@pixelzx/genesis 2026.6.20 → 2026.6.21

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 (43) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/.buildstamp +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-startup-metadata.json +1 -1
  5. package/dist/{command-registry-ClBXx6rA.js → command-registry-BGb_Uwan.js} +2 -2
  6. package/dist/{command-registry-bijZPq36.js → command-registry-DMgJTE4K.js} +2 -2
  7. package/dist/{command-registry-core-Bf_MZZiA.js → command-registry-core-nZQMcxbV.js} +2 -2
  8. package/dist/{completion-cli-DV02VPia.js → completion-cli-BCc1OonY.js} +2 -2
  9. package/dist/{config-cli-DAOeCcCk.js → config-cli-BZaYp_Ui.js} +1 -1
  10. package/dist/control-ui/assets/{agents-CdobtTOW.js → agents-BoHSZPvB.js} +2 -2
  11. package/dist/control-ui/assets/{canvas-Cy2AiGPQ.js → canvas-DkuTKNbN.js} +2 -2
  12. package/dist/control-ui/assets/{channels-DdgVKbNz.js → channels-v0P0irqY.js} +2 -2
  13. package/dist/control-ui/assets/{cron-CCNOjNyY.js → cron-DD6CAXar.js} +2 -2
  14. package/dist/control-ui/assets/{debug-B8lJz0xl.js → debug-CuUlTIAC.js} +2 -2
  15. package/dist/control-ui/assets/{index-DTwo_TE_.js → index-CYO6b4V3.js} +74 -7
  16. package/dist/control-ui/assets/index-a2bnKy1Z.css +1 -0
  17. package/dist/control-ui/assets/{instances-DRlIDzRt.js → instances-BIg5DC8B.js} +2 -2
  18. package/dist/control-ui/assets/{mcp-C7ry874X.js → mcp-CfklVyVu.js} +2 -2
  19. package/dist/control-ui/assets/{memory-Dk8DVFlc.js → memory-Dxu2hVW_.js} +2 -2
  20. package/dist/control-ui/assets/{models-WJk_luH_.js → models-DmHuwChH.js} +2 -2
  21. package/dist/control-ui/assets/{nodes-SWmxABM8.js → nodes-BAHmvdL1.js} +2 -2
  22. package/dist/control-ui/assets/{plugins-bulpMEFW.js → plugins-CaVRS7jh.js} +2 -2
  23. package/dist/control-ui/assets/{sessions-bCilYtM1.js → sessions-TU5OCoQU.js} +2 -2
  24. package/dist/control-ui/assets/{skills-C1LNGjhW.js → skills-CC23LxGO.js} +2 -2
  25. package/dist/control-ui/assets/{wallet-BwqvP_oc.js → wallet-DggW1ZUc.js} +2 -2
  26. package/dist/control-ui/index.html +2 -2
  27. package/dist/entry.js +1 -1
  28. package/dist/{gateway-cli-BFiZ-zEO.js → gateway-cli-CPCS4XTI.js} +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  31. package/dist/postinstall-inventory.json +32 -32
  32. package/dist/{program-BpFNiyL3.js → program-D6Z9HYd5.js} +1 -1
  33. package/dist/{register.subclis-CpLtsILI.js → register.subclis-CUxlv4Y7.js} +2 -2
  34. package/dist/{register.subclis-CHijsAFO.js → register.subclis-DPpkGluG.js} +1 -1
  35. package/dist/{register.subclis-core-DeVwcUrh.js → register.subclis-core-hOQqRXcI.js} +1 -1
  36. package/dist/{run-main-DYiUnyJr.js → run-main-By1VNkmf.js} +4 -4
  37. package/dist/{runtime-schema-DREgFqvJ.js → runtime-schema-BR36tJn9.js} +1 -1
  38. package/dist/{server-WzFFYZ9M.js → server-C7yMa7AQ.js} +1 -1
  39. package/dist/{server-plugin-bootstrap-BKn4Ukfx.js → server-plugin-bootstrap-C2EOYVsD.js} +1 -1
  40. package/dist/{server-plugin-bootstrap-Bkvb9v45.js → server-plugin-bootstrap-CWHfoBJK.js} +1 -1
  41. package/dist/{server.impl-DJz2wbse.js → server.impl-CNE0SpyS.js} +2 -2
  42. package/package.json +1 -1
  43. package/dist/control-ui/assets/index-u5Z0R_Xd.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agents-CdobtTOW.js","./i18n-Dr_ijwId.js","./format-BOO4MheD.js","./string-coerce-LCfkQHEZ.js","./channel-config-extras-BmGwfDPL.js","./skills-shared-BHZ4ntcf.js","./canvas-Cy2AiGPQ.js","./channels-DdgVKbNz.js","./cron-CCNOjNyY.js","./debug-B8lJz0xl.js","./instances-DRlIDzRt.js","./logs-BYrqUHTd.js","./mcp-C7ry874X.js","./models-WJk_luH_.js","./memory-Dk8DVFlc.js","./nodes-SWmxABM8.js","./plugins-bulpMEFW.js","./sessions-bCilYtM1.js","./skills-C1LNGjhW.js","./wallet-BwqvP_oc.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agents-BoHSZPvB.js","./i18n-Dr_ijwId.js","./format-BOO4MheD.js","./string-coerce-LCfkQHEZ.js","./channel-config-extras-BmGwfDPL.js","./skills-shared-BHZ4ntcf.js","./canvas-DkuTKNbN.js","./channels-v0P0irqY.js","./cron-DD6CAXar.js","./debug-CuUlTIAC.js","./instances-BIg5DC8B.js","./logs-BYrqUHTd.js","./mcp-CfklVyVu.js","./models-DmHuwChH.js","./memory-Dxu2hVW_.js","./nodes-BAHmvdL1.js","./plugins-CaVRS7jh.js","./sessions-TU5OCoQU.js","./skills-CC23LxGO.js","./wallet-DggW1ZUc.js"])))=>i.map(i=>d[i]);
