@dreb/dashboard 2.66.0 → 2.66.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return u(this.context.count)},getNextContextId(){return u(this.context.count++)}};function u(e){let t=String(e),n=t.length-1;return l.context.id+(n?String.fromCharCode(96+n):``)+t}function d(e){l.context=e}var f=(e,t)=>e===t,p=Symbol(`solid-proxy`),m=Symbol(`solid-track`),h={equals:f},g=null,_=pe,v=1,y=2,b={owned:null,cleanups:null,context:null,owner:null},x={},S=null,C=null,w=null,T=null,E=null,D=0;function O(e,t){let n=w,r=S,i=e.length===0,a=t===void 0?r:t,o=i?b:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>L(()=>_e(o)));S=o,w=null;try{return de(s,!0)}finally{w=n,S=r}}function k(e,t){t=t?Object.assign({},h,t):h;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[se.bind(n),e=>(typeof e==`function`&&(e=C&&C.running&&C.sources.has(n)?e(n.tValue):e(n.value)),B(n,e))]}function A(e,t,n){ce(le(e,t,!0,v))}function j(e,t,n){ce(le(e,t,!1,v))}function M(e,t,n){_=me;let r=le(e,t,!1,v),i=z&&ae(z);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),E?E.push(r):ce(r)}function N(e,t,n){n=n?Object.assign({},h,n):h;let r=le(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ce(r),se.bind(r)}function P(e){return e&&typeof e==`object`&&`then`in e}function F(e,t,n){let r,i,a;typeof t==`function`?(r=e,i=t,a=n||{}):(r=!0,i=e,a=t||{});let o=null,s=x,c=null,u=!1,d=!1,f=`initialValue`in a,p=typeof r==`function`&&N(r),m=new Set,[h,g]=(a.storage||k)(a.initialValue),[_,v]=k(void 0),[y,b]=k(void 0,{equals:!1}),[T,E]=k(f?`ready`:`unresolved`);S&&R(()=>{for(let e of m.keys())e.decrement();m.clear(),C&&o&&C.promises.delete(o),o=null}),l.context&&(c=l.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:l.load&&l.has(c)&&(s=l.load(c)));function D(e,t,n,r){return o===e&&(o=null,r!==void 0&&(f=!0),(e===s||t===s)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(r,{value:t})),s=x,C&&e&&u?(C.promises.delete(e),u=!1,de(()=>{C.running=!0,O(t,n)},!1)):O(t,n)),t}function O(e,t){de(()=>{t===void 0&&g(()=>e),E(t===void 0?f?`ready`:`unresolved`:`errored`),v(t);for(let e of m.keys())e.decrement();m.clear()},!1)}function j(){let e=z&&ae(z),t=h(),n=_();if(n!==void 0&&!o)throw n;return w&&!w.user&&e&&A(()=>{y(),o&&(e.resolved&&C&&u?C.promises.add(o):m.has(e)||(e.increment(),m.add(e)))}),t}function M(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=C&&C.running,t==null||t===!1){D(o,L(h));return}C&&o&&C.promises.delete(o);let n,a=s===x?L(()=>{try{return i(t,{value:h(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){D(o,void 0,ye(n),t);return}else if(!P(a))return D(o,a,void 0,t),a;return o=a,`v`in a?(a.s===1?D(o,a.v,void 0,t):D(o,void 0,ye(a.v),t),a):(d=!0,queueMicrotask(()=>d=!1),de(()=>{E(f?`refreshing`:`pending`),b()},!1),a.then(e=>D(a,e,void 0,t),e=>D(a,void 0,ye(e),t)))}Object.defineProperties(j,{state:{get:()=>T()},error:{get:()=>_()},loading:{get(){let e=T();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return j();let e=_();if(e&&!o)throw e;return h()}}});let F=S;return p?A(()=>(F=S,M(!1))):M(!1),[j,{refetch:e=>ne(F,()=>M(e)),mutate:g}]}function I(e){return de(e,!1)}function L(e){if(w===null)return e();let t=w;w=null;try{return e()}finally{w=t}}function ee(e){M(()=>L(e))}function R(e){return S===null||(S.cleanups===null?S.cleanups=[e]:S.cleanups.push(e)),e}function te(){return w}function ne(e,t){let n=S,r=w;S=e,w=null;try{return de(t,!0)}catch(e){be(e)}finally{S=n,w=r}}var[re,ie]=k(!1);function ae(e){let t;return S&&S.context&&(t=S.context[e.id])!==void 0?t:e.defaultValue}function oe(e){let t=N(e),n=N(()=>xe(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var z;function se(){let e=C&&C.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===v)ce(this);else{let e=T;T=null,de(()=>he(this),!1),T=e}if(w){let e=this.observers;if(!e||e[e.length-1]!==w){let t=e?e.length:0;w.sources?(w.sources.push(this),w.sourceSlots.push(t)):(w.sources=[this],w.sourceSlots=[t]),e?(e.push(w),this.observerSlots.push(w.sources.length-1)):(this.observers=[w],this.observerSlots=[w.sources.length-1])}}return e&&C.sources.has(this)?this.tValue:this.value}function B(e,t,n){let r=C&&C.running&&C.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(C){let r=C.running;(r||!n&&C.sources.has(e))&&(C.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&de(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=C&&C.running;r&&C.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?T.push(n):E.push(n),n.observers&&ge(n)),r?n.tState=v:n.state=v)}if(T.length>1e6)throw T=[],Error()},!1)}return t}function ce(e){if(!e.fn)return;_e(e);let t=D;V(e,C&&C.running&&C.sources.has(e)?e.tValue:e.value,t),C&&!C.running&&C.sources.has(e)&&queueMicrotask(()=>{de(()=>{C&&(C.running=!0),w=S=e,V(e,e.tValue,t),w=S=null},!1)})}function V(e,t,n){let r,i=S,a=w;w=S=e;try{r=e.fn(t)}catch(t){return e.pure&&(C&&C.running?(e.tState=v,e.tOwned&&e.tOwned.forEach(_e),e.tOwned=void 0):(e.state=v,e.owned&&e.owned.forEach(_e),e.owned=null)),e.updatedAt=n+1,be(t)}finally{w=a,S=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?B(e,r,!0):C&&C.running&&e.pure?(C.sources.has(e)||(e.value=r),C.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function le(e,t,n,r=v,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:S,context:S?S.context:null,pure:n};return C&&C.running&&(a.state=0,a.tState=r),S===null||S!==b&&(C&&C.running&&S.pure?S.tOwned?S.tOwned.push(a):S.tOwned=[a]:S.owned?S.owned.push(a):S.owned=[a]),a}function ue(e){let t=C&&C.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===y)return he(e);if(e.suspense&&L(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<D);){if(t&&C.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(C.disposed.has(t))return}if((t?e.tState:e.state)===v)ce(e);else if((t?e.tState:e.state)===y){let t=T;T=null,de(()=>he(e,n[0]),!1),T=t}}}function de(e,t){if(T)return e();let n=!1;t||(T=[]),E?n=!0:E=[],D++;try{let t=e();return fe(n),t}catch(e){n||(E=null),T=null,be(e)}}function fe(e){if(T&&=(pe(T),null),e)return;let t;if(C){if(!C.promises.size&&!C.queue.size){let e=C.sources,n=C.disposed;E.push.apply(E,C.effects),t=C.resolve;for(let e of E)`tState`in e&&(e.state=e.tState),delete e.tState;C=null,de(()=>{for(let e of n)_e(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)_e(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}ie(!1)},!1)}else if(C.running){C.running=!1,C.effects.push.apply(C.effects,E),E=null,ie(!0);return}}let n=E;E=null,n.length&&de(()=>_(n),!1),t&&t()}function pe(e){for(let t=0;t<e.length;t++)ue(e[t])}function me(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:ue(r)}if(l.context){if(l.count){l.effects||=[],l.effects.push(...e.slice(0,n));return}d()}for(l.effects&&(l.done||!l.count)&&(e=[...l.effects,...e],n+=l.effects.length,delete l.effects),t=0;t<n;t++)ue(e[t])}function he(e,t){let n=C&&C.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===v?i!==t&&(!i.updatedAt||i.updatedAt<D)&&ue(i):e===y&&he(i,t)}}}function ge(e){let t=C&&C.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=y:r.state=y,r.pure?T.push(r):E.push(r),r.observers&&ge(r))}}function _e(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)_e(e.tOwned[t]);delete e.tOwned}if(C&&C.running&&e.pure)ve(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)_e(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}C&&C.running?e.tState=0:e.state=0}function ve(e,t){if(t||(e.tState=0,C.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)ve(e.owned[t])}function ye(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function H(e,t,n){try{for(let n of t)n(e)}catch(e){be(e,n&&n.owner||null)}}function be(e,t=S){let n=g&&t&&t.context&&t.context[g],r=ye(e);if(!n)throw r;E?E.push({fn(){H(r,n,t)},state:v}):H(r,n,t)}function xe(e){if(typeof e==`function`&&!e.length)return xe(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=xe(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}var Se=Symbol(`fallback`);function Ce(e){for(let t=0;t<e.length;t++)e[t]()}function we(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return R(()=>Ce(a)),()=>{let c=e()||[],l=c.length,u,d;return c[m],L(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(Ce(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Se],i[0]=O(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=O(f);o=l}else{for(p=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=O(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=k(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function U(e,t){return L(()=>e(t||{}))}var Te=0;function Ee(){return l.context?l.getNextContextId():`cl-${Te++}`}var De=e=>`Stale read from <${e}>.`;function W(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return N(we(()=>e.each,e.children,t||void 0))}function G(e){let t=e.keyed,n=N(()=>e.when,void 0,void 0),r=t?n:N(n,void 0,{equals:(e,t)=>!e==!t});return N(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?L(()=>a(t?i:()=>{if(!L(r))throw De(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function Oe(e){let t=oe(()=>e.children),n=N(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=N(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:N(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return N(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?L(()=>o(a.keyed?i():()=>{if(L(n)()?.[0]!==r)throw De(`Match`);return i()})):o},void 0,void 0)}function ke(e){return e}var K=e=>N(()=>e());function Ae(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var je=`_$DX_DELEGATE`;function Me(e,t,n,r={}){let i;return O(r=>{i=r,t===document?e():Y(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function q(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>L(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function Ne(e,t=window.document){let n=t[je]||(t[je]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,Ve))}}function J(e,t,n){ze(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Pe(e,t){ze(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function Fe(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function Ie(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(Be(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(Be(e,i,!0),n[i]=o)}return n}function Le(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function Re(e,t,n){return L(()=>e(t,n))}function Y(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return He(e,t,r,n);j(r=>He(e,t(),r,n),r)}function ze(e){return!!l.context&&!l.done&&(!e||e.isConnected)}function Be(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function Ve(e){if(l.registry&&l.events&&l.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),l.registry&&!l.done&&(l.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function He(e,t,n,r,i){let a=ze(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Ge(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Ge(e,n,r)}else if(o===`function`)return j(()=>{let i=t();for(;typeof i==`function`;)i=i();n=He(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(Ue(o,t,n,i))return j(()=>n=He(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Ge(e,n,r),s)return n}else c?n.length===0?We(e,o,r):Ae(e,n,o):(n&&Ge(e),We(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Ge(e,n,r,t);Ge(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function Ue(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=Ue(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=Ue(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function We(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ge(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var Ke=q(`<span><span class=dot></span> `),qe=q(`<span class="chip chip-plain">…`),Je=q(`<span class="chip chip-plain mode-badge"><span class=dot></span><span class=mode-badge-text>`),Ye=q(`<header class=topbar><div class=topbar-inner><a class=wordmark href=#/>dreb</a><nav><a href=#/>fleet</a><a href=#/files>files</a><a href=#/memories>memories</a><a href=#/settings>settings</a></nav><span class=topbar-spacer>`),Xe=q(`<button type=button class="btn btn-small">recovery failed — retry`),Ze=q(`<span><output aria-live=polite><span class=dot></span> `),Qe=q(`<div class=modal-actions>`),$e=q(`<div class=modal-backdrop role=presentation><div role=dialog><div class=modal-title></div><div class=modal-body>`),et=q(`<div class="container banner-region"aria-live=polite>`),tt=q(`<span class=banner-actions>`),nt=q(`<div><span class=banner-glyph aria-hidden=true>◆</span><span class=banner-text></span><button type=button class="btn btn-small banner-dismiss">dismiss`),rt=q(`<button type=button class="btn btn-small">`),it=q(`<div class=toast-region>`),at=q(`<div><span></span><button type=button class="btn btn-small"style=margin-left:auto>✕`);function ot(e){let t={running:`●`,attention:`◆`,idle:`○`,error:`✕`},n={running:`running`,attention:`needs attention`,idle:`idle`,error:`error`};return(()=>{var r=Ke(),i=r.firstChild;return i.nextSibling,Y(i,()=>t[e.status]),Y(r,()=>e.label??n[e.status],null),j(()=>Pe(r,`chip chip-${e.status}`)),r})()}function st(e){return e.error?`error`:e.needsAttention?`attention`:e.state.isStreaming||e.state.isRetrying||e.state.isCompacting?`running`:`idle`}function ct(e){let t=()=>e.store.auth();return U(G,{get when(){return t()},get fallback(){return qe()},children:e=>{let t=()=>e().mode===`local`?`local · 127.0.0.1`:`remote · ${e().device??e().identity??`device`} via tailscale`;return(()=>{var n=Je(),r=n.firstChild,i=r.nextSibling;return Y(r,()=>e().mode===`local`?`⌂`:`⇄`),Y(i,t),j(()=>J(n,`title`,t())),n})()}})}function lt(e){let t=()=>Object.values(e.store.sessions).filter(e=>e.needsAttention).length+e.store.fleet().runtimes.filter(e=>e.needsAttention).length;return(()=>{var n=Ye(),r=n.firstChild,i=r.firstChild.nextSibling,a=i.firstChild;a.firstChild;var o=a.nextSibling,s=o.nextSibling,c=s.nextSibling;return i.nextSibling,Y(a,()=>t()>0?` ◆`:``,null),Y(r,U(ut,{get store(){return e.store}}),null),Y(r,U(ct,{get store(){return e.store}}),null),j(t=>{var n=e.active===`fleet`?`page`:void 0,r=e.active===`files`?`page`:void 0,i=e.active===`memories`?`page`:void 0,l=e.active===`settings`?`page`:void 0;return n!==t.e&&J(a,`aria-current`,t.e=n),r!==t.t&&J(o,`aria-current`,t.t=r),i!==t.a&&J(s,`aria-current`,t.a=i),l!==t.o&&J(c,`aria-current`,t.o=l),t},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()}function ut(e){let t=()=>e.store.resyncing()?`resyncing`:e.store.connection().state,n=()=>{switch(t()){case`connected`:return{glyph:`●`,text:`live`,tone:`idle`};case`connecting`:return{glyph:`…`,text:`connecting`,tone:`attention`};case`retrying`:{let t=e.store.connection().retryDelayMs;return{glyph:`↻`,text:`retrying${t===void 0?``:` in ${Math.ceil(t/1e3)}s`}`,tone:`attention`}}case`resyncing`:return{glyph:`↻`,text:`recovering live state`,tone:`attention`};case`auth_failed`:return{glyph:`✕`,text:`live connection unauthorized`,tone:`error`};default:return{glyph:`✕`,text:`live connection disconnected`,tone:`error`}}};return(()=>{var t=Ze(),r=t.firstChild,i=r.firstChild;return i.nextSibling,Y(i,()=>n().glyph),Y(r,()=>n().text,null),Y(t,U(G,{get when(){return e.store.resyncError()},get children(){var t=Xe();return t.$$click=()=>void e.store.retryResync(),j(()=>J(t,`title`,e.store.resyncError())),t}}),null),j(i=>{var a=`connection-indicator ${e.class??``}`.trim(),o=`chip chip-${n().tone}`;return a!==i.e&&Pe(t,i.e=a),o!==i.t&&Pe(r,i.t=o),i},{e:void 0,t:void 0}),t})()}function dt(e){return(()=>{var t=$e(),n=t.firstChild,r=n.firstChild,i=r.nextSibling;return t.$$keydown=t=>{t.key===`Escape`&&e.onDismiss()},t.$$click=t=>{t.target===t.currentTarget&&e.onDismiss()},Y(r,()=>e.title),Y(i,()=>e.children),Y(n,U(G,{get when(){return e.actions},get children(){var t=Qe();return Y(t,()=>e.actions),t}}),null),j(t=>{var r=`modal ${e.class??``}`,i=e.title;return r!==t.e&&Pe(n,t.e=r),i!==t.t&&J(n,`aria-label`,t.t=i),t},{e:void 0,t:void 0}),t})()}function ft(e){return U(G,{get when(){return e.banners.length>0},get children(){var t=et();return Y(t,U(W,{get each(){return e.banners},children:e=>(()=>{var t=nt(),n=t.firstChild.nextSibling,r=n.nextSibling;return Y(n,()=>e.text),Y(t,U(G,{get when(){return(e.actions?.length??0)>0},get children(){var t=tt();return Y(t,U(W,{get each(){return e.actions},children:e=>(()=>{var t=rt();return t.$$click=()=>void e.run(),Y(t,()=>e.label),j(()=>t.disabled=e.disabled),t})()})),t}}),r),Fe(r,`click`,e.onDismiss,!0),j(n=>{var r=`banner ${e.tone}`,i=e.key;return r!==n.e&&Pe(t,n.e=r),i!==n.t&&J(t,`data-banner-key`,n.t=i),n},{e:void 0,t:void 0}),t})()})),t}})}function pt(e){return(()=>{var t=it();return Y(t,U(W,{get each(){return e.toasts},children:t=>(()=>{var n=at(),r=n.firstChild,i=r.nextSibling;return Y(r,()=>t.text),i.$$click=()=>e.onDismiss(t.id),j(()=>Pe(n,`toast ${t.tone}`)),n})()})),t})()}function mt(e){if(!e)return``;let t=typeof e==`number`?e:Date.parse(e);if(Number.isNaN(t))return``;let n=Math.floor((Date.now()-t)/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:`${Math.floor(a/30)}mo ago`}function ht(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}Ne([`click`,`keydown`]);function gt(e,t,n,r){if(typeof r==`object`&&r&&`error`in r)return String(r.error);let i=typeof r==`string`?r:String(r);return/^\s*<(?:!doctype|html)/i.test(i)?`${(t?.method??`GET`).toUpperCase()} ${e} → ${n} ${n===404?`Not Found`:`error`}`:i.trim()||`Request failed (${n})`}async function X(e,t){let n=await fetch(e,t),r=(n.headers.get(`content-type`)??``).includes(`application/json`)?await n.json():await n.text();if(!n.ok){let i=gt(e,t,n.status,r);throw Object.assign(Error(i),{status:n.status,body:r})}return r}function Z(e){return{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}}function _t(e,t){return{method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}}function vt(e,t){return t?`${e}?cwd=${encodeURIComponent(t)}`:e}var Q=/^[0-9a-f]{64}$/;function yt(e,t,n,r){if(!Q.test(t)||e.length===0)return;let i=encodeURIComponent(e);return`${r?`/api/runtimes/${i}/subagents/${encodeURIComponent(r)}/images`:`/api/runtimes/${i}/images`}/${t}/${n}`}var $={auth:e=>X(`/api/auth`,{signal:e}),connectionDiagnostic:e=>X(`/api/events/diagnostic`,Z(e)),pair:e=>X(`/api/pair`,Z({pin:e})),pairingCode:()=>X(`/api/pairing-code`),pairingSettings:()=>X(`/api/pairing-settings`),savePairingSettings:e=>X(`/api/pairing-settings`,_t(`PUT`,{pairingTtlDays:e})),devices:()=>X(`/api/devices`),unpair:e=>X(`/api/devices/${encodeURIComponent(e)}`,{method:`DELETE`}),fleet:()=>X(`/api/fleet`),sessions:()=>X(`/api/sessions`),resync:(e,t,n)=>{let r=new URLSearchParams;return e&&r.set(`key`,e),t&&r.set(`agentId`,t),X(`/api/resync${r.size?`?${r}`:``}`,{signal:n})},createRuntime:(e,t={})=>X(`/api/runtimes`,Z({cwd:e,...t})),stopRuntime:e=>X(`/api/runtimes/${e}`,{method:`DELETE`}),runtime:(e,t)=>X(`/api/runtimes/${e}`,{signal:t}),hydrate:(e,t)=>X(`/api/runtimes/${e}/hydrate`,{signal:t}),messages:(e,t)=>X(`/api/runtimes/${e}/messages`,{signal:t}),pending:e=>X(`/api/runtimes/${e}/pending`),dequeue:e=>X(`/api/runtimes/${e}/dequeue`,{method:`POST`}),prompt:(e,t,n,r)=>X(`/api/runtimes/${e}/prompt`,Z({message:t,mode:n,images:r})),abort:e=>X(`/api/runtimes/${e}/abort`,{method:`POST`}),abortCompaction:e=>X(`/api/runtimes/${e}/abort-compaction`,{method:`POST`}),abortRetry:e=>X(`/api/runtimes/${e}/abort-retry`,{method:`POST`}),setModel:(e,t,n)=>X(`/api/runtimes/${e}/model`,Z({provider:t,modelId:n})),models:e=>X(`/api/runtimes/${e}/models`),setThinking:(e,t)=>X(`/api/runtimes/${e}/thinking`,Z({level:t})),compact:(e,t)=>X(`/api/runtimes/${e}/compact`,Z({instructions:t})),newSession:e=>X(`/api/runtimes/${e}/new-session`,{method:`POST`}),reload:e=>X(`/api/runtimes/${e}/reload`,{method:`POST`}),dream:(e,t)=>X(`/api/runtimes/${e}/dream`,Z({args:t})),importJsonl:(e,t)=>X(`/api/runtimes/${e}/import`,Z({inputPath:t})),rename:(e,t)=>X(`/api/runtimes/${e}/name`,Z({name:t})),stats:(e,t)=>X(`/api/runtimes/${e}/stats`,{signal:t}),performance:e=>X(`/api/runtimes/${e}/performance`),resources:e=>X(`/api/runtimes/${e}/resources`),commands:e=>X(`/api/runtimes/${e}/commands`),branch:e=>X(`/api/runtimes/${e}/branch`),forkMessages:e=>X(`/api/runtimes/${e}/fork-messages`),fork:(e,t)=>X(`/api/runtimes/${e}/fork`,Z({entryId:t})),tree:e=>X(`/api/runtimes/${e}/tree`),navigateTree:(e,t)=>X(`/api/runtimes/${e}/tree`,Z({targetId:t})),runtimeSessions:e=>X(`/api/runtimes/${e}/sessions`),resume:(e,t)=>X(`/api/runtimes/${e}/resume`,Z({sessionPath:t})),backgroundAgents:(e,t)=>X(`/api/runtimes/${e}/background-agents`,{signal:t}),subagentMessages:(e,t,n)=>X(`/api/runtimes/${e}/subagents/${encodeURIComponent(t)}/messages`,{signal:n}),subagentPending:(e,t)=>X(`/api/runtimes/${e}/subagents/${encodeURIComponent(t)}/pending`),steerSubagent:(e,t,n)=>X(`/api/runtimes/${e}/subagents/${encodeURIComponent(t)}/steer`,Z({message:n})),extensionUiResponse:(e,t)=>X(`/api/runtimes/${e}/extension-ui-response`,Z(t)),exportHtmlUrl:e=>`/api/runtimes/${e}/export-html`,deleteSession:e=>X(`/api/sessions`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e})}),settings:e=>X(vt(`/api/settings`,e)),saveSettings:(e,t)=>X(vt(`/api/settings`,t),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),settingsModels:e=>X(vt(`/api/settings/models`,e)),agentTypes:e=>X(e?`/api/settings/agent-types?cwd=${encodeURIComponent(e)}`:`/api/settings/agent-types`),version:()=>X(`/api/version`),serverInfo:()=>X(`/api/server/info`),restartServer:()=>X(`/api/server/restart`,{method:`POST`}),dailyCost:()=>X(`/api/daily-cost`),listFiles:e=>X(`/api/files?path=${encodeURIComponent(e)}`),trustContextFolder:e=>X(`/api/files/trust`,Z({path:e})),untrustContextFolder:e=>X(`/api/files/untrust`,Z({path:e})),removeTrustedContextFolder:e=>X(`/api/settings/remove-trusted`,Z({path:e})),places:()=>X(`/api/files/places`),memoryScopes:()=>X(`/api/memories/scopes`),memoryListing:e=>X(`/api/memories/${encodeURIComponent(e)}`),memoryDocument:(e,t)=>X(`/api/memories/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}`),saveMemoryDocument:(e,t,n,r)=>X(`/api/memories/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}`,_t(`PUT`,{content:n,revision:r})),deleteMemoryEntry:(e,t,n,r)=>X(`/api/memories/${encodeURIComponent(e)}/entries/${encodeURIComponent(t)}`,_t(`DELETE`,{revision:n,indexRevision:r})),downloadUrl:e=>`/api/files/download?path=${encodeURIComponent(e)}`,upload:async(e,t,n)=>{let r=await fetch(`/api/files/upload?dir=${encodeURIComponent(e)}&name=${encodeURIComponent(t.name)}&overwrite=${n}`,{method:`POST`,body:t}),i=await r.json();if(!r.ok)throw Object.assign(Error(String(i.error??r.statusText)),{status:r.status});return i},mkdir:(e,t)=>X(`/api/files/mkdir`,Z({dir:e,name:t}))},bt=1,xt=6e4,St=6e4,Ct=1e4;function wt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Number.isSafeInteger(t.seq)&&t.seq>0&&typeof t.key==`string`&&!!t.event&&typeof t.event==`object`&&!Array.isArray(t.event)}function Tt(e,t={}){let n=t.EventSource??EventSource,r=t.now??Date.now,i=t.random??Math.random,a=t.setTimeout??setTimeout,o=t.clearTimeout??clearTimeout,s=t.setInterval??setInterval,c=t.clearInterval??clearInterval,l=t.visibility??document,u=t.status??$.auth,d=t.diagnostic??(e=>$.connectionDiagnostic(e)),f=t.baseDelayMs??1e3,p=t.maxDelayMs??3e4,m=t.healthyResetMs??xt,h=t.watchdogMs??St,g=t.statusTimeoutMs??Ct,_,v,y,b,x,S,C=0,w=!1,T=0,E,D=r(),O,k,A,j=0,M=0,N=0,P={state:`connecting`,attempt:0};function F(){return l.visibilityState!==`hidden`}function I(t){let n=P.state;if(P={...t,...E===void 0?{}:{lastAppliedSeq:E}},e.onStatusChange?.(P),!k)return;let i=Math.max((r()-(A??r()))/6e4,1/60);Promise.resolve(d({connectionId:k,state:P.state,...n===P.state?{}:{previousState:n},attempt:T,...P.retryDelayMs===void 0?{}:{delayMs:P.retryDelayMs},visibility:F()?`visible`:`hidden`,...E===void 0?{}:{lastAppliedSeq:E},heartbeatAgeMs:Math.max(0,r()-D),eventCount:j,eventRatePerMinute:j/i,processingLagTotalMs:M,processingLagMaxMs:N})).catch(()=>{})}function L(){b!==void 0&&o(b),b=void 0}function ee(){_&&(v&&_.removeEventListener(`heartbeat`,v),y&&_.removeEventListener(`connection`,y),v=void 0,y=void 0,_.onopen=null,_.onmessage=null,_.onerror=null,_.close(),_=void 0,O=void 0,k=void 0,A=void 0,j=0,M=0,N=0)}function R(){let e=Math.min(p,f*2**Math.max(0,T-1));return Math.min(p,Math.max(0,Math.round(e*(.75+i()*.5))))}function te(){if(w||b!==void 0||P.state===`auth_failed`)return;T+=1;let e=R(),t=r()+e;I({state:`retrying`,attempt:T,retryDelayMs:e,retryAt:t}),b=a(()=>{b=void 0,oe()},e)}function ne(t){w||(I({state:`resyncing`,attempt:T}),ee(),e.onRecovery?.(t),t===`watchdog`&&!S?ae():te())}function re(){S&&=(S.timeout!==void 0&&o(S.timeout),S.controller.abort(),void 0)}function ie(t,n){if(S||w)return;let r={controller:new AbortController,timeout:void 0};S=r;let i=!1,s=e=>{i||(i=!0,r.timeout!==void 0&&o(r.timeout),!w&&S===r&&e(),S===r&&(S=void 0))};r.timeout=a(()=>{r.controller.abort(),s(()=>n(Object.assign(Error(`dashboard authentication validation timed out`),{status:void 0})))},g);try{Promise.resolve(u(r.controller.signal)).then(n=>s(()=>{e.onAuthStatus?.(n),t()}),e=>s(()=>n(e)))}catch(e){s(()=>n(e))}}function ae(){ie(()=>te(),e=>{if(e?.status===401||e?.status===403){L(),I({state:`auth_failed`,attempt:T});return}te()})}function oe(){if(w||_)return;L();let t=++C;I({state:`connecting`,attempt:T});let i=E===void 0?`/api/events`:`/api/events?lastEventId=${E}`,a=new n(i);_=a,D=r(),O=void 0;let o=()=>{w||t!==C||_!==a||(D=r(),T>0&&O!==void 0&&D-O>=m&&(T=0,I({state:`connected`,attempt:T})))};a.onopen=()=>{w||t!==C||_!==a||(O=r(),o(),I({state:`connected`,attempt:T}))},v=()=>o(),a.addEventListener(`heartbeat`,v),y=n=>{if(!(w||t!==C||_!==a))try{let t=JSON.parse(n.data);if(typeof t.connectionId!=`string`)throw Error(`missing connection id`);k=t.connectionId,A=r(),j=0,M=0,N=0,e.onConnectionMetadata?.(k),o(),I(P)}catch{ne(`protocol`)}},a.addEventListener(`connection`,y),a.onmessage=n=>{if(w||t!==C||_!==a)return;D=r();let i;try{if(i=JSON.parse(n.data),!wt(i))throw Error(`invalid dashboard SSE envelope`);let e=i.event.type===`dashboard_resync`;if(!e&&E!==void 0&&i.seq<=E)return;if(!e&&E!==void 0&&i.seq!==E+1)throw Error(`dashboard SSE sequence gap`)}catch{ne(`protocol`);return}let s=r();try{e.onEnvelope(i)}catch{ne(`handler`);return}E=i.seq,j+=1;let c=Math.max(0,r()-s);M+=c,N=Math.max(N,c),o()},a.onerror=()=>{w||t!==C||_!==a||(I({state:`disconnected`,attempt:T}),ee(),ae())}}let z=()=>{w||!F()||S||ie(()=>{(!_||_.readyState!==bt||r()-D>h)&&ne(`watchdog`)},e=>{if(e?.status===401||e?.status===403){L(),I({state:`auth_failed`,attempt:T}),ee();return}ne(`watchdog`)})};return l.addEventListener(`visibilitychange`,z),x=s(()=>{F()&&_&&r()-D>h&&ne(`watchdog`)},Math.min(h,5e3)),oe(),()=>{w=!0,C+=1,re(),L(),x!==void 0&&c(x),x=void 0,l.removeEventListener(`visibilitychange`,z),I({state:`disconnected`,attempt:T}),ee()}}var Et=q(`<p class=settings-error>`),Dt=q(`<div class=field><label for=mkdir-name>folder name</label><input id=mkdir-name type=text>`),Ot=q(`<div class=screen-fill><main class=container><div class=files-head><div><nav class=crumbs aria-label=breadcrumb></nav><p class=scope-note>whole host filesystem — you can browse anywhere the dreb process can read</p></div><div class=head-actions><button type=button class=btn>+ new folder</button><button type=button class=btn>↑ upload here</button><button type=button class="btn btn-primary">▸ new session here</button></div></div><section class=context-trust aria-live=polite></section><div class=places><span class=label>places</span></div><table class="table file-table"><thead><tr><th>name</th><th class="meta cols">size</th><th class="meta cols">modified</th><th></th></tr></thead><tbody></tbody></table><section class=drop-zone aria-label="file upload drop zone">drop a file here to upload to </section><p class=upload-warning>Uploads land on the host machine and become visible to any agent working near this path. Existing files are never overwritten silently — you'll be asked first.</p><input type=file style=display:none>`),kt=q(`<span class=sep>/`),At=q(`<a>`),jt=q(`<span>nested context trust: checking…`),Mt=q(`<div><strong>Nested context is untrusted.</strong><p>This folder's nested instructions are not loaded automatically.</p><button type=button class="btn btn-small btn-primary"></button><p class=context-trust-impact>Trusting this folder trusts it and all descendants.`),Nt=q(`<div><strong></strong><p></p><button type=button class="btn btn-small btn-danger"></button><p class=context-trust-impact>This removes trust from <!> and all of its descendants.`),Pt=q(`<div class=context-trust-warning><strong>Global expert trust is ON.</strong> Nested instructions from any resolvable directory may load, including prompt-injection content. Folder trust cannot override this global setting. <a href=#/settings>Disable global expert trust in Settings.`),Ft=q(`<button type=button class=place-chip>`),It=q(`<button type=button class=name><span class=icon>▸</span> <!>/`),Lt=q(`<a class="btn btn-small">↓ download`),Rt=q(`<tr><td></td><td class="meta cols"></td><td class="meta cols"></td><td class=actions>`),zt=q(`<span class=name><span class=icon>·</span> `),Bt=q(`<p>“<!>” already exists in <!>. Overwrite it?`),Vt=q(`<button type=button class="btn btn-small">cancel`),Ht=q(`<button type=button class="btn btn-small btn-danger">overwrite`),Ut=q(`<button type=button class="btn btn-small btn-primary">create`);function Wt(e){let t=e.split(`/`).filter(Boolean),n=[{label:`/`,path:`/`}],r=``;for(let e of t)r+=`/${e}`,n.push({label:e,path:r});return n}function Gt(e){let[t,n]=k(e.initialPath??``),[r,i]=k(),[a,o]=k(!1),[s,c]=k(),[l,u]=k(!1),[d,f]=k(``),[p,m]=k(!1),[h]=F(async()=>{let{places:e}=await $.places();return e}),[g,{mutate:_,refetch:v}]=F(()=>t(),async e=>{if(i(void 0),!e){let{places:e}=await $.places(),t=e.find(e=>e.label===`home`)?.path??`/`;return n(t),$.listFiles(t)}return $.listFiles(e)});async function y(e,n){try{await $.upload(t(),e,n),c(void 0),await v()}catch(t){t?.status===409&&!n?c(e):i(t instanceof Error?t.message:String(t))}}async function b(){try{let n=await $.createRuntime(t());e.store.upsertRuntime(n),await e.store.refreshDiskSessions()}catch(e){i(e instanceof Error?e.message:String(e))}}async function x(e){let n=g();if(n){i(void 0),m(!0);try{let r=e===`trust`?await $.trustContextFolder(n.path):await $.untrustContextFolder(n.path),i=g();t()===n.path&&i?.path===n.path&&_({...i,contextTrust:r.evaluation})}catch(e){i(e instanceof Error?e.message:String(e))}finally{m(!1)}}}let S;return(()=>{var m=Ot(),_=m.firstChild,C=_.firstChild,w=C.firstChild,T=w.firstChild,E=w.nextSibling.firstChild,D=E.nextSibling,O=D.nextSibling,k=C.nextSibling,A=k.nextSibling;A.firstChild;var M=A.nextSibling,N=M.firstChild.nextSibling,P=M.nextSibling;P.firstChild;var F=P.nextSibling.nextSibling;Y(m,U(lt,{get store(){return e.store},active:`files`}),_),Y(T,U(W,{get each(){return Wt(t())},children:(e,t)=>[U(G,{get when(){return t()>1},get children(){return kt()}}),(()=>{var t=At();return t.$$click=t=>{t.preventDefault(),n(e.path)},Y(t,()=>e.label),j(()=>J(t,`href`,`#/files/${encodeURIComponent(e.path)}`)),t})()]})),E.$$click=()=>u(!0),D.$$click=()=>S?.click(),O.$$click=b,Y(k,U(G,{get when(){return g()?.contextTrust},get fallback(){return jt()},children:e=>U(G,{get when(){return e().state===`untrusted`},get fallback(){return U(G,{get when(){return e().state===`trusted-root`},get fallback(){return Pt()},get children(){var t=Nt(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling,o=a.firstChild.nextSibling;return o.nextSibling,Y(n,()=>e().grantingRoot===e().canonicalTarget?`Nested context trusted for this folder`:`Nested context inherited from a trusted root`),Y(r,(()=>{var t=K(()=>e().grantingRoot===e().canonicalTarget);return()=>t()?`${e().grantingRoot} and all descendants are trusted.`:`${e().canonicalTarget} is covered by ${e().grantingRoot} and its descendants.`})()),i.$$click=()=>void x(`untrust`),Y(i,(()=>{var t=K(()=>!!p());return()=>t()?`removing trust…`:`untrust ${e().grantingRoot}`})()),Y(a,()=>e().grantingRoot,o),j(()=>i.disabled=p()),t}})},get children(){var e=Mt(),t=e.firstChild.nextSibling.nextSibling;return t.$$click=()=>void x(`trust`),Y(t,()=>p()?`trusting…`:`trust this folder and descendants`),j(()=>t.disabled=p()),e}})})),Y(A,U(W,{get each(){return h()??[]},children:e=>(()=>{var t=Ft();return t.$$click=()=>n(e.path),Y(t,()=>e.label),t})()}),null),Y(_,U(G,{get when(){return r()},get children(){var e=Et();return Y(e,r),e}}),M),Y(N,U(W,{get each(){return g()?.entries??[]},children:e=>(()=>{var t=Rt(),r=t.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return Y(r,U(G,{get when(){return e.type===`dir`},get fallback(){return(()=>{var t=zt();return t.firstChild.nextSibling,Y(t,()=>e.name,null),t})()},get children(){var t=It(),r=t.firstChild.nextSibling.nextSibling;return r.nextSibling,t.$$click=()=>n(`${g().path}/${e.name}`.replace(`//`,`/`)),Y(t,()=>e.name,r),t}})),Y(i,(()=>{var t=K(()=>e.type===`dir`);return()=>t()?`—`:ht(e.size)})()),Y(a,()=>mt(e.modified)),Y(o,U(G,{get when(){return e.type===`file`},get children(){var t=Lt();return j(()=>J(t,`href`,$.downloadUrl(`${g().path}/${e.name}`.replace(`//`,`/`)))),t}})),t})()})),P.addEventListener(`drop`,e=>{e.preventDefault(),o(!1);let t=e.dataTransfer?.files[0];t&&y(t,!1)}),P.addEventListener(`dragleave`,()=>o(!1)),P.addEventListener(`dragover`,e=>{e.preventDefault(),o(!0)}),Y(P,t,null),F.addEventListener(`change`,e=>{let t=e.currentTarget.files?.[0];t&&y(t,!1),e.currentTarget.value=``});var I=S;return typeof I==`function`?Re(I,F):S=F,Y(m,U(G,{get when(){return s()},children:e=>U(dt,{title:`file exists`,onDismiss:()=>c(void 0),get actions(){return[(()=>{var e=Vt();return e.$$click=()=>c(void 0),e})(),(()=>{var t=Ht();return t.$$click=()=>y(e(),!0),t})()]},get children(){var n=Bt(),r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;return i.nextSibling,Y(n,()=>e().name,r),Y(n,t,i),n}})}),null),Y(m,U(G,{get when(){return l()},get children(){return U(dt,{title:`new folder`,onDismiss:()=>u(!1),get actions(){return[(()=>{var e=Vt();return e.$$click=()=>u(!1),e})(),(()=>{var e=Ut();return e.$$click=async()=>{try{await $.mkdir(t(),d().trim()),u(!1),f(``),await v()}catch(e){i(e instanceof Error?e.message:String(e)),u(!1)}},j(()=>e.disabled=!d().trim()),e})()]},get children(){var e=Dt(),t=e.firstChild.nextSibling;return t.$$input=e=>f(e.currentTarget.value),j(()=>t.value=d()),e}})}}),null),j(()=>P.classList.toggle(`active`,!!a())),m})()}Ne([`click`,`input`]);var Kt=3e4,qt=new WeakMap;function Jt(e,t){let n=N(t),r=qt.get(e)??{lastStarted:Date.now()};qt.set(e,r),M(()=>{if(!n())return;let t,i=()=>{Date.now()-r.lastStarted>=Kt&&(r.lastStarted=Date.now(),e.refreshFleetStats()),t=setTimeout(i,Math.max(1,Kt-(Date.now()-r.lastStarted)))};i(),R(()=>clearTimeout(t))})}var Yt=`dreb.dashboard.expandThinking`,Xt=`dreb.dashboard.imageDisplayMode`,Zt=`dreb.dashboard.sessionSidebarCollapsed`,Qt=`dreb.dashboard.sessionSidebarWidth`,$t=`dreb.dashboard.toolAutoExpand`,en=[`read`,`edit`,`write`,`suggest_next`,`bash`],tn=!0,nn=!1,rn=new Set(en),an=Object.fromEntries(en.map(e=>[e,!0]));function on(e,t){if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return n===null?t:n===`true`}catch{return t}}function sn(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,t?`true`:`false`)}catch{}}function cn(e){return Number.isFinite(e)?Math.min(560,Math.max(240,Math.round(e))):260}function ln(){if(typeof window>`u`)return 260;try{let e=window.localStorage.getItem(Qt);return e?.trim()?cn(Number(e)):260}catch{return 260}}function un(){if(typeof window>`u`)return`previews`;try{let e=window.localStorage.getItem(Xt);return e===`placeholders`||e===`previews`||e===`originals`?e:`previews`}catch{return`previews`}}function dn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Xt,e)}catch{}}function fn(){if(typeof window>`u`)return{...an};try{let e=window.localStorage.getItem($t);if(e===null)return{...an};let t=JSON.parse(e),n={...an};for(let e of en)typeof t[e]==`boolean`&&(n[e]=t[e]);return n}catch{return{...an}}}function pn(e){if(!(typeof window>`u`))try{window.localStorage.setItem($t,JSON.stringify(e))}catch{}}var[mn,hn]=k(on(Yt,tn)),[gn,_n]=k(un()),[vn,yn]=k(fn()),[bn,xn]=k(on(Zt,nn)),[Sn,Cn]=k(ln()),wn=Sn;function Tn(e){let t=cn(e);if(Cn(t),!(typeof window>`u`))try{window.localStorage.setItem(Qt,String(t))}catch{}}var En=mn,Dn=gn,On=bn;function kn(e){hn(e),sn(Yt,e)}function An(e){_n(e),dn(e)}function jn(e,t){let n={...vn(),[e]:t};yn(n),pn(n)}function Mn(e){xn(e),sn(Zt,e)}function Nn(e){return vn()[e]??rn.has(e)}var Pn=q(`<div class=fleet-sidebar-resize role=separator tabindex=0 aria-label="Fleet sidebar width"aria-orientation=vertical>`),Fn=360,In=6;function Ln(e,t){let n=N(e),[r,i]=k(window.innerWidth),[a,o]=k(),s,c=N(()=>Math.max(0,Math.min(560,r()-Fn-In))),l=N(()=>Math.min(240,c())),u=e=>Math.min(c(),Math.max(l(),e)),d=N(()=>u(a()??wn()));function f(e){let t=s;t&&(e&&d()!==t.startWidth&&Tn(d()),s=void 0,o(void 0),t.element.hasPointerCapture(t.pointerId)&&t.element.releasePointerCapture(t.pointerId))}M(()=>{if(!n()){f(!1);return}let e=t(),r=()=>i(e?.getBoundingClientRect().width||window.innerWidth);r();let a=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);e&&a?.observe(e),window.addEventListener(`resize`,r),R(()=>{a?.disconnect(),window.removeEventListener(`resize`,r),f(!1)})}),R(()=>f(!1));let p=t=>{!e()||t.button!==0||s||(t.preventDefault(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId),s={element:t.currentTarget,pointerId:t.pointerId,startX:t.clientX,startWidth:d()},o(d()))},m=e=>{s?.pointerId===e.pointerId&&o(u(s.startWidth+e.clientX-s.startX))};return{width:d,min:l,max:c,dragging:()=>a()!==void 0,pointerDown:p,pointerMove:m,pointerUp:e=>{s?.pointerId===e.pointerId&&(m(e),f(!0))},pointerCancel:e=>{s?.pointerId===e.pointerId&&f(!1)},keyDown:t=>{if(!e())return;let n=t.key===`ArrowLeft`?d()-10:t.key===`ArrowRight`?d()+10:t.key===`Home`?l():t.key===`End`?c():void 0;n!==void 0&&(t.preventDefault(),t.stopPropagation(),f(!1),Tn(u(n)))}}}function Rn(e){return(()=>{var t=Pn();return Fe(t,`keydown`,e.resize.keyDown,!0),Fe(t,`lostpointercapture`,e.resize.pointerCancel),Fe(t,`pointercancel`,e.resize.pointerCancel),Fe(t,`pointerup`,e.resize.pointerUp,!0),Fe(t,`pointermove`,e.resize.pointerMove,!0),Fe(t,`pointerdown`,e.resize.pointerDown,!0),j(n=>{var r=!!e.resize.dragging(),i=e.id,a=Math.round(e.resize.min()),o=Math.round(e.resize.max()),s=Math.round(e.resize.width()),c=`${Math.round(e.resize.width())} pixels`;return r!==n.e&&t.classList.toggle(`dragging`,n.e=r),i!==n.t&&J(t,`aria-controls`,n.t=i),a!==n.a&&J(t,`aria-valuemin`,n.a=a),o!==n.o&&J(t,`aria-valuemax`,n.o=o),s!==n.i&&J(t,`aria-valuenow`,n.i=s),c!==n.n&&J(t,`aria-valuetext`,n.n=c),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()}Ne([`pointerdown`,`pointermove`,`pointerup`,`keydown`]);var zn=19660800-768*1024;function Bn(e){let t=e?.method;if(t===`select`||t===`confirm`||t===`input`||t===`editor`)return{id:String(e.id),method:t,title:String(e.title??``),message:e.message,options:e.options,prefill:e.prefill,placeholder:e.placeholder};if(t===`ask`){let t=(Array.isArray(e.questions)?e.questions:[]).map(e=>({question:String(e?.question??``),title:typeof e?.title==`string`?e.title:void 0,options:Array.isArray(e?.options)?e.options.map(e=>String(e)):void 0,allowFreeText:typeof e?.allowFreeText==`boolean`?e.allowFreeText:void 0,multiSelect:typeof e?.multiSelect==`boolean`?e.multiSelect:void 0,multiline:typeof e?.multiline==`boolean`?e.multiline:void 0}));return{id:String(e.id),method:`ask`,title:String(e.title??`Question`),questions:t,timeout:typeof e.timeout==`number`?e.timeout:void 0,expiresAt:typeof e.expiresAt==`number`?e.expiresAt:void 0}}}function Vn(e){return{key:e,entries:[],streaming:!1,compacting:!1,statusEntries:[],tasks:[],backgroundAgents:{},uiRequests:[],toasts:[],widgets:{above:[],below:[]},needsAttention:!1,subagents:{}}}var Hn=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),Un=/^[0-9a-f]{64}$/;function Wn(e){if(typeof e==`string`)return{text:e,images:[]};if(!Array.isArray(e))return{text:``,images:[]};let t=[],n=[];for(let r of e){let e=r;typeof e?.text==`string`?t.push(e.text):e?.type===`image_reference`&&typeof e.id==`string`&&Un.test(e.id)&&typeof e.mimeType==`string`&&Hn.has(e.mimeType)&&typeof e.size==`number`&&Number.isSafeInteger(e.size)&&e.size>0&&n.push({id:e.id,mimeType:e.mimeType,size:e.size})}return{text:t.join(`
|
|
2
2
|
`),images:n}}function Gn(e){return Wn(e).text}function Kn(e,t){let n=e.match(/<background-agent-complete>\n?([\s\S]*?)\n?<\/background-agent-complete>/)?.[1]?.trim();if(!n)return;let r=n.split(`
|
|
3
3
|
`),i=r.findIndex(e=>e.trim().length>0),a,o=n;return i>=0&&/^Background agent .+\.$/.test(r[i]?.trim()??``)&&(a=r[i].trim(),o=r.slice(i+1).join(`
|
|
4
|
-
`).trim()||a),{kind:`agent-result`,text:o,header:a,raw:e,timestamp:t}}function qn(e){let{text:t,images:n}=Wn(e.content);return Kn(t,e.timestamp)??{kind:`user`,text:t,images:n.length>0?n:void 0,timestamp:e.timestamp}}function Jn(e){if(!(e?.role!==`assistant`||e.stopReason!==`error`))return typeof e.errorMessage==`string`&&e.errorMessage.trim().length>0?e.errorMessage:`Unknown error`}function Yn(e){let t=[],n=new Map;for(let r of e)if(r.role===`user`)t.push(qn(r));else if(r.role===`assistant`){let e=[],i=[],a=()=>{if(e.length===0)return;let n={kind:`assistant`,blocks:e,model:r.model,streaming:!1,timestamp:r.timestamp};i.push(n),t.push(n),e=[]};if(Array.isArray(r.content)){for(let i of r.content)if(i.type===`text`&&typeof i.text==`string`)e.push({kind:`text`,text:i.text});else if(i.type===`thinking`&&typeof i.thinking==`string`)e.push({kind:`thinking`,text:i.thinking});else if(i.type===`toolCall`){a();let e=i,o={kind:`tool`,toolCallId:String(e.id??``),toolName:String(e.name??`tool`),args:e.arguments,status:`running`,resultText:``,startedAt:r.timestamp??Date.now()};n.set(o.toolCallId,o),t.push(o)}}a();let o=Jn(r);if(o&&i.length===0){let e={kind:`assistant`,blocks:[],model:r.model,streaming:!1,timestamp:r.timestamp};i.push(e),t.push(e)}let s=i.at(-1);s&&(s.stopReason=r.stopReason,s.errorMessage=o)}else if(r.role===`toolResult`){let e=n.get(String(r.toolCallId));if(e){e.status=r.isError?`error`:`done`;let t=Wn(r.content);e.resultText=t.text,t.images.length>0&&(e.images=t.images),e.details=r.details,e.endedAt=r.timestamp}}else if(r.role===`bashExecution`){let e=r;t.push({kind:`tool`,toolCallId:`bash-exec-${t.length}`,toolName:`bash (user)`,args:{command:e.command},status:`done`,resultText:e.output??``,startedAt:r.timestamp??Date.now()})}else if(r.role===`custom`){let e=r;t.push({kind:`custom`,tag:e.customType??`extension`,text:e.displayText??Gn(r.content)})}else if(r.role===`compactionSummary`){let e=r;t.push({kind:`summary`,label:`compaction`,text:e.summary??`context compacted`,tokensBefore:e.tokensBefore})}return t}var Xn=0,Zn=0;function Qn(e){return Zn+=1,{id:Zn,...e}}function $n(e){e.statusEntries=e.statusEntries.filter(e=>e.key!==`compaction`),e.compacting&&e.statusEntries.push(Qn({key:`compaction`,text:`compacting context…`,tone:`info`}))}var er=20;function tr(e){let t=e.toasts.length-er;t>0&&e.toasts.splice(0,t)}function nr(e){let t=Date.parse(e.startedAt);return Number.isFinite(t)?t:0}function rr(e){let t=Object.values(e.backgroundAgents).filter(e=>e.status!==`running`).sort((e,t)=>nr(e)-nr(t)||e.agentId.localeCompare(t.agentId)),n=t.length-20;if(!(n<=0))for(let r of t.slice(0,n))delete e.backgroundAgents[r.agentId],delete e.subagents[r.agentId]}function ir(e){e.needsAttention=e.uiRequests.length>0||e.statusEntries.some(e=>e.tone===`error`)||!!e.suggestedCommand}function ar(e){let t=e.reduce((e,t)=>e+(t.questions?.length??0),0);if(t!==0)return`waiting for input — ${t} question${t===1?``:`s`}`}var or=`provider-error`;function sr(e){e.statusEntries=e.statusEntries.filter(e=>e.key!==or),e.lastError=void 0}function cr(e,t){sr(e),e.statusEntries.push(Qn({key:or,text:t,tone:`error`})),e.lastError=t}function lr(e,t,n){if(sr(e),!n)for(let n=t.length-1;n>=0;--n){let r=t[n];if(r?.role!==`assistant`)continue;let i=Jn(r);i&&cr(e,i);break}ir(e)}function ur(e){for(let t=e.entries.length-1;t>=0;t--){let n=e.entries[t];if(n.kind===`assistant`)return n}}function dr(e,t){for(let n=e.entries.length-1;n>=0;n--){let r=e.entries[n];if(r.kind===`tool`&&r.toolCallId===t)return r}}function fr(e,t,n){let r=e.entries.indexOf(t);if(r<0)return;let i=new Set,a=n.map(t=>{if(t.kind!==`tool`)return t;let n=dr(e,t.toolCallId);return n?(i.add(n),n):t}),o=new Set([t,...i]),s=e.entries.slice(0,r).filter(e=>!o.has(e)).length,c=e.entries.filter(e=>!o.has(e));c.splice(s,0,...a),e.entries.splice(0,e.entries.length,...c)}function pr(e,t){switch(t.type){case`agent_start`:e.streaming=!0;break;case`agent_end`:{e.streaming=!1;let t=ur(e);t&&(t.streaming=!1);break}case`message_start`:{let n=t.message;n?.role===`user`?e.entries.push(qn(n)):n?.role===`assistant`&&e.entries.push({kind:`assistant`,blocks:[],model:n.model,streaming:!0,timestamp:n.timestamp});break}case`message_update`:{let n=t.assistantMessageEvent;if(!n)break;let r=ur(e);if((!r||!r.streaming)&&(r={kind:`assistant`,blocks:[],streaming:!0},e.entries.push(r)),n.type===`text_start`)r.blocks.push({kind:`text`,text:``});else if(n.type===`thinking_start`)r.blocks.push({kind:`thinking`,text:``});else if(n.type===`text_delta`||n.type===`thinking_delta`){let e=r.blocks[r.blocks.length-1];e&&(e.text+=n.delta??``)}else if(n.type===`text_end`||n.type===`thinking_end`){let e=r.blocks[r.blocks.length-1];e&&typeof n.content==`string`&&(e.text=n.content)}break}case`message_end`:{let n=t.message;if(n?.role===`assistant`){let t=ur(e),r=Yn([n]);t?.streaming?fr(e,t,r):e.entries.push(...r)}else if(n?.role===`user`){let t=e.entries[e.entries.length-1],r=qn(n);r.kind===`agent-result`?t?.kind===`agent-result`&&t.raw===r.raw||e.entries.push(r):t?.kind===`user`&&t.text===r.text?r.images&&(t.images=r.images):e.entries.push(r)}break}case`tool_execution_start`:{let n=String(t.toolCallId),r=dr(e,n);r?(r.toolName=String(t.toolName),r.args=t.args,r.status=`running`,r.resultText=``,r.images=void 0,r.details=void 0,r.startedAt=Date.now(),r.endedAt=void 0):e.entries.push({kind:`tool`,toolCallId:n,toolName:String(t.toolName),args:t.args,status:`running`,resultText:``,startedAt:Date.now()});break}case`tool_execution_update`:{let n=dr(e,String(t.toolCallId));if(n){let e=t.partialResult;if(typeof e==`string`)n.resultText=e,n.images=void 0;else if(e?.content){let t=Wn(e.content);n.resultText=t.text,n.images=t.images.length>0?t.images:void 0}}break}case`tool_execution_end`:{let n=dr(e,String(t.toolCallId));if(n){n.status=t.isError?`error`:`done`;let e=t.result;if(typeof e==`string`)n.resultText=e,n.images=void 0;else if(e?.content){let t=Wn(e.content);n.resultText=t.text,n.images=t.images.length>0?t.images:void 0}n.details=t.result?.details,n.endedAt=Date.now()}break}default:break}}function mr(e,t){switch(pr(e,t),t.type){case`agent_start`:e.workingText=`working`,e.workingSince=Date.now(),sr(e),e.suggestedCommand=void 0,e.uiRequests=[];break;case`agent_end`:e.workingText=void 0,e.workingSince=void 0,e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`&&e.key!==`paused`);break;case`message_end`:{let n=t.message;if(n?.role===`assistant`){let t=Jn(n);t?cr(e,t):sr(e)}break}case`tool_execution_start`:e.workingText=`${t.toolName}`;break;case`auto_compaction_start`:e.compacting=!0,t.reason===`overflow`&&sr(e),$n(e);break;case`auto_compaction_end`:{e.compacting=!1,$n(e);let n=t.result;if(n&&!t.aborted){let t=n.summary??`context compacted`;e.entries.some(e=>e.kind===`summary`&&e.label===`compaction`&&e.text===t&&e.tokensBefore===n.tokensBefore)||e.entries.push({kind:`summary`,label:`compaction`,text:t,tokensBefore:n.tokensBefore})}t.errorMessage&&e.statusEntries.push(Qn({key:`compaction-error`,text:String(t.errorMessage),tone:`error`}));break}case`auto_retry_start`:sr(e),e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`retrying (${t.attempt}/${t.maxAttempts}) — ${t.errorMessage}`,tone:`warning`}));break;case`auto_retry_end`:e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),!t.success&&t.finalError?cr(e,String(t.finalError)):t.success&&sr(e);break;case`stream_retry`:{e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`stream dropped, retrying (${t.attempt}/${t.maxAttempts})`,tone:`warning`}));let n=ur(e);n?.streaming&&e.entries.splice(e.entries.indexOf(n),1);break}case`length_retry`:{e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`response truncated, retrying with larger budget (${t.attempt}/${t.maxAttempts})`,tone:`warning`}));let n=ur(e);n?.streaming&&e.entries.splice(e.entries.indexOf(n),1);break}case`tasks_update`:e.tasks=t.tasks??[];break;case`suggest_next`:e.suggestedCommand=String(t.command);break;case`session_name_changed`:e.sessionName=String(t.name??``);break;case`background_agent_start`:e.backgroundAgents[String(t.agentId)]={agentId:String(t.agentId),agentType:String(t.agentType),taskSummary:String(t.taskSummary),startedAt:new Date().toISOString(),status:`running`,sessionDir:t.sessionDir};break;case`subagent_arbitration`:{let n=e.backgroundAgents[String(t.agentId)];if(n){let e={status:t.status,proposed:t.proposed,final:t.final??null,changed:t.changed??[],step:t.step,errorCode:t.errorCode,errorMessage:t.errorMessage};n.arbitrations=[...n.arbitrations??[],e],e.status===`success`&&e.final&&(n.agentType=e.final.agent)}break}case`background_agent_end`:{let n=e.backgroundAgents[String(t.agentId)];n&&(n.status=t.success?`completed`:`failed`,n.sessionFile=t.sessionFile??n.sessionFile);let r=e.subagents[String(t.agentId)];r&&(r.streaming=!1),rr(e);break}case`background_agent_event`:{let n=String(t.agentId),r=e.subagents[n];r||(r={agentId:n,entries:[],streaming:!0},e.subagents[n]=r);let i=t.event;if(i?.type===`session`)break;i?.type===`agent_start`&&i.model&&(r.model=i.model.id),pr(r,i);break}case`parent_paused_for_background_agents`:e.statusEntries=e.statusEntries.filter(e=>e.key!==`paused`),e.statusEntries.push(Qn({key:`paused`,text:`paused — waiting on ${t.runningAgentCount} background agent${t.runningAgentCount===1?``:`s`}`,tone:`warning`}));break;case`extension_ui_response_handled`:gr(e,String(t.id));break;case`extension_ui_request`:{let n=t.method,r=Bn(t);if(r)e.uiRequests.push(r);else if(n===`notify`){Xn+=1;let n=t.notifyType??`info`;e.toasts.push({id:Xn,text:String(t.message??``),tone:n}),tr(e)}else if(n===`setStatus`){let n=`ext:${t.statusKey??`default`}`;e.statusEntries=e.statusEntries.filter(e=>e.key!==n),t.statusText&&e.statusEntries.push(Qn({key:n,text:String(t.statusText),tone:`info`}))}else if(n===`setWidget`){let n=t.widgetPlacement===`belowEditor`?`below`:`above`;e.widgets[n]=Array.isArray(t.widgetLines)?t.widgetLines:[]}else n===`setTitle`?e.title=String(t.title??``):n===`set_editor_text`&&(e.composerPrefill=String(t.text??``));break}case`extension_error`:Xn+=1,e.toasts.push({id:Xn,text:`extension error: ${t.error}`,tone:`error`}),tr(e);break;default:break}ir(e)}function hr(e,t){e.toasts=e.toasts.filter(e=>e.id!==t)}function gr(e,t){e.uiRequests=e.uiRequests.filter(e=>e.id!==t),ir(e)}var _r=q(`<span class=session-title><span class=name>`),vr=q(`<span class=session-project>`),yr=q(`<span class=attention-reason>`),br=q(`<span class=error-reason>`),xr=q(`<span class=activity>`),Sr=q(`<span class=subagents><span>⚡ <!> running · <!> done`),Cr=q(`<span>tasks <!>/`),wr=q(`<span>·`),Tr=q(`<span>/`),Er=q(`<span>ctx <!>%`),Dr=q(`<span>$`),Or=q(`<span class=session-meta><span> msgs</span><span>·</span><span>`),kr=q(`<span class=agent-line><span class=live>●</span> <!> — `);function Ar(e,t){return e.sessions[t.key]?.lastError?`error`:st(t)}function jr(e,t){let n=e.sessions[t.key]?.entries??[];for(let e=n.length-1;e>=0;--e){let t=n[e];if(t.kind!==`assistant`)continue;let r=t.blocks.filter(e=>e.kind===`text`).map(e=>e.text).join(``).trim();if(r)return r.slice(0,200)}return t.lastAssistantText?.slice(0,200)}function Mr(e){let t=()=>e.store.sessions[e.runtime.key],n=()=>Ar(e.store,e.runtime),r=()=>e.runtime.backgroundAgents.filter(e=>e.status===`running`),i=()=>e.runtime.backgroundAgents.filter(e=>e.status!==`running`),a=()=>t()?.tasks??e.runtime.state.tasks??[],o=()=>a().filter(e=>e.status===`completed`).length,s=()=>e.runtime.state.contextUsage,c=()=>e.runtime.state.model,l=()=>{let n=t();return n?.workingText?`▸ ${n.workingText}`:n?.suggestedCommand?`suggested next: ${n.suggestedCommand}`:jr(e.store,e.runtime)};return[(()=>{var r=_r(),i=r.firstChild;return Y(i,()=>t()?.sessionName??e.runtime.state.sessionName??e.runtime.state.sessionId.slice(0,8)),Y(r,U(ot,{get status(){return n()}}),null),r})(),(()=>{var t=vr();return Y(t,()=>e.runtime.cwd.replace(/^\/home\/[^/]+/,`~`)),j(()=>J(t,`title`,e.runtime.cwd)),t})(),U(G,{get when(){return st(e.runtime)===`attention`},get children(){var e=yr();return Y(e,()=>ar(t()?.uiRequests??[])??`needs attention`),e}}),U(G,{get when(){return e.runtime.error??t()?.lastError},get children(){var n=br();return Y(n,()=>e.runtime.error??t()?.lastError),n}}),U(G,{get when(){return l()},get children(){var e=xr();return Y(e,l),e}}),U(G,{get when(){return e.runtime.backgroundAgents.length>0},get children(){var e=Sr(),t=e.firstChild,n=t.firstChild.nextSibling,a=n.nextSibling.nextSibling;return a.nextSibling,Y(t,()=>r().length,n),Y(t,()=>i().length,a),Y(e,U(W,{get each(){return r().slice(0,3)},children:e=>(()=>{var t=kr(),n=t.firstChild.nextSibling.nextSibling;return n.nextSibling,Y(t,()=>e.agentType,n),Y(t,()=>e.taskSummary,null),t})()}),null),e}}),(()=>{var t=Or(),n=t.firstChild,r=n.firstChild,i=n.nextSibling.nextSibling;return Y(t,U(G,{get when(){return a().length>0},get children(){return[(()=>{var e=Cr(),t=e.firstChild.nextSibling;return t.nextSibling,Y(e,o,t),Y(e,()=>a().length,null),e})(),wr()]}}),n),Y(t,U(G,{get when(){return c()},get children(){return[(()=>{var e=Tr(),t=e.firstChild;return Y(e,()=>c().provider,t),Y(e,()=>c().id,null),e})(),wr()]}}),n),Y(t,U(G,{get when(){return K(()=>!!s())()&&s().percent!==null},get children(){return[(()=>{var e=Er(),t=e.firstChild.nextSibling;return t.nextSibling,Y(e,()=>s().percent.toFixed(0),t),e})(),wr()]}}),n),Y(t,U(G,{get when(){return e.runtime.stats},get children(){return[(()=>{var t=Dr();return t.firstChild,Y(t,()=>e.runtime.stats.cost.toFixed(2),null),t})(),wr()]}}),n),Y(n,()=>e.runtime.state.messageCount,r),Y(i,()=>mt(e.runtime.lastActivity)),t})()]}var Nr=q(`<button type=button class="chrome-toggle fleet-sidebar-toggle">`),Pr=q(`<button type=button class="chrome-toggle fleet-sidebar-close">close fleet sidebar`),Fr=q(`<output class=error-reason>Stats refresh failed: `),Ir=q(`<aside aria-label="Other live sessions"class=fleet-sidebar>`),Lr=q(`<div class=fleet-sidebar-scrim aria-hidden=true>`),Rr=q(`<button type=button class=fleet-sidebar-entry>`);function zr(e){let t=[...e];return t.sort((e,t)=>{let n=e.cwd.localeCompare(t.cwd);return n===0?new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime():n}),t}function Br(){let[e,t]=k(!1),n=typeof window.matchMedia==`function`?window.matchMedia(`(max-width: 700px)`):void 0,[r,i]=k(n?.matches??!1),a=e=>{t(!1),i(e.matches)};return n?.addEventListener(`change`,a),R(()=>n?.removeEventListener(`change`,a)),{id:`fleet-sidebar-${Ee()}`,mobile:r,open:e,collapsed:On,toggle:()=>{r()?t(e=>!e):Mn(!On())},close:()=>t(!1)}}function Vr(e){let t=N(()=>{let t={idle:0,running:1,attention:2,error:3};return e.runtimes.reduce((n,r)=>{let i=Ar(e.store,r);return t[i]>t[n]?i:n},`idle`)}),n=()=>e.hidden?`show other sessions; highest priority: ${t()===`attention`?`needs attention`:t()}`:`hide other sessions`;return(()=>{var r=Nr();return r.$$click=()=>e.onToggle(),Y(r,()=>e.hidden?`fleet ▸`:`fleet ◂`),j(i=>{var a=e.hidden?t():void 0,o=n(),s=n(),c=e.id,l=!e.hidden;return a!==i.e&&J(r,`data-status`,i.e=a),o!==i.t&&J(r,`title`,i.t=o),s!==i.a&&J(r,`aria-label`,i.a=s),c!==i.o&&J(r,`aria-controls`,i.o=c),l!==i.i&&J(r,`aria-expanded`,i.i=l),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()}function Hr(e){let t=N(()=>zr(e.store.fleet().runtimes.filter(t=>t.key!==e.sessionKey))),n,r=N(()=>!e.mobile&&!e.collapsed&&t().length>0),i=Ln(r,()=>n?.parentElement??void 0),a=N(()=>e.mobile&&e.open&&t().length>0),o=()=>e.mobile?!e.open:e.collapsed;return Jt(e.store,()=>!o()&&t().length>0),M(()=>{if(!a())return;let t=document.activeElement;n?.querySelector(`.fleet-sidebar-close`)?.focus({preventScroll:!0});let r=t=>{let r=t.target instanceof Element?t.target:void 0;if(!(r?.closest(`[role="dialog"]`)&&!n?.contains(r))&&!t.defaultPrevented)if(t.key===`Escape`)t.preventDefault(),t.stopPropagation(),e.onClose();else if(t.key===`Tab`){t.stopPropagation();let e=n?.querySelectorAll(`button:not(:disabled)`),r=e?.[0],i=e?.[e.length-1];t.shiftKey&&(document.activeElement===r||!n?.contains(document.activeElement))?(t.preventDefault(),i?.focus()):!t.shiftKey&&(document.activeElement===i||!n?.contains(document.activeElement))&&(t.preventDefault(),r?.focus())}else r&&n?.contains(r)&&t.stopPropagation()};document.addEventListener(`keydown`,r),R(()=>{document.removeEventListener(`keydown`,r),n?.contains(document.activeElement)&&t instanceof HTMLElement&&t.isConnected&&t.focus({preventScroll:!0})})}),U(G,{get when(){return t().length>0},get children(){return[(()=>{var r=Ir(),s=n;return typeof s==`function`?Re(s,r):n=r,Y(r,U(G,{get when(){return e.mobile},get children(){var t=Pr();return t.$$click=()=>e.onClose(),t}}),null),Y(r,U(G,{get when(){return e.store.fleetStatsError()},get children(){var t=Fr();return t.firstChild,Y(t,()=>e.store.fleetStatsError(),null),t}}),null),Y(r,U(W,{get each(){return t()},children:t=>{let n=()=>Ar(e.store,t);return(()=>{var r=Rr();return r.$$click=()=>e.onNavigate(t.key),Y(r,U(Mr,{get store(){return e.store},runtime:t})),j(e=>{var i=n()===`attention`,a=n()===`error`,o=t.cwd;return i!==e.e&&r.classList.toggle(`attention`,e.e=i),a!==e.t&&r.classList.toggle(`error`,e.t=a),o!==e.a&&J(r,`title`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),r})()}}),null),j(t=>{var n=e.id,s=e.mobile?`dialog`:`complementary`,c=a()?!0:void 0,l=o(),u=o(),d=`${i.width()}px`,f=!!(e.mobile&&e.open),p=!!(!e.mobile&&e.collapsed);return n!==t.e&&J(r,`id`,t.e=n),s!==t.t&&J(r,`role`,t.t=s),c!==t.a&&J(r,`aria-modal`,t.a=c),l!==t.o&&J(r,`aria-hidden`,t.o=l),u!==t.i&&(r.inert=t.i=u),d!==t.n&&Le(r,`--fleet-sidebar-width`,t.n=d),f!==t.s&&r.classList.toggle(`open`,t.s=f),p!==t.h&&r.classList.toggle(`collapsed`,t.h=p),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),r})(),U(G,{get when(){return r()},get children(){return U(Rn,{resize:i,get id(){return e.id}})}}),U(G,{get when(){return K(()=>!!e.mobile)()&&e.open},get children(){var t=Lr();return t.$$click=()=>e.onClose(),t}})]}})}Ne([`click`]);var Ur=q(`<article class=session-card><div class=session-actions><button type=button class="btn btn-small btn-primary">open</button><button type=button class="btn btn-small btn-danger">stop runtime`),Wr=q(`<div class=field><label for=new-session-cwd>project path</label><input id=new-session-cwd type=text placeholder=/path/to/project>`),Gr=q(`<div class=field><label for=recent-projects-list>recent projects</label><div class=recent-projects id=recent-projects-list>`),Kr=q(`<div class=field><label for=new-session-prompt>first prompt (optional)</label><textarea id=new-session-prompt rows=3>`),qr=q(`<p class=pair-error>`),Jr=q(`<button type=button class="btn btn-small">cancel`),Yr=q(`<button type=button class="btn btn-small btn-primary">`),Xr=q(`<button type=button>`),Zr=q(`<div class=settings-error role=alert>Fleet could not be loaded: `),Qr=q(`<div class=settings-error role=alert>Fleet stats could not be refreshed: `),$r=q(`<section class=live-sessions><div class=session-grid>`),ei=q(`<section class=past-sessions><h2 class=past-sessions-head>past sessions`),ti=q(`<div class=screen-fill><main class=container><div class=fleet-head><div><h1>fleet</h1><p class="muted small"> live · <!> needs attention · <!> on disk</p></div><button type=button class="btn btn-primary">+ new session`),ni=q(`<div class=empty-state><p>No sessions yet.</p><p style=margin-top:8px><button type=button class="btn btn-primary">+ create your first session`),ri=q(`<button type=button class=disk-more>`),ii=q(`<section class=project-group><div class=group-head><h3></h3><span class="muted small"> on disk</span><button type=button class="btn btn-small">+ new`),ai=q(`<div class=disk-row><span class=name></span><span class=meta> msgs · </span><span class=actions><button type=button class="btn btn-small">resume</button><button type=button class="btn btn-small btn-danger">delete`),oi=q(`<p> — <!> messages. The session file is moved to trash where supported.`),si=q(`<button type=button class="btn btn-small btn-danger">delete`);function ci(e){return e===`/tmp`||e.startsWith(`/tmp/`)?`/tmp`:e}function li(e){return e.replace(/^\/home\/[^/]+/,`~`)}function ui(e){let t=()=>Ar(e.store,e.runtime);return(()=>{var n=Ur(),r=n.firstChild,i=r.firstChild,a=i.nextSibling;return Y(n,U(Mr,{get store(){return e.store},get runtime(){return e.runtime}}),r),i.$$click=()=>e.store.navigate({screen:`session`,key:e.runtime.key}),a.$$click=async()=>{await $.stopRuntime(e.runtime.key),await e.store.removeRuntime(e.runtime.key)},j(e=>{var r=t()===`attention`,i=t()===`error`;return r!==e.e&&n.classList.toggle(`attention`,e.e=r),i!==e.t&&n.classList.toggle(`error`,e.t=i),e},{e:void 0,t:void 0}),n})()}function di(e){let[t,n]=k(e.initialCwd??``),[r,i]=k(``),[a,o]=k(),[s,c]=k(!1);async function l(){c(!0),o(void 0);try{let n=await $.createRuntime(t(),{firstPrompt:r()||void 0});e.store.upsertRuntime(n),await e.store.refreshDiskSessions(),e.onClose()}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}}return U(dt,{title:`new session`,get onDismiss(){return e.onClose},get actions(){return[(()=>{var t=Jr();return Fe(t,`click`,e.onClose,!0),t})(),(()=>{var e=Yr();return e.$$click=l,Y(e,()=>s()?`starting…`:`start session`),j(()=>e.disabled=s()||!t()),e})()]},get children(){return[(()=>{var e=Wr(),r=e.firstChild.nextSibling;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),U(G,{get when(){return e.recentProjects.length>0},get children(){var t=Gr(),r=t.firstChild.nextSibling;return Y(r,U(W,{get each(){return e.recentProjects},children:e=>(()=>{var t=Xr();return t.$$click=()=>n(e),Y(t,()=>li(e)),t})()})),t}}),(()=>{var e=Kr(),t=e.firstChild.nextSibling;return t.$$input=e=>i(e.currentTarget.value),j(()=>t.value=r()),e})(),U(G,{get when(){return a()},get children(){var e=qr();return Y(e,a),e}})]}})}function fi(e){let[t,n]=k(),[r,i]=k(!1),[a,o]=k(),[s,c]=k({}),[l,u]=k(),d=N(()=>zr(e.store.fleet().runtimes)),f=N(()=>{let t=e.store.fleet(),n=new Set(t.runtimes.map(e=>e.state.sessionFile).filter(Boolean)),r=new Map;for(let e of t.diskSessions){if(n.has(e.path))continue;let t=ci(e.cwd),i=r.get(t)??[];i.push(e),r.set(t,i)}let i=[...r.entries()];return i.sort(([,e],[,t])=>new Date(t[0]?.modified??0).getTime()-new Date(e[0]?.modified??0).getTime()),i}),p=N(()=>{let t=e.store.fleet();return{live:t.runtimes.length,attention:t.runtimes.filter(e=>e.needsAttention).length,disk:t.diskSessions.length}}),m=N(()=>{let t=new Set;for(let n of e.store.fleet().runtimes)t.add(n.cwd);for(let n of e.store.fleet().diskSessions)t.add(n.cwd);return[...t].slice(0,8)});Jt(e.store,()=>!0);async function h(t){u(void 0);try{let n=await $.createRuntime(t.cwd,{sessionPath:t.path});e.store.upsertRuntime(n),await e.store.refreshDiskSessions(),e.store.navigate({screen:`session`,key:n.key})}catch(e){u(`Failed to resume session: ${e instanceof Error?e.message:String(e)}`)}}return(()=>{var u=ti(),g=u.firstChild,_=g.firstChild.firstChild,v=_.firstChild.nextSibling,y=v.firstChild,b=y.nextSibling,x=b.nextSibling.nextSibling;x.nextSibling;var S=_.nextSibling;return Y(u,U(lt,{get store(){return e.store},active:`fleet`}),g),Y(v,()=>p().live,y),Y(v,()=>p().attention,b),Y(v,()=>p().disk,x),S.$$click=()=>{n(void 0),i(!0)},Y(g,U(G,{get when(){return e.store.fleetError()},get children(){var t=Zr();return t.firstChild,Y(t,()=>e.store.fleetError(),null),t}}),null),Y(g,U(G,{get when(){return e.store.fleetStatsError()},get children(){var t=Qr();return t.firstChild,Y(t,()=>e.store.fleetStatsError(),null),t}}),null),Y(g,U(G,{get when(){return d().length>0||f().length>0||e.store.fleetError()},get fallback(){return(()=>{var e=ni(),t=e.firstChild.nextSibling.firstChild;return t.$$click=()=>i(!0),e})()},get children(){return[U(G,{get when(){return d().length>0},get children(){var t=$r(),n=t.firstChild;return Y(n,U(W,{get each(){return d()},children:t=>U(ui,{get store(){return e.store},runtime:t})})),t}}),U(G,{get when(){return f().length>0},get children(){var e=ei();return e.firstChild,Y(e,U(G,{get when(){return l()},get children(){var e=qr();return Y(e,l),e}}),null),Y(e,U(W,{get each(){return f()},children:([e,t])=>{let r=()=>s()[e]??!1,a=()=>r()?t:t.slice(0,3);return(()=>{var s=ii(),l=s.firstChild.firstChild,u=l.nextSibling,d=u.firstChild,f=u.nextSibling;return Y(l,()=>li(e)),Y(u,()=>t.length,d),f.$$click=()=>{n(e),i(!0)},Y(s,U(W,{get each(){return a()},children:e=>(()=>{var t=ai(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=r.nextSibling.firstChild,s=a.nextSibling;return Y(n,()=>e.name??`“${e.firstMessage.slice(0,60)}…”`),Y(r,()=>e.messageCount,i),Y(r,()=>mt(e.modified),null),a.$$click=()=>h(e),s.$$click=()=>o(e),j(()=>n.classList.toggle(`muted`,!e.name)),t})()}),null),Y(s,U(G,{get when(){return t.length>3},get children(){var n=ri();return n.$$click=()=>c(t=>({...t,[e]:!r()})),Y(n,(()=>{var e=K(()=>!!r());return()=>e()?`show fewer ←`:`all ${t.length} on disk →`})()),n}}),null),s})()}}),null),e}})]}}),null),Y(u,U(G,{get when(){return r()},get children(){return U(di,{get store(){return e.store},get initialCwd(){return t()},get recentProjects(){return m()},onClose:()=>i(!1)})}}),null),Y(u,U(G,{get when(){return a()},children:t=>U(dt,{title:`delete session?`,onDismiss:()=>o(void 0),get actions(){return[(()=>{var e=Jr();return e.$$click=()=>o(void 0),e})(),(()=>{var n=si();return n.$$click=async()=>{await $.deleteSession(t().path),o(void 0),await e.store.refreshDiskSessions()},n})()]},get children(){var e=oi(),n=e.firstChild,r=n.nextSibling;return r.nextSibling,Y(e,()=>t().name??t().firstMessage.slice(0,80),n),Y(e,()=>t().messageCount,r),e}})}),null),u})()}Ne([`click`,`input`]);function pi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mi(e){if(Array.isArray(e))return e}function hi(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function gi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
|
+
`).trim()||a),{kind:`agent-result`,text:o,header:a,raw:e,timestamp:t}}function qn(e){let{text:t,images:n}=Wn(e.content);return Kn(t,e.timestamp)??{kind:`user`,text:t,images:n.length>0?n:void 0,timestamp:e.timestamp}}function Jn(e){if(!(e?.role!==`assistant`||e.stopReason!==`error`))return typeof e.errorMessage==`string`&&e.errorMessage.trim().length>0?e.errorMessage:`Unknown error`}function Yn(e){let t=[],n=new Map;for(let r of e)if(r.role===`user`)t.push(qn(r));else if(r.role===`assistant`){let e=[],i=[],a=()=>{if(e.length===0)return;let n={kind:`assistant`,blocks:e,model:r.model,streaming:!1,timestamp:r.timestamp};i.push(n),t.push(n),e=[]};if(Array.isArray(r.content)){for(let i of r.content)if(i.type===`text`&&typeof i.text==`string`)e.push({kind:`text`,text:i.text});else if(i.type===`thinking`&&typeof i.thinking==`string`)e.push({kind:`thinking`,text:i.thinking});else if(i.type===`toolCall`){a();let e=i,o={kind:`tool`,toolCallId:String(e.id??``),toolName:String(e.name??`tool`),args:e.arguments,status:`running`,resultText:``,startedAt:r.timestamp??Date.now()};n.set(o.toolCallId,o),t.push(o)}}a();let o=Jn(r);if(o&&i.length===0){let e={kind:`assistant`,blocks:[],model:r.model,streaming:!1,timestamp:r.timestamp};i.push(e),t.push(e)}let s=i.at(-1);s&&(s.stopReason=r.stopReason,s.errorMessage=o)}else if(r.role===`toolResult`){let e=n.get(String(r.toolCallId));if(e){e.status=r.isError?`error`:`done`;let t=Wn(r.content);e.resultText=t.text,t.images.length>0&&(e.images=t.images),e.details=r.details,e.endedAt=r.timestamp}}else if(r.role===`bashExecution`){let e=r;t.push({kind:`tool`,toolCallId:`bash-exec-${t.length}`,toolName:`bash (user)`,args:{command:e.command},status:`done`,resultText:e.output??``,startedAt:r.timestamp??Date.now()})}else if(r.role===`custom`){let e=r;t.push({kind:`custom`,tag:e.customType??`extension`,text:e.displayText??Gn(r.content)})}else if(r.role===`compactionSummary`){let e=r;t.push({kind:`summary`,label:`compaction`,text:e.summary??`context compacted`,tokensBefore:e.tokensBefore})}return t}var Xn=0,Zn=0;function Qn(e){return Zn+=1,{id:Zn,...e}}function $n(e){e.statusEntries=e.statusEntries.filter(e=>e.key!==`compaction`),e.compacting&&e.statusEntries.push(Qn({key:`compaction`,text:`compacting context…`,tone:`info`}))}var er=20;function tr(e){let t=e.toasts.length-er;t>0&&e.toasts.splice(0,t)}function nr(e){let t=Date.parse(e.startedAt);return Number.isFinite(t)?t:0}function rr(e){let t=Object.values(e.backgroundAgents).filter(e=>e.status!==`running`).sort((e,t)=>nr(e)-nr(t)||e.agentId.localeCompare(t.agentId)),n=t.length-20;if(!(n<=0))for(let r of t.slice(0,n))delete e.backgroundAgents[r.agentId],delete e.subagents[r.agentId]}function ir(e){e.needsAttention=e.uiRequests.length>0||e.statusEntries.some(e=>e.tone===`error`)||!!e.suggestedCommand}function ar(e){let t=e.reduce((e,t)=>e+(t.questions?.length??0),0);if(t!==0)return`waiting for input — ${t} question${t===1?``:`s`}`}var or=`provider-error`;function sr(e){e.statusEntries=e.statusEntries.filter(e=>e.key!==or),e.lastError=void 0}function cr(e,t){sr(e),e.statusEntries.push(Qn({key:or,text:t,tone:`error`})),e.lastError=t}function lr(e,t,n){if(sr(e),!n)for(let n=t.length-1;n>=0;--n){let r=t[n];if(r?.role!==`assistant`)continue;let i=Jn(r);i&&cr(e,i);break}ir(e)}function ur(e){for(let t=e.entries.length-1;t>=0;t--){let n=e.entries[t];if(n.kind===`assistant`)return n}}function dr(e,t){for(let n=e.entries.length-1;n>=0;n--){let r=e.entries[n];if(r.kind===`tool`&&r.toolCallId===t)return r}}function fr(e,t,n){let r=e.entries.indexOf(t);if(r<0)return;let i=new Set,a=n.map(t=>{if(t.kind!==`tool`)return t;let n=dr(e,t.toolCallId);return n?(i.add(n),n):t}),o=new Set([t,...i]),s=e.entries.slice(0,r).filter(e=>!o.has(e)).length,c=e.entries.filter(e=>!o.has(e));c.splice(s,0,...a),e.entries.splice(0,e.entries.length,...c)}function pr(e,t){switch(t.type){case`agent_start`:e.streaming=!0;break;case`agent_end`:{e.streaming=!1;let t=ur(e);t&&(t.streaming=!1);break}case`message_start`:{let n=t.message;n?.role===`user`?e.entries.push(qn(n)):n?.role===`assistant`&&e.entries.push({kind:`assistant`,blocks:[],model:n.model,streaming:!0,timestamp:n.timestamp});break}case`message_update`:{let n=t.assistantMessageEvent;if(!n)break;let r=ur(e);if((!r||!r.streaming)&&(r={kind:`assistant`,blocks:[],streaming:!0},e.entries.push(r)),n.type===`text_start`)r.blocks.push({kind:`text`,text:``});else if(n.type===`thinking_start`)r.blocks.push({kind:`thinking`,text:``});else if(n.type===`text_delta`||n.type===`thinking_delta`){let e=r.blocks[r.blocks.length-1];e&&(e.text+=n.delta??``)}else if(n.type===`text_end`||n.type===`thinking_end`){let e=r.blocks[r.blocks.length-1];e&&typeof n.content==`string`&&(e.text=n.content)}break}case`message_end`:{let n=t.message;if(n?.role===`assistant`){let t=ur(e),r=Yn([n]);t?.streaming?fr(e,t,r):e.entries.push(...r)}else if(n?.role===`user`){let t=e.entries[e.entries.length-1],r=qn(n);r.kind===`agent-result`?t?.kind===`agent-result`&&t.raw===r.raw||e.entries.push(r):t?.kind===`user`&&t.text===r.text?r.images&&(t.images=r.images):e.entries.push(r)}break}case`tool_execution_start`:{let n=String(t.toolCallId),r=dr(e,n);r?(r.toolName=String(t.toolName),r.args=t.args,r.status=`running`,r.resultText=``,r.images=void 0,r.details=void 0,r.startedAt=Date.now(),r.endedAt=void 0):e.entries.push({kind:`tool`,toolCallId:n,toolName:String(t.toolName),args:t.args,status:`running`,resultText:``,startedAt:Date.now()});break}case`tool_execution_update`:{let n=dr(e,String(t.toolCallId));if(n){let e=t.partialResult;if(typeof e==`string`)n.resultText=e,n.images=void 0;else if(e?.content){let t=Wn(e.content);n.resultText=t.text,n.images=t.images.length>0?t.images:void 0}}break}case`tool_execution_end`:{let n=dr(e,String(t.toolCallId));if(n){n.status=t.isError?`error`:`done`;let e=t.result;if(typeof e==`string`)n.resultText=e,n.images=void 0;else if(e?.content){let t=Wn(e.content);n.resultText=t.text,n.images=t.images.length>0?t.images:void 0}n.details=t.result?.details,n.endedAt=Date.now()}break}default:break}}function mr(e,t){switch(pr(e,t),t.type){case`agent_start`:e.workingText=`working`,e.workingSince=Date.now(),sr(e),e.suggestedCommand=void 0,e.uiRequests=[];break;case`agent_end`:e.workingText=void 0,e.workingSince=void 0,e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`&&e.key!==`paused`);break;case`message_end`:{let n=t.message;if(n?.role===`assistant`){let t=Jn(n);t?cr(e,t):sr(e)}break}case`tool_execution_start`:e.workingText=`${t.toolName}`;break;case`auto_compaction_start`:e.compacting=!0,t.reason===`overflow`&&sr(e),$n(e);break;case`auto_compaction_end`:{e.compacting=!1,$n(e);let n=t.result;if(n&&!t.aborted){let t=n.summary??`context compacted`;e.entries.some(e=>e.kind===`summary`&&e.label===`compaction`&&e.text===t&&e.tokensBefore===n.tokensBefore)||e.entries.push({kind:`summary`,label:`compaction`,text:t,tokensBefore:n.tokensBefore})}t.errorMessage&&e.statusEntries.push(Qn({key:`compaction-error`,text:String(t.errorMessage),tone:`error`}));break}case`auto_retry_start`:sr(e),e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`retrying (${t.attempt}/${t.maxAttempts}) — ${t.errorMessage}`,tone:`warning`}));break;case`auto_retry_end`:e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),!t.success&&t.finalError?cr(e,String(t.finalError)):t.success&&sr(e);break;case`stream_retry`:{e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`stream dropped, retrying (${t.attempt}/${t.maxAttempts})`,tone:`warning`}));let n=ur(e);n?.streaming&&e.entries.splice(e.entries.indexOf(n),1);break}case`length_retry`:{e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`),e.statusEntries.push(Qn({key:`retry`,text:`response truncated, retrying at the configured output limit (${t.attempt}/${t.maxAttempts})`,tone:`warning`}));let n=ur(e);n?.streaming&&e.entries.splice(e.entries.indexOf(n),1);break}case`tasks_update`:e.tasks=t.tasks??[];break;case`suggest_next`:e.suggestedCommand=String(t.command);break;case`session_name_changed`:e.sessionName=String(t.name??``);break;case`background_agent_start`:e.backgroundAgents[String(t.agentId)]={agentId:String(t.agentId),agentType:String(t.agentType),taskSummary:String(t.taskSummary),startedAt:new Date().toISOString(),status:`running`,sessionDir:t.sessionDir};break;case`subagent_arbitration`:{let n=e.backgroundAgents[String(t.agentId)];if(n){let e={status:t.status,proposed:t.proposed,final:t.final??null,changed:t.changed??[],step:t.step,errorCode:t.errorCode,errorMessage:t.errorMessage};n.arbitrations=[...n.arbitrations??[],e],e.status===`success`&&e.final&&(n.agentType=e.final.agent)}break}case`background_agent_end`:{let n=e.backgroundAgents[String(t.agentId)];n&&(n.status=t.success?`completed`:`failed`,n.sessionFile=t.sessionFile??n.sessionFile);let r=e.subagents[String(t.agentId)];r&&(r.streaming=!1),rr(e);break}case`background_agent_event`:{let n=String(t.agentId),r=e.subagents[n];r||(r={agentId:n,entries:[],streaming:!0},e.subagents[n]=r);let i=t.event;if(i?.type===`session`)break;i?.type===`agent_start`&&i.model&&(r.model=i.model.id),pr(r,i);break}case`parent_paused_for_background_agents`:e.statusEntries=e.statusEntries.filter(e=>e.key!==`paused`),e.statusEntries.push(Qn({key:`paused`,text:`paused — waiting on ${t.runningAgentCount} background agent${t.runningAgentCount===1?``:`s`}`,tone:`warning`}));break;case`extension_ui_response_handled`:gr(e,String(t.id));break;case`extension_ui_request`:{let n=t.method,r=Bn(t);if(r)e.uiRequests.push(r);else if(n===`notify`){Xn+=1;let n=t.notifyType??`info`;e.toasts.push({id:Xn,text:String(t.message??``),tone:n}),tr(e)}else if(n===`setStatus`){let n=`ext:${t.statusKey??`default`}`;e.statusEntries=e.statusEntries.filter(e=>e.key!==n),t.statusText&&e.statusEntries.push(Qn({key:n,text:String(t.statusText),tone:`info`}))}else if(n===`setWidget`){let n=t.widgetPlacement===`belowEditor`?`below`:`above`;e.widgets[n]=Array.isArray(t.widgetLines)?t.widgetLines:[]}else n===`setTitle`?e.title=String(t.title??``):n===`set_editor_text`&&(e.composerPrefill=String(t.text??``));break}case`extension_error`:Xn+=1,e.toasts.push({id:Xn,text:`extension error: ${t.error}`,tone:`error`}),tr(e);break;default:break}ir(e)}function hr(e,t){e.toasts=e.toasts.filter(e=>e.id!==t)}function gr(e,t){e.uiRequests=e.uiRequests.filter(e=>e.id!==t),ir(e)}var _r=q(`<span class=session-title><span class=name>`),vr=q(`<span class=session-project>`),yr=q(`<span class=attention-reason>`),br=q(`<span class=error-reason>`),xr=q(`<span class=activity>`),Sr=q(`<span class=subagents><span>⚡ <!> running · <!> done`),Cr=q(`<span>tasks <!>/`),wr=q(`<span>·`),Tr=q(`<span>/`),Er=q(`<span>ctx <!>%`),Dr=q(`<span>$`),Or=q(`<span class=session-meta><span> msgs</span><span>·</span><span>`),kr=q(`<span class=agent-line><span class=live>●</span> <!> — `);function Ar(e,t){return e.sessions[t.key]?.lastError?`error`:st(t)}function jr(e,t){let n=e.sessions[t.key]?.entries??[];for(let e=n.length-1;e>=0;--e){let t=n[e];if(t.kind!==`assistant`)continue;let r=t.blocks.filter(e=>e.kind===`text`).map(e=>e.text).join(``).trim();if(r)return r.slice(0,200)}return t.lastAssistantText?.slice(0,200)}function Mr(e){let t=()=>e.store.sessions[e.runtime.key],n=()=>Ar(e.store,e.runtime),r=()=>e.runtime.backgroundAgents.filter(e=>e.status===`running`),i=()=>e.runtime.backgroundAgents.filter(e=>e.status!==`running`),a=()=>t()?.tasks??e.runtime.state.tasks??[],o=()=>a().filter(e=>e.status===`completed`).length,s=()=>e.runtime.state.contextUsage,c=()=>e.runtime.state.model,l=()=>{let n=t();return n?.workingText?`▸ ${n.workingText}`:n?.suggestedCommand?`suggested next: ${n.suggestedCommand}`:jr(e.store,e.runtime)};return[(()=>{var r=_r(),i=r.firstChild;return Y(i,()=>t()?.sessionName??e.runtime.state.sessionName??e.runtime.state.sessionId.slice(0,8)),Y(r,U(ot,{get status(){return n()}}),null),r})(),(()=>{var t=vr();return Y(t,()=>e.runtime.cwd.replace(/^\/home\/[^/]+/,`~`)),j(()=>J(t,`title`,e.runtime.cwd)),t})(),U(G,{get when(){return st(e.runtime)===`attention`},get children(){var e=yr();return Y(e,()=>ar(t()?.uiRequests??[])??`needs attention`),e}}),U(G,{get when(){return e.runtime.error??t()?.lastError},get children(){var n=br();return Y(n,()=>e.runtime.error??t()?.lastError),n}}),U(G,{get when(){return l()},get children(){var e=xr();return Y(e,l),e}}),U(G,{get when(){return e.runtime.backgroundAgents.length>0},get children(){var e=Sr(),t=e.firstChild,n=t.firstChild.nextSibling,a=n.nextSibling.nextSibling;return a.nextSibling,Y(t,()=>r().length,n),Y(t,()=>i().length,a),Y(e,U(W,{get each(){return r().slice(0,3)},children:e=>(()=>{var t=kr(),n=t.firstChild.nextSibling.nextSibling;return n.nextSibling,Y(t,()=>e.agentType,n),Y(t,()=>e.taskSummary,null),t})()}),null),e}}),(()=>{var t=Or(),n=t.firstChild,r=n.firstChild,i=n.nextSibling.nextSibling;return Y(t,U(G,{get when(){return a().length>0},get children(){return[(()=>{var e=Cr(),t=e.firstChild.nextSibling;return t.nextSibling,Y(e,o,t),Y(e,()=>a().length,null),e})(),wr()]}}),n),Y(t,U(G,{get when(){return c()},get children(){return[(()=>{var e=Tr(),t=e.firstChild;return Y(e,()=>c().provider,t),Y(e,()=>c().id,null),e})(),wr()]}}),n),Y(t,U(G,{get when(){return K(()=>!!s())()&&s().percent!==null},get children(){return[(()=>{var e=Er(),t=e.firstChild.nextSibling;return t.nextSibling,Y(e,()=>s().percent.toFixed(0),t),e})(),wr()]}}),n),Y(t,U(G,{get when(){return e.runtime.stats},get children(){return[(()=>{var t=Dr();return t.firstChild,Y(t,()=>e.runtime.stats.cost.toFixed(2),null),t})(),wr()]}}),n),Y(n,()=>e.runtime.state.messageCount,r),Y(i,()=>mt(e.runtime.lastActivity)),t})()]}var Nr=q(`<button type=button class="chrome-toggle fleet-sidebar-toggle">`),Pr=q(`<button type=button class="chrome-toggle fleet-sidebar-close">close fleet sidebar`),Fr=q(`<output class=error-reason>Stats refresh failed: `),Ir=q(`<aside aria-label="Other live sessions"class=fleet-sidebar>`),Lr=q(`<div class=fleet-sidebar-scrim aria-hidden=true>`),Rr=q(`<button type=button class=fleet-sidebar-entry>`);function zr(e){let t=[...e];return t.sort((e,t)=>{let n=e.cwd.localeCompare(t.cwd);return n===0?new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime():n}),t}function Br(){let[e,t]=k(!1),n=typeof window.matchMedia==`function`?window.matchMedia(`(max-width: 700px)`):void 0,[r,i]=k(n?.matches??!1),a=e=>{t(!1),i(e.matches)};return n?.addEventListener(`change`,a),R(()=>n?.removeEventListener(`change`,a)),{id:`fleet-sidebar-${Ee()}`,mobile:r,open:e,collapsed:On,toggle:()=>{r()?t(e=>!e):Mn(!On())},close:()=>t(!1)}}function Vr(e){let t=N(()=>{let t={idle:0,running:1,attention:2,error:3};return e.runtimes.reduce((n,r)=>{let i=Ar(e.store,r);return t[i]>t[n]?i:n},`idle`)}),n=()=>e.hidden?`show other sessions; highest priority: ${t()===`attention`?`needs attention`:t()}`:`hide other sessions`;return(()=>{var r=Nr();return r.$$click=()=>e.onToggle(),Y(r,()=>e.hidden?`fleet ▸`:`fleet ◂`),j(i=>{var a=e.hidden?t():void 0,o=n(),s=n(),c=e.id,l=!e.hidden;return a!==i.e&&J(r,`data-status`,i.e=a),o!==i.t&&J(r,`title`,i.t=o),s!==i.a&&J(r,`aria-label`,i.a=s),c!==i.o&&J(r,`aria-controls`,i.o=c),l!==i.i&&J(r,`aria-expanded`,i.i=l),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()}function Hr(e){let t=N(()=>zr(e.store.fleet().runtimes.filter(t=>t.key!==e.sessionKey))),n,r=N(()=>!e.mobile&&!e.collapsed&&t().length>0),i=Ln(r,()=>n?.parentElement??void 0),a=N(()=>e.mobile&&e.open&&t().length>0),o=()=>e.mobile?!e.open:e.collapsed;return Jt(e.store,()=>!o()&&t().length>0),M(()=>{if(!a())return;let t=document.activeElement;n?.querySelector(`.fleet-sidebar-close`)?.focus({preventScroll:!0});let r=t=>{let r=t.target instanceof Element?t.target:void 0;if(!(r?.closest(`[role="dialog"]`)&&!n?.contains(r))&&!t.defaultPrevented)if(t.key===`Escape`)t.preventDefault(),t.stopPropagation(),e.onClose();else if(t.key===`Tab`){t.stopPropagation();let e=n?.querySelectorAll(`button:not(:disabled)`),r=e?.[0],i=e?.[e.length-1];t.shiftKey&&(document.activeElement===r||!n?.contains(document.activeElement))?(t.preventDefault(),i?.focus()):!t.shiftKey&&(document.activeElement===i||!n?.contains(document.activeElement))&&(t.preventDefault(),r?.focus())}else r&&n?.contains(r)&&t.stopPropagation()};document.addEventListener(`keydown`,r),R(()=>{document.removeEventListener(`keydown`,r),n?.contains(document.activeElement)&&t instanceof HTMLElement&&t.isConnected&&t.focus({preventScroll:!0})})}),U(G,{get when(){return t().length>0},get children(){return[(()=>{var r=Ir(),s=n;return typeof s==`function`?Re(s,r):n=r,Y(r,U(G,{get when(){return e.mobile},get children(){var t=Pr();return t.$$click=()=>e.onClose(),t}}),null),Y(r,U(G,{get when(){return e.store.fleetStatsError()},get children(){var t=Fr();return t.firstChild,Y(t,()=>e.store.fleetStatsError(),null),t}}),null),Y(r,U(W,{get each(){return t()},children:t=>{let n=()=>Ar(e.store,t);return(()=>{var r=Rr();return r.$$click=()=>e.onNavigate(t.key),Y(r,U(Mr,{get store(){return e.store},runtime:t})),j(e=>{var i=n()===`attention`,a=n()===`error`,o=t.cwd;return i!==e.e&&r.classList.toggle(`attention`,e.e=i),a!==e.t&&r.classList.toggle(`error`,e.t=a),o!==e.a&&J(r,`title`,e.a=o),e},{e:void 0,t:void 0,a:void 0}),r})()}}),null),j(t=>{var n=e.id,s=e.mobile?`dialog`:`complementary`,c=a()?!0:void 0,l=o(),u=o(),d=`${i.width()}px`,f=!!(e.mobile&&e.open),p=!!(!e.mobile&&e.collapsed);return n!==t.e&&J(r,`id`,t.e=n),s!==t.t&&J(r,`role`,t.t=s),c!==t.a&&J(r,`aria-modal`,t.a=c),l!==t.o&&J(r,`aria-hidden`,t.o=l),u!==t.i&&(r.inert=t.i=u),d!==t.n&&Le(r,`--fleet-sidebar-width`,t.n=d),f!==t.s&&r.classList.toggle(`open`,t.s=f),p!==t.h&&r.classList.toggle(`collapsed`,t.h=p),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),r})(),U(G,{get when(){return r()},get children(){return U(Rn,{resize:i,get id(){return e.id}})}}),U(G,{get when(){return K(()=>!!e.mobile)()&&e.open},get children(){var t=Lr();return t.$$click=()=>e.onClose(),t}})]}})}Ne([`click`]);var Ur=q(`<article class=session-card><div class=session-actions><button type=button class="btn btn-small btn-primary">open</button><button type=button class="btn btn-small btn-danger">stop runtime`),Wr=q(`<div class=field><label for=new-session-cwd>project path</label><input id=new-session-cwd type=text placeholder=/path/to/project>`),Gr=q(`<div class=field><label for=recent-projects-list>recent projects</label><div class=recent-projects id=recent-projects-list>`),Kr=q(`<div class=field><label for=new-session-prompt>first prompt (optional)</label><textarea id=new-session-prompt rows=3>`),qr=q(`<p class=pair-error>`),Jr=q(`<button type=button class="btn btn-small">cancel`),Yr=q(`<button type=button class="btn btn-small btn-primary">`),Xr=q(`<button type=button>`),Zr=q(`<div class=settings-error role=alert>Fleet could not be loaded: `),Qr=q(`<div class=settings-error role=alert>Fleet stats could not be refreshed: `),$r=q(`<section class=live-sessions><div class=session-grid>`),ei=q(`<section class=past-sessions><h2 class=past-sessions-head>past sessions`),ti=q(`<div class=screen-fill><main class=container><div class=fleet-head><div><h1>fleet</h1><p class="muted small"> live · <!> needs attention · <!> on disk</p></div><button type=button class="btn btn-primary">+ new session`),ni=q(`<div class=empty-state><p>No sessions yet.</p><p style=margin-top:8px><button type=button class="btn btn-primary">+ create your first session`),ri=q(`<button type=button class=disk-more>`),ii=q(`<section class=project-group><div class=group-head><h3></h3><span class="muted small"> on disk</span><button type=button class="btn btn-small">+ new`),ai=q(`<div class=disk-row><span class=name></span><span class=meta> msgs · </span><span class=actions><button type=button class="btn btn-small">resume</button><button type=button class="btn btn-small btn-danger">delete`),oi=q(`<p> — <!> messages. The session file is moved to trash where supported.`),si=q(`<button type=button class="btn btn-small btn-danger">delete`);function ci(e){return e===`/tmp`||e.startsWith(`/tmp/`)?`/tmp`:e}function li(e){return e.replace(/^\/home\/[^/]+/,`~`)}function ui(e){let t=()=>Ar(e.store,e.runtime);return(()=>{var n=Ur(),r=n.firstChild,i=r.firstChild,a=i.nextSibling;return Y(n,U(Mr,{get store(){return e.store},get runtime(){return e.runtime}}),r),i.$$click=()=>e.store.navigate({screen:`session`,key:e.runtime.key}),a.$$click=async()=>{await $.stopRuntime(e.runtime.key),await e.store.removeRuntime(e.runtime.key)},j(e=>{var r=t()===`attention`,i=t()===`error`;return r!==e.e&&n.classList.toggle(`attention`,e.e=r),i!==e.t&&n.classList.toggle(`error`,e.t=i),e},{e:void 0,t:void 0}),n})()}function di(e){let[t,n]=k(e.initialCwd??``),[r,i]=k(``),[a,o]=k(),[s,c]=k(!1);async function l(){c(!0),o(void 0);try{let n=await $.createRuntime(t(),{firstPrompt:r()||void 0});e.store.upsertRuntime(n),await e.store.refreshDiskSessions(),e.onClose()}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}}return U(dt,{title:`new session`,get onDismiss(){return e.onClose},get actions(){return[(()=>{var t=Jr();return Fe(t,`click`,e.onClose,!0),t})(),(()=>{var e=Yr();return e.$$click=l,Y(e,()=>s()?`starting…`:`start session`),j(()=>e.disabled=s()||!t()),e})()]},get children(){return[(()=>{var e=Wr(),r=e.firstChild.nextSibling;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),U(G,{get when(){return e.recentProjects.length>0},get children(){var t=Gr(),r=t.firstChild.nextSibling;return Y(r,U(W,{get each(){return e.recentProjects},children:e=>(()=>{var t=Xr();return t.$$click=()=>n(e),Y(t,()=>li(e)),t})()})),t}}),(()=>{var e=Kr(),t=e.firstChild.nextSibling;return t.$$input=e=>i(e.currentTarget.value),j(()=>t.value=r()),e})(),U(G,{get when(){return a()},get children(){var e=qr();return Y(e,a),e}})]}})}function fi(e){let[t,n]=k(),[r,i]=k(!1),[a,o]=k(),[s,c]=k({}),[l,u]=k(),d=N(()=>zr(e.store.fleet().runtimes)),f=N(()=>{let t=e.store.fleet(),n=new Set(t.runtimes.map(e=>e.state.sessionFile).filter(Boolean)),r=new Map;for(let e of t.diskSessions){if(n.has(e.path))continue;let t=ci(e.cwd),i=r.get(t)??[];i.push(e),r.set(t,i)}let i=[...r.entries()];return i.sort(([,e],[,t])=>new Date(t[0]?.modified??0).getTime()-new Date(e[0]?.modified??0).getTime()),i}),p=N(()=>{let t=e.store.fleet();return{live:t.runtimes.length,attention:t.runtimes.filter(e=>e.needsAttention).length,disk:t.diskSessions.length}}),m=N(()=>{let t=new Set;for(let n of e.store.fleet().runtimes)t.add(n.cwd);for(let n of e.store.fleet().diskSessions)t.add(n.cwd);return[...t].slice(0,8)});Jt(e.store,()=>!0);async function h(t){u(void 0);try{let n=await $.createRuntime(t.cwd,{sessionPath:t.path});e.store.upsertRuntime(n),await e.store.refreshDiskSessions(),e.store.navigate({screen:`session`,key:n.key})}catch(e){u(`Failed to resume session: ${e instanceof Error?e.message:String(e)}`)}}return(()=>{var u=ti(),g=u.firstChild,_=g.firstChild.firstChild,v=_.firstChild.nextSibling,y=v.firstChild,b=y.nextSibling,x=b.nextSibling.nextSibling;x.nextSibling;var S=_.nextSibling;return Y(u,U(lt,{get store(){return e.store},active:`fleet`}),g),Y(v,()=>p().live,y),Y(v,()=>p().attention,b),Y(v,()=>p().disk,x),S.$$click=()=>{n(void 0),i(!0)},Y(g,U(G,{get when(){return e.store.fleetError()},get children(){var t=Zr();return t.firstChild,Y(t,()=>e.store.fleetError(),null),t}}),null),Y(g,U(G,{get when(){return e.store.fleetStatsError()},get children(){var t=Qr();return t.firstChild,Y(t,()=>e.store.fleetStatsError(),null),t}}),null),Y(g,U(G,{get when(){return d().length>0||f().length>0||e.store.fleetError()},get fallback(){return(()=>{var e=ni(),t=e.firstChild.nextSibling.firstChild;return t.$$click=()=>i(!0),e})()},get children(){return[U(G,{get when(){return d().length>0},get children(){var t=$r(),n=t.firstChild;return Y(n,U(W,{get each(){return d()},children:t=>U(ui,{get store(){return e.store},runtime:t})})),t}}),U(G,{get when(){return f().length>0},get children(){var e=ei();return e.firstChild,Y(e,U(G,{get when(){return l()},get children(){var e=qr();return Y(e,l),e}}),null),Y(e,U(W,{get each(){return f()},children:([e,t])=>{let r=()=>s()[e]??!1,a=()=>r()?t:t.slice(0,3);return(()=>{var s=ii(),l=s.firstChild.firstChild,u=l.nextSibling,d=u.firstChild,f=u.nextSibling;return Y(l,()=>li(e)),Y(u,()=>t.length,d),f.$$click=()=>{n(e),i(!0)},Y(s,U(W,{get each(){return a()},children:e=>(()=>{var t=ai(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=r.nextSibling.firstChild,s=a.nextSibling;return Y(n,()=>e.name??`“${e.firstMessage.slice(0,60)}…”`),Y(r,()=>e.messageCount,i),Y(r,()=>mt(e.modified),null),a.$$click=()=>h(e),s.$$click=()=>o(e),j(()=>n.classList.toggle(`muted`,!e.name)),t})()}),null),Y(s,U(G,{get when(){return t.length>3},get children(){var n=ri();return n.$$click=()=>c(t=>({...t,[e]:!r()})),Y(n,(()=>{var e=K(()=>!!r());return()=>e()?`show fewer ←`:`all ${t.length} on disk →`})()),n}}),null),s})()}}),null),e}})]}}),null),Y(u,U(G,{get when(){return r()},get children(){return U(di,{get store(){return e.store},get initialCwd(){return t()},get recentProjects(){return m()},onClose:()=>i(!1)})}}),null),Y(u,U(G,{get when(){return a()},children:t=>U(dt,{title:`delete session?`,onDismiss:()=>o(void 0),get actions(){return[(()=>{var e=Jr();return e.$$click=()=>o(void 0),e})(),(()=>{var n=si();return n.$$click=async()=>{await $.deleteSession(t().path),o(void 0),await e.store.refreshDiskSessions()},n})()]},get children(){var e=oi(),n=e.firstChild,r=n.nextSibling;return r.nextSibling,Y(e,()=>t().name??t().firstMessage.slice(0,80),n),Y(e,()=>t().messageCount,r),e}})}),null),u})()}Ne([`click`,`input`]);function pi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mi(e){if(Array.isArray(e))return e}function hi(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function gi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
5
5
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _i(e,t){return mi(e)||hi(e,t)||vi(e,t)||gi()}function vi(e,t){if(e){if(typeof e==`string`)return pi(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pi(e,t):void 0}}var yi=Object.entries,bi=Object.setPrototypeOf,xi=Object.isFrozen,Si=Object.getPrototypeOf,Ci=Object.getOwnPropertyDescriptor,wi=Object.freeze,Ti=Object.seal,Ei=Object.create,Di=typeof Reflect<`u`&&Reflect,Oi=Di.apply,ki=Di.construct;wi||=function(e){return e},Ti||=function(e){return e},Oi||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ki||=function(e){return new e(...[...arguments].slice(1))};var Ai=Xi(Array.prototype.forEach),ji=Xi(Array.prototype.lastIndexOf),Mi=Xi(Array.prototype.pop),Ni=Xi(Array.prototype.push),Pi=Xi(Array.prototype.splice),Fi=Array.isArray,Ii=Xi(String.prototype.toLowerCase),Li=Xi(String.prototype.toString),Ri=Xi(String.prototype.match),zi=Xi(String.prototype.replace),Bi=Xi(String.prototype.indexOf),Vi=Xi(String.prototype.trim),Hi=Xi(Number.prototype.toString),Ui=Xi(Boolean.prototype.toString),Wi=typeof BigInt>`u`?null:Xi(BigInt.prototype.toString),Gi=typeof Symbol>`u`?null:Xi(Symbol.prototype.toString),Ki=Xi(Object.prototype.hasOwnProperty),qi=Xi(Object.prototype.toString),Ji=Xi(RegExp.prototype.test),Yi=Zi(TypeError);function Xi(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Oi(e,t,n)}}function Zi(e){return function(){return ki(e,[...arguments])}}function Qi(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ii;if(bi&&bi(e,null),!Fi(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(xi(t)||(t[r]=e),i=e)}e[i]=!0}return e}function $i(e){for(let t=0;t<e.length;t++)Ki(e,t)||(e[t]=null);return e}function ea(e){let t=Ei(null);for(let r of yi(e)){var n=_i(r,2);let i=n[0],a=n[1];Ki(e,i)&&(Fi(a)?t[i]=$i(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=ea(a):t[i]=a)}return t}function ta(e){switch(typeof e){case`string`:return e;case`number`:return Hi(e);case`boolean`:return Ui(e);case`bigint`:return Wi?Wi(e):`0`;case`symbol`:return Gi?Gi(e):`Symbol()`;case`undefined`:return qi(e);case`function`:case`object`:{if(e===null)return qi(e);let t=e,n=na(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:qi(e)}return qi(e)}default:return qi(e)}}function na(e,t){for(;e!==null;){let n=Ci(e,t);if(n){if(n.get)return Xi(n.get);if(typeof n.value==`function`)return Xi(n.value)}e=Si(e)}function n(){return null}return n}function ra(e){try{return Ji(e,``),!0}catch{return!1}}var ia=wi(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),aa=wi(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),oa=wi([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),sa=wi([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ca=wi(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),la=wi([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),ua=wi([`#text`]),da=wi(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),fa=wi(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),pa=wi(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ma=wi([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ha=Ti(/{{[\w\W]*|^[\w\W]*}}/g),ga=Ti(/<%[\w\W]*|^[\w\W]*%>/g),_a=Ti(/\${[\w\W]*/g),va=Ti(/^data-[\-\w.\u00B7-\uFFFF]+$/),ya=Ti(/^aria-[\-\w]+$/),ba=Ti(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xa=Ti(/^(?:\w+script|data):/i),Sa=Ti(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ca=Ti(/^html$/i),wa=Ti(/^[a-z][.\w]*(-[.\w]+)+$/i),Ta=Ti(/<[/\w!]/g),Ea=Ti(/<[/\w]/g),Da=Ti(/<\/no(script|embed|frames)/i),Oa=Ti(/\/>/i),ka={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Aa=function(){return typeof window>`u`?null:window},ja=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ma=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Na=function(e,t,n,r){return Ki(e,t)&&Fi(e[t])?Qi(r.base?ea(r.base):{},e[t],r.transform):n};function Pa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Aa(),t=e=>Pa(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==ka.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=na(d,`cloneNode`),p=na(d,`remove`),m=na(d,`nextSibling`),h=na(d,`childNodes`),g=na(d,`parentNode`),_=na(d,`shadowRoot`),v=na(d,`attributes`),y=o&&o.prototype?na(o.prototype,`nodeType`):null,b=o&&o.prototype?na(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw Yi(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},O=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},k=function(){return w||=(C=ja(u,i),!0),C},A=n,j=A.implementation,M=A.createNodeIterator,N=A.createDocumentFragment,P=A.getElementsByTagName,F=r.importNode,I=Ma();t.isSupported=typeof yi==`function`&&typeof g==`function`&&j&&j.createHTMLDocument!==void 0;let L=ha,ee=ga,R=_a,te=va,ne=ya,re=xa,ie=Sa,ae=wa,oe=ba,z=null,se=Qi({},[...ia,...aa,...oa,...ca,...ua]),B=null,ce=Qi({},[...da,...fa,...pa,...ma]),V=Object.seal(Ei(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ue=null,de=Object.seal(Ei(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),fe=!0,pe=!0,me=!1,he=!0,ge=!1,_e=!0,ve=!1,ye=!1,H=null,be=null,xe=!1,Se=!1,Ce=!1,we=!1,U=!0,Te=!1,Ee=`user-content-`,De=!0,W=!1,G={},Oe=null,ke=Qi({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),K=null,Ae=Qi({},[`audio`,`video`,`img`,`source`,`image`,`track`]),je=null,Me=Qi({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),q=`http://www.w3.org/1998/Math/MathML`,Ne=`http://www.w3.org/2000/svg`,J=`http://www.w3.org/1999/xhtml`,Pe=J,Fe=!1,Ie=null,Le=Qi({},[q,Ne,J],Li),Re=wi([`mi`,`mo`,`mn`,`ms`,`mtext`]),Y=Qi({},Re),ze=wi([`annotation-xml`]),Be=Qi({},ze),Ve=Qi({},[`title`,`style`,`font`,`a`,`script`]),He=null,Ue=[`application/xhtml+xml`,`text/html`],We=null,Ge=null,Ke=n.createElement(`form`),qe=function(e){return e instanceof RegExp||e instanceof Function},Je=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ge&&Ge===e)return;(!e||typeof e!=`object`)&&(e={}),e=ea(e),He=Ue.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,We=He===`application/xhtml+xml`?Li:Ii,z=Na(e,`ALLOWED_TAGS`,se,{transform:We}),B=Na(e,`ALLOWED_ATTR`,ce,{transform:We}),Ie=Na(e,`ALLOWED_NAMESPACES`,Le,{transform:Li}),je=Na(e,`ADD_URI_SAFE_ATTR`,Me,{transform:We,base:Me}),K=Na(e,`ADD_DATA_URI_TAGS`,Ae,{transform:We,base:Ae}),Oe=Na(e,`FORBID_CONTENTS`,ke,{transform:We}),le=Na(e,`FORBID_TAGS`,ea({}),{transform:We}),ue=Na(e,`FORBID_ATTR`,ea({}),{transform:We}),G=Ki(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ea(e.USE_PROFILES):e.USE_PROFILES:!1,fe=e.ALLOW_ARIA_ATTR!==!1,pe=e.ALLOW_DATA_ATTR!==!1,me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,he=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=e.SAFE_FOR_TEMPLATES||!1,_e=e.SAFE_FOR_XML!==!1,ve=e.WHOLE_DOCUMENT||!1,Se=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,we=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,U=e.SANITIZE_DOM!==!1,Te=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,W=e.IN_PLACE||!1,oe=ra(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ba,Pe=typeof e.NAMESPACE==`string`?e.NAMESPACE:J,Y=Ki(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?ea(e.MATHML_TEXT_INTEGRATION_POINTS):Qi({},Re),Be=Ki(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?ea(e.HTML_INTEGRATION_POINTS):Qi({},ze);let t=Ki(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?ea(e.CUSTOM_ELEMENT_HANDLING):Ei(null);if(V=Ei(null),Ki(t,`tagNameCheck`)&&qe(t.tagNameCheck)&&(V.tagNameCheck=t.tagNameCheck),Ki(t,`attributeNameCheck`)&&qe(t.attributeNameCheck)&&(V.attributeNameCheck=t.attributeNameCheck),Ki(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(V.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Ti(V),ge&&(pe=!1),Ce&&(Se=!0),G&&(z=Qi({},ua),B=Ei(null),G.html===!0&&(Qi(z,ia),Qi(B,da)),G.svg===!0&&(Qi(z,aa),Qi(B,fa),Qi(B,ma)),G.svgFilters===!0&&(Qi(z,oa),Qi(B,fa),Qi(B,ma)),G.mathMl===!0&&(Qi(z,ca),Qi(B,pa),Qi(B,ma))),de.tagCheck=null,de.attributeCheck=null,Ki(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?de.tagCheck=e.ADD_TAGS:Fi(e.ADD_TAGS)&&(z===se&&(z=ea(z)),Qi(z,e.ADD_TAGS,We))),Ki(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?de.attributeCheck=e.ADD_ATTR:Fi(e.ADD_ATTR)&&(B===ce&&(B=ea(B)),Qi(B,e.ADD_ATTR,We))),Ki(e,`ADD_URI_SAFE_ATTR`)&&Fi(e.ADD_URI_SAFE_ATTR)&&Qi(je,e.ADD_URI_SAFE_ATTR,We),Ki(e,`FORBID_CONTENTS`)&&Fi(e.FORBID_CONTENTS)&&(Oe===ke&&(Oe=ea(Oe)),Qi(Oe,e.FORBID_CONTENTS,We)),Ki(e,`ADD_FORBID_CONTENTS`)&&Fi(e.ADD_FORBID_CONTENTS)&&(Oe===ke&&(Oe=ea(Oe)),Qi(Oe,e.ADD_FORBID_CONTENTS,We)),De&&(z[`#text`]=!0),ve&&Qi(z,[`html`,`head`,`body`]),z.table&&(Qi(z,[`tbody`]),delete le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Yi(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Yi(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=k()),x&&typeof S==`string`&&(S=D(``)));wi&&wi(e),Ge=e},Ye=Qi({},[...aa,...oa,...sa]),Xe=Qi({},[...ca,...la]),Ze=function(e,t,n){return t.namespaceURI===J?e===`svg`:t.namespaceURI===q?e===`svg`&&(n===`annotation-xml`||Y[n]):!!Ye[e]},Qe=function(e,t,n){return t.namespaceURI===J?e===`math`:t.namespaceURI===Ne?e===`math`&&Be[n]:!!Xe[e]},$e=function(e,t,n){return t.namespaceURI===Ne&&!Be[n]||t.namespaceURI===q&&!Y[n]?!1:!Xe[e]&&(Ve[e]||!Ye[e])},et=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Pe,tagName:`template`});let n=Ii(e.tagName),r=Ii(t.tagName);return Ie[e.namespaceURI]?e.namespaceURI===Ne?Ze(n,t,r):e.namespaceURI===q?Qe(n,t,r):e.namespaceURI===J?$e(n,t,r):!!(He===`application/xhtml+xml`&&Ie[e.namespaceURI]):!1},tt=function(e){Ni(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Yi(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},nt=function(e){let t=h(e);if(t){let e=[];Ai(t,t=>{Ni(e,t)}),Ai(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},rt=function(e,n){try{Ni(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Ni(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Se||Ce)try{tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},it=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||B[We(i)]))try{e.removeAttribute(i)}catch{}}},at=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===ka.element&&it(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ot=function(e){let t=null,r=null;if(xe)e=`<remove></remove>`+e;else{let t=Ri(e,/^[\r\n\t ]+/);r=t&&t[0]}He===`application/xhtml+xml`&&Pe===J&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Pe===J)try{t=new l().parseFromString(i,He)}catch{}if(!t||!t.documentElement){t=j.createDocument(Pe,`template`,null);try{t.documentElement.innerHTML=Fe?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Pe===J?P.call(t,ve?`html`:`body`)[0]:ve?t.documentElement:a},st=function(e){return M.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ct=function(e){return e=zi(e,L,` `),e=zi(e,ee,` `),e=zi(e,R,` `),e},lt=function(e){e.normalize();let t=M.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=ct(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ai(r,e=>{dt(e.content)&<(e.content)})},ut=function(e){let t=b?b(e):null;return typeof t!=`string`||We(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===ka.documentFragment}catch{return!1}},ft=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function pt(e,n,r){e.length!==0&&Ai(e,e=>{e.call(t,n,r,Ge)})}let mt=function(e,t){return!!(_e&&e.hasChildNodes()&&!ft(e.firstElementChild)&&Ji(Ta,e.textContent)&&Ji(Ta,e.innerHTML)||_e&&e.namespaceURI===J&&t===`style`&&ft(e.firstElementChild)||e.nodeType===ka.processingInstruction||_e&&e.nodeType===ka.comment&&Ji(Ea,e.data))},ht=function(e,t){if(!le[t]&&_t(t)&&(V.tagNameCheck instanceof RegExp&&Ji(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t)))return!1;if(De&&!Oe[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=W?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return tt(e),!0},gt=function(e){if(pt(I.beforeSanitizeElements,e,null),ut(e))return tt(e),!0;let n=We(b?b(e):e.nodeName);if(pt(I.uponSanitizeElement,e,{tagName:n,allowedTags:z}),mt(e,n))return tt(e),!0;if(le[n]||!(de.tagCheck instanceof Function&&de.tagCheck(n))&&!z[n])return ht(e,n);if((y?y(e):e.nodeType)===ka.element&&!et(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&Ji(Da,e.innerHTML))return tt(e),!0;if(ge&&e.nodeType===ka.text){let n=ct(e.textContent);e.textContent!==n&&(Ni(t.removed,{element:e.cloneNode()}),e.textContent=n)}return pt(I.afterSanitizeElements,e,null),!1},X=function(e,t,r){if(ue[t]||U&&(t===`id`||t===`name`)&&(r in n||r in Ke))return!1;let i=B[t]||de.attributeCheck instanceof Function&&de.attributeCheck(t,e);if(!(pe&&Ji(te,t))&&!(fe&&Ji(ne,t))){if(!i){if(!(_t(e)&&(V.tagNameCheck instanceof RegExp&&Ji(V.tagNameCheck,e)||V.tagNameCheck instanceof Function&&V.tagNameCheck(e))&&(V.attributeNameCheck instanceof RegExp&&Ji(V.attributeNameCheck,t)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(t,e))||t===`is`&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Ji(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r))))return!1}else if(!je[t]&&!Ji(oe,zi(r,ie,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Bi(r,`data:`)===0&&K[e])&&!(me&&!Ji(re,zi(r,ie,``)))&&r)return!1}return!0},Z=Qi({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),_t=function(e){return!Z[Ii(e)]&&Ji(ae,e)},vt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return O(r)}return r},Q=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),ut(e)?tt(e):Mi(t.removed)}catch{rt(n,e)}},yt=function(e){pt(I.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||ut(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0},r=t.length,i=We(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=We(o),u=c,d=o===`value`?u:Vi(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,pt(I.uponSanitizeAttribute,e,n),d=n.attrValue,Te&&(l===`id`||l===`name`)&&Bi(d,Ee)!==0&&(rt(o,e),d=Ee+d),_e&&Ji(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){rt(o,e);continue}if(l===`attributename`&&Ri(d,`href`)){rt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){rt(o,e);continue}if(!he&&Ji(Oa,d)){rt(o,e);continue}if(ge&&(d=ct(d)),!X(i,l,d)){rt(o,e);continue}d=vt(i,l,s,d),d!==u&&Q(e,o,s,d)}}pt(I.afterSanitizeAttributes,e,null)},$=function(e){let t=null,n=st(e);for(pt(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(pt(I.uponSanitizeShadowNode,t,null),gt(t),yt(t),dt(t.content)&&$(t.content),(y?y(t):t.nodeType)===ka.element){let e=_(t);dt(e)&&(bt(e),$(e))}pt(I.afterSanitizeShadowDOM,e,null)},bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){$(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===ka.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&We(e)===`template`){let e=n.content;dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);dt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Fe=!e,Fe&&(e=`<!-->`),typeof e!=`string`&&!ft(e)&&(e=ta(e),typeof e!=`string`))throw Yi(`dirty is not a string, aborting`);if(!t.isSupported)return e;ye?(z=H,B=be):Je(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(z=ea(z)),I.uponSanitizeAttribute.length>0&&(B=ea(B)),t.removed=[];let c=W&&typeof e!=`string`&&ft(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=We(t);if(!z[e]||le[e])throw Yi(`root node is forbidden and cannot be sanitized in-place`)}if(ut(e))throw Yi(`root node is clobbered and cannot be sanitized in-place`);try{bt(e)}catch(t){throw nt(e),t}}else if(ft(e))i=ot(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===ka.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),bt(a);else{if(!Se&&!ge&&!ve&&e.indexOf(`<`)===-1)return x&&we?D(e):e;if(i=ot(e),!i)return Se?null:we?S:``}i&&xe&&tt(i.firstChild);let l=st(c?e:i);try{for(;o=l.nextNode();)gt(o),yt(o),dt(o.content)&&$(o.content)}catch(t){throw c&&nt(e),t}if(c)return Ai(t.removed,e=>{e.element&&at(e.element)}),ge&<(e),e;if(Se){if(ge&<(i),Ce)for(s=N.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(B.shadowroot||B.shadowrootmode)&&(s=F.call(r,s,!0)),s}let u=ve?i.outerHTML:i.innerHTML;return ve&&z[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Ji(Ca,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
6
6
|
`+u),ge&&(u=ct(u)),x&&we?D(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Je(e),ye=!0,H=z,be=B},t.clearConfig=function(){Ge=null,ye=!1,H=null,be=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ge||Je({});let r=We(e),i=We(t);return X(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Ki(I,e)&&Ni(I[e],t)},t.removeHook=function(e,t){if(Ki(I,e)){if(t!==void 0){let n=ji(I[e],t);return n===-1?void 0:Pi(I[e],n,1)[0]}return Mi(I[e])}},t.removeHooks=function(e){Ki(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=Ma()},t}var Fa=Pa(),Ia=o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),ee=I(`/\\*`,`\\*/`),R=I(`#`,`$`),te=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:ee,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function ne(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function re(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ie(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ne,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ae(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function oe(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function z(e,t){e.relevance===void 0&&(e.relevance=1)}var se=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},B=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],ce=`keyword`;function V(e,t,n=ce){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,V(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,le(n[0],n[1])]})}}function le(e,t){return t?Number(t):+!ue(e)}function ue(e){return B.includes(e.toLowerCase())}var de={},fe=e=>{console.error(e)},pe=(e,...t)=>{console.log(`WARN: ${e}`,...t)},me=(e,t)=>{de[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),de[`${e}/${t}`]=!0)},he=Error();function ge(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function _e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw fe(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),he;if(typeof e.beginScope!=`object`||e.beginScope===null)throw fe(`beginScope must be object`),he;ge(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ve(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw fe(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),he;if(typeof e.endScope!=`object`||e.endScope===null)throw fe(`endScope must be object`),he;ge(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function ye(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function H(e){ye(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),_e(e),ve(e)}function be(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[re,oe,H,se].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ie,ae,z].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=V(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Se(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function xe(e){return e?e.endsWithParent||xe(e.starts):!1}function Se(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:xe(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ce=`11.11.1`,we=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},U=i,Te=a,Ee=Symbol(`nomatch`),De=7,W=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(pe(s.replace(`{}`,n[1])),pe(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(me(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),me(`10.7.0`,`Please use highlight(code, options) instead.
|
|
7
7
|
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};R(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,R(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=De&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(ee=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Ee;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Ee)return e}if(r.type===`illegal`&&a===``)return P+=`
|
package/dist/static/index.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
} catch (e) {}
|
|
60
60
|
})();
|
|
61
61
|
</script>
|
|
62
|
-
<script type="module" crossorigin src="./assets/index-
|
|
62
|
+
<script type="module" crossorigin src="./assets/index-BJrKzEhV.js"></script>
|
|
63
63
|
<link rel="stylesheet" crossorigin href="./assets/index-B8IoYkGH.css">
|
|
64
64
|
</head>
|
|
65
65
|
<body>
|
package/dist/static/sw.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// Replaced at build time; see vite.config.ts generateBundle hook.
|
|
17
|
-
const SW_CACHE_VERSION = "2.66.
|
|
17
|
+
const SW_CACHE_VERSION = "2.66.1";
|
|
18
18
|
const SHELL_CACHE = `dreb-dashboard-shell-v${SW_CACHE_VERSION}`;
|
|
19
19
|
|
|
20
20
|
// Shell assets (HTML, JS, CSS) get a network-first strategy. The dashboard
|