@xopcai/xopc 0.0.40 → 0.0.41

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.
Files changed (34) hide show
  1. package/dist/extensions/telegram/xopc.extension.json +1 -1
  2. package/dist/gateway/static/root/assets/{agents-DcHp6W8S.js → agents-Cg_LGzbv.js} +2 -2
  3. package/dist/gateway/static/root/assets/{agents-DcHp6W8S.js.map → agents-Cg_LGzbv.js.map} +1 -1
  4. package/dist/gateway/static/root/assets/{apps-page-W9XwqSi7.js → apps-page-CW1VZ5L2.js} +2 -2
  5. package/dist/gateway/static/root/assets/{apps-page-W9XwqSi7.js.map → apps-page-CW1VZ5L2.js.map} +1 -1
  6. package/dist/gateway/static/root/assets/{channels-settings-m10wg_Lg.js → channels-settings-BDkP3YdO.js} +2 -2
  7. package/dist/gateway/static/root/assets/{channels-settings-m10wg_Lg.js.map → channels-settings-BDkP3YdO.js.map} +1 -1
  8. package/dist/gateway/static/root/assets/{cron-api-DIzlYLdG.js → cron-api-BF3i6fQ6.js} +2 -2
  9. package/dist/gateway/static/root/assets/{cron-api-DIzlYLdG.js.map → cron-api-BF3i6fQ6.js.map} +1 -1
  10. package/dist/gateway/static/root/assets/{cron-page-B5nTa2u4.js → cron-page-C82UvjSi.js} +2 -2
  11. package/dist/gateway/static/root/assets/{cron-page-B5nTa2u4.js.map → cron-page-C82UvjSi.js.map} +1 -1
  12. package/dist/gateway/static/root/assets/{dist-DL8vJx7B.js → dist-KXNTFU5L.js} +2 -2
  13. package/dist/gateway/static/root/assets/{dist-DL8vJx7B.js.map → dist-KXNTFU5L.js.map} +1 -1
  14. package/dist/gateway/static/root/assets/{extension-debug-page-DMkgbZXH.js → extension-debug-page-Cb1TVFq8.js} +2 -2
  15. package/dist/gateway/static/root/assets/{extension-debug-page-DMkgbZXH.js.map → extension-debug-page-Cb1TVFq8.js.map} +1 -1
  16. package/dist/gateway/static/root/assets/{extension-page-D5iyUHNi.js → extension-page-ClpFl3ym.js} +2 -2
  17. package/dist/gateway/static/root/assets/{extension-page-D5iyUHNi.js.map → extension-page-ClpFl3ym.js.map} +1 -1
  18. package/dist/gateway/static/root/assets/{extension-settings-page-DXYuT-Dq.js → extension-settings-page-AawKA54u.js} +2 -2
  19. package/dist/gateway/static/root/assets/{extension-settings-page-DXYuT-Dq.js.map → extension-settings-page-AawKA54u.js.map} +1 -1
  20. package/dist/gateway/static/root/assets/{index-Cir8fqd7.js → index-DFgsyQna.js} +5 -5
  21. package/dist/gateway/static/root/assets/{index-Cir8fqd7.js.map → index-DFgsyQna.js.map} +1 -1
  22. package/dist/gateway/static/root/assets/{logs-page-BuugMrI_.js → logs-page-DCH6aatp.js} +2 -2
  23. package/dist/gateway/static/root/assets/{logs-page-BuugMrI_.js.map → logs-page-DCH6aatp.js.map} +1 -1
  24. package/dist/gateway/static/root/assets/{sessions-page-CaRD3IvA.js → sessions-page-DgAIvstc.js} +2 -2
  25. package/dist/gateway/static/root/assets/{sessions-page-CaRD3IvA.js.map → sessions-page-DgAIvstc.js.map} +1 -1
  26. package/dist/gateway/static/root/assets/{settings-page-DYOSuaHt.js → settings-page-CyQrYfl-.js} +2 -2
  27. package/dist/gateway/static/root/assets/{settings-page-DYOSuaHt.js.map → settings-page-CyQrYfl-.js.map} +1 -1
  28. package/dist/gateway/static/root/assets/{skills-page-CN7HsYLQ.js → skills-page-BR5vm_QN.js} +2 -2
  29. package/dist/gateway/static/root/assets/{skills-page-CN7HsYLQ.js.map → skills-page-BR5vm_QN.js.map} +1 -1
  30. package/dist/gateway/static/root/assets/{use-image-provider-credentials-DPIDwada.js → use-image-provider-credentials-DGrrG5oe.js} +2 -2
  31. package/dist/gateway/static/root/assets/{use-image-provider-credentials-DPIDwada.js.map → use-image-provider-credentials-DGrrG5oe.js.map} +1 -1
  32. package/dist/gateway/static/root/index.html +1 -1
  33. package/dist/package.js +1 -1
  34. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-page-DYOSuaHt.js","assets/rolldown-runtime-DWdDZTNf.js","assets/cron-api-DIzlYLdG.js","assets/vendor-swr-DKvYJ-LI.js","assets/vendor-react-DbimaAId.js","assets/browser-DNXWYwzc.js","assets/agents-DcHp6W8S.js","assets/use-image-provider-credentials-DPIDwada.js","assets/sessions-page-CaRD3IvA.js","assets/logs-page-BuugMrI_.js","assets/cron-page-B5nTa2u4.js","assets/dist-DL8vJx7B.js","assets/skills-page-CN7HsYLQ.js","assets/vendor-codemirror-CXAvob9m.js","assets/attachment-preview-renderer-CebH7fCz.js","assets/excel-worksheet-utils-Dk66snKA.js","assets/attachment-process-heavy-Dbf1--O6.js","assets/channels-settings-m10wg_Lg.js","assets/apps-page-W9XwqSi7.js","assets/extension-page-D5iyUHNi.js","assets/extension-settings-page-DXYuT-Dq.js","assets/extension-debug-page-DMkgbZXH.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-page-CyQrYfl-.js","assets/rolldown-runtime-DWdDZTNf.js","assets/cron-api-BF3i6fQ6.js","assets/vendor-swr-DKvYJ-LI.js","assets/vendor-react-DbimaAId.js","assets/browser-DNXWYwzc.js","assets/agents-Cg_LGzbv.js","assets/use-image-provider-credentials-DGrrG5oe.js","assets/sessions-page-DgAIvstc.js","assets/logs-page-DCH6aatp.js","assets/cron-page-C82UvjSi.js","assets/dist-KXNTFU5L.js","assets/skills-page-BR5vm_QN.js","assets/vendor-codemirror-CXAvob9m.js","assets/attachment-preview-renderer-CebH7fCz.js","assets/excel-worksheet-utils-Dk66snKA.js","assets/attachment-process-heavy-Dbf1--O6.js","assets/channels-settings-BDkP3YdO.js","assets/apps-page-CW1VZ5L2.js","assets/extension-page-ClpFl3ym.js","assets/extension-settings-page-AawKA54u.js","assets/extension-debug-page-Cb1TVFq8.js"])))=>i.map(i=>d[i]);
2
2
  import{i as e,n as t,t as n}from"./rolldown-runtime-DWdDZTNf.js";import{i as r,n as i,r as a,t as o}from"./vendor-react-DbimaAId.js";import{a as s,i as c,n as l,o as u,t as d}from"./vendor-swr-DKvYJ-LI.js";import{Cn as f,Sn as p,_n as m,bn as h,cn as g,gn as _,hn as v,in as y,mn as b,on as x,pn as S,sn as C,un as w,vn as T,xn as E,yn as D}from"./vendor-codemirror-CXAvob9m.js";import{a as O,c as k,d as A,i as j,l as M,n as N,o as P,r as F,s as I,t as ee,u as te}from"./attachment-utils-core-Dt6UxMPV.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var L=e(r()),ne=i(),R=e=>typeof e==`string`,z=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},B=e=>e==null?``:String(e),re=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},V=/###/g,ie=e=>e&&e.includes(`###`)?e.replace(V,`.`):e,ae=e=>!e||R(e),oe=(e,t,n)=>{let r=R(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(ae(e))return{};let t=ie(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return ae(e)?{}:{obj:e,k:ie(r[i])}},se=(e,t,n)=>{let{obj:r,k:i}=oe(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=oe(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=oe(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},ce=(e,t,n,r)=>{let{obj:i,k:a}=oe(e,t,Object);i[a]=i[a]||[],i[a].push(n)},le=(e,t)=>{let{obj:n,k:r}=oe(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},ue=(e,t,n)=>{let r=le(e,n);return r===void 0?le(t,n):r},de=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?R(e[r])||e[r]instanceof String||R(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):de(e[r],t[r],n):e[r]=t[r]);return e},fe=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),H={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},pe=e=>R(e)?e.replace(/[&<>"'\/]/g,e=>H[e]):e,me=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},he=[` `,`,`,`?`,`!`,`;`],U=new me(20),ge=(e,t,n)=>{t||=``,n||=``;let r=he.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=U.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},W=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},_e=e=>e?.replace(/_/g,`-`),ve={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},ye=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ve,this.options=t,this.debug=t.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,t,n,r){return r&&!this.debug?null:(e=e.map(e=>R(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),R(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},be=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},xe=class extends be{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):R(n)&&i?o.push(...n.split(i)):o.push(n)));let s=le(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!R(n)?s:W(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),se(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(R(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=le(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?de(s,n,i):s={...s,...n},se(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Se={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Ce=Symbol(`i18next/PATH_KEY`);function we(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Ce?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Te(e,t){let{[Ce]:n}=e(we()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Ee=e=>!R(e)&&typeof e!=`boolean`&&typeof e!=`number`,De=class e extends be{constructor(e,t={}){super(),re([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=ye.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Ee(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ge(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:R(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:R(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Te(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Te(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!R(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Ee(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(R(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:Ee(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&R(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.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 e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=R(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!R(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=R(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Se.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return R(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Te(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!R(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(R(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" 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!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!R(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},Oe=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ye.create(`languageUtils`)}getScriptPartFromCode(e){if(e=_e(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=_e(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(R(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(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.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),R(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return R(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):R(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},ke={zero:0,one:1,two:2,few:3,many:4,other:5},Ae={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},je=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ye.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=_e(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Ae;if(!e.match(/-|_/))return Ae;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>ke[e]-ke[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Me=(e,t,n,r=`.`,i=!0)=>{let a=ue(e,t,n);return!a&&i&&R(n)&&(a=W(e,n,r),a===void 0&&(a=W(t,n,r))),a},Ne=e=>e.replace(/\$/g,`$$$$`),Pe=class{constructor(e={}){this.logger=ye.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?pe:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?fe(i):a||`{{`,this.suffix=o?fe(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?fe(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?fe(l):``,this.nestingPrefix=d?fe(d):f||fe(`$t(`),this.nestingSuffix=p?fe(p):m||fe(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`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,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Me(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Me(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ne(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ne(this.escape(e)):Ne(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=R(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else !R(a)&&!this.useRawValueToEscape&&(a=B(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${fe(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!R(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!R(i))return i;R(i)||(i=B(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Fe=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Ie=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(_e(r),i),t[o]=s),s(n)}},Le=e=>(t,n,r)=>e(_e(n),r)(t),Re=class{constructor(e={}){this.logger=ye.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Ie:Le;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ie(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&!i[0].includes(`)`)&&i.find(e=>e.includes(`)`))){let e=i.findIndex(e=>e.includes(`)`));i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Fe(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},ze=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Be=class extends be{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=ye.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?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{ce(n.loaded,[i],a),ze(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();R(e)&&(e=this.languageUtils.toResolveHierarchy(e)),R(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},Ve=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,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:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),R(e[1])&&(t.defaultValue=e[1]),R(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),He=e=>(R(e.ns)&&(e.ns=[e.ns]),R(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),R(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),Ue=()=>{},We=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Ge=class e extends be{constructor(e={},t){if(super(),this.options=He(e),this.services={},this.logger=ye,this.modules={external:[]},We(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(R(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Ve();this.options={...n,...this.options,...He(e)},this.options.interpolation={...n.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=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?ye.init(r(this.modules.logger),this.options):ye.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Re;let t=new Oe(this.options);this.store=new xe(this.options.resources,this.options);let n=this.services;n.logger=ye,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new je(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new Pe(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Be(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new De(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=Ue,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[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(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=z(),a=()=>{let e=(e,n)=>{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),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=Ue){let n=t,r=R(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=z();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=Ue,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw 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`&&Se.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`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=z();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=R(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(R(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};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),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=Te(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=Te(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=Te(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return R(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=z();return this.options.ns?(R(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=z();R(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`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`.split(`.`),n=this.services?.languageUtils||new Oe(Ve());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Ue){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new xe(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Ve().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Pe(n)}return a.translator=new De(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Ge.createInstance,Ge.dir,Ge.init,Ge.loadResources,Ge.reloadResources,Ge.use,Ge.changeLanguage,Ge.getFixedT,Ge.t,Ge.exists,Ge.setDefaultNamespace,Ge.hasLoadedNamespace,Ge.loadNamespaces,Ge.loadLanguages;var Ke=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);$e(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},qe={},Je=(e,t,n,r)=>{$e(n)&&qe[n]||($e(n)&&(qe[n]=new Date),Ke(e,t,n,r))},Ye=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Xe=(e,t,n)=>{e.loadNamespaces(t,Ye(e,n))},Ze=(e,t,n,r)=>{if($e(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Xe(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Ye(e,r))},Qe=(e,t,n={})=>!t.languages||!t.languages.length?(Je(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),$e=e=>typeof e==`string`,et=e=>typeof e==`object`&&!!e,tt=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,nt={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},rt=e=>nt[e],it={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:e=>e.replace(tt,rt),transDefaultProps:void 0},at=(e={})=>{it={...it,...e}},ot=()=>it,st,ct=e=>{st=e},lt=()=>st,ut={type:`3rdParty`,init(e){at(e.options.react),ct(e)}},dt=(0,L.createContext)(),eee=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}},tee=u(),nee={t:(e,t)=>{if($e(t))return t;if(et(t)&&$e(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},ft=()=>()=>{},pt=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,L.useContext)(dt)||{},a=n||r||lt();a&&!a.reportNamespaces&&(a.reportNamespaces=new eee),a||Je(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,L.useMemo)(()=>({...ot(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=$e(l)?[l]:l||[`translation`],d=(0,L.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,L.useRef)(0),p=(0,L.useCallback)(e=>{if(!a)return ft;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,L.useRef)(),h=(0,L.useCallback)(()=>{if(!a)return nee;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>Qe(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,L.useState)(0),{t:v,ready:y}=(0,tee.useSyncExternalStore)(p,h,h);(0,L.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?Ze(a,t.lng,d,e):Xe(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,L.useRef)(null),S=(0,L.useRef)(),C=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,`__original`,{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},w=(0,L.useMemo)(()=>{let e=b,t=e?.language,n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=C(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(Je(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y)throw new Promise(e=>{let n=()=>e();t.lng?Ze(a,t.lng,d,n):Xe(a,d,n)});return w};function ree({i18n:e,defaultNS:t,children:n}){let r=(0,L.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,L.createElement)(dt.Provider,{value:r},n)}function iee(e){let t=(e??``).trim().toLowerCase().replace(/_/g,`-`);return!t||t===`en`||t.startsWith(`en-`)?`en`:`zh`}function mt(){if(typeof navigator>`u`)return`en`;let e=(navigator.language||navigator.languages?.[0]||``).trim();return e?iee(e):`en`}function ht(e){return e===`zh`?`zh-CN`:`en`}var gt=`xopc.token`,_t=`xopc.language`;function vt(){try{return localStorage.getItem(gt)||``}catch{return``}}function yt(e){try{localStorage.setItem(gt,e)}catch(e){console.error(`Failed to save token:`,e)}}function bt(){try{localStorage.removeItem(gt)}catch(e){console.error(`Failed to clear token:`,e)}}function xt(){try{let e=localStorage.getItem(_t);return e===`en`||e===`zh`?e:mt()}catch{return mt()}}function St(e){try{localStorage.setItem(_t,e)}catch(e){console.error(`Failed to save language:`,e)}}var Ct={agentSettings:JSON.parse('{"subtitle":"Defaults for models, workspace, sampling, and how responses are shown.","sectionDesc":"Changes are written to your gateway config file. Some values apply on the next agent turn or session.","needToken":"Save a gateway token to load and change agent defaults.","loadError":"Failed to load settings","save":"Save","discard":"Discard","saving":"Saving…","saved":"Saved","saveError":"Failed to save","routeIntro":{"chat":"Primary model, sampling, and how replies appear. Saves to agents.defaults on the gateway.","workspace":"Working directory for agent files and limits for inbound images in the image tool.","browser":"Playwright browser_* tools: enablement, headless mode, timeouts, and local or cloud backends.","runtime":"Per-turn limits, context compaction, tool-result pruning, memory, session_search summaries, and background review.","tools":"Optional tools (web_extract, delegate_task, execute_code), global tool disables, skill allowlist, and extension params JSON.","systemPrompt":"Optional full replacement for the default system prompt; merges with per-agent entries (entry wins). Saves to agents.defaults."},"cardModelsTitle":"Models","cardModelsSubtitle":"Chat, vision, and image generation defaults","cardWorkspaceTitle":"Workspace & attachments","cardWorkspaceSubtitle":"Working directory and inbound media limits","cardBrowserTitle":"Browser automation","cardBrowserSubtitle":"Playwright tools — navigate, snapshot, click, console, vision, and more","browserEnabledOn":"Enable browser tools","browserHeadlessOn":"Run headless (no visible window)","browserAllowPrivateOn":"Allow private/internal URLs","browserDialogPolicyMustRespond":"Agent must respond","browserDialogPolicyAutoDismiss":"Auto dismiss","browserDialogPolicyAutoAccept":"Auto accept","browserCloudProviderLocal":"Local (Playwright)","browserCloudProviderBrowserbase":"Browserbase","browserCloudProviderBrowserUse":"Browser Use","cardGenerationTitle":"Sampling & tools","cardGenerationSubtitle":"Token budget, randomness, and tool loop depth","cardBehaviorTitle":"Reasoning & output","cardBehaviorSubtitle":"Thinking depth, traces, and verbosity","label":{"model":"Model","modelFallbacks":"Fallback models","imageModel":"Image model","imageModelFallbacks":"Image understanding fallbacks","imageGenerationModel":"Image generation model","imageGenerationModelFallbacks":"Image generation fallbacks","mediaMaxMb":"Image load limit (MB)","workspace":"Workspace","browserEnabled":"Browser tools","browserHeadless":"Headless mode","browserAllowPrivateUrls":"Allow private URLs","browserCommandTimeout":"Command timeout (s)","browserCloudProvider":"Browser backend","browserCdpUrl":"CDP endpoint URL","browserDialogPolicy":"Dialog handling policy","browserDialogTimeout":"Dialog timeout (s)","maxTokens":"Max tokens","temperature":"Temperature","maxToolIterations":"Max tool iterations","thinkingDefault":"Thinking level","reasoningDefault":"Reasoning visibility","verboseDefault":"Verbose mode"},"desc":{"model":"Default model for new sessions.","modelFallbacks":"Tried in order when the primary model returns an error after transient retries. Requires API keys for each provider.","imageModel":"Optional. Used for image understanding / vision. Only models the gateway marks as accepting image input are listed.","imageModelFallbacks":"Tried in order when the primary vision model fails. Only models flagged as image-capable are listed.","imageGenerationModel":"Optional. For image_generate. Only providers the gateway reports as configured (API keys present) are listed.","imageGenerationModelFallbacks":"Tried in order when the primary image generation model fails. Only configured image-generation providers are listed.","mediaMaxMb":"Max size when loading images in the image tool.","workspace":"Working directory for agent files.","browserEnabled":"Exposes Playwright browser_* tools to the model. Install Chromium once on the gateway host: npx playwright install chromium.","browserHeadless":"When off, Chromium shows a window on the gateway machine (useful for debugging). When on, runs in the background.","browserAllowPrivateUrls":"Skip private-IP blocking for navigation. Cloud metadata endpoints (169.254.169.254, etc.) are always blocked regardless.","browserCommandTimeout":"Max seconds per browser command (navigate, click, etc.). Default 30.","browserCloudProvider":"Browser backend: local Playwright, Browserbase cloud, or Browser Use cloud. Cloud providers require API keys in environment.","browserCdpUrl":"Direct Chrome DevTools Protocol WebSocket endpoint (e.g. ws://localhost:9222). Bypasses cloud provider when set.","browserDialogPolicy":"How JS dialogs (alert/confirm/prompt) are handled: agent must respond, auto dismiss, or auto accept.","browserDialogTimeout":"Seconds before an unhandled dialog is auto-dismissed/accepted (only for auto policies). Default 300.","maxTokens":"Maximum tokens in the model response.","temperature":"Randomness (0–2).","maxToolIterations":"Maximum tool calls per user message.","thinkingDefault":"Default thinking level for new sessions.","reasoningDefault":"Whether to surface model reasoning in the chat UI. Per-session overrides (e.g. /reasoning) take precedence until cleared.","verboseDefault":"Agent verbosity for logs/tool detail elsewhere — not the reasoning/thinking panel. Use Reasoning visibility to hide reasoning."},"addModelFallback":"Add fallback model","removeModelFallback":"Remove fallback model","visionRegistryEmpty":"No models flagged as image-capable for your configured providers. Add `input` including \\"image\\" in models.json, or pick a provider model that exposes image input.","visionOutOfFilterNote":"Registry does not mark this model as image-capable; choose a vision model when possible.","imageGenRegistryEmpty":"No image generation providers are configured with API credentials. Add keys for a provider (e.g. OpenAI) in config or environment, then refresh.","imageGenOutOfFilterNote":"This model’s provider is not configured with credentials; image_generate will fail until you configure it or pick a configured provider.","reasoning":{"off":"Off","on":"On","stream":"Stream"},"verbose":{"off":"Off","on":"On","full":"Full"},"advanced":{"cardLimitsTitle":"Turn limits & reliability","cardLimitsSubtitle":"Wall-clock cap per user turn, request retries, and tool failure budget.","maxTaskDurationMs":"Max task duration (minutes)","maxTaskDurationMsDesc":"Per-user-turn wall time for LLM and tools. Leave empty to use the server default. Range 1–240 min (1 min–4 h).","maxTaskDurationPlaceholder":"e.g. 30 (empty = default)","maxRequestsPerTurn":"Max requests per turn","maxRequestsPerTurnDesc":"LLM request attempts per user message (reliability; default 50).","maxToolFailuresPerTurn":"Max tool failures per turn","maxToolFailuresPerTurnDesc":"Consecutive tool errors before giving up (default 3).","cardCompactionTitle":"Context compaction","cardCompactionSubtitle":"When to compact older context to stay within the model window.","compactionEnabled":"Enable compaction","compactionEnabledDesc":"When off, the runtime skips compaction (may use more context).","compactionEnabledOn":"Compaction on","compactionMode":"Mode","compactionModeDesc":"default: standard strategy; safeguard: stricter heuristics when enabled.","compactionModeDefault":"default","compactionModeSafeguard":"safeguard","reserveTokens":"Reserve tokens","reserveTokensDesc":"Headroom to leave after compaction (default 8000).","triggerThreshold":"Trigger threshold","triggerThresholdDesc":"Fraction of context that triggers compaction (0.5–0.95).","minMessagesBeforeCompact":"Min messages before compact","minMessagesBeforeCompactDesc":"Message count before compaction can run (default 10).","keepRecentMessages":"Keep recent messages","keepRecentMessagesDesc":"Recent turns always kept near the tail (default 5).","evictionWindow":"Eviction window","evictionWindowDesc":"Portion of history eligible for summary-first eviction (0.1–0.5).","retentionWindow":"Retention window","retentionWindowDesc":"Recent turns in the retention band (3–20).","cardPruningTitle":"Tool result pruning","cardPruningSubtitle":"Trim oversized tool results before the model sees them.","pruningEnabled":"Enable pruning","pruningEnabledDesc":"When off, full tool output may be sent to the model (higher cost).","pruningEnabledOn":"Pruning on","maxToolResultChars":"Max tool result characters","maxToolResultCharsDesc":"Default cap for a single tool result string (default 10000).","headKeepRatio":"Head keep ratio","headKeepRatioDesc":"Fraction kept from the start when pruning (0–1, default 0.3).","tailKeepRatio":"Tail keep ratio","tailKeepRatioDesc":"Fraction kept from the end (0–1, default 0.3).","cardMemoryTitle":"Memory (curated & external)","cardMemorySubtitle":"System memory, USER.md, and optional provider hooks.","memoryEnabled":"Memory features","memoryEnabledDesc":"Master switch: curated memory snapshot, tool, and external prefetch (when set).","memoryEnabledOn":"Enabled","useEnhancedSystem":"Use enhanced system","useEnhancedSystemDesc":"When off, use workspace bootstrap only (no extra memory snapshot in system).","useEnhancedSystemOn":"Enhanced system on","userProfileEnabled":"Include USER.md","userProfileEnabledDesc":"Add USER.md to the memory snapshot when present.","userProfileEnabledOn":"Include user profile","memoryProvider":"External memory provider","memoryProviderDesc":"none/stub, or leave unset to omit.","memoryProviderUnset":"(unset)","injectionFrequency":"External prefetch injection","injectionFrequencyDesc":"How often to inject prefetched memory into the user message context.","injectionFrequencyUnset":"(unset)","injectionEveryTurn":"Every turn (with cadence)","injectionFirstTurn":"First turn only","memoryCharLimit":"Memory character limit","memoryCharLimitDesc":"Max chars for the curated memory snapshot (optional).","userCharLimit":"User profile char limit","userCharLimitDesc":"Max chars for USER.md section (optional).","contextCadence":"Context cadence","contextCadenceDesc":"When using every turn: inject on turns 1, 1+N, … (min 1).","dialecticCadence":"Dialectic cadence (reserved)","dialecticCadenceDesc":"Reserved; not yet wired. Min 1 when set.","cardSessionSearchTitle":"Session search (transcripts)","cardSessionSearchSubtitle":"Model used to summarize past sessions for the session_search tool.","sessionSearchSummaryModel":"Summary model","sessionSearchSummaryModelDesc":"e.g. openai/gpt-4o-mini. Leave empty to use runtime defaults.","cardReviewTitle":"Background review","cardReviewSubtitle":"Post-turn nudges for memory/skills. Opt-in: enable below.","reviewEnabled":"Enable background review","reviewEnabledDesc":"When on, a quiet follow-up may run after successful turns.","reviewEnabledOn":"Enable","memoryNudgeInterval":"Memory nudge (every N user turns)","memoryNudgeIntervalDesc":"0 disables the memory channel. Default 10.","skillNudgeInterval":"Skill nudge (rounds without skill_manage)","skillNudgeIntervalDesc":"0 disables the skill channel. Default 10.","reviewMaxToolRounds":"Review max tool rounds","reviewMaxToolRoundsDesc":"1–32 (default 8).","reviewMaxHistoryMessages":"Max history in review (messages, tail)","reviewMaxHistoryMessagesDesc":"10–200 (default 80).","reviewMaxDurationMs":"Review time limit (seconds)","reviewMaxDurationMsDesc":"Wall clock for the review run (30–600 s; default 120).","cardWebExtractTitle":"web_extract (LLM pass)","cardWebExtractSubtitle":"Optional model and length for markdown web extraction.","webExtractModel":"Model","webExtractModelDesc":"Leave empty to use the default provider/model for extraction.","webExtractMaxLength":"Max length","webExtractMaxLengthDesc":"Max extracted characters (optional).","cardDelegateTitle":"Sub-agents & code execution","cardDelegateSubtitle":"Opt-in: delegate_task and sandboxed execute_code.","delegateEnabled":"Sub-agent delegate_task","delegateEnabledDesc":"When on, the agent may delegate to sub-agent runs (if supported).","delegateEnabledOn":"Enabled","executeCodeEnabled":"execute_code (sandboxed)","executeCodeEnabledDesc":"When on, the sandboxed code tool is available (if the runtime allows).","executeCodeEnabledOn":"Enabled","cardSystemPromptTitle":"System prompt","cardSystemPromptSubtitle":"Optional override of the default system context. Merged with per-agent values; entry-specific settings win.","cardSkillsTitle":"Skill allowlist","cardSkillsSubtitle":"When non-empty, only these skills appear in <available_skills> in the prompt.","systemPromptOverride":"System prompt override","systemPromptOverrideDesc":"Optional full replacement; merged with per-agent entry (entry wins). Leave empty to clear.","systemPromptPlaceholder":"","skillsAllowlist":"Skill name allowlist","skillsAllowlistDesc":"When set, only checked skills appear in <available_skills>. Use All skills for no filter, or Only selected to pick from the catalog (including entries not currently listed).","skillsAllowlistModeAll":"All skills","skillsAllowlistModeRestrict":"Only selected","skillsAllowlistNotInCatalog":"not in catalog","addSkillName":"Add skill name","removeListItem":"Remove row","cardToolsDisableTitle":"Tools — global disable","cardToolsDisableSubtitle":"Disable built-in tool names in agents.defaults (e.g. shell, web_search).","toolsDisableFieldLabel":"Built-in tools","toolsDisableHint":"Checked tools are available to the default agent; unchecked tools are blocked. Per-agent overrides in Agents still apply.","toolsDisableLoadingBuiltin":"Loading built-in tool list…","toolsDisableEmptyBuiltin":"No built-in tools returned by the gateway.","toolsDisableNotInBuiltin":"not in built-in list","toolsDisableQuickActionsLabel":"Quick actions","toolsDisableQuickEnableAll":"Enable all","toolsDisableQuickDisableAll":"Disable all","toolsDisableQuickReadOnlyWorkspace":"Read-only workspace","toolsDisableQuickHighRiskOff":"Block high-risk","toolsDisableQuickNoOutbound":"No outbound","addToolName":"Add tool name","cardParamsTitle":"Params (JSON)","cardParamsSubtitle":"Opaque key/value for extensions. Must be a JSON object.","paramsJson":"Params object","paramsJsonDesc":"e.g. {\\"myFlag\\": true}. Clear to remove params from the config file.","paramsInvalidJson":"Params must be valid JSON object (e.g. empty or {}). Check syntax."}}'),agentsSettings:JSON.parse(`{"title":"Agents","subtitle":"Manage agents.list entries: workspaces, default routing, persona bootstrap files.","needToken":"Save a gateway token to manage agents.","loadError":"Failed to load agents","saveError":"Request failed","loading":"Loading…","tabOverview":"Agents","tabDefaults":"Defaults","tabFiles":"Bootstrap files","tabTools":"Tools","tabSkills":"Skills","tabChannels":"Channels","tabCron":"Cron","selectAgent":"Agent","selectAgentHint":"Choose an entry to edit or inspect bootstrap Markdown under ~/.xopc/agents/<id>/bootstrap/.","agent":"Agent","defaultBadge":"default","setDefault":"Set as default","editAgent":"Edit entry","editAgentHint":"Updates agents.list on the gateway. Paths are expanded (~ → home).","displayName":"Display name","agentDescription":"Description","agentDescriptionPlaceholder":"Short summary shown on agent cards and in pickers (optional).","workspacePath":"Markdown workspace","modelPrimary":"Model (primary)","modelClear":"Clear","save":"Save","discard":"Discard","removeFromConfig":"Remove from config","purgeDisk":"Remove + delete data","addAgent":"Add agent","addAgentHint":"Same as CLI agents add: creates directories and seeds bootstrap templates.","newAgentLabel":"Display name","newAgentIdOptional":"Agent ID (optional)","newAgentIdPlaceholder":"Leave empty to derive from display name","newAgentIdRules":"1–64 characters: letters, digits, underscores, hyphens; must start with a letter or digit. Avoid reserved ids (e.g. main, con).","newWorkspace":"Workspace directory (required)","newModelOptional":"Model (optional)","create":"Create agent","addAgentAria":"Add agent","createModalCancel":"Cancel","closeDialogAria":"Close","filesHint":"Editable persona files (SOUL, IDENTITY, …). Changes save automatically after you stop typing; use Preview to render Markdown.","filesLoading":"Loading file list…","filesEmpty":"No files yet.","pickFile":"Select a file to edit.","saveFile":"Save file","filesBootstrapEdit":"Edit","filesBootstrapPreview":"Preview","filesAutoSaveHint":"Auto-saves when you pause typing.","filesSavingStatus":"Saving…","missing":"missing","confirmDelete":"Remove this agent from config? Bindings referencing it will be stripped.","confirmDeletePurge":"Remove this agent and delete its workspace + ~/.xopc/agents/<id> data? This cannot be undone.","purgeConfirmLabel":"Type the agent id to confirm","purgeConfirmPlaceholder":"Type {{agentId}} to confirm","purgeConfirmHint":"This action is irreversible. Enter {{agentId}} exactly to enable deletion.","toolsTitle":"Built-in tools","toolsHint":"Per-agent tool disables (merged with agents.defaults). Tools already disabled in defaults cannot be re-enabled here.","toolsSave":"Save tool disables","toolsClearEntry":"Clear per-agent disables","toolsLockedByDefaults":"disabled in defaults","toolsDisableGroups":{"unknown":"Custom ids (not in built-in list)","workspace":"Workspace & search","execution":"Execution","web":"Web","messaging":"Channels & outbound","memory":"Memory & sessions","media":"Vision & generation","extensions":"Extensions","misc":"Other built-ins"},"toolDescriptions":{"read_file":"Read text and small files inside the agent workspace (paths are restricted to the workspace sandbox).","write_file":"Create new files or overwrite existing ones under the workspace.","edit_file":"Change existing files using locate-and-replace or patch-style edits.","list_dir":"List files and subfolders in a workspace directory.","grep":"Search file contents with regular expressions (similar to ripgrep).","find":"Find files by name or glob pattern under the workspace.","shell":"Run shell commands with workspace context — high impact; turn off for read-only or safer agents.","web_search":"Search the public web for facts and pages newer than the model may know.","web_fetch":"Fetch a URL and read its text content for the model.","send_message":"Send outbound chat messages on connected channels (e.g. Telegram, CLI, gateway) when the agent replies.","send_media":"Send images or other media attachments through those channels.","memory_search":"Search indexed memories and notes stored for this agent.","memory_get":"Load a specific memory entry or chunk by id.","curated_memory":"Read or update curated markdown memories under the agent home directory.","session_search":"Search across saved conversation transcripts and per-session summaries.","image":"Analyze or describe images (vision) from the workspace or the current turn.","image_generate":"Generate images using the configured image / image-generation model.","extensions":"Expose tools registered by enabled extensions — disable to block all extension tools."},"skillsTitle":"Skill allowlist","skillsHint":"Optional allowlist for <available_skills>. Inherit uses agents.defaults only; customize sets this agent’s skills array.","skillsInherit":"Inherit defaults","skillsCustomize":"Customize allowlist","skillsSave":"Save skills","skillsCatalogLoading":"Loading skill catalog…","skillsEmptyCatalog":"No skills in catalog.","skillsNoDescription":"No description in SKILL.md metadata.","skillsDefaultsLabel":"Defaults allowlist:","skillsEffectiveLabel":"Effective allowlist:","skillsAllFromCatalog":"(all catalog skills)","channelsTitle":"Routing bindings","channelsHint":"config.bindings rows for this agent. Removing a rule updates the full bindings array on the gateway.","channelsLoading":"Loading bindings…","channelsNone":"No bindings target this agent.","channelLabel":"Channel","peerIdLabel":"Peer id (optional)","channelsLoadingChannels":"Loading channel list…","channelsManualChannelHint":"Gateway returned no channel list. Enter a channel id (e.g. telegram, webchat, gateway).","channelsDisabledSuffix":"(disabled)","channelsSessionLabel":"Match","channelsRefreshSessions":"Refresh","channelsRefreshSessionsHint":"Reload recent sessions for this channel","channelsLoadingSessions":"Loading sessions…","channelsPeerFromSessions":"From sessions","channelsPeerAny":"All traffic on this channel","channelsNoSessionsHint":"No session history for this channel yet. Send a message or enter a custom peer id below.","channelsCustomPeerHint":"If set, overrides the session picker. Supports * globs; see session routing docs.","channelsCustomPeerPlaceholder":"e.g. 12345 or *","addBinding":"Add binding","removeBinding":"Remove","cronTitle":"Scheduled jobs","cronHint":"Isolated cron jobs can pin an agent id for the session key. Jobs without an agent id use the default agent and appear when that agent is selected.","cronLoading":"Loading cron jobs…","cronNone":"No matching jobs.","cronColSchedule":"Schedule","cronColMessage":"Message","cronColSession":"Session","cronColAgent":"Agent","cronAgentDefault":"Default agent","cronAgentClear":"Reset to default","navIdentity":"Identity","navProfile":"About You","navPersona":"Persona","navTools":"Tools","navSkills":"Skills","navCoreFiles":"Core files","navAdvanced":"Advanced","listSearchPlaceholder":"Search by name, id, or workspace","listEmpty":"No agents match your search.","listNoAgentsYet":"No agents yet. Create one to get started.","listNewAgentCard":"New agent","listChatWithAgent":"Chat","defaultMainAgentName":"Smart Assistant","defaultMainAgentDescription":"Your personal intelligent assistant for answering questions, handling everyday tasks, and chatting with you anytime.","editorNavAria":"Agent editor sections","skillsLibraryLink":"Skill library","personaHint":"Set up your agent's identity and personality with a friendly form. For advanced editing, use Core files.","personaSectionIdentity":"Agent Identity","personaSectionIdentityHint":"How your agent presents itself","personaSectionUser":"About You","personaSectionUserHint":"Help your agent know you better","personaSectionSoul":"Personality & Style","personaSectionSoulHint":"Define how your agent communicates","personaName":"Name","personaNamePlaceholder":"e.g. Aria, Nova, Kai…","personaCreature":"Type","personaCreaturePlaceholder":"Custom type…","personaVibe":"Vibe","personaVibePlaceholder":"Custom vibe…","personaEmoji":"Emoji","personaEmojiPlaceholder":"e.g. 🤖 ✨ 🧠","personaAvatar":"Avatar","personaAvatarPlaceholder":"URL or workspace path","avatarPickerTitle":"Agent avatar","avatarOpenSettingsAria":"Open agent avatar settings","avatarRowHint":"Pick a style or upload a custom image.","avatarUploadCustom":"Upload custom image","avatarStyleAdventurer":"Adventurer","avatarStyleRobot":"Robot","avatarStyleLorelei":"Lorelei","avatarStyleThumbs":"Thumbs","avatarStyleFunEmoji":"Fun Emoji","avatarMore":"More","avatarUploading":"Uploading…","avatarUploadFailed":"Upload failed. Try a smaller PNG, JPEG, or WebP.","avatarInvalidImage":"Use a PNG, JPEG, or WebP image.","avatarTooLarge":"Image must be at most 512 KB.","personaCallName":"What to call you","personaCallNamePlaceholder":"e.g. Michael","personaPronouns":"Pronouns","personaPronounsPlaceholder":"e.g. he/him, she/her, they/them","personaTimezone":"Timezone","personaTimezoneDetect":"Detect","personaTimezoneCustom":"Custom timezone…","personaNotes":"Notes","personaNotesPlaceholder":"Anything else your agent should know about you…","personaSoulTemplate":"Personality template","personaSoulCustomEdit":"Edit personality (Markdown)","personaSoulPreview":"Preview","personaSoulEdit":"Edit","personaMemoryNote":"Your agent will automatically remember preferences you share in conversation (like favorite foods or habits). No need to add those here.","personaSaving":"Saving…","personaSaved":"Saved","footerSaveNotApplicable":"Use actions in this section; the bar Save applies to Identity, Tools, Skills, and Core files.","presetSetupBadge":"Quick Setup","presetSetupTitle":"Get Started with Preset Agents","presetSetupSubtitle":"Choose agents to create. Each comes with a tailored personality and workspace. You can customize them later.","presetSkip":"Skip for now","presetCreateSelected":"Create {{count}} Agent(s)","presetCreating":"Creating…","presetCreatingProgress":"Creating agent {{current}} of {{total}}…","presetSetupComplete":"Agents created successfully!","presetCreateFailed":"Failed to create {{name}}: {{message}}"}`)},wt={appsPage:{title:`Apps`,subtitle:`Marketplace, built-ins shipped with xopc, and extensions under ~/.xopc/extensions or your workspace. URL: ?tab=marketplace | builtin | user.`,tabMarketplace:`Marketplace`,tabBuiltin:`Built-in`,tabUser:`Installed`,appsNavAria:`Apps sections`,emptyBuiltin:`No built-in extensions were discovered by the gateway (check gateway logs and dist/extensions manifests).`,emptyUser:`No global or workspace extensions found. Install under ~/.xopc/extensions or workspace/.extensions.`,searchPlaceholder:`Search apps`,noSearchResults:`No apps match your filters.`,statusEnabled:`Enabled`,cardNoDescription:`No description in manifest.`,badgeKindUi:`UI`,badgeKindBackend:`Backend`,badgeBundled:`Built-in`,cardTooltipHasUi:`Declares Gateway console UI (pages or settings).`,cardTooltipNoUi:`No Gateway UI; may still expose tools, hooks, or channels.`,badgeSourceGlobal:`Global`,badgeSourceWorkspace:`Workspace`,badgeSourceOther:`Other`,detailTitle:`App details`,detailBack:`Back`,detailClose:`Close`,detailProviderPrefix:`Source:`,providerBundled:`Built-in (shipped with xopc)`,providerGlobal:`Global install (~/.xopc/extensions)`,providerWorkspace:`Workspace (.extensions)`,providerOther:`Other`,detailSectionFeatures:`Capabilities`,detailNoDescription:`No description was provided for this extension.`,restartNote:`Some extension changes require restarting the gateway for code to fully load.`,cliManageHint:`This copy is not bundled with xopc — install, remove, and upgrades are done via the CLI or filesystem.`,builtinConfigHint:`Channels and image keys are managed under Settings → Channels and Settings → Images. Built-in enable/disable in config is not shown here until it matches runtime behavior.`,backendOnlyHint:`This extension has no Gateway UI; tools and hooks still run when enabled.`,badgePages:`{{count}} page(s)`,badgeSettings:`{{count}} settings`,badgeWidgets:`{{count}} widget(s)`,badgeSidebar:`{{count}} sidebar`,open:`Open`,openSettings:`Settings`,runStateLive:`Running`,runStatePendingOn:`Enabled in config`,runStatePendingOff:`Disabled in config`,runStateOff:`Off`},extensionUi:{permissionTitle:`Allow “{{name}}”?`,permissionSubtitle:`This extension may use the following capabilities while its UI is open.`,permissionsNone:`No additional permissions are declared in the manifest.`,allow:`Allow`,deny:`Not now`,deniedHint:`The extension UI stays hidden until you approve it for this browser.`,reviewPermissions:`Review permissions`,loadFailed:`The extension panel failed to load.`,loadFailedConnectionHint:`If the frame shows “connection refused”, start the xopc gateway (and if you use Vite for web/, match the proxy target in web/vite.config.ts).`,retryLoad:`Reload panel`},extensionDebug:{nav:`Extension debug`,title:`Extension debug`,subtitle:`Inspect discovered extensions, declared permissions, and browser UI approval state.`,grantsHeading:`UI approval storage`,grantsHint:"Key `xopc.extensionUiGrants.v1` in localStorage — fingerprints of permission lists you approved per extension.",refresh:`Refresh`,listHeading:`Extensions from gateway`,colId:`Id`,colName:`Name`,colPermissions:`Manifest permissions`,futureHeading:`Coming later`,futureBody:`PostMessage capture, per-extension storage preview, and live permission overrides are planned for a future iteration.`}},Tt={channelsSettings:{needToken:`Save a gateway token to edit channel settings.`,subtitle:`Telegram, Weixin, Feishu, and DingTalk inbound channels. Changes are written to the gateway config file.`,docsLink:`Channel documentation`,refresh:`Refresh`,loadError:`Failed to load channel settings`,loading:`Loading…`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved`,saveError:`Failed to save`,retry:`Retry`,unsavedHint:`You have unsaved changes.`,hubConfigureButton:`Configure`,hubConnectedBadge:`Connected`,enableChannelAria:`Enable or disable this channel`,menuMoreAria:`More actions`,menuEditConfig:`Edit configuration`,menuRemoveConfig:`Remove configuration`,removeChannelTitle:`Remove configuration?`,removeChannelConfirm:`Remove {{name}} settings and clear saved credentials on the gateway? You can configure again later.`,removeChannelAction:`Remove`,modalCancel:`Cancel`,telegramTitle:`Telegram`,telegramSubtitle:`Bot token, allowlists, and optional multi-account JSON.`,weixinTitle:`Weixin`,weixinSubtitle:`Sign in with WeChat via QR (browser or CLI), then enable below. Credentials stay on the gateway host.`,feishuTitle:`Feishu/Lark`,feishuSubtitle:`Feishu app credentials, policies, and optional multi-account JSON.`,dingtalkTitle:`DingTalk`,dingtalkSubtitle:`DingTalk app credentials (Stream robot), policies, and optional multi-account JSON.`,enableTelegramAria:`Enable Telegram channel`,enableWeixinAria:`Enable Weixin channel`,enableFeishuAria:`Enable Feishu channel`,enableDingtalkAria:`Enable DingTalk channel`,telegramToken:`Bot token`,telegramTokenDesc:`From BotFather. Stored in the gateway config.`,feishuAppId:`App ID`,feishuAppIdDesc:`From Feishu developer console (cli_xxx). Stored in the gateway config.`,feishuAppSecret:`App secret`,feishuAppSecretDesc:`From Feishu developer console. Stored in the gateway config.`,feishuDomain:`Domain`,connectionMode:`Connection mode`,connectionModeDesc:`websocket: Socket Mode. webhook: local HTTP server receives events.`,renderMode:`Render mode`,enableStreaming:`Enable streaming`,requireMention:`Require @mention in groups`,reactionNotifications:`Reaction notifications`,allowFromDm:`Allow from (DM)`,allowFromDmDesc:`Comma-separated user IDs allowed to DM the bot (when policy uses allowlist).`,advancedShow:`Advanced options`,advancedHide:`Hide advanced options`,apiRoot:`API root`,proxy:`Proxy`,dmPolicy:`DM policy`,groupPolicy:`Group policy`,replyToMode:`Reply-to mode`,streamMode:`Stream mode`,allowFromGroups:`Allow from (groups)`,allowFromGroupsDesc:`Comma-separated group chat IDs (when group policy is allowlist).`,historyLimit:`History limit`,textChunkLimit:`Text chunk limit`,telegramDebug:`Debug mode`,multiAccountJson:`Multi-account (JSON)`,multiAccountJsonDesc:`Optional. Per-account botToken or tokenFile, policies, and groups. Empty {} uses the single token above only.`,weixinQuickStartTitle:`Quick start`,weixinStepLogin:`Use “Sign in with WeChat (QR)” below in this console, or see Channel documentation for CLI login.`,weixinStepEnable:`Turn on Weixin below and save.`,weixinStepPairing:`After QR login, DMs work immediately. Use allowlist DM policy only if you want to restrict who can message the bot.`,weixinAdvancedHint:`Optional: allowlist, route tag, streaming, and per-account JSON—only if you need them.`,weixinAllowFrom:`Allow from`,weixinAllowFromDesc:`When DM policy is allowlist: comma-separated wxid / openid. Default pairing allows all contacts after QR login.`,weixinRouteTag:`Route tag`,weixinRouteTagDesc:`Optional tag for routing; numeric or string.`,routeTagPlaceholder:`e.g. tag name or number`,weixinDebug:`Debug mode`,weixinDebugDesc:`Extra logging for the Weixin channel.`,weixinAccountsJson:`Accounts (JSON)`,weixinAccountsJsonDesc:`Per-account name, CDN base URL, route tag, and policies.`,weixinQrLoginTitle:`Browser QR login`,weixinQrLoginDesc:`Starts a login on the gateway. Scan with WeChat; when it succeeds, settings refresh automatically.`,weixinQrLoginButton:`Sign in with WeChat (QR)`,weixinQrLoginBusy:`Starting…`,weixinQrLoginScanned:`Scanned — confirm in WeChat`,weixinQrLoginSuccess:`Weixin connected.`,weixinQrLoginCancel:`Dismiss QR`,weixinQrImageError:`Could not render the QR code here. You can open the link in a new tab, or tap Regenerate to try again.`,weixinQrOpenLink:`Open in new tab`,weixinQrEncoding:`Rendering QR…`,weixinQrModalTitle:`Scan to sign in`,weixinQrModalSubtitle:`Use WeChat to scan the QR code below to connect.`,weixinQrRegenerate:`Regenerate QR code`,weixinQrModalCloseAria:`Close`,feishuQrModalTitle:`Scan to create app`,feishuQrModalSubtitle:`Starts with China (Feishu). Use the switch below the QR to use International (Lark). Expand Advanced options for manual credentials and policies.`,feishuQrCloseAria:`Close`,feishuRegionSwitchAria:`Registration region`,feishuRegionChina:`China (Feishu)`,feishuRegionInternational:`International (Lark)`,feishuAdvancedHint:`Optional: App ID / Secret from the developer console, connection mode, webhook, tools, routing, and multi-account JSON. Save writes to the gateway config.`,feishuQrStarting:`Starting…`,feishuQrScanHint:`Scan this QR code with Feishu/Lark on your phone.`,feishuQrEncoding:`Generating QR…`,feishuQrImageError:`Could not generate QR image.`,feishuQrOpenLink:`Open link in browser`,feishuQrRegenerate:`Regenerate QR`,feishuQrSetupSuccess:`Feishu app created and configured.`,dingtalkQrModalTitle:`Scan to register app`,dingtalkQrModalSubtitle:`Scan with DingTalk to register the app. Expand Advanced options below to enter credentials or policies manually.`,dingtalkQrCloseAria:`Close`,dingtalkQrStarting:`Starting…`,dingtalkQrScanHint:`Scan this QR code with DingTalk on your phone.`,dingtalkQrEncoding:`Generating QR…`,dingtalkQrImageError:`Could not generate QR image.`,dingtalkQrOpenLink:`Open link in browser`,dingtalkQrRegenerate:`Regenerate QR`,dingtalkQrSetupSuccess:`DingTalk app registered and configured.`,dingtalkClientId:`Client ID`,dingtalkClientIdDesc:`From DingTalk Open Platform after registration. Stored in the gateway config.`,dingtalkClientSecret:`Client secret`,dingtalkClientSecretDesc:`From DingTalk Open Platform. Stored in the gateway config.`,dingtalkEndpoint:`API endpoint`,dingtalkEndpointDesc:`Open API base URL (default https://api.dingtalk.com).`,dingtalkDebug:`Debug mode`,dingtalkAdvancedHint:`Optional: enter Client ID / Secret from DingTalk Open Platform, policies, routing, and multi-account JSON. Save applies changes to the gateway config.`,agentRoutingTitle:`Agent routing`,agentRoutingHint:"Maps each channel account to an agent via config `bindings`. Inbound messages use a session key for that agent.",agentRoutingAccountLabel:`Account`,agentRoutingAgentLabel:`Agent`,jsonObjectAccounts:`Accounts must be a JSON object`,jsonInvalid:`Invalid JSON`,copy:`Copy`,copied:`Copied`,show:`Show`,hide:`Hide`,webhookTitle:`Webhook settings`,verificationToken:`Verification token`,verificationTokenDesc:`From Feishu event subscription settings (webhook mode).`,encryptKey:`Encrypt key`,encryptKeyDesc:`From Feishu event subscription settings (webhook mode).`,webhookHost:`Webhook host`,webhookPort:`Webhook port`,webhookPath:`Webhook path`,webhookPathDesc:`Request URL path configured in Feishu event subscription.`,feishuToolsTitle:`Feishu tools`,feishuToolsDesc:`Enable only what you need. Each tool may require additional app scopes.`,feishuToolDoc:`Doc (feishu_doc)`,feishuToolWiki:`Wiki (feishu_wiki)`,feishuToolDrive:`Drive (feishu_drive)`,feishuToolPerm:`Permissions (feishu_perm)`,feishuToolBitable:`Bitable (feishu_bitable_*)`,feishuToolScopes:`Scopes check (feishu_app_scopes)`,feishuActionsTitle:`Feishu actions`,feishuActionReactions:`Enable reaction actions`,policy:{dm:{pairing:`Pairing`,allowlist:`Allowlist`,open:`Open`,disabled:`Disabled`},group:{open:`Open`,disabled:`Disabled`,allowlist:`Allowlist`},reply:{off:`Off`,first:`First`,all:`All`},stream:{off:`Off`,partial:`Partial`,block:`Block`}}},voiceSettings:{needToken:`Save a gateway token to edit voice settings.`,subtitle:`Speech-to-text and text-to-speech for channels. Keys can also be set via environment variables.`,docsLink:`Voice documentation`,loadError:`Failed to load voice settings`,loading:`Loading…`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved`,saveError:`Failed to save`,retry:`Retry`,unsavedHint:`You have unsaved changes.`,stt:{title:`Speech-to-text (STT)`,description:`Transcribe inbound voice using Alibaba DashScope or OpenAI Whisper.`,enable:`Enable STT`,enableDesc:`When on, voice messages can be transcribed for the agent.`,provider:`STT provider`,alibaba:`Alibaba DashScope`,openai:`OpenAI`,apiKey:`API key`,apiKeyDesc:`Optional if the key is already in the environment.`,model:`Model`,fallback:`Fallback between providers`,fallbackDesc:`Try the other provider if the primary request fails.`},tts:{title:`Text-to-speech (TTS)`,description:`Synthesize assistant replies as audio when enabled.`,enable:`Enable TTS`,enableDesc:`When on, TTS runs according to the trigger mode below.`,trigger:`Trigger`,triggerOff:`Off`,triggerAlways:`Always`,triggerInbound:`Inbound voice only`,triggerTagged:`Tagged ([[tts]])`,triggerDescOff:`TTS is completely disabled.`,triggerDescAlways:`Apply TTS to all assistant messages.`,triggerDescInbound:`Only reply with voice when the user sends voice.`,triggerDescTagged:`Only when the [[tts]] directive is used.`,provider:`TTS provider`,providerOpenai:`OpenAI TTS`,providerEdge:`Microsoft Edge (free)`,providerLocalCli:`Local CLI (offline)`,voice:`Voice`,edgeHint:`Microsoft Edge TTS — no API key required.`,localCli:{command:`CLI command`,commandDesc:`Shell template; placeholders: {{Text}}, {{OutputBase}}.`,commandPlaceholder:`mlx_audio.tts.generate --text "{{Text}}" --file_prefix {{OutputBase}}`,cwd:`Working directory`,cwdDesc:`Optional. Defaults to the gateway working directory.`,outputFormat:`Output format`,outputFormatDesc:`File extension produced by the CLI (mp3, wav, opus, …).`,timeoutMs:`Timeout (ms)`,timeoutMsDesc:`Per-call timeout override; leave blank to inherit the TTS default.`,hint:"Provided by the bundled `tts-local-cli` extension. Enable the extension and configure the binary on PATH."}},notes:{title:`Note`,duration:`Long audio is split automatically; quality depends on provider and model.`,envVars:`Environment variables: DASHSCOPE_API_KEY, OPENAI_API_KEY (when not set in this form).`}},gatewaySettings:{needToken:`Save a gateway token to load and edit gateway options.`,subtitle:`HTTP API access token and listen address. Values are stored in the gateway config file.`,docsLink:`Gateway documentation`,loadError:`Failed to load gateway settings`,loading:`Loading…`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved`,saveError:`Failed to save`,retry:`Retry`,unsavedHint:`You have unsaved changes.`,tokenExpired:`Your session token was rejected. Update the client token or fix the access token in config.`,updateToken:`Update client token`,changeToken:`Open token dialog`,accessToken:`Gateway access token`,tokenPlaceholder:`Token stored in config (optional if using env)`,tokenHelp:`Used to authenticate HTTP/WebSocket API requests. You can also set XOPC_GATEWAY_TOKEN.`,copy:`Copy`,copied:`Copied`,show:`Show`,hide:`Hide`,listenHost:`Listen address`,listenPort:`Port`,listenHint:`Effective after gateway restart if changed outside this UI.`,authModeNone:`Auth mode is set to none — token in config may be ignored.`,updateChannel:`Update channel`,channelStable:`Stable`,channelBeta:`Beta`,channelDev:`Dev`,updateChannelHint:`Beta and dev receive builds earlier; stable is recommended for daily use.`,mobilePairTitle:`Mobile app pairing`,mobilePairSubtitle:`Scan with your mobile app to connect using the gateway URL and the same Bearer token this console uses.`,mobilePairBaseUrlLabel:`Gateway URL for pairing`,mobilePairBaseUrlHint:`Use an address reachable from your phone (for example LAN IP and port). This may differ from the address in your desktop browser.`,mobilePairLocalhostWarning:`This URL looks like localhost. Phones on the network cannot reach your machine unless you expose the gateway (for example bind to LAN and use http://<this-machine-ip>:<port>).`,mobilePairSecurityNote:`The QR contains your access token. Only show it where you trust the people and cameras around you.`,mobilePairEncoding:`Generating QR…`,mobilePairImageError:`Could not generate a QR image. Copy the pairing link instead.`,mobilePairCopyLink:`Copy pairing link`,mobilePairCopied:`Copied pairing link`,mobilePairSchemeHint:`Format registered by apps: xopc://gateway/mobile-connect?baseUrl=…&token=…`,mobilePairInvalidBaseUrl:`Enter an absolute gateway URL starting with http:// or https:// (no path required).`},heartbeatSettings:{needToken:`Save a gateway token to load and edit heartbeat options.`,subtitle:`Periodic agent wake, optional delivery to a channel, and HEARTBEAT.md in your workspace. Stored in the gateway config file and workspace.`,docsLink:`Heartbeat documentation`,loadError:`Failed to load heartbeat settings`,loading:`Loading…`,saveConfig:`Save`,discard:`Discard`,savingConfig:`Saving…`,savedConfig:`Configuration saved`,saveConfigError:`Failed to save configuration`,triggerNow:`Run now`,triggering:`Queuing…`,triggered:`Heartbeat queued`,triggerError:`Failed to trigger heartbeat`,triggerHint:`Queues one heartbeat run (same as the timer). Skipped if HEARTBEAT.md is empty, outside active hours, or heartbeat is disabled.`,saveDoc:`Save`,savingDoc:`Saving…`,savedDoc:`Document saved`,saveDocError:`Failed to save HEARTBEAT.md`,retry:`Retry`,unsavedConfig:`You have unsaved configuration changes.`,unsavedDoc:`You have unsaved changes to HEARTBEAT.md.`,workspaceLabel:`Workspace`,configSection:`Heartbeat configuration`,docSection:`HEARTBEAT.md`,docHint:`Tasks and reminders read by the agent on each heartbeat. Leave empty or comment-only to skip LLM calls and save tokens.`,enable:`Enable heartbeat`,interval:`Interval`,intervalHint:`Minimum 1 second. Saved to the gateway as milliseconds.`,intervalHintPreset:`Quick preset or type seconds in the field.`,intervalSecondsLabel:`Seconds`,intervalPresets:{custom:`Custom`,every30s:`Every 30 seconds`,every1min:`Every 1 minute`,every5min:`Every 5 minutes`,every10min:`Every 10 minutes`,every15min:`Every 15 minutes`,every30min:`Every 30 minutes`,every1h:`Every 1 hour`,every2h:`Every 2 hours`},deliveryTitle:`Delivery (optional)`,channelNone:`— None —`,customChannelSuffix:`custom`,deliveryHint:`Both channel and chat id are required to send non-silent replies somewhere. Otherwise the reply is only logged.`,prompt:`Custom system prompt (optional)`,promptPlaceholder:`Override the default heartbeat instruction…`,promptHint:`Leave empty to use the built-in default prompt.`,ackMaxChars:`Max reply length before treating as silent (ackMaxChars)`,ackMaxCharsHint:`Leave empty for server default (300).`,ackDefaultPlaceholder:`Default`,isolatedSession:`Use a fresh session key each run`,isolatedSessionHint:`Avoids mixing heartbeat context with the main chat session.`,activeHoursTitle:`Active hours (optional)`,activeStart:`Start`,activeEnd:`End`,activeTimezone:`Timezone (IANA)`,activeHoursHint:`Restrict heartbeats to this window. Clear to run any time.`,addActiveHours:`Add active hours`,clearActiveHours:`Clear active hours`},webSearchSettings:{title:`Web search`,subtitle:`Configure region and search providers for the web_search tool. Without API keys, a built-in HTML fallback is used.`,docsLink:`Gateway documentation`,needToken:`Save a gateway token to edit web search settings.`,loading:`Loading…`,loadError:`Failed to load web search settings`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved`,saveError:`Failed to save`,unsavedHint:`You have unsaved changes.`,sectionRegion:`Region`,sectionRegionHint:`Controls which zero-config HTML fallback is used when no API provider succeeds (China → Bing; otherwise DuckDuckGo).`,sectionSearch:`Search providers`,sectionSearchHint:`Providers are tried in order. Keys are stored in the gateway config file. Leave the list empty to use only the HTML fallback.`,regionLabel:`Fallback region`,regionDesc:`Auto uses your system timezone. Override if you are on a VPN or need a specific fallback.`,regionAuto:`Auto (timezone)`,regionCn:`China (Bing HTML fallback)`,regionGlobal:`Global (DuckDuckGo HTML fallback)`,maxResultsLabel:`Default max results`,maxResultsDesc:`Used when the model does not pass a count (1–50).`,providersTitle:`Providers (ordered)`,addProvider:`Add provider`,apiKeyLabel:`API key`,apiKeyDesc:`Optional for some setups. Leave masked to keep the saved value.`,urlLabel:`Instance URL`,urlDesc:`SearXNG base URL (e.g. http://localhost:8080). No trailing slash required.`,keyPlaceholder:`API key or env var name`,keyPlaceholderMasked:`•••••••• (unchanged)`,disabled:`Skip`,footerHint:`HTML fallbacks depend on third-party pages and may change. For production, use a supported search API (Brave, Tavily, Bing, or self-hosted SearXNG).`,providerTypes:{brave:`Brave Search API`,tavily:`Tavily`,bing:`Bing Web Search API`,searxng:`SearXNG`}}},Et={chat:JSON.parse(`{"typeMessage":"Type a message…","sendMessage":"Send","abort":"Abort","needToken":"Save a gateway token to chat.","loading":"Loading conversation…","model":"Model","modelPlaceholder":"Select a model…","agent":"Agent","agentPlaceholder":"Select an agent…","agentSearchPlaceholder":"Search agents…","agentNoMatches":"No matching agents","thinkingLevel":"Thinking","newSession":"New chat","welcomeTitle":"Welcome to xopc","welcomeDescription":"Send a message to get started","welcomeSpotlight":{"headline":"Your personal AI assistant, ready to help","tagline":"Just tell me what you need — I'll break it down, look things up, and get it done.","categories":[{"id":"work","icon":"documents","title":"Work & productivity","description":"Emails, reports, meeting notes","scenarios":[{"prompt":"Help me write a professional reply to an email declining a meeting invitation politely while suggesting an alternative time."},{"prompt":"Draft a concise weekly status update covering what I accomplished, what's in progress, and any blockers — keep it under 200 words."},{"prompt":"I have a meeting in 30 minutes. Help me prepare 5 key talking points and 3 questions I should ask about project timeline risks."}]},{"id":"research","icon":"globe","title":"Research & learning","description":"News, explanations, decisions","scenarios":[{"prompt":"What are the biggest tech news stories this week? Give me a quick summary of the top 3 with why they matter."},{"prompt":"Explain how RAG (Retrieval-Augmented Generation) works in simple terms, as if I'm explaining it to a non-technical manager."},{"prompt":"I'm choosing between Notion and Obsidian for personal note-taking. Compare them on features, pricing, and offline use, then recommend one for my case."}]},{"id":"content","icon":"content","title":"Writing & creation","description":"Posts, copy, translation","scenarios":[{"prompt":"Turn this idea into a LinkedIn post: AI tools are making individual contributors as productive as small teams. Keep it engaging and under 150 words."},{"prompt":"Rewrite the following paragraph to be more concise and punchy, suitable for a product landing page hero section."},{"prompt":"Translate this text to English and adjust the tone to sound natural for a global audience, not just a literal translation."}]},{"id":"data","icon":"folder","title":"Data & files","description":"Organize, analyze, automate","scenarios":[{"prompt":"Look at my Downloads folder and suggest how to organize it — group files by type and tell me what's safe to delete."},{"prompt":"I have a CSV with sales data. Help me find the top 5 products by revenue and spot any month-over-month trends."},{"prompt":"Create a simple daily planning template in Markdown: sections for top 3 priorities, meetings, notes, and end-of-day reflection."}]}]},"you":"You","assistant":"Assistant","tool":"Tool","thinkingLabel":"thinking…","thoughts":"Thoughts","thoughtsStreaming":"Thinking…","thoughtsExpandHint":"Expand to view model thoughts","thinkingLevelLabel":"Thinking","thinkingLevels":{"off":"Off","minimal":"Minimal","low":"Low","medium":"Medium","high":"High","xhigh":"X-High","adaptive":"Adaptive"},"toolInput":"Input","toolOutput":"Output","noOutput":"(no output)","viewSteps_one":"View {{count}} step","viewSteps_other":"View {{count}} steps","stepSearchedWeb":"Searched web","stepReadFile":"Read file","stepDetails":"Details","stepRunCommand":"Run command","stepListDirectory":"Browse folder","stepWriteFile":"Save file","stepEditFile":"Edit file","stepOpenUrl":"Open link","stepFetchUrl":"Fetch webpage","stepUnknownTool":"Running {{name}}","composerRunStatusSending":"Sending…","composerRunStatusDefault":"Working…","composerRunningTool":"Running {{name}}","composerStageThinking":"Thinking…","composerStageSearching":"Searching…","composerStageReading":"Reading…","composerStageWriting":"Writing…","composerStageExecuting":"Executing…","composerStageAnalyzing":"Analyzing…","attachFile":"Attach file","workingDirectory":{"selectWorkingDirectory":"Select working directory","chooseFolder":"Choose folder…","selectPath":"Select folder…","recentDirectories":"Recent directories","noRecent":"No recent folders","notSet":"Default workspace","defaultWorkspace":"Session workspace","copyPath":"Copy path","selectionOnlyAtNewChat":"Workspace can only be chosen before the first message.","lockedTapTitle":"Workspace is locked for this chat","lockedTapBody":"To pick a folder for the agent, open New chat and click this control before you send the first message. You can also set a default workspace under Settings → Agents.","clickToCopyFullPath":"Click to copy full path","tooltipAgentWorkspace":"Agent workspace","tooltipOpenProjectFiles":"Click to open or close project files in the sidebar.","copied":"Copied","openWorkspaceMenu":"Workspace options","folderPickerRequiresDesktop":"Folder selection requires the desktop app (Electron). Open xopc from the desktop app, or configure the path another way.","applyErrorTitle":"Could not set working directory","applyErrorClose":"Close","pathModalTitle":"Working directory","pathModalDescription":"Enter an absolute path on the machine running the gateway (folder for the session workspace).","pathInputPlaceholder":"/absolute/path/to/folder","pathModalConfirm":"Apply","pathModalCancel":"Cancel","pickerHostHint":"Directories on gateway host: {{hostname}}","pickerLoading":"Loading…","pickerUp":"Up","pickerUseThisFolder":"Use this folder","pickerManualPath":"Or type an absolute path","pickerApplyManual":"Apply path","pickerListError":"Could not read this location.","pickerEmptyFolder":"Empty folder","pickerDrives":"Drives"},"maxAttachmentsReached":"Maximum {{max}} files per message. Remove some to add more.","maxAttachmentsTruncated":"{{dropped}} file(s) not added (limit {{max}} per message).","attachmentFileTooLarge":"File \\"{{name}}\\" is too large (max {{maxSize}} per file).","attachmentLoadFailed":"Failed to load attachment: {{name}}","clipboardFileTypeUnsupported":"Clipboard file type not supported for chat attachments","inputPlaceholder":"Ask anything — @ for files, / for skills & commands","currentModel":"Model used for this conversation","modelSearchPlaceholder":"Search by name, provider, or ID…","modelNoMatches":"No models match your search","contextWindowHoverShort":"{{percent}}% context","contextWindowHoverNoLimit":"~{{used}} context","contextWindowAriaSummary":"Context usage about {{used}} of {{limit}} tokens","contextWindowAriaSummaryNoLimit":"Estimated context usage about {{used}} tokens","modelProviderSettingsLink":"Configure providers…","dropFiles":"Drop files here to attach","voiceRecording":"Record voice","voiceRecordingStop":"Stop recording","voiceMicDenied":"Microphone access denied or unavailable.","inputPlaceholderSteering":"Follow-up: Enter queues a row; click a row to edit here","inputPlaceholderSteeringEdit":"Editing queued follow-up — Enter saves, Esc discards changes","steeringInterruptSend":"Stop and send now (⌘↵ or Ctrl+↵)","followUpSuggestionsAria":"Suggested follow-up questions","followUpChipErrorHandling":"Add error handling and edge cases.","followUpChipRefactorReadability":"Refactor for readability.","followUpChipCodeExplain":"Explain this code step by step.","followUpChipCodeOptimize":"Suggest performance optimizations.","followUpChipWebMoreDetails":"Find more details online.","followUpChipWebFindSources":"Find reliable sources.","followUpChipShorterSummary":"Give a shorter summary.","followUpChipMainRisks":"What are the main risks?","followUpChipEmailMakeFormal":"Make it more formal.","followUpChipEmailShorten":"Shorten this.","followUpChipSimplerTerms":"Explain that in simpler terms.","followUpChipConcreteExample":"Give a concrete example.","followUpChipBulletPoints":"Summarize as bullet points.","followUpChipCreateTable":"Present as a table.","followUpChipWhatNext":"What should I do next?","followUpQueueAria":"Follow-up queue (sent after this reply, in order)","followUpQueueHeading":"Follow-ups","followUpQueueClickToEdit":"Edit in composer","followUpQueueAttachmentOnly":"(attachment)","followUpQueueEmptyPreview":"(empty)","followUpQueueDrag":"Drag to reorder","followUpQueueMoveUp":"Move up","followUpQueueMoveDown":"Move down","followUpQueueSteerNow":"Inject as steering (tool boundary)","followUpQueueRemove":"Remove from queue","followUpQueueAttachmentsNote":"Rows with attachments cannot use ✨ steer; they send as full messages in order.","followUpQueueMaxReached":"Follow-up queue is full (max {{max}}). Remove one or wait for the run to finish.","voicePlay":"Play voice","voicePause":"Pause","voiceLoading":"Loading audio…","voiceAriaRegion":"Voice playback","voiceAwaitingMeta":"Measuring clip length","voiceMessage":"Voice","loadOlder":"Loading older messages…","scrollToBottom":"Scroll to bottom","attachmentPreviewClose":"Close","attachmentPreviewDownload":"Download","attachmentPreviewRemove":"Remove","attachmentPreviewLoading":"Loading file…","attachmentPreviewText":"Text","attachmentPreviewPdf":"PDF","attachmentPreviewDocument":"Document","attachmentPreviewPresentation":"Presentation","attachmentPreviewSpreadsheet":"Spreadsheet","attachmentPreviewNoText":"No text content available","attachmentPreviewMissingData":"Missing file data","attachmentPreviewLoadError":"Error loading file","attachmentPreviewMissingAuth":"Missing authentication","attachmentPreviewFailedPdf":"Failed to load PDF","attachmentPreviewFailedDocx":"Failed to load document","attachmentPreviewFailedExcel":"Failed to load spreadsheet","attachmentPreviewPdfRendering":"Rendering PDF…","attachmentPreviewPdfLoadMore":"Scroll to load more pages","attachmentPreviewExcelTruncated":"Preview limited to {rows} rows × {cols} columns. Download the file to see the full sheet.","attachmentPreviewPptxTruncated":"Text preview truncated for performance. Download the file to see the full deck.","attachmentPreviewPptxSlide":"Slide {n}","attachmentPreviewPptxEmptySlide":"(No text on this slide)","attachmentPreviewOpenElsewhereHint":"Download the file to open it in another application on your computer.","attachmentPreviewOpenElsewhereTruncated":"Only part of this file is shown here. Download the full file to open it elsewhere.","attachmentPreviewDownloadFull":"Download file","attachmentPreviewImage":"Preview image","messageArtifactsHeading":"Message output","stepTimelineThinkingStreaming":"Thinking…","stepTimelineThinkingDone":"Thinking complete","stepTimelineToolSearchRunning":"Searching the web…","stepTimelineToolSearchComplete":"Web search complete","stepTimelineToolSearchError":"Web search failed","stepTimelineToolGenericRunning":"{{name}}…","stepTimelineToolGenericComplete":"{{name}} complete","stepTimelineToolGenericError":"{{name}} failed","searchSourcesHeading":"Search sources · {{count}}","executionDrawerTitle":"Execution","executionDrawerClose":"Close","executionDrawerEmpty":"No steps for this reply yet.","executionProgressDone":"Thinking complete","executionProgressRunning":"Thinking & tools…","executionElapsedTitle":"Elapsed time for this run","messageCopyPlainText":"Copy plain text","messageCopyMarkdown":"Copy Markdown","codeBlockCopy":"Copy","messageCopied":"Copied","userMessageCopy":"Copy message","userMessageRetry":"Retry","userMessageEdit":"Edit in composer","userMessageRetryDisabledHint":"Only your latest message can be retried.","userMessageActionsWait":"Wait until sending or streaming finishes.","userMessageDelete":"Delete this round","userMessageDeleteConfirm":"This will delete both your message and the AI response. Continue?","userMessageDeleteConfirmTitle":"Delete conversation round","userMessageDeleteCancel":"Cancel","userMessageDeleteOk":"Delete","commandPalette":{"noResults":"No matching commands or skills","placeholder":"Search skills and commands…","skillsSection":"Skills","commandsSection":"Commands","showGroupedMore":"Show {{count}} more"},"goal":{"heading":"Standing goal","turns":"{{used}} / {{max}} turns","statusActive":"Active","statusPaused":"Paused","statusDone":"Done","agentRunning":"Agent run in progress…","pause":"Pause","resume":"Resume","clear":"Clear","restart":"Restart budget","detailsToggle":"Judge details","lastVerdict":"Last verdict","lastReason":"Reason","loadFailed":"Could not load goal state.","collapseAria":"Collapse goal bar","expandAria":"Expand standing goal","pillTitle":"{{status}} · {{turns}} — click to expand"},"atMention":{"noResults":"No matches","placeholder":"Search files…","searchError":"Failed to search workspace","files":"Files","folders":"Folders","recentFiles":"Recent","recentBadge":"Recent","shiftHint":"Shift+Enter or Shift+click: add another @ mention."}}`)},Dt={cron:JSON.parse('{"title":"Scheduled Tasks","subtitle":"Tasks run automatically on schedule and can be triggered manually anytime. Describe what you want to do regularly in any chat to create one quickly.","needToken":"Save a gateway token to manage scheduled tasks.","statsRegion":"Overview","tabMyTasks":"My Scheduled Tasks","tabRunHistory":"Run History","wakeBanner":"Scheduled tasks only run while this device is awake. When the system or display sleeps, runs may be skipped.","keepAwake":"Keep screen awake","wakeLockUnavailable":"Screen wake lock is not available in this browser or context.","sortCreatedDesc":"Created (newest first)","sortCreatedAsc":"Created (oldest first)","historyRangeDay":"Day","historyRangeWeek":"Week","historyRangeMonth":"Month","filterAllTasks":"All tasks","filterAllStatuses":"All statuses","emptyHistoryTitle":"No execution records","emptyHistoryHint":"Records will appear here once scheduled tasks start running.","jobCardMenuAria":"Task actions","scheduleBadge":{"everyMinute":"Every minute","everyNMinutes":"Every {{n}} minutes","everyNHours":"Every {{n}} hours","hourly":"Hourly","dailyAt":"Daily, {{time}}","weekdaysAt":"Weekdays, {{time}}","weeklyOn":"{{day}}, {{time}}","cronExpr":"{{expr}}"},"jobsHeading":"Scheduled jobs","addJob":"New task","editJob":"Edit task","name":"Name *","namePlaceholder":"My scheduled task","nameRequired":"Name is required","schedule":"Schedule (cron expression) *","message":"Message *","messagePlaceholder":"What should the assistant do?","messageEdit":"Edit","messagePreview":"Preview","messageMarkdownHint":"Supports Markdown (headings, lists, code blocks, links, …).","create":"Create Job","runNow":"Run Now","delete":"Delete","edit":"Edit","enabled":"Enabled","disabled":"Disabled","running":"Running","nextRun":"Next Run","status":"Status","runHistoryTitle":"Run History","runHistoryHint":"Completed runs are stored on disk (state/cron/runs). Use Refresh to update.","detailRunHistory":"Recent runs","colStarted":"Started","colJob":"Job","colDuration":"Duration","colDetail":"Result","colChat":"Chat","openChat":"Open","openChatTitle":"Open this run in chat (isolated agent sessions only)","execStatusRunning":"Running","execStatusSuccess":"Success","execStatusFailed":"Failed","execStatusCancelled":"Skipped","noRunsYet":"No executions in this range.","confirmDelete":"Are you sure you want to delete this cron job?","confirmRun":"Run this cron job now?","scheduleLabel":"Schedule","messageLabel":"Message","totalJobs":"Total jobs","emptyStateCta":"Create your first job","channel":"Channel","channelLocal":"Local (no outbound)","deliveryTargetLocalChannel":"Local channel — transcript or message stays on this machine","recipient":"Recipient *","recipientPlaceholder":"Telegram: numeric id, or pick from recent sessions","refreshList":"Refresh","refreshRecipientHint":"Reload list from recent sessions","selectRecipient":"— Select —","noRecentChatsOption":"No recent sessions","deliveryTarget":"Delivery","scheduleHintPreset":"Select a preset or enter custom cron expression","schedulePicker":{"scheduleTimeLabel":"Scheduled time","modeNoRepeat":"Does not repeat (yearly date)","modeInterval":"Interval","intervalKindMinutes":"Minutes","intervalKindHours":"Hours","modeHourly":"Every hour","modeDaily":"Daily","modeWeekly":"Weekly","modeMonthly":"Monthly","modeCustom":"Custom (cron)","minuteUnit":"min","minuteAtHour":"Minute","intervalMinutes":"Interval in minutes","intervalHours":"Interval in hours","hourUnit":"h","dayOfMonth":"Day of month","customCronHint":"Five-field cron: minute hour day-of-month month day-of-week","weekdays":["Mo","Tu","We","Th","Fr","Sa","Su"]},"mode":"Mode","modeDirect":"Send message directly to the channel without AI processing","modeAgent":"Use AI agent to process the message, then send the response","modeDirectOption":"Direct (send message directly)","modeAgentOption":"AI Agent (process with AI then send)","agentLocalOnly":"Local only (save transcript, no channel send)","agentLocalOnlyHint":"Runs the agent on this machine. The transcript is stored as a cron session under the default or selected agent (the job id is part of the session key); no Telegram or CLI delivery.","deliveryLocalOnly":"Local only — transcript saved as a cron session under that agent","agentProfile":"Agent","agentProfileHint":"Only applies when mode is AI Agent. Leave as default to use the gateway default agent profile.","agentProfileDefault":"Default agent","workingDirectoryLabel":"Workspace","workingDirectoryHint":"Optional. Absolute path on the gateway host; leave unset to use this agent\'s default workspace.","workingDirectoryReset":"Use agent default","model":"Model","save":"Save","failedToLoadJobs":"Failed to load jobs","scheduleRequired":"Schedule and message are required","chatIdRequired":"Chat ID is required","failedToCreateJob":"Failed to create job","failedToUpdateJob":"Failed to save job","failedToToggleJob":"Failed to toggle job","actionFailed":"Action failed","enterManuallyOrSelect":"Enter manually or select from recent chats","noRecentChats":"No recent chats found. Enter chat ID manually (e.g., 123456789 for Telegram)","refresh":"Refresh","close":"Close","cancel":"Cancel","loading":"Loading…","schedulePresets":{"custom":"-- Custom (enter below) --","everyMinute":"Every minute","every5Minutes":"Every 5 minutes (default)","every10Minutes":"Every 10 minutes","every15Minutes":"Every 15 minutes","every30Minutes":"Every 30 minutes","everyHour":"Every hour","every2Hours":"Every 2 hours","every4Hours":"Every 4 hours","every6Hours":"Every 6 hours","every12Hours":"Every 12 hours","everyDayMidnight":"Every day at midnight","everyDay9AM":"Every day at 9:00 AM","everyDay9PM":"Every day at 9:00 PM"},"timeLabels":{"overdue":"Overdue","lessThanMinute":"Less than a minute","minutes":"{{count}} min","hours":"{{count}} hours"},"lastActiveLabels":{"justNow":"just now","minutesAgo":"{{count}}m ago","hoursAgo":"{{count}}h ago","daysAgo":"{{count}}d ago"},"templateFilterAll":"All","fromTemplate":"From template","templatesEmptyHint":"No templates match this filter.","templateCategories":{"daily":"Daily","monitoring":"Monitoring","reports":"Reports","automation":"Automation"},"templates":{"morning_briefing":{"title":"Morning briefing","description":"Weather-style day snapshot, headlines in your topics, and top priorities—edit the topic list in the prompt.","prompt":"Build a **morning briefing** I can read in a few minutes.\\n- **Weather / day shape**: if you cannot access a real forecast API, say so and give **one** practical clothing or commute tip based only on season/region I name below, or skip this bullet.\\n- **Headlines**: topics I care about (edit): **(e.g. local news, macro, tech policy, sports)**—if web search works, 4–6 bullets from the last ~24h with source type; if not, give a **manual check order** instead of inventing stories.\\n- **Top 3 priorities today** from workspace notes/todos if visible; else ask me to paste them once.\\n- **No fake URLs or quotes**."},"standup_prep":{"title":"Standup prep","description":"Draft a standup-style update from recent git activity and notable file changes in the workspace.","prompt":"Prepare a **standup update** for me:\\n- If Git is available: **yesterday / since last standup** themes from `git log` (no wall of SHAs), risky paths if obvious from messages.\\n- If not: give **commands** I should run locally next time.\\n- **Files touched**: infer from workspace if you can (recent edits, open PR-style hints); mark uncertain.\\n- **Blockers**: max 3, honest \\"unknown\\" allowed.\\n- **Today intent**: one sentence.\\n- Keep it speakable aloud in under ~90 seconds."},"end_of_day_wrap_up":{"title":"End-of-day wrap-up","description":"Summarize progress, open items, and tomorrow\'s priorities from workspace context when possible.","prompt":"**End-of-day wrap** (weekday):\\n- **Done**: up to 5 bullets (mark inferred items).\\n- **Open / parked**: up to 4 bullets.\\n- **Tomorrow**: first concrete task after login—single bullet.\\n- Pull from task docs, changelogs, or notes in the workspace when present; otherwise say what is missing.\\n- Neutral tone, no guilt."},"inbox_triage":{"title":"Inbox triage","description":"Surface urgent follow-ups first—uses any mail/export notes in the workspace; no mailbox access implied.","prompt":"Help me **triage inbox-style work** (no live email unless I paste content):\\n- If I have exported snippets, `*.eml`, or notes about mail in the workspace, summarize **urgent follow-ups first** with suggested next action each.\\n- If nothing mail-related exists, output a **5-step triage routine** (folders/labels, oldest-first, VIP senders I list below) and ask me to paste 3 subject lines next run.\\n- **VIP / domains to watch** (edit): **(add yours)**.\\n- Do not claim you read my real inbox."},"competitor_watch":{"title":"Competitor watch","description":"Track competitor news, product updates, and pricing signals you name—web search when available.","prompt":"Competitors or alternatives to watch (edit names/topics): **(list here)**.\\n- If web search works: summarize **news, product/changelog moves, pricing or packaging signals** from roughly the past week; separate **fact** vs **rumor**.\\n- If search is unavailable: give **official domains + what to check** (pricing page, changelog, press) without fabricating updates.\\n- **Never invent press quotes, numbers, or URLs**."},"trending_topics_monitor":{"title":"Trending topics","description":"Track trending discussions and news in industries or communities you list.","prompt":"Industries, communities, or hashtags I track (edit): **(e.g. fintech, indie games, city subreddit, AI tools)**.\\n- If web search works: **5–7** bullets on what is **trending or unusually active** this week; note platform (news, Reddit-style, HN-style) at a high level.\\n- If not: suggest **where to look** and **search phrases**—no made-up threads.\\n- Flag **controversy or misinformation risk** briefly when relevant."},"tech_radar_stack":{"title":"Tech radar","description":"Monitor new releases and security advisories for stacks you name (frameworks, runtimes, cloud).","prompt":"Stacks I use (edit): **(e.g. Node LTS, Postgres, AWS service X, Android SDK)**.\\n- List **notable releases or deprecations** from the past ~14 days using **official blogs, registries, or changelogs** only.\\n- Security: point to **official advisory channels**; **do not invent CVE IDs**.\\n- If the workspace has lockfiles, you may mention ecosystem at a high level; if unsure, say what file you need."},"dependency_check_audit":{"title":"Dependency check","description":"Audit-style nudge for outdated packages and known issues—suggests commands, does not fabricate CVEs.","prompt":"From the repo in the workspace, infer package managers (`package.json`, `go.mod`, `pyproject.toml`, etc.).\\n- Suggest **one concrete audit command** per ecosystem if documented (npm/pnpm audit, pip-audit, etc.).\\n- Summarize **what I should look for** (majors, yanked packages, EOL runtimes) without claiming scan results you did not run.\\n- **Never fabricate CVE numbers** or vulnerable versions."},"weekly_review":{"title":"Weekly review","description":"Summarize the week\'s commits, open items, and next-week priorities.","prompt":"**Weekly review** (assume end of week):\\n- **Shipped themes** from git + workspace notes (or say git unavailable).\\n- **Open items** still worrying (max 6).\\n- **Next week**: 3 headline priorities.\\n- **One thing to stop or delegate** if overload is visible.\\n- Short, executive-summary tone."},"code_quality_report":{"title":"Code quality report","description":"Outline how to run lint/type-check and what to look for in output—does not pretend CI already ran.","prompt":"Inspect the workspace for **lint / typecheck / format** scripts (package.json, Makefile, CI YAML).\\n- Propose **commands** I should run locally and in what order.\\n- Describe **how to skim output**: error categories, flaky tests, type debt hotspots—without inventing numbers.\\n- If no scripts found, suggest a **minimal** starter for the detected language with caveats."},"git_activity_summary":{"title":"Git activity summary","description":"Summarize recent commits, active branches, and hotspot files when git is available.","prompt":"Summarize **recent Git activity** (last ~7 days if possible):\\n- Commit **themes**, **active branches** worth naming, **hotspot files** touched often.\\n- If git is not callable here, output **commands** to reproduce the summary locally.\\n- Avoid dumping hashes; keep it scannable."},"user_feedback_digest":{"title":"User feedback digest","description":"Summarize recurring feedback and pain points from notes, issues exports, or docs you keep in the workspace.","prompt":"I store feedback in (edit paths or patterns): **`feedback/`, issues export, Notion export, etc.`**\\n- From readable workspace text, cluster **recurring themes**, **sentiment (rough)**, and **top pain points** (max 5).\\n- If no material: give a **template** for how I should paste feedback next time.\\n- No PII beyond what is already in files; redact if needed in summary."},"stale_todo_or_issue_sweep":{"title":"Stale todo / issue sweep","description":"Find aging TODOs or issue-like markers in the repo and suggest keep / close / split.","prompt":"Scan the workspace for **TODO/FIXME/HACK** comments or lightweight issue lists in markdown.\\n- List up to **10 stale candidates** (old by file churn or vague wording) with **suggested next action**: close, split, or schedule.\\n- Do not delete anything—recommendations only.\\n- If scan is incomplete, say why."},"release_notes_or_changelog_draft":{"title":"Release notes draft","description":"Draft changelog bullets from recent commits and version files—human must verify before ship.","prompt":"Draft **release notes / changelog** candidate for the **next** version bump:\\n- Read `CHANGELOG`, version in `package.json`/`Cargo.toml`/similar if present.\\n- Summarize **user-visible** changes from recent commits since last tag if inferable; else since last week.\\n- Mark **uncertain** items; I will edit before publishing.\\n- No marketing exaggeration."},"workspace_cleanup_suggestions":{"title":"Workspace cleanup","description":"List large artifacts, caches, or generated files to review before the weekend—never auto-delete.","prompt":"Suggest **workspace cleanup** before the weekend:\\n- Large **build outputs, caches, logs** if discoverable.\\n- Table: path | why it might be safe to trim | risk | suggested action (review only).\\n- **Never delete**; if you cannot see disk usage, say so and give generic patterns."},"smoke_or_ci_health_reminder":{"title":"Smoke / CI health","description":"Remind which smoke tests or CI checks matter this week and how to run them locally.","prompt":"From CI config and package scripts, list **smoke or health checks** worth running this week.\\n- For each: **command**, **expected green signal**, **when to run** (before release, daily, etc.).\\n- If CI files are missing, propose a **minimal** manual smoke path for this repo type.\\n- Do not claim CI passed without evidence."}}}')},Ot={logs:{title:`Logs`,subtitle:`Runtime diagnostics and history from the gateway.`,needToken:`Save a gateway token to view logs.`,filters:`Filters`,level:`Level`,searchPlaceholder:`Search message or module…`,module:`Module`,allModules:`All modules`,timeRange:`Time range`,from:`From`,to:`To`,clear:`Clear`,refresh:`Refresh`,autoRefresh:`Auto refresh`,pause:`Pause`,liveHint:`Refreshing every 5s`,logFiles:`Log files`,filesEmpty:`No log files on disk`,loadMore:`Load more`,showingCount:`{{count}} entries loaded`,moreAvailable:`Earlier entries may be available`,noLogs:`No matching entries`,noLogsDescription:`Adjust filters or search, or try again later.`,loading:`Loading…`,loadError:`Failed to load logs`,details:`Log details`,close:`Close`,time:`Time`,message:`Message`,metadata:`Metadata`,statsRegion:`Sample (recent files)`,statsHint:`Counts are sampled from recent log files, not totals.`,statsDetailTitle:`Level breakdown`,logDir:`Directory`,requestId:`Request ID`,sessionId:`Session ID`,presetAll:`All`,presetErrors:`Errors`,presetWarnPlus:`Warn+`,presetInfoPlus:`Info+`,presetVerbose:`Debug`,presetOther:`More`,levelPresetAria:`Filter by log level`,refreshModeAria:`Log refresh mode`,refreshManual:`Manual`,refreshLive:`Live`,filtersMore:`More filters`,filtersDialogTitle:`More filters`,filtersDialogDesc:`Time range and custom log levels.`,filtersDone:`Done`,levelCustom:`Custom levels`,levelCustomHint:`Toggle to include or exclude. No selection means all levels.`,copyMessage:`Copy message`,copyJson:`Copy JSON`,copied:`Copied`,levelNames:{trace:`trace`,debug:`debug`,info:`info`,warn:`warn`,error:`error`,fatal:`fatal`}}},kt={onboarding:{title:`Welcome to xopc`,subtitle:`Let's get your AI assistant set up in 3 quick steps.`,step1Title:`Choose an AI Provider`,step1Subtitle:`Select the AI service you'd like to use.`,step2Title:`Enter your API key`,step2Subtitle:`Your key is stored locally in your xopc config file.`,step2Placeholder:`Paste your API key here`,step2SecurityNote:`🔒 Keys never leave your machine.`,step3Title:`Choose a default model`,step3Subtitle:`You can change this anytime in settings.`,back:`Back`,continue:`Continue`,startChatting:`Start chatting`,skipSetup:`Skip — I'll set this up later`,setupComplete:`You're all set! Start chatting below.`,stepOf:`Step {{current}} of {{total}}`}},At={providersSettings:{subtitle:`Provider API keys and OAuth. Keys you save here go to the gateway credential store.`,intro:`Search or open a group, expand a provider, paste a new key, then Save. OAuth opens in your browser when you choose it.`,docsLink:`Model & provider docs`,modelsLink:`Custom providers (models.json)`,rotateHint:`Rotating a key: expand the provider, paste the new secret, Save — no restart needed.`,needToken:`Save a gateway token to manage provider credentials.`,loadError:`Failed to load providers`,save:`Save`,saving:`Saving…`,saved:`Saved`,noChangesSaved:`No new keys to save.`,saveError:`Failed to save`,empty:`No providers available.`,searchPlaceholder:`Search OpenAI, Claude, Gemini…`,getApiKey:`Get API Key`,getApiKeyIntl:`Get API Key (International)`,getApiKeyCn:`Get API Key (China)`,savedModelsAvailable:`models available`,savedNoModels:`Configured — no models listed yet`,envVarAlt:`Or set via environment variable`,unconfiguredOnly:`Unconfigured only`,noMatches:`No providers match your filters.`,clearFilters:`Clear filters`,discard:`Discard`,unsavedHint:`You have unsaved changes.`,runtimeLabelPrefix:`Runtime credential:`,sourceAgent:`agent private profile`,sourceGateway:`saved in gateway (this console)`,sourceOauth:`OAuth token`,sourceEnv:`environment variable`,sourceModelsJson:`models.json`,sourceExtension:`extension provider`,sourceNone:`none`,testKey:`Test value`,testingKey:`Testing…`,testOkLiteral:`Value accepted (direct key or text).`,testOkEnv:`Environment variable resolves.`,testOkCommand:`Command resolved successfully.`,testFailed:`Check failed.`,revokeFailed:`Revoke failed.`,expandRowDetails:`Show credential fields`,categories:{common:`Common providers`,specialty:`Specialty providers`,enterprise:`Enterprise / cloud`,oauth:`OAuth only`,extension:`Extensions`},configuredCount:`{{count}} configured`,metaMasked:`Credential on file — enter a new key to replace.`,metaWillSave:`API key will be saved when you click Save.`,metaNotConfigured:`Not configured.`,placeholderKey:`API key`,placeholderKeep:`Leave empty to keep current`,placeholderOverride:`Enter new key to override`,show:`Show`,hide:`Hide`,copy:`Copy`,copied:`Copied`,oauth:`OAuth`,revoke:`Revoke`,revokeConfirm:`Revoke OAuth credentials for "{{name}}"?`,oauthStarting:`Starting OAuth…`,oauthProcessingCode:`Processing authorization…`,openAuthPage:`Open auth page`,cancelOAuth:`Cancel`,pasteRedirectUrl:`Paste full redirect URL (e.g. http://127.0.0.1:…/oauth-callback?code=…&state=…)`,submitCode:`Submit`,envHint:`API key is set via environment variable. Enter a new key above to override.`,maskedStoredHint:`Stored credential is not shown. Enter a new key above to replace it.`,oauthHint:`Use OAuth for secure authentication, or enter an API key manually.`,removeKey:`Remove key`,removeKeyConfirm:`Remove the stored API key for "{{name}}"? This cannot be undone.`,removeKeySuccess:`API key removed.`,removeKeyFailed:`Failed to remove key.`},modelsSettings:{needToken:`Save a gateway token to edit models.json.`,subtitle:`Custom providers and models (models.json). Changes apply after save; reload picks up disk edits.`,docsLink:`Model & provider docs`,loadError:`Failed to load models.json`,loadFileWarning:`File warning`,filePath:`Path`,addProvider:`Add provider`,validate:`Validate`,validating:`Validating…`,validateError:`Validation request failed`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved`,saveError:`Failed to save`,reload:`Reload`,reloading:`Reloading…`,reloadError:`Reload failed`,showJson:`Show JSON`,hideJson:`Hide JSON`,statsProviders:`{{count}} providers`,statsModels:`{{count}} models`,unsavedHint:`You have unsaved changes.`,loading:`Loading…`,jsonParseError:`Invalid JSON`,jsonReset:`Reset from editor`,jsonApply:`Apply JSON`,emptyTitle:`No custom providers`,emptyDesc:`Add OpenAI-compatible endpoints (Ollama, LM Studio, OpenRouter, vLLM, etc.) and optional per-model overrides.`,emptyCta:`Add your first provider`,presetOllama:`Ollama`,presetLmStudio:`LM Studio`,presetOpenRouter:`OpenRouter`,presetZhipuCn:`Zhipu GLM (China · Coding API)`,presetZaiGeneral:`Zhipu GLM (International · general API)`,presetLabel:`Preset`,presetCustom:`Custom`,addProviderTitle:`Add provider`,addProviderSubtitle:`Provider id must be unique (e.g. ollama, my-openai).`,providerIdLabel:`Provider ID`,providerIdPlaceholder:`e.g. ollama`,providerIdRequired:`Provider ID is required`,addProviderConfirm:`Add provider`,cancel:`Cancel`,close:`Close`,baseUrl:`Base URL`,apiType:`API type`,apiKey:`API key`,apiKeyPlaceholder:`sk-…, ENV_VAR, or !command`,apiKeyHint:`Literal key, ENV name (uppercase), or shell command prefixed with !`,authHeader:`Send Authorization header automatically`,testKey:`Test`,show:`Show`,hide:`Hide`,badgeShell:`shell`,badgeEnv:`env`,badgeLiteral:`literal`,removeProvider:`Remove provider`,removeProviderConfirm:`Remove provider "{{id}}" and its models?`,modelsSection:`Models`,modelsEmpty:`No custom models; built-in defaults apply where available.`,addModel:`Add model`,editModel:`Edit model`,removeModel:`Remove model`,removeModelConfirm:`Remove model "{{id}}"?`,addModelTitle:`Add model`,editModelTitle:`Edit model`,modelProviderLabel:`Provider`,modelId:`Model ID`,displayName:`Display name`,inputTypes:`Input types`,inputTextOnly:`Text only`,inputTextVision:`Text + vision`,reasoning:`Supports reasoning`,contextWindow:`Context window`,maxOutputTokens:`Max output tokens`,costSection:`Cost (per 1M tokens)`,costInput:`Input`,costOutput:`Output`,modelIdRequired:`Model ID is required`,mustBePositive:`Must be greater than 0`,addModelConfirm:`Add model`,saveModelConfirm:`Save`,validationErrors:`Validation issues`,validationWarnings:`Warnings`,testError:`Error`,testOk:`Resolved`}},jt={sessions:{title:`Sessions`,needToken:`Save a gateway token to manage sessions.`,searchPlaceholder:`Search sessions…`,filterAll:`All`,filterActive:`Active`,filterPinned:`Pinned`,filterArchived:`Archived`,filterChannelAll:`All channels`,filterChannelLabel:`Channel`,totalSessions:`Total`,activeSessions:`Active`,pinnedSessions:`Pinned`,archivedSessions:`Archived`,sessionCount:`{{count}} shown`,loadMore:`Load more`,noSessions:`No sessions yet`,noSessionsDescription:`Start a conversation in Chat; sessions will appear here.`,startNewChat:`Start New Chat`,continueChat:`Continue in chat`,archive:`Archive`,unarchive:`Unarchive`,pin:`Pin`,unpin:`Unpin`,export:`Export JSON`,delete:`Delete`,deleteSessionTitle:`Delete session?`,deleteSessionMessage:`Delete “{{name}}”? This cannot be undone.`,cancel:`Cancel`,loading:`Loading…`,loadError:`Failed to load sessions`,gridView:`Grid`,listView:`List`,layoutToggleGroup:`Session layout`,detailLoading:`Loading session…`,detailMessages:`Messages`,detailExport:`Export`,close:`Close`}},Mt={settingsSections:{appearance:`Preferences`,agent:`Agent`,"agent-defaults":`Agent defaults`,"agent-chat":`Chat`,"agent-workspace":`Workspace`,"agent-browser":`Browser`,"agent-runtime":`Runtime`,"agent-tools":`Tools & skills`,"agent-system-prompt":`System prompt`,providers:`Providers`,models:`Models`,"image-models":`Images`,channels:`Channels`,voice:`Voice`,gateway:`Gateway`,heartbeat:`Heartbeat`,search:`Web search`,dreams:`Dreams`,agents:`Agents`,system:`System`,cron:`Scheduled Tasks`,skills:`Skills`},dreamingSettings:{title:`Dreams`,subtitle:`Inspect and maintain the background memory promotion sweep.`,refresh:`Refresh`,runNow:`Run now`,runPhaseLabel:`Phase`,runNowHint:`Trigger the managed cron job immediately.`,runQueued:`Run queued.`,actionOk:`Done.`,configSaved:`Configuration saved.`,configTitle:`Configuration`,configHint:`Edits agents.defaults.memory.dreaming and writes back to the gateway config file.`,configLoading:`Loading configuration…`,saveConfig:`Save`,resetConfig:`Reset`,configEnabled:`Enable dreaming`,configFrequency:`Global fallback schedule`,configTimezone:`Timezone (IANA)`,configPhaseLight:`Light Sleep`,configPhaseLightHint:`Lightweight deduplication sweep (every 6h by default).`,configPhaseDeep:`Deep Sleep`,configPhaseDeepHint:`Full promotion sweep with scoring and time decay (daily at 3 AM).`,configPhaseRem:`REM Sleep`,configPhaseRemHint:`Cross-entry pattern clustering and dream diary (weekly on Sunday 5 AM).`,configPhaseEnabled:`Enabled`,configPhaseCron:`Cron schedule`,configLightLookbackDays:`Lookback (days)`,configLightLimit:`Limit`,configLightDedupe:`Dedupe similarity`,configDeepMinScore:`Min score`,configDeepMinRecallCount:`Min recall count`,configDeepLimit:`Limit`,configDeepHalfLife:`Recency half-life (days)`,configDeepMaxAge:`Max age (days)`,configRemLookbackDays:`Lookback (days)`,configRemLimit:`Limit`,configRemMinStrength:`Min pattern strength`,previewTitle:`Preview (dry-run)`,previewHint:`Shows the top candidates after rehydration, contamination filtering, and marker/hash dedupe checks. No files are written.`,previewLoad:`Load preview`,previewNotLoaded:`Preview not loaded yet.`,previewEmpty:`No eligible candidates found.`,previewEligible:`eligible`,runtimeTitle:`Runtime`,runtimeHint:`Read-only: effective settings from the gateway, the recall store, and the latest sweep output.`,subsectionSchedule:`Schedule & lock`,subsectionStore:`Short-term store`,subsectionPhases:`Phases (live)`,subsectionDeep:`Deep gate (live)`,subsectionLastRun:`Last sweep (deep)`,subsectionLightLastRun:`Last sweep (light)`,subsectionRemLastRun:`Last sweep (REM)`,lastRunBlockHint:`Data file: memory/.dreams/last-run.json`,phaseLastRunEmpty:`No runs recorded yet.`,phaseLastRunOk:`OK`,phaseLastRunFailed:`Failed`,lockValueLocked:`Locked`,lockValueUnlocked:`Unlocked`,statusTitle:`Status`,statusHint:`This reads the store under your configured workspace (memory/.dreams).`,enabled:`Enabled`,on:`On`,off:`Off`,schedule:`Schedule`,timezone:`Timezone`,lock:`Promotion lock`,storeEntries:`Store entries`,storePromoted:`Promoted entries`,storeUpdatedAt:`Store updated`,storeLastPromotedAt:`Last promoted`,deepGate:`Deep gate:`,deepGateValue:`minScore={{minScore}}, minRecallCount={{minRecallCount}}, limit={{limit}}`,lastRunTitle:`Last run`,lastRunHint:`memory/.dreams/last-run.json: timing, deep gate config snapshot, ranked/applied counts, and skip reasons. Raw JSON is below for debugging.`,lastRunEmpty:`No runs recorded yet.`,lastRunDuration:`Duration`,lastRunStatus:`Result`,lastRunSuccess:`OK`,lastRunFailure:`Failed`,lastRunReason:`Reason`,lastRunError:`Error`,lastRunRanked:`Ranked candidates`,lastRunApplied:`Applied to MEMORY.md`,lastRunSkipped:`Skipped (counts)`,lastRunSkipKey:`Key already in MEMORY`,lastRunSkipRehydrate:`Rehydrate failed`,lastRunSkipContaminated:`Contaminated`,lastRunSkipHash:`Hash duplicate`,lastRunParseError:`Could not parse last-run file`,lastRunRaw:`Raw JSON`,eventsTitle:`Event log`,eventsHint:`Audit trail of dreaming phase runs (memory/.dreams/events.jsonl).`,eventsLoad:`Load events`,eventsNotLoaded:`Event log not loaded yet.`,eventsEmpty:`No events recorded yet.`,maintenanceTitle:`Maintenance`,maintenanceHint:`These actions only affect the store/lock files. They do not edit MEMORY.md.`,resetStore:`Reset store`,clearLock:`Clear lock`,confirmResetStore:`Reset the dreaming store? This clears short-term recall signals.`,confirmClearLock:`Clear the promotion lock file? Only do this if a sweep got stuck.`},systemSettings:{title:`System`,behaviorGroup:`App behavior`,desktopOnlyTitle:`Desktop app only`,desktopOnlyBody:`System integration is available in the xopc Electron app. In the browser, use your OS settings instead.`,toggles:{openAtLogin:`Open at login`,openAtLoginDesc:`Start xopc when you sign in to this user account.`,keepAwake:`Keep system awake`,keepAwakeDesc:`While enabled, the app requests that the system stay awake (agent work may not be interrupted by idle sleep).`,notifyDesktop:`Desktop notifications`,notifyDesktopDesc:`Allow the app to show system notifications when you wire them in a future update (preference is saved now).`,notifySound:`Sound notifications`,notifySoundDesc:`Play a sound when a notification is shown (when notification sound is implemented).`},permissionsTitle:`System permissions`,permissionsHint:`Status is best-effort. After changing system settings, refresh or revisit this page.`,permissionsHintDarwin:`macOS privacy (TCC) and media status are best-effort. Use Refresh after you change System Settings.`,permissionsHintWin:`On Windows, microphone and (where reported) screen access follow system-wide toggles. Each link opens a relevant page in the Settings app.`,permissionsHintLinux:`Linux does not report these states here. We try to open your desktop’s Settings; otherwise a documentation page opens. Grant access in your distro, Flatpak, or portal as needed.`,status:{granted:`Allowed`,denied:`Not allowed`,unknown:`Unknown`},openSettings:`Open settings`,refresh:`Refresh status`,perm:{fullDisk:{title:`Files & storage`,desc:`Read and write workspace and user data when the OS or sandbox allows (wording and paths vary by system).`},screen:{title:`Screen Recording`,desc:`Capture the screen for vision features outside the in-app browser.`},microphone:{title:`Microphone`,desc:`Record voice in chat and voice features.`},accessibility:{title:`Accessibility`,desc:`Use global shortcuts and accessibility-related integrations.`},automation:{title:`Automation & app integration`,desc:`Control or integrate with other apps and services (e.g. Apple Events on macOS, default apps on Windows, or desktop portals on Linux).`},notifications:{title:`Notifications`,desc:`Allow the app in your OS notification settings so alerts can appear.`},location:{title:`Location`,desc:`Location-based tasks when the product uses location.`}}},settingsNavGroups:{general:`General`,models:`Models & media`,agent:`Agent defaults`,gateway:`Gateway`,automation:`Automation`,data:`Sessions & logs`,extensions:`Extensions`},imageModelsSettings:{title:`Images`,subtitle:`Vision (understanding) and image-generation defaults, runtime options, and registered image providers.`,refresh:`Refresh`,crossLinkHint:`Primary chat model and sampling are on the Chat tab; text model fallbacks are on the Models tab (same group). This page and Agent defaults together edit vision (understanding) and image-generation fields in agents.defaults.`,timeoutLabel:`Timeout (ms)`,timeoutHint:`Hard cap for one generation attempt; leave empty for the gateway default (120000 ms).`,autoFallbackLabel:`Auto-fallback to any configured provider`,autoFallbackHint:`After the primary chain fails, sweep every other configured provider before giving up.`,save:`Save`,discard:`Discard`,saving:`Saving…`,saved:`Saved.`,providersTitle:`Registered providers`,providersEmpty:`No image-generation providers registered.`,configured:`Configured`,missingKey:`Missing API key`,defaultModel:`Default`,modelsLabel:`Models`,credentialsIntro:`Set API keys and optional endpoints here. Values are written to config as providers.<id> (same as environment variables). Keys are never returned in full from the gateway.`,apiKeyLabel:`API key`,regionLabel:`Region`,regionHint:`DashScope: pick a region on its card to set region and the official image endpoint (Custom lets you type both).`,endpointPresetsHint:`When a card shows endpoint or cluster presets, pick one or use Custom — values are saved as providers.<id>.baseUrl.`,baseUrlLabel:`Base URL`,imageBaseUrlLabel:`Image base URL`,optionalPlaceholder:`Optional`,saveCredentials:`Save keys`,savingCredentials:`Saving…`,credentialsSaved:`Keys saved.`,discardCredentials:`Discard keys`,credentialsSaveError:`Could not save provider keys.`,credentialsNothingToSave:`No credential changes to save.`,regionPresetDefault:`Default (gateway chooses)`,regionPresetCustom:`Custom region / endpoint`,baseUrlPresetDefault:`Default (vendor official)`,baseUrlPresetCustom:`Custom URL`,openExtensionSettings:`Extension page`,openImageModelsPage:`Open Images settings`,extensionSettingsLinkTitle:`Open this provider’s extension settings`,imageModelsLinkTitle:`Open Images settings for all providers`,imageBaseUrlPresetHint:`Filled from the region preset; switch to “Custom” to edit.`,dashscopeRegion_beijing:`China (Beijing)`,dashscopeRegion_singapore:`International (Singapore)`,dashscopeRegion_us:`United States (Virginia)`,apiKeyMaskedHelp:`Saved keys are hidden. Click the eye to load the key from your config file (providers.<id>.apiKey only — not from environment variables).`,apiKeyCopy:`Copy`,apiKeyCopied:`Copied`,apiKeyShow:`Show key`,apiKeyHide:`Hide key`,apiKeyNotInConfigFile:`No API key in the config file for this provider (it may come only from an environment variable).`,apiKeyRevealFailed:`Could not load key from the gateway.`,minimaxClusterLabel:`MiniMax cluster (API host)`,minimaxClusterHint:`MiniMax chooses China vs international by hostname, not a separate region code. The gateway stores that host as providers.minimax.baseUrl (what the runtime reads). DashScope uses providers.dashscope.region plus an image endpoint URL.`,falQueueBaseLabel:`Fal queue / API base`,falQueueBaseHint:"Fal image calls are rooted at a queue URL (default `https://queue.fal.run`). This maps to `providers.fal.baseUrl`."},extensionImageGen:{banner:`API keys and endpoints are stored globally as providers.<id> (same as Settings → Images). Use either page — they stay in sync.`,openImageModels:`Open Images settings (all providers)`},appearanceSettings:{pageTitle:`Preferences`,subtitle:`Language, appearance, and text size for daily use. Stored in this browser only.`,languageTitle:`Language`,languageDescription:`Choose the interface language.`,themeTitle:`Theme`,themeDescription:`Light, dark, or follow your system setting.`,colorSchemeTitle:`Color scheme`,colorSchemeDescription:`Visual style of the interface.`,colorSchemeDefault:`Default`,colorSchemeLightGreen:`Light green`,colorSchemeModernMono:`Mono`,fontScaleTitle:`Conversation text size`,fontScaleDescription:`Adjust text size in chat and reading areas.`,fontScaleCompact:`Small`,fontScaleDefault:`Medium`,fontScaleLarge:`Large`,langOptionEn:`English`,langOptionZh:`中文`,themeOptionLight:`Light`,themeOptionDark:`Dark`,themeOptionSystem:`System`,openFullPreferences:`Open all settings`,quickMenuHint:`Language, theme, and text size`,aboutApp:`About`}},Nt={appBrand:`XOPC`,sidebarCollapse:`Collapse sidebar`,sidebarExpand:`Expand sidebar`,closeMenu:`Close menu`,openMenu:`Open menu`,appBarPreferences:`Language and theme`,nav:{chat:`Chat`,management:`Management`,settings:`Settings`,sessions:`Sessions`,cron:`Scheduled Tasks`,skills:`Skills`,channels:`Channels`,agents:`Agents`,apps:`Apps`,logs:`Logs`,settingsAppearance:`Preferences`,settingsProviders:`Providers`,settingsModels:`Models`,settingsImageModels:`Images`,settingsChannels:`Channels`,settingsVoice:`Voice`,settingsGateway:`Gateway`,settingsHeartbeat:`Heartbeat`,settingsSearch:`Web search`,settingsDreams:`Dreams`,settingsAgentChat:`Chat`,settingsAgentWorkspace:`Workspace`,settingsAgentBrowser:`Browser`,settingsAgentRuntime:`Runtime`,settingsAgentTools:`Tools & skills`,settingsAgentSystemPrompt:`System prompt`,settingsAgents:`Agents`,settingsSystem:`System`},token:{title:`Authentication required`,description:`Enter your gateway token to continue.`,gatewayUrl:`Gateway URL`,tokenLabel:`Token`,placeholder:`Gateway token (e.g. ea4c67bf…)`,save:`Save`,show:`Show`,hide:`Hide`},gatewayLanding:{headline:`Connect to this gateway`,subline:`The Web console needs the same token your server uses. Get it from setup or your config file, then paste it below.`,sessionExpired:`Your session expired or the token was rejected. Enter a valid gateway token to continue.`,stepOnboard:`Run xopc onboard (or onboard --gateway) and enable the Web console — the token is printed there.`,stepPaste:`Paste the token here and save. You can also open a link that ends with ?token=… from onboarding.`,stepUrlHint:`Opening a bookmark with ?token= in the URL saves it automatically (the address bar is cleaned afterward).`,docsGatewayLink:`Gateway guide`},electron:{setupBannerTitle:`Finish setup to start chatting`,setupBannerBody:`Add at least one model provider API key and choose a default model. You can change this anytime in Settings.`,setupBannerLinkProviders:`Provider keys`,setupBannerLinkModels:`Default model`,setupBannerDismiss:`Don't show again`,gatewayExitTitle:`Local gateway stopped`,gatewayExitBody:`The assistant backend exited unexpectedly. Restart the app to continue.`},connection:{connecting:`Connecting…`,online:`Online`,reconnecting:`Reconnecting…`,offline:`Offline`,error:`Connection error`,reconnect:`Reconnect`},api:{errorBadGateway:`Bad gateway (502)`,errorServiceUnavailable:`Service unavailable (503)`,errorGatewayTimeout:`Gateway timeout (504)`,errorInternal:`Internal server error (500)`,errorServer:`Server error ({{status}})`,errorNotFound:`Not found (404)`,errorForbidden:`Forbidden (403)`,errorRequest:`Request failed ({{status}})`},sidebar:{newTask:`New task`,tasksHeading:`Tasks`,viewAllSessions:`All sessions`,taskListEmpty:`No chats yet`,taskListNeedToken:`Save a gateway token to load your chats.`,taskListAddToken:`Add token`,taskListStartChat:`Start a chat`,appMenuAria:`App menu and settings`,taskSessionMenuAria:`Session actions`,taskSessionAgentRunning:`Assistant is still responding`,taskRename:`Rename`,taskCopyChatId:`Copy chat ID`,taskDeleteTask:`Delete task`,taskRenameTitle:`Rename task`,taskRenamePlaceholder:`Session name`,taskRenameSave:`Save`,taskRenameCancel:`Cancel`,backToApp:`Back to app`,backToAgents:`Back to agents`,back:`Back`,helpDocs:`Documentation`,sessionChannelFilterAria:`Filter tasks: web app or channels`,sessionTasksTab:`Tasks`,sessionChannelsTab:`Channels`,resizeHandleAria:`Resize sidebar`},aboutDialog:{windowTitle:`About this application`,close:`Close`,versionLabel:`Version`,commitLabel:`Commit`,buildDateLabel:`Date`,gatewayVersionLabel:`Gateway`,consoleBuildHint:`Console UI build (this browser bundle). Gateway is the running xopc service.`,checkUpdates:`Check for updates`,checkUpdatesChecking:`Checking...`,checkUpdatesUpToDate:`You're up to date`,checkUpdatesAvailable:`Update available: v{version}`,checkUpdatesDownloading:`Downloading... {percent}%`,checkUpdatesDownloaded:`Ready to install: v{version}`,checkUpdatesError:`Check failed`,gatewayUnavailable:`—`,openSourceLead:`This software is made possible by `,openSourceLink:`open source software`,copyright:`Copyright © {year} xopcai`},updatePanel:{restartToUpdate:`Restart to update`,dismissAria:`Dismiss`,dismissHint:`Do not show this reminder again for this version`,reminderElectronReady:`Update v{{version}} is ready. Restart the app to install.`,reminderDownloading:`Downloading update… {{percent}}%`,reminderElectronUpdateError:`Desktop update failed: {{detail}}`,reminderNpm:`A new version v{{version}} is available for the gateway.`,updateNow:`Update now`,updateRunning:`Updating…`,updateSuccess:`Update installed`,updateSuccessDetail:`Restart the gateway to use the new version (for example: xopc gateway restart).`,updateErrorGit:`One-click update unavailable`,updateErrorBusy:`An update is already in progress`,updateErrorFailed:`Update failed`,restartRequired:`v{{version}} installed. Restart the gateway to use the new version.`,restartGateway:`Restart gateway`}},Pt={skills:{title:`Skills`,needToken:`Save a gateway token to manage skills.`,tagline:`Install and manage skills to extend xopc in conversation.`,refresh:`Refresh list`,reloadRuntime:`Reload from disk`,reloadDiskAria:`Reload skills from disk`,skillsNavAria:`Skill sources`,tabBuiltin:`Built-in`,tabUser:`Installed`,tabMarketplace:`Marketplace`,marketplacePlaceholder:`The skill marketplace is coming soon.`,sectionMarketplace:`Skill store`,marketplaceSortLabel:`Sort`,marketplaceSortDownloads:`Most downloads`,marketplaceSortNewest:`Newest`,marketplaceCategoryAll:`All`,marketplaceCategoriesAria:`Marketplace categories`,marketplaceCategoriesFailed:`Could not load categories`,marketplaceSearchPackages:`Search skill name, description, tags…`,marketplaceStars:`Stars`,marketplaceSource:`Source`,marketplaceLoadFailed:`Failed to load marketplace`,marketplaceEmpty:`No packages match your search.`,marketplaceInstall:`Install`,previewUseInChat:`Use in chat`,previewUseInChatBusy:`Installing…`,marketplaceReinstall:`Reinstall`,marketplaceInstalled:`Installed`,marketplaceReinstallConfirm:`This skill is already installed. Replace it with the version from the store?`,marketplacePagePrev:`Previous page`,marketplacePageNext:`Next page`,marketplacePageStatus:`Page {{page}} of {{totalPages}} · {{total}} packages`,marketplaceAuthor:`Author`,marketplaceOpenOnSkillhub:`Open on SkillHub`,marketplaceOpenOnSkillhubAria:`Open this skill on skillhub.cn in a new tab`,marketplaceDownloads:`Downloads`,marketplaceVersion:`Latest`,sectionBuiltinList:`Built-in skills`,categoryLabel:{business:`Business`,creative:`Creative & Design`,documents:`Documents`,engineering:`Engineering`,tools:`Tools & Utilities`},filterAll:`All`,filterGlobal:`Global`,filterWorkspace:`Workspace`,filterExtra:`Extra`,sectionUser:`Your skills`,installCta:`Install skill`,installModalTitle:`Install skill`,installModalDropHint:`Drop a .zip or SKILL.md file, or click to choose.`,installModalReqTitle:`Requirements`,installModalReq1:`A .zip archive that contains SKILL.md`,installModalReq2:`Or drop a SKILL.md file directly`,installAction:`Install`,installClose:`Close`,searchPlaceholder:`Search skills`,noSearchResults:`No skills match your search.`,uploading:`Uploading…`,loading:`Loading…`,empty:`No skills loaded.`,loadFailed:`Failed to load skills`,reloadFailed:`Failed to reload skills`,skillToggleFailed:`Failed to update skill`,uploadFailed:`Upload failed`,installSuccess:`Skill installed.`,zipOnly:`Please choose a .zip file`,invalidFile:`Choose a .zip or SKILL.md file`,delete:`Delete`,deleteTitle:`Delete skill`,deleteMessage:`Remove folder "{{id}}" from managed skills? This cannot be undone.`,deleteConfirm:`Delete`,deleteFailed:`Failed to delete skill`,yes:`Yes`,no:`No`,cancel:`Cancel`,source:{builtin:`Bundled`,workspace:`Workspace`,global:`Global`,extra:`Extra`},col:{name:`Name`,description:`Description`,source:`Source`,managed:`Managed`,actions:`Actions`},detailModalBanner:`Metadata comes from SKILL.md YAML frontmatter; the instruction body below excludes that block.`,detailModalBannerStore:`Preview below is the markdown published with this package on the skill store (same content as the package readme).`,detailSummaryHeading:`Summary`,detailInstructionsHeading:`Instructions`,detailNoInstructionsBody:`No instruction body after frontmatter.`,detailHomepageLabel:`Homepage`,detailPlatformsLabel:`Platforms`,detailRequiresLabel:`Requirements`,detailRequiresBins:`Binaries`,detailRequiresEnv:`Environment variables`,detailRequiresAnyBins:`Any of these binaries`,detailInstallLabel:`Install steps`,detailToolGatingLabel:`Tool visibility`,detailToolsRequiresList:`Requires tools`,detailToolsetsRequiresList:`Requires toolsets`,detailToolsFallbackList:`Fallback tools`,detailToolsetsFallbackList:`Fallback toolsets`,detailEnvVarsLabel:`Session environment variables`,detailNotInjectedNote:`This skill is not injected into model context (disable-model-invocation).`,marketplaceNoReadme:`No readme text is available for this package.`,detailModalEnable:`Enable`,detailModalDisable:`Disable`,detailLoadFailed:`Failed to load SKILL.md`,detailCloseAria:`Close`,hubRemote:`Remote`,hubKindGit:`git`,hubKindArchive:`archive`}},Ft={workspace:{title:`Project Files`,currentWorkspace:`Current Workspace`,openFiles:`Project Files`,preview:`Preview`,download:`Download`,copyPath:`Copy Path`,pathCopied:`Path copied`,edit:`Edit`,viewing:`Viewing`,saved:`Saved`,saving:`Saving…`,emptyDir:`No files`,loadError:`Failed to load`,close:`Close`,resizeHandleAria:`Resize project files panel`,lastModified:`Modified`,openElsewhereHint:`Preview may be limited or unavailable. Download the file or open it with another app.`,cannotPreviewType:`This file type can't be previewed here.`,openSystemApp:`Open with default app`}},It={agentSettings:JSON.parse('{"subtitle":"模型、工作区、采样与输出方式的默认配置。","sectionDesc":"修改将写入网关配置文件;部分项在下一轮对话或新会话中生效。","needToken":"请先保存网关访问令牌后再加载或修改智能体默认项。","loadError":"加载设置失败","save":"保存","discard":"放弃","saving":"保存中…","saved":"已保存","saveError":"保存失败","routeIntro":{"chat":"主模型、采样参数与界面展示方式。保存到网关配置中的 agents.defaults。","workspace":"智能体工作目录与图像工具加载入站图片的体积上限。","browser":"Playwright 的 browser_* 工具:开关、无头模式、超时与本地或云端后端。","runtime":"单轮耗时与请求上限、上下文压缩、工具输出裁剪、记忆、会话检索摘要模型与后台回顾。","tools":"可选工具(网页抽取、子任务委托、沙箱执行代码)、全局禁用工具名、技能白名单以及扩展用 Params(JSON)。","systemPrompt":"可选覆盖默认系统提示;与智能体级合并(条目优先)。保存到 agents.defaults。"},"cardModelsTitle":"模型","cardModelsSubtitle":"对话、视觉与图像生成默认模型","cardWorkspaceTitle":"工作区与附件","cardWorkspaceSubtitle":"工作目录与入站媒体大小限制","cardBrowserTitle":"浏览器自动化","cardBrowserSubtitle":"Playwright 工具 — 导航、快照、点击、控制台、视觉分析等","browserEnabledOn":"启用浏览器工具","browserHeadlessOn":"无头模式(不显示浏览器窗口)","browserAllowPrivateOn":"允许内网/私有 URL","browserDialogPolicyMustRespond":"智能体必须响应","browserDialogPolicyAutoDismiss":"自动关闭","browserDialogPolicyAutoAccept":"自动接受","browserCloudProviderLocal":"本地(Playwright)","browserCloudProviderBrowserbase":"Browserbase","browserCloudProviderBrowserUse":"Browser Use","cardGenerationTitle":"采样与工具","cardGenerationSubtitle":"输出上限(Token)、随机性与工具调用轮数","cardBehaviorTitle":"推理与输出","cardBehaviorSubtitle":"思考深度、推理可见性与详细程度","label":{"model":"模型","modelFallbacks":"备用模型","imageModel":"图像理解模型","imageModelFallbacks":"图像理解备用模型","imageGenerationModel":"图像生成模型","imageGenerationModelFallbacks":"图像生成备用模型","mediaMaxMb":"图像加载上限 (MB)","workspace":"工作区","browserEnabled":"浏览器工具","browserHeadless":"无头模式","browserAllowPrivateUrls":"允许私有 URL","browserCommandTimeout":"命令超时(秒)","browserCloudProvider":"浏览器后端","browserCdpUrl":"CDP 端点 URL","browserDialogPolicy":"对话框处理策略","browserDialogTimeout":"对话框超时(秒)","maxTokens":"最大 Token 数","temperature":"温度","maxToolIterations":"最大工具调用轮数","thinkingDefault":"思考级别","reasoningDefault":"推理可见性","verboseDefault":"详细程度"},"desc":{"model":"新会话的默认模型。","modelFallbacks":"主模型在瞬时重试后仍失败时,按顺序尝试。各服务商均需配置 API Key。","imageModel":"可选,用于图像理解 / 视觉。下列仅展示网关判定为接受图像输入的模型。","imageModelFallbacks":"主视觉模型失败时按顺序尝试。下列仅展示标记为支持图像输入的模型。","imageGenerationModel":"可选,用于 image_generate。下列仅展示网关判定为已配置 API 凭证的图像生成服务商。","imageGenerationModelFallbacks":"主图像生成模型失败时按顺序尝试。下列仅展示已配置凭证的图像生成服务商。","mediaMaxMb":"图像工具加载单张图片时的最大体积。","workspace":"智能体读写文件的工作目录。","browserEnabled":"向模型暴露 Playwright 的 browser_* 工具。请在网关所在机器执行一次:npx playwright install chromium。","browserHeadless":"关闭时会在网关机器上显示 Chromium 窗口(便于调试);开启时在后台运行。","browserAllowPrivateUrls":"跳过导航时的私有 IP 拦截。云元数据端点(169.254.169.254 等)始终被拦截。","browserCommandTimeout":"单条浏览器命令(导航、点击等)的最大秒数。默认 30。","browserCloudProvider":"浏览器后端:本地 Playwright、Browserbase 云或 Browser Use 云。云端需在环境中配置 API Key。","browserCdpUrl":"Chrome DevTools Protocol 的 WebSocket 端点(如 ws://localhost:9222)。设置后将跳过云端 provider。","browserDialogPolicy":"JS 对话框(alert/confirm/prompt)的处理方式:智能体必须响应、自动关闭或自动接受。","browserDialogTimeout":"未处理的对话框在自动策略下的等待秒数。默认 300。","maxTokens":"模型回复的最大 Token 数。","temperature":"随机性(0–2)。","maxToolIterations":"单条用户消息内最多进行多少轮工具调用。","thinkingDefault":"新会话的默认思考级别。","reasoningDefault":"是否在聊天界面展示模型推理。若会话曾设置 /reasoning 等,会覆盖此默认直至清除会话配置。","verboseDefault":"智能体在日志与工具细节上的详细程度,不控制聊天中的推理/思考区块;若要隐藏推理请使用「推理可见性」。"},"addModelFallback":"添加备用模型","removeModelFallback":"移除备用模型","visionRegistryEmpty":"当前已配置的服务商下,没有标记为支持图像输入的模型。可在 models.json 中为模型设置包含 \\"image\\" 的 `input`,或选择上游目录中声明支持图像的模型。","visionOutOfFilterNote":"网关模型目录未将该模型标为支持图像;建议尽量选择带图像能力的模型。","imageGenRegistryEmpty":"当前没有已配置 API 凭证的图像生成服务商。请在配置或环境变量中填写对应密钥(如 OpenAI)后刷新。","imageGenOutOfFilterNote":"该模型所属服务商未配置凭证;在配置完成或改选已配置的服务商之前,image_generate 将无法使用该模型。","reasoning":{"off":"关闭","on":"开启","stream":"流式"},"verbose":{"off":"关闭","on":"开启","full":"完整"},"advanced":{"cardLimitsTitle":"单轮限制与可靠性","cardLimitsSubtitle":"单轮最大耗时、重试与工具连续失败次数。","maxTaskDurationMs":"单轮最长时间(分钟)","maxTaskDurationMsDesc":"单条用户消息内(模型 + 工具)墙钟上限。留空用服务端默认。范围 1–240 分(1 分–4 小时)。","maxTaskDurationPlaceholder":"如 30(留空为默认)","maxRequestsPerTurn":"每轮最大请求数","maxRequestsPerTurnDesc":"单条用户消息内大模型重试/请求尝试上限(默认 50)。","maxToolFailuresPerTurn":"每轮最大工具失败次数","maxToolFailuresPerTurnDesc":"连续工具错误达到该值后放弃(默认 3)。","cardCompactionTitle":"上下文压缩","cardCompactionSubtitle":"在上下文中按策略压缩较早内容以适配窗口。","compactionEnabled":"启用压缩","compactionEnabledDesc":"关闭后不按策略压缩(可能更占上下文)。","compactionEnabledOn":"启用压缩","compactionMode":"模式","compactionModeDesc":"default:标准;safeguard:更谨慎的启发式。","compactionModeDefault":"default","compactionModeSafeguard":"safeguard","reserveTokens":"保留 token","reserveTokensDesc":"压缩后为目标模型预留的头部空间(默认 8000)。","triggerThreshold":"触发阈值","triggerThresholdDesc":"已用上下文比例达到该值时考虑压缩(0.5–0.95)。","minMessagesBeforeCompact":"最早压缩前消息数","minMessagesBeforeCompactDesc":"达到该条数后才允许开始压缩(默认 10)。","keepRecentMessages":"保留最近消息数","keepRecentMessagesDesc":"尾部始终完整保留的最近轮次(默认 5)。","evictionWindow":"逐出窗口","evictionWindowDesc":"可参与先摘要/逐出策略的历史比例(0.1–0.5)。","retentionWindow":"保留窗口","retentionWindowDesc":"参与保留策略的轮次宽度(3–20)。","cardPruningTitle":"工具结果裁剪","cardPruningSubtitle":"在送入模型前截断过长的工具输出。","pruningEnabled":"启用裁剪","pruningEnabledDesc":"关闭后整段工具结果可能入模型(成本更高)。","pruningEnabledOn":"启用裁剪","maxToolResultChars":"单条工具结果最大字符","maxToolResultCharsDesc":"单条工具结果默认上限(默认 10000)。","headKeepRatio":"保留开头比例","headKeepRatioDesc":"裁剪时从开头保留比例(0–1,默认 0.3)。","tailKeepRatio":"保留结尾比例","tailKeepRatioDesc":"从结尾保留比例(0–1,默认 0.3)。","cardMemoryTitle":"记忆(精选与外部)","cardMemorySubtitle":"系统记忆、USER.md 与可选外部 provider。","memoryEnabled":"记忆功能","memoryEnabledDesc":"总开关:精选记忆快照、工具与外部预取。","memoryEnabledOn":"启用","useEnhancedSystem":"增强 system","useEnhancedSystemDesc":"关闭时仅工作区引导(不附加额外记忆快照)。","useEnhancedSystemOn":"使用增强 system","userProfileEnabled":"包含 USER.md","userProfileEnabledDesc":"在快照中纳入 USER.md。","userProfileEnabledOn":"包含用户侧写","memoryProvider":"外部记忆 provider","memoryProviderDesc":"选 none / stub 或留空视为不设置。","memoryProviderUnset":"(不设置)","injectionFrequency":"外部预取注入","injectionFrequencyDesc":"将预取记忆注入到用户消息上下文的频率。","injectionFrequencyUnset":"(不设置)","injectionEveryTurn":"每轮(配合 cadence)","injectionFirstTurn":"仅首轮","memoryCharLimit":"记忆字符上限","memoryCharLimitDesc":"精选记忆快照最大字符数(可选)。","userCharLimit":"用户侧写字符上限","userCharLimitDesc":"USER.md 区块最大字符数(可选)。","contextCadence":"上下文节奏","contextCadenceDesc":"每轮注入时:在轮次 1、1+N、… 注入(最小 1)。","dialecticCadence":"对话节奏(预留)","dialecticCadenceDesc":"预留,尚未接入。设置时最小为 1。","cardSessionSearchTitle":"会话搜索(转写)","cardSessionSearchSubtitle":"session_search 工具中用于历史会话摘要的模型。","sessionSearchSummaryModel":"摘要模型","sessionSearchSummaryModelDesc":"如 openai/gpt-4o-mini。留空用运行时的默认/启发式。","cardReviewTitle":"后台审阅","cardReviewSubtitle":"成功回合后可选的静默跟进(记忆/技能)。默认关闭。","reviewEnabled":"启用后台审阅","reviewEnabledDesc":"开启后,成功轮次后可能跑静默跟进。","reviewEnabledOn":"启用","memoryNudgeInterval":"记忆审阅节奏(每 N 轮用户消息)","memoryNudgeIntervalDesc":"0 表示关闭该通道。默认 10。","skillNudgeInterval":"技能审阅(无 skill_manage 的轮数)","skillNudgeIntervalDesc":"0 表示关闭。默认 10。","reviewMaxToolRounds":"审阅中最大工具轮数","reviewMaxToolRoundsDesc":"1–32,默认 8。","reviewMaxHistoryMessages":"审阅上下文中最大消息数(尾部)","reviewMaxHistoryMessagesDesc":"10–200,默认 80。","reviewMaxDurationMs":"审阅时间上限(秒)","reviewMaxDurationMsDesc":"单轮审阅墙钟 30–600 秒,默认 120 秒。","cardWebExtractTitle":"web_extract(LLM 提取)","cardWebExtractSubtitle":"网页转 Markdown 提取的可选模型与长度。","webExtractModel":"模型","webExtractModelDesc":"留空用默认提取模型/启发式。","webExtractMaxLength":"最大长度","webExtractMaxLengthDesc":"提取文字最大长度(可选)。","cardDelegateTitle":"子智能体与代码执行","cardDelegateSubtitle":"可选:delegate_task 与沙箱 execute_code。","delegateEnabled":"子任务委托 delegate_task","delegateEnabledDesc":"开启后,若运行环境支持,可使用子智能体。","delegateEnabledOn":"开启","executeCodeEnabled":"execute_code(沙箱)","executeCodeEnabledDesc":"开启后,若运行环境允许,可见沙箱代码工具。","executeCodeEnabledOn":"开启","cardSystemPromptTitle":"系统提示词","cardSystemPromptSubtitle":"可选覆盖默认系统上下文;与智能体级合并,条目级优先。","cardSkillsTitle":"技能白名单","cardSkillsSubtitle":"非空时仅向提示中暴露列表中的 <available_skills>。","systemPromptOverride":"系统提示覆盖","systemPromptOverrideDesc":"可选全量覆盖;与智能体级合并(条目优先)。留空可清除。","systemPromptPlaceholder":"","skillsAllowlist":"技能名白名单","skillsAllowlistDesc":"设置后仅向提示暴露已勾选技能。选「全部技能」表示不过滤;选「仅已选技能」从目录勾选(配置里已有但目录未列出的项仍会显示)。","skillsAllowlistModeAll":"全部技能","skillsAllowlistModeRestrict":"仅已选技能","skillsAllowlistNotInCatalog":"不在目录中","addSkillName":"添加技能名","removeListItem":"移除此行","cardToolsDisableTitle":"工具 — 全局禁用","cardToolsDisableSubtitle":"在 agents.defaults 中禁用内建工具名(如 shell、web_search)。","toolsDisableFieldLabel":"内建工具","toolsDisableHint":"勾选表示默认智能体可使用该工具;取消勾选则全局禁用。与「智能体」中按条目的禁用会合并生效。","toolsDisableLoadingBuiltin":"正在加载内建工具列表…","toolsDisableEmptyBuiltin":"网关未返回任何内建工具。","toolsDisableNotInBuiltin":"不在内建列表中","toolsDisableQuickActionsLabel":"快捷操作","toolsDisableQuickEnableAll":"全部允许","toolsDisableQuickDisableAll":"全部禁用","toolsDisableQuickReadOnlyWorkspace":"工作区只读","toolsDisableQuickHighRiskOff":"关闭高危","toolsDisableQuickNoOutbound":"禁止出站","addToolName":"添加工具名","cardParamsTitle":"Params(JSON)","cardParamsSubtitle":"给扩展的任意键值,必须为 JSON 对象。","paramsJson":"Params 对象","paramsJsonDesc":"如 {\\"myFlag\\": true}。清空可去掉配置文件中的 params。","paramsInvalidJson":"Params 必须是有效 JSON 对象。请检查花括号、引号等。"}}'),agentsSettings:JSON.parse(`{"title":"智能体","subtitle":"管理 agents.list:工作区、默认路由与 Bootstrap 人设文件。","needToken":"请先保存网关访问令牌后再管理智能体。","loadError":"加载智能体列表失败","saveError":"请求失败","loading":"加载中…","tabOverview":"智能体列表","tabDefaults":"智能体默认配置","tabFiles":"Bootstrap 人设","tabTools":"工具","tabSkills":"技能","tabChannels":"通道","tabCron":"定时","selectAgent":"智能体","selectAgentHint":"选择一个智能体进行配置;身份文件位于 ~/.xopc/agents/<id>/bootstrap/。","agent":"智能体","defaultBadge":"默认","setDefault":"设为默认","editAgent":"运行配置","editAgentHint":"修改模型、工作区等配置,保存后将更新网关的 agents.list。","displayName":"名称","agentDescription":"描述","agentDescriptionPlaceholder":"简短说明,会显示在智能体卡片和选择器中(可选)。","workspacePath":"Markdown 工作区","modelPrimary":"模型(主)","modelClear":"清除","save":"保存","discard":"放弃","removeFromConfig":"从配置移除","purgeDisk":"移除并删除数据","addAgent":"添加智能体","addAgentHint":"创建新的智能体目录并初始化配置模板。","newAgentLabel":"名称","newAgentIdOptional":"Agent ID(可选)","newAgentIdPlaceholder":"留空则根据显示名称生成","newAgentIdRules":"1–64 个字符:字母、数字、下划线、连字符;须以字母或数字开头。勿使用保留 id(如 main、con)。","newWorkspace":"工作区目录(必填)","newModelOptional":"模型(可选)","create":"创建智能体","addAgentAria":"添加智能体","createModalCancel":"取消","closeDialogAria":"关闭","filesHint":"智能体的身份配置文件(SOUL、IDENTITY 等)。编辑后自动保存,可用「预览」查看渲染效果。","filesLoading":"正在加载文件列表…","filesEmpty":"暂无文件。","pickFile":"请选择要编辑的文件。","saveFile":"保存文件","filesBootstrapEdit":"编辑","filesBootstrapPreview":"预览","filesAutoSaveHint":"编辑后自动保存。","filesSavingStatus":"保存中…","missing":"缺失","confirmDelete":"从配置中移除此智能体?相关路由绑定会被清除。","confirmDeletePurge":"移除此智能体并删除其工作区与 ~/.xopc/agents/<id> 数据?此操作不可恢复。","purgeConfirmLabel":"输入 agentId 以确认","purgeConfirmPlaceholder":"请输入 {{agentId}} 以确认","purgeConfirmHint":"此操作不可恢复。需完整输入 {{agentId}} 才能启用删除。","toolsTitle":"内置工具","toolsHint":"按智能体禁用工具(与 agents.defaults 合并)。已在默认配置中禁用的工具不能在此处单独启用。","toolsSave":"保存工具禁用","toolsClearEntry":"清除本智能体的额外禁用","toolsLockedByDefaults":"已在默认中禁用","toolsDisableGroups":{"unknown":"自定义(不在内置列表)","workspace":"工作区与搜索","execution":"执行","web":"网络","messaging":"通道与出站","memory":"记忆与会话","media":"视觉与生成","extensions":"扩展","misc":"其他内置"},"toolDescriptions":{"read_file":"读取工作区内的文本与小文件(路径限制在工作区沙箱内)。","write_file":"在工作区创建新文件或覆盖已有文件。","edit_file":"通过定位替换或补丁式编辑修改已有文件。","list_dir":"列出工作区某目录下的文件与子目录。","grep":"用正则搜索文件内容(类似 ripgrep)。","find":"按文件名或 glob 在工作区内查找文件。","shell":"在与工作区关联的环境中执行 shell 命令,权限高;只读或更保守的智能体可关闭。","web_search":"检索公开网页,获取模型训练截止之后的事实与资料。","web_fetch":"请求 URL 并读取页面文本供模型使用。","send_message":"在已连接的通道上发送出站聊天内容(如 Telegram、CLI、网关等)。","send_media":"通过通道发送图片或其他媒体附件。","memory_search":"搜索为本智能体建立的记忆与笔记索引。","memory_get":"按 ID 读取某条记忆或片段。","curated_memory":"读取或更新智能体主目录下的精选 Markdown 记忆。","session_search":"在已保存的会话记录与按会话摘要中搜索。","image":"分析或描述图片(视觉),可来自工作区或当前对话。","image_generate":"使用已配置的图像 / 文生图模型生成图片。","extensions":"启用扩展注册的工具;关闭则屏蔽所有扩展工具。"},"skillsTitle":"技能白名单","skillsHint":"可选的 <available_skills> 白名单。「继承默认」仅使用 agents.defaults;「自定义」写入本智能体的 skills 数组。","skillsInherit":"继承默认","skillsCustomize":"自定义白名单","skillsSave":"保存技能","skillsCatalogLoading":"正在加载技能目录…","skillsEmptyCatalog":"目录中暂无技能。","skillsNoDescription":"SKILL.md 元数据中暂无描述。","skillsDefaultsLabel":"默认白名单:","skillsEffectiveLabel":"生效白名单:","skillsAllFromCatalog":"(全部目录技能)","channelsTitle":"路由绑定","channelsHint":"指向本智能体的 config.bindings。删除规则会更新网关上的完整 bindings 数组。","channelsLoading":"正在加载绑定…","channelsNone":"没有指向该智能体的绑定。","channelLabel":"通道","peerIdLabel":"对端 ID(可选)","channelsLoadingChannels":"正在加载通道列表…","channelsManualChannelHint":"网关未返回通道列表。请直接填写通道 id(如 telegram、webchat、gateway)。","channelsDisabledSuffix":"(已禁用)","channelsSessionLabel":"匹配范围","channelsRefreshSessions":"刷新","channelsRefreshSessionsHint":"重新加载该通道的近期会话","channelsLoadingSessions":"正在加载会话…","channelsPeerFromSessions":"从会话选择","channelsPeerAny":"该通道上全部入站","channelsNoSessionsHint":"此通道下暂无会话记录。先发一条消息,或在下方填写自定义对端 id。","channelsCustomPeerHint":"若填写,将覆盖上方会话选择;支持 * 通配,详见会话路由说明。","channelsCustomPeerPlaceholder":"例如 12345 或 *","addBinding":"添加绑定","removeBinding":"移除","cronTitle":"定时任务","cronHint":"隔离会话的定时任务可指定 agentId 作为会话键。未指定 agentId 的任务使用默认智能体,并在选中该智能体时显示。","cronLoading":"正在加载定时任务…","cronNone":"没有匹配的任务。","cronColSchedule":"计划","cronColMessage":"消息","cronColSession":"会话","cronColAgent":"智能体","cronAgentDefault":"默认智能体","cronAgentClear":"恢复默认","navIdentity":"智能体身份","navProfile":"关于你","navPersona":"人格","navTools":"工具","navSkills":"技能","navCoreFiles":"核心文件","navAdvanced":"高级","listSearchPlaceholder":"按名称、ID 或工作区搜索","listEmpty":"没有匹配的智能体。","listNoAgentsYet":"暂无智能体,请先创建一个。","listNewAgentCard":"新建智能体","listChatWithAgent":"聊天","defaultMainAgentName":"智能助手","defaultMainAgentDescription":"你的个人智能助手:解答疑问、协助日常事务,并随时与你交流。","editorNavAria":"智能体编辑器分区","skillsLibraryLink":"技能库","personaHint":"通过表单快速设置你的智能体身份和个性。高级编辑请前往「核心文件」。","personaSectionIdentity":"智能体身份","personaSectionIdentityHint":"你的智能体如何介绍自己","personaSectionUser":"关于你","personaSectionUserHint":"帮助你的智能体更好地了解你","personaSectionSoul":"个性与风格","personaSectionSoulHint":"定义你的智能体如何与你交流","personaName":"名字","personaNamePlaceholder":"例如:小助、星辰、晓彤…","personaCreature":"类型","personaCreaturePlaceholder":"自定义类型…","personaVibe":"风格","personaVibePlaceholder":"自定义风格…","personaEmoji":"签名表情","personaEmojiPlaceholder":"例如 🤖 ✨ 🧠","personaAvatar":"头像","personaAvatarPlaceholder":"URL 或工作区路径","avatarPickerTitle":"智能体头像","avatarOpenSettingsAria":"打开智能体头像设置","avatarRowHint":"选择风格或上传自定义图片。","avatarUploadCustom":"上传自定义图片","avatarStyleAdventurer":"冒险家","avatarStyleRobot":"机器人","avatarStyleLorelei":"洛蕾莱","avatarStyleThumbs":"Thumbs","avatarStyleFunEmoji":"趣味表情","avatarMore":"更多","avatarUploading":"上传中…","avatarUploadFailed":"上传失败,请换一张较小的 PNG、JPEG 或 WebP。","avatarInvalidImage":"请使用 PNG、JPEG 或 WebP 图片。","avatarTooLarge":"图片大小不能超过 512 KB。","personaCallName":"怎么称呼你","personaCallNamePlaceholder":"例如:小明","personaPronouns":"称谓","personaPronounsPlaceholder":"例如:先生、女士、同学","personaTimezone":"时区","personaTimezoneDetect":"自动检测","personaTimezoneCustom":"自定义时区…","personaNotes":"备注","personaNotesPlaceholder":"其他你希望智能体了解的信息…","personaSoulTemplate":"个性模板","personaSoulCustomEdit":"编辑个性描述 (Markdown)","personaSoulPreview":"预览","personaSoulEdit":"编辑","personaMemoryNote":"你在对话中分享的偏好(如喜欢的食物、习惯等)会被智能体自动记住,无需在这里添加。","personaSaving":"保存中…","personaSaved":"已保存","footerSaveNotApplicable":"本页内容自动保存,无需手动操作。底部「保存」仅用于智能体身份、工具、技能与核心文件。","presetSetupBadge":"快速设置","presetSetupTitle":"创建预置 Agent 开始使用","presetSetupSubtitle":"选择要创建的 Agent,每个都带有定制化的性格和独立工作空间,创建后可随时修改。","presetSkip":"跳过","presetCreateSelected":"创建 {{count}} 个 Agent","presetCreating":"正在创建…","presetCreatingProgress":"正在创建第 {{current}} 个 / 共 {{total}} 个…","presetSetupComplete":"Agent 创建成功!","presetCreateFailed":"创建 {{name}} 失败:{{message}}"}`)},Lt={appsPage:{title:`应用`,subtitle:`扩展市场、随 xopc 分发的内置扩展,以及全局(~/.xopc/extensions)与工作区(.extensions)安装。与技能页类似,可用 ?tab=marketplace | builtin | user。`,tabMarketplace:`扩展市场`,tabBuiltin:`内置`,tabUser:`用户安装`,appsNavAria:`应用分区`,emptyBuiltin:`网关未发现任何内置扩展(可检查网关日志与 dist/extensions 下的清单)。`,emptyUser:`未发现全局或工作区扩展。请安装到 ~/.xopc/extensions 或工作区 .extensions。`,searchPlaceholder:`搜索应用`,noSearchResults:`没有符合筛选的应用。`,statusEnabled:`已启用`,cardNoDescription:`清单中无描述。`,badgeKindUi:`界面`,badgeKindBackend:`后端`,badgeBundled:`内置`,cardTooltipHasUi:`声明了网关控制台界面(页面或设置)。`,cardTooltipNoUi:`无网关界面;仍可提供工具、钩子或频道等能力。`,badgeSourceGlobal:`全局`,badgeSourceWorkspace:`工作区`,badgeSourceOther:`其他`,detailTitle:`应用详情`,detailBack:`返回`,detailClose:`关闭`,detailProviderPrefix:`来源:`,providerBundled:`内置(随 xopc 分发)`,providerGlobal:`全局安装(~/.xopc/extensions)`,providerWorkspace:`工作区(.extensions)`,providerOther:`其他`,detailSectionFeatures:`应用能力`,detailNoDescription:`该扩展未提供描述。`,restartNote:`部分扩展变更需要重启网关后才会完整生效。`,cliManageHint:`非内置副本需通过 CLI 或文件系统安装、升级与卸载。`,builtinConfigHint:`频道与图片密钥请在「设置 → 频道」「设置 → 图片」中管理。内置启停与运行时对齐前不在此提供开关。`,backendOnlyHint:`该扩展无网关控制台界面;启用后工具与钩子仍会运行。`,badgePages:`{{count}} 个页面`,badgeSettings:`{{count}} 个设置`,badgeWidgets:`{{count}} 个聊天挂件`,badgeSidebar:`{{count}} 个侧栏`,open:`打开`,openSettings:`设置`,runStateLive:`运行中`,runStatePendingOn:`配置已启用`,runStatePendingOff:`配置已停用`,runStateOff:`已关闭`},extensionUi:{permissionTitle:`是否允许「{{name}}」?`,permissionSubtitle:`在扩展界面打开期间,它可能使用以下能力。`,permissionsNone:`清单中未声明额外权限。`,allow:`允许`,deny:`暂不`,deniedHint:`在你批准之前,此浏览器将不显示该扩展的界面。`,reviewPermissions:`查看权限`,loadFailed:`扩展面板加载失败。`,loadFailedConnectionHint:`若内嵌区域提示无法连接 localhost,请先启动 xopc 网关;若用 Vite 单独跑 web/,请确认 web/vite.config.ts 里代理的网关端口与正在运行的网关一致。`,retryLoad:`重新加载`},extensionDebug:{nav:`扩展调试`,title:`扩展调试`,subtitle:`查看网关发现的扩展、声明的权限,以及本机浏览器中对界面授权的存储。`,grantsHeading:`界面授权存储`,grantsHint:"localStorage 键 `xopc.extensionUiGrants.v1` — 已同意的权限列表指纹(按扩展)。",refresh:`刷新`,listHeading:`网关返回的扩展`,colId:`标识`,colName:`名称`,colPermissions:`清单权限`,futureHeading:`后续计划`,futureBody:`后续将支持 postMessage 捕获、按扩展查看存储,以及更细的权限调试。`}},Rt={channelsSettings:{needToken:`请先保存网关访问令牌后再编辑消息通道设置。`,subtitle:`Telegram、微信、飞书、钉钉消息入站。更改将写入网关配置文件。`,docsLink:`消息通道文档`,refresh:`刷新`,loadError:`加载消息通道设置失败`,loading:`加载中…`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存`,saveError:`保存失败`,retry:`重试`,unsavedHint:`有未保存的更改。`,hubConfigureButton:`配置`,hubConnectedBadge:`已连接`,enableChannelAria:`启用或停用该通道`,menuMoreAria:`更多操作`,menuEditConfig:`编辑配置`,menuRemoveConfig:`移除配置`,removeChannelTitle:`移除配置?`,removeChannelConfirm:`将移除 {{name}} 的网关配置并清除已保存的凭据?之后可重新配置。`,removeChannelAction:`移除`,modalCancel:`取消`,telegramTitle:`Telegram`,telegramSubtitle:`Bot Token、白名单及可选的多账号 JSON。`,weixinTitle:`微信`,weixinSubtitle:`用微信扫码登录(网页或命令行)后在此启用。凭据保存在运行网关的本机。`,feishuTitle:`飞书 / Lark`,feishuSubtitle:`飞书应用凭据、策略与可选的多账号 JSON。`,dingtalkTitle:`钉钉`,dingtalkSubtitle:`钉钉开放平台应用(Stream 机器人)凭据、策略与可选多账号 JSON。`,enableTelegramAria:`启用 Telegram 消息通道`,enableWeixinAria:`启用微信消息通道`,enableFeishuAria:`启用飞书消息通道`,enableDingtalkAria:`启用钉钉消息通道`,telegramToken:`Bot Token`,telegramTokenDesc:`来自 BotFather,保存在网关配置中。`,feishuAppId:`App ID`,feishuAppIdDesc:`在飞书开发者后台获取(cli_xxx),保存在网关配置中。`,feishuAppSecret:`App Secret`,feishuAppSecretDesc:`在飞书开发者后台获取,保存在网关配置中。`,feishuDomain:`域名`,connectionMode:`连接模式`,connectionModeDesc:`websocket:Socket Mode。webhook:本地 HTTP 接收事件。`,renderMode:`渲染模式`,enableStreaming:`启用流式输出`,requireMention:`群聊需要 @mention`,reactionNotifications:`表情反应通知`,allowFromDm:`允许私聊(用户 ID)`,allowFromDmDesc:`逗号分隔的用户 ID(策略为白名单时生效)。`,advancedShow:`高级选项`,advancedHide:`收起高级选项`,apiRoot:`API 根地址`,proxy:`代理`,dmPolicy:`私聊策略`,groupPolicy:`群组策略`,replyToMode:`回复引用模式`,streamMode:`流式模式`,allowFromGroups:`允许群组(ID)`,allowFromGroupsDesc:`逗号分隔的群 chat_id(群策略为白名单时生效)。`,historyLimit:`历史条数上限`,textChunkLimit:`文本分块上限`,telegramDebug:`调试模式`,multiAccountJson:`多账号(JSON)`,multiAccountJsonDesc:`可选。每账号可配置 botToken 或 tokenFile、策略与群组。留空 {} 则仅使用上方单一 Token。`,weixinQuickStartTitle:`最简步骤`,weixinStepLogin:`在本页使用下方「微信扫码登录」,命令行方式请见消息通道文档。`,weixinStepEnable:`下方打开「启用微信」并保存。`,weixinStepPairing:`扫码登录后即可正常收发;仅在需要限制谁可私聊时,将私聊策略改为白名单并配置允许来源。`,weixinAdvancedHint:`可选:白名单、路由标签、流式与分账号 JSON——仅在需要时展开。`,weixinAllowFrom:`允许来源`,weixinAllowFromDesc:`私聊策略为白名单时使用,逗号分隔的 wxid / openid。默认配对在扫码后即可与任意联系人私聊。`,weixinRouteTag:`路由标签`,weixinRouteTagDesc:`可选路由标签,可为数字或字符串。`,routeTagPlaceholder:`例如标签名或数字`,weixinDebug:`调试模式`,weixinDebugDesc:`为微信消息通道输出更详细的日志。`,weixinAccountsJson:`账号(JSON)`,weixinAccountsJsonDesc:`分账号名称、CDN 地址、路由标签与策略。`,weixinQrLoginTitle:`网页扫码登录`,weixinQrLoginDesc:`在网关上发起登录,使用微信扫码;成功后本页会自动刷新配置。`,weixinQrLoginButton:`微信扫码登录`,weixinQrLoginBusy:`正在启动…`,weixinQrLoginScanned:`已扫码,请在微信中确认`,weixinQrLoginSuccess:`微信已连接。`,weixinQrLoginCancel:`关闭二维码`,weixinQrImageError:`无法在页面内生成二维码,可在新标签页打开链接完成扫码,或点击「重新生成」重试。`,weixinQrOpenLink:`新标签页打开`,weixinQrEncoding:`正在生成二维码…`,weixinQrModalTitle:`扫码登录`,weixinQrModalSubtitle:`请使用微信扫描下方二维码完成连接`,weixinQrRegenerate:`重新生成`,weixinQrModalCloseAria:`关闭`,feishuQrModalTitle:`扫码创建应用`,feishuQrModalSubtitle:`默认使用国内(飞书)。可在二维码下方切换为国际(Lark)。展开高级选项可手动填写凭证与策略。`,feishuQrCloseAria:`关闭`,feishuRegionSwitchAria:`注册区域`,feishuRegionChina:`国内(飞书)`,feishuRegionInternational:`国际(Lark)`,feishuAdvancedHint:`可选:填写开发者后台的 App ID / Secret、连接模式、Webhook、工具、路由与多账号 JSON。保存后写入网关配置。`,feishuQrStarting:`启动中…`,feishuQrScanHint:`请使用飞书/Lark 扫描此二维码。`,feishuQrEncoding:`正在生成二维码…`,feishuQrImageError:`无法生成二维码图片。`,feishuQrOpenLink:`在浏览器中打开`,feishuQrRegenerate:`重新生成二维码`,feishuQrSetupSuccess:`飞书应用创建并配置完成。`,dingtalkQrModalTitle:`扫码注册应用`,dingtalkQrModalSubtitle:`请使用钉钉扫码完成应用注册。如需手动填写凭证或策略,请展开下方高级选项。`,dingtalkQrCloseAria:`关闭`,dingtalkQrStarting:`启动中…`,dingtalkQrScanHint:`请使用钉钉扫描此二维码。`,dingtalkQrEncoding:`正在生成二维码…`,dingtalkQrImageError:`无法生成二维码图片。`,dingtalkQrOpenLink:`在浏览器中打开`,dingtalkQrRegenerate:`重新生成二维码`,dingtalkQrSetupSuccess:`钉钉应用注册并配置完成。`,dingtalkClientId:`Client ID`,dingtalkClientIdDesc:`在钉钉开放平台注册应用后获得,保存在网关配置中。`,dingtalkClientSecret:`Client Secret`,dingtalkClientSecretDesc:`在钉钉开放平台获取,保存在网关配置中。`,dingtalkEndpoint:`API 地址`,dingtalkEndpointDesc:`开放接口根地址(默认 https://api.dingtalk.com)。`,dingtalkDebug:`调试模式`,dingtalkAdvancedHint:`可选:在此填写钉钉开放平台的 Client ID / Secret、策略、路由与多账号 JSON。保存后写入网关配置。`,agentRoutingTitle:`智能体路由`,agentRoutingHint:"在配置 `bindings` 中为每个消息通道账号指定智能体;入站消息会使用对应智能体的会话键。",agentRoutingAccountLabel:`账号`,agentRoutingAgentLabel:`智能体`,jsonObjectAccounts:`账号必须为 JSON 对象`,jsonInvalid:`JSON 无效`,copy:`复制`,copied:`已复制`,show:`显示`,hide:`隐藏`,webhookTitle:`Webhook 配置`,verificationToken:`Verification Token`,verificationTokenDesc:`在飞书事件订阅中获取(webhook 模式)。`,encryptKey:`Encrypt Key`,encryptKeyDesc:`在飞书事件订阅中获取(webhook 模式)。`,webhookHost:`Webhook Host`,webhookPort:`Webhook Port`,webhookPath:`Webhook Path`,webhookPathDesc:`飞书事件订阅里配置的 Request URL 路径。`,feishuToolsTitle:`飞书工具`,feishuToolsDesc:`按需开启。每个工具可能需要额外的应用权限(scopes)。`,feishuToolDoc:`文档(feishu_doc)`,feishuToolWiki:`知识库(feishu_wiki)`,feishuToolDrive:`云盘(feishu_drive)`,feishuToolPerm:`权限管理(feishu_perm)`,feishuToolBitable:`多维表格(feishu_bitable_*)`,feishuToolScopes:`权限诊断(feishu_app_scopes)`,feishuActionsTitle:`飞书动作`,feishuActionReactions:`启用表情反应动作`,policy:{dm:{pairing:`配对`,allowlist:`白名单`,open:`开放`,disabled:`关闭`},group:{open:`开放`,disabled:`关闭`,allowlist:`白名单`},reply:{off:`关闭`,first:`首条`,all:`全部`},stream:{off:`关闭`,partial:`部分`,block:`阻塞`}}},voiceSettings:{needToken:`请先保存网关访问令牌后再编辑语音设置。`,subtitle:`消息通道场景的语音转写与语音合成。API Key 也可通过环境变量配置。`,docsLink:`语音文档`,loadError:`加载语音设置失败`,loading:`加载中…`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存`,saveError:`保存失败`,retry:`重试`,unsavedHint:`有未保存的更改。`,stt:{title:`语音转文字(STT)`,description:`使用阿里云 DashScope 或 OpenAI Whisper 将入站语音转为文本。`,enable:`启用 STT`,enableDesc:`开启后,可将语音消息转写给智能体使用。`,provider:`STT 服务商`,alibaba:`阿里云 DashScope`,openai:`OpenAI`,apiKey:`API Key`,apiKeyDesc:`若环境变量已配置密钥,此处可留空。`,model:`模型`,fallback:`服务商回退`,fallbackDesc:`主服务商失败时尝试备用服务商。`},tts:{title:`文字转语音(TTS)`,description:`在启用时把助手回复合成为语音。`,enable:`启用 TTS`,enableDesc:`开启后,按下方触发模式执行 TTS。`,trigger:`触发`,triggerOff:`关闭`,triggerAlways:`始终`,triggerInbound:`仅入站语音`,triggerTagged:`标签([[tts]])`,triggerDescOff:`完全关闭 TTS。`,triggerDescAlways:`对助手消息尝试使用 TTS。`,triggerDescInbound:`仅当用户发送语音时以语音回复。`,triggerDescTagged:`仅在使用 [[tts]] 指令时。`,provider:`TTS 服务商`,providerOpenai:`OpenAI TTS`,providerEdge:`Microsoft Edge(免费)`,providerLocalCli:`本地 CLI(离线)`,voice:`音色`,edgeHint:`Microsoft Edge TTS — 无需 API Key。`,localCli:{command:`CLI 命令`,commandDesc:`Shell 模板;占位符:{{Text}}、{{OutputBase}}。`,commandPlaceholder:`mlx_audio.tts.generate --text "{{Text}}" --file_prefix {{OutputBase}}`,cwd:`工作目录`,cwdDesc:`可选;默认使用网关工作目录。`,outputFormat:`输出格式`,outputFormatDesc:`CLI 输出的文件扩展名(mp3、wav、opus 等)。`,timeoutMs:`超时(ms)`,timeoutMsDesc:`单次调用超时覆盖;留空则使用 TTS 默认值。`,hint:"由内置扩展 `tts-local-cli` 提供。请先启用该扩展并将二进制加入 PATH。"}},notes:{title:`说明`,duration:`长音频会自动分段;效果取决于服务商与模型。`,envVars:`环境变量:DASHSCOPE_API_KEY、OPENAI_API_KEY(未在表单填写时)。`}},gatewaySettings:{needToken:`请先保存网关访问令牌后再加载或修改网关选项。`,subtitle:`HTTP API 访问令牌与监听地址。配置写入网关配置文件。`,docsLink:`网关文档`,loadError:`加载网关设置失败`,loading:`加载中…`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存`,saveError:`保存失败`,retry:`重试`,unsavedHint:`有未保存的更改。`,tokenExpired:`会话访问令牌无效。请在客户端更新访问令牌,或修正配置文件中的访问令牌。`,updateToken:`更新客户端访问令牌`,changeToken:`打开访问令牌对话框`,accessToken:`网关访问令牌`,tokenPlaceholder:`保存在配置中的访问令牌(若使用环境变量可留空)`,tokenHelp:`用于 HTTP/WebSocket API 鉴权。也可通过环境变量 XOPC_GATEWAY_TOKEN 提供。`,copy:`复制`,copied:`已复制`,show:`显示`,hide:`隐藏`,listenHost:`监听地址`,listenPort:`端口`,listenHint:`若在 UI 外修改监听地址,需重启网关后生效。`,authModeNone:`当前认证模式为 none,配置文件中的令牌可能被忽略。`,updateChannel:`更新通道`,channelStable:`稳定版`,channelBeta:`测试版`,channelDev:`开发版`,updateChannelHint:`测试版与开发版会较早收到构建;日常使用建议稳定版。`,mobilePairTitle:`移动应用配对`,mobilePairSubtitle:`使用移动客户端扫描后即可连接网关:会使用下方网关地址与同本控制台一致的 Bearer 访问令牌。`,mobilePairBaseUrlLabel:`配对用的网关地址`,mobilePairBaseUrlHint:`请填写手机能访问的地址(例如局域网 IP 与端口),可能与桌面浏览器当前地址不一致。`,mobilePairLocalhostWarning:`当前地址看起来像本机 localhost。局域网内的手机默认无法直连,请在网关监听局域网并改用 http://<本机局域网IP>:<端口>。`,mobilePairSecurityNote:`二维码含访问令牌,请在可信环境中展示,留意周围摄像头与他人。`,mobilePairEncoding:`生成二维码中…`,mobilePairImageError:`无法生成二维码,可复制配对链接。`,mobilePairCopyLink:`复制配对链接`,mobilePairCopied:`已复制配对链接`,mobilePairSchemeHint:`应用注册的格式:xopc://gateway/mobile-connect?baseUrl=…&token=…`,mobilePairInvalidBaseUrl:`请输入以 http:// 或 https:// 开头的完整网关地址(无需路径)。`},heartbeatSettings:{needToken:`请先保存网关访问令牌后再加载或修改心跳选项。`,subtitle:`定时唤醒智能体、可选投递到消息通道,以及工作区中的 HEARTBEAT.md。配置写入网关配置文件与工作区文件。`,docsLink:`心跳机制文档`,loadError:`加载心跳设置失败`,loading:`加载中…`,saveConfig:`保存`,discard:`放弃`,savingConfig:`保存中…`,savedConfig:`配置已保存`,saveConfigError:`保存配置失败`,triggerNow:`立即触发`,triggering:`排队中…`,triggered:`已加入心跳队列`,triggerError:`触发心跳失败`,triggerHint:`与定时器相同的一次心跳(会受 HEARTBEAT.md、活跃时段与是否启用心跳影响)。`,saveDoc:`保存`,savingDoc:`保存中…`,savedDoc:`文档已保存`,saveDocError:`保存 HEARTBEAT.md 失败`,retry:`重试`,unsavedConfig:`有未保存的配置更改。`,unsavedDoc:`HEARTBEAT.md 有未保存的更改。`,workspaceLabel:`工作区`,configSection:`心跳配置`,docSection:`HEARTBEAT.md`,docHint:`每次心跳时智能体会读取的任务与提醒。若留空或仅有注释,将跳过 LLM 调用以节省用量。`,enable:`启用心跳`,interval:`间隔`,intervalHint:`最短 1 秒;保存到网关配置时为毫秒。`,intervalHintPreset:`快速选择,或在左侧输入秒数。`,intervalSecondsLabel:`秒`,intervalPresets:{custom:`自定义`,every30s:`每 30 秒`,every1min:`每 1 分钟`,every5min:`每 5 分钟`,every10min:`每 10 分钟`,every15min:`每 15 分钟`,every30min:`每 30 分钟`,every1h:`每 1 小时`,every2h:`每 2 小时`},deliveryTitle:`投递(可选)`,channelNone:`— 无 —`,customChannelSuffix:`自定义`,deliveryHint:`需同时填写消息通道与会话 ID 才会发送非静默回复;否则仅记录日志。`,prompt:`自定义系统提示(可选)`,promptPlaceholder:`覆盖默认心跳指令…`,promptHint:`留空则使用内置默认提示。`,ackMaxChars:`视为静默前的最大回复长度(ackMaxChars)`,ackMaxCharsHint:`留空则使用服务端默认值(300)。`,ackDefaultPlaceholder:`默认`,isolatedSession:`每次使用新的会话键`,isolatedSessionHint:`避免与主对话会话混淆上下文。`,activeHoursTitle:`活跃时段(可选)`,activeStart:`开始`,activeEnd:`结束`,activeTimezone:`时区(IANA)`,activeHoursHint:`仅在该时间窗口内运行心跳。清除则不限时段。`,addActiveHours:`添加活跃时段`,clearActiveHours:`清除活跃时段`},webSearchSettings:{title:`网络搜索`,subtitle:`为 web_search 工具配置地区与搜索提供方。未配置 API 时将使用内置 HTML 兜底。`,docsLink:`网关文档`,needToken:`请先保存网关访问令牌后再编辑网络搜索。`,loading:`加载中…`,loadError:`加载网络搜索设置失败`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存`,saveError:`保存失败`,unsavedHint:`有未保存的更改。`,sectionRegion:`地区`,sectionRegionHint:`在无可用 API 时,用于选择内置 HTML 兜底(国内优先必应,否则 DuckDuckGo)。`,sectionSearch:`搜索提供方`,sectionSearchHint:`按列表顺序依次尝试。密钥写在网关配置文件中。列表为空则仅使用 HTML 兜底。`,regionLabel:`兜底地区`,regionDesc:`自动根据系统时区判断。若使用代理或需固定策略,可手动覆盖。`,regionAuto:`自动(时区)`,regionCn:`中国(必应 HTML 兜底)`,regionGlobal:`全球(DuckDuckGo HTML 兜底)`,maxResultsLabel:`默认结果条数`,maxResultsDesc:`模型未指定 count 时使用(1–50)。`,providersTitle:`提供方(按顺序)`,addProvider:`添加提供方`,apiKeyLabel:`API 密钥`,apiKeyDesc:`部分场景可选。留空且显示为已掩码时保留原值。`,urlLabel:`实例地址`,urlDesc:`SearXNG 根地址(如 http://localhost:8080),无需末尾斜杠。`,keyPlaceholder:`密钥或环境变量名`,keyPlaceholderMasked:`••••••••(未修改)`,disabled:`跳过`,footerHint:`HTML 兜底依赖第三方页面,可能随站点改版变化。生产环境建议使用正式搜索 API(Brave、Tavily、必应或自建 SearXNG)。`,providerTypes:{brave:`Brave Search API`,tavily:`Tavily`,bing:`Bing Web Search API`,searxng:`SearXNG`}}},aee={chat:JSON.parse(`{"typeMessage":"输入消息…","sendMessage":"发送","abort":"停止","needToken":"请先保存网关访问令牌后再对话。","loading":"加载对话中…","model":"模型","modelPlaceholder":"选择模型…","agent":"智能体","agentPlaceholder":"选择智能体…","agentSearchPlaceholder":"搜索智能体…","agentNoMatches":"没有匹配的智能体","thinkingLevel":"思考级别","newSession":"新对话","welcomeTitle":"欢迎使用 xopc","welcomeDescription":"在下方输入消息开始对话","welcomeSpotlight":{"headline":"你的 AI 助手,随时待命","tagline":"告诉我你想做什么——我帮你拆解、查找、执行。","categories":[{"id":"work","icon":"documents","title":"高效办公","description":"邮件、汇报、会议准备","scenarios":[{"prompt":"帮我写一封礼貌的邮件,婉拒这次会议邀请,同时建议另一个时间。"},{"prompt":"帮我写一份简短的周报:本周完成了什么、进行中的事项、遇到的阻塞,控制在 200 字以内。"},{"prompt":"我 30 分钟后要开会,帮我准备 5 个核心讨论要点和 3 个我应该追问的关于项目进度风险的问题。"}]},{"id":"research","icon":"globe","title":"搜索与学习","description":"热点资讯、概念解释、选择决策","scenarios":[{"prompt":"这周科技圈有什么大新闻?帮我总结最重要的 3 条,以及为什么值得关注。"},{"prompt":"用通俗的语言解释一下 RAG(检索增强生成)是怎么工作的,就像在给一个非技术人员讲解。"},{"prompt":"Notion 和 Obsidian 做个人笔记哪个更好?从功能、价格、离线使用三方面对比,然后给我建议。"}]},{"id":"content","icon":"content","title":"写作与创作","description":"文案、帖子、翻译润色","scenarios":[{"prompt":"帮我把这个想法写成一条朋友圈/小红书帖子:AI 工具正在让个人贡献者拥有小团队的战斗力。要有感染力,150 字以内。"},{"prompt":"帮我把下面这段话精简润色,让它更有力、适合放在产品官网首屏。"},{"prompt":"把这段中文翻译成英文,语气要地道自然,不要翻译腔。"}]},{"id":"data","icon":"folder","title":"数据与文件","description":"整理、分析、自动化","scenarios":[{"prompt":"看看我的下载文件夹,帮我按类型分类整理,告诉我哪些可以安全删除。"},{"prompt":"我有一份销售数据 CSV,帮我找出营收前 5 的产品,并看看有没有环比增长趋势。"},{"prompt":"帮我创建一个 Markdown 格式的每日计划模板:包含今日 3 件最重要的事、会议安排、备忘、以及每日复盘。"}]}]},"you":"你","assistant":"助手","tool":"工具","thinkingLabel":"思考中…","thoughts":"思考内容","thoughtsStreaming":"思考中…","thoughtsExpandHint":"展开查看模型思考过程","thinkingLevelLabel":"思考深度","thinkingLevels":{"off":"关闭","minimal":"最低","low":"低","medium":"中","high":"高","xhigh":"极高","adaptive":"自适应"},"toolInput":"输入","toolOutput":"输出","noOutput":"(无输出)","viewSteps_one":"查看 {{count}} 步","viewSteps_other":"查看 {{count}} 步","stepSearchedWeb":"搜索网页","stepReadFile":"读取文件","stepDetails":"详情","stepRunCommand":"运行命令","stepListDirectory":"查看文件夹内容","stepWriteFile":"保存文件","stepEditFile":"修改文件","stepOpenUrl":"打开链接","stepFetchUrl":"获取网页内容","stepUnknownTool":"执行:{{name}}","composerRunStatusSending":"发送中…","composerRunStatusDefault":"处理中…","composerRunningTool":"执行:{{name}}","composerStageThinking":"思考中…","composerStageSearching":"搜索中…","composerStageReading":"阅读中…","composerStageWriting":"撰写中…","composerStageExecuting":"执行中…","composerStageAnalyzing":"分析中…","attachFile":"添加附件","workingDirectory":{"selectWorkingDirectory":"选择工作目录","chooseFolder":"选择目录…","selectPath":"选择文件夹…","recentDirectories":"最近使用的目录","noRecent":"暂无最近使用的目录","notSet":"默认工作区","defaultWorkspace":"会话工作区","copyPath":"复制路径","selectionOnlyAtNewChat":"仅可在发送首条消息前选择工作区。","lockedTapTitle":"本会话无法更改工作区","lockedTapBody":"要选择项目文件夹,请先新建对话,在发送第一条消息前点击此处选择路径。也可在「设置 → 智能体」中配置默认工作空间。","clickToCopyFullPath":"点击复制完整路径","tooltipAgentWorkspace":"智能体工作目录","tooltipOpenProjectFiles":"点击在左侧打开或关闭项目文件。","copied":"已复制","openWorkspaceMenu":"工作区选项","folderPickerRequiresDesktop":"文件夹选择需要使用桌面版(Electron)。请使用桌面端 xopc,或通过其他方式配置路径。","applyErrorTitle":"无法设置工作目录","applyErrorClose":"关闭","pathModalTitle":"工作目录","pathModalDescription":"请输入网关所在机器上的绝对路径(作为本会话的工作区文件夹)。","pathInputPlaceholder":"/绝对路径/到/文件夹","pathModalConfirm":"确定","pathModalCancel":"取消","pickerHostHint":"网关所在主机上的目录:{{hostname}}","pickerLoading":"加载中…","pickerUp":"上级","pickerUseThisFolder":"使用此文件夹","pickerManualPath":"或手动输入绝对路径","pickerApplyManual":"应用路径","pickerListError":"无法读取该位置。","pickerEmptyFolder":"空文件夹","pickerDrives":"驱动器"},"maxAttachmentsReached":"每条消息最多 {{max}} 个文件,请先移除部分附件。","maxAttachmentsTruncated":"已忽略 {{dropped}} 个文件(每条最多 {{max}} 个)。","attachmentFileTooLarge":"文件「{{name}}」过大(单文件最大 {{maxSize}})。","attachmentLoadFailed":"加载附件失败:{{name}}","clipboardFileTypeUnsupported":"剪贴板中的文件类型不支持作为聊天附件","inputPlaceholder":"提问或描述任务 — @ 引用文件,/ 使用技能和命令","currentModel":"当前对话使用的模型","modelSearchPlaceholder":"按名称、服务商或 ID 搜索…","modelNoMatches":"没有匹配的模型","contextWindowHoverShort":"{{percent}}% 上下文","contextWindowHoverNoLimit":"约 {{used}} 上下文","contextWindowAriaSummary":"上下文用量约 {{used}} / {{limit}} tokens","contextWindowAriaSummaryNoLimit":"估计上下文用量约 {{used}} tokens","modelProviderSettingsLink":"配置服务商…","dropFiles":"将文件拖放到此处添加","voiceRecording":"录制语音","voiceRecordingStop":"停止录音","voiceMicDenied":"无法使用麦克风(权限被拒绝或设备不可用)。","inputPlaceholderSteering":"后续问题:Enter 加入队列;点击队列一行在此编辑","inputPlaceholderSteeringEdit":"正在编辑队列中的后续问题 — Enter 保存,Esc 放弃修改","steeringInterruptSend":"停止当前回复并立即发送(⌘↵ 或 Ctrl+↵)","followUpSuggestionsAria":"建议的后续问题","followUpChipErrorHandling":"补充错误处理和边界情况。","followUpChipRefactorReadability":"重构以提高可读性。","followUpChipCodeExplain":"逐步解释这段代码。","followUpChipCodeOptimize":"建议性能优化方案。","followUpChipWebMoreDetails":"搜索更多详情。","followUpChipWebFindSources":"查找可靠来源。","followUpChipShorterSummary":"给一段更短的摘要。","followUpChipMainRisks":"主要风险有哪些?","followUpChipEmailMakeFormal":"语气更正式。","followUpChipEmailShorten":"精简这段内容。","followUpChipSimplerTerms":"用更通俗的话解释一下。","followUpChipConcreteExample":"举一个具体例子。","followUpChipBulletPoints":"整理为要点列表。","followUpChipCreateTable":"以表格形式呈现。","followUpChipWhatNext":"我接下来该做什么?","followUpQueueAria":"后续问题队列(本轮结束后按顺序发送)","followUpQueueHeading":"后续问题","followUpQueueClickToEdit":"在输入框中编辑","followUpQueueAttachmentOnly":"(附件)","followUpQueueEmptyPreview":"(空)","followUpQueueDrag":"拖动排序","followUpQueueMoveUp":"上移","followUpQueueMoveDown":"下移","followUpQueueSteerNow":"在工具间隙注入引导内容","followUpQueueRemove":"从队列移除","followUpQueueAttachmentsNote":"含附件的队列项无法使用 ✨ 引导注入,将按顺序作为整条消息发送。","followUpQueueMaxReached":"后续问题队列已满(最多 {{max}} 条)。请删除一条或等当前回复结束。","voicePlay":"播放语音","voicePause":"暂停","voiceLoading":"正在加载音频…","voiceAriaRegion":"语音播放","voiceAwaitingMeta":"正在读取时长","voiceMessage":"语音","loadOlder":"正在加载更早的消息…","scrollToBottom":"回到底部","attachmentPreviewClose":"关闭","attachmentPreviewDownload":"下载","attachmentPreviewRemove":"移除","attachmentPreviewLoading":"正在加载文件…","attachmentPreviewText":"文本","attachmentPreviewPdf":"PDF","attachmentPreviewDocument":"文档","attachmentPreviewPresentation":"演示文稿","attachmentPreviewSpreadsheet":"表格","attachmentPreviewNoText":"无可用文本","attachmentPreviewMissingData":"缺少文件数据","attachmentPreviewLoadError":"加载文件失败","attachmentPreviewMissingAuth":"缺少身份验证","attachmentPreviewFailedPdf":"无法加载 PDF","attachmentPreviewFailedDocx":"无法加载文档","attachmentPreviewFailedExcel":"无法加载表格","attachmentPreviewPdfRendering":"正在渲染 PDF…","attachmentPreviewPdfLoadMore":"向下滚动以加载更多页","attachmentPreviewExcelTruncated":"预览仅显示前 {rows} 行 × {cols} 列。请下载文件查看完整表格。","attachmentPreviewPptxTruncated":"为保护性能,文本预览已截断。请下载文件查看完整演示文稿。","attachmentPreviewPptxSlide":"第 {n} 页","attachmentPreviewPptxEmptySlide":"(本页无文本)","attachmentPreviewOpenElsewhereHint":"请下载文件后,使用本机上的其他应用打开。","attachmentPreviewOpenElsewhereTruncated":"此处仅显示部分内容。请下载完整文件后在本机其他应用中打开。","attachmentPreviewDownloadFull":"下载文件","attachmentPreviewImage":"预览图片","messageArtifactsHeading":"本消息输出","stepTimelineThinkingStreaming":"正在思考…","stepTimelineThinkingDone":"思考完成","stepTimelineToolSearchRunning":"搜索网络中…","stepTimelineToolSearchComplete":"搜索网络完成","stepTimelineToolSearchError":"搜索失败","stepTimelineToolGenericRunning":"{{name}}中…","stepTimelineToolGenericComplete":"{{name}}完成","stepTimelineToolGenericError":"{{name}}失败","searchSourcesHeading":"搜索来源 · {{count}}","executionDrawerTitle":"执行过程","executionDrawerClose":"关闭","executionDrawerEmpty":"暂无执行步骤。","executionProgressDone":"已完成思考","executionProgressRunning":"思考与工具执行中…","executionElapsedTitle":"本次执行已耗时","messageCopyPlainText":"复制纯文本","messageCopyMarkdown":"复制 Markdown 格式","codeBlockCopy":"复制","messageCopied":"已复制","userMessageCopy":"复制消息","userMessageRetry":"重试","userMessageEdit":"在输入框中编辑","userMessageRetryDisabledHint":"仅可重试最新一条自己的消息。","userMessageActionsWait":"请等待发送或回复结束后再操作。","userMessageDelete":"删除本轮对话","userMessageDeleteConfirm":"将同时删除你的消息和 AI 的回复,确定要删除吗?","userMessageDeleteConfirmTitle":"删除本轮对话","userMessageDeleteCancel":"取消","userMessageDeleteOk":"删除","commandPalette":{"noResults":"没有匹配的命令或技能","placeholder":"搜索技能与命令…","skillsSection":"技能","commandsSection":"命令","showGroupedMore":"显示另外 {{count}} 条"},"goal":{"heading":"持久目标 (/goal)","turns":"{{used}} / {{max}} 轮","statusActive":"进行中","statusPaused":"已暂停","statusDone":"已完成","agentRunning":"智能体运行中…","pause":"暂停","resume":"继续","clear":"清除","restart":"重置预算并重跑","detailsToggle":"裁判详情","lastVerdict":"上次判定","lastReason":"说明","loadFailed":"无法加载目标状态。","collapseAria":"收起目标条","expandAria":"展开持久目标","pillTitle":"{{status}} · {{turns}} — 点击展开"},"atMention":{"noResults":"无匹配项","placeholder":"搜索文件…","searchError":"搜索工作区失败","files":"文件","folders":"文件夹","recentFiles":"最近","recentBadge":"最近","shiftHint":"Shift+Enter 或 Shift+点击:继续添加 @ 引用。"}}`)},oee={cron:JSON.parse('{"title":"定时任务","subtitle":"任务会按计划自动执行,也可随时手动触发。在任意对话里描述你想定期做的事,即可快速创建任务。","needToken":"请先保存网关访问令牌后再管理定时任务。","statsRegion":"概览","tabMyTasks":"我的定时任务","tabRunHistory":"运行记录","wakeBanner":"定时任务仅在设备保持唤醒时运行;系统或屏幕休眠时,执行可能会被跳过。","keepAwake":"保持屏幕常亮","wakeLockUnavailable":"当前浏览器或环境不支持屏幕唤醒锁。","sortCreatedDesc":"创建时间(新→旧)","sortCreatedAsc":"创建时间(旧→新)","historyRangeDay":"日","historyRangeWeek":"周","historyRangeMonth":"月","filterAllTasks":"全部任务","filterAllStatuses":"全部状态","emptyHistoryTitle":"暂无执行记录","emptyHistoryHint":"定时任务开始运行后,记录将显示在这里。","jobCardMenuAria":"任务操作","scheduleBadge":{"everyMinute":"每分钟","everyNMinutes":"每 {{n}} 分钟","everyNHours":"每 {{n}} 小时","hourly":"每小时","dailyAt":"每天 {{time}}","weekdaysAt":"工作日 {{time}}","weeklyOn":"{{day}} {{time}}","cronExpr":"{{expr}}"},"jobsHeading":"计划任务","addJob":"新建任务","editJob":"编辑任务","name":"名称 *","namePlaceholder":"我的定时任务","nameRequired":"请填写名称","schedule":"计划(cron 表达式)*","message":"消息 *","messagePlaceholder":"助手应该做什么?","messageEdit":"编辑","messagePreview":"预览","messageMarkdownHint":"支持 Markdown(标题、列表、代码块、链接等)。","create":"创建任务","runNow":"立即执行","delete":"删除","edit":"编辑","enabled":"已启用","disabled":"已禁用","running":"运行中","nextRun":"下次执行","status":"状态","runHistoryTitle":"运行记录","runHistoryHint":"已完成的执行会保存在本地(state/cron/runs)。点击刷新更新列表。","detailRunHistory":"最近执行","colStarted":"开始时间","colJob":"任务","colDuration":"耗时","colDetail":"结果","colChat":"会话","openChat":"打开","openChatTitle":"在聊天中打开此次执行(仅 AI 智能体隔离会话)","execStatusRunning":"运行中","execStatusSuccess":"成功","execStatusFailed":"失败","execStatusCancelled":"已跳过","noRunsYet":"该时间范围内暂无执行记录。","confirmDelete":"确定要删除此定时任务吗?","confirmRun":"立即执行此定时任务?","scheduleLabel":"计划","messageLabel":"消息","totalJobs":"任务总数","emptyStateCta":"创建第一个任务","channel":"消息通道","channelLocal":"本地(不发出)","deliveryTargetLocalChannel":"本地消息通道 — 内容仅保存在本机","recipient":"接收方 *","recipientPlaceholder":"Telegram:填写数字形式的会话 ID,或从下方最近会话中选择","refreshList":"刷新","refreshRecipientHint":"从最近会话重新加载列表","selectRecipient":"— 请选择 —","noRecentChatsOption":"暂无最近会话","deliveryTarget":"投递目标","scheduleHintPreset":"选择预设或输入自定义 cron 表达式","schedulePicker":{"scheduleTimeLabel":"计划时间","modeNoRepeat":"不重复","modeInterval":"间隔","intervalKindMinutes":"分钟","intervalKindHours":"小时","modeHourly":"每小时","modeDaily":"每天","modeWeekly":"每周","modeMonthly":"每月","modeCustom":"自定义表达式","minuteUnit":"分","minuteAtHour":"分钟","intervalMinutes":"间隔分钟数","intervalHours":"间隔小时数","hourUnit":"小时","dayOfMonth":"日期","customCronHint":"标准五段 cron:分 时 日 月 周","weekdays":["一","二","三","四","五","六","日"]},"mode":"模式","modeDirect":"直接发送消息到消息通道,不经过 AI 处理","modeAgent":"由 AI 智能体处理消息并生成回复后发送","modeDirectOption":"直接发送(发到消息通道)","modeAgentOption":"AI 智能体(先由模型处理再发送)","agentLocalOnly":"仅本地运行(保存对话,不发送到消息通道)","agentLocalOnlyHint":"在本机运行智能体。对话以 cron 类型会话保存到默认或所选智能体下(任务 id 包含在会话键中);不向 Telegram/CLI 投递。","deliveryLocalOnly":"仅本地 — 对话以 cron 会话保存到该智能体目录","agentProfile":"智能体","agentProfileHint":"仅在「AI 智能体」模式下生效。选默认则使用网关配置的默认智能体。","agentProfileDefault":"默认智能体","workingDirectoryLabel":"工作目录","workingDirectoryHint":"可选。填写网关所在机器上的绝对路径;不填则使用该智能体的默认工作空间。","workingDirectoryReset":"使用智能体默认","model":"模型","save":"保存","failedToLoadJobs":"加载任务失败","scheduleRequired":"计划表达式和消息为必填项","chatIdRequired":"会话 ID 为必填项","failedToCreateJob":"创建任务失败","failedToUpdateJob":"保存任务失败","failedToToggleJob":"切换任务状态失败","actionFailed":"操作失败","enterManuallyOrSelect":"手动输入或从最近聊天中选择","noRecentChats":"未找到最近会话。请手动填写会话 ID(例如 Telegram 为 123456789)","refresh":"刷新","close":"关闭","cancel":"取消","loading":"加载中…","schedulePresets":{"custom":"-- 自定义(在下方输入) --","everyMinute":"每分钟","every5Minutes":"每 5 分钟(默认)","every10Minutes":"每 10 分钟","every15Minutes":"每 15 分钟","every30Minutes":"每 30 分钟","everyHour":"每小时","every2Hours":"每 2 小时","every4Hours":"每 4 小时","every6Hours":"每 6 小时","every12Hours":"每 12 小时","everyDayMidnight":"每天午夜","everyDay9AM":"每天早上 9 点","everyDay9PM":"每天晚上 9 点"},"timeLabels":{"overdue":"已过期","lessThanMinute":"不到 1 分钟","minutes":"{{count}} 分钟","hours":"{{count}} 小时"},"lastActiveLabels":{"justNow":"刚刚","minutesAgo":"{{count}} 分钟前","hoursAgo":"{{count}} 小时前","daysAgo":"{{count}} 天前"},"templateFilterAll":"全部","fromTemplate":"从模版创建","templatesEmptyHint":"该分类下暂无模版。","templateCategories":{"daily":"每日","monitoring":"监控","reports":"报告","automation":"自动化"},"templates":{"morning_briefing":{"title":"早间简报","description":"天气/出行提示(无 API 则如实说明)、你关心领域要闻、今日优先三件事——在提示词里改主题列表。","prompt":"生成一份**早间简报**,几分钟内读完。\\n- **天气/出行**:若无真实预报接口,请说明限制;仅根据我写的地区/季节给**一条**穿衣或通勤提示,或跳过。\\n- **要闻**:我关心的领域(**请编辑**):**(例:本地、宏观、科技政策、球队等)**;有检索则概括约 24 小时内要点并标注来源类型;无检索则给出我应**依次打开哪些首页**。\\n- **今日优先 3 件**:尽量从工作区笔记/待办推断;否则请我在文末一次性补充。\\n- **不要编造链接、引语或具体气温数字**。"},"standup_prep":{"title":"站会准备","description":"根据近期 Git 与文件变动起草站会式更新,便于口头汇报。","prompt":"帮我准备**站会发言稿**:\\n- 若可访问 Git:概括**自上次站会或昨天以来**的提交主题(不要堆 hash),若有明显风险路径可点出。\\n- 若不可用:给出我本地应执行的**简短命令**以便下次自动生成。\\n- **文件/改动线索**:从工作区可见信息推断,不确定请标注「推断」。\\n- **阻塞**:最多 3 条,可写「暂无」。\\n- **今天打算做什么**:一句话。\\n- 控制在约 **90 秒**可念完。"},"end_of_day_wrap_up":{"title":"日终小结","description":"总结今日进展、未闭环与明日第一件事。","prompt":"做**工作日日终小结**:\\n- **已完成**:最多 5 条(推断请标注)。\\n- **未闭环/搁置**:最多 4 条,语气中性。\\n- **明日登录后第一件事**:仅一条,动作具体。\\n- 尽量引用工作区内任务/日志;若无则说明缺口。\\n- 不做价值评判。"},"inbox_triage":{"title":"收件箱式梳理","description":"优先列出紧急待跟进项;若工作区无邮件内容则给可执行的梳理流程。","prompt":"协助**收件箱/待处理**梳理(**不假设**能登录真实邮箱):\\n- 若工作区有导出邮件、`.eml`、或关于邮件的笔记:按**紧急跟进优先**列出条目及建议下一步。\\n- 若无材料:给出**五步梳理流程**(文件夹/标签、先处理谁、如何处理老邮件等),并请我在下列 **VIP 发件人或域名**(**请编辑**)基础上下次粘贴若干主题行。\\n- **不要声称已读取真实收件箱**。"},"competitor_watch":{"title":"竞品动态","description":"按你列出的竞品做新闻、产品更新与价格信号摘要;有检索才写细节。","prompt":"竞品或对标名单(**请编辑**):**(填写公司/产品名)**。\\n- 有网络检索:概括约**一周**内公开动态:新闻、产品/changelog、价格或套餐变化;区分**已核实**与**传闻**。\\n- 无检索:列出**应查看的官方入口**(官网、定价页、changelog)及建议核对顺序,**不要编造更新**。\\n- **禁止捏造报道引语、数字或链接**。"},"trending_topics_monitor":{"title":"热点话题追踪","description":"跟踪你列出的行业或社区讨论热度与要闻线索。","prompt":"我关注的行业/社区/话题(**请编辑**):**(例:金融科技、独立游戏、本城论坛、AI 工具)**。\\n- 有检索:用 **5~7 条**要点概括本周**讨论变热或异常活跃**的方向,并注明大致平台类型(新闻/论坛类/HN 类等),勿捏造具体帖子链接。\\n- 无检索:给出**检索词组合**与**建议浏览顺序**。\\n- 若有争议或易误传话题,用一行提示**核实风险**。"},"tech_radar_stack":{"title":"技术雷达","description":"关注你列出的技术栈近期的发版与官方安全通告入口,不臆造 CVE。","prompt":"技术栈清单(**请编辑**):**(例:Node LTS、Postgres、某云产品、Android SDK)**。\\n- 汇总约 **14 天**内值得注意的发版、弃用说明,信息来源限于**官方博客、changelog、注册表**。\\n- 安全相关只指向**官方安全公告渠道**;**严禁编造 CVE 编号**或虚假漏洞版本。\\n- 若可见锁文件可概括生态;信息不足则说明缺哪份文件。"},"dependency_check_audit":{"title":"依赖检查","description":"根据仓库生态建议审计命令与关注项,不假装已跑过扫描。","prompt":"从工作区识别包管理文件(`package.json`、`go.mod`、`pyproject.toml` 等)。\\n- 为每种生态给出**一条**文档中常见的审计/检查命令(若不存在则说明)。\\n- 用文字说明**应关注什么**(大版本、被撤回包、EOL 运行时等),**不要编造扫描结果**。\\n- **不要捏造 CVE**。"},"weekly_review":{"title":"周报式回顾","description":"一周提交主题、未闭环与下周三块重点。","prompt":"写一份**周末/周五周报式回顾**:\\n- **本周交付主题**(结合 git 与笔记,若 git 不可用则说明)。\\n- **仍挂心的事**(≤6 条)。\\n- **下周 3 个标题级重点**。\\n- **一条**「该停做或该委派」的建议(仅在过载迹象明显时)。\\n- 语气像给上级的短简报。"},"code_quality_report":{"title":"代码质量报告","description":"从脚本与 CI 配置推断如何跑 lint/类型检查,并说明如何阅读输出——不虚构错误数量。","prompt":"在工作区查找 **lint / 类型检查 / 格式化** 相关脚本(`package.json`、Makefile、CI 配置等)。\\n- 给出建议的**本地执行顺序**。\\n- 说明**如何扫一眼输出**(错误类别、易 flaky 测试、类型债热点),**不要编造错误条数**。\\n- 若项目无脚本,按识别出的语言给**最小**起步建议并注明局限。"},"git_activity_summary":{"title":"Git 活动摘要","description":"归纳近期提交、活跃分支与热点文件;此处不能跑 git 则只给命令。","prompt":"总结约 **最近 7 天** 的 Git 活动:提交**主题**、值得注意的**分支**、**热点文件**。\\n- 若当前环境不能执行 git:**不要虚构**,改为列出我本地可复制的命令以生成同样摘要。\\n- 避免罗列大量 hash,保持可扫读。"},"user_feedback_digest":{"title":"用户反馈摘要","description":"从工作区内的反馈笔记、工单导出等聚类主题与痛点;无材料则给收集模板。","prompt":"我存放反馈的位置或命名习惯(**请编辑**):**(例:`feedback/`、导出的 issues、问卷摘要)**。\\n- 从可读文本中聚类**重复主题**、**大致情绪**、**主要痛点**(≤5)。\\n- 注意**脱敏**:不展开无关个人信息。\\n- 若无内容:给出我下次应粘贴/保存的**简短结构模板**。"},"stale_todo_or_issue_sweep":{"title":"陈旧待办清扫","description":"扫描 TODO/FIXME 或简易 issue 列表,建议保留/关闭/拆分,不自动改文件。","prompt":"扫描工作区中的 **TODO/FIXME/HACK** 或 Markdown 里的简易任务表。\\n- 列出最多 **10 条**「可能陈旧」的项(根据模糊措辞或文件很少再改动等启发式),每条给**建议动作**:关闭、拆分、排期。\\n- **仅建议,不修改文件**。\\n- 若扫描不完整,说明原因。"},"release_notes_or_changelog_draft":{"title":"发版说明草稿","description":"结合版本号文件与近期提交起草 changelog 草案,需人工核对后发布。","prompt":"为**下一次**版本发布起草 **changelog / 发版说明** 草案:\\n- 读取 `CHANGELOG`、以及 `package.json` / `Cargo.toml` 等版本字段(若存在)。\\n- 从可见提交归纳**面向用户**的变更;无法确定上次标签则退化为「最近一周」。\\n- 不确定条目请标注「待核实」。\\n- 语气克制,避免营销夸张。"},"workspace_cleanup_suggestions":{"title":"工作区清理建议","description":"列出大体积构建产物、缓存、日志等供周末前审视,不自动删除。","prompt":"为**周末前清理**给建议:\\n- 尽量发现**构建产物、缓存、日志**等;用表格:路径 | 可能原因 | 风险 | 建议(仅审视/归档)。\\n- **禁止删除或移动**。\\n- 若无法读磁盘占用,说明限制并给通用模式。"},"smoke_or_ci_health_reminder":{"title":"冒烟 / CI 健康","description":"从 CI 与脚本提炼本周值得跑的检查及如何确认通过,不谎称 CI 已绿。","prompt":"根据 CI 配置与脚本,列出本周值得做的 **smoke / 健康检查**:每条含**命令**、**期望通过信号**、**建议频率**。\\n- 若无 CI 文件:按仓库类型给**最小手工冒烟**路径。\\n- **不要在没有证据时声称 CI 已通过**。"}}}')},see={logs:{title:`日志`,subtitle:`网关运行时的诊断与历史记录。`,needToken:`请先保存网关访问令牌后再查看日志。`,filters:`筛选`,level:`级别`,searchPlaceholder:`搜索消息或模块…`,module:`模块`,allModules:`全部模块`,timeRange:`时间范围`,from:`开始`,to:`结束`,clear:`清除`,refresh:`刷新`,autoRefresh:`自动刷新`,pause:`暂停`,liveHint:`每 5 秒自动刷新`,logFiles:`日志文件`,filesEmpty:`磁盘上暂无日志文件`,loadMore:`加载更多`,showingCount:`已加载 {{count}} 条`,moreAvailable:`可能还有更早的条目`,noLogs:`没有匹配的条目`,noLogsDescription:`请调整筛选或搜索,或稍后再试。`,loading:`加载中…`,loadError:`加载日志失败`,details:`日志详情`,close:`关闭`,time:`时间`,message:`消息`,metadata:`元数据`,statsRegion:`抽样(近期文件)`,statsHint:`数量为近期日志文件抽样统计,非全量。`,statsDetailTitle:`各级别数量`,logDir:`目录`,requestId:`请求 ID`,sessionId:`会话 ID`,presetAll:`全部`,presetErrors:`错误`,presetWarnPlus:`警告+`,presetInfoPlus:`信息+`,presetVerbose:`调试`,presetOther:`更多`,levelPresetAria:`按日志级别筛选`,refreshModeAria:`日志刷新方式`,refreshManual:`手动`,refreshLive:`实时`,filtersMore:`更多筛选`,filtersDialogTitle:`更多筛选`,filtersDialogDesc:`时间范围与自定义日志级别。`,filtersDone:`完成`,levelCustom:`自定义级别`,levelCustomHint:`点选以包含或排除;全部不选表示所有级别。`,copyMessage:`复制消息`,copyJson:`复制 JSON`,copied:`已复制`,levelNames:{trace:`跟踪`,debug:`调试`,info:`信息`,warn:`警告`,error:`错误`,fatal:`致命`}}},cee={onboarding:{title:`欢迎使用 xopc`,subtitle:`只需 3 步,即可开始使用你的 AI 助手。`,step1Title:`选择 AI 服务商`,step1Subtitle:`选择你想要使用的 AI 服务。`,step2Title:`输入你的 API 密钥`,step2Subtitle:`密钥将保存在本地 xopc 配置文件中。`,step2Placeholder:`在此粘贴你的 API 密钥`,step2SecurityNote:`🔒 密钥不会离开你的设备。`,step3Title:`选择默认模型`,step3Subtitle:`你可以随时在设置中更改。`,back:`返回`,continue:`继续`,startChatting:`开始对话`,skipSetup:`跳过 — 稍后再设置`,setupComplete:`设置完成!在下方开始对话吧。`,stepOf:`第 {{current}} 步,共 {{total}} 步`}},lee={providersSettings:{subtitle:`服务商 API Key 与 OAuth。在此保存的密钥写入网关凭据存储。`,intro:`可搜索或展开分组,再展开具体服务商,粘贴新密钥后点「保存」。支持 OAuth 时,在浏览器中完成授权。`,docsLink:`模型与服务商文档`,modelsLink:`自定义服务商(models.json)`,rotateHint:`日常轮换密钥:展开对应服务商 → 粘贴新密钥 → 保存,一般无需重启。`,needToken:`请先保存网关访问令牌后再管理服务商凭据。`,loadError:`加载服务商列表失败`,save:`保存`,saving:`保存中…`,saved:`已保存`,noChangesSaved:`没有需要保存的新密钥。`,saveError:`保存失败`,empty:`暂无可用服务商。`,searchPlaceholder:`搜索 OpenAI、Claude、Gemini…`,getApiKey:`获取 API Key`,getApiKeyIntl:`获取 API Key(国际站)`,getApiKeyCn:`获取 API Key(国内)`,savedModelsAvailable:`个可用模型`,savedNoModels:`已配置,暂无模型列表`,envVarAlt:`或通过环境变量配置`,unconfiguredOnly:`仅显示未配置`,noMatches:`没有符合筛选条件的服务商。`,clearFilters:`清除筛选`,discard:`放弃`,unsavedHint:`有未保存的更改。`,runtimeLabelPrefix:`当前生效凭据:`,sourceAgent:`智能体私有凭据`,sourceGateway:`网关已保存(本页写入)`,sourceOauth:`OAuth 令牌`,sourceEnv:`环境变量`,sourceModelsJson:`models.json`,sourceExtension:`扩展提供方`,sourceNone:`无`,testKey:`测试输入值`,testingKey:`测试中…`,testOkLiteral:`格式有效(明文或文本)。`,testOkEnv:`环境变量可解析。`,testOkCommand:`命令解析成功。`,testFailed:`检查未通过。`,revokeFailed:`撤销失败。`,expandRowDetails:`展开凭据与操作`,categories:{common:`常用服务商`,specialty:`专业 / 特色`,enterprise:`企业 / 云端`,oauth:`仅 OAuth`,extension:`扩展`},configuredCount:`已配置 {{count}} 个`,metaMasked:`已有凭据 — 输入新 Key 可覆盖。`,metaWillSave:`点击「保存」后写入 API Key。`,metaNotConfigured:`未配置。`,placeholderKey:`API Key`,placeholderKeep:`留空则保留当前`,placeholderOverride:`输入新 Key 覆盖`,show:`显示`,hide:`隐藏`,copy:`复制`,copied:`已复制`,oauth:`OAuth 登录`,revoke:`撤销`,revokeConfirm:`撤销「{{name}}」的 OAuth 凭据?`,oauthStarting:`正在启动 OAuth…`,oauthProcessingCode:`正在处理授权…`,openAuthPage:`打开授权页`,cancelOAuth:`取消`,pasteRedirectUrl:`粘贴完整重定向 URL(含 code= 与 state=)`,submitCode:`提交`,envHint:`API Key 来自环境变量。在上方输入新 Key 可覆盖。`,maskedStoredHint:`已保存的凭据不会显示。在上方输入新 Key 可覆盖。`,oauthHint:`可使用 OAuth 安全登录,或手动填写 API Key。`,removeKey:`移除密钥`,removeKeyConfirm:`确定移除「{{name}}」的已保存 API Key?此操作不可撤销。`,removeKeySuccess:`API Key 已移除。`,removeKeyFailed:`移除失败。`},modelsSettings:{needToken:`请先保存网关访问令牌后再编辑 models.json。`,subtitle:`自定义服务商与模型(models.json)。保存后生效;重新加载可读取磁盘上的修改。`,docsLink:`模型与服务商文档`,loadError:`加载 models.json 失败`,loadFileWarning:`文件提示`,filePath:`路径`,addProvider:`添加服务商`,validate:`校验`,validating:`校验中…`,validateError:`校验请求失败`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存`,saveError:`保存失败`,reload:`重新加载`,reloading:`加载中…`,reloadError:`重新加载失败`,showJson:`显示 JSON`,hideJson:`隐藏 JSON`,statsProviders:`{{count}} 个服务商`,statsModels:`{{count}} 个模型`,unsavedHint:`有未保存的更改。`,loading:`加载中…`,jsonParseError:`JSON 无效`,jsonReset:`从编辑器还原`,jsonApply:`应用 JSON`,emptyTitle:`暂无自定义服务商`,emptyDesc:`可添加 OpenAI 兼容端点(Ollama、LM Studio、OpenRouter、vLLM 等)及可选的逐模型覆盖。`,emptyCta:`添加第一家服务商`,presetOllama:`Ollama`,presetLmStudio:`LM Studio`,presetOpenRouter:`OpenRouter`,presetZhipuCn:`智谱 GLM(国内 · Coding 端点)`,presetZaiGeneral:`智谱 GLM(国际 · 通用 API)`,presetLabel:`预设`,presetCustom:`自定义`,addProviderTitle:`添加服务商`,addProviderSubtitle:`服务商 ID 须唯一(如 ollama、my-openai)。`,providerIdLabel:`服务商 ID`,providerIdPlaceholder:`例如 ollama`,providerIdRequired:`请填写服务商 ID`,addProviderConfirm:`添加`,cancel:`取消`,close:`关闭`,baseUrl:`Base URL`,apiType:`API 类型`,apiKey:`API Key`,apiKeyPlaceholder:`sk-…、环境变量名 或 !命令`,apiKeyHint:`直接填写密钥、大写环境变量名,或以 ! 开头的 shell 命令`,authHeader:`自动发送 Authorization 头`,testKey:`测试`,show:`显示`,hide:`隐藏`,badgeShell:`shell`,badgeEnv:`env`,badgeLiteral:`字面量`,removeProvider:`删除服务商`,removeProviderConfirm:`删除服务商「{{id}}」及其模型?`,modelsSection:`模型`,modelsEmpty:`无自定义模型;在可用处将使用内置默认。`,addModel:`添加模型`,editModel:`编辑模型`,removeModel:`删除模型`,removeModelConfirm:`删除模型「{{id}}」?`,addModelTitle:`添加模型`,editModelTitle:`编辑模型`,modelProviderLabel:`服务商`,modelId:`模型 ID`,displayName:`显示名称`,inputTypes:`输入类型`,inputTextOnly:`仅文本`,inputTextVision:`文本 + 视觉`,reasoning:`支持推理`,contextWindow:`上下文窗口`,maxOutputTokens:`最大输出 Token 数`,costSection:`费用(每百万 token)`,costInput:`输入`,costOutput:`输出`,modelIdRequired:`请填写模型 ID`,mustBePositive:`必须大于 0`,addModelConfirm:`添加模型`,saveModelConfirm:`保存`,validationErrors:`校验问题`,validationWarnings:`警告`,testError:`错误`,testOk:`解析结果`}},uee={sessions:{title:`会话`,needToken:`请先保存网关访问令牌后再管理会话。`,searchPlaceholder:`搜索会话…`,filterAll:`全部`,filterActive:`活跃`,filterPinned:`置顶`,filterArchived:`归档`,filterChannelAll:`全部通道`,filterChannelLabel:`通道`,totalSessions:`总计`,activeSessions:`活跃`,pinnedSessions:`置顶`,archivedSessions:`归档`,sessionCount:`已显示 {{count}} 个`,loadMore:`加载更多`,noSessions:`暂无会话`,noSessionsDescription:`在「对话」中开始聊天后,会话将显示在这里。`,startNewChat:`开始新对话`,continueChat:`在对话中继续`,archive:`归档`,unarchive:`取消归档`,pin:`置顶`,unpin:`取消置顶`,export:`导出 JSON`,delete:`删除`,deleteSessionTitle:`删除会话?`,deleteSessionMessage:`确定删除「{{name}}」吗?此操作不可恢复。`,cancel:`取消`,loading:`加载中…`,loadError:`加载会话失败`,gridView:`网格`,listView:`列表`,layoutToggleGroup:`会话布局`,detailLoading:`加载会话…`,detailMessages:`消息`,detailExport:`导出`,close:`关闭`}},dee={settingsSections:{appearance:`偏好设置`,agent:`智能体`,"agent-defaults":`智能体默认`,"agent-chat":`对话`,"agent-workspace":`工作区`,"agent-browser":`浏览器`,"agent-runtime":`运行时`,"agent-tools":`工具与技能`,"agent-system-prompt":`系统提示词`,providers:`服务商`,models:`模型`,"image-models":`图像`,channels:`消息通道`,voice:`语音`,gateway:`网关`,heartbeat:`心跳`,search:`网络搜索`,dreams:`梦境`,agents:`智能体`,system:`系统设置`,cron:`定时任务`,skills:`技能`},dreamingSettings:{title:`梦境`,subtitle:`查看并维护后台记忆晋升(deep promotion)任务的运行状态。`,refresh:`刷新`,runNow:`立即执行`,runPhaseLabel:`阶段`,runNowHint:`立刻触发一次托管 cron job。`,runQueued:`已触发执行。`,actionOk:`已完成。`,configSaved:`配置已保存。`,configTitle:`配置`,configHint:`编辑 agents.defaults.memory.dreaming,并写回网关配置文件。`,configLoading:`正在加载配置…`,saveConfig:`保存`,resetConfig:`重置`,configEnabled:`启用 dreaming`,configFrequency:`全局 fallback 调度`,configTimezone:`时区(IANA)`,configPhaseLight:`浅睡眠(Light)`,configPhaseLightHint:`轻量去重扫描(默认每 6 小时)。`,configPhaseDeep:`深度睡眠(Deep)`,configPhaseDeepHint:`完整评分晋升,含时间衰减(每天凌晨 3 点)。`,configPhaseRem:`快速眼动(REM)`,configPhaseRemHint:`跨条目模式聚类与梦境日记(每周日凌晨 5 点)。`,configPhaseEnabled:`启用`,configPhaseCron:`Cron 表达式`,configLightLookbackDays:`回溯天数`,configLightLimit:`条数上限`,configLightDedupe:`去重相似度`,configDeepMinScore:`最低分数`,configDeepMinRecallCount:`最低召回次数`,configDeepLimit:`条数上限`,configDeepHalfLife:`时间衰减半衰期(天)`,configDeepMaxAge:`最大年龄(天)`,configRemLookbackDays:`回溯天数`,configRemLimit:`条数上限`,configRemMinStrength:`最低模式强度`,previewTitle:`预览(dry-run)`,previewHint:`展示经过 rehydrate、污染过滤、marker/hash 去重后的候选列表,不会写入任何文件。`,previewLoad:`加载预览`,previewNotLoaded:`尚未加载预览。`,previewEmpty:`没有可晋升的候选。`,previewEligible:`可晋升`,runtimeTitle:`运行状态`,runtimeHint:`只读:网关上当前生效的调度、短期 store 与最近一次扫描结果。`,subsectionSchedule:`调度与锁`,subsectionStore:`短期召回`,subsectionPhases:`三阶段配置(实际生效)`,subsectionDeep:`门控(实际生效)`,subsectionLastRun:`最近扫描(Deep)`,subsectionLightLastRun:`最近扫描(Light)`,subsectionRemLastRun:`最近扫描(REM)`,lastRunBlockHint:`数据文件:memory/.dreams/last-run.json`,phaseLastRunEmpty:`尚无运行记录。`,phaseLastRunOk:`成功`,phaseLastRunFailed:`失败`,lockValueLocked:`已锁定`,lockValueUnlocked:`未锁定`,statusTitle:`状态`,statusHint:`读取当前工作区下的存储文件(memory/.dreams)。`,enabled:`启用`,on:`开启`,off:`关闭`,schedule:`频率`,timezone:`时区`,lock:`晋升锁`,storeEntries:`信号条目数`,storePromoted:`已晋升条目数`,storeUpdatedAt:`存储更新时间`,storeLastPromotedAt:`最近晋升时间`,deepGate:`门控参数:`,deepGateValue:`minScore={{minScore}},minRecallCount={{minRecallCount}},limit={{limit}}`,lastRunTitle:`最近一次运行`,lastRunHint:`memory/.dreams/last-run.json:耗时、门控配置快照、候选/应用数量与跳过原因。下方可查看原始 JSON。`,lastRunEmpty:`尚无运行记录。`,lastRunDuration:`耗时`,lastRunStatus:`结果`,lastRunSuccess:`成功`,lastRunFailure:`失败`,lastRunReason:`原因`,lastRunError:`错误`,lastRunRanked:`进入排序的候选数`,lastRunApplied:`写入 MEMORY.md 条数`,lastRunSkipped:`跳过(计数)`,lastRunSkipKey:`键已在 MEMORY 中`,lastRunSkipRehydrate:`片段还原失败`,lastRunSkipContaminated:`内容污染`,lastRunSkipHash:`哈希去重`,lastRunParseError:`无法解析 last-run 文件`,lastRunRaw:`原始 JSON`,eventsTitle:`事件日志`,eventsHint:`记忆整理各阶段的运行审计记录(memory/.dreams/events.jsonl)。`,eventsLoad:`加载日志`,eventsNotLoaded:`尚未加载事件日志。`,eventsEmpty:`暂无事件记录。`,maintenanceTitle:`维护`,maintenanceHint:`仅影响 store/lock 文件,不会修改 MEMORY.md。`,resetStore:`重置 store`,clearLock:`清理锁文件`,confirmResetStore:`确认重置 dreaming store?这会清空短期召回信号。`,confirmClearLock:`确认删除晋升锁文件?仅在 sweep 卡住时使用。`},systemSettings:{title:`系统设置`,behaviorGroup:`应用行为`,desktopOnlyTitle:`仅桌面端`,desktopOnlyBody:`系统集成功能仅在 xopc Electron 桌面版中可用。在浏览器中请通过操作系统设置管理。`,toggles:{openAtLogin:`开机自动启动`,openAtLoginDesc:`登录本机用户时自动启动 xopc。`,keepAwake:`保持系统唤醒`,keepAwakeDesc:`开启后请求系统保持唤醒,减少因空闲睡眠中断长时间任务。`,notifyDesktop:`桌面通知`,notifyDesktopDesc:`在后续版本接入系统通知时生效(当前仅保存偏好)。`,notifySound:`声音通知`,notifySoundDesc:`在实现通知时是否播放提示音(需同时启用桌面通知相关实现)。`},permissionsTitle:`系统权限`,permissionsHint:`状态为尽量检测,修改系统设置后请刷新或重新进入本页。`,permissionsHintDarwin:`macOS 的隐私/媒体状态为尽量检测。修改系统设置后请用「刷新状态」或再次进入本页。`,permissionsHintWin:`在 Windows 上,麦克风和(如系统可报告)录屏等能力受系统级开关影响;每个按钮会打开系统「设置」中的相关页面。`,permissionsHintLinux:`Linux 上此处不显示各权限的准确状态。会尝试打开桌面环境设置,失败时打开说明文档。请在发行版/Flatpak/ portal 中授予「文件、麦克风、通知」等。`,status:{granted:`已授权`,denied:`未授权`,unknown:`未知`},openSettings:`去设置`,refresh:`刷新状态`,perm:{fullDisk:{title:`文件与磁盘访问`,desc:`在需要时访问工作区、用户目录等(具体名称因系统而异)。`},screen:{title:`录屏`,desc:`在应用内浏览器外进行整屏/窗口采集、供视觉类能力使用。`},microphone:{title:`麦克风`,desc:`在对话和语音能力中录音。`},accessibility:{title:`辅助功能`,desc:`使用全局快捷键及辅助功能相关能力。`},automation:{title:`自动操作 / 与系统集成`,desc:`与其他应用或系统能力协作(在 macOS 上对应自动化与隐私;在 Windows 上为默认应用等;Linux 为桌面/portal 能力)。`},notifications:{title:`通知`,desc:`在系统「通知」或本应用项中允许通知,以便任务完成时提示。`},location:{title:`位置`,desc:`在提供地理位置相关任务时获取位置信息。`}}},settingsNavGroups:{general:`通用`,models:`模型与多媒体`,agent:`智能体默认配置`,gateway:`网关`,automation:`自动化`,data:`会话与日志`,extensions:`扩展`},imageModelsSettings:{title:`图像`,subtitle:`图片理解与生成的默认项、运行参数,以及已注册的图像生成 Provider。`,refresh:`刷新`,crossLinkHint:`默认对话主模型与采样在「对话」;文本备用链在「模型」;本页与「智能体默认配置」中的表单共同编辑 agents.defaults 中的视觉理解与图像生成相关字段。`,timeoutLabel:`超时(毫秒)`,timeoutHint:`单次生成的最大耗时,留空使用网关默认值(120000 毫秒)。`,autoFallbackLabel:`失败时遍历所有已配置的 Provider`,autoFallbackHint:`主链全部失败后,再依次尝试其他已配置的 Provider,直到全部失败为止。`,save:`保存`,discard:`放弃`,saving:`保存中…`,saved:`已保存。`,providersTitle:`已注册的 Provider`,providersEmpty:`尚未注册任何图像生成 Provider。`,configured:`已配置`,missingKey:`缺少 API Key`,defaultModel:`默认模型`,modelsLabel:`模型`,credentialsIntro:`在此填写 API Key 与可选端点;会写入配置文件中的 providers.<id>(与通过环境变量配置等价)。网关不会在接口中返回完整密钥。`,apiKeyLabel:`API Key`,regionLabel:`区域`,regionHint:`DashScope:在其卡片中选择区域以写入 region 与官方图像端点(「自定义」可手填 region 与端点)。`,endpointPresetsHint:`若卡片上显示端点或集群预设,请选择一项或使用「自定义」,会写入 providers.<id>.baseUrl。`,baseUrlLabel:`Base URL`,imageBaseUrlLabel:`图像 Base URL`,optionalPlaceholder:`可选`,saveCredentials:`保存密钥`,savingCredentials:`保存中…`,credentialsSaved:`密钥已保存。`,discardCredentials:`放弃密钥修改`,credentialsSaveError:`无法保存 Provider 密钥。`,credentialsNothingToSave:`没有需要保存的密钥变更。`,regionPresetDefault:`默认(由网关自动选择)`,regionPresetCustom:`自定义区域 / 端点`,baseUrlPresetDefault:`默认(官方地址)`,baseUrlPresetCustom:`自定义 URL`,openExtensionSettings:`扩展设置页`,openImageModelsPage:`打开「图像」设置`,extensionSettingsLinkTitle:`打开该 Provider 的扩展设置`,imageModelsLinkTitle:`打开「图像」设置(全部 Provider)`,imageBaseUrlPresetHint:`由区域预设自动填入;选择「自定义」后可编辑。`,dashscopeRegion_beijing:`中国(北京)`,dashscopeRegion_singapore:`国际(新加坡)`,dashscopeRegion_us:`美国(弗吉尼亚)`,apiKeyMaskedHelp:`已保存的密钥默认隐藏。点击眼睛图标可从配置文件读取(仅 providers.<id>.apiKey,不含环境变量里的密钥)。`,apiKeyCopy:`复制`,apiKeyCopied:`已复制`,apiKeyShow:`显示密钥`,apiKeyHide:`隐藏密钥`,apiKeyNotInConfigFile:`配置文件里没有该 Provider 的 API Key(可能只通过环境变量提供)。`,apiKeyRevealFailed:`无法从网关读取密钥。`,minimaxClusterLabel:`MiniMax 集群(API 主机)`,minimaxClusterHint:`MiniMax 区分国内与国际靠的是不同主机名,配置里写在 providers.minimax.baseUrl,而不是像 DashScope 那样用 region 字段;DashScope 用 region 再映射到官方图像接口 URL。`,falQueueBaseLabel:`Fal 队列 / API 根地址`,falQueueBaseHint:`Fal 文生图请求挂在队列根地址上(默认 https://queue.fal.run),对应配置项 providers.fal.baseUrl。`},extensionImageGen:{banner:`API Key 与端点写入全局配置 providers.<id>(与「设置 → 图像」相同)。两个入口任选其一,保存后会保持一致。`,openImageModels:`打开「图像」设置(全部 Provider)`},appearanceSettings:{pageTitle:`偏好设置`,subtitle:`语言、界面外观与对话字号等日常使用的显示行为,仅保存在本浏览器。`,languageTitle:`语言`,languageDescription:`选择界面语言。`,themeTitle:`主题亮暗`,themeDescription:`浅色、深色,或跟随系统。`,colorSchemeTitle:`配色方案`,colorSchemeDescription:`界面的视觉风格。`,colorSchemeDefault:`默认`,colorSchemeLightGreen:`浅绿`,colorSchemeModernMono:`mono/单色`,fontScaleTitle:`对话字号`,fontScaleDescription:`调整对话与阅读区域的文字大小。`,fontScaleCompact:`小`,fontScaleDefault:`中`,fontScaleLarge:`大`,langOptionEn:`English`,langOptionZh:`中文`,themeOptionLight:`浅色`,themeOptionDark:`深色`,themeOptionSystem:`跟随系统`,openFullPreferences:`打开全部设置`,quickMenuHint:`语言、主题与字号`,aboutApp:`关于`}},fee={appBrand:`XOPC`,sidebarCollapse:`收起侧边栏`,sidebarExpand:`展开侧边栏`,closeMenu:`关闭菜单`,openMenu:`打开菜单`,appBarPreferences:`语言与主题`,nav:{chat:`对话`,management:`管理`,settings:`设置`,sessions:`会话`,cron:`定时任务`,skills:`技能`,channels:`消息通道`,agents:`智能体`,apps:`应用`,logs:`日志`,settingsAppearance:`偏好设置`,settingsProviders:`服务商`,settingsModels:`模型`,settingsImageModels:`图像`,settingsChannels:`消息通道`,settingsVoice:`语音`,settingsGateway:`网关`,settingsHeartbeat:`心跳`,settingsSearch:`网络搜索`,settingsDreams:`梦境`,settingsAgentChat:`对话`,settingsAgentWorkspace:`工作区`,settingsAgentBrowser:`浏览器`,settingsAgentRuntime:`运行时`,settingsAgentTools:`工具与技能`,settingsAgentSystemPrompt:`系统提示词`,settingsAgents:`智能体`,settingsSystem:`系统设置`},token:{title:`需要身份验证`,description:`请输入网关访问令牌以继续。`,gatewayUrl:`网关地址`,tokenLabel:`访问令牌`,placeholder:`网关访问令牌(例如 ea4c67bf…)`,save:`保存`,show:`显示`,hide:`隐藏`},gatewayLanding:{headline:`连接网关`,subline:`网页控制台需使用与网关相同的访问令牌。请从初始化向导或配置文件中获取,并在下方粘贴。`,sessionExpired:`登录已失效或访问令牌被拒绝,请重新输入有效的网关访问令牌。`,stepOnboard:`在终端运行 xopc onboard(或 xopc onboard --gateway)并启用网页控制台,向导会打印访问令牌。`,stepPaste:`将访问令牌粘贴到下方并保存。也可直接打开向导给出的带 ?token= 的链接。`,stepUrlHint:`若使用带 ?token= 的链接打开,访问令牌会自动保存(随后地址栏会去掉参数)。`,docsGatewayLink:`网关说明`},electron:{setupBannerTitle:`完成设置后即可对话`,setupBannerBody:`请至少配置一家模型服务商的 API 密钥,并选择默认模型。之后可随时在设置中修改。`,setupBannerLinkProviders:`服务商与密钥`,setupBannerLinkModels:`默认模型`,setupBannerDismiss:`不再提示`,gatewayExitTitle:`本地网关已停止`,gatewayExitBody:`助手后端进程异常退出,请重启应用后再试。`},connection:{connecting:`连接中…`,online:`在线`,reconnecting:`重连中…`,offline:`离线`,error:`连接异常`,reconnect:`重连`},api:{errorBadGateway:`网关错误 (502)`,errorServiceUnavailable:`服务不可用 (503)`,errorGatewayTimeout:`网关超时 (504)`,errorInternal:`服务器内部错误 (500)`,errorServer:`服务器错误 ({{status}})`,errorNotFound:`未找到 (404)`,errorForbidden:`禁止访问 (403)`,errorRequest:`请求失败 ({{status}})`},sidebar:{newTask:`新建对话`,tasksHeading:`对话`,viewAllSessions:`全部会话`,taskListEmpty:`暂无会话`,taskListNeedToken:`保存网关访问令牌后即可在此查看最近会话。`,taskListAddToken:`填写访问令牌`,taskListStartChat:`开始对话`,appMenuAria:`应用菜单与设置`,taskSessionMenuAria:`会话操作`,taskSessionAgentRunning:`助手仍在回复中`,taskRename:`重命名`,taskCopyChatId:`复制会话 ID`,taskDeleteTask:`删除对话`,taskRenameTitle:`重命名对话`,taskRenamePlaceholder:`会话名称`,taskRenameSave:`保存`,taskRenameCancel:`取消`,backToApp:`返回应用`,backToAgents:`返回智能体`,back:`返回`,helpDocs:`帮助文档`,sessionChannelFilterAria:`按来源筛选:网页对话或消息通道`,sessionTasksTab:`对话`,sessionChannelsTab:`消息通道`,resizeHandleAria:`调整左侧导航宽度`},aboutDialog:{windowTitle:`关于本应用`,close:`关闭`,versionLabel:`版本`,commitLabel:`提交`,buildDateLabel:`时间`,gatewayVersionLabel:`网关`,consoleBuildHint:`以上为控制台界面构建信息;网关为当前运行的 xopc 服务版本。`,checkUpdates:`检查更新`,checkUpdatesChecking:`检查中...`,checkUpdatesUpToDate:`已是最新版本`,checkUpdatesAvailable:`有新版本:v{version}`,checkUpdatesDownloading:`下载中... {percent}%`,checkUpdatesDownloaded:`已下载,可安装:v{version}`,checkUpdatesError:`检查失败`,gatewayUnavailable:`—`,openSourceLead:`本软件离不开 `,openSourceLink:`开源软件`,copyright:`版权所有 © {year} xopcai`},updatePanel:{restartToUpdate:`重启以更新`,dismissAria:`关闭`,dismissHint:`不再提醒此版本`,reminderElectronReady:`新版本 v{{version}} 已就绪,重启应用以安装。`,reminderDownloading:`正在下载更新… {{percent}}%`,reminderElectronUpdateError:`桌面版更新失败:{{detail}}`,reminderNpm:`网关有新版本 v{{version}} 可用。`,updateNow:`立即更新`,updateRunning:`正在更新…`,updateSuccess:`已安装更新`,updateSuccessDetail:`请重启网关以使用新版本(例如:xopc gateway restart)。`,updateErrorGit:`无法一键更新`,updateErrorBusy:`已有更新任务在进行中`,updateErrorFailed:`更新失败`,restartRequired:`已安装 v{{version}}。请重启网关以使用新版本。`,restartGateway:`重启网关`}},pee={skills:{title:`技能`,needToken:`请先保存网关访问令牌后再管理技能。`,tagline:`安装与管理技能,在对话中扩展 xopc 的能力。`,refresh:`刷新列表`,reloadRuntime:`从磁盘重载`,reloadDiskAria:`从磁盘重载技能`,skillsNavAria:`技能分区`,tabBuiltin:`内置`,tabUser:`用户安装`,tabMarketplace:`技能广场`,marketplacePlaceholder:`技能广场即将上线,敬请期待。`,sectionMarketplace:`技能商店`,marketplaceSortLabel:`排序`,marketplaceSortDownloads:`下载最多`,marketplaceSortNewest:`最新`,marketplaceCategoryAll:`全部`,marketplaceCategoriesAria:`技能市场分类`,marketplaceCategoriesFailed:`分类加载失败`,marketplaceSearchPackages:`搜索 skill 名称、描述、标签…`,marketplaceStars:`收藏`,marketplaceSource:`源自`,marketplaceLoadFailed:`无法加载技能市场`,marketplaceEmpty:`没有匹配的包。`,marketplaceInstall:`安装`,previewUseInChat:`使用`,previewUseInChatBusy:`安装中…`,marketplaceReinstall:`重新安装`,marketplaceInstalled:`已安装`,marketplaceReinstallConfirm:`该技能已安装。是否用商店中的版本覆盖本地?`,marketplacePagePrev:`上一页`,marketplacePageNext:`下一页`,marketplacePageStatus:`第 {{page}} / {{totalPages}} 页 · 共 {{total}} 个包`,marketplaceAuthor:`作者`,marketplaceOpenOnSkillhub:`在 SkillHub 打开`,marketplaceOpenOnSkillhubAria:`在新标签页打开 skillhub.cn 上的该技能`,marketplaceDownloads:`下载`,marketplaceVersion:`最新版本`,sectionBuiltinList:`内置技能`,categoryLabel:{business:`创业与商业`,creative:`创意与设计`,documents:`文档处理`,engineering:`工程与研发`,tools:`工具与实用程序`},filterAll:`全部`,filterGlobal:`全局`,filterWorkspace:`工作区`,filterExtra:`扩展`,sectionUser:`已安装`,installCta:`安装技能`,installModalTitle:`安装技能`,installModalDropHint:`拖放 .zip 或 SKILL.md 文件,或点击选择`,installModalReqTitle:`文件要求`,installModalReq1:`包含 SKILL.md 文件的 .zip 压缩包`,installModalReq2:`或直接拖入 SKILL.md 文件`,installAction:`安装`,installClose:`关闭`,searchPlaceholder:`搜索技能`,noSearchResults:`没有匹配的技能。`,uploading:`上传中…`,loading:`加载中…`,empty:`暂无技能。`,loadFailed:`加载技能失败`,reloadFailed:`重载失败`,skillToggleFailed:`更新技能状态失败`,uploadFailed:`上传失败`,installSuccess:`技能已安装。`,zipOnly:`请选择 .zip 文件`,invalidFile:`请选择 .zip 或 SKILL.md 文件`,delete:`删除`,deleteTitle:`删除技能`,deleteMessage:`确定删除已管理技能目录「{{id}}」?此操作不可恢复。`,deleteConfirm:`删除`,deleteFailed:`删除失败`,yes:`是`,no:`否`,cancel:`取消`,source:{builtin:`内置`,workspace:`工作区`,global:`全局`,extra:`扩展`},col:{name:`名称`,description:`描述`,source:`来源`,managed:`可管理`,actions:`操作`},detailModalBanner:`元数据来自 SKILL.md 的 YAML frontmatter;下方为去掉该段后的正文说明。`,detailModalBannerStore:`以下为技能商店中该包发布的 Markdown 正文(与商店中的包说明一致)。`,detailSummaryHeading:`概要`,detailInstructionsHeading:`使用说明`,detailNoInstructionsBody:`frontmatter 之后没有 Markdown 正文。`,detailHomepageLabel:`主页`,detailPlatformsLabel:`适用平台`,detailRequiresLabel:`运行要求`,detailRequiresBins:`依赖命令`,detailRequiresEnv:`环境变量`,detailRequiresAnyBins:`满足其一即可的命令`,detailInstallLabel:`安装步骤`,detailToolGatingLabel:`工具可见性`,detailToolsRequiresList:`依赖工具`,detailToolsetsRequiresList:`依赖工具集`,detailToolsFallbackList:`回退工具`,detailToolsetsFallbackList:`回退工具集`,detailEnvVarsLabel:`会话环境变量`,detailNotInjectedNote:`该技能不会注入到模型上下文(disable-model-invocation)。`,marketplaceNoReadme:`该包暂无说明正文。`,detailModalEnable:`启用`,detailModalDisable:`停用`,detailLoadFailed:`无法加载 SKILL.md`,detailCloseAria:`关闭`,hubRemote:`远程`,hubKindGit:`git`,hubKindArchive:`归档`}},mee={workspace:{title:`项目文件`,currentWorkspace:`当前工作区`,openFiles:`项目文件`,preview:`预览`,download:`下载`,copyPath:`复制路径`,pathCopied:`路径已复制`,edit:`编辑`,viewing:`查看中`,saved:`已保存`,saving:`保存中…`,emptyDir:`暂无文件`,loadError:`加载失败`,close:`关闭`,resizeHandleAria:`调整项目文件区域宽度`,lastModified:`修改时间`,openElsewhereHint:`预览可能受限或不可用。请下载文件或使用其他应用打开。`,cannotPreviewType:`无法在预览中打开此类型的文件。`,openSystemApp:`用默认应用打开`}},zt={...Ct,...wt,...Tt,...Et,...Dt,...Ot,...kt,...At,...jt,...Mt,...Nt,...Pt,...Ft},Bt={...It,...Lt,...Rt,...aee,...oee,...see,...cee,...lee,...uee,...dee,...fee,...pee,...mee};Ge.use(ut).init({resources:{en:{translation:zt},zh:{translation:Bt}},lng:xt(),fallbackLng:`en`,interpolation:{escapeValue:!1},react:{useSuspense:!1}});var Vt=e=>{throw TypeError(e)},hee=(e,t,n)=>t.has(e)||Vt(`Cannot `+n),Ht=(e,t,n)=>(hee(e,t,`read from private field`),n?n.call(e):t.get(e)),gee=(e,t,n)=>t.has(e)?Vt(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Ut=`popstate`;function Wt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Gt(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=Qt(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),Xt(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:Zt(t))}function r(e,t){qt(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return $t(t,n,r,e)}function Kt(e,t){if(e===!1||e==null)throw Error(t)}function qt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Jt(){return Math.random().toString(36).substring(2,10)}function Yt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Qt(t):t,state:n,key:t&&t.key||r||Jt(),unstable_mask:i}}function Zt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Qt(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function $t(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Wt(e)?e:Xt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Yt(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Wt(e)?e:Xt(h.location,e,t);n&&n(r,e),l=u();let i=Yt(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return en(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Ut,d),c=e,()=>{i.removeEventListener(Ut,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function en(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),Kt(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Zt(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var tn,nn=class{constructor(e){if(gee(this,tn,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Ht(this,tn).has(e))return Ht(this,tn).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){Ht(this,tn).set(e,t)}};tn=new WeakMap;var rn=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function an(e){return rn.has(e)}var on=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function sn(e){return on.has(e)}function cn(e){return e.index===!0}function ln(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Kt(e.index!==!0||!e.children,`Cannot specify children on an index route`),Kt(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),cn(e)){let n={...e,id:s};return r[s]=un(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=un(n,t(n)),e.children&&(n.children=ln(e.children,t,o,r,i)),n}})}function un(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function dn(e,t,n=`/`){return fn(e,t,n,!1)}function fn(e,t,n,r){let i=An((typeof t==`string`?Qt(t):t).pathname||`/`,n);if(i==null)return null;let a=mn(e);gn(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=kn(i);o=En(a[e],t,r)}return o}function pn(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function mn(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Kt(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Bn([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Kt(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),mn(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:wn(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of hn(e.path))a(e,t,!0,n)}),t}function hn(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=hn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function gn(e){e.sort((e,t)=>e.score===t.score?Tn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var _n=/^:[\w-]+$/,vn=3,yn=2,bn=1,xn=10,Sn=-2,Cn=e=>e===`*`;function wn(e,t){let n=e.split(`/`),r=n.length;return n.some(Cn)&&(r+=Sn),t&&(r+=yn),n.filter(e=>!Cn(e)).reduce((e,t)=>e+(_n.test(t)?vn:t===``?bn:xn),r)}function Tn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function En(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Bn([a,u.pathname]),pathnameBase:vee(Bn([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Bn([a,u.pathnameBase]))}return o}function Dn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=On(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function On(e,t=!1,n=!0){qt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function kn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return qt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function An(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function jn({basename:e,pathname:t}){return t===`/`?e:Bn([e,t])}var Mn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Nn=e=>Mn.test(e);function _ee(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Qt(e):e,a;return n?(n=zn(n),a=n.startsWith(`/`)?Pn(n.substring(1),`/`):Pn(n,t)):a=t,{pathname:a,search:yee(r),hash:bee(i)}}function Pn(e,t){let n=Vn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Fn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function In(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ln(e){let t=In(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Rn(e,t,n,r=!1){let i;typeof e==`string`?i=Qt(e):(i={...e},Kt(!i.pathname||!i.pathname.includes(`?`),Fn(`?`,`pathname`,`search`,i)),Kt(!i.pathname||!i.pathname.includes(`#`),Fn(`#`,`pathname`,`hash`,i)),Kt(!i.search||!i.search.includes(`#`),Fn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_ee(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var zn=e=>e.replace(/\/\/+/g,`/`),Bn=e=>zn(e.join(`/`)),Vn=e=>e.replace(/\/+$/,``),vee=e=>Vn(e).replace(/^\/*/,`/`),yee=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,bee=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Hn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Un(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Wn(e){return Bn(e.map(e=>e.route.path).filter(Boolean))||`/`}var Gn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Kn(e,t){let n=e;if(typeof n!=`string`||!Mn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Gn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=An(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{qt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var qn=Symbol(`Uninstrumented`);function xee(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=Jn(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=Jn(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[qn]??i,a=Jn(n[e],t,(...e)=>Xn(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[qn]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[qn]??e,r=Jn(n.middleware,t,(...e)=>Xn(e[0]));return r?(r[qn]=t,r):e})),r}function See(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[qn]??e.navigate,r=Jn(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?Zt(n):`.`,...Zn(e,r??{})}});r&&(r[qn]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[qn]??e.fetch,r=Jn(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...Zn(e,i??{})}});r&&(r[qn]=t,e.fetch=r)}return e}function Jn(e,t,n){return e.length===0?null:async(...r)=>{let i=await Yn(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function Yn(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=Yn(e,t,n,r-1),a=await o,Kt(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function Xn(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:Qn(t),params:{...r},unstable_pattern:i,context:$n(n)}}function Zn(e,t){return{currentUrl:Zt(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function Qn(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function $n(e){if(tr(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var er=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function tr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===er}var nr=[`POST`,`PUT`,`PATCH`,`DELETE`],rr=new Set(nr),ir=[`GET`,...nr],ar=new Set(ir),or=new Set([301,302,303,307,308]),sr=new Set([307,308]),cr={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},lr={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ur={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},dr=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),fr=`remix-router-transitions`,pr=Symbol(`ResetLoaderData`);function mr(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Kt(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||dr,a=i;if(e.unstable_instrumentations){let t=e.unstable_instrumentations;a=e=>({...i(e),...xee(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=ln(e.routes,a,void 0,o),c,l=e.basename||`/`;l.startsWith(`/`)||(l=`/${l}`);let u=e.dataStrategy||jr,d={unstable_passThroughRequests:!1,...e.future},f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=dn(s,e.history.location,l),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=ti(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=ei(s);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&ze(v,s,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=ze(null,s,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>yr(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=br(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:cr,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,F=new Map,I=0,ee=-1,te=new Map,L=new Set,ne=new Map,R=new Map,z=new Set,B=new Map,re,V=null;function ie(){if(f=e.history.listen(({action:t,location:n,delta:r})=>{if(re){re(),re=void 0;return}qt(B.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ne({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{re=e});e.history.go(r*-1),Me(i,{state:`blocked`,location:n,proceed(){Me(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,ur),se({blockers:e})}}),E?.resolve(),E=null;return}return de(t,n)}),n){Tee(t,A);let e=()=>Eee(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||de(`POP`,w.location,{initialHydration:!0}),C}function ae(){f&&f(),j&&j(),p.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>we(t)),w.blockers.forEach((e,t)=>je(t))}function oe(e){return p.add(e),()=>p.delete(e)}function se(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!w.fetchers.has(e)&&!F.has(e)&&n.push(e)}),[...p].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>we(e)),r.forEach(e=>w.fetchers.delete(e))}function ce(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&gi(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?Zr(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,l=w.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,ur)));let u=M?!1:Re(t,n.matches||w.matches),d=D===!0||w.navigation.formMethod!=null&&gi(w.navigation.formMethod)&&t.state?._isRedirect!==!0;c&&=(s=c,void 0),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let f;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?f={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(f={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),f={currentLocation:w.location,nextLocation:t}}se({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:cr,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,V?.resolve(),V=null}async function le(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=Ci();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=_r(!1,gr(w.location,w.matches,l,t,n?.fromRouteId,n?.relative),n),o;n?.unstable_mask&&(o={pathname:``,search:``,hash:``,...typeof n.unstable_mask==`string`?Qt(n.unstable_mask):{...w.location.unstable_mask,...n.unstable_mask}});let s=w.location,c=Xt(s,r,n&&n.state,void 0,o);c={...c,...e.history.encodeLocation(c)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&gi(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=Ne({currentLocation:s,nextLocation:c,historyAction:d});if(m){Me(m,{state:`blocked`,location:c,proceed(){Me(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:c}),le(t,n)},reset(){let e=new Map(w.blockers);e.set(m,ur),se({blockers:e})}});return}await de(d,c,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.unstable_defaultShouldRevalidate})}function ue(){V||=Ci(),ye(),se({revalidation:`loading`});let e=V.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(de(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(de(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function de(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Le(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=c||s,a=r&&r.overrideNavigation,o=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:dn(i,n,l),u=(r&&r.flushSync)===!0;if(o&&w.initialized&&!N&&ii(w.location,n)&&!(r&&r.submission&&gi(r.submission.formMethod))){ce(n,{matches:o},{flushSync:u});return}let d=ze(o,i,n.pathname);if(d.active&&d.matches&&(o=d.matches),!o){let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);ce(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}O=new AbortController;let f=Gr(e.history,n,O.signal,r&&r.submission),p=e.getContext?await e.getContext():new nn,m;if(r&&r.pendingError)m=[$r(o).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&gi(r.submission.formMethod)){let t=await fe(f,n,r.submission,o,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(li(r)&&Un(r.error)&&r.error.status===404){O=null,ce(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}o=t.matches||o,m=t.pendingActionResult,a=bi(n,r.submission),u=!1,d.active=!1,f=Gr(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:v}=await H(f,n,o,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m,r&&r.callSiteDefaultShouldRevalidate);h||(O=null,ce(n,{matches:g||o,...Qr(m),loaderData:_,errors:v}))}async function fe(t,n,i,c,u,d,f,p={}){if(ye(),se({navigation:Cee(n,i)},{flushSync:p.flushSync===!0}),d){let e=await Be(c,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=ei(s);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=$r(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)c=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Pe(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let m,h=vi(c,n);if(!h.route.action&&!h.route.lazy)m={type:`error`,error:ti(405,{method:t.method,pathname:n.pathname,routeId:h.route.id})};else{let e=await _e(t,n,Lr(a,o,t,n,c,h,f?[]:r,u),u,null);if(m=e[h.route.id],!m){for(let t of c)if(e[t.route.id]){m=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(ui(m)){let n;return n=p&&p.replace!=null?p.replace:Wr(m.response.headers.get(`Location`),new URL(t.url),l,e.history)===w.location.pathname+w.location.search,await W(t,m,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(li(m)){let e=$r(c,h.route.id);return(p&&p.replace)!==!0&&(T=`PUSH`),{matches:c,pendingActionResult:[e.route.id,m,h.route.id]}}return{matches:c,pendingActionResult:[h.route.id,m]}}async function H(t,n,i,u,d,f,p,m,h,g,_,v,y){let b=f||bi(n,p),x=p||m||yi(b),S=!M&&!g;if(d){if(S){let e=pe(v);se({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Be(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=ei(s);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=$r(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=c||s,{dsMatches:T,revalidatingFetchers:E}=vr(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,z,ne,L,C,l,e.patchRoutesOnNavigation!=null,v,y);if(ee=++I,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=Oe();return ce(n,{matches:i,loaderData:{},errors:v&&li(v[1])?{[v[0]]:v[1].error}:null,...Qr(v),...e?{fetchers:new Map(w.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=pe(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=me(E)),se(e,{flushSync:_})}E.forEach(e=>{Ee(e.key),e.controller&&F.set(e.key,e.controller)});let D=()=>E.forEach(e=>Ee(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await ve(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>F.delete(e.key));let j=ni(k);if(j)return await W(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=ni(A),j)return L.add(j.key),await W(t,j.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:te,errors:R}=Xr(w,i,k,v,E,A);g&&w.errors&&(R={...w.errors,...R});let B=Oe(),re=ke(ee),V=B||re||E.length>0;return{matches:i,loaderData:te,errors:R,...V?{fetchers:new Map(w.fetchers)}:{}}}function pe(e){if(e&&!li(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function me(e){return e.forEach(e=>{let t=w.fetchers.get(e.key),n=xi(void 0,t?t.data:void 0);w.fetchers.set(e.key,n)}),new Map(w.fetchers)}async function he(t,n,r,i){Ee(t);let a=(i&&i.flushSync)===!0,o=c||s,u=gr(w.location,w.matches,l,r,n,i?.relative),d=dn(o,u,l),f=ze(d,o,u);if(f.active&&f.matches&&(d=f.matches),!d){xe(t,n,ti(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=_r(!0,u,i);if(h){xe(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new nn,_=(i&&i.preventScrollReset)===!0;if(m&&gi(m.formMethod)){await U(t,n,p,d,g,f.active,a,_,m,i&&i.unstable_defaultShouldRevalidate);return}ne.set(t,{routeId:n,path:p}),await ge(t,n,p,d,g,f.active,a,_,m)}async function U(t,n,i,u,d,f,p,m,h,g){ye(),ne.delete(t),be(t,wee(h,w.fetchers.get(t)),{flushSync:p});let _=new AbortController,v=Gr(e.history,i,_.signal,h);if(f){let e=await Be(u,new URL(v.url).pathname,v.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{xe(t,n,ti(404,{pathname:i}),{flushSync:p});return}}let y=vi(u,i);if(!y.route.action&&!y.route.lazy){xe(t,n,ti(405,{method:h.formMethod,pathname:i,routeId:n}),{flushSync:p});return}F.set(t,_);let b=I,x=Lr(a,o,v,i,u,y,r,d),S=await _e(v,i,x,d,t),C=S[y.route.id];if(!C){for(let e of x)if(S[e.route.id]){C=S[e.route.id];break}}if(v.signal.aborted){F.get(t)===_&&F.delete(t);return}if(z.has(t)){if(ui(C)||li(C)){be(t,Si(void 0));return}}else{if(ui(C))if(F.delete(t),ee>b){be(t,Si(void 0));return}else return L.add(t),be(t,xi(h)),W(v,C,!1,{fetcherSubmission:h,preventScrollReset:m});if(li(C)){xe(t,n,C.error);return}}let E=w.navigation.location||w.location,D=Gr(e.history,E,_.signal),k=c||s,A=w.navigation.state===`idle`?w.matches:dn(k,w.navigation.location,l);Kt(A,`Didn't find any matches after fetcher action`);let j=++I;te.set(t,j);let M=xi(h,C.data);w.fetchers.set(t,M);let{dsMatches:R,revalidatingFetchers:B}=vr(D,d,a,o,e.history,w,A,h,E,r,!1,N,P,z,ne,L,k,l,e.patchRoutesOnNavigation!=null,[y.route.id,C],g);B.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=w.fetchers.get(t),r=xi(void 0,n?n.data:void 0);w.fetchers.set(t,r),Ee(t),e.controller&&F.set(t,e.controller)}),se({fetchers:new Map(w.fetchers)});let re=()=>B.forEach(e=>Ee(e.key));_.signal.addEventListener(`abort`,re);let{loaderResults:V,fetcherResults:ie}=await ve(R,B,D,E,d);if(_.signal.aborted)return;if(_.signal.removeEventListener(`abort`,re),te.delete(t),F.delete(t),B.forEach(e=>F.delete(e.key)),w.fetchers.has(t)){let e=Si(C.data);w.fetchers.set(t,e)}let ae=ni(V);if(ae)return W(D,ae.result,!1,{preventScrollReset:m});if(ae=ni(ie),ae)return L.add(ae.key),W(D,ae.result,!1,{preventScrollReset:m});let{loaderData:oe,errors:le}=Xr(w,A,V,void 0,B,ie);ke(j),w.navigation.state===`loading`&&j>ee?(Kt(T,`Expected pending action`),O&&O.abort(),ce(w.navigation.location,{matches:A,loaderData:oe,errors:le,fetchers:new Map(w.fetchers)})):(se({errors:le,loaderData:Zr(w.loaderData,oe,A,le),fetchers:new Map(w.fetchers)}),N=!1)}async function ge(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);be(t,xi(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=Gr(e.history,i,m.signal);if(l){let e=await Be(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{xe(t,n,ti(404,{pathname:i}),{flushSync:u});return}}let g=vi(s,i);F.set(t,m);let _=I,v=await _e(h,i,Lr(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(F.get(t)===m&&F.delete(t),!h.signal.aborted){if(z.has(t)){be(t,Si(void 0));return}if(ui(y))if(ee>_){be(t,Si(void 0));return}else{L.add(t),await W(h,y,!1,{preventScrollReset:d});return}if(li(y)){xe(t,n,y.error);return}be(t,Si(y.data))}}async function W(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:c,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);Kt(d,`Expected a Location header on the redirect Response`),d=Wr(d,new URL(r.url),l,e.history);let f=Xt(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Nn(d)){let n=en(d,!0);e=n.origin!==t.location.origin||An(n.pathname,l)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=yi(w.navigation));let _=o||s;sr.has(i.response.status)&&_&&gi(_.formMethod)?await de(p,f,{submission:{..._,formAction:d},preventScrollReset:c||D,enableViewTransition:a?k:void 0}):await de(p,f,{overrideNavigation:bi(f,o),fetcherSubmission:s,preventScrollReset:c||D,enableViewTransition:a?k:void 0})}async function _e(e,t,n,r,i){let a,o={};try{a=await Rr(u,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!gi(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(ci(r)){let i=r.result;o[t]={type:`redirect`,response:Hr(i,e,t,n,l)}}else o[t]=await Vr(r);return o}async function ve(e,t,n,r,i){let a=_e(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await _e(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:ti(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function ye(){N=!0,ne.forEach((e,t)=>{F.has(t)&&P.add(t),Ee(t)})}function be(e,t,n={}){w.fetchers.set(e,t),se({fetchers:new Map(w.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function xe(e,t,n,r={}){let i=$r(w.matches,t);we(e),se({errors:{[i.route.id]:n},fetchers:new Map(w.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Se(e){return R.set(e,(R.get(e)||0)+1),z.has(e)&&z.delete(e),w.fetchers.get(e)||lr}function Ce(e,t){Ee(e,t?.reason),be(e,Si(null))}function we(e){let t=w.fetchers.get(e);F.has(e)&&!(t&&t.state===`loading`&&te.has(e))&&Ee(e),ne.delete(e),te.delete(e),L.delete(e),z.delete(e),P.delete(e),w.fetchers.delete(e)}function Te(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),z.add(e)):R.set(e,t),se({fetchers:new Map(w.fetchers)})}function Ee(e,t){let n=F.get(e);n&&(n.abort(t),F.delete(e))}function De(e){for(let t of e){let e=Si(Se(t).data);w.fetchers.set(t,e)}}function Oe(){let e=[],t=!1;for(let n of L){let r=w.fetchers.get(n);Kt(r,`Expected fetcher: ${n}`),r.state===`loading`&&(L.delete(n),e.push(n),t=!0)}return De(e),t}function ke(e){let t=[];for(let[n,r]of te)if(r<e){let e=w.fetchers.get(n);Kt(e,`Expected fetcher: ${n}`),e.state===`loading`&&(Ee(n),te.delete(n),t.push(n))}return De(t),t.length>0}function Ae(e,t){let n=w.blockers.get(e)||ur;return B.get(e)!==t&&B.set(e,t),n}function je(e){w.blockers.delete(e),B.delete(e)}function Me(e,t){let n=w.blockers.get(e)||ur;Kt(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),se({blockers:r})}function Ne({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&qt(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Pe(e){let t=ti(404,{pathname:e}),{matches:n,route:r}=ei(c||s);return{notFoundMatches:n,route:r,error:t}}function Fe(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===cr){_=!0;let e=Re(w.location,w.matches);e!=null&&se({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ie(e,t){return h&&h(e,t.map(e=>pn(e,w.loaderData)))||e.key}function Le(e,t){if(m&&g){let n=Ie(e,t);m[n]=g()}}function Re(e,t){if(m){let n=Ie(e,t),r=m[n];if(typeof r==`number`)return r}return null}function ze(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:fn(n,r,l,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:fn(n,r,l,!0)}}return{active:!1,matches:null}}async function Be(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=c==null,d=c||s,f=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:i,patch:(e,t)=>{r.aborted||wr(e,t,d,f,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(s=[...s])}if(r.aborted)return{type:`aborted`};let p=dn(d,n,l),m=null;if(p&&(Object.keys(p[0].params).length===0||(m=fn(d,n,l,!0),!(m&&u.length<m.length&&Ve(u,m.slice(0,u.length))))))return{type:`success`,matches:p};if(m||=fn(d,n,l,!0),!m||Ve(u,m))return{type:`success`,matches:null};u=m}}function Ve(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function He(e){o={},c=ln(e,a,void 0,o)}function Ue(e,t,n=!1){let r=c==null;wr(e,t,c||s,o,a,n),r&&(s=[...s],se({}))}return C={get basename(){return l},get future(){return d},get state(){return w},get routes(){return s},get window(){return t},initialize:ie,subscribe:oe,enableScrollRestoration:Fe,navigate:le,fetch:he,revalidate:ue,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Se,resetFetcher:Ce,deleteFetcher:Te,dispose:ae,getBlocker:Ae,deleteBlocker:je,patchRoutes:Ue,_internalFetchControllers:F,_internalSetRoutes:He,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){se(e)}},e.unstable_instrumentations&&(C=See(C,e.unstable_instrumentations.map(e=>e.router).filter(Boolean))),C}function hr(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function gr(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=Rn(r||`.`,Ln(o),An(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=_i(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=jn({basename:n,pathname:c.pathname})),Zt(c)}function _r(e,t,n){if(!n||!hr(n))return{path:t};if(n.formMethod&&!hi(n.formMethod))return{path:t,error:ti(405,{method:n.formMethod})};let r=()=>({path:t,error:ti(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=ri(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!gi(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
3
3
  `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!gi(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Kt(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=qr(n.formData),s=n.formData;else if(n.body instanceof FormData)o=qr(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=Jr(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=Jr(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(gi(c.formMethod))return{path:t,submission:c};let l=Qt(t);return e&&l.search&&_i(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Zt(l),submission:c}}function vr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){let x=y?li(y[1])?y[1].error:y[1].data:void 0,S=i.createURL(a.location),C=i.createURL(c),w;if(u&&a.errors){let e=Object.keys(a.errors)[0];w=o.findIndex(t=>t.route.id===e)}else if(y&&li(y[1])){let e=y[0];w=o.findIndex(t=>t.route.id===e)-1}let T=y?y[1].statusCode:void 0,E=T&&T>=400,D={currentUrl:S,currentParams:a.matches[0]?.params||{},nextUrl:C,nextParams:o[0].params,...s,actionResult:x,actionStatus:T},O=Wn(o),k=o.map((i,o)=>{let{route:s}=i,f=null;if(w!=null&&o>w)f=!1;else if(s.lazy)f=!0;else if(!yr(s))f=!1;else if(u){let{shouldLoad:e}=br(s,a.loaderData,a.errors);f=e}else xr(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return Ir(n,r,e,c,O,i,l,t,f);let p=!1;typeof b==`boolean`?p=b:E?p=!1:d||S.pathname+S.search===C.pathname+C.search?p=!0:S.search===C.search?Sr(a.matches[o],i)&&(p=!0):p=!0;let m={...D,defaultShouldRevalidate:p};return Ir(n,r,e,c,O,i,l,t,Cr(i,m),m,b)}),A=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,y=dn(g,e.path,_);if(!y){if(v&&m)return;A.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let x=vi(y,e.path),S=new AbortController,C=Gr(i,e.path,S.signal),w=null;if(f.has(s))f.delete(s),w=Lr(n,r,C,e.path,y,x,l,t);else if(m)d&&(w=Lr(n,r,C,e.path,y,x,l,t));else{let i;i=typeof b==`boolean`?b:E?!1:d;let a={...D,defaultShouldRevalidate:i};Cr(x,a)&&(w=Lr(n,r,C,e.path,y,x,l,t,a))}w&&A.push({key:s,routeId:e.routeId,path:e.path,matches:w,match:x,request:C,controller:S})}),{dsMatches:k,revalidatingFetchers:A}}function yr(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function br(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!yr(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function xr(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Sr(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Cr(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function wr(e,t,n,r,i,a){let o;if(e){let t=r[e];Kt(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Tr(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=ln(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=ln([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}}function Tr(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>Tr(e,t)))??!1:!1}var Er=new WeakMap,Dr=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Kt(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Er.get(i);o||(o={},Er.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=an(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)qt(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)qt(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},Or=new WeakMap;function kr(e,t,n,r,i){let a=n[e.id];if(Kt(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=Or.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Kt(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=sn(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?qt(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?qt(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return Or.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Dr({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Ar(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function jr(e){return e.matches.some(e=>e.route.middleware)?Mr(e,()=>Ar(e)):Ar(e)}function Mr(e,t){return Nr(e,t,e=>{if(mi(e))throw e;return e},oi,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=$r(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Nr(e,t,n,r,i){let{matches:a,...o}=e;return await Pr(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function Pr(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await Pr(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function Fr(e,t,n,r,i){let a=Dr({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=kr(r.route,gi(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function Ir(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=Fr(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?Cr(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?Cr(a,{...l,defaultShouldRevalidate:e}):Cr(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!gi(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(gi(n.method)||!p)?zr({request:n,path:r,unstable_pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function Lr(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?Ir(e,t,n,r,Wn(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:Fr(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function Rr(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,unstable_url:Kr(t,n),unstable_pattern:Wn(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return Mr(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function zr({request:e,path:t,unstable_pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=gi(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,unstable_url:Kr(e,t),unstable_pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw ti(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw ti(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function Br(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Vr(e){let{result:t,type:n}=e;if(fi(t)){let e;try{e=await Br(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Hn(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?di(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:ai(t),statusCode:Un(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Un(t)?t.status:void 0}:di(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function Hr(e,t,n,r,i){let a=e.headers.get(`Location`);if(Kt(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!Nn(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=gr(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var Ur=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Wr(e,t,n,r){if(Nn(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(Ur.includes(i.protocol))throw Error(`Invalid redirect location`);let a=An(i.pathname,n)!=null;if(i.origin===t.origin&&a)return zn(i.pathname)+i.search+i.hash}try{let t=r.createURL(e);if(Ur.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function Gr(e,t,n,r){let i=e.createURL(ri(t)).toString(),a={signal:n};if(r&&gi(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=qr(r.formData):a.body=r.formData}return new Request(i,a)}function Kr(e,t){let n=new URL(e.url),r=typeof t==`string`?Qt(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function qr(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Jr(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Yr(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&li(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Kt(!ui(f),`Cannot handle redirect results in processLoaderData`),li(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=$r(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=pr),c||(c=!0,s=Un(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function Xr(e,t,n,r,i,a){let{loaderData:o,errors:s}=Yr(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let o=a[n];if(Kt(o,`Did not find corresponding fetcher result`),li(o)){let t=$r(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(ui(o))Kt(!1,`Unhandled fetcher revalidation redirect`);else{let t=Si(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function Zr(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==pr).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Qr(e){return e?li(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function $r(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function ei(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function ti(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Hn(e||500,o,Error(s),!0)}function ni(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(ui(r))return{key:n,result:r}}}function ri(e){return Zt({...typeof e==`string`?Qt(e):e,hash:``})}function ii(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function ai(e){return new Hn(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function oi(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&si(t))}function si(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function ci(e){return fi(e.result)&&or.has(e.result.status)}function li(e){return e.type===`error`}function ui(e){return(e&&e.type)===`redirect`}function di(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function fi(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function pi(e){return or.has(e)}function mi(e){return fi(e)&&pi(e.status)&&e.headers.has(`Location`)}function hi(e){return ar.has(e.toUpperCase())}function gi(e){return rr.has(e.toUpperCase())}function _i(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function vi(e,t){let n=typeof t==`string`?Qt(t).search:t.search;if(e[e.length-1].route.index&&_i(n||``))return e[e.length-1];let r=In(e);return r[r.length-1]}function yi(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function bi(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Cee(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function xi(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function wee(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Si(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Tee(e,t){try{let n=e.sessionStorage.getItem(fr);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function Eee(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(fr,JSON.stringify(n))}catch(e){qt(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Ci(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var wi=L.createContext(null);wi.displayName=`DataRouter`;var Ti=L.createContext(null);Ti.displayName=`DataRouterState`;var Ei=L.createContext(!1);function Di(){return L.useContext(Ei)}var Oi=L.createContext({isTransitioning:!1});Oi.displayName=`ViewTransition`;var ki=L.createContext(new Map);ki.displayName=`Fetchers`;var Dee=L.createContext(null);Dee.displayName=`Await`;var Ai=L.createContext(null);Ai.displayName=`Navigation`;var ji=L.createContext(null);ji.displayName=`Location`;var Mi=L.createContext({outlet:null,matches:[],isDataRoute:!1});Mi.displayName=`Route`;var Ni=L.createContext(null);Ni.displayName=`RouteError`;var Pi=`REACT_ROUTER_ERROR`,Oee=`REDIRECT`,kee=`ROUTE_ERROR_RESPONSE`;function Aee(e){if(e.startsWith(`${Pi}:${Oee}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function jee(e){if(e.startsWith(`${Pi}:${kee}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Hn(t.status,t.statusText,t.data)}catch{}}function Mee(e,{relative:t}={}){Kt(Fi(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=L.useContext(Ai),{hash:i,pathname:a,search:o}=Hi(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Bn([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Fi(){return L.useContext(ji)!=null}function Ii(){return Kt(Fi(),`useLocation() may be used only in the context of a <Router> component.`),L.useContext(ji).location}var Li=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ri(e){L.useContext(Ai).static||L.useLayoutEffect(e)}function zi(){let{isDataRoute:e}=L.useContext(Mi);return e?oa():Nee()}function Nee(){Kt(Fi(),`useNavigate() may be used only in the context of a <Router> component.`);let e=L.useContext(wi),{basename:t,navigator:n}=L.useContext(Ai),{matches:r}=L.useContext(Mi),{pathname:i}=Ii(),a=JSON.stringify(Ln(r)),o=L.useRef(!1);return Ri(()=>{o.current=!0}),L.useCallback((r,s={})=>{if(qt(o.current,Li),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Rn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Bn([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Pee=L.createContext(null);function Bi(e){let t=L.useContext(Mi).outlet;return L.useMemo(()=>t&&L.createElement(Pee.Provider,{value:e},t),[t,e])}function Vi(){let{matches:e}=L.useContext(Mi);return e[e.length-1]?.params??{}}function Hi(e,{relative:t}={}){let{matches:n}=L.useContext(Mi),{pathname:r}=Ii(),i=JSON.stringify(Ln(n));return L.useMemo(()=>Rn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ui(e,t,n){Kt(Fi(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=L.useContext(Ai),{matches:i}=L.useContext(Mi),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ca(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
4
4
 
@@ -50,7 +50,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
50
50
  `)){let e=r.replace(/\r$/,``);e.startsWith(`event:`)?t=e.slice(6).trim():e.startsWith(`data:`)&&(n+=e.slice(5).trimStart())}if(n){if(t===`progress`){a(n);return}if(t===`result`)try{let e=JSON.parse(n);i=e.ok?{ok:!0,result:e.result??null}:{ok:!1,error:String(e.error??`unknown`),message:String(e.message??`Update failed`),status:e.error===`busy`?409:400,result:e.result??null}}catch{i={ok:!1,error:`parse`,message:`Invalid update stream`,status:0}}}};try{for(;i===null;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0}),r=r.replace(/\r\n/g,`
51
51
  `);let a;for(;(a=r.indexOf(`
52
52
 
53
- `))!==-1;){let e=r.slice(0,a);r=r.slice(a+2),e.length&&o(e)}}}finally{t.releaseLock()}return i??{ok:!1,error:`no-result`,message:`Update stream ended without a result`,status:0}}var fV=`xopc.updateReminder.dismissed`,pV=typeof window<`u`&&window.electronAPI?.updater!==void 0,mV=`xopc:electron-update-recheck`;function hV(){if(typeof window>`u`)return{};try{let e=localStorage.getItem(fV);if(!e)return{};let t=JSON.parse(e);return t&&typeof t==`object`?t:{}}catch{return{}}}var gV=160;function _V(e){let t=e.trim();return t.length<=gV?t:`${t.slice(0,gV-1)}…`}function vV(){let{npm:e,electron:t,isElectron:n,electronQuitAndInstall:r,runNpmUpdate:i,npmUpdateRunning:a}=cV(),[o,s]=(0,L.useState)(hV),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(()=>{if(typeof window>`u`||pV)return null;try{let e=sessionStorage.getItem(aV);if(!e)return null;let t=JSON.parse(e);return(typeof t.installedVersion==`string`?t.installedVersion.trim():``)||null}catch{return null}});(0,L.useEffect)(()=>{t?.state!==`downloading`&&l(!1)},[t?.state]),(0,L.useEffect)(()=>{t?.state!==`error`&&d(!1)},[t?.state]),(0,L.useEffect)(()=>{if(n)return;let e=()=>{try{let e=sessionStorage.getItem(aV);if(!e){p(null);return}let t=JSON.parse(e);p((typeof t.installedVersion==`string`?t.installedVersion.trim():``)||null)}catch{p(null)}};return e(),window.addEventListener(`xopc:npm-update-installed`,e),()=>window.removeEventListener(`xopc:npm-update-installed`,e)},[n]),(0,L.useEffect)(()=>{if(!(!e?.currentVersion||!f)&&e.currentVersion===f){try{sessionStorage.removeItem(aV)}catch{}p(null)}},[e?.currentVersion,f]),(0,L.useEffect)(()=>{let e=()=>{l(!1),s(e=>{let t={...e};delete t.electronReady;try{localStorage.setItem(fV,JSON.stringify(t))}catch{}return t})};return window.addEventListener(mV,e),()=>window.removeEventListener(mV,e)},[]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail?.version?.trim();t&&s(e=>{let n={...e,npm:t};try{localStorage.setItem(fV,JSON.stringify(n))}catch{}return n})};return window.addEventListener(`xopc:npm-update-installed`,e),()=>window.removeEventListener(`xopc:npm-update-installed`,e)},[]);let m=(0,L.useMemo)(()=>n&&t?.state===`downloaded`&&t.version?o.electronReady===t.version?{kind:`none`}:{kind:`electron-ready`,version:t.version}:n&&t?.state===`downloading`&&!c?{kind:`electron-downloading`,percent:Math.round(t.percent??0)}:n&&t?.state===`error`&&t.message&&!u?{kind:`electron-error`,message:_V(t.message)}:!n&&f&&e&&e.currentVersion!==f?{kind:`npm-restart-required`,version:f}:!n&&e?.updateAvailable&&e.latestVersion?o.npm===e.latestVersion?{kind:`none`}:{kind:`npm`,version:e.latestVersion,channel:e.channel}:{kind:`none`},[o.npm,o.electronReady,t,c,u,n,e,f]);return{show:m,dismiss:(0,L.useCallback)(()=>{if(m.kind===`electron-downloading`){l(!0);return}if(m.kind===`electron-error`){d(!0);return}if(m.kind===`npm-restart-required`){try{sessionStorage.removeItem(aV)}catch{}p(null);return}if(m.kind===`none`)return;let e={...o};m.kind===`npm`?e.npm=m.version:m.kind===`electron-ready`&&(e.electronReady=m.version);try{localStorage.setItem(fV,JSON.stringify(e))}catch{}s(e)},[o,m]),electronQuitAndInstall:r,runNpmUpdate:i,npmUpdateRunning:a}}var yV={version:`0.0.40`,commit:`0524710c261bc86d25ec916045e1a4a4a0b8b635`,buildTimeIso:`2026-05-10T12:52:22.364Z`},bV=`https://github.com/xopcai/xopc`,xV=`https://github.com/xopcai/xopc/releases`;function SV(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n)}catch{return n.toISOString()}}function CV({open:e,onOpenChange:t}){let n=oN(e=>e.language),r=GM(n),i=r.aboutDialog,{isElectron:a,electron:o,electronCheck:s}=cV(),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1);(0,L.useEffect)(()=>{e||d(!1)},[e]),(0,L.useEffect)(()=>{if(!e)return;let t=!1;return l(null),(async()=>{try{let e=await sP(Y(`/health`));if(!e.ok)throw Error(`health`);let n=await e.json();t||l(typeof n.version==`string`?n.version:null)}catch{t||l(null)}})(),()=>{t=!0}},[e]);let f=yV.commit,p=n===`zh`?`zh-CN`:`en-US`,m=SV(yV.buildTimeIso,p),h=new Date().getFullYear(),g=i.copyright.replace(`{year}`,String(h));return(0,J.jsx)(QB,{open:e,onOpenChange:t,children:(0,J.jsxs)($B,{children:[(0,J.jsx)(eV,{className:`xopc-dialog-overlay fixed inset-0 z-[200] bg-scrim`}),(0,J.jsxs)(tV,{className:q(`xopc-dialog-content fixed left-1/2 top-1/2 z-[201] w-[min(100%-2rem,26rem)] -translate-x-1/2 -translate-y-1/2`,`rounded-2xl border border-edge bg-surface-panel shadow-popover dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-3`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#ff5f57]`}),(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#febc2e]`}),(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#28c840]`})]}),(0,J.jsxs)(`div`,{className:`px-6 pb-2 pt-1`,children:[(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(iV,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":i.close,children:(0,J.jsx)(DA,{className:`size-4`,strokeWidth:2})})})}),(0,J.jsxs)(`div`,{className:`-mt-2 flex flex-col items-center text-center`,children:[(0,J.jsx)(DM,{className:`size-[4.5rem]`,alt:r.appBrand}),(0,J.jsx)(nV,{className:`mt-3 text-xl font-semibold tracking-tight text-fg`,children:r.appBrand}),(0,J.jsx)(rV,{className:`sr-only`,children:i.windowTitle})]}),(0,J.jsxs)(`div`,{className:`mt-6 space-y-3 text-sm`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.versionLabel}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-2 sm:justify-start`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[13px] text-fg tabular-nums`,children:yV.version}),(0,J.jsx)(`button`,{type:`button`,className:q(`shrink-0 rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,`transition-colors hover:bg-surface-hover hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),onClick:()=>{a?(window.dispatchEvent(new CustomEvent(mV)),d(!0),s()):window.open(xV,`_blank`,`noopener,noreferrer`)},disabled:a&&[`checking`,`available`,`downloading`,`downloaded`].includes(o?.state??``),children:a&&o?.state===`checking`?(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Kg,{className:`size-3 animate-spin`}),i.checkUpdatesChecking]}):i.checkUpdates})]})]}),a&&u&&(0,J.jsx)(wV,{state:o?.state,version:o?.version,percent:o?.percent,d:i}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`pt-0.5 text-fg-muted`,children:i.commitLabel}),(0,J.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-snug text-fg`,children:f})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-baseline gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.buildDateLabel}),(0,J.jsx)(`span`,{className:`text-right text-[13px] text-fg sm:text-left`,children:m})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-baseline gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.gatewayVersionLabel}),(0,J.jsx)(`span`,{className:`text-right font-mono text-[13px] text-fg sm:text-left`,children:c??i.gatewayUnavailable})]}),(0,J.jsx)(`p`,{className:`pt-0.5 text-[11px] text-fg-subtle`,children:i.consoleBuildHint})]}),(0,J.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4 text-center text-[11px] leading-relaxed text-fg-muted`,children:[(0,J.jsxs)(`p`,{children:[i.openSourceLead,(0,J.jsx)(`a`,{className:`text-accent-fg underline decoration-accent-fg/40 underline-offset-2 hover:decoration-accent-fg`,href:bV,target:`_blank`,rel:`noopener noreferrer`,children:i.openSourceLink})]}),(0,J.jsx)(`p`,{className:`mt-2`,children:g})]})]})]})]})})}function wV({state:e,version:t,percent:n,d:r}){return!e||e===`idle`?null:e===`checking`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,J.jsx)(Kg,{className:`size-3.5 animate-spin`}),(0,J.jsx)(`span`,{children:r.checkUpdatesChecking})]}):e===`not-available`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-green-600 dark:text-green-400`,children:[(0,J.jsx)(Ap,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesUpToDate})]}):e===`available`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-accent-fg`,children:[(0,J.jsx)(Xx,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesAvailable.replace(`{version}`,t??`?`)})]}):e===`downloading`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,J.jsx)(hg,{className:`size-3.5 animate-bounce`}),(0,J.jsx)(`span`,{children:r.checkUpdatesDownloading.replace(`{percent}`,String(Math.round(n??0)))})]}):e===`downloaded`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] font-semibold text-accent-fg`,children:[(0,J.jsx)(hg,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesDownloaded.replace(`{version}`,t??`?`)})]}):e===`error`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-red-500 dark:text-red-400`,children:[(0,J.jsx)(xp,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesError})]}):null}var TV=q(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-left text-sm font-medium leading-5 text-fg`,`transition-colors duration-150 ease-out`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),EV=q(`rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,`dark:border-edge`);function DV({selected:e,label:t,onSelect:n}){return(0,J.jsxs)(`button`,{type:`button`,className:q(`flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium leading-5 text-fg`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:n,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),e?(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-success`,"aria-hidden":!0}):(0,J.jsx)(`span`,{className:`size-1.5 shrink-0`,"aria-hidden":!0})]})}function OV({onOpenFullSettings:e,onAboutClick:t}){let[n,r]=(0,L.useState)(null),i=oN(e=>e.language),a=oN(e=>e.setLanguage),o=TN(e=>e.preference),s=TN(e=>e.setPreference),c=mN(e=>e.preference),l=mN(e=>e.setPreference),u=GM(i),d=u.appearanceSettings,f=e=>q(`absolute left-full top-0 z-[60] min-w-[11rem] max-w-[min(calc(100vw-2rem),16rem)]`,`ml-2 sm:ml-2.5`,n===e?`block`:`hidden`),p=e=>q(`absolute left-full top-0 z-[55] h-full w-8 sm:w-9`,n===e?`pointer-events-auto`:`pointer-events-none`);return(0,J.jsxs)(`div`,{className:`w-[min(calc(100vw-2rem),15rem)] shrink-0 py-1`,onMouseLeave:()=>r(null),children:[(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`lang`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`lang`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`lang`,children:[(0,J.jsx)(jg,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.languageTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`lang`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`lang`),role:`menu`,"aria-label":d.languageTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:i===`en`,label:d.langOptionEn,onSelect:()=>a(`en`)}),(0,J.jsx)(DV,{selected:i===`zh`,label:d.langOptionZh,onSelect:()=>a(`zh`)})]})})]}),(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`theme`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`theme`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`theme`,children:[(0,J.jsx)(Ny,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.themeTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`theme`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`theme`),role:`menu`,"aria-label":d.themeTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:o===`light`,label:d.themeOptionLight,onSelect:()=>s(`light`)}),(0,J.jsx)(DV,{selected:o===`dark`,label:d.themeOptionDark,onSelect:()=>s(`dark`)}),(0,J.jsx)(DV,{selected:o===`system`,label:d.themeOptionSystem,onSelect:()=>s(`system`)})]})})]}),(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`font`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`font`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`font`,children:[(0,J.jsx)(NO,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.fontScaleTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`font`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`font`),role:`menu`,"aria-label":d.fontScaleTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:c===`compact`,label:d.fontScaleCompact,onSelect:()=>l(`compact`)}),(0,J.jsx)(DV,{selected:c===`default`,label:d.fontScaleDefault,onSelect:()=>l(`default`)}),(0,J.jsx)(DV,{selected:c===`large`,label:d.fontScaleLarge,onSelect:()=>l(`large`)})]})})]}),(0,J.jsx)(`div`,{className:`my-2 h-px bg-edge-subtle`,role:`separator`}),(0,J.jsxs)(`button`,{type:`button`,className:TV,onClick:()=>t?.(),onMouseEnter:()=>r(null),onFocus:()=>r(null),children:[(0,J.jsx)(Ig,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.aboutApp})]}),(0,J.jsxs)(`a`,{href:PN(i),target:`_blank`,rel:`noopener noreferrer`,className:TV,onMouseEnter:()=>r(null),onFocus:()=>r(null),children:[(0,J.jsx)(Mu,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:u.sidebar.helpDocs}),(0,J.jsx)(vg,{className:`size-3.5 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsxs)(_o,{to:`/settings/appearance`,className:q(TV,`text-accent-fg hover:bg-accent-soft hover:text-accent-fg`),onMouseEnter:()=>r(null),onFocus:()=>r(null),onClick:()=>e?.(),children:[(0,J.jsx)(xC,{className:`size-4 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:d.openFullPreferences})]})]})}function kV({collapsed:e=!1,onNavigate:t}){let n=GM(oN(e=>e.language)),r=n.appearanceSettings,[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{f(()=>import(`./settings-page-DYOSuaHt.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),f(()=>import(`./sessions-page-CaRD3IvA.js`),__vite__mapDeps([8,1,3,4])),f(()=>import(`./logs-page-BuugMrI_.js`),__vite__mapDeps([9,1,4])),f(()=>import(`./cron-page-B5nTa2u4.js`),__vite__mapDeps([10,1,11,4,2])),f(()=>import(`./skills-page-CN7HsYLQ.js`),__vite__mapDeps([12,1,13,11,4]))},[]),(0,J.jsxs)(`div`,{className:q(`flex shrink-0 flex-col`,e&&`mt-auto`,e?`items-center px-1 py-2`:`px-3 py-3`),children:[(0,J.jsxs)(mB,{open:i,onOpenChange:a,children:[e?(0,J.jsx)(hB,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:q(`flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full outline-none ring-offset-surface-base transition-transform`,`hover:opacity-95 active:scale-95`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2`,i&&`ring-2 ring-accent`,`motion-reduce:opacity-100 motion-reduce:active:scale-100`),"aria-expanded":i,"aria-haspopup":`dialog`,title:n.sidebar.appMenuAria,"aria-label":n.sidebar.appMenuAria,children:(0,J.jsx)(DM,{className:`size-full rounded-full`,alt:n.appBrand})})}):(0,J.jsx)(hB,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:q(`flex w-full min-w-0 items-center gap-2 rounded-xl px-1 py-1 text-left outline-none transition-colors duration-150 ease-out`,`hover:bg-surface-active/70`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i&&`bg-surface-active/70`),"aria-expanded":i,"aria-haspopup":`dialog`,title:n.sidebar.appMenuAria,"aria-label":n.sidebar.appMenuAria,children:[(0,J.jsx)(`span`,{className:`size-8 shrink-0 overflow-hidden rounded-full`,"aria-hidden":!0,children:(0,J.jsx)(DM,{className:`size-full rounded-full`,alt:``,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm font-semibold leading-tight text-fg`,children:n.appBrand}),(0,J.jsx)(`div`,{className:`truncate text-xs text-fg-muted`,children:r.quickMenuHint})]}),(0,J.jsx)(`span`,{className:q(`flex size-9 shrink-0 items-center justify-center rounded-xl text-fg-muted transition-colors`,i&&`bg-accent-soft text-accent-fg`),"aria-hidden":!0,children:(0,J.jsx)(xC,{className:`size-[18px]`,strokeWidth:1.5})})]})}),(0,J.jsx)(gB,{children:(0,J.jsx)(_B,{className:q(`z-50 w-max max-w-[min(calc(100vw-1rem),28rem)] overflow-visible`,`rounded-xl border border-edge bg-surface-panel p-2 shadow-popover dark:border-edge`),side:`top`,align:e?`center`:`start`,sideOffset:8,collisionPadding:12,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:(0,J.jsx)(OV,{onOpenFullSettings:()=>{a(!1),t?.()},onAboutClick:()=>{s(!0),a(!1)}})})})]}),(0,J.jsx)(CV,{open:o,onOpenChange:s})]})}var AV={dingtalk:`/channel-icons/dingtalk.svg`,feishu:`/channel-icons/feishu.svg`,lark:`/channel-icons/lark.svg`,telegram:`/channel-icons/telegram.svg`,weixin:`/channel-icons/weixin.svg`,wechat:`/channel-icons/wechat.svg`};function jV({sourceChannel:e,className:t}){let n=AV[e.toLowerCase()];return n?(0,J.jsx)(`img`,{src:n,alt:``,draggable:!1,className:q(`shrink-0`,t),"aria-hidden":!0}):(0,J.jsx)(Ng,{className:q(`shrink-0`,t),strokeWidth:1.75,"aria-hidden":!0})}var MV=`inline-flex items-center gap-px rounded-pill border border-edge bg-surface-hover p-1 dark:border-edge`,NV=`inline-flex shrink-0 items-center justify-center rounded-pill text-xs font-medium leading-none transition-[color,background-color,box-shadow] duration-150 ease-out text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100`,PV=`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,FV=1;function IV(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===t?{x:n,y:r}:null}var LV=`pointer-events-none absolute left-0 top-0 z-[1] rounded-pill bg-surface-panel shadow-sm will-change-transform [backface-visibility:hidden] dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,RV=`relative z-[2] box-border flex h-6 min-h-0 min-w-0 flex-1 cursor-pointer items-center justify-center gap-1 rounded-pill border-0 bg-transparent px-2 py-0 text-center text-xs font-medium leading-none outline-none transition-[color,background-color,box-shadow] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`;function zV({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:a}){let o=(0,L.useRef)(null),s=(0,L.useRef)([]),[c,l]=(0,L.useState)({x:0,y:0,w:0,h:0}),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=(0,L.useCallback)(()=>{let t=o.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=s.current[r];if(!i)return;let a=FV,c=t.getBoundingClientRect(),u=i.getBoundingClientRect(),f=IV(i,t),p,m;if(f)p=f.x,m=f.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=u.left-c.left-n,m=u.top-c.top-r}l({x:p+a,y:m+a,w:Math.max(0,u.width-a*2),h:Math.max(0,u.height-a*2)}),d(!0)},[n,e]);return(0,L.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>m());return()=>cancelAnimationFrame(e)},[m]),(0,L.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>p(!0))});return()=>cancelAnimationFrame(e)},[]),(0,L.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(()=>m())});return t.observe(e),window.addEventListener(`resize`,m),()=>{t.disconnect(),window.removeEventListener(`resize`,m)}},[m]),(0,J.jsxs)(`div`,{ref:o,className:q(MV,`relative isolate flex w-full max-w-full flex-row items-center`,i),role:`group`,"aria-label":r,children:[(0,J.jsx)(`div`,{"aria-hidden":!0,className:q(LV,`motion-reduce:!transition-none motion-reduce:!duration-0`,f&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:c.w,height:c.h,transform:`translate3d(${c.x}px, ${c.y}px, 0)`,opacity:u&&c.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,o=e===n.value;return(0,J.jsxs)(`button`,{ref:e=>{s.current[r]=e},type:`button`,"aria-pressed":o,title:n.title??n.label,onClick:()=>t(n.value),className:q(RV,o?`text-fg`:`text-fg-subtle`,a),children:[i?(0,J.jsx)(i,{className:`block size-3 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate leading-none`,children:n.label})]},n.value)})]})}function BV(){return Y(`/api/config`)}var VV=null;async function HV(){return VV||(VV=cP(BV()).finally(()=>{VV=null}),VV)}function UV(e){let t=c(e?BV():null,HV,{revalidateOnFocus:!1});return(0,L.useEffect)(()=>{if(!e)return;let t=BV(),n=()=>{s(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},[e]),t}function WV(){return s(BV())}var GV=null;async function KV(){return GV||(GV=qV().finally(()=>{GV=null}),GV)}async function qV(){let e=await sP(Y(`/api/agents`));if(e.ok){let t=await e.json();if(t.ok&&t.payload?.defaultId&&Array.isArray(t.payload.agents)){let e=t.payload.defaultId.trim().toLowerCase(),n=t.payload.agents.filter(e=>!!(e&&typeof e.id==`string`&&e.id.trim())).map(e=>({id:e.id.trim().toLowerCase(),name:typeof e.name==`string`&&e.name.trim()?e.name.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{}}));if(n.length>0)return{defaultId:e,items:n}}}let t=(await HV()).payload?.config?.agents,n=(t?.defaultId??`main`).trim().toLowerCase(),r=(Array.isArray(t?.list)?t.list:[]).filter(e=>!!(e&&typeof e.id==`string`&&e.id.trim())).map(e=>({id:e.id.trim().toLowerCase(),name:typeof e.name==`string`&&e.name.trim()?e.name.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{}}));return r.length===0?{defaultId:n,items:[{id:n}]}:{defaultId:n,items:r}}function JV(e){return typeof e==`object`&&!!e&&`role`in e}function YV(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function XV(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function ZV(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function QV(e){return ZV(e.args??e.arguments??e.input??e.function?.arguments)??{}}function $V(e){return typeof e==`object`&&!!e}function eH(e){if(e.type!==`thinking`)return``;let t=e;return typeof t.text==`string`?t.text:typeof t.thinking==`string`?t.thinking:``}function tH(e,t){let n=e.map(e=>({...e})),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t.type===`tool_use`&&r.set(t.id,e)}for(let e of t){if(e.type===`tool_use`&&r.has(e.id)){let t=r.get(e.id);n[t]={...e};continue}if(e.type===`thinking`&&n.length>0){let t=n[n.length-1];if(t.type===`thinking`&&eH(t)===eH(e))continue}e.type===`tool_use`&&r.set(e.id,n.length),n.push({...e})}return n}function nH(e){if(e.length<2)return e;let t=[];for(let n of e){if(n.role!==`assistant`){t.push(n);continue}let e=t[t.length-1];e?.role===`assistant`?(e.content=tH(e.content,n.content),n.timestamp!=null&&(e.timestamp=n.timestamp),n.usage&&(e.usage=n.usage),n.attachments?.length&&(e.attachments=pH([...e.attachments??[],...n.attachments]))):t.push({...n,content:[...n.content]})}return t}function rH(e){let t=[];for(let n of e){if(!JV(n))continue;let e=n,r=String(e.role??``);if(r!==`system`){if(r===`toolResult`||r===`tool`){yH(t,e);continue}if(r===`user`||r===`user-with-attachments`){t.push(hH(e));continue}if(r===`assistant`){t.push(gH(e));continue}}}return nH(t)}function iH(e){if(Array.isArray(e))return e.map(e=>aH(e))}function aH(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=typeof t.data==`string`?t.data:void 0,r=typeof t.content==`string`&&t.content.length>0?t.content:n,i=typeof t.name==`string`&&t.name.length>0?t.name:`file`,a=typeof t.mimeType==`string`&&t.mimeType.length>0?t.mimeType:``;!a&&typeof t.type==`string`&&t.type.includes(`/`)&&(a=t.type),a||=`application/octet-stream`;let o=a.split(`;`)[0]?.trim().toLowerCase()??``;if(o===`application/octet-stream`||o===``){let e=k(i);e&&(a=e)}let s=typeof t.preview==`string`&&t.preview.length>0?t.preview:a.startsWith(`image/`)&&r?r:void 0,c=typeof t.durationSeconds==`number`&&Number.isFinite(t.durationSeconds)&&t.durationSeconds>0?t.durationSeconds:void 0;return{id:typeof t.id==`string`?t.id:void 0,name:i,mimeType:a,type:typeof t.type==`string`?t.type:void 0,size:typeof t.size==`number`?t.size:void 0,content:r,data:n??r,preview:s,extractedText:typeof t.extractedText==`string`?t.extractedText:void 0,workspaceRelativePath:typeof t.workspaceRelativePath==`string`&&t.workspaceRelativePath.length>0?t.workspaceRelativePath:void 0,durationSeconds:c}}function oH(e){if(typeof e!=`string`||!e.includes(`## Skill:`))return e;let t=e.match(/## Skill:\s*([^\s\r\n]+)/);if(!t)return e;let n=t[1]??``;if(!n)return e;let r=[...e.matchAll(/\*\*Arguments\*\*:\s*([^\r\n]+)/g)],i=r.length>0?(r[r.length-1]?.[1]??``).trim():``;return i?`/skill:${n} ${i}`:`/skill:${n}`}function sH(e){return e.includes(`<file path=`)?e.replace(/<file\s+path="[^"]*">\r?\n[\s\S]*?<\/file>(?:\r?\n)*/g,``).replace(/\n{3,}/g,`
53
+ `))!==-1;){let e=r.slice(0,a);r=r.slice(a+2),e.length&&o(e)}}}finally{t.releaseLock()}return i??{ok:!1,error:`no-result`,message:`Update stream ended without a result`,status:0}}var fV=`xopc.updateReminder.dismissed`,pV=typeof window<`u`&&window.electronAPI?.updater!==void 0,mV=`xopc:electron-update-recheck`;function hV(){if(typeof window>`u`)return{};try{let e=localStorage.getItem(fV);if(!e)return{};let t=JSON.parse(e);return t&&typeof t==`object`?t:{}}catch{return{}}}var gV=160;function _V(e){let t=e.trim();return t.length<=gV?t:`${t.slice(0,gV-1)}…`}function vV(){let{npm:e,electron:t,isElectron:n,electronQuitAndInstall:r,runNpmUpdate:i,npmUpdateRunning:a}=cV(),[o,s]=(0,L.useState)(hV),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(()=>{if(typeof window>`u`||pV)return null;try{let e=sessionStorage.getItem(aV);if(!e)return null;let t=JSON.parse(e);return(typeof t.installedVersion==`string`?t.installedVersion.trim():``)||null}catch{return null}});(0,L.useEffect)(()=>{t?.state!==`downloading`&&l(!1)},[t?.state]),(0,L.useEffect)(()=>{t?.state!==`error`&&d(!1)},[t?.state]),(0,L.useEffect)(()=>{if(n)return;let e=()=>{try{let e=sessionStorage.getItem(aV);if(!e){p(null);return}let t=JSON.parse(e);p((typeof t.installedVersion==`string`?t.installedVersion.trim():``)||null)}catch{p(null)}};return e(),window.addEventListener(`xopc:npm-update-installed`,e),()=>window.removeEventListener(`xopc:npm-update-installed`,e)},[n]),(0,L.useEffect)(()=>{if(!(!e?.currentVersion||!f)&&e.currentVersion===f){try{sessionStorage.removeItem(aV)}catch{}p(null)}},[e?.currentVersion,f]),(0,L.useEffect)(()=>{let e=()=>{l(!1),s(e=>{let t={...e};delete t.electronReady;try{localStorage.setItem(fV,JSON.stringify(t))}catch{}return t})};return window.addEventListener(mV,e),()=>window.removeEventListener(mV,e)},[]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail?.version?.trim();t&&s(e=>{let n={...e,npm:t};try{localStorage.setItem(fV,JSON.stringify(n))}catch{}return n})};return window.addEventListener(`xopc:npm-update-installed`,e),()=>window.removeEventListener(`xopc:npm-update-installed`,e)},[]);let m=(0,L.useMemo)(()=>n&&t?.state===`downloaded`&&t.version?o.electronReady===t.version?{kind:`none`}:{kind:`electron-ready`,version:t.version}:n&&t?.state===`downloading`&&!c?{kind:`electron-downloading`,percent:Math.round(t.percent??0)}:n&&t?.state===`error`&&t.message&&!u?{kind:`electron-error`,message:_V(t.message)}:!n&&f&&e&&e.currentVersion!==f?{kind:`npm-restart-required`,version:f}:!n&&e?.updateAvailable&&e.latestVersion?o.npm===e.latestVersion?{kind:`none`}:{kind:`npm`,version:e.latestVersion,channel:e.channel}:{kind:`none`},[o.npm,o.electronReady,t,c,u,n,e,f]);return{show:m,dismiss:(0,L.useCallback)(()=>{if(m.kind===`electron-downloading`){l(!0);return}if(m.kind===`electron-error`){d(!0);return}if(m.kind===`npm-restart-required`){try{sessionStorage.removeItem(aV)}catch{}p(null);return}if(m.kind===`none`)return;let e={...o};m.kind===`npm`?e.npm=m.version:m.kind===`electron-ready`&&(e.electronReady=m.version);try{localStorage.setItem(fV,JSON.stringify(e))}catch{}s(e)},[o,m]),electronQuitAndInstall:r,runNpmUpdate:i,npmUpdateRunning:a}}var yV={version:`0.0.41`,commit:`33551ca310963dff4d1ad9d67d0c82e8abd6a818`,buildTimeIso:`2026-05-10T13:40:01.650Z`},bV=`https://github.com/xopcai/xopc`,xV=`https://github.com/xopcai/xopc/releases`;function SV(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n)}catch{return n.toISOString()}}function CV({open:e,onOpenChange:t}){let n=oN(e=>e.language),r=GM(n),i=r.aboutDialog,{isElectron:a,electron:o,electronCheck:s}=cV(),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1);(0,L.useEffect)(()=>{e||d(!1)},[e]),(0,L.useEffect)(()=>{if(!e)return;let t=!1;return l(null),(async()=>{try{let e=await sP(Y(`/health`));if(!e.ok)throw Error(`health`);let n=await e.json();t||l(typeof n.version==`string`?n.version:null)}catch{t||l(null)}})(),()=>{t=!0}},[e]);let f=yV.commit,p=n===`zh`?`zh-CN`:`en-US`,m=SV(yV.buildTimeIso,p),h=new Date().getFullYear(),g=i.copyright.replace(`{year}`,String(h));return(0,J.jsx)(QB,{open:e,onOpenChange:t,children:(0,J.jsxs)($B,{children:[(0,J.jsx)(eV,{className:`xopc-dialog-overlay fixed inset-0 z-[200] bg-scrim`}),(0,J.jsxs)(tV,{className:q(`xopc-dialog-content fixed left-1/2 top-1/2 z-[201] w-[min(100%-2rem,26rem)] -translate-x-1/2 -translate-y-1/2`,`rounded-2xl border border-edge bg-surface-panel shadow-popover dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-3`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#ff5f57]`}),(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#febc2e]`}),(0,J.jsx)(`span`,{className:`size-3 rounded-full bg-[#28c840]`})]}),(0,J.jsxs)(`div`,{className:`px-6 pb-2 pt-1`,children:[(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(iV,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":i.close,children:(0,J.jsx)(DA,{className:`size-4`,strokeWidth:2})})})}),(0,J.jsxs)(`div`,{className:`-mt-2 flex flex-col items-center text-center`,children:[(0,J.jsx)(DM,{className:`size-[4.5rem]`,alt:r.appBrand}),(0,J.jsx)(nV,{className:`mt-3 text-xl font-semibold tracking-tight text-fg`,children:r.appBrand}),(0,J.jsx)(rV,{className:`sr-only`,children:i.windowTitle})]}),(0,J.jsxs)(`div`,{className:`mt-6 space-y-3 text-sm`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.versionLabel}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-2 sm:justify-start`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[13px] text-fg tabular-nums`,children:yV.version}),(0,J.jsx)(`button`,{type:`button`,className:q(`shrink-0 rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,`transition-colors hover:bg-surface-hover hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),onClick:()=>{a?(window.dispatchEvent(new CustomEvent(mV)),d(!0),s()):window.open(xV,`_blank`,`noopener,noreferrer`)},disabled:a&&[`checking`,`available`,`downloading`,`downloaded`].includes(o?.state??``),children:a&&o?.state===`checking`?(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Kg,{className:`size-3 animate-spin`}),i.checkUpdatesChecking]}):i.checkUpdates})]})]}),a&&u&&(0,J.jsx)(wV,{state:o?.state,version:o?.version,percent:o?.percent,d:i}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`pt-0.5 text-fg-muted`,children:i.commitLabel}),(0,J.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-snug text-fg`,children:f})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-baseline gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.buildDateLabel}),(0,J.jsx)(`span`,{className:`text-right text-[13px] text-fg sm:text-left`,children:m})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] items-baseline gap-x-3 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:i.gatewayVersionLabel}),(0,J.jsx)(`span`,{className:`text-right font-mono text-[13px] text-fg sm:text-left`,children:c??i.gatewayUnavailable})]}),(0,J.jsx)(`p`,{className:`pt-0.5 text-[11px] text-fg-subtle`,children:i.consoleBuildHint})]}),(0,J.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4 text-center text-[11px] leading-relaxed text-fg-muted`,children:[(0,J.jsxs)(`p`,{children:[i.openSourceLead,(0,J.jsx)(`a`,{className:`text-accent-fg underline decoration-accent-fg/40 underline-offset-2 hover:decoration-accent-fg`,href:bV,target:`_blank`,rel:`noopener noreferrer`,children:i.openSourceLink})]}),(0,J.jsx)(`p`,{className:`mt-2`,children:g})]})]})]})]})})}function wV({state:e,version:t,percent:n,d:r}){return!e||e===`idle`?null:e===`checking`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,J.jsx)(Kg,{className:`size-3.5 animate-spin`}),(0,J.jsx)(`span`,{children:r.checkUpdatesChecking})]}):e===`not-available`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-green-600 dark:text-green-400`,children:[(0,J.jsx)(Ap,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesUpToDate})]}):e===`available`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-accent-fg`,children:[(0,J.jsx)(Xx,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesAvailable.replace(`{version}`,t??`?`)})]}):e===`downloading`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,J.jsx)(hg,{className:`size-3.5 animate-bounce`}),(0,J.jsx)(`span`,{children:r.checkUpdatesDownloading.replace(`{percent}`,String(Math.round(n??0)))})]}):e===`downloaded`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] font-semibold text-accent-fg`,children:[(0,J.jsx)(hg,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesDownloaded.replace(`{version}`,t??`?`)})]}):e===`error`?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-[12px] text-red-500 dark:text-red-400`,children:[(0,J.jsx)(xp,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:r.checkUpdatesError})]}):null}var TV=q(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-left text-sm font-medium leading-5 text-fg`,`transition-colors duration-150 ease-out`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),EV=q(`rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,`dark:border-edge`);function DV({selected:e,label:t,onSelect:n}){return(0,J.jsxs)(`button`,{type:`button`,className:q(`flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium leading-5 text-fg`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:n,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),e?(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-success`,"aria-hidden":!0}):(0,J.jsx)(`span`,{className:`size-1.5 shrink-0`,"aria-hidden":!0})]})}function OV({onOpenFullSettings:e,onAboutClick:t}){let[n,r]=(0,L.useState)(null),i=oN(e=>e.language),a=oN(e=>e.setLanguage),o=TN(e=>e.preference),s=TN(e=>e.setPreference),c=mN(e=>e.preference),l=mN(e=>e.setPreference),u=GM(i),d=u.appearanceSettings,f=e=>q(`absolute left-full top-0 z-[60] min-w-[11rem] max-w-[min(calc(100vw-2rem),16rem)]`,`ml-2 sm:ml-2.5`,n===e?`block`:`hidden`),p=e=>q(`absolute left-full top-0 z-[55] h-full w-8 sm:w-9`,n===e?`pointer-events-auto`:`pointer-events-none`);return(0,J.jsxs)(`div`,{className:`w-[min(calc(100vw-2rem),15rem)] shrink-0 py-1`,onMouseLeave:()=>r(null),children:[(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`lang`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`lang`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`lang`,children:[(0,J.jsx)(jg,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.languageTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`lang`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`lang`),role:`menu`,"aria-label":d.languageTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:i===`en`,label:d.langOptionEn,onSelect:()=>a(`en`)}),(0,J.jsx)(DV,{selected:i===`zh`,label:d.langOptionZh,onSelect:()=>a(`zh`)})]})})]}),(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`theme`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`theme`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`theme`,children:[(0,J.jsx)(Ny,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.themeTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`theme`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`theme`),role:`menu`,"aria-label":d.themeTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:o===`light`,label:d.themeOptionLight,onSelect:()=>s(`light`)}),(0,J.jsx)(DV,{selected:o===`dark`,label:d.themeOptionDark,onSelect:()=>s(`dark`)}),(0,J.jsx)(DV,{selected:o===`system`,label:d.themeOptionSystem,onSelect:()=>s(`system`)})]})})]}),(0,J.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>r(`font`),children:[(0,J.jsxs)(`button`,{type:`button`,className:q(TV,n===`font`&&`bg-surface-hover`),"aria-haspopup":`menu`,"aria-expanded":n===`font`,children:[(0,J.jsx)(NO,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.fontScaleTitle}),(0,J.jsx)(sp,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsx)(`div`,{className:p(`font`),"aria-hidden":!0}),(0,J.jsx)(`div`,{className:f(`font`),role:`menu`,"aria-label":d.fontScaleTitle,children:(0,J.jsxs)(`div`,{className:EV,children:[(0,J.jsx)(DV,{selected:c===`compact`,label:d.fontScaleCompact,onSelect:()=>l(`compact`)}),(0,J.jsx)(DV,{selected:c===`default`,label:d.fontScaleDefault,onSelect:()=>l(`default`)}),(0,J.jsx)(DV,{selected:c===`large`,label:d.fontScaleLarge,onSelect:()=>l(`large`)})]})})]}),(0,J.jsx)(`div`,{className:`my-2 h-px bg-edge-subtle`,role:`separator`}),(0,J.jsxs)(`button`,{type:`button`,className:TV,onClick:()=>t?.(),onMouseEnter:()=>r(null),onFocus:()=>r(null),children:[(0,J.jsx)(Ig,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:d.aboutApp})]}),(0,J.jsxs)(`a`,{href:PN(i),target:`_blank`,rel:`noopener noreferrer`,className:TV,onMouseEnter:()=>r(null),onFocus:()=>r(null),children:[(0,J.jsx)(Mu,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:u.sidebar.helpDocs}),(0,J.jsx)(vg,{className:`size-3.5 shrink-0 text-fg-subtle`,strokeWidth:2,"aria-hidden":!0})]}),(0,J.jsxs)(_o,{to:`/settings/appearance`,className:q(TV,`text-accent-fg hover:bg-accent-soft hover:text-accent-fg`),onMouseEnter:()=>r(null),onFocus:()=>r(null),onClick:()=>e?.(),children:[(0,J.jsx)(xC,{className:`size-4 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:d.openFullPreferences})]})]})}function kV({collapsed:e=!1,onNavigate:t}){let n=GM(oN(e=>e.language)),r=n.appearanceSettings,[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{f(()=>import(`./settings-page-CyQrYfl-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),f(()=>import(`./sessions-page-DgAIvstc.js`),__vite__mapDeps([8,1,3,4])),f(()=>import(`./logs-page-DCH6aatp.js`),__vite__mapDeps([9,1,4])),f(()=>import(`./cron-page-C82UvjSi.js`),__vite__mapDeps([10,1,11,4,2])),f(()=>import(`./skills-page-BR5vm_QN.js`),__vite__mapDeps([12,1,13,11,4]))},[]),(0,J.jsxs)(`div`,{className:q(`flex shrink-0 flex-col`,e&&`mt-auto`,e?`items-center px-1 py-2`:`px-3 py-3`),children:[(0,J.jsxs)(mB,{open:i,onOpenChange:a,children:[e?(0,J.jsx)(hB,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:q(`flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full outline-none ring-offset-surface-base transition-transform`,`hover:opacity-95 active:scale-95`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2`,i&&`ring-2 ring-accent`,`motion-reduce:opacity-100 motion-reduce:active:scale-100`),"aria-expanded":i,"aria-haspopup":`dialog`,title:n.sidebar.appMenuAria,"aria-label":n.sidebar.appMenuAria,children:(0,J.jsx)(DM,{className:`size-full rounded-full`,alt:n.appBrand})})}):(0,J.jsx)(hB,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:q(`flex w-full min-w-0 items-center gap-2 rounded-xl px-1 py-1 text-left outline-none transition-colors duration-150 ease-out`,`hover:bg-surface-active/70`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i&&`bg-surface-active/70`),"aria-expanded":i,"aria-haspopup":`dialog`,title:n.sidebar.appMenuAria,"aria-label":n.sidebar.appMenuAria,children:[(0,J.jsx)(`span`,{className:`size-8 shrink-0 overflow-hidden rounded-full`,"aria-hidden":!0,children:(0,J.jsx)(DM,{className:`size-full rounded-full`,alt:``,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm font-semibold leading-tight text-fg`,children:n.appBrand}),(0,J.jsx)(`div`,{className:`truncate text-xs text-fg-muted`,children:r.quickMenuHint})]}),(0,J.jsx)(`span`,{className:q(`flex size-9 shrink-0 items-center justify-center rounded-xl text-fg-muted transition-colors`,i&&`bg-accent-soft text-accent-fg`),"aria-hidden":!0,children:(0,J.jsx)(xC,{className:`size-[18px]`,strokeWidth:1.5})})]})}),(0,J.jsx)(gB,{children:(0,J.jsx)(_B,{className:q(`z-50 w-max max-w-[min(calc(100vw-1rem),28rem)] overflow-visible`,`rounded-xl border border-edge bg-surface-panel p-2 shadow-popover dark:border-edge`),side:`top`,align:e?`center`:`start`,sideOffset:8,collisionPadding:12,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:(0,J.jsx)(OV,{onOpenFullSettings:()=>{a(!1),t?.()},onAboutClick:()=>{s(!0),a(!1)}})})})]}),(0,J.jsx)(CV,{open:o,onOpenChange:s})]})}var AV={dingtalk:`/channel-icons/dingtalk.svg`,feishu:`/channel-icons/feishu.svg`,lark:`/channel-icons/lark.svg`,telegram:`/channel-icons/telegram.svg`,weixin:`/channel-icons/weixin.svg`,wechat:`/channel-icons/wechat.svg`};function jV({sourceChannel:e,className:t}){let n=AV[e.toLowerCase()];return n?(0,J.jsx)(`img`,{src:n,alt:``,draggable:!1,className:q(`shrink-0`,t),"aria-hidden":!0}):(0,J.jsx)(Ng,{className:q(`shrink-0`,t),strokeWidth:1.75,"aria-hidden":!0})}var MV=`inline-flex items-center gap-px rounded-pill border border-edge bg-surface-hover p-1 dark:border-edge`,NV=`inline-flex shrink-0 items-center justify-center rounded-pill text-xs font-medium leading-none transition-[color,background-color,box-shadow] duration-150 ease-out text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100`,PV=`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,FV=1;function IV(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===t?{x:n,y:r}:null}var LV=`pointer-events-none absolute left-0 top-0 z-[1] rounded-pill bg-surface-panel shadow-sm will-change-transform [backface-visibility:hidden] dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,RV=`relative z-[2] box-border flex h-6 min-h-0 min-w-0 flex-1 cursor-pointer items-center justify-center gap-1 rounded-pill border-0 bg-transparent px-2 py-0 text-center text-xs font-medium leading-none outline-none transition-[color,background-color,box-shadow] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`;function zV({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:a}){let o=(0,L.useRef)(null),s=(0,L.useRef)([]),[c,l]=(0,L.useState)({x:0,y:0,w:0,h:0}),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=(0,L.useCallback)(()=>{let t=o.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=s.current[r];if(!i)return;let a=FV,c=t.getBoundingClientRect(),u=i.getBoundingClientRect(),f=IV(i,t),p,m;if(f)p=f.x,m=f.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=u.left-c.left-n,m=u.top-c.top-r}l({x:p+a,y:m+a,w:Math.max(0,u.width-a*2),h:Math.max(0,u.height-a*2)}),d(!0)},[n,e]);return(0,L.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>m());return()=>cancelAnimationFrame(e)},[m]),(0,L.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>p(!0))});return()=>cancelAnimationFrame(e)},[]),(0,L.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(()=>m())});return t.observe(e),window.addEventListener(`resize`,m),()=>{t.disconnect(),window.removeEventListener(`resize`,m)}},[m]),(0,J.jsxs)(`div`,{ref:o,className:q(MV,`relative isolate flex w-full max-w-full flex-row items-center`,i),role:`group`,"aria-label":r,children:[(0,J.jsx)(`div`,{"aria-hidden":!0,className:q(LV,`motion-reduce:!transition-none motion-reduce:!duration-0`,f&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:c.w,height:c.h,transform:`translate3d(${c.x}px, ${c.y}px, 0)`,opacity:u&&c.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,o=e===n.value;return(0,J.jsxs)(`button`,{ref:e=>{s.current[r]=e},type:`button`,"aria-pressed":o,title:n.title??n.label,onClick:()=>t(n.value),className:q(RV,o?`text-fg`:`text-fg-subtle`,a),children:[i?(0,J.jsx)(i,{className:`block size-3 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate leading-none`,children:n.label})]},n.value)})]})}function BV(){return Y(`/api/config`)}var VV=null;async function HV(){return VV||(VV=cP(BV()).finally(()=>{VV=null}),VV)}function UV(e){let t=c(e?BV():null,HV,{revalidateOnFocus:!1});return(0,L.useEffect)(()=>{if(!e)return;let t=BV(),n=()=>{s(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},[e]),t}function WV(){return s(BV())}var GV=null;async function KV(){return GV||(GV=qV().finally(()=>{GV=null}),GV)}async function qV(){let e=await sP(Y(`/api/agents`));if(e.ok){let t=await e.json();if(t.ok&&t.payload?.defaultId&&Array.isArray(t.payload.agents)){let e=t.payload.defaultId.trim().toLowerCase(),n=t.payload.agents.filter(e=>!!(e&&typeof e.id==`string`&&e.id.trim())).map(e=>({id:e.id.trim().toLowerCase(),name:typeof e.name==`string`&&e.name.trim()?e.name.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{}}));if(n.length>0)return{defaultId:e,items:n}}}let t=(await HV()).payload?.config?.agents,n=(t?.defaultId??`main`).trim().toLowerCase(),r=(Array.isArray(t?.list)?t.list:[]).filter(e=>!!(e&&typeof e.id==`string`&&e.id.trim())).map(e=>({id:e.id.trim().toLowerCase(),name:typeof e.name==`string`&&e.name.trim()?e.name.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{}}));return r.length===0?{defaultId:n,items:[{id:n}]}:{defaultId:n,items:r}}function JV(e){return typeof e==`object`&&!!e&&`role`in e}function YV(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function XV(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function ZV(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function QV(e){return ZV(e.args??e.arguments??e.input??e.function?.arguments)??{}}function $V(e){return typeof e==`object`&&!!e}function eH(e){if(e.type!==`thinking`)return``;let t=e;return typeof t.text==`string`?t.text:typeof t.thinking==`string`?t.thinking:``}function tH(e,t){let n=e.map(e=>({...e})),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t.type===`tool_use`&&r.set(t.id,e)}for(let e of t){if(e.type===`tool_use`&&r.has(e.id)){let t=r.get(e.id);n[t]={...e};continue}if(e.type===`thinking`&&n.length>0){let t=n[n.length-1];if(t.type===`thinking`&&eH(t)===eH(e))continue}e.type===`tool_use`&&r.set(e.id,n.length),n.push({...e})}return n}function nH(e){if(e.length<2)return e;let t=[];for(let n of e){if(n.role!==`assistant`){t.push(n);continue}let e=t[t.length-1];e?.role===`assistant`?(e.content=tH(e.content,n.content),n.timestamp!=null&&(e.timestamp=n.timestamp),n.usage&&(e.usage=n.usage),n.attachments?.length&&(e.attachments=pH([...e.attachments??[],...n.attachments]))):t.push({...n,content:[...n.content]})}return t}function rH(e){let t=[];for(let n of e){if(!JV(n))continue;let e=n,r=String(e.role??``);if(r!==`system`){if(r===`toolResult`||r===`tool`){yH(t,e);continue}if(r===`user`||r===`user-with-attachments`){t.push(hH(e));continue}if(r===`assistant`){t.push(gH(e));continue}}}return nH(t)}function iH(e){if(Array.isArray(e))return e.map(e=>aH(e))}function aH(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=typeof t.data==`string`?t.data:void 0,r=typeof t.content==`string`&&t.content.length>0?t.content:n,i=typeof t.name==`string`&&t.name.length>0?t.name:`file`,a=typeof t.mimeType==`string`&&t.mimeType.length>0?t.mimeType:``;!a&&typeof t.type==`string`&&t.type.includes(`/`)&&(a=t.type),a||=`application/octet-stream`;let o=a.split(`;`)[0]?.trim().toLowerCase()??``;if(o===`application/octet-stream`||o===``){let e=k(i);e&&(a=e)}let s=typeof t.preview==`string`&&t.preview.length>0?t.preview:a.startsWith(`image/`)&&r?r:void 0,c=typeof t.durationSeconds==`number`&&Number.isFinite(t.durationSeconds)&&t.durationSeconds>0?t.durationSeconds:void 0;return{id:typeof t.id==`string`?t.id:void 0,name:i,mimeType:a,type:typeof t.type==`string`?t.type:void 0,size:typeof t.size==`number`?t.size:void 0,content:r,data:n??r,preview:s,extractedText:typeof t.extractedText==`string`?t.extractedText:void 0,workspaceRelativePath:typeof t.workspaceRelativePath==`string`&&t.workspaceRelativePath.length>0?t.workspaceRelativePath:void 0,durationSeconds:c}}function oH(e){if(typeof e!=`string`||!e.includes(`## Skill:`))return e;let t=e.match(/## Skill:\s*([^\s\r\n]+)/);if(!t)return e;let n=t[1]??``;if(!n)return e;let r=[...e.matchAll(/\*\*Arguments\*\*:\s*([^\r\n]+)/g)],i=r.length>0?(r[r.length-1]?.[1]??``).trim():``;return i?`/skill:${n} ${i}`:`/skill:${n}`}function sH(e){return e.includes(`<file path=`)?e.replace(/<file\s+path="[^"]*">\r?\n[\s\S]*?<\/file>(?:\r?\n)*/g,``).replace(/\n{3,}/g,`
54
54
 
55
55
  `).trim():e}function cH(e){if(!e.includes(`xopc-path:`))return e;let t=e;return t=t.replace(/\s*\[File:[^\]]+\]\s*\r?\nxopc-path:rel:[^\r\n]+\r?\n\s*xopc-path:abs:[^\r\n]+/g,``),t=t.replace(/\s*\[File:[^\]]+\]\s+xopc-path:rel:\S+\s+xopc-path:abs:\S+/g,``),t=t.replace(/\s*\[File:[^\]]+\]\s*xopc-path:rel:\S+\s*xopc-path:abs:\S+/g,``),t.replace(/\n{3,}/g,`
56
56
 
@@ -132,7 +132,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
132
132
  ]*?"'`},{begin:`"[^\r
133
133
  "]*"`}]},{className:`built_in`,variants:[{begin:`\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()`}]},e.COMMENT(`^[ ]*\\*.*$`,!1),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]}}t.exports=n})),gQ=n(((e,t)=>{function n(e){return{name:`STEP Part 21`,aliases:[`p21`,`step`,`stp`],case_insensitive:!0,keywords:{$pattern:`[A-Z_][A-Z0-9_.]*`,keyword:[`HEADER`,`ENDSEC`,`DATA`]},contains:[{className:`meta`,begin:`ISO-10303-21;`,relevance:10},{className:`meta`,begin:`END-ISO-10303-21;`,relevance:10},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.COMMENT(`/\\*\\*!`,`\\*/`),e.C_NUMBER_MODE,e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:`string`,begin:`'`,end:`'`},{className:`symbol`,variants:[{begin:`#`,end:`\\d+`,illegal:`\\W`}]}]}}t.exports=n})),_Q=n(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function u(e){let t=n(e),r={className:`variable`,begin:`\\$`+e.IDENT_RE},i=[`charset`,`css`,`debug`,`extend`,`font-face`,`for`,`import`,`include`,`keyframes`,`media`,`mixin`,`page`,`warn`,`while`],u=`(?=[.\\s\\n[:,(])`;return{name:`Stylus`,aliases:[`styl`],case_insensitive:!1,keywords:`if else for in`,illegal:`(`+[`\\?`,`(\\bReturn\\b)`,`(\\bEnd\\b)`,`(\\bend\\b)`,`(\\bdef\\b)`,`;`,`#\\s`,`\\*\\s`,`===\\s`,`\\|`,`%`].join(`|`)+`)`,contains:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.HEXCOLOR,{begin:`\\.[a-zA-Z][a-zA-Z0-9_-]*`+u,className:`selector-class`},{begin:`#[a-zA-Z][a-zA-Z0-9_-]*`+u,className:`selector-id`},{begin:`\\b(`+a.join(`|`)+`)(?=[.\\s\\n[:,(])`,className:`selector-tag`},{className:`selector-pseudo`,begin:`&?:(`+s.join(`|`)+`)(?=[.\\s\\n[:,(])`},{className:`selector-pseudo`,begin:`&?:(:)?(`+c.join(`|`)+`)(?=[.\\s\\n[:,(])`},t.ATTRIBUTE_SELECTOR_MODE,{className:`keyword`,begin:/@media/,starts:{end:/[{;}]/,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},contains:[t.CSS_NUMBER_MODE]}},{className:`keyword`,begin:`@((-(o|moz|ms|webkit)-)?(`+i.join(`|`)+`))\\b`},r,t.CSS_NUMBER_MODE,{className:`function`,begin:`^[a-zA-Z][a-zA-Z0-9_-]*\\(.*\\)`,illegal:`[\\n]`,returnBegin:!0,contains:[{className:`title`,begin:`\\b[a-zA-Z][a-zA-Z0-9_-]*`},{className:`params`,begin:/\(/,end:/\)/,contains:[t.HEXCOLOR,r,e.APOS_STRING_MODE,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE]}]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`,starts:{end:/;|$/,contains:[t.HEXCOLOR,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,t.CSS_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH],illegal:/\./,relevance:0}},t.FUNCTION_DISPATCH]}}t.exports=u})),vQ=n(((e,t)=>{function n(e){return{name:`SubUnit`,case_insensitive:!0,contains:[{className:`string`,begin:`\\[
134
134
  (multipart)?`,end:`\\]
135
- `},{className:`string`,begin:`\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z`},{className:`string`,begin:`(\\+|-)\\d+`},{className:`keyword`,relevance:10,variants:[{begin:`^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?`},{begin:`^progress(:?)(\\s+)?(pop|push)?`},{begin:`^tags:`},{begin:`^time:`}]}]}}t.exports=n})),yQ=n(((e,t)=>{function n(e){return e?typeof e==`string`?e:e.source:null}function r(e){return i(`(?=`,e,`)`)}function i(...e){return e.map(e=>n(e)).join(``)}function a(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function o(...e){return`(`+(a(e).capture?``:`?:`)+e.map(e=>n(e)).join(`|`)+`)`}var s=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),c=[`Protocol`,`Type`].map(s),l=[`init`,`self`].map(s),u=[`Any`,`Self`],d=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],f=[`false`,`nil`,`true`],p=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],m=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],h=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),g=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_=o(g,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),v=i(g,_,`*`),y=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),b=o(y,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),x=i(y,b,`*`),S=i(/[A-Z]/,b,`*`),C=[`attached`,`autoclosure`,i(/convention\(/,o(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,i(/objc\(/,x,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],w=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function T(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),a=[e.C_LINE_COMMENT_MODE,n],g={match:[/\./,o(...c,...l)],className:{2:`keyword`}},y={match:i(/\./,o(...d)),relevance:0},T=d.filter(e=>typeof e==`string`).concat([`_|0`]),E={variants:[{className:`keyword`,match:o(...d.filter(e=>typeof e!=`string`).concat(u).map(s),...l)}]},D={$pattern:o(/\b\w+/,/#\w+/),keyword:T.concat(m),literal:f},O=[g,y,E],k=[{match:i(/\./,o(...h)),relevance:0},{className:`built_in`,match:i(/\b/,o(...h),/(?=\()/)}],A={match:/->/,relevance:0},j=[A,{className:`operator`,relevance:0,variants:[{match:v},{match:`\\.(\\.|${_})+`}]}],M=`([0-9]_*)+`,N=`([0-9a-fA-F]_*)+`,P={className:`number`,relevance:0,variants:[{match:`\\b(${M})(\\.(${M}))?([eE][+-]?(${M}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${M}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},F=(e=``)=>({className:`subst`,variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),I=(e=``)=>({className:`subst`,match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),ee=(e=``)=>({className:`subst`,label:`interpol`,begin:i(/\\/,e,/\(/),end:/\)/}),te=(e=``)=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[F(e),I(e),ee(e)]}),L=(e=``)=>({begin:i(e,/"/),end:i(/"/,e),contains:[F(e),ee(e)]}),ne={className:`string`,variants:[te(),te(`#`),te(`##`),te(`###`),L(),L(`#`),L(`##`),L(`###`)]},R=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:R},B=e=>{let t=i(e,/\//),n=i(/\//,e);return{begin:t,end:n,contains:[...R,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},re={scope:`regexp`,variants:[B(`###`),B(`##`),B(`#`),z]},V={match:i(/`/,x,/`/)},ie=[V,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${b}+`}],ae=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:w,contains:[...j,P,ne]}]}},{scope:`keyword`,match:i(/@/,o(...C),r(o(/\(/,/\s+/)))},{scope:`meta`,match:i(/@/,x)}],oe={match:r(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,b,`+`)},{className:`type`,match:S,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,r(S)),relevance:0}]},se={begin:/</,end:/>/,keywords:D,contains:[...a,...O,...ae,A,oe]};oe.contains.push(se);let ce={begin:/\(/,end:/\)/,relevance:0,keywords:D,contains:[`self`,{match:i(x,/\s*:/),keywords:`_|0`,relevance:0},...a,re,...O,...k,...j,P,ne,...ie,...ae,oe]},le={begin:/</,end:/>/,keywords:`repeat each`,contains:[...a,oe]},ue={begin:/\(/,end:/\)/,keywords:D,contains:[{begin:o(r(i(x,/\s*:/)),r(i(x,/\s+/,x,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:x}]},...a,...O,...j,P,ne,...ae,oe,ce],endsParent:!0,illegal:/["']/},de={match:[/(func|macro)/,/\s+/,o(V.match,x,v)],className:{1:`keyword`,3:`title.function`},contains:[le,ue,t],illegal:[/\[/,/%/]},fe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[le,ue,t],illegal:/\[|%/},H={match:[/operator/,/\s+/,v],className:{1:`keyword`,3:`title`}},pe={begin:[/precedencegroup/,/\s+/,S],className:{1:`keyword`,3:`title`},contains:[oe],keywords:[...p,...f],end:/}/},me={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},he={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},U={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,x,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:D,contains:[le,...O,{begin:/:/,end:/\{/,keywords:D,contains:[{scope:`title.class.inherited`,match:S},...O],relevance:0}]};for(let e of ne.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=D;let n=[...O,...k,...j,P,ne,...ie];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:D,contains:[...a,de,fe,me,he,U,H,pe,{beginKeywords:`import`,end:/$/,contains:[...a],relevance:0},re,...O,...k,...j,P,ne,...ie,...ae,oe,ce]}}t.exports=T})),bQ=n(((e,t)=>{function n(e){return{name:`Tagger Script`,contains:[{className:`comment`,begin:/\$noop\(/,end:/\)/,contains:[{begin:/\\[()]/},{begin:/\(/,end:/\)/,contains:[{begin:/\\[()]/},`self`]}],relevance:10},{className:`keyword`,begin:/\$[_a-zA-Z0-9]+(?=\()/},{className:`variable`,begin:/%[_a-zA-Z0-9:]+%/},{className:`symbol`,begin:/\\[\\nt$%,()]/},{className:`symbol`,begin:/\\u[a-fA-F0-9]{4}/}]}}t.exports=n})),xQ=n(((e,t)=>{function n(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}t.exports=n})),SQ=n(((e,t)=>{function n(e){return{name:`Test Anything Protocol`,case_insensitive:!0,contains:[e.HASH_COMMENT_MODE,{className:`meta`,variants:[{begin:`^TAP version (\\d+)$`},{begin:`^1\\.\\.(\\d+)$`}]},{begin:/---$/,end:`\\.\\.\\.$`,subLanguage:`yaml`,relevance:0},{className:`number`,begin:` (\\d+) `},{className:`symbol`,variants:[{begin:`^ok`},{begin:`^not ok`}]}]}}t.exports=n})),CQ=n(((e,t)=>{function n(e){let t=e.regex,n=/[a-zA-Z_][a-zA-Z0-9_]*/,r={className:`number`,variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]};return{name:`Tcl`,aliases:[`tk`],keywords:`after.append.apply.array.auto_execok.auto_import.auto_load.auto_mkindex.auto_mkindex_old.auto_qualify.auto_reset.bgerror.binary.break.catch.cd.chan.clock.close.concat.continue.dde.dict.encoding.eof.error.eval.exec.exit.expr.fblocked.fconfigure.fcopy.file.fileevent.filename.flush.for.foreach.format.gets.glob.global.history.http.if.incr.info.interp.join.lappend|10.lassign|10.lindex|10.linsert|10.list.llength|10.load.lrange|10.lrepeat|10.lreplace|10.lreverse|10.lsearch|10.lset|10.lsort|10.mathfunc.mathop.memory.msgcat.namespace.open.package.parray.pid.pkg::create.pkg_mkIndex.platform.platform::shell.proc.puts.pwd.read.refchan.regexp.registry.regsub|10.rename.return.safe.scan.seek.set.socket.source.split.string.subst.switch.tcl_endOfWord.tcl_findLibrary.tcl_startOfNextWord.tcl_startOfPreviousWord.tcl_wordBreakAfter.tcl_wordBreakBefore.tcltest.tclvars.tell.time.tm.trace.unknown.unload.unset.update.uplevel.upvar.variable.vwait.while`.split(`.`),contains:[e.COMMENT(`;[ \\t]*#`,`$`),e.COMMENT(`^[ \\t]*#`,`$`),{beginKeywords:`proc`,end:`[\\{]`,excludeEnd:!0,contains:[{className:`title`,begin:`[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*`,end:`[ \\t\\n\\r]`,endsWithParent:!0,excludeEnd:!0}]},{className:`variable`,variants:[{begin:t.concat(/\$/,t.optional(/::/),n,`(::`,n,`)*`)},{begin:`\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*`,end:`\\}`,contains:[r]}]},{className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},r]}}t.exports=n})),wQ=n(((e,t)=>{function n(e){let t=[`bool`,`byte`,`i16`,`i32`,`i64`,`double`,`string`,`binary`];return{name:`Thrift`,keywords:{keyword:[`namespace`,`const`,`typedef`,`struct`,`enum`,`service`,`exception`,`void`,`oneway`,`set`,`list`,`map`,`required`,`optional`],type:t,literal:`true false`},contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`class`,beginKeywords:`struct enum service exception`,end:/\{/,illegal:/\n/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{begin:`\\b(set|list|map)\\s*<`,keywords:{type:[...t,`set`,`list`,`map`]},end:`>`,contains:[`self`]}]}}t.exports=n})),TQ=n(((e,t)=>{function n(e){let t={className:`number`,begin:`[1-9][0-9]*`,relevance:0},n={className:`symbol`,begin:`:[^\\]]+`};return{name:`TP`,keywords:{keyword:`ABORT.ACC.ADJUST.AND.AP_LD.BREAK.CALL.CNT.COL.CONDITION.CONFIG.DA.DB.DIV.DETECT.ELSE.END.ENDFOR.ERR_NUM.ERROR_PROG.FINE.FOR.GP.GUARD.INC.IF.JMP.LINEAR_MAX_SPEED.LOCK.MOD.MONITOR.OFFSET.Offset.OR.OVERRIDE.PAUSE.PREG.PTH.RT_LD.RUN.SELECT.SKIP.Skip.TA.TB.TO.TOOL_OFFSET.Tool_Offset.UF.UT.UFRAME_NUM.UTOOL_NUM.UNLOCK.WAIT.X.Y.Z.W.P.R.STRLEN.SUBSTR.FINDSTR.VOFFSET.PROG.ATTR.MN.POS`.split(`.`),literal:[`ON`,`OFF`,`max_speed`,`LPOS`,`JPOS`,`ENABLE`,`DISABLE`,`START`,`STOP`,`RESET`]},contains:[{className:`built_in`,begin:`(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER|TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[`,end:`\\]`,contains:[`self`,t,n]},{className:`built_in`,begin:`(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[`,end:`\\]`,contains:[`self`,t,e.QUOTE_STRING_MODE,n]},{className:`keyword`,begin:`/(PROG|ATTR|MN|POS|END)\\b`},{className:`keyword`,begin:`(CALL|RUN|POINT_LOGIC|LBL)\\b`},{className:`keyword`,begin:`\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)`},{className:`number`,begin:`\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b`,relevance:0},e.COMMENT(`//`,`[;$]`),e.COMMENT(`!`,`[;$]`),e.COMMENT(`--eg:`,`$`),e.QUOTE_STRING_MODE,{className:`string`,begin:`'`,end:`'`},e.C_NUMBER_MODE,{className:`variable`,begin:`\\$[A-Za-z0-9_]+`}]}}t.exports=n})),EQ=n(((e,t)=>{function n(e){let t=e.regex,n=`absolute_url.asset|0.asset_version.attribute.block.constant.controller|0.country_timezones.csrf_token.cycle.date.dump.expression.form|0.form_end.form_errors.form_help.form_label.form_rest.form_row.form_start.form_widget.html_classes.include.is_granted.logout_path.logout_url.max.min.parent.path|0.random.range.relative_path.render.render_esi.source.template_from_string.url|0`.split(`.`),r=`abs.abbr_class.abbr_method.batch.capitalize.column.convert_encoding.country_name.currency_name.currency_symbol.data_uri.date.date_modify.default.escape.file_excerpt.file_link.file_relative.filter.first.format.format_args.format_args_as_text.format_currency.format_date.format_datetime.format_file.format_file_from_text.format_number.format_time.html_to_markdown.humanize.inky_to_html.inline_css.join.json_encode.keys.language_name.last.length.locale_name.lower.map.markdown.markdown_to_html.merge.nl2br.number_format.raw.reduce.replace.reverse.round.slice.slug.sort.spaceless.split.striptags.timezone_name.title.trans.transchoice.trim.u|0.upper.url_encode.yaml_dump.yaml_encode`.split(`.`),i=`apply.autoescape.block.cache.deprecated.do.embed.extends.filter.flush.for.form_theme.from.if.import.include.macro.sandbox.set.stopwatch.trans.trans_default_domain.transchoice.use.verbatim.with`.split(`.`);i=i.concat(i.map(e=>`end${e}`));let a={scope:`string`,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},o={scope:`number`,match:/\d+/},s={begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,contains:[a,o]},c={beginKeywords:n.join(` `),keywords:{name:n},relevance:0,contains:[s]},l={match:/\|(?=[A-Za-z_]+:?)/,beginScope:`punctuation`,relevance:0,contains:[{match:/[A-Za-z_]+:?/,keywords:r}]},u=(e,{relevance:n})=>({beginScope:{1:`template-tag`,3:`name`},relevance:n||2,endScope:`template-tag`,begin:[/\{%/,/\s*/,t.either(...e)],end:/%\}/,keywords:`in`,contains:[l,c,a,o]}),d=/[a-z_]+/,f=u(i,{relevance:2}),p=u([d],{relevance:1});return{name:`Twig`,aliases:[`craftcms`],case_insensitive:!0,subLanguage:`xml`,contains:[e.COMMENT(/\{#/,/#\}/),f,p,{className:`template-variable`,begin:/\{\{/,end:/\}\}/,contains:[`self`,l,c,a,o]}]}}t.exports=n})),DQ=n(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},d=n,f={begin:`<>`,end:`</>`},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);if(i=a.match(/^\s*=/)){t.ignoreMatch();return}if((i=a.match(/^\s+extends\s+/))&&i.index===0){t.ignoreMatch();return}}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:d+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},ee={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},te={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},L=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,ne={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(L)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},ne,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:L,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},ee,{match:`\\$`+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,te,{match:/\$[(.]/}]}}function d(e){let t=e.regex,a=u(e),o=n,s=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},f={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:s},contains:[a.exports.CLASS_REFERENCE]},p={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},m={$pattern:n,keyword:r.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:i,built_in:l.concat(s),"variable.language":c},h={className:`meta`,begin:`@`+o},g=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(a.keywords,m),a.exports.PARAMS_CONTAINS.push(h);let _=a.contains.find(e=>e.scope===`attr`),v=Object.assign({},_,{match:t.concat(o,t.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,_,v]),a.contains=a.contains.concat([h,d,f,v]),g(a,`shebang`,e.SHEBANG()),g(a,`use_strict`,p);let y=a.contains.find(e=>e.label===`func.def`);return y.relevance=0,Object.assign(a,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),a}t.exports=d})),OQ=n(((e,t)=>{function n(e){return{name:`Vala`,keywords:{keyword:`char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override virtual delegate if while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var`,built_in:`DBus GLib CCode Gee Object Gtk Posix`,literal:`false true null`},contains:[{className:`class`,beginKeywords:`class interface namespace`,end:/\{/,excludeEnd:!0,illegal:`[^,:\\n\\s\\.]`,contains:[e.UNDERSCORE_TITLE_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,begin:`"""`,end:`"""`,relevance:5},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_NUMBER_MODE,{className:`meta`,begin:`^#`,end:`$`}]}}t.exports=n})),kQ=n(((e,t)=>{function n(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}t.exports=n})),AQ=n(((e,t)=>{function n(e){let t=e.regex,n=`lcase.month.vartype.instrrev.ubound.setlocale.getobject.rgb.getref.string.weekdayname.rnd.dateadd.monthname.now.day.minute.isarray.cbool.round.formatcurrency.conversions.csng.timevalue.second.year.space.abs.clng.timeserial.fixs.len.asc.isempty.maths.dateserial.atn.timer.isobject.filter.weekday.datevalue.ccur.isdate.instr.datediff.formatdatetime.replace.isnull.right.sgn.array.snumeric.log.cdbl.hex.chr.lbound.msgbox.ucase.getlocale.cos.cdate.cbyte.rtrim.join.hour.oct.typename.trim.strcomp.int.createobject.loadpicture.tan.formatnumber.mid.split.cint.sin.datepart.ltrim.sqr.time.derived.eval.date.formatpercent.exp.inputbox.left.ascw.chrw.regexp.cstr.err`.split(`.`),r=[`server`,`response`,`request`,`scriptengine`,`scriptenginebuildversion`,`scriptengineminorversion`,`scriptenginemajorversion`],i={begin:t.concat(t.either(...n),`\\s*\\(`),relevance:0,keywords:{built_in:n}};return{name:`VBScript`,aliases:[`vbs`],case_insensitive:!0,keywords:{keyword:`call.class.const.dim.do.loop.erase.execute.executeglobal.exit.for.each.next.function.if.then.else.on.error.option.explicit.new.private.property.let.get.public.randomize.redim.rem.select.case.set.stop.sub.while.wend.with.end.to.elseif.is.or.xor.and.not.class_initialize.class_terminate.default.preserve.in.me.byval.byref.step.resume.goto`.split(`.`),built_in:r,literal:[`true`,`false`,`null`,`nothing`,`empty`]},illegal:`//`,contains:[i,e.inherit(e.QUOTE_STRING_MODE,{contains:[{begin:`""`}]}),e.COMMENT(/'/,/$/,{relevance:0}),e.C_NUMBER_MODE]}}t.exports=n})),jQ=n(((e,t)=>{function n(e){return{name:`VBScript in HTML`,subLanguage:`xml`,contains:[{begin:`<%`,end:`%>`,subLanguage:`vbscript`}]}}t.exports=n})),MQ=n(((e,t)=>{function n(e){let t=e.regex,n={$pattern:/\$?[\w]+(\$[\w]+)*/,keyword:`accept_on.alias.always.always_comb.always_ff.always_latch.and.assert.assign.assume.automatic.before.begin.bind.bins.binsof.bit.break.buf|0.bufif0.bufif1.byte.case.casex.casez.cell.chandle.checker.class.clocking.cmos.config.const.constraint.context.continue.cover.covergroup.coverpoint.cross.deassign.default.defparam.design.disable.dist.do.edge.else.end.endcase.endchecker.endclass.endclocking.endconfig.endfunction.endgenerate.endgroup.endinterface.endmodule.endpackage.endprimitive.endprogram.endproperty.endspecify.endsequence.endtable.endtask.enum.event.eventually.expect.export.extends.extern.final.first_match.for.force.foreach.forever.fork.forkjoin.function.generate|5.genvar.global.highz0.highz1.if.iff.ifnone.ignore_bins.illegal_bins.implements.implies.import.incdir.include.initial.inout.input.inside.instance.int.integer.interconnect.interface.intersect.join.join_any.join_none.large.let.liblist.library.local.localparam.logic.longint.macromodule.matches.medium.modport.module.nand.negedge.nettype.new.nexttime.nmos.nor.noshowcancelled.not.notif0.notif1.or.output.package.packed.parameter.pmos.posedge.primitive.priority.program.property.protected.pull0.pull1.pulldown.pullup.pulsestyle_ondetect.pulsestyle_onevent.pure.rand.randc.randcase.randsequence.rcmos.real.realtime.ref.reg.reject_on.release.repeat.restrict.return.rnmos.rpmos.rtran.rtranif0.rtranif1.s_always.s_eventually.s_nexttime.s_until.s_until_with.scalared.sequence.shortint.shortreal.showcancelled.signed.small.soft.solve.specify.specparam.static.string.strong.strong0.strong1.struct.super.supply0.supply1.sync_accept_on.sync_reject_on.table.tagged.task.this.throughout.time.timeprecision.timeunit.tran.tranif0.tranif1.tri.tri0.tri1.triand.trior.trireg.type.typedef.union.unique.unique0.unsigned.until.until_with.untyped.use.uwire.var.vectored.virtual.void.wait.wait_order.wand.weak.weak0.weak1.while.wildcard.wire.with.within.wor.xnor.xor`.split(`.`),literal:[`null`],built_in:`$finish.$stop.$exit.$fatal.$error.$warning.$info.$realtime.$time.$printtimescale.$bitstoreal.$bitstoshortreal.$itor.$signed.$cast.$bits.$stime.$timeformat.$realtobits.$shortrealtobits.$rtoi.$unsigned.$asserton.$assertkill.$assertpasson.$assertfailon.$assertnonvacuouson.$assertoff.$assertcontrol.$assertpassoff.$assertfailoff.$assertvacuousoff.$isunbounded.$sampled.$fell.$changed.$past_gclk.$fell_gclk.$changed_gclk.$rising_gclk.$steady_gclk.$coverage_control.$coverage_get.$coverage_save.$set_coverage_db_name.$rose.$stable.$past.$rose_gclk.$stable_gclk.$future_gclk.$falling_gclk.$changing_gclk.$display.$coverage_get_max.$coverage_merge.$get_coverage.$load_coverage_db.$typename.$unpacked_dimensions.$left.$low.$increment.$clog2.$ln.$log10.$exp.$sqrt.$pow.$floor.$ceil.$sin.$cos.$tan.$countbits.$onehot.$isunknown.$fatal.$warning.$dimensions.$right.$high.$size.$asin.$acos.$atan.$atan2.$hypot.$sinh.$cosh.$tanh.$asinh.$acosh.$atanh.$countones.$onehot0.$error.$info.$random.$dist_chi_square.$dist_erlang.$dist_exponential.$dist_normal.$dist_poisson.$dist_t.$dist_uniform.$q_initialize.$q_remove.$q_exam.$async$and$array.$async$nand$array.$async$or$array.$async$nor$array.$sync$and$array.$sync$nand$array.$sync$or$array.$sync$nor$array.$q_add.$q_full.$psprintf.$async$and$plane.$async$nand$plane.$async$or$plane.$async$nor$plane.$sync$and$plane.$sync$nand$plane.$sync$or$plane.$sync$nor$plane.$system.$display.$displayb.$displayh.$displayo.$strobe.$strobeb.$strobeh.$strobeo.$write.$readmemb.$readmemh.$writememh.$value$plusargs.$dumpvars.$dumpon.$dumplimit.$dumpports.$dumpportson.$dumpportslimit.$writeb.$writeh.$writeo.$monitor.$monitorb.$monitorh.$monitoro.$writememb.$dumpfile.$dumpoff.$dumpall.$dumpflush.$dumpportsoff.$dumpportsall.$dumpportsflush.$fclose.$fdisplay.$fdisplayb.$fdisplayh.$fdisplayo.$fstrobe.$fstrobeb.$fstrobeh.$fstrobeo.$swrite.$swriteb.$swriteh.$swriteo.$fscanf.$fread.$fseek.$fflush.$feof.$fopen.$fwrite.$fwriteb.$fwriteh.$fwriteo.$fmonitor.$fmonitorb.$fmonitorh.$fmonitoro.$sformat.$sformatf.$fgetc.$ungetc.$fgets.$sscanf.$rewind.$ftell.$ferror`.split(`.`)},r=[`__FILE__`,`__LINE__`],i=`begin_keywords.celldefine.default_nettype.default_decay_time.default_trireg_strength.define.delay_mode_distributed.delay_mode_path.delay_mode_unit.delay_mode_zero.else.elsif.end_keywords.endcelldefine.endif.ifdef.ifndef.include.line.nounconnected_drive.pragma.resetall.timescale.unconnected_drive.undef.undefineall`.split(`.`);return{name:`Verilog`,aliases:[`v`,`sv`,`svh`],case_insensitive:!1,keywords:n,contains:[e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.QUOTE_STRING_MODE,{scope:`number`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/\b((\d+'([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\B(('([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\b[0-9][0-9_]*/,relevance:0}]},{scope:`variable`,variants:[{begin:`#\\((?!parameter).+\\)`},{begin:`\\.\\w+`,relevance:0}]},{scope:`variable.constant`,match:t.concat(/`/,t.either(...r))},{scope:`meta`,begin:t.concat(/`/,t.either(...i)),end:/$|\/\/|\/\*/,returnEnd:!0,keywords:i}]}}t.exports=n})),NQ=n(((e,t)=>{function n(e){let t=`\\d(_|\\d)*`;return``+t,t+``,t+``,{name:`VHDL`,case_insensitive:!0,keywords:{keyword:`abs.access.after.alias.all.and.architecture.array.assert.assume.assume_guarantee.attribute.begin.block.body.buffer.bus.case.component.configuration.constant.context.cover.disconnect.downto.default.else.elsif.end.entity.exit.fairness.file.for.force.function.generate.generic.group.guarded.if.impure.in.inertial.inout.is.label.library.linkage.literal.loop.map.mod.nand.new.next.nor.not.null.of.on.open.or.others.out.package.parameter.port.postponed.procedure.process.property.protected.pure.range.record.register.reject.release.rem.report.restrict.restrict_guarantee.return.rol.ror.select.sequence.severity.shared.signal.sla.sll.sra.srl.strong.subtype.then.to.transport.type.unaffected.units.until.use.variable.view.vmode.vprop.vunit.wait.when.while.with.xnor.xor`.split(`.`),built_in:`boolean.bit.character.integer.time.delay_length.natural.positive.string.bit_vector.file_open_kind.file_open_status.std_logic.std_logic_vector.unsigned.signed.boolean_vector.integer_vector.std_ulogic.std_ulogic_vector.unresolved_unsigned.u_unsigned.unresolved_signed.u_signed.real_vector.time_vector`.split(`.`),literal:[`false`,`true`,`note`,`warning`,`error`,`failure`,`line`,`text`,`side`,`width`]},illegal:/\{/,contains:[e.C_BLOCK_COMMENT_MODE,e.COMMENT(`--`,`$`),e.QUOTE_STRING_MODE,{className:`number`,begin:`\\b(\\d(_|\\d)*#\\w+(\\.\\w+)?#([eE][-+]?\\d(_|\\d)*)?|\\d(_|\\d)*(\\.\\d(_|\\d)*)?([eE][-+]?\\d(_|\\d)*)?)`,relevance:0},{className:`string`,begin:`'(U|X|0|1|Z|W|L|H|-)'`,contains:[e.BACKSLASH_ESCAPE]},{className:`symbol`,begin:`'[A-Za-z](_?[A-Za-z0-9])*`,contains:[e.BACKSLASH_ESCAPE]}]}}t.exports=n})),PQ=n(((e,t)=>{function n(e){return{name:`Vim Script`,keywords:{$pattern:/[!#@\w]+/,keyword:`N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank`,built_in:`synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv complete_check add getwinposx getqflist getwinposy screencol clearmatches empty extend getcmdpos mzeval garbagecollect setreg ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable shiftwidth max sinh isdirectory synID system inputrestore winline atan visualmode inputlist tabpagewinnr round getregtype mapcheck hasmapto histdel argidx findfile sha256 exists toupper getcmdline taglist string getmatches bufnr strftime winwidth bufexists strtrans tabpagebuflist setcmdpos remote_read printf setloclist getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval resolve libcallnr foldclosedend reverse filter has_key bufname str2float strlen setline getcharmod setbufvar index searchpos shellescape undofile foldclosed setqflist buflisted strchars str2nr virtcol floor remove undotree remote_expr winheight gettabwinvar reltime cursor tabpagenr finddir localtime acos getloclist search tanh matchend rename gettabvar strdisplaywidth type abs py3eval setwinvar tolower wildmenumode log10 spellsuggest bufloaded synconcealed nextnonblank server2client complete settabwinvar executable input wincol setmatches getftype hlID inputsave searchpair or screenrow line settabvar histadd deepcopy strpart remote_peek and eval getftime submatch screenchar winsaveview matchadd mkdir screenattr getfontname libcall reltimestr getfsize winnr invert pow getbufline byte2line soundfold repeat fnameescape tagfiles sin strwidth spellbadword trunc maparg log lispindent hostname setpos globpath remote_foreground getchar synIDattr fnamemodify cscope_connection stridx winbufnr indent min complete_add nr2char searchpairpos inputdialog values matchlist items hlexists strridx browsedir expand fmod pathshorten line2byte argc count getwinvar glob foldtextresult getreg foreground cosh matchdelete has char2nr simplify histget searchdecl iconv winrestcmd pumvisible writefile foldlevel haslocaldir keys cos matchstr foldtext histnr tan tempname getcwd byteidx getbufvar islocked escape eventhandler remote_send serverlist winrestview synstack pyeval prevnonblank readfile cindent filereadable changenr exp`},illegal:/;/,contains:[e.NUMBER_MODE,{className:`string`,begin:`'`,end:`'`,illegal:`\\n`},{className:`string`,begin:/"(\\"|\n\\|[^"\n])*"/},e.COMMENT(`"`,`$`),{className:`variable`,begin:/[bwtglsav]:[\w\d_]+/},{begin:[/\b(?:function|function!)/,/\s+/,e.IDENT_RE],className:{1:`keyword`,3:`title`},end:`$`,relevance:0,contains:[{className:`params`,begin:`\\(`,end:`\\)`}]},{className:`symbol`,begin:/<[\w-]+>/}]}}t.exports=n})),FQ=n(((e,t)=>{function n(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}t.exports=n})),IQ=n(((e,t)=>{function n(e){let t=e.regex,n=/[a-zA-Z]\w*/,r=[`as`,`break`,`class`,`construct`,`continue`,`else`,`for`,`foreign`,`if`,`import`,`in`,`is`,`return`,`static`,`var`,`while`],i=[`true`,`false`,`null`],a=[`this`,`super`],o=[`Bool`,`Class`,`Fiber`,`Fn`,`List`,`Map`,`Null`,`Num`,`Object`,`Range`,`Sequence`,`String`,`System`],s=[`-`,`~`,/\*/,`%`,/\.\.\./,/\.\./,/\+/,`<<`,`>>`,`>=`,`<=`,`<`,`>`,/\^/,/!=/,/!/,/\bis\b/,`==`,`&&`,`&`,/\|\|/,/\|/,/\?:/,`=`],c={relevance:0,match:t.concat(/\b(?!(if|while|for|else|super)\b)/,n,/(?=\s*[({])/),className:`title.function`},l={match:t.concat(t.either(t.concat(/\b(?!(if|while|for|else|super)\b)/,n),t.either(...s)),/(?=\s*\([^)]+\)\s*\{)/),className:`title.function`,starts:{contains:[{begin:/\(/,end:/\)/,contains:[{relevance:0,scope:`params`,match:n}]}]}},u={variants:[{match:[/class\s+/,n,/\s+is\s+/,n]},{match:[/class\s+/,n]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:r},d={relevance:0,match:t.either(...s),className:`operator`},f={className:`string`,begin:/"""/,end:/"""/},p={className:`property`,begin:t.concat(/\./,t.lookahead(n)),end:n,excludeBegin:!0,relevance:0},m={relevance:0,match:t.concat(/\b_/,n),scope:`variable`},h={relevance:0,match:/\b[A-Z]+[a-z]+([A-Z]+[a-z]+)*/,scope:`title.class`,keywords:{_:o}},g=e.C_NUMBER_MODE,_={match:[n,/\s*/,/=/,/\s*/,/\(/,n,/\)\s*\{/],scope:{1:`title.function`,3:`operator`,6:`params`}},v=e.COMMENT(/\/\*\*/,/\*\//,{contains:[{match:/@[a-z]+/,scope:`doctag`},`self`]}),y={scope:`subst`,begin:/%\(/,end:/\)/,contains:[g,h,c,m,d]},b={scope:`string`,begin:/"/,end:/"/,contains:[y,{scope:`char.escape`,variants:[{match:/\\\\|\\["0%abefnrtv]/},{match:/\\x[0-9A-F]{2}/},{match:/\\u[0-9A-F]{4}/},{match:/\\U[0-9A-F]{8}/}]}]};y.contains.push(b);let x=[...r,...a,...i],S={relevance:0,match:t.concat(`\\b(?!`,x.join(`|`),`\\b)`,/[a-zA-Z_]\w*(?:[?!]|\b)/),className:`variable`};return{name:`Wren`,keywords:{keyword:r,"variable.language":a,literal:i},contains:[{scope:`comment`,variants:[{begin:[/#!?/,/[A-Za-z_]+(?=\()/],beginScope:{},keywords:{literal:i},contains:[],end:/\)/},{begin:[/#!?/,/[A-Za-z_]+/],beginScope:{},end:/$/}]},g,b,f,v,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,u,_,l,c,d,m,p,S]}}t.exports=n})),LQ=n(((e,t)=>{function n(e){return{name:`Intel x86 Assembly`,case_insensitive:!0,keywords:{$pattern:`[.%]?`+e.IDENT_RE,keyword:`lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63`,built_in:`ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr`,meta:`%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__`},contains:[e.COMMENT(`;`,`$`,{relevance:0}),{className:`number`,variants:[{begin:`\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b`,relevance:0},{begin:`\\$[0-9][0-9A-Fa-f]*`,relevance:0},{begin:`\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b`},{begin:`\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b`}]},e.QUOTE_STRING_MODE,{className:`string`,variants:[{begin:`'`,end:`[^\\\\]'`},{begin:"`",end:"[^\\\\]`"}],relevance:0},{className:`symbol`,variants:[{begin:`^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)`},{begin:`^\\s*%%[A-Za-z0-9_$#@~.?]*:`}],relevance:0},{className:`subst`,begin:`%[0-9]+`,relevance:0},{className:`subst`,begin:`%!S+`,relevance:0},{className:`meta`,begin:/^\s*\.[\w_-]+/}]}}t.exports=n})),RQ=n(((e,t)=>{function n(e){let t={$pattern:/[a-zA-Z][a-zA-Z0-9_?]*/,keyword:`if.then.else.do.while.until.for.loop.import.with.is.as.where.when.by.data.constant.integer.real.text.name.boolean.symbol.infix.prefix.postfix.block.tree`.split(`.`),literal:[`true`,`false`,`nil`],built_in:`in.mod.rem.and.or.xor.not.abs.sign.floor.ceil.sqrt.sin.cos.tan.asin.acos.atan.exp.expm1.log.log2.log10.log1p.pi.at.text_length.text_range.text_find.text_replace.contains.page.slide.basic_slide.title_slide.title.subtitle.fade_in.fade_out.fade_at.clear_color.color.line_color.line_width.texture_wrap.texture_transform.texture.scale_?x.scale_?y.scale_?z?.translate_?x.translate_?y.translate_?z?.rotate_?x.rotate_?y.rotate_?z?.rectangle.circle.ellipse.sphere.path.line_to.move_to.quad_to.curve_to.theme.background.contents.locally.time.mouse_?x.mouse_?y.mouse_buttons`.split(`.`).concat([`ObjectLoader`,`Animate`,`MovieCredits`,`Slides`,`Filters`,`Shading`,`Materials`,`LensFlare`,`Mapping`,`VLCAudioVideo`,`StereoDecoder`,`PointCloud`,`NetworkAccess`,`RemoteControl`,`RegExp`,`ChromaKey`,`Snowfall`,`NodeJS`,`Speech`,`Charts`])},n={className:`string`,begin:`"`,end:`"`,illegal:`\\n`},r={className:`string`,begin:`'`,end:`'`,illegal:`\\n`},i={className:`string`,begin:`<<`,end:`>>`},a={className:`number`,begin:`[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?`},o={beginKeywords:`import`,end:`$`,keywords:t,contains:[n]},s={className:`function`,begin:/[a-z][^\n]*->/,returnBegin:!0,end:/->/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,keywords:t}})]};return{name:`XL`,aliases:[`tao`],keywords:t,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n,r,i,s,o,a,e.NUMBER_MODE]}}t.exports=n})),zQ=n(((e,t)=>{function n(e){return{name:`XQuery`,aliases:[`xpath`,`xq`,`xqm`],case_insensitive:!1,illegal:/(proc)|(abstract)|(extends)|(until)|(#)/,keywords:{$pattern:/[a-zA-Z$][a-zA-Z0-9_:-]*/,keyword:`module.schema.namespace.boundary-space.preserve.no-preserve.strip.default.collation.base-uri.ordering.context.decimal-format.decimal-separator.copy-namespaces.empty-sequence.except.exponent-separator.external.grouping-separator.inherit.no-inherit.lax.minus-sign.per-mille.percent.schema-attribute.schema-element.strict.unordered.zero-digit.declare.import.option.function.validate.variable.for.at.in.let.where.order.group.by.return.if.then.else.tumbling.sliding.window.start.when.only.end.previous.next.stable.ascending.descending.allowing.empty.greatest.least.some.every.satisfies.switch.case.typeswitch.try.catch.and.or.to.union.intersect.instance.of.treat.as.castable.cast.map.array.delete.insert.into.replace.value.rename.copy.modify.update`.split(`.`),type:`item.document-node.node.attribute.document.element.comment.namespace.namespace-node.processing-instruction.text.construction.xs:anyAtomicType.xs:untypedAtomic.xs:duration.xs:time.xs:decimal.xs:float.xs:double.xs:gYearMonth.xs:gYear.xs:gMonthDay.xs:gMonth.xs:gDay.xs:boolean.xs:base64Binary.xs:hexBinary.xs:anyURI.xs:QName.xs:NOTATION.xs:dateTime.xs:dateTimeStamp.xs:date.xs:string.xs:normalizedString.xs:token.xs:language.xs:NMTOKEN.xs:Name.xs:NCName.xs:ID.xs:IDREF.xs:ENTITY.xs:integer.xs:nonPositiveInteger.xs:negativeInteger.xs:long.xs:int.xs:short.xs:byte.xs:nonNegativeInteger.xs:unisignedLong.xs:unsignedInt.xs:unsignedShort.xs:unsignedByte.xs:positiveInteger.xs:yearMonthDuration.xs:dayTimeDuration`.split(`.`),literal:[`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`is`,`self::`,`child::`,`descendant::`,`descendant-or-self::`,`attribute::`,`following::`,`following-sibling::`,`parent::`,`ancestor::`,`ancestor-or-self::`,`preceding::`,`preceding-sibling::`,`NaN`]},contains:[{className:`variable`,begin:/[$][\w\-:]+/},{className:`built_in`,variants:[{begin:/\barray:/,end:/(?:append|filter|flatten|fold-(?:left|right)|for-each(?:-pair)?|get|head|insert-before|join|put|remove|reverse|size|sort|subarray|tail)\b/},{begin:/\bmap:/,end:/(?:contains|entry|find|for-each|get|keys|merge|put|remove|size)\b/},{begin:/\bmath:/,end:/(?:a(?:cos|sin|tan[2]?)|cos|exp(?:10)?|log(?:10)?|pi|pow|sin|sqrt|tan)\b/},{begin:/\bop:/,end:/\(/,excludeEnd:!0},{begin:/\bfn:/,end:/\(/,excludeEnd:!0},{begin:/[^</$:'"-]\b(?:abs|accumulator-(?:after|before)|adjust-(?:date(?:Time)?|time)-to-timezone|analyze-string|apply|available-(?:environment-variables|system-properties)|avg|base-uri|boolean|ceiling|codepoints?-(?:equal|to-string)|collation-key|collection|compare|concat|contains(?:-token)?|copy-of|count|current(?:-)?(?:date(?:Time)?|time|group(?:ing-key)?|output-uri|merge-(?:group|key))?data|dateTime|days?-from-(?:date(?:Time)?|duration)|deep-equal|default-(?:collation|language)|distinct-values|document(?:-uri)?|doc(?:-available)?|element-(?:available|with-id)|empty|encode-for-uri|ends-with|environment-variable|error|escape-html-uri|exactly-one|exists|false|filter|floor|fold-(?:left|right)|for-each(?:-pair)?|format-(?:date(?:Time)?|time|integer|number)|function-(?:arity|available|lookup|name)|generate-id|has-children|head|hours-from-(?:dateTime|duration|time)|id(?:ref)?|implicit-timezone|in-scope-prefixes|index-of|innermost|insert-before|iri-to-uri|json-(?:doc|to-xml)|key|lang|last|load-xquery-module|local-name(?:-from-QName)?|(?:lower|upper)-case|matches|max|minutes-from-(?:dateTime|duration|time)|min|months?-from-(?:date(?:Time)?|duration)|name(?:space-uri-?(?:for-prefix|from-QName)?)?|nilled|node-name|normalize-(?:space|unicode)|not|number|one-or-more|outermost|parse-(?:ietf-date|json)|path|position|(?:prefix-from-)?QName|random-number-generator|regex-group|remove|replace|resolve-(?:QName|uri)|reverse|root|round(?:-half-to-even)?|seconds-from-(?:dateTime|duration|time)|snapshot|sort|starts-with|static-base-uri|stream-available|string-?(?:join|length|to-codepoints)?|subsequence|substring-?(?:after|before)?|sum|system-property|tail|timezone-from-(?:date(?:Time)?|time)|tokenize|trace|trans(?:form|late)|true|type-available|unordered|unparsed-(?:entity|text)?-?(?:public-id|uri|available|lines)?|uri-collection|xml-to-json|years?-from-(?:date(?:Time)?|duration)|zero-or-one)\b/},{begin:/\blocal:/,end:/\(/,excludeEnd:!0},{begin:/\bzip:/,end:/(?:zip-file|(?:xml|html|text|binary)-entry| (?:update-)?entries)\b/},{begin:/\b(?:util|db|functx|app|xdmp|xmldb):/,end:/\(/,excludeEnd:!0}]},{className:`string`,variants:[{begin:/"/,end:/"/,contains:[{begin:/""/,relevance:0}]},{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]}]},{className:`number`,begin:/(\b0[0-7_]+)|(\b0x[0-9a-fA-F_]+)|(\b[1-9][0-9_]*(\.[0-9_]+)?)|[0_]\b/,relevance:0},{className:`comment`,begin:/\(:/,end:/:\)/,relevance:10,contains:[{className:`doctag`,begin:/@\w+/}]},{className:`meta`,begin:/%[\w\-:]+/},{className:`title`,begin:/\bxquery version "[13]\.[01]"\s?(?:encoding ".+")?/,end:/;/},{beginKeywords:`element attribute comment document processing-instruction`,end:/\{/,excludeEnd:!0},{begin:/<([\w._:-]+)(\s+\S*=('|").*('|"))?>/,end:/(\/[\w._:-]+>)/,subLanguage:`xml`,contains:[{begin:/\{/,end:/\}/,subLanguage:`xquery`},`self`]}]}}t.exports=n})),BQ=n(((e,t)=>{function n(e){let t={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},n=e.UNDERSCORE_TITLE_MODE,r={variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]},i=`namespace class interface use extends function return abstract final public protected private static deprecated throw try catch Exception echo empty isset instanceof unset let var new const self require if else elseif switch case default do while loop for continue break likely unlikely __LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ array boolean float double integer object resource string char long unsigned bool int uint ulong uchar true false null undefined`;return{name:`Zephir`,aliases:[`zep`],keywords:i,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(/\/\*/,/\*\//,{contains:[{className:`doctag`,begin:/@[A-Za-z]+/}]}),{className:`string`,begin:/<<<['"]?\w+['"]?$/,end:/^\w+;/,contains:[e.BACKSLASH_ESCAPE]},{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:`function`,beginKeywords:`function fn`,end:/[;{]/,excludeEnd:!0,illegal:/\$|\[|%/,contains:[n,{className:`params`,begin:/\(/,end:/\)/,keywords:i,contains:[`self`,e.C_BLOCK_COMMENT_MODE,t,r]}]},{className:`class`,beginKeywords:`class interface`,end:/\{/,excludeEnd:!0,illegal:/[:($"]/,contains:[{beginKeywords:`extends implements`},n]},{beginKeywords:`namespace`,end:/;/,illegal:/[.']/,contains:[n]},{beginKeywords:`use`,end:/;/,contains:[n]},{begin:/=>/},t,r]}}t.exports=n})),VQ=e(n(((e,t)=>{var n=uY();n.registerLanguage(`1c`,dY()),n.registerLanguage(`abnf`,fY()),n.registerLanguage(`accesslog`,pY()),n.registerLanguage(`actionscript`,mY()),n.registerLanguage(`ada`,hY()),n.registerLanguage(`angelscript`,gY()),n.registerLanguage(`apache`,_Y()),n.registerLanguage(`applescript`,vY()),n.registerLanguage(`arcade`,yY()),n.registerLanguage(`arduino`,bY()),n.registerLanguage(`armasm`,xY()),n.registerLanguage(`xml`,SY()),n.registerLanguage(`asciidoc`,CY()),n.registerLanguage(`aspectj`,wY()),n.registerLanguage(`autohotkey`,TY()),n.registerLanguage(`autoit`,EY()),n.registerLanguage(`avrasm`,DY()),n.registerLanguage(`awk`,OY()),n.registerLanguage(`axapta`,kY()),n.registerLanguage(`bash`,AY()),n.registerLanguage(`basic`,jY()),n.registerLanguage(`bnf`,MY()),n.registerLanguage(`brainfuck`,NY()),n.registerLanguage(`c`,PY()),n.registerLanguage(`cal`,FY()),n.registerLanguage(`capnproto`,IY()),n.registerLanguage(`ceylon`,LY()),n.registerLanguage(`clean`,RY()),n.registerLanguage(`clojure`,zY()),n.registerLanguage(`clojure-repl`,BY()),n.registerLanguage(`cmake`,VY()),n.registerLanguage(`coffeescript`,HY()),n.registerLanguage(`coq`,UY()),n.registerLanguage(`cos`,WY()),n.registerLanguage(`cpp`,GY()),n.registerLanguage(`crmsh`,KY()),n.registerLanguage(`crystal`,qY()),n.registerLanguage(`csharp`,JY()),n.registerLanguage(`csp`,YY()),n.registerLanguage(`css`,XY()),n.registerLanguage(`d`,ZY()),n.registerLanguage(`markdown`,QY()),n.registerLanguage(`dart`,$Y()),n.registerLanguage(`delphi`,eX()),n.registerLanguage(`diff`,tX()),n.registerLanguage(`django`,nX()),n.registerLanguage(`dns`,rX()),n.registerLanguage(`dockerfile`,iX()),n.registerLanguage(`dos`,aX()),n.registerLanguage(`dsconfig`,oX()),n.registerLanguage(`dts`,sX()),n.registerLanguage(`dust`,cX()),n.registerLanguage(`ebnf`,lX()),n.registerLanguage(`elixir`,uX()),n.registerLanguage(`elm`,dX()),n.registerLanguage(`ruby`,fX()),n.registerLanguage(`erb`,pX()),n.registerLanguage(`erlang-repl`,mX()),n.registerLanguage(`erlang`,hX()),n.registerLanguage(`excel`,gX()),n.registerLanguage(`fix`,_X()),n.registerLanguage(`flix`,vX()),n.registerLanguage(`fortran`,yX()),n.registerLanguage(`fsharp`,bX()),n.registerLanguage(`gams`,xX()),n.registerLanguage(`gauss`,SX()),n.registerLanguage(`gcode`,CX()),n.registerLanguage(`gherkin`,wX()),n.registerLanguage(`glsl`,TX()),n.registerLanguage(`gml`,EX()),n.registerLanguage(`go`,DX()),n.registerLanguage(`golo`,OX()),n.registerLanguage(`gradle`,kX()),n.registerLanguage(`graphql`,AX()),n.registerLanguage(`groovy`,jX()),n.registerLanguage(`haml`,MX()),n.registerLanguage(`handlebars`,NX()),n.registerLanguage(`haskell`,PX()),n.registerLanguage(`haxe`,FX()),n.registerLanguage(`hsp`,IX()),n.registerLanguage(`http`,LX()),n.registerLanguage(`hy`,RX()),n.registerLanguage(`inform7`,zX()),n.registerLanguage(`ini`,BX()),n.registerLanguage(`irpf90`,VX()),n.registerLanguage(`isbl`,HX()),n.registerLanguage(`java`,UX()),n.registerLanguage(`javascript`,WX()),n.registerLanguage(`jboss-cli`,GX()),n.registerLanguage(`json`,KX()),n.registerLanguage(`julia`,qX()),n.registerLanguage(`julia-repl`,JX()),n.registerLanguage(`kotlin`,YX()),n.registerLanguage(`lasso`,XX()),n.registerLanguage(`latex`,ZX()),n.registerLanguage(`ldif`,QX()),n.registerLanguage(`leaf`,$X()),n.registerLanguage(`less`,eZ()),n.registerLanguage(`lisp`,tZ()),n.registerLanguage(`livecodeserver`,nZ()),n.registerLanguage(`livescript`,rZ()),n.registerLanguage(`llvm`,iZ()),n.registerLanguage(`lsl`,aZ()),n.registerLanguage(`lua`,oZ()),n.registerLanguage(`makefile`,sZ()),n.registerLanguage(`mathematica`,cZ()),n.registerLanguage(`matlab`,lZ()),n.registerLanguage(`maxima`,uZ()),n.registerLanguage(`mel`,dZ()),n.registerLanguage(`mercury`,fZ()),n.registerLanguage(`mipsasm`,pZ()),n.registerLanguage(`mizar`,mZ()),n.registerLanguage(`perl`,hZ()),n.registerLanguage(`mojolicious`,gZ()),n.registerLanguage(`monkey`,_Z()),n.registerLanguage(`moonscript`,vZ()),n.registerLanguage(`n1ql`,yZ()),n.registerLanguage(`nestedtext`,bZ()),n.registerLanguage(`nginx`,xZ()),n.registerLanguage(`nim`,SZ()),n.registerLanguage(`nix`,CZ()),n.registerLanguage(`node-repl`,wZ()),n.registerLanguage(`nsis`,TZ()),n.registerLanguage(`objectivec`,EZ()),n.registerLanguage(`ocaml`,DZ()),n.registerLanguage(`openscad`,OZ()),n.registerLanguage(`oxygene`,kZ()),n.registerLanguage(`parser3`,AZ()),n.registerLanguage(`pf`,jZ()),n.registerLanguage(`pgsql`,MZ()),n.registerLanguage(`php`,NZ()),n.registerLanguage(`php-template`,PZ()),n.registerLanguage(`plaintext`,FZ()),n.registerLanguage(`pony`,IZ()),n.registerLanguage(`powershell`,LZ()),n.registerLanguage(`processing`,RZ()),n.registerLanguage(`profile`,zZ()),n.registerLanguage(`prolog`,BZ()),n.registerLanguage(`properties`,VZ()),n.registerLanguage(`protobuf`,HZ()),n.registerLanguage(`puppet`,UZ()),n.registerLanguage(`purebasic`,WZ()),n.registerLanguage(`python`,GZ()),n.registerLanguage(`python-repl`,KZ()),n.registerLanguage(`q`,qZ()),n.registerLanguage(`qml`,JZ()),n.registerLanguage(`r`,YZ()),n.registerLanguage(`reasonml`,XZ()),n.registerLanguage(`rib`,ZZ()),n.registerLanguage(`roboconf`,QZ()),n.registerLanguage(`routeros`,$Z()),n.registerLanguage(`rsl`,eQ()),n.registerLanguage(`ruleslanguage`,tQ()),n.registerLanguage(`rust`,nQ()),n.registerLanguage(`sas`,rQ()),n.registerLanguage(`scala`,iQ()),n.registerLanguage(`scheme`,aQ()),n.registerLanguage(`scilab`,oQ()),n.registerLanguage(`scss`,sQ()),n.registerLanguage(`shell`,cQ()),n.registerLanguage(`smali`,lQ()),n.registerLanguage(`smalltalk`,uQ()),n.registerLanguage(`sml`,dQ()),n.registerLanguage(`sqf`,fQ()),n.registerLanguage(`sql`,pQ()),n.registerLanguage(`stan`,mQ()),n.registerLanguage(`stata`,hQ()),n.registerLanguage(`step21`,gQ()),n.registerLanguage(`stylus`,_Q()),n.registerLanguage(`subunit`,vQ()),n.registerLanguage(`swift`,yQ()),n.registerLanguage(`taggerscript`,bQ()),n.registerLanguage(`yaml`,xQ()),n.registerLanguage(`tap`,SQ()),n.registerLanguage(`tcl`,CQ()),n.registerLanguage(`thrift`,wQ()),n.registerLanguage(`tp`,TQ()),n.registerLanguage(`twig`,EQ()),n.registerLanguage(`typescript`,DQ()),n.registerLanguage(`vala`,OQ()),n.registerLanguage(`vbnet`,kQ()),n.registerLanguage(`vbscript`,AQ()),n.registerLanguage(`vbscript-html`,jQ()),n.registerLanguage(`verilog`,MQ()),n.registerLanguage(`vhdl`,NQ()),n.registerLanguage(`vim`,PQ()),n.registerLanguage(`wasm`,FQ()),n.registerLanguage(`wren`,IQ()),n.registerLanguage(`x86asm`,LQ()),n.registerLanguage(`xl`,RQ()),n.registerLanguage(`xquery`,zQ()),n.registerLanguage(`zephir`,BQ()),n.HighlightJS=n,n.default=n,t.exports=n}))()).default;$J.use(eY({emptyLangClass:`hljs`,langPrefix:`hljs language-`,highlight(e,t){let n=(t??``).trim()||`plaintext`,r=VQ.getLanguage(n)?n:`plaintext`;return VQ.highlight(e,{language:r}).value}}));var HQ={gfm:!0,breaks:!1};function UQ(e,t){return $J.parse(e,{...HQ,...t})}var WQ=!1;function GQ(){WQ||typeof window>`u`||(WQ=!0,Sq.addHook(`afterSanitizeAttributes`,e=>{if(e.tagName!==`A`||!e.hasAttribute(`href`))return;let t=e.getAttribute(`href`)??``;try{let n=new URL(t,window.location.href);if(n.protocol!==`http:`&&n.protocol!==`https:`||n.origin===window.location.origin)return;e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)}catch{}}))}GQ();var KQ=`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,qQ=`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`;function JQ(e){return e.querySelector(`code`)?.textContent??e.textContent??``}function YQ(e){let t=e.querySelector(`code`);if(!t?.className)return`plaintext`;for(let e of t.className.split(/\s+/))if(e.startsWith(`language-`))return e.slice(9).trim()||`plaintext`;return`plaintext`}function XQ(e,t){let n=document.createDocumentFragment(),r=document.createElement(`span`);r.className=`markdown-code-copy-inner`,r.innerHTML=e===`idle`?KQ:qQ;let i=document.createElement(`span`);return i.className=`markdown-code-copy-label`,i.textContent=e===`idle`?t.copy:t.copied,n.appendChild(r),n.appendChild(i),n}function ZQ(e){e.querySelectorAll(`[data-md-code-block]`).forEach(e=>{let t=e.querySelector(`:scope > pre`),n=e.parentNode;t&&n&&(n.insertBefore(t,e),e.remove())})}function QQ(e,t){let n=e.querySelectorAll(`.markdown-body pre`),r=[];for(let e of n){if(e.closest(`[data-md-code-block]`))continue;let n=e.parentNode;if(!n)continue;let i=document.createElement(`div`);i.className=`markdown-code-block`,i.setAttribute(`data-md-code-block`,``);let a=document.createElement(`div`);a.className=`markdown-code-block-header`;let o=document.createElement(`span`);o.className=`markdown-code-block-lang`,o.textContent=YQ(e);let s=document.createElement(`button`);s.type=`button`,s.className=`markdown-code-copy-btn`,s.dataset.mdCodeCopy=``,s.title=t.copy,s.setAttribute(`aria-label`,t.copy),s.replaceChildren(XQ(`idle`,t));let c=n=>{n.preventDefault(),n.stopPropagation(),Cq(JQ(e)).then(e=>{!e||!s.isConnected||(s.replaceChildren(XQ(`copied`,t)),s.title=t.copied,s.setAttribute(`aria-label`,t.copied),window.setTimeout(()=>{s.isConnected&&(s.replaceChildren(XQ(`idle`,t)),s.title=t.copy,s.setAttribute(`aria-label`,t.copy))},2e3))})};s.addEventListener(`click`,c),a.appendChild(o),a.appendChild(s),i.appendChild(a),n.insertBefore(i,e),i.appendChild(e),r.push(()=>{s.removeEventListener(`click`,c);let t=e.parentElement;t?.matches(`[data-md-code-block]`)&&t.parentNode&&(t.parentNode.insertBefore(e,t),t.remove())})}return()=>{for(let e of r)e()}}function $Q({content:e,compact:t=!1,breaks:n=!1,className:r,codeCopy:i=!0}){let a=oN(e=>e.language),o=(0,L.useMemo)(()=>{let e=GM(a).chat;return{copy:e.codeBlockCopy,copied:e.messageCopied}},[a]),s=(0,L.useMemo)(()=>{if(!e.trim())return``;let t=UQ(e,n?{breaks:!0}:void 0);return Sq.sanitize(t,{USE_PROFILES:{html:!0}})},[e,n]),c=(0,L.useRef)(null);return(0,L.useLayoutEffect)(()=>{let e=c.current;if(e&&(ZQ(e),!(!i||!s)))return QQ(e,o)},[i,s,o]),(0,J.jsx)(`div`,{ref:c,children:(0,J.jsx)(`div`,{className:[`markdown-body`,t?`markdown-compact`:``,r??``].filter(Boolean).join(` `),dangerouslySetInnerHTML:{__html:s}})})}var e$=(0,L.memo)($Q);e$.displayName=`MarkdownView`;function t$({initialContent:e,onSave:t,isDark:n=!1}){let[r,i]=(0,L.useState)(e);(0,L.useEffect)(()=>{i(e)},[e]);let a=XG(e=>{t?.(e)},500);return(0,J.jsxs)(`div`,{className:`flex h-full divide-x divide-edge`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,J.jsx)(uK,{initialContent:e,onChange:(0,L.useCallback)(e=>{i(e),a(e)},[a]),isDark:n})}),(0,J.jsx)(`div`,{className:`bg-surface min-w-0 flex-1 overflow-y-auto px-6 py-4`,children:(0,J.jsx)(e$,{content:r})})]})}var Z={transition:`transition-colors duration-150 ease-out`,press:`transition-transform duration-150 ease-out active:scale-95`,focusRingPanel:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,focusRingBase:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,disabled:`disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none`},n$=`rounded-lg p-2 text-fg-muted transition-colors transition-transform duration-150 ease-out hover:bg-surface-hover hover:text-fg active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`;function r$({message:e,downloadLabel:t,onDownload:n,openSystemLabel:r,onOpenWithSystemApp:i,canOpenWithSystemApp:a=!0}){let o=ZG()&&a&&typeof i==`function`&&typeof r==`string`&&r.length>0;return(0,J.jsxs)(`div`,{className:q(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),children:[(0,J.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:e}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[o?(0,J.jsxs)(`button`,{type:`button`,className:q(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,Z.transition,Z.press,Z.focusRingPanel),onClick:()=>void i?.(),children:[(0,J.jsx)(vg,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),r]}):null,(0,J.jsxs)(`button`,{type:`button`,className:q(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,Z.transition,Z.press,Z.focusRingPanel),onClick:n,children:[(0,J.jsx)(hg,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t]})]})]})}function i$(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}function a$({text:e,slideLabel:t,emptySlideLabel:n}){let r=(0,L.useMemo)(()=>i$(e),[e]);if(!r.ok)return(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:r.raw});let i=[];r.notes.length>0&&i.push((0,J.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:r.notes.map((e,t)=>(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},t))},`notes`));for(let e of r.slides)i.push((0,J.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,J.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:t(e.slideNumber)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:e.text.length>0?e.text:n})]},e.slideNumber));return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,children:i})}function o$(e,t){return`\`\`\`${{".ts":`typescript`,".js":`javascript`,".json":`json`}[t]??`plaintext`}\n${e}\n\`\`\``}function s$({layout:e,text:t,showTruncationBar:n,onDownload:r,downloadLabel:i,truncationMessage:a,truncatedCaption:o,slideLabel:s,emptySlideLabel:c,openSystemLabel:l,onOpenWithSystemApp:u,canOpenWithSystemApp:d}){return(0,J.jsxs)(`div`,{className:e===`workspace`?`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[n?(0,J.jsx)(r$,{message:a,downloadLabel:i,onDownload:r,openSystemLabel:l,onOpenWithSystemApp:u,canOpenWithSystemApp:d}):null,(0,J.jsxs)(`div`,{className:e===`workspace`?`min-h-0 flex-1 overflow-auto px-2 py-2`:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle p-4 dark:border-edge`,children:[n?(0,J.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:o}):null,(0,J.jsx)(a$,{text:t,slideLabel:s,emptySlideLabel:c})]})]})}function c$(e){let{context:t,language:n,resolvedTheme:r,fileKey:i,fileName:a,loading:o,loadError:s,previewKind:c,textContent:l,binaryBuffer:u,showExtractedText:d,extractedText:f,extractedTextTruncated:p,workspaceEditing:m,pptxText:h,pptxTruncated:g,pptxError:_,actions:v}=e,y=GM(n),b=(0,L.useMemo)(()=>QG(a),[a]),x=b===`.md`,S=b===`.html`||b===`.htm`,C=(0,L.useRef)(null),{error:w,excelTruncated:T}=YG({language:n,buffer:u,kind:c===`pdf`||c===`excel`||c===`docx`?c:null,fileKey:i,containerEl:C.current}),E=!!v.onOpenWithSystemApp&&(v.canOpenWithSystemApp??!0)&&t===`workspace`,D=t===`workspace`?y.workspace.openElsewhereHint:y.chat.attachmentPreviewOpenElsewhereHint,O=y.chat.attachmentPreviewDownloadFull,A=t===`workspace`?y.workspace.openSystemApp:void 0,j=e=>y.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),M=(0,J.jsx)(r$,{message:D,downloadLabel:O,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E}),P=null;if(o)P=(0,J.jsx)(`p`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.chat.loading});else if(s)P=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+s})]});else if(t===`attachment`&&d&&c!==`image`){let e=f||y.chat.attachmentPreviewNoText,t=c===`pptx`&&e.length>3e5?e.slice(0,ee):e,n=!!p||c===`pptx`&&e.length>3e5;P=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[n&&c===`pptx`?(0,J.jsx)(r$,{message:y.chat.attachmentPreviewOpenElsewhereTruncated,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload}):null,(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:[n&&c===`pptx`?(0,J.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:y.chat.attachmentPreviewPptxTruncated}):null,(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:t})]})]})}else if(c===`binaryOnly`&&u)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:(0,J.jsx)(r$,{message:t===`workspace`?y.workspace.cannotPreviewType+` `+y.workspace.openElsewhereHint:y.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E})});else if(u&&c===`image`)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,children:(0,J.jsx)(`img`,{src:`data:${k(a)??`image/png`};base64,${N(u)}`,alt:``,className:t===`workspace`?`max-h-[min(100%,calc(100dvh-9rem))] w-auto max-w-full object-contain`:`max-h-full max-w-full object-contain`})});else if(u&&c===`pptx`)if(t===`attachment`){let e=f||y.chat.attachmentPreviewNoText,t=ee,n=!!p||e.length>t;P=(0,J.jsx)(s$,{layout:`attachment`,text:e.length>t?e.slice(0,t):e,showTruncationBar:n,onDownload:v.onDownload,downloadLabel:O,truncationMessage:y.chat.attachmentPreviewOpenElsewhereTruncated,truncatedCaption:y.chat.attachmentPreviewPptxTruncated,slideLabel:j,emptySlideLabel:y.chat.attachmentPreviewPptxEmptySlide})}else P=_?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+_})]}):h==null?(0,J.jsx)(`p`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.chat.loading}):(0,J.jsx)(s$,{layout:`workspace`,text:h,showTruncationBar:!!g,onDownload:v.onDownload,downloadLabel:O,truncationMessage:y.chat.attachmentPreviewOpenElsewhereTruncated,truncatedCaption:y.chat.attachmentPreviewPptxTruncated,slideLabel:j,emptySlideLabel:y.chat.attachmentPreviewPptxEmptySlide,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E});else if(u&&(c===`pdf`||c===`docx`))P=w?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+w})]}):(0,J.jsx)(`div`,{ref:C,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`});else if(u&&c===`excel`)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:w?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 px-2`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:w})]}):(0,J.jsxs)(J.Fragment,{children:[T?(0,J.jsx)(r$,{message:y.chat.attachmentPreviewOpenElsewhereTruncated,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E}):null,(0,J.jsx)(`div`,{ref:C,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`})]})});else if(l!==null&&c===`text`)if(t===`workspace`&&x&&m?.markdownEditMode)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(t$,{initialContent:l,onSave:e=>void m?.onSaveMarkdown?.(e),isDark:(m?.isDark??r===`dark`)===!0},i)});else if(x)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:l})});else if(t===`workspace`&&S&&m?.htmlCodeMode)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(lK,{initialContent:l,onChange:e=>m?.onHtmlChange?.(e),isDark:(m?.isDark??r===`dark`)===!0},i)});else if(S)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,J.jsx)(`iframe`,{title:a,className:`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white dark:border-edge dark:bg-[#1e1e1e]`,srcDoc:l,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`})});else if(b===`.ts`||b===`.js`)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:o$(l,b)})});else if(b===`.json`){let e=l;try{e=JSON.stringify(JSON.parse(l),null,2)}catch{}P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:o$(e,`.json`)})})}else P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:l})});return(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:P})}function l$(e,t,n,r){let i=n?t.replace(/\{\{(\w+)\}\}/g,(e,t)=>String(n[t]??``)):t;window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:e,title:i,duration:r?.duration??4e3}}))}function u$(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.isDirectory,children:e.isDirectory?[]:void 0}))}function d$(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:d$(e.children,t,n)}:e)}function f$(e,t){let[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(new Set),l=e.trim(),u=t?.trim()??``,d=u,f=u?``:l,p=(0,L.useMemo)(()=>{if(d)return{sessionKey:d};if(f)return{agentId:f}},[d,f]);return{tree:n,loading:i,error:o,loadRoot:(0,L.useCallback)(async()=>{a(!0),s(null),c.current.clear();try{r(u$(await BG(``,p))),c.current.add(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[p]),loadChildren:(0,L.useCallback)(async e=>{if(!c.current.has(e)){c.current.add(e);try{let t=u$(await BG(e,p));r(n=>d$(n,e,t))}catch{c.current.delete(e)}}},[p]),reset:(0,L.useCallback)(()=>{r([]),s(null),c.current.clear()},[])}}var p$=aN(e=>({agentId:``,setAgentId:t=>e({agentId:t})})),m$=`xopc-web-workspace-panel-open`,h$=`xopc-web-workspace-panel-width-px`;function g$(){try{return globalThis.localStorage?.getItem(m$)===`1`}catch{return!1}}function _$(e){try{globalThis.localStorage?.setItem(m$,e?`1`:`0`)}catch{}}function v$(e){return Math.min(520,Math.max(200,Math.round(e)))}function y$(){try{let e=globalThis.localStorage?.getItem(h$);if(e==null)return 320;let t=Number.parseInt(e,10);return Number.isFinite(t)?v$(t):320}catch{return 320}}function b$(e){try{globalThis.localStorage?.setItem(h$,String(e))}catch{}}var x$=aN((e,t)=>({open:g$(),setOpen:t=>{e({open:t}),queueMicrotask(()=>_$(t))},toggleOpen:()=>{t().setOpen(!t().open)},widthPx:y$(),setWidthPx:t=>{let n=v$(t);e({widthPx:n}),queueMicrotask(()=>b$(n))}})),S$=aN(e=>({path:null,setPath:t=>e({path:t})})),C$=(0,L.memo)(function(){let e=GM(oN(e=>e.language)),{pathname:t}=Ii(),{sessionKey:n}=Vi(),r=t.startsWith(`/chat`)&&n?decodeURIComponent(n):null,i=x$(e=>e.open),a=x$(e=>e.setOpen),o=x$(e=>e.widthPx),s=x$(e=>e.setWidthPx),[c,l]=(0,L.useState)(!1),u=S$(e=>e.path),d=S$(e=>e.setPath),f=p$(e=>e.agentId),{tree:p,loading:m,error:h,loadRoot:g,loadChildren:_,reset:v}=f$(f,r),y=r??f,b=r==null?f.trim()?{agentId:f.trim()}:void 0:{sessionKey:r},x=(0,L.useCallback)(e=>{if(!i)return;e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),l(!0);let n=e.clientX,r=x$.getState().widthPx,a=e.pointerId,o=e=>{s(r+(n-e.clientX))},c=()=>{try{t.releasePointerCapture(a)}catch{}l(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[i,s]);(0,L.useEffect)(()=>{t.startsWith(`/chat`)||a(!1)},[t,a]),(0,L.useEffect)(()=>{if(!i){v(),d(null);return}d(null),g()},[i,y,g,v,d]),(0,L.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&(S$.getState().path||a(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,a]),(0,L.useEffect)(()=>{if(!i||!window.matchMedia(`(max-width: 767px)`).matches)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[i]);let S=(0,L.useCallback)(e=>{_(e)},[_]),C=(0,L.useCallback)(async(t,n)=>{if(!n.isDirectory)switch(t){case`preview`:d(n.path);break;case`download`:try{let e=$G(n.path);if(aK(n.path)){let{contentBase64:t}=await HG(n.path,b);qG(e,F(t),k(e)??`application/octet-stream`)}else{let{content:t}=await VG(n.path,b);KG(e,t)}}catch{}break;case`copyPath`:try{await navigator.clipboard.writeText(n.absolutePath??n.path),l$(`success`,e.workspace.pathCopied,void 0,{duration:2500})}catch{}break;default:break}},[e.workspace.pathCopied,d,b]);return(0,J.jsxs)(J.Fragment,{children:[i?(0,J.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-scrim md:hidden`,"aria-label":e.closeMenu,onClick:()=>a(!1)}):null,(0,J.jsx)(`aside`,{id:`app-workspace-panel`,"aria-label":e.workspace.title,"aria-hidden":!i,className:q(`flex min-h-0 flex-col overflow-hidden bg-surface-base`,`max-md:fixed max-md:right-0 max-md:top-0 max-md:z-50 max-md:h-[100dvh] max-md:shadow-popover`,`max-md:transition-transform max-md:duration-200 max-md:ease-out`,`motion-reduce:max-md:transition-none`,`max-md:w-[min(20rem,92vw)]`,i?`max-md:translate-x-0`:`max-md:pointer-events-none max-md:translate-x-full`,`md:relative md:h-full md:translate-x-0`,`motion-reduce:md:transition-none`,!i&&`md:pointer-events-none md:w-0 md:min-w-0 md:max-w-0 md:overflow-hidden`,i&&`app-workspace-panel-expanded-width md:shrink-0`,i&&c&&`workspace-panel-rail-resizing`),style:i?{"--workspace-panel-px":`${o}px`}:void 0,children:i?(0,J.jsxs)(`div`,{className:q(`relative flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden overflow-y-hidden bg-surface-base`),children:[(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":e.workspace.resizeHandleAria,onPointerDown:x,className:q(`pointer-events-auto absolute left-0 top-0 z-20 hidden h-full w-2 cursor-col-resize md:block`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:z-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:bg-surface-hover/20 hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,c&&`bg-surface-hover/30 before:!bg-edge/80 dark:before:!bg-edge/85`,`transition-[background-color] duration-150`,`touch-none select-none`,VN)}),(0,J.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4 dark:border-edge`,children:[(0,J.jsx)(Og,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-tight tracking-tight text-fg`,children:e.workspace.title}),(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:e.cron.refresh,"aria-label":e.cron.refresh,disabled:m,onClick:()=>void g(),children:(0,J.jsx)(Xx,{className:q(`size-4`,m&&`animate-spin`),"aria-hidden":!0})}),(0,J.jsx)(UM,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 rounded-md p-0`,"aria-label":e.workspace.close,title:e.workspace.close,onClick:()=>a(!1),children:(0,J.jsx)(DA,{className:`size-4`,strokeWidth:1.75})})]}),h?(0,J.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[e.workspace.loadError,`: `,h]}):null,(0,J.jsx)(RG,{tree:p,selectedPath:u,onSelectFile:e=>d(e),onExpandDir:S,onAction:C,actionLabels:{preview:e.workspace.preview,download:e.workspace.download,copyPath:e.workspace.copyPath},emptyHint:e.workspace.emptyDir})]}):null})]})});function w$(){let e=LN(e=>e.tokenDialogOpen),t=LN(e=>e.baseUrl),n=LN(e=>e.tokenExpired),r=LN(e=>e.setGatewayToken),i=LN(e=>e.closeTokenDialog),a=LN(e=>e.token),o=oN(e=>e.language),s=GM(o).token,c=!!a&&!n;return(0,J.jsx)(QB,{open:e,onOpenChange:e=>{!e&&!c||e||i()},children:(0,J.jsxs)($B,{children:[(0,J.jsx)(eV,{className:`fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(tV,{className:q(`fixed left-1/2 top-1/2 z-50 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsx)(nV,{className:`text-base font-semibold text-fg`,children:s.title}),(0,J.jsx)(rV,{className:`mt-1 text-sm text-fg-muted`,children:s.description}),(0,J.jsx)(sN,{className:`mt-4`,baseUrl:t,onSubmit:r,footerLeft:c?(0,J.jsx)(UM,{type:`button`,variant:`ghost`,onClick:()=>i(),children:o===`zh`?`取消`:`Cancel`}):void 0})]})]})})}function T$(){let e=GM(oN(e=>e.language)).electron,[t,n]=(0,L.useState)(null);return(0,L.useEffect)(()=>{if(!ZG())return;let e=window.electronAPI?.gateway;if(e?.onExited)return e.onExited(e=>n(e))},[]),t?(0,J.jsxs)(`div`,{className:q(`shrink-0 border-b border-danger/35 bg-danger/10 px-4 py-3 text-sm text-fg shadow-surface`),role:`alert`,children:[(0,J.jsx)(`p`,{className:`font-semibold`,children:e.gatewayExitTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:e.gatewayExitBody}),(0,J.jsxs)(`p`,{className:`mt-2 font-mono text-xs text-fg-muted`,children:[`exit `,t.code??`—`,` · signal `,t.signal??`—`]})]}):null}function E$(){let e=zi();return(0,L.useEffect)(()=>{if(!ZG())return;let t=window.electronAPI;if(!t?.menu)return;let n=t.menu.onNavigate(t=>{e(t)}),r=t.menu.onTogglePalette(()=>{window.dispatchEvent(new CustomEvent(`toggle-command-palette`))});return()=>{n(),r()}},[e]),null}function D$({reminder:e,compact:t}){let n=oN(e=>e.language),r=GM(n).updatePanel,{show:i,dismiss:a,electronQuitAndInstall:o,runNpmUpdate:s,npmUpdateRunning:c}=e,[l,u]=(0,L.useState)(!1),d=(0,L.useCallback)(async()=>{let e=GM(n).updatePanel;u(!0);try{let t=await sP(Y(`/api/gateway/restart`),{method:`POST`}),n=await t.json().catch(()=>({}));if(t.ok&&n.ok!==!1){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`success`,title:e.restartGateway,message:``}}));return}window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:e.updateErrorFailed,message:typeof n.message==`string`?n.message:`HTTP ${t.status}`}}))}catch(t){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:e.updateErrorFailed,message:t instanceof Error?t.message:String(t)}}))}finally{u(!1)}},[n]),f=(0,L.useCallback)(async()=>{let e=GM(n).updatePanel,t=await s();if(t.ok){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`success`,title:e.updateSuccess,message:e.updateSuccessDetail}}));return}let r=t.error===`git-checkout`?e.updateErrorGit:t.error===`busy`?e.updateErrorBusy:e.updateErrorFailed;window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:r,message:t.message}}))},[s,n]);if(i.kind===`none`)return null;let p=`absolute right-2 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1 sm:right-3`;return i.kind===`electron-ready`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-accent/20 bg-accent/10 px-10 py-2 text-sm sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-[min(100%,48rem)] items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(hg,{className:`h-4 w-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0`,children:r.reminderElectronReady.replace(`{{version}}`,i.version)})]}),(0,J.jsxs)(`div`,{className:p,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:o,className:`rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90`,children:[(0,J.jsx)(Xx,{className:`mr-1 inline h-3 w-3`}),r.restartToUpdate]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:`rounded p-1 text-fg-muted hover:text-fg`,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]})]}):i.kind===`electron-error`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-red-500/20 bg-red-500/10 px-10 py-2 text-sm text-fg sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-[min(100%,52rem)] items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(xp,{className:`h-4 w-4 shrink-0 text-red-500 dark:text-red-400`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:r.reminderElectronUpdateError.replace(`{{detail}}`,i.message)})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`electron-downloading`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 flex-col items-center justify-center gap-2 border-b border-edge bg-surface-secondary px-10 py-2 text-sm text-fg-muted sm:flex-row sm:gap-4 sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-full items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(hg,{className:`h-4 w-4 shrink-0 animate-pulse`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:r.reminderDownloading.replace(`{{percent}}`,String(i.percent))})]}),(0,J.jsx)(`div`,{className:`h-1.5 w-full max-w-xs rounded-full bg-surface-tertiary sm:max-w-[12rem]`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${i.percent}%`}})}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:q(p,`sm:right-2`),"aria-label":r.dismissAria,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`npm-restart-required`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-amber-500/25 bg-amber-500/10 py-2 text-sm`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[min(100%,52rem)] flex-wrap items-center justify-center gap-x-2 gap-y-1 px-10 pr-14 text-center sm:px-12 sm:pr-16`,children:[(0,J.jsx)(`span`,{children:r.restartRequired.replace(`{{version}}`,i.version)}),(0,J.jsxs)(`button`,{type:`button`,onClick:d,disabled:l,className:`inline-flex shrink-0 items-center gap-1 rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-60`,children:[l?(0,J.jsx)(Kg,{className:`h-3 w-3 shrink-0 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(Xx,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),r.restartGateway]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`npm`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-accent/20 bg-accent/10 py-2 text-sm`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:q(`mx-auto flex max-w-[min(100%,52rem)] flex-wrap items-center justify-center gap-x-2 gap-y-1 px-10 pr-14 text-center sm:px-12 sm:pr-16`),children:[(0,J.jsxs)(`span`,{children:[r.reminderNpm.replace(`{{version}}`,i.version),i.channel&&i.channel!==`latest`?` (${i.channel})`:``]}),(0,J.jsxs)(`button`,{type:`button`,onClick:f,disabled:c,className:`inline-flex shrink-0 items-center gap-1 rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-60`,children:[c?(0,J.jsx)(Kg,{className:`h-3 w-3 shrink-0 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(Xx,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),c?r.updateRunning:r.updateNow]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):null}function O$(e,t,n){let r=e===`zh`;return[{kind:`action`,id:`action:cron:create`,title:r?`创建定时任务`:`Create scheduled task`,subtitle:r?`新建 Cron 任务`:`Open scheduled tasks (create)`,groupLabel:`Actions`,keywords:[`cron`,`schedule`,`job`,`timer`],run:()=>{n(),t(`/cron?action=create`)}},{kind:`action`,id:`action:cron:manage`,title:r?`管理定时任务`:`Manage scheduled tasks`,subtitle:r?`查看和编辑 Cron`:`View and edit cron jobs`,groupLabel:`Actions`,keywords:[`cron`,`schedule`,`tasks`],run:()=>{n(),t(`/cron`)}},{kind:`action`,id:`action:skills:manage`,title:r?`管理技能`:`Manage skills`,subtitle:r?`启用或禁用技能`:`View, enable, or disable skills`,groupLabel:`Actions`,keywords:[`skills`,`skill`,`catalog`],run:()=>{n(),t(`/skills`)}},{kind:`action`,id:`action:skills:reload`,title:r?`重新加载技能`:`Reload skills`,subtitle:r?`从磁盘重新加载`:`Reload all skills from disk`,groupLabel:`Actions`,keywords:[`skills`,`reload`,`refresh`],run:()=>{n(),f(async()=>{let{reloadSkills:e}=await Promise.resolve().then(()=>L$);return{reloadSkills:e}},void 0).then(({reloadSkills:e})=>e())}}]}function k$(e){return e.trim().toLowerCase()}function A$(e,t){let n=k$(e),r=k$(t);if(!r)return 0;if(!n)return null;if(n===r)return 0;if(n.startsWith(r))return 1;let i=n.indexOf(r);return i>=0?2+Math.min(i,50)/100:null}function j$(e,t){let n=t.trim();if(!n)return 0;let r=[{text:e.title,weight:1},{text:e.subtitle??``,weight:1.75}];for(let t of e.keywords??[])r.push({text:t,weight:1.25});let i=null;for(let e of r){let t=A$(e.text,n);if(t===null)continue;let r=t*e.weight;i=i===null?r:Math.min(i,r)}if(i===null)return null;let a=e.kind===`route`?-.15:e.kind===`file`?-.1:e.kind===`session`?-.05:e.kind===`setting`||e.kind===`action`?-.02:0;return Math.max(0,i+a)}function M$(e){return[...e].sort((e,t)=>e.rank===t.rank?e.groupLabel===t.groupLabel?e.title.localeCompare(t.title):e.groupLabel.localeCompare(t.groupLabel):e.rank-t.rank)}function N$(e){let t=GM(e);return[{id:`route:chat`,title:t.nav.chat,subtitle:e===`zh`?`打开聊天`:`Open chat`,path:`/chat`,keywords:[`chat`,`new`,`compose`,`assistant`]},{id:`route:agents`,title:t.nav.agents,subtitle:e===`zh`?`管理智能体`:`Manage agents`,path:`/agents`,keywords:[`agent`,`persona`,`switch`]},{id:`route:apps`,title:t.nav.apps,subtitle:e===`zh`?`扩展应用`:`Extension apps`,path:`/apps`,keywords:[`extension`,`plugin`,`addon`]},{id:`route:sessions`,title:t.nav.sessions,subtitle:e===`zh`?`管理与搜索会话`:`Manage and search sessions`,path:`/settings/sessions`,keywords:[`history`,`archive`,`pin`]},{id:`route:logs`,title:t.nav.logs,subtitle:e===`zh`?`查看日志`:`View logs`,path:`/settings/logs`,keywords:[`debug`,`errors`]},{id:`route:skills`,title:t.nav.skills,subtitle:e===`zh`?`管理技能`:`Manage skills`,path:`/skills`,keywords:[`tools`,`catalog`]},{id:`route:channels`,title:t.nav.channels,subtitle:e===`zh`?`消息通道设置`:`Channel settings`,path:`/channels`,keywords:[`telegram`,`weixin`]},{id:`route:cron`,title:t.nav.cron,subtitle:e===`zh`?`定时任务与调度`:`Cron jobs and schedules`,path:`/cron`,keywords:[`schedule`,`jobs`]},{id:`route:settings`,title:t.nav.settings,subtitle:e===`zh`?`打开设置`:`Open settings`,path:`/settings/appearance`,keywords:[`config`,`appearance`,`providers`,`models`,`agents`,`search`,`preferences`]},{id:`route:settings:providers`,title:t.nav.settingsProviders,subtitle:e===`zh`?`AI 服务商配置`:`AI provider configuration`,path:`/settings/providers`,keywords:[`api`,`key`,`openai`,`anthropic`,`google`]},{id:`route:settings:models`,title:t.nav.settingsModels,subtitle:e===`zh`?`模型配置`:`Model configuration`,path:`/settings/models`,keywords:[`gpt`,`claude`,`gemini`,`llm`]},{id:`route:settings:voice`,title:t.nav.settingsVoice,subtitle:e===`zh`?`语音设置`:`Voice settings`,path:`/settings/voice`,keywords:[`tts`,`stt`,`speech`,`microphone`]},{id:`route:settings:gateway`,title:t.nav.settingsGateway,subtitle:e===`zh`?`网关设置`:`Gateway settings`,path:`/settings/gateway`,keywords:[`server`,`port`,`auth`,`token`]}]}function P$(e){TN.getState().setPreference(e)}function F$(e){oN.getState().setLanguage(e)}function I$(e,t){let n=e===`zh`;return[{kind:`setting`,id:`setting:model`,title:n?`切换模型`:`Switch model`,subtitle:n?`更改默认 AI 模型`:`Change the default AI model`,groupLabel:`Quick Settings`,keywords:[`model`,`gpt`,`claude`,`gemini`,`llm`],run:()=>t.openModelPalette()},{kind:`setting`,id:`setting:agent`,title:n?`切换智能体`:`Switch agent`,subtitle:n?`更改新对话使用的智能体`:`Change the agent for new chats`,groupLabel:`Quick Settings`,keywords:[`agent`,`persona`,`bot`],run:()=>t.openAgentPalette()},{kind:`setting`,id:`setting:theme:light`,title:n?`切换到浅色主题`:`Switch to light theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`light`,`appearance`],run:()=>{P$(`light`),t.closePalette()}},{kind:`setting`,id:`setting:theme:dark`,title:n?`切换到深色主题`:`Switch to dark theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`dark`,`night`],run:()=>{P$(`dark`),t.closePalette()}},{kind:`setting`,id:`setting:theme:system`,title:n?`使用系统主题`:`Use system theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`system`,`auto`],run:()=>{P$(`system`),t.closePalette()}},{kind:`setting`,id:`setting:lang:en`,title:`Switch to English`,subtitle:n?`语言`:`Language`,groupLabel:`Quick Settings`,keywords:[`english`,`language`,`locale`],run:()=>{F$(`en`),t.closePalette()}},{kind:`setting`,id:`setting:lang:zh`,title:`切换到中文`,subtitle:n?`语言`:`Language`,groupLabel:`Quick Settings`,keywords:[`chinese`,`中文`,`language`],run:()=>{F$(`zh`),t.closePalette()}}]}var L$=t({deleteSkill:()=>H$,getMarketplaceCategories:()=>W$,getMarketplacePackageDetail:()=>K$,getMarketplaceProvider:()=>Y$,getMarketplaceSkills:()=>G$,getSkillMarkdown:()=>J$,getSkills:()=>z$,installMarketplaceSkill:()=>q$,patchSkillEnabled:()=>U$,reloadSkills:()=>B$,uploadSkillZip:()=>V$});async function R$(e){let t=await e.json().catch(()=>({}));if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;if(typeof e==`string`)return e}return`HTTP ${e.status}`}async function z$(e){let t=await sP(Y(`/api/skills${e&&e!==`en`?`?lang=${encodeURIComponent(e)}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload)throw Error(`Invalid response`);return n.payload}async function B$(){let e=await sP(Y(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await R$(e))}async function V$(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`);let r=LN.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(Y(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&LN.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function H$(e){let t=await sP(Y(`/api/skills/${encodeURIComponent(e)}`),{method:`DELETE`});if(!t.ok)throw Error(await R$(t))}async function U$(e,t){let n=await sP(Y(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await R$(n))}async function W$(){let e=await sP(Y(`/api/skills/marketplace/categories`),{cache:`no-store`});if(!e.ok)throw Error(await R$(e));let t=await e.json();if(!t.payload||!Array.isArray(t.payload.items))throw Error(`Invalid response`);return{items:t.payload.items}}async function G$(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim());let n=t.toString(),r=await sP(Y(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await R$(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function K$(e){let t=await sP(Y(`/api/skills/marketplace/packages/${encodeURIComponent(e)}`),{cache:`no-store`});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload?.name)throw Error(`Invalid response`);return n.payload}async function q$(e){let t=await sP(Y(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function J$(e,t){let n=t?`?lang=${encodeURIComponent(t)}`:``,r=await sP(Y(`/api/skills/${encodeURIComponent(e)}/content${n}`),{cache:`no-store`});if(!r.ok)throw Error(await R$(r));let i=(await r.json()).payload;if(!i||typeof i.name!=`string`||typeof i.description!=`string`||typeof i.bodyMarkdown!=`string`||typeof i.disableModelInvocation!=`boolean`||!i.metadata||typeof i.metadata!=`object`||typeof i.metadata.name!=`string`||typeof i.metadata.description!=`string`)throw Error(`Invalid response`);return i}async function Y$(){let e=await sP(Y(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await R$(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function X$(e){let t=await e.json().catch(()=>({}));if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;if(typeof e==`string`)return e}return`HTTP ${e.status}`}async function Z$(){let e=await sP(Y(`/api/commands`));if(!e.ok)throw Error(await X$(e));return(await e.json()).payload?.commands??[]}var Q$=6e4,$$=null,e1=0,t1=null,n1=new Map,r1=new Map,i1=null,a1;async function o1(e=!1){return!e&&$$&&Date.now()<e1?$$:t1||(t1=Z$().then(e=>($$=e,e1=Date.now()+Q$,e)).finally(()=>{t1=null}),t1)}async function s1(e,t=!1){let n=e??`en`,r=Date.now();return!t&&n1.has(n)&&r<(r1.get(n)??0)?n1.get(n):i1&&a1===n?i1:(a1=n,i1=z$(e).then(e=>(n1.set(n,e),r1.set(n,Date.now()+Q$),e)).finally(()=>{i1=null,a1=void 0}),i1)}var c1=`fill-chat-composer`;function l1(e){window.dispatchEvent(new CustomEvent(c1,{detail:{text:e}}))}function u1(e){return e.acceptsArgs?`/${e.name} `:`/${e.name}`}var d1=3e4,f1=null;function p1(e){return e.trim()}function m1(e){return e.map(e=>({name:e.name,relativePath:e.path,isDirectory:e.isDirectory}))}async function h1(e,t){let n=t.sessionKey?.trim(),r=t.agentId?.trim(),i=t.limit??15,a=e.trim(),o=new URLSearchParams;if(o.set(`q`,a),o.set(`limit`,String(i)),n?o.set(`sessionKey`,n):r&&o.set(`agentId`,r),n&&a.length===0){let e=p1(n),t=Date.now();if(f1&&f1.key===e&&t-f1.at<d1)return f1.items}let s=m1((await cP(Y(`/api/workspace/editor/files/search?${o.toString()}`))).payload.entries??[]);return n&&a.length===0&&(f1={key:p1(n),at:Date.now(),items:s}),s}async function g1(e,t){return BG(e,{sessionKey:t.sessionKey,agentId:t.agentId})}function _1(e){return{...e,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{},skills:e.skills??{defaults:[]},tools:e.tools??{defaultsDisable:[],entryDisable:[],effectiveDisable:[]}}}async function v1(){let e=(await cP(Y(`/api/agents`))).payload;if(!e?.defaultId||!Array.isArray(e.agents))throw Error(`Invalid /api/agents response`);let t=Array.isArray(e.builtinToolIds)?e.builtinToolIds:[];return{defaultId:e.defaultId,agents:e.agents.map(_1),builtinToolIds:t}}async function y1(e){let t=await cP(Y(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=typeof t.payload?.agentId==`string`?t.payload.agentId.trim():``,r=t.payload?.agents;if(!n||!r?.defaultId||!Array.isArray(r.agents))throw Error(`Invalid create agent response`);return{createdAgentId:n,defaultId:r.defaultId,agents:r.agents.map(_1),builtinToolIds:Array.isArray(r.builtinToolIds)?r.builtinToolIds:[]}}async function b1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).payload;if(!n?.defaultId||!Array.isArray(n.agents))throw Error(`Invalid update agent response`);return{defaultId:n.defaultId,agents:n.agents.map(_1),builtinToolIds:Array.isArray(n.builtinToolIds)?n.builtinToolIds:[]}}async function x1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}${t?`?purge=true`:``}`),{method:`DELETE`})).payload?.agents;if(!n?.defaultId||!Array.isArray(n.agents))throw Error(`Invalid delete agent response`);return{defaultId:n.defaultId,agents:n.agents.map(_1),builtinToolIds:Array.isArray(n.builtinToolIds)?n.builtinToolIds:[]}}function S1(e){if(!e||typeof e!=`object`||!(`bindings`in e))return[];let t=e.bindings;return Array.isArray(t)?t:[]}async function C1(e){await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({bindings:e})}),WV()}async function w1(){let e=(await cP(Y(`/api/skills`))).payload?.catalog;return Array.isArray(e)?e:[]}async function T1(e){let t=(await cP(Y(`/api/agents/${encodeURIComponent(e)}/files`))).payload;if(!t?.files||!t.bootstrapDir)throw Error(`Invalid files list response`);return t}async function E1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`))).payload?.content;if(typeof n!=`string`)throw Error(`Invalid file content response`);return n}async function D1(e,t,n){await cP(Y(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})})}function O1(e){let t=e.type.toLowerCase();return t===`image/png`||t===`image/jpeg`||t===`image/jpg`||t===`image/webp`?t===`image/jpg`?`image/jpeg`:t:null}function k1(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=String(r.result??``),n=e.indexOf(`,`);t(n>=0?e.slice(n+1):``)},r.onerror=()=>n(r.error??Error(`read failed`)),r.readAsDataURL(e)})}async function A1(e,t){let n=O1(t);if(!n)throw Error(`unsupported_image_type`);if(t.size===0||t.size>512*1024)throw Error(`avatar_too_large`);let r=await k1(t);if(!r)throw Error(`empty_file`);await cP(Y(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({base64:r,mimeType:n})})}async function j1(e){await cP(Y(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`DELETE`})}var M1=`main`;function N1(e,t){return e.name?.trim()||(e.id.trim().toLowerCase()===M1?t.defaultMainAgentName:e.id)}function P1(e,t){return e.description?.trim()||(e.id.trim().toLowerCase()===M1?t.defaultMainAgentDescription:``)}function F1(){let{pathname:e}=Ii(),{sessionKey:t}=Vi();if(!e.startsWith(`/chat`)||!t)return;let n=decodeURIComponent(t);return n&&n!==`new`?n:void 0}function I1(e){switch(e){case`Navigate`:return 0;case`Quick Settings`:return 1;case`Extensions`:return 2;case`Sessions`:return 3;case`Files`:return 4;case`Commands`:return 5;case`Skills`:return 6;case`Actions`:return 7;default:return 10}}function L1(e){switch(e.kind){case`extension`:return(0,J.jsx)(fx,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`route`:return(0,J.jsx)(Og,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`session`:return(0,J.jsx)(Og,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`file`:return(0,J.jsx)(Eg,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`command`:return(0,J.jsx)(pD,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`skill`:return(0,J.jsx)(Nw,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0});case`setting`:return(0,J.jsx)(xC,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`action`:return(0,J.jsx)(kA,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0});default:return null}}function R1(e,t,n,r){if(r(),t.startsWith(`/chat`)){l1(e);return}n(`/chat`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{l1(e)})})}function z1(e){let t=[];for(let n of e.uiExtensions){let r=n.ui?.contributions?.commands;if(Array.isArray(r))for(let i of r)!i||typeof i.id!=`string`||typeof i.title!=`string`||t.push({kind:`extension`,id:`ext:${n.id}:${i.id}`,title:i.title,subtitle:n.name,groupLabel:`Extensions`,keywords:[n.id,n.name,i.id],run:()=>{e.close(),i.opensPanel!==void 0&&i.opensPanel!==``?e.navigate(`/apps/${encodeURIComponent(n.id)}`):window.dispatchEvent(new CustomEvent(`extension-command`,{detail:{extensionId:n.id,commandId:i.id}}))}})}return t}function B1(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(0),o=(0,L.useRef)(null),s=(0,L.useRef)(null),c=zi(),{pathname:l}=Ii(),u=oN(e=>e.language),d=DP(),f=F1(),p=p$(e=>e.agentId),m=S$(e=>e.setPath),h=(0,L.useRef)(0),[g,_]=(0,L.useState)({phase:`idle`,hits:[]}),[v,y]=(0,L.useState)(`main`),[b,x]=(0,L.useState)([]),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(!1),E=(0,L.useMemo)(()=>N$(u),[u]),D=(0,L.useCallback)(async()=>{y(`models`),r(``),a(0),T(!0);try{let e=await cP(Y(`/api/registry`)),t=[];for(let n of e.payload?.providers??[])for(let e of n.models??[])e.available!==!1&&t.push({id:e.ref,title:e.name||e.ref,subtitle:e.ref});t.sort((e,t)=>e.title.localeCompare(t.title)),x(t)}catch{x([])}finally{T(!1)}},[]),O=(0,L.useCallback)(async()=>{y(`agents`),r(``),a(0),T(!0);try{let e=await v1(),t=GM(u).agentsSettings;C(e.agents.map(e=>({id:e.id,title:N1(e,t),subtitle:e.id})))}catch{C([])}finally{T(!1)}},[u]),k=(0,L.useMemo)(()=>{let e=n.trim().toLowerCase(),t=v===`models`?b:v===`agents`?S:[];return e?t.filter(t=>t.title.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.subtitle?.toLowerCase().includes(e)??!1)):t},[v,b,S,n]);if((0,L.useEffect)(()=>{e&&(r(``),a(0),y(`main`),x([]),C([]),_({phase:`idle`,hits:[]}),window.setTimeout(()=>o.current?.focus(),50))},[e]),(0,L.useEffect)(()=>{a(e=>Math.min(e,Math.max(0,k.length>0?k.length-1:0)))},[k.length,v,n]),(0,L.useEffect)(()=>{let n=n=>{if((n.metaKey||n.ctrlKey)&&n.key===`k`){n.preventDefault(),t(e=>!e);return}if(!e)return;if(n.key===`Escape`){if(n.preventDefault(),v!==`main`){y(`main`),r(``),a(0);return}t(!1);return}let o=v===`main`?Math.max(0,g.hits.length-1):Math.max(0,k.length);if(n.key===`ArrowDown`){n.preventDefault(),a(e=>Math.min(e+1,o));return}if(n.key===`ArrowUp`){n.preventDefault(),a(e=>Math.max(0,e-1));return}if(n.key===`Enter`){if(n.preventDefault(),v===`models`){if(i===0){y(`main`),r(``);return}let e=k[i-1];if(!e)return;(async()=>{await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agents:{defaults:{model:e.id}}})}),WV(),window.dispatchEvent(new CustomEvent(`config-reload`)),t(!1),y(`main`)})();return}if(v===`agents`){if(i===0){y(`main`),r(``);return}let e=k[i-1];if(!e)return;window.dispatchEvent(new CustomEvent(`xopc-set-chat-agent`,{detail:{agentId:e.id}})),t(!1),y(`main`);return}let e=g.hits[i];e&&e.run()}};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,i,g.hits,v,k,w]),(0,L.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(`open-command-palette`,e),()=>window.removeEventListener(`open-command-palette`,e)},[]),(0,L.useEffect)(()=>{let e=()=>t(e=>!e);return window.addEventListener(`toggle-command-palette`,e),()=>window.removeEventListener(`toggle-command-palette`,e)},[]),(0,L.useEffect)(()=>{if(!e||v!==`main`)return;let r=n.trim(),i=++h.current,o=!1,s=window.setTimeout(()=>{(async()=>{try{_(e=>({phase:`loading`,hits:e.hits}));let e=()=>t(!1),n=E.map(t=>({kind:`route`,id:t.id,title:t.title,subtitle:t.subtitle,groupLabel:`Navigate`,keywords:[...t.keywords??[],t.path],run:()=>{e(),c(t.path)}})),s=I$(u,{closePalette:e,openModelPalette:D,openAgentPalette:O}),g=O$(u,c,e),v=z1({query:r,close:e,navigate:c,uiExtensions:d}),[y,b,x,S]=await Promise.all([o1(),s1(u),DH({search:r||void 0,limit:8,offset:0}).catch(()=>({items:[]})),(async()=>{let e=f?.trim(),t=p.trim();return!e&&!t?[]:await h1(r,{sessionKey:e||void 0,agentId:e?void 0:t||void 0,limit:10}).catch(()=>[])})()]),C=y.map(t=>({kind:`command`,id:`cmd:${t.id}`,title:`/${t.name}`,subtitle:t.description,groupLabel:`Commands`,keywords:[t.id,...t.aliases??[],t.category??``],run:()=>{R1(u1(t),l,c,e)}})),w=b.catalog.filter(e=>e.enabled&&!e.disableModelInvocation).map(t=>({kind:`skill`,id:`skill:${t.name}`,title:`/skill:${t.name}`,subtitle:t.description,groupLabel:`Skills`,keywords:[t.source??``,`skill`],run:()=>{R1(`/skill:${t.name} `,l,c,e)}})),T=(x.items??[]).map(t=>({kind:`session`,id:`session:${t.key}`,title:t.name?.trim()||t.key,subtitle:t.key,groupLabel:`Sessions`,keywords:[t.key,...t.tags??[],t.sourceChannel??``],run:()=>{e(),c(`/chat/${encodeURIComponent(t.key)}`)}})),k=S.filter(e=>!e.isDirectory).map(t=>({kind:`file`,id:`file:${t.relativePath}`,title:t.name,subtitle:t.relativePath,groupLabel:`Files`,keywords:[t.relativePath],run:()=>{e();let n=t.relativePath.replace(/\\/g,`/`).replace(/^\/+/,``),r=()=>m(n);if(l.startsWith(`/chat`)){r();return}c(`/chat`),window.setTimeout(()=>r(),0)}})),A=[...n,...s,...g,...v,...T,...k,...C,...w],j=[];for(let e of A){let t=j$(e,r);t!==null&&j.push({...e,rank:t})}let M={Navigate:12,"Quick Settings":12,Actions:8,Extensions:8,Sessions:8,Files:10,Commands:6,Skills:6},N=M$(j),P=[],F={};for(let e of N){let t=(F[e.groupLabel]??0)+1;if(!(t>(M[e.groupLabel]??6))&&(F[e.groupLabel]=t,P.push(e),P.length>=36))break}if(P.sort((e,t)=>I1(e.groupLabel)-I1(t.groupLabel)||e.rank-t.rank||e.title.localeCompare(t.title)),o||i!==h.current)return;_({phase:`ready`,hits:P}),a(e=>Math.min(e,Math.max(0,P.length-1)))}catch(e){if(o||i!==h.current)return;_({phase:`error`,hits:[],message:e instanceof Error?e.message:String(e)})}})()},120);return()=>{o=!0,window.clearTimeout(s)}},[e,n,E,d,c,f,p,l,m,u,D,O,v]),(0,L.useLayoutEffect)(()=>{if(!e)return;let t=s.current;t&&t.querySelector(`[data-global-palette-index="${String(i)}"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,i,g.hits,v,k.length]),!e)return null;let A=g.hits,j=u===`zh`?`返回`:`Back`;if(v===`models`||v===`agents`){let e=k;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/40 p-4 pt-[min(18vh,7rem)]`,role:`dialog`,"aria-modal":`true`,"aria-label":u===`zh`?`选择模型或智能体`:`Model or agent picker`,onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,J.jsxs)(`div`,{className:`flex w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,J.jsx)(`input`,{ref:o,type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:v===`models`?u===`zh`?`搜索模型…`:`Search models…`:u===`zh`?`搜索智能体…`:`Search agents…`,className:`border-b border-edge bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-fg-muted`,autoComplete:`off`,autoCorrect:`off`}),(0,J.jsxs)(`ul`,{ref:s,className:`max-h-[min(60vh,26rem)] overflow-y-auto p-2 text-sm [scrollbar-gutter:stable]`,role:`listbox`,children:[(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-global-palette-index":0,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-fg-muted`,i===0?`bg-surface-hover`:`hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(0),onClick:()=>{y(`main`),r(``),a(0)},children:[`← `,j]})}),w?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:u===`zh`?`加载中…`:`Loading…`}):e.length===0?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:u===`zh`?`无结果`:`No results`}):e.map((e,n)=>{let r=n+1;return(0,J.jsx)(`li`,{children:(0,J.jsx)(`button`,{type:`button`,"data-global-palette-index":r,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left`,i===r?`bg-surface-hover text-fg`:`text-fg hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(r),onClick:()=>{v===`models`?(async()=>{await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agents:{defaults:{model:e.id}}})}),WV(),window.dispatchEvent(new CustomEvent(`config-reload`)),t(!1),y(`main`)})():(window.dispatchEvent(new CustomEvent(`xopc-set-chat-agent`,{detail:{agentId:e.id}})),t(!1),y(`main`))},children:(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`min-w-0 truncate font-medium`,children:e.title}),e.subtitle?(0,J.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-fg-muted`,children:e.subtitle}):null]})})},e.id)})]})]})})}let M=``;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/40 p-4 pt-[min(18vh,7rem)]`,role:`dialog`,"aria-modal":`true`,"aria-label":`Global search`,onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,J.jsxs)(`div`,{className:`flex w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,J.jsx)(`input`,{ref:o,type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:u===`zh`?`搜索…(会话 / 文件 / 设置 / 命令)`:`Search… (sessions, files, settings, commands)`,className:`border-b border-edge bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-fg-muted`,autoComplete:`off`,autoCorrect:`off`}),(0,J.jsx)(`ul`,{ref:s,className:`max-h-[min(60vh,26rem)] overflow-y-auto p-2 text-sm [scrollbar-gutter:stable]`,role:`listbox`,"aria-activedescendant":A[i]?`global-hit-${A[i].id}`:void 0,children:A.length===0?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:g.phase===`loading`?u===`zh`?`搜索中…`:`Searching…`:g.phase===`error`?g.message:u===`zh`?`无结果`:`No results`}):A.map((e,t)=>{let n=e.groupLabel===M?``:e.groupLabel;return M=e.groupLabel,(0,J.jsxs)(`li`,{children:[n?(0,J.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-fg-muted`,children:n}):null,(0,J.jsxs)(`button`,{id:`global-hit-${e.id}`,"data-global-palette-index":t,type:`button`,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left`,t===i?`bg-surface-hover text-fg`:`text-fg hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(t),onClick:()=>e.run(),children:[(0,J.jsx)(`span`,{className:`mt-0.5`,children:L1(e)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`min-w-0 truncate font-medium`,children:e.title}),e.subtitle?(0,J.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-fg-muted`,children:e.subtitle}):null]})]})]},e.id)})})]})})}var V1=class{_eventSource;_shouldReconnect=!0;_reconnectCount=0;constructor(e,t){this._config=e,this._callbacks=t}get maxReconnectAttempts(){return this._config.maxReconnectAttempts??10}get autoReconnect(){return this._config.autoReconnect??!0}connect(){if(this._eventSource)return;let e=new URL(Y(`/api/events`));this._config.token&&e.searchParams.set(`token`,this._config.token),this._eventSource=new EventSource(e.toString()),this._eventSource.onopen=()=>{this._reconnectCount=0},this._eventSource.addEventListener(`connected`,()=>{this._callbacks.onConnected()});for(let e of[`agent.stream`,`config.reload`,`channels.status`,`message.sent`,`session.updated`,`session.created`,`dreaming.phase.start`,`dreaming.phase.end`])this._eventSource.addEventListener(e,t=>{this._callbacks.onEvent(e,t.data)});this._eventSource.onerror=()=>{this._eventSource?.readyState===EventSource.CLOSED?this._handlePermanentDisconnect():this._callbacks.onReconnecting()}}_handlePermanentDisconnect(){this._callbacks.onDisconnected(),!(!this._shouldReconnect||!this.autoReconnect)&&(this._reconnectCount++,this._reconnectCount>this.maxReconnectAttempts&&this._callbacks.onError(`Connection failed after max retries`))}disconnect(){this._shouldReconnect=!1,this._eventSource?.close(),this._eventSource=void 0}reconnect(){this._shouldReconnect=!0,this._reconnectCount=0,this.disconnect(),this._shouldReconnect=!0,setTimeout(()=>this.connect(),100)}};function H1(e,t){let n=t;try{n=JSON.parse(t)}catch{}let r=e.replace(/\./g,`-`);if(window.dispatchEvent(new CustomEvent(r,{detail:n})),e===`agent.stream`&&n&&typeof n==`object`&&n){let e=n;typeof e.sessionKey==`string`&&e.sessionKey.length>0&&window.dispatchEvent(new CustomEvent(`agent-stream-event`,{detail:{sessionKey:e.sessionKey,event:e.event===void 0?e:e.event}}))}}var U1=null;function W1(e){U1=e}function G1(){U1?.reconnect()}var K1=aN(()=>({connectionState:`idle`,error:null,reconnectAttempt:0}));function q1(e){K1.setState(e)}function J1(){let e=LN(e=>e.token);(0,L.useEffect)(()=>{if(!e){W1(null),q1({connectionState:`disconnected`,error:null,reconnectAttempt:0});return}let t=new V1({token:e,autoReconnect:!0,maxReconnectAttempts:10},{onConnected:()=>{q1({connectionState:`connected`,error:null,reconnectAttempt:0})},onReconnecting:()=>{q1({connectionState:`reconnecting`})},onDisconnected:()=>{q1({connectionState:`disconnected`})},onError:e=>{q1({connectionState:`error`,error:e})},onEvent:(e,t)=>{H1(e,t)}});return W1(t),q1({connectionState:`connecting`,error:null}),t.connect(),()=>{t.disconnect(),W1(null),q1({connectionState:`disconnected`,error:null})}},[e])}function Y1(){return J1(),null}var X1=1e3,Z1=1001,Q1=1002,$1=1003,e0=1004,t0=1005,n0=1006,r0=1007,i0=1008,a0=1009,o0=1010,s0=1011,c0=1012,l0=1013,u0=1014,d0=1015,f0=1016,p0=1017,m0=1018,h0=1020,g0=35902,_0=35899,v0=1021,y0=1022,b0=1023,x0=1026,S0=1027,C0=1028,w0=1029,T0=1030,E0=1031,D0=1033,O0=33776,k0=33777,A0=33778,j0=33779,M0=35840,N0=35841,P0=35842,F0=35843,I0=36196,L0=37492,R0=37496,z0=37488,B0=37489,V0=37490,H0=37491,U0=37808,W0=37809,G0=37810,K0=37811,pce=37812,mce=37813,hce=37814,gce=37815,_ce=37816,vce=37817,yce=37818,bce=37819,xce=37820,Sce=37821,Cce=36492,wce=36494,Tce=36495,Ece=36283,Dce=36284,Oce=36285,kce=36286,q0=2300,J0=2301,Y0=2302,X0=2303,Z0=2400,Q0=2401,$0=2402,Ace=3200,e2=`srgb`,t2=`srgb-linear`,n2=`linear`,r2=`srgb`,i2=7680,jce=35044,a2=2e3;function Mce(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Nce(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function o2(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Pce(){let e=o2(`canvas`);return e.style.display=`block`,e}var s2={},c2=null;function l2(...e){let t=`THREE.`+e.shift();c2?c2(`log`,t,...e):console.log(t,...e)}function u2(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function d2(...e){e=u2(e);let t=`THREE.`+e.shift();if(c2)c2(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function f2(...e){e=u2(e);let t=`THREE.`+e.shift();if(c2)c2(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function p2(...e){let t=e.join(` `);t in s2||(s2[t]=!0,d2(...e))}function Fce(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var Ice={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},m2=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},h2=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),g2=Math.PI/180,_2=180/Math.PI;function v2(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(h2[e&255]+h2[e>>8&255]+h2[e>>16&255]+h2[e>>24&255]+`-`+h2[t&255]+h2[t>>8&255]+`-`+h2[t>>16&15|64]+h2[t>>24&255]+`-`+h2[n&63|128]+h2[n>>8&255]+`-`+h2[n>>16&255]+h2[n>>24&255]+h2[r&255]+h2[r>>8&255]+h2[r>>16&255]+h2[r>>24&255]).toLowerCase()}function y2(e,t,n){return Math.max(t,Math.min(n,e))}function Lce(e,t){return(e%t+t)%t}function b2(e,t,n){return(1-n)*e+n*t}function x2(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function S2(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var C2=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(y2(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},w2=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:d2(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(y2(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Q=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(E2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(E2.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this.z=y2(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this.z=y2(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return T2.copy(this).projectOnVector(e),this.sub(T2)}reflect(e){return this.sub(T2.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(y2(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},T2=new Q,E2=new w2,D2=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(O2.makeScale(e,t)),this}rotate(e){return this.premultiply(O2.makeRotation(-e)),this}translate(e,t){return this.premultiply(O2.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},O2=new D2,k2=new D2().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),A2=new D2().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Rce(){let e={enabled:!0,workingColorSpace:t2,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=M2(e.r),e.g=M2(e.g),e.b=M2(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=N2(e.r),e.g=N2(e.g),e.b=N2(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?n2:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return p2(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return p2(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[t2]:{primaries:t,whitePoint:r,transfer:n2,toXYZ:k2,fromXYZ:A2,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:e2},outputColorSpaceConfig:{drawingBufferColorSpace:e2}},[e2]:{primaries:t,whitePoint:r,transfer:r2,toXYZ:k2,fromXYZ:A2,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:e2}}}),e}var j2=Rce();function M2(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function N2(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var P2,zce=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{P2===void 0&&(P2=o2(`canvas`)),P2.width=e.width,P2.height=e.height;let t=P2.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=P2}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=o2(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=M2(i[e]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(M2(t[e]/255)*255):t[e]=M2(t[e]);return{data:t,width:e.width,height:e.height}}else return d2(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Bce=0,F2=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,`id`,{value:Bce++}),this.uuid=v2(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(I2(r[t].image)):e.push(I2(r[t]))}else e=I2(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function I2(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?zce.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(d2(`Texture: Unable to serialize Texture.`),{})}var Vce=0,L2=new Q,R2=class e extends m2{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=Z1,i=Z1,a=n0,o=i0,s=b0,c=a0,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,`id`,{value:Vce++}),this.uuid=v2(),this.name=``,this.source=new F2(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new C2(0,0),this.repeat=new C2(1,1),this.center=new C2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new D2,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(L2).x}get height(){return this.source.getSize(L2).y}get depth(){return this.source.getSize(L2).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){d2(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){d2(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case X1:e.x-=Math.floor(e.x);break;case Z1:e.x=e.x<0?0:1;break;case Q1:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case X1:e.y-=Math.floor(e.y);break;case Z1:e.y=e.y<0?0:1;break;case Q1:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};R2.DEFAULT_IMAGE=null,R2.DEFAULT_MAPPING=300,R2.DEFAULT_ANISOTROPY=1;var z2=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this.z=y2(this.z,e.z,t.z),this.w=y2(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this.z=y2(this.z,e,t),this.w=y2(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Hce=class extends m2{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:n0,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new z2(0,0,e,t),this.scissorTest=!1,this.viewport=new z2(0,0,e,t),this.textures=[];let r=new R2({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:n0,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new F2(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:`dispose`})}},B2=class extends Hce{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},V2=class extends R2{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=$1,this.minFilter=$1,this.wrapR=Z1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Uce=class extends R2{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=$1,this.minFilter=$1,this.wrapR=Z1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},H2=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,r=1/U2.setFromMatrixColumn(e,0).length(),i=1/U2.setFromMatrixColumn(e,1).length(),a=1/U2.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Wce,e,Gce)}lookAt(e,t,n){let r=this.elements;return q2.subVectors(e,t),q2.lengthSq()===0&&(q2.z=1),q2.normalize(),G2.crossVectors(n,q2),G2.lengthSq()===0&&(Math.abs(n.z)===1?q2.x+=1e-4:q2.z+=1e-4,q2.normalize(),G2.crossVectors(n,q2)),G2.normalize(),K2.crossVectors(q2,G2),r[0]=G2.x,r[4]=K2.x,r[8]=q2.x,r[1]=G2.y,r[5]=K2.y,r[9]=q2.y,r[2]=G2.z,r[6]=K2.z,r[10]=q2.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinant();if(i===0)return n.set(1,1,1),t.identity(),this;let a=U2.set(r[0],r[1],r[2]).length(),o=U2.set(r[4],r[5],r[6]).length(),s=U2.set(r[8],r[9],r[10]).length();i<0&&(a=-a),W2.copy(this);let c=1/a,l=1/o,u=1/s;return W2.elements[0]*=c,W2.elements[1]*=c,W2.elements[2]*=c,W2.elements[4]*=l,W2.elements[5]*=l,W2.elements[6]*=l,W2.elements[8]*=u,W2.elements[9]*=u,W2.elements[10]*=u,t.setFromRotationMatrix(W2),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=a2,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=a2,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},U2=new Q,W2=new H2,Wce=new Q(0,0,0),Gce=new Q(1,1,1),G2=new Q,K2=new Q,q2=new Q,J2=new H2,Y2=new w2,X2=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(y2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-y2(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(y2(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-y2(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(y2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-y2(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:d2(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return J2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(J2,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Y2.setFromEuler(this),this.setFromQuaternion(Y2,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};X2.DEFAULT_ORDER=`XYZ`;var Z2=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},Kce=0,Q2=new Q,$2=new w2,e4=new H2,t4=new Q,n4=new Q,qce=new Q,Jce=new w2,r4=new Q(1,0,0),i4=new Q(0,1,0),a4=new Q(0,0,1),o4={type:`added`},Yce={type:`removed`},s4={type:`childadded`,child:null},c4={type:`childremoved`,child:null},l4=class e extends m2{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,`id`,{value:Kce++}),this.uuid=v2(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new Q,n=new X2,r=new w2,i=new Q(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new H2},normalMatrix:{value:new D2}}),this.matrix=new H2,this.matrixWorld=new H2,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Z2,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return $2.setFromAxisAngle(e,t),this.quaternion.multiply($2),this}rotateOnWorldAxis(e,t){return $2.setFromAxisAngle(e,t),this.quaternion.premultiply($2),this}rotateX(e){return this.rotateOnAxis(r4,e)}rotateY(e){return this.rotateOnAxis(i4,e)}rotateZ(e){return this.rotateOnAxis(a4,e)}translateOnAxis(e,t){return Q2.copy(e).applyQuaternion(this.quaternion),this.position.add(Q2.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(r4,e)}translateY(e){return this.translateOnAxis(i4,e)}translateZ(e){return this.translateOnAxis(a4,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(e4.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?t4.copy(e):t4.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),n4.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e4.lookAt(n4,t4,this.up):e4.lookAt(t4,n4,this.up),this.quaternion.setFromRotationMatrix(e4),r&&(e4.extractRotation(r.matrixWorld),$2.setFromRotationMatrix(e4),this.quaternion.premultiply($2.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(f2(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(o4),s4.child=e,this.dispatchEvent(s4),s4.child=null):f2(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Yce),c4.child=e,this.dispatchEvent(c4),c4.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),e4.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),e4.multiply(e.parent.matrixWorld)),e.applyMatrix4(e4),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(o4),s4.child=e,this.dispatchEvent(s4),s4.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n4,e,qce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n4,Jce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};l4.DEFAULT_UP=new Q(0,1,0),l4.DEFAULT_MATRIX_AUTO_UPDATE=!0,l4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var u4=class extends l4{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Xce={type:`move`},d4=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new u4,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new u4,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new u4,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position),s=.02,l=.005;c.inputState.pinching&&o>s+l?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=s-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Xce)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new u4;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},f4={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},p4={h:0,s:0,l:0},m4={h:0,s:0,l:0};function h4(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var g4=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=e2){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,j2.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=j2.workingColorSpace){return this.r=e,this.g=t,this.b=n,j2.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=j2.workingColorSpace){if(e=Lce(e,1),t=y2(t,0,1),n=y2(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=h4(i,r,e+1/3),this.g=h4(i,r,e),this.b=h4(i,r,e-1/3)}return j2.colorSpaceToWorking(this,r),this}setStyle(e,t=e2){function n(t){t!==void 0&&parseFloat(t)<1&&d2(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:d2(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);d2(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=e2){let n=f4[e.toLowerCase()];return n===void 0?d2(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=M2(e.r),this.g=M2(e.g),this.b=M2(e.b),this}copyLinearToSRGB(e){return this.r=N2(e.r),this.g=N2(e.g),this.b=N2(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=e2){return j2.workingToColorSpace(_4.copy(this),e),Math.round(y2(_4.r*255,0,255))*65536+Math.round(y2(_4.g*255,0,255))*256+Math.round(y2(_4.b*255,0,255))}getHexString(e=e2){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=j2.workingColorSpace){j2.workingToColorSpace(_4.copy(this),t);let n=_4.r,r=_4.g,i=_4.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4;break}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=j2.workingColorSpace){return j2.workingToColorSpace(_4.copy(this),t),e.r=_4.r,e.g=_4.g,e.b=_4.b,e}getStyle(e=e2){j2.workingToColorSpace(_4.copy(this),e);let t=_4.r,n=_4.g,r=_4.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(p4),this.setHSL(p4.h+e,p4.s+t,p4.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(p4),e.getHSL(m4);let n=b2(p4.h,m4.h,t),r=b2(p4.s,m4.s,t),i=b2(p4.l,m4.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},_4=new g4;g4.NAMES=f4;var Zce=class extends l4{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new X2,this.environmentIntensity=1,this.environmentRotation=new X2,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},v4=new Q,y4=new Q,b4=new Q,x4=new Q,S4=new Q,C4=new Q,w4=new Q,T4=new Q,E4=new Q,D4=new Q,O4=new z2,k4=new z2,A4=new z2,j4=class e{constructor(e=new Q,t=new Q,n=new Q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),v4.subVectors(e,t),r.cross(v4);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){v4.subVectors(r,t),y4.subVectors(n,t),b4.subVectors(e,t);let a=v4.dot(v4),o=v4.dot(y4),s=v4.dot(b4),c=y4.dot(y4),l=y4.dot(b4),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,x4)===null?!1:x4.x>=0&&x4.y>=0&&x4.x+x4.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,x4)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,x4.x),s.addScaledVector(a,x4.y),s.addScaledVector(o,x4.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return O4.setScalar(0),k4.setScalar(0),A4.setScalar(0),O4.fromBufferAttribute(e,t),k4.fromBufferAttribute(e,n),A4.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(O4,i.x),a.addScaledVector(k4,i.y),a.addScaledVector(A4,i.z),a}static isFrontFacing(e,t,n,r){return v4.subVectors(n,t),y4.subVectors(e,t),v4.cross(y4).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return v4.subVectors(this.c,this.b),y4.subVectors(this.a,this.b),v4.cross(y4).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;S4.subVectors(r,n),C4.subVectors(i,n),T4.subVectors(e,n);let s=S4.dot(T4),c=C4.dot(T4);if(s<=0&&c<=0)return t.copy(n);E4.subVectors(e,r);let l=S4.dot(E4),u=C4.dot(E4);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(S4,a);D4.subVectors(e,i);let f=S4.dot(D4),p=C4.dot(D4);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(C4,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return w4.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(w4,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(S4,a).addScaledVector(C4,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},M4=class{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(P4.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(P4.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=P4.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,P4):P4.fromBufferAttribute(r,t),P4.applyMatrix4(e.matrixWorld),this.expandByPoint(P4);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),F4.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),F4.copy(e.boundingBox)),F4.applyMatrix4(e.matrixWorld),this.union(F4)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,P4),P4.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(H4),U4.subVectors(this.max,H4),I4.subVectors(e.a,H4),L4.subVectors(e.b,H4),R4.subVectors(e.c,H4),z4.subVectors(L4,I4),B4.subVectors(R4,L4),V4.subVectors(I4,R4);let t=[0,-z4.z,z4.y,0,-B4.z,B4.y,0,-V4.z,V4.y,z4.z,0,-z4.x,B4.z,0,-B4.x,V4.z,0,-V4.x,-z4.y,z4.x,0,-B4.y,B4.x,0,-V4.y,V4.x,0];return!K4(t,I4,L4,R4,U4)||(t=[1,0,0,0,1,0,0,0,1],!K4(t,I4,L4,R4,U4))?!1:(W4.crossVectors(z4,B4),t=[W4.x,W4.y,W4.z],K4(t,I4,L4,R4,U4))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,P4).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(P4).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(N4[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),N4[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),N4[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),N4[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),N4[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),N4[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),N4[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),N4[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(N4),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},N4=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],P4=new Q,F4=new M4,I4=new Q,L4=new Q,R4=new Q,z4=new Q,B4=new Q,V4=new Q,H4=new Q,U4=new Q,W4=new Q,G4=new Q;function K4(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){G4.fromArray(e,a);let o=i.x*Math.abs(G4.x)+i.y*Math.abs(G4.y)+i.z*Math.abs(G4.z),s=t.dot(G4),c=n.dot(G4),l=r.dot(G4);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var q4=new Q,J4=new C2,Qce=0,Y4=class extends m2{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,`id`,{value:Qce++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=jce,this.updateRanges=[],this.gpuType=d0,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)J4.fromBufferAttribute(this,t),J4.applyMatrix3(e),this.setXY(t,J4.x,J4.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyMatrix3(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyMatrix4(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyNormalMatrix(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.transformDirection(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=x2(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=S2(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=x2(t,this.array)),t}setX(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=x2(t,this.array)),t}setY(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=x2(t,this.array)),t}setZ(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=x2(t,this.array)),t}setW(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array),r=S2(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array),r=S2(r,this.array),i=S2(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},X4=class extends Y4{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Z4=class extends Y4{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Q4=class extends Y4{constructor(e,t,n){super(new Float32Array(e),t,n)}},$ce=new M4,$4=new Q,e3=new Q,t3=class{constructor(e=new Q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?$ce.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;$4.subVectors(e,this.center);let t=$4.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector($4,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(e3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint($4.copy(e.center).add(e3)),this.expandByPoint($4.copy(e.center).sub(e3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},ele=0,n3=new H2,r3=new l4,i3=new Q,a3=new M4,o3=new M4,s3=new Q,c3=class e extends m2{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,`id`,{value:ele++}),this.uuid=v2(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Mce(e)?Z4:X4)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new D2().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return n3.makeRotationFromQuaternion(e),this.applyMatrix4(n3),this}rotateX(e){return n3.makeRotationX(e),this.applyMatrix4(n3),this}rotateY(e){return n3.makeRotationY(e),this.applyMatrix4(n3),this}rotateZ(e){return n3.makeRotationZ(e),this.applyMatrix4(n3),this}translate(e,t,n){return n3.makeTranslation(e,t,n),this.applyMatrix4(n3),this}scale(e,t,n){return n3.makeScale(e,t,n),this.applyMatrix4(n3),this}lookAt(e){return r3.lookAt(e),r3.updateMatrix(),this.applyMatrix4(r3.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i3).negate(),this.translate(i3.x,i3.y,i3.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new Q4(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&d2(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new M4);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){f2(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Q(-1/0,-1/0,-1/0),new Q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];a3.setFromBufferAttribute(n),this.morphTargetsRelative?(s3.addVectors(this.boundingBox.min,a3.min),this.boundingBox.expandByPoint(s3),s3.addVectors(this.boundingBox.max,a3.max),this.boundingBox.expandByPoint(s3)):(this.boundingBox.expandByPoint(a3.min),this.boundingBox.expandByPoint(a3.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&f2(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new t3);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){f2(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new Q,1/0);return}if(e){let n=this.boundingSphere.center;if(a3.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];o3.setFromBufferAttribute(n),this.morphTargetsRelative?(s3.addVectors(a3.min,o3.min),a3.expandByPoint(s3),s3.addVectors(a3.max,o3.max),a3.expandByPoint(s3)):(a3.expandByPoint(o3.min),a3.expandByPoint(o3.max))}a3.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)s3.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(s3));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)s3.fromBufferAttribute(a,t),o&&(i3.fromBufferAttribute(e,t),s3.add(i3)),r=Math.max(r,n.distanceToSquared(s3))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&f2(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){f2(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new Y4(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Q,s[e]=new Q;let c=new Q,l=new Q,u=new Q,d=new C2,f=new C2,p=new C2,m=new Q,h=new Q;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new Q,y=new Q,b=new Q,x=new Q;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new Y4(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new Q,i=new Q,a=new Q,o=new Q,s=new Q,c=new Q,l=new Q,u=new Q;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)s3.fromBufferAttribute(e,t),s3.normalize(),e.setXYZ(t,s3.x,s3.y,s3.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Y4(a,r,i)}if(this.index===null)return d2(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:`dispose`})}},tle=0,l3=class extends m2{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,`id`,{value:tle++}),this.uuid=v2(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new g4(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=i2,this.stencilZFail=i2,this.stencilZPass=i2,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){d2(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){d2(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},u3=new Q,d3=new Q,f3=new Q,p3=new Q,m3=new Q,h3=new Q,g3=new Q,_3=class{constructor(e=new Q,t=new Q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,u3)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=u3.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(u3.copy(this.origin).addScaledVector(this.direction,t),u3.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){d3.copy(e).add(t).multiplyScalar(.5),f3.copy(t).sub(e).normalize(),p3.copy(this.origin).sub(d3);let i=e.distanceTo(t)*.5,a=-this.direction.dot(f3),o=p3.dot(this.direction),s=-p3.dot(f3),c=p3.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(d3).addScaledVector(f3,d),f}intersectSphere(e,t){u3.subVectors(e.center,this.origin);let n=u3.dot(this.direction),r=u3.dot(u3)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,u3)!==null}intersectTriangle(e,t,n,r,i){m3.subVectors(t,e),h3.subVectors(n,e),g3.crossVectors(m3,h3);let a=this.direction.dot(g3),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;p3.subVectors(this.origin,e);let s=o*this.direction.dot(h3.crossVectors(p3,h3));if(s<0)return null;let c=o*this.direction.dot(m3.cross(p3));if(c<0||s+c>a)return null;let l=-o*p3.dot(g3);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},v3=class extends l3{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new g4(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new X2,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},y3=new H2,b3=new _3,x3=new t3,S3=new Q,C3=new Q,w3=new Q,T3=new Q,E3=new Q,D3=new Q,O3=new Q,k3=new Q,A3=class extends l4{constructor(e=new c3,t=new v3){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){D3.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(E3.fromBufferAttribute(s,e),a?D3.addScaledVector(E3,r):D3.addScaledVector(E3.sub(t),r))}t.add(D3)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),x3.copy(n.boundingSphere),x3.applyMatrix4(i),b3.copy(e.ray).recast(e.near),!(x3.containsPoint(b3.origin)===!1&&(b3.intersectSphere(x3,S3)===null||b3.origin.distanceToSquared(S3)>(e.far-e.near)**2))&&(y3.copy(i).invert(),b3.copy(e.ray).applyMatrix4(y3),!(n.boundingBox!==null&&b3.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,b3)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=j3(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=j3(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=j3(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=j3(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function nle(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;k3.copy(s),k3.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(k3);return l<n.near||l>n.far?null:{distance:l,point:k3.clone(),object:e}}function j3(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,C3),e.getVertexPosition(c,w3),e.getVertexPosition(l,T3);let u=nle(e,t,n,r,C3,w3,T3,O3);if(u){let e=new Q;j4.getBarycoord(O3,C3,w3,T3,e),i&&(u.uv=j4.getInterpolatedAttribute(i,s,c,l,e,new C2)),a&&(u.uv1=j4.getInterpolatedAttribute(a,s,c,l,e,new C2)),o&&(u.normal=j4.getInterpolatedAttribute(o,s,c,l,e,new Q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Q,materialIndex:0};j4.getNormal(C3,w3,T3,t.normal),u.face=t,u.barycoord=e}return u}var rle=class extends R2{constructor(e=null,t=1,n=1,r,i,a,o,s,c=$1,l=$1,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},M3=new Q,ile=new Q,ale=new D2,N3=class{constructor(e=new Q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=M3.subVectors(n,t).cross(ile.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(M3),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||ale.getNormalMatrix(e),r=this.coplanarPoint(M3).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},P3=new t3,ole=new C2(.5,.5),F3=new Q,I3=class{constructor(e=new N3,t=new N3,n=new N3,r=new N3,i=new N3,a=new N3){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=a2,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),P3.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),P3.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(P3)}intersectsSprite(e){return P3.center.set(0,0,0),P3.radius=.7071067811865476+ole.distanceTo(e.center),P3.applyMatrix4(e.matrixWorld),this.intersectsSphere(P3)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(F3.x=r.normal.x>0?e.max.x:e.min.x,F3.y=r.normal.y>0?e.max.y:e.min.y,F3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(F3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},sle=class extends l3{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new g4(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},L3=new Q,R3=new Q,z3=new H2,B3=new _3,V3=new t3,H3=new Q,U3=new Q,cle=class extends l4{constructor(e=new c3,t=new sle){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)L3.fromBufferAttribute(t,e-1),R3.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=L3.distanceTo(R3);e.setAttribute(`lineDistance`,new Q4(n,1))}else d2(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),V3.copy(n.boundingSphere),V3.applyMatrix4(r),V3.radius+=i,e.ray.intersectsSphere(V3)===!1)return;z3.copy(r).invert(),B3.copy(e.ray).applyMatrix4(z3);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=W3(this,e,B3,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=W3(this,e,B3,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=W3(this,e,B3,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=W3(this,e,B3,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function W3(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(L3.fromBufferAttribute(s,i),R3.fromBufferAttribute(s,a),n.distanceSqToSegment(L3,R3,H3,U3)>r)return;H3.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(H3);if(!(c<t.near||c>t.far))return{distance:c,point:U3.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var G3=new Q,K3=new Q,lle=class extends cle{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)G3.fromBufferAttribute(t,e),K3.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+G3.distanceTo(K3);e.setAttribute(`lineDistance`,new Q4(n,1))}else d2(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},ule=class extends l3{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new g4(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},q3=new H2,J3=new _3,Y3=new t3,X3=new Q,Z3=class extends l4{constructor(e=new c3,t=new ule){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Y3.copy(n.boundingSphere),Y3.applyMatrix4(r),Y3.radius+=i,e.ray.intersectsSphere(Y3)===!1)return;q3.copy(r).invert(),J3.copy(e.ray).applyMatrix4(q3);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);X3.fromBufferAttribute(l,n),Q3(X3,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)X3.fromBufferAttribute(l,a),Q3(X3,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function Q3(e,t,n,r,i,a,o){let s=J3.distanceSqToPoint(e);if(s<n){let n=new Q;J3.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var $3=class extends R2{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},e6=class extends R2{constructor(e,t,n=u0,r,i,a,o=$1,s=$1,c,l=x0,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new F2(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},dle=class extends e6{constructor(e,t=u0,n=301,r,i,a=$1,o=$1,s,c=x0){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},t6=class extends R2{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},n6=class e extends c3{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Q4(c,3)),this.setAttribute(`normal`,new Q4(l,3)),this.setAttribute(`uv`,new Q4(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Q;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},r6=class e extends c3{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new Q4(p,3)),this.setAttribute(`normal`,new Q4(m,3)),this.setAttribute(`uv`,new Q4(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}};function i6(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(o6(i))i.isRenderTargetTexture?(d2(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i))if(o6(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice();else t[n][r]=i}}return t}function a6(e){let t={};for(let n=0;n<e.length;n++){let r=i6(e[n]);for(let e in r)t[e]=r[e]}return t}function o6(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function fle(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function s6(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:j2.workingColorSpace}var ple={clone:i6,merge:a6},mle=`void main() {
135
+ `},{className:`string`,begin:`\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z`},{className:`string`,begin:`(\\+|-)\\d+`},{className:`keyword`,relevance:10,variants:[{begin:`^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?`},{begin:`^progress(:?)(\\s+)?(pop|push)?`},{begin:`^tags:`},{begin:`^time:`}]}]}}t.exports=n})),yQ=n(((e,t)=>{function n(e){return e?typeof e==`string`?e:e.source:null}function r(e){return i(`(?=`,e,`)`)}function i(...e){return e.map(e=>n(e)).join(``)}function a(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function o(...e){return`(`+(a(e).capture?``:`?:`)+e.map(e=>n(e)).join(`|`)+`)`}var s=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),c=[`Protocol`,`Type`].map(s),l=[`init`,`self`].map(s),u=[`Any`,`Self`],d=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],f=[`false`,`nil`,`true`],p=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],m=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],h=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),g=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_=o(g,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),v=i(g,_,`*`),y=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),b=o(y,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),x=i(y,b,`*`),S=i(/[A-Z]/,b,`*`),C=[`attached`,`autoclosure`,i(/convention\(/,o(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,i(/objc\(/,x,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],w=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function T(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),a=[e.C_LINE_COMMENT_MODE,n],g={match:[/\./,o(...c,...l)],className:{2:`keyword`}},y={match:i(/\./,o(...d)),relevance:0},T=d.filter(e=>typeof e==`string`).concat([`_|0`]),E={variants:[{className:`keyword`,match:o(...d.filter(e=>typeof e!=`string`).concat(u).map(s),...l)}]},D={$pattern:o(/\b\w+/,/#\w+/),keyword:T.concat(m),literal:f},O=[g,y,E],k=[{match:i(/\./,o(...h)),relevance:0},{className:`built_in`,match:i(/\b/,o(...h),/(?=\()/)}],A={match:/->/,relevance:0},j=[A,{className:`operator`,relevance:0,variants:[{match:v},{match:`\\.(\\.|${_})+`}]}],M=`([0-9]_*)+`,N=`([0-9a-fA-F]_*)+`,P={className:`number`,relevance:0,variants:[{match:`\\b(${M})(\\.(${M}))?([eE][+-]?(${M}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${M}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},F=(e=``)=>({className:`subst`,variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),I=(e=``)=>({className:`subst`,match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),ee=(e=``)=>({className:`subst`,label:`interpol`,begin:i(/\\/,e,/\(/),end:/\)/}),te=(e=``)=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[F(e),I(e),ee(e)]}),L=(e=``)=>({begin:i(e,/"/),end:i(/"/,e),contains:[F(e),ee(e)]}),ne={className:`string`,variants:[te(),te(`#`),te(`##`),te(`###`),L(),L(`#`),L(`##`),L(`###`)]},R=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:R},B=e=>{let t=i(e,/\//),n=i(/\//,e);return{begin:t,end:n,contains:[...R,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},re={scope:`regexp`,variants:[B(`###`),B(`##`),B(`#`),z]},V={match:i(/`/,x,/`/)},ie=[V,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${b}+`}],ae=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:w,contains:[...j,P,ne]}]}},{scope:`keyword`,match:i(/@/,o(...C),r(o(/\(/,/\s+/)))},{scope:`meta`,match:i(/@/,x)}],oe={match:r(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,b,`+`)},{className:`type`,match:S,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,r(S)),relevance:0}]},se={begin:/</,end:/>/,keywords:D,contains:[...a,...O,...ae,A,oe]};oe.contains.push(se);let ce={begin:/\(/,end:/\)/,relevance:0,keywords:D,contains:[`self`,{match:i(x,/\s*:/),keywords:`_|0`,relevance:0},...a,re,...O,...k,...j,P,ne,...ie,...ae,oe]},le={begin:/</,end:/>/,keywords:`repeat each`,contains:[...a,oe]},ue={begin:/\(/,end:/\)/,keywords:D,contains:[{begin:o(r(i(x,/\s*:/)),r(i(x,/\s+/,x,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:x}]},...a,...O,...j,P,ne,...ae,oe,ce],endsParent:!0,illegal:/["']/},de={match:[/(func|macro)/,/\s+/,o(V.match,x,v)],className:{1:`keyword`,3:`title.function`},contains:[le,ue,t],illegal:[/\[/,/%/]},fe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[le,ue,t],illegal:/\[|%/},H={match:[/operator/,/\s+/,v],className:{1:`keyword`,3:`title`}},pe={begin:[/precedencegroup/,/\s+/,S],className:{1:`keyword`,3:`title`},contains:[oe],keywords:[...p,...f],end:/}/},me={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},he={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},U={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,x,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:D,contains:[le,...O,{begin:/:/,end:/\{/,keywords:D,contains:[{scope:`title.class.inherited`,match:S},...O],relevance:0}]};for(let e of ne.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=D;let n=[...O,...k,...j,P,ne,...ie];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:D,contains:[...a,de,fe,me,he,U,H,pe,{beginKeywords:`import`,end:/$/,contains:[...a],relevance:0},re,...O,...k,...j,P,ne,...ie,...ae,oe,ce]}}t.exports=T})),bQ=n(((e,t)=>{function n(e){return{name:`Tagger Script`,contains:[{className:`comment`,begin:/\$noop\(/,end:/\)/,contains:[{begin:/\\[()]/},{begin:/\(/,end:/\)/,contains:[{begin:/\\[()]/},`self`]}],relevance:10},{className:`keyword`,begin:/\$[_a-zA-Z0-9]+(?=\()/},{className:`variable`,begin:/%[_a-zA-Z0-9:]+%/},{className:`symbol`,begin:/\\[\\nt$%,()]/},{className:`symbol`,begin:/\\u[a-fA-F0-9]{4}/}]}}t.exports=n})),xQ=n(((e,t)=>{function n(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}t.exports=n})),SQ=n(((e,t)=>{function n(e){return{name:`Test Anything Protocol`,case_insensitive:!0,contains:[e.HASH_COMMENT_MODE,{className:`meta`,variants:[{begin:`^TAP version (\\d+)$`},{begin:`^1\\.\\.(\\d+)$`}]},{begin:/---$/,end:`\\.\\.\\.$`,subLanguage:`yaml`,relevance:0},{className:`number`,begin:` (\\d+) `},{className:`symbol`,variants:[{begin:`^ok`},{begin:`^not ok`}]}]}}t.exports=n})),CQ=n(((e,t)=>{function n(e){let t=e.regex,n=/[a-zA-Z_][a-zA-Z0-9_]*/,r={className:`number`,variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]};return{name:`Tcl`,aliases:[`tk`],keywords:`after.append.apply.array.auto_execok.auto_import.auto_load.auto_mkindex.auto_mkindex_old.auto_qualify.auto_reset.bgerror.binary.break.catch.cd.chan.clock.close.concat.continue.dde.dict.encoding.eof.error.eval.exec.exit.expr.fblocked.fconfigure.fcopy.file.fileevent.filename.flush.for.foreach.format.gets.glob.global.history.http.if.incr.info.interp.join.lappend|10.lassign|10.lindex|10.linsert|10.list.llength|10.load.lrange|10.lrepeat|10.lreplace|10.lreverse|10.lsearch|10.lset|10.lsort|10.mathfunc.mathop.memory.msgcat.namespace.open.package.parray.pid.pkg::create.pkg_mkIndex.platform.platform::shell.proc.puts.pwd.read.refchan.regexp.registry.regsub|10.rename.return.safe.scan.seek.set.socket.source.split.string.subst.switch.tcl_endOfWord.tcl_findLibrary.tcl_startOfNextWord.tcl_startOfPreviousWord.tcl_wordBreakAfter.tcl_wordBreakBefore.tcltest.tclvars.tell.time.tm.trace.unknown.unload.unset.update.uplevel.upvar.variable.vwait.while`.split(`.`),contains:[e.COMMENT(`;[ \\t]*#`,`$`),e.COMMENT(`^[ \\t]*#`,`$`),{beginKeywords:`proc`,end:`[\\{]`,excludeEnd:!0,contains:[{className:`title`,begin:`[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*`,end:`[ \\t\\n\\r]`,endsWithParent:!0,excludeEnd:!0}]},{className:`variable`,variants:[{begin:t.concat(/\$/,t.optional(/::/),n,`(::`,n,`)*`)},{begin:`\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*`,end:`\\}`,contains:[r]}]},{className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},r]}}t.exports=n})),wQ=n(((e,t)=>{function n(e){let t=[`bool`,`byte`,`i16`,`i32`,`i64`,`double`,`string`,`binary`];return{name:`Thrift`,keywords:{keyword:[`namespace`,`const`,`typedef`,`struct`,`enum`,`service`,`exception`,`void`,`oneway`,`set`,`list`,`map`,`required`,`optional`],type:t,literal:`true false`},contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`class`,beginKeywords:`struct enum service exception`,end:/\{/,illegal:/\n/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{begin:`\\b(set|list|map)\\s*<`,keywords:{type:[...t,`set`,`list`,`map`]},end:`>`,contains:[`self`]}]}}t.exports=n})),TQ=n(((e,t)=>{function n(e){let t={className:`number`,begin:`[1-9][0-9]*`,relevance:0},n={className:`symbol`,begin:`:[^\\]]+`};return{name:`TP`,keywords:{keyword:`ABORT.ACC.ADJUST.AND.AP_LD.BREAK.CALL.CNT.COL.CONDITION.CONFIG.DA.DB.DIV.DETECT.ELSE.END.ENDFOR.ERR_NUM.ERROR_PROG.FINE.FOR.GP.GUARD.INC.IF.JMP.LINEAR_MAX_SPEED.LOCK.MOD.MONITOR.OFFSET.Offset.OR.OVERRIDE.PAUSE.PREG.PTH.RT_LD.RUN.SELECT.SKIP.Skip.TA.TB.TO.TOOL_OFFSET.Tool_Offset.UF.UT.UFRAME_NUM.UTOOL_NUM.UNLOCK.WAIT.X.Y.Z.W.P.R.STRLEN.SUBSTR.FINDSTR.VOFFSET.PROG.ATTR.MN.POS`.split(`.`),literal:[`ON`,`OFF`,`max_speed`,`LPOS`,`JPOS`,`ENABLE`,`DISABLE`,`START`,`STOP`,`RESET`]},contains:[{className:`built_in`,begin:`(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER|TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[`,end:`\\]`,contains:[`self`,t,n]},{className:`built_in`,begin:`(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[`,end:`\\]`,contains:[`self`,t,e.QUOTE_STRING_MODE,n]},{className:`keyword`,begin:`/(PROG|ATTR|MN|POS|END)\\b`},{className:`keyword`,begin:`(CALL|RUN|POINT_LOGIC|LBL)\\b`},{className:`keyword`,begin:`\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)`},{className:`number`,begin:`\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b`,relevance:0},e.COMMENT(`//`,`[;$]`),e.COMMENT(`!`,`[;$]`),e.COMMENT(`--eg:`,`$`),e.QUOTE_STRING_MODE,{className:`string`,begin:`'`,end:`'`},e.C_NUMBER_MODE,{className:`variable`,begin:`\\$[A-Za-z0-9_]+`}]}}t.exports=n})),EQ=n(((e,t)=>{function n(e){let t=e.regex,n=`absolute_url.asset|0.asset_version.attribute.block.constant.controller|0.country_timezones.csrf_token.cycle.date.dump.expression.form|0.form_end.form_errors.form_help.form_label.form_rest.form_row.form_start.form_widget.html_classes.include.is_granted.logout_path.logout_url.max.min.parent.path|0.random.range.relative_path.render.render_esi.source.template_from_string.url|0`.split(`.`),r=`abs.abbr_class.abbr_method.batch.capitalize.column.convert_encoding.country_name.currency_name.currency_symbol.data_uri.date.date_modify.default.escape.file_excerpt.file_link.file_relative.filter.first.format.format_args.format_args_as_text.format_currency.format_date.format_datetime.format_file.format_file_from_text.format_number.format_time.html_to_markdown.humanize.inky_to_html.inline_css.join.json_encode.keys.language_name.last.length.locale_name.lower.map.markdown.markdown_to_html.merge.nl2br.number_format.raw.reduce.replace.reverse.round.slice.slug.sort.spaceless.split.striptags.timezone_name.title.trans.transchoice.trim.u|0.upper.url_encode.yaml_dump.yaml_encode`.split(`.`),i=`apply.autoescape.block.cache.deprecated.do.embed.extends.filter.flush.for.form_theme.from.if.import.include.macro.sandbox.set.stopwatch.trans.trans_default_domain.transchoice.use.verbatim.with`.split(`.`);i=i.concat(i.map(e=>`end${e}`));let a={scope:`string`,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},o={scope:`number`,match:/\d+/},s={begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,contains:[a,o]},c={beginKeywords:n.join(` `),keywords:{name:n},relevance:0,contains:[s]},l={match:/\|(?=[A-Za-z_]+:?)/,beginScope:`punctuation`,relevance:0,contains:[{match:/[A-Za-z_]+:?/,keywords:r}]},u=(e,{relevance:n})=>({beginScope:{1:`template-tag`,3:`name`},relevance:n||2,endScope:`template-tag`,begin:[/\{%/,/\s*/,t.either(...e)],end:/%\}/,keywords:`in`,contains:[l,c,a,o]}),d=/[a-z_]+/,f=u(i,{relevance:2}),p=u([d],{relevance:1});return{name:`Twig`,aliases:[`craftcms`],case_insensitive:!0,subLanguage:`xml`,contains:[e.COMMENT(/\{#/,/#\}/),f,p,{className:`template-variable`,begin:/\{\{/,end:/\}\}/,contains:[`self`,l,c,a,o]}]}}t.exports=n})),DQ=n(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},d=n,f={begin:`<>`,end:`</>`},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);if(i=a.match(/^\s*=/)){t.ignoreMatch();return}if((i=a.match(/^\s+extends\s+/))&&i.index===0){t.ignoreMatch();return}}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:d+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},ee={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},te={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},L=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,ne={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(L)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},ne,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:L,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},ee,{match:`\\$`+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,te,{match:/\$[(.]/}]}}function d(e){let t=e.regex,a=u(e),o=n,s=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},f={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:s},contains:[a.exports.CLASS_REFERENCE]},p={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},m={$pattern:n,keyword:r.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:i,built_in:l.concat(s),"variable.language":c},h={className:`meta`,begin:`@`+o},g=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(a.keywords,m),a.exports.PARAMS_CONTAINS.push(h);let _=a.contains.find(e=>e.scope===`attr`),v=Object.assign({},_,{match:t.concat(o,t.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,_,v]),a.contains=a.contains.concat([h,d,f,v]),g(a,`shebang`,e.SHEBANG()),g(a,`use_strict`,p);let y=a.contains.find(e=>e.label===`func.def`);return y.relevance=0,Object.assign(a,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),a}t.exports=d})),OQ=n(((e,t)=>{function n(e){return{name:`Vala`,keywords:{keyword:`char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override virtual delegate if while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var`,built_in:`DBus GLib CCode Gee Object Gtk Posix`,literal:`false true null`},contains:[{className:`class`,beginKeywords:`class interface namespace`,end:/\{/,excludeEnd:!0,illegal:`[^,:\\n\\s\\.]`,contains:[e.UNDERSCORE_TITLE_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,begin:`"""`,end:`"""`,relevance:5},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_NUMBER_MODE,{className:`meta`,begin:`^#`,end:`$`}]}}t.exports=n})),kQ=n(((e,t)=>{function n(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}t.exports=n})),AQ=n(((e,t)=>{function n(e){let t=e.regex,n=`lcase.month.vartype.instrrev.ubound.setlocale.getobject.rgb.getref.string.weekdayname.rnd.dateadd.monthname.now.day.minute.isarray.cbool.round.formatcurrency.conversions.csng.timevalue.second.year.space.abs.clng.timeserial.fixs.len.asc.isempty.maths.dateserial.atn.timer.isobject.filter.weekday.datevalue.ccur.isdate.instr.datediff.formatdatetime.replace.isnull.right.sgn.array.snumeric.log.cdbl.hex.chr.lbound.msgbox.ucase.getlocale.cos.cdate.cbyte.rtrim.join.hour.oct.typename.trim.strcomp.int.createobject.loadpicture.tan.formatnumber.mid.split.cint.sin.datepart.ltrim.sqr.time.derived.eval.date.formatpercent.exp.inputbox.left.ascw.chrw.regexp.cstr.err`.split(`.`),r=[`server`,`response`,`request`,`scriptengine`,`scriptenginebuildversion`,`scriptengineminorversion`,`scriptenginemajorversion`],i={begin:t.concat(t.either(...n),`\\s*\\(`),relevance:0,keywords:{built_in:n}};return{name:`VBScript`,aliases:[`vbs`],case_insensitive:!0,keywords:{keyword:`call.class.const.dim.do.loop.erase.execute.executeglobal.exit.for.each.next.function.if.then.else.on.error.option.explicit.new.private.property.let.get.public.randomize.redim.rem.select.case.set.stop.sub.while.wend.with.end.to.elseif.is.or.xor.and.not.class_initialize.class_terminate.default.preserve.in.me.byval.byref.step.resume.goto`.split(`.`),built_in:r,literal:[`true`,`false`,`null`,`nothing`,`empty`]},illegal:`//`,contains:[i,e.inherit(e.QUOTE_STRING_MODE,{contains:[{begin:`""`}]}),e.COMMENT(/'/,/$/,{relevance:0}),e.C_NUMBER_MODE]}}t.exports=n})),jQ=n(((e,t)=>{function n(e){return{name:`VBScript in HTML`,subLanguage:`xml`,contains:[{begin:`<%`,end:`%>`,subLanguage:`vbscript`}]}}t.exports=n})),MQ=n(((e,t)=>{function n(e){let t=e.regex,n={$pattern:/\$?[\w]+(\$[\w]+)*/,keyword:`accept_on.alias.always.always_comb.always_ff.always_latch.and.assert.assign.assume.automatic.before.begin.bind.bins.binsof.bit.break.buf|0.bufif0.bufif1.byte.case.casex.casez.cell.chandle.checker.class.clocking.cmos.config.const.constraint.context.continue.cover.covergroup.coverpoint.cross.deassign.default.defparam.design.disable.dist.do.edge.else.end.endcase.endchecker.endclass.endclocking.endconfig.endfunction.endgenerate.endgroup.endinterface.endmodule.endpackage.endprimitive.endprogram.endproperty.endspecify.endsequence.endtable.endtask.enum.event.eventually.expect.export.extends.extern.final.first_match.for.force.foreach.forever.fork.forkjoin.function.generate|5.genvar.global.highz0.highz1.if.iff.ifnone.ignore_bins.illegal_bins.implements.implies.import.incdir.include.initial.inout.input.inside.instance.int.integer.interconnect.interface.intersect.join.join_any.join_none.large.let.liblist.library.local.localparam.logic.longint.macromodule.matches.medium.modport.module.nand.negedge.nettype.new.nexttime.nmos.nor.noshowcancelled.not.notif0.notif1.or.output.package.packed.parameter.pmos.posedge.primitive.priority.program.property.protected.pull0.pull1.pulldown.pullup.pulsestyle_ondetect.pulsestyle_onevent.pure.rand.randc.randcase.randsequence.rcmos.real.realtime.ref.reg.reject_on.release.repeat.restrict.return.rnmos.rpmos.rtran.rtranif0.rtranif1.s_always.s_eventually.s_nexttime.s_until.s_until_with.scalared.sequence.shortint.shortreal.showcancelled.signed.small.soft.solve.specify.specparam.static.string.strong.strong0.strong1.struct.super.supply0.supply1.sync_accept_on.sync_reject_on.table.tagged.task.this.throughout.time.timeprecision.timeunit.tran.tranif0.tranif1.tri.tri0.tri1.triand.trior.trireg.type.typedef.union.unique.unique0.unsigned.until.until_with.untyped.use.uwire.var.vectored.virtual.void.wait.wait_order.wand.weak.weak0.weak1.while.wildcard.wire.with.within.wor.xnor.xor`.split(`.`),literal:[`null`],built_in:`$finish.$stop.$exit.$fatal.$error.$warning.$info.$realtime.$time.$printtimescale.$bitstoreal.$bitstoshortreal.$itor.$signed.$cast.$bits.$stime.$timeformat.$realtobits.$shortrealtobits.$rtoi.$unsigned.$asserton.$assertkill.$assertpasson.$assertfailon.$assertnonvacuouson.$assertoff.$assertcontrol.$assertpassoff.$assertfailoff.$assertvacuousoff.$isunbounded.$sampled.$fell.$changed.$past_gclk.$fell_gclk.$changed_gclk.$rising_gclk.$steady_gclk.$coverage_control.$coverage_get.$coverage_save.$set_coverage_db_name.$rose.$stable.$past.$rose_gclk.$stable_gclk.$future_gclk.$falling_gclk.$changing_gclk.$display.$coverage_get_max.$coverage_merge.$get_coverage.$load_coverage_db.$typename.$unpacked_dimensions.$left.$low.$increment.$clog2.$ln.$log10.$exp.$sqrt.$pow.$floor.$ceil.$sin.$cos.$tan.$countbits.$onehot.$isunknown.$fatal.$warning.$dimensions.$right.$high.$size.$asin.$acos.$atan.$atan2.$hypot.$sinh.$cosh.$tanh.$asinh.$acosh.$atanh.$countones.$onehot0.$error.$info.$random.$dist_chi_square.$dist_erlang.$dist_exponential.$dist_normal.$dist_poisson.$dist_t.$dist_uniform.$q_initialize.$q_remove.$q_exam.$async$and$array.$async$nand$array.$async$or$array.$async$nor$array.$sync$and$array.$sync$nand$array.$sync$or$array.$sync$nor$array.$q_add.$q_full.$psprintf.$async$and$plane.$async$nand$plane.$async$or$plane.$async$nor$plane.$sync$and$plane.$sync$nand$plane.$sync$or$plane.$sync$nor$plane.$system.$display.$displayb.$displayh.$displayo.$strobe.$strobeb.$strobeh.$strobeo.$write.$readmemb.$readmemh.$writememh.$value$plusargs.$dumpvars.$dumpon.$dumplimit.$dumpports.$dumpportson.$dumpportslimit.$writeb.$writeh.$writeo.$monitor.$monitorb.$monitorh.$monitoro.$writememb.$dumpfile.$dumpoff.$dumpall.$dumpflush.$dumpportsoff.$dumpportsall.$dumpportsflush.$fclose.$fdisplay.$fdisplayb.$fdisplayh.$fdisplayo.$fstrobe.$fstrobeb.$fstrobeh.$fstrobeo.$swrite.$swriteb.$swriteh.$swriteo.$fscanf.$fread.$fseek.$fflush.$feof.$fopen.$fwrite.$fwriteb.$fwriteh.$fwriteo.$fmonitor.$fmonitorb.$fmonitorh.$fmonitoro.$sformat.$sformatf.$fgetc.$ungetc.$fgets.$sscanf.$rewind.$ftell.$ferror`.split(`.`)},r=[`__FILE__`,`__LINE__`],i=`begin_keywords.celldefine.default_nettype.default_decay_time.default_trireg_strength.define.delay_mode_distributed.delay_mode_path.delay_mode_unit.delay_mode_zero.else.elsif.end_keywords.endcelldefine.endif.ifdef.ifndef.include.line.nounconnected_drive.pragma.resetall.timescale.unconnected_drive.undef.undefineall`.split(`.`);return{name:`Verilog`,aliases:[`v`,`sv`,`svh`],case_insensitive:!1,keywords:n,contains:[e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.QUOTE_STRING_MODE,{scope:`number`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/\b((\d+'([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\B(('([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\b[0-9][0-9_]*/,relevance:0}]},{scope:`variable`,variants:[{begin:`#\\((?!parameter).+\\)`},{begin:`\\.\\w+`,relevance:0}]},{scope:`variable.constant`,match:t.concat(/`/,t.either(...r))},{scope:`meta`,begin:t.concat(/`/,t.either(...i)),end:/$|\/\/|\/\*/,returnEnd:!0,keywords:i}]}}t.exports=n})),NQ=n(((e,t)=>{function n(e){let t=`\\d(_|\\d)*`;return``+t,t+``,t+``,{name:`VHDL`,case_insensitive:!0,keywords:{keyword:`abs.access.after.alias.all.and.architecture.array.assert.assume.assume_guarantee.attribute.begin.block.body.buffer.bus.case.component.configuration.constant.context.cover.disconnect.downto.default.else.elsif.end.entity.exit.fairness.file.for.force.function.generate.generic.group.guarded.if.impure.in.inertial.inout.is.label.library.linkage.literal.loop.map.mod.nand.new.next.nor.not.null.of.on.open.or.others.out.package.parameter.port.postponed.procedure.process.property.protected.pure.range.record.register.reject.release.rem.report.restrict.restrict_guarantee.return.rol.ror.select.sequence.severity.shared.signal.sla.sll.sra.srl.strong.subtype.then.to.transport.type.unaffected.units.until.use.variable.view.vmode.vprop.vunit.wait.when.while.with.xnor.xor`.split(`.`),built_in:`boolean.bit.character.integer.time.delay_length.natural.positive.string.bit_vector.file_open_kind.file_open_status.std_logic.std_logic_vector.unsigned.signed.boolean_vector.integer_vector.std_ulogic.std_ulogic_vector.unresolved_unsigned.u_unsigned.unresolved_signed.u_signed.real_vector.time_vector`.split(`.`),literal:[`false`,`true`,`note`,`warning`,`error`,`failure`,`line`,`text`,`side`,`width`]},illegal:/\{/,contains:[e.C_BLOCK_COMMENT_MODE,e.COMMENT(`--`,`$`),e.QUOTE_STRING_MODE,{className:`number`,begin:`\\b(\\d(_|\\d)*#\\w+(\\.\\w+)?#([eE][-+]?\\d(_|\\d)*)?|\\d(_|\\d)*(\\.\\d(_|\\d)*)?([eE][-+]?\\d(_|\\d)*)?)`,relevance:0},{className:`string`,begin:`'(U|X|0|1|Z|W|L|H|-)'`,contains:[e.BACKSLASH_ESCAPE]},{className:`symbol`,begin:`'[A-Za-z](_?[A-Za-z0-9])*`,contains:[e.BACKSLASH_ESCAPE]}]}}t.exports=n})),PQ=n(((e,t)=>{function n(e){return{name:`Vim Script`,keywords:{$pattern:/[!#@\w]+/,keyword:`N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank`,built_in:`synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv complete_check add getwinposx getqflist getwinposy screencol clearmatches empty extend getcmdpos mzeval garbagecollect setreg ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable shiftwidth max sinh isdirectory synID system inputrestore winline atan visualmode inputlist tabpagewinnr round getregtype mapcheck hasmapto histdel argidx findfile sha256 exists toupper getcmdline taglist string getmatches bufnr strftime winwidth bufexists strtrans tabpagebuflist setcmdpos remote_read printf setloclist getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval resolve libcallnr foldclosedend reverse filter has_key bufname str2float strlen setline getcharmod setbufvar index searchpos shellescape undofile foldclosed setqflist buflisted strchars str2nr virtcol floor remove undotree remote_expr winheight gettabwinvar reltime cursor tabpagenr finddir localtime acos getloclist search tanh matchend rename gettabvar strdisplaywidth type abs py3eval setwinvar tolower wildmenumode log10 spellsuggest bufloaded synconcealed nextnonblank server2client complete settabwinvar executable input wincol setmatches getftype hlID inputsave searchpair or screenrow line settabvar histadd deepcopy strpart remote_peek and eval getftime submatch screenchar winsaveview matchadd mkdir screenattr getfontname libcall reltimestr getfsize winnr invert pow getbufline byte2line soundfold repeat fnameescape tagfiles sin strwidth spellbadword trunc maparg log lispindent hostname setpos globpath remote_foreground getchar synIDattr fnamemodify cscope_connection stridx winbufnr indent min complete_add nr2char searchpairpos inputdialog values matchlist items hlexists strridx browsedir expand fmod pathshorten line2byte argc count getwinvar glob foldtextresult getreg foreground cosh matchdelete has char2nr simplify histget searchdecl iconv winrestcmd pumvisible writefile foldlevel haslocaldir keys cos matchstr foldtext histnr tan tempname getcwd byteidx getbufvar islocked escape eventhandler remote_send serverlist winrestview synstack pyeval prevnonblank readfile cindent filereadable changenr exp`},illegal:/;/,contains:[e.NUMBER_MODE,{className:`string`,begin:`'`,end:`'`,illegal:`\\n`},{className:`string`,begin:/"(\\"|\n\\|[^"\n])*"/},e.COMMENT(`"`,`$`),{className:`variable`,begin:/[bwtglsav]:[\w\d_]+/},{begin:[/\b(?:function|function!)/,/\s+/,e.IDENT_RE],className:{1:`keyword`,3:`title`},end:`$`,relevance:0,contains:[{className:`params`,begin:`\\(`,end:`\\)`}]},{className:`symbol`,begin:/<[\w-]+>/}]}}t.exports=n})),FQ=n(((e,t)=>{function n(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}t.exports=n})),IQ=n(((e,t)=>{function n(e){let t=e.regex,n=/[a-zA-Z]\w*/,r=[`as`,`break`,`class`,`construct`,`continue`,`else`,`for`,`foreign`,`if`,`import`,`in`,`is`,`return`,`static`,`var`,`while`],i=[`true`,`false`,`null`],a=[`this`,`super`],o=[`Bool`,`Class`,`Fiber`,`Fn`,`List`,`Map`,`Null`,`Num`,`Object`,`Range`,`Sequence`,`String`,`System`],s=[`-`,`~`,/\*/,`%`,/\.\.\./,/\.\./,/\+/,`<<`,`>>`,`>=`,`<=`,`<`,`>`,/\^/,/!=/,/!/,/\bis\b/,`==`,`&&`,`&`,/\|\|/,/\|/,/\?:/,`=`],c={relevance:0,match:t.concat(/\b(?!(if|while|for|else|super)\b)/,n,/(?=\s*[({])/),className:`title.function`},l={match:t.concat(t.either(t.concat(/\b(?!(if|while|for|else|super)\b)/,n),t.either(...s)),/(?=\s*\([^)]+\)\s*\{)/),className:`title.function`,starts:{contains:[{begin:/\(/,end:/\)/,contains:[{relevance:0,scope:`params`,match:n}]}]}},u={variants:[{match:[/class\s+/,n,/\s+is\s+/,n]},{match:[/class\s+/,n]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:r},d={relevance:0,match:t.either(...s),className:`operator`},f={className:`string`,begin:/"""/,end:/"""/},p={className:`property`,begin:t.concat(/\./,t.lookahead(n)),end:n,excludeBegin:!0,relevance:0},m={relevance:0,match:t.concat(/\b_/,n),scope:`variable`},h={relevance:0,match:/\b[A-Z]+[a-z]+([A-Z]+[a-z]+)*/,scope:`title.class`,keywords:{_:o}},g=e.C_NUMBER_MODE,_={match:[n,/\s*/,/=/,/\s*/,/\(/,n,/\)\s*\{/],scope:{1:`title.function`,3:`operator`,6:`params`}},v=e.COMMENT(/\/\*\*/,/\*\//,{contains:[{match:/@[a-z]+/,scope:`doctag`},`self`]}),y={scope:`subst`,begin:/%\(/,end:/\)/,contains:[g,h,c,m,d]},b={scope:`string`,begin:/"/,end:/"/,contains:[y,{scope:`char.escape`,variants:[{match:/\\\\|\\["0%abefnrtv]/},{match:/\\x[0-9A-F]{2}/},{match:/\\u[0-9A-F]{4}/},{match:/\\U[0-9A-F]{8}/}]}]};y.contains.push(b);let x=[...r,...a,...i],S={relevance:0,match:t.concat(`\\b(?!`,x.join(`|`),`\\b)`,/[a-zA-Z_]\w*(?:[?!]|\b)/),className:`variable`};return{name:`Wren`,keywords:{keyword:r,"variable.language":a,literal:i},contains:[{scope:`comment`,variants:[{begin:[/#!?/,/[A-Za-z_]+(?=\()/],beginScope:{},keywords:{literal:i},contains:[],end:/\)/},{begin:[/#!?/,/[A-Za-z_]+/],beginScope:{},end:/$/}]},g,b,f,v,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,u,_,l,c,d,m,p,S]}}t.exports=n})),LQ=n(((e,t)=>{function n(e){return{name:`Intel x86 Assembly`,case_insensitive:!0,keywords:{$pattern:`[.%]?`+e.IDENT_RE,keyword:`lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63`,built_in:`ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr`,meta:`%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__`},contains:[e.COMMENT(`;`,`$`,{relevance:0}),{className:`number`,variants:[{begin:`\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b`,relevance:0},{begin:`\\$[0-9][0-9A-Fa-f]*`,relevance:0},{begin:`\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b`},{begin:`\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b`}]},e.QUOTE_STRING_MODE,{className:`string`,variants:[{begin:`'`,end:`[^\\\\]'`},{begin:"`",end:"[^\\\\]`"}],relevance:0},{className:`symbol`,variants:[{begin:`^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)`},{begin:`^\\s*%%[A-Za-z0-9_$#@~.?]*:`}],relevance:0},{className:`subst`,begin:`%[0-9]+`,relevance:0},{className:`subst`,begin:`%!S+`,relevance:0},{className:`meta`,begin:/^\s*\.[\w_-]+/}]}}t.exports=n})),RQ=n(((e,t)=>{function n(e){let t={$pattern:/[a-zA-Z][a-zA-Z0-9_?]*/,keyword:`if.then.else.do.while.until.for.loop.import.with.is.as.where.when.by.data.constant.integer.real.text.name.boolean.symbol.infix.prefix.postfix.block.tree`.split(`.`),literal:[`true`,`false`,`nil`],built_in:`in.mod.rem.and.or.xor.not.abs.sign.floor.ceil.sqrt.sin.cos.tan.asin.acos.atan.exp.expm1.log.log2.log10.log1p.pi.at.text_length.text_range.text_find.text_replace.contains.page.slide.basic_slide.title_slide.title.subtitle.fade_in.fade_out.fade_at.clear_color.color.line_color.line_width.texture_wrap.texture_transform.texture.scale_?x.scale_?y.scale_?z?.translate_?x.translate_?y.translate_?z?.rotate_?x.rotate_?y.rotate_?z?.rectangle.circle.ellipse.sphere.path.line_to.move_to.quad_to.curve_to.theme.background.contents.locally.time.mouse_?x.mouse_?y.mouse_buttons`.split(`.`).concat([`ObjectLoader`,`Animate`,`MovieCredits`,`Slides`,`Filters`,`Shading`,`Materials`,`LensFlare`,`Mapping`,`VLCAudioVideo`,`StereoDecoder`,`PointCloud`,`NetworkAccess`,`RemoteControl`,`RegExp`,`ChromaKey`,`Snowfall`,`NodeJS`,`Speech`,`Charts`])},n={className:`string`,begin:`"`,end:`"`,illegal:`\\n`},r={className:`string`,begin:`'`,end:`'`,illegal:`\\n`},i={className:`string`,begin:`<<`,end:`>>`},a={className:`number`,begin:`[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?`},o={beginKeywords:`import`,end:`$`,keywords:t,contains:[n]},s={className:`function`,begin:/[a-z][^\n]*->/,returnBegin:!0,end:/->/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,keywords:t}})]};return{name:`XL`,aliases:[`tao`],keywords:t,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n,r,i,s,o,a,e.NUMBER_MODE]}}t.exports=n})),zQ=n(((e,t)=>{function n(e){return{name:`XQuery`,aliases:[`xpath`,`xq`,`xqm`],case_insensitive:!1,illegal:/(proc)|(abstract)|(extends)|(until)|(#)/,keywords:{$pattern:/[a-zA-Z$][a-zA-Z0-9_:-]*/,keyword:`module.schema.namespace.boundary-space.preserve.no-preserve.strip.default.collation.base-uri.ordering.context.decimal-format.decimal-separator.copy-namespaces.empty-sequence.except.exponent-separator.external.grouping-separator.inherit.no-inherit.lax.minus-sign.per-mille.percent.schema-attribute.schema-element.strict.unordered.zero-digit.declare.import.option.function.validate.variable.for.at.in.let.where.order.group.by.return.if.then.else.tumbling.sliding.window.start.when.only.end.previous.next.stable.ascending.descending.allowing.empty.greatest.least.some.every.satisfies.switch.case.typeswitch.try.catch.and.or.to.union.intersect.instance.of.treat.as.castable.cast.map.array.delete.insert.into.replace.value.rename.copy.modify.update`.split(`.`),type:`item.document-node.node.attribute.document.element.comment.namespace.namespace-node.processing-instruction.text.construction.xs:anyAtomicType.xs:untypedAtomic.xs:duration.xs:time.xs:decimal.xs:float.xs:double.xs:gYearMonth.xs:gYear.xs:gMonthDay.xs:gMonth.xs:gDay.xs:boolean.xs:base64Binary.xs:hexBinary.xs:anyURI.xs:QName.xs:NOTATION.xs:dateTime.xs:dateTimeStamp.xs:date.xs:string.xs:normalizedString.xs:token.xs:language.xs:NMTOKEN.xs:Name.xs:NCName.xs:ID.xs:IDREF.xs:ENTITY.xs:integer.xs:nonPositiveInteger.xs:negativeInteger.xs:long.xs:int.xs:short.xs:byte.xs:nonNegativeInteger.xs:unisignedLong.xs:unsignedInt.xs:unsignedShort.xs:unsignedByte.xs:positiveInteger.xs:yearMonthDuration.xs:dayTimeDuration`.split(`.`),literal:[`eq`,`ne`,`lt`,`le`,`gt`,`ge`,`is`,`self::`,`child::`,`descendant::`,`descendant-or-self::`,`attribute::`,`following::`,`following-sibling::`,`parent::`,`ancestor::`,`ancestor-or-self::`,`preceding::`,`preceding-sibling::`,`NaN`]},contains:[{className:`variable`,begin:/[$][\w\-:]+/},{className:`built_in`,variants:[{begin:/\barray:/,end:/(?:append|filter|flatten|fold-(?:left|right)|for-each(?:-pair)?|get|head|insert-before|join|put|remove|reverse|size|sort|subarray|tail)\b/},{begin:/\bmap:/,end:/(?:contains|entry|find|for-each|get|keys|merge|put|remove|size)\b/},{begin:/\bmath:/,end:/(?:a(?:cos|sin|tan[2]?)|cos|exp(?:10)?|log(?:10)?|pi|pow|sin|sqrt|tan)\b/},{begin:/\bop:/,end:/\(/,excludeEnd:!0},{begin:/\bfn:/,end:/\(/,excludeEnd:!0},{begin:/[^</$:'"-]\b(?:abs|accumulator-(?:after|before)|adjust-(?:date(?:Time)?|time)-to-timezone|analyze-string|apply|available-(?:environment-variables|system-properties)|avg|base-uri|boolean|ceiling|codepoints?-(?:equal|to-string)|collation-key|collection|compare|concat|contains(?:-token)?|copy-of|count|current(?:-)?(?:date(?:Time)?|time|group(?:ing-key)?|output-uri|merge-(?:group|key))?data|dateTime|days?-from-(?:date(?:Time)?|duration)|deep-equal|default-(?:collation|language)|distinct-values|document(?:-uri)?|doc(?:-available)?|element-(?:available|with-id)|empty|encode-for-uri|ends-with|environment-variable|error|escape-html-uri|exactly-one|exists|false|filter|floor|fold-(?:left|right)|for-each(?:-pair)?|format-(?:date(?:Time)?|time|integer|number)|function-(?:arity|available|lookup|name)|generate-id|has-children|head|hours-from-(?:dateTime|duration|time)|id(?:ref)?|implicit-timezone|in-scope-prefixes|index-of|innermost|insert-before|iri-to-uri|json-(?:doc|to-xml)|key|lang|last|load-xquery-module|local-name(?:-from-QName)?|(?:lower|upper)-case|matches|max|minutes-from-(?:dateTime|duration|time)|min|months?-from-(?:date(?:Time)?|duration)|name(?:space-uri-?(?:for-prefix|from-QName)?)?|nilled|node-name|normalize-(?:space|unicode)|not|number|one-or-more|outermost|parse-(?:ietf-date|json)|path|position|(?:prefix-from-)?QName|random-number-generator|regex-group|remove|replace|resolve-(?:QName|uri)|reverse|root|round(?:-half-to-even)?|seconds-from-(?:dateTime|duration|time)|snapshot|sort|starts-with|static-base-uri|stream-available|string-?(?:join|length|to-codepoints)?|subsequence|substring-?(?:after|before)?|sum|system-property|tail|timezone-from-(?:date(?:Time)?|time)|tokenize|trace|trans(?:form|late)|true|type-available|unordered|unparsed-(?:entity|text)?-?(?:public-id|uri|available|lines)?|uri-collection|xml-to-json|years?-from-(?:date(?:Time)?|duration)|zero-or-one)\b/},{begin:/\blocal:/,end:/\(/,excludeEnd:!0},{begin:/\bzip:/,end:/(?:zip-file|(?:xml|html|text|binary)-entry| (?:update-)?entries)\b/},{begin:/\b(?:util|db|functx|app|xdmp|xmldb):/,end:/\(/,excludeEnd:!0}]},{className:`string`,variants:[{begin:/"/,end:/"/,contains:[{begin:/""/,relevance:0}]},{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]}]},{className:`number`,begin:/(\b0[0-7_]+)|(\b0x[0-9a-fA-F_]+)|(\b[1-9][0-9_]*(\.[0-9_]+)?)|[0_]\b/,relevance:0},{className:`comment`,begin:/\(:/,end:/:\)/,relevance:10,contains:[{className:`doctag`,begin:/@\w+/}]},{className:`meta`,begin:/%[\w\-:]+/},{className:`title`,begin:/\bxquery version "[13]\.[01]"\s?(?:encoding ".+")?/,end:/;/},{beginKeywords:`element attribute comment document processing-instruction`,end:/\{/,excludeEnd:!0},{begin:/<([\w._:-]+)(\s+\S*=('|").*('|"))?>/,end:/(\/[\w._:-]+>)/,subLanguage:`xml`,contains:[{begin:/\{/,end:/\}/,subLanguage:`xquery`},`self`]}]}}t.exports=n})),BQ=n(((e,t)=>{function n(e){let t={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},n=e.UNDERSCORE_TITLE_MODE,r={variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]},i=`namespace class interface use extends function return abstract final public protected private static deprecated throw try catch Exception echo empty isset instanceof unset let var new const self require if else elseif switch case default do while loop for continue break likely unlikely __LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ array boolean float double integer object resource string char long unsigned bool int uint ulong uchar true false null undefined`;return{name:`Zephir`,aliases:[`zep`],keywords:i,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(/\/\*/,/\*\//,{contains:[{className:`doctag`,begin:/@[A-Za-z]+/}]}),{className:`string`,begin:/<<<['"]?\w+['"]?$/,end:/^\w+;/,contains:[e.BACKSLASH_ESCAPE]},{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:`function`,beginKeywords:`function fn`,end:/[;{]/,excludeEnd:!0,illegal:/\$|\[|%/,contains:[n,{className:`params`,begin:/\(/,end:/\)/,keywords:i,contains:[`self`,e.C_BLOCK_COMMENT_MODE,t,r]}]},{className:`class`,beginKeywords:`class interface`,end:/\{/,excludeEnd:!0,illegal:/[:($"]/,contains:[{beginKeywords:`extends implements`},n]},{beginKeywords:`namespace`,end:/;/,illegal:/[.']/,contains:[n]},{beginKeywords:`use`,end:/;/,contains:[n]},{begin:/=>/},t,r]}}t.exports=n})),VQ=e(n(((e,t)=>{var n=uY();n.registerLanguage(`1c`,dY()),n.registerLanguage(`abnf`,fY()),n.registerLanguage(`accesslog`,pY()),n.registerLanguage(`actionscript`,mY()),n.registerLanguage(`ada`,hY()),n.registerLanguage(`angelscript`,gY()),n.registerLanguage(`apache`,_Y()),n.registerLanguage(`applescript`,vY()),n.registerLanguage(`arcade`,yY()),n.registerLanguage(`arduino`,bY()),n.registerLanguage(`armasm`,xY()),n.registerLanguage(`xml`,SY()),n.registerLanguage(`asciidoc`,CY()),n.registerLanguage(`aspectj`,wY()),n.registerLanguage(`autohotkey`,TY()),n.registerLanguage(`autoit`,EY()),n.registerLanguage(`avrasm`,DY()),n.registerLanguage(`awk`,OY()),n.registerLanguage(`axapta`,kY()),n.registerLanguage(`bash`,AY()),n.registerLanguage(`basic`,jY()),n.registerLanguage(`bnf`,MY()),n.registerLanguage(`brainfuck`,NY()),n.registerLanguage(`c`,PY()),n.registerLanguage(`cal`,FY()),n.registerLanguage(`capnproto`,IY()),n.registerLanguage(`ceylon`,LY()),n.registerLanguage(`clean`,RY()),n.registerLanguage(`clojure`,zY()),n.registerLanguage(`clojure-repl`,BY()),n.registerLanguage(`cmake`,VY()),n.registerLanguage(`coffeescript`,HY()),n.registerLanguage(`coq`,UY()),n.registerLanguage(`cos`,WY()),n.registerLanguage(`cpp`,GY()),n.registerLanguage(`crmsh`,KY()),n.registerLanguage(`crystal`,qY()),n.registerLanguage(`csharp`,JY()),n.registerLanguage(`csp`,YY()),n.registerLanguage(`css`,XY()),n.registerLanguage(`d`,ZY()),n.registerLanguage(`markdown`,QY()),n.registerLanguage(`dart`,$Y()),n.registerLanguage(`delphi`,eX()),n.registerLanguage(`diff`,tX()),n.registerLanguage(`django`,nX()),n.registerLanguage(`dns`,rX()),n.registerLanguage(`dockerfile`,iX()),n.registerLanguage(`dos`,aX()),n.registerLanguage(`dsconfig`,oX()),n.registerLanguage(`dts`,sX()),n.registerLanguage(`dust`,cX()),n.registerLanguage(`ebnf`,lX()),n.registerLanguage(`elixir`,uX()),n.registerLanguage(`elm`,dX()),n.registerLanguage(`ruby`,fX()),n.registerLanguage(`erb`,pX()),n.registerLanguage(`erlang-repl`,mX()),n.registerLanguage(`erlang`,hX()),n.registerLanguage(`excel`,gX()),n.registerLanguage(`fix`,_X()),n.registerLanguage(`flix`,vX()),n.registerLanguage(`fortran`,yX()),n.registerLanguage(`fsharp`,bX()),n.registerLanguage(`gams`,xX()),n.registerLanguage(`gauss`,SX()),n.registerLanguage(`gcode`,CX()),n.registerLanguage(`gherkin`,wX()),n.registerLanguage(`glsl`,TX()),n.registerLanguage(`gml`,EX()),n.registerLanguage(`go`,DX()),n.registerLanguage(`golo`,OX()),n.registerLanguage(`gradle`,kX()),n.registerLanguage(`graphql`,AX()),n.registerLanguage(`groovy`,jX()),n.registerLanguage(`haml`,MX()),n.registerLanguage(`handlebars`,NX()),n.registerLanguage(`haskell`,PX()),n.registerLanguage(`haxe`,FX()),n.registerLanguage(`hsp`,IX()),n.registerLanguage(`http`,LX()),n.registerLanguage(`hy`,RX()),n.registerLanguage(`inform7`,zX()),n.registerLanguage(`ini`,BX()),n.registerLanguage(`irpf90`,VX()),n.registerLanguage(`isbl`,HX()),n.registerLanguage(`java`,UX()),n.registerLanguage(`javascript`,WX()),n.registerLanguage(`jboss-cli`,GX()),n.registerLanguage(`json`,KX()),n.registerLanguage(`julia`,qX()),n.registerLanguage(`julia-repl`,JX()),n.registerLanguage(`kotlin`,YX()),n.registerLanguage(`lasso`,XX()),n.registerLanguage(`latex`,ZX()),n.registerLanguage(`ldif`,QX()),n.registerLanguage(`leaf`,$X()),n.registerLanguage(`less`,eZ()),n.registerLanguage(`lisp`,tZ()),n.registerLanguage(`livecodeserver`,nZ()),n.registerLanguage(`livescript`,rZ()),n.registerLanguage(`llvm`,iZ()),n.registerLanguage(`lsl`,aZ()),n.registerLanguage(`lua`,oZ()),n.registerLanguage(`makefile`,sZ()),n.registerLanguage(`mathematica`,cZ()),n.registerLanguage(`matlab`,lZ()),n.registerLanguage(`maxima`,uZ()),n.registerLanguage(`mel`,dZ()),n.registerLanguage(`mercury`,fZ()),n.registerLanguage(`mipsasm`,pZ()),n.registerLanguage(`mizar`,mZ()),n.registerLanguage(`perl`,hZ()),n.registerLanguage(`mojolicious`,gZ()),n.registerLanguage(`monkey`,_Z()),n.registerLanguage(`moonscript`,vZ()),n.registerLanguage(`n1ql`,yZ()),n.registerLanguage(`nestedtext`,bZ()),n.registerLanguage(`nginx`,xZ()),n.registerLanguage(`nim`,SZ()),n.registerLanguage(`nix`,CZ()),n.registerLanguage(`node-repl`,wZ()),n.registerLanguage(`nsis`,TZ()),n.registerLanguage(`objectivec`,EZ()),n.registerLanguage(`ocaml`,DZ()),n.registerLanguage(`openscad`,OZ()),n.registerLanguage(`oxygene`,kZ()),n.registerLanguage(`parser3`,AZ()),n.registerLanguage(`pf`,jZ()),n.registerLanguage(`pgsql`,MZ()),n.registerLanguage(`php`,NZ()),n.registerLanguage(`php-template`,PZ()),n.registerLanguage(`plaintext`,FZ()),n.registerLanguage(`pony`,IZ()),n.registerLanguage(`powershell`,LZ()),n.registerLanguage(`processing`,RZ()),n.registerLanguage(`profile`,zZ()),n.registerLanguage(`prolog`,BZ()),n.registerLanguage(`properties`,VZ()),n.registerLanguage(`protobuf`,HZ()),n.registerLanguage(`puppet`,UZ()),n.registerLanguage(`purebasic`,WZ()),n.registerLanguage(`python`,GZ()),n.registerLanguage(`python-repl`,KZ()),n.registerLanguage(`q`,qZ()),n.registerLanguage(`qml`,JZ()),n.registerLanguage(`r`,YZ()),n.registerLanguage(`reasonml`,XZ()),n.registerLanguage(`rib`,ZZ()),n.registerLanguage(`roboconf`,QZ()),n.registerLanguage(`routeros`,$Z()),n.registerLanguage(`rsl`,eQ()),n.registerLanguage(`ruleslanguage`,tQ()),n.registerLanguage(`rust`,nQ()),n.registerLanguage(`sas`,rQ()),n.registerLanguage(`scala`,iQ()),n.registerLanguage(`scheme`,aQ()),n.registerLanguage(`scilab`,oQ()),n.registerLanguage(`scss`,sQ()),n.registerLanguage(`shell`,cQ()),n.registerLanguage(`smali`,lQ()),n.registerLanguage(`smalltalk`,uQ()),n.registerLanguage(`sml`,dQ()),n.registerLanguage(`sqf`,fQ()),n.registerLanguage(`sql`,pQ()),n.registerLanguage(`stan`,mQ()),n.registerLanguage(`stata`,hQ()),n.registerLanguage(`step21`,gQ()),n.registerLanguage(`stylus`,_Q()),n.registerLanguage(`subunit`,vQ()),n.registerLanguage(`swift`,yQ()),n.registerLanguage(`taggerscript`,bQ()),n.registerLanguage(`yaml`,xQ()),n.registerLanguage(`tap`,SQ()),n.registerLanguage(`tcl`,CQ()),n.registerLanguage(`thrift`,wQ()),n.registerLanguage(`tp`,TQ()),n.registerLanguage(`twig`,EQ()),n.registerLanguage(`typescript`,DQ()),n.registerLanguage(`vala`,OQ()),n.registerLanguage(`vbnet`,kQ()),n.registerLanguage(`vbscript`,AQ()),n.registerLanguage(`vbscript-html`,jQ()),n.registerLanguage(`verilog`,MQ()),n.registerLanguage(`vhdl`,NQ()),n.registerLanguage(`vim`,PQ()),n.registerLanguage(`wasm`,FQ()),n.registerLanguage(`wren`,IQ()),n.registerLanguage(`x86asm`,LQ()),n.registerLanguage(`xl`,RQ()),n.registerLanguage(`xquery`,zQ()),n.registerLanguage(`zephir`,BQ()),n.HighlightJS=n,n.default=n,t.exports=n}))()).default;$J.use(eY({emptyLangClass:`hljs`,langPrefix:`hljs language-`,highlight(e,t){let n=(t??``).trim()||`plaintext`,r=VQ.getLanguage(n)?n:`plaintext`;return VQ.highlight(e,{language:r}).value}}));var HQ={gfm:!0,breaks:!1,async:!1};function UQ(e,t){return $J.parse(e,{...HQ,...t,async:!1})}var WQ=!1;function GQ(){WQ||typeof window>`u`||(WQ=!0,Sq.addHook(`afterSanitizeAttributes`,e=>{if(e.tagName!==`A`||!e.hasAttribute(`href`))return;let t=e.getAttribute(`href`)??``;try{let n=new URL(t,window.location.href);if(n.protocol!==`http:`&&n.protocol!==`https:`||n.origin===window.location.origin)return;e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)}catch{}}))}GQ();var KQ=`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,qQ=`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`;function JQ(e){return e.querySelector(`code`)?.textContent??e.textContent??``}function YQ(e){let t=e.querySelector(`code`);if(!t?.className)return`plaintext`;for(let e of t.className.split(/\s+/))if(e.startsWith(`language-`))return e.slice(9).trim()||`plaintext`;return`plaintext`}function XQ(e,t){let n=document.createDocumentFragment(),r=document.createElement(`span`);r.className=`markdown-code-copy-inner`,r.innerHTML=e===`idle`?KQ:qQ;let i=document.createElement(`span`);return i.className=`markdown-code-copy-label`,i.textContent=e===`idle`?t.copy:t.copied,n.appendChild(r),n.appendChild(i),n}function ZQ(e){e.querySelectorAll(`[data-md-code-block]`).forEach(e=>{let t=e.querySelector(`:scope > pre`),n=e.parentNode;t&&n&&(n.insertBefore(t,e),e.remove())})}function QQ(e,t){let n=e.querySelectorAll(`.markdown-body pre`),r=[];for(let e of n){if(e.closest(`[data-md-code-block]`))continue;let n=e.parentNode;if(!n)continue;let i=document.createElement(`div`);i.className=`markdown-code-block`,i.setAttribute(`data-md-code-block`,``);let a=document.createElement(`div`);a.className=`markdown-code-block-header`;let o=document.createElement(`span`);o.className=`markdown-code-block-lang`,o.textContent=YQ(e);let s=document.createElement(`button`);s.type=`button`,s.className=`markdown-code-copy-btn`,s.dataset.mdCodeCopy=``,s.title=t.copy,s.setAttribute(`aria-label`,t.copy),s.replaceChildren(XQ(`idle`,t));let c=n=>{n.preventDefault(),n.stopPropagation(),Cq(JQ(e)).then(e=>{!e||!s.isConnected||(s.replaceChildren(XQ(`copied`,t)),s.title=t.copied,s.setAttribute(`aria-label`,t.copied),window.setTimeout(()=>{s.isConnected&&(s.replaceChildren(XQ(`idle`,t)),s.title=t.copy,s.setAttribute(`aria-label`,t.copy))},2e3))})};s.addEventListener(`click`,c),a.appendChild(o),a.appendChild(s),i.appendChild(a),n.insertBefore(i,e),i.appendChild(e),r.push(()=>{s.removeEventListener(`click`,c);let t=e.parentElement;t?.matches(`[data-md-code-block]`)&&t.parentNode&&(t.parentNode.insertBefore(e,t),t.remove())})}return()=>{for(let e of r)e()}}function $Q({content:e,compact:t=!1,breaks:n=!1,className:r,codeCopy:i=!0}){let a=oN(e=>e.language),o=(0,L.useMemo)(()=>{let e=GM(a).chat;return{copy:e.codeBlockCopy,copied:e.messageCopied}},[a]),s=(0,L.useMemo)(()=>{if(!e.trim())return``;let t=UQ(e,n?{breaks:!0}:void 0);return Sq.sanitize(t,{USE_PROFILES:{html:!0}})},[e,n]),c=(0,L.useRef)(null);return(0,L.useLayoutEffect)(()=>{let e=c.current;if(e&&(ZQ(e),!(!i||!s)))return QQ(e,o)},[i,s,o]),(0,J.jsx)(`div`,{ref:c,children:(0,J.jsx)(`div`,{className:[`markdown-body`,t?`markdown-compact`:``,r??``].filter(Boolean).join(` `),dangerouslySetInnerHTML:{__html:s}})})}var e$=(0,L.memo)($Q);e$.displayName=`MarkdownView`;function t$({initialContent:e,onSave:t,isDark:n=!1}){let[r,i]=(0,L.useState)(e);(0,L.useEffect)(()=>{i(e)},[e]);let a=XG(e=>{t?.(e)},500);return(0,J.jsxs)(`div`,{className:`flex h-full divide-x divide-edge`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,J.jsx)(uK,{initialContent:e,onChange:(0,L.useCallback)(e=>{i(e),a(e)},[a]),isDark:n})}),(0,J.jsx)(`div`,{className:`bg-surface min-w-0 flex-1 overflow-y-auto px-6 py-4`,children:(0,J.jsx)(e$,{content:r})})]})}var Z={transition:`transition-colors duration-150 ease-out`,press:`transition-transform duration-150 ease-out active:scale-95`,focusRingPanel:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,focusRingBase:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,disabled:`disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none`},n$=`rounded-lg p-2 text-fg-muted transition-colors transition-transform duration-150 ease-out hover:bg-surface-hover hover:text-fg active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`;function r$({message:e,downloadLabel:t,onDownload:n,openSystemLabel:r,onOpenWithSystemApp:i,canOpenWithSystemApp:a=!0}){let o=ZG()&&a&&typeof i==`function`&&typeof r==`string`&&r.length>0;return(0,J.jsxs)(`div`,{className:q(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),children:[(0,J.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:e}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[o?(0,J.jsxs)(`button`,{type:`button`,className:q(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,Z.transition,Z.press,Z.focusRingPanel),onClick:()=>void i?.(),children:[(0,J.jsx)(vg,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),r]}):null,(0,J.jsxs)(`button`,{type:`button`,className:q(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,Z.transition,Z.press,Z.focusRingPanel),onClick:n,children:[(0,J.jsx)(hg,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t]})]})]})}function i$(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}function a$({text:e,slideLabel:t,emptySlideLabel:n}){let r=(0,L.useMemo)(()=>i$(e),[e]);if(!r.ok)return(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:r.raw});let i=[];r.notes.length>0&&i.push((0,J.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:r.notes.map((e,t)=>(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},t))},`notes`));for(let e of r.slides)i.push((0,J.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,J.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:t(e.slideNumber)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:e.text.length>0?e.text:n})]},e.slideNumber));return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,children:i})}function o$(e,t){return`\`\`\`${{".ts":`typescript`,".js":`javascript`,".json":`json`}[t]??`plaintext`}\n${e}\n\`\`\``}function s$({layout:e,text:t,showTruncationBar:n,onDownload:r,downloadLabel:i,truncationMessage:a,truncatedCaption:o,slideLabel:s,emptySlideLabel:c,openSystemLabel:l,onOpenWithSystemApp:u,canOpenWithSystemApp:d}){return(0,J.jsxs)(`div`,{className:e===`workspace`?`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[n?(0,J.jsx)(r$,{message:a,downloadLabel:i,onDownload:r,openSystemLabel:l,onOpenWithSystemApp:u,canOpenWithSystemApp:d}):null,(0,J.jsxs)(`div`,{className:e===`workspace`?`min-h-0 flex-1 overflow-auto px-2 py-2`:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle p-4 dark:border-edge`,children:[n?(0,J.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:o}):null,(0,J.jsx)(a$,{text:t,slideLabel:s,emptySlideLabel:c})]})]})}function c$(e){let{context:t,language:n,resolvedTheme:r,fileKey:i,fileName:a,loading:o,loadError:s,previewKind:c,textContent:l,binaryBuffer:u,showExtractedText:d,extractedText:f,extractedTextTruncated:p,workspaceEditing:m,pptxText:h,pptxTruncated:g,pptxError:_,actions:v}=e,y=GM(n),b=(0,L.useMemo)(()=>QG(a),[a]),x=b===`.md`,S=b===`.html`||b===`.htm`,C=(0,L.useRef)(null),{error:w,excelTruncated:T}=YG({language:n,buffer:u,kind:c===`pdf`||c===`excel`||c===`docx`?c:null,fileKey:i,containerEl:C.current}),E=!!v.onOpenWithSystemApp&&(v.canOpenWithSystemApp??!0)&&t===`workspace`,D=t===`workspace`?y.workspace.openElsewhereHint:y.chat.attachmentPreviewOpenElsewhereHint,O=y.chat.attachmentPreviewDownloadFull,A=t===`workspace`?y.workspace.openSystemApp:void 0,j=e=>y.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),M=(0,J.jsx)(r$,{message:D,downloadLabel:O,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E}),P=null;if(o)P=(0,J.jsx)(`p`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.chat.loading});else if(s)P=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+s})]});else if(t===`attachment`&&d&&c!==`image`){let e=f||y.chat.attachmentPreviewNoText,t=c===`pptx`&&e.length>3e5?e.slice(0,ee):e,n=!!p||c===`pptx`&&e.length>3e5;P=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[n&&c===`pptx`?(0,J.jsx)(r$,{message:y.chat.attachmentPreviewOpenElsewhereTruncated,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload}):null,(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:[n&&c===`pptx`?(0,J.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:y.chat.attachmentPreviewPptxTruncated}):null,(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:t})]})]})}else if(c===`binaryOnly`&&u)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:(0,J.jsx)(r$,{message:t===`workspace`?y.workspace.cannotPreviewType+` `+y.workspace.openElsewhereHint:y.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E})});else if(u&&c===`image`)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,children:(0,J.jsx)(`img`,{src:`data:${k(a)??`image/png`};base64,${N(u)}`,alt:``,className:t===`workspace`?`max-h-[min(100%,calc(100dvh-9rem))] w-auto max-w-full object-contain`:`max-h-full max-w-full object-contain`})});else if(u&&c===`pptx`)if(t===`attachment`){let e=f||y.chat.attachmentPreviewNoText,t=ee,n=!!p||e.length>t;P=(0,J.jsx)(s$,{layout:`attachment`,text:e.length>t?e.slice(0,t):e,showTruncationBar:n,onDownload:v.onDownload,downloadLabel:O,truncationMessage:y.chat.attachmentPreviewOpenElsewhereTruncated,truncatedCaption:y.chat.attachmentPreviewPptxTruncated,slideLabel:j,emptySlideLabel:y.chat.attachmentPreviewPptxEmptySlide})}else P=_?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+_})]}):h==null?(0,J.jsx)(`p`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.chat.loading}):(0,J.jsx)(s$,{layout:`workspace`,text:h,showTruncationBar:!!g,onDownload:v.onDownload,downloadLabel:O,truncationMessage:y.chat.attachmentPreviewOpenElsewhereTruncated,truncatedCaption:y.chat.attachmentPreviewPptxTruncated,slideLabel:j,emptySlideLabel:y.chat.attachmentPreviewPptxEmptySlide,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E});else if(u&&(c===`pdf`||c===`docx`))P=w?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto px-4 py-4`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:(t===`workspace`?y.workspace.loadError:y.chat.attachmentPreviewLoadError)+`: `+w})]}):(0,J.jsx)(`div`,{ref:C,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`});else if(u&&c===`excel`)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:w?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 px-2`,children:[M,(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:w})]}):(0,J.jsxs)(J.Fragment,{children:[T?(0,J.jsx)(r$,{message:y.chat.attachmentPreviewOpenElsewhereTruncated,downloadLabel:y.chat.attachmentPreviewDownloadFull,onDownload:v.onDownload,openSystemLabel:A,onOpenWithSystemApp:v.onOpenWithSystemApp,canOpenWithSystemApp:E}):null,(0,J.jsx)(`div`,{ref:C,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`})]})});else if(l!==null&&c===`text`)if(t===`workspace`&&x&&m?.markdownEditMode)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(t$,{initialContent:l,onSave:e=>void m?.onSaveMarkdown?.(e),isDark:(m?.isDark??r===`dark`)===!0},i)});else if(x)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:l})});else if(t===`workspace`&&S&&m?.htmlCodeMode)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(lK,{initialContent:l,onChange:e=>m?.onHtmlChange?.(e),isDark:(m?.isDark??r===`dark`)===!0},i)});else if(S)P=(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,J.jsx)(`iframe`,{title:a,className:`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white dark:border-edge dark:bg-[#1e1e1e]`,srcDoc:l,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`})});else if(b===`.ts`||b===`.js`)P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:o$(l,b)})});else if(b===`.json`){let e=l;try{e=JSON.stringify(JSON.parse(l),null,2)}catch{}P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(e$,{content:o$(e,`.json`)})})}else P=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:l})});return(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:P})}function l$(e,t,n,r){let i=n?t.replace(/\{\{(\w+)\}\}/g,(e,t)=>String(n[t]??``)):t;window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:e,title:i,duration:r?.duration??4e3}}))}function u$(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.isDirectory,children:e.isDirectory?[]:void 0}))}function d$(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:d$(e.children,t,n)}:e)}function f$(e,t){let[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(new Set),l=e.trim(),u=t?.trim()??``,d=u,f=u?``:l,p=(0,L.useMemo)(()=>{if(d)return{sessionKey:d};if(f)return{agentId:f}},[d,f]);return{tree:n,loading:i,error:o,loadRoot:(0,L.useCallback)(async()=>{a(!0),s(null),c.current.clear();try{r(u$(await BG(``,p))),c.current.add(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[p]),loadChildren:(0,L.useCallback)(async e=>{if(!c.current.has(e)){c.current.add(e);try{let t=u$(await BG(e,p));r(n=>d$(n,e,t))}catch{c.current.delete(e)}}},[p]),reset:(0,L.useCallback)(()=>{r([]),s(null),c.current.clear()},[])}}var p$=aN(e=>({agentId:``,setAgentId:t=>e({agentId:t})})),m$=`xopc-web-workspace-panel-open`,h$=`xopc-web-workspace-panel-width-px`;function g$(){try{return globalThis.localStorage?.getItem(m$)===`1`}catch{return!1}}function _$(e){try{globalThis.localStorage?.setItem(m$,e?`1`:`0`)}catch{}}function v$(e){return Math.min(520,Math.max(200,Math.round(e)))}function y$(){try{let e=globalThis.localStorage?.getItem(h$);if(e==null)return 320;let t=Number.parseInt(e,10);return Number.isFinite(t)?v$(t):320}catch{return 320}}function b$(e){try{globalThis.localStorage?.setItem(h$,String(e))}catch{}}var x$=aN((e,t)=>({open:g$(),setOpen:t=>{e({open:t}),queueMicrotask(()=>_$(t))},toggleOpen:()=>{t().setOpen(!t().open)},widthPx:y$(),setWidthPx:t=>{let n=v$(t);e({widthPx:n}),queueMicrotask(()=>b$(n))}})),S$=aN(e=>({path:null,setPath:t=>e({path:t})})),C$=(0,L.memo)(function(){let e=GM(oN(e=>e.language)),{pathname:t}=Ii(),{sessionKey:n}=Vi(),r=t.startsWith(`/chat`)&&n?decodeURIComponent(n):null,i=x$(e=>e.open),a=x$(e=>e.setOpen),o=x$(e=>e.widthPx),s=x$(e=>e.setWidthPx),[c,l]=(0,L.useState)(!1),u=S$(e=>e.path),d=S$(e=>e.setPath),f=p$(e=>e.agentId),{tree:p,loading:m,error:h,loadRoot:g,loadChildren:_,reset:v}=f$(f,r),y=r??f,b=r==null?f.trim()?{agentId:f.trim()}:void 0:{sessionKey:r},x=(0,L.useCallback)(e=>{if(!i)return;e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),l(!0);let n=e.clientX,r=x$.getState().widthPx,a=e.pointerId,o=e=>{s(r+(n-e.clientX))},c=()=>{try{t.releasePointerCapture(a)}catch{}l(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[i,s]);(0,L.useEffect)(()=>{t.startsWith(`/chat`)||a(!1)},[t,a]),(0,L.useEffect)(()=>{if(!i){v(),d(null);return}d(null),g()},[i,y,g,v,d]),(0,L.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&(S$.getState().path||a(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,a]),(0,L.useEffect)(()=>{if(!i||!window.matchMedia(`(max-width: 767px)`).matches)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[i]);let S=(0,L.useCallback)(e=>{_(e)},[_]),C=(0,L.useCallback)(async(t,n)=>{if(!n.isDirectory)switch(t){case`preview`:d(n.path);break;case`download`:try{let e=$G(n.path);if(aK(n.path)){let{contentBase64:t}=await HG(n.path,b);qG(e,F(t),k(e)??`application/octet-stream`)}else{let{content:t}=await VG(n.path,b);KG(e,t)}}catch{}break;case`copyPath`:try{await navigator.clipboard.writeText(n.absolutePath??n.path),l$(`success`,e.workspace.pathCopied,void 0,{duration:2500})}catch{}break;default:break}},[e.workspace.pathCopied,d,b]);return(0,J.jsxs)(J.Fragment,{children:[i?(0,J.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 bg-scrim md:hidden`,"aria-label":e.closeMenu,onClick:()=>a(!1)}):null,(0,J.jsx)(`aside`,{id:`app-workspace-panel`,"aria-label":e.workspace.title,"aria-hidden":!i,className:q(`flex min-h-0 flex-col overflow-hidden bg-surface-base`,`max-md:fixed max-md:right-0 max-md:top-0 max-md:z-50 max-md:h-[100dvh] max-md:shadow-popover`,`max-md:transition-transform max-md:duration-200 max-md:ease-out`,`motion-reduce:max-md:transition-none`,`max-md:w-[min(20rem,92vw)]`,i?`max-md:translate-x-0`:`max-md:pointer-events-none max-md:translate-x-full`,`md:relative md:h-full md:translate-x-0`,`motion-reduce:md:transition-none`,!i&&`md:pointer-events-none md:w-0 md:min-w-0 md:max-w-0 md:overflow-hidden`,i&&`app-workspace-panel-expanded-width md:shrink-0`,i&&c&&`workspace-panel-rail-resizing`),style:i?{"--workspace-panel-px":`${o}px`}:void 0,children:i?(0,J.jsxs)(`div`,{className:q(`relative flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden overflow-y-hidden bg-surface-base`),children:[(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":e.workspace.resizeHandleAria,onPointerDown:x,className:q(`pointer-events-auto absolute left-0 top-0 z-20 hidden h-full w-2 cursor-col-resize md:block`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:z-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:bg-surface-hover/20 hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,c&&`bg-surface-hover/30 before:!bg-edge/80 dark:before:!bg-edge/85`,`transition-[background-color] duration-150`,`touch-none select-none`,VN)}),(0,J.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4 dark:border-edge`,children:[(0,J.jsx)(Og,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-tight tracking-tight text-fg`,children:e.workspace.title}),(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:e.cron.refresh,"aria-label":e.cron.refresh,disabled:m,onClick:()=>void g(),children:(0,J.jsx)(Xx,{className:q(`size-4`,m&&`animate-spin`),"aria-hidden":!0})}),(0,J.jsx)(UM,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 rounded-md p-0`,"aria-label":e.workspace.close,title:e.workspace.close,onClick:()=>a(!1),children:(0,J.jsx)(DA,{className:`size-4`,strokeWidth:1.75})})]}),h?(0,J.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[e.workspace.loadError,`: `,h]}):null,(0,J.jsx)(RG,{tree:p,selectedPath:u,onSelectFile:e=>d(e),onExpandDir:S,onAction:C,actionLabels:{preview:e.workspace.preview,download:e.workspace.download,copyPath:e.workspace.copyPath},emptyHint:e.workspace.emptyDir})]}):null})]})});function w$(){let e=LN(e=>e.tokenDialogOpen),t=LN(e=>e.baseUrl),n=LN(e=>e.tokenExpired),r=LN(e=>e.setGatewayToken),i=LN(e=>e.closeTokenDialog),a=LN(e=>e.token),o=oN(e=>e.language),s=GM(o).token,c=!!a&&!n;return(0,J.jsx)(QB,{open:e,onOpenChange:e=>{!e&&!c||e||i()},children:(0,J.jsxs)($B,{children:[(0,J.jsx)(eV,{className:`fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(tV,{className:q(`fixed left-1/2 top-1/2 z-50 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsx)(nV,{className:`text-base font-semibold text-fg`,children:s.title}),(0,J.jsx)(rV,{className:`mt-1 text-sm text-fg-muted`,children:s.description}),(0,J.jsx)(sN,{className:`mt-4`,baseUrl:t,onSubmit:r,footerLeft:c?(0,J.jsx)(UM,{type:`button`,variant:`ghost`,onClick:()=>i(),children:o===`zh`?`取消`:`Cancel`}):void 0})]})]})})}function T$(){let e=GM(oN(e=>e.language)).electron,[t,n]=(0,L.useState)(null);return(0,L.useEffect)(()=>{if(!ZG())return;let e=window.electronAPI?.gateway;if(e?.onExited)return e.onExited(e=>n(e))},[]),t?(0,J.jsxs)(`div`,{className:q(`shrink-0 border-b border-danger/35 bg-danger/10 px-4 py-3 text-sm text-fg shadow-surface`),role:`alert`,children:[(0,J.jsx)(`p`,{className:`font-semibold`,children:e.gatewayExitTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:e.gatewayExitBody}),(0,J.jsxs)(`p`,{className:`mt-2 font-mono text-xs text-fg-muted`,children:[`exit `,t.code??`—`,` · signal `,t.signal??`—`]})]}):null}function E$(){let e=zi();return(0,L.useEffect)(()=>{if(!ZG())return;let t=window.electronAPI;if(!t?.menu)return;let n=t.menu.onNavigate(t=>{e(t)}),r=t.menu.onTogglePalette(()=>{window.dispatchEvent(new CustomEvent(`toggle-command-palette`))});return()=>{n(),r()}},[e]),null}function D$({reminder:e,compact:t}){let n=oN(e=>e.language),r=GM(n).updatePanel,{show:i,dismiss:a,electronQuitAndInstall:o,runNpmUpdate:s,npmUpdateRunning:c}=e,[l,u]=(0,L.useState)(!1),d=(0,L.useCallback)(async()=>{let e=GM(n).updatePanel;u(!0);try{let t=await sP(Y(`/api/gateway/restart`),{method:`POST`}),n=await t.json().catch(()=>({}));if(t.ok&&n.ok!==!1){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`success`,title:e.restartGateway,message:``}}));return}window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:e.updateErrorFailed,message:typeof n.message==`string`?n.message:`HTTP ${t.status}`}}))}catch(t){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:e.updateErrorFailed,message:t instanceof Error?t.message:String(t)}}))}finally{u(!1)}},[n]),f=(0,L.useCallback)(async()=>{let e=GM(n).updatePanel,t=await s();if(t.ok){window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`success`,title:e.updateSuccess,message:e.updateSuccessDetail}}));return}let r=t.error===`git-checkout`?e.updateErrorGit:t.error===`busy`?e.updateErrorBusy:e.updateErrorFailed;window.dispatchEvent(new CustomEvent(`extension-notification`,{detail:{type:`error`,title:r,message:t.message}}))},[s,n]);if(i.kind===`none`)return null;let p=`absolute right-2 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1 sm:right-3`;return i.kind===`electron-ready`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-accent/20 bg-accent/10 px-10 py-2 text-sm sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-[min(100%,48rem)] items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(hg,{className:`h-4 w-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0`,children:r.reminderElectronReady.replace(`{{version}}`,i.version)})]}),(0,J.jsxs)(`div`,{className:p,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:o,className:`rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90`,children:[(0,J.jsx)(Xx,{className:`mr-1 inline h-3 w-3`}),r.restartToUpdate]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:`rounded p-1 text-fg-muted hover:text-fg`,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]})]}):i.kind===`electron-error`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-red-500/20 bg-red-500/10 px-10 py-2 text-sm text-fg sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-[min(100%,52rem)] items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(xp,{className:`h-4 w-4 shrink-0 text-red-500 dark:text-red-400`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:r.reminderElectronUpdateError.replace(`{{detail}}`,i.message)})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`electron-downloading`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 flex-col items-center justify-center gap-2 border-b border-edge bg-surface-secondary px-10 py-2 text-sm text-fg-muted sm:flex-row sm:gap-4 sm:px-12`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`flex max-w-full items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(hg,{className:`h-4 w-4 shrink-0 animate-pulse`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:r.reminderDownloading.replace(`{{percent}}`,String(i.percent))})]}),(0,J.jsx)(`div`,{className:`h-1.5 w-full max-w-xs rounded-full bg-surface-tertiary sm:max-w-[12rem]`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${i.percent}%`}})}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:q(p,`sm:right-2`),"aria-label":r.dismissAria,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`npm-restart-required`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-amber-500/25 bg-amber-500/10 py-2 text-sm`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:`mx-auto flex max-w-[min(100%,52rem)] flex-wrap items-center justify-center gap-x-2 gap-y-1 px-10 pr-14 text-center sm:px-12 sm:pr-16`,children:[(0,J.jsx)(`span`,{children:r.restartRequired.replace(`{{version}}`,i.version)}),(0,J.jsxs)(`button`,{type:`button`,onClick:d,disabled:l,className:`inline-flex shrink-0 items-center gap-1 rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-60`,children:[l?(0,J.jsx)(Kg,{className:`h-3 w-3 shrink-0 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(Xx,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),r.restartGateway]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):i.kind===`npm`?(0,J.jsxs)(`div`,{className:q(`relative flex min-h-10 w-full min-w-0 items-center justify-center border-b border-accent/20 bg-accent/10 py-2 text-sm`,t&&`text-xs`),children:[(0,J.jsxs)(`div`,{className:q(`mx-auto flex max-w-[min(100%,52rem)] flex-wrap items-center justify-center gap-x-2 gap-y-1 px-10 pr-14 text-center sm:px-12 sm:pr-16`),children:[(0,J.jsxs)(`span`,{children:[r.reminderNpm.replace(`{{version}}`,i.version),i.channel&&i.channel!==`latest`?` (${i.channel})`:``]}),(0,J.jsxs)(`button`,{type:`button`,onClick:f,disabled:c,className:`inline-flex shrink-0 items-center gap-1 rounded bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-60`,children:[c?(0,J.jsx)(Kg,{className:`h-3 w-3 shrink-0 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(Xx,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),c?r.updateRunning:r.updateNow]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:a,className:p,"aria-label":r.dismissAria,title:r.dismissHint,children:(0,J.jsx)(DA,{className:`h-4 w-4`})})]}):null}function O$(e,t,n){let r=e===`zh`;return[{kind:`action`,id:`action:cron:create`,title:r?`创建定时任务`:`Create scheduled task`,subtitle:r?`新建 Cron 任务`:`Open scheduled tasks (create)`,groupLabel:`Actions`,keywords:[`cron`,`schedule`,`job`,`timer`],run:()=>{n(),t(`/cron?action=create`)}},{kind:`action`,id:`action:cron:manage`,title:r?`管理定时任务`:`Manage scheduled tasks`,subtitle:r?`查看和编辑 Cron`:`View and edit cron jobs`,groupLabel:`Actions`,keywords:[`cron`,`schedule`,`tasks`],run:()=>{n(),t(`/cron`)}},{kind:`action`,id:`action:skills:manage`,title:r?`管理技能`:`Manage skills`,subtitle:r?`启用或禁用技能`:`View, enable, or disable skills`,groupLabel:`Actions`,keywords:[`skills`,`skill`,`catalog`],run:()=>{n(),t(`/skills`)}},{kind:`action`,id:`action:skills:reload`,title:r?`重新加载技能`:`Reload skills`,subtitle:r?`从磁盘重新加载`:`Reload all skills from disk`,groupLabel:`Actions`,keywords:[`skills`,`reload`,`refresh`],run:()=>{n(),f(async()=>{let{reloadSkills:e}=await Promise.resolve().then(()=>L$);return{reloadSkills:e}},void 0).then(({reloadSkills:e})=>e())}}]}function k$(e){return e.trim().toLowerCase()}function A$(e,t){let n=k$(e),r=k$(t);if(!r)return 0;if(!n)return null;if(n===r)return 0;if(n.startsWith(r))return 1;let i=n.indexOf(r);return i>=0?2+Math.min(i,50)/100:null}function j$(e,t){let n=t.trim();if(!n)return 0;let r=[{text:e.title,weight:1},{text:e.subtitle??``,weight:1.75}];for(let t of e.keywords??[])r.push({text:t,weight:1.25});let i=null;for(let e of r){let t=A$(e.text,n);if(t===null)continue;let r=t*e.weight;i=i===null?r:Math.min(i,r)}if(i===null)return null;let a=e.kind===`route`?-.15:e.kind===`file`?-.1:e.kind===`session`?-.05:e.kind===`setting`||e.kind===`action`?-.02:0;return Math.max(0,i+a)}function M$(e){return[...e].sort((e,t)=>e.rank===t.rank?e.groupLabel===t.groupLabel?e.title.localeCompare(t.title):e.groupLabel.localeCompare(t.groupLabel):e.rank-t.rank)}function N$(e){let t=GM(e);return[{id:`route:chat`,title:t.nav.chat,subtitle:e===`zh`?`打开聊天`:`Open chat`,path:`/chat`,keywords:[`chat`,`new`,`compose`,`assistant`]},{id:`route:agents`,title:t.nav.agents,subtitle:e===`zh`?`管理智能体`:`Manage agents`,path:`/agents`,keywords:[`agent`,`persona`,`switch`]},{id:`route:apps`,title:t.nav.apps,subtitle:e===`zh`?`扩展应用`:`Extension apps`,path:`/apps`,keywords:[`extension`,`plugin`,`addon`]},{id:`route:sessions`,title:t.nav.sessions,subtitle:e===`zh`?`管理与搜索会话`:`Manage and search sessions`,path:`/settings/sessions`,keywords:[`history`,`archive`,`pin`]},{id:`route:logs`,title:t.nav.logs,subtitle:e===`zh`?`查看日志`:`View logs`,path:`/settings/logs`,keywords:[`debug`,`errors`]},{id:`route:skills`,title:t.nav.skills,subtitle:e===`zh`?`管理技能`:`Manage skills`,path:`/skills`,keywords:[`tools`,`catalog`]},{id:`route:channels`,title:t.nav.channels,subtitle:e===`zh`?`消息通道设置`:`Channel settings`,path:`/channels`,keywords:[`telegram`,`weixin`]},{id:`route:cron`,title:t.nav.cron,subtitle:e===`zh`?`定时任务与调度`:`Cron jobs and schedules`,path:`/cron`,keywords:[`schedule`,`jobs`]},{id:`route:settings`,title:t.nav.settings,subtitle:e===`zh`?`打开设置`:`Open settings`,path:`/settings/appearance`,keywords:[`config`,`appearance`,`providers`,`models`,`agents`,`search`,`preferences`]},{id:`route:settings:providers`,title:t.nav.settingsProviders,subtitle:e===`zh`?`AI 服务商配置`:`AI provider configuration`,path:`/settings/providers`,keywords:[`api`,`key`,`openai`,`anthropic`,`google`]},{id:`route:settings:models`,title:t.nav.settingsModels,subtitle:e===`zh`?`模型配置`:`Model configuration`,path:`/settings/models`,keywords:[`gpt`,`claude`,`gemini`,`llm`]},{id:`route:settings:voice`,title:t.nav.settingsVoice,subtitle:e===`zh`?`语音设置`:`Voice settings`,path:`/settings/voice`,keywords:[`tts`,`stt`,`speech`,`microphone`]},{id:`route:settings:gateway`,title:t.nav.settingsGateway,subtitle:e===`zh`?`网关设置`:`Gateway settings`,path:`/settings/gateway`,keywords:[`server`,`port`,`auth`,`token`]}]}function P$(e){TN.getState().setPreference(e)}function F$(e){oN.getState().setLanguage(e)}function I$(e,t){let n=e===`zh`;return[{kind:`setting`,id:`setting:model`,title:n?`切换模型`:`Switch model`,subtitle:n?`更改默认 AI 模型`:`Change the default AI model`,groupLabel:`Quick Settings`,keywords:[`model`,`gpt`,`claude`,`gemini`,`llm`],run:()=>t.openModelPalette()},{kind:`setting`,id:`setting:agent`,title:n?`切换智能体`:`Switch agent`,subtitle:n?`更改新对话使用的智能体`:`Change the agent for new chats`,groupLabel:`Quick Settings`,keywords:[`agent`,`persona`,`bot`],run:()=>t.openAgentPalette()},{kind:`setting`,id:`setting:theme:light`,title:n?`切换到浅色主题`:`Switch to light theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`light`,`appearance`],run:()=>{P$(`light`),t.closePalette()}},{kind:`setting`,id:`setting:theme:dark`,title:n?`切换到深色主题`:`Switch to dark theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`dark`,`night`],run:()=>{P$(`dark`),t.closePalette()}},{kind:`setting`,id:`setting:theme:system`,title:n?`使用系统主题`:`Use system theme`,subtitle:n?`外观`:`Appearance`,groupLabel:`Quick Settings`,keywords:[`theme`,`system`,`auto`],run:()=>{P$(`system`),t.closePalette()}},{kind:`setting`,id:`setting:lang:en`,title:`Switch to English`,subtitle:n?`语言`:`Language`,groupLabel:`Quick Settings`,keywords:[`english`,`language`,`locale`],run:()=>{F$(`en`),t.closePalette()}},{kind:`setting`,id:`setting:lang:zh`,title:`切换到中文`,subtitle:n?`语言`:`Language`,groupLabel:`Quick Settings`,keywords:[`chinese`,`中文`,`language`],run:()=>{F$(`zh`),t.closePalette()}}]}var L$=t({deleteSkill:()=>H$,getMarketplaceCategories:()=>W$,getMarketplacePackageDetail:()=>K$,getMarketplaceProvider:()=>Y$,getMarketplaceSkills:()=>G$,getSkillMarkdown:()=>J$,getSkills:()=>z$,installMarketplaceSkill:()=>q$,patchSkillEnabled:()=>U$,reloadSkills:()=>B$,uploadSkillZip:()=>V$});async function R$(e){let t=await e.json().catch(()=>({}));if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;if(typeof e==`string`)return e}return`HTTP ${e.status}`}async function z$(e){let t=await sP(Y(`/api/skills${e&&e!==`en`?`?lang=${encodeURIComponent(e)}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload)throw Error(`Invalid response`);return n.payload}async function B$(){let e=await sP(Y(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await R$(e))}async function V$(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`);let r=LN.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(Y(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&LN.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function H$(e){let t=await sP(Y(`/api/skills/${encodeURIComponent(e)}`),{method:`DELETE`});if(!t.ok)throw Error(await R$(t))}async function U$(e,t){let n=await sP(Y(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await R$(n))}async function W$(){let e=await sP(Y(`/api/skills/marketplace/categories`),{cache:`no-store`});if(!e.ok)throw Error(await R$(e));let t=await e.json();if(!t.payload||!Array.isArray(t.payload.items))throw Error(`Invalid response`);return{items:t.payload.items}}async function G$(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim());let n=t.toString(),r=await sP(Y(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await R$(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function K$(e){let t=await sP(Y(`/api/skills/marketplace/packages/${encodeURIComponent(e)}`),{cache:`no-store`});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload?.name)throw Error(`Invalid response`);return n.payload}async function q$(e){let t=await sP(Y(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await R$(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function J$(e,t){let n=t?`?lang=${encodeURIComponent(t)}`:``,r=await sP(Y(`/api/skills/${encodeURIComponent(e)}/content${n}`),{cache:`no-store`});if(!r.ok)throw Error(await R$(r));let i=(await r.json()).payload;if(!i||typeof i.name!=`string`||typeof i.description!=`string`||typeof i.bodyMarkdown!=`string`||typeof i.disableModelInvocation!=`boolean`||!i.metadata||typeof i.metadata!=`object`||typeof i.metadata.name!=`string`||typeof i.metadata.description!=`string`)throw Error(`Invalid response`);return i}async function Y$(){let e=await sP(Y(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await R$(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function X$(e){let t=await e.json().catch(()=>({}));if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&`message`in t.error){let e=t.error.message;if(typeof e==`string`)return e}return`HTTP ${e.status}`}async function Z$(){let e=await sP(Y(`/api/commands`));if(!e.ok)throw Error(await X$(e));return(await e.json()).payload?.commands??[]}var Q$=6e4,$$=null,e1=0,t1=null,n1=new Map,r1=new Map,i1=null,a1;async function o1(e=!1){return!e&&$$&&Date.now()<e1?$$:t1||(t1=Z$().then(e=>($$=e,e1=Date.now()+Q$,e)).finally(()=>{t1=null}),t1)}async function s1(e,t=!1){let n=e??`en`,r=Date.now();return!t&&n1.has(n)&&r<(r1.get(n)??0)?n1.get(n):i1&&a1===n?i1:(a1=n,i1=z$(e).then(e=>(n1.set(n,e),r1.set(n,Date.now()+Q$),e)).finally(()=>{i1=null,a1=void 0}),i1)}var c1=`fill-chat-composer`;function l1(e){window.dispatchEvent(new CustomEvent(c1,{detail:{text:e}}))}function u1(e){return e.acceptsArgs?`/${e.name} `:`/${e.name}`}var d1=3e4,f1=null;function p1(e){return e.trim()}function m1(e){return e.map(e=>({name:e.name,relativePath:e.path,isDirectory:e.isDirectory}))}async function h1(e,t){let n=t.sessionKey?.trim(),r=t.agentId?.trim(),i=t.limit??15,a=e.trim(),o=new URLSearchParams;if(o.set(`q`,a),o.set(`limit`,String(i)),n?o.set(`sessionKey`,n):r&&o.set(`agentId`,r),n&&a.length===0){let e=p1(n),t=Date.now();if(f1&&f1.key===e&&t-f1.at<d1)return f1.items}let s=m1((await cP(Y(`/api/workspace/editor/files/search?${o.toString()}`))).payload.entries??[]);return n&&a.length===0&&(f1={key:p1(n),at:Date.now(),items:s}),s}async function g1(e,t){return BG(e,{sessionKey:t.sessionKey,agentId:t.agentId})}function _1(e){return{...e,...typeof e.avatar==`string`&&e.avatar.trim()?{avatar:e.avatar.trim()}:{},skills:e.skills??{defaults:[]},tools:e.tools??{defaultsDisable:[],entryDisable:[],effectiveDisable:[]}}}async function v1(){let e=(await cP(Y(`/api/agents`))).payload;if(!e?.defaultId||!Array.isArray(e.agents))throw Error(`Invalid /api/agents response`);let t=Array.isArray(e.builtinToolIds)?e.builtinToolIds:[];return{defaultId:e.defaultId,agents:e.agents.map(_1),builtinToolIds:t}}async function y1(e){let t=await cP(Y(`/api/agents`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=typeof t.payload?.agentId==`string`?t.payload.agentId.trim():``,r=t.payload?.agents;if(!n||!r?.defaultId||!Array.isArray(r.agents))throw Error(`Invalid create agent response`);return{createdAgentId:n,defaultId:r.defaultId,agents:r.agents.map(_1),builtinToolIds:Array.isArray(r.builtinToolIds)?r.builtinToolIds:[]}}async function b1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).payload;if(!n?.defaultId||!Array.isArray(n.agents))throw Error(`Invalid update agent response`);return{defaultId:n.defaultId,agents:n.agents.map(_1),builtinToolIds:Array.isArray(n.builtinToolIds)?n.builtinToolIds:[]}}async function x1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}${t?`?purge=true`:``}`),{method:`DELETE`})).payload?.agents;if(!n?.defaultId||!Array.isArray(n.agents))throw Error(`Invalid delete agent response`);return{defaultId:n.defaultId,agents:n.agents.map(_1),builtinToolIds:Array.isArray(n.builtinToolIds)?n.builtinToolIds:[]}}function S1(e){if(!e||typeof e!=`object`||!(`bindings`in e))return[];let t=e.bindings;return Array.isArray(t)?t:[]}async function C1(e){await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({bindings:e})}),WV()}async function w1(){let e=(await cP(Y(`/api/skills`))).payload?.catalog;return Array.isArray(e)?e:[]}async function T1(e){let t=(await cP(Y(`/api/agents/${encodeURIComponent(e)}/files`))).payload;if(!t?.files||!t.bootstrapDir)throw Error(`Invalid files list response`);return t}async function E1(e,t){let n=(await cP(Y(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`))).payload?.content;if(typeof n!=`string`)throw Error(`Invalid file content response`);return n}async function D1(e,t,n){await cP(Y(`/api/agents/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})})}function O1(e){let t=e.type.toLowerCase();return t===`image/png`||t===`image/jpeg`||t===`image/jpg`||t===`image/webp`?t===`image/jpg`?`image/jpeg`:t:null}function k1(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=String(r.result??``),n=e.indexOf(`,`);t(n>=0?e.slice(n+1):``)},r.onerror=()=>n(r.error??Error(`read failed`)),r.readAsDataURL(e)})}async function A1(e,t){let n=O1(t);if(!n)throw Error(`unsupported_image_type`);if(t.size===0||t.size>512*1024)throw Error(`avatar_too_large`);let r=await k1(t);if(!r)throw Error(`empty_file`);await cP(Y(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({base64:r,mimeType:n})})}async function j1(e){await cP(Y(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`DELETE`})}var M1=`main`;function N1(e,t){return e.name?.trim()||(e.id.trim().toLowerCase()===M1?t.defaultMainAgentName:e.id)}function P1(e,t){return e.description?.trim()||(e.id.trim().toLowerCase()===M1?t.defaultMainAgentDescription:``)}function F1(){let{pathname:e}=Ii(),{sessionKey:t}=Vi();if(!e.startsWith(`/chat`)||!t)return;let n=decodeURIComponent(t);return n&&n!==`new`?n:void 0}function I1(e){switch(e){case`Navigate`:return 0;case`Quick Settings`:return 1;case`Extensions`:return 2;case`Sessions`:return 3;case`Files`:return 4;case`Commands`:return 5;case`Skills`:return 6;case`Actions`:return 7;default:return 10}}function L1(e){switch(e.kind){case`extension`:return(0,J.jsx)(fx,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`route`:return(0,J.jsx)(Og,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`session`:return(0,J.jsx)(Og,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`file`:return(0,J.jsx)(Eg,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`command`:return(0,J.jsx)(pD,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`skill`:return(0,J.jsx)(Nw,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0});case`setting`:return(0,J.jsx)(xC,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0});case`action`:return(0,J.jsx)(kA,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0});default:return null}}function R1(e,t,n,r){if(r(),t.startsWith(`/chat`)){l1(e);return}n(`/chat`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{l1(e)})})}function z1(e){let t=[];for(let n of e.uiExtensions){let r=n.ui?.contributions?.commands;if(Array.isArray(r))for(let i of r)!i||typeof i.id!=`string`||typeof i.title!=`string`||t.push({kind:`extension`,id:`ext:${n.id}:${i.id}`,title:i.title,subtitle:n.name,groupLabel:`Extensions`,keywords:[n.id,n.name,i.id],run:()=>{e.close(),i.opensPanel!==void 0&&i.opensPanel!==``?e.navigate(`/apps/${encodeURIComponent(n.id)}`):window.dispatchEvent(new CustomEvent(`extension-command`,{detail:{extensionId:n.id,commandId:i.id}}))}})}return t}function B1(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(0),o=(0,L.useRef)(null),s=(0,L.useRef)(null),c=zi(),{pathname:l}=Ii(),u=oN(e=>e.language),d=DP(),f=F1(),p=p$(e=>e.agentId),m=S$(e=>e.setPath),h=(0,L.useRef)(0),[g,_]=(0,L.useState)({phase:`idle`,hits:[]}),[v,y]=(0,L.useState)(`main`),[b,x]=(0,L.useState)([]),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(!1),E=(0,L.useMemo)(()=>N$(u),[u]),D=(0,L.useCallback)(async()=>{y(`models`),r(``),a(0),T(!0);try{let e=await cP(Y(`/api/registry`)),t=[];for(let n of e.payload?.providers??[])for(let e of n.models??[])e.available!==!1&&t.push({id:e.ref,title:e.name||e.ref,subtitle:e.ref});t.sort((e,t)=>e.title.localeCompare(t.title)),x(t)}catch{x([])}finally{T(!1)}},[]),O=(0,L.useCallback)(async()=>{y(`agents`),r(``),a(0),T(!0);try{let e=await v1(),t=GM(u).agentsSettings;C(e.agents.map(e=>({id:e.id,title:N1(e,t),subtitle:e.id})))}catch{C([])}finally{T(!1)}},[u]),k=(0,L.useMemo)(()=>{let e=n.trim().toLowerCase(),t=v===`models`?b:v===`agents`?S:[];return e?t.filter(t=>t.title.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.subtitle?.toLowerCase().includes(e)??!1)):t},[v,b,S,n]);if((0,L.useEffect)(()=>{e&&(r(``),a(0),y(`main`),x([]),C([]),_({phase:`idle`,hits:[]}),window.setTimeout(()=>o.current?.focus(),50))},[e]),(0,L.useEffect)(()=>{a(e=>Math.min(e,Math.max(0,k.length>0?k.length-1:0)))},[k.length,v,n]),(0,L.useEffect)(()=>{let n=n=>{if((n.metaKey||n.ctrlKey)&&n.key===`k`){n.preventDefault(),t(e=>!e);return}if(!e)return;if(n.key===`Escape`){if(n.preventDefault(),v!==`main`){y(`main`),r(``),a(0);return}t(!1);return}let o=v===`main`?Math.max(0,g.hits.length-1):Math.max(0,k.length);if(n.key===`ArrowDown`){n.preventDefault(),a(e=>Math.min(e+1,o));return}if(n.key===`ArrowUp`){n.preventDefault(),a(e=>Math.max(0,e-1));return}if(n.key===`Enter`){if(n.preventDefault(),v===`models`){if(i===0){y(`main`),r(``);return}let e=k[i-1];if(!e)return;(async()=>{await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agents:{defaults:{model:e.id}}})}),WV(),window.dispatchEvent(new CustomEvent(`config-reload`)),t(!1),y(`main`)})();return}if(v===`agents`){if(i===0){y(`main`),r(``);return}let e=k[i-1];if(!e)return;window.dispatchEvent(new CustomEvent(`xopc-set-chat-agent`,{detail:{agentId:e.id}})),t(!1),y(`main`);return}let e=g.hits[i];e&&e.run()}};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,i,g.hits,v,k,w]),(0,L.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(`open-command-palette`,e),()=>window.removeEventListener(`open-command-palette`,e)},[]),(0,L.useEffect)(()=>{let e=()=>t(e=>!e);return window.addEventListener(`toggle-command-palette`,e),()=>window.removeEventListener(`toggle-command-palette`,e)},[]),(0,L.useEffect)(()=>{if(!e||v!==`main`)return;let r=n.trim(),i=++h.current,o=!1,s=window.setTimeout(()=>{(async()=>{try{_(e=>({phase:`loading`,hits:e.hits}));let e=()=>t(!1),n=E.map(t=>({kind:`route`,id:t.id,title:t.title,subtitle:t.subtitle,groupLabel:`Navigate`,keywords:[...t.keywords??[],t.path],run:()=>{e(),c(t.path)}})),s=I$(u,{closePalette:e,openModelPalette:D,openAgentPalette:O}),g=O$(u,c,e),v=z1({query:r,close:e,navigate:c,uiExtensions:d}),[y,b,x,S]=await Promise.all([o1(),s1(u),DH({search:r||void 0,limit:8,offset:0}).catch(()=>({items:[]})),(async()=>{let e=f?.trim(),t=p.trim();return!e&&!t?[]:await h1(r,{sessionKey:e||void 0,agentId:e?void 0:t||void 0,limit:10}).catch(()=>[])})()]),C=y.map(t=>({kind:`command`,id:`cmd:${t.id}`,title:`/${t.name}`,subtitle:t.description,groupLabel:`Commands`,keywords:[t.id,...t.aliases??[],t.category??``],run:()=>{R1(u1(t),l,c,e)}})),w=b.catalog.filter(e=>e.enabled&&!e.disableModelInvocation).map(t=>({kind:`skill`,id:`skill:${t.name}`,title:`/skill:${t.name}`,subtitle:t.description,groupLabel:`Skills`,keywords:[t.source??``,`skill`],run:()=>{R1(`/skill:${t.name} `,l,c,e)}})),T=(x.items??[]).map(t=>({kind:`session`,id:`session:${t.key}`,title:t.name?.trim()||t.key,subtitle:t.key,groupLabel:`Sessions`,keywords:[t.key,...t.tags??[],t.sourceChannel??``],run:()=>{e(),c(`/chat/${encodeURIComponent(t.key)}`)}})),k=S.filter(e=>!e.isDirectory).map(t=>({kind:`file`,id:`file:${t.relativePath}`,title:t.name,subtitle:t.relativePath,groupLabel:`Files`,keywords:[t.relativePath],run:()=>{e();let n=t.relativePath.replace(/\\/g,`/`).replace(/^\/+/,``),r=()=>m(n);if(l.startsWith(`/chat`)){r();return}c(`/chat`),window.setTimeout(()=>r(),0)}})),A=[...n,...s,...g,...v,...T,...k,...C,...w],j=[];for(let e of A){let t=j$(e,r);t!==null&&j.push({...e,rank:t})}let M={Navigate:12,"Quick Settings":12,Actions:8,Extensions:8,Sessions:8,Files:10,Commands:6,Skills:6},N=M$(j),P=[],F={};for(let e of N){let t=(F[e.groupLabel]??0)+1;if(!(t>(M[e.groupLabel]??6))&&(F[e.groupLabel]=t,P.push(e),P.length>=36))break}if(P.sort((e,t)=>I1(e.groupLabel)-I1(t.groupLabel)||e.rank-t.rank||e.title.localeCompare(t.title)),o||i!==h.current)return;_({phase:`ready`,hits:P}),a(e=>Math.min(e,Math.max(0,P.length-1)))}catch(e){if(o||i!==h.current)return;_({phase:`error`,hits:[],message:e instanceof Error?e.message:String(e)})}})()},120);return()=>{o=!0,window.clearTimeout(s)}},[e,n,E,d,c,f,p,l,m,u,D,O,v]),(0,L.useLayoutEffect)(()=>{if(!e)return;let t=s.current;t&&t.querySelector(`[data-global-palette-index="${String(i)}"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,i,g.hits,v,k.length]),!e)return null;let A=g.hits,j=u===`zh`?`返回`:`Back`;if(v===`models`||v===`agents`){let e=k;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/40 p-4 pt-[min(18vh,7rem)]`,role:`dialog`,"aria-modal":`true`,"aria-label":u===`zh`?`选择模型或智能体`:`Model or agent picker`,onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,J.jsxs)(`div`,{className:`flex w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,J.jsx)(`input`,{ref:o,type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:v===`models`?u===`zh`?`搜索模型…`:`Search models…`:u===`zh`?`搜索智能体…`:`Search agents…`,className:`border-b border-edge bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-fg-muted`,autoComplete:`off`,autoCorrect:`off`}),(0,J.jsxs)(`ul`,{ref:s,className:`max-h-[min(60vh,26rem)] overflow-y-auto p-2 text-sm [scrollbar-gutter:stable]`,role:`listbox`,children:[(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-global-palette-index":0,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-fg-muted`,i===0?`bg-surface-hover`:`hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(0),onClick:()=>{y(`main`),r(``),a(0)},children:[`← `,j]})}),w?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:u===`zh`?`加载中…`:`Loading…`}):e.length===0?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:u===`zh`?`无结果`:`No results`}):e.map((e,n)=>{let r=n+1;return(0,J.jsx)(`li`,{children:(0,J.jsx)(`button`,{type:`button`,"data-global-palette-index":r,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left`,i===r?`bg-surface-hover text-fg`:`text-fg hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(r),onClick:()=>{v===`models`?(async()=>{await cP(Y(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agents:{defaults:{model:e.id}}})}),WV(),window.dispatchEvent(new CustomEvent(`config-reload`)),t(!1),y(`main`)})():(window.dispatchEvent(new CustomEvent(`xopc-set-chat-agent`,{detail:{agentId:e.id}})),t(!1),y(`main`))},children:(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`min-w-0 truncate font-medium`,children:e.title}),e.subtitle?(0,J.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-fg-muted`,children:e.subtitle}):null]})})},e.id)})]})]})})}let M=``;return(0,J.jsx)(`div`,{className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/40 p-4 pt-[min(18vh,7rem)]`,role:`dialog`,"aria-modal":`true`,"aria-label":`Global search`,onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,J.jsxs)(`div`,{className:`flex w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,J.jsx)(`input`,{ref:o,type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:u===`zh`?`搜索…(会话 / 文件 / 设置 / 命令)`:`Search… (sessions, files, settings, commands)`,className:`border-b border-edge bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-fg-muted`,autoComplete:`off`,autoCorrect:`off`}),(0,J.jsx)(`ul`,{ref:s,className:`max-h-[min(60vh,26rem)] overflow-y-auto p-2 text-sm [scrollbar-gutter:stable]`,role:`listbox`,"aria-activedescendant":A[i]?`global-hit-${A[i].id}`:void 0,children:A.length===0?(0,J.jsx)(`li`,{className:`rounded-lg px-3 py-6 text-center text-fg-muted`,children:g.phase===`loading`?u===`zh`?`搜索中…`:`Searching…`:g.phase===`error`?g.message:u===`zh`?`无结果`:`No results`}):A.map((e,t)=>{let n=e.groupLabel===M?``:e.groupLabel;return M=e.groupLabel,(0,J.jsxs)(`li`,{children:[n?(0,J.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-fg-muted`,children:n}):null,(0,J.jsxs)(`button`,{id:`global-hit-${e.id}`,"data-global-palette-index":t,type:`button`,className:[`flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left`,t===i?`bg-surface-hover text-fg`:`text-fg hover:bg-surface-muted`].join(` `),onMouseEnter:()=>a(t),onClick:()=>e.run(),children:[(0,J.jsx)(`span`,{className:`mt-0.5`,children:L1(e)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`min-w-0 truncate font-medium`,children:e.title}),e.subtitle?(0,J.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-fg-muted`,children:e.subtitle}):null]})]})]},e.id)})})]})})}var V1=class{_eventSource;_shouldReconnect=!0;_reconnectCount=0;constructor(e,t){this._config=e,this._callbacks=t}get maxReconnectAttempts(){return this._config.maxReconnectAttempts??10}get autoReconnect(){return this._config.autoReconnect??!0}connect(){if(this._eventSource)return;let e=new URL(Y(`/api/events`));this._config.token&&e.searchParams.set(`token`,this._config.token),this._eventSource=new EventSource(e.toString()),this._eventSource.onopen=()=>{this._reconnectCount=0},this._eventSource.addEventListener(`connected`,()=>{this._callbacks.onConnected()});for(let e of[`agent.stream`,`config.reload`,`channels.status`,`message.sent`,`session.updated`,`session.created`,`dreaming.phase.start`,`dreaming.phase.end`])this._eventSource.addEventListener(e,t=>{this._callbacks.onEvent(e,t.data)});this._eventSource.onerror=()=>{this._eventSource?.readyState===EventSource.CLOSED?this._handlePermanentDisconnect():this._callbacks.onReconnecting()}}_handlePermanentDisconnect(){this._callbacks.onDisconnected(),!(!this._shouldReconnect||!this.autoReconnect)&&(this._reconnectCount++,this._reconnectCount>this.maxReconnectAttempts&&this._callbacks.onError(`Connection failed after max retries`))}disconnect(){this._shouldReconnect=!1,this._eventSource?.close(),this._eventSource=void 0}reconnect(){this._shouldReconnect=!0,this._reconnectCount=0,this.disconnect(),this._shouldReconnect=!0,setTimeout(()=>this.connect(),100)}};function H1(e,t){let n=t;try{n=JSON.parse(t)}catch{}let r=e.replace(/\./g,`-`);if(window.dispatchEvent(new CustomEvent(r,{detail:n})),e===`agent.stream`&&n&&typeof n==`object`&&n){let e=n;typeof e.sessionKey==`string`&&e.sessionKey.length>0&&window.dispatchEvent(new CustomEvent(`agent-stream-event`,{detail:{sessionKey:e.sessionKey,event:e.event===void 0?e:e.event}}))}}var U1=null;function W1(e){U1=e}function G1(){U1?.reconnect()}var K1=aN(()=>({connectionState:`idle`,error:null,reconnectAttempt:0}));function q1(e){K1.setState(e)}function J1(){let e=LN(e=>e.token);(0,L.useEffect)(()=>{if(!e){W1(null),q1({connectionState:`disconnected`,error:null,reconnectAttempt:0});return}let t=new V1({token:e,autoReconnect:!0,maxReconnectAttempts:10},{onConnected:()=>{q1({connectionState:`connected`,error:null,reconnectAttempt:0})},onReconnecting:()=>{q1({connectionState:`reconnecting`})},onDisconnected:()=>{q1({connectionState:`disconnected`})},onError:e=>{q1({connectionState:`error`,error:e})},onEvent:(e,t)=>{H1(e,t)}});return W1(t),q1({connectionState:`connecting`,error:null}),t.connect(),()=>{t.disconnect(),W1(null),q1({connectionState:`disconnected`,error:null})}},[e])}function Y1(){return J1(),null}var X1=1e3,Z1=1001,Q1=1002,$1=1003,e0=1004,t0=1005,n0=1006,r0=1007,i0=1008,a0=1009,o0=1010,s0=1011,c0=1012,l0=1013,u0=1014,d0=1015,f0=1016,p0=1017,m0=1018,h0=1020,g0=35902,_0=35899,v0=1021,y0=1022,b0=1023,x0=1026,S0=1027,C0=1028,w0=1029,T0=1030,E0=1031,D0=1033,O0=33776,k0=33777,A0=33778,j0=33779,M0=35840,N0=35841,P0=35842,F0=35843,I0=36196,L0=37492,R0=37496,z0=37488,B0=37489,V0=37490,H0=37491,U0=37808,W0=37809,G0=37810,K0=37811,pce=37812,mce=37813,hce=37814,gce=37815,_ce=37816,vce=37817,yce=37818,bce=37819,xce=37820,Sce=37821,Cce=36492,wce=36494,Tce=36495,Ece=36283,Dce=36284,Oce=36285,kce=36286,q0=2300,J0=2301,Y0=2302,X0=2303,Z0=2400,Q0=2401,$0=2402,Ace=3200,e2=`srgb`,t2=`srgb-linear`,n2=`linear`,r2=`srgb`,i2=7680,jce=35044,a2=2e3;function Mce(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Nce(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function o2(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Pce(){let e=o2(`canvas`);return e.style.display=`block`,e}var s2={},c2=null;function l2(...e){let t=`THREE.`+e.shift();c2?c2(`log`,t,...e):console.log(t,...e)}function u2(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function d2(...e){e=u2(e);let t=`THREE.`+e.shift();if(c2)c2(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function f2(...e){e=u2(e);let t=`THREE.`+e.shift();if(c2)c2(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function p2(...e){let t=e.join(` `);t in s2||(s2[t]=!0,d2(...e))}function Fce(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var Ice={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},m2=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},h2=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),g2=Math.PI/180,_2=180/Math.PI;function v2(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(h2[e&255]+h2[e>>8&255]+h2[e>>16&255]+h2[e>>24&255]+`-`+h2[t&255]+h2[t>>8&255]+`-`+h2[t>>16&15|64]+h2[t>>24&255]+`-`+h2[n&63|128]+h2[n>>8&255]+`-`+h2[n>>16&255]+h2[n>>24&255]+h2[r&255]+h2[r>>8&255]+h2[r>>16&255]+h2[r>>24&255]).toLowerCase()}function y2(e,t,n){return Math.max(t,Math.min(n,e))}function Lce(e,t){return(e%t+t)%t}function b2(e,t,n){return(1-n)*e+n*t}function x2(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function S2(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var C2=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(y2(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},w2=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:d2(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(y2(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Q=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(E2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(E2.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this.z=y2(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this.z=y2(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return T2.copy(this).projectOnVector(e),this.sub(T2)}reflect(e){return this.sub(T2.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(y2(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},T2=new Q,E2=new w2,D2=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(O2.makeScale(e,t)),this}rotate(e){return this.premultiply(O2.makeRotation(-e)),this}translate(e,t){return this.premultiply(O2.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},O2=new D2,k2=new D2().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),A2=new D2().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Rce(){let e={enabled:!0,workingColorSpace:t2,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=M2(e.r),e.g=M2(e.g),e.b=M2(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=N2(e.r),e.g=N2(e.g),e.b=N2(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?n2:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return p2(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return p2(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[t2]:{primaries:t,whitePoint:r,transfer:n2,toXYZ:k2,fromXYZ:A2,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:e2},outputColorSpaceConfig:{drawingBufferColorSpace:e2}},[e2]:{primaries:t,whitePoint:r,transfer:r2,toXYZ:k2,fromXYZ:A2,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:e2}}}),e}var j2=Rce();function M2(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function N2(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var P2,zce=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{P2===void 0&&(P2=o2(`canvas`)),P2.width=e.width,P2.height=e.height;let t=P2.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=P2}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=o2(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=M2(i[e]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(M2(t[e]/255)*255):t[e]=M2(t[e]);return{data:t,width:e.width,height:e.height}}else return d2(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Bce=0,F2=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,`id`,{value:Bce++}),this.uuid=v2(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(I2(r[t].image)):e.push(I2(r[t]))}else e=I2(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function I2(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?zce.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(d2(`Texture: Unable to serialize Texture.`),{})}var Vce=0,L2=new Q,R2=class e extends m2{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=Z1,i=Z1,a=n0,o=i0,s=b0,c=a0,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,`id`,{value:Vce++}),this.uuid=v2(),this.name=``,this.source=new F2(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new C2(0,0),this.repeat=new C2(1,1),this.center=new C2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new D2,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(L2).x}get height(){return this.source.getSize(L2).y}get depth(){return this.source.getSize(L2).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){d2(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){d2(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case X1:e.x-=Math.floor(e.x);break;case Z1:e.x=e.x<0?0:1;break;case Q1:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case X1:e.y-=Math.floor(e.y);break;case Z1:e.y=e.y<0?0:1;break;case Q1:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};R2.DEFAULT_IMAGE=null,R2.DEFAULT_MAPPING=300,R2.DEFAULT_ANISOTROPY=1;var z2=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=y2(this.x,e.x,t.x),this.y=y2(this.y,e.y,t.y),this.z=y2(this.z,e.z,t.z),this.w=y2(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=y2(this.x,e,t),this.y=y2(this.y,e,t),this.z=y2(this.z,e,t),this.w=y2(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(y2(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Hce=class extends m2{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:n0,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new z2(0,0,e,t),this.scissorTest=!1,this.viewport=new z2(0,0,e,t),this.textures=[];let r=new R2({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:n0,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new F2(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:`dispose`})}},B2=class extends Hce{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},V2=class extends R2{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=$1,this.minFilter=$1,this.wrapR=Z1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Uce=class extends R2{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=$1,this.minFilter=$1,this.wrapR=Z1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},H2=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,r=1/U2.setFromMatrixColumn(e,0).length(),i=1/U2.setFromMatrixColumn(e,1).length(),a=1/U2.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Wce,e,Gce)}lookAt(e,t,n){let r=this.elements;return q2.subVectors(e,t),q2.lengthSq()===0&&(q2.z=1),q2.normalize(),G2.crossVectors(n,q2),G2.lengthSq()===0&&(Math.abs(n.z)===1?q2.x+=1e-4:q2.z+=1e-4,q2.normalize(),G2.crossVectors(n,q2)),G2.normalize(),K2.crossVectors(q2,G2),r[0]=G2.x,r[4]=K2.x,r[8]=q2.x,r[1]=G2.y,r[5]=K2.y,r[9]=q2.y,r[2]=G2.z,r[6]=K2.z,r[10]=q2.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinant();if(i===0)return n.set(1,1,1),t.identity(),this;let a=U2.set(r[0],r[1],r[2]).length(),o=U2.set(r[4],r[5],r[6]).length(),s=U2.set(r[8],r[9],r[10]).length();i<0&&(a=-a),W2.copy(this);let c=1/a,l=1/o,u=1/s;return W2.elements[0]*=c,W2.elements[1]*=c,W2.elements[2]*=c,W2.elements[4]*=l,W2.elements[5]*=l,W2.elements[6]*=l,W2.elements[8]*=u,W2.elements[9]*=u,W2.elements[10]*=u,t.setFromRotationMatrix(W2),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=a2,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=a2,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},U2=new Q,W2=new H2,Wce=new Q(0,0,0),Gce=new Q(1,1,1),G2=new Q,K2=new Q,q2=new Q,J2=new H2,Y2=new w2,X2=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(y2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-y2(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(y2(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-y2(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(y2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-y2(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:d2(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return J2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(J2,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Y2.setFromEuler(this),this.setFromQuaternion(Y2,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};X2.DEFAULT_ORDER=`XYZ`;var Z2=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},Kce=0,Q2=new Q,$2=new w2,e4=new H2,t4=new Q,n4=new Q,qce=new Q,Jce=new w2,r4=new Q(1,0,0),i4=new Q(0,1,0),a4=new Q(0,0,1),o4={type:`added`},Yce={type:`removed`},s4={type:`childadded`,child:null},c4={type:`childremoved`,child:null},l4=class e extends m2{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,`id`,{value:Kce++}),this.uuid=v2(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new Q,n=new X2,r=new w2,i=new Q(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new H2},normalMatrix:{value:new D2}}),this.matrix=new H2,this.matrixWorld=new H2,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Z2,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return $2.setFromAxisAngle(e,t),this.quaternion.multiply($2),this}rotateOnWorldAxis(e,t){return $2.setFromAxisAngle(e,t),this.quaternion.premultiply($2),this}rotateX(e){return this.rotateOnAxis(r4,e)}rotateY(e){return this.rotateOnAxis(i4,e)}rotateZ(e){return this.rotateOnAxis(a4,e)}translateOnAxis(e,t){return Q2.copy(e).applyQuaternion(this.quaternion),this.position.add(Q2.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(r4,e)}translateY(e){return this.translateOnAxis(i4,e)}translateZ(e){return this.translateOnAxis(a4,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(e4.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?t4.copy(e):t4.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),n4.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e4.lookAt(n4,t4,this.up):e4.lookAt(t4,n4,this.up),this.quaternion.setFromRotationMatrix(e4),r&&(e4.extractRotation(r.matrixWorld),$2.setFromRotationMatrix(e4),this.quaternion.premultiply($2.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(f2(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(o4),s4.child=e,this.dispatchEvent(s4),s4.child=null):f2(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Yce),c4.child=e,this.dispatchEvent(c4),c4.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),e4.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),e4.multiply(e.parent.matrixWorld)),e.applyMatrix4(e4),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(o4),s4.child=e,this.dispatchEvent(s4),s4.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n4,e,qce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(n4,Jce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};l4.DEFAULT_UP=new Q(0,1,0),l4.DEFAULT_MATRIX_AUTO_UPDATE=!0,l4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var u4=class extends l4{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Xce={type:`move`},d4=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new u4,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new u4,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new u4,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position),s=.02,l=.005;c.inputState.pinching&&o>s+l?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=s-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Xce)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new u4;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},f4={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},p4={h:0,s:0,l:0},m4={h:0,s:0,l:0};function h4(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var g4=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=e2){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,j2.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=j2.workingColorSpace){return this.r=e,this.g=t,this.b=n,j2.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=j2.workingColorSpace){if(e=Lce(e,1),t=y2(t,0,1),n=y2(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=h4(i,r,e+1/3),this.g=h4(i,r,e),this.b=h4(i,r,e-1/3)}return j2.colorSpaceToWorking(this,r),this}setStyle(e,t=e2){function n(t){t!==void 0&&parseFloat(t)<1&&d2(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:d2(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);d2(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=e2){let n=f4[e.toLowerCase()];return n===void 0?d2(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=M2(e.r),this.g=M2(e.g),this.b=M2(e.b),this}copyLinearToSRGB(e){return this.r=N2(e.r),this.g=N2(e.g),this.b=N2(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=e2){return j2.workingToColorSpace(_4.copy(this),e),Math.round(y2(_4.r*255,0,255))*65536+Math.round(y2(_4.g*255,0,255))*256+Math.round(y2(_4.b*255,0,255))}getHexString(e=e2){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=j2.workingColorSpace){j2.workingToColorSpace(_4.copy(this),t);let n=_4.r,r=_4.g,i=_4.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4;break}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=j2.workingColorSpace){return j2.workingToColorSpace(_4.copy(this),t),e.r=_4.r,e.g=_4.g,e.b=_4.b,e}getStyle(e=e2){j2.workingToColorSpace(_4.copy(this),e);let t=_4.r,n=_4.g,r=_4.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(p4),this.setHSL(p4.h+e,p4.s+t,p4.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(p4),e.getHSL(m4);let n=b2(p4.h,m4.h,t),r=b2(p4.s,m4.s,t),i=b2(p4.l,m4.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},_4=new g4;g4.NAMES=f4;var Zce=class extends l4{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new X2,this.environmentIntensity=1,this.environmentRotation=new X2,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},v4=new Q,y4=new Q,b4=new Q,x4=new Q,S4=new Q,C4=new Q,w4=new Q,T4=new Q,E4=new Q,D4=new Q,O4=new z2,k4=new z2,A4=new z2,j4=class e{constructor(e=new Q,t=new Q,n=new Q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),v4.subVectors(e,t),r.cross(v4);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){v4.subVectors(r,t),y4.subVectors(n,t),b4.subVectors(e,t);let a=v4.dot(v4),o=v4.dot(y4),s=v4.dot(b4),c=y4.dot(y4),l=y4.dot(b4),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,x4)===null?!1:x4.x>=0&&x4.y>=0&&x4.x+x4.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,x4)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,x4.x),s.addScaledVector(a,x4.y),s.addScaledVector(o,x4.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return O4.setScalar(0),k4.setScalar(0),A4.setScalar(0),O4.fromBufferAttribute(e,t),k4.fromBufferAttribute(e,n),A4.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(O4,i.x),a.addScaledVector(k4,i.y),a.addScaledVector(A4,i.z),a}static isFrontFacing(e,t,n,r){return v4.subVectors(n,t),y4.subVectors(e,t),v4.cross(y4).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return v4.subVectors(this.c,this.b),y4.subVectors(this.a,this.b),v4.cross(y4).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;S4.subVectors(r,n),C4.subVectors(i,n),T4.subVectors(e,n);let s=S4.dot(T4),c=C4.dot(T4);if(s<=0&&c<=0)return t.copy(n);E4.subVectors(e,r);let l=S4.dot(E4),u=C4.dot(E4);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(S4,a);D4.subVectors(e,i);let f=S4.dot(D4),p=C4.dot(D4);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(C4,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return w4.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(w4,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(S4,a).addScaledVector(C4,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},M4=class{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(P4.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(P4.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=P4.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,P4):P4.fromBufferAttribute(r,t),P4.applyMatrix4(e.matrixWorld),this.expandByPoint(P4);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),F4.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),F4.copy(e.boundingBox)),F4.applyMatrix4(e.matrixWorld),this.union(F4)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,P4),P4.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(H4),U4.subVectors(this.max,H4),I4.subVectors(e.a,H4),L4.subVectors(e.b,H4),R4.subVectors(e.c,H4),z4.subVectors(L4,I4),B4.subVectors(R4,L4),V4.subVectors(I4,R4);let t=[0,-z4.z,z4.y,0,-B4.z,B4.y,0,-V4.z,V4.y,z4.z,0,-z4.x,B4.z,0,-B4.x,V4.z,0,-V4.x,-z4.y,z4.x,0,-B4.y,B4.x,0,-V4.y,V4.x,0];return!K4(t,I4,L4,R4,U4)||(t=[1,0,0,0,1,0,0,0,1],!K4(t,I4,L4,R4,U4))?!1:(W4.crossVectors(z4,B4),t=[W4.x,W4.y,W4.z],K4(t,I4,L4,R4,U4))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,P4).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(P4).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(N4[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),N4[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),N4[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),N4[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),N4[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),N4[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),N4[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),N4[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(N4),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},N4=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],P4=new Q,F4=new M4,I4=new Q,L4=new Q,R4=new Q,z4=new Q,B4=new Q,V4=new Q,H4=new Q,U4=new Q,W4=new Q,G4=new Q;function K4(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){G4.fromArray(e,a);let o=i.x*Math.abs(G4.x)+i.y*Math.abs(G4.y)+i.z*Math.abs(G4.z),s=t.dot(G4),c=n.dot(G4),l=r.dot(G4);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var q4=new Q,J4=new C2,Qce=0,Y4=class extends m2{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,`id`,{value:Qce++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=jce,this.updateRanges=[],this.gpuType=d0,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)J4.fromBufferAttribute(this,t),J4.applyMatrix3(e),this.setXY(t,J4.x,J4.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyMatrix3(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyMatrix4(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.applyNormalMatrix(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)q4.fromBufferAttribute(this,t),q4.transformDirection(e),this.setXYZ(t,q4.x,q4.y,q4.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=x2(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=S2(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=x2(t,this.array)),t}setX(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=x2(t,this.array)),t}setY(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=x2(t,this.array)),t}setZ(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=x2(t,this.array)),t}setW(e,t){return this.normalized&&(t=S2(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array),r=S2(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=S2(t,this.array),n=S2(n,this.array),r=S2(r,this.array),i=S2(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},X4=class extends Y4{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Z4=class extends Y4{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Q4=class extends Y4{constructor(e,t,n){super(new Float32Array(e),t,n)}},$ce=new M4,$4=new Q,e3=new Q,t3=class{constructor(e=new Q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?$ce.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;$4.subVectors(e,this.center);let t=$4.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector($4,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(e3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint($4.copy(e.center).add(e3)),this.expandByPoint($4.copy(e.center).sub(e3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},ele=0,n3=new H2,r3=new l4,i3=new Q,a3=new M4,o3=new M4,s3=new Q,c3=class e extends m2{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,`id`,{value:ele++}),this.uuid=v2(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Mce(e)?Z4:X4)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new D2().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return n3.makeRotationFromQuaternion(e),this.applyMatrix4(n3),this}rotateX(e){return n3.makeRotationX(e),this.applyMatrix4(n3),this}rotateY(e){return n3.makeRotationY(e),this.applyMatrix4(n3),this}rotateZ(e){return n3.makeRotationZ(e),this.applyMatrix4(n3),this}translate(e,t,n){return n3.makeTranslation(e,t,n),this.applyMatrix4(n3),this}scale(e,t,n){return n3.makeScale(e,t,n),this.applyMatrix4(n3),this}lookAt(e){return r3.lookAt(e),r3.updateMatrix(),this.applyMatrix4(r3.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i3).negate(),this.translate(i3.x,i3.y,i3.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new Q4(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&d2(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new M4);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){f2(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Q(-1/0,-1/0,-1/0),new Q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];a3.setFromBufferAttribute(n),this.morphTargetsRelative?(s3.addVectors(this.boundingBox.min,a3.min),this.boundingBox.expandByPoint(s3),s3.addVectors(this.boundingBox.max,a3.max),this.boundingBox.expandByPoint(s3)):(this.boundingBox.expandByPoint(a3.min),this.boundingBox.expandByPoint(a3.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&f2(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new t3);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){f2(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new Q,1/0);return}if(e){let n=this.boundingSphere.center;if(a3.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];o3.setFromBufferAttribute(n),this.morphTargetsRelative?(s3.addVectors(a3.min,o3.min),a3.expandByPoint(s3),s3.addVectors(a3.max,o3.max),a3.expandByPoint(s3)):(a3.expandByPoint(o3.min),a3.expandByPoint(o3.max))}a3.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)s3.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(s3));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)s3.fromBufferAttribute(a,t),o&&(i3.fromBufferAttribute(e,t),s3.add(i3)),r=Math.max(r,n.distanceToSquared(s3))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&f2(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){f2(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new Y4(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Q,s[e]=new Q;let c=new Q,l=new Q,u=new Q,d=new C2,f=new C2,p=new C2,m=new Q,h=new Q;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new Q,y=new Q,b=new Q,x=new Q;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new Y4(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new Q,i=new Q,a=new Q,o=new Q,s=new Q,c=new Q,l=new Q,u=new Q;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)s3.fromBufferAttribute(e,t),s3.normalize(),e.setXYZ(t,s3.x,s3.y,s3.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Y4(a,r,i)}if(this.index===null)return d2(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:`dispose`})}},tle=0,l3=class extends m2{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,`id`,{value:tle++}),this.uuid=v2(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new g4(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=i2,this.stencilZFail=i2,this.stencilZPass=i2,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){d2(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){d2(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},u3=new Q,d3=new Q,f3=new Q,p3=new Q,m3=new Q,h3=new Q,g3=new Q,_3=class{constructor(e=new Q,t=new Q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,u3)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=u3.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(u3.copy(this.origin).addScaledVector(this.direction,t),u3.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){d3.copy(e).add(t).multiplyScalar(.5),f3.copy(t).sub(e).normalize(),p3.copy(this.origin).sub(d3);let i=e.distanceTo(t)*.5,a=-this.direction.dot(f3),o=p3.dot(this.direction),s=-p3.dot(f3),c=p3.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(d3).addScaledVector(f3,d),f}intersectSphere(e,t){u3.subVectors(e.center,this.origin);let n=u3.dot(this.direction),r=u3.dot(u3)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,u3)!==null}intersectTriangle(e,t,n,r,i){m3.subVectors(t,e),h3.subVectors(n,e),g3.crossVectors(m3,h3);let a=this.direction.dot(g3),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;p3.subVectors(this.origin,e);let s=o*this.direction.dot(h3.crossVectors(p3,h3));if(s<0)return null;let c=o*this.direction.dot(m3.cross(p3));if(c<0||s+c>a)return null;let l=-o*p3.dot(g3);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},v3=class extends l3{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new g4(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new X2,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},y3=new H2,b3=new _3,x3=new t3,S3=new Q,C3=new Q,w3=new Q,T3=new Q,E3=new Q,D3=new Q,O3=new Q,k3=new Q,A3=class extends l4{constructor(e=new c3,t=new v3){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){D3.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(E3.fromBufferAttribute(s,e),a?D3.addScaledVector(E3,r):D3.addScaledVector(E3.sub(t),r))}t.add(D3)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),x3.copy(n.boundingSphere),x3.applyMatrix4(i),b3.copy(e.ray).recast(e.near),!(x3.containsPoint(b3.origin)===!1&&(b3.intersectSphere(x3,S3)===null||b3.origin.distanceToSquared(S3)>(e.far-e.near)**2))&&(y3.copy(i).invert(),b3.copy(e.ray).applyMatrix4(y3),!(n.boundingBox!==null&&b3.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,b3)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=j3(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=j3(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=j3(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=j3(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function nle(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;k3.copy(s),k3.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(k3);return l<n.near||l>n.far?null:{distance:l,point:k3.clone(),object:e}}function j3(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,C3),e.getVertexPosition(c,w3),e.getVertexPosition(l,T3);let u=nle(e,t,n,r,C3,w3,T3,O3);if(u){let e=new Q;j4.getBarycoord(O3,C3,w3,T3,e),i&&(u.uv=j4.getInterpolatedAttribute(i,s,c,l,e,new C2)),a&&(u.uv1=j4.getInterpolatedAttribute(a,s,c,l,e,new C2)),o&&(u.normal=j4.getInterpolatedAttribute(o,s,c,l,e,new Q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Q,materialIndex:0};j4.getNormal(C3,w3,T3,t.normal),u.face=t,u.barycoord=e}return u}var rle=class extends R2{constructor(e=null,t=1,n=1,r,i,a,o,s,c=$1,l=$1,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},M3=new Q,ile=new Q,ale=new D2,N3=class{constructor(e=new Q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=M3.subVectors(n,t).cross(ile.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(M3),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||ale.getNormalMatrix(e),r=this.coplanarPoint(M3).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},P3=new t3,ole=new C2(.5,.5),F3=new Q,I3=class{constructor(e=new N3,t=new N3,n=new N3,r=new N3,i=new N3,a=new N3){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=a2,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),P3.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),P3.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(P3)}intersectsSprite(e){return P3.center.set(0,0,0),P3.radius=.7071067811865476+ole.distanceTo(e.center),P3.applyMatrix4(e.matrixWorld),this.intersectsSphere(P3)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(F3.x=r.normal.x>0?e.max.x:e.min.x,F3.y=r.normal.y>0?e.max.y:e.min.y,F3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(F3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},sle=class extends l3{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new g4(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},L3=new Q,R3=new Q,z3=new H2,B3=new _3,V3=new t3,H3=new Q,U3=new Q,cle=class extends l4{constructor(e=new c3,t=new sle){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)L3.fromBufferAttribute(t,e-1),R3.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=L3.distanceTo(R3);e.setAttribute(`lineDistance`,new Q4(n,1))}else d2(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),V3.copy(n.boundingSphere),V3.applyMatrix4(r),V3.radius+=i,e.ray.intersectsSphere(V3)===!1)return;z3.copy(r).invert(),B3.copy(e.ray).applyMatrix4(z3);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=W3(this,e,B3,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=W3(this,e,B3,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=W3(this,e,B3,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=W3(this,e,B3,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function W3(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(L3.fromBufferAttribute(s,i),R3.fromBufferAttribute(s,a),n.distanceSqToSegment(L3,R3,H3,U3)>r)return;H3.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(H3);if(!(c<t.near||c>t.far))return{distance:c,point:U3.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var G3=new Q,K3=new Q,lle=class extends cle{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)G3.fromBufferAttribute(t,e),K3.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+G3.distanceTo(K3);e.setAttribute(`lineDistance`,new Q4(n,1))}else d2(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},ule=class extends l3{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new g4(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},q3=new H2,J3=new _3,Y3=new t3,X3=new Q,Z3=class extends l4{constructor(e=new c3,t=new ule){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Y3.copy(n.boundingSphere),Y3.applyMatrix4(r),Y3.radius+=i,e.ray.intersectsSphere(Y3)===!1)return;q3.copy(r).invert(),J3.copy(e.ray).applyMatrix4(q3);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);X3.fromBufferAttribute(l,n),Q3(X3,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)X3.fromBufferAttribute(l,a),Q3(X3,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function Q3(e,t,n,r,i,a,o){let s=J3.distanceSqToPoint(e);if(s<n){let n=new Q;J3.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var $3=class extends R2{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},e6=class extends R2{constructor(e,t,n=u0,r,i,a,o=$1,s=$1,c,l=x0,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new F2(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},dle=class extends e6{constructor(e,t=u0,n=301,r,i,a=$1,o=$1,s,c=x0){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},t6=class extends R2{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},n6=class e extends c3{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Q4(c,3)),this.setAttribute(`normal`,new Q4(l,3)),this.setAttribute(`uv`,new Q4(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Q;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},r6=class e extends c3{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new Q4(p,3)),this.setAttribute(`normal`,new Q4(m,3)),this.setAttribute(`uv`,new Q4(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}};function i6(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(o6(i))i.isRenderTargetTexture?(d2(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i))if(o6(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice();else t[n][r]=i}}return t}function a6(e){let t={};for(let n=0;n<e.length;n++){let r=i6(e[n]);for(let e in r)t[e]=r[e]}return t}function o6(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function fle(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function s6(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:j2.workingColorSpace}var ple={clone:i6,merge:a6},mle=`void main() {
136
136
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
137
137
  }`,hle=`void main() {
138
138
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -4730,5 +4730,5 @@ void main() {
4730
4730
  `).trim()}function rge(e){if(!e.trim())return``;let t=$J.parse(e,{gfm:!0,breaks:!1});return new DOMParser().parseFromString(`<div>${t}</div>`,`text/html`).body.textContent?.trim()??``}function ige(e){let t=[];for(let n of e)n.type===`thinking`||n.type===`tool_use`||(n.type===`text`?t.push(rge(n.text)):n.type===`image`&&t.push(`[image]`));return t.join(`
4731
4731
 
4732
4732
  `).trim()}var g9=q(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg`,`text-fg-muted transition-colors transition-transform duration-150 ease-out`,`hover:bg-surface-hover hover:text-fg active:scale-95`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Z.disabled),_9=q(`inline-flex h-8 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-xs text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg active:scale-[0.98]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,Z.disabled),age=(0,L.memo)(function({message:e,authToken:t,sessionKey:n,isStreaming:r,progress:i,reasoningLevel:a=`stream`,messageIndex:o,onDeleteRound:s,onRetryUserMessageRound:c,userMessageCanRetry:l=!1,deleteRoundDisabled:u=!1}){let d=GM(oN(e=>e.language)),f=e.role===`user`||e.role===`user-with-attachments`,p=e.role===`assistant`,m=f?d.chat.you:p?d.chat.assistant:d.chat.tool,h=(0,L.useMemo)(()=>({input:d.chat.toolInput,output:d.chat.toolOutput,noOutput:d.chat.noOutput}),[d.chat.toolInput,d.chat.toolOutput,d.chat.noOutput]),g=(0,L.useMemo)(()=>({thoughts:d.chat.thoughts,thoughtsStreaming:d.chat.thoughtsStreaming,viewSteps_one:d.chat.viewSteps_one,viewSteps_other:d.chat.viewSteps_other,searchedWeb:d.chat.stepSearchedWeb,readFile:d.chat.stepReadFile,stepDetails:d.chat.stepDetails,runCommand:d.chat.stepRunCommand,listDirectory:d.chat.stepListDirectory,writeFile:d.chat.stepWriteFile,editFile:d.chat.stepEditFile,openUrl:d.chat.stepOpenUrl,fetchUrl:d.chat.stepFetchUrl,unknownTool:d.chat.stepUnknownTool}),[d.chat.thoughts,d.chat.thoughtsStreaming,d.chat.viewSteps_one,d.chat.viewSteps_other,d.chat.stepSearchedWeb,d.chat.stepReadFile,d.chat.stepDetails,d.chat.stepRunCommand,d.chat.stepListDirectory,d.chat.stepWriteFile,d.chat.stepEditFile,d.chat.stepOpenUrl,d.chat.stepFetchUrl,d.chat.stepUnknownTool]),_=a===`off`,v=(0,L.useMemo)(()=>_?(e.content??[]).filter(e=>e.type!==`thinking`):e.content??[],[e.content,_]),y=(0,L.useMemo)(()=>p?(v??[]).filter(e=>e.type!==`image`):v,[p,v]),b=(0,L.useMemo)(()=>p?Xhe(e.content):[],[p,e.content]),x=(0,L.useMemo)(()=>p?(e.content??[]).filter(e=>e.type===`image`&&!!e.source?.data):[],[p,e.content]),S=(0,L.useMemo)(()=>p?Zhe(x):[],[p,x]),C=p&&(b.length>0||S.length>0),w=_&&i?.stage===`thinking`?null:i,T=_?!1:!!e.content?.some(e=>e.type===`thinking`&&e.streaming),E=!!e.timestamp||!!w?.message||r&&!T,D=(0,L.useMemo)(()=>p?nge(e.content??[]):``,[p,e.content]),O=(0,L.useMemo)(()=>p&&D?ige(e.content??[]):``,[p,D,e.content]),k=(0,L.useMemo)(()=>f?f9(e.content):``,[f,e.content]),[A,j]=(0,L.useState)(null),[M,N]=(0,L.useState)(!1),[P,F]=(0,L.useState)(null),I=(0,L.useCallback)((e,t)=>{let n=Qhe(e,t);n&&F(n)},[]),ee=(0,L.useCallback)(()=>{O&&Cq(O).then(e=>{e&&(j(`plain`),window.setTimeout(()=>j(e=>e===`plain`?null:e),2e3))})},[O]),te=(0,L.useCallback)(()=>{D&&Cq(D).then(e=>{e&&(j(`markdown`),window.setTimeout(()=>j(e=>e===`markdown`?null:e),2e3))})},[D]),ne=(0,L.useCallback)(()=>{k&&Cq(k).then(e=>{e&&(j(`user`),window.setTimeout(()=>j(e=>e===`user`?null:e),2e3))})},[k]),R=(0,L.useCallback)(()=>{o==null||!s||N(!0)},[o,s]),z=(0,L.useCallback)(()=>{o==null||!s||(s(o),N(!1))},[o,s]),B=(0,L.useCallback)(()=>{N(!1)},[]),re=(0,L.useMemo)(()=>{let t=jhe(e);return _?t.filter(e=>e.type!==`thinking`):t},[e,_]),V=u||!l;return(0,J.jsxs)(`article`,{className:q(`group/msg flex w-full min-w-0`,f?`justify-end`:`justify-start`),children:[(0,J.jsxs)(`div`,{className:q(`min-w-0 max-w-[min(85%,var(--max-width-chat))]`,f?`flex w-full flex-col items-end`:`w-full`),children:[(0,J.jsx)(`span`,{className:`sr-only`,children:m}),f&&E?(0,J.jsxs)(`div`,{className:`mb-2 flex w-full min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-0.5 text-xs`,children:[e.timestamp?(0,J.jsx)(`time`,{className:`shrink-0 tabular-nums text-fg-disabled`,dateTime:new Date(e.timestamp).toISOString(),children:h9(e.timestamp)}):null,w?.message?(0,J.jsx)(`span`,{className:`text-fg-subtle`,title:w.detail??``,children:w.message}):null,r&&!T&&!w?.message?(0,J.jsx)(`span`,{className:`text-fg-subtle`,children:d.chat.thinkingLabel}):null]}):null,!f&&E?(0,J.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-fg-disabled`,children:[e.timestamp?(0,J.jsx)(`time`,{className:`tabular-nums`,dateTime:new Date(e.timestamp).toISOString(),children:h9(e.timestamp)}):null,w?.message?(0,J.jsx)(`span`,{className:`text-fg-subtle`,title:w.detail??``,children:w.message}):null,r&&!T&&!w?.message?(0,J.jsx)(`span`,{className:`text-fg-subtle`,children:d.chat.thinkingLabel}):null]}):null,(0,J.jsx)(`div`,{dir:f?`ltr`:void 0,className:q(`min-w-0 text-sm leading-relaxed text-fg`,f&&`w-fit max-w-full rounded-xl border border-edge-subtle/70 bg-surface-hover/90 px-4 py-3 text-left shadow-sm dark:border-edge-subtle dark:bg-surface-hover/50`),children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(y?.length??0)>0?(0,J.jsxs)(J.Fragment,{children:[tge(y,f,p&&r,h,g,d.chat.attachmentPreviewImage,I,n),r?(0,J.jsx)(`span`,{className:`inline-block h-3 w-0.5 animate-pulse bg-accent align-middle`}):null]}):r?(0,J.jsx)(`span`,{className:`inline-block h-3 w-0.5 animate-pulse bg-accent`}):null,p&&re.length>0?(0,J.jsx)(Bhe,{blocks:re}):null,C?(0,J.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle/60 bg-surface-elevated/20 px-3 py-2.5`,role:`group`,"aria-label":d.chat.messageArtifactsHeading,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:d.chat.messageArtifactsHeading}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[b.length>0?(0,J.jsx)(G7,{paths:b,sessionKey:n}):null,S.length>0?(0,J.jsx)(u9,{attachments:S,authToken:t,sessionKey:n,layout:`assistant`}):null]})]}):null,e.attachments?.length?f?(0,J.jsx)(u9,{attachments:e.attachments,authToken:t,sessionKey:n,layout:`user`,centerUserVoiceRow:k.length===0}):(0,J.jsx)(u9,{attachments:e.attachments,authToken:t,sessionKey:n,layout:`assistant`}):null]})}),f&&!r?(0,J.jsx)(`div`,{className:`mt-1.5 flex h-8 w-full min-w-0 shrink-0 justify-end`,children:(0,J.jsxs)(`div`,{className:q(`flex h-full max-w-full items-center justify-end gap-0.5 sm:gap-2`,`pointer-events-none opacity-0 transition-opacity duration-150 ease-out`,`group-hover/msg:pointer-events-auto group-hover/msg:opacity-100`,`group-focus-within/msg:pointer-events-auto group-focus-within/msg:opacity-100`,`[@media(hover:none)_and_(pointer:coarse)]:pointer-events-auto [@media(hover:none)_and_(pointer:coarse)]:opacity-100`),children:[c&&o!=null?(0,J.jsxs)(`button`,{type:`button`,className:q(_9,V&&`opacity-40`),onClick:()=>c(o),disabled:V,title:u?d.chat.userMessageActionsWait:l?d.chat.userMessageRetry:d.chat.userMessageRetryDisabledHint,"aria-label":d.chat.userMessageRetry,children:[(0,J.jsx)(Xx,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`max-w-[4.5rem] truncate sm:max-w-none`,children:d.chat.userMessageRetry})]}):null,(0,J.jsx)(`button`,{type:`button`,className:q(_9,`size-8 px-0`),onClick:()=>l1(k),disabled:!k,title:d.chat.userMessageEdit,"aria-label":d.chat.userMessageEdit,children:(0,J.jsx)(hb,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsx)(`button`,{type:`button`,className:q(_9,`size-8 px-0`),onClick:ne,disabled:!k,title:A===`user`?d.chat.messageCopied:d.chat.userMessageCopy,"aria-label":A===`user`?d.chat.messageCopied:d.chat.userMessageCopy,children:A===`user`?(0,J.jsx)(Jf,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}):(0,J.jsx)(Gh,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})}),s&&o!=null&&!u?(0,J.jsx)(`button`,{type:`button`,className:q(_9,`size-8 px-0 hover:text-red-500 dark:hover:text-red-400`),onClick:R,title:d.chat.userMessageDelete,"aria-label":d.chat.userMessageDelete,children:(0,J.jsx)(dO,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})}):null]})}):null,p&&D?(0,J.jsxs)(`div`,{className:`mt-2 flex shrink-0 flex-wrap items-center gap-2 overflow-visible`,children:[(0,J.jsx)(`button`,{type:`button`,className:g9,onClick:ee,disabled:!O,title:A===`plain`?d.chat.messageCopied:d.chat.messageCopyPlainText,"aria-label":A===`plain`?d.chat.messageCopied:d.chat.messageCopyPlainText,children:A===`plain`?(0,J.jsx)(Jf,{className:`h-4 w-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}):(0,J.jsx)(Gh,{className:`h-4 w-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsx)(`button`,{type:`button`,className:g9,onClick:te,title:A===`markdown`?d.chat.messageCopied:d.chat.messageCopyMarkdown,"aria-label":A===`markdown`?d.chat.messageCopied:d.chat.messageCopyMarkdown,children:A===`markdown`?(0,J.jsx)(Jf,{className:`h-4 w-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}):(0,J.jsx)(Cg,{className:`h-4 w-4`,strokeWidth:1.75,"aria-hidden":!0})})]}):null,p&&e.usage?(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(Khe,{usage:e.usage})}):null]}),f&&s&&o!=null?(0,J.jsx)(m9,{open:M,title:d.chat.userMessageDeleteConfirmTitle,description:d.chat.userMessageDeleteConfirm,confirmLabel:d.chat.userMessageDeleteOk,cancelLabel:d.chat.userMessageDeleteCancel,destructive:!0,onConfirm:z,onCancel:B}):null,(0,J.jsx)(o9,{open:P!==null,attachment:P,authToken:t,sessionKey:n,onClose:()=>F(null)})]})});function v9(e){return e.scrollHeight-e.scrollTop-e.clientHeight}function oge(e,t){return`${e.timestamp??`n`}-${t}`}var sge=40,cge=32,lge=(0,L.memo)(function({messages:e,authToken:t,sessionKey:n,streaming:r,progress:i,reasoningLevel:a,scrollElementRef:o,pinToBottom:s,onPickWelcomePrompt:c,welcomeOverlay:l,onDeleteRound:u,onRetryUserMessageRound:d,deleteRoundDisabled:f}){let p=GM(oN(e=>e.language)),m=e.length===0&&!r,h=Zme({count:m?0:e.length,enabled:!m,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0,getScrollElement:()=>o.current,estimateSize:()=>200,gap:sge,paddingEnd:cge,overscan:8,getItemKey:t=>oge(e[t],t),measureElement:k7}),g=(0,L.useRef)(null),_=(0,L.useRef)(s);_.current=s;let v=(0,L.useRef)(null),y=(0,L.useCallback)(()=>{let e=h.options.count;if(e===0)return;let t=o.current;if(!t){h.scrollToIndex(e-1,{align:`end`,behavior:`auto`});return}v9(t)<=1||(t.scrollTop=t.scrollHeight)},[h,o]),b=(0,L.useCallback)(()=>{v.current!=null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,_.current&&y()})},[y]);return(0,L.useLayoutEffect)(()=>{!s||e.length===0||y()},[s,e.length,y]),(0,L.useEffect)(()=>{if(!s||e.length===0||r)return;let t=g.current;if(!t)return;let n=new ResizeObserver(()=>{b()});return n.observe(t),()=>{n.disconnect(),v.current!=null&&(cancelAnimationFrame(v.current),v.current=null)}},[s,e.length,b,r]),m?l?(0,J.jsx)(`div`,{className:`flex w-full flex-col items-center pb-6 pt-4`,children:l}):c&&p.chat.welcomeSpotlight?(0,J.jsx)(`div`,{className:`pb-1.5`,children:(0,J.jsx)(ehe,{chat:p.chat,onPickPrompt:c})}):(0,J.jsx)(`div`,{className:`flex flex-col gap-10 pb-8`,children:(0,J.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-20 text-center`,children:[(0,J.jsx)(`div`,{className:`text-4xl`,"aria-hidden":!0,children:`🤖`}),(0,J.jsx)(`div`,{className:`text-xl font-semibold tracking-tight text-fg`,children:p.chat.welcomeTitle}),(0,J.jsx)(`div`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:p.chat.welcomeDescription})]})}):(0,J.jsx)(`div`,{ref:g,className:`relative w-full min-w-0`,style:{height:h.getTotalSize()},children:h.getVirtualItems().map(o=>{let s=e[o.index];if(!s)return null;let c=o.index===e.length-1,l=!!(r&&c&&s.role===`assistant`);return(0,J.jsx)(`div`,{"data-index":o.index,ref:h.measureElement,className:`absolute left-0 w-full min-w-0`,style:{top:o.start},children:(0,J.jsx)(age,{message:s,authToken:t,sessionKey:n,isStreaming:l,progress:l?i:null,reasoningLevel:a,messageIndex:o.index,onDeleteRound:u,onRetryUserMessageRound:d,userMessageCanRetry:!!d&&Whe(e,o.index),deleteRoundDisabled:f})},o.key)})})}),uge=(0,L.memo)(function({visible:e,onClick:t}){let n=GM(oN(e=>e.language));return e?(0,J.jsx)(`button`,{type:`button`,className:q(`fixed bottom-[calc(11rem+env(safe-area-inset-bottom,0px))] right-6 z-20 flex h-11 w-11 items-center justify-center rounded-full border border-edge bg-surface-panel text-fg-subtle shadow-float`,`hover:bg-surface-hover hover:text-fg dark:border-edge dark:shadow-none md:right-10`,Z.transition,Z.press,Z.focusRingPanel),onClick:t,title:n.chat.scrollToBottom,"aria-label":n.chat.scrollToBottom,children:(0,J.jsx)(rp,{className:`h-6 w-6`,"aria-hidden":!0})}):null}),y9=.5,b9=.75;function dge(e){return e.webkitDirectionInvertedFromDevice===!0?e.deltaY>0:e.deltaY<0}function fge({hasToken:e,showSessionLoading:t,sessionKey:n,sending:r,chatMessages:i,hasMore:a,loadingMore:o,loadMoreMessages:s}){let c=(0,L.useRef)(null),[l,u]=(0,L.useState)(!0),d=(0,L.useRef)(!0),f=(0,L.useRef)(!0),p=(0,L.useRef)({first:void 0,len:0,scrollHeight:0}),m=(0,L.useRef)(null),h=(0,L.useRef)(0),g=(0,L.useRef)(0);(0,L.useEffect)(()=>{d.current=l},[l]);let _=(0,L.useCallback)((e=!0,t=!1)=>{let n=c.current;if(!n)return;let r=v9(n);if(!t&&r>5){d.current&&(d.current=!1,u(!1));return}t&&!e&&(n.scrollTop=n.scrollHeight),requestAnimationFrame(()=>{n.scrollTo({top:n.scrollHeight,behavior:e?`smooth`:`auto`});let t=n.scrollHeight;requestAnimationFrame(()=>{c.current&&c.current.scrollHeight>t&&c.current.scrollTo({top:c.current.scrollHeight,behavior:e?`smooth`:`auto`})})})},[]),v=(0,L.useCallback)(()=>{let e=c.current;if(!e)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e,i=n-t-r;d.current?i>4&&(d.current=!1,u(!1)):i<2&&(d.current=!0,u(!0)),h.current=t,g.current=n,t<100&&!d.current&&a&&!o&&s()},[a,o,s]);return(0,L.useLayoutEffect)(()=>{if(!e)return;if(t){f.current=!0;return}if(f.current!==!0)return;f.current=!1,u(!0);let n=c.current;n&&(n.scrollTop=n.scrollHeight,h.current=n.scrollTop,g.current=n.scrollHeight),requestAnimationFrame(()=>{_(!1,!0),requestAnimationFrame(()=>_(!1,!0))})},[t,e,_]),(0,L.useLayoutEffect)(()=>{if(!e||t)return;p.current={first:void 0,len:0,scrollHeight:0},d.current=!0,u(!0);let n=c.current;n&&(n.scrollTop=n.scrollHeight,h.current=n.scrollTop,g.current=n.scrollHeight),requestAnimationFrame(()=>{_(!1,!0),requestAnimationFrame(()=>_(!1,!0))})},[n,e,t,_]),(0,L.useEffect)(()=>{r&&(t||(u(!0),_(!0,!0)))},[r,t,_]),(0,L.useLayoutEffect)(()=>{if(!e||t)return;let n=c.current;if(!n)return;let r=()=>{d.current&&(d.current=!1,(0,Io.flushSync)(()=>u(!1)))},i=e=>{if(!d.current||Math.abs(e.deltaY)<Math.abs(e.deltaX)||Math.abs(e.deltaY)<.25)return;let t=n.scrollTop,i=v9(n),a=()=>{let n=c.current;if(!n||!d.current)return;let a=n.scrollTop,o=v9(n);if(a<t-y9||o>i+b9){r();return}Math.abs(a-t)<y9&&Math.abs(o-i)<b9&&i<=4&&Math.abs(e.deltaY)>=.5&&dge(e)&&r()};requestAnimationFrame(()=>{requestAnimationFrame(a)})},a=0,o=e=>{e.touches.length===1&&(a=e.touches[0].clientY)},s=e=>{if(e.touches.length!==1)return;let t=e.touches[0].clientY,n=t-a;a=t,n>2&&r()};return n.addEventListener(`wheel`,i,{passive:!0}),n.addEventListener(`touchstart`,o,{passive:!0}),n.addEventListener(`touchmove`,s,{passive:!0}),()=>{n.removeEventListener(`wheel`,i),n.removeEventListener(`touchstart`,o),n.removeEventListener(`touchmove`,s)}},[e,t]),(0,L.useLayoutEffect)(()=>{if(t)return;let e=c.current;if(!e)return;if(!d.current){h.current=e.scrollTop,g.current=e.scrollHeight;return}let n=e.scrollTop,r=e.scrollHeight,i=h.current,a=g.current;if(n<i-1.5){if(!(r<a-1)){d.current&&(d.current=!1,u(!1)),h.current=n,g.current=r;return}h.current=n,g.current=r}return m.current!=null&&cancelAnimationFrame(m.current),m.current=requestAnimationFrame(()=>{m.current=null;let e=c.current;!e||!d.current||(_(!1,!0),h.current=e.scrollTop,g.current=e.scrollHeight)}),()=>{m.current!=null&&(cancelAnimationFrame(m.current),m.current=null)}},[i,_,t]),(0,L.useLayoutEffect)(()=>{let e=c.current;if(!e||t)return;let n=p.current,r=i[0],a=i.length,o=e.scrollHeight;a>n.len&&n.len>0&&r!==void 0&&r!==n.first&&n.scrollHeight>0&&(e.scrollTop+=o-n.scrollHeight),p.current={first:r,len:a,scrollHeight:o}},[i,t]),{scrollRef:c,atBottom:l,scrollToBottom:_,onScroll:v}}function pge(e){if(e.type!==`thinking`)return``;let t=e;return(typeof t.text==`string`&&t.text.length>0?t.text:typeof t.thinking==`string`?t.thinking:``).trim()}function mge(e){if(e.role!==`assistant`)return!1;for(let t of e.content)if(t.type===`text`&&(t.text||``).trim().length>0||t.type===`thinking`&&pge(t).length>0||t.type===`tool_use`)return!0;return!1}function x9(e,t){return e&&e.role===`assistant`?{...e,content:[...e.content]}:{role:`assistant`,content:[],timestamp:t}}function S9(e){return{...e,content:e.content.map(e=>({...e})),attachments:e.attachments?e.attachments.map(e=>({...e})):void 0}}function C9(e,t){if(!t)return e;if(!e)return t;if(e.endsWith(t))return e;let n=Math.min(e.length,t.length,512);for(let r=n;r>0;r--)if(e.slice(-r)===t.slice(0,r))return e+t.slice(r);return e+t}function w9(e){let t=e[e.length-1];t?.type===`thinking`&&t.streaming&&(t.streaming=!1)}function hge(e){let t=e[e.length-1];t?.type===`thinking`&&t.streaming||e.push({type:`thinking`,text:``,streaming:!0})}function gge(e,t,n){let r=e[e.length-1];if(r?.type===`thinking`){n?r.text=C9(r.text||``,t):r.text=t,r.streaming=!0;return}e.push({type:`thinking`,text:t,streaming:!0})}function T9(e){w9(e);for(let t of e)t.type===`thinking`&&typeof t.text==`string`&&(t.text=t.text.trim())}function _ge(e){for(let t of e)t.type===`tool_use`&&t.status===`running`&&(t.status=`done`)}function vge(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}function yge(e,t){w9(e);let n=e[e.length-1];if(n?.type===`text`){n.text=C9(n.text||``,t);return}e.push({type:`text`,text:t})}function bge(e,t,n){w9(e);let r={type:`tool_use`,id:crypto.randomUUID(),name:t,input:n,status:`running`};e.push(r)}function xge(e,t,n,r){for(let i=e.length-1;i>=0;i--){let a=e[i];if(a.type===`tool_use`&&a.status===`running`&&vge(a.name,t)){a.status=n?`error`:`done`,a.result=r;return}}}var E9=new Map;function D9(e){return e.map(e=>S9(e))}function O9(e,t){E9.set(e,{messages:D9(t.messages),streamingMsg:t.streamingMsg?S9(t.streamingMsg):null,progress:t.progress,sending:t.sending,streaming:t.streaming})}function k9(e){E9.delete(e)}function A9(e){let t=E9.get(e);if(t)return{messages:D9(t.messages),streamingMsg:t.streamingMsg?S9(t.streamingMsg):null,progress:t.progress,sending:t.sending,streaming:t.streaming}}function Sge(e,t,n,r){E9.has(e)||O9(e,{messages:t,streamingMsg:null,progress:null,sending:n,streaming:r})}function Cge(e,t){let n=E9.get(e);n&&(t.sending!==void 0&&(n.sending=t.sending),t.streaming!==void 0&&(n.streaming=t.streaming))}function wge(e,t){let n=E9.get(e);n&&(n.progress=t)}function j9(e,t,n=Date.now()){let r=E9.get(e);if(!r)return;let i=x9(r.streamingMsg,n);t(i),r.streamingMsg=S9(i),r.streaming=!0}function Tge(e,t,n){let r=E9.get(e);r&&(r.messages=D9(t),r.streamingMsg=n?S9(n):null,r.streaming=!0,r.sending=!0)}var Ege=`medium`,Dge=`stream`,M9=`xopc.webchat.agentId`;function N9(){if(globalThis.localStorage===void 0)return null;try{return globalThis.localStorage.getItem(`xopc.webchat.agentId`)?.trim().toLowerCase()||null}catch{return null}}function P9(e,t){if(t)return e.find(e=>LH(e.key)&&(e.messageCount??0)===0&&xG(e.key)===t)}function F9(e){return e===`on`||e===`stream`||e===`off`?e:`stream`}var Oge=`xopc.chat.followUpQueue:v1:`,kge=new Set([`code_error_handling`,`code_refactor`,`code_explain`,`code_optimize`,`web_more_details`,`web_find_sources`,`date_shorter_summary`,`date_main_risks`,`email_make_formal`,`email_shorten`,`generic_simpler_terms`,`generic_concrete_example`,`generic_bullet_points`,`generic_create_table`,`what_next`]);function Age(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)typeof n==`string`&&kge.has(n)&&t.push(n);return t}function I9(e){return`${Oge}${encodeURIComponent(e.trim())}`}function L9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jge(e){if(!L9(e))return null;let t=e.type;if(typeof t!=`string`||!t.trim())return null;let n={type:t.trim()};return typeof e.mimeType==`string`&&(n.mimeType=e.mimeType),typeof e.name==`string`&&(n.name=e.name),typeof e.size==`number`&&Number.isFinite(e.size)&&(n.size=e.size),typeof e.workspaceRelativePath==`string`&&(n.workspaceRelativePath=e.workspaceRelativePath),typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&(n.durationSeconds=e.durationSeconds),n}function Mge(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!L9(n))continue;let e=n.id,r=n.text;if(typeof e!=`string`||!e.trim()||typeof r!=`string`)continue;let i={id:e.trim(),text:r};if(typeof n.thinkingLevel==`string`&&n.thinkingLevel.trim()&&(i.thinkingLevel=n.thinkingLevel.trim()),Array.isArray(n.attachments)){let e=n.attachments.map(jge).filter(Boolean);e.length&&(i.attachments=e)}if(t.push(i),t.length>=50)break}return t}function Nge(e){return{editingId:e.editingId,suggestions:[...e.suggestions],pending:e.pending.map(e=>({...e,attachments:e.attachments?.map(e=>{let{data:t,...n}=e;return n})}))}}function Pge(e){let t=e?.trim();if(!t||typeof localStorage>`u`)return null;try{let e=localStorage.getItem(I9(t));if(!e)return null;let n=JSON.parse(e);if(!L9(n))return null;let r=Mge(n.pending),i=Age(n.suggestions),a=n.editingId===null?null:typeof n.editingId==`string`&&n.editingId.trim()?n.editingId.trim():null;return r.length===0&&i.length===0&&a==null?null:{pending:r,suggestions:i,editingId:a}}catch{return null}}function R9(e,t){let n=e?.trim();if(!n||typeof localStorage>`u`)return;let r=Nge(t);if(r.pending.length===0&&r.suggestions.length===0&&r.editingId==null){z9(n);return}try{localStorage.setItem(I9(n),JSON.stringify({v:1,...r}))}catch{}}function z9(e){let t=e?.trim();if(!(!t||typeof localStorage>`u`))try{localStorage.removeItem(I9(t))}catch{}}var B9=1200;function Fge(e){let t=[];for(let n of e)n.type===`text`&&n.text?.trim()&&t.push(n.text.trim());return t.join(`
4733
- `).trim()}function Ige(e){if(e.role!==`assistant`)return[];let t=Fge(e.content);if(!t)return[];let n=t.length>B9?`${t.slice(0,B9)}…`:t,r=n.toLowerCase(),i=[];/\b(function|class|const |def |import |export |async |await |interface |type )\b/.test(r)||/```/.test(n)?(i.push(`code_error_handling`),i.push(`code_explain`),i.push(`code_refactor`),i.push(`code_optimize`)):/\d{4}-\d{2}-\d{2}|january|february|march|april|may|june|july|august|september|october|november|december|q[1-4]|quarter/i.test(n)?(i.push(`date_shorter_summary`),i.push(`date_main_risks`)):/^[-*•]|\n[-*•]/.test(n.trim())?(i.push(`generic_simpler_terms`),i.push(`generic_create_table`),i.push(`generic_bullet_points`)):/\|.*\|.*\|/.test(n)?(i.push(`generic_simpler_terms`),i.push(`generic_bullet_points`)):(i.push(`generic_simpler_terms`),i.push(`generic_concrete_example`),i.push(`generic_bullet_points`)),i.push(`what_next`);let a=new Set,o=[];for(let e of i)if(!a.has(e)&&(a.add(e),o.push(e),o.length>=4))break;return o.slice(0,4)}function Lge(e){let{sessionKey:t,decodedKey:n,sessionKeyRef:r,activeStreamSessionKeyRef:i,sendingRef:a,streamingRef:o,setSending:s,setStreaming:c,setProgress:l,modelSupportsThinking:u,thinkingLevel:d,shouldApplyStreamUpdate:f,setError:p,sendMessageRef:m}=e,[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useRef)(null),[b,x]=(0,L.useState)([]),S=(0,L.useRef)([]),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(null),[O,k]=(0,L.useState)([]),A=(0,L.useRef)([]),j=(0,L.useRef)(void 0),M=(0,L.useRef)(null);(0,L.useEffect)(()=>{y.current=h},[h]),(0,L.useEffect)(()=>{let e=j.current;e!=null&&e!==n&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current}),j.current=n,w(null)},[n]),(0,L.useEffect)(()=>{let e=M.current;if(e!=null&&e!==t&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current}),M.current=t,!t&&!n){S.current=[],x([]),A.current=[],k([]),E(null);return}if(!t||!n||t!==n)return;let r=Pge(t);if(r){let e=structuredClone(r.pending),t=[...r.suggestions];S.current=e,x(e),A.current=t,k(t),E(r.editingId)}else S.current=[],x([]),A.current=[],k([]),E(null)},[t,n]),(0,L.useEffect)(()=>{let e=t!=null&&n!=null&&t!==n?t:t??n??null;if(!e)return;let i=window.setTimeout(()=>{r.current===e&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current})},280);return()=>window.clearTimeout(i)},[t,n,b,O,T,r]),(0,L.useEffect)(()=>{n&&t!=null&&t!==n&&g(null)},[n,t]);let N=(0,L.useCallback)(()=>{g(null)},[]),P=(0,L.useCallback)(()=>{let e=r.current;e&&z9(e),S.current=[],x([]),E(null)},[r]),F=(0,L.useCallback)(()=>{let e=r.current;e&&z9(e),S.current=[],x([]),g(null),E(null)},[r]),I=(0,L.useCallback)(()=>{A.current=[],k([])},[]),ee=(0,L.useCallback)(e=>{let t=Ige(e);A.current=t,k(t)},[]),te=(0,L.useCallback)(()=>{g(null)},[]),ne=(0,L.useCallback)(e=>t=>{f(e)&&(a.current=!1,o.current=!1,s(!1),c(!1),l(null),g(t))},[f,a,o,s,c,l]),R=(0,L.useCallback)(async e=>{let t=r.current;if(e!=null&&e!==t)return;let n=t;if(!n)return;let s=S.current;for(;s.length>0&&!s[0].text.trim()&&!s[0].attachments?.length;)s=s.slice(1);if(s.length===0){S.current=[],x([]);return}s.length!==S.current.length&&(S.current=s,x(s));let[c,...l]=s,u=c.text?.trim()??``,d=c.attachments;!u&&!d?.length||i.current===n&&(a.current||o.current)||(D.current===c.id&&E(null),S.current=l,x(l),await m.current(c.text,c.attachments,c.thinkingLevel))},[m,r,i,a,o]);(0,L.useEffect)(()=>{if(!t||t!==n||h||b.length===0||a.current||o.current)return;let e=b[0];if(!e||!e.text.trim()&&!e.attachments?.length)return;let i=window.setTimeout(()=>{r.current===t&&(a.current||o.current||y.current||R(t))},72);return()=>window.clearTimeout(i)},[t,n,h,b,R,a,o,r]);let z=(0,L.useCallback)((e,t)=>{let n=e.trim();if(!n&&!t?.length||S.current.length>=10)return;let r=u?d:`off`,i={id:crypto.randomUUID(),text:n||e,attachments:t?.length?t:void 0,thinkingLevel:r};x(e=>{let t=[...e,i];return S.current=t,t})},[u,d]),B=(0,L.useCallback)(e=>{E(e)},[]),re=(0,L.useCallback)(()=>{E(null)},[]),V=(0,L.useCallback)((e,t,n,r)=>{let i=t.trim(),a=S.current,o=a.findIndex(t=>t.id===e);if(o<0){E(null);return}if(!i&&!n?.length){let t=a.filter(t=>t.id!==e);S.current=t,x(t),E(null);return}let s=[...a],c=u?r??d:`off`;s[o]={...s[o],text:i||t,attachments:n?.length?n:void 0,thinkingLevel:c},S.current=s,x(s),E(null)},[u,d]),ie=(0,L.useCallback)(e=>{D.current===e&&E(null),x(t=>{let n=t.filter(t=>t.id!==e);return S.current=n,n})},[]),ae=(0,L.useCallback)((e,t)=>{x(n=>{let r=n.findIndex(t=>t.id===e);if(r<0)return n;let i=t===`up`?r-1:r+1;if(i<0||i>=n.length)return n;let a=[...n];return[a[r],a[i]]=[a[i],a[r]],S.current=a,a})},[]),oe=(0,L.useCallback)((e,t)=>{x(n=>{if(e<0||e>=n.length||t<0||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),S.current=r,r})},[]),se=(0,L.useCallback)(async e=>{let t=r.current;if(!t)return;let n=S.current.find(t=>t.id===e);if(!(!n?.text.trim()||n.attachments?.length)){w(e);try{(await sP(Y(`/api/agent/steer`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({chatId:t,message:n.text.trim()})})).ok&&(x(t=>{let n=t.filter(t=>t.id!==e);return S.current=n,n}),D.current===e&&E(null))}catch{}finally{w(null)}}},[r]),ce=(0,L.useCallback)(e=>{let t=e.trim();if(t){if(A.current=[],k([]),a.current||o.current){if(S.current.length>=10){console.warn(`Follow-up queue is full (max 10). Remove one or wait for the run to finish.`);return}z(t,void 0);return}m.current(t,void 0,void 0)}},[z,m,a,o]),le=(0,L.useCallback)(async e=>{let t=y.current;if(t){v(!0);try{let n=await sP(Y(`/api/clarify/${encodeURIComponent(t.requestId)}`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({answer:e})});n.ok||p((await n.json().catch(()=>({}))).error?.message??n.statusText??`Clarify failed`),g(null)}finally{v(!1)}}},[p]);return S.current=b,A.current=O,D.current=T,{clarifyPrompt:h,clarifySubmitting:_,clarifyPromptRef:y,pendingFollowUps:b,pendingFollowUpsRef:S,followUpSuggestions:O,steeringFollowUpId:C,editingFollowUpId:T,addPendingFollowUp:z,beginEditFollowUp:B,cancelEditFollowUp:re,commitEditFollowUp:V,removePendingFollowUp:ie,movePendingFollowUp:ae,reorderPendingFollowUp:oe,steerPendingFollowUp:se,pickFollowUpSuggestion:ce,submitClarifyAnswer:le,dismissClarify:N,clearPendingFollowUps:P,dismissClarifyAndClearPending:F,refreshFollowUpSuggestions:ee,clearFollowUpSuggestions:I,onClarifyToolEnd:te,makeOnClarifyRequest:ne,flushSteeringQueue:R}}function Rge(e){let{navigate:t,sessionKeyRef:n,sessionKey:r,isNewRoute:i,locationState:a}=e,o=LN(e=>e.token),{data:s,mutate:l}=c(o?[`gateway-chat-agents`,o]:null,KV,{revalidateOnFocus:!1});(0,L.useEffect)(()=>{let e=()=>void l();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[l]);let[u,d]=(0,L.useState)(()=>N9()),f=(0,L.useRef)(s??null),p=(0,L.useRef)(N9());(0,L.useEffect)(()=>{f.current=s??null},[s]),(0,L.useEffect)(()=>{p.current=u},[u]),(0,L.useEffect)(()=>{if(!s)return;let e=new Set(s.items.map(e=>e.id));d(t=>t==null||t===``||!e.has(t)?s.defaultId:t)},[s]);let m=(0,L.useCallback)(()=>{let e=f.current,t=(p.current??``).trim().toLowerCase();if(!e)return t||void 0;let n=new Set(e.items.map(e=>e.id));return t&&n.has(t)?t:e.defaultId},[]),h=(0,L.useCallback)(e=>{let r=e.trim().toLowerCase();d(r);try{globalThis.localStorage?.setItem(M9,r)}catch{}let i=n.current;(i?xG(i):null)!==r&&t(`/chat/new`,{replace:!1})},[t,n]);return(0,L.useEffect)(()=>{let e=e=>{let t=e.detail?.agentId;typeof t!=`string`||!t.trim()||h(t)};return window.addEventListener(`xopc-set-chat-agent`,e),()=>window.removeEventListener(`xopc-set-chat-agent`,e)},[h]),(0,L.useEffect)(()=>{if(!r)return;let e=xG(r);if(e){d(t=>e===t?t:e);try{globalThis.localStorage?.setItem(M9,e)}catch{}}},[r]),(0,L.useLayoutEffect)(()=>{if(!i)return;let e=a,t=typeof e?.agentId==`string`?e.agentId.trim().toLowerCase():``;if(t){p.current=t,d(t);try{globalThis.localStorage?.setItem(M9,t)}catch{}}},[i,a]),{token:o,chatAgentsData:s,resolveAgentIdForPost:m,onChatAgentChange:h,displayAgentId:(0,L.useMemo)(()=>r&&xG(r)||u||s?.defaultId||`main`,[r,u,s]),showChatAgentSelector:(s?.items.length??0)>1}}async function zge(e){let t=e.trim();if(!t)return!1;try{return!!(await r7()).find(e=>e.id===t)?.reasoning}catch{return!1}}function Bge(e){let{sessionMgrRef:t,sessionKeyRef:n,sessionNameRef:r,sendingRef:i,streamingRef:a,activeStreamSessionKeyRef:o,loadingSessionRef:s,messagesLenRef:c,thinkingSupportGenRef:l,navigateToSession:u,resolveAgentIdForPost:d,dismissClarifyOnSessionLoad:f,sessionKey:p,loadingMore:m,hasMore:h,setLoadingMore:g,setSessionKey:_,setSessionName:v,setMessages:y,setHasMore:b,setError:x,setSessionModel:S,setThinkingLevel:C,setReasoningLevel:w,setModelSupportsThinking:T}=e,E=(0,L.useRef)(Promise.resolve(void 0)),D=(0,L.useRef)(0),O=(0,L.useCallback)(async e=>{let t=++l.current;if(!e.trim()){t===l.current&&T(!1);return}let n=await zge(e);t===l.current&&T(n)},[T,l]),k=(0,L.useCallback)(async()=>{let e=n.current;if(!e||r.current?.trim())return;let i=++D.current,a=[700,900,900,1e3,1e3];for(let o=0;o<5;o++){if(await new Promise(e=>setTimeout(e,a[o]??900)),i!==D.current||n.current!==e||r.current?.trim())return;try{let n=await t.current.fetchSessionName(e);if(i!==D.current)return;if(n){v(n);return}}catch{}}},[n,r,t,v]),A=(0,L.useCallback)((e,t)=>{n.current===e&&(y(t.messages),b(t.hasMore),t.name&&v(t.name))},[n,y,b,v]),j=(0,L.useCallback)(async(e,r=0)=>{let c=async(e,r)=>{if(!(r===0&&e===n.current&&(i.current||a.current)&&o.current===e)){r===0&&!GH(e)&&f(),s.current=!0;try{let{messages:n,hasMore:i,name:a}=await t.current.loadSession(e,r);if(r===0){_(e),v(a??null),y(n),b(i),x(null);try{let n=await t.current.loadSessionAgentConfig(e);S(n.model),C(n.thinkingLevel||`medium`),w(F9(n.reasoningLevel)),O(n.model)}catch{}return n}y(e=>{let t=new Set(e.map(e=>e.timestamp));return nH([...n.filter(e=>!t.has(e.timestamp)),...e])}),b(i);return}catch{if(r===0){x(`Failed to load session`);let e=await t.current.loadSessions().catch(()=>[]),n=e.filter(e=>(e.messageCount??0)>0)[0]??e[0];if(n)return u(n.key),await c(n.key,0);try{let e=d(),n=await t.current.createSession(e?{agentId:e}:void 0);u(n.key),_(n.key),y([]),b(!1);try{let e=await t.current.loadSessionAgentConfig(n.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}}catch{x(`Could not open a session`)}}return}finally{s.current=!1}}},l=E.current,p,m=new Promise(e=>{p=e});E.current=l.then(()=>m),await l;try{return await c(e,r)}finally{p()}},[n,i,a,o,s,f,_,v,y,b,x,S,C,w,u,O,d,t]);return{refreshModelThinkingSupport:O,pollSessionNameAfterTurn:k,applyLoadedSessionSnapshot:A,loadSessionById:j,loadMoreMessages:(0,L.useCallback)(async()=>{let e=n.current;if(!(!e||m||!h)){g(!0);try{await j(e,c.current)}finally{g(!1)}}},[h,j,m,c,s,n,g]),onSessionModelChange:(0,L.useCallback)(async e=>{if(p)try{x(null),await t.current.patchSessionAgentConfig(p,{model:e}),S(e),O(e)}catch(e){x(e instanceof Error?e.message:`Failed to switch model`)}},[p,t,x,S,O]),onSessionThinkingLevelChange:(0,L.useCallback)(async e=>{if(p)try{x(null),await t.current.patchSessionAgentConfig(p,{thinkingLevel:e}),C(e)}catch(e){x(e instanceof Error?e.message:`Failed to update thinking level`)}},[p,t,x,C]),createNewSession:(0,L.useCallback)(async()=>{f();try{let e=await t.current.loadSessions(),n=d(),r=P9(e,n);if(r){_(r.key),v(r.name??null),y([]),b(!1),u(r.key);try{let e=await t.current.loadSessionAgentConfig(r.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}return}let i=await t.current.createSession(n?{agentId:n}:void 0);_(i.key),v(i.name??null),y([]),b(!1),u(i.key);try{let e=await t.current.loadSessionAgentConfig(i.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}}catch(e){console.error(`[chat] createNewSession failed:`,e)}},[f,u,O,d,t,b,y,w,_,S,v,C])}}function V9(e){let{chatId:t,shouldApplyStreamUpdate:n,beforeAssistantDelta:r,setStreamingOnStreamStart:i,clearResumeRunIdOnBackgroundTerminal:a,clearResumeRunIdOnVisibleError:o,setStreaming:s,setStreamingMsg:c,setProgress:l,setSending:u,setError:d,userAbortedRef:f,activeStreamSessionKeyRef:p,activeResumeRunIdRef:m,sendingRef:h,streamingRef:g,sessionMgrRef:_,applyLoadedSessionSnapshot:v,finalizeMessage:y,fq:b}=e,x=()=>{_.current.loadSession(t,0).then(e=>v(t,e)).catch(()=>{})},S=()=>{k9(t),p.current=null,a&&(m.current=null),h.current=!1,g.current=!1,s(!1),u(!1),l(null),b.dismissClarify(),x()},C=()=>{let e=A9(t)?.streamingMsg;e&&c(e)};return{onStreamStart:()=>{r(),j9(t,()=>{}),Cge(t,{streaming:!0}),n(t)&&(i&&s(!0),C(),s(!0))},onToken:e=>{r(),j9(t,t=>{yge(t.content,e)}),n(t)&&(C(),s(!0))},onThinking:(e,i)=>{r(),j9(t,t=>{!i&&e===``?hge(t.content):gge(t.content,e,i)}),n(t)&&C()},onThinkingEnd:()=>{r(),j9(t,e=>{T9(e.content)}),n(t)&&C()},onToolStart:(e,i)=>{r(),j9(t,t=>{bge(t.content,e,i)}),n(t)&&(C(),s(!0))},onToolEnd:(e,i,a)=>{e===`clarify`&&b.onClarifyToolEnd(),r(),j9(t,t=>{xge(t.content,e,i,a)}),n(t)&&C()},onProgress:e=>{wge(t,e),n(t)&&l(e)},onTtsAudio:e=>{r(),j9(t,t=>{let n=e.workspaceRelativePath?.replace(/\\/g,`/`).trim(),r=t.attachments??[];if(n&&r.some(e=>e.workspaceRelativePath?.replace(/\\/g,`/`).trim()===n))return;let i={name:e.name,mimeType:e.mimeType,type:`voice`,workspaceRelativePath:e.workspaceRelativePath,size:0};t.attachments=[...r,i]}),n(t)&&C()},onClarifyRequest:b.makeOnClarifyRequest(t),onResult:()=>{if(!n(t)){S();return}if(f.current){f.current=!1;return}y()},onError:e=>{if(!n(t)){S();return}k9(t),o&&(m.current=null),h.current=!1,g.current=!1,d(e),c(null),s(!1),u(!1),l(null),b.dismissClarify()}}}function Vge(e){let{sessionKey:t,thinkingLevel:n,modelSupportsThinking:r,sessionKeyRef:i,sendingRef:a,streamingRef:o,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,userAbortedRef:l,senderRef:u,sessionMgrRef:d,sendMessageRef:f,setMessages:p,setStreamingMsg:m,setStreaming:h,setSending:g,setProgress:_,setError:v,shouldApplyStreamUpdate:y,fq:b,applyLoadedSessionSnapshot:x,loadSessionById:S,createNewSession:C,pollSessionNameAfterTurn:w,latestMessagesRef:T}=e,E=(0,L.useRef)(b.flushSteeringQueue);E.current=b.flushSteeringQueue;let D=(0,L.useCallback)(e=>{let t=s.current??i.current,n=null;(0,Io.flushSync)(()=>{m(e=>{if(!e)return null;let t=x9(e,Date.now());return T9(t.content),_ge(t.content),n=S9(t),null})});let r=n;if(r&&mge(r)&&(p(e=>nH([...e,r])),b.refreshFollowUpSuggestions(r)),h(!1),_(null),g(!1),a.current=!1,o.current=!1,s.current=null,c.current=null,b.dismissClarify(),w(),!e?.skipSteeringQueueFlush){let e=t??i.current;e&&window.setTimeout(()=>{E.current(e)},72)}let l=i.current;l&&window.setTimeout(()=>{i.current===l&&(a.current||o.current||b.pendingFollowUpsRef.current.length>0||S(l,0))},400),t&&k9(t)},[m,p,h,_,g,a,o,s,c,i,b.dismissClarify,b.refreshFollowUpSuggestions,b.pendingFollowUpsRef,w,S]),O=(0,L.useCallback)(async(e,t)=>{let n=u.current;if(n.isSending)return;let r=null;try{let t=sessionStorage.getItem(WH(e));t&&(r=JSON.parse(t))}catch{}if(!r?.runId||c.current===r.runId)return;l.current=!1,c.current=r.runId,s.current=e,a.current=!0,o.current=!0,g(!0),h(!0),_(null),Sge(e,t??T.current??[],!0,!0);let i=!1,f=()=>{if(i)return;i=!0;let t=null,n=[];(0,Io.flushSync)(()=>{p(e=>{if(e.length===0)return e;let r=e[e.length-1];return r?.role===`assistant`?(t=S9(r),n=e.slice(0,-1),n):e}),t&&(m(e=>e??t),Tge(e,n,t))})};try{let t=V9({chatId:e,shouldApplyStreamUpdate:y,beforeAssistantDelta:f,setStreamingOnStreamStart:!1,clearResumeRunIdOnBackgroundTerminal:!0,clearResumeRunIdOnVisibleError:!0,setStreaming:h,setStreamingMsg:m,setProgress:_,setSending:g,setError:v,userAbortedRef:l,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,sendingRef:a,streamingRef:o,sessionMgrRef:d,applyLoadedSessionSnapshot:x,finalizeMessage:D,fq:b});await n.resume(r.runId,e,t)}catch(t){t.name!==`AbortError`&&console.error(`[chat] resume failed:`,t),k9(e),c.current=null,a.current=!1,o.current=!1,h(!1),g(!1),m(null),_(null),s.current===e&&(s.current=null)}},[u,c,l,s,a,o,g,h,_,p,m,v,y,d,x,D,b.dismissClarify,b.makeOnClarifyRequest,b.onClarifyToolEnd,T]),k=(0,L.useCallback)(async(e,t,d)=>{if(!e.trim()&&!t?.length||!a.current&&!o.current&&!u.current.isSending)return;if(e.trim()===`/new`&&!t?.length){await C();return}if(!i.current)return;b.dismissClarifyAndClearPending();let p=r?d??n:`off`;l.current=!0,c.current=null,s.current=null,u.current.abort(),a.current=!1,o.current=!1,D({skipSteeringQueueFlush:!0}),_(null),queueMicrotask(()=>{f.current(e,t,p)})},[a,o,u,i,b.dismissClarifyAndClearPending,r,n,l,c,s,D,_,f,C]);return{finalizeMessage:D,tryResumeAgentRun:O,sendMessage:(0,L.useCallback)(async(e,i,f)=>{if(!t||!e.trim()&&!i?.length||s.current===t&&(a.current||o.current))return;if(e.trim()===`/new`&&!i?.length){await C();return}let S=r?f??n:`off`,w=u.current,T=t;l.current=!1,b.clearFollowUpSuggestions(),s.current=T,a.current=!0,g(!0),v(null),b.dismissClarify(),p(t=>{let n=[...t,{role:`user`,content:e?[{type:`text`,text:e}]:[],attachments:i,timestamp:Date.now()}];return O9(T,{messages:n,streamingMsg:null,progress:null,sending:!0,streaming:!1}),n});try{let t=V9({chatId:T,shouldApplyStreamUpdate:y,beforeAssistantDelta:()=>{},setStreamingOnStreamStart:!0,clearResumeRunIdOnBackgroundTerminal:!1,clearResumeRunIdOnVisibleError:!1,setStreaming:h,setStreamingMsg:m,setProgress:_,setSending:g,setError:v,userAbortedRef:l,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,sendingRef:a,streamingRef:o,sessionMgrRef:d,applyLoadedSessionSnapshot:x,finalizeMessage:D,fq:b});await w.send(e,T,i,S,t)}catch(e){e.name!==`AbortError`&&(k9(T),v(e instanceof Error?e.message:`Send failed`),m(null),h(!1))}finally{a.current=!1,o.current=!1,g(!1),s.current===T&&(s.current=null)}},[t,n,r,s,a,o,l,b.clearFollowUpSuggestions,b.dismissClarify,g,v,p,h,m,_,y,d,x,D,b.dismissClarify,b.makeOnClarifyRequest,b.onClarifyToolEnd,C,T]),interruptAndSend:k,abort:(0,L.useCallback)(()=>{l.current=!0,c.current=null,s.current=null,b.dismissClarifyAndClearPending(),u.current.abort(),a.current=!1,o.current=!1,D({skipSteeringQueueFlush:!0}),_(null);let e=i.current;e&&window.setTimeout(()=>{S(e,0)},300)},[l,c,s,b.dismissClarifyAndClearPending,u,a,o,D,_,i,S]),deleteMessageRound:(0,L.useCallback)(e=>{let t=i.current;t&&(a.current||o.current||p(n=>{let r=n[e];if(!r||!(r.role===`user`||r.role===`user-with-attachments`))return n;let i=1,a=n[e+1];a&&a.role===`assistant`&&(i=2);let o=[...n];return o.splice(e,i),d.current.deleteMessages(t,e,i).catch(()=>{S(t,0)}),o}))},[i,a,o,p,d,S]),retryUserMessageRound:(0,L.useCallback)(e=>{let t=i.current;t&&(a.current||o.current||p(n=>{let r=n[e];if(!r||r.role!==`user`&&r.role!==`user-with-attachments`)return n;for(let t=e+1;t<n.length;t++){let e=n[t].role;if(e===`user`||e===`user-with-attachments`)return n}let i=f9(r.content),a=Ghe(r.attachments);if(!i.trim()&&!a?.length)return n;let o=1,s=n[e+1];s&&s.role===`assistant`&&(o=2);let c=[...n];return c.splice(e,o),d.current.deleteMessages(t,e,o).catch(()=>{S(t,0)}),queueMicrotask(()=>{f.current(i,a)}),c}))},[i,a,o,p,d,S,f])}}function H9(e){let t=e.startsWith(`?`)?e.slice(1):e;if(!t)return``;let n=new URLSearchParams(t),r=new URLSearchParams,i=n.get(`skill`),a=n.get(`slash`);i&&r.set(`skill`,i),a&&r.set(`slash`,a);let o=r.toString();return o?`?${o}`:``}function Hge(){let e=zi(),t=Ii(),{sessionKey:n}=Vi(),r=(0,L.useRef)(new BH),i=(0,L.useRef)(new qH),a=(0,L.useRef)(!1),o=(0,L.useRef)(0),s=(0,L.useRef)(!1),c=(0,L.useRef)(!1),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=(0,L.useRef)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(null),m=(0,L.useRef)(0),h=(0,L.useRef)(!1),g=(0,L.useRef)(!1),_=(0,L.useRef)(async()=>{}),[v,y]=(0,L.useState)([]),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(null),[M,N]=(0,L.useState)(null),[P,F]=(0,L.useState)(!0),[I,ee]=(0,L.useState)(``),[te,ne]=(0,L.useState)(Ege),[R,z]=(0,L.useState)(Dge),[B,re]=(0,L.useState)(!1),[V,ie]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(!1),se=(0,L.useRef)(0),ce=(0,L.useRef)([]);(0,L.useEffect)(()=>{ce.current=v},[v]),(0,L.useEffect)(()=>{c.current=S},[S]),(0,L.useEffect)(()=>{l.current=A},[A]),(0,L.useEffect)(()=>{p.current=M},[M]),(0,L.useEffect)(()=>{se.current=v.length},[v.length]);let le=t.pathname.endsWith(`/new`),ue=n?decodeURIComponent(n):void 0;u.current=ue??null;let{token:de,chatAgentsData:fe,resolveAgentIdForPost:H,onChatAgentChange:pe,displayAgentId:me,showChatAgentSelector:he}=Rge({navigate:e,sessionKeyRef:l,sessionKey:A,isNewRoute:le,locationState:t.state}),U=ue!==void 0&&A!==ue,ge=(0,L.useMemo)(()=>P&&(A==null||ue===void 0),[P,A,ue]),W=(0,L.useCallback)((t,n=!0,r)=>{let i=r??``;e({pathname:`/chat/${encodeURIComponent(t)}`,search:i},{replace:n})},[e]),_e=(0,L.useCallback)(e=>{let t=String(e??``).trim();if(!t)return!1;let n=String(u.current??``).trim(),r=String(l.current??``).trim();return!!(n&&t===n||r&&t===r)},[]),ve=Lge({sessionKey:A,decodedKey:ue,sessionKeyRef:l,activeStreamSessionKeyRef:d,sendingRef:s,streamingRef:c,setSending:T,setStreaming:C,setProgress:D,modelSupportsThinking:B,thinkingLevel:te,shouldApplyStreamUpdate:_e,setError:k,sendMessageRef:_}),{refreshModelThinkingSupport:ye,pollSessionNameAfterTurn:be,applyLoadedSessionSnapshot:xe,loadSessionById:Se,loadMoreMessages:Ce,onSessionModelChange:we,onSessionThinkingLevelChange:Te,createNewSession:Ee}=Bge({sessionMgrRef:r,sessionKeyRef:l,sessionNameRef:p,sendingRef:s,streamingRef:c,activeStreamSessionKeyRef:d,loadingSessionRef:a,messagesLenRef:se,thinkingSupportGenRef:m,navigateToSession:W,resolveAgentIdForPost:H,dismissClarifyOnSessionLoad:ve.dismissClarify,sessionKey:A,loadingMore:ae,hasMore:V,setLoadingMore:oe,setSessionKey:j,setSessionName:N,setMessages:y,setHasMore:ie,setError:k,setSessionModel:ee,setThinkingLevel:ne,setReasoningLevel:z,setModelSupportsThinking:re}),De=(0,L.useCallback)(e=>{let t=A9(e);return!t||!GH(e)&&!i.current.isStreamingFor(e)?!1:(y(t.messages),x(t.streamingMsg),D(t.progress),C(t.streaming),T(t.sending),s.current=t.sending,c.current=t.streaming,d.current=e,!0)},[]),{tryResumeAgentRun:Oe,sendMessage:ke,interruptAndSend:Ae,abort:je,deleteMessageRound:Me,retryUserMessageRound:Ne}=Vge({sessionKey:A,thinkingLevel:te,modelSupportsThinking:B,sessionKeyRef:l,sendingRef:s,streamingRef:c,activeStreamSessionKeyRef:d,activeResumeRunIdRef:f,userAbortedRef:h,senderRef:i,sessionMgrRef:r,sendMessageRef:_,setMessages:y,setStreamingMsg:x,setStreaming:C,setSending:T,setProgress:D,setError:k,shouldApplyStreamUpdate:_e,fq:ve,applyLoadedSessionSnapshot:xe,loadSessionById:Se,createNewSession:Ee,pollSessionNameAfterTurn:be,latestMessagesRef:ce});(0,L.useEffect)(()=>{if(!ue)return;let e=d.current;(!e||ue!==e)&&(d.current=null,s.current=!1,c.current=!1,x(null),D(null),C(!1),T(!1))},[ue]);let Pe=(0,L.useMemo)(()=>b?[...v,b]:v,[v,b]);return(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;!t?.key||t.name===void 0||t.key===A&&N(t.name||null)};return window.addEventListener(`session-updated`,e),()=>window.removeEventListener(`session-updated`,e)},[A]),(0,L.useEffect)(()=>{let e=()=>{let e=l.current;e&&r.current.loadSessionAgentConfig(e).then(e=>{ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}).catch(()=>{})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[ye]),(0,L.useEffect)(()=>{if(!de){F(!1);return}let e=++o.current,n=!1;return(async()=>{(le||ue===void 0)&&F(!0),k(null);try{if(le){let i=await r.current.loadSessions();if(n||e!==o.current)return;let a=H(),s=P9(i,a);if(s){j(s.key),N(s.name??null),y([]),ie(!1),W(s.key,!0,H9(t.search));try{let e=await r.current.loadSessionAgentConfig(s.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}else{let i=await r.current.createSession(a?{agentId:a}:void 0);if(n||e!==o.current)return;j(i.key),N(i.name??null),y([]),ie(!1),W(i.key,!0,H9(t.search));try{let e=await r.current.loadSessionAgentConfig(i.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}}else if(ue){let t=await Se(ue,0);!n&&e===o.current&&(De(ue),await Oe(ue,A9(ue)?.messages??t??[]))}else{let t=await r.current.loadSessions();if(n||e!==o.current)return;let i=t.filter(e=>(e.messageCount??0)>0)[0]??t[0];if(i){let t=await Se(i.key,0);if(n||e!==o.current)return;De(i.key);let a=A9(i.key)?.messages??t??[];r.current.parseSessionFromHash()||W(i.key),await Oe(i.key,a)}else{let t=H(),i=await r.current.createSession(t?{agentId:t}:void 0);if(n||e!==o.current)return;j(i.key),N(i.name??null),y([]),ie(!1),W(i.key);try{let e=await r.current.loadSessionAgentConfig(i.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}}}catch(e){n||k(e instanceof Error?e.message:`Chat init failed`)}finally{!n&&e===o.current&&F(!1)}})(),()=>{n=!0}},[de,le,ue,W,Se,Oe,ye,H,De,t.search]),(0,L.useEffect)(()=>{let e=JH.getState().setFocusedAgentRun;if(!A){e(null,!1);return}e(A,S||w)},[A,S,w]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.sessionKey)return;let n=t.event;!n||n.type!==`status`||typeof n.runId!=`string`||!n.runId.trim()||(KH(t.sessionKey,n.runId),l.current===t.sessionKey&&(i.current.isStreamingFor(t.sessionKey)||queueMicrotask(()=>{l.current===t.sessionKey&&(i.current.isStreamingFor(t.sessionKey)||Oe(t.sessionKey,ce.current??[]))})))};return window.addEventListener(`agent-stream`,e),()=>window.removeEventListener(`agent-stream`,e)},[Oe]),(0,L.useEffect)(()=>{let e=S||w,t=g.current;if(g.current=e,!t||e)return;let n=l.current;n&&queueMicrotask(()=>{l.current===n&&(i.current.isStreamingFor(n)||GH(n)&&Oe(n,ce.current??[]))})},[S,w,Oe]),_.current=ke,{auth:{hasToken:!!de},session:{sessionKey:A,sessionName:M,decodedKey:ue,sessionRoutePending:U,showSessionLoading:ge,loading:P,sessionModel:I,thinkingLevel:te,onSessionThinkingLevelChange:Te,reasoningLevel:R,modelSupportsThinking:B,hasMore:V,loadingMore:ae,loadMoreMessages:Ce,onSessionModelChange:we,createNewSession:Ee,sessionManager:r.current},messages:{items:Pe},stream:{error:O,streaming:S,sending:w,progress:E,sendMessage:ke,abort:je,interruptAndSend:Ae,deleteMessageRound:Me,retryUserMessageRound:Ne},followUp:{addPendingFollowUp:ve.addPendingFollowUp,pendingFollowUps:ve.pendingFollowUps,editingFollowUpId:ve.editingFollowUpId,beginEditFollowUp:ve.beginEditFollowUp,cancelEditFollowUp:ve.cancelEditFollowUp,commitEditFollowUp:ve.commitEditFollowUp,removePendingFollowUp:ve.removePendingFollowUp,movePendingFollowUp:ve.movePendingFollowUp,reorderPendingFollowUp:ve.reorderPendingFollowUp,steerPendingFollowUp:ve.steerPendingFollowUp,steeringFollowUpId:ve.steeringFollowUpId,followUpSuggestions:ve.followUpSuggestions,pickFollowUpSuggestion:ve.pickFollowUpSuggestion},clarify:{clarifyPrompt:ve.clarifyPrompt,clarifySubmitting:ve.clarifySubmitting,submitClarifyAnswer:ve.submitClarifyAnswer},agents:{chatAgents:fe,displayAgentId:me,showChatAgentSelector:he,onChatAgentChange:pe}}}function Uge({prompt:e,submitting:t,onSubmit:n}){let[r,i]=(0,L.useState)(``),a=(0,L.useCallback)(e=>{n(e)},[n]);if(!e)return null;let o=Array.isArray(e.choices)&&e.choices.length>=2;return(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Clarification`,className:`mb-4 rounded-lg border border-edge bg-surface-elevated px-4 py-3 text-sm text-fg shadow-sm`,children:[(0,J.jsx)(e$,{content:e.question,compact:!0,className:`mb-3`}),o?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.choices.map(e=>(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:t,className:q(`min-h-9 justify-start rounded-lg px-3 py-2 text-left text-sm font-normal shadow-none`,`hover:border-edge`),onClick:()=>a(e),children:e},e)),e.default?(0,J.jsxs)(UM,{type:`button`,variant:`ghost`,disabled:t,className:q(`min-h-9 justify-start rounded-lg border border-dashed border-edge px-3 py-2 text-left text-sm font-normal text-fg-muted`,`hover:border-edge hover:text-fg`),onClick:()=>a(e.default),children:[`Default: `,e.default]}):null]}):(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-end`,onSubmit:e=>{e.preventDefault();let t=r.trim();t&&(n(t),i(``))},children:[(0,J.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:t,placeholder:`Your answer…`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 py-2 text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent disabled:opacity-50`}),(0,J.jsx)(UM,{type:`submit`,variant:`primary`,disabled:t||!r.trim(),className:`shrink-0 rounded-lg px-4 py-2 shadow-surface`,children:`Send`}),e.default?(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:t,className:`shrink-0 rounded-lg px-3 py-2 text-sm font-normal text-fg-muted shadow-none hover:text-fg`,onClick:()=>a(e.default),children:`Use default`}):null]})]})}var Wge=`xopc-onboarding-model-setup-dismissed`;function Gge({models:e,selectedId:t,onSelectedChange:n}){return e.length===0?null:(0,J.jsx)(`div`,{className:`flex max-h-[min(50vh,22rem)] flex-col gap-2 overflow-y-auto pr-1`,role:`radiogroup`,children:e.map(e=>{let r=t===e.id;return(0,J.jsxs)(`label`,{className:q(`flex cursor-pointer items-start gap-3 rounded-xl border border-edge px-3 py-2.5 transition-colors`,r?`border-accent bg-accent-soft`:`hover:bg-surface-hover`),children:[(0,J.jsx)(`input`,{type:`radio`,name:`onboarding-model`,className:`mt-1`,checked:r,onChange:()=>n(e.id)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name||e.id}),(0,J.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:e.id})]})]},e.id)})})}function U9({className:e,children:t,...n}){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,className:q(`shrink-0`,e),...n,children:t})}function Kge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#4D6BFE`,d:`M12.639 5.436c-.377-.222-.676-.093-.676.28v1.63c0 .55.185 1.088.524 1.527l.026.033 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`})})}function qge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`currentColor`,d:`M11.43 3.92a.86.86 0 1 0-1.718 0v14.236a1.999 1.999 0 0 1-3.997 0V9.022a.86.86 0 1 0-1.718 0v3.87a1.999 1.999 0 0 1-3.997 0V11.49a.57.57 0 0 1 1.139 0v1.404a.86.86 0 0 0 1.719 0V9.022a1.999 1.999 0 0 1 3.997 0v9.134a.86.86 0 0 0 1.719 0V3.92a1.998 1.998 0 1 1 3.996 0v11.788a.57.57 0 1 1-1.139 0zm10.572 3.105a2 2 0 0 0-1.999 1.997v7.63a.86.86 0 0 1-1.718 0V3.923a1.999 1.999 0 0 0-3.997 0v16.16a.86.86 0 0 1-1.719 0V18.08a.57.57 0 1 0-1.138 0v2a1.998 1.998 0 0 0 3.996 0V3.92a.86.86 0 0 1 1.719 0v12.73a1.999 1.999 0 0 0 3.996 0V9.023a.86.86 0 1 1 1.72 0v6.686a.57.57 0 0 0 1.138 0V9.022a2 2 0 0 0-1.998-1.997`})})}function W9({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#1A1A2E`,d:`m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866`})})}function Jge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`currentColor`,d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})})}function Yge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#D4A27F`,d:`M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z`})})}function Xge({className:e,...t}){return(0,J.jsxs)(U9,{className:e,...t,children:[(0,J.jsx)(`defs`,{children:(0,J.jsxs)(`linearGradient`,{id:`gemini-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`0%`,stopColor:`#4285F4`}),(0,J.jsx)(`stop`,{offset:`50%`,stopColor:`#9B72CB`}),(0,J.jsx)(`stop`,{offset:`100%`,stopColor:`#D96570`})]})}),(0,J.jsx)(`path`,{fill:`url(#gemini-grad)`,d:`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`})]})}function Zge({providerId:e,className:t}){let n={className:t,"aria-hidden":!0};switch(e){case`deepseek`:return(0,J.jsx)(Kge,{...n});case`minimax`:return(0,J.jsx)(qge,{...n});case`kimi-coding`:return(0,J.jsx)(W9,{...n});case`moonshotai`:case`moonshotai-cn`:return(0,J.jsx)(W9,{...n});case`openai`:return(0,J.jsx)(Jge,{...n});case`anthropic`:return(0,J.jsx)(Yge,{...n});case`google`:return(0,J.jsx)(Xge,{...n});default:return(0,J.jsx)(`span`,{className:q(`flex items-center justify-center text-2xl`,t),children:`🤖`})}}var Qge=[{id:`deepseek`,name:`DeepSeek`,recommended:!0},{id:`minimax`,name:`MiniMax`,recommended:!1},{id:`kimi-coding`,name:`Kimi Coding`,recommended:!1},{id:`openai`,name:`OpenAI`,recommended:!1},{id:`anthropic`,name:`Anthropic`,recommended:!1},{id:`google`,name:`Google AI`,recommended:!1}];function $ge({onSelect:e}){return(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Qge.map(t=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(t.id),className:q(`relative flex flex-col items-center gap-1.5 rounded-xl border border-edge p-4 text-center transition-colors`,`hover:border-accent hover:bg-accent-soft`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,t.recommended&&`border-accent/50 bg-accent-soft/30`),children:[t.recommended&&(0,J.jsx)(`span`,{className:`absolute -top-2 right-2 rounded-full bg-accent px-2 py-0.5 text-[10px] font-semibold text-white`,children:`推荐`}),(0,J.jsx)(Zge,{providerId:t.id,className:`size-8`}),(0,J.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.name})]},t.id))})}function e_e(e,t){return e===`single`?t.getApiKey:e===`intl`?t.getApiKeyIntl:t.getApiKeyCn}var G9={openai:{apiKeyUrl:`https://platform.openai.com/api-keys`,pricingUrl:`https://openai.com/pricing`,docsUrl:`https://platform.openai.com/docs`,description:`The most widely used LLM provider. Powers ChatGPT.`,descriptionZh:`最广泛使用的 LLM 服务商,ChatGPT 背后的技术。`,bestFor:[`general`,`coding`,`vision`],freeTier:!1,freeTierNote:`Pay-as-you-go; new accounts may receive trial credits.`,aliases:[`chatgpt`,`gpt`,`gpt-4`,`gpt4`,`gpt-4o`,`gpt4o`],envVars:[`OPENAI_API_KEY`]},anthropic:{apiKeyUrl:`https://console.anthropic.com/settings/keys`,pricingUrl:`https://www.anthropic.com/pricing`,docsUrl:`https://docs.anthropic.com`,description:`Known for Claude — excellent at long documents, coding, and nuanced reasoning.`,descriptionZh:`Claude 系列模型,擅长长文档处理、代码和复杂推理。`,bestFor:[`long context`,`coding`,`reasoning`],freeTier:!1,aliases:[`claude`,`claude 3`,`claude sonnet`,`claude opus`,`claude haiku`],envVars:[`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`]},google:{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Google Gemini models — strong multimodal and long-context capabilities.`,descriptionZh:`Google Gemini 系列,多模态能力强,支持超长上下文。`,bestFor:[`multimodal`,`long context`,`general`],freeTier:!0,freeTierNote:`Free tier available via Google AI Studio.`,aliases:[`gemini`,`google gemini`,`bard`,`google ai`],envVars:[`GEMINI_API_KEY`,`GOOGLE_API_KEY`]},"google-vertex":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/vertex-ai/pricing`,docsUrl:`https://cloud.google.com/vertex-ai/docs`,description:`Google Vertex AI — enterprise-grade Gemini and other models on GCP.`,descriptionZh:`Google Vertex AI,企业级 GCP 托管模型,支持 Gemini 等。`,bestFor:[`enterprise`,`multimodal`,`compliance`],freeTier:!1,aliases:[`vertex`,`vertex ai`,`gcp`,`google cloud`],envVars:[`GOOGLE_CLOUD_API_KEY`,`GOOGLE_CLOUD_PROJECT`,`GOOGLE_CLOUD_LOCATION`]},"google-gemini-cli":{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Gemini via CLI token — for users authenticated with the Gemini CLI tool.`,descriptionZh:`通过 Gemini CLI 令牌访问 Gemini,适合已安装 CLI 工具的用户。`,bestFor:[`general`,`multimodal`],freeTier:!0,freeTierNote:`Uses your existing Gemini CLI authentication.`,aliases:[`gemini cli`,`gemini-cli`],envVars:[`GEMINI_CLI_TOKEN`,`GOOGLE_TOKEN`]},"google-antigravity":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/pricing`,docsUrl:`https://cloud.google.com/docs`,description:`Google Antigravity — internal/experimental Google AI endpoint.`,descriptionZh:`Google Antigravity,Google 内部/实验性 AI 端点。`,bestFor:[`experimental`],freeTier:!1,aliases:[`antigravity`,`google antigravity`],envVars:[`ANTIGRAVITY_API_KEY`]},groq:{apiKeyUrl:`https://console.groq.com/keys`,pricingUrl:`https://groq.com/pricing/`,docsUrl:`https://console.groq.com/docs`,description:`Extremely fast inference — ideal for latency-sensitive applications.`,descriptionZh:`推理速度极快,适合对延迟敏感的场景。`,bestFor:[`speed`,`cheap`],freeTier:!0,freeTierNote:`Generous free tier with rate limits.`,aliases:[`groq`,`llama on groq`,`mixtral on groq`],envVars:[`GROQ_API_KEY`]},deepseek:{apiKeyUrl:`https://platform.deepseek.com/api_keys`,pricingUrl:`https://api-docs.deepseek.com/quick_start/pricing/`,docsUrl:`https://platform.deepseek.com/api-docs/`,description:`DeepSeek models — OpenAI-compatible API with strong reasoning and low costs.`,descriptionZh:`DeepSeek 模型:OpenAI 兼容 API,推理强、成本低。`,bestFor:[`reasoning`,`cheap`,`coding`],freeTier:!0,freeTierNote:`Free credits may be available for new accounts.`,aliases:[`deepseek`,`deep seek`,`deepseek v4`,`deepseek-v4`,`r1`],envVars:[`DEEPSEEK_API_KEY`]},xai:{apiKeyUrl:`https://console.x.ai/`,pricingUrl:`https://x.ai/api`,docsUrl:`https://docs.x.ai/`,description:`xAI Grok models — real-time web access, strong reasoning.`,descriptionZh:`xAI Grok 系列,支持实时联网,推理能力强。`,bestFor:[`reasoning`,`real-time`],freeTier:!1,aliases:[`grok`,`xai`,`x.ai`],envVars:[`XAI_API_KEY`]},cerebras:{apiKeyUrl:`https://cloud.cerebras.ai/platform/`,pricingUrl:`https://cloud.cerebras.ai/platform/`,docsUrl:`https://inference-docs.cerebras.ai/`,description:`Ultra-fast inference on custom AI chips. Fastest Llama inference available.`,descriptionZh:`基于专用 AI 芯片的超快推理,Llama 推理速度业界最快。`,bestFor:[`speed`],freeTier:!0,freeTierNote:`Free tier available.`,aliases:[`cerebras`],envVars:[`CEREBRAS_API_KEY`]},mistral:{apiKeyUrl:`https://console.mistral.ai/api-keys/`,pricingUrl:`https://mistral.ai/technology/#pricing`,docsUrl:`https://docs.mistral.ai/`,description:`European open-weight models. Good balance of quality and cost.`,descriptionZh:`欧洲开源模型,质量与成本平衡好。`,bestFor:[`general`,`cheap`,`coding`],freeTier:!1,aliases:[`mistral`,`mixtral`,`codestral`],envVars:[`MISTRAL_API_KEY`]},openrouter:{apiKeyUrl:`https://openrouter.ai/keys`,pricingUrl:`https://openrouter.ai/models`,docsUrl:`https://openrouter.ai/docs`,description:`API gateway to 100+ models from many providers with a single key.`,descriptionZh:`统一 API 网关,一个 Key 访问 100+ 模型。`,bestFor:[`general`,`flexibility`],freeTier:!0,freeTierNote:`Some models are free; pay-per-use for others.`,aliases:[`openrouter`,`open router`],envVars:[`OPENROUTER_API_KEY`]},"azure-openai-responses":{apiKeyUrl:`https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI`,pricingUrl:`https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/`,docsUrl:`https://learn.microsoft.com/en-us/azure/ai-services/openai/`,description:`OpenAI models hosted on Azure. Enterprise SLA and data residency.`,descriptionZh:`Azure 托管的 OpenAI 模型,企业级 SLA 和数据合规。`,bestFor:[`enterprise`,`compliance`,`coding`],freeTier:!1,aliases:[`azure`,`azure openai`,`aoai`],envVars:[`AZURE_OPENAI_API_KEY`,`AZURE_OPENAI_BASE_URL`]},"amazon-bedrock":{apiKeyUrl:`https://console.aws.amazon.com/iam/home#/security_credentials`,pricingUrl:`https://aws.amazon.com/bedrock/pricing/`,docsUrl:`https://docs.aws.amazon.com/bedrock/`,description:`AWS-hosted models including Claude, Llama, Titan. Enterprise-grade.`,descriptionZh:`AWS 托管模型,包含 Claude、Llama 等,企业级可靠性。`,bestFor:[`enterprise`,`compliance`],freeTier:!1,aliases:[`bedrock`,`aws`,`amazon`],envVars:[`AWS_ACCESS_KEY_ID`,`AWS_SECRET_ACCESS_KEY`,`AWS_REGION`]},minimax:{apiKeyUrl:`https://platform.minimax.io/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimax.io/docs/guides/models-intro`,docsUrl:`https://platform.minimax.io/docs/guides/quickstart-preparation`,description:`MiniMax — Chinese multimodal model with strong text and audio capabilities.`,descriptionZh:`MiniMax,国产多模态模型,文本和音频能力强。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax`,`mini max`,`abab`],envVars:[`MINIMAX_API_KEY`]},"minimax-cn":{apiKeyUrl:`https://platform.minimaxi.com/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimaxi.com/document/Price`,docsUrl:`https://platform.minimaxi.com/document/Announcement`,description:`MiniMax (China endpoint) — domestic access for Chinese users.`,descriptionZh:`MiniMax 国内端点,国内用户直连访问。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax cn`,`minimax china`,`abab`],envVars:[`MINIMAX_CN_API_KEY`,`MINIMAX_API_KEY`]},"kimi-coding":{apiKeyUrl:`https://platform.kimi.com/console/api-keys`,pricingUrl:`https://platform.kimi.com/docs/pricing/chat`,docsUrl:`https://platform.kimi.com/docs`,description:`Kimi Coding — Moonshot model optimized for code generation tasks.`,descriptionZh:`Kimi Coding,Moonshot 专为代码生成优化的模型。`,bestFor:[`coding`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`kimi coding`,`moonshot coding`,`kimi code`],envVars:[`KIMI_API_KEY`,`MOONSHOT_API_KEY`]},moonshotai:{apiKeyUrl:`https://platform.moonshot.ai/console/api-keys`,pricingUrl:`https://platform.moonshot.ai/docs/pricing`,docsUrl:`https://platform.moonshot.ai/docs`,description:`Moonshot Kimi — international API (api.moonshot.ai).`,descriptionZh:`月之暗面 Kimi 国际版 API(api.moonshot.ai)。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot`,`kimi`,`moonshot ai`],envVars:[`MOONSHOT_API_KEY`]},"moonshotai-cn":{apiKeyUrl:`https://platform.moonshot.cn/console/api-keys`,pricingUrl:`https://platform.moonshot.cn/docs/pricing/chat`,docsUrl:`https://platform.moonshot.cn/docs`,description:`Moonshot Kimi — China region endpoint.`,descriptionZh:`月之暗面 Kimi 中国区域端点。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot cn`,`kimi cn`],envVars:[`MOONSHOT_API_KEY`]},fal:{apiKeyUrl:`https://fal.ai/dashboard/keys`,pricingUrl:`https://fal.ai/pricing`,docsUrl:`https://fal.ai/docs`,description:`fal — serverless image and media generation APIs.`,descriptionZh:`fal:无服务器图像与媒体生成 API。`,bestFor:[`image`,`video`],freeTier:!0,aliases:[`fal ai`,`fal.ai`],envVars:[`FAL_KEY`,`FAL_API_KEY`]},fireworks:{apiKeyUrl:`https://fireworks.ai/account/api-keys`,pricingUrl:`https://fireworks.ai/pricing`,docsUrl:`https://docs.fireworks.ai`,description:`Fireworks AI — fast inference for open and proprietary models.`,descriptionZh:`Fireworks AI,多种开源与商业模型的高速推理服务。`,bestFor:[`speed`,`coding`,`open weights`],freeTier:!0,aliases:[`fireworks ai`,`fireworks`],envVars:[`FIREWORKS_API_KEY`]},together:{apiKeyUrl:`https://api.together.xyz/settings/api-keys`,pricingUrl:`https://www.together.ai/pricing`,docsUrl:`https://docs.together.ai`,description:`Together AI — hosted Llama, Qwen, DeepSeek, and more.`,descriptionZh:`Together AI,托管 Llama、Qwen、DeepSeek 等模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,aliases:[`together ai`,`together.xyz`],envVars:[`TOGETHER_API_KEY`]},"cloudflare-workers-ai":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/workers-ai`,pricingUrl:`https://developers.cloudflare.com/workers-ai/platform/pricing/`,docsUrl:`https://developers.cloudflare.com/workers-ai/`,description:`Cloudflare Workers AI — models at the edge via Cloudflare API.`,descriptionZh:`Cloudflare Workers AI,通过 Cloudflare API 在边缘运行模型。`,bestFor:[`edge`,`latency`],freeTier:!0,aliases:[`workers ai`,`cf workers ai`],envVars:[`CLOUDFLARE_API_KEY`]},"cloudflare-ai-gateway":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/ai-gateway`,pricingUrl:`https://developers.cloudflare.com/ai-gateway/pricing/`,docsUrl:`https://developers.cloudflare.com/ai-gateway/`,description:`Cloudflare AI Gateway — unified OpenAI/Anthropic-compatible routing.`,descriptionZh:`Cloudflare AI Gateway,统一 OpenAI/Anthropic 兼容路由。`,bestFor:[`routing`,`observability`,`enterprise`],freeTier:!0,aliases:[`cf ai gateway`,`cloudflare gateway`],envVars:[`CLOUDFLARE_API_KEY`]},xiaomi:{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo — API billing (Anthropic-compatible). Keys from the MiMo open platform; endpoint api.xiaomimimo.com.`,descriptionZh:`小米 MiMo 按量计费线路(Anthropic 兼容),在开放平台创建密钥;接口域名为 api.xiaomimimo.com。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi`,`mimo`,`小米`,`xiaomimimo`],envVars:[`XIAOMI_API_KEY`]},"xiaomi-token-plan-cn":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — China region (token-plan-cn.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 中国区(token-plan-cn.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token cn`,`mimo token cn`],envVars:[`XIAOMI_TOKEN_PLAN_CN_API_KEY`]},"xiaomi-token-plan-ams":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Amsterdam region (token-plan-ams.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 阿姆斯特丹(token-plan-ams.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token ams`,`mimo token ams`],envVars:[`XIAOMI_TOKEN_PLAN_AMS_API_KEY`]},"xiaomi-token-plan-sgp":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Singapore region (token-plan-sgp.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 新加坡(token-plan-sgp.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token sgp`,`mimo token sgp`],envVars:[`XIAOMI_TOKEN_PLAN_SGP_API_KEY`]},huggingface:{apiKeyUrl:`https://huggingface.co/settings/tokens`,pricingUrl:`https://huggingface.co/pricing`,docsUrl:`https://huggingface.co/docs/api-inference/`,description:`Access thousands of open-source models via Hugging Face Inference API.`,descriptionZh:`通过 Hugging Face 访问数千个开源模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,freeTierNote:`Free tier with rate limits.`,aliases:[`huggingface`,`hugging face`,`hf`],envVars:[`HF_TOKEN`,`HUGGINGFACE_TOKEN`]},opencode:{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode — AI coding assistant provider.`,descriptionZh:`OpenCode,AI 代码助手服务商。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode`,`open code`],envVars:[`OPENCODE_API_KEY`]},"opencode-go":{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode Go — AI coding assistant provider (Go variant).`,descriptionZh:`OpenCode Go,AI 代码助手服务商(Go 版本)。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode go`,`opencode-go`],envVars:[`OPENCODE_API_KEY`]},zai:{apiKeyUrl:`https://z.ai/manage-apikey/apikey-list`,pricingUrl:`https://z.ai/manage-apikey/billing`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,description:`01.AI Yi models — strong multilingual capabilities.`,descriptionZh:`零一万物 Yi 系列模型,多语言能力强。`,bestFor:[`general`,`chinese`],freeTier:!1,aliases:[`yi`,`01.ai`,`zero one`,`零一万物`],envVars:[`ZAI_API_KEY`]},dashscope:{apiKeyUrl:`https://modelstudio.console.alibabacloud.com/`,apiKeyUrlCn:`https://dashscope.console.aliyun.com/apiKey`,pricingUrl:`https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing`,docsUrl:`https://help.aliyun.com/zh/dashscope/`,description:"Alibaba DashScope — image generation, speech, and STT HTTP APIs (service id `dashscope`, not a pi-ai LLM provider).",descriptionZh:`阿里 DashScope:文生图、语音等 HTTP API(服务 id 为 dashscope,非 pi-ai 内置 LLM)。`,bestFor:[`image`,`speech`,`chinese`],freeTier:!0,aliases:[`dash scope`,`alibaba dashscope`],envVars:[`DASHSCOPE_API_KEY`]},"vercel-ai-gateway":{apiKeyUrl:`https://vercel.com/account/tokens`,pricingUrl:`https://vercel.com/pricing`,docsUrl:`https://vercel.com/docs/ai/ai-gateway`,description:`Vercel AI Gateway — route requests to multiple LLM providers via Vercel.`,descriptionZh:`Vercel AI Gateway,通过 Vercel 路由请求到多个 LLM 服务商。`,bestFor:[`flexibility`,`enterprise`],freeTier:!1,aliases:[`vercel gateway`,`vercel ai gateway`],envVars:[`AI_GATEWAY_API_KEY`,`VERCEL_AI_GATEWAY_API_KEY`]},"github-copilot":{apiKeyUrl:`https://github.com/settings/tokens`,pricingUrl:`https://github.com/features/copilot#pricing`,docsUrl:`https://docs.github.com/en/copilot`,description:`GitHub Copilot — use your GitHub token to access Copilot models.`,descriptionZh:`使用 GitHub 令牌访问 Copilot 模型。`,bestFor:[`coding`],freeTier:!0,freeTierNote:`Free for verified students and open-source maintainers.`,aliases:[`github copilot`,`copilot`,`github`],envVars:[`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`]}};function t_e(e,t){let n=G9[e];if(!n)return[];let r=n.apiKeyUrl,i=n.apiKeyUrlCn;return r&&i?t===`zh`?[{href:i,kind:`cn`},{href:r,kind:`intl`}]:[{href:r,kind:`intl`},{href:i,kind:`cn`}]:r?[{href:r,kind:`single`}]:i?[{href:i,kind:`single`}]:[]}function n_e(e){return e===`***`||e===`••••••••••••`}function r_e(e){if(!e||typeof e!=`object`||!(`providers`in e))return{};let t=e.providers;if(!t||typeof t!=`object`||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&(n[e]=r);return n}function i_e(e,t,n){let r=new Set(n.map(e=>e.provider));return e.map(e=>({...e,configured:e.configured||r.has(e.id),apiKey:t[e.id]||(e.configured||r.has(e.id)?`***`:``)}))}async function K9(e){await cP(Y(`/api/config`),{method:`PATCH`,body:JSON.stringify({providers:e})}),Promise.all([WV(),s(Y(`/api/providers/meta`))])}async function a_e(e){await cP(Y(`/api/providers/${encodeURIComponent(e)}/key`),{method:`DELETE`}),Promise.all([WV(),s(Y(`/api/providers/meta`))])}async function o_e(e){return(await cP(Y(`/api/models-json/test-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({value:e})})).payload??{type:`literal`,error:`No response`}}function s_e({onComplete:e,onDismiss:t}){let n=oN(e=>e.language),r=GM(n).onboarding,[i,a]=(0,L.useState)(`provider`),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)([]),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),b=(0,L.useMemo)(()=>r.stepOf.replace(`{{current}}`,String(i===`provider`?1:i===`apiKey`?2:3)).replace(`{{total}}`,`3`),[r.stepOf,i]),x=(0,L.useCallback)(async e=>{y(!0),p(null);try{let t=(await r7(!0)).filter(t=>t.provider===e);h(t),_(t[0]?.id??null)}catch(e){p(e instanceof Error?e.message:String(e)),h([]),_(null)}finally{y(!1)}},[]),S=async()=>{if(!(!o||!c.trim())){d(!0),p(null);try{await K9({[o]:c.trim()}),await x(o),a(`model`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},C=async()=>{if(!o||!g)return;let t=m.find(e=>e.id===g)?.id??g;d(!0),p(null);try{await cP(Y(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:{model:t}}})}),WV(),Zpe(),window.dispatchEvent(new CustomEvent(`config-reload`)),e()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,J.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-edge bg-surface-panel p-6 shadow-elevated`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl`,"aria-hidden":!0,children:`🤖`}),(0,J.jsx)(`h2`,{className:`mt-3 text-lg font-semibold tracking-tight text-fg`,children:r.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.subtitle}),(0,J.jsx)(`p`,{className:`mt-2 text-xs font-medium uppercase tracking-wide text-fg-muted`,children:b})]}),(0,J.jsxs)(`div`,{className:`mt-6`,children:[i===`provider`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-base font-medium text-fg`,children:r.step1Title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step1Subtitle})]}),(0,J.jsx)($ge,{onSelect:e=>{s(e),a(`apiKey`),l(``),p(null)}}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 pt-2`,children:[(0,J.jsx)(_o,{to:`/settings/providers`,className:`text-xs font-medium text-accent-fg hover:underline`,children:n===`zh`?`高级设置…`:`More settings…`}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline`,onClick:t,children:r.skipSetup})]})]}):null,i===`apiKey`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h3`,{className:`text-base font-medium text-fg`,children:[r.step2Title,o?` (${o})`:``]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step2Subtitle})]}),o&&(()=>{let e=G9[o],t=e?.apiKeyUrl,r=e?.apiKeyUrlCn;return t?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-xl border border-edge-subtle bg-surface-base px-3.5 py-2.5`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n===`zh`?`获取 API Key:`:`Get your API Key:`}),(0,J.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[r?n===`zh`?`国际版`:`International`:n===`zh`?`前往获取`:`Get API Key`,(0,J.jsx)(vg,{className:`size-3`})]}),r&&(0,J.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n===`zh`?`中国版`:`China`,(0,J.jsx)(vg,{className:`size-3`})]})]}):null})(),(0,J.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:r.step2Placeholder}),(0,J.jsx)(`input`,{type:`password`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:r.step2Placeholder,className:`mt-1 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none ring-accent placeholder:text-fg-muted focus:border-accent focus:ring-2 focus:ring-accent/30`})]}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.step2SecurityNote}),f?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2`,children:[(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>a(`provider`),children:r.back}),(0,J.jsx)(UM,{type:`button`,className:`bg-accent text-white hover:bg-accent/90`,disabled:u||!c.trim(),onClick:()=>void S(),children:r.continue})]})]}):null,i===`model`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-base font-medium text-fg`,children:r.step3Title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step3Subtitle})]}),v?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n===`zh`?`加载模型…`:`Loading models…`}):f&&m.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),(0,J.jsx)(`button`,{type:`button`,className:`text-left text-sm font-medium text-accent-fg hover:underline`,onClick:()=>o&&void x(o),children:n===`zh`?`重试`:`Retry`})]}):(0,J.jsx)(Gge,{models:m,selectedId:g,onSelectedChange:_}),f&&m.length>0?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2`,children:[(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>a(`apiKey`),children:r.back}),(0,J.jsx)(UM,{type:`button`,className:`bg-accent text-white hover:bg-accent/90`,disabled:u||!g||v,onClick:()=>void C(),children:r.startChatting})]})]}):null]})]})}function c_e(e){if(!e||typeof e!=`object`)return!0;let t=e,n=t.providers,r=Object.values(n&&typeof n==`object`&&!Array.isArray(n)?n:{}).some(e=>e===`***`),i=t.agents,a=``;if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i.defaults;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.model;typeof t==`string`&&(a=t)}}let o=a.trim().length>0;return!r||!o}function l_e(e){let[t,n]=(0,L.useState)(()=>typeof localStorage<`u`&&localStorage.getItem(`xopc-onboarding-model-setup-dismissed`)===`1`),{data:r,error:i,isLoading:a,mutate:o}=UV(e),{data:s,isLoading:l,mutate:u}=c(e?n7:null,r7,{revalidateOnFocus:!1}),d=!e||!a&&!l,f=(0,L.useMemo)(()=>{if(!e||!d)return!1;if(i)return!0;let t=c_e(r?.payload?.config),n=Array.isArray(s)&&s.length===0;return t||n},[e,d,i,r,s]),p=(0,L.useCallback)(async()=>{await Promise.all([o(),u()])},[o,u]);return(0,L.useEffect)(()=>{if(!e)return;let t=()=>{u()};return window.addEventListener(`config-reload`,t),()=>window.removeEventListener(`config-reload`,t)},[e,u]),{needsSetup:f,ready:d,refresh:p,guideDismissed:t,dismissPermanently:(0,L.useCallback)(()=>{try{localStorage.setItem(Wge,`1`)}catch{}n(!0)},[])}}function q9(){let e=GM(oN(e=>e.language)),t=LN(e=>e.token),n=zi(),r=Ii(),[i]=To(),a=(0,L.useRef)(null),o=l_e(!!t),s=(0,L.useRef)(0),[c,l]=(0,L.useState)(null),{auth:u,session:d,messages:f,stream:p,followUp:m,clarify:h,agents:g}=Hge(),_=i.get(`skill`)?.trim()??``,v=i.get(`slash`)?.trim()??``;(0,L.useEffect)(()=>{a.current=null},[d.sessionKey]),(0,L.useEffect)(()=>{if(!u.hasToken||!_&&!v||d.showSessionLoading||d.sessionRoutePending||!d.sessionKey)return;let e=()=>{let e=new URLSearchParams(i);e.delete(`skill`),e.delete(`slash`);let t=e.toString();n({pathname:r.pathname,search:t?`?${t}`:``},{replace:!0})},t=(t,n)=>{a.current!==n&&(a.current=n,queueMicrotask(()=>{s.current+=1,l({id:s.current,text:t}),e()}))};if(_){if(!Xfe(_)){e();return}let n=`${d.sessionKey}:skill:${_}`;t(`/skill:${_} `,n);return}if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(v)){e();return}let o=`${d.sessionKey}:slash:${v}`;a.current!==o&&queueMicrotask(()=>{(async()=>{try{let e=await o1(),t=v.toLowerCase(),n=e.find(e=>e.name.toLowerCase()===t||Array.isArray(e.aliases)&&e.aliases.some(e=>e.toLowerCase()===t));if(n){if(a.current===o)return;a.current=o,s.current+=1,l({id:s.current,text:u1(n)})}}finally{e()}})()})},[u.hasToken,_,v,i,d.showSessionLoading,d.sessionRoutePending,d.sessionKey,n,r.pathname]),(0,L.useEffect)(()=>()=>{JH.getState().setFocusedAgentRun(null,!1)},[]);let{scrollRef:y,atBottom:b,scrollToBottom:x,onScroll:S}=fge({hasToken:u.hasToken,showSessionLoading:d.showSessionLoading,sessionKey:d.sessionKey,sending:p.sending,chatMessages:f.items,hasMore:d.hasMore,loadingMore:d.loadingMore,loadMoreMessages:d.loadMoreMessages});(0,L.useEffect)(()=>{l(null)},[d.sessionKey]);let C=(0,L.useCallback)(e=>{s.current+=1,l({id:s.current,text:e})},[]),w=(0,L.useMemo)(()=>!!d.sessionKey&&!d.showSessionLoading&&!d.sessionRoutePending&&f.items.length===0,[d.sessionKey,d.showSessionLoading,d.sessionRoutePending,f.items.length]),T=p$(e=>e.setAgentId);(0,L.useEffect)(()=>{if(u.hasToken)return T(g.displayAgentId),()=>T(``)},[u.hasToken,g.displayAgentId,T]);let E=!!t&&o.ready&&o.needsSetup&&!o.guideDismissed&&!d.showSessionLoading&&!p.streaming,D=!d.showSessionLoading&&f.items.length===0&&!p.streaming&&!E,O=(0,L.useMemo)(()=>(d.sessionRoutePending&&d.decodedKey?d.decodedKey:d.sessionKey)?d.sessionName?.trim()||e.chat.newSession:e.nav.chat,[d.sessionKey,d.sessionName,d.sessionRoutePending,d.decodedKey,e.nav.chat,e.chat.newSession]);return u.hasToken?(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[(0,J.jsx)(Bme,{}),(0,J.jsx)(zme,{chatHeadline:O,chatAgents:g.chatAgents?.items??[],showChatAgentSelector:g.showChatAgentSelector,chatAgentId:g.displayAgentId,onChatAgentChange:g.onChatAgentChange,chatAgentDisabled:d.showSessionLoading||d.sessionRoutePending||p.streaming}),(0,J.jsxs)(`div`,{className:`mx-auto flex min-h-0 w-full max-w-[var(--max-width-chat)] flex-1 flex-col`,children:[d.sessionKey&&LH(d.sessionKey)&&!d.showSessionLoading&&!d.sessionRoutePending?(0,J.jsx)(Nme,{sessionKey:d.sessionKey,streaming:p.streaming,sending:p.sending}):null,(0,J.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col px-3 sm:px-5 xl:px-6`,children:(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(`div`,{ref:y,className:q(`chat-messages min-h-0 flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable_both-edges]`,D?`chat-messages--compact-welcome pt-5 pb-2`:`py-4`),onScroll:S,children:d.showSessionLoading?(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-3 py-12 text-center text-sm text-fg-muted`,children:e.chat.loading}):(0,J.jsxs)(J.Fragment,{children:[d.loadingMore?(0,J.jsx)(`div`,{className:`mb-3 text-center text-xs text-fg-muted`,children:e.chat.loadOlder}):null,p.error?(0,J.jsx)(`div`,{className:`mb-4 rounded-md border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:p.error}):null,(0,J.jsx)(lge,{messages:f.items,authToken:t??void 0,sessionKey:d.sessionKey,streaming:p.streaming,progress:p.progress,reasoningLevel:d.reasoningLevel,scrollElementRef:y,pinToBottom:b,onPickWelcomePrompt:C,welcomeOverlay:E?(0,J.jsx)(s_e,{onComplete:()=>void o.refresh(),onDismiss:o.dismissPermanently}):void 0,onDeleteRound:p.deleteMessageRound,onRetryUserMessageRound:p.retryUserMessageRound,deleteRoundDisabled:p.streaming||p.sending})]})}),(0,J.jsxs)(`div`,{className:q(`sticky bottom-0 z-10 shrink-0 bg-surface-panel`,D?`py-2.5`:`py-4`),children:[(0,J.jsx)(Uge,{prompt:h.clarifyPrompt,submitting:h.clarifySubmitting,onSubmit:h.submitClarifyAnswer}),(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-[var(--max-width-chat)] px-3 sm:px-5 xl:px-6`,children:(0,J.jsx)(Fme,{suggestions:m.followUpSuggestions,disabled:d.showSessionLoading||d.sessionRoutePending||!!h.clarifyPrompt,onPick:m.pickFollowUpSuggestion})}),(0,J.jsx)(kme,{disabled:d.showSessionLoading||d.sessionRoutePending||!!h.clarifyPrompt,sending:p.sending,streaming:p.streaming,sessionKey:d.sessionKey,sessionManager:d.sessionManager,welcomeDraftSeed:c,canSelectWorkingDirectory:w,thinkingLevel:d.thinkingLevel,showThinkingSelector:d.modelSupportsThinking,onThinkingChange:d.onSessionThinkingLevelChange,onSend:p.sendMessage,onAbort:p.abort,onAddPendingFollowUp:(e,t)=>void m.addPendingFollowUp(e,t),onSteeringInterrupt:(e,t)=>void p.interruptAndSend(e,t),pendingFollowUps:m.pendingFollowUps,editingFollowUpId:m.editingFollowUpId,onBeginEditFollowUp:m.beginEditFollowUp,onCancelEditFollowUp:m.cancelEditFollowUp,onCommitEditFollowUp:(e,t,n,r)=>void m.commitEditFollowUp(e,t,n,r),onPendingFollowUpRemove:m.removePendingFollowUp,onPendingFollowUpMove:m.movePendingFollowUp,onPendingFollowUpReorder:m.reorderPendingFollowUp,onPendingFollowUpSteer:e=>void m.steerPendingFollowUp(e),steeringFollowUpId:m.steeringFollowUpId,sessionModel:d.sessionModel,showModelSelector:!!(d.sessionKey&&!d.sessionRoutePending),onModelChange:d.onSessionModelChange,modelDisabled:d.showSessionLoading||d.sessionRoutePending||p.streaming,contextUsageMessages:f.items})]})]})})]}),(0,J.jsx)(uge,{visible:!d.showSessionLoading&&!b,onClick:()=>x(!0,!0)})]}):(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-[var(--max-width-chat)] px-3 py-16 text-center text-sm leading-relaxed text-fg-muted sm:px-5`,children:e.chat.needToken})}function u_e(){return(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:(0,J.jsx)(Sa,{})})}async function d_e(e){let t=await sP(e);if(!t.ok){let e=await t.json().catch(()=>({})),n=oP(t.status,t.statusText,e.error?.message);throw Error(n)}return t.json()}function f_e({children:e}){return(0,J.jsx)(l,{value:{fetcher:d_e,revalidateOnFocus:!1,dedupingInterval:2e3,shouldRetryOnError:!0,errorRetryCount:2},children:e})}var p_e=(0,L.lazy)(()=>f(()=>import(`./sessions-page-CaRD3IvA.js`).then(e=>({default:e.SessionsPage})),__vite__mapDeps([8,1,3,4]))),m_e=(0,L.lazy)(()=>f(()=>import(`./cron-page-B5nTa2u4.js`).then(e=>({default:e.CronPage})),__vite__mapDeps([10,1,11,4,2]))),h_e=(0,L.lazy)(()=>f(()=>import(`./skills-page-CN7HsYLQ.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([12,1,13,11,4]))),g_e=(0,L.lazy)(()=>f(()=>import(`./logs-page-BuugMrI_.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([9,1,4]))),__e=(0,L.lazy)(()=>f(()=>import(`./settings-page-DYOSuaHt.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7]))),J9=(0,L.lazy)(()=>f(()=>import(`./agents-DcHp6W8S.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([6,1,2,3,4]))),v_e=(0,L.lazy)(()=>f(()=>import(`./channels-settings-m10wg_Lg.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([17,1,11,4,3,5]))),Y9=(0,L.lazy)(()=>f(()=>import(`./apps-page-W9XwqSi7.js`).then(e=>({default:e.AppsPage})),__vite__mapDeps([18,1,3,4]))),X9=(0,L.lazy)(()=>f(()=>import(`./extension-page-D5iyUHNi.js`).then(e=>({default:e.ExtensionPage})),__vite__mapDeps([19,1,4]))),Z9=(0,L.lazy)(()=>f(()=>import(`./extension-settings-page-DXYuT-Dq.js`).then(e=>({default:e.ExtensionSettingsPage})),__vite__mapDeps([20,1,3,4,7]))),y_e=(0,L.lazy)(()=>f(()=>import(`./extension-debug-page-DMkgbZXH.js`).then(e=>({default:e.ExtensionDebugPage})),__vite__mapDeps([21,1,4])));function Q9(){return(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center text-sm text-fg-muted`,"aria-busy":!0,children:`Loading…`})}function b_e(){let{agentId:e}=Vi(),t=typeof e==`string`?e.trim():``;return(0,J.jsx)(xa,{to:t?`/agents/${encodeURIComponent(t)}`:`/agents`,replace:!0})}function $9(){return(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"aria-busy":!0,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main flex-1 px-4 py-8`,children:[(0,J.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,J.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,J.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`}),(0,J.jsx)(`p`,{className:`mt-6 text-sm text-fg-muted`,children:`Loading…`})]})})}var x_e=fo([{path:`/`,element:(0,J.jsx)(Sfe,{}),children:[{index:!0,element:(0,J.jsx)(xa,{to:`/chat`,replace:!0})},{path:`chat`,element:(0,J.jsx)(u_e,{}),children:[{index:!0,element:(0,J.jsx)(q9,{})},{path:`new`,element:(0,J.jsx)(q9,{})},{path:`:sessionKey`,element:(0,J.jsx)(q9,{})}]},{path:`sessions`,element:(0,J.jsx)(xa,{to:`/settings/sessions`,replace:!0})},{path:`logs`,element:(0,J.jsx)(xa,{to:`/settings/logs`,replace:!0})},{path:`cron`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(m_e,{})})},{path:`skills`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(h_e,{})})},{path:`channels`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(v_e,{})})},{path:`agents`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(J9,{})})},{path:`agents/:agentId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(J9,{})})},{path:`apps`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(Y9,{})})},{path:`apps/:extensionId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(X9,{})})},{path:`apps/:extensionId/:pageId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(X9,{})})},{path:`settings`,element:(0,J.jsx)(Nfe,{children:(0,J.jsx)(Afe,{})}),children:[{index:!0,element:(0,J.jsx)(xa,{to:`appearance`,replace:!0})},{path:`skills`,element:(0,J.jsx)(xa,{to:`/skills`,replace:!0})},{path:`cron`,element:(0,J.jsx)(xa,{to:`/cron`,replace:!0})},{path:`channels`,element:(0,J.jsx)(xa,{to:`/channels`,replace:!0})},{path:`sessions`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(p_e,{})})},{path:`logs`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(g_e,{})})},{path:`apps`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Y9,{})})},{path:`agents`,element:(0,J.jsx)(xa,{to:`/agents`,replace:!0})},{path:`agents/:agentId`,element:(0,J.jsx)(b_e,{})},{path:`agent-defaults`,element:(0,J.jsx)(xa,{to:`/settings/agent-chat`,replace:!0})},{path:`agent-models`,element:(0,J.jsx)(xa,{to:`/settings/models`,replace:!0})},{path:`extensions/debug`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(y_e,{})})},{path:`ext/:extensionId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Z9,{})})},{path:`ext/:extensionId/:panelId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Z9,{})})},{path:`:section`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(__e,{})})}]}]}]);function S_e(){return(0,L.useEffect)(()=>{let e=TN.persist.onFinishHydration(()=>{EN()}),t=mN.persist.onFinishHydration(()=>{hN()}),n=DN();return()=>{e?.(),t?.(),n()}},[]),null}function C_e(){return(0,J.jsx)(ree,{i18n:Ge,children:(0,J.jsx)(f_e,{children:(0,J.jsx)(xP,{children:(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(S_e,{}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col [&>*]:min-h-0 [&>*]:flex-1`,children:(0,J.jsx)(Lo,{router:x_e})})]})})})})}document.documentElement.setAttribute(`lang`,ht(xt())),wN(),pN(),RN(),(0,ne.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(L.StrictMode,{children:(0,J.jsx)(C_e,{})}));export{XG as $,pw as $n,ng as $r,eF as $t,v1 as A,ZM as An,Ug as Ar,eV as At,Y$ as B,hk as Bn,jg as Br,Hz as Bt,P1 as C,_o as Ci,oN as Cn,w_ as Cr,zV as Ct,x1 as D,Vi as Di,qM as Dn,Kg as Dr,iV as Dt,j1 as E,zi as Ei,XM as En,qg as Er,MV as Et,b1 as F,q as Fn,Rg as Fr,vB as Ft,U$ as G,GD as Gn,Tg as Gr,dR as Gt,J$ as H,JO as Hn,kg as Hr,SR as Ht,A1 as I,kA as In,Lg as Ir,_B as It,n$ as J,vE as Jn,yg as Jr,uR as Jt,B$ as K,pD as Kn,xg as Kr,pR as Kt,H$ as L,DA as Ln,Ig as Lr,gB as Lt,S1 as M,UM as Mn,Vg as Mr,QB as Mt,C1 as N,kM as Nn,Bg as Nr,nV as Nt,E1 as O,To as Oi,YM as On,Gg as Or,tV as Ot,D1 as P,AM as Pn,zg as Pr,yB as Pt,ZG as Q,_w as Qn,hg as Qr,cF as Qt,W$ as R,EA as Rn,Fg as Rr,mB as Rt,Ofe as S,Zo as Si,TN as Sn,P_ as Sr,UV as St,y1 as T,Ii as Ti,$M as Tn,Jg as Tr,NV as Tt,z$ as U,bO as Un,Og as Ur,_R as Ut,G$ as V,nk as Vn,Ag as Vr,NR as Vt,q$ as W,dO as Wn,Dg as Wr,hR as Wt,e$ as X,Nw as Xn,_g as Xr,kF as Xt,Z as Y,zT as Yn,vg as Yr,JL as Yt,uK as Z,xw as Zn,gg as Zr,mF as Zt,J8 as _,Mu as _i,nP as _n,hb as _r,PH as _t,r_e as a,fm as ai,NP as an,uC as ar,lG as at,W8 as b,Hs as bi,IN as bn,K_ as br,KV as bt,t_e as c,Ap as ci,CP as cn,KS as cr,_G as ct,Z7 as d,sp as di,Y as dn,fx as dr,MH as dt,Gh as ei,KP as en,HC as er,CG as et,m7 as f,op as fi,uP as fn,Xb as fr,AH as ft,r7 as g,ed as gi,cP as gn,zb as gr,DH as gt,n7 as h,od as hi,sP as hn,Bb as hr,OH as ht,K9 as i,vm as ii,FP as in,pC as ir,dG as it,w1 as j,GM as jn,Hg as jr,$B as jt,T1 as k,pt as ki,JM as kn,Wg as kr,rV as kt,e_e as l,xp as li,OP as ln,RS as lr,pG as lt,l7 as m,Jf as mi,dP as mn,Kb as mr,kH as mt,n_e as n,_h as ni,GP as nn,xC as nr,bG as nt,o_e as o,um as oi,kP as on,rC as or,sG as ot,f7 as p,rp as pi,lP as pn,Yb as pr,IH as pt,V$ as q,PE as qn,bg as qr,fR as qt,i_e as r,Km as ri,LP as rn,bC as rr,fG as rt,G9 as s,jp as si,EP as sn,QS as sr,hG as st,a_e as t,bh as ti,WP as tn,SC as tr,SG as tt,m9 as u,gp as ui,DP as un,Xx as ur,gG as ut,q8 as v,gc as vi,LN as vn,Oy as vr,NH as vt,N1 as w,xa as wi,QM as wn,Yg as wr,PV as wt,U8 as x,is as xi,kN as xn,V_ as xr,WV as xt,Mfe as y,Ws as yi,FN as yn,yv as yr,FH as yt,K$ as z,Rk as zn,Pg as zr,hB as zt};
4734
- //# sourceMappingURL=index-Cir8fqd7.js.map
4733
+ `).trim()}function Ige(e){if(e.role!==`assistant`)return[];let t=Fge(e.content);if(!t)return[];let n=t.length>B9?`${t.slice(0,B9)}…`:t,r=n.toLowerCase(),i=[];/\b(function|class|const |def |import |export |async |await |interface |type )\b/.test(r)||/```/.test(n)?(i.push(`code_error_handling`),i.push(`code_explain`),i.push(`code_refactor`),i.push(`code_optimize`)):/\d{4}-\d{2}-\d{2}|january|february|march|april|may|june|july|august|september|october|november|december|q[1-4]|quarter/i.test(n)?(i.push(`date_shorter_summary`),i.push(`date_main_risks`)):/^[-*•]|\n[-*•]/.test(n.trim())?(i.push(`generic_simpler_terms`),i.push(`generic_create_table`),i.push(`generic_bullet_points`)):/\|.*\|.*\|/.test(n)?(i.push(`generic_simpler_terms`),i.push(`generic_bullet_points`)):(i.push(`generic_simpler_terms`),i.push(`generic_concrete_example`),i.push(`generic_bullet_points`)),i.push(`what_next`);let a=new Set,o=[];for(let e of i)if(!a.has(e)&&(a.add(e),o.push(e),o.length>=4))break;return o.slice(0,4)}function Lge(e){let{sessionKey:t,decodedKey:n,sessionKeyRef:r,activeStreamSessionKeyRef:i,sendingRef:a,streamingRef:o,setSending:s,setStreaming:c,setProgress:l,modelSupportsThinking:u,thinkingLevel:d,shouldApplyStreamUpdate:f,setError:p,sendMessageRef:m}=e,[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useRef)(null),[b,x]=(0,L.useState)([]),S=(0,L.useRef)([]),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(null),D=(0,L.useRef)(null),[O,k]=(0,L.useState)([]),A=(0,L.useRef)([]),j=(0,L.useRef)(void 0),M=(0,L.useRef)(null);(0,L.useEffect)(()=>{y.current=h},[h]),(0,L.useEffect)(()=>{let e=j.current;e!=null&&e!==n&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current}),j.current=n,w(null)},[n]),(0,L.useEffect)(()=>{let e=M.current;if(e!=null&&e!==t&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current}),M.current=t,!t&&!n){S.current=[],x([]),A.current=[],k([]),E(null);return}if(!t||!n||t!==n)return;let r=Pge(t);if(r){let e=structuredClone(r.pending),t=[...r.suggestions];S.current=e,x(e),A.current=t,k(t),E(r.editingId)}else S.current=[],x([]),A.current=[],k([]),E(null)},[t,n]),(0,L.useEffect)(()=>{let e=t!=null&&n!=null&&t!==n?t:t??n??null;if(!e)return;let i=window.setTimeout(()=>{r.current===e&&R9(e,{pending:structuredClone(S.current),suggestions:[...A.current],editingId:D.current})},280);return()=>window.clearTimeout(i)},[t,n,b,O,T,r]),(0,L.useEffect)(()=>{n&&t!=null&&t!==n&&g(null)},[n,t]);let N=(0,L.useCallback)(()=>{g(null)},[]),P=(0,L.useCallback)(()=>{let e=r.current;e&&z9(e),S.current=[],x([]),E(null)},[r]),F=(0,L.useCallback)(()=>{let e=r.current;e&&z9(e),S.current=[],x([]),g(null),E(null)},[r]),I=(0,L.useCallback)(()=>{A.current=[],k([])},[]),ee=(0,L.useCallback)(e=>{let t=Ige(e);A.current=t,k(t)},[]),te=(0,L.useCallback)(()=>{g(null)},[]),ne=(0,L.useCallback)(e=>t=>{f(e)&&(a.current=!1,o.current=!1,s(!1),c(!1),l(null),g(t))},[f,a,o,s,c,l]),R=(0,L.useCallback)(async e=>{let t=r.current;if(e!=null&&e!==t)return;let n=t;if(!n)return;let s=S.current;for(;s.length>0&&!s[0].text.trim()&&!s[0].attachments?.length;)s=s.slice(1);if(s.length===0){S.current=[],x([]);return}s.length!==S.current.length&&(S.current=s,x(s));let[c,...l]=s,u=c.text?.trim()??``,d=c.attachments;!u&&!d?.length||i.current===n&&(a.current||o.current)||(D.current===c.id&&E(null),S.current=l,x(l),await m.current(c.text,c.attachments,c.thinkingLevel))},[m,r,i,a,o]);(0,L.useEffect)(()=>{if(!t||t!==n||h||b.length===0||a.current||o.current)return;let e=b[0];if(!e||!e.text.trim()&&!e.attachments?.length)return;let i=window.setTimeout(()=>{r.current===t&&(a.current||o.current||y.current||R(t))},72);return()=>window.clearTimeout(i)},[t,n,h,b,R,a,o,r]);let z=(0,L.useCallback)((e,t)=>{let n=e.trim();if(!n&&!t?.length||S.current.length>=10)return;let r=u?d:`off`,i={id:crypto.randomUUID(),text:n||e,attachments:t?.length?t:void 0,thinkingLevel:r};x(e=>{let t=[...e,i];return S.current=t,t})},[u,d]),B=(0,L.useCallback)(e=>{E(e)},[]),re=(0,L.useCallback)(()=>{E(null)},[]),V=(0,L.useCallback)((e,t,n,r)=>{let i=t.trim(),a=S.current,o=a.findIndex(t=>t.id===e);if(o<0){E(null);return}if(!i&&!n?.length){let t=a.filter(t=>t.id!==e);S.current=t,x(t),E(null);return}let s=[...a],c=u?r??d:`off`;s[o]={...s[o],text:i||t,attachments:n?.length?n:void 0,thinkingLevel:c},S.current=s,x(s),E(null)},[u,d]),ie=(0,L.useCallback)(e=>{D.current===e&&E(null),x(t=>{let n=t.filter(t=>t.id!==e);return S.current=n,n})},[]),ae=(0,L.useCallback)((e,t)=>{x(n=>{let r=n.findIndex(t=>t.id===e);if(r<0)return n;let i=t===`up`?r-1:r+1;if(i<0||i>=n.length)return n;let a=[...n];return[a[r],a[i]]=[a[i],a[r]],S.current=a,a})},[]),oe=(0,L.useCallback)((e,t)=>{x(n=>{if(e<0||e>=n.length||t<0||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),S.current=r,r})},[]),se=(0,L.useCallback)(async e=>{let t=r.current;if(!t)return;let n=S.current.find(t=>t.id===e);if(!(!n?.text.trim()||n.attachments?.length)){w(e);try{(await sP(Y(`/api/agent/steer`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({chatId:t,message:n.text.trim()})})).ok&&(x(t=>{let n=t.filter(t=>t.id!==e);return S.current=n,n}),D.current===e&&E(null))}catch{}finally{w(null)}}},[r]),ce=(0,L.useCallback)(e=>{let t=e.trim();if(t){if(A.current=[],k([]),a.current||o.current){if(S.current.length>=10){console.warn(`Follow-up queue is full (max 10). Remove one or wait for the run to finish.`);return}z(t,void 0);return}m.current(t,void 0,void 0)}},[z,m,a,o]),le=(0,L.useCallback)(async e=>{let t=y.current;if(t){v(!0);try{let n=await sP(Y(`/api/clarify/${encodeURIComponent(t.requestId)}`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({answer:e})});n.ok||p((await n.json().catch(()=>({}))).error?.message??n.statusText??`Clarify failed`),g(null)}finally{v(!1)}}},[p]);return S.current=b,A.current=O,D.current=T,{clarifyPrompt:h,clarifySubmitting:_,clarifyPromptRef:y,pendingFollowUps:b,pendingFollowUpsRef:S,followUpSuggestions:O,steeringFollowUpId:C,editingFollowUpId:T,addPendingFollowUp:z,beginEditFollowUp:B,cancelEditFollowUp:re,commitEditFollowUp:V,removePendingFollowUp:ie,movePendingFollowUp:ae,reorderPendingFollowUp:oe,steerPendingFollowUp:se,pickFollowUpSuggestion:ce,submitClarifyAnswer:le,dismissClarify:N,clearPendingFollowUps:P,dismissClarifyAndClearPending:F,refreshFollowUpSuggestions:ee,clearFollowUpSuggestions:I,onClarifyToolEnd:te,makeOnClarifyRequest:ne,flushSteeringQueue:R}}function Rge(e){let{navigate:t,sessionKeyRef:n,sessionKey:r,isNewRoute:i,locationState:a}=e,o=LN(e=>e.token),{data:s,mutate:l}=c(o?[`gateway-chat-agents`,o]:null,KV,{revalidateOnFocus:!1});(0,L.useEffect)(()=>{let e=()=>void l();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[l]);let[u,d]=(0,L.useState)(()=>N9()),f=(0,L.useRef)(s??null),p=(0,L.useRef)(N9());(0,L.useEffect)(()=>{f.current=s??null},[s]),(0,L.useEffect)(()=>{p.current=u},[u]),(0,L.useEffect)(()=>{if(!s)return;let e=new Set(s.items.map(e=>e.id));d(t=>t==null||t===``||!e.has(t)?s.defaultId:t)},[s]);let m=(0,L.useCallback)(()=>{let e=f.current,t=(p.current??``).trim().toLowerCase();if(!e)return t||void 0;let n=new Set(e.items.map(e=>e.id));return t&&n.has(t)?t:e.defaultId},[]),h=(0,L.useCallback)(e=>{let r=e.trim().toLowerCase();d(r);try{globalThis.localStorage?.setItem(M9,r)}catch{}let i=n.current;(i?xG(i):null)!==r&&t(`/chat/new`,{replace:!1})},[t,n]);return(0,L.useEffect)(()=>{let e=e=>{let t=e.detail?.agentId;typeof t!=`string`||!t.trim()||h(t)};return window.addEventListener(`xopc-set-chat-agent`,e),()=>window.removeEventListener(`xopc-set-chat-agent`,e)},[h]),(0,L.useEffect)(()=>{if(!r)return;let e=xG(r);if(e){d(t=>e===t?t:e);try{globalThis.localStorage?.setItem(M9,e)}catch{}}},[r]),(0,L.useLayoutEffect)(()=>{if(!i)return;let e=a,t=typeof e?.agentId==`string`?e.agentId.trim().toLowerCase():``;if(t){p.current=t,d(t);try{globalThis.localStorage?.setItem(M9,t)}catch{}}},[i,a]),{token:o,chatAgentsData:s,resolveAgentIdForPost:m,onChatAgentChange:h,displayAgentId:(0,L.useMemo)(()=>r&&xG(r)||u||s?.defaultId||`main`,[r,u,s]),showChatAgentSelector:(s?.items.length??0)>1}}async function zge(e){let t=e.trim();if(!t)return!1;try{return!!(await r7()).find(e=>e.id===t)?.reasoning}catch{return!1}}function Bge(e){let{sessionMgrRef:t,sessionKeyRef:n,sessionNameRef:r,sendingRef:i,streamingRef:a,activeStreamSessionKeyRef:o,loadingSessionRef:s,messagesLenRef:c,thinkingSupportGenRef:l,navigateToSession:u,resolveAgentIdForPost:d,dismissClarifyOnSessionLoad:f,sessionKey:p,loadingMore:m,hasMore:h,setLoadingMore:g,setSessionKey:_,setSessionName:v,setMessages:y,setHasMore:b,setError:x,setSessionModel:S,setThinkingLevel:C,setReasoningLevel:w,setModelSupportsThinking:T}=e,E=(0,L.useRef)(Promise.resolve(void 0)),D=(0,L.useRef)(0),O=(0,L.useCallback)(async e=>{let t=++l.current;if(!e.trim()){t===l.current&&T(!1);return}let n=await zge(e);t===l.current&&T(n)},[T,l]),k=(0,L.useCallback)(async()=>{let e=n.current;if(!e||r.current?.trim())return;let i=++D.current,a=[700,900,900,1e3,1e3];for(let o=0;o<5;o++){if(await new Promise(e=>setTimeout(e,a[o]??900)),i!==D.current||n.current!==e||r.current?.trim())return;try{let n=await t.current.fetchSessionName(e);if(i!==D.current)return;if(n){v(n);return}}catch{}}},[n,r,t,v]),A=(0,L.useCallback)((e,t)=>{n.current===e&&(y(t.messages),b(t.hasMore),t.name&&v(t.name))},[n,y,b,v]),j=(0,L.useCallback)(async(e,r=0)=>{let c=async(e,r)=>{if(!(r===0&&e===n.current&&(i.current||a.current)&&o.current===e)){r===0&&!GH(e)&&f(),s.current=!0;try{let{messages:n,hasMore:i,name:a}=await t.current.loadSession(e,r);if(r===0){_(e),v(a??null),y(n),b(i),x(null);try{let n=await t.current.loadSessionAgentConfig(e);S(n.model),C(n.thinkingLevel||`medium`),w(F9(n.reasoningLevel)),O(n.model)}catch{}return n}y(e=>{let t=new Set(e.map(e=>e.timestamp));return nH([...n.filter(e=>!t.has(e.timestamp)),...e])}),b(i);return}catch{if(r===0){x(`Failed to load session`);let e=await t.current.loadSessions().catch(()=>[]),n=e.filter(e=>(e.messageCount??0)>0)[0]??e[0];if(n)return u(n.key),await c(n.key,0);try{let e=d(),n=await t.current.createSession(e?{agentId:e}:void 0);u(n.key),_(n.key),y([]),b(!1);try{let e=await t.current.loadSessionAgentConfig(n.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}}catch{x(`Could not open a session`)}}return}finally{s.current=!1}}},l=E.current,p,m=new Promise(e=>{p=e});E.current=l.then(()=>m),await l;try{return await c(e,r)}finally{p()}},[n,i,a,o,s,f,_,v,y,b,x,S,C,w,u,O,d,t]);return{refreshModelThinkingSupport:O,pollSessionNameAfterTurn:k,applyLoadedSessionSnapshot:A,loadSessionById:j,loadMoreMessages:(0,L.useCallback)(async()=>{let e=n.current;if(!(!e||m||!h)){g(!0);try{await j(e,c.current)}finally{g(!1)}}},[h,j,m,c,s,n,g]),onSessionModelChange:(0,L.useCallback)(async e=>{if(p)try{x(null),await t.current.patchSessionAgentConfig(p,{model:e}),S(e),O(e)}catch(e){x(e instanceof Error?e.message:`Failed to switch model`)}},[p,t,x,S,O]),onSessionThinkingLevelChange:(0,L.useCallback)(async e=>{if(p)try{x(null),await t.current.patchSessionAgentConfig(p,{thinkingLevel:e}),C(e)}catch(e){x(e instanceof Error?e.message:`Failed to update thinking level`)}},[p,t,x,C]),createNewSession:(0,L.useCallback)(async()=>{f();try{let e=await t.current.loadSessions(),n=d(),r=P9(e,n);if(r){_(r.key),v(r.name??null),y([]),b(!1),u(r.key);try{let e=await t.current.loadSessionAgentConfig(r.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}return}let i=await t.current.createSession(n?{agentId:n}:void 0);_(i.key),v(i.name??null),y([]),b(!1),u(i.key);try{let e=await t.current.loadSessionAgentConfig(i.key);S(e.model),C(e.thinkingLevel||`medium`),w(F9(e.reasoningLevel)),O(e.model)}catch{}}catch(e){console.error(`[chat] createNewSession failed:`,e)}},[f,u,O,d,t,b,y,w,_,S,v,C])}}function V9(e){let{chatId:t,shouldApplyStreamUpdate:n,beforeAssistantDelta:r,setStreamingOnStreamStart:i,clearResumeRunIdOnBackgroundTerminal:a,clearResumeRunIdOnVisibleError:o,setStreaming:s,setStreamingMsg:c,setProgress:l,setSending:u,setError:d,userAbortedRef:f,activeStreamSessionKeyRef:p,activeResumeRunIdRef:m,sendingRef:h,streamingRef:g,sessionMgrRef:_,applyLoadedSessionSnapshot:v,finalizeMessage:y,fq:b}=e,x=()=>{_.current.loadSession(t,0).then(e=>v(t,e)).catch(()=>{})},S=()=>{k9(t),p.current=null,a&&(m.current=null),h.current=!1,g.current=!1,s(!1),u(!1),l(null),b.dismissClarify(),x()},C=()=>{let e=A9(t)?.streamingMsg;e&&c(e)};return{onStreamStart:()=>{r(),j9(t,()=>{}),Cge(t,{streaming:!0}),n(t)&&(i&&s(!0),C(),s(!0))},onToken:e=>{r(),j9(t,t=>{yge(t.content,e)}),n(t)&&(C(),s(!0))},onThinking:(e,i)=>{r(),j9(t,t=>{!i&&e===``?hge(t.content):gge(t.content,e,i)}),n(t)&&C()},onThinkingEnd:()=>{r(),j9(t,e=>{T9(e.content)}),n(t)&&C()},onToolStart:(e,i)=>{r(),j9(t,t=>{bge(t.content,e,i)}),n(t)&&(C(),s(!0))},onToolEnd:(e,i,a)=>{e===`clarify`&&b.onClarifyToolEnd(),r(),j9(t,t=>{xge(t.content,e,i,a)}),n(t)&&C()},onProgress:e=>{wge(t,e),n(t)&&l(e)},onTtsAudio:e=>{r(),j9(t,t=>{let n=e.workspaceRelativePath?.replace(/\\/g,`/`).trim(),r=t.attachments??[];if(n&&r.some(e=>e.workspaceRelativePath?.replace(/\\/g,`/`).trim()===n))return;let i={name:e.name,mimeType:e.mimeType,type:`voice`,workspaceRelativePath:e.workspaceRelativePath,size:0};t.attachments=[...r,i]}),n(t)&&C()},onClarifyRequest:b.makeOnClarifyRequest(t),onResult:()=>{if(!n(t)){S();return}if(f.current){f.current=!1;return}y()},onError:e=>{if(!n(t)){S();return}k9(t),o&&(m.current=null),h.current=!1,g.current=!1,d(e),c(null),s(!1),u(!1),l(null),b.dismissClarify()}}}function Vge(e){let{sessionKey:t,thinkingLevel:n,modelSupportsThinking:r,sessionKeyRef:i,sendingRef:a,streamingRef:o,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,userAbortedRef:l,senderRef:u,sessionMgrRef:d,sendMessageRef:f,setMessages:p,setStreamingMsg:m,setStreaming:h,setSending:g,setProgress:_,setError:v,shouldApplyStreamUpdate:y,fq:b,applyLoadedSessionSnapshot:x,loadSessionById:S,createNewSession:C,pollSessionNameAfterTurn:w,latestMessagesRef:T}=e,E=(0,L.useRef)(b.flushSteeringQueue);E.current=b.flushSteeringQueue;let D=(0,L.useCallback)(e=>{let t=s.current??i.current,n=null;(0,Io.flushSync)(()=>{m(e=>{if(!e)return null;let t=x9(e,Date.now());return T9(t.content),_ge(t.content),n=S9(t),null})});let r=n;if(r&&mge(r)&&(p(e=>nH([...e,r])),b.refreshFollowUpSuggestions(r)),h(!1),_(null),g(!1),a.current=!1,o.current=!1,s.current=null,c.current=null,b.dismissClarify(),w(),!e?.skipSteeringQueueFlush){let e=t??i.current;e&&window.setTimeout(()=>{E.current(e)},72)}let l=i.current;l&&window.setTimeout(()=>{i.current===l&&(a.current||o.current||b.pendingFollowUpsRef.current.length>0||S(l,0))},400),t&&k9(t)},[m,p,h,_,g,a,o,s,c,i,b.dismissClarify,b.refreshFollowUpSuggestions,b.pendingFollowUpsRef,w,S]),O=(0,L.useCallback)(async(e,t)=>{let n=u.current;if(n.isSending)return;let r=null;try{let t=sessionStorage.getItem(WH(e));t&&(r=JSON.parse(t))}catch{}if(!r?.runId||c.current===r.runId)return;l.current=!1,c.current=r.runId,s.current=e,a.current=!0,o.current=!0,g(!0),h(!0),_(null),Sge(e,t??T.current??[],!0,!0);let i=!1,f=()=>{if(i)return;i=!0;let t=null,n=[];(0,Io.flushSync)(()=>{p(e=>{if(e.length===0)return e;let r=e[e.length-1];return r?.role===`assistant`?(t=S9(r),n=e.slice(0,-1),n):e}),t&&(m(e=>e??t),Tge(e,n,t))})};try{let t=V9({chatId:e,shouldApplyStreamUpdate:y,beforeAssistantDelta:f,setStreamingOnStreamStart:!1,clearResumeRunIdOnBackgroundTerminal:!0,clearResumeRunIdOnVisibleError:!0,setStreaming:h,setStreamingMsg:m,setProgress:_,setSending:g,setError:v,userAbortedRef:l,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,sendingRef:a,streamingRef:o,sessionMgrRef:d,applyLoadedSessionSnapshot:x,finalizeMessage:D,fq:b});await n.resume(r.runId,e,t)}catch(t){t.name!==`AbortError`&&console.error(`[chat] resume failed:`,t),k9(e),c.current=null,a.current=!1,o.current=!1,h(!1),g(!1),m(null),_(null),s.current===e&&(s.current=null)}},[u,c,l,s,a,o,g,h,_,p,m,v,y,d,x,D,b.dismissClarify,b.makeOnClarifyRequest,b.onClarifyToolEnd,T]),k=(0,L.useCallback)(async(e,t,d)=>{if(!e.trim()&&!t?.length||!a.current&&!o.current&&!u.current.isSending)return;if(e.trim()===`/new`&&!t?.length){await C();return}if(!i.current)return;b.dismissClarifyAndClearPending();let p=r?d??n:`off`;l.current=!0,c.current=null,s.current=null,u.current.abort(),a.current=!1,o.current=!1,D({skipSteeringQueueFlush:!0}),_(null),queueMicrotask(()=>{f.current(e,t,p)})},[a,o,u,i,b.dismissClarifyAndClearPending,r,n,l,c,s,D,_,f,C]);return{finalizeMessage:D,tryResumeAgentRun:O,sendMessage:(0,L.useCallback)(async(e,i,f)=>{if(!t||!e.trim()&&!i?.length||s.current===t&&(a.current||o.current))return;if(e.trim()===`/new`&&!i?.length){await C();return}let S=r?f??n:`off`,w=u.current,T=t;l.current=!1,b.clearFollowUpSuggestions(),s.current=T,a.current=!0,g(!0),v(null),b.dismissClarify(),p(t=>{let n=[...t,{role:`user`,content:e?[{type:`text`,text:e}]:[],attachments:i,timestamp:Date.now()}];return O9(T,{messages:n,streamingMsg:null,progress:null,sending:!0,streaming:!1}),n});try{let t=V9({chatId:T,shouldApplyStreamUpdate:y,beforeAssistantDelta:()=>{},setStreamingOnStreamStart:!0,clearResumeRunIdOnBackgroundTerminal:!1,clearResumeRunIdOnVisibleError:!1,setStreaming:h,setStreamingMsg:m,setProgress:_,setSending:g,setError:v,userAbortedRef:l,activeStreamSessionKeyRef:s,activeResumeRunIdRef:c,sendingRef:a,streamingRef:o,sessionMgrRef:d,applyLoadedSessionSnapshot:x,finalizeMessage:D,fq:b});await w.send(e,T,i,S,t)}catch(e){e.name!==`AbortError`&&(k9(T),v(e instanceof Error?e.message:`Send failed`),m(null),h(!1))}finally{a.current=!1,o.current=!1,g(!1),s.current===T&&(s.current=null)}},[t,n,r,s,a,o,l,b.clearFollowUpSuggestions,b.dismissClarify,g,v,p,h,m,_,y,d,x,D,b.dismissClarify,b.makeOnClarifyRequest,b.onClarifyToolEnd,C,T]),interruptAndSend:k,abort:(0,L.useCallback)(()=>{l.current=!0,c.current=null,s.current=null,b.dismissClarifyAndClearPending(),u.current.abort(),a.current=!1,o.current=!1,D({skipSteeringQueueFlush:!0}),_(null);let e=i.current;e&&window.setTimeout(()=>{S(e,0)},300)},[l,c,s,b.dismissClarifyAndClearPending,u,a,o,D,_,i,S]),deleteMessageRound:(0,L.useCallback)(e=>{let t=i.current;t&&(a.current||o.current||p(n=>{let r=n[e];if(!r||!(r.role===`user`||r.role===`user-with-attachments`))return n;let i=1,a=n[e+1];a&&a.role===`assistant`&&(i=2);let o=[...n];return o.splice(e,i),d.current.deleteMessages(t,e,i).catch(()=>{S(t,0)}),o}))},[i,a,o,p,d,S]),retryUserMessageRound:(0,L.useCallback)(e=>{let t=i.current;t&&(a.current||o.current||p(n=>{let r=n[e];if(!r||r.role!==`user`&&r.role!==`user-with-attachments`)return n;for(let t=e+1;t<n.length;t++){let e=n[t].role;if(e===`user`||e===`user-with-attachments`)return n}let i=f9(r.content),a=Ghe(r.attachments);if(!i.trim()&&!a?.length)return n;let o=1,s=n[e+1];s&&s.role===`assistant`&&(o=2);let c=[...n];return c.splice(e,o),d.current.deleteMessages(t,e,o).catch(()=>{S(t,0)}),queueMicrotask(()=>{f.current(i,a)}),c}))},[i,a,o,p,d,S,f])}}function H9(e){let t=e.startsWith(`?`)?e.slice(1):e;if(!t)return``;let n=new URLSearchParams(t),r=new URLSearchParams,i=n.get(`skill`),a=n.get(`slash`);i&&r.set(`skill`,i),a&&r.set(`slash`,a);let o=r.toString();return o?`?${o}`:``}function Hge(){let e=zi(),t=Ii(),{sessionKey:n}=Vi(),r=(0,L.useRef)(new BH),i=(0,L.useRef)(new qH),a=(0,L.useRef)(!1),o=(0,L.useRef)(0),s=(0,L.useRef)(!1),c=(0,L.useRef)(!1),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=(0,L.useRef)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(null),m=(0,L.useRef)(0),h=(0,L.useRef)(!1),g=(0,L.useRef)(!1),_=(0,L.useRef)(async()=>{}),[v,y]=(0,L.useState)([]),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(null),[M,N]=(0,L.useState)(null),[P,F]=(0,L.useState)(!0),[I,ee]=(0,L.useState)(``),[te,ne]=(0,L.useState)(Ege),[R,z]=(0,L.useState)(Dge),[B,re]=(0,L.useState)(!1),[V,ie]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(!1),se=(0,L.useRef)(0),ce=(0,L.useRef)([]);(0,L.useEffect)(()=>{ce.current=v},[v]),(0,L.useEffect)(()=>{c.current=S},[S]),(0,L.useEffect)(()=>{l.current=A},[A]),(0,L.useEffect)(()=>{p.current=M},[M]),(0,L.useEffect)(()=>{se.current=v.length},[v.length]);let le=t.pathname.endsWith(`/new`),ue=n?decodeURIComponent(n):void 0;u.current=ue??null;let{token:de,chatAgentsData:fe,resolveAgentIdForPost:H,onChatAgentChange:pe,displayAgentId:me,showChatAgentSelector:he}=Rge({navigate:e,sessionKeyRef:l,sessionKey:A,isNewRoute:le,locationState:t.state}),U=ue!==void 0&&A!==ue,ge=(0,L.useMemo)(()=>P&&(A==null||ue===void 0),[P,A,ue]),W=(0,L.useCallback)((t,n=!0,r)=>{let i=r??``;e({pathname:`/chat/${encodeURIComponent(t)}`,search:i},{replace:n})},[e]),_e=(0,L.useCallback)(e=>{let t=String(e??``).trim();if(!t)return!1;let n=String(u.current??``).trim(),r=String(l.current??``).trim();return!!(n&&t===n||r&&t===r)},[]),ve=Lge({sessionKey:A,decodedKey:ue,sessionKeyRef:l,activeStreamSessionKeyRef:d,sendingRef:s,streamingRef:c,setSending:T,setStreaming:C,setProgress:D,modelSupportsThinking:B,thinkingLevel:te,shouldApplyStreamUpdate:_e,setError:k,sendMessageRef:_}),{refreshModelThinkingSupport:ye,pollSessionNameAfterTurn:be,applyLoadedSessionSnapshot:xe,loadSessionById:Se,loadMoreMessages:Ce,onSessionModelChange:we,onSessionThinkingLevelChange:Te,createNewSession:Ee}=Bge({sessionMgrRef:r,sessionKeyRef:l,sessionNameRef:p,sendingRef:s,streamingRef:c,activeStreamSessionKeyRef:d,loadingSessionRef:a,messagesLenRef:se,thinkingSupportGenRef:m,navigateToSession:W,resolveAgentIdForPost:H,dismissClarifyOnSessionLoad:ve.dismissClarify,sessionKey:A,loadingMore:ae,hasMore:V,setLoadingMore:oe,setSessionKey:j,setSessionName:N,setMessages:y,setHasMore:ie,setError:k,setSessionModel:ee,setThinkingLevel:ne,setReasoningLevel:z,setModelSupportsThinking:re}),De=(0,L.useCallback)(e=>{let t=A9(e);return!t||!GH(e)&&!i.current.isStreamingFor(e)?!1:(y(t.messages),x(t.streamingMsg),D(t.progress),C(t.streaming),T(t.sending),s.current=t.sending,c.current=t.streaming,d.current=e,!0)},[]),{tryResumeAgentRun:Oe,sendMessage:ke,interruptAndSend:Ae,abort:je,deleteMessageRound:Me,retryUserMessageRound:Ne}=Vge({sessionKey:A,thinkingLevel:te,modelSupportsThinking:B,sessionKeyRef:l,sendingRef:s,streamingRef:c,activeStreamSessionKeyRef:d,activeResumeRunIdRef:f,userAbortedRef:h,senderRef:i,sessionMgrRef:r,sendMessageRef:_,setMessages:y,setStreamingMsg:x,setStreaming:C,setSending:T,setProgress:D,setError:k,shouldApplyStreamUpdate:_e,fq:ve,applyLoadedSessionSnapshot:xe,loadSessionById:Se,createNewSession:Ee,pollSessionNameAfterTurn:be,latestMessagesRef:ce});(0,L.useEffect)(()=>{if(!ue)return;let e=d.current;(!e||ue!==e)&&(d.current=null,s.current=!1,c.current=!1,x(null),D(null),C(!1),T(!1))},[ue]);let Pe=(0,L.useMemo)(()=>b?[...v,b]:v,[v,b]);return(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;!t?.key||t.name===void 0||t.key===A&&N(t.name||null)};return window.addEventListener(`session-updated`,e),()=>window.removeEventListener(`session-updated`,e)},[A]),(0,L.useEffect)(()=>{let e=()=>{let e=l.current;e&&r.current.loadSessionAgentConfig(e).then(e=>{ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}).catch(()=>{})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[ye]),(0,L.useEffect)(()=>{if(!de){F(!1);return}let e=++o.current,n=!1;return(async()=>{(le||ue===void 0)&&F(!0),k(null);try{if(le){let i=await r.current.loadSessions();if(n||e!==o.current)return;let a=H(),s=P9(i,a);if(s){j(s.key),N(s.name??null),y([]),ie(!1),W(s.key,!0,H9(t.search));try{let e=await r.current.loadSessionAgentConfig(s.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}else{let i=await r.current.createSession(a?{agentId:a}:void 0);if(n||e!==o.current)return;j(i.key),N(i.name??null),y([]),ie(!1),W(i.key,!0,H9(t.search));try{let e=await r.current.loadSessionAgentConfig(i.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}}else if(ue){let t=await Se(ue,0);!n&&e===o.current&&(De(ue),await Oe(ue,A9(ue)?.messages??t??[]))}else{let t=await r.current.loadSessions();if(n||e!==o.current)return;let i=t.filter(e=>(e.messageCount??0)>0)[0]??t[0];if(i){let t=await Se(i.key,0);if(n||e!==o.current)return;De(i.key);let a=A9(i.key)?.messages??t??[];r.current.parseSessionFromHash()||W(i.key),await Oe(i.key,a)}else{let t=H(),i=await r.current.createSession(t?{agentId:t}:void 0);if(n||e!==o.current)return;j(i.key),N(i.name??null),y([]),ie(!1),W(i.key);try{let e=await r.current.loadSessionAgentConfig(i.key);ee(e.model),ne(e.thinkingLevel||`medium`),z(F9(e.reasoningLevel)),ye(e.model)}catch{}}}}catch(e){n||k(e instanceof Error?e.message:`Chat init failed`)}finally{!n&&e===o.current&&F(!1)}})(),()=>{n=!0}},[de,le,ue,W,Se,Oe,ye,H,De,t.search]),(0,L.useEffect)(()=>{let e=JH.getState().setFocusedAgentRun;if(!A){e(null,!1);return}e(A,S||w)},[A,S,w]),(0,L.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.sessionKey)return;let n=t.event;!n||n.type!==`status`||typeof n.runId!=`string`||!n.runId.trim()||(KH(t.sessionKey,n.runId),l.current===t.sessionKey&&(i.current.isStreamingFor(t.sessionKey)||queueMicrotask(()=>{l.current===t.sessionKey&&(i.current.isStreamingFor(t.sessionKey)||Oe(t.sessionKey,ce.current??[]))})))};return window.addEventListener(`agent-stream`,e),()=>window.removeEventListener(`agent-stream`,e)},[Oe]),(0,L.useEffect)(()=>{let e=S||w,t=g.current;if(g.current=e,!t||e)return;let n=l.current;n&&queueMicrotask(()=>{l.current===n&&(i.current.isStreamingFor(n)||GH(n)&&Oe(n,ce.current??[]))})},[S,w,Oe]),_.current=ke,{auth:{hasToken:!!de},session:{sessionKey:A,sessionName:M,decodedKey:ue,sessionRoutePending:U,showSessionLoading:ge,loading:P,sessionModel:I,thinkingLevel:te,onSessionThinkingLevelChange:Te,reasoningLevel:R,modelSupportsThinking:B,hasMore:V,loadingMore:ae,loadMoreMessages:Ce,onSessionModelChange:we,createNewSession:Ee,sessionManager:r.current},messages:{items:Pe},stream:{error:O,streaming:S,sending:w,progress:E,sendMessage:ke,abort:je,interruptAndSend:Ae,deleteMessageRound:Me,retryUserMessageRound:Ne},followUp:{addPendingFollowUp:ve.addPendingFollowUp,pendingFollowUps:ve.pendingFollowUps,editingFollowUpId:ve.editingFollowUpId,beginEditFollowUp:ve.beginEditFollowUp,cancelEditFollowUp:ve.cancelEditFollowUp,commitEditFollowUp:ve.commitEditFollowUp,removePendingFollowUp:ve.removePendingFollowUp,movePendingFollowUp:ve.movePendingFollowUp,reorderPendingFollowUp:ve.reorderPendingFollowUp,steerPendingFollowUp:ve.steerPendingFollowUp,steeringFollowUpId:ve.steeringFollowUpId,followUpSuggestions:ve.followUpSuggestions,pickFollowUpSuggestion:ve.pickFollowUpSuggestion},clarify:{clarifyPrompt:ve.clarifyPrompt,clarifySubmitting:ve.clarifySubmitting,submitClarifyAnswer:ve.submitClarifyAnswer},agents:{chatAgents:fe,displayAgentId:me,showChatAgentSelector:he,onChatAgentChange:pe}}}function Uge({prompt:e,submitting:t,onSubmit:n}){let[r,i]=(0,L.useState)(``),a=(0,L.useCallback)(e=>{n(e)},[n]);if(!e)return null;let o=Array.isArray(e.choices)&&e.choices.length>=2;return(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Clarification`,className:`mb-4 rounded-lg border border-edge bg-surface-elevated px-4 py-3 text-sm text-fg shadow-sm`,children:[(0,J.jsx)(e$,{content:e.question,compact:!0,className:`mb-3`}),o?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.choices.map(e=>(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:t,className:q(`min-h-9 justify-start rounded-lg px-3 py-2 text-left text-sm font-normal shadow-none`,`hover:border-edge`),onClick:()=>a(e),children:e},e)),e.default?(0,J.jsxs)(UM,{type:`button`,variant:`ghost`,disabled:t,className:q(`min-h-9 justify-start rounded-lg border border-dashed border-edge px-3 py-2 text-left text-sm font-normal text-fg-muted`,`hover:border-edge hover:text-fg`),onClick:()=>a(e.default),children:[`Default: `,e.default]}):null]}):(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-end`,onSubmit:e=>{e.preventDefault();let t=r.trim();t&&(n(t),i(``))},children:[(0,J.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),disabled:t,placeholder:`Your answer…`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 py-2 text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent disabled:opacity-50`}),(0,J.jsx)(UM,{type:`submit`,variant:`primary`,disabled:t||!r.trim(),className:`shrink-0 rounded-lg px-4 py-2 shadow-surface`,children:`Send`}),e.default?(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:t,className:`shrink-0 rounded-lg px-3 py-2 text-sm font-normal text-fg-muted shadow-none hover:text-fg`,onClick:()=>a(e.default),children:`Use default`}):null]})]})}var Wge=`xopc-onboarding-model-setup-dismissed`;function Gge({models:e,selectedId:t,onSelectedChange:n}){return e.length===0?null:(0,J.jsx)(`div`,{className:`flex max-h-[min(50vh,22rem)] flex-col gap-2 overflow-y-auto pr-1`,role:`radiogroup`,children:e.map(e=>{let r=t===e.id;return(0,J.jsxs)(`label`,{className:q(`flex cursor-pointer items-start gap-3 rounded-xl border border-edge px-3 py-2.5 transition-colors`,r?`border-accent bg-accent-soft`:`hover:bg-surface-hover`),children:[(0,J.jsx)(`input`,{type:`radio`,name:`onboarding-model`,className:`mt-1`,checked:r,onChange:()=>n(e.id)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name||e.id}),(0,J.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:e.id})]})]},e.id)})})}function U9({className:e,children:t,...n}){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,className:q(`shrink-0`,e),...n,children:t})}function Kge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#4D6BFE`,d:`M12.639 5.436c-.377-.222-.676-.093-.676.28v1.63c0 .55.185 1.088.524 1.527l.026.033 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`})})}function qge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`currentColor`,d:`M11.43 3.92a.86.86 0 1 0-1.718 0v14.236a1.999 1.999 0 0 1-3.997 0V9.022a.86.86 0 1 0-1.718 0v3.87a1.999 1.999 0 0 1-3.997 0V11.49a.57.57 0 0 1 1.139 0v1.404a.86.86 0 0 0 1.719 0V9.022a1.999 1.999 0 0 1 3.997 0v9.134a.86.86 0 0 0 1.719 0V3.92a1.998 1.998 0 1 1 3.996 0v11.788a.57.57 0 1 1-1.139 0zm10.572 3.105a2 2 0 0 0-1.999 1.997v7.63a.86.86 0 0 1-1.718 0V3.923a1.999 1.999 0 0 0-3.997 0v16.16a.86.86 0 0 1-1.719 0V18.08a.57.57 0 1 0-1.138 0v2a1.998 1.998 0 0 0 3.996 0V3.92a.86.86 0 0 1 1.719 0v12.73a1.999 1.999 0 0 0 3.996 0V9.023a.86.86 0 1 1 1.72 0v6.686a.57.57 0 0 0 1.138 0V9.022a2 2 0 0 0-1.998-1.997`})})}function W9({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#1A1A2E`,d:`m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866`})})}function Jge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`currentColor`,d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})})}function Yge({className:e,...t}){return(0,J.jsx)(U9,{className:e,...t,children:(0,J.jsx)(`path`,{fill:`#D4A27F`,d:`M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z`})})}function Xge({className:e,...t}){return(0,J.jsxs)(U9,{className:e,...t,children:[(0,J.jsx)(`defs`,{children:(0,J.jsxs)(`linearGradient`,{id:`gemini-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`0%`,stopColor:`#4285F4`}),(0,J.jsx)(`stop`,{offset:`50%`,stopColor:`#9B72CB`}),(0,J.jsx)(`stop`,{offset:`100%`,stopColor:`#D96570`})]})}),(0,J.jsx)(`path`,{fill:`url(#gemini-grad)`,d:`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`})]})}function Zge({providerId:e,className:t}){let n={className:t,"aria-hidden":!0};switch(e){case`deepseek`:return(0,J.jsx)(Kge,{...n});case`minimax`:return(0,J.jsx)(qge,{...n});case`kimi-coding`:return(0,J.jsx)(W9,{...n});case`moonshotai`:case`moonshotai-cn`:return(0,J.jsx)(W9,{...n});case`openai`:return(0,J.jsx)(Jge,{...n});case`anthropic`:return(0,J.jsx)(Yge,{...n});case`google`:return(0,J.jsx)(Xge,{...n});default:return(0,J.jsx)(`span`,{className:q(`flex items-center justify-center text-2xl`,t),children:`🤖`})}}var Qge=[{id:`deepseek`,name:`DeepSeek`,recommended:!0},{id:`minimax`,name:`MiniMax`,recommended:!1},{id:`kimi-coding`,name:`Kimi Coding`,recommended:!1},{id:`openai`,name:`OpenAI`,recommended:!1},{id:`anthropic`,name:`Anthropic`,recommended:!1},{id:`google`,name:`Google AI`,recommended:!1}];function $ge({onSelect:e}){return(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Qge.map(t=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(t.id),className:q(`relative flex flex-col items-center gap-1.5 rounded-xl border border-edge p-4 text-center transition-colors`,`hover:border-accent hover:bg-accent-soft`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,t.recommended&&`border-accent/50 bg-accent-soft/30`),children:[t.recommended&&(0,J.jsx)(`span`,{className:`absolute -top-2 right-2 rounded-full bg-accent px-2 py-0.5 text-[10px] font-semibold text-white`,children:`推荐`}),(0,J.jsx)(Zge,{providerId:t.id,className:`size-8`}),(0,J.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.name})]},t.id))})}function e_e(e,t){return e===`single`?t.getApiKey:e===`intl`?t.getApiKeyIntl:t.getApiKeyCn}var G9={openai:{apiKeyUrl:`https://platform.openai.com/api-keys`,pricingUrl:`https://openai.com/pricing`,docsUrl:`https://platform.openai.com/docs`,description:`The most widely used LLM provider. Powers ChatGPT.`,descriptionZh:`最广泛使用的 LLM 服务商,ChatGPT 背后的技术。`,bestFor:[`general`,`coding`,`vision`],freeTier:!1,freeTierNote:`Pay-as-you-go; new accounts may receive trial credits.`,aliases:[`chatgpt`,`gpt`,`gpt-4`,`gpt4`,`gpt-4o`,`gpt4o`],envVars:[`OPENAI_API_KEY`]},anthropic:{apiKeyUrl:`https://console.anthropic.com/settings/keys`,pricingUrl:`https://www.anthropic.com/pricing`,docsUrl:`https://docs.anthropic.com`,description:`Known for Claude — excellent at long documents, coding, and nuanced reasoning.`,descriptionZh:`Claude 系列模型,擅长长文档处理、代码和复杂推理。`,bestFor:[`long context`,`coding`,`reasoning`],freeTier:!1,aliases:[`claude`,`claude 3`,`claude sonnet`,`claude opus`,`claude haiku`],envVars:[`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`]},google:{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Google Gemini models — strong multimodal and long-context capabilities.`,descriptionZh:`Google Gemini 系列,多模态能力强,支持超长上下文。`,bestFor:[`multimodal`,`long context`,`general`],freeTier:!0,freeTierNote:`Free tier available via Google AI Studio.`,aliases:[`gemini`,`google gemini`,`bard`,`google ai`],envVars:[`GEMINI_API_KEY`,`GOOGLE_API_KEY`]},"google-vertex":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/vertex-ai/pricing`,docsUrl:`https://cloud.google.com/vertex-ai/docs`,description:`Google Vertex AI — enterprise-grade Gemini and other models on GCP.`,descriptionZh:`Google Vertex AI,企业级 GCP 托管模型,支持 Gemini 等。`,bestFor:[`enterprise`,`multimodal`,`compliance`],freeTier:!1,aliases:[`vertex`,`vertex ai`,`gcp`,`google cloud`],envVars:[`GOOGLE_CLOUD_API_KEY`,`GOOGLE_CLOUD_PROJECT`,`GOOGLE_CLOUD_LOCATION`]},"google-gemini-cli":{apiKeyUrl:`https://aistudio.google.com/app/apikey`,pricingUrl:`https://ai.google.dev/pricing`,docsUrl:`https://ai.google.dev/docs`,description:`Gemini via CLI token — for users authenticated with the Gemini CLI tool.`,descriptionZh:`通过 Gemini CLI 令牌访问 Gemini,适合已安装 CLI 工具的用户。`,bestFor:[`general`,`multimodal`],freeTier:!0,freeTierNote:`Uses your existing Gemini CLI authentication.`,aliases:[`gemini cli`,`gemini-cli`],envVars:[`GEMINI_CLI_TOKEN`,`GOOGLE_TOKEN`]},"google-antigravity":{apiKeyUrl:`https://console.cloud.google.com/apis/credentials`,pricingUrl:`https://cloud.google.com/pricing`,docsUrl:`https://cloud.google.com/docs`,description:`Google Antigravity — internal/experimental Google AI endpoint.`,descriptionZh:`Google Antigravity,Google 内部/实验性 AI 端点。`,bestFor:[`experimental`],freeTier:!1,aliases:[`antigravity`,`google antigravity`],envVars:[`ANTIGRAVITY_API_KEY`]},groq:{apiKeyUrl:`https://console.groq.com/keys`,pricingUrl:`https://groq.com/pricing/`,docsUrl:`https://console.groq.com/docs`,description:`Extremely fast inference — ideal for latency-sensitive applications.`,descriptionZh:`推理速度极快,适合对延迟敏感的场景。`,bestFor:[`speed`,`cheap`],freeTier:!0,freeTierNote:`Generous free tier with rate limits.`,aliases:[`groq`,`llama on groq`,`mixtral on groq`],envVars:[`GROQ_API_KEY`]},deepseek:{apiKeyUrl:`https://platform.deepseek.com/api_keys`,pricingUrl:`https://api-docs.deepseek.com/quick_start/pricing/`,docsUrl:`https://platform.deepseek.com/api-docs/`,description:`DeepSeek models — OpenAI-compatible API with strong reasoning and low costs.`,descriptionZh:`DeepSeek 模型:OpenAI 兼容 API,推理强、成本低。`,bestFor:[`reasoning`,`cheap`,`coding`],freeTier:!0,freeTierNote:`Free credits may be available for new accounts.`,aliases:[`deepseek`,`deep seek`,`deepseek v4`,`deepseek-v4`,`r1`],envVars:[`DEEPSEEK_API_KEY`]},xai:{apiKeyUrl:`https://console.x.ai/`,pricingUrl:`https://x.ai/api`,docsUrl:`https://docs.x.ai/`,description:`xAI Grok models — real-time web access, strong reasoning.`,descriptionZh:`xAI Grok 系列,支持实时联网,推理能力强。`,bestFor:[`reasoning`,`real-time`],freeTier:!1,aliases:[`grok`,`xai`,`x.ai`],envVars:[`XAI_API_KEY`]},cerebras:{apiKeyUrl:`https://cloud.cerebras.ai/platform/`,pricingUrl:`https://cloud.cerebras.ai/platform/`,docsUrl:`https://inference-docs.cerebras.ai/`,description:`Ultra-fast inference on custom AI chips. Fastest Llama inference available.`,descriptionZh:`基于专用 AI 芯片的超快推理,Llama 推理速度业界最快。`,bestFor:[`speed`],freeTier:!0,freeTierNote:`Free tier available.`,aliases:[`cerebras`],envVars:[`CEREBRAS_API_KEY`]},mistral:{apiKeyUrl:`https://console.mistral.ai/api-keys/`,pricingUrl:`https://mistral.ai/technology/#pricing`,docsUrl:`https://docs.mistral.ai/`,description:`European open-weight models. Good balance of quality and cost.`,descriptionZh:`欧洲开源模型,质量与成本平衡好。`,bestFor:[`general`,`cheap`,`coding`],freeTier:!1,aliases:[`mistral`,`mixtral`,`codestral`],envVars:[`MISTRAL_API_KEY`]},openrouter:{apiKeyUrl:`https://openrouter.ai/keys`,pricingUrl:`https://openrouter.ai/models`,docsUrl:`https://openrouter.ai/docs`,description:`API gateway to 100+ models from many providers with a single key.`,descriptionZh:`统一 API 网关,一个 Key 访问 100+ 模型。`,bestFor:[`general`,`flexibility`],freeTier:!0,freeTierNote:`Some models are free; pay-per-use for others.`,aliases:[`openrouter`,`open router`],envVars:[`OPENROUTER_API_KEY`]},"azure-openai-responses":{apiKeyUrl:`https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI`,pricingUrl:`https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/`,docsUrl:`https://learn.microsoft.com/en-us/azure/ai-services/openai/`,description:`OpenAI models hosted on Azure. Enterprise SLA and data residency.`,descriptionZh:`Azure 托管的 OpenAI 模型,企业级 SLA 和数据合规。`,bestFor:[`enterprise`,`compliance`,`coding`],freeTier:!1,aliases:[`azure`,`azure openai`,`aoai`],envVars:[`AZURE_OPENAI_API_KEY`,`AZURE_OPENAI_BASE_URL`]},"amazon-bedrock":{apiKeyUrl:`https://console.aws.amazon.com/iam/home#/security_credentials`,pricingUrl:`https://aws.amazon.com/bedrock/pricing/`,docsUrl:`https://docs.aws.amazon.com/bedrock/`,description:`AWS-hosted models including Claude, Llama, Titan. Enterprise-grade.`,descriptionZh:`AWS 托管模型,包含 Claude、Llama 等,企业级可靠性。`,bestFor:[`enterprise`,`compliance`],freeTier:!1,aliases:[`bedrock`,`aws`,`amazon`],envVars:[`AWS_ACCESS_KEY_ID`,`AWS_SECRET_ACCESS_KEY`,`AWS_REGION`]},minimax:{apiKeyUrl:`https://platform.minimax.io/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimax.io/docs/guides/models-intro`,docsUrl:`https://platform.minimax.io/docs/guides/quickstart-preparation`,description:`MiniMax — Chinese multimodal model with strong text and audio capabilities.`,descriptionZh:`MiniMax,国产多模态模型,文本和音频能力强。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax`,`mini max`,`abab`],envVars:[`MINIMAX_API_KEY`]},"minimax-cn":{apiKeyUrl:`https://platform.minimaxi.com/user-center/basic-information/interface-key`,pricingUrl:`https://platform.minimaxi.com/document/Price`,docsUrl:`https://platform.minimaxi.com/document/Announcement`,description:`MiniMax (China endpoint) — domestic access for Chinese users.`,descriptionZh:`MiniMax 国内端点,国内用户直连访问。`,bestFor:[`multimodal`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`minimax cn`,`minimax china`,`abab`],envVars:[`MINIMAX_CN_API_KEY`,`MINIMAX_API_KEY`]},"kimi-coding":{apiKeyUrl:`https://platform.kimi.com/console/api-keys`,pricingUrl:`https://platform.kimi.com/docs/pricing/chat`,docsUrl:`https://platform.kimi.com/docs`,description:`Kimi Coding — Moonshot model optimized for code generation tasks.`,descriptionZh:`Kimi Coding,Moonshot 专为代码生成优化的模型。`,bestFor:[`coding`,`chinese`],freeTier:!0,freeTierNote:`注册赠送免费额度。`,aliases:[`kimi coding`,`moonshot coding`,`kimi code`],envVars:[`KIMI_API_KEY`,`MOONSHOT_API_KEY`]},moonshotai:{apiKeyUrl:`https://platform.moonshot.ai/console/api-keys`,pricingUrl:`https://platform.moonshot.ai/docs/pricing`,docsUrl:`https://platform.moonshot.ai/docs`,description:`Moonshot Kimi — international API (api.moonshot.ai).`,descriptionZh:`月之暗面 Kimi 国际版 API(api.moonshot.ai)。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot`,`kimi`,`moonshot ai`],envVars:[`MOONSHOT_API_KEY`]},"moonshotai-cn":{apiKeyUrl:`https://platform.moonshot.cn/console/api-keys`,pricingUrl:`https://platform.moonshot.cn/docs/pricing/chat`,docsUrl:`https://platform.moonshot.cn/docs`,description:`Moonshot Kimi — China region endpoint.`,descriptionZh:`月之暗面 Kimi 中国区域端点。`,bestFor:[`coding`,`chinese`,`long context`],freeTier:!0,aliases:[`moonshot cn`,`kimi cn`],envVars:[`MOONSHOT_API_KEY`]},fal:{apiKeyUrl:`https://fal.ai/dashboard/keys`,pricingUrl:`https://fal.ai/pricing`,docsUrl:`https://fal.ai/docs`,description:`fal — serverless image and media generation APIs.`,descriptionZh:`fal:无服务器图像与媒体生成 API。`,bestFor:[`image`,`video`],freeTier:!0,aliases:[`fal ai`,`fal.ai`],envVars:[`FAL_KEY`,`FAL_API_KEY`]},fireworks:{apiKeyUrl:`https://fireworks.ai/account/api-keys`,pricingUrl:`https://fireworks.ai/pricing`,docsUrl:`https://docs.fireworks.ai`,description:`Fireworks AI — fast inference for open and proprietary models.`,descriptionZh:`Fireworks AI,多种开源与商业模型的高速推理服务。`,bestFor:[`speed`,`coding`,`open weights`],freeTier:!0,aliases:[`fireworks ai`,`fireworks`],envVars:[`FIREWORKS_API_KEY`]},together:{apiKeyUrl:`https://api.together.xyz/settings/api-keys`,pricingUrl:`https://www.together.ai/pricing`,docsUrl:`https://docs.together.ai`,description:`Together AI — hosted Llama, Qwen, DeepSeek, and more.`,descriptionZh:`Together AI,托管 Llama、Qwen、DeepSeek 等模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,aliases:[`together ai`,`together.xyz`],envVars:[`TOGETHER_API_KEY`]},"cloudflare-workers-ai":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/workers-ai`,pricingUrl:`https://developers.cloudflare.com/workers-ai/platform/pricing/`,docsUrl:`https://developers.cloudflare.com/workers-ai/`,description:`Cloudflare Workers AI — models at the edge via Cloudflare API.`,descriptionZh:`Cloudflare Workers AI,通过 Cloudflare API 在边缘运行模型。`,bestFor:[`edge`,`latency`],freeTier:!0,aliases:[`workers ai`,`cf workers ai`],envVars:[`CLOUDFLARE_API_KEY`]},"cloudflare-ai-gateway":{apiKeyUrl:`https://dash.cloudflare.com/?to=/:account/ai/ai-gateway`,pricingUrl:`https://developers.cloudflare.com/ai-gateway/pricing/`,docsUrl:`https://developers.cloudflare.com/ai-gateway/`,description:`Cloudflare AI Gateway — unified OpenAI/Anthropic-compatible routing.`,descriptionZh:`Cloudflare AI Gateway,统一 OpenAI/Anthropic 兼容路由。`,bestFor:[`routing`,`observability`,`enterprise`],freeTier:!0,aliases:[`cf ai gateway`,`cloudflare gateway`],envVars:[`CLOUDFLARE_API_KEY`]},xiaomi:{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo — API billing (Anthropic-compatible). Keys from the MiMo open platform; endpoint api.xiaomimimo.com.`,descriptionZh:`小米 MiMo 按量计费线路(Anthropic 兼容),在开放平台创建密钥;接口域名为 api.xiaomimimo.com。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi`,`mimo`,`小米`,`xiaomimimo`],envVars:[`XIAOMI_API_KEY`]},"xiaomi-token-plan-cn":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — China region (token-plan-cn.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 中国区(token-plan-cn.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token cn`,`mimo token cn`],envVars:[`XIAOMI_TOKEN_PLAN_CN_API_KEY`]},"xiaomi-token-plan-ams":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Amsterdam region (token-plan-ams.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 阿姆斯特丹(token-plan-ams.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token ams`,`mimo token ams`],envVars:[`XIAOMI_TOKEN_PLAN_AMS_API_KEY`]},"xiaomi-token-plan-sgp":{apiKeyUrl:`https://platform.xiaomimimo.com/#/console/api-keys`,pricingUrl:`https://mimo.mi.com/`,docsUrl:`https://platform.xiaomimimo.com/`,description:`Xiaomi MiMo Token Plan — Singapore region (token-plan-sgp.xiaomimimo.com).`,descriptionZh:`小米 MiMo Token 套餐 · 新加坡(token-plan-sgp.xiaomimimo.com)。`,bestFor:[`general`,`coding`],freeTier:!1,aliases:[`xiaomi token sgp`,`mimo token sgp`],envVars:[`XIAOMI_TOKEN_PLAN_SGP_API_KEY`]},huggingface:{apiKeyUrl:`https://huggingface.co/settings/tokens`,pricingUrl:`https://huggingface.co/pricing`,docsUrl:`https://huggingface.co/docs/api-inference/`,description:`Access thousands of open-source models via Hugging Face Inference API.`,descriptionZh:`通过 Hugging Face 访问数千个开源模型。`,bestFor:[`open source`,`flexibility`],freeTier:!0,freeTierNote:`Free tier with rate limits.`,aliases:[`huggingface`,`hugging face`,`hf`],envVars:[`HF_TOKEN`,`HUGGINGFACE_TOKEN`]},opencode:{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode — AI coding assistant provider.`,descriptionZh:`OpenCode,AI 代码助手服务商。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode`,`open code`],envVars:[`OPENCODE_API_KEY`]},"opencode-go":{apiKeyUrl:`https://opencode.ai/auth`,pricingUrl:`https://opencode.ai/docs`,docsUrl:`https://opencode.ai/docs/providers/`,description:`OpenCode Go — AI coding assistant provider (Go variant).`,descriptionZh:`OpenCode Go,AI 代码助手服务商(Go 版本)。`,bestFor:[`coding`],freeTier:!1,aliases:[`opencode go`,`opencode-go`],envVars:[`OPENCODE_API_KEY`]},zai:{apiKeyUrl:`https://z.ai/manage-apikey/apikey-list`,pricingUrl:`https://z.ai/manage-apikey/billing`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,description:`01.AI Yi models — strong multilingual capabilities.`,descriptionZh:`零一万物 Yi 系列模型,多语言能力强。`,bestFor:[`general`,`chinese`],freeTier:!1,aliases:[`yi`,`01.ai`,`zero one`,`零一万物`],envVars:[`ZAI_API_KEY`]},dashscope:{apiKeyUrl:`https://modelstudio.console.alibabacloud.com/`,apiKeyUrlCn:`https://dashscope.console.aliyun.com/apiKey`,pricingUrl:`https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-thousand-questions-metering-and-billing`,docsUrl:`https://help.aliyun.com/zh/dashscope/`,description:"Alibaba DashScope — image generation, speech, and STT HTTP APIs (service id `dashscope`, not a pi-ai LLM provider).",descriptionZh:`阿里 DashScope:文生图、语音等 HTTP API(服务 id 为 dashscope,非 pi-ai 内置 LLM)。`,bestFor:[`image`,`speech`,`chinese`],freeTier:!0,aliases:[`dash scope`,`alibaba dashscope`],envVars:[`DASHSCOPE_API_KEY`]},"vercel-ai-gateway":{apiKeyUrl:`https://vercel.com/account/tokens`,pricingUrl:`https://vercel.com/pricing`,docsUrl:`https://vercel.com/docs/ai/ai-gateway`,description:`Vercel AI Gateway — route requests to multiple LLM providers via Vercel.`,descriptionZh:`Vercel AI Gateway,通过 Vercel 路由请求到多个 LLM 服务商。`,bestFor:[`flexibility`,`enterprise`],freeTier:!1,aliases:[`vercel gateway`,`vercel ai gateway`],envVars:[`AI_GATEWAY_API_KEY`,`VERCEL_AI_GATEWAY_API_KEY`]},"github-copilot":{apiKeyUrl:`https://github.com/settings/tokens`,pricingUrl:`https://github.com/features/copilot#pricing`,docsUrl:`https://docs.github.com/en/copilot`,description:`GitHub Copilot — use your GitHub token to access Copilot models.`,descriptionZh:`使用 GitHub 令牌访问 Copilot 模型。`,bestFor:[`coding`],freeTier:!0,freeTierNote:`Free for verified students and open-source maintainers.`,aliases:[`github copilot`,`copilot`,`github`],envVars:[`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`]}};function t_e(e,t){let n=G9[e];if(!n)return[];let r=n.apiKeyUrl,i=n.apiKeyUrlCn;return r&&i?t===`zh`?[{href:i,kind:`cn`},{href:r,kind:`intl`}]:[{href:r,kind:`intl`},{href:i,kind:`cn`}]:r?[{href:r,kind:`single`}]:i?[{href:i,kind:`single`}]:[]}function n_e(e){return e===`***`||e===`••••••••••••`}function r_e(e){if(!e||typeof e!=`object`||!(`providers`in e))return{};let t=e.providers;if(!t||typeof t!=`object`||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&(n[e]=r);return n}function i_e(e,t,n){let r=new Set(n.map(e=>e.provider));return e.map(e=>({...e,configured:e.configured||r.has(e.id),apiKey:t[e.id]||(e.configured||r.has(e.id)?`***`:``)}))}async function K9(e){await cP(Y(`/api/config`),{method:`PATCH`,body:JSON.stringify({providers:e})}),Promise.all([WV(),s(Y(`/api/providers/meta`))])}async function a_e(e){await cP(Y(`/api/providers/${encodeURIComponent(e)}/key`),{method:`DELETE`}),Promise.all([WV(),s(Y(`/api/providers/meta`))])}async function o_e(e){return(await cP(Y(`/api/models-json/test-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({value:e})})).payload??{type:`literal`,error:`No response`}}function s_e({onComplete:e,onDismiss:t}){let n=oN(e=>e.language),r=GM(n).onboarding,[i,a]=(0,L.useState)(`provider`),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)([]),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),b=(0,L.useMemo)(()=>r.stepOf.replace(`{{current}}`,String(i===`provider`?1:i===`apiKey`?2:3)).replace(`{{total}}`,`3`),[r.stepOf,i]),x=(0,L.useCallback)(async e=>{y(!0),p(null);try{let t=(await r7(!0)).filter(t=>t.provider===e);h(t),_(t[0]?.id??null)}catch(e){p(e instanceof Error?e.message:String(e)),h([]),_(null)}finally{y(!1)}},[]),S=async()=>{if(!(!o||!c.trim())){d(!0),p(null);try{await K9({[o]:c.trim()}),await x(o),a(`model`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},C=async()=>{if(!o||!g)return;let t=m.find(e=>e.id===g)?.id??g;d(!0),p(null);try{await cP(Y(`/api/config`),{method:`PATCH`,body:JSON.stringify({agents:{defaults:{model:t}}})}),WV(),Zpe(),window.dispatchEvent(new CustomEvent(`config-reload`)),e()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,J.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-edge bg-surface-panel p-6 shadow-elevated`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl`,"aria-hidden":!0,children:`🤖`}),(0,J.jsx)(`h2`,{className:`mt-3 text-lg font-semibold tracking-tight text-fg`,children:r.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.subtitle}),(0,J.jsx)(`p`,{className:`mt-2 text-xs font-medium uppercase tracking-wide text-fg-muted`,children:b})]}),(0,J.jsxs)(`div`,{className:`mt-6`,children:[i===`provider`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-base font-medium text-fg`,children:r.step1Title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step1Subtitle})]}),(0,J.jsx)($ge,{onSelect:e=>{s(e),a(`apiKey`),l(``),p(null)}}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 pt-2`,children:[(0,J.jsx)(_o,{to:`/settings/providers`,className:`text-xs font-medium text-accent-fg hover:underline`,children:n===`zh`?`高级设置…`:`More settings…`}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline`,onClick:t,children:r.skipSetup})]})]}):null,i===`apiKey`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h3`,{className:`text-base font-medium text-fg`,children:[r.step2Title,o?` (${o})`:``]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step2Subtitle})]}),o&&(()=>{let e=G9[o],t=e?.apiKeyUrl,r=e?.apiKeyUrlCn;return t?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-xl border border-edge-subtle bg-surface-base px-3.5 py-2.5`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n===`zh`?`获取 API Key:`:`Get your API Key:`}),(0,J.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[r?n===`zh`?`国际版`:`International`:n===`zh`?`前往获取`:`Get API Key`,(0,J.jsx)(vg,{className:`size-3`})]}),r&&(0,J.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n===`zh`?`中国版`:`China`,(0,J.jsx)(vg,{className:`size-3`})]})]}):null})(),(0,J.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:r.step2Placeholder}),(0,J.jsx)(`input`,{type:`password`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:r.step2Placeholder,className:`mt-1 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none ring-accent placeholder:text-fg-muted focus:border-accent focus:ring-2 focus:ring-accent/30`})]}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.step2SecurityNote}),f?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2`,children:[(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>a(`provider`),children:r.back}),(0,J.jsx)(UM,{type:`button`,className:`bg-accent text-white hover:bg-accent/90`,disabled:u||!c.trim(),onClick:()=>void S(),children:r.continue})]})]}):null,i===`model`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-base font-medium text-fg`,children:r.step3Title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.step3Subtitle})]}),v?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n===`zh`?`加载模型…`:`Loading models…`}):f&&m.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),(0,J.jsx)(`button`,{type:`button`,className:`text-left text-sm font-medium text-accent-fg hover:underline`,onClick:()=>o&&void x(o),children:n===`zh`?`重试`:`Retry`})]}):(0,J.jsx)(Gge,{models:m,selectedId:g,onSelectedChange:_}),f&&m.length>0?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2`,children:[(0,J.jsx)(UM,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>a(`apiKey`),children:r.back}),(0,J.jsx)(UM,{type:`button`,className:`bg-accent text-white hover:bg-accent/90`,disabled:u||!g||v,onClick:()=>void C(),children:r.startChatting})]})]}):null]})]})}function c_e(e){if(!e||typeof e!=`object`)return!0;let t=e,n=t.providers,r=Object.values(n&&typeof n==`object`&&!Array.isArray(n)?n:{}).some(e=>e===`***`),i=t.agents,a=``;if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i.defaults;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.model;typeof t==`string`&&(a=t)}}let o=a.trim().length>0;return!r||!o}function l_e(e){let[t,n]=(0,L.useState)(()=>typeof localStorage<`u`&&localStorage.getItem(`xopc-onboarding-model-setup-dismissed`)===`1`),{data:r,error:i,isLoading:a,mutate:o}=UV(e),{data:s,isLoading:l,mutate:u}=c(e?n7:null,r7,{revalidateOnFocus:!1}),d=!e||!a&&!l,f=(0,L.useMemo)(()=>{if(!e||!d)return!1;if(i)return!0;let t=c_e(r?.payload?.config),n=Array.isArray(s)&&s.length===0;return t||n},[e,d,i,r,s]),p=(0,L.useCallback)(async()=>{await Promise.all([o(),u()])},[o,u]);return(0,L.useEffect)(()=>{if(!e)return;let t=()=>{u()};return window.addEventListener(`config-reload`,t),()=>window.removeEventListener(`config-reload`,t)},[e,u]),{needsSetup:f,ready:d,refresh:p,guideDismissed:t,dismissPermanently:(0,L.useCallback)(()=>{try{localStorage.setItem(Wge,`1`)}catch{}n(!0)},[])}}function q9(){let e=GM(oN(e=>e.language)),t=LN(e=>e.token),n=zi(),r=Ii(),[i]=To(),a=(0,L.useRef)(null),o=l_e(!!t),s=(0,L.useRef)(0),[c,l]=(0,L.useState)(null),{auth:u,session:d,messages:f,stream:p,followUp:m,clarify:h,agents:g}=Hge(),_=i.get(`skill`)?.trim()??``,v=i.get(`slash`)?.trim()??``;(0,L.useEffect)(()=>{a.current=null},[d.sessionKey]),(0,L.useEffect)(()=>{if(!u.hasToken||!_&&!v||d.showSessionLoading||d.sessionRoutePending||!d.sessionKey)return;let e=()=>{let e=new URLSearchParams(i);e.delete(`skill`),e.delete(`slash`);let t=e.toString();n({pathname:r.pathname,search:t?`?${t}`:``},{replace:!0})},t=(t,n)=>{a.current!==n&&(a.current=n,queueMicrotask(()=>{s.current+=1,l({id:s.current,text:t}),e()}))};if(_){if(!Xfe(_)){e();return}let n=`${d.sessionKey}:skill:${_}`;t(`/skill:${_} `,n);return}if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(v)){e();return}let o=`${d.sessionKey}:slash:${v}`;a.current!==o&&queueMicrotask(()=>{(async()=>{try{let e=await o1(),t=v.toLowerCase(),n=e.find(e=>e.name.toLowerCase()===t||Array.isArray(e.aliases)&&e.aliases.some(e=>e.toLowerCase()===t));if(n){if(a.current===o)return;a.current=o,s.current+=1,l({id:s.current,text:u1(n)})}}finally{e()}})()})},[u.hasToken,_,v,i,d.showSessionLoading,d.sessionRoutePending,d.sessionKey,n,r.pathname]),(0,L.useEffect)(()=>()=>{JH.getState().setFocusedAgentRun(null,!1)},[]);let{scrollRef:y,atBottom:b,scrollToBottom:x,onScroll:S}=fge({hasToken:u.hasToken,showSessionLoading:d.showSessionLoading,sessionKey:d.sessionKey,sending:p.sending,chatMessages:f.items,hasMore:d.hasMore,loadingMore:d.loadingMore,loadMoreMessages:d.loadMoreMessages});(0,L.useEffect)(()=>{l(null)},[d.sessionKey]);let C=(0,L.useCallback)(e=>{s.current+=1,l({id:s.current,text:e})},[]),w=(0,L.useMemo)(()=>!!d.sessionKey&&!d.showSessionLoading&&!d.sessionRoutePending&&f.items.length===0,[d.sessionKey,d.showSessionLoading,d.sessionRoutePending,f.items.length]),T=p$(e=>e.setAgentId);(0,L.useEffect)(()=>{if(u.hasToken)return T(g.displayAgentId),()=>T(``)},[u.hasToken,g.displayAgentId,T]);let E=!!t&&o.ready&&o.needsSetup&&!o.guideDismissed&&!d.showSessionLoading&&!p.streaming,D=!d.showSessionLoading&&f.items.length===0&&!p.streaming&&!E,O=(0,L.useMemo)(()=>(d.sessionRoutePending&&d.decodedKey?d.decodedKey:d.sessionKey)?d.sessionName?.trim()||e.chat.newSession:e.nav.chat,[d.sessionKey,d.sessionName,d.sessionRoutePending,d.decodedKey,e.nav.chat,e.chat.newSession]);return u.hasToken?(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[(0,J.jsx)(Bme,{}),(0,J.jsx)(zme,{chatHeadline:O,chatAgents:g.chatAgents?.items??[],showChatAgentSelector:g.showChatAgentSelector,chatAgentId:g.displayAgentId,onChatAgentChange:g.onChatAgentChange,chatAgentDisabled:d.showSessionLoading||d.sessionRoutePending||p.streaming}),(0,J.jsxs)(`div`,{className:`mx-auto flex min-h-0 w-full max-w-[var(--max-width-chat)] flex-1 flex-col`,children:[d.sessionKey&&LH(d.sessionKey)&&!d.showSessionLoading&&!d.sessionRoutePending?(0,J.jsx)(Nme,{sessionKey:d.sessionKey,streaming:p.streaming,sending:p.sending}):null,(0,J.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col px-3 sm:px-5 xl:px-6`,children:(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(`div`,{ref:y,className:q(`chat-messages min-h-0 flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable_both-edges]`,D?`chat-messages--compact-welcome pt-5 pb-2`:`py-4`),onScroll:S,children:d.showSessionLoading?(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-3 py-12 text-center text-sm text-fg-muted`,children:e.chat.loading}):(0,J.jsxs)(J.Fragment,{children:[d.loadingMore?(0,J.jsx)(`div`,{className:`mb-3 text-center text-xs text-fg-muted`,children:e.chat.loadOlder}):null,p.error?(0,J.jsx)(`div`,{className:`mb-4 rounded-md border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:p.error}):null,(0,J.jsx)(lge,{messages:f.items,authToken:t??void 0,sessionKey:d.sessionKey,streaming:p.streaming,progress:p.progress,reasoningLevel:d.reasoningLevel,scrollElementRef:y,pinToBottom:b,onPickWelcomePrompt:C,welcomeOverlay:E?(0,J.jsx)(s_e,{onComplete:()=>void o.refresh(),onDismiss:o.dismissPermanently}):void 0,onDeleteRound:p.deleteMessageRound,onRetryUserMessageRound:p.retryUserMessageRound,deleteRoundDisabled:p.streaming||p.sending})]})}),(0,J.jsxs)(`div`,{className:q(`sticky bottom-0 z-10 shrink-0 bg-surface-panel`,D?`py-2.5`:`py-4`),children:[(0,J.jsx)(Uge,{prompt:h.clarifyPrompt,submitting:h.clarifySubmitting,onSubmit:h.submitClarifyAnswer}),(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-[var(--max-width-chat)] px-3 sm:px-5 xl:px-6`,children:(0,J.jsx)(Fme,{suggestions:m.followUpSuggestions,disabled:d.showSessionLoading||d.sessionRoutePending||!!h.clarifyPrompt,onPick:m.pickFollowUpSuggestion})}),(0,J.jsx)(kme,{disabled:d.showSessionLoading||d.sessionRoutePending||!!h.clarifyPrompt,sending:p.sending,streaming:p.streaming,sessionKey:d.sessionKey,sessionManager:d.sessionManager,welcomeDraftSeed:c,canSelectWorkingDirectory:w,thinkingLevel:d.thinkingLevel,showThinkingSelector:d.modelSupportsThinking,onThinkingChange:d.onSessionThinkingLevelChange,onSend:p.sendMessage,onAbort:p.abort,onAddPendingFollowUp:(e,t)=>void m.addPendingFollowUp(e,t),onSteeringInterrupt:(e,t)=>void p.interruptAndSend(e,t),pendingFollowUps:m.pendingFollowUps,editingFollowUpId:m.editingFollowUpId,onBeginEditFollowUp:m.beginEditFollowUp,onCancelEditFollowUp:m.cancelEditFollowUp,onCommitEditFollowUp:(e,t,n,r)=>void m.commitEditFollowUp(e,t,n,r),onPendingFollowUpRemove:m.removePendingFollowUp,onPendingFollowUpMove:m.movePendingFollowUp,onPendingFollowUpReorder:m.reorderPendingFollowUp,onPendingFollowUpSteer:e=>void m.steerPendingFollowUp(e),steeringFollowUpId:m.steeringFollowUpId,sessionModel:d.sessionModel,showModelSelector:!!(d.sessionKey&&!d.sessionRoutePending),onModelChange:d.onSessionModelChange,modelDisabled:d.showSessionLoading||d.sessionRoutePending||p.streaming,contextUsageMessages:f.items})]})]})})]}),(0,J.jsx)(uge,{visible:!d.showSessionLoading&&!b,onClick:()=>x(!0,!0)})]}):(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-[var(--max-width-chat)] px-3 py-16 text-center text-sm leading-relaxed text-fg-muted sm:px-5`,children:e.chat.needToken})}function u_e(){return(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:(0,J.jsx)(Sa,{})})}async function d_e(e){let t=await sP(e);if(!t.ok){let e=await t.json().catch(()=>({})),n=oP(t.status,t.statusText,e.error?.message);throw Error(n)}return t.json()}function f_e({children:e}){return(0,J.jsx)(l,{value:{fetcher:d_e,revalidateOnFocus:!1,dedupingInterval:2e3,shouldRetryOnError:!0,errorRetryCount:2},children:e})}var p_e=(0,L.lazy)(()=>f(()=>import(`./sessions-page-DgAIvstc.js`).then(e=>({default:e.SessionsPage})),__vite__mapDeps([8,1,3,4]))),m_e=(0,L.lazy)(()=>f(()=>import(`./cron-page-C82UvjSi.js`).then(e=>({default:e.CronPage})),__vite__mapDeps([10,1,11,4,2]))),h_e=(0,L.lazy)(()=>f(()=>import(`./skills-page-BR5vm_QN.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([12,1,13,11,4]))),g_e=(0,L.lazy)(()=>f(()=>import(`./logs-page-DCH6aatp.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([9,1,4]))),__e=(0,L.lazy)(()=>f(()=>import(`./settings-page-CyQrYfl-.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7]))),J9=(0,L.lazy)(()=>f(()=>import(`./agents-Cg_LGzbv.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([6,1,2,3,4]))),v_e=(0,L.lazy)(()=>f(()=>import(`./channels-settings-BDkP3YdO.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([17,1,11,4,3,5]))),Y9=(0,L.lazy)(()=>f(()=>import(`./apps-page-CW1VZ5L2.js`).then(e=>({default:e.AppsPage})),__vite__mapDeps([18,1,3,4]))),X9=(0,L.lazy)(()=>f(()=>import(`./extension-page-ClpFl3ym.js`).then(e=>({default:e.ExtensionPage})),__vite__mapDeps([19,1,4]))),Z9=(0,L.lazy)(()=>f(()=>import(`./extension-settings-page-AawKA54u.js`).then(e=>({default:e.ExtensionSettingsPage})),__vite__mapDeps([20,1,3,4,7]))),y_e=(0,L.lazy)(()=>f(()=>import(`./extension-debug-page-Cb1TVFq8.js`).then(e=>({default:e.ExtensionDebugPage})),__vite__mapDeps([21,1,4])));function Q9(){return(0,J.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center text-sm text-fg-muted`,"aria-busy":!0,children:`Loading…`})}function b_e(){let{agentId:e}=Vi(),t=typeof e==`string`?e.trim():``;return(0,J.jsx)(xa,{to:t?`/agents/${encodeURIComponent(t)}`:`/agents`,replace:!0})}function $9(){return(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"aria-busy":!0,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main flex-1 px-4 py-8`,children:[(0,J.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,J.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,J.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`}),(0,J.jsx)(`p`,{className:`mt-6 text-sm text-fg-muted`,children:`Loading…`})]})})}var x_e=fo([{path:`/`,element:(0,J.jsx)(Sfe,{}),children:[{index:!0,element:(0,J.jsx)(xa,{to:`/chat`,replace:!0})},{path:`chat`,element:(0,J.jsx)(u_e,{}),children:[{index:!0,element:(0,J.jsx)(q9,{})},{path:`new`,element:(0,J.jsx)(q9,{})},{path:`:sessionKey`,element:(0,J.jsx)(q9,{})}]},{path:`sessions`,element:(0,J.jsx)(xa,{to:`/settings/sessions`,replace:!0})},{path:`logs`,element:(0,J.jsx)(xa,{to:`/settings/logs`,replace:!0})},{path:`cron`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(m_e,{})})},{path:`skills`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(h_e,{})})},{path:`channels`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(v_e,{})})},{path:`agents`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(J9,{})})},{path:`agents/:agentId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(J9,{})})},{path:`apps`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(Y9,{})})},{path:`apps/:extensionId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(X9,{})})},{path:`apps/:extensionId/:pageId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(X9,{})})},{path:`settings`,element:(0,J.jsx)(Nfe,{children:(0,J.jsx)(Afe,{})}),children:[{index:!0,element:(0,J.jsx)(xa,{to:`appearance`,replace:!0})},{path:`skills`,element:(0,J.jsx)(xa,{to:`/skills`,replace:!0})},{path:`cron`,element:(0,J.jsx)(xa,{to:`/cron`,replace:!0})},{path:`channels`,element:(0,J.jsx)(xa,{to:`/channels`,replace:!0})},{path:`sessions`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(p_e,{})})},{path:`logs`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)(Q9,{}),children:(0,J.jsx)(g_e,{})})},{path:`apps`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Y9,{})})},{path:`agents`,element:(0,J.jsx)(xa,{to:`/agents`,replace:!0})},{path:`agents/:agentId`,element:(0,J.jsx)(b_e,{})},{path:`agent-defaults`,element:(0,J.jsx)(xa,{to:`/settings/agent-chat`,replace:!0})},{path:`agent-models`,element:(0,J.jsx)(xa,{to:`/settings/models`,replace:!0})},{path:`extensions/debug`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(y_e,{})})},{path:`ext/:extensionId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Z9,{})})},{path:`ext/:extensionId/:panelId`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(Z9,{})})},{path:`:section`,element:(0,J.jsx)(L.Suspense,{fallback:(0,J.jsx)($9,{}),children:(0,J.jsx)(__e,{})})}]}]}]);function S_e(){return(0,L.useEffect)(()=>{let e=TN.persist.onFinishHydration(()=>{EN()}),t=mN.persist.onFinishHydration(()=>{hN()}),n=DN();return()=>{e?.(),t?.(),n()}},[]),null}function C_e(){return(0,J.jsx)(ree,{i18n:Ge,children:(0,J.jsx)(f_e,{children:(0,J.jsx)(xP,{children:(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(S_e,{}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col [&>*]:min-h-0 [&>*]:flex-1`,children:(0,J.jsx)(Lo,{router:x_e})})]})})})})}document.documentElement.setAttribute(`lang`,ht(xt())),wN(),pN(),RN(),(0,ne.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(L.StrictMode,{children:(0,J.jsx)(C_e,{})}));export{XG as $,pw as $n,ng as $r,eF as $t,v1 as A,ZM as An,Ug as Ar,eV as At,Y$ as B,hk as Bn,jg as Br,Hz as Bt,P1 as C,_o as Ci,oN as Cn,w_ as Cr,zV as Ct,x1 as D,Vi as Di,qM as Dn,Kg as Dr,iV as Dt,j1 as E,zi as Ei,XM as En,qg as Er,MV as Et,b1 as F,q as Fn,Rg as Fr,vB as Ft,U$ as G,GD as Gn,Tg as Gr,dR as Gt,J$ as H,JO as Hn,kg as Hr,SR as Ht,A1 as I,kA as In,Lg as Ir,_B as It,n$ as J,vE as Jn,yg as Jr,uR as Jt,B$ as K,pD as Kn,xg as Kr,pR as Kt,H$ as L,DA as Ln,Ig as Lr,gB as Lt,S1 as M,UM as Mn,Vg as Mr,QB as Mt,C1 as N,kM as Nn,Bg as Nr,nV as Nt,E1 as O,To as Oi,YM as On,Gg as Or,tV as Ot,D1 as P,AM as Pn,zg as Pr,yB as Pt,ZG as Q,_w as Qn,hg as Qr,cF as Qt,W$ as R,EA as Rn,Fg as Rr,mB as Rt,Ofe as S,Zo as Si,TN as Sn,P_ as Sr,UV as St,y1 as T,Ii as Ti,$M as Tn,Jg as Tr,NV as Tt,z$ as U,bO as Un,Og as Ur,_R as Ut,G$ as V,nk as Vn,Ag as Vr,NR as Vt,q$ as W,dO as Wn,Dg as Wr,hR as Wt,e$ as X,Nw as Xn,_g as Xr,kF as Xt,Z as Y,zT as Yn,vg as Yr,JL as Yt,uK as Z,xw as Zn,gg as Zr,mF as Zt,J8 as _,Mu as _i,nP as _n,hb as _r,PH as _t,r_e as a,fm as ai,NP as an,uC as ar,lG as at,W8 as b,Hs as bi,IN as bn,K_ as br,KV as bt,t_e as c,Ap as ci,CP as cn,KS as cr,_G as ct,Z7 as d,sp as di,Y as dn,fx as dr,MH as dt,Gh as ei,KP as en,HC as er,CG as et,m7 as f,op as fi,uP as fn,Xb as fr,AH as ft,r7 as g,ed as gi,cP as gn,zb as gr,DH as gt,n7 as h,od as hi,sP as hn,Bb as hr,OH as ht,K9 as i,vm as ii,FP as in,pC as ir,dG as it,w1 as j,GM as jn,Hg as jr,$B as jt,T1 as k,pt as ki,JM as kn,Wg as kr,rV as kt,e_e as l,xp as li,OP as ln,RS as lr,pG as lt,l7 as m,Jf as mi,dP as mn,Kb as mr,kH as mt,n_e as n,_h as ni,GP as nn,xC as nr,bG as nt,o_e as o,um as oi,kP as on,rC as or,sG as ot,f7 as p,rp as pi,lP as pn,Yb as pr,IH as pt,V$ as q,PE as qn,bg as qr,fR as qt,i_e as r,Km as ri,LP as rn,bC as rr,fG as rt,G9 as s,jp as si,EP as sn,QS as sr,hG as st,a_e as t,bh as ti,WP as tn,SC as tr,SG as tt,m9 as u,gp as ui,DP as un,Xx as ur,gG as ut,q8 as v,gc as vi,LN as vn,Oy as vr,NH as vt,N1 as w,xa as wi,QM as wn,Yg as wr,PV as wt,U8 as x,is as xi,kN as xn,V_ as xr,WV as xt,Mfe as y,Ws as yi,FN as yn,yv as yr,FH as yt,K$ as z,Rk as zn,Pg as zr,hB as zt};
4734
+ //# sourceMappingURL=index-DFgsyQna.js.map