2
2
  import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./i18n-Dr_ijwId.js";import{n as _,r as v,t as y}from"./string-coerce-LCfkQHEZ.js";import{a as b,c as x,d as S,f as ee,i as C,l as te,n as ne,o as w,s as re,u as T}from"./format-BOO4MheD.js";var ie=Object.create,ae=Object.defineProperty,E=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,O=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,k=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),A=(e,t)=>{let n={};for(var r in e)ae(n,r,{get:e[r],enumerable:!0});return t||ae(n,Symbol.toStringTag,{value:`Module`}),n},se=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=D(t),a=0,o=i.length,s;a<o;a++)s=i[a],!oe.call(e,s)&&s!==n&&ae(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=E(t,s))||r.enumerable});return e},j=(e,t,n)=>(n=e==null?{}:ie(O(e)),se(t||!e||!e.__esModule?ae(n,`default`,{value:e,enumerable:!0}):n,e));(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 M=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},N={attribute:!0,type:String,converter:a,reflect:!1,hasChanged:o},ce=(e=N,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function P(e){return(t,n)=>typeof n==`object`?ce(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function F(e){return P({...e,state:!0,attribute:!1})}function I(e){return e?/[\r\n]/.test(e)?null:e:null}function le(e){return I(v(e.hello?.auth?.deviceToken)??null)??I(v(e.settings?.token)??null)??I(v(e.password)??null)??null}function ue(e){let t=le(e);return t?`Bearer ${t}`:null}function de(e){let t=new Set,n=[];for(let r of[v(e.hello?.auth?.deviceToken),v(e.settings?.token),v(e.password)]){let e=I(r??null);e&&!t.has(e)&&(t.add(e),n.push(e))}return n}var L={AUTH_REQUIRED:`AUTH_REQUIRED`,AUTH_UNAUTHORIZED:`AUTH_UNAUTHORIZED`,AUTH_TOKEN_MISSING:`AUTH_TOKEN_MISSING`,AUTH_TOKEN_MISMATCH:`AUTH_TOKEN_MISMATCH`,AUTH_TOKEN_NOT_CONFIGURED:`AUTH_TOKEN_NOT_CONFIGURED`,AUTH_PASSWORD_MISSING:`AUTH_PASSWORD_MISSING`,AUTH_PASSWORD_MISMATCH:`AUTH_PASSWORD_MISMATCH`,AUTH_PASSWORD_NOT_CONFIGURED:`AUTH_PASSWORD_NOT_CONFIGURED`,AUTH_BOOTSTRAP_TOKEN_INVALID:`AUTH_BOOTSTRAP_TOKEN_INVALID`,AUTH_DEVICE_TOKEN_MISMATCH:`AUTH_DEVICE_TOKEN_MISMATCH`,AUTH_RATE_LIMITED:`AUTH_RATE_LIMITED`,AUTH_TAILSCALE_IDENTITY_MISSING:`AUTH_TAILSCALE_IDENTITY_MISSING`,AUTH_TAILSCALE_PROXY_MISSING:`AUTH_TAILSCALE_PROXY_MISSING`,AUTH_TAILSCALE_WHOIS_FAILED:`AUTH_TAILSCALE_WHOIS_FAILED`,AUTH_TAILSCALE_IDENTITY_MISMATCH:`AUTH_TAILSCALE_IDENTITY_MISMATCH`,CONTROL_UI_ORIGIN_NOT_ALLOWED:`CONTROL_UI_ORIGIN_NOT_ALLOWED`,CONTROL_UI_DEVICE_IDENTITY_REQUIRED:`CONTROL_UI_DEVICE_IDENTITY_REQUIRED`,DEVICE_IDENTITY_REQUIRED:`DEVICE_IDENTITY_REQUIRED`,DEVICE_AUTH_INVALID:`DEVICE_AUTH_INVALID`,DEVICE_AUTH_DEVICE_ID_MISMATCH:`DEVICE_AUTH_DEVICE_ID_MISMATCH`,DEVICE_AUTH_SIGNATURE_EXPIRED:`DEVICE_AUTH_SIGNATURE_EXPIRED`,DEVICE_AUTH_NONCE_REQUIRED:`DEVICE_AUTH_NONCE_REQUIRED`,DEVICE_AUTH_NONCE_MISMATCH:`DEVICE_AUTH_NONCE_MISMATCH`,DEVICE_AUTH_SIGNATURE_INVALID:`DEVICE_AUTH_SIGNATURE_INVALID`,DEVICE_AUTH_PUBLIC_KEY_INVALID:`DEVICE_AUTH_PUBLIC_KEY_INVALID`,PAIRING_REQUIRED:`PAIRING_REQUIRED`},fe={NOT_PAIRED:`not-paired`,ROLE_UPGRADE:`role-upgrade`,SCOPE_UPGRADE:`scope-upgrade`,METADATA_UPGRADE:`metadata-upgrade`},pe=new Set([`retry_with_device_token`,`update_auth_configuration`,`update_auth_credentials`,`wait_then_retry`,`review_auth_configuration`]),R=new Set([`not-paired`,`role-upgrade`,`scope-upgrade`,`metadata-upgrade`]),z=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,me={"not-paired":{requirement:`device is not approved yet`,remediationHint:`Approve this device from the pending pairing requests.`,recoveryTitle:`Gateway pairing approval required.`},"role-upgrade":{requirement:`device is asking for a higher role than currently approved`,remediationHint:`Review the requested role upgrade, then approve the pending request.`,recoveryTitle:`Gateway role upgrade approval required.`},"scope-upgrade":{requirement:`device is asking for more scopes than currently approved`,remediationHint:`Review the requested scopes, then approve the pending upgrade.`,recoveryTitle:`Gateway scope upgrade approval required.`},"metadata-upgrade":{requirement:`device identity changed and must be re-approved`,remediationHint:`Review the refreshed device details, then approve the pending request.`,recoveryTitle:`Gateway device refresh approval required.`}},he={"not-paired":`device pairing required`,"role-upgrade":`role upgrade pending approval`,"scope-upgrade":`scope upgrade pending approval`,"metadata-upgrade":`device metadata change pending approval`};function B(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.code;return typeof t==`string`&&t.trim().length>0?t:null}function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n=typeof t.canRetryWithDeviceToken==`boolean`?t.canRetryWithDeviceToken:void 0,r=v(t.recommendedNextStep)??``;return{canRetryWithDeviceToken:n,recommendedNextStep:pe.has(r)?r:void 0}}function _e(e){let t=v(e)??``;return R.has(t)?t:void 0}function V(e){let t=v(e);return t&&z.test(t)?t:void 0}function ve(e){if(!Array.isArray(e))return;let t=e.map(e=>v(e)).filter(e=>!!e);return t.length>0?t:[]}function H(e){return{code:L.PAIRING_REQUIRED,...e.reason?{reason:e.reason}:{},...e.requestId?{requestId:e.requestId}:{},...e.remediationHint?{remediationHint:e.remediationHint}:{},...e.deviceId?{deviceId:e.deviceId}:{},...e.requestedRole?{requestedRole:e.requestedRole}:{},...e.requestedScopes?{requestedScopes:e.requestedScopes}:{},...e.approvedRoles?{approvedRoles:e.approvedRoles}:{},...e.approvedScopes?{approvedScopes:e.approvedScopes}:{}}}function ye(e){return e?me[e].requirement:`device approval is required`}function be(e){return e?me[e].remediationHint:`Approve the pending device request before retrying.`}function xe(e){if(B(e)!==L.PAIRING_REQUIRED||!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=_e(t.reason);return H({reason:n,requestId:V(t.requestId),remediationHint:v(t.remediationHint)??be(n),deviceId:v(t.deviceId),requestedRole:v(t.requestedRole),requestedScopes:ve(t.requestedScopes),approvedRoles:ve(t.approvedRoles),approvedScopes:ve(t.approvedScopes)})}function Se(e){let t=v(e);if(!t)return null;let n=t.trim().toLowerCase(),r;for(let[e,t]of Object.entries(he))if(n.includes(t)){r=e;break}if(!r&&n.includes(`pairing required`)&&(r=fe.NOT_PAIRED),!r)return null;let i=V(t.match(/\(requestId:\s*([^\s)]+)\)/i)?.[1]);return{...i?{requestId:i}:{},reason:r}}function Ce(e){let t=xe(e),n=he[t?.reason??fe.NOT_PAIRED];return t?.requestId?`${n} (requestId: ${t.requestId})`:n}function we(e){return B(e.details)===L.PAIRING_REQUIRED?Ce(e.details):v(e.message)??`gateway request failed`}function Te(e){let t=e.scopes.join(`,`),n=e.token??``;return[`v2`,e.deviceId,e.clientId,e.clientMode,e.role,t,String(e.signedAtMs),n,e.nonce].join(`|`)}var U={WEBCHAT_UI:`webchat-ui`,CONTROL_UI:`genesis-control-ui`,TUI:`genesis-tui`,WEBCHAT:`webchat`,CLI:`cli`,GATEWAY_CLIENT:`gateway-client`,MACOS_APP:`genesis-macos`,IOS_APP:`genesis-ios`,ANDROID_APP:`genesis-android`,NODE_HOST:`node-host`,TEST:`test`,FINGERPRINT:`fingerprint`,PROBE:`genesis-probe`},Ee=U,De={WEBCHAT:`webchat`,CLI:`cli`,UI:`ui`,BACKEND:`backend`,NODE:`node`,PROBE:`probe`,TEST:`test`};new Set(Object.values(U)),new Set(Object.values(De));function Oe(e){return e.trim()}function ke(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}t.has(`operator.admin`)?(t.add(`operator.read`),t.add(`operator.write`)):t.has(`operator.write`)&&t.add(`operator.read`);let n=Array.from(t);return n.sort(),n}function Ae(e){let t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return null;let n=Oe(e.role),r=t.tokens[n];return!r||typeof r.token!=`string`?null:r}function je(e){let t=Oe(e.role),n=e.adapter.readStore(),r={version:1,deviceId:e.deviceId,tokens:n&&n.deviceId===e.deviceId&&n.tokens?{...n.tokens}:{}},i={token:e.token,role:t,scopes:ke(e.scopes),updatedAtMs:Date.now()};return r.tokens[t]=i,e.adapter.writeStore(r),i}function Me(e){let t=e.adapter.readStore();if(!t||t.deviceId!==e.deviceId)return;let n=Oe(e.role);if(!t.tokens[n])return;let r={version:1,deviceId:t.deviceId,tokens:{...t.tokens}};delete r.tokens[n],e.adapter.writeStore(r)}var Ne=`genesis.device.auth.v1`;function Pe(){try{let e=m()?.getItem(Ne);if(!e)return null;let t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!=`string`||!t.tokens||typeof t.tokens!=`object`?null:t}catch{return null}}function Fe(e){try{m()?.setItem(Ne,JSON.stringify(e))}catch{}}function Ie(e){return Ae({adapter:{readStore:Pe,writeStore:Fe},deviceId:e.deviceId,role:e.role})}function Le(e){return je({adapter:{readStore:Pe,writeStore:Fe},deviceId:e.deviceId,role:e.role,token:e.token,scopes:e.scopes})}function Re(e){Me({adapter:{readStore:Pe,writeStore:Fe},deviceId:e.deviceId,role:e.role})}var ze=Object.freeze({p:57896044618658097711785492504343953926634992332820282019728792003956564819949n,n:7237005577332262213973186563042994240857116359379907606001950938285454250989n,h:8n,a:57896044618658097711785492504343953926634992332820282019728792003956564819948n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,Gx:15112221349535400772501151409588531511454012693041857206046113283949847762202n,Gy:46316835694926478169428394003475163141307993866256225615783033603165251855960n}),{p:Be,n:Ve,Gx:He,Gy:Ue,a:We,d:Ge,h:Ke}=ze,qe=32,Je=(...e)=>{`captureStackTrace`in Error&&typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(...e)},Ye=(e=``)=>{let t=Error(e);throw Je(t,Ye),t},Xe=e=>typeof e==`bigint`,Ze=e=>typeof e==`string`,Qe=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1,$e=(e,t,n=``)=>{let r=Qe(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`,l=o+`expected Uint8Array`+s+`, got `+c;throw r?RangeError(l):TypeError(l)}return e},et=e=>new Uint8Array(e),tt=e=>Uint8Array.from(e),nt=(e,t)=>e.toString(16).padStart(t,`0`),rt=e=>Array.from($e(e)).map(e=>nt(e,2)).join(``),it={_0:48,_9:57,A:65,F:70,a:97,f:102},at=e=>{if(e>=it._0&&e<=it._9)return e-it._0;if(e>=it.A&&e<=it.F)return e-(it.A-10);if(e>=it.a&&e<=it.f)return e-(it.a-10)},ot=e=>{let t=`hex invalid`;if(!Ze(e))return Ye(t);let n=e.length,r=n/2;if(n%2)return Ye(t);let i=et(r);for(let n=0,a=0;n<r;n++,a+=2){let r=at(e.charCodeAt(a)),o=at(e.charCodeAt(a+1));if(r===void 0||o===void 0)return Ye(t);i[n]=r*16+o}return i},st=()=>globalThis?.crypto,ct=()=>st()?.subtle??Ye(`crypto.subtle must be defined, consider polyfill`),lt=(...e)=>{let t=0;for(let n of e)t+=$e(n).length;let n=et(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n},ut=(e=qe)=>st().getRandomValues(et(e)),dt=BigInt,ft=(e,t,n,r=`bad number: out of range`)=>{if(!Xe(e))throw TypeError(r);if(t<=e&&e<n)return e;throw RangeError(r)},pt=(e,t=Be)=>{let n=e%t;return n>=0n?n:t+n},mt=(1n<<255n)-1n,W=e=>{e<0n&&Ye(`negative coordinate`);let t=(e>>255n)*19n+(e&mt);return t=(t>>255n)*19n+(t&mt),t%Be},ht=e=>pt(e,Ve),gt=(e,t)=>{(e===0n||t<=0n)&&Ye(`no inverse n=`+e+` mod=`+t);let n=pt(e,t),r=t,i=0n,a=1n,o=1n,s=0n;for(;n!==0n;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}return r===1n?pt(i,t):Ye(`no inverse`)},_t=e=>{let t=Bt[e];return typeof t!=`function`&&Ye(`hashes.`+e+` not set`),t},vt=e=>$e(e,64,`digest`),yt=e=>e instanceof xt?e:Ye(`Point expected`),bt=2n**256n,xt=class e{static BASE;static ZERO;X;Y;Z;T;constructor(e,t,n,r){let i=bt;this.X=ft(e,0n,i),this.Y=ft(t,0n,i),this.Z=ft(n,1n,i),this.T=ft(r,0n,i),Object.freeze(this)}static CURVE(){return ze}static fromAffine(t){return new e(t.x,t.y,1n,W(t.x*t.y))}static fromBytes(t,n=!1){let r=Ge,i=tt($e(t,qe)),a=t[31];i[31]=a&-129;let o=Tt(i);ft(o,0n,n?bt:Be);let s=W(o*o),{isValid:c,value:l}=kt(pt(s-1n),W(r*s+1n));c||Ye(`bad point: y not sqrt`);let u=(l&1n)==1n,d=(a&128)!=0;return!n&&l===0n&&d&&Ye(`bad point: x==0, isLastByteOdd`),d!==u&&(l=pt(-l)),new e(l,o,1n,W(l*o))}static fromHex(t,n){return e.fromBytes(ot(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){let e=We,t=Ge,n=this;if(n.is0())return Ye(`bad point: ZERO`);let{X:r,Y:i,Z:a,T:o}=n,s=W(r*r),c=W(i*i),l=W(a*a),u=W(l*l);return W(l*(W(s*e)+c))===pt(u+W(t*W(s*c)))?W(r*i)===W(a*o)?this:Ye(`bad point: equation left != right (2)`):Ye(`bad point: equation left != right (1)`)}equals(e){let{X:t,Y:n,Z:r}=this,{X:i,Y:a,Z:o}=yt(e),s=W(t*o),c=W(i*r),l=W(n*o),u=W(a*r);return s===c&&l===u}is0(){return this.equals(Ct)}negate(){return new e(pt(-this.X),this.Y,this.Z,pt(-this.T))}double(){let{X:t,Y:n,Z:r}=this,i=We,a=W(t*t),o=W(n*n),s=W(2n*r*r),c=W(i*a),l=pt(t+n),u=pt(W(l*l)-a-o),d=pt(c+o),f=pt(d-s),p=pt(c-o),m=W(u*f),h=W(d*p),g=W(u*p);return new e(m,h,W(f*d),g)}add(t){let{X:n,Y:r,Z:i,T:a}=this,{X:o,Y:s,Z:c,T:l}=yt(t),u=We,d=Ge,f=W(n*o),p=W(r*s),m=W(W(a*d)*l),h=W(i*c),g=pt(W(pt(n+r)*pt(o+s))-f-p),_=pt(h-m),v=pt(h+m),y=pt(p-W(u*f)),b=W(g*_),x=W(v*y),S=W(g*y);return new e(b,x,W(_*v),S)}subtract(e){return this.add(yt(e).negate())}multiply(e,t=!0){if(!t&&e===0n||(ft(e,1n,Ve),!t&&this.is0()))return Ct;if(e===1n)return this;if(this.equals(St))return Jt(e).p;let n=Ct,r=St;for(let i=this;e>0n;i=i.double(),e>>=1n)e&1n?n=n.add(i):t&&(r=r.add(i));return n}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){let{X:e,Y:t,Z:n}=this;if(this.equals(Ct))return{x:0n,y:1n};let r=gt(n,Be);return W(n*r)!==1n&&Ye(`invalid inverse`),{x:W(e*r),y:W(t*r)}}toBytes(){let{x:e,y:t}=this.toAffine(),n=wt(t);return n[31]|=e&1n?128:0,n}toHex(){return rt(this.toBytes())}clearCofactor(){return this.multiply(dt(Ke),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.multiply(Ve/2n,!1).double();return Ve%2n&&(e=e.add(this)),e.is0()}},St=new xt(He,Ue,1n,pt(He*Ue)),Ct=new xt(0n,1n,1n,0n);xt.BASE=St,xt.ZERO=Ct;var wt=e=>ot(nt(ft(e,0n,bt),64)).reverse(),Tt=e=>dt(`0x`+rt(tt($e(e)).reverse())),Et=(e,t)=>{let n=e;for(;t-- >0n;)n=W(n*n);return n},Dt=e=>{let t=W(W(e*e)*e),n=W(Et(W(Et(t,2n)*t),1n)*e),r=W(Et(n,5n)*n),i=W(Et(r,10n)*r),a=W(Et(i,20n)*i),o=W(Et(a,40n)*a);return{pow_p_5_8:W(Et(W(Et(W(Et(W(Et(o,80n)*o),80n)*o),10n)*r),2n)*e),b2:t}},Ot=19681161376707505956807079304988542015446066515923890162744021073123829784752n,kt=(e,t)=>{let n=W(t*W(t*t)),r=Dt(W(e*W(W(n*n)*t))).pow_p_5_8,i=W(e*W(n*r)),a=W(t*W(i*i)),o=i,s=W(i*Ot),c=a===e,l=a===pt(-e),u=a===pt(-e*Ot);return c&&(i=o),(l||u)&&(i=s),(pt(i)&1n)==1n&&(i=pt(-i)),{isValid:c||l,value:i}},At=e=>ht(Tt(e)),jt=(...e)=>Promise.resolve(_t(`sha512Async`)(lt(...e))).then(vt),Mt=(...e)=>vt(_t(`sha512`)(lt(...e))),Nt=e=>{let t=tt(e),n=t.slice(0,32);n[0]&=248,n[31]&=127,n[31]|=64;let r=t.slice(32,64),i=At(n),a=St.multiply(i);return{head:n,prefix:r,scalar:i,point:a,pointBytes:a.toBytes()}},Pt=e=>jt($e(e,qe)).then(Nt),Ft=e=>Nt(Mt($e(e,qe))),It=e=>Pt(e).then(e=>e.pointBytes),Lt=e=>jt(e.hashable).then(e.finish),Rt=(e,t,n)=>{let{pointBytes:r,scalar:i}=e,a=At(t),o=St.multiply(a).toBytes();return{hashable:lt(o,r,n),finish:e=>$e(lt(o,wt(ht(a+At(e)*i))),64)}},zt=async(e,t)=>{let n=$e(e),r=await Pt(t);return Lt(Rt(r,await jt(r.prefix,n),n))},Bt={sha512Async:async e=>{let t=ct(),n=lt(e);return et(await t.digest(`SHA-512`,n.buffer))},sha512:void 0},Vt=Object.freeze({getExtendedPublicKeyAsync:Pt,getExtendedPublicKey:Ft,randomSecretKey:e=>(e=e===void 0?ut(qe):e,$e(e,qe))}),Ht=8,Ut=Math.ceil(256/Ht)+1,Wt=2**(Ht-1),Gt=()=>{let e=[],t=St,n=t;for(let r=0;r<Ut;r++){n=t,e.push(n);for(let r=1;r<Wt;r++)n=n.add(t),e.push(n);t=n.double()}return e},Kt=void 0,qt=(e,t)=>{let n=t.negate();return e?n:t},Jt=e=>{let t=Kt||=Gt(),n=Ct,r=St,i=2**Ht,a=i,o=dt(i-1),s=dt(Ht);for(let i=0;i<Ut;i++){let c=Number(e&o);e>>=s,c>Wt&&(c-=a,e+=1n);let l=i*Wt,u=l,d=l+Math.abs(c)-1,f=i%2!=0,p=c<0;c===0?r=r.add(qt(f,t[u])):n=n.add(qt(p,t[d]))}return e!==0n&&Ye(`invalid wnaf`),{p:n,f:r}},Yt=`genesis-device-identity-v1`;function Xt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/g,``)}function Zt(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t+`=`.repeat((4-t.length%4)%4),r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return i}function Qt(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function $t(e){let t=await crypto.subtle.digest(`SHA-256`,e.slice().buffer);return Qt(new Uint8Array(t))}async function en(){let e=Vt.randomSecretKey(),t=await It(e);return{deviceId:await $t(t),publicKey:Xt(t),privateKey:Xt(e)}}async function tn(){let e=m();try{let t=e?.getItem(Yt);if(t){let n=JSON.parse(t);if(n?.version===1&&typeof n.deviceId==`string`&&typeof n.publicKey==`string`&&typeof n.privateKey==`string`){let t=await $t(Zt(n.publicKey));if(t!==n.deviceId){let r={...n,deviceId:t};return e?.setItem(Yt,JSON.stringify(r)),{deviceId:t,publicKey:n.publicKey,privateKey:n.privateKey}}return{deviceId:n.deviceId,publicKey:n.publicKey,privateKey:n.privateKey}}}}catch{}let t=await en(),n={version:1,deviceId:t.deviceId,publicKey:t.publicKey,privateKey:t.privateKey,createdAtMs:Date.now()};return e?.setItem(Yt,JSON.stringify(n)),t}async function nn(e,t){let n=Zt(e);return Xt(await zt(new TextEncoder().encode(t),n))}var rn=!1;function an(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function on(){rn||(rn=!0,console.warn(`[uuid] crypto API missing; refusing insecure UUID generation`))}function sn(e=globalThis.crypto){if(e&&typeof e.randomUUID==`function`)return e.randomUUID();if(e&&typeof e.getRandomValues==`function`){let t=new Uint8Array(16);return e.getRandomValues(t),an(t)}throw on(),Error(`Web Crypto is required for UUID generation`)}var cn=class extends Error{constructor(e){super(we({message:e.message,details:e.details})),this.name=`GatewayRequestError`,this.gatewayCode=e.code,this.details=e.details,this.retryable=e.retryable===!0,this.retryAfterMs=e.retryAfterMs}};function ln(e){return B(e?.details)}function un(e){if(!e)return!1;let t=ln(e);return t===L.AUTH_TOKEN_MISSING||t===L.AUTH_BOOTSTRAP_TOKEN_INVALID||t===L.AUTH_PASSWORD_MISSING||t===L.AUTH_PASSWORD_MISMATCH||t===L.AUTH_RATE_LIMITED||t===L.PAIRING_REQUIRED||t===L.CONTROL_UI_DEVICE_IDENTITY_REQUIRED||t===L.DEVICE_IDENTITY_REQUIRED}function dn(e){try{let t=new URL(e,window.location.href),n=t.hostname.trim().toLowerCase(),r=n===`localhost`||n===`::1`||n===`[::1]`||n===`127.0.0.1`,i=n.startsWith(`127.`);if(r||i)return!0;let a=new URL(window.location.href);return t.host===a.host}catch{return!1}}var fn=`operator`,pn=[`operator.admin`,`operator.read`,`operator.write`,`operator.approvals`,`operator.pairing`],mn=4008,hn=1e4;function gn(e){let t=e.authToken;if(t||e.authPassword)return{token:t,deviceToken:e.authDeviceToken??e.resolvedDeviceToken,password:e.authPassword}}async function _n(e){let{deviceIdentity:t}=e;if(!t)return;let n=Date.now(),r=e.connectNonce??``,i=Te({deviceId:t.deviceId,clientId:e.client.id,clientMode:e.client.mode,role:e.role,scopes:e.scopes,signedAtMs:n,token:e.authToken??null,nonce:r}),a=await nn(t.privateKey,i);return{id:t.deviceId,publicKey:t.publicKey,signature:a,signedAt:n,nonce:r}}function vn(e){return!e.deviceTokenRetryBudgetUsed&&!e.authDeviceToken&&!!e.explicitGatewayToken&&!!e.deviceIdentity&&!!e.storedToken&&e.canRetryWithDeviceTokenHint&&dn(e.url)}var yn=class{constructor(e){this.opts=e,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.eventListeners=new Set}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.clearConnectTimer(),this.ws?.close(),this.ws=null,this.pendingConnectError=void 0,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.flushPending(Error(`gateway client stopped`))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener(`open`,()=>this.queueConnect()),this.ws.addEventListener(`message`,e=>this.handleMessage(String(e.data??``))),this.ws.addEventListener(`close`,e=>{let t=e.reason??``,n=this.pendingConnectError;this.pendingConnectError=void 0,this.ws=null,this.flushPending(Error(`gateway closed (${e.code}): ${t}`)),this.opts.onClose?.({code:e.code,reason:t,error:n}),!(ln(n)===L.AUTH_TOKEN_MISMATCH&&this.deviceTokenRetryBudgetUsed&&!this.pendingDeviceTokenRetry)&&(un(n)||this.scheduleReconnect())}),this.ws.addEventListener(`error`,()=>{}))}scheduleReconnect(){if(this.closed)return;let e=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),this.clearConnectTimer(),this.connectTimer=window.setTimeout(()=>{this.connectTimer=null,this.connect()},e)}flushPending(e){for(let[,t]of this.pending)t.timeout!==null&&window.clearTimeout(t.timeout),t.reject(e);this.pending.clear()}buildConnectClient(){return{id:this.opts.clientName??Ee.CONTROL_UI,version:this.opts.clientVersion??`control-ui`,platform:this.opts.platform??navigator.platform??`web`,mode:this.opts.mode??De.WEBCHAT,instanceId:this.opts.instanceId}}buildConnectParams(e){return{minProtocol:4,maxProtocol:4,client:e.client,role:e.role,scopes:e.scopes,device:e.device,caps:[`tool-events`,`chat-incremental`],auth:e.auth,userAgent:navigator.userAgent,locale:navigator.language}}async buildConnectPlan(){let e=fn,t=[...pn],n=this.buildConnectClient(),r=this.opts.token?.trim()||void 0,i=this.opts.password?.trim()||void 0,a=typeof crypto<`u`&&!!crypto.subtle,o=null,s={authToken:r,authPassword:i,canFallbackToShared:!1};return a&&(o=await tn(),s=this.selectConnectAuth({role:e,deviceId:o.deviceId}),this.pendingDeviceTokenRetry&&s.authDeviceToken&&(this.pendingDeviceTokenRetry=!1)),{role:e,scopes:t,client:n,explicitGatewayToken:r,selectedAuth:s,auth:gn(s),deviceIdentity:o,device:await _n({deviceIdentity:o,client:n,role:e,scopes:t,authToken:s.authToken,connectNonce:this.connectNonce})}}handleConnectHello(e,t){this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,e?.auth?.deviceToken&&t.deviceIdentity&&Le({deviceId:t.deviceIdentity.deviceId,role:e.auth.role??t.role,token:e.auth.deviceToken,scopes:e.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(e)}handleConnectFailure(e,t){let n=e instanceof cn?ln(e):null,r=e instanceof cn?ge(e.details):{},i=r.recommendedNextStep===`retry_with_device_token`,a=r.canRetryWithDeviceToken===!0||i||n===L.AUTH_TOKEN_MISMATCH;vn({deviceTokenRetryBudgetUsed:this.deviceTokenRetryBudgetUsed,authDeviceToken:t.selectedAuth.authDeviceToken,explicitGatewayToken:t.explicitGatewayToken,deviceIdentity:t.deviceIdentity,storedToken:t.selectedAuth.storedToken,canRetryWithDeviceTokenHint:a,url:this.opts.url})&&(this.pendingDeviceTokenRetry=!0,this.deviceTokenRetryBudgetUsed=!0),e instanceof cn?this.pendingConnectError={code:e.gatewayCode,message:e.message,details:e.details,retryable:e.retryable,retryAfterMs:e.retryAfterMs}:this.pendingConnectError=void 0,t.selectedAuth.canFallbackToShared&&t.deviceIdentity&&n===L.AUTH_DEVICE_TOKEN_MISMATCH&&Re({deviceId:t.deviceIdentity.deviceId,role:t.role}),this.ws?.close(mn,`connect failed`)}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.clearConnectTimer();let e=await this.buildConnectPlan();this.request(`connect`,this.buildConnectParams(e),{timeoutMs:hn}).then(t=>this.handleConnectHello(t,e)).catch(t=>this.handleConnectFailure(t,e))}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}let n=t;if(n.type===`event`){let e=t;if(e.event===`connect.challenge`){let t=e.payload,n=t&&typeof t.nonce==`string`?t.nonce:null;n&&(this.connectNonce=n,this.sendConnect());return}let n=typeof e.seq==`number`?e.seq:null;n!==null&&(this.lastSeq!==null&&n>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:n}),this.lastSeq=n);try{this.opts.onEvent?.(e);for(let t of this.eventListeners)t(e)}catch(e){console.error(`[gateway] event handler error:`,e)}return}if(n.type===`res`){let e=t,n=this.pending.get(e.id);if(!n)return;this.pending.delete(e.id),n.timeout!==null&&window.clearTimeout(n.timeout),e.ok?n.resolve(e.payload):n.reject(new cn({code:e.error?.code??`UNAVAILABLE`,message:e.error?.message??`request failed`,details:e.error?.details,retryable:e.error?.retryable,retryAfterMs:e.error?.retryAfterMs}));return}}selectConnectAuth(e){let t=this.opts.token?.trim()||void 0,n=this.opts.password?.trim()||void 0,r=Ie({deviceId:e.deviceId,role:e.role}),i=r?.scopes??[],a=e.role!==`operator`||i.includes(`operator.read`)||i.includes(`operator.write`)||i.includes(`operator.admin`)?r?.token:void 0,o=this.pendingDeviceTokenRetry&&!!t&&!!a&&dn(this.opts.url),s=t||n?void 0:a??void 0;return{authToken:t??s,authDeviceToken:o?a??void 0:void 0,authPassword:n,resolvedDeviceToken:s,storedToken:a??void 0,canFallbackToShared:!!(a&&t)}}request(e,t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(Error(`gateway not connected`));let r=sn(),i={type:`req`,id:r,method:e,params:t},a=new Promise((t,i)=>{let a=n?.timeoutMs===null?null:typeof n?.timeoutMs==`number`&&Number.isFinite(n.timeoutMs)?window.setTimeout(()=>{this.pending.delete(r),i(Error(`gateway request timeout for ${e}`))},Math.max(1,n.timeoutMs)):null;this.pending.set(r,{resolve:e=>t(e),reject:i,timeout:a})});return this.ws.send(JSON.stringify(i)),a}addEventListener(e){return this.eventListeners.add(e),()=>{this.eventListeners.delete(e)}}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.clearConnectTimer(),this.connectTimer=window.setTimeout(()=>{this.connectTimer=null,this.sendConnect()},750)}clearConnectTimer(){this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null)}};function bn(e){return e instanceof cn?ln(e)===L.AUTH_UNAUTHORIZED?!0:e.message.includes(`missing scope: operator.read`):!1}function xn(e){return`This connection is missing operator.read, so ${e} cannot be loaded yet.`}async function Sn(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{e.channelsSnapshot=await e.client.request(`channels.status`,{probe:t,timeoutMs:8e3}),e.channelsLastSuccess=Date.now()}catch(t){bn(t)?(e.channelsSnapshot=null,e.channelsError=xn(`channel status`)):e.channelsError=String(t)}finally{e.channelsLoading=!1}}}async function Cn(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{let n=await e.client.request(`web.login.start`,{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=typeof n.connected==`boolean`?n.connected:null}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function wn(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{let t=await e.client.request(`web.login.wait`,{timeoutMs:12e4,currentQrDataUrl:e.whatsappLoginQrDataUrl??void 0});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.qrDataUrl?e.whatsappLoginQrDataUrl=t.qrDataUrl:t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Tn(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request(`channels.logout`,{channel:`whatsapp`}),e.whatsappLoginMessage=`Logged out.`,e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}var En=j(k(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):n.JSON5=r()})(e,(function(){function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}var t=e(function(e){var t=e.exports=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)();typeof __g==`number`&&(__g=t)}),n=e(function(e){var t=e.exports={version:`2.6.5`};typeof __e==`number`&&(__e=t)});n.version;var r=function(e){return typeof e==`object`?e!==null:typeof e==`function`},i=function(e){if(!r(e))throw TypeError(e+` is not an object!`);return e},a=function(e){try{return!!e()}catch{return!0}},o=!a(function(){return Object.defineProperty({},`a`,{get:function(){return 7}}).a!=7}),s=t.document,c=r(s)&&r(s.createElement),l=function(e){return c?s.createElement(e):{}},u=!o&&!a(function(){return Object.defineProperty(l(`div`),`a`,{get:function(){return 7}}).a!=7}),d=function(e,t){if(!r(e))return e;var n,i;if(t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e))||typeof(n=e.valueOf)==`function`&&!r(i=n.call(e))||!t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e)))return i;throw TypeError(`Can't convert object to primitive value`)},f=Object.defineProperty,p={f:o?Object.defineProperty:function(e,t,n){if(i(e),t=d(t,!0),i(n),u)try{return f(e,t,n)}catch{}if(`get`in n||`set`in n)throw TypeError(`Accessors not supported!`);return`value`in n&&(e[t]=n.value),e}},m=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},h=o?function(e,t,n){return p.f(e,t,m(1,n))}:function(e,t,n){return e[t]=n,e},g={}.hasOwnProperty,_=function(e,t){return g.call(e,t)},v=0,y=Math.random(),b=function(e){return`Symbol(${e===void 0?``:e})_${(++v+y).toString(36)}`},x=!1,S=e(function(e){var r=`__core-js_shared__`,i=t[r]||(t[r]={});(e.exports=function(e,t){return i[e]||(i[e]=t===void 0?{}:t)})(`versions`,[]).push({version:n.version,mode:x?`pure`:`global`,copyright:`© 2019 Denis Pushkarev (zloirock.ru)`})})(`native-function-to-string`,Function.toString),ee=e(function(e){var r=b(`src`),i=`toString`,a=(``+S).split(i);n.inspectSource=function(e){return S.call(e)},(e.exports=function(e,n,i,o){var s=typeof i==`function`;s&&(_(i,`name`)||h(i,`name`,n)),e[n]!==i&&(s&&(_(i,r)||h(i,r,e[n]?``+e[n]:a.join(String(n)))),e===t?e[n]=i:o?e[n]?e[n]=i:h(e,n,i):(delete e[n],h(e,n,i)))})(Function.prototype,i,function(){return typeof this==`function`&&this[r]||S.call(this)})}),C=function(e){if(typeof e!=`function`)throw TypeError(e+` is not a function!`);return e},te=function(e,t,n){if(C(e),t===void 0)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},ne=`prototype`,w=function(e,r,i){var a=e&w.F,o=e&w.G,s=e&w.S,c=e&w.P,l=e&w.B,u=o?t:s?t[r]||(t[r]={}):(t[r]||{})[ne],d=o?n:n[r]||(n[r]={}),f=d[ne]||(d[ne]={}),p,m,g,_;for(p in o&&(i=r),i)m=!a&&u&&u[p]!==void 0,g=(m?u:i)[p],_=l&&m?te(g,t):c&&typeof g==`function`?te(Function.call,g):g,u&&ee(u,p,g,e&w.U),d[p]!=g&&h(d,p,_),c&&f[p]!=g&&(f[p]=g)};t.core=n,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128;var re=w,T=Math.ceil,ie=Math.floor,ae=function(e){return isNaN(e=+e)?0:(e>0?ie:T)(e)},E=function(e){if(e==null)throw TypeError(`Can't call method on `+e);return e},D=function(e){return function(t,n){var r=String(E(t)),i=ae(n),a=r.length,o,s;return i<0||i>=a?e?``:void 0:(o=r.charCodeAt(i),o<55296||o>56319||i+1===a||(s=r.charCodeAt(i+1))<56320||s>57343?e?r.charAt(i):o:e?r.slice(i,i+2):(o-55296<<10)+(s-56320)+65536)}}(!1);re(re.P,`String`,{codePointAt:function(e){return D(this,e)}}),n.String.codePointAt;var O=Math.max,oe=Math.min,k=function(e,t){return e=ae(e),e<0?O(e+t,0):oe(e,t)},A=String.fromCharCode,se=String.fromCodePoint;re(re.S+re.F*(!!se&&se.length!=1),`String`,{fromCodePoint:function(e){for(var t=arguments,n=[],r=arguments.length,i=0,a;r>i;){if(a=+t[i++],k(a,1114111)!==a)throw RangeError(a+` is not a valid code point`);n.push(a<65536?A(a):A(((a-=65536)>>10)+55296,a%1024+56320))}return n.join(``)}}),n.String.fromCodePoint;var j={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},M={isSpaceSeparator:function(e){return typeof e==`string`&&j.Space_Separator.test(e)},isIdStartChar:function(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`$`||e===`_`||j.ID_Start.test(e))},isIdContinueChar:function(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`$`||e===`_`||e===`‌`||e===`‍`||j.ID_Continue.test(e))},isDigit:function(e){return typeof e==`string`&&/[0-9]/.test(e)},isHexDigit:function(e){return typeof e==`string`&&/[0-9A-Fa-f]/.test(e)}},N,ce,P,F,I,le,ue,de,L,fe=function(e,t){N=String(e),ce=`start`,P=[],F=0,I=1,le=0,ue=void 0,de=void 0,L=void 0;do ue=ge(),Ce[ce]();while(ue.type!==`eof`);return typeof t==`function`?pe({"":L},``,t):L};function pe(e,t,n){var r=e[t];if(typeof r==`object`&&r)if(Array.isArray(r))for(var i=0;i<r.length;i++){var a=String(i),o=pe(r,a,n);o===void 0?delete r[a]:Object.defineProperty(r,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(var s in r){var c=pe(r,s,n);c===void 0?delete r[s]:Object.defineProperty(r,s,{value:c,writable:!0,enumerable:!0,configurable:!0})}return n.call(e,t,r)}var R,z,me,he,B;function ge(){for(R=`default`,z=``,me=!1,he=1;;){B=_e();var e=ve[R]();if(e)return e}}function _e(){if(N[F])return String.fromCodePoint(N.codePointAt(F))}function V(){var e=_e();return e===`
3
3
  `?(I++,le=0):e?le+=e.length:le++,e&&(F+=e.length),e}var ve={default:function(){switch(B){case` `:case`\v`:case`\f`:case` `:case`\xA0`:case``:case`
4
4
  `:case`\r`:case`\u2028`:case`\u2029`:V();return;case`/`:V(),R=`comment`;return;case void 0:return V(),H(`eof`)}if(M.isSpaceSeparator(B)){V();return}return ve[ce]()},comment:function(){switch(B){case`*`:V(),R=`multiLineComment`;return;case`/`:V(),R=`singleLineComment`;return}throw U(V())},multiLineComment:function(){switch(B){case`*`:V(),R=`multiLineCommentAsterisk`;return;case void 0:throw U(V())}V()},multiLineCommentAsterisk:function(){switch(B){case`*`:V();return;case`/`:V(),R=`default`;return;case void 0:throw U(V())}V(),R=`multiLineComment`},singleLineComment:function(){switch(B){case`
@@ -172,7 +172,7 @@ Action:
172
172
  `)}return typeof t.text==`string`?t.text:null}function lc(e){let t=e.trim();if(!t)return``;let n=t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>`_${e}_`);return n.length?[`_Reasoning:_`,...n].join(`
173
173
  `):``}function uc(e){return typeof e==`string`?e:e instanceof Error&&typeof e.message==`string`?e.message:`unknown error`}function dc(e){let t=uc(e.message),n=y(t),r=xe(e.details),i=Se(t),a=r?.reason??i?.reason;if(n.startsWith(`pairing required:`)&&a)return`gateway pairing required: ${ye(a)}`;if(i&&n!==`pairing required`)return t;let o=r?.approvedRoles?.join(`, `)??`none`,s=r?.requestedRole??`none`,c=r?.approvedScopes?.join(`, `)??`none`,l=r?.requestedScopes?.join(`, `)??`none`;switch(r?.reason){case`scope-upgrade`:return r.approvedScopes||r.requestedScopes?`device scope upgrade requires approval (approved: ${c}; requested: ${l})`:Ce(e.details);case`role-upgrade`:return r.approvedRoles||r.requestedRole?`device role upgrade requires approval (approved: ${o}; requested: ${s})`:Ce(e.details);case`metadata-upgrade`:return`device reconnect details changed and require approval`;default:return`gateway pairing required`}}function fc(e){let t=uc(e.message);switch(ln(e)){case L.AUTH_TOKEN_MISMATCH:return`gateway token mismatch`;case L.AUTH_UNAUTHORIZED:return`gateway auth failed`;case L.AUTH_RATE_LIMITED:return`too many failed authentication attempts`;case L.PAIRING_REQUIRED:return dc(e);case L.CONTROL_UI_DEVICE_IDENTITY_REQUIRED:return`device identity required (use HTTPS/localhost or allow insecure auth explicitly)`;case L.CONTROL_UI_ORIGIN_NOT_ALLOWED:return`origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)`;case L.AUTH_TOKEN_MISSING:return`gateway token missing`;default:break}let n=y(t);return n===`fetch failed`||n===`failed to fetch`||n===`connect failed`?`gateway connect failed`:t}function pc(e){return e&&typeof e==`object`?fc(e):uc(e)}var mc=/^\s*NO_REPLY\s*$/,hc=`HEARTBEAT_OK`,gc=300,_c=`[genesis] missing tool result in session history; inserted synthetic error result for transcript repair.`,vc=6e4,yc=500,bc=5e3,xc=new WeakMap,Sc=new WeakMap,Cc=256;function wc(e){let t=e,n=(xc.get(t)??0)+1;return xc.set(t,n),n}function Tc(e,t){return xc.get(e)===t}function Ec(e,t,n){return Tc(e,t)&&e.sessionKey===n}function Dc(e){return mc.test(e)}function Oc(e){return e===`final`||e===`aborted`||e===`error`}function kc(e){if(!Oc(e.state))return null;let t=typeof e.runId==`string`?e.runId.trim():``,n=typeof e.sessionKey==`string`?e.sessionKey.trim():``;return t&&n?`${n}\u0000${t}`:null}function Ac(e,t){let n=kc(t);return n?Sc.get(e)?.has(n)??!1:!1}function jc(e,t){let n=kc(t);if(!n)return;let r=e,i=Sc.get(r);for(i||(i=new Map,Sc.set(r,i)),i.set(n,Date.now());i.size>Cc;){let e=i.keys().next().value;if(typeof e!=`string`)break;i.delete(e)}}var Mc=null,Nc=null;function Pc(){if(Nc){let{state:e,text:t}=Nc;Nc=null,e.chatStream=t}}function Fc(){Mc!==null&&(cancelAnimationFrame(Mc),Mc=null),Pc()}function Ic(e,t){Nc={state:e,text:t},Mc===null&&(Mc=requestAnimationFrame(()=>{Mc=null,Pc()}))}function Lc(e){return Nc&&Nc.state===e?Nc.text:e.chatStream??``}function Rc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zc(e,t=gc){let n=e.trim();if(!n)return{shouldSkip:!0};let r=n.replace(/<[^>]*>/g,` `).replace(/&nbsp;/gi,` `).replace(/^[*`~_]+/,``).replace(/[*`~_]+$/,``);if(!n.includes(hc)&&!r.includes(hc))return{shouldSkip:!1};let i=RegExp(`${Rc(hc)}[^\\w]{0,4}$`),a=!0,o=!1;for(n=r.trim();a;){a=!1;let e=n.trim();if(e.startsWith(hc)){n=e.slice(12).trimStart(),o=!0,a=!0;continue}if(i.test(e)){let t=e.lastIndexOf(hc),r=e.slice(0,t).trimEnd(),i=e.slice(t+12).trimStart();n=r?`${r}${i}`.trimEnd():``,o=!0,a=!0}}return o?{shouldSkip:!n||n.length<=t}:{shouldSkip:!1}}function Bc(e){if(e.role!==`assistant`)return!1;let{text:t,hasNonTextContent:n}=Vc(e.content);return n?!1:zc(t).shouldSkip}function Vc(e){if(typeof e==`string`)return{text:e,hasNonTextContent:!1};if(!Array.isArray(e))return{text:``,hasNonTextContent:e!=null};let t=!1;return{text:e.filter(e=>!e||typeof e!=`object`||!(`type`in e)||e.type!==`text`||typeof e.text!=`string`?(t=!0,!1):!0).map(e=>e.text).join(``),hasNonTextContent:t}}function Hc(e){if(!e||typeof e!=`object`)return!1;let t=e;if(y(t.role)!==`assistant`)return!1;if(typeof t.text==`string`)return Dc(t.text);let n=ic(e);return typeof n==`string`&&Dc(n)}function Uc(e){if(!e||typeof e!=`object`||y(e.role)!==`toolresult`)return!1;let t=ic(e);return typeof t==`string`&&t.trim()===_c}function Wc(e){if(typeof e==`string`)return!0;if(!Array.isArray(e))return!1;if(e.length===0)return!0;let t=!1;for(let n of e){if(!n||typeof n!=`object`)return!1;let e=n;if(e.type!==`text`||(t=!0,typeof e.text!=`string`))return!1}return t}function Gc(e){if(!e||typeof e!=`object`)return!1;let t=e;return y(t.role)!==`user`||!Wc(t.content??t.text)?!1:(ic(e)?.trim()??``)===``}function Kc(e){if(!e||typeof e!=`object`)return!1;let t=e,n=y(t.role);return n===`assistant`?Bc({role:n,content:t.content??t.text}):!1}function qc(e){return Hc(e)||Kc(e)||Uc(e)||Gc(e)}function Jc(e){return!!(e&&typeof e==`object`&&e.__genesis&&typeof e.__genesis==`object`)}function Yc(e){if(!e||typeof e!=`object`||Jc(e))return!1;let t=y(e.role);return t===`user`||t===`assistant`}function Xc(e){if(!e||typeof e!=`object`)return null;let t=y(e.role);if(!t)return null;let n=ic(e)?.trim();if(n)return`${t}:text:${n}`;try{return`${t}:content:${JSON.stringify(e.content??null)}`}catch{return null}}function Zc(e){if(!e||typeof e!=`object`)return null;let t=e.__genesis;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function Qc(e){let t=Zc(e),n=t?.id;if(typeof n==`string`&&n.trim())return`id:${n.trim()}`;let r=t?.seq;return typeof r==`number`&&Number.isFinite(r)?`seq:${r}`:null}function $c(e,t){let n=Qc(t);if(n){let t=e.findIndex(e=>Qc(e)===n);if(t>=0)return t}let r=Xc(t);if(!r)return-1;for(let t=e.length-1;t>=0;--t){let n=e[t];if(Yc(n)&&Xc(n)===r)return t}return-1}function el(e,t,n){if(t===void 0||qc(t))return t!==void 0;let r=$c(e.chatMessages,t);return r>=0?(e.chatMessages[r]===t||(e.chatMessages=e.chatMessages.map((e,n)=>n===r?t:e)),!0):n?.appendIfMissing===!1?!1:(e.chatMessages=[...e.chatMessages,t],!0)}function tl(e,t){if(e.length===0||t.length===0)return e;let n=new Set(e.map(e=>Xc(e)).filter(e=>!!e)),r=-1;for(let e=t.length-1;e>=0;e--){let i=Xc(t[e]);if(i&&n.has(i)){r=e;break}}if(r<0)return e;let i=[];for(let a of t.slice(r+1)){if(!Yc(a)||qc(a))return e;let t=Xc(a);if(!t||n.has(t))return e;i.push(a)}return i.length>0?[...e,...i]:e}function nl(e,t){if(!(e instanceof cn)||e.gatewayCode!==`UNAVAILABLE`||!e.retryable)return!1;let n=e.details;if(!n||typeof n!=`object`)return!0;let r=n.method;return typeof r!=`string`||r===t}function rl(e){let t=typeof e.retryAfterMs==`number`?e.retryAfterMs:yc;return Math.min(Math.max(t,100),bc)}function il(e){return new Promise(t=>setTimeout(t,e))}function al(e){let t=e;t.toolStreamById instanceof Map&&Array.isArray(t.toolStreamOrder)&&Array.isArray(t.chatToolMessages)&&Array.isArray(t.chatStreamSegments)&&Ai(t)}async function ol(e){if(!e.client||!e.connected)return;let t=e.sessionKey,n=wc(e),r=Date.now(),i=e.chatMessages;e.chatLoading=!0,e.lastError=null;try{let a;for(;;)try{a=await e.client.request(`chat.history`,{sessionKey:t,limit:200});break}catch(i){if(!Ec(e,n,t))return;if(Date.now()-r<vc&&nl(i,`chat.history`)){if(await il(rl(i)),!e.client||!e.connected)return;continue}throw i}if(!Ec(e,n,t))return;e.chatMessages=tl((Array.isArray(a.messages)?a.messages:[]).filter(e=>!qc(e)),i),e.chatThinkingLevel=a.thinkingLevel??null,al(e),e.chatStream=null,e.chatStreamStartedAt=null}catch(r){if(!Ec(e,n,t))return;bn(r)?(e.chatMessages=[],e.chatThinkingLevel=null,e.lastError=xn(`existing chat history`)):e.lastError=String(r)}finally{Tc(e,n)&&(e.chatLoading=!1)}}function sl(e){let t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}function cl(e){return e&&e.length>0?e.map(e=>{let t=sl(e.dataUrl);return t?{type:`image`,mimeType:t.mimeType,content:t.content}:null}).filter(e=>e!==null):void 0}async function ll(e,t){await e.client.request(`chat.send`,{sessionKey:e.sessionKey,message:t.message,deliver:!1,idempotencyKey:t.runId,attachments:cl(t.attachments)})}function ul(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=n.role;if(typeof r==`string`){if((t.roleCaseSensitive?r:y(r))!==`assistant`)return null}else if(t.roleRequirement===`required`)return null;return t.requireContentArray?Array.isArray(n.content)?n:null:!(`content`in n)&&!(t.allowTextField&&`text`in n)?null:n}function dl(e){return ul(e,{roleRequirement:`required`,roleCaseSensitive:!0,requireContentArray:!0})}function fl(e){return ul(e,{roleRequirement:`optional`,allowTextField:!0})}async function pl(e,t,n){if(!e.client||!e.connected)return null;let r=t.trim(),i=n&&n.length>0;if(!r&&!i)return null;let a=Date.now(),o=[];if(r&&o.push({type:`text`,text:r}),i)for(let e of n)o.push({type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.dataUrl}});e.chatMessages=[...e.chatMessages,{role:`user`,content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;let s=sn();e.chatRunId=s,e.chatStream=``,e.chatStreamStartedAt=a;try{return await ll(e,{message:r,attachments:n,runId:s}),s}catch(t){let n=pc(t);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=n,e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:`Error: `+n}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function ml(e,t,n){if(!e.client||!e.connected)return null;let r=t.trim(),i=n&&n.length>0;if(!r&&!i)return null;e.lastError=null;let a=sn();try{return await ll(e,{message:r,attachments:n,runId:a}),a}catch(t){return e.lastError=pc(t),null}}async function hl(e,t,n){if(!e.client||!e.connected)return null;let r=t.trim(),i=n&&n.length>0;if(!r&&!i)return null;e.lastError=null;let a=sn();try{return await ll(e,{message:r,attachments:n,runId:a}),a}catch(t){return e.lastError=pc(t),null}}async function gl(e){if(!e.client||!e.connected)return!1;let t=e.chatRunId;try{return await e.client.request(`chat.abort`,t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(t){return e.lastError=pc(t),!1}}function _l(e,t){if(!t||t.sessionKey!==e.sessionKey||Ac(e,t))return null;if(jc(e,t),t.runId&&e.chatRunId&&t.runId!==e.chatRunId){if(t.state===`final`){let n=fl(t.message);return n&&!Hc(n)?(e.chatMessages=[...e.chatMessages,n],null):`final`}return null}if(t.state===`delta`)if(typeof t.appendText==`string`){let n=(t.reset?``:Lc(e))+t.appendText;Dc(n)||Ic(e,n)}else{let n=ic(t.message);typeof n==`string`&&!Dc(n)&&Ic(e,n)}else if(t.state===`final`){Fc();let n=fl(t.message);n&&!Hc(n)?e.chatMessages=[...e.chatMessages,n]:e.chatStream?.trim()&&!Dc(e.chatStream)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:e.chatStream}],timestamp:Date.now()}]),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else if(t.state===`aborted`){Fc();let n=dl(t.message);if(n&&!Hc(n))e.chatMessages=[...e.chatMessages,n];else{let t=e.chatStream??``;t.trim()&&!Dc(t)&&(e.chatMessages=[...e.chatMessages,{role:`assistant`,content:[{type:`text`,text:t}],timestamp:Date.now()}])}e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null}else t.state===`error`&&(Fc(),e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??`chat error`);return t.state}async function vl(e){try{return(await e.request(`models.list`,{}))?.models??[]}catch{return[]}}var yl=new WeakMap,bl=`abortedLastRun.childSessions.compactionCheckpointCount.contextTokens.displayName.endedAt.elevatedLevel.fastMode.inputTokens.kind.label.latestCompactionCheckpoint.model.modelProvider.outputTokens.reasoningLevel.runtimeMs.sessionId.spawnedBy.startedAt.status.subject.surface.systemSent.thinkingDefault.thinkingLevel.thinkingOptions.totalTokens.totalTokensFresh.updatedAt.verboseLevel`.split(`.`);function xl(e){let t=e,n=yl.get(t);return n||(n={loading:!1,ownsStateLoading:!1,pending:null},yl.set(t,n)),n}function Sl(e){let t=e.pending;return e.pending=null,t}function Cl(e){return!!(e&&typeof e==`object`)}function wl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Tl(e){return e===`direct`||e===`group`||e===`global`||e===`unknown`?e:void 0}function El(e){return`${e?.compactionCheckpointCount??0}:${e?.latestCompactionCheckpoint?.checkpointId??``}:${e?.latestCompactionCheckpoint?.createdAt??0}`}function Dl(e,t){if(!(t in e.sessionsCheckpointItemsByKey)&&!(t in e.sessionsCheckpointErrorByKey))return;let n={...e.sessionsCheckpointItemsByKey},r={...e.sessionsCheckpointErrorByKey};delete n[t],delete r[t],e.sessionsCheckpointItemsByKey=n,e.sessionsCheckpointErrorByKey=r}async function Ol(e,t){e.sessionsCheckpointLoadingKey=t,e.sessionsCheckpointErrorByKey={...e.sessionsCheckpointErrorByKey,[t]:``};try{let n=await e.client?.request(`sessions.compaction.list`,{key:t});n&&(e.sessionsCheckpointItemsByKey={...e.sessionsCheckpointItemsByKey,[t]:n.checkpoints??[]})}catch(n){e.sessionsCheckpointErrorByKey={...e.sessionsCheckpointErrorByKey,[t]:String(n)}}finally{e.sessionsCheckpointLoadingKey===t&&(e.sessionsCheckpointLoadingKey=null)}}async function kl(e,t){if(e.sessionsLoading)return!1;let n=xl(e);e.sessionsLoading=!0,e.sessionsError=null;let r=!1;try{await t()}finally{e.sessionsLoading=!1;let t=Sl(n);t&&e.client&&e.connected&&(await Nl(e,t.overrides),r=!0)}return r}async function Al(e,t,n,r,i){if(!e.client||!e.connected||!window.confirm(i))return null;let a=e.client;e.sessionsCheckpointBusyKey=n;try{let i=await a.request(r,{key:t,checkpointId:n});return await Nl(e),i}catch(t){return e.sessionsError=String(t),null}finally{e.sessionsCheckpointBusyKey===n&&(e.sessionsCheckpointBusyKey=null)}}function jl(e,t){if(!Cl(t)||!e.sessionsResult)return!1;let n=(Cl(t.session)?t.session:null)??t,r=typeof n.key==`string`&&n.key.trim()||typeof t.sessionKey==`string`&&t.sessionKey.trim()||typeof t.key==`string`&&t.key.trim()||``;if(!r)return!1;let i=e.sessionsResult.sessions,a=i.findIndex(e=>e.key===r),o=a>=0?i[a]:void 0,s=El(o),c=Tl(n.kind)??o?.kind??`unknown`,l={...o??{key:r,kind:c,updatedAt:null},key:r,kind:c},u=l;for(let e of bl){if(!wl(n,e))continue;let t=n[e];t===void 0?delete u[e]:u[e]=t}l.totalTokensFresh===!1&&!wl(n,`totalTokens`)&&delete l.totalTokens;let d=a>=0?i.map((e,t)=>t===a?l:e):[l,...i],f=typeof t.ts==`number`&&Number.isFinite(t.ts)?t.ts:null;return e.sessionsResult={...e.sessionsResult,ts:f==null?e.sessionsResult.ts:Math.max(e.sessionsResult.ts,f),count:a>=0?e.sessionsResult.count:e.sessionsResult.count+1,sessions:d},s!==El(l)&&Dl(e,r),!0}async function Ml(e){if(!(!e.client||!e.connected))try{await e.client.request(`sessions.subscribe`,{})}catch(t){e.sessionsError=String(t)}}async function Nl(e,t){if(!e.client||!e.connected)return;let n=xl(e);if(n.loading){n.pending={overrides:t};return}if(e.sessionsLoading){n.pending={overrides:t};return}let r=e.client;n.loading=!0,n.ownsStateLoading=!0,e.sessionsLoading=!0,e.sessionsError=null;let i=t;try{for(;;){n.pending=null,await Pl(e,r,i);let t=Sl(n);if(!t||!e.client||!e.connected)break;i=t.overrides}}finally{n.loading=!1,n.pending=null,n.ownsStateLoading&&=(e.sessionsLoading=!1,!1)}}async function Pl(e,t,n){await(async()=>{let r=new Map((e.sessionsResult?.sessions??[]).map(e=>[e.key,e])),i=n?.includeGlobal??e.sessionsIncludeGlobal,a=n?.includeUnknown??e.sessionsIncludeUnknown,o=n?.activeMinutes??x(e.sessionsFilterActive,0),s=n?.limit??x(e.sessionsFilterLimit,0),c={includeGlobal:i,includeUnknown:a,includeTranscriptUsage:n?.includeTranscriptUsage??!1};o>0&&(c.activeMinutes=o),s>0&&(c.limit=s);let l=n?.search===void 0?``:n.search.trim();l&&(c.search=l);let u=await t.request(`sessions.list`,c);if(u){e.sessionsResult=u;let t=new Set(u.sessions.map(e=>e.key));for(let n of Object.keys(e.sessionsCheckpointItemsByKey))t.has(n)||Dl(e,n);let n=!1;for(let t of u.sessions)El(r.get(t.key))!==El(t)&&(Dl(e,t.key),e.sessionsExpandedCheckpointKey===t.key&&(n=!0));let i=e.sessionsExpandedCheckpointKey;i&&t.has(i)&&(n||!e.sessionsCheckpointItemsByKey[i])&&await Ol(e,i)}})().catch(t=>{if(!bn(t)){e.sessionsError=String(t);return}e.sessionsResult=null,e.sessionsError=xn(`sessions`)})}async function Fl(e,t,n){if(!e.client||!e.connected)return;let r={key:t};for(let e of[`label`,`thinkingLevel`,`fastMode`,`verboseLevel`,`reasoningLevel`])e in n&&(r[e]=n[e]);try{await e.client.request(`sessions.patch`,r),await Nl(e)}catch(t){e.sessionsError=String(t)}}async function Il(e,t){if(!e.client||!e.connected||t.length===0)return[];let n=e.client;if(e.sessionsLoading||!window.confirm(`Delete ${t.length} ${t.length===1?`session`:`sessions`}?\n\nThis will delete the session entries and archive their transcripts.`))return[];let r=[],i=[],a=await kl(e,async()=>{for(let e of t)try{await n.request(`sessions.delete`,{key:e,deleteTranscript:!0}),r.push(e)}catch(e){i.push(String(e))}});return r.length>0&&!a&&await Nl(e),i.length>0&&(e.sessionsError=i.join(`; `)),r}async function Ll(e,t){let n=t.trim();if(n){if(e.sessionsExpandedCheckpointKey===n){e.sessionsExpandedCheckpointKey=null;return}e.sessionsExpandedCheckpointKey=n,!e.sessionsCheckpointItemsByKey[n]&&await Ol(e,n)}}async function Rl(e,t,n){return(await Al(e,t,n,`sessions.compaction.branch`,`Create a new child session from this pre-compaction checkpoint?`))?.key??null}async function zl(e,t,n){await Al(e,t,n,`sessions.compaction.restore`,`Restore this session to the selected pre-compaction checkpoint?
174
174
 
175
- This replaces the current active transcript for the session key.`)}var Bl=[{label:`control`,tabs:[`overview`,`agents`,`chat`,`canvas`,`channels`,`sessions`,`models`,`instances`,`usage`,`cron`]},{label:`tools`,tabs:[`skills`,`plugins`,`mcp`,`wallet`,`memory`,`nodes`,`dreams`]},{label:`settings`,tabs:[`config`,`communications`,`appearance`,`automation`,`infrastructure`,`aiAgents`,`debug`,`logs`]}],Vl={agents:`/agents`,overview:`/overview`,canvas:`/canvas`,channels:`/channels`,instances:`/instances`,sessions:`/sessions`,usage:`/usage`,wallet:`/wallet`,cron:`/cron`,skills:`/skills`,mcp:`/mcp`,plugins:`/plugins`,models:`/models`,memory:`/memory`,nodes:`/nodes`,chat:`/chat`,config:`/config`,communications:`/communications`,appearance:`/appearance`,automation:`/automation`,infrastructure:`/infrastructure`,aiAgents:`/ai-agents`,debug:`/debug`,logs:`/logs`,dreams:`/dreaming`},Hl={"/dreams":`dreams`},Ul=new Map([...Object.entries(Vl).map(([e,t])=>[t,e]),...Object.entries(Hl)]);function Wl(e){if(!e)return``;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t===`/`?``:(t.endsWith(`/`)&&(t=t.slice(0,-1)),t)}function Gl(e){if(!e)return`/`;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function Kl(e,t=``){let n=Wl(t),r=Vl[e];return n?`${n}${r}`:r}function ql(e,t=``){let n=Wl(t),r=e||`/`;n&&(r===n?r=`/`:r.startsWith(`${n}/`)&&(r=r.slice(n.length)));let i=y(Gl(r));return i.endsWith(`/index.html`)&&(i=`/`),i===`/`?`chat`:Ul.get(i)??null}function Jl(e){let t=Gl(e);if(t.endsWith(`/index.html`)&&(t=Gl(t.slice(0,-11))),t===`/`)return``;let n=t.split(`/`).filter(Boolean);if(n.length===0)return``;for(let e=0;e<n.length;e++){let t=y(`/${n.slice(e).join(`/`)}`);if(Ul.has(t)){let t=n.slice(0,e);return t.length?`/${t.join(`/`)}`:``}}return`/${n.join(`/`)}`}function Yl(e){switch(e){case`agents`:return`folder`;case`chat`:return`messageSquare`;case`overview`:return`barChart`;case`canvas`:return`image`;case`channels`:return`link`;case`instances`:return`radio`;case`sessions`:return`fileText`;case`usage`:return`barChart`;case`wallet`:return`wallet`;case`cron`:return`loader`;case`skills`:return`zap`;case`mcp`:return`plug`;case`plugins`:return`wrench`;case`models`:return`cpu`;case`memory`:return`brain`;case`nodes`:return`monitor`;case`config`:return`settings`;case`communications`:return`send`;case`appearance`:return`spark`;case`automation`:return`terminal`;case`infrastructure`:return`globe`;case`aiAgents`:return`brain`;case`debug`:return`bug`;case`logs`:return`scrollText`;case`dreams`:return`moon`;default:return`folder`}}function Xl(e){return p(`tabs.${e}`)}function Zl(e){return p(`subtitles.${e}`)}var Ql=[{id:`read`,label:`read`,description:`Read file contents`,sectionId:`fs`,profiles:[`coding`]},{id:`write`,label:`write`,description:`Create or overwrite files`,sectionId:`fs`,profiles:[`coding`]},{id:`edit`,label:`edit`,description:`Make precise edits`,sectionId:`fs`,profiles:[`coding`]},{id:`apply_patch`,label:`apply_patch`,description:`Patch files`,sectionId:`fs`,profiles:[`coding`]},{id:`exec`,label:`exec`,description:`Run shell commands that start now.`,sectionId:`runtime`,profiles:[`coding`]},{id:`process`,label:`process`,description:`Inspect and control running exec sessions.`,sectionId:`runtime`,profiles:[`coding`]},{id:`code_execution`,label:`code_execution`,description:`Run sandboxed remote analysis`,sectionId:`runtime`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`web_search`,label:`web_search`,description:`Search the web`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`web_fetch`,label:`web_fetch`,description:`Fetch web content`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`x_search`,label:`x_search`,description:`Search X posts`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`memory_search`,label:`memory_search`,description:`Semantic search`,sectionId:`memory`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`memory_get`,label:`memory_get`,description:`Read memory files`,sectionId:`memory`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`sessions_list`,label:`sessions_list`,description:`List visible sessions with mailbox filters and optional previews.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_history`,label:`sessions_history`,description:`Read sanitized message history for a visible session.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_send`,label:`sessions_send`,description:`Send a message to another visible session.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_spawn`,label:`sessions_spawn`,description:`Spawn sub-agent or ACP sessions.`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`sessions_yield`,label:`sessions_yield`,description:`End turn to receive sub-agent results`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`subagents`,label:`subagents`,description:`Manage sub-agents`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`session_status`,label:`session_status`,description:`Show session status, usage, and model state.`,sectionId:`sessions`,profiles:[`minimal`,`coding`,`messaging`],includeInGenesisGroup:!0},{id:`browser`,label:`browser`,description:`Control web browser`,sectionId:`ui`,profiles:[],includeInGenesisGroup:!0},{id:`canvas`,label:`canvas`,description:`Control canvases`,sectionId:`ui`,profiles:[],includeInGenesisGroup:!0},{id:`message`,label:`message`,description:`Send messages`,sectionId:`messaging`,profiles:[`messaging`],includeInGenesisGroup:!0},{id:`cron`,label:`cron`,description:`Schedule cron jobs, reminders, and wake events.`,sectionId:`automation`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`gateway`,label:`gateway`,description:`Gateway control`,sectionId:`automation`,profiles:[],includeInGenesisGroup:!0},{id:`nodes`,label:`nodes`,description:`Nodes + devices`,sectionId:`nodes`,profiles:[],includeInGenesisGroup:!0},{id:`agents_list`,label:`agents_list`,description:`List agents`,sectionId:`agents`,profiles:[],includeInGenesisGroup:!0},{id:`update_plan`,label:`update_plan`,description:`Track a short structured work plan.`,sectionId:`agents`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`image`,label:`image`,description:`Image understanding`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`image_generate`,label:`image_generate`,description:`Image generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`music_generate`,label:`music_generate`,description:`Music generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`video_generate`,label:`video_generate`,description:`Video generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`tts`,label:`tts`,description:`Text-to-speech conversion`,sectionId:`media`,profiles:[],includeInGenesisGroup:!0}];new Map(Ql.map(e=>[e.id,e]));function $l(e){return Ql.filter(t=>t.profiles.includes(e)).map(e=>e.id)}var eu={minimal:{allow:$l(`minimal`)},coding:{allow:[...$l(`coding`),`bundle-mcp`]},messaging:{allow:[...$l(`messaging`),`bundle-mcp`]},full:{}};function tu(){let e=new Map;for(let t of Ql){let n=`group:${t.sectionId}`,r=e.get(n)??[];r.push(t.id),e.set(n,r)}return{"group:genesis":Ql.filter(e=>e.includeInGenesisGroup).map(e=>e.id),...Object.fromEntries(e.entries())}}var nu=tu();function ru(e){if(!e)return;let t=eu[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}var iu={bash:`exec`,"apply-patch":`apply_patch`},au={...nu};function ou(e){let t=y(e);return iu[t]??t}function su(e){return e?e.map(ou).filter(Boolean):[]}function cu(e){let t=su(e),n=[];for(let e of t){let t=au[e];if(t){n.push(...t);continue}n.push(e)}return Array.from(new Set(n))}function lu(e){return ru(e)}var uu=[{id:`fs`,label:`Files`,tools:[{id:`read`,label:`read`,description:`Read file contents`},{id:`write`,label:`write`,description:`Create or overwrite files`},{id:`edit`,label:`edit`,description:`Make precise edits`},{id:`apply_patch`,label:`apply_patch`,description:`Patch files (OpenAI)`}]},{id:`runtime`,label:`Runtime`,tools:[{id:`exec`,label:`exec`,description:`Run shell commands`},{id:`process`,label:`process`,description:`Manage background processes`}]},{id:`web`,label:`Web`,tools:[{id:`web_search`,label:`web_search`,description:`Search the web`},{id:`web_fetch`,label:`web_fetch`,description:`Fetch web content`}]},{id:`memory`,label:`Memory`,tools:[{id:`memory_search`,label:`memory_search`,description:`Semantic search`},{id:`memory_get`,label:`memory_get`,description:`Read memory files`}]},{id:`sessions`,label:`Sessions`,tools:[{id:`sessions_list`,label:`sessions_list`,description:`List sessions`},{id:`sessions_history`,label:`sessions_history`,description:`Session history`},{id:`sessions_send`,label:`sessions_send`,description:`Send to session`},{id:`sessions_spawn`,label:`sessions_spawn`,description:`Spawn sub-agent`},{id:`session_status`,label:`session_status`,description:`Session status`}]},{id:`ui`,label:`UI`,tools:[{id:`browser`,label:`browser`,description:`Control web browser`},{id:`canvas`,label:`canvas`,description:`Control canvases`}]},{id:`messaging`,label:`Messaging`,tools:[{id:`message`,label:`message`,description:`Send messages`}]},{id:`automation`,label:`Automation`,tools:[{id:`cron`,label:`cron`,description:`Schedule tasks`},{id:`gateway`,label:`gateway`,description:`Gateway control`}]},{id:`nodes`,label:`Nodes`,tools:[{id:`nodes`,label:`nodes`,description:`Nodes + devices`}]},{id:`agents`,label:`Agents`,tools:[{id:`agents_list`,label:`agents_list`,description:`List agents`}]},{id:`media`,label:`Media`,tools:[{id:`image`,label:`image`,description:`Image understanding`}]}],du=[{id:`minimal`,label:`Minimal`},{id:`coding`,label:`Coding`},{id:`messaging`,label:`Messaging`},{id:`full`,label:`Full`}];function fu(e){return e?.groups?.length?e.groups.map(e=>({id:e.id,label:e.label,source:e.source,pluginId:e.pluginId,tools:e.tools.map(e=>({id:e.id,label:e.label,description:e.description,source:e.source,pluginId:e.pluginId,optional:e.optional,defaultProfiles:[...e.defaultProfiles]}))})):uu}function pu(e){return e?.profiles?.length?e.profiles:du}function mu(e){return v(e.name)??v(e.identity?.name)??e.id}var hu=/^(data:image\/|\/(?!\/))/i;function gu(e){return hu.test(e)}function _u(e,t){let n=[v(t?.avatar),v(e.identity?.avatarUrl),v(e.identity?.avatar)];for(let e of n)if(e&&gu(e))return e;return null}function vu(e,t,n){let r=v(e);return r?.startsWith(`blob:`)?r:_u(t,n)}function yu(e){let t=v(e)?.replace(/\/$/,``)??``;return t?`${t}/favicon.svg`:`favicon.svg`}function bu(e,t){return t&&e===t?`default`:null}function xu(e,t){let n=e;return{entry:(n?.agents?.list??[]).find(e=>e?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function Su(e,t,n,r,i){let a=xu(t,e.id),o=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||e.workspace||`default`,s=a.entry?.model?Cu(a.entry?.model):a.defaults?.model?Cu(a.defaults?.model):Cu(e.model),c=v(i?.name)||v(e.identity?.name)||v(e.name)||a.entry?.name||e.id,l=_u(e,i)?`custom`:`—`,u=Array.isArray(a.entry?.skills)?a.entry?.skills:null,d=u?.length??null;return{workspace:o,model:s,identityName:c,identityAvatar:l,skillsLabel:u?`${d} selected`:`all skills`,isDefault:!!(r&&e.id===r)}}function Cu(e){if(!e)return`-`;if(typeof e==`string`)return v(e)||`-`;if(typeof e==`object`&&e){let t=e,n=v(t.primary);if(n){let e=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return e>0?`${n} (+${e} fallback)`:n}}return`-`}function wu(e){let t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Tu(e){if(!e)return null;if(typeof e==`string`)return v(e)||null;if(typeof e==`object`&&e){let t=e;return v(typeof t.primary==`string`?t.primary:typeof t.model==`string`?t.model:typeof t.id==`string`?t.id:typeof t.value==`string`?t.value:null)||null}return null}function Eu(e){if(!e||typeof e==`string`)return null;if(typeof e==`object`&&e){let t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(e=>typeof e==`string`):null}return null}function Du(e,t){return Eu(e)??Eu(t)}function Ou(e,t){if(typeof t!=`string`)return;let n=t.trim();n&&e.add(n)}function ku(e,t){if(!t)return;if(typeof t==`string`){Ou(e,t);return}if(typeof t!=`object`)return;let n=t;Ou(e,n.primary),Ou(e,n.model),Ou(e,n.id),Ou(e,n.value);let r=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(let t of r)Ou(e,t)}function Au(e){let t=Array.from(e),n=Array.from({length:t.length},()=>``),r=(e,r,i)=>{let a=e,o=r,s=e;for(;a<r&&o<i;)n[s++]=t[a].localeCompare(t[o])<=0?t[a++]:t[o++];for(;a<r;)n[s++]=t[a++];for(;o<i;)n[s++]=t[o++];for(let r=e;r<i;r+=1)t[r]=n[r]},i=(e,t)=>{if(t-e<=1)return;let n=e+t>>>1;i(e,n),i(n,t),r(e,n,t)};return i(0,t.length),t}function ju(e){if(!e||typeof e!=`object`)return[];let t=e.agents;if(!t||typeof t!=`object`)return[];let n=new Set,r=t.defaults;if(r&&typeof r==`object`){let e=r;ku(n,e.model);let t=e.models;if(t&&typeof t==`object`)for(let e of Object.keys(t))Ou(n,e)}let i=t.list;if(i&&typeof i==`object`)for(let e of Object.values(i))!e||typeof e!=`object`||ku(n,e.model);return Au(n)}function Mu(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function Nu(e){let t=e?.agents?.defaults?.models;if(!t||typeof t!=`object`)return[];let n=[];for(let[e,r]of Object.entries(t)){let t=e.trim();if(!t)continue;let i=r&&typeof r==`object`&&`alias`in r&&typeof r.alias==`string`?r.alias?.trim():void 0,a=i&&i!==t?`${i} (${t})`:t;n.push({value:t,label:a})}return n}function Pu(e,t,n){let r=new Set,a=[],o=(e,t)=>{let n=y(e);r.has(n)||(r.add(n),a.push({value:e,label:t}))};for(let t of Nu(e))o(t.value,t.label);if(n)for(let e of n){let t=e.provider?.trim();o(t?`${t}/${e.id}`:e.id,t?`${e.id} · ${t}`:e.id)}return t&&!r.has(y(t))&&a.unshift({value:t,label:`Current (${t})`}),a.length===0?g:a.map(e=>i`<option value=${e.value}>${e.label}</option>`)}function Fu(e){let t=ou(e);if(!t)return{kind:`exact`,value:``};if(t===`*`)return{kind:`all`};if(!t.includes(`*`))return{kind:`exact`,value:t};let n=t.replace(/[.*+?^${}()|[\\]\\]/g,`\\$&`);return{kind:`regex`,value:RegExp(`^${n.replaceAll(`\\*`,`.*`)}$`)}}function Iu(e){return Array.isArray(e)?cu(e).map(Fu).filter(e=>e.kind!==`exact`||e.value.length>0):[]}function Lu(e,t){for(let n of t)if(n.kind===`all`||n.kind===`exact`&&e===n.value||n.kind===`regex`&&n.value.test(e))return!0;return!1}function Ru(e,t){if(!t)return!0;let n=ou(e);if(Lu(n,Iu(t.deny)))return!1;let r=Iu(t.allow);return!!(r.length===0||Lu(n,r)||n===`apply_patch`&&Lu(`exec`,r))}function zu(e,t){if(!Array.isArray(t)||t.length===0)return!1;let n=ou(e),r=Iu(t);return!!(Lu(n,r)||n===`apply_patch`&&Lu(`exec`,r))}function Bu(e){return lu(e)??void 0}function Vu(e){return e.chatSending||!!e.chatRunId}function Hu(e){let t=e.trim();if(!t)return!1;let n=y(t);return n===`/stop`?!0:n===`stop`||n===`esc`||n===`abort`||n===`wait`||n===`exit`}function Uu(e){let t=e.trim();if(!t)return!1;let n=y(t);return n===`/new`||n===`/reset`?!0:n.startsWith(`/new `)||n.startsWith(`/reset `)}function Wu(e){return/^\/btw(?::|\s|$)/i.test(e.trim())}async function Gu(e){if(!e.connected&&e.chatRunId){e.chatMessage=``,e.pendingAbort={runId:e.chatRunId,sessionKey:e.sessionKey};return}e.connected&&(e.chatMessage=``,await gl(e))}function Ku(e,t,n,r,i){let a=t.trim(),o=!!(n&&n.length>0);!a&&!o||(e.chatQueue=[...e.chatQueue,{id:sn(),text:a,createdAt:Date.now(),attachments:o?n?.map(e=>({...e})):void 0,refreshSessions:r,localCommandArgs:i?.args,localCommandName:i?.name}])}function qu(e,t,n,r){let i=t.trim(),a=!!(r&&r.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:sn(),text:i,createdAt:Date.now(),kind:`steered`,attachments:a?r?.map(e=>({...e})):void 0,pendingRunId:n}])}async function Ju(e,t,n){Ai(e),ai(e);let r=await pl(e,t,n?.attachments),i=!!r;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Qr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ti(e,!0),i&&!e.chatRunId&&Zu(e),i&&n?.refreshSessions&&r&&e.refreshSessionsAfterChat.add(r),i}async function Yu(e,t,n){let r=!!await ml(e,t,n?.attachments);return!r&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!r&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),r&&Qr(e,e.sessionKey),r}async function Xu(e,t){if(!e.connected||!e.chatRunId)return;let n=e.chatRunId,r=e.chatQueue.find(e=>e.id===t&&!e.pendingRunId&&!e.localCommandName);if(!r)return;let i=r.text.trim(),a=r.attachments??[],o=a.length>0;if(!(!i&&!o)){if(e.chatQueue=e.chatQueue.map(e=>e.id===t?{...e,kind:`steered`,pendingRunId:n}:e),!await hl(e,i,o?a:void 0)){e.chatQueue=e.chatQueue.map(e=>e.id===t?r:e);return}Qr(e,e.sessionKey),ti(e)}}async function Zu(e){if(!e.connected||Vu(e))return;let t=e.chatQueue.findIndex(e=>!e.pendingRunId);if(t<0)return;let n=e.chatQueue[t];e.chatQueue=e.chatQueue.filter((e,n)=>n!==t);let r=!1;try{n.localCommandName?(await nd(e,n.localCommandName,n.localCommandArgs??``),r=!0):r=await Ju(e,n.text,{attachments:n.attachments,refreshSessions:n.refreshSessions})}catch(t){e.lastError=String(t)}r?e.chatQueue.length>0&&Zu(e):e.chatQueue=[n,...e.chatQueue]}function Qu(e,t){e.chatQueue=e.chatQueue.filter(e=>e.id!==t)}function $u(e,t){t&&(e.chatQueue=e.chatQueue.filter(e=>e.pendingRunId!==t))}async function ed(e,t,n){if(!e.connected)return;let r=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],s=o.length>0;if(!i&&!s)return;if(Hu(i)){await Gu(e);return}if(Wu(i)){t??(e.chatMessage=``,e.chatAttachments=[]),await Yu(e,i,{previousDraft:t==null?r:void 0,attachments:s?o:void 0,previousAttachments:t==null?a:void 0});return}let c=Uo(i);if(c?.command.executeLocal){if(Vu(e)&&td(c.command.key)){t??(e.chatMessage=``,e.chatAttachments=[]),Ku(e,i,void 0,Uu(i),{args:c.args,name:c.command.key});return}let a=t==null?r:void 0;t??(e.chatMessage=``,e.chatAttachments=[]),await nd(e,c.command.key,c.args,{previousDraft:a,restoreDraft:!!(t&&n?.restoreDraft)});return}let l=Uu(i);if(t??(e.chatMessage=``,e.chatAttachments=[]),Vu(e)){Ku(e,i,o,l);return}await Ju(e,i,{previousDraft:t==null?r:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:s?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:l})}function td(e){return![`stop`,`focus`,`export-session`,`steer`,`redirect`].includes(e)}async function nd(e,t,n,r){switch(t){case`stop`:await Gu(e);return;case`new`:await Ju(e,`/new`,{refreshSessions:!0,previousDraft:r?.previousDraft,restoreDraft:r?.restoreDraft});return;case`reset`:await Ju(e,`/reset`,{refreshSessions:!0,previousDraft:r?.previousDraft,restoreDraft:r?.restoreDraft});return;case`clear`:await rd(e);return;case`focus`:e.onSlashAction?.(`toggle-focus`);return;case`export-session`:e.onSlashAction?.(`export`);return}if(!e.client)return;let i=e.sessionKey,a=await Go(e.client,i,t,n,{chatModelCatalog:e.chatModelCatalog,sessionsResult:e.sessionsResult});a.content&&id(e,a.content),a.trackRunId&&(e.chatRunId=a.trackRunId,e.chatStream=``,e.chatSending=!1),a.pendingCurrentRun&&e.chatRunId&&qu(e,`/${t} ${n}`.trim(),e.chatRunId),a.sessionPatch&&`modelOverride`in a.sessionPatch&&(e.chatModelOverrides={...e.chatModelOverrides,[i]:a.sessionPatch.modelOverride??null},e.onSlashAction?.(`refresh-tools-effective`)),a.action===`refresh`&&await ad(e),ti(e)}async function rd(e){if(!(!e.client||!e.connected)){try{await e.client.request(`sessions.reset`,{key:e.sessionKey}),e.chatMessages=[],e.chatSideResult=null,e.chatSideResultTerminalRuns?.clear(),e.chatStream=null,e.chatRunId=null,await ol(e)}catch(t){e.lastError=String(t)}ti(e)}}function id(e,t){e.chatMessages=[...e.chatMessages,{role:`system`,content:t,timestamp:Date.now()}]}async function ad(e,t){await Promise.all([ol(e),Nl(e,{activeMinutes:0,limit:0,includeGlobal:!0,includeUnknown:!0}),yd(e),od(e),sd(e)]),t?.scheduleScroll!==!1&&ti(e)}async function od(e){if(!e.client||!e.connected){e.chatModelsLoading=!1,e.chatModelCatalog=[];return}e.chatModelsLoading=!0;try{e.chatModelCatalog=await vl(e.client)}finally{e.chatModelsLoading=!1}}async function sd(e){await Lo({client:e.client,agentId:pd(e)})}var cd=Zu,ld=new WeakMap,ud=new WeakMap;function dd(e){let t=e,n=(ld.get(t)??0)+1;return ld.set(t,n),n}function fd(e,t,n){return ld.get(e)===t&&e.sessionKey===n}function pd(e){let t=la(e.sessionKey);return t?.agentId?t.agentId:(e.hello?.snapshot)?.sessionDefaults?.defaultAgentId?.trim()||`main`}function md(e,t){let n=Wl(e),r=encodeURIComponent(t);return n?`${n}/avatar/${r}?meta=1`:`/avatar/${r}?meta=1`}function hd(e){let t=e,n=ud.get(t);n&&(URL.revokeObjectURL(n),ud.delete(t)),e.chatAvatarUrl=null}function gd(e,t){let n=e,r=ud.get(n);r&&r!==t&&(URL.revokeObjectURL(r),ud.delete(n)),t?.startsWith(`blob:`)&&ud.set(n,t),e.chatAvatarUrl=t}function _d(e){return e?{Authorization:e}:void 0}function vd(e){return e.startsWith(`/`)}async function yd(e){if(!e.connected){hd(e);return}let t=e.sessionKey,n=dd(e),r=pd(e);if(!r){fd(e,n,t)&&hd(e);return}hd(e);let i=ue(e),a=_d(i),o=md(e.basePath,r);try{let r=await fetch(o,{method:`GET`,...a?{headers:a}:{}});if(!fd(e,n,t))return;if(!r.ok){hd(e);return}let s=await r.json();if(!fd(e,n,t))return;let c=typeof s.avatarUrl==`string`?s.avatarUrl.trim():``;if(!c||!gu(c)){hd(e);return}if(!i||!vd(c)){gd(e,c);return}let l=await fetch(c,{method:`GET`,headers:{Authorization:i}});if(!l.ok){fd(e,n,t)&&hd(e);return}let u=URL.createObjectURL(await l.blob());if(!fd(e,n,t)){URL.revokeObjectURL(u);return}gd(e,u)}catch{fd(e,n,t)&&hd(e)}}var bd={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},xd={name:``,description:``,agentId:``,sessionKey:``,clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:`every`,scheduleAt:``,everyAmount:`30`,everyUnit:`minutes`,cronExpr:`0 7 * * *`,cronTz:``,scheduleExact:!1,staggerAmount:``,staggerUnit:`seconds`,sessionTarget:`isolated`,wakeMode:`now`,payloadKind:`agentTurn`,payloadText:``,payloadModel:``,payloadThinking:``,payloadLightContext:!1,deliveryMode:`announce`,deliveryChannel:`last`,deliveryTo:``,deliveryAccountId:``,deliveryBestEffort:!1,failureAlertMode:`inherit`,failureAlertAfter:`2`,failureAlertCooldownSeconds:`3600`,failureAlertChannel:`last`,failureAlertTo:``,failureAlertDeliveryMode:`announce`,failureAlertAccountId:``,timeoutSeconds:``},Sd=`operator`,Cd=`operator.admin`,wd=`operator.read`,Td=`operator.write`,Ed=`operator.`;function Dd(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Od(e,t){return e.startsWith(Ed)?t.has(Cd)?!0:e===wd?t.has(wd)||t.has(Td):e===Td?t.has(Td):t.has(e):!1}function kd(e){let t=Dd(e.requestedScopes);if(t.length===0)return!0;let n=Dd(e.allowedScopes);if(n.length===0)return!1;let r=new Set(n);if(e.role.trim()!==Sd){let n=`${e.role.trim()}.`;return t.every(e=>e.startsWith(n)&&r.has(e))}return t.every(e=>Od(e,r))}async function Ad(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{let[t,n,r,i]=await Promise.all([e.client.request(`status`,{}),e.client.request(`health`,{}),e.client.request(`models.list`,{}),e.client.request(`last-heartbeat`,{})]);e.debugStatus=t,e.debugHealth=n;let a=r;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function jd(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{let t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}var Md=2e3,Nd=new Set([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);function Pd(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;try{let e=JSON.parse(t);return e&&typeof e==`object`?e:null}catch{return null}}function Fd(e){if(typeof e!=`string`)return null;let t=y(e);return Nd.has(t)?t:null}function Id(e){if(!e.trim())return{raw:e,message:e};try{let t=JSON.parse(e),n=t&&typeof t._meta==`object`&&t._meta!==null?t._meta:null,r=typeof t.time==`string`?t.time:typeof n?.date==`string`?n?.date:null,i=Fd(n?.logLevelName??n?.level),a=typeof t[0]==`string`?t[0]:typeof n?.name==`string`?n?.name:null,o=Pd(a),s=typeof o?.subsystem==`string`?o.subsystem:typeof o?.module==`string`?o.module:null;!s&&a&&a.length<120&&(s=a);let c=typeof t[1]==`string`?t[1]:typeof t[2]==`string`?t[2]:!o&&typeof t[0]==`string`?t[0]:typeof t.message==`string`?t.message:e;return{raw:e,time:r,level:i,subsystem:s,message:c,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ld(e,t){let n=t?.quiet===!0;if(!(!e.client||!e.connected||e.logsLoading&&!n)){n||(e.logsLoading=!0),e.logsError=null;try{let n=await e.client.request(`logs.tail`,{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(n.lines)?n.lines.filter(e=>typeof e==`string`):[]).map(Id);e.logsEntries=t?.reset||n.reset||e.logsCursor==null?r:[...e.logsEntries,...r].slice(-Md),e.logsCursor=typeof n.cursor==`number`?n.cursor:e.logsCursor,e.logsFile=typeof n.file==`string`?n.file:e.logsFile,e.logsTruncated=!!n.truncated,e.logsLastFetchAt=Date.now()}catch(t){bn(t)?(e.logsEntries=[],e.logsError=xn(`logs`)):e.logsError=String(t)}finally{n||(e.logsLoading=!1)}}}function Rd(e){return typeof e==`string`&&e.trim()?e.trim():null}function zd(e){return Rd(e.nodeId)}function Bd(e){return Rd(e.displayName)??zd(e)??``}function Vd(e){let t=Array.isArray(e?.commands)?e.commands:[];return Array.from(new Set(t.map(e=>Rd(e)).filter(e=>!!e))).toSorted((e,t)=>e.localeCompare(t))}function Hd(e,t){let n=Rd(t);return n?e.find(e=>zd(e)===n)??null:null}function Ud(e){return Vd(e).find(e=>e!==`system.execApprovals.get`&&e!==`system.execApprovals.set`&&e!==`system.run.prepare`)??``}function Wd(e){let t=Hd(e.nodes,e.nodeManagementSelectedId);if(t){let n=Vd(t);(!e.nodeManagementCommand||!n.includes(e.nodeManagementCommand))&&(e.nodeManagementCommand=Ud(t),e.nodeManagementParams=Yd(e.nodeManagementCommand)),e.nodeManagementRename.trim()||(e.nodeManagementRename=Bd(t));return}let n=e.nodes.find(e=>zd(e));if(!n){e.nodeManagementSelectedId=null,e.nodeManagementRename=``,e.nodeManagementCommand=``;return}Qd(e,zd(n)??``)}function Gd(e){let t=e.trim();return t?JSON.parse(t):{}}function Kd(e,t){let n=Number.parseInt(e.trim(),10);return!Number.isFinite(n)||n<=0?t:n}function qd(e){return`${e}:${globalThis.crypto?.randomUUID?.()??`${Date.now()}:${Math.random().toString(36).slice(2)}`}`}function Jd(e,t){return(Rd(e?.platform)?.toLowerCase()??``).startsWith(`win`)?[`cmd.exe`,`/d`,`/s`,`/c`,t]:[`sh`,`-lc`,t]}function Yd(e){return e===`system.which`?`{
175
+ This replaces the current active transcript for the session key.`)}var Bl=[{label:`control`,tabs:[`overview`,`agents`,`chat`,`canvas`,`channels`,`sessions`,`cron`,`models`]},{label:`tools`,tabs:[`skills`,`plugins`,`mcp`,`wallet`,`memory`]}],Vl={agents:`/agents`,overview:`/overview`,canvas:`/canvas`,channels:`/channels`,instances:`/instances`,sessions:`/sessions`,usage:`/usage`,wallet:`/wallet`,cron:`/cron`,skills:`/skills`,mcp:`/mcp`,plugins:`/plugins`,models:`/models`,memory:`/memory`,nodes:`/nodes`,chat:`/chat`,config:`/config`,communications:`/communications`,appearance:`/appearance`,automation:`/automation`,infrastructure:`/infrastructure`,aiAgents:`/ai-agents`,debug:`/debug`,logs:`/logs`,dreams:`/dreaming`},Hl={"/dreams":`dreams`},Ul=new Map([...Object.entries(Vl).map(([e,t])=>[t,e]),...Object.entries(Hl)]);function Wl(e){if(!e)return``;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t===`/`?``:(t.endsWith(`/`)&&(t=t.slice(0,-1)),t)}function Gl(e){if(!e)return`/`;let t=e.trim();return t.startsWith(`/`)||(t=`/${t}`),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function Kl(e,t=``){let n=Wl(t),r=Vl[e];return n?`${n}${r}`:r}function ql(e,t=``){let n=Wl(t),r=e||`/`;n&&(r===n?r=`/`:r.startsWith(`${n}/`)&&(r=r.slice(n.length)));let i=y(Gl(r));return i.endsWith(`/index.html`)&&(i=`/`),i===`/`?`chat`:Ul.get(i)??null}function Jl(e){let t=Gl(e);if(t.endsWith(`/index.html`)&&(t=Gl(t.slice(0,-11))),t===`/`)return``;let n=t.split(`/`).filter(Boolean);if(n.length===0)return``;for(let e=0;e<n.length;e++){let t=y(`/${n.slice(e).join(`/`)}`);if(Ul.has(t)){let t=n.slice(0,e);return t.length?`/${t.join(`/`)}`:``}}return`/${n.join(`/`)}`}function Yl(e){switch(e){case`agents`:return`bot`;case`chat`:return`messageCircle`;case`overview`:return`layoutGrid`;case`canvas`:return`frame`;case`channels`:return`radioTower`;case`instances`:return`radio`;case`sessions`:return`messagesSquare`;case`usage`:return`barChart`;case`wallet`:return`wallet`;case`cron`:return`loader`;case`skills`:return`sparkles`;case`mcp`:return`plug`;case`plugins`:return`blocks`;case`models`:return`cpu`;case`memory`:return`brain`;case`nodes`:return`monitor`;case`config`:return`settings`;case`communications`:return`send`;case`appearance`:return`spark`;case`automation`:return`terminal`;case`infrastructure`:return`globe`;case`aiAgents`:return`brain`;case`debug`:return`bug`;case`logs`:return`scrollText`;case`dreams`:return`moon`;default:return`folder`}}function Xl(e){return p(`tabs.${e}`)}function Zl(e){return p(`subtitles.${e}`)}var Ql=[{id:`read`,label:`read`,description:`Read file contents`,sectionId:`fs`,profiles:[`coding`]},{id:`write`,label:`write`,description:`Create or overwrite files`,sectionId:`fs`,profiles:[`coding`]},{id:`edit`,label:`edit`,description:`Make precise edits`,sectionId:`fs`,profiles:[`coding`]},{id:`apply_patch`,label:`apply_patch`,description:`Patch files`,sectionId:`fs`,profiles:[`coding`]},{id:`exec`,label:`exec`,description:`Run shell commands that start now.`,sectionId:`runtime`,profiles:[`coding`]},{id:`process`,label:`process`,description:`Inspect and control running exec sessions.`,sectionId:`runtime`,profiles:[`coding`]},{id:`code_execution`,label:`code_execution`,description:`Run sandboxed remote analysis`,sectionId:`runtime`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`web_search`,label:`web_search`,description:`Search the web`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`web_fetch`,label:`web_fetch`,description:`Fetch web content`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`x_search`,label:`x_search`,description:`Search X posts`,sectionId:`web`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`memory_search`,label:`memory_search`,description:`Semantic search`,sectionId:`memory`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`memory_get`,label:`memory_get`,description:`Read memory files`,sectionId:`memory`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`sessions_list`,label:`sessions_list`,description:`List visible sessions with mailbox filters and optional previews.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_history`,label:`sessions_history`,description:`Read sanitized message history for a visible session.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_send`,label:`sessions_send`,description:`Send a message to another visible session.`,sectionId:`sessions`,profiles:[`coding`,`messaging`],includeInGenesisGroup:!0},{id:`sessions_spawn`,label:`sessions_spawn`,description:`Spawn sub-agent or ACP sessions.`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`sessions_yield`,label:`sessions_yield`,description:`End turn to receive sub-agent results`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`subagents`,label:`subagents`,description:`Manage sub-agents`,sectionId:`sessions`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`session_status`,label:`session_status`,description:`Show session status, usage, and model state.`,sectionId:`sessions`,profiles:[`minimal`,`coding`,`messaging`],includeInGenesisGroup:!0},{id:`browser`,label:`browser`,description:`Control web browser`,sectionId:`ui`,profiles:[],includeInGenesisGroup:!0},{id:`canvas`,label:`canvas`,description:`Control canvases`,sectionId:`ui`,profiles:[],includeInGenesisGroup:!0},{id:`message`,label:`message`,description:`Send messages`,sectionId:`messaging`,profiles:[`messaging`],includeInGenesisGroup:!0},{id:`cron`,label:`cron`,description:`Schedule cron jobs, reminders, and wake events.`,sectionId:`automation`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`gateway`,label:`gateway`,description:`Gateway control`,sectionId:`automation`,profiles:[],includeInGenesisGroup:!0},{id:`nodes`,label:`nodes`,description:`Nodes + devices`,sectionId:`nodes`,profiles:[],includeInGenesisGroup:!0},{id:`agents_list`,label:`agents_list`,description:`List agents`,sectionId:`agents`,profiles:[],includeInGenesisGroup:!0},{id:`update_plan`,label:`update_plan`,description:`Track a short structured work plan.`,sectionId:`agents`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`image`,label:`image`,description:`Image understanding`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`image_generate`,label:`image_generate`,description:`Image generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`music_generate`,label:`music_generate`,description:`Music generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`video_generate`,label:`video_generate`,description:`Video generation`,sectionId:`media`,profiles:[`coding`],includeInGenesisGroup:!0},{id:`tts`,label:`tts`,description:`Text-to-speech conversion`,sectionId:`media`,profiles:[],includeInGenesisGroup:!0}];new Map(Ql.map(e=>[e.id,e]));function $l(e){return Ql.filter(t=>t.profiles.includes(e)).map(e=>e.id)}var eu={minimal:{allow:$l(`minimal`)},coding:{allow:[...$l(`coding`),`bundle-mcp`]},messaging:{allow:[...$l(`messaging`),`bundle-mcp`]},full:{}};function tu(){let e=new Map;for(let t of Ql){let n=`group:${t.sectionId}`,r=e.get(n)??[];r.push(t.id),e.set(n,r)}return{"group:genesis":Ql.filter(e=>e.includeInGenesisGroup).map(e=>e.id),...Object.fromEntries(e.entries())}}var nu=tu();function ru(e){if(!e)return;let t=eu[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}var iu={bash:`exec`,"apply-patch":`apply_patch`},au={...nu};function ou(e){let t=y(e);return iu[t]??t}function su(e){return e?e.map(ou).filter(Boolean):[]}function cu(e){let t=su(e),n=[];for(let e of t){let t=au[e];if(t){n.push(...t);continue}n.push(e)}return Array.from(new Set(n))}function lu(e){return ru(e)}var uu=[{id:`fs`,label:`Files`,tools:[{id:`read`,label:`read`,description:`Read file contents`},{id:`write`,label:`write`,description:`Create or overwrite files`},{id:`edit`,label:`edit`,description:`Make precise edits`},{id:`apply_patch`,label:`apply_patch`,description:`Patch files (OpenAI)`}]},{id:`runtime`,label:`Runtime`,tools:[{id:`exec`,label:`exec`,description:`Run shell commands`},{id:`process`,label:`process`,description:`Manage background processes`}]},{id:`web`,label:`Web`,tools:[{id:`web_search`,label:`web_search`,description:`Search the web`},{id:`web_fetch`,label:`web_fetch`,description:`Fetch web content`}]},{id:`memory`,label:`Memory`,tools:[{id:`memory_search`,label:`memory_search`,description:`Semantic search`},{id:`memory_get`,label:`memory_get`,description:`Read memory files`}]},{id:`sessions`,label:`Sessions`,tools:[{id:`sessions_list`,label:`sessions_list`,description:`List sessions`},{id:`sessions_history`,label:`sessions_history`,description:`Session history`},{id:`sessions_send`,label:`sessions_send`,description:`Send to session`},{id:`sessions_spawn`,label:`sessions_spawn`,description:`Spawn sub-agent`},{id:`session_status`,label:`session_status`,description:`Session status`}]},{id:`ui`,label:`UI`,tools:[{id:`browser`,label:`browser`,description:`Control web browser`},{id:`canvas`,label:`canvas`,description:`Control canvases`}]},{id:`messaging`,label:`Messaging`,tools:[{id:`message`,label:`message`,description:`Send messages`}]},{id:`automation`,label:`Automation`,tools:[{id:`cron`,label:`cron`,description:`Schedule tasks`},{id:`gateway`,label:`gateway`,description:`Gateway control`}]},{id:`nodes`,label:`Nodes`,tools:[{id:`nodes`,label:`nodes`,description:`Nodes + devices`}]},{id:`agents`,label:`Agents`,tools:[{id:`agents_list`,label:`agents_list`,description:`List agents`}]},{id:`media`,label:`Media`,tools:[{id:`image`,label:`image`,description:`Image understanding`}]}],du=[{id:`minimal`,label:`Minimal`},{id:`coding`,label:`Coding`},{id:`messaging`,label:`Messaging`},{id:`full`,label:`Full`}];function fu(e){return e?.groups?.length?e.groups.map(e=>({id:e.id,label:e.label,source:e.source,pluginId:e.pluginId,tools:e.tools.map(e=>({id:e.id,label:e.label,description:e.description,source:e.source,pluginId:e.pluginId,optional:e.optional,defaultProfiles:[...e.defaultProfiles]}))})):uu}function pu(e){return e?.profiles?.length?e.profiles:du}function mu(e){return v(e.name)??v(e.identity?.name)??e.id}var hu=/^(data:image\/|\/(?!\/))/i;function gu(e){return hu.test(e)}function _u(e,t){let n=[v(t?.avatar),v(e.identity?.avatarUrl),v(e.identity?.avatar)];for(let e of n)if(e&&gu(e))return e;return null}function vu(e,t,n){let r=v(e);return r?.startsWith(`blob:`)?r:_u(t,n)}function yu(e){let t=v(e)?.replace(/\/$/,``)??``;return t?`${t}/favicon.svg`:`favicon.svg`}function bu(e,t){return t&&e===t?`default`:null}function xu(e,t){let n=e;return{entry:(n?.agents?.list??[]).find(e=>e?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function Su(e,t,n,r,i){let a=xu(t,e.id),o=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||e.workspace||`default`,s=a.entry?.model?Cu(a.entry?.model):a.defaults?.model?Cu(a.defaults?.model):Cu(e.model),c=v(i?.name)||v(e.identity?.name)||v(e.name)||a.entry?.name||e.id,l=_u(e,i)?`custom`:`—`,u=Array.isArray(a.entry?.skills)?a.entry?.skills:null,d=u?.length??null;return{workspace:o,model:s,identityName:c,identityAvatar:l,skillsLabel:u?`${d} selected`:`all skills`,isDefault:!!(r&&e.id===r)}}function Cu(e){if(!e)return`-`;if(typeof e==`string`)return v(e)||`-`;if(typeof e==`object`&&e){let t=e,n=v(t.primary);if(n){let e=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return e>0?`${n} (+${e} fallback)`:n}}return`-`}function wu(e){let t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function Tu(e){if(!e)return null;if(typeof e==`string`)return v(e)||null;if(typeof e==`object`&&e){let t=e;return v(typeof t.primary==`string`?t.primary:typeof t.model==`string`?t.model:typeof t.id==`string`?t.id:typeof t.value==`string`?t.value:null)||null}return null}function Eu(e){if(!e||typeof e==`string`)return null;if(typeof e==`object`&&e){let t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(e=>typeof e==`string`):null}return null}function Du(e,t){return Eu(e)??Eu(t)}function Ou(e,t){if(typeof t!=`string`)return;let n=t.trim();n&&e.add(n)}function ku(e,t){if(!t)return;if(typeof t==`string`){Ou(e,t);return}if(typeof t!=`object`)return;let n=t;Ou(e,n.primary),Ou(e,n.model),Ou(e,n.id),Ou(e,n.value);let r=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(let t of r)Ou(e,t)}function Au(e){let t=Array.from(e),n=Array.from({length:t.length},()=>``),r=(e,r,i)=>{let a=e,o=r,s=e;for(;a<r&&o<i;)n[s++]=t[a].localeCompare(t[o])<=0?t[a++]:t[o++];for(;a<r;)n[s++]=t[a++];for(;o<i;)n[s++]=t[o++];for(let r=e;r<i;r+=1)t[r]=n[r]},i=(e,t)=>{if(t-e<=1)return;let n=e+t>>>1;i(e,n),i(n,t),r(e,n,t)};return i(0,t.length),t}function ju(e){if(!e||typeof e!=`object`)return[];let t=e.agents;if(!t||typeof t!=`object`)return[];let n=new Set,r=t.defaults;if(r&&typeof r==`object`){let e=r;ku(n,e.model);let t=e.models;if(t&&typeof t==`object`)for(let e of Object.keys(t))Ou(n,e)}let i=t.list;if(i&&typeof i==`object`)for(let e of Object.values(i))!e||typeof e!=`object`||ku(n,e.model);return Au(n)}function Mu(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function Nu(e){let t=e?.agents?.defaults?.models;if(!t||typeof t!=`object`)return[];let n=[];for(let[e,r]of Object.entries(t)){let t=e.trim();if(!t)continue;let i=r&&typeof r==`object`&&`alias`in r&&typeof r.alias==`string`?r.alias?.trim():void 0,a=i&&i!==t?`${i} (${t})`:t;n.push({value:t,label:a})}return n}function Pu(e,t,n){let r=new Set,a=[],o=(e,t)=>{let n=y(e);r.has(n)||(r.add(n),a.push({value:e,label:t}))};for(let t of Nu(e))o(t.value,t.label);if(n)for(let e of n){let t=e.provider?.trim();o(t?`${t}/${e.id}`:e.id,t?`${e.id} · ${t}`:e.id)}return t&&!r.has(y(t))&&a.unshift({value:t,label:`Current (${t})`}),a.length===0?g:a.map(e=>i`<option value=${e.value}>${e.label}</option>`)}function Fu(e){let t=ou(e);if(!t)return{kind:`exact`,value:``};if(t===`*`)return{kind:`all`};if(!t.includes(`*`))return{kind:`exact`,value:t};let n=t.replace(/[.*+?^${}()|[\\]\\]/g,`\\$&`);return{kind:`regex`,value:RegExp(`^${n.replaceAll(`\\*`,`.*`)}$`)}}function Iu(e){return Array.isArray(e)?cu(e).map(Fu).filter(e=>e.kind!==`exact`||e.value.length>0):[]}function Lu(e,t){for(let n of t)if(n.kind===`all`||n.kind===`exact`&&e===n.value||n.kind===`regex`&&n.value.test(e))return!0;return!1}function Ru(e,t){if(!t)return!0;let n=ou(e);if(Lu(n,Iu(t.deny)))return!1;let r=Iu(t.allow);return!!(r.length===0||Lu(n,r)||n===`apply_patch`&&Lu(`exec`,r))}function zu(e,t){if(!Array.isArray(t)||t.length===0)return!1;let n=ou(e),r=Iu(t);return!!(Lu(n,r)||n===`apply_patch`&&Lu(`exec`,r))}function Bu(e){return lu(e)??void 0}function Vu(e){return e.chatSending||!!e.chatRunId}function Hu(e){let t=e.trim();if(!t)return!1;let n=y(t);return n===`/stop`?!0:n===`stop`||n===`esc`||n===`abort`||n===`wait`||n===`exit`}function Uu(e){let t=e.trim();if(!t)return!1;let n=y(t);return n===`/new`||n===`/reset`?!0:n.startsWith(`/new `)||n.startsWith(`/reset `)}function Wu(e){return/^\/btw(?::|\s|$)/i.test(e.trim())}async function Gu(e){if(!e.connected&&e.chatRunId){e.chatMessage=``,e.pendingAbort={runId:e.chatRunId,sessionKey:e.sessionKey};return}e.connected&&(e.chatMessage=``,await gl(e))}function Ku(e,t,n,r,i){let a=t.trim(),o=!!(n&&n.length>0);!a&&!o||(e.chatQueue=[...e.chatQueue,{id:sn(),text:a,createdAt:Date.now(),attachments:o?n?.map(e=>({...e})):void 0,refreshSessions:r,localCommandArgs:i?.args,localCommandName:i?.name}])}function qu(e,t,n,r){let i=t.trim(),a=!!(r&&r.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:sn(),text:i,createdAt:Date.now(),kind:`steered`,attachments:a?r?.map(e=>({...e})):void 0,pendingRunId:n}])}async function Ju(e,t,n){Ai(e),ai(e);let r=await pl(e,t,n?.attachments),i=!!r;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Qr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),ti(e,!0),i&&!e.chatRunId&&Zu(e),i&&n?.refreshSessions&&r&&e.refreshSessionsAfterChat.add(r),i}async function Yu(e,t,n){let r=!!await ml(e,t,n?.attachments);return!r&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!r&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),r&&Qr(e,e.sessionKey),r}async function Xu(e,t){if(!e.connected||!e.chatRunId)return;let n=e.chatRunId,r=e.chatQueue.find(e=>e.id===t&&!e.pendingRunId&&!e.localCommandName);if(!r)return;let i=r.text.trim(),a=r.attachments??[],o=a.length>0;if(!(!i&&!o)){if(e.chatQueue=e.chatQueue.map(e=>e.id===t?{...e,kind:`steered`,pendingRunId:n}:e),!await hl(e,i,o?a:void 0)){e.chatQueue=e.chatQueue.map(e=>e.id===t?r:e);return}Qr(e,e.sessionKey),ti(e)}}async function Zu(e){if(!e.connected||Vu(e))return;let t=e.chatQueue.findIndex(e=>!e.pendingRunId);if(t<0)return;let n=e.chatQueue[t];e.chatQueue=e.chatQueue.filter((e,n)=>n!==t);let r=!1;try{n.localCommandName?(await nd(e,n.localCommandName,n.localCommandArgs??``),r=!0):r=await Ju(e,n.text,{attachments:n.attachments,refreshSessions:n.refreshSessions})}catch(t){e.lastError=String(t)}r?e.chatQueue.length>0&&Zu(e):e.chatQueue=[n,...e.chatQueue]}function Qu(e,t){e.chatQueue=e.chatQueue.filter(e=>e.id!==t)}function $u(e,t){t&&(e.chatQueue=e.chatQueue.filter(e=>e.pendingRunId!==t))}async function ed(e,t,n){if(!e.connected)return;let r=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],s=o.length>0;if(!i&&!s)return;if(Hu(i)){await Gu(e);return}if(Wu(i)){t??(e.chatMessage=``,e.chatAttachments=[]),await Yu(e,i,{previousDraft:t==null?r:void 0,attachments:s?o:void 0,previousAttachments:t==null?a:void 0});return}let c=Uo(i);if(c?.command.executeLocal){if(Vu(e)&&td(c.command.key)){t??(e.chatMessage=``,e.chatAttachments=[]),Ku(e,i,void 0,Uu(i),{args:c.args,name:c.command.key});return}let a=t==null?r:void 0;t??(e.chatMessage=``,e.chatAttachments=[]),await nd(e,c.command.key,c.args,{previousDraft:a,restoreDraft:!!(t&&n?.restoreDraft)});return}let l=Uu(i);if(t??(e.chatMessage=``,e.chatAttachments=[]),Vu(e)){Ku(e,i,o,l);return}await Ju(e,i,{previousDraft:t==null?r:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:s?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:l})}function td(e){return![`stop`,`focus`,`export-session`,`steer`,`redirect`].includes(e)}async function nd(e,t,n,r){switch(t){case`stop`:await Gu(e);return;case`new`:await Ju(e,`/new`,{refreshSessions:!0,previousDraft:r?.previousDraft,restoreDraft:r?.restoreDraft});return;case`reset`:await Ju(e,`/reset`,{refreshSessions:!0,previousDraft:r?.previousDraft,restoreDraft:r?.restoreDraft});return;case`clear`:await rd(e);return;case`focus`:e.onSlashAction?.(`toggle-focus`);return;case`export-session`:e.onSlashAction?.(`export`);return}if(!e.client)return;let i=e.sessionKey,a=await Go(e.client,i,t,n,{chatModelCatalog:e.chatModelCatalog,sessionsResult:e.sessionsResult});a.content&&id(e,a.content),a.trackRunId&&(e.chatRunId=a.trackRunId,e.chatStream=``,e.chatSending=!1),a.pendingCurrentRun&&e.chatRunId&&qu(e,`/${t} ${n}`.trim(),e.chatRunId),a.sessionPatch&&`modelOverride`in a.sessionPatch&&(e.chatModelOverrides={...e.chatModelOverrides,[i]:a.sessionPatch.modelOverride??null},e.onSlashAction?.(`refresh-tools-effective`)),a.action===`refresh`&&await ad(e),ti(e)}async function rd(e){if(!(!e.client||!e.connected)){try{await e.client.request(`sessions.reset`,{key:e.sessionKey}),e.chatMessages=[],e.chatSideResult=null,e.chatSideResultTerminalRuns?.clear(),e.chatStream=null,e.chatRunId=null,await ol(e)}catch(t){e.lastError=String(t)}ti(e)}}function id(e,t){e.chatMessages=[...e.chatMessages,{role:`system`,content:t,timestamp:Date.now()}]}async function ad(e,t){await Promise.all([ol(e),Nl(e,{activeMinutes:0,limit:0,includeGlobal:!0,includeUnknown:!0}),yd(e),od(e),sd(e)]),t?.scheduleScroll!==!1&&ti(e)}async function od(e){if(!e.client||!e.connected){e.chatModelsLoading=!1,e.chatModelCatalog=[];return}e.chatModelsLoading=!0;try{e.chatModelCatalog=await vl(e.client)}finally{e.chatModelsLoading=!1}}async function sd(e){await Lo({client:e.client,agentId:pd(e)})}var cd=Zu,ld=new WeakMap,ud=new WeakMap;function dd(e){let t=e,n=(ld.get(t)??0)+1;return ld.set(t,n),n}function fd(e,t,n){return ld.get(e)===t&&e.sessionKey===n}function pd(e){let t=la(e.sessionKey);return t?.agentId?t.agentId:(e.hello?.snapshot)?.sessionDefaults?.defaultAgentId?.trim()||`main`}function md(e,t){let n=Wl(e),r=encodeURIComponent(t);return n?`${n}/avatar/${r}?meta=1`:`/avatar/${r}?meta=1`}function hd(e){let t=e,n=ud.get(t);n&&(URL.revokeObjectURL(n),ud.delete(t)),e.chatAvatarUrl=null}function gd(e,t){let n=e,r=ud.get(n);r&&r!==t&&(URL.revokeObjectURL(r),ud.delete(n)),t?.startsWith(`blob:`)&&ud.set(n,t),e.chatAvatarUrl=t}function _d(e){return e?{Authorization:e}:void 0}function vd(e){return e.startsWith(`/`)}async function yd(e){if(!e.connected){hd(e);return}let t=e.sessionKey,n=dd(e),r=pd(e);if(!r){fd(e,n,t)&&hd(e);return}hd(e);let i=ue(e),a=_d(i),o=md(e.basePath,r);try{let r=await fetch(o,{method:`GET`,...a?{headers:a}:{}});if(!fd(e,n,t))return;if(!r.ok){hd(e);return}let s=await r.json();if(!fd(e,n,t))return;let c=typeof s.avatarUrl==`string`?s.avatarUrl.trim():``;if(!c||!gu(c)){hd(e);return}if(!i||!vd(c)){gd(e,c);return}let l=await fetch(c,{method:`GET`,headers:{Authorization:i}});if(!l.ok){fd(e,n,t)&&hd(e);return}let u=URL.createObjectURL(await l.blob());if(!fd(e,n,t)){URL.revokeObjectURL(u);return}gd(e,u)}catch{fd(e,n,t)&&hd(e)}}var bd={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},xd={name:``,description:``,agentId:``,sessionKey:``,clearAgent:!1,enabled:!0,deleteAfterRun:!0,scheduleKind:`every`,scheduleAt:``,everyAmount:`30`,everyUnit:`minutes`,cronExpr:`0 7 * * *`,cronTz:``,scheduleExact:!1,staggerAmount:``,staggerUnit:`seconds`,sessionTarget:`isolated`,wakeMode:`now`,payloadKind:`agentTurn`,payloadText:``,payloadModel:``,payloadThinking:``,payloadLightContext:!1,deliveryMode:`announce`,deliveryChannel:`last`,deliveryTo:``,deliveryAccountId:``,deliveryBestEffort:!1,failureAlertMode:`inherit`,failureAlertAfter:`2`,failureAlertCooldownSeconds:`3600`,failureAlertChannel:`last`,failureAlertTo:``,failureAlertDeliveryMode:`announce`,failureAlertAccountId:``,timeoutSeconds:``},Sd=`operator`,Cd=`operator.admin`,wd=`operator.read`,Td=`operator.write`,Ed=`operator.`;function Dd(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Od(e,t){return e.startsWith(Ed)?t.has(Cd)?!0:e===wd?t.has(wd)||t.has(Td):e===Td?t.has(Td):t.has(e):!1}function kd(e){let t=Dd(e.requestedScopes);if(t.length===0)return!0;let n=Dd(e.allowedScopes);if(n.length===0)return!1;let r=new Set(n);if(e.role.trim()!==Sd){let n=`${e.role.trim()}.`;return t.every(e=>e.startsWith(n)&&r.has(e))}return t.every(e=>Od(e,r))}async function Ad(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{let[t,n,r,i]=await Promise.all([e.client.request(`status`,{}),e.client.request(`health`,{}),e.client.request(`models.list`,{}),e.client.request(`last-heartbeat`,{})]);e.debugStatus=t,e.debugHealth=n;let a=r;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function jd(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{let t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}var Md=2e3,Nd=new Set([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);function Pd(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;try{let e=JSON.parse(t);return e&&typeof e==`object`?e:null}catch{return null}}function Fd(e){if(typeof e!=`string`)return null;let t=y(e);return Nd.has(t)?t:null}function Id(e){if(!e.trim())return{raw:e,message:e};try{let t=JSON.parse(e),n=t&&typeof t._meta==`object`&&t._meta!==null?t._meta:null,r=typeof t.time==`string`?t.time:typeof n?.date==`string`?n?.date:null,i=Fd(n?.logLevelName??n?.level),a=typeof t[0]==`string`?t[0]:typeof n?.name==`string`?n?.name:null,o=Pd(a),s=typeof o?.subsystem==`string`?o.subsystem:typeof o?.module==`string`?o.module:null;!s&&a&&a.length<120&&(s=a);let c=typeof t[1]==`string`?t[1]:typeof t[2]==`string`?t[2]:!o&&typeof t[0]==`string`?t[0]:typeof t.message==`string`?t.message:e;return{raw:e,time:r,level:i,subsystem:s,message:c,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ld(e,t){let n=t?.quiet===!0;if(!(!e.client||!e.connected||e.logsLoading&&!n)){n||(e.logsLoading=!0),e.logsError=null;try{let n=await e.client.request(`logs.tail`,{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(n.lines)?n.lines.filter(e=>typeof e==`string`):[]).map(Id);e.logsEntries=t?.reset||n.reset||e.logsCursor==null?r:[...e.logsEntries,...r].slice(-Md),e.logsCursor=typeof n.cursor==`number`?n.cursor:e.logsCursor,e.logsFile=typeof n.file==`string`?n.file:e.logsFile,e.logsTruncated=!!n.truncated,e.logsLastFetchAt=Date.now()}catch(t){bn(t)?(e.logsEntries=[],e.logsError=xn(`logs`)):e.logsError=String(t)}finally{n||(e.logsLoading=!1)}}}function Rd(e){return typeof e==`string`&&e.trim()?e.trim():null}function zd(e){return Rd(e.nodeId)}function Bd(e){return Rd(e.displayName)??zd(e)??``}function Vd(e){let t=Array.isArray(e?.commands)?e.commands:[];return Array.from(new Set(t.map(e=>Rd(e)).filter(e=>!!e))).toSorted((e,t)=>e.localeCompare(t))}function Hd(e,t){let n=Rd(t);return n?e.find(e=>zd(e)===n)??null:null}function Ud(e){return Vd(e).find(e=>e!==`system.execApprovals.get`&&e!==`system.execApprovals.set`&&e!==`system.run.prepare`)??``}function Wd(e){let t=Hd(e.nodes,e.nodeManagementSelectedId);if(t){let n=Vd(t);(!e.nodeManagementCommand||!n.includes(e.nodeManagementCommand))&&(e.nodeManagementCommand=Ud(t),e.nodeManagementParams=Yd(e.nodeManagementCommand)),e.nodeManagementRename.trim()||(e.nodeManagementRename=Bd(t));return}let n=e.nodes.find(e=>zd(e));if(!n){e.nodeManagementSelectedId=null,e.nodeManagementRename=``,e.nodeManagementCommand=``;return}Qd(e,zd(n)??``)}function Gd(e){let t=e.trim();return t?JSON.parse(t):{}}function Kd(e,t){let n=Number.parseInt(e.trim(),10);return!Number.isFinite(n)||n<=0?t:n}function qd(e){return`${e}:${globalThis.crypto?.randomUUID?.()??`${Date.now()}:${Math.random().toString(36).slice(2)}`}`}function Jd(e,t){return(Rd(e?.platform)?.toLowerCase()??``).startsWith(`win`)?[`cmd.exe`,`/d`,`/s`,`/c`,t]:[`sh`,`-lc`,t]}function Yd(e){return e===`system.which`?`{
176
176
  "bins": ["genesis", "node", "pnpm"]
177
177
  }`:e===`system.run`?`{
178
178
  "command": ["genesis", "--version"]
@@ -194,6 +194,65 @@ This replaces the current active transcript for the session key.`)}var Bl=[{labe
194
194
  <svg viewBox="0 0 24 24">
195
195
  <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
196
196
  </svg>
197
+ `,layoutGrid:i`
198
+ <svg viewBox="0 0 24 24">
199
+ <rect width="7" height="7" x="3" y="3" rx="1" />
200
+ <rect width="7" height="7" x="14" y="3" rx="1" />
201
+ <rect width="7" height="7" x="14" y="14" rx="1" />
202
+ <rect width="7" height="7" x="3" y="14" rx="1" />
203
+ </svg>
204
+ `,bot:i`
205
+ <svg viewBox="0 0 24 24">
206
+ <path d="M12 8V4H8" />
207
+ <rect width="16" height="12" x="4" y="8" rx="2" />
208
+ <path d="M2 14h2" />
209
+ <path d="M20 14h2" />
210
+ <path d="M15 13v2" />
211
+ <path d="M9 13v2" />
212
+ </svg>
213
+ `,messageCircle:i`
214
+ <svg viewBox="0 0 24 24">
215
+ <path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z" />
216
+ </svg>
217
+ `,frame:i`
218
+ <svg viewBox="0 0 24 24">
219
+ <line x1="22" x2="2" y1="6" y2="6" />
220
+ <line x1="22" x2="2" y1="18" y2="18" />
221
+ <line x1="6" x2="6" y1="2" y2="22" />
222
+ <line x1="18" x2="18" y1="2" y2="22" />
223
+ </svg>
224
+ `,radioTower:i`
225
+ <svg viewBox="0 0 24 24">
226
+ <path d="M4.9 16.1C1 12.2 1 5.8 4.9 1.9" />
227
+ <path d="M7.8 4.7a6.14 6.14 0 0 0-.8 7.5" />
228
+ <circle cx="12" cy="9" r="2" />
229
+ <path d="M16.2 4.8c2 2 2.26 5.11.8 7.47" />
230
+ <path d="M19.1 1.9a9.96 9.96 0 0 1 0 14.1" />
231
+ <path d="M9.5 18h5" />
232
+ <path d="m8 22 4-11 4 11" />
233
+ </svg>
234
+ `,messagesSquare:i`
235
+ <svg viewBox="0 0 24 24">
236
+ <path d="M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z" />
237
+ <path d="M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1" />
238
+ </svg>
239
+ `,sparkles:i`
240
+ <svg viewBox="0 0 24 24">
241
+ <path
242
+ d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .962 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.962 0z"
243
+ />
244
+ <path d="M20 3v4" />
245
+ <path d="M22 5h-4" />
246
+ <path d="M4 17v2" />
247
+ <path d="M5 18H3" />
248
+ </svg>
249
+ `,blocks:i`
250
+ <svg viewBox="0 0 24 24">
251
+ <rect width="7" height="7" x="14" y="3" rx="1" />
252
+ <path
253
+ d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"
254
+ />
255
+ </svg>
197
256
  `,barChart:i`
198
257
  <svg viewBox="0 0 24 24">
199
258
  <line x1="12" x2="12" y1="20" y2="10" />
@@ -6026,7 +6085,7 @@ ${e.pluginDescription}</pre
6026
6085
  ${bF({events:e.eventLog})}
6027
6086
  ${OF({lines:e.overviewLogLines,onRefreshLogs:e.onRefreshLogs})}
6028
6087
  </div>
6029
- `}function PF(e){return Nl(e,{search:e.sessionsSearchQuery})}function FF(e){!e.client||!e.connected||e.modelsLoading||e.chatModelCatalog.length>0||(e.modelsLoading=!0,vl(e.client).then(t=>{e.chatModelCatalog=t}).finally(()=>{e.modelsLoading=!1}))}function IF(e){let t=e.agentsSelectedId??e.assistantAgentId;!e.client||!e.connected||e.memoryLoading||!t||e.memoryEntries.length>0||(e.memoryLoading=!0,e.memoryError=null,Bj(e.client,t).then(t=>{e.memoryEntries=t}).catch(t=>{e.memoryError=String(t)}).finally(()=>{e.memoryLoading=!1}))}var LF;function RF(e){return e instanceof Error&&e.message?e.message:String(e)}function zF(e){let t={mod:null,promise:null,error:null},n=()=>t.promise?t.promise:t.mod?Promise.resolve():(t.error=null,t.promise=e().then(e=>{t.mod=e}).catch(e=>{t.error=RF(e),console.error(`[genesis] failed to load Control UI view:`,e)}).finally(()=>{t.promise=null,LF?.()}),t.promise);return()=>t.mod?{status:`ready`,mod:t.mod}:(!t.promise&&!t.error&&n(),t.error?{status:`error`,message:t.error,retry:()=>{t.error=null,n(),LF?.()}}:{status:`loading`,promise:t.promise??n()})}var BF=zF(()=>d(()=>import(`./agents-CdobtTOW.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),VF=zF(()=>d(()=>import(`./canvas-Cy2AiGPQ.js`),__vite__mapDeps([6,1]),import.meta.url)),HF=zF(()=>d(()=>import(`./channels-DdgVKbNz.js`),__vite__mapDeps([7,1,2,3,4]),import.meta.url)),UF=zF(()=>d(()=>import(`./cron-CCNOjNyY.js`),__vite__mapDeps([8,1,2,3]),import.meta.url)),WF=zF(()=>d(()=>import(`./debug-B8lJz0xl.js`),__vite__mapDeps([9,1]),import.meta.url)),GF=zF(()=>d(()=>import(`./instances-DRlIDzRt.js`),__vite__mapDeps([10,1]),import.meta.url)),KF=zF(()=>d(()=>import(`./logs-BYrqUHTd.js`),__vite__mapDeps([11,1,3]),import.meta.url)),qF=zF(()=>d(()=>import(`./mcp-C7ry874X.js`),__vite__mapDeps([12,1]),import.meta.url)),JF=zF(()=>d(()=>import(`./models-WJk_luH_.js`),__vite__mapDeps([13,1]),import.meta.url)),YF=zF(()=>d(()=>import(`./memory-Dk8DVFlc.js`),__vite__mapDeps([14,1]),import.meta.url)),XF=zF(()=>d(()=>import(`./nodes-SWmxABM8.js`),__vite__mapDeps([15,1,2,3]),import.meta.url)),ZF=zF(()=>d(()=>import(`./plugins-bulpMEFW.js`),__vite__mapDeps([16,1,2,3]),import.meta.url)),QF=zF(()=>d(()=>import(`./sessions-bCilYtM1.js`),__vite__mapDeps([17,1,2,3]),import.meta.url)),$F=zF(()=>d(()=>import(`./skills-C1LNGjhW.js`),__vite__mapDeps([18,1,2,3,5]),import.meta.url)),eI=zF(()=>d(()=>import(`./wallet-BwqvP_oc.js`),__vite__mapDeps([19,1,2,3]),import.meta.url));async function tI(e,t){let n=await Tm(e,t);n&&(e.mcpOAuthFlow=n,e.mcpOAuthPopup=VT(n.authorizeUrl,`mcp-oauth-${encodeURIComponent(t)}`,`width=520,height=720,noopener=no`))}function nI(e){return typeof e!=`number`||!Number.isFinite(e)?null:new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function rI(e){if(!e?.phases)return null;let t;for(let n of Object.values(e.phases))!n.enabled||typeof n.nextRunAtMs!=`number`||(t===void 0||n.nextRunAtMs<t)&&(t=n.nextRunAtMs);return nI(t)}var iI=null,aI=null;function oI(){return i`
6088
+ `}function PF(e){return Nl(e,{search:e.sessionsSearchQuery})}function FF(e){!e.client||!e.connected||e.modelsLoading||e.chatModelCatalog.length>0||(e.modelsLoading=!0,vl(e.client).then(t=>{e.chatModelCatalog=t}).finally(()=>{e.modelsLoading=!1}))}function IF(e){let t=e.agentsSelectedId??e.assistantAgentId;!e.client||!e.connected||e.memoryLoading||!t||e.memoryEntries.length>0||(e.memoryLoading=!0,e.memoryError=null,Bj(e.client,t).then(t=>{e.memoryEntries=t}).catch(t=>{e.memoryError=String(t)}).finally(()=>{e.memoryLoading=!1}))}var LF;function RF(e){return e instanceof Error&&e.message?e.message:String(e)}function zF(e){let t={mod:null,promise:null,error:null},n=()=>t.promise?t.promise:t.mod?Promise.resolve():(t.error=null,t.promise=e().then(e=>{t.mod=e}).catch(e=>{t.error=RF(e),console.error(`[genesis] failed to load Control UI view:`,e)}).finally(()=>{t.promise=null,LF?.()}),t.promise);return()=>t.mod?{status:`ready`,mod:t.mod}:(!t.promise&&!t.error&&n(),t.error?{status:`error`,message:t.error,retry:()=>{t.error=null,n(),LF?.()}}:{status:`loading`,promise:t.promise??n()})}var BF=zF(()=>d(()=>import(`./agents-BoHSZPvB.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),VF=zF(()=>d(()=>import(`./canvas-DkuTKNbN.js`),__vite__mapDeps([6,1]),import.meta.url)),HF=zF(()=>d(()=>import(`./channels-v0P0irqY.js`),__vite__mapDeps([7,1,2,3,4]),import.meta.url)),UF=zF(()=>d(()=>import(`./cron-DD6CAXar.js`),__vite__mapDeps([8,1,2,3]),import.meta.url)),WF=zF(()=>d(()=>import(`./debug-CuUlTIAC.js`),__vite__mapDeps([9,1]),import.meta.url)),GF=zF(()=>d(()=>import(`./instances-BIg5DC8B.js`),__vite__mapDeps([10,1]),import.meta.url)),KF=zF(()=>d(()=>import(`./logs-BYrqUHTd.js`),__vite__mapDeps([11,1,3]),import.meta.url)),qF=zF(()=>d(()=>import(`./mcp-CfklVyVu.js`),__vite__mapDeps([12,1]),import.meta.url)),JF=zF(()=>d(()=>import(`./models-DmHuwChH.js`),__vite__mapDeps([13,1]),import.meta.url)),YF=zF(()=>d(()=>import(`./memory-Dxu2hVW_.js`),__vite__mapDeps([14,1]),import.meta.url)),XF=zF(()=>d(()=>import(`./nodes-BAHmvdL1.js`),__vite__mapDeps([15,1,2,3]),import.meta.url)),ZF=zF(()=>d(()=>import(`./plugins-CaVRS7jh.js`),__vite__mapDeps([16,1,2,3]),import.meta.url)),QF=zF(()=>d(()=>import(`./sessions-TU5OCoQU.js`),__vite__mapDeps([17,1,2,3]),import.meta.url)),$F=zF(()=>d(()=>import(`./skills-CC23LxGO.js`),__vite__mapDeps([18,1,2,3,5]),import.meta.url)),eI=zF(()=>d(()=>import(`./wallet-DggW1ZUc.js`),__vite__mapDeps([19,1,2,3]),import.meta.url));async function tI(e,t){let n=await Tm(e,t);n&&(e.mcpOAuthFlow=n,e.mcpOAuthPopup=VT(n.authorizeUrl,`mcp-oauth-${encodeURIComponent(t)}`,`width=520,height=720,noopener=no`))}function nI(e){return typeof e!=`number`||!Number.isFinite(e)?null:new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function rI(e){if(!e?.phases)return null;let t;for(let n of Object.values(e.phases))!n.enabled||typeof n.nextRunAtMs!=`number`||(t===void 0||n.nextRunAtMs<t)&&(t=n.nextRunAtMs);return nI(t)}var iI=null,aI=null;function oI(){return i`
6030
6089
  <section class="card">
6031
6090
  <div class="muted">${p(`common.loading`)}</div>
6032
6091
  </section>
@@ -6090,7 +6149,6 @@ ${e.pluginDescription}</pre
6090
6149
  alt="Genesis"
6091
6150
  />
6092
6151
  <span class="sidebar-brand__copy">
6093
- <span class="sidebar-brand__eyebrow">${p(`nav.control`)}</span>
6094
6152
  <span class="sidebar-brand__title">Genesis</span>
6095
6153
  </span>
6096
6154
  `}
@@ -6111,7 +6169,7 @@ ${e.pluginDescription}</pre
6111
6169
  <nav class="sidebar-nav">
6112
6170
  ${Bl.map(t=>{let n=e.settings.navGroupsCollapsed[t.label]??!1,r=t.tabs.some(t=>t===e.tab),a=d||r||!n;return i`
6113
6171
  <section class="nav-section ${a?``:`nav-section--collapsed`}">
6114
- ${d?g:i`
6172
+ ${!d&&t.label!==`control`?i`
6115
6173
  <button
6116
6174
  class="nav-section__label"
6117
6175
  @click=${()=>{let r={...e.settings.navGroupsCollapsed};r[t.label]=!n,e.applySettings({...e.settings,navGroupsCollapsed:r})}}
@@ -6122,7 +6180,7 @@ ${e.pluginDescription}</pre
6122
6180
  >
6123
6181
  <span class="nav-section__chevron"> ${J.chevronDown} </span>
6124
6182
  </button>
6125
- `}
6183
+ `:g}
6126
6184
  <div class="nav-section__items">
6127
6185
  ${t.tabs.map(t=>Dj(e,t,{collapsed:d}))}
6128
6186
  </div>
@@ -6132,6 +6190,15 @@ ${e.pluginDescription}</pre
6132
6190
  </div>
6133
6191
  <div class="sidebar-shell__footer">
6134
6192
  <div class="sidebar-utility-group">
6193
+ <a
6194
+ class="nav-item ${e.tab===`config`?`nav-item--active`:``}"
6195
+ href=${Kl(`config`,e.basePath)}
6196
+ @click=${t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),e.setTab(`config`))}}
6197
+ title=${p(`nav.settings`)}
6198
+ >
6199
+ <span class="nav-item__icon" aria-hidden="true">${J.settings}</span>
6200
+ ${d?g:i`<span class="nav-item__text">${p(`nav.settings`)}</span>`}
6201
+ </a>
6135
6202
  <a
6136
6203
  class="nav-item nav-item--external sidebar-utility-link"
6137
6204
  href="https://genesis.pixelzx.com/docs"
@@ -6244,4 +6311,4 @@ ${e.pluginDescription}</pre
6244
6311
  }`,this.nodeManagementShell=`genesis --version`,this.nodeManagementCwd=``,this.nodeManagementTimeoutMs=`120000`,this.nodeManagementBusy=!1,this.nodeManagementError=null,this.nodeManagementResult=null,this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget=`gateway`,this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.pendingGatewayToken=null,this.configLoading=!1,this.configRaw=`{
6245
6312
  }
6246
6313
  `,this.configRawOriginal=``,this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configRestartPrompt=null,this.dreamingStatusLoading=!1,this.dreamingStatusError=null,this.dreamingStatus=null,this.dreamingModeSaving=!1,this.dreamDiaryLoading=!1,this.dreamDiaryActionLoading=!1,this.dreamDiaryActionMessage=null,this.dreamDiaryActionArchivePath=null,this.dreamDiaryError=null,this.dreamDiaryPath=null,this.dreamDiaryContent=null,this.wikiImportInsightsLoading=!1,this.wikiImportInsightsError=null,this.wikiImportInsights=null,this.wikiMemoryPalaceLoading=!1,this.wikiMemoryPalaceError=null,this.wikiMemoryPalace=null,this.configFormDirty=!1,this.configSettingsMode=`quick`,this.configFormMode=`form`,this.configSearchQuery=``,this.configActiveSection=null,this.configActiveSubsection=null,this.communicationsFormMode=`form`,this.communicationsSearchQuery=``,this.communicationsActiveSection=null,this.communicationsActiveSubsection=null,this.appearanceFormMode=`form`,this.appearanceSearchQuery=``,this.appearanceActiveSection=null,this.appearanceActiveSubsection=null,this.automationFormMode=`form`,this.automationSearchQuery=``,this.automationActiveSection=null,this.automationActiveSubsection=null,this.infrastructureFormMode=`form`,this.infrastructureSearchQuery=``,this.infrastructureActiveSection=null,this.infrastructureActiveSubsection=null,this.aiAgentsFormMode=`form`,this.aiAgentsSearchQuery=``,this.aiAgentsActiveSection=null,this.aiAgentsActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.channelWizardSessionId=null,this.channelWizardStep=null,this.channelWizardInput=null,this.channelWizardBusy=!1,this.channelWizardError=null,this.channelWizardMessage=null,this.modelProviderWizardSessionId=null,this.modelProviderWizardStep=null,this.modelProviderWizardInput=null,this.modelProviderWizardBusy=!1,this.modelProviderWizardError=null,this.modelProviderWizardMessage=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.toolsCatalogLoading=!1,this.toolsCatalogError=null,this.toolsCatalogResult=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveResult=null,this.agentsPanel=`files`,this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.mcpServersLoading=!1,this.mcpServers=null,this.mcpServersPath=null,this.mcpServersError=null,this.mcpBusy=!1,this.mcpMessage=null,this.mcpDraftName=``,this.mcpDraftConfig=``,this.mcpAddMode=`preset`,this.mcpAuthToken=``,this.mcpPresetId=null,this.mcpLinkUrl=``,this.mcpLinkMetadataLoading=!1,this.mcpLinkMetadataError=null,this.mcpLinkMetadata=null,this.mcpOAuthStatus={},this.mcpOAuthFlow=null,this.mcpOAuthPopup=null,this.mcpTestStatus={},this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive=``,this.sessionsFilterLimit=`120`,this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.sessionsHideCron=!0,this.sessionsSearchQuery=``,this.sessionsSortColumn=`updated`,this.sessionsSortDir=`desc`,this.sessionsPage=0,this.sessionsPageSize=25,this.sessionsSelectedKeys=new Set,this.sessionsExpandedCheckpointKey=null,this.sessionsCheckpointItemsByKey={},this.sessionsCheckpointLoadingKey=null,this.sessionsCheckpointBusyKey=null,this.sessionsCheckpointErrorByKey={},this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageEndDate=(()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode=`tokens`,this.usageDailyChartMode=`by-type`,this.usageTimeSeriesMode=`per-turn`,this.usageTimeSeriesBreakdownMode=`by-type`,this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageTimeSeriesCursorStart=null,this.usageTimeSeriesCursorEnd=null,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery=``,this.usageQueryDraft=``,this.usageSessionSort=`recent`,this.usageSessionSortDir=`desc`,this.usageRecentSessions=[],this.usageTimeZone=`local`,this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab=`all`,this.usageVisibleColumns=[`channel`,`agent`,`provider`,`model`,`messages`,`tools`,`errors`,`duration`],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery=``,this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronQuickCreateOpen=!1,this.cronQuickCreateStep=`what`,this.cronQuickCreateDraft=null,this.cronJobsLoadingMore=!1,this.cronJobs=[],this.cronJobsTotal=0,this.cronJobsHasMore=!1,this.cronJobsNextOffset=null,this.cronJobsLimit=50,this.cronJobsQuery=``,this.cronJobsEnabledFilter=`all`,this.cronJobsScheduleKindFilter=`all`,this.cronJobsLastStatusFilter=`all`,this.cronJobsSortBy=`nextRunAtMs`,this.cronJobsSortDir=`asc`,this.cronStatus=null,this.cronError=null,this.cronForm={...xd},this.cronFieldErrors={},this.cronEditingJobId=null,this.cronRunsJobId=null,this.cronRunsLoadingMore=!1,this.cronRuns=[],this.cronRunsTotal=0,this.cronRunsHasMore=!1,this.cronRunsNextOffset=null,this.cronRunsLimit=50,this.cronRunsScope=`all`,this.cronRunsStatuses=[],this.cronRunsDeliveryStatuses=[],this.cronRunsStatusFilter=`all`,this.cronRunsQuery=``,this.cronRunsSortDir=`desc`,this.cronModelSuggestions=[],this.cronBusy=!1,this.updateAvailable=null,this.attentionItems=[],this.paletteOpen=!1,this.paletteQuery=``,this.paletteActiveIndex=0,this.overviewShowGatewayToken=!1,this.overviewShowGatewayPassword=!1,this.overviewLogLines=[],this.overviewLogCursor=0,this.walletSummary=null,this.walletSummaryError=null,this.walletSummaryLoading=!1,this.walletBalancesLoading=!1,this.walletLastUpdatedAt=null,this.walletRecoveryPhraseMode=`generate`,this.walletRecoveryPhraseBusy=!1,this.walletRecoveryPhraseError=null,this.walletRecoveryPhraseGeneratedMnemonic=null,this.walletRecoveryPhraseStatus=null,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter=``,this.skillsStatusFilter=`all`,this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillsDetailKey=null,this.clawhubSearchQuery=``,this.clawhubSearchResults=null,this.clawhubSearchLoading=!1,this.clawhubSearchError=null,this.clawhubDetail=null,this.clawhubDetailSlug=null,this.clawhubDetailLoading=!1,this.clawhubDetailError=null,this.clawhubInstallSlug=null,this.clawhubInstallMessage=null,this.pluginsLoading=!1,this.pluginsReport=null,this.pluginsError=null,this.pluginsFilter=``,this.pluginsStatusFilter=`all`,this.pluginsBusyKey=null,this.pluginMessages={},this.pluginDetailKey=null,this.pluginClawhubSearchQuery=``,this.pluginClawhubSearchResults=null,this.pluginClawhubSearchLoading=!1,this.pluginClawhubSearchError=null,this.pluginClawhubDetail=null,this.pluginClawhubDetailName=null,this.pluginClawhubDetailLoading=!1,this.pluginClawhubDetailError=null,this.pluginClawhubInstallName=null,this.pluginClawhubInstallMessage=null,this.healthLoading=!1,this.healthResult=null,this.healthError=null,this.modelAuthStatusLoading=!1,this.modelAuthStatusResult=null,this.modelAuthStatusError=null,this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod=``,this.debugCallParams=`{}`,this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText=``,this.logsLevelFilters={...bd},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.chatSideResultTerminalRuns=new Set,this.basePath=``,this.popStateHandler=()=>wO(this),this.topbarObserver=null,this.globalKeydownHandler=e=>{(e.metaKey||e.ctrlKey)&&!e.shiftKey&&e.key===`k`&&(e.preventDefault(),this.paletteOpen=!this.paletteOpen,this.paletteOpen&&(this.paletteQuery=``,this.paletteActiveIndex=0))},this.canvasAgentRunMessageHandler=e=>{GI(this,e)},this.mcpOAuthMessageHandler=e=>{let t=e.data;if(!t)return;let n=typeof window<`u`&&window.location?window.location.origin:``;if($I({origin:e.origin,source:e.source,expectedOrigin:n,popup:this.mcpOAuthPopup,dataSource:t.source}))if(t.type===`mcp-oauth-callback`){if(this.mcpOAuthPopup&&!this.mcpOAuthPopup.closed)try{this.mcpOAuthPopup.close()}catch{}if(this.mcpOAuthPopup=null,!this.mcpOAuthFlow)return;if(t.error){this.mcpMessage={kind:`error`,text:`OAuth failed: ${t.error}`},this.mcpOAuthFlow=null;return}if(!t.code||!t.state){this.mcpMessage={kind:`error`,text:`OAuth callback missing code or state.`},this.mcpOAuthFlow=null;return}Em(this,t.code,t.state)}else t.type===`mcp-oauth-cancelled`&&(Om(this),this.mcpMessage={kind:`error`,text:`Authorization was cancelled.`})},t(this.settings.locale)&&u.setLocale(this.settings.locale)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.onSlashAction=e=>{switch(e){case`toggle-focus`:this.applySettings({...this.settings,chatFocusMode:!this.settings.chatFocusMode});break;case`export`:By(this.chatMessages,this.assistantName);break;case`refresh-tools-effective`:Tf(this);break}},document.addEventListener(`keydown`,this.globalKeydownHandler),window.addEventListener(`message`,this.canvasAgentRunMessageHandler),window.addEventListener(`message`,this.mcpOAuthMessageHandler),_k(this)}firstUpdated(){vk(this)}disconnectedCallback(){document.removeEventListener(`keydown`,this.globalKeydownHandler),window.removeEventListener(`message`,this.canvasAgentRunMessageHandler),window.removeEventListener(`message`,this.mcpOAuthMessageHandler),yk(this),super.disconnectedCallback()}updated(e){if(bk(this,e),!e.has(`sessionKey`)||this.agentsPanel!==`tools`)return;let t=pa(this.sessionKey);if(this.agentsSelectedId&&this.agentsSelectedId===t){Sf(this,{agentId:this.agentsSelectedId,sessionKey:this.sessionKey});return}this.toolsEffectiveResult=null,this.toolsEffectiveResultKey=null,this.toolsEffectiveError=null,this.toolsEffectiveLoading=!1,this.toolsEffectiveLoadingKey=null}connect(){uk(this)}handleChatScroll(e){ri(this,e)}handleLogsScroll(e){ii(this,e)}exportLogs(e,t){oi(e,t)}resetToolStream(){Ai(this)}resetChatScroll(){ai(this)}scrollToBottom(e){ai(this),ti(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await zO(this)}applySettings(e){aO(this,e)}applyLocalUserIdentity(e){oO(this,e)}setTab(e){uO(this,e),this.navDrawerOpen=!1}setTheme(e,t){fO(this,e,t),this.themeOrder=this.buildThemeOrder(e)}setThemeMode(e,t){pO(this,e,t)}setBorderRadius(e){aO(this,{...this.settings,borderRadius:e}),this.requestUpdate()}buildThemeOrder(e){return[e,...[...kh].filter(t=>t!==e)]}async loadOverview(e){await AO(this,e)}async loadCron(){await IO(this)}async handleAbortChat(){await Gu(this)}removeQueuedMessage(e){Qu(this,e)}async handleSendChat(e,t){await ed(this,e,t)}async toggleRealtimeTalk(){if(this.realtimeTalkSession){this.realtimeTalkSession.stop(),this.realtimeTalkSession=null,this.realtimeTalkActive=!1,this.realtimeTalkStatus=`idle`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null;return}if(!this.client||!this.connected){this.lastError=`Gateway not connected`;return}this.realtimeTalkActive=!0,this.realtimeTalkStatus=`connecting`,this.realtimeTalkDetail=null,this.realtimeTalkTranscript=null;let e=new QI(this.client,this.sessionKey,{onStatus:(e,t)=>{this.realtimeTalkStatus=e,this.realtimeTalkDetail=t??null,(e===`idle`||e===`error`)&&(this.realtimeTalkActive=e!==`idle`)},onTranscript:e=>{this.realtimeTalkTranscript=`${e.role===`user`?`You`:`Genesis`}: ${e.text}`}});this.realtimeTalkSession=e;try{await e.start()}catch(t){e.stop(),this.realtimeTalkSession===e&&(this.realtimeTalkSession=null),this.realtimeTalkActive=!1,this.realtimeTalkStatus=`error`,this.realtimeTalkDetail=t instanceof Error?t.message:String(t),this.lastError=this.realtimeTalkDetail}}async steerQueuedChatMessage(e){await Xu(this,e)}async handleWhatsAppStart(e){await Ar(this,e)}async handleWhatsAppWait(){await jr(this)}async handleWhatsAppLogout(){await Mr(this)}async handleChannelConfigSave(){await Nr(this)}async handleChannelConfigReload(){await Pr(this)}async handleChannelWizardStart(){await Lr(this)}async handleChannelWizardSubmit(){await zr(this)}async handleChannelWizardCancel(){await Br(this)}handleChannelWizardInput(e){Rr(this,e)}handleChannelWizardClose(){Vr(this)}async handleModelProviderWizardStart(){await wk(this)}async handleModelProviderWizardSubmit(){await Ek(this)}async handleModelProviderWizardCancel(){await Dk(this)}handleModelProviderWizardInput(e){Tk(this,e)}handleModelProviderWizardClose(){Ok(this)}handleNostrProfileEdit(e,t){Kr(this,e,t)}handleNostrProfileCancel(){qr(this)}handleNostrProfileFieldChange(e,t){Jr(this,e,t)}async handleNostrProfileSave(){await Xr(this)}async handleNostrProfileImport(){await Zr(this)}handleNostrProfileToggleAdvanced(){Yr(this)}async handleExecApprovalDecision(e){let t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{let n=t.kind===`plugin`?`plugin.approval.resolve`:`exec.approval.resolve`;await this.client.request(n,{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(e=>e.id!==t.id)}catch(e){this.execApprovalError=`Approval failed: ${String(e)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){let e=this.pendingGatewayUrl;if(!e)return;let t=this.pendingGatewayToken?.trim()||``;this.pendingGatewayUrl=null,this.pendingGatewayToken=null,aO(this,{...this.settings,gatewayUrl:e,token:t}),this.connect()}handleGatewayUrlCancel(){this.pendingGatewayUrl=null,this.pendingGatewayToken=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){let t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return LI(this)}};X([F()],$.prototype,`settings`,void 0),X([F()],$.prototype,`password`,void 0),X([F()],$.prototype,`loginShowGatewayToken`,void 0),X([F()],$.prototype,`loginShowGatewayPassword`,void 0),X([F()],$.prototype,`tab`,void 0),X([F()],$.prototype,`onboarding`,void 0),X([F()],$.prototype,`connected`,void 0),X([F()],$.prototype,`theme`,void 0),X([F()],$.prototype,`themeMode`,void 0),X([F()],$.prototype,`themeResolved`,void 0),X([F()],$.prototype,`themeOrder`,void 0),X([F()],$.prototype,`hello`,void 0),X([F()],$.prototype,`lastError`,void 0),X([F()],$.prototype,`lastErrorCode`,void 0),X([F()],$.prototype,`eventLog`,void 0),X([F()],$.prototype,`assistantName`,void 0),X([F()],$.prototype,`assistantAvatar`,void 0),X([F()],$.prototype,`assistantAgentId`,void 0),X([F()],$.prototype,`userName`,void 0),X([F()],$.prototype,`userAvatar`,void 0),X([F()],$.prototype,`localMediaPreviewRoots`,void 0),X([F()],$.prototype,`embedSandboxMode`,void 0),X([F()],$.prototype,`allowExternalEmbedUrls`,void 0),X([F()],$.prototype,`serverVersion`,void 0),X([F()],$.prototype,`sessionKey`,void 0),X([F()],$.prototype,`chatLoading`,void 0),X([F()],$.prototype,`chatSending`,void 0),X([F()],$.prototype,`chatMessage`,void 0),X([F()],$.prototype,`chatMessages`,void 0),X([F()],$.prototype,`chatToolMessages`,void 0),X([F()],$.prototype,`chatStreamSegments`,void 0),X([F()],$.prototype,`chatStream`,void 0),X([F()],$.prototype,`chatStreamStartedAt`,void 0),X([F()],$.prototype,`chatRunId`,void 0),X([F()],$.prototype,`chatSideResult`,void 0),X([F()],$.prototype,`compactionStatus`,void 0),X([F()],$.prototype,`fallbackStatus`,void 0),X([F()],$.prototype,`chatAvatarUrl`,void 0),X([F()],$.prototype,`chatThinkingLevel`,void 0),X([F()],$.prototype,`chatModelOverrides`,void 0),X([F()],$.prototype,`chatModelsLoading`,void 0),X([F()],$.prototype,`chatModelCatalog`,void 0),X([F()],$.prototype,`modelsPanel`,void 0),X([F()],$.prototype,`modelsLoading`,void 0),X([F()],$.prototype,`memoryEntries`,void 0),X([F()],$.prototype,`memoryLoading`,void 0),X([F()],$.prototype,`memoryError`,void 0),X([F()],$.prototype,`chatQueue`,void 0),X([F()],$.prototype,`chatAttachments`,void 0),X([F()],$.prototype,`realtimeTalkActive`,void 0),X([F()],$.prototype,`realtimeTalkStatus`,void 0),X([F()],$.prototype,`realtimeTalkDetail`,void 0),X([F()],$.prototype,`realtimeTalkTranscript`,void 0),X([F()],$.prototype,`chatManualRefreshInFlight`,void 0),X([F()],$.prototype,`navDrawerOpen`,void 0),X([F()],$.prototype,`sidebarOpen`,void 0),X([F()],$.prototype,`sidebarContent`,void 0),X([F()],$.prototype,`sidebarError`,void 0),X([F()],$.prototype,`splitRatio`,void 0),X([F()],$.prototype,`nodesLoading`,void 0),X([F()],$.prototype,`nodes`,void 0),X([F()],$.prototype,`nodeManagementSelectedId`,void 0),X([F()],$.prototype,`nodeManagementRename`,void 0),X([F()],$.prototype,`nodeManagementCommand`,void 0),X([F()],$.prototype,`nodeManagementParams`,void 0),X([F()],$.prototype,`nodeManagementShell`,void 0),X([F()],$.prototype,`nodeManagementCwd`,void 0),X([F()],$.prototype,`nodeManagementTimeoutMs`,void 0),X([F()],$.prototype,`nodeManagementBusy`,void 0),X([F()],$.prototype,`nodeManagementError`,void 0),X([F()],$.prototype,`nodeManagementResult`,void 0),X([F()],$.prototype,`devicesLoading`,void 0),X([F()],$.prototype,`devicesError`,void 0),X([F()],$.prototype,`devicesList`,void 0),X([F()],$.prototype,`execApprovalsLoading`,void 0),X([F()],$.prototype,`execApprovalsSaving`,void 0),X([F()],$.prototype,`execApprovalsDirty`,void 0),X([F()],$.prototype,`execApprovalsSnapshot`,void 0),X([F()],$.prototype,`execApprovalsForm`,void 0),X([F()],$.prototype,`execApprovalsSelectedAgent`,void 0),X([F()],$.prototype,`execApprovalsTarget`,void 0),X([F()],$.prototype,`execApprovalsTargetNodeId`,void 0),X([F()],$.prototype,`execApprovalQueue`,void 0),X([F()],$.prototype,`execApprovalBusy`,void 0),X([F()],$.prototype,`execApprovalError`,void 0),X([F()],$.prototype,`pendingGatewayUrl`,void 0),X([F()],$.prototype,`configLoading`,void 0),X([F()],$.prototype,`configRaw`,void 0),X([F()],$.prototype,`configRawOriginal`,void 0),X([F()],$.prototype,`configValid`,void 0),X([F()],$.prototype,`configIssues`,void 0),X([F()],$.prototype,`configSaving`,void 0),X([F()],$.prototype,`configApplying`,void 0),X([F()],$.prototype,`updateRunning`,void 0),X([F()],$.prototype,`applySessionKey`,void 0),X([F()],$.prototype,`configSnapshot`,void 0),X([F()],$.prototype,`configSchema`,void 0),X([F()],$.prototype,`configSchemaVersion`,void 0),X([F()],$.prototype,`configSchemaLoading`,void 0),X([F()],$.prototype,`configUiHints`,void 0),X([F()],$.prototype,`configForm`,void 0),X([F()],$.prototype,`configFormOriginal`,void 0),X([F()],$.prototype,`configRestartPrompt`,void 0),X([F()],$.prototype,`dreamingStatusLoading`,void 0),X([F()],$.prototype,`dreamingStatusError`,void 0),X([F()],$.prototype,`dreamingStatus`,void 0),X([F()],$.prototype,`dreamingModeSaving`,void 0),X([F()],$.prototype,`dreamDiaryLoading`,void 0),X([F()],$.prototype,`dreamDiaryActionLoading`,void 0),X([F()],$.prototype,`dreamDiaryActionMessage`,void 0),X([F()],$.prototype,`dreamDiaryActionArchivePath`,void 0),X([F()],$.prototype,`dreamDiaryError`,void 0),X([F()],$.prototype,`dreamDiaryPath`,void 0),X([F()],$.prototype,`dreamDiaryContent`,void 0),X([F()],$.prototype,`wikiImportInsightsLoading`,void 0),X([F()],$.prototype,`wikiImportInsightsError`,void 0),X([F()],$.prototype,`wikiImportInsights`,void 0),X([F()],$.prototype,`wikiMemoryPalaceLoading`,void 0),X([F()],$.prototype,`wikiMemoryPalaceError`,void 0),X([F()],$.prototype,`wikiMemoryPalace`,void 0),X([F()],$.prototype,`configFormDirty`,void 0),X([F()],$.prototype,`configSettingsMode`,void 0),X([F()],$.prototype,`configFormMode`,void 0),X([F()],$.prototype,`configSearchQuery`,void 0),X([F()],$.prototype,`configActiveSection`,void 0),X([F()],$.prototype,`configActiveSubsection`,void 0),X([F()],$.prototype,`communicationsFormMode`,void 0),X([F()],$.prototype,`communicationsSearchQuery`,void 0),X([F()],$.prototype,`communicationsActiveSection`,void 0),X([F()],$.prototype,`communicationsActiveSubsection`,void 0),X([F()],$.prototype,`appearanceFormMode`,void 0),X([F()],$.prototype,`appearanceSearchQuery`,void 0),X([F()],$.prototype,`appearanceActiveSection`,void 0),X([F()],$.prototype,`appearanceActiveSubsection`,void 0),X([F()],$.prototype,`automationFormMode`,void 0),X([F()],$.prototype,`automationSearchQuery`,void 0),X([F()],$.prototype,`automationActiveSection`,void 0),X([F()],$.prototype,`automationActiveSubsection`,void 0),X([F()],$.prototype,`infrastructureFormMode`,void 0),X([F()],$.prototype,`infrastructureSearchQuery`,void 0),X([F()],$.prototype,`infrastructureActiveSection`,void 0),X([F()],$.prototype,`infrastructureActiveSubsection`,void 0),X([F()],$.prototype,`aiAgentsFormMode`,void 0),X([F()],$.prototype,`aiAgentsSearchQuery`,void 0),X([F()],$.prototype,`aiAgentsActiveSection`,void 0),X([F()],$.prototype,`aiAgentsActiveSubsection`,void 0),X([F()],$.prototype,`channelsLoading`,void 0),X([F()],$.prototype,`channelsSnapshot`,void 0),X([F()],$.prototype,`channelsError`,void 0),X([F()],$.prototype,`channelsLastSuccess`,void 0),X([F()],$.prototype,`whatsappLoginMessage`,void 0),X([F()],$.prototype,`whatsappLoginQrDataUrl`,void 0),X([F()],$.prototype,`whatsappLoginConnected`,void 0),X([F()],$.prototype,`whatsappBusy`,void 0),X([F()],$.prototype,`nostrProfileFormState`,void 0),X([F()],$.prototype,`nostrProfileAccountId`,void 0),X([F()],$.prototype,`channelWizardSessionId`,void 0),X([F()],$.prototype,`channelWizardStep`,void 0),X([F()],$.prototype,`channelWizardInput`,void 0),X([F()],$.prototype,`channelWizardBusy`,void 0),X([F()],$.prototype,`channelWizardError`,void 0),X([F()],$.prototype,`channelWizardMessage`,void 0),X([F()],$.prototype,`modelProviderWizardSessionId`,void 0),X([F()],$.prototype,`modelProviderWizardStep`,void 0),X([F()],$.prototype,`modelProviderWizardInput`,void 0),X([F()],$.prototype,`modelProviderWizardBusy`,void 0),X([F()],$.prototype,`modelProviderWizardError`,void 0),X([F()],$.prototype,`modelProviderWizardMessage`,void 0),X([F()],$.prototype,`presenceLoading`,void 0),X([F()],$.prototype,`presenceEntries`,void 0),X([F()],$.prototype,`presenceError`,void 0),X([F()],$.prototype,`presenceStatus`,void 0),X([F()],$.prototype,`agentsLoading`,void 0),X([F()],$.prototype,`agentsList`,void 0),X([F()],$.prototype,`agentsError`,void 0),X([F()],$.prototype,`agentsSelectedId`,void 0),X([F()],$.prototype,`toolsCatalogLoading`,void 0),X([F()],$.prototype,`toolsCatalogError`,void 0),X([F()],$.prototype,`toolsCatalogResult`,void 0),X([F()],$.prototype,`toolsEffectiveLoading`,void 0),X([F()],$.prototype,`toolsEffectiveLoadingKey`,void 0),X([F()],$.prototype,`toolsEffectiveResultKey`,void 0),X([F()],$.prototype,`toolsEffectiveError`,void 0),X([F()],$.prototype,`toolsEffectiveResult`,void 0),X([F()],$.prototype,`agentsPanel`,void 0),X([F()],$.prototype,`agentFilesLoading`,void 0),X([F()],$.prototype,`agentFilesError`,void 0),X([F()],$.prototype,`agentFilesList`,void 0),X([F()],$.prototype,`agentFileContents`,void 0),X([F()],$.prototype,`agentFileDrafts`,void 0),X([F()],$.prototype,`agentFileActive`,void 0),X([F()],$.prototype,`agentFileSaving`,void 0),X([F()],$.prototype,`agentIdentityLoading`,void 0),X([F()],$.prototype,`agentIdentityError`,void 0),X([F()],$.prototype,`agentIdentityById`,void 0),X([F()],$.prototype,`agentSkillsLoading`,void 0),X([F()],$.prototype,`agentSkillsError`,void 0),X([F()],$.prototype,`agentSkillsReport`,void 0),X([F()],$.prototype,`agentSkillsAgentId`,void 0),X([F()],$.prototype,`mcpServersLoading`,void 0),X([F()],$.prototype,`mcpServers`,void 0),X([F()],$.prototype,`mcpServersPath`,void 0),X([F()],$.prototype,`mcpServersError`,void 0),X([F()],$.prototype,`mcpBusy`,void 0),X([F()],$.prototype,`mcpMessage`,void 0),X([F()],$.prototype,`mcpDraftName`,void 0),X([F()],$.prototype,`mcpDraftConfig`,void 0),X([F()],$.prototype,`mcpAddMode`,void 0),X([F()],$.prototype,`mcpAuthToken`,void 0),X([F()],$.prototype,`mcpPresetId`,void 0),X([F()],$.prototype,`mcpLinkUrl`,void 0),X([F()],$.prototype,`mcpLinkMetadataLoading`,void 0),X([F()],$.prototype,`mcpLinkMetadataError`,void 0),X([F()],$.prototype,`mcpLinkMetadata`,void 0),X([F()],$.prototype,`mcpOAuthStatus`,void 0),X([F()],$.prototype,`mcpOAuthFlow`,void 0),X([F()],$.prototype,`mcpOAuthPopup`,void 0),X([F()],$.prototype,`mcpTestStatus`,void 0),X([F()],$.prototype,`sessionsLoading`,void 0),X([F()],$.prototype,`sessionsResult`,void 0),X([F()],$.prototype,`sessionsError`,void 0),X([F()],$.prototype,`sessionsFilterActive`,void 0),X([F()],$.prototype,`sessionsFilterLimit`,void 0),X([F()],$.prototype,`sessionsIncludeGlobal`,void 0),X([F()],$.prototype,`sessionsIncludeUnknown`,void 0),X([F()],$.prototype,`sessionsHideCron`,void 0),X([F()],$.prototype,`sessionsSearchQuery`,void 0),X([F()],$.prototype,`sessionsSortColumn`,void 0),X([F()],$.prototype,`sessionsSortDir`,void 0),X([F()],$.prototype,`sessionsPage`,void 0),X([F()],$.prototype,`sessionsPageSize`,void 0),X([F()],$.prototype,`sessionsSelectedKeys`,void 0),X([F()],$.prototype,`sessionsExpandedCheckpointKey`,void 0),X([F()],$.prototype,`sessionsCheckpointItemsByKey`,void 0),X([F()],$.prototype,`sessionsCheckpointLoadingKey`,void 0),X([F()],$.prototype,`sessionsCheckpointBusyKey`,void 0),X([F()],$.prototype,`sessionsCheckpointErrorByKey`,void 0),X([F()],$.prototype,`usageLoading`,void 0),X([F()],$.prototype,`usageResult`,void 0),X([F()],$.prototype,`usageCostSummary`,void 0),X([F()],$.prototype,`usageError`,void 0),X([F()],$.prototype,`usageStartDate`,void 0),X([F()],$.prototype,`usageEndDate`,void 0),X([F()],$.prototype,`usageSelectedSessions`,void 0),X([F()],$.prototype,`usageSelectedDays`,void 0),X([F()],$.prototype,`usageSelectedHours`,void 0),X([F()],$.prototype,`usageChartMode`,void 0),X([F()],$.prototype,`usageDailyChartMode`,void 0),X([F()],$.prototype,`usageTimeSeriesMode`,void 0),X([F()],$.prototype,`usageTimeSeriesBreakdownMode`,void 0),X([F()],$.prototype,`usageTimeSeries`,void 0),X([F()],$.prototype,`usageTimeSeriesLoading`,void 0),X([F()],$.prototype,`usageTimeSeriesCursorStart`,void 0),X([F()],$.prototype,`usageTimeSeriesCursorEnd`,void 0),X([F()],$.prototype,`usageSessionLogs`,void 0),X([F()],$.prototype,`usageSessionLogsLoading`,void 0),X([F()],$.prototype,`usageSessionLogsExpanded`,void 0),X([F()],$.prototype,`usageQuery`,void 0),X([F()],$.prototype,`usageQueryDraft`,void 0),X([F()],$.prototype,`usageSessionSort`,void 0),X([F()],$.prototype,`usageSessionSortDir`,void 0),X([F()],$.prototype,`usageRecentSessions`,void 0),X([F()],$.prototype,`usageTimeZone`,void 0),X([F()],$.prototype,`usageContextExpanded`,void 0),X([F()],$.prototype,`usageHeaderPinned`,void 0),X([F()],$.prototype,`usageSessionsTab`,void 0),X([F()],$.prototype,`usageVisibleColumns`,void 0),X([F()],$.prototype,`usageLogFilterRoles`,void 0),X([F()],$.prototype,`usageLogFilterTools`,void 0),X([F()],$.prototype,`usageLogFilterHasTools`,void 0),X([F()],$.prototype,`usageLogFilterQuery`,void 0),X([F()],$.prototype,`cronLoading`,void 0),X([F()],$.prototype,`cronQuickCreateOpen`,void 0),X([F()],$.prototype,`cronQuickCreateStep`,void 0),X([F()],$.prototype,`cronQuickCreateDraft`,void 0),X([F()],$.prototype,`cronJobsLoadingMore`,void 0),X([F()],$.prototype,`cronJobs`,void 0),X([F()],$.prototype,`cronJobsTotal`,void 0),X([F()],$.prototype,`cronJobsHasMore`,void 0),X([F()],$.prototype,`cronJobsNextOffset`,void 0),X([F()],$.prototype,`cronJobsLimit`,void 0),X([F()],$.prototype,`cronJobsQuery`,void 0),X([F()],$.prototype,`cronJobsEnabledFilter`,void 0),X([F()],$.prototype,`cronJobsScheduleKindFilter`,void 0),X([F()],$.prototype,`cronJobsLastStatusFilter`,void 0),X([F()],$.prototype,`cronJobsSortBy`,void 0),X([F()],$.prototype,`cronJobsSortDir`,void 0),X([F()],$.prototype,`cronStatus`,void 0),X([F()],$.prototype,`cronError`,void 0),X([F()],$.prototype,`cronForm`,void 0),X([F()],$.prototype,`cronFieldErrors`,void 0),X([F()],$.prototype,`cronEditingJobId`,void 0),X([F()],$.prototype,`cronRunsJobId`,void 0),X([F()],$.prototype,`cronRunsLoadingMore`,void 0),X([F()],$.prototype,`cronRuns`,void 0),X([F()],$.prototype,`cronRunsTotal`,void 0),X([F()],$.prototype,`cronRunsHasMore`,void 0),X([F()],$.prototype,`cronRunsNextOffset`,void 0),X([F()],$.prototype,`cronRunsLimit`,void 0),X([F()],$.prototype,`cronRunsScope`,void 0),X([F()],$.prototype,`cronRunsStatuses`,void 0),X([F()],$.prototype,`cronRunsDeliveryStatuses`,void 0),X([F()],$.prototype,`cronRunsStatusFilter`,void 0),X([F()],$.prototype,`cronRunsQuery`,void 0),X([F()],$.prototype,`cronRunsSortDir`,void 0),X([F()],$.prototype,`cronModelSuggestions`,void 0),X([F()],$.prototype,`cronBusy`,void 0),X([F()],$.prototype,`updateAvailable`,void 0),X([F()],$.prototype,`attentionItems`,void 0),X([F()],$.prototype,`paletteOpen`,void 0),X([F()],$.prototype,`paletteQuery`,void 0),X([F()],$.prototype,`paletteActiveIndex`,void 0),X([F()],$.prototype,`overviewShowGatewayToken`,void 0),X([F()],$.prototype,`overviewShowGatewayPassword`,void 0),X([F()],$.prototype,`overviewLogLines`,void 0),X([F()],$.prototype,`overviewLogCursor`,void 0),X([F()],$.prototype,`walletSummary`,void 0),X([F()],$.prototype,`walletSummaryError`,void 0),X([F()],$.prototype,`walletSummaryLoading`,void 0),X([F()],$.prototype,`walletBalancesLoading`,void 0),X([F()],$.prototype,`walletLastUpdatedAt`,void 0),X([F()],$.prototype,`walletRecoveryPhraseMode`,void 0),X([F()],$.prototype,`walletRecoveryPhraseBusy`,void 0),X([F()],$.prototype,`walletRecoveryPhraseError`,void 0),X([F()],$.prototype,`walletRecoveryPhraseGeneratedMnemonic`,void 0),X([F()],$.prototype,`walletRecoveryPhraseStatus`,void 0),X([F()],$.prototype,`skillsLoading`,void 0),X([F()],$.prototype,`skillsReport`,void 0),X([F()],$.prototype,`skillsError`,void 0),X([F()],$.prototype,`skillsFilter`,void 0),X([F()],$.prototype,`skillsStatusFilter`,void 0),X([F()],$.prototype,`skillEdits`,void 0),X([F()],$.prototype,`skillsBusyKey`,void 0),X([F()],$.prototype,`skillMessages`,void 0),X([F()],$.prototype,`skillsDetailKey`,void 0),X([F()],$.prototype,`clawhubSearchQuery`,void 0),X([F()],$.prototype,`clawhubSearchResults`,void 0),X([F()],$.prototype,`clawhubSearchLoading`,void 0),X([F()],$.prototype,`clawhubSearchError`,void 0),X([F()],$.prototype,`clawhubDetail`,void 0),X([F()],$.prototype,`clawhubDetailSlug`,void 0),X([F()],$.prototype,`clawhubDetailLoading`,void 0),X([F()],$.prototype,`clawhubDetailError`,void 0),X([F()],$.prototype,`clawhubInstallSlug`,void 0),X([F()],$.prototype,`clawhubInstallMessage`,void 0),X([F()],$.prototype,`pluginsLoading`,void 0),X([F()],$.prototype,`pluginsReport`,void 0),X([F()],$.prototype,`pluginsError`,void 0),X([F()],$.prototype,`pluginsFilter`,void 0),X([F()],$.prototype,`pluginsStatusFilter`,void 0),X([F()],$.prototype,`pluginsBusyKey`,void 0),X([F()],$.prototype,`pluginMessages`,void 0),X([F()],$.prototype,`pluginDetailKey`,void 0),X([F()],$.prototype,`pluginClawhubSearchQuery`,void 0),X([F()],$.prototype,`pluginClawhubSearchResults`,void 0),X([F()],$.prototype,`pluginClawhubSearchLoading`,void 0),X([F()],$.prototype,`pluginClawhubSearchError`,void 0),X([F()],$.prototype,`pluginClawhubDetail`,void 0),X([F()],$.prototype,`pluginClawhubDetailName`,void 0),X([F()],$.prototype,`pluginClawhubDetailLoading`,void 0),X([F()],$.prototype,`pluginClawhubDetailError`,void 0),X([F()],$.prototype,`pluginClawhubInstallName`,void 0),X([F()],$.prototype,`pluginClawhubInstallMessage`,void 0),X([F()],$.prototype,`healthLoading`,void 0),X([F()],$.prototype,`healthResult`,void 0),X([F()],$.prototype,`healthError`,void 0),X([F()],$.prototype,`modelAuthStatusLoading`,void 0),X([F()],$.prototype,`modelAuthStatusResult`,void 0),X([F()],$.prototype,`modelAuthStatusError`,void 0),X([F()],$.prototype,`debugLoading`,void 0),X([F()],$.prototype,`debugStatus`,void 0),X([F()],$.prototype,`debugHealth`,void 0),X([F()],$.prototype,`debugModels`,void 0),X([F()],$.prototype,`debugHeartbeat`,void 0),X([F()],$.prototype,`debugCallMethod`,void 0),X([F()],$.prototype,`debugCallParams`,void 0),X([F()],$.prototype,`debugCallResult`,void 0),X([F()],$.prototype,`debugCallError`,void 0),X([F()],$.prototype,`logsLoading`,void 0),X([F()],$.prototype,`logsError`,void 0),X([F()],$.prototype,`logsFile`,void 0),X([F()],$.prototype,`logsEntries`,void 0),X([F()],$.prototype,`logsFilterText`,void 0),X([F()],$.prototype,`logsLevelFilters`,void 0),X([F()],$.prototype,`logsAutoFollow`,void 0),X([F()],$.prototype,`logsTruncated`,void 0),X([F()],$.prototype,`logsCursor`,void 0),X([F()],$.prototype,`logsLastFetchAt`,void 0),X([F()],$.prototype,`logsLimit`,void 0),X([F()],$.prototype,`logsMaxBytes`,void 0),X([F()],$.prototype,`logsAtBottom`,void 0),X([F()],$.prototype,`chatNewMessagesBelow`,void 0),$=X([M(`genesis-app`)],$);export{Cu as A,Dn as B,Ru as C,Mu as D,wu as E,ou as F,tn as H,Kl as I,Xa as L,Bu as M,pu as N,xu as O,fu as P,ga as R,Pu as S,mu as T,Ie as U,fn as V,ke as W,ev as _,lF as a,bu as b,nF as c,Hj as d,Uj as f,J as g,Uy as h,dF as i,Tu as j,Eu as k,oN as l,cx as m,pF as n,cF as o,zT as p,fF as r,uF as s,mF as t,WM as u,$_ as v,zu as w,Su as x,zg as y,Or as z};
6247
- //# sourceMappingURL=index-DTwo_TE_.js.map
6314
+ //# sourceMappingURL=index-CYO6b4V3.js.map