my-durable 0.0.115 → 0.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/dpi-backend/src/backup.ts +41 -0
- package/apps/dpi-backend/src/diagnostics.ts +12 -1
- package/apps/dpi-backend/src/git.ts +92 -35
- package/apps/dpi-backend/src/store.ts +46 -6
- package/apps/dpi-backend/src/vitals.ts +6 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-5H8W3a_-.js +83 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-lji31QeB.css → index-DD66rPUN.css} +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/client/composables.ts +29 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/client/export-bundle.ts +14 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/client/markdown.ts +7 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/GitPanel.vue +11 -8
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/TunnelStatusBar.vue +5 -1
- package/apps/dpi-playground/apps/dpi-playground-hub/src/main.ts +12 -2
- package/apps/dpi-playground/apps/dpi-playground-hub/src/mux.ts +153 -17
- package/apps/dpi-playground/apps/dpi-playground-hub/src/tunnel-transport.ts +38 -11
- package/apps/dpi-sdk/src/client.ts +53 -2
- package/apps/dpi-sdk/src/node/ops.ts +6 -2
- package/apps/dpi-sdk/src/node/private-file.ts +34 -1
- package/apps/dpi-sdk/src/node/registry.ts +5 -1
- package/apps/dpi-sdk/src/protocol/limits.ts +21 -0
- package/docs/verification.md +18 -0
- package/package.json +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-jjYABCI4.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>C(e)===`[object Map]`,h=e=>C(e)===`[object Set]`,g=e=>C(e)===`[object Date]`,_=e=>typeof e==`function`,v=e=>typeof e==`string`,y=e=>typeof e==`symbol`,b=e=>typeof e==`object`&&!!e,x=e=>(b(e)||_(e))&&_(e.then)&&_(e.catch),S=Object.prototype.toString,C=e=>S.call(e),ee=e=>C(e).slice(8,-1),te=e=>C(e)===`[object Object]`,ne=e=>v(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,re=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),w=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ie=/-\w/g,ae=w(e=>e.replace(ie,e=>e.slice(1).toUpperCase())),oe=/\B([A-Z])/g,se=w(e=>e.replace(oe,`-$1`).toLowerCase()),ce=w(e=>e.charAt(0).toUpperCase()+e.slice(1)),le=w(e=>e?`on${ce(e)}`:``),ue=(e,t)=>!Object.is(e,t),de=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},fe=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},pe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},me=e=>{let t=v(e)?Number(e):NaN;return isNaN(t)?e:t},he,ge=()=>he||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function T(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=v(r)?be(r):T(r);if(i)for(let e in i)t[e]=i[e]}return t}if(v(e)||b(e))return e}var _e=/;(?![^(]*\))/g,ve=/:([^]+)/,ye=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function be(e){let t={};return e.replace(ye,e=>e.startsWith(`/*`)?``:e).split(_e).forEach(e=>{if(e){let n=e.split(ve);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function E(e){let t=``;if(v(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=E(e[n]);r&&(t+=r+` `)}else if(b(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var xe=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Se=n(xe);xe+``;function Ce(e){return!!e||e===``}function we(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Oe(e[i],t[i],n);return r}function Te(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Oe(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Ee(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Te(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Oe(e[r],t[r],n))return!1}return String(e)===String(t)}function De(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Oe(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=y(e),i=y(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?De(e,t,n,we):!1:(r=b(e),i=b(t),r||i?!r||!i?!1:De(e,t,n,Ee):String(e)===String(t))))}function ke(e,t){return e.findIndex(e=>Oe(e,t))}var Ae=e=>!!(e&&e.__v_isRef===!0),D=e=>v(e)?e:e==null?``:p(e)||b(e)&&(e.toString===S||!_(e.toString))?Ae(e)?D(e.value):JSON.stringify(e,je,2):String(e),je=(e,t)=>Ae(t)?je(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Me(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Me(e))}:y(t)?Me(t):b(t)&&!p(t)&&!te(t)?String(t):t,Me=(e,t=``)=>y(e)?`Symbol(${e.description??t})`:e,Ne,Pe=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Ne&&(Ne.active?(this.parent=Ne,this.index=(Ne.scopes||(Ne.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Ne;try{return Ne=this,e()}finally{Ne=t}}}on(){++this._on===1&&(this.prevScope=Ne,Ne=this)}off(){if(this._on>0&&--this._on===0){if(Ne===this)Ne=this.prevScope;else{let e=Ne;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Fe(){return Ne}var Ie,Le=new WeakSet,Re=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ne&&(Ne.active?Ne.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Le.has(this)&&(Le.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||He(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,tt(this),Ge(this);let e=Ie,t=Ze;Ie=this,Ze=!0;try{return this.fn()}finally{Ke(this),Ie=e,Ze=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ye(e);this.deps=this.depsTail=void 0,tt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Le.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){qe(this)&&this.run()}get dirty(){return qe(this)}},ze=0,Be,Ve;function He(e,t=!1){if(e.flags|=8,t){e.next=Ve,Ve=e;return}e.next=Be,Be=e}function Ue(){ze++}function We(){if(--ze>0)return;if(Ve){let e=Ve;for(Ve=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Be;){let t=Be;for(Be=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Ge(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ke(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ye(r),Xe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function qe(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Je(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Je(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===nt)||(e.globalVersion=nt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!qe(e))))return;e.flags|=2;let t=e.dep,n=Ie,r=Ze;Ie=e,Ze=!0;try{Ge(e);let n=e.fn(e._value);(t.version===0||ue(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Ie=n,Ze=r,Ke(e),e.flags&=-3}}function Ye(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ye(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Xe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Ze=!0,Qe=[];function $e(){Qe.push(Ze),Ze=!1}function et(){let e=Qe.pop();Ze=e===void 0||e}function tt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Ie;Ie=void 0;try{t()}finally{Ie=e}}}var nt=0,rt=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},it=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ie||!Ze||Ie===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Ie)t=this.activeLink=new rt(Ie,this),Ie.deps?(t.prevDep=Ie.depsTail,Ie.depsTail.nextDep=t,Ie.depsTail=t):Ie.deps=Ie.depsTail=t,at(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Ie.depsTail,t.nextDep=void 0,Ie.depsTail.nextDep=t,Ie.depsTail=t,Ie.deps===t&&(Ie.deps=e)}return t}trigger(e){this.version++,nt++,this.notify(e)}notify(e){Ue();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{We()}}};function at(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)at(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ot=new WeakMap,st=Symbol(``),ct=Symbol(``),lt=Symbol(``);function ut(e,t,n){if(Ze&&Ie){let t=ot.get(e);t||ot.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new it),r.map=t,r.key=n),r.track()}}function dt(e,t,n,r,i,a){let o=ot.get(e);if(!o){nt++;return}let s=e=>{e&&e.trigger()};if(Ue(),t===`clear`)o.forEach(s);else{let i=p(e),a=i&&ne(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===lt||!y(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(lt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(st)),m(e)&&s(o.get(ct)));break;case`delete`:i||(s(o.get(st)),m(e)&&s(o.get(ct)));break;case`set`:m(e)&&s(o.get(st))}}We()}function ft(e){let t=O(e);return t===e||(ut(t,`iterate`,lt),Zt(e))?t:Xt(e)?Yt(e)?t.map(e=>tn(en(e))):t.map(tn):t.map(en)}function pt(e){return ut(e=O(e),`iterate`,lt),e}function mt(e,t){return Xt(e)?tn(Yt(e)?en(t):t):en(t)}var ht={__proto__:null,[Symbol.iterator](){return gt(this,Symbol.iterator,e=>mt(this,e))},concat(...e){return ft(this).concat(...e.map(e=>p(e)?ft(e):e))},entries(){return gt(this,`entries`,e=>(e[1]=mt(this,e[1]),e))},every(e,t){return vt(this,`every`,e,t,void 0,arguments)},filter(e,t){return vt(this,`filter`,e,t,e=>e.map(e=>mt(this,e)),arguments)},find(e,t){return vt(this,`find`,e,t,e=>mt(this,e),arguments)},findIndex(e,t){return vt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return vt(this,`findLast`,e,t,e=>mt(this,e),arguments)},findLastIndex(e,t){return vt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return vt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return bt(this,`includes`,e)},indexOf(...e){return bt(this,`indexOf`,e)},join(e){return ft(this).join(e)},lastIndexOf(...e){return bt(this,`lastIndexOf`,e)},map(e,t){return vt(this,`map`,e,t,void 0,arguments)},pop(){return xt(this,`pop`)},push(...e){return xt(this,`push`,e)},reduce(e,...t){return yt(this,`reduce`,e,t)},reduceRight(e,...t){return yt(this,`reduceRight`,e,t)},shift(){return xt(this,`shift`)},some(e,t){return vt(this,`some`,e,t,void 0,arguments)},splice(...e){return xt(this,`splice`,e)},toReversed(){return ft(this).toReversed()},toSorted(e){return ft(this).toSorted(e)},toSpliced(...e){return ft(this).toSpliced(...e)},unshift(...e){return xt(this,`unshift`,e)},values(){return gt(this,`values`,e=>mt(this,e))}};function gt(e,t,n){let r=pt(e),i=r[t]();return r!==e&&!Zt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var _t=Array.prototype;function vt(e,t,n,r,i,a){let o=pt(e),s=o!==e&&!Zt(e),c=o[t];if(c!==_t[t]){let t=c.apply(e,a);return s?en(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,mt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function yt(e,t,n,r){let i=pt(e),a=i!==e&&!Zt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=mt(e,t)),n.call(this,t,mt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?mt(e,c):c}function bt(e,t,n){let r=O(e);ut(r,`iterate`,lt);let i=r[t](...n);return(i===-1||i===!1)&&Qt(n[0])?(n[0]=O(n[0]),r[t](...n)):i}function xt(e,t,n=[]){$e(),Ue();let r=O(e)[t].apply(e,n);return We(),et(),r}var St=n(`__proto__,__v_isRef,__isVue`),Ct=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(y));function wt(e){y(e)||(e=String(e));let t=O(this);return ut(t,`has`,e),t.hasOwnProperty(e)}var Tt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Ut:Ht:i?Vt:Bt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=p(e);if(!r){let e;if(a&&(e=ht[t]))return e;if(t===`hasOwnProperty`)return wt}let o=Reflect.get(e,t,nn(e)?e:n);if((y(t)?Ct.has(t):St(t))||(r||ut(e,`get`,t),i))return o;if(nn(o)){let e=a&&ne(t)?o:o.value;return r&&b(e)?qt(e):e}return b(o)?r?qt(o):Gt(o):o}},Et=class extends Tt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=p(e)&&ne(t);if(!this._isShallow){let e=Xt(i);if(!Zt(n)&&!Xt(n)&&(i=O(i),n=O(n)),!a&&nn(i)&&!nn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:f(e,t),s=Reflect.set(e,t,n,nn(e)?e:r);return e===O(r)&&s&&(o?ue(n,i)&&dt(e,`set`,t,n,i):dt(e,`add`,t,n)),s}deleteProperty(e,t){let n=f(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&dt(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!y(t)||!Ct.has(t))&&ut(e,`has`,t),n}ownKeys(e){return ut(e,`iterate`,p(e)?`length`:st),Reflect.ownKeys(e)}},Dt=class extends Tt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Ot=new Et,kt=new Dt,At=new Et(!0),jt=e=>e,Mt=e=>Reflect.getPrototypeOf(e);function Nt(e,t,n){return function(...r){let i=this.__v_raw,a=O(i),o=m(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,u=i[e](...r),d=n?jt:t?tn:en;return!t&&ut(a,`iterate`,c?ct:st),l(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function Pt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ft(e,t){let n={get(n){let r=this.__v_raw,i=O(r),a=O(n);e||(ue(n,a)&&ut(i,`get`,n),ut(i,`get`,a));let{has:o}=Mt(i),s=t?jt:e?tn:en;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&ut(O(t),`iterate`,st),t.size},has(t){let n=this.__v_raw,r=O(n),i=O(t);return e||(ue(t,i)&&ut(r,`has`,t),ut(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=O(a),s=t?jt:e?tn:en;return!e&&ut(o,`iterate`,st),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return l(n,e?{add:Pt(`add`),set:Pt(`set`),delete:Pt(`delete`),clear:Pt(`clear`)}:{add(e){let n=O(this),r=Mt(n),i=O(e),a=!t&&!Zt(e)&&!Xt(e)?i:e;return r.has.call(n,a)||ue(e,a)&&r.has.call(n,e)||ue(i,a)&&r.has.call(n,i)||(n.add(a),dt(n,`add`,a,a)),this},set(e,n){!t&&!Zt(n)&&!Xt(n)&&(n=O(n));let r=O(this),{has:i,get:a}=Mt(r),o=i.call(r,e);o||=(e=O(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?ue(n,s)&&dt(r,`set`,e,n,s):dt(r,`add`,e,n),this},delete(e){let t=O(this),{has:n,get:r}=Mt(t),i=n.call(t,e);i||=(e=O(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&dt(t,`delete`,e,void 0,a),o},clear(){let e=O(this),t=e.size!==0,n=e.clear();return t&&dt(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Nt(r,e,t)}),n}function It(e,t){let n=Ft(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(f(n,r)&&r in t?n:t,r,i)}var Lt={get:It(!1,!1)},Rt={get:It(!1,!0)},zt={get:It(!0,!1)},Bt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,Ut=new WeakMap;function Wt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Gt(e){return Xt(e)?e:Jt(e,!1,Ot,Lt,Bt)}function Kt(e){return Jt(e,!1,At,Rt,Vt)}function qt(e){return Jt(e,!0,kt,zt,Ht)}function Jt(e,t,n,r,i){if(!b(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Wt(ee(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Yt(e){return Xt(e)?Yt(e.__v_raw):!!(e&&e.__v_isReactive)}function Xt(e){return!!(e&&e.__v_isReadonly)}function Zt(e){return!!(e&&e.__v_isShallow)}function Qt(e){return e?!!e.__v_raw:!1}function O(e){let t=e&&e.__v_raw;return t?O(t):e}function $t(e){return!f(e,`__v_skip`)&&Object.isExtensible(e)&&fe(e,`__v_skip`,!0),e}var en=e=>b(e)?Gt(e):e,tn=e=>b(e)?qt(e):e;function nn(e){return e?e.__v_isRef===!0:!1}function k(e){return an(e,!1)}function rn(e){return an(e,!0)}function an(e,t){return nn(e)?e:new on(e,t)}var on=class{constructor(e,t){this.dep=new it,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:O(e),this._value=t?e:en(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Zt(e)||Xt(e);e=n?e:O(e),ue(e,t)&&(this._rawValue=e,this._value=n?e:en(e),this.dep.trigger())}};function A(e){return nn(e)?e.value:e}var sn={get:(e,t,n)=>t===`__v_raw`?e:A(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return nn(i)&&!nn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function cn(e){return Yt(e)?e:new Proxy(e,sn)}var ln=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new it,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}};function un(e){return new ln(e)}var dn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new it(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=nt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ie!==this)return He(this,!0),!0}get value(){let e=this.dep.track();return Je(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function fn(e,t,n=!1){let r,i;return _(e)?r=e:(r=e.get,i=e.set),new dn(r,i,n)}var pn={},mn=new WeakMap,hn=void 0;function gn(e,t=!1,n=hn){if(n){let t=mn.get(n);t||mn.set(n,t=[]),t.push(e)}}function _n(e,t,n=r){let{immediate:i,deep:o,once:s,scheduler:c,augmentJob:l,call:d}=n,f=e=>o?e:Zt(e)||o===!1||o===0?vn(e,1):vn(e),m,h,g,v,y=!1,b=!1;if(nn(e)?(h=()=>e.value,y=Zt(e)):Yt(e)?(h=()=>f(e),y=!0):p(e)?(b=!0,y=e.some(e=>Yt(e)||Zt(e)),h=()=>e.map(e=>{if(nn(e))return e.value;if(Yt(e))return f(e);if(_(e))return d?d(e,2):e()})):h=_(e)?t?d?()=>d(e,2):e:()=>{if(g){$e();try{g()}finally{et()}}let t=hn;hn=m;try{return d?d(e,3,[v]):e(v)}finally{hn=t}}:a,t&&o){let e=h,t=o===!0?1/0:o;h=()=>vn(e(),t)}let x=Fe(),S=()=>{m.stop(),x&&x.active&&u(x.effects,m)};if(s&&t){let e=t;t=(...t)=>{let n=e(...t);return S(),n}}let C=b?Array(e.length).fill(pn):pn,ee=e=>{if(m.flags&1&&(m.dirty||e)){if(t){let n=m.run();if(e||o||y||(b?n.some((e,t)=>ue(e,C[t])):ue(n,C))){g&&g();let e=hn;hn=m;try{let e=[n,C===pn?void 0:b&&C[0]===pn?[]:C,v];C=n,d?d(t,3,e):t(...e)}finally{hn=e}}}else m.run()}};return l&&l(ee),m=new Re(h),m.scheduler=c?()=>c(ee,!1):ee,v=e=>gn(e,!1,m),g=m.onStop=()=>{let e=mn.get(m);if(e){if(d)d(e,4);else for(let t of e)t();mn.delete(m)}},t?i?ee(!0):C=m.run():c?c(ee.bind(null,!0),!0):m.run(),S.pause=m.pause.bind(m),S.resume=m.resume.bind(m),S.stop=S,S}function vn(e,t=1/0,n){if(t<=0||!b(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,nn(e))vn(e.value,t,n);else if(p(e))for(let r=0;r<e.length;r++)vn(e[r],t,n);else if(h(e)||m(e))e.forEach(e=>{vn(e,t,n)});else if(te(e)){for(let r in e)vn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&vn(e[r],t,n)}return e}function yn(e,t,n,r){try{return r?e(...r):e()}catch(e){xn(e,t,n)}}function bn(e,t,n,r){if(_(e)){let i=yn(e,t,n,r);return i&&x(i)&&i.catch(e=>{xn(e,t,n)}),i}if(p(e)){let i=[];for(let a=0;a<e.length;a++)i.push(bn(e[a],t,n,r));return i}}function xn(e,t,n,i=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||r;if(t){let r=t.parent,i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,a)===!1)return}r=r.parent}if(o){$e(),yn(o,null,10,[e,i,a]),et();return}}Sn(e,n,a,i,s)}function Sn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Cn=[],wn=-1,Tn=[],En=null,Dn=0,On=Promise.resolve(),kn=null;function An(e){let t=kn||On;return e?t.then(this?e.bind(this):e):t}function jn(e){let t=wn+1,n=Cn.length;for(;t<n;){let r=t+n>>>1,i=Cn[r],a=Ln(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Mn(e){if(!(e.flags&1)){let t=Ln(e),n=Cn[Cn.length-1];!n||!(e.flags&2)&&t>=Ln(n)?Cn.push(e):Cn.splice(jn(t),0,e),e.flags|=1,Nn()}}function Nn(){kn||=On.then(Rn)}function Pn(e){if(!p(e))En&&e.id===-1?En.splice(Dn+1,0,e):e.flags&1||(Tn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Tn.push(e[t]);Nn()}function Fn(e,t,n=wn+1){for(;n<Cn.length;n++){let t=Cn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;Cn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function In(e){if(Tn.length){let e=[...new Set(Tn)].sort((e,t)=>Ln(e)-Ln(t));if(Tn.length=0,En){for(let t=0;t<e.length;t++)En.push(e[t]);return}for(En=e,Dn=0;Dn<En.length;Dn++){let e=En[Dn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}En=null,Dn=0}}var Ln=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Rn(e){try{for(wn=0;wn<Cn.length;wn++){let e=Cn[wn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),yn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;wn<Cn.length;wn++){let e=Cn[wn];e&&(e.flags&=-2)}wn=-1,Cn.length=0,In(e),kn=null,(Cn.length||Tn.length)&&Rn(e)}}var zn=null,Bn=null;function Vn(e){let t=zn;return zn=e,Bn=e&&e.type.__scopeId||null,t}function Hn(e,t=zn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&wa(-1);let i=Vn(t),a=ba.length,o;try{o=e(...n)}finally{for(let e=ba.length;e>a;e--)Sa();Vn(i),r._d&&wa(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function j(e,t){if(zn===null)return e;let n=to(zn),i=e.dirs||=[];for(let e=0;e<t.length;e++){let[a,o,s,c=r]=t[e];a&&(_(a)&&(a={mounted:a,updated:a}),a.deep&&vn(o),i.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function Un(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&($e(),bn(c,n,8,[e.el,s,e,t]),et())}}function Wn(e,t){if(Va){let n=Va.provides,r=Va.parent&&Va.parent.provides;r===n&&(n=Va.provides=Object.create(r)),n[e]=t}}function Gn(e,t,n=!1){let r=Ha();if(r||Ei){let i=Ei?Ei._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&_(t)?t.call(r&&r.proxy):t}}var Kn=Symbol.for(`v-scx`),qn=()=>Gn(Kn);function Jn(e,t){return Yn(e,null,{flush:`sync`})}function M(e,t,n){return Yn(e,t,n)}function Yn(e,t,n=r){let{immediate:i,deep:o,flush:s,once:c}=n,u=l({},n),d=t&&i||!t&&s!==`post`,f;if(Ja){if(s===`sync`){let e=qn();f=e.__watcherHandles||=[]}else if(!d){let e=()=>{};return e.stop=a,e.resume=a,e.pause=a,e}}let p=Va;u.call=(e,t,n)=>bn(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{ia(e,p&&p.suspense)}:s!==`sync`&&(m=!0,u.scheduler=(e,t)=>{t?e():Mn(e)}),u.augmentJob=e=>{t&&(e.flags|=4),m&&(e.flags|=2,p&&(e.id=p.uid,e.i=p))};let h=_n(e,t,u);return Ja&&(f?f.push(h):d&&h()),h}function Xn(e,t,n){let r=this.proxy,i=v(e)?e.includes(`.`)?Zn(r,e):()=>r[e]:e.bind(r,r),a;_(t)?a=t:(a=t.handler,n=t);let o=Ga(this),s=Yn(i,a.bind(r),n);return o(),s}function Zn(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Qn=new WeakMap,$n=Symbol(`_vte`),er=e=>e.__isTeleport,tr=e=>e&&(e.disabled||e.disabled===``),nr=e=>e&&(e.defer||e.defer===``),rr=e=>typeof SVGElement<`u`&&e instanceof SVGElement,ir=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,ar=(e,t)=>{let n=e&&e.to;return v(n)?t?t(n):null:n},or={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g,parentNode:_}}=l,v=tr(t.props),{dynamicChildren:y}=t,b=(e,t,n)=>{e.shapeFlag&16&&u(e.children,t,n,i,a,o,s,c)},x=(e=t)=>{let n=tr(e.props),r=e.target=ar(e.props,m),a=dr(r,e,h,p);r&&(o!==`svg`&&rr(r)?o=`svg`:o!==`mathml`&&ir(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),ur(e,!1)))},S=e=>{let t=()=>{if(Qn.get(e)===t){if(Qn.delete(e),tr(e.props)){let t=_(e.el)||n;b(e,t,e.anchor),ur(e,!0)}x(e)}};Qn.set(e,t),ia(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),nr(t.props)||a&&a.pendingBranch){S(t);return}v&&(b(t,n,i),ur(t,!0)),x()}else{t.el=e.el;let r=t.anchor=e.anchor,u=Qn.get(e);if(u){u.flags|=8,Qn.delete(e),S(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=tr(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||rr(p)?o=`svg`:(o===`mathml`||ir(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),ua(e,t,!0)):c||d(e,t,_,b,i,a,o,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):sr(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=ar(t.props,m);e&&(t.target=e,sr(t,e,null,l,0))}else g&&sr(t,p,h,l,1);ur(t,v)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e,p=tr(f),m=a||!p,h=Qn.get(e);if(h&&(h.flags|=8,Qn.delete(e)),d&&(i(l),i(u)),a&&i(c),!h&&(p||d)&&o&16)for(let e=0;e<s.length;e++){let i=s[e];r(i,t,n,m,!!i.dynamicChildren)}},move:sr,hydrate:cr};function sr(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),!Qn.has(e)&&(!d||tr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function cr(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=ar(t.props,c),h=tr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||dr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||dr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),ur(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var lr=or;function ur(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function dr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[$n]=o,e&&(r(a,e,i),r(o,e,i)),o}var fr=Symbol(`_leaveCb`),pr=Symbol(`_enterCb`);function mr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Vr(()=>{e.isMounted=!0}),Wr(()=>{e.isUnmounting=!0}),e}var hr=[Function,Array],gr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:hr,onEnter:hr,onAfterEnter:hr,onEnterCancelled:hr,onBeforeLeave:hr,onLeave:hr,onAfterLeave:hr,onLeaveCancelled:hr,onBeforeAppear:hr,onAppear:hr,onAfterAppear:hr,onAppearCancelled:hr},_r=e=>{let t=e.subTree;return t.component?_r(t.component):t},vr={name:`BaseTransition`,props:gr,setup(e,{slots:t}){let n=Ha(),r=mr();return()=>{let i=t.default&&Er(t.default(),!0),a=i&&i.length?yr(i):n.subTree?H():void 0;if(!a)return;let o=O(e),{mode:s}=o;if(r.isLeaving)return Cr(a);let c=wr(a);if(!c)return Cr(a);let l=Sr(c,o,r,n,e=>l=e);c.type!==va&&Tr(c,l);let u=n.subTree&&wr(n.subTree);if(u&&u.type!==va&&!Da(u,c)&&_r(n).type!==va){let e=Sr(u,o,r,n);if(Tr(u,e),s===`out-in`&&c.type!==va)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Cr(a);s===`in-out`&&c.type!==va?e.delayLeave=(e,t,n)=>{let i=xr(r,u);i[String(u.key)]=u,e[fr]=()=>{t(),e[fr]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function yr(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==va){t=n;break}}return t}var br=vr;function xr(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Sr(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:m,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:_,onAppear:v,onAfterAppear:y,onAppearCancelled:b}=t,x=String(e.key),S=xr(n,e),C=(e,t)=>{e&&bn(e,r,9,t)},ee=(e,t)=>{let n=t[1];C(e,t),p(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},te={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted){if(a)r=_||c;else return}t[fr]&&t[fr](!0);let i=S[x];i&&Da(e,i)&&i.el[fr]&&i.el[fr](),C(r,[t])},enter(t){if(S[x]===e)return;let r=l,i=u,o=d;if(!n.isMounted){if(a)r=v||l,i=y||u,o=b||d;else return}let s=!1;t[pr]=e=>{s||(s=!0,C(e?o:i,[t]),te.delayedLeave&&te.delayedLeave(),t[pr]=void 0)};let c=t[pr].bind(null,!1);r?ee(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[pr]&&t[pr](!0),n.isUnmounting)return r();C(f,[t]);let a=!1;t[fr]=n=>{a||(a=!0,r(),C(n?g:h,[t]),t[fr]=void 0,S[i]===e&&delete S[i])};let o=t[fr].bind(null,!1);S[i]=e,m?ee(m,[t,o]):o()},clone(e){let a=Sr(e,t,n,r,i);return i&&i(a),a}};return te}function Cr(e){if(Nr(e))return e=Ma(e),e.children=null,e}function wr(e){if(!Nr(e))return er(e.type)&&e.children?yr(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&_(n.default))return n.default()}}function Tr(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;Tr(er(n.type)&&wr(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Er(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===F?(o.patchFlag&128&&i++,r=r.concat(Er(o.children,t,s))):(t||o.type!==va)&&r.push(s==null?o:Ma(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function N(e,t){return _(e)?l({name:e.name},t,{setup:e}):e}function Dr(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function Or(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var kr=new WeakMap;function Ar(e,t,n,i,a=!1){if(p(e)){e.forEach((e,r)=>Ar(e,t&&(p(t)?t[r]:t),n,i,a));return}if(Mr(i)&&!a){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Ar(e,t,n,i.component.subTree);return}let s=i.shapeFlag&4?to(i.component):i.el,c=a?null:s,{i:l,r:d}=e,m=t&&t.r,h=l.refs===r?l.refs={}:l.refs,g=l.setupState,y=O(g),b=g===r?o:e=>!Or(h,e)&&f(y,e),x=(e,t)=>!(t&&Or(h,t));if(m!=null&&m!==d){if(jr(t),v(m))h[m]=null,b(m)&&(g[m]=null);else if(nn(m)){let e=t;x(m,e.k)&&(m.value=null),e.k&&(h[e.k]=null)}}if(_(d))yn(d,l,12,[c,h]);else{let t=v(d),r=nn(d);if(t||r){let i=()=>{if(e.f){let n=t?b(d)?g[d]:h[d]:x(d)||!e.k?d.value:h[e.k];if(a)p(n)&&u(n,s);else if(p(n))n.includes(s)||n.push(s);else if(t)h[d]=[s],b(d)&&(g[d]=h[d]);else{let t=[s];x(d,e.k)&&(d.value=t),e.k&&(h[e.k]=t)}}else t?(h[d]=c,b(d)&&(g[d]=c)):r&&(x(d,e.k)&&(d.value=c),e.k&&(h[e.k]=c))};if(c){let t=()=>{i(),kr.delete(e)};t.id=-1,kr.set(e,t),ia(t,n)}else jr(e),i()}}}function jr(e){let t=kr.get(e);t&&(t.flags|=8,kr.delete(e))}ge().requestIdleCallback,ge().cancelIdleCallback;var Mr=e=>!!e.type.__asyncLoader,Nr=e=>e.type.__isKeepAlive;function Pr(e,t){Ir(e,`a`,t)}function Fr(e,t){Ir(e,`da`,t)}function Ir(e,t,n=Va){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Rr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Nr(e.parent.vnode)&&Lr(r,t,n,e),e=e.parent}}function Lr(e,t,n,r){let i=Rr(t,e,r,!0);Gr(()=>{u(r[t],i)},n)}function Rr(e,t,n=Va,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{$e();let i=Ga(n),a=bn(t,n,e,r);return i(),et(),a};return r?i.unshift(a):i.push(a),a}}var zr=e=>(t,n=Va)=>{(!Ja||e===`sp`)&&Rr(e,(...e)=>t(...e),n)},Br=zr(`bm`),Vr=zr(`m`),Hr=zr(`bu`),Ur=zr(`u`),Wr=zr(`bum`),Gr=zr(`um`),Kr=zr(`sp`),qr=zr(`rtg`),Jr=zr(`rtc`);function Yr(e,t=Va){Rr(`ec`,e,t)}var Xr=`components`;function Zr(e,t){return ei(Xr,e,!0,t)||e}var Qr=Symbol.for(`v-ndc`);function $r(e){return v(e)?ei(Xr,e,!1)||e:e||Qr}function ei(e,t,n=!0,r=!1){let i=zn||Va;if(i){let n=i.type;if(e===Xr){let e=no(n,!1);if(e&&(e===t||e===ae(t)||e===ce(ae(t))))return n}let a=ti(i[e]||n[e],t)||ti(i.appContext[e],t);return!a&&r?n:a}}function ti(e,t){return e&&(e[t]||e[ae(t)]||e[ce(ae(t))])}function P(e,t,n,r){let i,a=n&&n[r],o=p(e);if(o||v(e)){let n=o&&Yt(e),r=!1,s=!1;n&&(r=!Zt(e),s=Xt(e),e=pt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?tn(en(e[n])):en(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(b(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}var ni=e=>e?qa(e)?to(e):ni(e.parent):null,ri=l(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ni(e.parent),$root:e=>ni(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>pi(e),$forceUpdate:e=>e.f||=()=>{Mn(e.update)},$nextTick:e=>e.n||=An.bind(e.proxy),$watch:e=>Xn.bind(e)}),ii=(e,t)=>e!==r&&!e.__isScriptSetup&&f(e,t),ai={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:i,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return i[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else if(ii(i,t))return s[t]=1,i[t];else if(a!==r&&f(a,t))return s[t]=2,a[t];else if(f(o,t))return s[t]=3,o[t];else if(n!==r&&f(n,t))return s[t]=4,n[t];else ci&&(s[t]=0)}let u=ri[t],d,p;if(u)return t===`$attrs`&&ut(e.attrs,`get`,``),u(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==r&&f(n,t))return s[t]=4,n[t];if(p=l.config.globalProperties,f(p,t))return p[t]},set({_:e},t,n){let{data:i,setupState:a,ctx:o}=e;return ii(a,t)?(a[t]=n,!0):i!==r&&f(i,t)?(i[t]=n,!0):f(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:a,props:o,type:s}},c){let l;return!!(n[c]||e!==r&&c[0]!==`$`&&f(e,c)||ii(t,c)||f(o,c)||f(i,c)||f(ri,c)||f(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?f(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function oi(e){return p(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function si(e,t){return!e||!t?e||t:p(e)&&p(t)?e.concat(t):l({},oi(e),oi(t))}var ci=!0;function li(e){let t=pi(e),n=e.proxy,r=e.ctx;ci=!1,t.beforeCreate&&di(t.beforeCreate,e,`bc`);let{data:i,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:f,mounted:m,beforeUpdate:h,updated:g,activated:v,deactivated:y,beforeDestroy:x,beforeUnmount:S,destroyed:C,unmounted:ee,render:te,renderTracked:ne,renderTriggered:re,errorCaptured:w,serverPrefetch:ie,expose:ae,inheritAttrs:oe,components:se,directives:ce,filters:le}=t;if(u&&ui(u,r,null),s)for(let e in s){let t=s[e];_(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);b(t)&&(e.data=Gt(t))}if(ci=!0,o)for(let e in o){let t=o[e],i=U({get:_(t)?t.bind(n,n):_(t.get)?t.get.bind(n,n):a,set:!_(t)&&_(t.set)?t.set.bind(n):a});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(c)for(let e in c)fi(c[e],r,n,e);if(l){let e=_(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Wn(t,e[t])})}d&&di(d,e,`c`);function ue(e,t){p(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(ue(Br,f),ue(Vr,m),ue(Hr,h),ue(Ur,g),ue(Pr,v),ue(Fr,y),ue(Yr,w),ue(Jr,ne),ue(qr,re),ue(Wr,S),ue(Gr,ee),ue(Kr,ie),p(ae)){if(ae.length){let t=e.exposed||={};ae.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}te&&e.render===a&&(e.render=te),oe!=null&&(e.inheritAttrs=oe),se&&(e.components=se),ce&&(e.directives=ce),ie&&Dr(e)}function ui(e,t,n=a){p(e)&&(e=vi(e));for(let n in e){let r=e[n],i;i=b(r)?`default`in r?Gn(r.from||n,r.default,!0):Gn(r.from||n):Gn(r),nn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function di(e,t,n){bn(p(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function fi(e,t,n,r){let i=r.includes(`.`)?Zn(n,r):()=>n[r];if(v(e)){let n=t[e];_(n)&&M(i,n)}else if(_(e))M(i,e.bind(n));else if(b(e)){if(p(e))e.forEach(e=>fi(e,t,n,r));else{let r=_(e.handler)?e.handler.bind(n):t[e.handler];_(r)&&M(i,r,e)}}}function pi(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>mi(c,e,o,!0)),mi(c,t,o)),b(t)&&a.set(t,c),c}function mi(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&mi(e,a,n,!0),i&&i.forEach(t=>mi(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=hi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var hi={data:gi,props:xi,emits:xi,methods:bi,computed:bi,beforeCreate:yi,created:yi,beforeMount:yi,mounted:yi,beforeUpdate:yi,updated:yi,beforeDestroy:yi,beforeUnmount:yi,destroyed:yi,unmounted:yi,activated:yi,deactivated:yi,errorCaptured:yi,serverPrefetch:yi,components:bi,directives:bi,watch:Si,provide:gi,inject:_i};function gi(e,t){return t?e?function(){return l(_(e)?e.call(this,this):e,_(t)?t.call(this,this):t)}:t:e}function _i(e,t){return bi(vi(e),vi(t))}function vi(e){if(p(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function yi(e,t){return e?[...new Set([].concat(e,t))]:t}function bi(e,t){return e?l(Object.create(null),e,t):t}function xi(e,t){return e?p(e)&&p(t)?[...new Set([...e,...t])]:l(Object.create(null),oi(e),oi(t??{})):t}function Si(e,t){if(!e)return t;if(!t)return e;let n=l(Object.create(null),e);for(let r in t)n[r]=yi(e[r],t[r]);return n}function Ci(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var wi=0;function Ti(e,t){return function(n,r=null){_(n)||(n=l({},n)),r!=null&&!b(r)&&(r=null);let i=Ci(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:wi++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:ao,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&_(e.install)?(a.add(e),e.install(c,...t)):_(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||B(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,to(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(bn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=Ei;Ei=c;try{return e()}finally{Ei=t}}};return c}}var Ei=null;function Di(e,t,n=r){let i=Ha(),a=ae(t),o=se(t),s=Oi(e,a),c=un((s,c)=>{let l,u=r,d;return Jn(()=>{let t=e[a];ue(l,t)&&(l=t,c())}),{get(){return s(),n.get?n.get(l):l},set(e){let s=n.set?n.set(e):e;if(!ue(s,l)&&!(u!==r&&ue(e,u)))return;let f=i.vnode.props,p=!!(f&&(t in f||a in f||o in f)&&(`onUpdate:${t}`in f||`onUpdate:${a}`in f||`onUpdate:${o}`in f));p||(l=e,c()),i.emit(`update:${t}`,s),ue(e,u)&&(ue(e,s)&&!ue(s,d)||p&&u!==r&&!ue(s,l))&&c(),u=e,d=s}}});return c[Symbol.iterator]=()=>{let e=0;return{next(){return e<2?{value:e++?s||r:c,done:!1}:{done:!0}}}},c}var Oi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ae(t)}Modifiers`]||e[`${se(t)}Modifiers`];function ki(e,t,...n){if(e.isUnmounted)return;let i=e.vnode.props||r,a=n,o=t.startsWith(`update:`),s=o&&Oi(i,t.slice(7));s&&(s.trim&&(a=n.map(e=>v(e)?e.trim():e)),s.number&&(a=a.map(pe)));let c,l=i[c=le(t)]||i[c=le(ae(t))];!l&&o&&(l=i[c=le(se(t))]),l&&bn(l,e,6,a);let u=i[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,bn(u,e,6,a)}}var Ai=new WeakMap;function ji(e,t,n=!1){let r=n?Ai:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!_(e)){let r=e=>{let n=ji(e,t,!0);n&&(s=!0,l(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(b(e)&&r.set(e,null),null):(p(a)?a.forEach(e=>o[e]=null):l(o,a),b(e)&&r.set(e,o),o)}function Mi(e,t){return!e||!s(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),f(e,t[0].toLowerCase()+t.slice(1))||f(e,se(t))||f(e,t))}function Ni(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:l,render:u,renderCache:d,props:f,data:p,setupState:m,ctx:h,inheritAttrs:g}=e,_=Vn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Na(u.call(t,e,d,f,m,p,h)),y=s}else{let e=t;v=Na(e.length>1?e(f,{attrs:s,slots:o,emit:l}):e(f,null)),y=t.props?s:Pi(s)}}catch(t){ba.length=0,xn(t,e,1),v=B(va)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(c)&&(y=Fi(y,a)),b=Ma(b,y,!1,!0))}return n.dirs&&(b=Ma(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Tr(er(b.type)&&wr(b)||b,n.transition),v=b,Vn(_),v}var Pi=e=>{let t;for(let n in e)(n===`class`||n===`style`||s(n))&&((t||={})[n]=e[n]);return t},Fi=(e,t)=>{let n={};for(let r in e)(!c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ii(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Li(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Ri(o,r,n)&&!Mi(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||Li(r,o,l):!!o;return!1}function Li(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Ri(t,e,a)&&!Mi(n,a))return!0}return!1}function Ri(e,t,n){let r=e[n],i=t[n];return n===`style`&&b(r)&&b(i)?!Oe(r,i):r!==i}function zi({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var Bi={},Vi=()=>Object.create(Bi),Hi=e=>Object.getPrototypeOf(e)===Bi;function Ui(e,t,n,r=!1){let i={},a=Vi();e.propsDefaults=Object.create(null),Gi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Kt(i):e.type.props?i:a,e.attrs=a}function Wi(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=O(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(Mi(e.emitsOptions,o))continue;let u=t[o];if(c){if(f(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=ae(o);i[t]=Ki(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Gi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!f(t,a)&&((r=se(a))===a||!f(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Ki(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!f(t,e))&&(delete a[e],l=!0)}l&&dt(e.attrs,`set`,``)}function Gi(e,t,n,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let r in t){if(re(r))continue;let l=t[r],u;a&&f(a,u=ae(r))?!o||!o.includes(u)?n[u]=l:(c||={})[u]=l:Mi(e.emitsOptions,r)||(!(r in i)||l!==i[r])&&(i[r]=l,s=!0)}if(o){let t=O(n),i=c||r;for(let r=0;r<o.length;r++){let s=o[r];n[s]=Ki(a,t,s,i[s],e,!f(i,s))}}return s}function Ki(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=f(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&_(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Ga(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===se(n))&&(r=!0))}return r}var qi=new WeakMap;function Ji(e,t,n=!1){let a=n?qi:t.propsCache,o=a.get(e);if(o)return o;let s=e.props,c={},u=[],d=!1;if(!_(e)){let r=e=>{d=!0;let[n,r]=Ji(e,t,!0);l(c,n),r&&u.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!s&&!d)return b(e)&&a.set(e,i),i;if(p(s))for(let e=0;e<s.length;e++){let t=ae(s[e]);Yi(t)&&(c[t]=r)}else if(s)for(let e in s){let t=ae(e);if(Yi(t)){let n=s[e],r=c[t]=p(n)||_(n)?{type:n}:l({},n),i=r.type,a=!1,o=!0;if(p(i))for(let e=0;e<i.length;++e){let t=i[e],n=_(t)&&t.name;if(n===`Boolean`){a=!0;break}n===`String`&&(o=!1)}else a=_(i)&&i.name===`Boolean`;r[0]=a,r[1]=o,(a||f(r,`default`))&&u.push(t)}}let m=[c,u];return b(e)&&a.set(e,m),m}function Yi(e){return e[0]!==`$`&&!re(e)}var Xi=e=>e===`_`||e===`_ctx`||e===`$stable`,Zi=e=>p(e)?e.map(Na):[Na(e)],Qi=(e,t,n)=>{if(t._n)return t;let r=Hn((...e)=>Zi(t(...e)),n);return r._c=!1,r},$i=(e,t,n)=>{let r=e._ctx;for(let n in e){if(Xi(n))continue;let i=e[n];if(_(i))t[n]=Qi(n,i,r);else if(i!=null){let e=Zi(i);t[n]=()=>e}}},ea=(e,t)=>{let n=Zi(t);e.slots.default=()=>n},ta=(e,t,n)=>{for(let r in t)(n||!Xi(r))&&(e[r]=t[r])},na=(e,t,n)=>{let r=e.slots=Vi();if(e.vnode.shapeFlag&32){let e=t._;e?(ta(r,t,n),n&&fe(r,`_`,e,!0)):$i(t,r)}else t&&ea(e,t)},ra=(e,t,n)=>{let{vnode:i,slots:a}=e,o=!0,s=r;if(i.shapeFlag&32){let e=t._;e?n&&e===1?o=!1:ta(a,t,n):(o=!t.$stable,$i(t,a)),s=t}else t&&(ea(e,t),s={default:1});if(o)for(let e in a)!Xi(e)&&s[e]==null&&delete a[e]},ia=ga;function aa(e){return oa(e)}function oa(e,t){let n=ge();n.__VUE__=!0;let{insert:o,remove:s,patchProp:c,createElement:l,createText:u,createComment:d,setText:f,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=a,insertStaticContent:_}=e,v=(e,t,n,r=null,a=null,o=null,s=void 0,c=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!Da(e,t)&&(r=Se(e),ve(e,a,o,!0),e=null),t.patchFlag===-2&&(l=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===i&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:u,ref:d,shapeFlag:f}=t;switch(u){case _a:y(e,t,n,r);break;case va:b(e,t,n,r);break;case ya:e??x(t,n,r,s);break;case F:se(e,t,n,r,a,o,s,c,l);break;default:f&1?ee(e,t,n,r,a,o,s,c,l):f&6?ce(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,Te)}d!=null&&a?Ar(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&Ar(e.ref,null,o,e,!0)},y=(e,t,n,r)=>{if(e==null)o(t.el=u(t.children),n,r);else{let n=t.el=e.el;t.children!==e.children&&f(n,t.children)}},b=(e,t,n,r)=>{e==null?o(t.el=d(t.children||``),n,r):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,r)=>{let i;for(;e&&e!==t;)i=h(e),o(e,n,r),e=i;o(t,n,r)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),s(e),e=n;s(t)},ee=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)te(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),ie(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},te=(e,t,n,r,i,a,s,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=l(e.type,a,m&&m.is,m),h&8?p(d,e.children):h&16&&w(e.children,d,null,r,i,sa(e,a),s,u),_&&Un(e,null,r,`created`),ne(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!re(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&La(f,r,e)}_&&Un(e,null,r,`beforeMount`);let v=la(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&ia(()=>{try{f&&La(f,r,e),v&&g.enter(d),_&&Un(e,null,r,`mounted`)}finally{}},i)},ne=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||ha(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ne(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},w=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?Pa(e[l]):Na(e[l]);v(null,c,t,n,r,i,a,o,s)}},ie=(e,t,n,i,a,o,s)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:d,dirs:f}=t;u|=e.patchFlag&16;let m=e.props||r,h=t.props||r,g;if(n&&ca(n,!1),(g=h.onVnodeBeforeUpdate)&&La(g,n,t,e),f&&Un(t,e,n,`beforeUpdate`),n&&ca(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(u=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(l,``),d?ae(e.dynamicChildren,d,l,n,i,sa(t,a),o):s||me(e,t,l,null,n,i,sa(t,a),o,!1),u>0){if(u&16)oe(l,m,h,n,a);else if(u&2&&m.class!==h.class&&c(l,`class`,null,h.class,a),u&4&&c(l,`style`,m.style,h.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],i=m[r],o=h[r];(o!==i||r===`value`)&&c(l,r,i,o,a,n)}}u&1&&e.children!==t.children&&p(l,t.children)}else!s&&d==null&&oe(l,m,h,n,a);((g=h.onVnodeUpdated)||f)&&ia(()=>{g&&La(g,n,t,e),f&&Un(t,e,n,`updated`)},i)},ae=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===F||!Da(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},oe=(e,t,n,i,a)=>{if(t!==n){if(t!==r)for(let r in t)!re(r)&&!(r in n)&&c(e,r,t[r],null,a,i);for(let r in n){if(re(r))continue;let o=n[r],s=t[r];o!==s&&r!==`value`&&c(e,r,s,o,a,i)}`value`in n&&c(e,`value`,t.value,n.value,a)}},se=(e,t,n,r,i,a,s,c,l)=>{let d=t.el=e?e.el:u(``),f=t.anchor=e?e.anchor:u(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(c=c?c.concat(h):h),e==null?(o(d,n,r),o(f,n,r),w(t.children||[],n,f,i,a,s,c,l)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ae(e.dynamicChildren,m,n,i,a,s,c),(t.key!=null||i&&t===i.subTree)&&ua(e,t,!0)):me(e,t,n,f,i,a,s,c,l)},ce=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):le(t,n,r,i,a,o,c):ue(e,t,c)},le=(e,t,n,r,i,a,o)=>{let s=e.component=Ba(e,r,i);if(Nr(e)&&(s.ctx.renderer=Te),Ya(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,fe,o),!e.el){let r=s.subTree=B(va);b(null,r,t,n),e.placeholder=r.el}}else fe(s,e,t,n,i,a,o)},ue=(e,t,n)=>{let r=t.component=e.component;if(Ii(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,pe(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},fe=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=fa(e);if(n){t&&(t.el=c.el,pe(e,t,o)),n.asyncDep.then(()=>{ia(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;ca(e,!1),t?(t.el=c.el,pe(e,t,o)):t=c,n&&de(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&La(d,s,t,c),ca(e,!0);let f=Ni(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),Se(p),e,i,a),t.el=f.el,u===null&&zi(e,f.el),r&&ia(r,i),(d=t.props&&t.props.onVnodeUpdated)&&ia(()=>La(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Mr(t);if(ca(e,!1),l&&de(l),!m&&(o=c&&c.onVnodeBeforeMount)&&La(o,d,t),ca(e,!0),s&&De){let t=()=>{e.subTree=Ni(e),De(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=Ni(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ia(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ia(()=>La(o,d,e),i)}(t.shapeFlag&256||d&&Mr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ia(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Re(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Mn(u),ca(e,!0),l()},pe=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Wi(e,t.props,r,n),ra(e,t.children,n),$e(),Fn(e),et()},me=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){T(l,d,n,r,i,a,o,s,c);return}if(f&256){he(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&xe(l,i,a),d!==l&&p(n,d)):u&16?m&16?T(l,d,n,r,i,a,o,s,c):xe(l,i,a,!0):(u&8&&p(n,``),m&16&&w(d,n,r,i,a,o,s,c))},he=(e,t,n,r,a,o,s,c,l)=>{e||=i,t||=i;let u=e.length,d=t.length,f=Math.min(u,d),p=0;for(;p<f;p++){let r=t[p]=l?Pa(t[p]):Na(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?xe(e,a,o,!0,!1,f):w(t,n,r,a,o,s,c,l,f)},T=(e,t,n,r,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,p=d-1;for(;u<=f&&u<=p;){let r=e[u],i=t[u]=l?Pa(t[u]):Na(t[u]);if(Da(r,i))v(r,i,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=p;){let r=e[f],i=t[p]=l?Pa(t[p]):Na(t[p]);if(Da(r,i))v(r,i,n,null,a,o,s,c,l);else break;f--,p--}if(u>f){if(u<=p){let e=p+1,i=e<d?t[e].el:r;for(;u<=p;)v(null,t[u]=l?Pa(t[u]):Na(t[u]),n,i,a,o,s,c,l),u++}}else if(u>p)for(;u<=f;)ve(e[u],a,o,!0),u++;else{let m=u,h=u,g=new Map;for(u=h;u<=p;u++){let e=t[u]=l?Pa(t[u]):Na(t[u]);e.key!=null&&g.set(e.key,u)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(u=0;u<b;u++)C[u]=0;for(u=m;u<=f;u++){let r=e[u];if(y>=b){ve(r,a,o,!0);continue}let i;if(r.key!=null)i=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&Da(r,t[_])){i=_;break}i===void 0?ve(r,a,o,!0):(C[i-h]=u+1,i>=S?S=i:x=!0,v(r,t[i],n,null,a,o,s,c,l),y++)}let ee=x?da(C):i;for(_=ee.length-1,u=b-1;u>=0;u--){let e=h+u,i=t[e],f=t[e+1],p=e+1<d?f.el||ma(f):r;C[u]===0?v(null,i,n,p,a,o,s,c,l):x&&(_<0||u!==ee[_]?_e(i,n,p,2):_--)}}},_e=(e,t,n,r,i=null)=>{let{el:a,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){_e(e.component.subTree,t,n,r);return}if(d&128){e.suspense.move(t,n,r);return}if(d&64){c.move(e,t,n,Te);return}if(c===F){o(a,t,n);for(let e=0;e<u.length;e++)_e(u[e],t,n,r);o(e.anchor,t,n);return}if(c===ya){S(e,t,n);return}if(r!==2&&d&1&&l){if(r===0)l.persisted&&!a[fr]?o(a,t,n):(l.beforeEnter(a),o(a,t,n),ia(()=>l.enter(a),i));else{let{leave:r,delayLeave:i,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?s(a):o(a,t,n)},d=()=>{let e=a._isLeaving||!!a[fr];a._isLeaving&&a[fr](!0),l.persisted&&!e?u():r(a,()=>{u(),c&&c()})};i?i(a,u,d):d()}}else o(a,t,n)},ve=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&($e(),Ar(s,null,n,e,!0),et()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!Mr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&La(_,t,e),u&6)E(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Un(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Te,r):l&&!l.hasOnce&&(a!==F||d>0&&d&64)?xe(l,t,n,!1,!0):(a===F&&d&384||!i&&u&16)&&xe(c,t,n),r&&ye(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&ia(()=>{_&&La(_,t,e),h&&Un(e,null,t,`unmounted`),v&&(e.el=null)},n)},ye=e=>{let{type:t,el:n,anchor:r,transition:i}=e;if(t===F){be(n,r);return}if(t===ya){C(e),i&&!i.persisted&&i.afterLeave&&i.afterLeave();return}let a=()=>{s(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(e.shapeFlag&1&&i&&!i.persisted){let{leave:t,delayLeave:r}=i,o=()=>t(n,a);r?r(e.el,a,o):o()}else a()},be=(e,t)=>{let n;for(;e!==t;)n=h(e),s(e),e=n;s(t)},E=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;pa(c),pa(l),r&&de(r),i.stop(),a?(a.flags|=8,ve(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,ve(o,e,t,n)),s&&ia(s,t),ia(()=>{e.isUnmounted=!0},t)},xe=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)ve(e[o],t,n,r,i)},Se=e=>{if(e.shapeFlag&6)return Se(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[$n];return n?h(n):t},Ce=!1,we=(e,t,n)=>{let r;e==null?t._vnode&&(ve(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,Ce||=(Ce=!0,Fn(r),In(),!1)},Te={p:v,um:ve,m:_e,r:ye,mt:le,mc:w,pc:me,pbc:ae,n:Se,o:e},Ee,De;return t&&([Ee,De]=t(Te)),{render:we,hydrate:Ee,createApp:Ti(we,Ee)}}function sa({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function ca({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function la(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ua(e,t,n=!1){let r=e.children,i=t.children;if(p(r)&&p(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=Pa(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&ua(t,a)),a.type===_a&&(a.patchFlag===-1&&(a=i[e]=Pa(a)),a.el=t.el),a.type===va&&!a.el&&(a.el=t.el)}}function da(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function fa(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:fa(t)}function pa(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ma(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?ma(t.subTree):null}var ha=e=>e.__isSuspense;function ga(e,t){t&&t.pendingBranch?p(e)?t.effects.push(...e):t.effects.push(e):Pn(e)}var F=Symbol.for(`v-fgt`),_a=Symbol.for(`v-txt`),va=Symbol.for(`v-cmt`),ya=Symbol.for(`v-stc`),ba=[],xa=null;function I(e=!1){ba.push(xa=e?null:[])}function Sa(){ba.pop(),xa=ba[ba.length-1]||null}var Ca=1;function wa(e,t=!1){Ca+=e,e<0&&xa&&t&&(xa.hasOnce=!0)}function Ta(e){return e.dynamicChildren=Ca>0?xa||i:null,Sa(),Ca>0&&xa&&xa.push(e),e}function L(e,t,n,r,i,a){return Ta(z(e,t,n,r,i,a,!0))}function R(e,t,n,r,i){return Ta(B(e,t,n,r,i,!0))}function Ea(e){return e?e.__v_isVNode===!0:!1}function Da(e,t){return e.type===t.type&&e.key===t.key}var Oa=({key:e})=>e??null,ka=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:v(e)||nn(e)||_(e)?{i:zn,r:e,k:t,f:!!n}:e);function z(e,t=null,n=null,r=0,i=null,a=e===F?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Oa(t),ref:t&&ka(t),scopeId:Bn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:zn};return s?(Fa(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=v(n)?8:16),Ca>0&&!o&&xa&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&xa.push(c),c}var B=Aa;function Aa(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===Qr)&&(e=va),Ea(e)){let r=Ma(e,t,!0);return n&&Fa(r,n),Ca>0&&!a&&xa&&(r.shapeFlag&6?xa[xa.indexOf(e)]=r:xa.push(r)),r.patchFlag=-2,r}if(ro(e)&&(e=e.__vccOpts),t){t=ja(t);let{class:e,style:n}=t;e&&!v(e)&&(t.class=E(e)),b(n)&&(Qt(n)&&!p(n)&&(n=l({},n)),t.style=T(n))}let o=v(e)?1:ha(e)?128:er(e)?64:b(e)?4:_(e)?2:0;return z(e,t,n,r,i,o,a,!0)}function ja(e){return e?Qt(e)||Hi(e)?l({},e):e:null}function Ma(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Ia(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Oa(l),ref:t&&t.ref?n&&a?p(a)?a.concat(ka(t)):[a,ka(t)]:ka(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==F?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ma(e.ssContent),ssFallback:e.ssFallback&&Ma(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&Tr(u,c.clone(u)),u}function V(e=` `,t=0){return B(_a,null,e,t)}function H(e=``,t=!1){return t?(I(),R(va,null,e)):B(va,null,e)}function Na(e){return e==null||typeof e==`boolean`?B(va):p(e)?B(F,null,e.slice()):Ea(e)?Pa(e):B(_a,null,String(e))}function Pa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ma(e)}function Fa(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(p(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),Fa(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Hi(t)?t._ctx=zn:r===3&&zn&&(zn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(_(t)){if(r&65){Fa(e,{default:t});return}t={default:t,_ctx:zn},n=32}else t=String(t),r&64?(n=16,t=[V(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ia(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=E([t.class,r.class]));else if(e===`style`)t.style=T([t.style,r.style]);else if(s(e)){let n=t[e],i=r[e];i&&n!==i&&!(p(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!c(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function La(e,t,n,r=null){bn(e,t,7,[n,r])}var Ra=Ci(),za=0;function Ba(e,t,n){let i=e.type,a=(t?t.appContext:e.appContext)||Ra,o={uid:za++,vnode:e,type:i,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Pe(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ji(i,a),emitsOptions:ji(i,a),emit:null,emitted:null,propsDefaults:r,inheritAttrs:i.inheritAttrs,ctx:r,data:r,props:r,attrs:r,slots:r,refs:r,setupState:r,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=ki.bind(null,o),e.ce&&e.ce(o),o}var Va=null,Ha=()=>Va||zn,Ua,Wa;{let e=ge(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Ua=t(`__VUE_INSTANCE_SETTERS__`,e=>Va=e),Wa=t(`__VUE_SSR_SETTERS__`,e=>Ja=e)}var Ga=e=>{let t=Va;return Ua(e),e.scope.on(),()=>{e.scope.off(),Ua(t)}},Ka=()=>{Va&&Va.scope.off(),Ua(null)};function qa(e){return e.vnode.shapeFlag&4}var Ja=!1;function Ya(e,t=!1,n=!1){t&&Wa(t);let{props:r,children:i}=e.vnode,a=qa(e);Ui(e,r,a,t),na(e,i,n||t);let o=a?Xa(e,t):void 0;return t&&Wa(!1),o}function Xa(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,ai);let{setup:r}=n;if(r){$e();let n=e.setupContext=r.length>1?eo(e):null,i=Ga(e),a=yn(r,e,0,[e.props,n]),o=x(a);if(et(),i(),(o||e.sp)&&!Mr(e)&&Dr(e),o){if(a.then(Ka,Ka),t)return a.then(n=>{Wa(!0);try{Za(e,n,t)}finally{Wa(!1)}}).catch(t=>{xn(t,e,0)});e.asyncDep=a}else Za(e,a,t)}else Qa(e,t)}function Za(e,t,n){_(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:b(t)&&(e.setupState=cn(t)),Qa(e,n)}function Qa(e,t,n){let r=e.type;e.render||=r.render||a;{let t=Ga(e);$e();try{li(e)}finally{et(),t()}}}var $a={get(e,t){return ut(e,`get`,``),e[t]}};function eo(e){return{attrs:new Proxy(e.attrs,$a),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function to(e){return e.exposed?e.exposeProxy||=new Proxy(cn($t(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in ri)return ri[n](e)},has(e,t){return t in e||t in ri}}):e.proxy}function no(e,t=!0){return _(e)?e.displayName||e.name:e.name||t&&e.__name}function ro(e){return _(e)&&`__vccOpts`in e}var U=(e,t)=>fn(e,t,Ja);function io(e,t,n){try{wa(-1);let r=arguments.length;return r===2?b(t)&&!p(t)?Ea(t)?B(e,null,[t]):B(e,t):B(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ea(n)&&(n=[n]),B(e,t,n))}finally{wa(1)}}var ao=`3.5.43`,oo=void 0,so=typeof window<`u`&&window.trustedTypes;if(so)try{oo=so.createPolicy(`vue`,{createHTML:e=>e})}catch{}var co=oo?e=>oo.createHTML(e):e=>e,lo=`http://www.w3.org/2000/svg`,uo=`http://www.w3.org/1998/Math/MathML`,fo=typeof document<`u`?document:null,po=fo&&fo.createElement(`template`),mo={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?fo.createElementNS(lo,e):t===`mathml`?fo.createElementNS(uo,e):n?fo.createElement(e,{is:n}):fo.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>fo.createTextNode(e),createComment:e=>fo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>fo.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{po.innerHTML=co(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=po.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ho=`transition`,go=`animation`,_o=Symbol(`_vtc`),vo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},yo=l({},gr,vo),bo=(e=>(e.displayName=`Transition`,e.props=yo,e))((e,{slots:t})=>io(br,Co(e),t)),xo=(e,t=[])=>{p(e)?e.forEach(e=>e(...t)):e&&e(...t)},So=e=>e?p(e)?e.some(e=>e.length>1):e.length>1:!1;function Co(e){let t={};for(let n in e)n in vo||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:u=o,appearToClass:d=s,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,h=wo(i),g=h&&h[0],_=h&&h[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:x,onLeaveCancelled:S,onBeforeAppear:C=v,onAppear:ee=y,onAppearCancelled:te=b}=t,ne=(e,t,n,r)=>{e._enterCancelled=r,Do(e,t?d:s),Do(e,t?u:o),n&&n()},re=(e,t)=>{e._isLeaving=!1,Do(e,f),Do(e,m),Do(e,p),t&&t()},w=e=>(t,n)=>{let i=e?ee:y,o=()=>ne(t,e,n);xo(i,[t,o]),Oo(()=>{Do(t,e?c:a),Eo(t,e?d:s),So(i)||Ao(t,r,g,o)})};return l(t,{onBeforeEnter(e){xo(v,[e]),Eo(e,a),Eo(e,o)},onBeforeAppear(e){xo(C,[e]),Eo(e,c),Eo(e,u)},onEnter:w(!1),onAppear:w(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>re(e,t);Eo(e,f),e._enterCancelled?(Eo(e,p),Po(e)):(Po(e),Eo(e,p)),Oo(()=>{e._isLeaving&&(Do(e,f),Eo(e,m),So(x)||Ao(e,r,_,n))}),xo(x,[e,n])},onEnterCancelled(e){ne(e,!1,void 0,!0),xo(b,[e])},onAppearCancelled(e){ne(e,!0,void 0,!0),xo(te,[e])},onLeaveCancelled(e){re(e),xo(S,[e])}})}function wo(e){if(e==null)return null;if(b(e))return[To(e.enter),To(e.leave)];{let t=To(e);return[t,t]}}function To(e){return me(e)}function Eo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[_o]||(e[_o]=new Set)).add(t)}function Do(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[_o];n&&(n.delete(t),n.size||(e[_o]=void 0))}function Oo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var ko=0;function Ao(e,t,n,r){let i=e._endId=++ko,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=jo(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function jo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${ho}Delay`),a=r(`${ho}Duration`),o=Mo(i,a),s=r(`${go}Delay`),c=r(`${go}Duration`),l=Mo(s,c),u=null,d=0,f=0;t===ho?o>0&&(u=ho,d=o,f=a.length):t===go?l>0&&(u=go,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?ho:go:null,f=u?u===ho?a.length:c.length:0);let p=u===ho&&/\b(?:transform|all)(?:,|$)/.test(r(`${ho}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function Mo(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>No(t)+No(e[n])))}function No(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Po(e){return(e?e.ownerDocument:document).body.offsetHeight}function Fo(e,t,n){let r=e[_o];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Io=Symbol(`_vod`),Lo=Symbol(`_vsh`),Ro={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Io]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):zo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),zo(e,!0),r.enter(e)):r.leave(e,()=>{zo(e,!1)}):zo(e,t))},beforeUnmount(e,{value:t}){zo(e,t)}};function zo(e,t){e.style.display=t?e[Io]:`none`,e[Lo]=!t}var Bo=Symbol(``),Vo=/(?:^|;)\s*display\s*:/;function Ho(e,t,n){let r=e.style,i=v(n),a=!1;if(n&&!i){if(t){if(v(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Wo(r,t,``)}else for(let e in t)n[e]??Wo(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?Wo(r,i,``):Jo(e,i,!v(t)&&t?t[i]:void 0,o)||Wo(r,i,o)}}else if(i){if(t!==n){let e=r[Bo];e&&(n+=`;`+e),r.cssText=n,a=Vo.test(n)}}else t&&e.removeAttribute(`style`);Io in e&&(e[Io]=a?r.display:``,e[Lo]&&(r.display=`none`))}var Uo=/\s*!important$/;function Wo(e,t,n){if(p(n))n.forEach(n=>Wo(e,t,n));else if(n??=``,t.startsWith(`--`))Uo.test(n)?e.setProperty(t,n.replace(Uo,``),`important`):e.setProperty(t,n);else{let r=qo(e,t);Uo.test(n)?e.setProperty(se(r),n.replace(Uo,``),`important`):e[r]=n}}var Go=[`Webkit`,`Moz`,`ms`],Ko={};function qo(e,t){let n=Ko[t];if(n)return n;let r=ae(t);if(r!==`filter`&&r in e)return Ko[t]=r;r=ce(r);for(let n=0;n<Go.length;n++){let i=Go[n]+r;if(i in e)return Ko[t]=i}return t}function Jo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&v(r)&&n===r}var Yo=`http://www.w3.org/1999/xlink`;function Xo(e,t,n,r,i,a=Se(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(Yo,t.slice(6,t.length)):e.setAttributeNS(Yo,t,n):n==null||a&&!Ce(n)?e.removeAttribute(t):e.setAttribute(t,a?``:y(n)?String(n):n)}function Zo(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?co(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=Ce(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function Qo(e,t,n,r){e.addEventListener(t,n,r)}function $o(e,t,n,r){e.removeEventListener(t,n,r)}var es=Symbol(`_vei`);function ts(e,t,n,r,i=null){let a=e[es]||(e[es]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=is(t);r?Qo(e,n,a[t]=cs(r,i),s):o&&($o(e,n,o,s),a[t]=void 0)}}var ns=/(Once|Passive|Capture)$/,rs=/^on:?(?:Once|Passive|Capture)$/;function is(e){let t,n;for(;(n=e.match(ns))&&!rs.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):se(e.slice(2)),t]}var as=0,os=Promise.resolve(),ss=()=>as||=(os.then(()=>as=0),Date.now());function cs(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(p(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&bn(e,t,5,a)}}else bn(r,t,5,[e])};return n.value=e,n.attached=ss(),n}var ls=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,us=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Fo(e,r,o):t===`style`?Ho(e,n,r):s(t)?c(t)||ts(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):ds(e,t,r,o))?(Zo(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&Xo(e,t,r,o,a,t!==`value`)):e._isVueCE&&(fs(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!v(r)))?Zo(e,ae(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),Xo(e,t,r,o))};function ds(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&ls(t)&&_(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return ls(t)&&v(n)?!1:t in e}function fs(e,t){let n=e._def.props;if(!n)return!1;let r=ae(t);return Array.isArray(n)?n.some(e=>ae(e)===r):Object.keys(n).some(e=>ae(e)===r)}var ps=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return p(t)?e=>de(t,e):t};function ms(e){e.target.composing=!0}function hs(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var gs=Symbol(`_assign`),_s=Symbol(`_initialValue`);function vs(e,t,n){return t&&(e=e.trim()),n&&(e=pe(e)),e}var ys={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[_s]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[_s]=e.defaultValue.replace(/\r\n?/g,`
|
|
2
|
-
`))),e[gs]=ps(i);let a=r||i.props&&i.props.type===`number`;Qo(e,t?`change`:`input`,t=>{t.target.composing||e[gs](vs(e.value,n,a))}),(n||a)&&Qo(e,`change`,()=>{e.value=vs(e.value,n,a)}),t||(Qo(e,`compositionstart`,ms),Qo(e,`compositionend`,hs),Qo(e,`change`,hs))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[_s];delete e[_s],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[gs](vs(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[gs]=ps(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?pe(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},bs={deep:!0,created(e,t,n){e[gs]=ps(n),Qo(e,`change`,()=>{let t=e._modelValue,n=Ts(e),r=e.checked,i=e[gs];if(p(t)){let e=ke(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Es(e,r))})},mounted:xs,beforeUpdate(e,t,n){e[gs]=ps(n),xs(e,t,n)}};function xs(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=ke(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Oe(t,Es(e,!0))}e.checked!==i&&(e.checked=i)}var Ss={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,Qo(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pe(Ts(e)):Ts(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[gs](i)}finally{An(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[gs]=ps(r)},mounted(e,{value:t}){ws(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[gs]=ps(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Cs(t,n[1],n[0]))&&ws(e,t)}};function Cs(e,t,n){if(!n||p(e))return Oe(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function ws(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Ts(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):ke(t,o)>-1}else a.selected=t.has(o)}else if(Oe(Ts(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ts(e){return`_value`in e?e._value:e.value}function Es(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Ds=[`ctrl`,`shift`,`alt`,`meta`],Os={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ds.some(n=>e[`${n}Key`]&&!t.includes(n))},ks=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Os[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},As={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},js=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=se(n.key);if(t.some(e=>e===r||As[e]===r))return e(n)}))},Ms=l({patchProp:us},mo),Ns;function Ps(){return Ns||=aa(Ms)}var Fs=((...e)=>{let t=Ps().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Ls(e);if(!r)return;let i=t._component;!_(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Is(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Is(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Ls(e){return v(e)?document.querySelector(e):e}var Rs=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),zs={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Bs=({size:e,strokeWidth:t=2,absoluteStrokeWidth:n,color:r,iconNode:i,name:a,class:o,...s},{slots:c})=>io(`svg`,{...zs,width:e||zs.width,height:e||zs.height,stroke:r||zs.stroke,"stroke-width":n?Number(t)*24/Number(e):t,class:[`lucide`,`lucide-${Rs(a??`icon`)}`],...s},[...i.map(e=>io(...e)),...c.default?[c.default()]:[]]),W=(e,t)=>(n,{slots:r})=>io(Bs,{...n,iconNode:t,name:e},r),Vs=W(`ActivityIcon`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Hs=W(`ArchiveRestoreIcon`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Us=W(`ArchiveIcon`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Ws=W(`ArrowDownToLineIcon`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Gs=W(`ArrowRightIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ks=W(`ArrowUpFromLineIcon`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),qs=W(`ArrowUpRightIcon`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Js=W(`ArrowUpIcon`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ys=W(`BanIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),Xs=W(`BellIcon`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Zs=W(`BotIcon`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Qs=W(`BracesIcon`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),$s=W(`CableIcon`,[[`path`,{d:`M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1`,key:`10bnsj`}],[`path`,{d:`M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9`,key:`1eqmu1`}],[`path`,{d:`M21 21v-2h-4`,key:`14zm7j`}],[`path`,{d:`M3 5h4V3`,key:`z442eg`}],[`path`,{d:`M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3`,key:`ebdjd7`}]]),ec=W(`CalendarClockIcon`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),tc=W(`CheckIcon`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),nc=W(`ChevronDownIcon`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),rc=W(`ChevronRightIcon`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ic=W(`CircleCheckIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ac=W(`CircleHelpIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),oc=W(`Clock3Icon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),sc=W(`CopyIcon`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),cc=W(`CornerDownRightIcon`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),lc=W(`CornerLeftUpIcon`,[[`polyline`,{points:`14 9 9 4 4 9`,key:`m9oyvo`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),uc=W(`CornerUpLeftIcon`,[[`polyline`,{points:`9 14 4 9 9 4`,key:`881910`}],[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}]]),dc=W(`CpuIcon`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),fc=W(`DatabaseIcon`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),pc=W(`DownloadIcon`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),mc=W(`ExternalLinkIcon`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),hc=W(`EyeIcon`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),gc=W(`FileCogIcon`,[[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m3.2 12.9-.9-.4`,key:`1i3dj5`}],[`path`,{d:`m3.2 15.1-.9.4`,key:`1fvgj0`}],[`path`,{d:`M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5`,key:`1yo3oz`}],[`path`,{d:`m4.9 11.2-.4-.9`,key:`otmhb9`}],[`path`,{d:`m4.9 16.8-.4.9`,key:`1b8z07`}],[`path`,{d:`m7.5 10.3-.4.9`,key:`11k65u`}],[`path`,{d:`m7.5 17.7-.4-.9`,key:`431x55`}],[`path`,{d:`m9.7 12.5-.9.4`,key:`87sjan`}],[`path`,{d:`m9.7 15.5-.9-.4`,key:`khqm91`}],[`circle`,{cx:`6`,cy:`14`,r:`3`,key:`a1xfv6`}]]),_c=W(`FlagIcon`,[[`path`,{d:`M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z`,key:`i9b6wo`}],[`line`,{x1:`4`,x2:`4`,y1:`22`,y2:`15`,key:`1cm3nv`}]]),vc=W(`FolderGit2Icon`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),yc=W(`FolderOpenIcon`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),bc=W(`FolderIcon`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),xc=W(`GitBranchIcon`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Sc=W(`GitCompareIcon`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Cc=W(`GitForkIcon`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),wc=W(`GitMergeIcon`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Tc=W(`HandIcon`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),Ec=W(`HistoryIcon`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Dc=W(`HouseIcon`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),Oc=W(`InfoIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),kc=W(`KeyRoundIcon`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ac=W(`LaptopIcon`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),jc=W(`LayersIcon`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Mc=W(`LibraryBigIcon`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),Nc=W(`Link2Icon`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Pc=W(`ListChecksIcon`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),Fc=W(`LoaderCircleIcon`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ic=W(`LoaderIcon`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Lc=W(`MessageSquareIcon`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Rc=W(`MinusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),zc=W(`MonitorSmartphoneIcon`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),Bc=W(`NetworkIcon`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Vc=W(`OctagonIcon`,[[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}]]),Hc=W(`PackageOpenIcon`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Uc=W(`PanelLeftCloseIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Wc=W(`PanelLeftOpenIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Gc=W(`PanelLeftIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Kc=W(`PanelRightIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),qc=W(`PencilIcon`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Jc=W(`PiggyBankIcon`,[[`path`,{d:`M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z`,key:`1ivx2i`}],[`path`,{d:`M2 9v1c0 1.1.9 2 2 2h1`,key:`nm575m`}],[`path`,{d:`M16 11h.01`,key:`xkw8gn`}]]),Yc=W(`PlayIcon`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Xc=W(`PlusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zc=W(`PowerIcon`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Qc=W(`PuzzleIcon`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),$c=W(`RefreshCwIcon`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),el=W(`RepeatIcon`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),tl=W(`RotateCcwIcon`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),nl=W(`SearchIcon`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),rl=W(`SendIcon`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),il=W(`ServerIcon`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),al=W(`Share2Icon`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),ol=W(`ShieldAlertIcon`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),sl=W(`ShieldCheckIcon`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),cl=W(`ShieldOffIcon`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),ll=W(`SparklesIcon`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ul=W(`SplitIcon`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),dl=W(`SquareStackIcon`,[[`path`,{d:`M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2`,key:`4i38lg`}],[`path`,{d:`M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2`,key:`mlte4a`}],[`rect`,{width:`8`,height:`8`,x:`14`,y:`14`,rx:`2`,key:`1fa9i4`}]]),fl=W(`TagIcon`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),pl=W(`TerminalIcon`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ml=W(`Trash2Icon`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),hl=W(`Undo2Icon`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),gl=W(`WaypointsIcon`,[[`circle`,{cx:`12`,cy:`4.5`,r:`2.5`,key:`r5ysbb`}],[`path`,{d:`m10.2 6.3-3.9 3.9`,key:`1nzqf6`}],[`circle`,{cx:`4.5`,cy:`12`,r:`2.5`,key:`jydg6v`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`circle`,{cx:`19.5`,cy:`12`,r:`2.5`,key:`1piiel`}],[`path`,{d:`m13.8 17.7 3.9-3.9`,key:`1wyg1y`}],[`circle`,{cx:`12`,cy:`19.5`,r:`2.5`,key:`13o1pw`}]]),_l=W(`WifiOffIcon`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),vl=W(`WifiIcon`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),yl=W(`WorkflowIcon`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),bl=W(`WrenchIcon`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),xl=W(`XIcon`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Sl=class extends Error{code;status;constructor(e,t,n=0,r){super(t,r),this.code=e,this.status=n,this.name=`DpiError`}},Cl=e=>e.role===`assistant`,wl=e=>e.role===`toolResult`;function Tl(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>e.type===`text`?e.text??``:``).join(``):``}function El(e){if(e.errorMessage)return e.errorMessage;if(e.stopReason===`aborted`)return`Interrupted. Partial response preserved.`;if(e.stopReason===`error`)return`Provider request failed.`}function Dl(e){let t=e.data;return typeof t?.text==`string`?t.text:e.kind===`pi.reset`?`New context started. Earlier entries remain stored.`:e.kind===`pi.compaction`?`Context compacted. Earlier entries remain stored.`:e.kind}function Ol(e,t,n=new Map){let r=new Map,i=new Set;for(let t of e)for(let e of t.model??[])if(t.kind===`pi.tool-result`&&wl(e)&&r.set(e.toolCallId,{entryId:t.id,message:e}),t.kind===`pi.assistant`&&Cl(e))for(let t of e.content)t.type===`toolCall`&&i.add(t.id);if(t)for(let e of t.content)e.type===`toolCall`&&i.add(e.id);let a=(e,t,i)=>{let a=r.get(e),o=n.get(e),s=o?.nested;return a?{callId:e,name:t,args:i,status:a.message.isError?`error`:`done`,result:Tl(a.message),resultEntryId:a.entryId,...s?{nested:s}:{}}:o?.result?{callId:e,name:t,args:i,status:o.result.isError?`error`:`done`,result:o.result.text,...s?{nested:s}:{},...o.summary?{summary:kl(o.summary)}:{}}:{callId:e,name:t,args:i,status:o?.status??`pending`,output:o?.output||void 0,...s?{nested:s}:{},...o?.summary?{summary:kl(o.summary)}:{}}},o=e=>e.content.flatMap(e=>e.type===`text`?e.text?[{type:`text`,text:e.text}]:[]:e.type===`thinking`?e.thinking?[{type:`thinking`,text:e.thinking}]:[]:[{type:`tool`,call:a(e.id,e.name,e.arguments)}]),s=[];for(let t of e)if(t.kind!==`pi.system`){if(t.kind===`pi.user`)s.push({kind:`user`,id:t.id,text:(t.model??[]).map(Tl).join(`
|
|
3
|
-
`)});else if(t.kind===`pi.assistant`){let e=(t.model??[]).filter(Cl);s.push({kind:`assistant`,id:t.id,streaming:!1,blocks:e.flatMap(o),error:e.map(El).find(Boolean),model:e[0]?.model})}else if(t.kind===`pi.tool-result`)for(let e of(t.model??[]).filter(wl))i.has(e.toolCallId)||s.push({kind:`tool-result`,id:t.id,name:e.toolName,text:Tl(e),isError:e.isError});else s.push({kind:`event`,id:t.id,entryKind:t.kind,text:Dl(t),note:t.model?.length?(t.model??[]).map(Tl).join(`
|
|
4
|
-
`):void 0,...t.data===void 0?{}:{data:t.data}})}t&&s.push({kind:`assistant`,id:`live`,streaming:!0,blocks:o(t),model:t.model});for(let[e,t]of n)(t.status!==`done`||t.result||t.nested)&&!i.has(e)&&s.push({kind:`tool`,id:e,call:a(e,t.name,t.args)});return s}function kl(e){let t=[];return e.durationMs!==void 0&&t.push(`${(e.durationMs/1e3).toFixed(1)}s`),e.error&&t.push(e.error),t.join(` · `)}function Al(e){let t={tokens:0,cost:0,input:0,output:0,cacheRead:0,cacheWrite:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0};for(let n of Object.values(e?.models??{}))n&&typeof n==`object`&&(t.tokens+=n.totalTokens??n.input+n.output+n.cacheRead+n.cacheWrite,t.cost+=n.cost?.total??0,t.input+=n.input??0,t.output+=n.output??0,t.cacheRead+=n.cacheRead??0,t.cacheWrite+=n.cacheWrite??0,t.inputCost+=n.cost?.input??0,t.outputCost+=n.cost?.output??0,t.cacheReadCost+=n.cost?.cacheRead??0,t.cacheWriteCost+=n.cost?.cacheWrite??0);return t}var jl=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>void this.listeners.delete(e)}emit(){for(let e of this.listeners)e()}},Ml=()=>({items:[],entries:[],running:!1,generating:!1,inbox:[],agent:{},usage:{models:{},tools:{}},compactions:[],notices:[],docs:{},ready:!1}),Nl=new Set([`__proto__`,`constructor`,`prototype`]);function Pl(e,t,n){for(let e of t)if(typeof e==`string`&&Nl.has(e))return;let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];(typeof r[n]!=`object`||r[n]===null)&&(r[n]=typeof t[e+1]==`number`?[]:{}),r=r[n]}let i=t[t.length-1];r[i]=Ul(String(r[i]??``)+n)}var Fl=65536;function Il(e){return(Array.isArray(e)?e:[]).filter(e=>!!e&&typeof e==`object`).slice(-128).map(e=>{let t=e.content;return typeof t==`string`&&t.length>Fl?{...e,content:Buffer.from(t.slice(0,Fl),`utf8`).toString(`utf8`)+`…[truncated]`}:e})}var Ll=262144,Rl=4096;function zl(e){return e.length>Rl?Buffer.from(e.slice(-4096),`utf8`).toString(`utf8`)+`…[truncated]`:e}function Bl(e){let t=structuredClone(e),n=t.content;if(!Array.isArray(n))return t;for(let e of n){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.text==`string`&&t.text.length>Ll&&(t.text=Ul(t.text.slice(-262144))),typeof t.thinking==`string`&&t.thinking.length>Ll&&(t.thinking=Ul(t.thinking.slice(-262144))),t.arguments!==void 0)try{JSON.stringify(t.arguments).length>Vl&&(t.arguments=Hl(t.arguments))}catch{t.arguments={truncated:!0}}}return t}var Vl=65536;function Hl(e){try{let t=JSON.stringify(e);return t.length<=Vl?e:{truncated:!0,preview:Buffer.from(t.slice(0,4096),`utf8`).toString(`utf8`)}}catch{return{truncated:!0}}}function Ul(e){return e.length>Ll?ql.flatSlice(e.slice(e.length-Ll)):e}function Wl(e,t){if(t.type===`message`)return structuredClone(t.message);let n=t.path;if(n!==void 0&&(!Array.isArray(n)||n.length>64||n.some(e=>typeof e==`string`&&e.length>256)))return e;let r=[...e.content],i=t.contentIndex;if(!Number.isInteger(i)||i<0||i>r.length)return e;if(t.type===`block`||t.type.endsWith(`_start`))r[i]=structuredClone(t.block);else if(t.type===`text_delta`){let e=r[i];r[i]={type:`text`,text:Ul((e?.type===`text`?e.text:``)+t.delta)}}else if(t.type===`thinking_delta`){let e=r[i];r[i]={type:`thinking`,thinking:Ul((e?.type===`thinking`?e.thinking:``)+t.delta)}}else if(t.type===`toolcall_delta`){if(!Array.isArray(t.path))return e;let n=structuredClone(r[i]??{type:`toolCall`,id:``,name:``,arguments:{}});Pl(n,t.path,t.delta),r[i]=n}return{...e,content:r}}function Gl(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function Kl(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&!!e.state):[]}var ql=class e extends jl{state=Ml();entries=new Map;live;tools=new Map;apply(e){switch(e.type){case`snapshot`:this.reset(e.snapshot),this.state.inbox=Il(e.inbox);break;case`batch`:for(let t of(Array.isArray(e.events)?e.events:[]).filter(e=>!!e&&typeof e==`object`))try{this.event(t)}catch{}break;case`inbox`:this.state.inbox=Il(e.items);break;case`doc`:{if(String(e.kind).length>256)break;let t={...this.state.docs,[String(e.kind)]:this.capDocValue(e.value)},n=Object.keys(t).slice(-64);this.state.docs=Object.fromEntries(n.map(e=>[e,t[e]]));break}default:return!1}return this.rebuild(),this.emit(),!0}touch(){this.emit()}clear(){this.entries.clear(),this.tools.clear(),this.live=void 0,this.state=Ml(),this.emit()}rebuild(){let e=[...this.entries.values()].sort((e,t)=>e.id-t.id);this.state.entries=e,this.state.generating=!!this.live,this.state.items=Ol(e,this.live,this.tools)}reset(e){let t=(Array.isArray(e.entries)?e.entries:[]).filter(e=>!!e&&typeof e==`object`),n=(Array.isArray(e.tools)?e.tools:[]).filter(e=>!!e&&typeof e==`object`),r=(Array.isArray(e.nestedTools)?e.nestedTools:[]).filter(e=>!!e&&typeof e==`object`),i=(Array.isArray(e.compactions)?e.compactions:[]).filter(e=>!!e&&typeof e==`object`);this.entries=new Map(t.map(e=>[e.id,e])),this.capEntries(),this.live=e.generation?.message?Bl(e.generation.message):void 0,this.tools=new Map(n.filter(e=>typeof e.callId==`string`&&e.callId.length<=4096&&typeof e.name==`string`&&e.name.length<=4096).slice(-2e3).map(e=>[e.callId,{name:e.name,status:e.status,output:this.capToolOutput(e.output??``)}]));for(let e of r.filter(e=>typeof e.callId==`string`&&e.callId.length<=4096&&typeof e.name==`string`&&e.name.length<=4096).slice(-2e3)){let t=this.tools.get(e.callId);this.tools.set(e.callId,{name:e.name,status:e.status,output:this.capToolOutput(e.output??``),args:this.capArgs(e.arguments),nested:{parentCallId:e.parentCallId,parentTaskId:e.parentTaskId,taskId:e.taskId},...e.summary?{summary:e.summary}:{},...t??{}})}this.capTools(),this.state.running=!!e.run,this.state.agent=e.agent,this.state.usage=e.usage,this.state.retry=e.generation?.retry,this.state.compactions=i.map(e=>e.taskId).slice(-64),this.state.compactionFailure=e.compactionFailure,this.state.ready=!0}static MAX_TOOL_OUTPUT=262144;capToolOutput(t){return t.length>e.MAX_TOOL_OUTPUT?e.flatSlice(t.slice(-e.MAX_TOOL_OUTPUT)):t}static flatSlice(e){return Buffer.from(e,`utf8`).toString(`utf8`)}static MAX_ARGS=65536;capArgs(t){if(t==null)return t;try{let n=JSON.stringify(t);return n.length<=e.MAX_ARGS?t:{truncated:!0,preview:e.flatSlice(n.slice(0,4096))}}catch{return{truncated:!0}}}capTools(){for(;this.tools.size>2e3;){let e=this.tools.keys().next().value;if(e===void 0)break;this.tools.delete(e)}}capEntries(){for(;this.entries.size>5e3;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}commit(e){if(this.entries.set(e.id,this.capEntry(e)),e.kind===`pi.reset`||e.kind===`pi.compaction`){let t=e.head??e.id;for(let e of this.entries.keys())e<t&&this.entries.delete(e)}this.capEntries()}capEntry(t){if(!Array.isArray(t.model))return t;for(let n of t.model){let t=n.content;if(Array.isArray(t))for(let n of t){let t=n;for(let n of[`text`,`thinking`]){let r=t[n];typeof r==`string`&&r.length>Ll&&(t[n]=e.flatSlice(r.slice(r.length-Ll))+`…[truncated]`)}}}return t}capDocValue(t){let n=ru(t);return n.length>65536?{truncated:!0,preview:e.flatSlice(n.slice(0,4096))}:t}event(e){switch(e.type){case`snapshot`:return this.reset(e);case`run_start`:this.state.running=!0;return;case`run_end`:this.state.running=!1,this.live=void 0;return;case`message_start`:e.message.role===`assistant`&&(this.live=Bl(e.message));return;case`message_update`:this.live||={role:`assistant`,content:[],provider:``,model:``,usage:e.usage,stopReason:`pending`};for(let t of e.changes)this.live=Wl(this.live,t);this.live={...this.live,usage:e.usage};return;case`message_end`:return this.live=void 0,this.commit(e.entry);case`entry_appended`:return this.commit(e.entry);case`tool_execution_start`:if(typeof e.toolCallId!=`string`||e.toolCallId.length>4096||typeof e.toolName!=`string`||e.toolName.length>4096||e.parentToolCallId!==void 0&&typeof e.parentToolCallId==`string`&&e.parentToolCallId.length>4096)return;this.capTools(),this.tools.set(e.toolCallId,{name:e.toolName,status:`running`,output:``,args:this.capArgs(e.args),...e.parentToolCallId!==void 0&&e.parentTaskId!==void 0&&e.taskId!==void 0?{nested:{parentCallId:e.parentToolCallId,parentTaskId:e.parentTaskId,taskId:e.taskId}}:{}});return;case`tool_execution_update`:{if(typeof e.toolCallId!=`string`||e.toolCallId.length>4096||typeof e.toolName!=`string`||e.toolName.length>4096)return;let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`running`,output:``},n=e.output;n&&`set`in n?t.output=this.capToolOutput(n.set):n&&(t.output=this.capToolOutput(t.output.slice(n.trimStart??0)+(n.append??``))),t.status=`running`,this.capTools(),this.tools.set(e.toolCallId,t);return}case`tool_execution_end`:if(e.entry){this.tools.delete(e.toolCallId),this.commit(e.entry),this.capTools();return}if(e.result){if(typeof e.toolCallId!=`string`||e.toolCallId.length>4096||typeof e.toolName!=`string`||e.toolName.length>4096)return;let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`done`,output:``};t.status=`done`,t.result={text:nu(e.result),isError:e.result.isError},t.summary={isError:e.result.isError,durationMs:e.result.durationMs},this.capTools(),this.tools.set(e.toolCallId,t);return}this.tools.delete(e.toolCallId);return;case`agent_changed`:this.state.agent=e.agent;return;case`usage_changed`:this.state.usage=e.usage;return;case`auto_retry_start`:this.state.retry={at:e.at,error:e.errorMessage};return;case`auto_retry_end`:this.state.retry=void 0;return;case`compaction_start`:this.state.compactions.includes(e.taskId)||this.state.compactions.push(e.taskId),this.state.compactions.length>64&&(this.state.compactions=this.state.compactions.slice(-64));return;case`compaction_end`:this.state.compactions=this.state.compactions.filter(t=>t!==e.taskId),this.state.compactionFailure=e.error?{taskId:e.taskId,reason:e.reason,error:e.error}:void 0;return;case`task_failed`:if(typeof e.kind!=`string`||e.kind.length>64)return;this.state.notices=[...this.state.notices.slice(-9),`${e.kind} failed: ${zl(String(e.message??``))}`];return;default:return}}},Jl=class extends jl{state={agents:[],tasks:[],usage:{models:{},tools:{}},ready:!1};apply(e){if(e.type===`session`)this.state={agents:Gl(e.agents),tasks:Kl(e.tasks),usage:e.usage,ready:!0};else if(e.type===`agents`)this.state={...this.state,agents:Gl(e.agents)};else if(e.type===`tasks`)this.state={...this.state,tasks:Kl(e.tasks)};else if(e.type===`usage`)this.state={...this.state,usage:e.usage};else return!1;return this.emit(),!0}clear(){this.state={agents:[],tasks:[],usage:{models:{},tools:{}},ready:!1},this.emit()}agent(e){return this.state.agents.find(t=>t.id===e)}lineage(e){return Yl(this.state.agents,e)}foregroundBusy(e){return this.state.tasks.some(t=>!!t&&t?.background!==!0&&t.conversationId===e)}backgroundTasks(e){return this.state.tasks.filter(t=>!!t&&t?.background===!0&&(e===void 0||t.conversationId===e))}};function Yl(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[],i=new Set,a=t;for(;a!==void 0&&!i.has(a);){i.add(a);let e=n.get(a);if(!e)break;r.unshift(e),a=e.parentId}return r}var Xl=e=>e,Zl=(e,t)=>`${e}/s/${t}`,Ql=(e,t,n)=>`${e}/s/${t}/a/${n}`;function $l(e,t,n){let r=new Map;for(let i of(Array.isArray(t.agents)?t.agents:[]).filter(e=>!!e&&typeof e==`object`))r.set(i.id,{type:`agent`,key:Ql(e,t.id,i.id),deviceId:e,sessionId:t.id,agent:i,stale:n,children:[]});let i=[];for(let e of r.values()){let t=r.get(e.agent.parentId??e.agent.ownerAgentId??-1);t&&t!==e?t.children.push(e):i.push(e)}return i}function eu(e){return e.map(e=>{let t=e.status!==`online`;return{type:`device`,key:Xl(e.id),device:e,status:e.status,stale:t,children:(e.tree?.sessions??[]).map(n=>({type:`session`,key:Zl(e.id,n.id),deviceId:e.id,session:n,stale:t,children:$l(e.id,n,t)}))}})}var tu=class extends jl{devices=[];apply(e){return e.type===`network`&&(this.devices=(Array.isArray(e.devices)?e.devices:[]).filter(e=>!!e&&typeof e==`object`).map(e=>{let t=Array.isArray(e.tree?.sessions)?e.tree.sessions.filter(e=>!!e&&typeof e==`object`):[];return{...e,...e.tree?{tree:{...e.tree,sessions:t.map(e=>({...e,agents:(Array.isArray(e.agents)?e.agents:[]).filter(e=>!!e&&typeof e==`object`)}))}}:{}}}),this.emit(),!0)}device(e){return this.devices.find(t=>t.id===e)}tree(){return eu(this.devices)}};function nu(e){let t=e.structuredOutput;if(t==null)return``;let n=typeof t==`string`?t:ru(t);return n.length>4e3?`${ql.flatSlice(n.slice(0,4e3))}…`:n}function ru(e){try{return JSON.stringify(e)??``}catch{return``}}var iu=3e4;function au(e,t){return t&&/^\d+$/.test(t.trim())?Math.min(iu,Math.max(1e3,Number(t)*1e3)):Math.min(iu,1e3*2**Math.min(e,10))}function ou(e){return Math.min(iu,2e3*2**Math.min(e,10))}var su=class{state=`connecting`;source;streamId=``;slots=new Map;fresh=new Set;applied=[];routes=new Map;networkFns=new Set;stateFns=new Set;timer;reconnectTimer;reconnects=0;failures=0;flushing=Promise.resolve();start(){clearTimeout(this.reconnectTimer),this.source?.close(),this.streamId=``,this.source=new EventSource(`/api/stream`),this.source.onmessage=e=>this.receive(JSON.parse(e.data)),this.source.onerror=()=>{this.streamId=``,this.setState(this.source?.readyState===EventSource.CLOSED?`offline`:`connecting`),this.source?.readyState===EventSource.CLOSED&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>this.start(),ou(this.reconnects++)))}}stop(){clearTimeout(this.timer),clearTimeout(this.reconnectTimer),this.source?.close(),this.streamId=``}set(e,t){this.slots.get(e)!==t&&(t?(this.slots.set(e,t),this.fresh.add(t)):this.slots.delete(e),this.schedule())}reopen(e){let t=this.slots.get(e);t&&(this.fresh.add(t),this.schedule(0))}route(e,t){let n=this.routes.get(e)??new Set;return n.add(t),this.routes.set(e,n),()=>void n.delete(t)}onNetwork(e){return this.networkFns.add(e),()=>void this.networkFns.delete(e)}onState(e){return this.stateFns.add(e),()=>void this.stateFns.delete(e)}setState(e){if(e!==this.state){this.state=e;for(let t of this.stateFns)t(e)}}receive(e){let t=e.frame;if(t.type===`stream`){if(e.sub!==`hello`)return;this.streamId=t.streamId,this.applied=[],this.reconnects=0,this.failures=0,this.setState(`live`),this.schedule(0);return}if(t.type===`network`){if(e.sub!==`network`)return;for(let e of this.networkFns)e(t.devices);return}if(e.sub!==`hello`&&e.sub!==`network`){for(let[n,r]of this.slots)if(r===e.sub)for(let e of this.routes.get(n)??[])e(t)}}schedule(e=30){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flushing=this.flushing.then(()=>this.flush())},e)}async flush(){let e=this.streamId;if(!e)return;let t=[...new Set(this.slots.values())],n=t.filter(e=>this.fresh.has(e)&&this.applied.includes(e));if(this.fresh.clear(),n.length&&!await this.put(e,t.filter(e=>!n.includes(e)))){for(let e of n)this.fresh.add(e);return}(t.join(`
|
|
5
|
-
`)!==this.applied.join(`
|
|
6
|
-
`)||n.length)&&await this.put(e,t)}async put(e,t){let n=null;try{let r=await fetch(`/api/stream/${e}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({subs:t})});if(e!==this.streamId)return!1;if(r.ok)return this.applied=t,this.failures=0,!0;if(r.status===404)return this.start(),!1;console.warn(`subscription rejected`,r.status,await r.text()),n=r.headers.get(`retry-after`)}catch{if(e!==this.streamId)return!1}return this.schedule(au(this.failures++,n)),!1}},cu=`lab.png`;function lu(e){return`/icons/${typeof e==`string`&&/^[\w.-]+\.(png|svg)$/.test(e)&&!e.includes(`..`)?e:cu}`}var uu=16777216,du={initS:1,capS:15},fu={codeCreate:{perMinute:5,capacity:5},start:{perMinute:20,capacity:20},verifyFails:{perWindow:100,windowMinutes:15},verifyTotal:{perMinute:300,capacity:300}},pu={perMinute:60,capacity:120};du.initS,fu.verifyFails.perWindow,fu.verifyFails.windowMinutes,pu.perMinute,pu.capacity;function mu(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&n+1<e.length&&(e.charCodeAt(n+1)&64512)==56320?(t+=4,n++):t+=3}return t}async function*hu(e,t=45e3,n=uu){let r=e.getReader(),i=new TextDecoder,a=()=>new Sl(`invalid`,`SSE event exceeds ${n} bytes`),o=[],s=0,c=``;try{for(;;){let e,l=new Promise((n,r)=>{e=setTimeout(()=>r(new Sl(`offline`,`No data for ${t/1e3}s`)),t)}),u;try{u=await Promise.race([r.read(),l])}finally{clearTimeout(e)}if(u.done)return;let d=i.decode(u.value,{stream:!0}).replaceAll(`\r
|
|
7
|
-
`,`
|
|
8
|
-
`);if(!d)continue;if(c===`\r`&&d.startsWith(`
|
|
9
|
-
`)){let e=o.pop();if(e!==void 0){let t=e.slice(0,-1);t&&o.push(t),--s,c=o.length>0?o[o.length-1].slice(-1):``}}if(s+=mu(d),!(c+d).includes(`
|
|
10
|
-
|
|
11
|
-
`)){if(s>n)throw a();o.push(d),c=d.slice(-1);continue}let f=o.join(``)+d,p;for(;(p=f.indexOf(`
|
|
12
|
-
|
|
13
|
-
`))>=0;){let e=f.slice(0,p),t=mu(e);if(t>n)throw a();f=f.slice(p+2),s-=t+2;let r=gu(e);r&&(yield r)}if(s>n)throw a();o=f?[f]:[],c=f.slice(-1)}}finally{r.cancel().catch(()=>{})}}function gu(e){let t=`message`,n,r=[];for(let i of e.split(`
|
|
14
|
-
`)){if(!i||i.startsWith(`:`))continue;let e=i.indexOf(`:`),a=e<0?i:i.slice(0,e),o=e<0?``:i.slice(e+1).replace(/^ /,``);a===`event`?t=o:a===`data`?r.push(o):a===`id`&&(n=o)}return r.length?{event:t,data:r.join(`
|
|
15
|
-
`),id:n}:void 0}var _u=encodeURIComponent,vu=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,yu=e=>e.normalize(`NFKD`).replace(/[^\w.-]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60).toLowerCase()||`session`,bu=class{token;hooks;baseUrl;constructor(e,t,n={}){this.token=t,this.hooks=n,this.baseUrl=e.replace(/\/+$/,``)}headers(e,t={}){return{...this.token?{authorization:`Bearer ${this.token}`,"x-dpi-token":this.token}:{},...e?{"content-type":`application/json`}:{},...t}}async request(e,t,n,r={}){let i=AbortSignal.timeout(r.timeoutMs??2e4),a=r.signal?AbortSignal.any([r.signal,i]):i,o;try{o=await fetch(this.baseUrl+t,{method:e,signal:a,headers:this.headers(n!==void 0,r.idempotencyKey?{"idempotency-key":r.idempotencyKey}:{}),body:n===void 0?void 0:JSON.stringify(n)})}catch(e){throw r.signal?.aborted?e:new Sl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}let s=await o.text(),c;try{c=s?JSON.parse(s):void 0}catch{c=void 0}if(!o.ok){let e=c?.error;throw new Sl(e?.code??(o.status===401?`unauthorized`:o.status===404?`not_found`:`internal`),e?.message??`${o.status} ${o.statusText}`,o.status)}return o.headers.get(`idempotent-replay`)===`true`&&this.hooks.onIdempotentReplay?.(t),c}async*stream(e,t,n){let r;try{r=await fetch(this.baseUrl+e,{headers:{...this.headers(!1),accept:`text/event-stream`},signal:t})}catch(e){if(t.aborted)return;throw new Sl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}if(!r.ok||!r.body){let e=await r.json().catch(()=>void 0);throw new Sl(e?.error?.code??(r.status===401?`unauthorized`:`unavailable`),e?.error?.message??`Stream failed (${r.status})`,r.status)}try{for await(let e of hu(r.body,n))yield JSON.parse(e.data)}catch(e){if(t.aborted)return;throw e}}device(e){return this.request(`GET`,`/v1/device`,void 0,e)}vitals(){return this.request(`GET`,`/v1/device/vitals`)}tree(){return this.request(`GET`,`/v1/tree`)}projects(e=!1){return this.request(`GET`,`/v1/projects${e?`?includeArchived=1`:``}`)}updateProject(e,t){return this.request(`PATCH`,`/v1/projects/${_u(e)}`,t)}archiveProject(e){return this.request(`POST`,`/v1/projects/${_u(e)}/archive`,{})}unarchiveProject(e){return this.request(`POST`,`/v1/projects/${_u(e)}/unarchive`,{})}notifySinks(){return this.request(`GET`,`/v1/notify/sinks`)}createNotifySink(e){return this.request(`POST`,`/v1/notify/sinks`,e)}updateNotifySink(e,t){return this.request(`PATCH`,`/v1/notify/sinks/${_u(e)}`,t)}removeNotifySink(e){return this.request(`DELETE`,`/v1/notify/sinks/${_u(e)}`)}testNotifySinks(){return this.request(`POST`,`/v1/notify/test`,{})}envView(){return this.request(`GET`,`/v1/device/env`)}setEnvVar(e,t){return this.request(`POST`,`/v1/device/env`,{key:e,value:t})}removeEnvVar(e){return this.request(`DELETE`,`/v1/device/env/${_u(e)}`)}piAuth(){return this.request(`GET`,`/v1/device/pi-auth`)}setPiApiKey(e,t){return this.request(`PUT`,`/v1/device/pi-auth/${_u(e)}`,{key:t})}removePiApiKey(e){return this.request(`DELETE`,`/v1/device/pi-auth/${_u(e)}`)}graphs(){return this.request(`GET`,`/v1/graphs`)}graph(e){return this.request(`GET`,`/v1/graphs/${_u(e)}`)}createGraph(e){return this.request(`POST`,`/v1/graphs`,e)}runGraph(e){return this.request(`POST`,`/v1/graphs/${_u(e)}/run`,{})}removeGraph(e){return this.request(`DELETE`,`/v1/graphs/${_u(e)}`)}schedules(){return this.request(`GET`,`/v1/schedules`)}createSchedule(e){return this.request(`POST`,`/v1/schedules`,e)}updateSchedule(e,t){return this.request(`PATCH`,`/v1/schedules/${_u(e)}`,t)}removeSchedule(e){return this.request(`DELETE`,`/v1/schedules/${_u(e)}`)}runSchedule(e){return this.request(`POST`,`/v1/schedules/${_u(e)}/run`,{})}deviceUsage(){return this.request(`GET`,`/v1/device/usage`)}searchSessions(e,t){return this.request(`GET`,`/v1/sessions/search?q=${_u(e)}${t===`all`?`&scope=all`:``}`)}dirs(e=``){return this.request(`GET`,`/v1/fs/dirs?path=${_u(e)}`)}deviceDoc(e){return this.request(`GET`,`/v1/docs/${_u(e)}`)}deviceEvents(e,t=[]){return this.stream(`/v1/events${t.length?`?docs=${t.map(_u).join(`,`)}`:``}`,e)}gitStatus(e,t={}){return this.request(`GET`,`/v1/git/status?path=${_u(e)}`,void 0,t)}gitOp(e,t,n={}){return this.request(`POST`,`/v1/git`,{path:e,op:t,...n})}async exportSession(e,t={}){let n=AbortSignal.timeout(t.timeoutMs??6e4),r=t.signal?AbortSignal.any([t.signal,n]):n,i;try{i=await fetch(this.baseUrl+`/v1/sessions/${_u(e)}/export`,{headers:this.headers(!1),signal:r})}catch(e){throw t.signal?.aborted?e:new Sl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}if(!i.ok){let e=await i.text().catch(()=>``),t;try{t=e?JSON.parse(e):void 0}catch{t=void 0}throw new Sl(t?.error?.code??(i.status===401?`unauthorized`:i.status===404?`not_found`:`internal`),t?.error?.message??`${i.status} ${i.statusText}`,i.status)}let a=new Uint8Array(await i.arrayBuffer()),o=i.headers.get(`content-disposition`)??``,s=/filename="((?:[^"\\]|\\.)*)"/i.exec(o)?.[1],c=/filename=([^;\s]+)/i.exec(o)?.[1];return{filename:(s===void 0?c:s.replace(/\\(.)/g,`$1`))||`${yu(e)}.bundle.zip`,mime:i.headers.get(`content-type`)??`application/zip`,bytes:a}}sessionGitFiles(e){return this.request(`GET`,`/v1/sessions/${_u(e)}/git-files`)}sessionGitTurns(e){return this.request(`GET`,`/v1/sessions/${_u(e)}/git-turns`)}gitStatusBatch(e,t={}){return this.request(`POST`,`/v1/git/status-batch`,{paths:e},t)}sessions(){return this.request(`GET`,`/v1/sessions`)}archived(){return this.request(`GET`,`/v1/archive`)}archivedTranscript(e,t=`markdown`){return this.request(`GET`,`/v1/archive/${_u(e)}/transcript?format=${t}`)}restoreArchived(e){return this.request(`POST`,`/v1/archive/${_u(e)}/restore`,{})}createSession(e,t=vu()){return this.request(`POST`,`/v1/sessions`,e,{idempotencyKey:t})}session(e){return new xu(this,e)}agent(e,t){return new Su(this,e,String(t))}},xu=class{client;ref;constructor(e,t){this.client=e,this.ref=t}get base(){return`/v1/sessions/${_u(this.ref)}`}get(){return this.client.request(`GET`,this.base)}rename(e){return this.client.request(`PATCH`,this.base,{name:e})}archive(){return this.client.request(`DELETE`,this.base)}agents(){return this.client.request(`GET`,`${this.base}/agents`)}createAgent(e={},t=vu()){return this.client.request(`POST`,`${this.base}/agents`,e,{idempotencyKey:t})}tasks(e=`terminal`,t=20){return this.client.request(`GET`,`${this.base}/tasks?status=${e}&limit=${t}`)}abortTask(e){return this.client.request(`POST`,`${this.base}/tasks/${e}/abort`,{})}inspect(){return this.client.request(`GET`,`${this.base}/inspect`)}compaction(){return this.client.request(`GET`,`${this.base}/compaction`)}setCompaction(e){return this.client.request(`PATCH`,`${this.base}/compaction`,e)}submission(e,t=0){return this.client.request(`GET`,`${this.base}/submissions/${e}?waitMs=${t}`,void 0,{timeoutMs:t+2e4})}events(e){return this.client.stream(`${this.base}/events`,e)}},Su=class{client;session;agent;constructor(e,t,n){this.client=e,this.session=t,this.agent=n}get base(){return`/v1/sessions/${_u(this.session)}/agents/${_u(this.agent)}`}get(){return this.client.request(`GET`,this.base)}rename(e){return this.client.request(`PATCH`,this.base,{name:e})}send(e,t=`followUp`,n=vu(),r){return this.client.request(`POST`,`${this.base}/messages`,{content:e,whenBusy:t,requestId:n,waitMs:r},{timeoutMs:(r??0)+2e4})}withdraw(e){return this.client.request(`DELETE`,`${this.base}/inbox/${e}`)}abort(e=!1){return this.client.request(`POST`,`${this.base}/abort`,{background:e})}fork(e,t=vu()){return this.client.request(`POST`,`${this.base}/fork`,e,{idempotencyKey:t})}config(){return this.client.request(`GET`,`${this.base}/config`)}configure(e){return this.client.request(`PATCH`,`${this.base}/config`,e)}compact(e){return this.client.request(`POST`,`${this.base}/compact`,{instructions:e})}reset(e){return this.client.request(`POST`,`${this.base}/reset`,{note:e})}entries(e={}){let t=new URLSearchParams({scope:e.scope??`all`,limit:String(e.limit??500),...e.cursor?{cursor:e.cursor}:{}});return this.client.request(`GET`,`${this.base}/entries?${t}`)}transcript(e=`json`){return this.client.request(`GET`,`${this.base}/transcript?format=${e}`)}doc(e){return this.client.request(`GET`,`${this.base}/docs/${_u(e)}`)}extensions(){return this.client.request(`GET`,`${this.base}/extensions`)}setExtension(e){return this.client.request(`PATCH`,`${this.base}/extensions`,e)}demo(e,t,n=`POST`){return this.client.request(n,`${this.base}/demo/${e}`,t)}events(e,t=[]){return this.client.stream(`${this.base}/events${t.length?`?docs=${t.map(_u).join(`,`)}`:``}`,e)}};function Cu(e,t){let n=String(e??``).trim();return t?n.replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase():n.replace(/\/+$/,``)}function wu(e,t){let n=Array.isArray(e?.gitDirs)&&e.gitDirs.length?e.gitDirs:e?.startDirs;if(!Array.isArray(n)||n.length===0)return!0;let r=String(e?.platform??``).startsWith(`win32`),i=Cu(t,r);return n.some(e=>{let t=Cu(String(e),r);return!!t&&(i===t||i.startsWith(r?`${t}\\`:`${t}/`))})}function Tu(e){let t=Array.isArray(e?.gitDirs)&&e.gitDirs.length?e.gitDirs:e?.startDirs,n=Array.isArray(t)?t.map(String):[];return n.length?`outside the device's start dirs (it serves: ${n.join(`, `)})`:`outside the device's start dirs`}var Eu=0,Du=e=>new bu(`/api/devices/${encodeURIComponent(e)}`,void 0,{onIdempotentReplay:e=>{Date.now()-Eu<3e4||(Eu=Date.now(),Y(`Replayed an earlier identical request (${e}) — send a custom idempotency key for deliberate repeats.`))}}),G=e=>{let t=Du(e),n=()=>Vu.devices.value.find(t=>t.id===e)?.info,r=t.gitOp.bind(t);return t.gitOp=((e,t,i)=>{let a=n();return a&&e&&!wu(a,e)?Promise.reject(new Sl(`invalid`,`git ${t} skipped: ${Tu(a)}`,400)):r(e,t,i)}),t};async function Ou(e,t,n){let r=await fetch(`/api${t}`,{method:e,headers:n===void 0?{}:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)}),i=await r.json().catch(()=>void 0);if(!r.ok){let e=i?.error;throw new Sl(e?.code??`internal`,e?.message??`${r.status} ${r.statusText}`,r.status)}return i}var ku={network:()=>Ou(`GET`,`/network`),version:()=>Ou(`GET`,`/version`),check:e=>Ou(`POST`,`/devices/${encodeURIComponent(e)}/check`,{}),createShare:e=>Ou(`POST`,`/shares`,e),async uiGet(e){return(await Ou(`GET`,`/ui-state/${encodeURIComponent(e)}`)).value??void 0},uiSet:(e,t)=>Ou(`PUT`,`/ui-state/${encodeURIComponent(e)}`,{value:t})},K=e=>e instanceof Error?e.message:String(e),Au=[`demo.job-runs`,`demo.workspace`],ju=e=>`${e.deviceId}/agent/${e.sessionId}/${e.agentId}?docs=${Au.join(`,`)}`,Mu=e=>`${e.deviceId}/session/${e.sessionId}`,Nu=e=>`${e}/device?docs=app.shared-state`;function Pu(e,t,n,r=`hello`){let i=k(`idle`),a=k(``);return e.route(t,e=>{e.type===`hello`?(i.value=r===`hello`?`live`:`connecting`,r===`hello`&&(a.value=``)):e.type===`disconnected`?i.value=`reconnecting`:e.type===`fault`?(i.value=`fault`,a.value=e.error.message):(n(e),e.type===r&&(a.value=``,i.value=`live`))}),{status:i,fault:a,select:n=>{a.value=``,i.value=n?`connecting`:`idle`,e.set(t,n)},retry:()=>{i.value=`connecting`,e.reopen(t)}}}function Fu(e){let t=new tu,n=k(0);return t.subscribe(()=>n.value++),e.onNetwork(e=>t.apply({type:`network`,devices:e})),{model:t,devices:U(()=>(n.value,t.devices)),tree:U(()=>(n.value,t.tree()))}}function Iu(e,t){let n=rn(),r=rn([]),{status:i,select:a}=Pu(e,`device`,e=>{e.type===`doc`&&e.kind===`app.shared-state`?n.value={value:e.value,revision:e.revision??0}:e.type===`activity`&&(r.value=[...r.value,...e.items].slice(-50))});return M(t,e=>{n.value=void 0,a(e?Nu(e):void 0)},{immediate:!0}),{sharedState:n,activity:r,status:i}}function Lu(e,t){let n=new Jl,r=k(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o}=Pu(e,`session`,e=>n.apply(e));return M(()=>t.value?Mu(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:U(()=>(r.value,n.state)),status:i,fault:a}}function Ru(e,t){let n=new ql,r=k(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o,retry:s}=Pu(e,`agent`,e=>n.apply(e),`snapshot`);return M(()=>t.value?ju(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:U(()=>(r.value,{...n.state})),status:i,fault:a,version:r,retry:s}}var zu=new su,Bu=k(zu.state);zu.onState(e=>Bu.value=e);var Vu=Fu(zu),Hu=k(),Uu=k(),q=k(),Wu=k(new Set),Gu=k(300),Ku=Gt({tree:!0,inspector:!0}),qu=k(!1),Ju=U(()=>q.value?.deviceId),Yu=U(()=>Vu.devices.value.find(e=>e.id===Ju.value)),Xu=U(()=>Yu.value?.status===`online`),Zu=Lu(zu,U(()=>q.value?{deviceId:q.value.deviceId,sessionId:q.value.sessionId}:void 0)),Qu=Ru(zu,q),$u=Iu(zu,Ju),ed=U(()=>Yu.value?.tree?.sessions.find(e=>e.id===q.value?.sessionId)),td=U(()=>Ju.value?G(Ju.value):void 0),nd=U(()=>q.value&&td.value?td.value.agent(q.value.sessionId,q.value.agentId):void 0),rd=U(()=>q.value&&td.value?td.value.session(q.value.sessionId):void 0);function id(e){q.value=e,J.drawer=!1,ad=!!e,od()}var ad=!1;function od(){let e=q.value;if(!ad||!e)return;let t=Vu.devices.value.find(t=>t.id===e.deviceId)?.tree?.sessions.find(t=>t.id===e.sessionId)?.agents,n=new Map((t??[]).map(e=>[e.id,e])),r=[e.deviceId,`${e.deviceId}/s/${e.sessionId}`,`${e.deviceId}/s/${e.sessionId}/a/${e.agentId}`],i=n.get(e.agentId),a=new Set;for(;i&&!a.has(i.id);){a.add(i.id);let t=i.parentId??i.ownerAgentId;if(t===void 0)break;r.push(`${e.deviceId}/s/${e.sessionId}/a/${t}`),i=n.get(t)}r.some(e=>!Wu.value.has(e))&&(Wu.value=new Set([...Wu.value,...r])),n.has(e.agentId)&&(ad=!1)}M(()=>Vu.devices.value,od);function sd(e,t){let n=new Set(Wu.value);t??!n.has(e)?n.add(e):n.delete(e),Wu.value=n}var cd=(()=>{let e=new Map;return(t,n)=>{clearTimeout(e.get(t)),e.set(t,setTimeout(()=>void ku.uiSet(t,n).catch(()=>{}),300))}})();M(q,e=>qu.value&&void ku.uiSet(`tree.selected`,e??null).catch(()=>{})),M(Gu,e=>qu.value&&cd(`tree.width`,e)),M(Ku,e=>qu.value&&cd(`layout.panels`,{...e}));async function ld(){let e;try{e=await ku.network()}catch(e){e instanceof Sl&&e.status===401||zu.start(),J.error=K(e),qu.value=!0;return}zu.start();try{let[t,n,r]=await Promise.all([ku.uiGet(`tree.selected`),ku.uiGet(`tree.width`),ku.uiGet(`layout.panels`)]);r&&Object.assign(Ku,r),ku.version().then(e=>Uu.value=e.version).catch(()=>{}),Hu.value=e.configFile,Vu.model.devices.length||Vu.model.apply({type:`network`,devices:e.devices}),Wu.value=new Set,n&&(Gu.value=n),t&&e.devices.some(e=>e.id===t.deviceId)?id(t):ud(e.devices)}catch(e){J.error=K(e)}finally{qu.value=!0}}function ud(e){for(let t of e){let e=t.status===`online`?t.tree?.sessions[0]:void 0,n=e?.agents.find(e=>e.kind===`root`)??e?.agents[0];if(e&&n)return id({deviceId:t.id,sessionId:e.id,agentId:n.id})}}M(()=>[Qu.status.value,ed.value],([e,t])=>{e===`fault`&&!t&&Xu.value&&(Y(`That session was archived on its device.`),id(void 0))});var dd=U(()=>Yu.value?.info?.models??[]),fd=Qu.state,pd=U(()=>Zu.state.value.agents.length?Zu.state.value.agents:ed.value?.agents??[]),md=U(()=>q.value?Yl(pd.value,q.value.agentId):[]),hd=U(()=>{let e=q.value?.agentId;if(e===void 0)return[];let t=pd.value,n=new Set([e]);for(let e=!0;e;){e=!1;for(let r of t)r.ownerAgentId!==void 0&&n.has(r.ownerAgentId)&&!n.has(r.id)&&(n.add(r.id),e=!0)}let r=Zu.state.value.tasks,i=new Map(r.map(e=>[e.id,e])),a=new Map(t.map(e=>[e.id,e.ownerTaskId]));return r.filter(e=>n.has(e.conversationId)).map(e=>{let t=e,n=!1,r=new Set;for(;t&&!r.has(t.id);){if(r.add(t.id),t.background){n=!0;break}let e=t.owner??a.get(t.conversationId);t=e===void 0?void 0:i.get(e)}return{...e,effectiveBackground:n}})}),gd=U(()=>fd.value.running||hd.value.some(e=>!e.effectiveBackground&&e.conversationId===q.value?.agentId)),_d=U(()=>Al(fd.value.usage)),vd=U(()=>{let e=fd.value.agent.model;return dd.value.find(t=>t.provider===e?.provider&&t.id===e?.modelId)}),yd=U(()=>{let e=fd.value.agent.model;if(e?.modelId)return e;let t=ed.value;return t?.model?{provider:t.provider??``,modelId:t.model}:void 0}),bd=U(()=>{let e=yd.value;return e?dd.value.find(t=>t.provider===e.provider&&t.id===e.modelId):void 0}),xd=rn(),Sd=0;async function Cd(){let e=nd.value,t=++Sd;if(!e||!Xu.value)return void(xd.value=void 0);try{let n=await e.get();t===Sd&&(xd.value=n)}catch{t===Sd&&(xd.value=void 0)}}M([nd,Xu],()=>void Cd(),{immediate:!0});var J=Gt({error:``,toast:``,drawer:!1,inspectorOverlay:!1,tab:`session`,composer:``,dialog:void 0}),wd,Td=Gt([]),Ed=1;function Dd(){for(let e of Td)e.read=!0}function Y(e){J.toast=e,e&&(Td.unshift({id:Ed++,text:e,at:Date.now(),read:!1}),Td.length>50&&(Td.length=50)),clearTimeout(wd),wd=setTimeout(()=>J.toast=``,4500)}async function Od(e){J.error=``;try{return await e()}catch(e){J.error=K(e);return}}function kd(e){J.composer=e,setTimeout(()=>document.querySelector(`.composer textarea`)?.focus())}var Ad=e=>Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e),jd=e=>JSON.stringify(e,null,2),Md=(e=``)=>lu(dd.value.find(t=>t.id===e)?.icon);function Nd(e){if(!e)return`never`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s ago`:t<3600?`${Math.round(t/60)}m ago`:t<86400?`${Math.round(t/3600)}h ago`:`${Math.round(t/86400)}d ago`}var Pd=k(!1);async function Fd(){gd.value&&!Pd.value&&nd.value&&(Pd.value=!0,await Od(()=>nd.value.abort(!1))&&Y(`Foreground work interrupted. Background jobs continue.`),Pd.value=!1)}var Id=window.matchMedia(`(max-width: 1100px)`),Ld=k(Id.matches);Id.addEventListener(`change`,e=>Ld.value=e.matches);var Rd=U(()=>Ld.value?J.inspectorOverlay:Ku.inspector);function zd(e){e&&(J.tab=e),Ld.value?(J.drawer=!1,J.inspectorOverlay=!0):Ku.inspector=!0}function Bd(){Ld.value?J.inspectorOverlay=!1:Ku.inspector=!1}function Vd(){Ld.value?(J.drawer=!J.drawer)&&(J.inspectorOverlay=!1,Ku.tree=!0):Ku.tree=!Ku.tree}function Hd(){Rd.value?Bd():zd()}var Ud=/Mac|iPhone|iPad/.test(navigator.userAgent),Wd=Ud?{tree:`Ctrl+N`,inspector:`Ctrl+T`}:{tree:`Alt+Shift+N`,inspector:`Alt+Shift+T`};function Gd(e){if(!(!(Ud?e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey:e.altKey&&e.shiftKey&&!e.ctrlKey&&!e.metaKey)||e.repeat||e.isComposing)){if(e.code===`KeyN`)return`tree`;if(e.code===`KeyT`)return`inspector`}}var Kd={class:`topbar`},qd={class:`brand`},Jd={class:`daemon`,"data-testid":`topbar-stats`},Yd=[`title`],Xd={class:`top-actions`},Zd={key:0,class:`usage-chip`,title:`This session's token usage and cost`},Qd=[`aria-label`,`title`],$d={key:0,class:`bell-dot`},ef={key:0,class:`hint`},tf={class:`when`},nf=[`disabled`],rf=[`disabled`],af=N({__name:`TopBar`,emits:[`newSession`],setup(e,{emit:t}){let n=k(!1),r=U(()=>Td.filter(e=>!e.read).length),i=()=>{n.value=!n.value,n.value&&Dd()},a=e=>{let t=Math.round((Date.now()-e)/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h`},o=U(()=>_d.value.input+_d.value.output+_d.value.cacheRead+_d.value.cacheWrite),s=U(()=>(_d.value.inputCost??0)+(_d.value.outputCost??0)+(_d.value.cacheReadCost??0)+(_d.value.cacheWriteCost??0)),c=U(()=>Vu.devices.value.filter(e=>e.status===`online`).length),l=U(()=>Vu.devices.value.reduce((e,t)=>e+(t.tree?.sessions.length??0),0)),u=U(()=>Vu.devices.value.reduce((e,t)=>e+(t.tree?.sessions.reduce((e,t)=>e+t.agents.length,0)??0),0)),d=k(!1);async function f(){let e=rd.value,t=q.value;if(!e||!t||d.value)return;d.value=!0;let n=await Od(()=>e.createAgent({name:`Agent ${pd.value.length+1}`}));d.value=!1,n&&(id({...t,agentId:n.id}),Y(`New agent. Same session, same shared App State.`))}let p=t;return(e,t)=>(I(),L(`header`,Kd,[z(`div`,qd,[z(`button`,{class:`icon-button tree-toggle`,"aria-label":`Toggle network`,title:`Network`,onClick:t[0]||=e=>A(J).drawer=!A(J).drawer},[B(A(Gc),{size:19})]),t[6]||=z(`img`,{class:`brandmark`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),t[7]||=z(`strong`,null,`Durable Pi`,-1)]),t[15]||=z(`span`,{class:`topbar-sep`,"aria-hidden":`true`},null,-1),z(`div`,Jd,[z(`span`,{class:E([`dot`,{off:!c.value}]),"aria-hidden":`true`},null,2),z(`span`,{class:`network-summary`,title:`${c.value} of ${A(Vu).devices.value.length} devices online`},[B(A(Bc),{size:16}),V(D(c.value)+` of `+D(A(Vu).devices.value.length)+` online`,1)],8,Yd),t[10]||=z(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),z(`span`,null,[z(`b`,null,D(l.value),1),t[8]||=V(` sessions`,-1)]),t[11]||=z(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),z(`span`,null,[z(`b`,null,D(u.value),1),t[9]||=V(` agents`,-1)])]),z(`div`,Xd,[z(`span`,{class:E([`chip connection`,{accent:A(Bu)===`live`}])},[z(`span`,{class:E([`dot`,{off:A(Bu)!==`live`}]),"aria-hidden":`true`},null,2),V(D(A(Bu)===`live`?`Connected`:`Reconnecting`),1)],2),o.value?(I(),L(`span`,Zd,D(o.value.toLocaleString())+` tok · $`+D(s.value.toFixed(3)),1)):H(``,!0),z(`button`,{class:`icon-button`,"aria-label":`Notifications${r.value?` (${r.value} unread)`:``}`,title:`Notification center${r.value?` — ${r.value} unread`:``}`,onClick:i},[B(A(Xs),{size:18}),r.value?(I(),L(`i`,$d,D(r.value>9?`9+`:r.value),1)):H(``,!0)],8,Qd),(I(),R(lr,{to:`body`},[n.value?(I(),L(`div`,{key:0,class:`notif-panel`,onClick:t[2]||=ks(()=>{},[`stop`])},[z(`header`,null,[t[12]||=z(`b`,null,`Notifications`,-1),z(`button`,{class:`icon-button`,"aria-label":`Close notifications`,onClick:t[1]||=e=>n.value=!1},`✕`)]),A(Td).length?H(``,!0):(I(),L(`p`,ef,`Nothing yet — events land here as they happen.`)),z(`ul`,null,[(I(!0),L(F,null,P(A(Td),e=>(I(),L(`li`,{key:e.id,class:E({unread:!e.read})},[z(`span`,tf,D(a(e.at)),1),z(`span`,null,D(e.text),1)],2))),128))])])):H(``,!0)])),z(`button`,{class:`icon-button`,title:`How this works`,"aria-label":`How this works`,onClick:t[3]||=e=>A(J).dialog={kind:`help`}},[B(A(ac),{size:19})]),z(`button`,{class:`secondary small new-agent-button`,disabled:!A(q)||!A(Xu)||d.value,title:`Start a fresh agent in this session`,onClick:f},[B(A(Xc),{size:18}),t[13]||=V(`New agent `,-1)],8,nf),z(`button`,{class:`primary small`,onClick:t[4]||=e=>p(`newSession`)},[B(A(Xc),{size:18}),t[14]||=V(`New session `,-1)]),z(`button`,{class:`icon-button inspector-toggle`,"aria-label":`Toggle inspector`,title:`Inspector`,disabled:!A(q)||!A(Xu),onClick:t[5]||=e=>A(J).inspectorOverlay?A(Bd)():A(zd)()},[B(A(Kc),{size:19})],8,rf)])]))}}),of=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},sf=of(af,[[`__scopeId`,`data-v-c21f1a6d`]]),cf={class:`mnav`,"aria-label":`Panels`},lf={key:0,class:`badge`},uf=N({__name:`MobileNav`,setup(e){function t(){J.drawer=!1,J.inspectorOverlay=!1}return(e,n)=>(I(),L(`nav`,cf,[z(`button`,{type:`button`,class:E({"is-on":!A(J).drawer&&!A(Rd)}),onClick:t},[B(A(Lc),{size:18}),n[2]||=V(`Chat `,-1)],2),z(`button`,{type:`button`,class:E({"is-on":A(Rd)}),onClick:n[0]||=e=>A(Rd)?A(Bd)():A(zd)()},[B(A(Kc),{size:18}),n[3]||=V(`Details`,-1),A(hd).length?(I(),L(`span`,lf,D(A(hd).length),1)):H(``,!0)],2),z(`button`,{type:`button`,class:E({"is-on":A(J).drawer}),onClick:n[1]||=e=>A(Vd)()},[B(A(gl),{size:18}),n[4]||=V(`Network `,-1)],2)]))}}),df=[`width`,`height`,`aria-label`],ff=[`width`,`height`,`aria-label`],pf=N({__name:`DeviceIcon`,props:{device:{},size:{default:16}},setup(e){let t=e,n=U(()=>{let e=t.device;return e?.kind===`exe-dev`||e?.url?.includes(`.exe.xyz`)?`exe`:e?.info?.platform.startsWith(`darwin`)?`apple`:e?.kind===`local`?`laptop`:`server`}),r=U(()=>{let e={exe:`exe.dev VM`,apple:`macOS`,laptop:`This computer`,server:`Server`}[n.value];return t.device?.transport===`tunnel`?`${e} (tunnel)`:e});return(t,i)=>n.value===`exe`?(I(),L(`svg`,{key:0,class:`device-icon exe`,viewBox:`0 0 512 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[z(`title`,null,D(r.value),1),i[0]||=z(`path`,{fill:`currentColor`,"fill-rule":`evenodd`,d:`M8 332.2l.9 1.4 1.5 .5 38.5-4.1 3.1 .4 2.7 2.2 8.8 13.2 10.1 12.8 1.1 2.6-.3 3.2-16.4 35.6 0 1.7 1 1.2 2.2 0 33.8-18.2 3.1-.8 3.4 1 12.4 8.7 15.3 9.4 1.5 2.1 .5 2.5-3.1 38.9 .4 1.5 1.3 .9 2.3-.7 25.9-29.2 2.1-1.3 2.8-.4 16.3 4.4 15.7 3.2 3 1.8 1.6 2.8 9.8 37.1 1.5 1.6 1.7-.1 1.1-1.1 14.5-35.6 1.8-2.5 3.4-1.5 15.7-1.1 16.1-2.4 3.2 .5 2.3 1.8 22.4 32 2.2 .9 1.4-.7 .6-1.5 1.4-39 1-2.7 2.4-2.2 14.7-6.8 13.8-7.8 3.4-.7 3 1 32.4 21 2.3 0 1.1-1.1 0-1.6-13.4-36.6-.3-2.5 .7-2.4 12.2-13.9 8.8-12.1 2.8-2 3.1-.3 38.4 5.4 2.1-.9 .5-1.5-.6-1.4-27.5-27.4-1.6-2.7-.2-3.1 4.6-15.8 2.9-15.8 1.3-2.6 2.5-1.9 37.3-12.2 1.6-1.9-.3-1.5-1.1-1-36.8-12.5-2.4-1.4-1.8-3.3-3.1-17.7 0-2.2 .9-2.4 3.1-2.9 10.6-15.3 3.3-1.8 3.4 .3 3.8 3 4.5 6.8 8.9 11.2 12.5 12.5 6.2 4.8 7.3 4.3 6.3 2.4 3.8 .3 4-.3 5.1-2.4 6.5-7 4.8-10.6 3.3-11.9 2-14.1 1.3-3.4 0-66.6-.8-2.6-2-13.6-3.8-14.6-7.5-18.7-4.7-9.4-4-6-7.2-7.1-5-2.1-6.5 0-2.2 .7-6 3.5-12 12-13.1 17.8-11.7 18.2-3.7 1.6-11.8-.1-3.1-1.6-1.8-2.9-.3-8.8-2.8-12.7-1.5-4-7.1-13.3-5.9-7.8-10.7-9.3-8.6-4.7-5.9-2-4.1-.5-6.7-.5-4.1 .5-7 2-7.3 3.8-7.5 7-2.2 3.2-2.5 5.5-2.8 10.5-.5 3.6 .1 17.1-.3 2.2-1.1 1.9-1.7 1.5-3.7 1.5-2.6 .3-27.5-10.5-14.5-4-15.7-3.2-2.6-1.3-1.9-3-9.9-37.5-.9-1.2-1.4-.4-1.3 .4-.8 1-14.7 36.1-1.8 2.1-2.2 1.2-17.8 1.4-15 2.2-3.4-.7-2.4-2.1-22-31.5-2-.9-1.5 .5-.7 1.5-1.4 38.6-.9 3-2.5 2.5-14.7 6.8-13.8 7.8-2.8 .7-3.1-.7-32.9-21.3-2.3 0-1.1 1.1-.1 1.6 13.6 36.9 0 3.1-1.2 2.6-10.8 12-9.5 12.9-2.8 2-3.2 .3-38.4-5.4-1.5 .4-.9 1.4 .6 2.1 27.6 27.6 1.2 1.8 .5 2.2-3 10.6-1.5 2.4-2.4 1.6-5.8 1-4.4 1.8-3.8 3-3 3.8-1.7 4-.7 4.7 .4 4.7 1.5 4.2 .3 .5 30.7 0 1.7 .6 1.4 1.1 1.1 3-1.1 2.9-2.7 1.6-31.1 .1-.6 1.1-1.2 3.6-.4 4.1 .4 4.2 1.2 3.5 2.5 4 3.2 3.1 4.1 2.3 5.6 1.8 2.4 2.1 .9 2.1 5.1 21.2-.6 2.1-1.2 1.9-28.5 26.5zM283.6 189.4l6.6 .5 5.6 1.2 6.2 2.2 5.9 3.1 4.6 3.4 4.8 4.5 3.5 4.4 3.4 5.8 2.6 6.2 1.6 6.4 .6 5.6-.2 6.7-1.1 6.5-1.7 5.4-2.9 6-3.6 5.5-7.1 7.3-8.4 5.4-9.4 3.5-9.9 1.3-11-1-40.4-10.4-2.8-1.1-3.1-2.4-1.7-.6-.9-1.1-.1-2.2-1.4-2.2 1.6-6.3 18.1-38.5 4.7-7.5 7.1-7.3 8.4-5.4 9.4-3.5zM173.9 198l-1.1 5.9-2.3 5.5-3.4 5-4.2 4.3-5 3.3-5.5 2.3-5.9 1.2-6 0-5.9-1.2-5.6-2.3-5-3.3-4.2-4.3-3.3-5-2.3-5.5-1.2-5.9 0-6 1.2-5.9 2.3-5.5 3.3-5 4.2-4.3 5-3.3 5.6-2.3 5.9-1.2 6 0 5.9 1.2 5.5 2.3 5 3.3 4.2 4.3 3.4 5 2.3 5.5 1.1 5.9zM315.1 213.5l-63.1 37.7 69.5-12.9 0-6.2-1-6.5-2.1-6.1zM237.3 260l-2.6 1.5 40.6 10.5 7.4 .9 7.4-.5 5.4-1.4 5.2-2.1 8.5-5.8 3.8-4.1 3.2-4.5 2.6-5 1.6-4.9zM284.5 196.9l-7.4 .5-8.1 2.3-7.3 4.1-6.3 5.5-5.8 8.5-17.4 37.1 3-.6 76.1-45.5-5.8-5-6.5-3.7-7.1-2.3zM141.1 183.6l-1.1-2.9-2-2.3-2.8-1.3-3.1-.1-2.9 1-2.3 2.1-1.3 2.8-.1 3 1 2.9 2.1 2.3 2.7 1.3 3.1 .2 2.9-1.1 2.3-2 1.3-2.8z`},null,-1)],8,df)):n.value===`apple`?(I(),L(`svg`,{key:1,class:`device-icon apple`,viewBox:`0 0 384 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[z(`title`,null,D(r.value),1),i[1]||=z(`path`,{fill:`currentColor`,d:`M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z`},null,-1)],8,ff)):n.value===`laptop`?(I(),R(A(Ac),{key:2,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`])):(I(),R(A(il),{key:3,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`]))}}),mf=new Map,hf=new Map,gf=2e3;function _f(){for(;mf.size>gf;){let e=mf.keys().next().value;if(e===void 0)break;mf.delete(e)}}function vf(e,t){return wu(Vu.devices.value.find(t=>t.id===e)?.info,t)}function yf(e,t){if(!vf(e,t))return{ok:!1,reason:`outside the device's start dirs`};let n=Ef(e,t);return n.status&&n.status.repo===!1&&Date.now()-n.at<5e3?{ok:!1,reason:`not a git repository`}:{ok:!0}}function bf(e,t){t&&typeof t.error==`string`?(e.status=null,e.error=t.error):(e.status=t??null,e.error=``),e.at=Date.now()}async function xf(e,t){let n=t.filter(t=>!Df(Ef(e,t),Sf)&&vf(e,t));if(n.length){for(let t=0;t<n.length&&t<500;t+=50){let r=n.slice(t,t+50);try{let t=await G(e).gitStatusBatch(r,{timeoutMs:6e4});for(let n of r){let r=t[n];r!==void 0&&bf(Ef(e,n),r)}}catch{}}_f()}}var Sf=6e4,Cf=!1;function wf(){Cf||(Cf=!0,M(()=>Vu.devices.value,e=>{let t=Date.now();for(let n of e){let e=(n.tree?.git??[]).filter(e=>t-e.at<6e4);if(e.length)for(let r of[...mf.keys()]){let i=r.indexOf(`::`),a=r.slice(0,i),o=r.slice(i+2);if(i<0||!a||a!==n.id||!o)continue;let s=mf.get(r);e.some(e=>o===e.root||o.startsWith(e.root+`/`)||o.startsWith(e.root+`\\`))&&(s.loading||t-s.at<4e3||Of(a,o,{force:!0}))}}}))}var Tf=(e,t)=>`${e}::${t}`;function Ef(e,t){let n=Tf(e,t),r=mf.get(n);return r||(r=Gt({at:0,status:null,error:``,loading:!1,refreshing:!1}),mf.set(n,r)),r}var Df=(e,t)=>e.at>0&&Date.now()-e.at<t&&(e.status!==null||e.error);async function Of(e,t,n={}){let{staleMs:r=6e4,force:i=!1,timeoutMs:a=6e4}=n;if(!e||!t)return;let o=Tf(e,t),s=Ef(e,t);if(!i&&Df(s,r))return;if(!vf(e,t)){bf(s,{error:`outside the device's start dirs`});return}_f();let c=hf.get(o);if(c)return c;s.status===null&&!s.error?s.loading=!0:s.refreshing=!0,s.error=``;let l=(async()=>{try{s.status=await G(e).gitStatus(t,{timeoutMs:a}),s.at=Date.now()}catch(e){let t=e.message??``;s.error=/fetch failed|Cannot reach|Failed to fetch|NetworkError|abort/i.test(t)?`device unreachable — check that it is online, then retry (${t.slice(0,80)})`:t.slice(0,160),s.at=Date.now()}finally{s.loading=!1,s.refreshing=!1,hf.delete(o)}})();return hf.set(o,l),l}var kf=new Map;function Af(){M(()=>Vu.devices.value.map(e=>`${e.id}:${e.status}:${e.tree?.sessions.length??0}:${e.tree?.sessions.map(e=>e.cwd).join(`|`)}`).join(`;`),()=>{for(let e of Vu.devices.value){if(e.status!==`online`||!e.tree?.sessions.length)continue;let t=Date.now();t-(kf.get(e.id)??0)<6e4||(kf.set(e.id,t),xf(e.id,e.tree.sessions.map(e=>e.cwd)))}},{immediate:!0})}var jf=(e,t)=>Ef(e,t).status?.branch,Mf=[`aria-level`,`aria-expanded`,`aria-selected`,`data-key`,`title`],Nf=[`aria-label`],Pf={key:1,class:`chev`},Ff={class:`name`},If={class:`badge`},Lf=[`title`],Rf=[`aria-label`],zf=[`disabled`,`aria-label`],Bf=[`aria-label`],Vf=[`checked`,`aria-label`],Hf={class:`name`},Uf={class:`path`},Wf=[`title`],Gf=[`title`],Kf={key:3,class:`dot work`,title:`Working`},qf=[`title`],Jf=[`disabled`,`aria-label`],Yf=[`disabled`,`aria-label`],Xf=[`disabled`,`aria-label`],Zf=[`disabled`,`aria-label`],Qf={class:`name`},$f={key:3,class:`meta`},ep={key:4,class:`dot work`,title:`Working`},tp=[`title`],np=[`disabled`,`aria-label`],rp=of(N({__name:`TreeRow`,props:{node:{},depth:{},open:{type:Boolean},selected:{type:Boolean},focused:{type:Boolean},online:{type:Boolean},checkbox:{type:Boolean},checked:{type:Boolean}},emits:[`toggle`,`activate`,`action`,`check`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>n.node.children.length>0),a=U(()=>n.node.type===`device`?n.node.device:void 0),o=U(()=>n.node.type===`session`?n.node.session:void 0),s=U(()=>n.node.type===`agent`?n.node.agent:void 0),c=U(()=>o.value?o.value.agents.reduce((e,t)=>e+t.background,0):s.value?.background??0),l=U(()=>o.value?.busy||s.value?.busy),u=U(()=>{let e=a.value?.info,t=e?.packageVersion??e?.durableVersion,n=Uu.value;return!!(t&&n&&n!==`unknown`&&t!==n)}),d=U(()=>{let e=a.value?.info;return e?.packageVersion??e?.durableVersion??`?`}),f=U(()=>{let e=a.value;if(!e)return``;let t=e.tree?.sessions.length??0;switch(e.status){case`online`:return`${t} session${t===1?``:`s`}`;case`checking`:return`checking…`;case`unauthorized`:return e.hasToken?`token rejected`:`no token`;case`mismatch`:return`identity changed`;case`incompatible`:return`incompatible`;default:return`offline · ${Nd(e.lastSeenAt)}`}}),p=U(()=>{let e=a.value?.status;return e===`online`?`on`:e===`checking`?`chk`:e===`offline`?`off`:`err`}),m=U(()=>{let e=n.node;return e.type===`session`?jf(e.deviceId,e.session.cwd):void 0}),h=U(()=>a.value?.name??a.value?.id??o.value?.name??s.value?.name??``),g=U(()=>{if(a.value){let e=a.value;return`${e.name}${e.url?` · ${e.url}`:``}${e.error?`\n${e.error}`:``}`}if(o.value)return`${o.value.name}\n${o.value.cwd}`;let e=s.value;return e.kind===`fork`?`Fork of agent #${e.parentId} at entry #${e.forkedAt}`:e.kind===`subagent`?`Subagent owned by agent #${e.ownerAgentId}`:`Root agent`});return(t,n)=>(I(),L(`div`,{class:E([`tree-row`,[e.node.type,{sel:e.selected,focus:e.focused,stale:e.node.stale}]]),style:T({"--depth":e.depth}),role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":i.value?e.open:void 0,"aria-selected":e.selected,"data-key":e.node.key,title:g.value,onClick:n[14]||=e=>r(`activate`)},[i.value?(I(),L(`button`,{key:0,class:`chev`,tabindex:`-1`,"aria-label":e.open?`Collapse ${h.value}`:`Expand ${h.value}`,onClick:n[0]||=ks(e=>r(`toggle`),[`stop`])},[e.open?(I(),R(A(nc),{key:0,size:16})):(I(),R(A(rc),{key:1,size:16}))],8,Nf)):(I(),L(`span`,Pf)),a.value?(I(),L(F,{key:2},[z(`i`,{class:E([`dot`,p.value])},null,2),B(pf,{device:a.value,size:16},null,8,[`device`]),z(`b`,Ff,D(h.value),1),z(`span`,If,D(a.value.kind),1),u.value?(I(),L(`span`,{key:0,class:`tag update`,title:`device runs ${d.value}; hub runs ${A(Uu)}. Devices self-update: dpi update`},`update`,8,Lf)):H(``,!0),z(`span`,{class:E([`meta`,{err:p.value===`err`}])},D(f.value),3),z(`span`,{class:`acts`,onClick:n[4]||=ks(()=>{},[`stop`])},[a.value.pairing?(I(),L(`button`,{key:0,class:`icon-button`,"aria-label":`Manage credentials for ${h.value}`,title:`Manage device credentials, including while offline`,onClick:n[1]||=e=>r(`action`,`credentials`)},[B(A(kc),{size:16})],8,Rf)):H(``,!0),z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New session on ${h.value}`,title:`New session on this device`,onClick:n[2]||=e=>r(`action`,`new-session`)},[B(A(Xc),{size:16})],8,zf),z(`button`,{class:`icon-button`,"aria-label":`Check ${h.value}`,title:`Check connection now`,onClick:n[3]||=e=>r(`action`,`check`)},[B(A($c),{size:16})],8,Bf)])],64)):o.value?(I(),L(F,{key:3},[e.checkbox?(I(),L(`input`,{key:0,type:`checkbox`,class:`bulk-check`,checked:e.checked,"aria-label":`Select ${h.value}`,tabindex:`-1`,onClick:n[5]||=ks(()=>{},[`stop`]),onChange:n[6]||=e=>r(`check`)},null,40,Vf)):H(``,!0),B(A(yc),{class:`ico`,size:16}),z(`b`,Hf,D(h.value),1),z(`span`,Uf,`…/`+D(o.value.cwd.split(`/`).filter(Boolean).at(-1)),1),m.value?(I(),L(`span`,{key:1,class:`branch`,title:`git branch of ${o.value.cwd}`},`⎇ `+D(m.value),9,Wf)):H(``,!0),o.value.model?(I(),L(`span`,{key:2,class:`tag`,title:o.value.provider?`${o.value.provider} / ${o.value.model}`:o.value.model},D(o.value.model),9,Gf)):H(``,!0),l.value?(I(),L(`i`,Kf)):H(``,!0),c.value?(I(),L(`span`,{key:4,class:`bg-count`,title:`${c.value} background task(s)`},[n[15]||=z(`i`,{class:`dot bg`},null,-1),V(D(c.value)+` bg`,1)],8,qf)):H(``,!0),z(`span`,{class:`acts`,onClick:n[11]||=ks(()=>{},[`stop`])},[z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New agent in ${h.value}`,title:`New agent in this session`,onClick:n[7]||=e=>r(`action`,`new-agent`)},[B(A(Xc),{size:16})],8,Jf),z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename session ${h.value}`,title:`Rename session`,onClick:n[8]||=e=>r(`action`,`rename`)},[B(A(qc),{size:16})],8,Yf),z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New worktree session from ${h.value}`,title:`New worktree session: branch this folder's repo and open a session in the sibling checkout`,onClick:n[9]||=e=>r(`action`,`worktree`)},[B(A(ul),{size:16})],8,Xf),z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Archive session ${h.value}`,title:`Archive session`,onClick:n[10]||=e=>r(`action`,`archive`)},[B(A(Us),{size:16})],8,Zf)])],64)):s.value?(I(),L(F,{key:4},[s.value.kind===`fork`?(I(),R(A(Cc),{key:0,class:`ico`,size:16})):s.value.kind===`subagent`?(I(),R(A(cc),{key:1,class:`ico`,size:16})):(I(),R(A(Lc),{key:2,class:`ico root`,size:16})),z(`span`,Qf,D(h.value),1),s.value.kind===`fork`&&s.value.forkedAt!==void 0?(I(),L(`span`,$f,`@ #`+D(s.value.forkedAt),1)):H(``,!0),l.value?(I(),L(`i`,ep)):H(``,!0),c.value?(I(),L(`span`,{key:5,class:`bg-count`,title:`${c.value} background task(s)`},[n[16]||=z(`i`,{class:`dot bg`},null,-1),V(D(c.value),1)],8,tp)):H(``,!0),z(`span`,{class:`acts`,onClick:n[13]||=ks(()=>{},[`stop`])},[z(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename agent ${h.value}`,title:`Rename agent`,onClick:n[12]||=e=>r(`action`,`rename`)},[B(A(qc),{size:16})],8,np)])],64)):H(``,!0)],14,Mf))}}),[[`__scopeId`,`data-v-ea928445`]]),ip={class:`project-bar`,"aria-label":`Projects`},ap={class:`project-head`},op={class:`project-title`},sp=[`aria-label`,`title`],cp={key:0,class:`project-hint`},lp={key:0,class:`chips`},up=[`title`,`onClick`,`onDblclick`],dp={class:`chip-name`},fp={class:`chip-count`},pp={key:1,class:`project-hint`},mp={key:2,class:`project-actions`},hp=[`onClick`],gp=[`onClick`],_p=[`onClick`],vp=[`onClick`],yp={key:3,class:`message-error`},bp={key:4,class:`project-hint labels-hint`},xp=of(N({__name:`ProjectBar`,props:{active:{},activeModifiers:{}},emits:[`update:active`],setup(e,{expose:t}){let n=Di(e,`active`),r=k([]),i=k(!1),a=k(``),o=k(!1),s=U(()=>Vu.devices.value.filter(e=>e.status===`online`).map(e=>e.id));async function c(){i.value=!0,a.value=``;let e=[],t=[];for(let n of s.value){let r=Vu.devices.value.find(e=>e.id===n),i=await G(n).projects(o.value).catch(e=>{let r=K(e);e.code===`not_found`||/allowlist|not found/i.test(r)||t.push(`${n}: ${r.slice(0,60)}`)});for(let t of i?.projects??[]){let i=(r?.tree?.sessions??[]).filter(e=>e.cwd===t.rootPath||e.cwd.startsWith(`${t.rootPath}/`)).length;e.push({deviceId:n,project:t,sessions:i})}}r.value=e.sort((e,t)=>l(e.project).localeCompare(l(t.project))),t.length&&(a.value=t.join(` · `)),i.value=!1}M([s,o],c,{immediate:!0});let l=e=>e.customName??e.name,u=e=>n.value?.deviceId===e.deviceId&&n.value.rootPath===e.project.rootPath;function d(e){n.value=u(e)?void 0:{deviceId:e.deviceId,rootPath:e.project.rootPath}}function f(e){let t=e.project;J.dialog={kind:`prompt`,title:`Rename ${l(t)}`,label:`Project name`,hint:`Shown in the tree and in usage rollups. Leave empty to use the folder name.`,value:t.customName??``,placeholder:t.name,submit:`Save name`,run:async n=>{let r=await G(e.deviceId).updateProject(t.id,{customName:n});Y(`Project renamed to ${r.customName??r.name}.`),await c()}}}function p(e){let t=e.project;J.dialog={kind:`prompt`,title:`Labels for ${l(t)}`,label:`Labels (comma separated)`,hint:`Lowercase, up to 12 labels of 32 characters. Used to filter projects.`,value:t.labels.join(`, `),submit:`Save labels`,run:async n=>{let r=await G(e.deviceId).updateProject(t.id,{labels:n.split(`,`).map(e=>e.trim()).filter(Boolean)});Y(r.labels.length?`Labels: ${r.labels.join(`, `)}.`:`Labels cleared on ${l(r)}.`),await c()}}}function m(e){let t=e.project,n=Vu.devices.value.find(t=>t.id===e.deviceId)?.info?.models??[];J.dialog={kind:`prompt`,title:`Default model for ${l(t)}`,label:`Model (provider/modelId)`,hint:n.length?`New sessions in this project start on this model instead of the device default. Leave empty to use the device default. E.g. ${n[0].provider}/${n[0].id}`:`New sessions in this project start on this model. Leave empty to use the device default.`,value:t.model?`${t.model.provider}/${t.model.modelId}`:``,placeholder:`device default`,submit:`Save default model`,run:async r=>{if(!r.trim()){await G(e.deviceId).updateProject(t.id,{model:``}),Y(`Default model cleared on ${l(t)}.`),await c();return}let[i,...a]=r.trim().split(`/`),o=a.join(`/`),s=n.some(e=>e.provider===i&&e.id===o);if(!i||!o)throw Error(`Format: provider/modelId`);if(!s)throw Error(`${r.trim()} is not in this device's catalog`);await G(e.deviceId).updateProject(t.id,{model:{provider:i,modelId:o}}),Y(`New sessions in ${l(t)} start on ${o}.`),await c()}}}function h(e){let t=e.project,r=t.archivedAt!==null;J.dialog={kind:`prompt`,title:`${r?`Restore`:`Archive`} ${l(t)}?`,hint:r?`The project returns to the tree. Its sessions were never touched.`:`Bookkeeping only: the project leaves the list, its sessions keep running. Nothing is deleted.`,submit:r?`Restore project`:`Archive project`,danger:!r,run:async()=>{let i=G(e.deviceId);r?await i.unarchiveProject(t.id):await g(i,t.id),!r&&u(e)&&(n.value=void 0),await c()}}}let g=(e,t)=>e.archiveProject(t);return t({reload:c}),(e,t)=>(I(),L(`div`,ip,[z(`div`,ap,[z(`span`,op,[B(A(vc),{size:13}),t[2]||=V(`PROJECTS`,-1)]),z(`button`,{class:E([`icon-button tiny`,{on:o.value}]),"aria-label":o.value?`Hide archived projects`:`Show archived projects`,title:o.value?`Hide archived projects`:`Show archived projects`,onClick:t[0]||=e=>o.value=!o.value},[B(A(Us),{size:12})],10,sp),i.value?(I(),L(`span`,cp,`…`)):H(``,!0)]),r.value.length?(I(),L(`div`,lp,[(I(!0),L(F,null,P(r.value,e=>(I(),L(`button`,{key:`${e.deviceId}-${e.project.id}`,class:E([`chip`,{on:u(e),archived:e.project.archivedAt}]),title:`${e.project.rootPath} — ${e.sessions} session${e.sessions===1?``:`s`}`,onClick:t=>d(e),onDblclick:t=>f(e)},[e.project.kind===`plain`?(I(),R(A(bc),{key:0,size:11})):(I(),R(A(vc),{key:1,size:11})),z(`span`,dp,D(l(e.project)),1),z(`em`,fp,D(e.sessions),1),(I(!0),L(F,null,P(e.project.labels.slice(0,2),e=>(I(),L(`span`,{key:e,class:`chip-label`},D(e),1))),128))],42,up))),128))])):i.value?H(``,!0):(I(),L(`p`,pp,` No projects yet — a project appears when a session starts in a folder. `)),n.value?(I(),L(`div`,mp,[t[5]||=z(`span`,{class:`project-hint`},`filtering`,-1),(I(!0),L(F,null,P(r.value.filter(u),e=>(I(),L(F,{key:e.project.id},[z(`button`,{class:`small`,onClick:t=>f(e)},[B(A(qc),{size:12}),t[3]||=V(`name`,-1)],8,hp),z(`button`,{class:`small`,onClick:t=>p(e)},[B(A(fl),{size:12}),t[4]||=V(`labels`,-1)],8,gp),z(`button`,{class:`small`,onClick:t=>m(e),title:`Default model for new sessions in this project`},[B(A(dc),{size:12}),V(D(e.project.model?`model ✓`:`model`),1)],8,_p),z(`button`,{class:`small`,onClick:t=>h(e)},[e.project.archivedAt?(I(),R(A(Hs),{key:0,size:12})):(I(),R(A(Us),{key:1,size:12})),V(` `+D(e.project.archivedAt?`restore`:`archive`),1)],8,vp),z(`button`,{class:`icon-button tiny`,"aria-label":`Clear project filter`,onClick:t[1]||=e=>n.value=void 0},[B(A(xl),{size:12})])],64))),128))])):H(``,!0),a.value?(I(),L(`p`,yp,D(a.value),1)):H(``,!0),r.value.some(e=>e.project.labels.length)?(I(),L(`p`,bp,[B(A(fl),{size:11}),V(`labels: `+D([...new Set(r.value.flatMap(e=>e.project.labels))].join(` · `)),1)])):H(``,!0)]))}}),[[`__scopeId`,`data-v-4dd05d24`]]);function Sp(e,t){return`${e.slice(0,e.lastIndexOf(`/`))}/${e.slice(e.lastIndexOf(`/`)+1)}-${t.replace(/[/\\]+/g,`-`)}`}async function Cp(e,t,n,r){let i=Sp(n,r);return{target:i,text:(await e.gitOp(t,`worktree-add`,{branch:r,target:i})).text.split(`
|
|
16
|
-
`)[0]??`worktree ${i}`}}async function wp(e,t,n,r){return e.createSession(r?{name:n,cwd:t,model:r}:{name:n,cwd:t})}async function Tp({deviceApi:e,cwd:t,sessionName:n,branch:r,root:i,source:a,catalog:o,defaultModel:s}){let c=i;if(!c){let n=await e.gitStatus(t);if(!n.repo||!n.root)throw Error(`${t} is not a git repository`);c=n.root}let{target:l}=await Cp(e,t,c,r),{model:u,provider:d}=a??{},f=u&&d&&(!o||o.some(e=>e.provider===d&&e.id===u))?{provider:d,modelId:u}:void 0,p=o?.length?o.find(e=>`${e.provider}/${e.id}`===s)??o[0]:void 0;return wp(e,l,n,f??(p?{provider:p.provider,modelId:p.id}:void 0))}var Ep={class:`tree-head`},Dp=[`aria-label`,`title`],Op=[`title`],kp={class:`tree-search`},Ap={key:1,class:`searching`,"aria-label":`Searching devices`},jp={key:0,class:`bulk-bar`},Mp=[`disabled`],Np=[`disabled`],Pp={class:`hit-head hint`},Fp=[`title`,`onClick`],Ip={class:`hit-name`},Lp={class:`hit-cwd`},Rp={key:0,class:`hit-where`},zp=[`title`],Bp={key:2,class:`hint tree-empty`},Vp={key:3,class:`hint tree-empty`,"data-testid":`tree-empty`},Hp={key:1,class:`panel-rail`,"aria-label":`Network (collapsed)`},Up=[`title`],Wp=[`title`,`aria-label`,`onClick`],Gp=of(N({__name:`NetworkSidebar`,setup(e){let t=U(()=>{let e=[],t=(n,r,i)=>{for(let a of n)e.push({node:a,depth:r,parent:i}),a.children.length&&Wu.value.has(a.key)&&t(a.children,r+1,a.key)};return t(Vu.tree.value,0),e}),n=k(),r=k(),i=k(``),a=k([]),o=k(!1),s=U(()=>i.value.trim().toLowerCase()),c=U(()=>s.value.length>=2),l=U(()=>{let e=new Set;if(!c.value)return e;for(let t of Vu.devices.value)for(let n of t.tree?.sessions??[])`${n.name}\n${n.cwd}`.toLowerCase().includes(s.value)&&e.add(n.id);return e}),u=k(),d=(e,t)=>!u.value||u.value.deviceId===e&&(t===u.value.rootPath||t.startsWith(`${u.value.rootPath}/`)),f=U(()=>{if(!c.value&&!u.value)return t.value;let e=e=>{if(u.value){let t=e.type===`device`?e.device.id:e.deviceId;if(e.type===`session`&&!d(t,e.session.cwd))return!1;if(e.type===`agent`){let t=Vu.devices.value.find(t=>t.id===e.deviceId)?.tree?.sessions.find(t=>t.id===e.sessionId);if(t&&!d(e.deviceId,t.cwd))return!1}if(e.type===`device`)return(e.device.tree?.sessions??[]).some(t=>d(e.device.id,t.cwd))}return c.value?e.type===`session`?l.value.has(e.session.id):e.type===`agent`?l.value.has(e.sessionId)||e.agent.name.toLowerCase().includes(s.value):(e.device.tree?.sessions??[]).some(e=>l.value.has(e.id)):!0},n=new Set(t.value.filter(t=>e(t.node)).map(e=>e.node.key));return t.value.filter(e=>n.has(e.node.key))}),p=U(()=>a.value.filter(e=>!t.value.some(t=>t.node.type===`session`&&t.node.session.id===e.id))),m,h=0;M(i,e=>{clearTimeout(m);let t=e.trim();if(t.length<2){++h,a.value=[],o.value=!1;return}m=setTimeout(async()=>{o.value=!0;let e=++h,n=[];for(let r of Vu.devices.value.filter(e=>e.status===`online`)){let i=await G(r.id).searchSessions(t,`all`).catch(()=>void 0);if(e!==h)return;for(let e of i?.matches??[])n.push({deviceId:r.id,id:e.id,name:e.name,cwd:e.cwd,where:e.where,hits:e.hits??[]})}a.value=n,o.value=!1},250)});let g=()=>(i.value=``,++h,a.value=[]),_=k(!1),v=k(new Set),y=k(``),b=e=>{if(e.type!==`session`)return;let t=new Set(v.value);t.has(e.session.id)?t.delete(e.session.id):t.add(e.session.id),v.value=t},x=async e=>{y.value=e;let n=0,r=[];for(let i of t.value.map(e=>e.node)){if(i.type!==`session`||!v.value.has(i.session.id))continue;let t=S(i);if(!t)continue;let a=G(t.id);try{e===`archive`?await a.session(i.session.id).archive():await a.agent(i.session.id,1).abort(!0),n++,e===`archive`&&q.value?.sessionId===i.session.id&&id(void 0)}catch{r.push(i.session.name)}}Y(`${e}: ${n} done${r.length?`, ${r.length} failed (${r.slice(0,3).join(`, `)})`:``}`),v.value=new Set,y.value=``},S=e=>Vu.devices.value.find(t=>t.id===(e.type===`device`?e.device.id:e.deviceId)),C=e=>S(e)?.status===`online`,ee=e=>e.type===`agent`&&q.value?.deviceId===e.deviceId&&q.value.sessionId===e.sessionId&&q.value.agentId===e.agent.id;function te(e){if(n.value=e.key,_.value&&e.type===`session`)return b(e);if(e.type===`device`)return sd(e.key);if(e.type===`agent`)return id({deviceId:e.deviceId,sessionId:e.sessionId,agentId:e.agent.id});let t=e.session.agents.find(e=>e.kind===`root`)??e.session.agents[0];sd(e.key,!0),t&&id({deviceId:e.deviceId,sessionId:e.session.id,agentId:t.id})}async function ne(e,t){let n=S(e);if(!n)return;let r=G(n.id);if(e.type===`device`){t===`new-session`?J.dialog={kind:`new-session`,deviceId:n.id}:t===`check`?await Od(()=>ku.check(n.id)):t===`credentials`&&(J.dialog={kind:`credentials`,deviceId:n.id});return}if(e.type===`session`){let i=e.session;if(t===`new-agent`){let e=await Od(()=>r.session(i.id).createAgent({name:`Agent ${i.agents.length+1}`}));e&&(id({deviceId:n.id,sessionId:i.id,agentId:e.id}),Y(`New agent. Same session, same shared App State.`))}else t===`rename`?J.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:i.name,submit:`Save name`,run:e=>r.session(i.id).rename(e)}:t===`worktree`?J.dialog={kind:`prompt`,title:`New worktree session`,label:`Branch name`,value:i.name.replace(/[/\\]+/g,`-`),hint:`Adds a sibling checkout of ${i.cwd} on the branch (git worktree add) and opens a session in it.`,submit:`Create worktree session`,run:async e=>{let t=await Tp({deviceApi:r,cwd:i.cwd,sessionName:e,branch:e,source:i,catalog:n.info?.models,defaultModel:n.info?.defaultModel}),a=t.agents.find(e=>e.kind===`root`)??t.agents[0];id({deviceId:n.id,sessionId:t.id,agentId:a?.id??1}),Y(`session "${t.name}" on ${t.cwd}`)}}:t===`archive`&&(J.dialog={kind:`prompt`,title:`Archive ${i.name}?`,hint:`Stops all of its work and moves its files to archive/ on ${n.id}. Nothing is deleted.`,submit:`Archive session`,danger:!0,run:async()=>{await r.session(i.id).archive(),q.value?.sessionId===i.id&&id(void 0)}});return}let i=e.agent;t===`rename`&&(J.dialog={kind:`prompt`,title:`Rename agent`,label:`Agent name`,value:i.named?i.name:``,placeholder:i.name,submit:`Save name`,run:t=>r.agent(e.sessionId,i.id).rename(t)})}function re(e){let i=t.value.findIndex(e=>e.node.key===n.value),a=t.value[Math.max(0,Math.min(t.value.length-1,(i<0?0:i)+e))];a&&(n.value=a.node.key,An(()=>r.value?.querySelector(`[data-key="${CSS.escape(a.node.key)}"]`)?.scrollIntoView({block:`nearest`})))}function w(){n.value??=t.value[0]?.node.key}function ie(e){let r=t.value.find(e=>e.node.key===n.value);if(e.key===`ArrowDown`)re(1);else if(e.key===`ArrowUp`)re(-1);else if(e.key===`ArrowRight`&&r){if(!r.node.children.length)return;Wu.value.has(r.node.key)?re(1):sd(r.node.key,!0)}else if(e.key===`ArrowLeft`&&r)r.node.children.length&&Wu.value.has(r.node.key)?sd(r.node.key,!1):r.parent&&(n.value=r.parent);else if((e.key===`Enter`||e.key===` `)&&r)te(r.node);else return;e.preventDefault()}return(e,a)=>(I(),L(`aside`,{class:E([`network-sidebar`,{open:A(J).drawer,collapsed:!A(Ku).tree&&!A(J).drawer}]),"aria-label":`Network`},[A(Ku).tree||A(J).drawer?(I(),L(F,{key:0},[z(`header`,Ep,[z(`span`,null,[B(A(Bc),{size:16}),a[8]||=V(`NETWORK`,-1)]),z(`button`,{class:E([`icon-button`,{on:_.value}]),"aria-label":_.value?`Exit bulk select`:`Bulk manage sessions`,title:_.value?`Exit bulk select`:`Bulk manage sessions (select → archive / abort)`,onClick:a[0]||=e=>(_.value=!_.value,v.value=new Set)},[B(A(Pc),{size:15})],10,Dp),z(`button`,{class:`icon-button`,"aria-label":`Pair a device`,title:`Pair a device`,onClick:a[1]||=e=>A(J).dialog={kind:`pair`}},[B(A(Nc),{size:15})]),z(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse network`,title:`Collapse network (${A(Wd).tree})`,onClick:a[2]||=e=>(A(Ku).tree=!1,A(J).drawer=!1)},[B(A(Uc),{size:18})],8,Op)]),z(`div`,kp,[B(A(nl),{size:14,class:`search-icon`}),j(z(`input`,{"onUpdate:modelValue":a[3]||=e=>i.value=e,type:`search`,class:`search-input`,placeholder:`Search sessions…`,"aria-label":`Search sessions`,spellcheck:`false`},null,512),[[ys,i.value]]),i.value?(I(),L(`button`,{key:0,class:`icon-button clear`,"aria-label":`Clear search`,onClick:g},[B(A(xl),{size:13})])):H(``,!0),o.value?(I(),L(`span`,Ap,`…`)):H(``,!0)]),B(xp,{active:u.value,"onUpdate:active":a[4]||=e=>u.value=e},null,8,[`active`]),z(`div`,{ref_key:`list`,ref:r,class:`tree-list`,role:`tree`,tabindex:`0`,"aria-label":`Devices, sessions and agents`,onKeydown:ie,onFocus:w},[_.value&&v.value.size?(I(),L(`div`,jp,[z(`span`,null,D(v.value.size)+` selected`,1),z(`button`,{class:`small`,disabled:!!y.value,onClick:a[5]||=e=>x(`abort`)},`abort work`,8,Mp),z(`button`,{class:`small danger`,disabled:!!y.value,onClick:a[6]||=e=>x(`archive`)},D(y.value===`archive`?`archiving…`:`archive`),9,Np)])):H(``,!0),(I(!0),L(F,null,P(f.value,e=>(I(),R(rp,{key:e.node.key,node:e.node,depth:e.depth,open:A(Wu).has(e.node.key),selected:ee(e.node),focused:n.value===e.node.key,online:C(e.node),checkbox:_.value&&e.node.type===`session`,checked:e.node.type===`session`&&v.value.has(e.node.session.id),onToggle:t=>A(sd)(e.node.key),onActivate:t=>te(e.node),onAction:t=>ne(e.node,t),onCheck:t=>b(e.node)},null,8,[`node`,`depth`,`open`,`selected`,`focused`,`online`,`checkbox`,`checked`,`onToggle`,`onActivate`,`onAction`,`onCheck`]))),128)),c.value&&p.value.length?(I(),L(F,{key:1},[z(`div`,Pp,D(p.value.length)+` more on device`,1),(I(!0),L(F,null,P(p.value,e=>(I(),L(`button`,{key:`${e.deviceId}-${e.id}`,class:`hit`,title:e.cwd,onClick:t=>A(id)({deviceId:e.deviceId,sessionId:e.id,agentId:1})},[z(`span`,Ip,D(e.name),1),z(`code`,Lp,D(e.cwd),1),e.where.length?(I(),L(`em`,Rp,D(e.where.join(` · `)),1)):H(``,!0),e.hits.length?(I(),L(`em`,{key:1,class:`hit-line`,title:e.hits.map(e=>`${e.agent} #${e.entry}: ${e.text}`).join(`
|
|
17
|
-
`)},D(e.hits[0].agent)+` #`+D(e.hits[0].entry)+` · `+D(e.hits[0].text.slice(0,90)),9,zp)):H(``,!0)],8,Fp))),128))],64)):H(``,!0),c.value&&!f.value.length&&!p.value.length?(I(),L(`p`,Bp,` No session matches “`+D(i.value.trim())+`”. `,1)):H(``,!0),!t.value.length&&!c.value?(I(),L(`p`,Vp,[...a[9]||=[V(` No devices yet. Declare them in `,-1),z(`code`,null,`dpi-network.yaml`,-1),V(` (start from `,-1),z(`code`,null,`dpi-network.example.yaml`,-1),V(`), then run `,-1),z(`code`,null,`just net up <id>`,-1),V(`. `,-1)]])):H(``,!0)],544)],64)):(I(),L(`div`,Hp,[z(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand network`,title:`Expand network (${A(Wd).tree})`,onClick:a[7]||=e=>A(Ku).tree=!0},[B(A(Wc),{size:18})],8,Up),(I(!0),L(F,null,P(A(Vu).devices.value,e=>(I(),L(`button`,{key:e.id,class:`rail-device`,title:`${e.id} · ${e.status}`,"aria-label":`Show ${e.id}`,onClick:t=>(A(Ku).tree=!0,A(sd)(e.id,!0))},[B(pf,{device:e,size:20},null,8,[`device`]),z(`i`,{class:E([`dot`,e.status===`online`?`on`:e.status===`checking`?`chk`:e.status===`offline`?`off`:`err`])},null,2)],8,Wp))),128))]))],2))}}),[[`__scopeId`,`data-v-c4aae24d`]]);function Kp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var qp=Kp();function Jp(e){qp=e}var Yp={exec:()=>null};function Xp(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Qp.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Zp=(()=>{try{return!0}catch{return!1}})(),Qp={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},$p=/^(?:[ \t]*(?:\n|$))+/,em=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,nm=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,im=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,am=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,om=Xp(am).replace(/bull/g,im).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),sm=Xp(am).replace(/bull/g,im).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),cm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lm=/^[^\n]+/,um=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,dm=Xp(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,um).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),fm=Xp(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,im).getRegex(),pm=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,mm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,hm=Xp(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,mm).replace(`tag`,pm).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gm=Xp(cm).replace(`hr`,nm).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,pm).getRegex(),_m={blockquote:Xp(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,gm).getRegex(),code:em,def:dm,fences:tm,heading:rm,hr:nm,html:hm,lheading:om,list:fm,newline:$p,paragraph:gm,table:Yp,text:lm},vm=Xp(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,nm).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,pm).getRegex(),ym={..._m,lheading:sm,table:vm,paragraph:Xp(cm).replace(`hr`,nm).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,vm).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,pm).getRegex()},bm={..._m,html:Xp(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,mm).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Yp,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xp(cm).replace(`hr`,nm).replace(`heading`,` *#{1,6} *[^
|
|
18
|
-
]`).replace(`lheading`,om).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},xm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Sm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Cm=/^( {2,}|\\)\n(?!\s*$)/,wm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tm=/[\p{P}\p{S}]/u,Em=/[\s\p{P}\p{S}]/u,Dm=/[^\s\p{P}\p{S}]/u,Om=Xp(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Em).getRegex(),km=/(?!~)[\p{P}\p{S}]/u,Am=/(?!~)[\s\p{P}\p{S}]/u,jm=/(?:[^\s\p{P}\p{S}]|~)/u,Mm=Xp(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Zp?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Nm=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pm=Xp(Nm,`u`).replace(/punct/g,Tm).getRegex(),Fm=Xp(Nm,`u`).replace(/punct/g,km).getRegex(),Im=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Lm=Xp(Im,`gu`).replace(/notPunctSpace/g,Dm).replace(/punctSpace/g,Em).replace(/punct/g,Tm).getRegex(),Rm=Xp(Im,`gu`).replace(/notPunctSpace/g,jm).replace(/punctSpace/g,Am).replace(/punct/g,km).getRegex(),zm=Xp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Dm).replace(/punctSpace/g,Em).replace(/punct/g,Tm).getRegex(),Bm=Xp(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Tm).getRegex(),Vm=Xp(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Dm).replace(/punctSpace/g,Em).replace(/punct/g,Tm).getRegex(),Hm=Xp(/\\(punct)/,`gu`).replace(/punct/g,Tm).getRegex(),Um=Xp(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Wm=Xp(mm).replace(`(?:-->|$)`,`-->`).getRegex(),Gm=Xp(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Wm).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Km=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,qm=Xp(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Km).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jm=Xp(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Km).replace(`ref`,um).getRegex(),Ym=Xp(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,um).getRegex(),Xm=Xp(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Jm).replace(`nolink`,Ym).getRegex(),Zm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Qm={_backpedal:Yp,anyPunctuation:Hm,autolink:Um,blockSkip:Mm,br:Cm,code:Sm,del:Yp,delLDelim:Yp,delRDelim:Yp,emStrongLDelim:Pm,emStrongRDelimAst:Lm,emStrongRDelimUnd:zm,escape:xm,link:qm,nolink:Ym,punctuation:Om,reflink:Jm,reflinkSearch:Xm,tag:Gm,text:wm,url:Yp},$m={...Qm,link:Xp(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Km).getRegex(),reflink:Xp(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Km).getRegex()},eh={...Qm,emStrongRDelimAst:Rm,emStrongLDelim:Fm,delLDelim:Bm,delRDelim:Vm,url:Xp(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Zm).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Xp(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Zm).getRegex()},th={...eh,br:Xp(Cm).replace(`{2,}`,`*`).getRegex(),text:Xp(eh.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},nh={normal:_m,gfm:ym,pedantic:bm},rh={normal:Qm,gfm:eh,breaks:th,pedantic:$m},ih={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},ah=e=>ih[e];function oh(e,t){if(t){if(Qp.escapeTest.test(e))return e.replace(Qp.escapeReplace,ah)}else if(Qp.escapeTestNoEncode.test(e))return e.replace(Qp.escapeReplaceNoEncode,ah);return e}function sh(e){try{e=encodeURI(e).replace(Qp.percentDecode,`%`)}catch{return null}return e}function ch(e,t){let n=e.replace(Qp.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Qp.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Qp.slashPipe,`|`);return n}function lh(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function uh(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function dh(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function fh(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function ph(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
19
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
20
|
-
`)}var mh=class{options;rules;lexer;constructor(e){this.options=e||qp}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:lh(e,`
|
|
21
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ph(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=lh(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:lh(t[0],`
|
|
22
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=lh(t[0],`
|
|
23
|
-
`).split(`
|
|
24
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
25
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
26
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
27
|
-
${s}`:s,r=r?`${r}
|
|
28
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
29
|
-
`+e.join(`
|
|
30
|
-
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
31
|
-
`+e.join(`
|
|
32
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
33
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=dh(t[2].split(`
|
|
34
|
-
`,1)[0],t[1].length),l=e.split(`
|
|
35
|
-
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
36
|
-
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
37
|
-
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
38
|
-
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
39
|
-
`+l}u=!l.trim(),r+=p+`
|
|
40
|
-
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ch(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
41
|
-
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ch(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
42
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=lh(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=uh(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),fh(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return fh(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},hh=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||qp,this.options.tokenizer=this.options.tokenizer||new mh,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Qp,block:nh.normal,inline:rh.normal};this.options.pedantic?(t.block=nh.pedantic,t.inline=rh.pedantic):this.options.gfm&&(t.block=nh.gfm,t.inline=this.options.breaks?rh.breaks:rh.gfm),this.tokenizer.rules=t}static get rules(){return{block:nh,inline:rh}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Qp.carriageReturn,`
|
|
43
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Qp.tabCharGlobal,` `).replace(Qp.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
44
|
-
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
45
|
-
`)?``:`
|
|
46
|
-
`)+r.raw,n.text+=`
|
|
47
|
-
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
48
|
-
`)?``:`
|
|
49
|
-
`)+r.raw,n.text+=`
|
|
50
|
-
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
51
|
-
`)?``:`
|
|
52
|
-
`)+r.raw,a.text+=`
|
|
53
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
54
|
-
`)?``:`
|
|
55
|
-
`)+r.raw,n.text+=`
|
|
56
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},gh=class{options;parser;constructor(e){this.options=e||qp}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Qp.notSpaceStart)?.[0],i=e.replace(Qp.endingNewline,``)+`
|
|
57
|
-
`;return r?`<pre><code class="language-`+oh(r)+`">`+(n?i:oh(i,!0))+`</code></pre>
|
|
58
|
-
`:`<pre><code>`+(n?i:oh(i,!0))+`</code></pre>
|
|
59
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
60
|
-
${this.parser.parse(e)}</blockquote>
|
|
61
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
62
|
-
`}hr(e){return`<hr>
|
|
63
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
64
|
-
`+r+`</`+i+`>
|
|
65
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
66
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
67
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
68
|
-
<thead>
|
|
69
|
-
`+t+`</thead>
|
|
70
|
-
`+r+`</table>
|
|
71
|
-
`}tablerow({text:e}){return`<tr>
|
|
72
|
-
${e}</tr>
|
|
73
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
74
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${oh(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=sh(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+oh(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=sh(e);if(i===null)return oh(n);e=i;let a=`<img src="${e}" alt="${oh(n)}"`;return t&&(a+=` title="${oh(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:oh(e.text)}},_h=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},vh=class e{options;renderer;textRenderer;constructor(e){this.options=e||qp,this.options.renderer=this.options.renderer||new gh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _h}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},yh=class{options;block;constructor(e){this.options=e||qp}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?hh.lex:hh.lexInline}provideParser(e=this.block){return e?vh.parse:vh.parseInline}},bh=new class{defaults=Kp();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=vh;Renderer=gh;TextRenderer=_h;Lexer=hh;Tokenizer=mh;Hooks=yh;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new gh(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new mh(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new yh;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=yh.passThroughHooks.has(n)?e=>{if(this.defaults.async&&yh.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return hh.lex(e,t??this.defaults)}parser(e,t){return vh.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?hh.lex:hh.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?vh.parse:vh.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?hh.lex:hh.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?vh.parse:vh.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
75
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+oh(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function xh(e,t){return bh.parse(e,t)}xh.options=xh.setOptions=function(e){return bh.setOptions(e),xh.defaults=bh.defaults,Jp(xh.defaults),xh},xh.getDefaults=Kp,xh.defaults=qp,xh.use=function(...e){return bh.use(...e),xh.defaults=bh.defaults,Jp(xh.defaults),xh},xh.walkTokens=function(e,t){return bh.walkTokens(e,t)},xh.parseInline=bh.parseInline,xh.Parser=vh,xh.parser=vh.parse,xh.Renderer=gh,xh.TextRenderer=_h,xh.Lexer=hh,xh.lexer=hh.lex,xh.Tokenizer=mh,xh.Hooks=yh,xh.parse=xh,xh.options,xh.setOptions,xh.use,xh.walkTokens,xh.parseInline,vh.parse,hh.lex;function Sh(e,t){this.v=e,this.k=t}function Ch(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 wh(e){if(Array.isArray(e))return e}function Th(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){if(Object(n)!==n)return;c=!1}else 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 Eh(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
76
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dh(e,t){return wh(e)||Th(e,t)||Oh(e,t)||Eh()}function Oh(e,t){if(e){if(typeof e==`string`)return Ch(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)?Ch(e,t):void 0}}function kh(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Sh;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}kh.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},kh.prototype.next=function(e){return this._invoke(`next`,e)},kh.prototype.throw=function(e){return this._invoke(`throw`,e)},kh.prototype.return=function(e){return this._invoke(`return`,e)};var Ah=Object.entries,jh=Object.setPrototypeOf,Mh=Object.isFrozen,Nh=Object.getPrototypeOf,Ph=Object.getOwnPropertyDescriptor,Fh=Object.freeze,Ih=Object.seal,Lh=Object.create,Rh=typeof Reflect<`u`&&Reflect,zh=Rh.apply,Bh=Rh.construct;Fh||=function(e){return e},Ih||=function(e){return e},zh||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Bh||=function(e){return new e(...[...arguments].slice(1))};var Vh=dg(Array.prototype.forEach);Array.prototype.indexOf;var Hh=dg(Array.prototype.lastIndexOf),Uh=dg(Array.prototype.pop),Wh=dg(Array.prototype.push),Gh=dg(Array.prototype.slice),Kh=dg(Array.prototype.splice),qh=Array.isArray,Jh=fg(Set),Yh=dg(Set.prototype.add),Xh=dg(Set.prototype.has),Zh=dg(String.prototype.toLowerCase),Qh=dg(String.prototype.toString),$h=dg(String.prototype.match),eg=dg(String.prototype.replace),tg=dg(String.prototype.indexOf),ng=dg(String.prototype.trim),rg=dg(Number.prototype.toString),ig=dg(Boolean.prototype.toString),ag=typeof BigInt>`u`?null:dg(BigInt.prototype.toString),og=typeof Symbol>`u`?null:dg(Symbol.prototype.toString),sg=dg(Object.prototype.hasOwnProperty),cg=dg(Object.prototype.toString),lg=dg(RegExp.prototype.test),ug=fg(TypeError);function dg(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return zh(e,t,n)}}function fg(e){return function(){return Bh(e,[...arguments])}}function pg(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zh;if(jh&&jh(e,null),!qh(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Mh(t)||(t[r]=e),i=e)}e[i]=!0}return e}function mg(e){for(let t=0;t<e.length;t++)sg(e,t)||(e[t]=null);return e}function hg(e){let t=Lh(null);for(let r of Ah(e)){var n=Dh(r,2);let i=n[0],a=n[1];sg(e,i)&&(t[i]=qh(a)?mg(a):a&&typeof a==`object`&&a.constructor===Object?hg(a):a)}return t}function gg(e){switch(typeof e){case`string`:return e;case`number`:return rg(e);case`boolean`:return ig(e);case`bigint`:return ag?ag(e):`0`;case`symbol`:return og?og(e):`Symbol()`;case`undefined`:return cg(e);case`function`:case`object`:{if(e===null)return cg(e);let t=e,n=_g(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:cg(e)}return cg(e)}default:return cg(e)}}function _g(e,t){for(;e!==null;){let n=Ph(e,t);if(n){if(n.get)return dg(n.get);if(typeof n.value==`function`)return dg(n.value)}e=Nh(e)}function n(){return null}return n}function vg(e,t){for(;e!==null;){let n=Ph(e,t);if(n)return n.get?dg(n.get):null;e=Nh(e)}return null}function yg(e){try{return lg(e,``),!0}catch{return!1}}var bg=Fh(`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(`.`)),xg=Fh(`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(`.`)),Sg=Fh([`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`]),Cg=Fh([`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`]),wg=Fh(`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(`.`)),Tg=Fh([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Eg=Fh([`#text`]),Dg=Fh(`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(`.`)),Og=Fh(`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.dominant-baseline.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.pointer-events.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-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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(`.`)),kg=Fh(`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(`.`)),Ag=Fh([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),jg=Ih(/{{[\w\W]*|^[\w\W]*}}/g),Mg=Ih(/<%[\w\W]*|^[\w\W]*%>/g),Ng=Ih(/\${[\w\W]*/g),Pg=Ih(/^data-[\-\w.\u00B7-\uFFFF]+$/),Fg=Ih(/^aria-[\-\w]+$/),Ig=Ih(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lg=Ih(/^(?:\w+script|data):/i),Rg=Ih(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zg=Ih(/^html$/i),Bg=Ih(/^[a-z][.\w]*(-[.\w]+)+$/i),Vg=Ih(/<[/\w!]/g),Hg=Ih(/<[/\w]/g),Ug=Ih(/<\/no(script|embed|frames)/i),Wg=Ih(/\/>/i),Gg={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Kg=Fh(pg({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),qg=function(){return typeof window>`u`?null:window},Jg=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}},Yg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Xg=function(e,t,n,r){return sg(e,t)&&qh(e[t])?pg(r.base?hg(r.base):{},e[t],r.transform):n},Zg=function(e,t,n){let r=sg(e,t)?e[t]:void 0;return r&&typeof r==`object`?hg(r):n()};function Qg(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qg(),t=e=>Qg(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Gg.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=_g(d,`cloneNode`),p=_g(d,`remove`),m=_g(d,`removeAttributeNode`),h=_g(d,`nextSibling`),g=_g(d,`childNodes`),_=_g(d,`parentNode`),v=_g(d,`shadowRoot`),y=_g(d,`attributes`),b=o&&o.prototype?_g(o.prototype,`nodeType`):null,x=o&&o.prototype?_g(o.prototype,`nodeName`):null,S=o&&o.prototype?_g(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},ee=function(e){return x?x(e):e.nodeName},te=vg(d,`namespaceURI`),ne=function(e){return te?te(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let re,w=``,ie,ae=!1,oe=0,se=function(){if(oe>0)throw ug(`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.`)},ce=function(e){se(),oe++;try{return re.createHTML(e)}finally{oe--}},le=function(e){se(),oe++;try{return re.createScriptURL(e)}finally{oe--}},ue=function(){return ae||=(ie=Jg(u,i),!0),ie},de=n,fe=de.implementation,pe=de.createNodeIterator,me=de.createDocumentFragment,he=de.getElementsByTagName,ge=r.importNode,T=Yg();t.isSupported=typeof Ah==`function`&&typeof _==`function`&&fe&&fe.createHTMLDocument!==void 0;let _e=jg,ve=Mg,ye=Ng,be=Pg,E=Fg,xe=Lg,Se=Rg,Ce=Bg,we=Ig,Te=null,Ee=pg({},[...bg,...xg,...Sg,...wg,...Eg]),De=null,Oe=pg({},[...Dg,...Og,...kg,...Ag]),ke=Object.seal(Lh(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}})),Ae=null,D=null,je=Object.seal(Lh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Me=!0,Ne=!0,Pe=!1,Fe=!0,Ie=!1,Le=!0,Re=!1,ze=!1,Be=null,Ve=null,He=!1,Ue=!1,We=!1,Ge=!1,Ke=!0,qe=!1,Je=`user-content-`,Ye=!0,Xe=!1,Ze=null,Qe={},$e=null,et=pg({},`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(`.`)),tt=null,nt=pg({},[`audio`,`video`,`img`,`source`,`image`,`track`]),rt=null,it=pg({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),at=`http://www.w3.org/1998/Math/MathML`,ot=`http://www.w3.org/2000/svg`,st=`http://www.w3.org/1999/xhtml`,ct=st,lt=!1,ut=null,dt=pg({},[at,ot,st],Qh),ft=Fh([`mi`,`mo`,`mn`,`ms`,`mtext`]),pt=pg({},ft),mt=Fh([`annotation-xml`]),ht=pg({},mt),gt=pg({},[`title`,`style`,`font`,`a`,`script`]),_t=null,vt=[`application/xhtml+xml`,`text/html`],yt=null,bt=null,xt=n.createElement(`form`),St=function(e){return e instanceof RegExp||e instanceof Function},Ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(bt&&bt===e)return;(!e||typeof e!=`object`)&&(e={}),e=hg(e),_t=vt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,yt=_t===`application/xhtml+xml`?Qh:Zh,Te=Xg(e,`ALLOWED_TAGS`,Ee,{transform:yt}),De=Xg(e,`ALLOWED_ATTR`,Oe,{transform:yt}),ut=Xg(e,`ALLOWED_NAMESPACES`,dt,{transform:Qh}),rt=Xg(e,`ADD_URI_SAFE_ATTR`,it,{transform:yt,base:it}),tt=Xg(e,`ADD_DATA_URI_TAGS`,nt,{transform:yt,base:nt}),$e=Xg(e,`FORBID_CONTENTS`,et,{transform:yt}),Ae=Xg(e,`FORBID_TAGS`,hg({}),{transform:yt}),D=Xg(e,`FORBID_ATTR`,hg({}),{transform:yt}),Qe=sg(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?hg(e.USE_PROFILES):e.USE_PROFILES:!1,Me=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,Pe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ie=e.SAFE_FOR_TEMPLATES||!1,Le=e.SAFE_FOR_XML!==!1,Re=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,We=e.RETURN_DOM_FRAGMENT||!1,Ge=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,Ke=e.SANITIZE_DOM!==!1,qe=e.SANITIZE_NAMED_PROPS||!1,Ye=e.KEEP_CONTENT!==!1,Xe=e.IN_PLACE||!1,we=yg(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ig,ct=typeof e.NAMESPACE==`string`?e.NAMESPACE:st,pt=Zg(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>pg({},ft)),ht=Zg(e,`HTML_INTEGRATION_POINTS`,()=>pg({},mt));let t=Zg(e,`CUSTOM_ELEMENT_HANDLING`,()=>Lh(null));if(ke=Lh(null),sg(t,`tagNameCheck`)&&St(t.tagNameCheck)&&(ke.tagNameCheck=t.tagNameCheck),sg(t,`attributeNameCheck`)&&St(t.attributeNameCheck)&&(ke.attributeNameCheck=t.attributeNameCheck),sg(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ke.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Ih(ke),Ie&&(Ne=!1),We&&(Ue=!0),Qe&&(Te=pg({},Eg),De=Lh(null),Qe.html===!0&&(pg(Te,bg),pg(De,Dg)),Qe.svg===!0&&(pg(Te,xg),pg(De,Og),pg(De,Ag)),Qe.svgFilters===!0&&(pg(Te,Sg),pg(De,Og),pg(De,Ag)),Qe.mathMl===!0&&(pg(Te,wg),pg(De,kg),pg(De,Ag))),je.tagCheck=null,je.attributeCheck=null,sg(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?je.tagCheck=e.ADD_TAGS:qh(e.ADD_TAGS)&&(Te===Ee&&(Te=hg(Te)),pg(Te,e.ADD_TAGS,yt))),sg(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?je.attributeCheck=e.ADD_ATTR:qh(e.ADD_ATTR)&&(De===Oe&&(De=hg(De)),pg(De,e.ADD_ATTR,yt))),sg(e,`ADD_FORBID_CONTENTS`)&&qh(e.ADD_FORBID_CONTENTS)&&($e===et&&($e=hg($e)),pg($e,e.ADD_FORBID_CONTENTS,yt)),Ye&&(Te[`#text`]=!0),Re&&pg(Te,[`html`,`head`,`body`]),Te.table&&(pg(Te,[`tbody`]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ug(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ug(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=re;re=e.TRUSTED_TYPES_POLICY;try{w=ce(``)}catch(e){throw re=t,e}}else e.TRUSTED_TYPES_POLICY===null?(re=void 0,w=``):(re===void 0&&(re=ue()),re&&typeof w==`string`&&(w=ce(``)));Fh&&Fh(e),bt=e},wt=pg({},[...xg,...Sg,...Cg]),Tt=pg({},[...wg,...Tg]),Et=function(e,t,n){return t.namespaceURI===st?e===`svg`:t.namespaceURI===at?e===`svg`&&(n===`annotation-xml`||pt[n]):!!wt[e]},Dt=function(e,t,n){return t.namespaceURI===st?e===`math`:t.namespaceURI===ot?e===`math`&&ht[n]:!!Tt[e]},Ot=function(e,t,n){return t.namespaceURI===ot&&!ht[n]||t.namespaceURI===at&&!pt[n]?!1:!Tt[e]&&(gt[e]||!wt[e])},kt=function(e){let t=ne(e),n=Zh(ee(e)),r=_(e),i,a;return r&&C(r)===Gg.element?(i={namespaceURI:ne(r)},a=Zh(ee(r))):(i={namespaceURI:ct},a=`template`),ut[t]?t===ot?Et(n,i,a):t===at?Dt(n,i,a):t===st?Ot(n,i,a):!!(_t===`application/xhtml+xml`&&ut[t]):!1},At=function(e){Wh(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw ug(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},jt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Mt=function(e){It(e);let t=g(e);t&&Vh(Gh(t),e=>{try{p(e)}catch{}});let n=C(e)===Gg.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&jt(e,r,i)}},Nt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Wh(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Ue||We)try{At(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Pt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||De[yt(i)]||jt(e,r,i)}},Ft=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===Gg.element){let t=v(e);Zt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},It=function(e){Ft(e,e=>{C(e)===Gg.element&&Pt(e)})},Lt=function(e){let t=[];return Ft(e,e=>{t.push(e)},!0),t},Rt=function(e,t){let n=Jh();Vh(Lt(e),e=>{C(e)===Gg.element&&Yh(n,e)}),Vh(t,e=>{C(e)===Gg.element&&!Xh(n,e)&&Pt(e)})},zt=function(e,n){let r=!1;return Vh(t.removed,t=>{t.element&&(r||=t.element===e,It(t.element))}),Rt(e,n),r},Bt=function(e,t){let n=Ze,r=null,i=()=>(r||(r=Jh(),Vh(t,e=>{Yh(r,e)})),r);for(let t=0;;t++){let r=Lt(e),a=[e],o=!1;if(Vh(r,e=>{C(e)===Gg.documentFragment?Wh(a,e):!o&&!Xh(n,e)&&(o=Xh(i(),e))}),!o)return;if(t>=8)throw ug(`the tree kept changing during in-place sanitization; refusing to return it`);Vh(a,(t,n)=>{Vt(t,n>0,e,i())})}},Vt=function(e,t,n,r){let i=Kt(e),a;for(;a=i.nextNode();)Xh(r,a)&&!Xh(Ze,a)&&(t&&O(T.uponSanitizeShadowNode,a,null),rn(a,n),un(a,n),Zt(a.content)&&dn(a.content))},Ht=function(e){Ze&&Yh(Ze,e)},Ut=function(e,t){return Le?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Wt=function(e){Le&&Ft(e,e=>{let t=C(e);if(t===Gg.processingInstruction||t===Gg.comment&&lg(Hg,e.data)){try{p(e)}catch{}return!1}if(t===Gg.element){let t=e,n=yt(ee(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ut(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Gt=function(e){let t=null,r=null;if(He)e=`<remove></remove>`+e;else{let t=$h(e,/^[\r\n\t ]+/);r=t&&t[0]}_t===`application/xhtml+xml`&&ct===st&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=re?ce(e):e;if(ct===st)try{t=new l().parseFromString(i,_t)}catch{}if(!t||!t.documentElement){t=fe.createDocument(ct,`template`,null);try{t.documentElement.innerHTML=lt?w:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ct===st?he.call(t,Re?`html`:`body`)[0]:Re?t.documentElement:a},Kt=function(e){let t=S?S(e):e.ownerDocument;return pe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},qt=function(e){return e=eg(e,_e,` `),e=eg(e,ve,` `),e=eg(e,ye,` `),e},Jt=function(e){Yt(e);let t=e.querySelectorAll?.call(e,`template`);t&&Vh(t,e=>{Zt(e.content)&&Jt(e.content)})},Yt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=pe.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=qt(r.data),r=n.nextNode()},Xt=function(e){let t=x?x(e):null;return typeof t!=`string`||yt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Zt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Gg.documentFragment}catch{return!1}},Qt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function O(e,n,r){e.length!==0&&Vh(e,e=>{e.call(t,n,r,bt)})}let $t=function(e,t){return!!(Le&&e.hasChildNodes()&&!Qt(e.firstElementChild)&&lg(Vg,e.textContent)&&lg(Vg,e.innerHTML)||Le&&Kg[t]&&C(e)===Gg.element&&ne(e)===st&&(Qt(e.firstElementChild)||typeof e.textContent==`string`&&lg(Vg,e.textContent))||e.nodeType===Gg.processingInstruction||Le&&e.nodeType===Gg.comment&&lg(Hg,e.data))},en=function(e,t){return e instanceof RegExp?lg(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},tn=function(e,t,n){if(!Ae[t]&&A(t)&&en(ke.tagNameCheck,t))return!1;if(Ye&&!$e[t]&&!$e[Zh(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return At(e),!0},nn=function(e,t,n,r){return e.length===0?t:t===n||t===r?hg(t):t},k=function(e,t){return e===t||_(e)!==null?!1:(Xe&&It(e),!0)},rn=function(e,n){if(Ht(e),O(T.beforeSanitizeElements,e,null),k(e,n))return!0;if(Xt(e))return At(e),!0;let r=yt(ee(e));if(Te=nn(T.uponSanitizeElement,Te,Ee,Be),O(T.uponSanitizeElement,e,{tagName:r,allowedTags:Te}),k(e,n))return!0;if($t(e,r))return At(e),!0;if(Ae[r]||!(je.tagCheck instanceof Function&&je.tagCheck(r))&&!Te[r]){let t=tn(e,r,n);return t===!1&&(O(T.afterSanitizeElements,e,null),k(e,n))?!0:t}if(C(e)===Gg.element&&!kt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&lg(Ug,e.innerHTML))return At(e),!0;if(Ie&&e.nodeType===Gg.text){let n=qt(e.textContent);e.textContent!==n&&(Wh(t.removed,{element:e.cloneNode()}),e.textContent=n)}return O(T.afterSanitizeElements,e,null),k(e,n)},an=function(e,t,r){if(D[t]||Ut(t,e)||Ke&&(t===`id`||t===`name`)&&(r in n||r in xt))return!1;let i=De[t]||je.attributeCheck instanceof Function&&je.attributeCheck(t,e);return Ne&&lg(be,t)||Me&&lg(E,t)?!0:i?rt[t]||lg(we,eg(r,Se,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&tg(r,`data:`)===0&&tt[e]||Pe&&!lg(xe,eg(r,Se,``))?!0:!r:A(e)&&en(ke.tagNameCheck,e)&&en(ke.attributeNameCheck,t,e)||t===`is`&&ke.allowCustomizedBuiltInElements&&en(ke.tagNameCheck,r)},on=pg({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),A=function(e){return!on[Zh(e)]&&lg(Ce,e)},sn=function(e,t,n,r){if(re&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ce(r);case`TrustedScriptURL`:return le(r)}return r},cn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Xt(e)||(At(e),!1)}catch{return Nt(t,e),!1}},ln=function(e,t){return Le&&lg(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Zh(e)===`attributename`&&$h(t,`href`)!==null},un=function(e,n){if(O(T.beforeSanitizeAttributes,e,null),k(e,n))return;let r=e.attributes;if(!r||Xt(e))return;De=nn(T.uponSanitizeAttribute,De,Oe,Ve);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:De,forceKeepAttr:void 0},a=r.length,o=yt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=yt(s),d=l,f=s===`value`?d:ng(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,O(T.uponSanitizeAttribute,e,i),f=i.attrValue,qe&&(u===`id`||u===`name`)&&tg(f,Je)!==0&&(Nt(s,e,n),f=Je+f,p=!0),ln(s,f)){Nt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){Nt(s,e,n);continue}if(!Fe&&lg(Wg,f)){Nt(s,e,n);continue}if(Ie&&(f=qt(f)),!an(o,u,f)){Nt(s,e,n);continue}f=sn(o,u,c,f),f!==d&&cn(e,s,c,f)&&p&&Uh(t.removed)}}O(T.afterSanitizeAttributes,e,null),k(e,n)},dn=function(e){let t=null,n=Kt(e);for(O(T.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(O(T.uponSanitizeShadowNode,t,null),rn(t,e),un(t,e),Zt(t.content)&&dn(t.content),C(t)===Gg.element){let e=v(t);Zt(e)&&(fn(e),dn(e))}Ie&&Yt(e),O(T.afterSanitizeShadowDOM,e,null)},fn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){dn(e.shadow);continue}let n=e.node,r=C(n)===Gg.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&yt(e)===`template`){let e=n.content;Zt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Zt(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(lt=!e,lt&&(e=`<!-->`),typeof e!=`string`&&!Qt(e)&&(e=gg(e),typeof e!=`string`))throw ug(`dirty is not a string, aborting`);if(!t.isSupported)return e;ze?(Te=Be,De=Ve):Ct(n),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(Te=hg(Te)),T.uponSanitizeAttribute.length>0&&(De=hg(De)),t.removed=[];let c=Xe&&typeof e!=`string`&&Qt(e),l=[],u=Ze;if(c){Wt(e);let t=ee(e);if(typeof t==`string`){let n=yt(t);if(!Te[n]||Ae[n])throw Mt(e),ug(`root node is forbidden and cannot be sanitized in-place`)}if(Xt(e))throw Mt(e),ug(`root node is clobbered and cannot be sanitized in-place`);l=Lt(e),Ze=Jh()}else if(Qt(e))i=Gt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Gg.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),fn(i);else{if(!Ue&&!Ie&&!Re&&e.indexOf(`<`)===-1)return re&&Ge?ce(e):e;if(i=Gt(e),!i)return Ue?null:Ge?w:``}i&&He&&At(i.firstChild);let d=c?e:i;try{c&&fn(e);let t=Kt(d);for(;o=t.nextNode();)rn(o,d),un(o,d),Zt(o.content)&&dn(o.content);c&&Bt(e,l)}catch(t){throw c&&(Mt(e),zt(e,l)),t}finally{Ze=u}if(c){if(zt(e,l))throw ug(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Ie&&Jt(e),e}if(Ue){if(Ie&&Jt(i),We)for(s=me.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(De.shadowroot||De.shadowrootmode)&&(s=ge.call(r,s,!0)),s}let f=Re?i.outerHTML:i.innerHTML;return Re&&Te[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&lg(zg,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
77
|
-
`+f),Ie&&(f=qt(f)),re&&Ge?ce(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ct(e),ze=!0,Be=Te,Ve=De},t.clearConfig=function(){bt=null,ze=!1,Be=null,Ve=null,re=ie,w=``},t.isValidAttribute=function(e,t,n){bt||Ct({});let r=yt(e),i=yt(t);return typeof n==`string`&&(ln(t,n)||!Fe&&lg(Wg,n))?!1:an(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&sg(T,e)&&Wh(T[e],t)},t.removeHook=function(e,t){if(sg(T,e)){if(t!==void 0){let n=Hh(T[e],t);return n===-1?void 0:Kh(T[e],n,1)[0]}return Uh(T[e])}},t.removeHooks=function(e){sg(T,e)&&(T[e]=[])},t.removeAllHooks=function(){T=Yg()},t}var $g=Qg();function e_(e,t){let n;try{n=new URL(e.trim())}catch{return null}return n.protocol!==`https:`&&n.protocol!==`http:`||n.origin===t?null:n.href}var t_=`p.br.hr.strong.b.em.i.del.s.code.pre.blockquote.ul.ol.li.a.h1.h2.h3.h4.h5.h6.small.sub.sup.table.thead.tbody.tr.th.td.img.input`.split(`.`),n_=[`form`,`style`,`script`,`button`,`select`,`textarea`,`iframe`,`object`,`embed`,`svg`,`math`],r_={a:[`href`,`title`],img:[`src`,`alt`,`title`],th:[`colspan`,`rowspan`,`align`],td:[`colspan`,`rowspan`,`align`],ol:[`start`],code:[`class`],input:[`type`,`checked`,`disabled`]},i_=[...new Set(Object.values(r_).flat())],a_=/^language-[\w-]+$/,o_=/^\d{1,4}$/,s_=/^(left|right|center)$/i;function c_(e,t,n){if(!Object.hasOwn(r_,e)||!r_[e].includes(t))return!1;switch(t){case`class`:return a_.test(n);case`type`:return n.toLowerCase()===`checkbox`;case`colspan`:case`rowspan`:case`start`:return o_.test(n);case`align`:return s_.test(n);default:return!0}}var l_=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/i,u_=/^\/api(\/|$)/i;function d_(e,t){if(l_.test(e))return!0;if(!e.trim())return!1;let n;try{n=new URL(e,t)}catch{return!1}return(n.protocol===`https:`||n.protocol===`http:`)&&n.origin===t&&!u_.test(n.pathname)}$g.isSupported&&$g.addHook(`afterSanitizeAttributes`,e=>{let t=e.nodeName.toLowerCase();for(let{name:n,value:r}of Array.from(e.attributes))c_(t,n,r)||e.removeAttribute(n);if(t===`img`&&!d_(e.getAttribute(`src`)??``,location.origin)){e.replaceWith(document.createTextNode(e.getAttribute(`alt`)??``));return}if(t===`input`){e.getAttribute(`type`)===null?e.remove():e.setAttribute(`disabled`,``);return}if(t!==`a`)return;let n=e.getAttribute(`href`),r=n===null?null:e_(n,location.origin);r?(e.setAttribute(`href`,r),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):(e.removeAttribute(`href`),e.removeAttribute(`target`))});var f_={ALLOWED_TAGS:t_,ALLOWED_ATTR:i_,FORBID_TAGS:n_,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1},p_=new Map;function m_(e){let t=p_.get(e);return t===void 0&&(t=$g.sanitize(xh.parse(e,{async:!1}),f_),p_.size>400&&p_.delete(p_.keys().next().value),p_.set(e,t)),t}var h_=`demo.job-runs`,g_=e=>e.status!==`running`&&e.status!==`waiting`,__=U(()=>Yu.value?.info?.jobs??[]),v_=e=>__.value.find(t=>t.id===e),y_=U(()=>{let e=fd.value.docs[h_];return Object.values(e?.items??{}).sort((e,t)=>t.id-e.id)}),b_=e=>y_.value.find(t=>t.id===e),x_=e=>y_.value.find(t=>t.toolCallId===e),S_=k(Date.now());setInterval(()=>S_.value=Date.now(),1e3);var C_=e=>e<1e3?`${Math.max(0,Math.round(e))}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`,w_=k();async function T_(e,t){if(!w_.value){w_.value=e;try{return await Od(t)}finally{w_.value=void 0}}}function E_(e){Ld.value&&Bd(),setTimeout(()=>document.querySelector(`[data-job-run="${e}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function D_(e){let t=await T_(`start:${e.id}`,()=>nd.value.demo(`jobs`,{job:e.id}));t&&(Y(`${e.title} started. It runs in the chat.`),E_(t.taskId))}var O_=(e,t)=>T_(`decide:${e.id}`,()=>nd.value.demo(`jobs/${e.id}/approval`,{approved:t})),k_=e=>T_(`stop:${e.id}`,()=>rd.value.abortTask(e.id));function A_(e){q.value&&id({...q.value,agentId:e})}var j_=[`data-job-run`,`aria-label`],M_={class:`job-run-head`},N_={class:`job-run-icon`},P_={class:`job-run-titles`},F_={class:`job-run-eyebrow`},I_={class:`job-run-repeat`},L_={key:0,class:`job-run-about`},R_={class:`job-run-meta`},z_={key:0,class:`job-run-resumed`},B_={class:`job-stepper`,"aria-label":`Phases`},V_=[`aria-current`],H_={class:`job-chip`},U_={class:`job-step-dot`},W_={class:`job-step-label`},G_={key:0,class:`job-step-progress`},K_={class:`job-phases`},q_=[`open`],J_={class:`job-phase-n`},Y_={class:`job-phase-summary`},X_={class:`job-phase-time`},Z_={key:0,class:`job-phase-about`},Q_={key:1,class:`job-steps`},$_=[`open`],ev={key:1,class:`job-step-line`},tv=[`onClick`],nv={key:2,class:`job-phase-empty`},rv={key:1,class:`job-approval`,role:`group`,"aria-label":`Approval`},iv={class:`job-approval-buttons`},av=[`disabled`],ov=[`disabled`],sv={key:2,class:`message-error`},cv={class:`job-run-foot`},lv=[`disabled`],uv=N({__name:`JobCard`,props:{run:{}},setup(e){let t=e,n=U(()=>v_(t.run.job)),r=U(()=>g_(t.run)),i=U(()=>C_((t.run.endedAt??S_.value)-t.run.startedAt)),a={running:`Running`,waiting:`Waiting for you`,completed:`Completed`,failed:`Failed`,aborted:`Stopped`,declined:`Declined`},o={command:pl,tool:bl,agent:Zs,state:Qs,approval:sl,checkpoint:_c,note:Pc},s=e=>e.kind===`tool`?`${e.label}: a subagent tool call, its own durable task`:e.label,c=e=>{let t=e.step,n=[`command`,`tool`,`state`].includes(t.kind)?io(`code`,{title:s(t)},t.label):io(`span`,{class:`job-step-text`},t.label),r=t.status===`running`?io(Fc,{size:15,class:`spin`}):t.status===`done`?io(tc,{size:15}):t.status===`waiting`?io(Tc,{size:15}):io(xl,{size:15});return[io(o[t.kind],{size:16,class:`job-step-kind`}),n,t.kind===`tool`&&t.detail?io(`span`,{class:`job-step-args`,title:t.detail},t.detail):null,io(`span`,{class:`job-step-state`},[r,t.ms!==void 0&&t.kind!==`note`?io(`span`,C_(t.ms)):null])]};c.props=[`step`];let l=e=>n.value?.phases.find(t=>t.id===e),u=e=>e.startedAt?C_((e.endedAt??(e.status===`running`||e.status===`waiting`?S_.value:e.startedAt))-e.startedAt):``,d=e=>e.status!==`pending`&&e.status!==`skipped`,f=U(()=>Object.entries(t.run.input)),p=U(()=>t.run.phases.find(e=>e.status===`waiting`));return(t,o)=>(I(),L(`article`,{class:E([`job-run`,`is-${e.run.status}`]),"data-job-run":e.run.id,"aria-label":`${e.run.title} run ${e.run.run}: ${a[e.run.status]}`},[z(`header`,M_,[z(`span`,N_,[B(A(yl),{size:22})]),z(`div`,P_,[z(`div`,F_,[o[3]||=z(`span`,null,`DURABLE JOB`,-1),z(`span`,I_,[B(A(el),{size:15}),V(`Repeatable workflow, run #`+D(e.run.run),1)])]),z(`h3`,null,D(e.run.title),1)]),z(`span`,{class:E([`job-run-status`,e.run.status])},[o[4]||=z(`i`,null,null,-1),V(D(a[e.run.status]),1)],2)]),n.value?(I(),L(`p`,L_,D(n.value.summary),1)):H(``,!0),z(`div`,R_,[z(`span`,null,`task #`+D(e.run.id),1),z(`span`,null,D(e.run.startedBy===`agent`?`started by the agent`:`started by you`),1),z(`span`,null,D(i.value),1),(I(!0),L(F,null,P(f.value,([e,t])=>(I(),L(`span`,{key:e,class:`job-run-input`},D(e)+`=`+D(t),1))),128)),e.run.resumed?(I(),L(`span`,z_,`resumed `+D(e.run.resumed)+`× after restart`,1)):H(``,!0)]),z(`ol`,B_,[(I(!0),L(F,null,P(e.run.phases,(t,n)=>(I(),L(`li`,{key:t.id,class:E(`ph-${t.status}`),"aria-current":e.run.phase===t.id&&!r.value?`step`:void 0},[z(`span`,H_,[z(`span`,U_,[t.status===`done`?(I(),R(A(tc),{key:0,size:15})):t.status===`running`?(I(),R(A(Fc),{key:1,size:15,class:`spin`})):t.status===`waiting`?(I(),R(A(Tc),{key:2,size:15})):[`failed`,`aborted`].includes(t.status)?(I(),R(A(xl),{key:3,size:15})):(I(),L(F,{key:4},[V(D(n+1),1)],64))]),z(`span`,W_,D(t.label),1),t.progress?(I(),L(`span`,G_,D(t.progress.done)+`/`+D(t.progress.total),1)):H(``,!0)])],10,V_))),128))]),z(`div`,K_,[(I(!0),L(F,null,P(e.run.phases,(e,t)=>(I(),L(`details`,{key:e.id,class:E([`job-phase`,`ph-${e.status}`]),open:d(e)},[z(`summary`,null,[z(`span`,J_,D(t+1),1),z(`strong`,null,D(e.label),1),z(`span`,Y_,D(e.summary??(e.status===`pending`?l(e.id)?.summary:e.status===`skipped`?`Skipped`:``)),1),z(`span`,X_,D(u(e)),1)]),e.status===`done`?H(``,!0):(I(),L(`p`,Z_,D(l(e.id)?.summary),1)),e.steps.length?(I(),L(`ul`,Q_,[(I(!0),L(F,null,P(e.steps,e=>(I(),L(`li`,{key:e.id,class:E([`k-${e.kind}`,`st-${e.status}`])},[e.detail&&e.kind!==`tool`?(I(),L(`details`,{key:0,open:e.status===`error`},[z(`summary`,null,[B(c,{step:e},null,8,[`step`])]),z(`pre`,null,D(e.detail),1)],8,$_)):(I(),L(`div`,ev,[B(c,{step:e},null,8,[`step`])])),e.kind===`agent`&&e.conversationId?(I(),L(`button`,{key:2,class:`text-button job-step-link`,onClick:t=>A(A_)(e.conversationId)},` Open subagent #`+D(e.conversationId),9,tv)):H(``,!0)],2))),128))])):e.status===`pending`?(I(),L(`p`,nv,`Not started yet.`)):H(``,!0)],10,q_))),128))]),e.run.approval===`pending`?(I(),L(`div`,rv,[z(`div`,null,[B(A(sl),{size:20}),o[5]||=z(`strong`,null,`Approve to continue`,-1)]),z(`p`,null,D(p.value?l(p.value.id)?.summary:`This run waits for you`)+`. It is paused on a saved checkpoint: close the browser or restart the device and the decision will still be waiting. `,1),z(`div`,iv,[z(`button`,{class:`primary small`,disabled:!!A(w_),onClick:o[0]||=t=>A(O_)(e.run,!0)},[B(A(tc),{size:18}),o[6]||=V(`Approve & continue `,-1)],8,av),z(`button`,{class:`secondary`,disabled:!!A(w_),onClick:o[1]||=t=>A(O_)(e.run,!1)},`Decline`,8,ov)])])):H(``,!0),e.run.error&&e.run.status!==`aborted`?(I(),L(`p`,sv,D(e.run.error),1)):H(``,!0),z(`footer`,cv,[z(`span`,null,D(e.run.background?`Runs in the background: the conversation owns it, so Interrupt leaves it running.`:`Owned by this tool call: Interrupt stops it.`)+` Each phase saves a checkpoint, so a restart resumes the current phase.`,1),r.value?H(``,!0):(I(),L(`button`,{key:0,class:`secondary danger`,disabled:!!A(w_),onClick:o[2]||=t=>A(k_)(e.run)},[B(A(Vc),{size:16}),o[7]||=V(`Stop `,-1)],8,lv))])],10,j_))}}),dv={class:`message-label`},fv={class:`user-message`},pv={class:`message-label`},mv={key:0,class:`streaming`},hv={key:1},gv=[`aria-label`],_v=[`innerHTML`],vv={key:1,class:`thinking`},yv=[`data-call-id`],bv={class:`tool-status`},xv={class:`tool-section-label`},Sv=[`aria-label`,`onClick`],Cv={key:0,class:`typing`},wv={key:1,class:`message-error`},Tv=[`aria-label`],Ev={key:3,class:`live-tool`},Dv={key:0},Ov={class:`event-line`},kv=[`aria-label`],Av={key:0,class:`raw`},jv=N({__name:`TranscriptItem`,props:{item:{}},emits:[`fork`],setup(e,{emit:t}){let n=t,r=e=>e.status===`error`?`Error`:e.status===`done`?`Done`:e.status,i=e=>e.kind===`user`?`pi-user`:e.kind===`assistant`?e.streaming?`live-generation`:`pi-assistant`:e.kind===`tool-result`?`pi-tool-result`:e.kind===`tool`?`live-tool-entry`:e.entryKind.replaceAll(`.`,`-`);return(t,a)=>(I(),L(`article`,{class:E([`entry`,i(e.item)])},[e.item.kind===`user`?(I(),L(F,{key:0},[z(`div`,dv,[a[3]||=V(` YOU `,-1),z(`span`,null,`#`+D(e.item.id),1)]),z(`div`,fv,D(e.item.text),1)],64)):e.item.kind===`assistant`?(I(),L(F,{key:1},[z(`div`,pv,[a[5]||=V(` AGENT `,-1),e.item.streaming?(I(),L(`span`,mv,`Working`)):(I(),L(`span`,hv,`#`+D(e.item.id),1)),e.item.streaming?H(``,!0):(I(),L(`button`,{key:2,class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,title:`Fork from this entry. App State stays shared.`,onClick:a[0]||=t=>n(`fork`,e.item.id)},[B(A(Cc),{size:18}),a[4]||=V(`Fork `,-1)],8,gv))]),(I(!0),L(F,null,P(e.item.blocks,(e,t)=>(I(),L(F,{key:t},[e.type===`text`?(I(),L(`div`,{key:0,class:`markdown`,innerHTML:A(m_)(e.text)},null,8,_v)):e.type===`thinking`?(I(),L(`details`,vv,[a[6]||=z(`summary`,null,`Thinking`,-1),z(`div`,null,D(e.text),1)])):(I(),L(`details`,{key:2,class:E([`tool-call`,{failed:e.call.status===`error`}]),"data-call-id":e.call.callId},[z(`summary`,null,[e.call.status===`error`?(I(),R(A(Oc),{key:0,size:18})):e.call.status===`done`?(I(),R(A(tc),{key:1,size:18})):e.call.status===`running`?(I(),R(A(Vs),{key:2,size:18})):(I(),R(A(bl),{key:3,size:18})),z(`strong`,null,D(e.call.name),1),z(`code`,null,D(A(jd)(e.call.args)?.slice(0,90)),1),z(`span`,bv,D(r(e.call)),1)]),a[10]||=z(`div`,{class:`tool-section-label`},`Input`,-1),z(`pre`,null,D(A(jd)(e.call.args)),1),e.call.result===void 0?e.call.output?(I(),L(F,{key:1},[a[9]||=z(`div`,{class:`tool-section-label`},`Live output`,-1),z(`pre`,null,D(e.call.output),1)],64)):H(``,!0):(I(),L(F,{key:0},[z(`div`,xv,[a[8]||=z(`span`,null,`Result`,-1),e.call.resultEntryId===void 0?H(``,!0):(I(),L(`button`,{key:0,class:`fork-button`,"aria-label":`Fork at entry ${e.call.resultEntryId}`,title:`Fork after this result`,onClick:t=>n(`fork`,e.call.resultEntryId)},[B(A(Cc),{size:18}),a[7]||=V(`Fork `,-1)],8,Sv))]),z(`pre`,null,D(e.call.result),1)],64))],10,yv)),e.type===`tool`&&e.call.name===`run_durable_job`&&A(x_)(e.call.callId)?(I(),R(uv,{key:3,run:A(x_)(e.call.callId)},null,8,[`run`])):H(``,!0)],64))),128)),e.item.streaming&&!e.item.blocks.length?(I(),L(`div`,Cv,[...a[11]||=[z(`i`,null,null,-1),z(`i`,null,null,-1),z(`i`,null,null,-1)]])):H(``,!0),e.item.error?(I(),L(`div`,wv,D(e.item.error),1)):H(``,!0)],64)):e.item.kind===`tool-result`?(I(),L(`details`,{key:2,class:E([`tool-result`,{failed:e.item.isError}])},[z(`summary`,null,[e.item.isError?(I(),R(A(Oc),{key:1,size:18})):(I(),R(A(tc),{key:0,size:18})),z(`strong`,null,D(e.item.name),1),z(`span`,null,D(e.item.isError?`error`:`result`),1),z(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[1]||=ks(t=>n(`fork`,e.item.id),[`prevent`])},[B(A(Cc),{size:18}),a[12]||=V(`Fork `,-1)],8,Tv)]),z(`pre`,null,D(e.item.text),1)],2)):e.item.kind===`tool`?(I(),L(`div`,Ev,[z(`div`,null,[B(A(Vs),{size:18}),z(`strong`,null,D(e.item.call.name),1),z(`span`,null,D(e.item.call.status),1)]),e.item.call.output?(I(),L(`pre`,Dv,D(e.item.call.output),1)):H(``,!0),e.item.call.name===`run_durable_job`&&A(x_)(e.item.call.callId)?(I(),R(uv,{key:1,run:A(x_)(e.item.call.callId)},null,8,[`run`])):H(``,!0)])):e.item.entryKind===`demo.job`&&A(b_)(e.item.data.taskId)?(I(),R(uv,{key:4,run:A(b_)(e.item.data.taskId)},null,8,[`run`])):(I(),L(F,{key:5},[z(`div`,Ov,[e.item.entryKind===`demo.state-change`?(I(),R(A(Qs),{key:0,size:18})):(I(),R(A(jc),{key:1,size:18})),z(`span`,null,D(e.item.text),1),z(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[2]||=t=>n(`fork`,e.item.id)},[B(A(Cc),{size:18}),a[13]||=V(`Fork `,-1)],8,kv)]),e.item.note?(I(),L(`details`,Av,[a[14]||=z(`summary`,null,`Context note`,-1),z(`pre`,null,D(e.item.note),1)])):H(``,!0)],64))],2))}}),Mv={key:0,class:`git-chip-wrap`},Nv=[`title`],Pv={class:`branch`},Fv={key:0,class:`dirty`},Iv={key:1,class:`ahead`},Lv={key:2,class:`behind`},Rv=of(N({__name:`GitChip`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=U(()=>t.cwd??ed.value?.cwd??``),r=U(()=>t.deviceId??Ju.value),i=U(()=>Ef(r.value||`?`,n.value||`?`)),a=U(()=>i.value.status),o=U(()=>i.value.loading),s=U(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0));return Of(r.value||`?`,n.value||`?`),Kr(()=>Of(r.value||`?`,n.value||`?`)),M([r,n],()=>void Of(r.value||`?`,n.value||`?`)),(e,t)=>a.value?.repo||o.value?(I(),L(`span`,Mv,[z(`button`,{class:`crumb git-chip`,title:a.value?`${a.value.root} · ${a.value.head??``} ${a.value.subject??``} — opens the Git tab`:`loading git…`,onClick:t[0]||=e=>A(zd)(`git`)},[B(A(xc),{size:16,"aria-hidden":`true`}),z(`span`,Pv,D(a.value?.branch??a.value?.head??`…`),1),s.value?(I(),L(`span`,Fv,`±`+D(s.value),1)):H(``,!0),a.value?.ahead?(I(),L(`span`,Iv,`↑`+D(a.value.ahead),1)):H(``,!0),a.value?.behind?(I(),L(`span`,Lv,`↓`+D(a.value.behind),1)):H(``,!0),B(A(nc),{size:14,"aria-hidden":`true`})],8,Nv)])):H(``,!0)}}),[[`__scopeId`,`data-v-bcb198d0`]]),zv=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,Bv=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Vv={enabled:!0,reserveTokens:16384,backgroundTokens:32768,keepRecentTokens:2e3},Hv={auto:2e5,wait:25e4};function Uv(e){if(!(e>0))return{...Vv};let t=Math.min(Hv.wait,e-Vv.reserveTokens),n=Math.min(Hv.auto,t-Vv.backgroundTokens);return{...Vv,reserveTokens:e-t,backgroundTokens:t-n}}function Wv(e,t){let n=Math.max(0,e-t.reserveTokens);return{wait:n,auto:t.backgroundTokens>0?Math.max(0,n-t.backgroundTokens):void 0}}var Gv=(e,t)=>{if(e===void 0)throw Error(`No ${t} selected`);return e},Kv=[{name:`compact`,args:`[instructions]`,description:`Summarize older context; stored entries stay`,run:async e=>{await Gv(nd.value,`agent`).compact(e||void 0),Y(`Compaction requested. /tasks shows its outcome.`)}},{name:`reset`,args:`[handoff note]`,description:`Start a fresh context; history stays stored`,run:async e=>{await Gv(nd.value,`agent`).reset(e||void 0),Y(`New context started.`)}},{name:`tasks`,description:`Open the Tasks panel`,run:()=>zd(`tasks`)},{name:`new`,args:`[name]`,description:`New agent in this workspace`,run:async e=>{let t=Gv(q.value,`workspace`),n=await Gv(rd.value,`workspace`).createAgent({name:e||`Agent ${pd.value.length+1}`});id({...t,agentId:n.id}),Y(`New agent ${n.name}.`)}},{name:`fork`,args:`[entryId] [name]`,description:`Fork at an entry (default: the last reply)`,run:async e=>{let[t,...n]=e.split(/\s+/).filter(Boolean),r=t&&/^\d+$/.test(t)?Number(t):void 0,i=(r===void 0?[t,...n]:n).filter(Boolean).join(` `),a=r??fd.value.entries.filter(e=>e.kind===`pi.assistant`).at(-1)?.id;if(a===void 0)throw Error(`Nothing to fork yet`);let o=Gv(q.value,`agent`),s=await Gv(nd.value,`agent`).fork({entryId:a,name:i||void 0});id({...o,agentId:s.id}),Y(`Forked at entry #${a}. App State stays shared.`)}},{name:`name`,args:`<name>`,description:`Rename this agent`,run:async e=>{if(!e)throw Error(`Usage: /name <name>`);await Gv(nd.value,`agent`).rename(e),Y(`Agent renamed to ${e}.`)}},{name:`model`,description:`Choose this agent's model`,run:()=>J.dialog={kind:`models`}},{name:`thinking`,args:`<level>`,description:`Thinking level: ${Bv.join(`, `)}`,run:async e=>{if(!Bv.includes(e))throw Error(`Levels: ${Bv.join(`, `)}`);await Gv(nd.value,`agent`).configure({thinkingLevel:e}),await Cd(),Y(`Thinking ${e}. Used on the next turn.`)}},{name:`help`,description:`How this works, keys and commands`,run:()=>J.dialog={kind:`help`}}];function qv(e){let t=e.trim().match(/^\/(\S+)\s*([\s\S]*)$/),n=t&&Kv.find(e=>e.name===t[1]);return n?{command:n,arg:t[2].trim()}:void 0}var Jv={class:`composer-region`},Yv={key:0,class:`queue`},Xv=[`aria-label`,`onClick`],Zv={class:`composer`},Qv={key:0,class:`slash-menu`,role:`listbox`,"aria-label":`Slash commands`},$v=[`aria-selected`,`onMousedown`],ey={key:0,class:`slash-args`},ty={class:`slash-desc`},ny={class:`composer-toolbar`},ry={class:`composer-left`},iy={class:`lib-wrap`},ay=[`aria-label`],oy={key:0,class:`hint`},sy={class:`save-row`},cy=[`disabled`],ly=[`title`,`onClick`],uy=[`aria-label`,`onClick`],dy={class:`queue-mode`},fy={class:`composer-right`},py=[`disabled`],my=[`disabled`],hy=`dpi-prompt-library`,gy=of(N({__name:`Composer`,setup(e){let t=k(`followUp`),n=k(!1),r=k(``),i=k([]),a=()=>{try{i.value=JSON.parse(localStorage.getItem(hy)??`[]`)}catch{i.value=[]}},o=()=>localStorage.setItem(hy,JSON.stringify(i.value));a();let s=()=>{let e=J.composer.trim(),t=r.value.trim()||e.slice(0,24)||`snippet`;e&&(i.value=[{name:t,text:e},...i.value.filter(e=>e.name!==t)].slice(0,30),o(),r.value=``)},c=e=>{i.value=i.value.filter(t=>t.name!==e),o()},l=k(!1),u=U(()=>Xu.value&&fd.value.ready&&Qu.status.value===`live`&&Bu.value===`live`),d=k(0),f=k(!1),p=U(()=>{let e=J.composer.match(/^\/(\S*)$/);return e&&!f.value?Kv.filter(t=>t.name.startsWith(e[1].toLowerCase())):[]});M(()=>J.composer,()=>{d.value=0,J.composer.startsWith(`/`)||(f.value=!1)});async function m(e,t=!1){!e.args||t&&e.args.startsWith(`[`)&&J.composer===`/${e.name}`?(J.composer=`/${e.name}`,await _()):J.composer=`/${e.name} `}function h(e){if(!p.value.length){e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),_());return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){let t=p.value.length;d.value=(d.value+(e.key===`ArrowDown`?1:t-1))%t}else if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)m(p.value[d.value],e.key===`Enter`);else if(e.key===`Escape`)f.value=!0;else return;e.preventDefault(),e.stopPropagation()}async function g(e){let t=qv(e);return t?(l.value=!0,await Od(async()=>{await t.command.run(t.arg),J.composer=``}),l.value=!1,!0):!1}async function _(){let e=J.composer.trim(),n=nd.value;if(!e||l.value||!n||!u.value||e.startsWith(`/`)&&await g(e))return;l.value=!0;let r=q.value,i=`${r.deviceId}/${r.sessionId}/${r.agentId}`,a;try{a=JSON.parse(sessionStorage.getItem(`dpi.pending-send`)??`null`)}catch{}let o=a?.key===i&&a.content===e&&a.mode===t.value?a.requestId:zv();sessionStorage.setItem(`dpi.pending-send`,JSON.stringify({key:i,content:e,mode:t.value,requestId:o})),await Od(async()=>{await n.send(e,t.value,o),sessionStorage.removeItem(`dpi.pending-send`),J.composer=``}),l.value=!1}function v(e){Od(()=>nd.value.withdraw(e))}return(e,a)=>(I(),L(`div`,Jv,[A(fd).inbox.length?(I(),L(`div`,Yv,[(I(!0),L(F,null,P(A(fd).inbox,e=>(I(),L(`div`,{key:e.id},[B(A(oc),{size:18}),z(`span`,null,D(e.mode===`steer`?`Steer`:`Queued`)+`: `+D(e.content??`Context update`),1),z(`button`,{class:`icon-button`,"aria-label":`Withdraw submission ${e.id}`,title:`Withdraw queued input`,onClick:t=>v(e.id)},[B(A(xl),{size:18})],8,Xv)]))),128))])):H(``,!0),z(`div`,Zv,[p.value.length?(I(),L(`ul`,Qv,[(I(!0),L(F,null,P(p.value,(e,t)=>(I(),L(`li`,{key:e.name,role:`option`,"aria-selected":t===d.value,class:E({active:t===d.value}),onMousedown:ks(t=>m(e),[`prevent`])},[z(`code`,null,`/`+D(e.name),1),e.args?(I(),L(`span`,ey,D(e.args),1)):H(``,!0),z(`span`,ty,D(e.description),1)],42,$v))),128))])):H(``,!0),j(z(`textarea`,{"onUpdate:modelValue":a[0]||=e=>A(J).composer=e,rows:`2`,placeholder:`Give your agent something to do, or type / for commands…`,"aria-label":`Message your agent`,onKeydown:h},null,544),[[ys,A(J).composer]]),z(`div`,ny,[z(`div`,ry,[z(`div`,iy,[z(`button`,{type:`button`,class:`icon-button`,"aria-label":`Prompt library (${i.value.length})`,title:`Prompt library — saved snippets`,onClick:a[1]||=e=>n.value=!n.value},[B(A(Mc),{size:18})],8,ay),n.value?(I(),L(`div`,{key:0,class:`lib`,onClick:a[4]||=ks(()=>{},[`stop`])},[z(`header`,null,[a[7]||=z(`b`,null,`Prompts`,-1),z(`button`,{class:`icon-button`,"aria-label":`Close library`,onClick:a[2]||=e=>n.value=!1},[B(A(xl),{size:14})])]),i.value.length?H(``,!0):(I(),L(`p`,oy,`Type something below, give it a name, save it.`)),z(`div`,sy,[j(z(`input`,{"onUpdate:modelValue":a[3]||=e=>r.value=e,placeholder:`name…`,onKeyup:js(s,[`enter`])},null,544),[[ys,r.value]]),z(`button`,{type:`button`,class:`small`,disabled:!A(J).composer.trim(),onClick:s},`save composer as`,8,cy)]),z(`ul`,null,[(I(!0),L(F,null,P(i.value,e=>(I(),L(`li`,{key:e.name},[z(`button`,{type:`button`,class:`use`,title:e.text,onClick:t=>(A(J).composer=e.text,n.value=!1)},[z(`b`,null,D(e.name),1)],8,ly),z(`button`,{type:`button`,class:`icon-button`,"aria-label":`Delete ${e.name}`,onClick:t=>c(e.name)},[B(A(ml),{size:13})],8,uy)]))),128))])])):H(``,!0)]),z(`div`,dy,[j(z(`select`,{"onUpdate:modelValue":a[5]||=e=>t.value=e,"aria-label":`When busy`,title:`Follow-up waits for this run. Steer joins after a tool round.`},[...a[8]||=[z(`option`,{value:`followUp`},`Follow-up`,-1),z(`option`,{value:`steer`},`Steer`,-1),z(`option`,{value:`reject`},`Reject if busy`,-1)]],512),[[Ss,t.value]]),B(A(nc),{size:24,"aria-hidden":`true`})])]),z(`div`,fy,[z(`button`,{class:`interrupt`,disabled:!A(gd)||A(Pd),title:`Stop foreground work and owned subagents (Escape). Background jobs continue.`,onClick:a[6]||=(...e)=>A(Fd)&&A(Fd)(...e)},[B(A(Vc),{size:24,class:`stop-sign`,fill:`currentColor`}),a[9]||=V(`Interrupt`,-1)],8,py),z(`button`,{class:`send`,"aria-label":`Send message`,disabled:!A(J).composer.trim()||l.value||!u.value,onClick:_},[B(A(Js),{size:20})],8,my)])])]),a[10]||=z(`div`,{class:`composer-footnote`},[z(`span`,null,[z(`i`,{class:`live-dot`}),V(`Closing this window never interrupts your agent.`)])],-1)]))}}),[[`__scopeId`,`data-v-a629c9d8`]]),_y={class:`chat-panel`},vy={class:`chat-header`},yy={class:`lineage-picker`},by={class:`lineage-toolbar`},xy=[`title`],Sy={class:`crumb-main`},Cy={class:`device-chip`},wy=[`title`],Ty={class:`crumb-main`},Ey={class:`crumb-name`},Dy=[`aria-current`,`title`,`onClick`],Oy={class:`crumb-kind`},ky={class:`crumb-main`},Ay={class:`crumb-name`},jy=[`disabled`],My=[`aria-expanded`],Ny={key:0,class:`lineage-source`},Py={id:`conversation-picker`,class:`conversation-picker`,role:`dialog`,"aria-label":`Choose conversation`},Fy=[`aria-label`,`aria-current`,`onClick`],Iy={class:`conversation-choice-content`},Ly={class:`choice-lineage`},Ry={class:`choice-source`},zy={key:0,class:`agent-stream-status`,role:`alert`},By=[`disabled`],Vy={key:0,class:`chat-empty`},Hy={key:0},Uy={key:1},Wy={key:0,class:`chat-empty`},Gy={class:`starter-grid`},Ky={key:1,class:`entry live-generation`},qy={class:`message-label`},Jy={class:`streaming`},Yy={key:2,class:`hint retry-note`},Xy=N({__name:`AgentView`,setup(e){let t=k(),n=k(),r=k(!1),i=U(()=>fd.value.items),a=U(()=>i.value.some(e=>e.kind===`assistant`&&e.streaming)),o=U(()=>i.value.some(e=>e.kind===`tool`&&e.call.status===`running`||e.kind===`assistant`&&e.blocks.some(e=>e.type===`tool`&&e.call.status===`running`))),s=e=>e.kind===`fork`?`Forked from agent #${e.parentId} at entry #${e.forkedAt}`:e.kind===`subagent`?`Owned by agent #${e.ownerAgentId}`:`Root agent`,c=U(()=>pd.value.map(e=>({...e,lineage:Yl(pd.value,e.id)})).sort((e,t)=>{for(let n=0;n<Math.min(e.lineage.length,t.lineage.length);n++)if(e.lineage[n].id!==t.lineage[n].id)return e.lineage[n].id-t.lineage[n].id;return e.lineage.length-t.lineage.length})),l=U(()=>md.value.at(-1)),u=e=>e.kind===`root`?`agent`:e.kind;function d(){q.value&&(Ku.tree=!0,sd(q.value.deviceId,!0))}function f(){let e=pd.value.find(e=>e.kind===`root`)??pd.value[0];e&&p(e.id)}function p(e){r.value=!1,q.value&&id({...q.value,agentId:e})}function m(e){let t=nd.value,n=q.value;t&&n&&(J.dialog={kind:`prompt`,title:`Fork conversation`,hint:`${l.value?.name??`Agent #${n.agentId}`} / entry #${e}. Leave the name blank to use Fork #ID.`,label:`Fork name`,optional:!0,placeholder:`e.g. Alternative approach`,submit:`Create fork`,run:async r=>{let i=await t.fork({entryId:e,name:r||void 0});id({...n,agentId:i.id}),Y(`Forked at entry #${e}. App State stays shared.`)}})}function h(){let e=nd.value,t=l.value;e&&t&&(J.dialog={kind:`prompt`,title:`Rename agent`,label:`Agent name`,value:t.named?t.name:``,placeholder:t.name,submit:`Save name`,run:t=>e.rename(t)})}M(q,()=>{r.value=!1});let g=!0;return M(Qu.version,()=>{let e=t.value;g=!e||e.scrollHeight-e.scrollTop-e.clientHeight<120},{flush:`pre`}),M(Qu.version,()=>{g&&An(()=>t.value?.scrollTo({top:t.value.scrollHeight,behavior:`instant`}))}),M(()=>md.value.length,()=>void An(()=>n.value&&(n.value.scrollLeft=n.value.scrollWidth))),(e,g)=>(I(),L(`section`,_y,[z(`header`,vy,[z(`div`,yy,[z(`div`,by,[z(`nav`,{ref_key:`lineageNav`,ref:n,class:`crumbs conversation-lineage`,"aria-label":`Conversation lineage`},[z(`button`,{class:`crumb`,title:`${A(Yu)?.name} · ${A(Yu)?.url}`,onClick:d},[g[5]||=z(`span`,{class:`crumb-kind`},`device`,-1),z(`span`,Sy,[B(pf,{device:A(Yu),size:18},null,8,[`device`]),z(`span`,Cy,D(A(Yu)?.name??A(Yu)?.id),1)])],8,xy),B(A(rc),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),z(`button`,{class:`crumb`,title:A(ed)?.cwd,onClick:f},[g[6]||=z(`span`,{class:`crumb-kind`},`workspace`,-1),z(`span`,Ty,[B(A(yc),{size:18,"aria-hidden":`true`}),z(`span`,Ey,D(A(ed)?.name),1)])],8,wy),A(ed)?.cwd?(I(),R(Rv,{key:0})):H(``,!0),(I(!0),L(F,null,P(A(md),e=>(I(),L(F,{key:e.id},[B(A(rc),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),z(`button`,{class:E([`crumb`,{current:e.id===A(q)?.agentId}]),"aria-current":e.id===A(q)?.agentId?`page`:void 0,title:s(e),onClick:t=>p(e.id)},[z(`span`,Oy,D(u(e)),1),z(`span`,ky,[e.kind===`fork`?(I(),R(A(Cc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`subagent`?(I(),R(A(cc),{key:1,size:18,"aria-hidden":`true`})):(I(),R(A(Lc),{key:2,size:18,"aria-hidden":`true`})),z(`span`,Ay,D(e.name),1)])],10,Dy)],64))),128))],512),z(`button`,{class:`icon-button`,"aria-label":`Rename agent`,title:`Rename this agent`,disabled:!l.value,onClick:h},[B(A(qc),{size:18})],8,jy),z(`button`,{class:`icon-button conversation-menu-toggle`,"aria-label":`Browse conversations`,"aria-haspopup":`dialog`,"aria-expanded":r.value,"aria-controls":`conversation-picker`,title:`Browse roots and forks`,onClick:g[0]||=e=>r.value=!r.value},[B(A(nc),{size:18})],8,My)]),l.value&&l.value.kind!==`root`?(I(),L(`div`,Ny,D(s(l.value)),1)):H(``,!0),r.value?(I(),L(F,{key:1},[z(`button`,{class:`conversation-menu-dismiss`,"aria-label":`Close conversation picker`,onClick:g[1]||=e=>r.value=!1}),z(`section`,Py,[g[7]||=z(`div`,{class:`conversation-picker-heading`},`Roots & forks`,-1),(I(!0),L(F,null,P(c.value,e=>(I(),L(`button`,{key:e.id,class:E([`conversation-choice`,{selected:e.id===A(q)?.agentId}]),"aria-label":e.lineage.map(e=>e.name).join(` → `),"aria-current":e.id===A(q)?.agentId?`page`:void 0,onClick:t=>p(e.id)},[z(`div`,Iy,[z(`span`,Ly,[(I(!0),L(F,null,P(e.lineage,(t,n)=>(I(),L(F,{key:t.id},[n?(I(),R(A(rc),{key:0,size:18,"aria-hidden":`true`})):H(``,!0),z(`span`,{class:E({"choice-ancestor":n<e.lineage.length-1})},D(t.name),3)],64))),128))]),z(`span`,Ry,D(s(e)),1)]),e.id===A(q)?.agentId?(I(),R(A(tc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`fork`?(I(),R(A(Cc),{key:1,size:18,"aria-hidden":`true`})):(I(),R(A(Lc),{key:2,size:18,"aria-hidden":`true`}))],10,Fy))),128))])],64)):H(``,!0)])]),A(Qu).fault.value||A(Qu).status.value===`fault`||A(Qu).status.value===`reconnecting`||A(fd).ready&&A(Qu).status.value===`connecting`?(I(),L(`div`,zy,[z(`div`,null,[z(`strong`,null,D(A(fd).ready?`Cached transcript is stale.`:`Agent stream unavailable.`),1),z(`p`,null,D(A(Qu).fault.value||`Updates are paused while the stream reconnects.`),1),g[8]||=z(`p`,null,`Sending is paused until a fresh snapshot arrives. Your draft is kept.`,-1)]),z(`button`,{disabled:A(Qu).status.value===`connecting`,onClick:g[2]||=(...e)=>A(Qu).retry&&A(Qu).retry(...e)},` Retry stream `,8,By)])):H(``,!0),z(`div`,{ref_key:`chat`,ref:t,class:`chat-scroll`,"data-testid":`chat`},[A(fd).ready?(I(),L(F,{key:1},[i.value.length?H(``,!0):(I(),L(`div`,Wy,[g[13]||=z(`div`,{class:`agent-orb`},[z(`img`,{src:`/icons/durable-pi.svg`,alt:`Durable Pi`}),z(`i`)],-1),g[14]||=z(`span`,{class:`eyebrow`},`YOUR DURABLE AGENT IS READY`,-1),g[15]||=z(`h2`,null,`A conversation with continuity.`,-1),z(`p`,null,`Messages, tools and state live on `+D(A(Yu)?.id)+`, beyond this window.`,1),z(`div`,Gy,[z(`button`,{onClick:g[3]||=e=>A(kd)(`Inspect this directory using your tools and give me a brief overview. Do not modify any files.`)},[B(A(yc),{size:18}),g[9]||=z(`strong`,null,`Explore this directory`,-1),g[10]||=z(`span`,null,`See coding tools in action`,-1),B(A(qs),{size:18})]),z(`button`,{onClick:g[4]||=e=>A(kd)(`Use read_state, then update_state to add a field called progress with value 1 and a boolean called ready with value false.`)},[B(A(Qs),{size:18}),g[11]||=z(`strong`,null,`Make a state change`,-1),g[12]||=z(`span`,null,`Watch the workspace update`,-1),B(A(qs),{size:18})])])])),(I(!0),L(F,null,P(i.value,e=>(I(),R(jv,{key:e.id,item:e,onFork:m},null,8,[`item`]))),128)),A(fd).running&&!a.value&&!o.value?(I(),L(`div`,Ky,[z(`div`,qy,[g[16]||=V(` AGENT `,-1),z(`span`,Jy,D(A(fd).retry?`Retry scheduled`:`Working`),1)]),g[17]||=z(`div`,{class:`typing`},[z(`i`),z(`i`),z(`i`)],-1)])):H(``,!0),A(fd).retry?(I(),L(`p`,Yy,` Retrying: `+D(A(fd).retry.error),1)):H(``,!0),(I(!0),L(F,null,P(A(fd).notices,(e,t)=>(I(),L(`p`,{key:t,class:`message-error`},D(e),1))),128))],64)):(I(),L(`div`,Vy,[B(A(Vs),{size:30}),A(Qu).status.value===`fault`?(I(),L(`h2`,Hy,`This agent is unavailable.`)):(I(),L(`h2`,Uy,`Connecting to the agent…`)),z(`p`,null,`The agent keeps working on `+D(A(Yu)?.id)+` while this view connects.`,1)]))],512),B(gy)]))}});function Zy(e,t){return`${e}/${t.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}function Qy(e){if(e===``)return[];if(!e.startsWith(`/`))throw Error(`Use a JSON Pointer path, such as /counter`);return e.slice(1).split(`/`).map(e=>{if(/~(?![01])/u.test(e))throw Error(`Invalid JSON Pointer escape`);let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if([`__proto__`,`constructor`,`prototype`].includes(t))throw Error(`Reserved field name`);return t})}function $y(e,t){if(typeof e!=`object`||!e||!Object.hasOwn(e,t))throw Error(`Field does not exist: ${t}`);if(Array.isArray(e)&&!/^(0|[1-9]\d*)$/u.test(t))throw Error(`Invalid array index`);return e[t]}function eb(e,t=0){if(t>24)throw Error(`State is too deeply nested`);if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&!(typeof e==`number`&&Number.isFinite(e))){if(typeof e!=`object`||!e)throw Error(`Value must be valid JSON`);for(let[n,r]of Object.entries(e)){if([`__proto__`,`constructor`,`prototype`].includes(n))throw Error(`Reserved field name`);eb(r,t+1)}}}function tb(e,t){if(![`create`,`update`,`delete`,`increment`].includes(t.operation))throw Error(`Invalid state operation`);if(typeof t.path!=`string`)throw Error(`State path is required`);let n=Qy(t.path),r=JSON.parse(JSON.stringify(e));if(!n.length){if(t.operation===`delete`)return{};if(t.operation!==`update`||t.value===null||Array.isArray(t.value)||typeof t.value!=`object`)throw Error(`The state root must be a JSON object. Use update to replace it.`);if(eb(t.value),JSON.stringify(t.value).length>1e5)throw Error(`App State must be under 100,000 characters`);return JSON.parse(JSON.stringify(t.value))}let i=n.pop(),a=n.reduce($y,r);if(typeof a!=`object`||!a)throw Error(`Parent must be an object or array`);let o=Object.hasOwn(a,i),s=Array.isArray(a),c=s&&(i===`-`||i===String(a.length));if(s&&!c&&(!/^(0|[1-9]\d*)$/u.test(i)||Number(i)>=a.length))throw Error(`Invalid array index`);if(t.operation===`create`&&o)throw Error(`Field already exists. Use update.`);if(t.operation!==`create`&&!o)throw Error(`Field does not exist. Use create.`);if(t.operation===`delete`)s?a.splice(Number(i),1):delete a[i];else{let e=t.value;if(t.operation===`increment`){let t=a[i];if(typeof t!=`number`||typeof e!=`number`)throw Error(`Increment requires numbers`);e=t+e}eb(e),s?a[c?a.length:Number(i)]=e:a[i]=e}if(eb(r),JSON.stringify(r).length>1e5)throw Error(`App State must be under 100,000 characters`);return r}var nb=[`data-state-path`],rb={key:0,class:`state-field-heading`},ib=[`value`,`aria-label`,`disabled`],ab=[`value`],ob=[`aria-label`,`disabled`],sb=[`aria-label`,`disabled`],cb=[`aria-label`,`disabled`],lb=[`value`],ub=[`disabled`],db=[`disabled`,`aria-label`],fb={key:2,class:`state-number`},pb=[`aria-label`,`disabled`],mb=[`aria-label`,`disabled`],hb=[`aria-label`,`disabled`],gb={key:3,class:`state-boolean`},_b=[`aria-label`,`aria-checked`,`disabled`],vb=[`aria-label`,`disabled`],yb={key:5,class:`muted`},bb=N({__name:`StateEditor`,props:{value:{type:[String,Number,Boolean,null,Array,Object]},path:{default:``},label:{default:`App State`},disabled:{type:Boolean}},emits:[`change`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>n.value===null?`null`:Array.isArray(n.value)?`array`:typeof n.value),a=U(()=>i.value===`object`||i.value===`array`),o=U(()=>a.value?Object.entries(n.value):[]),s=k(``),c=k(!1),l=k(``),u=k(`string`),d=k(!1),f=[`string`,`number`,`boolean`,`object`,`array`,`null`],p={string:()=>``,number:()=>0,boolean:()=>!1,object:()=>({}),array:()=>[],null:()=>null};M(()=>n.value,e=>{c.value||(s.value=String(e??``))},{immediate:!0});function m(e,t){r(`change`,{operation:e,path:n.path,value:t})}function h(){c.value=!1;let e=i.value===`number`?Number(s.value):s.value;if(i.value===`number`&&(!String(s.value).trim()||!Number.isFinite(e))){s.value=String(n.value);return}e!==n.value&&m(`update`,e)}function g(){let e=i.value===`array`?`-`:l.value.trim();e&&(r(`change`,{operation:`create`,path:Zy(n.path,e),value:p[u.value]()}),l.value=``,d.value=!1)}return(t,n)=>{let _=Zr(`StateEditor`,!0);return I(),L(`div`,{class:E([`state-field`,{"state-root":e.path===``}]),"data-state-path":e.path},[e.path===``?H(``,!0):(I(),L(`div`,rb,[z(`strong`,null,D(e.label),1),z(`select`,{value:i.value,"aria-label":`Type of ${e.path}`,disabled:e.disabled,onChange:n[0]||=e=>m(`update`,p[e.target.value]())},[(I(),L(F,null,P(f,e=>z(`option`,{key:e,value:e},D(e),9,ab)),64))],40,ib),z(`button`,{class:`icon-button`,"aria-label":`Delete ${e.path}`,title:`Delete field`,disabled:e.disabled,onClick:n[1]||=e=>m(`delete`)},[B(A(ml),{size:18})],8,ob)])),a.value?(I(),L(F,{key:1},[(I(!0),L(F,null,P(o.value,([t,i])=>(I(),R(_,{key:t,value:i,path:A(Zy)(e.path,t),label:t,disabled:e.disabled,onChange:n[2]||=e=>r(`change`,e)},null,8,[`value`,`path`,`label`,`disabled`]))),128)),d.value?(I(),L(`form`,{key:0,class:`state-add`,onSubmit:ks(g,[`prevent`])},[i.value===`array`?H(``,!0):j((I(),L(`input`,{key:0,"onUpdate:modelValue":n[3]||=e=>l.value=e,placeholder:`Field name`,"aria-label":`New field name in ${e.path||`/`}`,required:``,disabled:e.disabled},null,8,sb)),[[ys,l.value]]),j(z(`select`,{"onUpdate:modelValue":n[4]||=e=>u.value=e,"aria-label":`New field type in ${e.path||`/`}`,disabled:e.disabled},[(I(),L(F,null,P(f,e=>z(`option`,{key:e,value:e},D(e),9,lb)),64))],8,cb),[[Ss,u.value]]),z(`button`,{class:`secondary small`,disabled:e.disabled||i.value!==`array`&&!l.value.trim()},` Add `,8,ub),z(`button`,{type:`button`,class:`text-button`,onClick:n[5]||=e=>d.value=!1},`Cancel`)],32)):(I(),L(`button`,{key:1,class:`text-button state-add-button`,disabled:e.disabled,"aria-label":`Add ${i.value===`array`?`item`:`field`} to ${e.path||`/`}`,onClick:n[6]||=e=>d.value=!0},[B(A(Xc),{size:18}),V(D(i.value===`array`?`Add item`:`Add field`),1)],8,db))],64)):i.value===`number`?(I(),L(`div`,fb,[z(`button`,{class:`secondary`,"aria-label":`Decrement ${e.path}`,disabled:e.disabled,onClick:n[7]||=e=>m(`increment`,-1)},[B(A(Rc),{size:18})],8,pb),j(z(`input`,{"onUpdate:modelValue":n[8]||=e=>s.value=e,type:`number`,step:`any`,"aria-label":`Value of ${e.path}`,disabled:e.disabled,onFocus:n[9]||=e=>c.value=!0,onBlur:h,onKeydown:n[10]||=js(e=>e.target.blur(),[`enter`])},null,40,mb),[[ys,s.value]]),z(`button`,{class:`secondary`,"aria-label":`Increment ${e.path}`,disabled:e.disabled,onClick:n[11]||=e=>m(`increment`,1)},[B(A(Xc),{size:18})],8,hb)])):i.value===`boolean`?(I(),L(`div`,gb,[z(`button`,{class:E([`switch`,{on:e.value===!0}]),role:`switch`,"aria-label":`Value of ${e.path}`,"aria-checked":e.value===!0,disabled:e.disabled,onClick:n[12]||=t=>m(`update`,!e.value)},[...n[15]||=[z(`span`,null,null,-1)]],10,_b),z(`span`,null,D(e.value),1)])):i.value===`string`?j((I(),L(`textarea`,{key:4,"onUpdate:modelValue":n[13]||=e=>s.value=e,rows:`2`,"aria-label":`Value of ${e.path}`,disabled:e.disabled,onFocus:n[14]||=e=>c.value=!0,onBlur:h},null,40,vb)),[[ys,s.value]]):(I(),L(`span`,yb,`null`))],10,nb)}}}),xb=[`data-status`],Sb=[`title`],Cb=[`title`],wb=[`href`],Tb=[`title`],Eb=N({__name:`TunnelStatusBar`,props:{device:{}},setup(e){let t=e,n=U(()=>t.device.status===`online`),r=U(()=>t.device.transport===`tunnel`),i=U(()=>n.value?r.value?`online · via tunnel`:`online · LAN`:r.value?`tunnel`:`LAN`),a=U(()=>t.device.tunnel?.state===`connected`);return(t,o)=>(I(),L(`span`,{class:`tunnel-status`,"data-status":e.device.status},[z(`span`,{class:`axis transport`,title:r.value?`Hub ⇄ device over the tunnel (WSS)`:`Hub → device over LAN`},[r.value?(I(),R(A($s),{key:0,size:13,class:E({live:a.value})},null,8,[`class`])):(I(),R(A(vl),{key:1,size:13,class:E({live:n.value})},null,8,[`class`])),V(` `+D(i.value),1)],8,Sb),z(`span`,{class:E([`axis monitor`,e.device.status])},[e.device.status===`offline`?(I(),R(A(_l),{key:0,size:13})):(I(),L(F,{key:1},[V(D(e.device.status),1)],64))],2),r.value&&a.value&&e.device.tunnel?(I(),L(`span`,{key:0,class:`axis muted`,title:`tunnel last seen ${A(Nd)(e.device.tunnel.lastSeenAt)}`},D(e.device.tunnel.readerCount)+` reader`+D(e.device.tunnel.readerCount===1?``:`s`),9,Cb)):H(``,!0),e.device.url?(I(),L(`a`,{key:1,class:`axis url`,href:e.device.url,target:`_blank`,rel:`noreferrer`},D(e.device.url),9,wb)):H(``,!0),e.device.lastSeenAt?(I(),L(`span`,{key:2,class:`axis muted`,title:`last probe ${A(Nd)(e.device.lastSeenAt)}`},D(A(Nd)(e.device.lastSeenAt)),9,Tb)):H(``,!0)],8,xb))}});async function Db(e,t,n,r,i){let a=await fetch(`/api${t}`,{method:e,headers:n===void 0?{}:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n),signal:r,...i?{keepalive:i}:{}}),o=await a.json().catch(()=>void 0);if(!a.ok){let e=o?.error;throw new Sl(e?.code??`internal`,e?.message??`${a.status} ${a.statusText}`,a.status)}return o}function Ob(e){return e.offerUrl??e.pairUrl}var kb={pending:e=>Db(`GET`,`/pair/codes`,void 0,e),pairings:e=>Db(`GET`,`/pairings`,void 0,e),createCode:e=>Db(`POST`,`/pair/code`,{},e),resolveCode:(e,t)=>Db(`POST`,`/pair/resolve`,{code:e},t),codeState:(e,t)=>Db(`GET`,`/pair/codes/${encodeURIComponent(e)}`,void 0,t),approve:(e,t,n)=>Db(`POST`,`/pair/codes/${encodeURIComponent(e)}/approve`,t,n),cancel:(e,t,n)=>Db(`POST`,`/pair/codes/${encodeURIComponent(e)}/cancel`,{},t,n),rotate:(e,t)=>Db(`POST`,`/pairings/${encodeURIComponent(e)}/rotate`,{},t),revoke:(e,t=`user`,n)=>Db(`POST`,`/pairings/${encodeURIComponent(e)}/revoke`,{reason:t},n)},Ab=0;function jb(){let e=++Ab,t=!1;return{gen:e,close:()=>t=!0,closed:()=>t}}var Mb=class extends Error{codeId;constructor(e){super(`pairing poll timed out for ${e}`),this.codeId=e,this.name=`PollTimeout`}},Nb=e=>e===`issued`||e===`cancelled`||e===`expired`;async function Pb(e,t,n={}){let r=n.intervalMs??1e3,i=Date.now()+(n.timeoutMs??33e4);for(;;){if(e.closed())return;if(n.signal?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);if(Date.now()>i)throw new Mb(t);let a=await kb.codeState(t,n.signal);if(e.closed())return;if(e.state=a,n.onState?.(a),Nb(a.phase))return a;await new Promise(e=>setTimeout(e,r))}}var Fb={key:0,class:`token-manager`,"aria-label":`Credential manager`},Ib={class:`credential-fingerprint`},Lb=[`title`],Rb={key:0,class:`rotation-badge`,role:`status`},zb={class:`token-actions`},Bb=[`disabled`],Vb=[`disabled`],Hb={key:1,class:`message-error`,role:`alert`},Ub=N({__name:`TokenManager`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=U(()=>t.device.pairing);async function a(){if(!n.value){n.value=!0,r.value=``;try{await kb.rotate(t.device.id),Y(`Rotation queued — it completes when the device acknowledges the new credential.`)}catch(e){r.value=K(e)}finally{n.value=!1}}}async function o(){n.value||(J.dialog={kind:`prompt`,title:`Revoke ${t.device.id}?`,hint:`Every tunnel credential for this device dies at commit and the live tunnel is cut within a second. The device cleans its own files the next time it talks to the hub.`,submit:`Revoke`,danger:!0,run:async()=>{await kb.revoke(t.device.id,`user`),Y(`Revoke committed on the hub. The tunnel is cut; the device cleans up on its next contact.`)}})}return(e,t)=>i.value?(I(),L(`section`,Fb,[z(`header`,null,[B(A(kc),{size:15}),t[0]||=z(`h3`,null,`Credential`,-1),z(`span`,{class:E([`pairing-status`,i.value.status])},D(i.value.status),3)]),z(`dl`,null,[t[1]||=z(`dt`,null,`Key fingerprint`,-1),z(`dd`,null,[z(`code`,Ib,D(i.value.keyFingerprint),1)]),t[2]||=z(`dt`,null,`Paired`,-1),z(`dd`,{title:new Date(i.value.pairedAt).toISOString()},D(A(Nd)(i.value.pairedAt)),9,Lb),t[3]||=z(`dt`,null,`Generation`,-1),z(`dd`,null,D(i.value.credentialGeneration),1)]),i.value.rotationPending?(I(),L(`p`,Rb,[B(A($c),{size:13,class:`spin`}),t[4]||=V(` rotation queued — waiting for the device to ACK `,-1)])):H(``,!0),z(`div`,zb,[i.value.status===`paired`?(I(),L(`button`,{key:0,class:`small`,disabled:n.value||i.value.rotationPending,onClick:a},[B(A($c),{size:14}),t[5]||=V(` Rotate credential `,-1)],8,Bb)):H(``,!0),i.value.status===`paired`?(I(),L(`button`,{key:1,class:`small danger`,disabled:n.value,onClick:o},[B(A(cl),{size:14}),t[6]||=V(` Revoke `,-1)],8,Vb)):H(``,!0)]),r.value?(I(),L(`p`,Hb,D(r.value),1)):H(``,!0)])):H(``,!0)}}),Wb={class:`tasks-panel`},Gb={class:`panel-heading`},Kb={class:`tag`},qb={key:0,class:`message-error`,role:`alert`},Jb={class:`task-section`,"aria-label":`Durable jobs`},Yb={key:0,class:`task-empty`},Xb=[`data-job`],Zb={class:`job-def-head`},Qb={key:0,class:`tag`},$b={class:`tag`},ex=[`aria-label`],tx=[`title`],nx={class:`job-def-meta`},rx=[`title`],ix=[`title`],ax={key:0,class:`job-def-last`},ox=[`onClick`],sx=[`disabled`,`onClick`],cx=[`disabled`,`onClick`],lx=[`disabled`,`onClick`],ux={class:`task-section`,"aria-label":`Agent activity`},dx={class:`panel-heading`},fx={key:0,class:`task-empty`},px={key:1,class:`task-tree`},mx=[`data-task-kind`],hx={class:`tag`},gx={key:0,class:`task-phase`},_x=[`onClick`],vx=[`disabled`],yx={class:`raw`},bx=N({__name:`TasksPanel`,setup(e){let t=k(``),n=k(!1),r=k([]),i=k(),a=e=>({running:`Running`,waiting:`Waiting`,completed:`Completed`,aborted:`Stopped`,declined:`Declined`,failed:`Failed`,pending:`Queued`,completing:`Finishing`,terminal:`Finished`})[e]??e,o=U(()=>new Map(__.value.map(e=>[e.id,y_.value.find(t=>t.job===e.id)]))),s=U(()=>{let e=hd.value,t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e){let e=r.owner!==void 0&&t.has(r.owner)?r.owner:void 0;n.set(e,[...n.get(e)??[],r])}let r=[],i=(e,t)=>{for(let a of(n.get(e)??[]).sort((e,t)=>e.id-t.id))r.push({task:a,depth:t}),i(a.id,t+1)};return i(void 0,0),r}),c=e=>e.kind===`pi.tool`?{icon:bl,name:e.label??`Tool call`,what:`tool call`}:e.kind===`pi.generation`?{icon:Zs,name:`Model response`,what:`generation`}:e.kind===`pi.compaction`?{icon:jc,name:`Compaction`,what:`compaction`}:e.kind.startsWith(`demo.job.`)?{icon:yl,name:e.label??v_(e.kind.slice(9))?.title??e.kind,what:`durable job`}:e.kind===`demo.job-approval`?{icon:sl,name:`Approval`,what:`waits for you`}:{icon:Vs,name:e.label??e.kind,what:e.kind},l=e=>e.state.phase?e.kind.startsWith(`demo.job.`)?v_(e.kind.slice(9))?.phases.find(t=>t.id===e.state.phase)?.label??e.state.phase:e.state.phase:``;async function u(){if(!n.value&&nd.value){n.value=!0,t.value=``;try{await nd.value.abort(!0)}catch(e){t.value=K(e)}finally{n.value=!1}}}async function d(e){let n=rd.value;if(e.target.open&&n)try{let[e,t]=await Promise.all([n.tasks(`terminal`,40),n.inspect()]);r.value=e,i.value=t}catch(e){t.value=K(e)}}let f=U(()=>r.value.filter(e=>e.state.status===`terminal`).slice(-12).reverse());return(e,r)=>(I(),L(`div`,Wb,[z(`div`,Gb,[r[0]||=z(`h2`,null,`Tasks`,-1),z(`span`,Kb,D(A(hd).length)+` active`,1)]),t.value?(I(),L(`p`,qb,D(t.value),1)):H(``,!0),z(`section`,Jb,[z(`h3`,null,[B(A(el),{size:18}),r[1]||=V(`Durable jobs`,-1)]),r[2]||=z(`p`,{class:`hint`},[V(` Repeatable workflows with named phases. Every run follows the same phases and saves a checkpoint after each one. Start one here, or ask your agent: it finds these with `),z(`code`,null,`list_durable_jobs`),V(`, starts them with `),z(`code`,null,`run_durable_job`),V(` and checks them with `),z(`code`,null,`check_durable_job`),V(`. Runs play out live in the chat. `)],-1),A(__).length?H(``,!0):(I(),L(`p`,Yb,` This device has no durable jobs. Deploy the latest backend to it. `)),(I(!0),L(F,null,P(A(__),e=>(I(),L(`article`,{key:e.id,class:`job-def`,"data-job":e.id},[z(`div`,Zb,[B(A(yl),{size:18}),z(`strong`,null,D(e.title),1),e.approval?(I(),L(`span`,Qb,`needs approval`)):H(``,!0),z(`span`,$b,`~`+D(e.seconds)+`s`,1)]),z(`p`,null,D(e.summary),1),z(`ol`,{class:`job-chain`,"aria-label":`${e.title} phases`},[(I(!0),L(F,null,P(e.phases,(e,t)=>(I(),L(`li`,{key:e.id,title:e.summary},[z(`span`,null,D(t+1),1),V(D(e.label),1),e.kind===`repeat`?(I(),R(A(el),{key:0,size:13})):H(``,!0),e.kind===`approval`?(I(),R(A(sl),{key:1,size:13})):H(``,!0)],8,tx))),128))],8,ex),z(`div`,nx,[(I(!0),L(F,null,P(e.inputs,e=>(I(),L(`code`,{key:e.name,title:e.description},D(e.name)+`=`+D(e.default),9,rx))),128)),z(`code`,{title:`Each run saves its result to App State ${e.resultPath}`},`→ `+D(e.resultPath),9,ix)]),o.value.get(e.id)?(I(),L(`div`,ax,[z(`span`,null,[V(`Run #`+D(o.value.get(e.id).run)+`: `,1),z(`strong`,null,D(a(o.value.get(e.id).status)),1),A(g_)(o.value.get(e.id))?H(``,!0):(I(),L(F,{key:0},[V(` in `+D(o.value.get(e.id).phases.find(t=>t.id===o.value.get(e.id).phase)?.label),1)],64))]),z(`button`,{class:`text-button`,onClick:t=>A(E_)(o.value.get(e.id).id)},` Show in chat `,8,ox),o.value.get(e.id).approval===`pending`?(I(),L(F,{key:0},[z(`button`,{class:`primary small`,disabled:!!A(w_),onClick:t=>A(O_)(o.value.get(e.id),!0)},` Approve `,8,sx),z(`button`,{class:`secondary`,disabled:!!A(w_),onClick:t=>A(O_)(o.value.get(e.id),!1)},` Decline `,8,cx)],64)):H(``,!0)])):H(``,!0),z(`button`,{class:`secondary job-def-run`,disabled:!!A(w_)||!A(nd),onClick:t=>A(D_)(e)},[B(A(Yc),{size:16}),V(`Run `+D(e.title),1)],8,lx)],8,Xb))),128))]),z(`section`,ux,[z(`div`,dx,[r[3]||=z(`h3`,null,`Agent activity`,-1),B(A(Vs),{size:18})]),r[5]||=z(`p`,{class:`hint`},` Every model response and every tool call is its own durable task with an id, an owner and a checkpoint. Follow them live here; after a restart each one resumes or reports how it ended. `,-1),s.value.length?(I(),L(`ul`,px,[(I(!0),L(F,null,P(s.value,({task:e,depth:t})=>(I(),L(`li`,{key:e.id,class:`task-row`,style:T({"--depth":t}),"data-task-kind":e.kind},[(I(),R($r(c(e).icon),{size:16})),z(`strong`,null,D(c(e).name),1),z(`span`,hx,D(a(e.state.status)),1),l(e)?(I(),L(`span`,gx,D(l(e)),1)):H(``,!0),z(`small`,null,`#`+D(e.id)+` `+D(c(e).what)+`, agent #`+D(e.conversationId)+D(e.effectiveBackground?`, background`:``),1),(I(!0),L(F,null,P(e.conversations,e=>(I(),L(`button`,{key:e,class:`text-button`,onClick:t=>A(A_)(e)},` Open agent #`+D(e),9,_x))),128))],12,mx))),128))])):(I(),L(`p`,fx,`Nothing running. Send a message or run a job.`)),r[6]||=z(`p`,{class:`hint`},` Interrupt or Esc stops foreground work and what it owns. Stop all also stops background runs. `,-1),z(`button`,{class:`secondary danger`,disabled:!A(hd).length||n.value,onClick:u},[B(A(Vc),{size:18}),r[4]||=V(`Stop all `,-1)],8,vx)]),z(`details`,{class:`raw task-section`,onToggle:d},[z(`summary`,null,[B(A(oc),{size:18}),r[7]||=V(`Runtime details`,-1)]),r[9]||=z(`p`,{class:`hint`},` Recent task results and recovery records, read from the device when opened. `,-1),(I(!0),L(F,null,P(f.value,e=>(I(),L(`details`,{key:e.id,class:`raw`},[z(`summary`,null,[V(D(e.kind)+` #`+D(e.id),1),z(`span`,null,D(a(e.state.outcome?.status??e.state.status)),1)]),z(`pre`,null,D(JSON.stringify(e.state.outcome,null,2)),1)]))),128)),z(`details`,yx,[r[8]||=z(`summary`,null,`Recovery inspection`,-1),z(`pre`,null,D(JSON.stringify(i.value,null,2)),1)])],32)]))}}),xx={class:`git-pane`},Sx={key:0,class:`hint`},Cx={key:0,class:`hint`},wx={key:1,class:`muted-line`},Tx={key:2,class:`message-error`},Ex={class:`muted-line`},Dx={key:3,class:`message-error`},Ox={key:0,class:`hint`},kx={key:0,class:`message-error merge-banner`},Ax=[`disabled`],jx={class:`panel-heading git-top`},Mx={class:`branch-wrap`},Nx=[`disabled`],Px={key:0,class:`menu`},Fx=[`onClick`],Ix={class:`muted-line`},Lx={class:`new-branch`},Rx=[`disabled`],zx={class:`auto-stash`},Bx={class:`tag`},Vx={key:0,class:`tag`},Hx={key:1,class:`tag`},Ux={key:2,class:`tag`,title:`vs the picked base`},Wx={class:`tag`},Gx=[`href`],Kx=[`disabled`],qx={class:`row ops`},Jx=[`disabled`],Yx=[`disabled`],Xx=[`disabled`],Zx=[`disabled`],Qx=[`disabled`],$x={key:1,class:`message-error hintbox`},eS=[`disabled`],tS=[`disabled`],nS={key:2,class:`message-error hintbox`},rS=[`disabled`],iS={class:`task-section`,"aria-label":`Commit`},aS={class:`panel-heading`},oS={class:`tag`},sS=[`disabled`],cS=[`disabled`],lS={key:0,class:`hintbox warn`},uS={key:1,class:`cps turns`},dS={key:0,class:`hint`},fS={class:`muted-line`},pS={class:`cp-subj`},mS={key:2,class:`muted-line cap`},hS={key:3,class:`files conflicts`},gS={class:`file all`},_S={class:`muted-line conflict-head`},vS={class:`file-label`},yS={class:`xy`},bS=[`title`],xS={class:`file-acts`},SS=[`onClick`],CS=[`disabled`,`onClick`],wS=[`disabled`,`onClick`],TS={key:4,class:`files`},ES={class:`file all`},DS=[`checked`],OS={class:`muted-line`},kS=[`onClick`],AS={class:`muted-line`},jS={class:`file-label`},MS=[`checked`,`onChange`],NS=[`title`],PS=[`title`],FS={class:`file-acts`},IS=[`onClick`],LS=[`onClick`],RS=[`onClick`],zS={key:5,class:`files`},BS={class:`file all`},VS=[`checked`],HS={class:`muted-line`},US=[`onClick`],WS={class:`muted-line`},GS={class:`file-label`},KS=[`checked`,`onChange`],qS=[`title`],JS=[`title`],YS={class:`file-acts`},XS=[`onClick`],ZS=[`onClick`],QS=[`onClick`],$S=[`onClick`],eC=[`onClick`],tC={key:6,class:`file-diff`},nC={class:`mode-chips`},rC={key:0,class:`nums bin`},iC={key:1,class:`nums`},aC={key:2},oC={class:`row`},sC=[`disabled`],cC=[`disabled`],lC=[`disabled`],uC={class:`task-section`,"aria-label":`Log`},dC={class:`panel-heading`},fC=[`disabled`],pC=[`disabled`],mC=[`disabled`],hC={key:0,class:`cps`},gC={key:0,class:`hint`},_C={class:`muted-line`},vC={class:`cp-subj`},yC=[`disabled`,`onClick`],bC={key:1,class:`hint`},xC={key:2,class:`commits`},SC=[`title`],CC=[`viewBox`],wC=[`x1`,`x2`],TC=[`x1`,`x2`,`stroke`],EC=[`cx`,`fill`],DC=[`onClick`],OC={class:`hash`},kC=[`href`],AC={key:1,class:`refs`},jC={class:`subject`},MC={class:`muted-line who`},NC={key:0,class:`commit-files`},PC=[`data-s`],FC={class:`path`},IC={key:0,class:`hint`},LC={key:3,class:`message-error`},RC={key:4,class:`hint`},zC={class:`task-section`,"aria-label":`Worktrees`},BC={class:`panel-heading`},VC={class:`branch-wrap`},HC=[`disabled`],UC={key:0,class:`menu`},WC=[`onClick`],GC={class:`new-branch`},KC=[`disabled`],qC=[`title`],JC={class:`muted-line`},YC=[`disabled`,`onClick`],XC=[`disabled`,`onClick`],ZC=[`disabled`,`onClick`],QC={key:3,class:`task-section`,"aria-label":`Code review`},$C={class:`panel-heading`},ew=[`href`],tw=[`href`],nw=[`href`],rw={key:0,class:`hint`},iw={class:`panel-heading`},aw=[`disabled`],ow=[`disabled`],sw={key:0,class:`hint`},cw={key:1,class:`commits`},lw={class:`hash`},uw={class:`subject`},dw={class:`muted-line who`},fw=[`disabled`,`onClick`],pw=[`disabled`,`onClick`],mw=[`disabled`,`onClick`],hw=[`href`],gw={key:4,class:`op-out`},_w=[`placeholder`],vw={class:`row`},yw=[`disabled`],bw=of(N({__name:`GitPanel`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=U(()=>t.cwd??ed.value?.cwd??``),r=U(()=>t.deviceId??Ju.value),i=U(()=>Ef(r.value||`?`,n.value||`?`)),a=U(()=>i.value.status),o=U(()=>i.value.loading),s=U(()=>String(Vu.devices.value.find(e=>e.id===r.value)?.info?.platform??``).startsWith(`win32`)),c=U(()=>{let e=i.value;if(!e.error||!/start dirs/i.test(e.error))return``;let t=Vu.devices.value.find(e=>e.id===r.value)?.info?.startDirs;return Array.isArray(t)&&t.length?t.map(String).join(`, `):``}),l=U(()=>i.value.refreshing),u=U(()=>i.value.error),d=U(()=>{let e=ed.value;return e&&e.cwd===n.value&&!t.deviceId?e.id:void 0}),f=k(``),p=k(``),m=k(``),h=k(new Set),g=k(!1),_=k(!1),v=k(``),y=k(null),b=k(`working`),x=U(()=>`dpi-git-draft:${r.value}:${n.value}`),S=k(null),C=k(!0),ee=k(``),te=k(!1),ne=k([]),re=U(()=>{if(!ne.value.length||!n.value)return null;let e=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,t=new Set(ne.value);return{changed:(a.value?.files??[]).filter(n=>t.has(e(n.path))).length,total:ne.value.length}}),w=k(null),ie=k(``),ae=e=>{ie.value=e.input?.value??``,w.value=e},oe=()=>{let e=w.value;w.value=null,e&&e.action(ie.value)};window.addEventListener(`keydown`,e=>{e.key===`Escape`&&w.value&&(w.value=null)});let se=k([]),ce=k(!1),le=k(new Map),ue=k([]),de=k(!1),fe=k(new Map),pe=k(!1),me=U(()=>a.value?.forge),he=U(()=>me.value===`github`),ge=U(()=>a.value?.webUrl??``),_e=U(()=>me.value===`gitlab`?`merge request`:me.value===`bitbucket`||me.value===`github`?`pull request`:`change request`),ve=U(()=>{let e=a.value?.branch,t=a.value?.upstream?.replace(/^[^/]+\//,``);if(!e||!ge.value)return``;let n=encodeURIComponent(e),r=t?encodeURIComponent(t):``;return me.value===`gitlab`?`${ge.value}/-/merge_requests/new?merge_request%5Bsource_branch%5D=${n}${r?`&merge_request%5Btarget_branch%5D=${r}`:``}`:me.value===`bitbucket`?`${ge.value}/pull-requests/new?source=${n}${r?`&dest=${r}`:``}`:me.value===`github`?`${ge.value}/compare/${r||`main`}...${n}?expand=1`:``}),ye=U(()=>me.value===`gitlab`?`${ge.value}/-/merge_requests`:me.value===`bitbucket`?`${ge.value}/pull-requests`:`${ge.value}/pulls`),be=async()=>{if(!r.value||!n.value)return;let e=yf(r.value,n.value);if(!e.ok){ue.value=[],Y(`pull requests unavailable: ${e.reason}`);return}pe.value=!0;try{let e=await G(r.value).gitOp(n.value,`pr-list`);ue.value=e.prs??[]}catch(e){Y(`pr list failed: ${e.message.slice(0,120)}`)}finally{pe.value=!1}};M(de,e=>{e&&be()});let xe=()=>ae({title:`Create pull request`,body:`head: ${a.value?.branch??`?`}`,confirmLabel:`Create PR`,input:{placeholder:`PR title`,value:m.value.trim()||``},action:e=>void Se(e)});async function Se(e){if(r.value&&n.value&&e.trim()){pe.value=!0;try{Y((await G(r.value).gitOp(n.value,`pr-create`,{message:e.trim(),body:e.trim()})).text.split(`
|
|
78
|
-
`)[0]??`PR created`),await be()}catch(e){Y(`pr create failed: ${e.message.slice(0,140)}`)}finally{pe.value=!1}}}async function Ce(e){if(r.value&&n.value){pe.value=!0;try{let t=await G(r.value).gitOp(n.value,`pr-checks`,{n:e});fe.value=new Map(fe.value).set(e,t.text.slice(0,1500))}catch(e){Y(`pr checks failed: ${e.message.slice(0,120)}`)}finally{pe.value=!1}}}let we=e=>ae({title:`Merge PR #${e}?`,body:`squash-merge via gh on the device.`,confirmLabel:`Squash & merge`,danger:!0,action:()=>void Te(e)});async function Te(e){if(r.value&&n.value){pe.value=!0;try{Y((await G(r.value).gitOp(n.value,`pr-merge`,{n:e})).text||`PR #${e} merged`),await be(),await Pe()}catch(e){Y(`pr merge failed: ${e.message.slice(0,140)}`)}finally{pe.value=!1}}}let Ee=e=>ae({title:`Comment on PR #${e}`,body:`posted as the device's gh login`,confirmLabel:`Comment`,input:{placeholder:`comment…`,value:``},action:t=>void De(e,t)});async function De(e,t){if(r.value&&n.value&&t.trim()){pe.value=!0;try{Y((await G(r.value).gitOp(n.value,`pr-comment`,{n:e,body:t.trim()})).text||`comment posted`)}catch(e){Y(`pr comment failed: ${e.message.slice(0,140)}`)}finally{pe.value=!1}}}let Oe=k([]),ke=k(!1),Ae=async()=>{if(r.value&&d.value)try{let e=await G(r.value).sessionGitTurns(d.value);Oe.value=e.turns}catch{Oe.value=[]}};M(ke,e=>{e&&Ae()});let je=0;window.addEventListener(`focus`,()=>{!n.value||Date.now()-je<15e3||(je=Date.now(),Of(r.value||`?`,n.value||`?`,{force:!0}))});let Me=k(new Set),Ne=()=>{typeof localStorage<`u`&&(m.value=localStorage.getItem(x.value)??``)};wf(),Of(r.value||`?`,n.value||`?`),Ne(),Kr(()=>Of(r.value||`?`,n.value||`?`)),M(m,e=>{typeof localStorage<`u`&&(e?localStorage.setItem(x.value,e):localStorage.removeItem(x.value))}),M([r,n],()=>{g.value=!1,_.value=!1,y.value=null,S.value=null,ee.value=``,te.value=!1,ne.value=[],le.value=new Map,Me.value=new Set,Of(r.value||`?`,n.value||`?`),Ne()});let Pe=()=>(h.value=new Set,y.value=null,Of(r.value||`?`,n.value||`?`,{force:!0})),Fe=U(()=>a.value?.files??[]);M(Fe,e=>{let t=new Set;for(let n of e)n.x!==`?`&&n.y!==`?`&&t.add(n.path);h.value=t},{immediate:!0});let Ie=U(()=>Fe.value.some(e=>h.value.has(e.path))),Le=U(()=>Fe.value.filter(e=>!ze(e)&&e.x!==` `&&e.x!==`?`)),Re=U(()=>Fe.value.filter(e=>!ze(e)&&(e.x===` `||e.x===`?`))),ze=e=>`UAD`.includes(e.x)&&`UAD`.includes(e.y),Be=U(()=>Fe.value.filter(ze)),Ve=U(()=>Fe.value.length>=500),He=U(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0)>0),Ue=U(()=>a.value?.repo===!0&&a.value?.identityComplete===!1),We=U(()=>a.value?.webUrl??``),Ge=e=>{let t=new Set(h.value);t.has(e)?t.delete(e):t.add(e),h.value=t},Ke=e=>{let t=e.every(e=>h.value.has(e.path)),n=new Set(h.value);for(let r of e)t?n.delete(r.path):n.add(r.path);h.value=n},qe=e=>{let t=e.lastIndexOf(`/`);return t===-1?`.`:e.slice(0,t)},Je=e=>{let t=new Map;for(let n of e){let e=qe(n.path);t.has(e)||t.set(e,[]),t.get(e).push(n)}return[...t.entries()].map(([e,t])=>({dir:e,files:t,open:!Me.value.has(e)}))},Ye=e=>{let t=new Set(Me.value);t.has(e)?t.delete(e):t.add(e),Me.value=t},Xe=e=>e.a===void 0&&e.d===void 0?``:e.a===-1||e.d===-1?`bin`:`+${e.a??0} −${e.d??0}`,Ze=e=>{navigator.clipboard?.writeText(e).then(()=>Y(`copied ${e}`))};async function Qe(e,t={}){if(!r.value||!n.value)return;let i=yf(r.value,n.value);if(!i.ok){Y(`git ${e} skipped: ${i.reason}`);return}f.value=e,p.value=``;try{let i=await G(r.value).gitOp(n.value,e,t);p.value=i.text||`(empty)`,e===`push`&&(ee.value=``),e===`pull`&&(te.value=!1),[`fetch`,`pull`,`push`,`stash-push`,`stash-pop`].includes(e)&&Y(`git ${e} ✓`),await Pe(),Dt(!0)}catch(t){let n=t.message;e===`push`&&(/no upstream|has no upstream|upstream is gone/i.test(n)?ee.value=`no upstream — set it while pushing?`:/fetch first|non-fast-forward|rejected.*fetch|behind/i.test(n)?ee.value=`the remote has work you lack — pull first`:/authentication|permission|could not read|403|denied/i.test(n)?ee.value=`credentials rejected on the device — check its git login`:ee.value=``),e===`pull`&&/not possible to fast-forward|divergent|unrelated histories/i.test(n)&&(te.value=!0),Y(`git ${e}: ${n.slice(0,160)}`)}finally{f.value=``}}async function $e(e,t,i=!1){if(!r.value||!n.value||(i&&(f.value=e),!t&&e!==`stage`))return;if(e===`discard`&&t&&!i){ae({title:`Roll back to HEAD?`,body:`${t} — uncommitted changes are lost.`,confirmLabel:`Roll back`,danger:!0,action:()=>void $e(e,t,!0)});return}f.value=e;let a=t?[t]:Fe.value.filter(e=>e.x===` `||e.x===`M`).map(e=>e.path);try{Y((await G(r.value).gitOp(n.value,e,{files:a})).text),await Pe()}catch(t){Y(`${e} failed: ${t.message.slice(0,140)}`)}finally{f.value=``}}async function et(e){if(r.value&&n.value&&e.length){f.value=`unstage`;try{Y((await G(r.value).gitOp(n.value,`unstage`,{files:e})).text),await Pe()}catch(e){Y(`unstage failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}async function tt(e,t){if(r.value&&n.value){f.value=`resolve`;try{Y((await G(r.value).gitOp(n.value,`resolve`,{side:e,files:[t]})).text),await Pe()}catch(e){Y(`resolve failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}async function nt(e){if(r.value&&n.value&&e.length){f.value=`ignore`;try{Y((await G(r.value).gitOp(n.value,`ignore`,{lines:e})).text),await Pe()}catch(e){Y(`ignore failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}async function rt(e){if(r.value&&n.value){if(y.value?.path===e)return y.value=null;f.value=`diff`;try{let t=await G(r.value).gitOp(n.value,`diff-file`,{target:e,staged:b.value===`staged`});y.value={path:e,text:t.text}}catch(e){Y(`diff failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}let it=async()=>{let e=y.value?.path;y.value=null,e&&await rt(e)},at=U(()=>/Binary files .* differ/i.test(y.value?.text??``));async function ot(){if(r.value&&n.value){f.value=`abort`;try{Y((await G(r.value).gitOp(n.value,`merge-abort`)).text),await Pe()}catch(e){Y(`abort failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}}async function st(e){if(g.value=!1,r.value&&n.value){f.value=`compare`;try{let t=await G(r.value).gitOp(n.value,`compare`,{ref:e});S.value={ref:e,ahead:t.ahead??0,behind:t.behind??0}}catch(e){Y(`compare failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}async function ct(e,t=!1){if(g.value=!1,!r.value||!n.value||e===a.value?.branch&&!t)return;f.value=`switch`;let i=G(r.value),o=!1;try{if(C.value&&!t&&He.value&&(await i.gitOp(n.value,`stash-push`,{message:`dpi auto-stash before ${e}`}),o=!0),Y((await i.gitOp(n.value,`switch`,{ref:e,create:t})).text||`switched to ${e}`),o)try{let e=await i.gitOp(n.value,`stash-pop`);/conflict/i.test(e.text)&&Y(`stash popped WITH CONFLICTS — resolve in the file list`)}catch{Y(`switched, but the stash did not pop — resolve manually (git stash list)`)}await Pe(),Dt(!0)}catch(e){if(Y(`switch failed: ${e.message.slice(0,140)}`),o)try{await i.gitOp(n.value,`stash-pop`)}catch{}}finally{f.value=``}}async function lt(e=!1){if(!r.value||!n.value||!m.value.trim())return;f.value=`commit`;let t=Fe.value.filter(e=>h.value.has(e.path)).map(e=>e.path);if(!t.length)return Y(`check the files to commit — nothing is selected`);let i=G(r.value);try{if(Y((await i.gitOp(n.value,`commit`,{message:m.value.trim(),...a.value?.merge?{}:{files:t}})).text),m.value=``,e)try{Y(`pushed: ${(await i.gitOp(n.value,`push`)).text.slice(0,80)}`)}catch(e){Y(`committed, but push failed: ${e.message.slice(0,120)}`)}await Pe(),Dt(!0)}catch(e){Y(`commit failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}function ut(e){let t=e?.models??[],n=t.find(t=>`${t.provider}/${t.id}`===e?.defaultModel),r=new Map;for(let e of t)r.has(e.provider)||r.set(e.provider,e);let i=[...r.values()].filter(e=>e!==n).slice(0,3);return(n?[n,...i]:i).slice(0,4)}async function dt(){if(!r.value||!n.value)return;let e=Fe.value.filter(e=>h.value.has(e.path)).map(e=>e.path);if(!e.length)return Y(`check files first — the model summarises THOSE`);f.value=`ai`;let t=G(r.value),i=``;for(let r of e.slice(0,5)){let e=await t.gitOp(n.value,`diff-file`,{target:r});if(i+=`${e.text}\n`,i.length>4e3)break}i=i.slice(0,4e3);let a=`Write ONE concise git commit message (under 72 chars, imperative, no quotes, no backticks) for these changes:\n\n${i}`,o=Vu.devices.value.find(e=>e.id===r.value)?.info,s=ut(o);if(!s.length)return f.value=``,Y(`no model on the device`);let c=[];try{for(let e of s){let r=await t.createSession({name:`git-msg`,cwd:n.value,model:{provider:e.provider,modelId:e.id}}).then(e=>e.id).catch(()=>``);if(!r){c.push(`${e.provider}: no session`);continue}try{let n=await t.agent(r,1).send(a,`followUp`,void 0,12e4),i=n.status===`done`?n.answer.text.trim().split(`
|
|
79
|
-
`)[0]?.slice(0,100):``;if(i){m.value=i;return}c.push(`${e.provider}/${e.id}: ${n.status===`unanswered`?n.reason:`empty answer`}`)}finally{t.session(r).archive().catch(()=>{})}}Y(`ai message failed on every model — ${c.join(`; `).slice(0,140)}`)}catch(e){Y(`ai message failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}async function ft(){if(r.value&&d.value){f.value=`session-files`;try{let e=await G(r.value).sessionGitFiles(d.value);ne.value=e.files;let t=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,i=new Set(e.files.map(t)),a=Fe.value.filter(e=>i.has(t(e.path)));h.value=new Set(a.map(e=>e.path)),Y(a.length?`${a.length} session file(s) still changed — checked`:`the session touched nothing that is still changed`)}catch(e){Y(`session files failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}}async function pt(e){if(le.value.has(e)){le.value.delete(e),le.value=new Map(le.value);return}if(r.value&&n.value)try{let t=await G(r.value).gitOp(n.value,`show-files`,{target:e});le.value=new Map(le.value).set(e,t.changed??[])}catch(e){Y(`commit files failed: ${e.message.slice(0,120)}`)}}async function mt(){if(!r.value||!n.value)return;let e=`cp-${new Date().toISOString().slice(0,16).replace(/[-:T]/g,``)}`;f.value=`checkpoint`;try{Y((await G(r.value).gitOp(n.value,`checkpoint`,{name:e})).text),ce.value=!0,await ht()}catch(e){Y(`checkpoint failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}async function ht(){if(r.value&&n.value)try{let e=await G(r.value).gitOp(n.value,`checkpoints`);se.value=e.checkpoints??[]}catch{se.value=[]}}async function gt(e){if(!r.value||!n.value)return;let t=e;ae({title:`Rewind to ${t}?`,body:`reset --hard — ALL uncommitted changes in this worktree are LOST.`,confirmLabel:`Rewind`,danger:!0,action:()=>void _t(t)})}async function _t(e){if(r.value&&n.value){f.value=`rewind`;try{Y((await G(r.value).gitOp(n.value,`rewind`,{name:e})).text),await Pe(),Dt(!0)}catch(e){Y(`rewind failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}}M(ce,e=>{e&&ht()});async function vt(e){if(_.value=!1,r.value&&n.value&&a.value?.root){f.value=`wt`;try{Y((await Cp(G(r.value),n.value,a.value.root,e)).text),v.value=``,await Pe()}catch(e){Y(`worktree failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}}async function yt(e,t){if(r.value){f.value=`session`;try{let n=Vu.devices.value.find(e=>e.id===r.value)?.info,i=ut(n)[0];if(!i)return Y(`no model available on ${r.value} — cannot create a session`);let a=await wp(G(r.value),e,t??e.slice(e.lastIndexOf(`/`)+1),{provider:i.provider,modelId:i.id});id({deviceId:r.value,sessionId:a.id,agentId:1}),Y(`session "${a.name}" on ${e}`)}catch(e){Y(`session failed: ${e.message.slice(0,160)}`)}finally{f.value=``}}}async function bt(e){if(r.value){f.value=`go`;try{let t=(await G(r.value).sessions()).find(t=>t.cwd===e);t?(id({deviceId:r.value,sessionId:t.id,agentId:1}),Y(`switched to session "${t.name}"`)):await yt(e,null)}catch(e){Y(`switch failed: ${e.message.slice(0,120)}`)}finally{f.value=``}}}async function xt(e){if(!r.value||!n.value)return;f.value=`wt`;let t=`Uncommitted changes in it will be LOST.`;try{let n=(await G(r.value).gitStatusBatch([e],{timeoutMs:6e4}))[e];t=(n?.staged??0)+(n?.unstaged??0)+(n?.untracked??0)>0?`It CONTAINS uncommitted changes — they will be LOST.`:`Its checkout is clean.`}catch{}ae({title:`Remove worktree?`,body:`${e} — ${t}`,confirmLabel:`Remove`,danger:!0,action:()=>void St(e)})}async function St(e){f.value=`wt`;try{await G(r.value).gitOp(n.value,`worktree-remove`,{target:e}),await Pe()}catch(e){Y(`remove failed: ${e.message.slice(0,140)}`)}finally{f.value=``}}let Ct=k([]),wt=k(!1),Tt=k(``),Et=0;async function Dt(e=!1){if(!r.value||!n.value||!e&&Ct.value.length&&Date.now()-Et<12e4)return;let t=yf(r.value,n.value);if(!t.ok){Ct.value=[],Tt.value=t.reason,Et=Date.now();return}wt.value=!0;try{let e=await G(r.value).gitOp(n.value,`log-list`);Ct.value=e.commits??[],Tt.value=``,Et=Date.now()}catch(e){Tt.value=e.message.slice(0,120)}finally{wt.value=!1}}Dt(),M([r,n],()=>{Ct.value=[],Et=0,Dt()});let Ot=U(()=>(a.value?.worktrees??[]).filter(e=>e.path)),kt=[`#4f8cc9`,`#b8860b`,`#7aa25c`,`#a061ba`,`#c96f6f`,`#5fa8a0`],At=U(()=>{let e=new Map,t=[],n=[];for(let r of Ct.value){let i=e.get(r.hash);i===void 0&&(i=n.indexOf(null),i===-1&&(n.push(null),i=n.length-1),e.set(r.hash,i)),n[i]=null;let a=[];r.parents.forEach((t,r)=>{let o=e.get(t);(o===void 0||n[o]===t)&&(o=n.indexOf(null),o===-1&&(n.push(null),o=n.length-1),e.set(t,o)),n[o]=t,r===0&&(n[i]=t),a.push(o)}),t.push({lane:i,parents:a,width:Math.max(1,n.length)})}return t}),jt=e=>e*12+7;return(e,t)=>(I(),L(`div`,xx,[n.value?(I(),L(F,{key:1},[o.value?(I(),L(`p`,Cx,`loading git…`)):l.value?(I(),L(`p`,wx,`refreshing…`)):H(``,!0),c.value?(I(),L(`div`,Tx,[z(`p`,null,[z(`strong`,null,D(n.value),1),t[41]||=V(` is outside the folders this device serves — it serves `,-1),z(`code`,null,D(c.value),1),t[42]||=V(`. `,-1)]),t[43]||=z(`p`,{class:`muted-line`},[V(` Your session and its history are intact, and the agent still runs in that folder; only the Git and Files panels (the device's HTTP surface) are confined. Nothing has to be recreated: add the folder to `),z(`code`,null,`DPI_START_DIRS`),V(` and restart the device, and this panel works again for the same session. `)],-1),z(`p`,Ex,[V(` Example (`+D(s.value?`Windows: separate with ;`:`Linux/macOS: separate with :`)+`) — `,1),z(`code`,null,D(s.value?`setx DPI_START_DIRS "%USERPROFILE%\\dpi-work;D:\\source"`:`DPI_START_DIRS="$HOME/dpi-work:/srv/src"`),1)])])):u.value?(I(),L(`p`,Dx,[V(D(u.value)+` `,1),z(`button`,{onClick:t[0]||=e=>Pe()},`retry`)])):H(``,!0),a.value?(I(),L(`div`,{key:4,class:E({stale:!!u.value||!!l.value})},[a.value.repo?(I(),L(F,{key:1},[a.value.merge?(I(),L(`p`,kx,[V(` merge in progress — `+D(a.value.conflicts??Be.value.length)+` unmerged path(s). Resolve them in the lists above, or `,1),z(`button`,{class:`small`,disabled:!!f.value,onClick:t[1]||=e=>ot()},`abort merge`,8,Ax)])):H(``,!0),z(`div`,jx,[z(`div`,Mx,[z(`button`,{class:`branch-btn`,disabled:!!f.value,onClick:t[2]||=e=>g.value=!g.value},[B(A(xc),{size:16}),z(`strong`,null,D(a.value.branch??`detached`),1),B(A(nc),{size:14})],8,Nx),g.value?(I(),L(`div`,Px,[(I(!0),L(F,null,P(a.value.branches??[],e=>(I(),L(`button`,{key:e.name,class:E({cur:e.current}),onClick:t=>ct(e.name)},[B(A(xc),{size:13}),z(`span`,null,D(e.name),1),z(`span`,Ix,D(e.current?`current`:e.upstream?`→ ${e.upstream}`:``),1),t[45]||=z(`span`,{class:`grow`},null,-1),e.current?H(``,!0):(I(),R(A(Sc),{key:0,size:13,title:`compare with this base`,onClick:ks(t=>st(e.name),[`stop`])},null,8,[`onClick`]))],10,Fx))),128)),z(`div`,Lx,[j(z(`input`,{"onUpdate:modelValue":t[3]||=e=>v.value=e,placeholder:`new branch…`,onKeyup:t[4]||=js(e=>v.value.trim()&&ct(v.value.trim(),!0),[`enter`])},null,544),[[ys,v.value]]),z(`button`,{disabled:!v.value.trim(),onClick:t[5]||=e=>ct(v.value.trim(),!0)},[B(A(Xc),{size:13})],8,Rx)]),z(`label`,zx,[j(z(`input`,{type:`checkbox`,"onUpdate:modelValue":t[6]||=e=>C.value=e},null,512),[[bs,C.value]]),t[46]||=V(` auto-stash on switch`,-1)])])):H(``,!0)]),z(`span`,Bx,D(a.value.upstream??`no upstream`),1),a.value.ahead?(I(),L(`span`,Vx,`↑`+D(a.value.ahead),1)):H(``,!0),a.value.behind?(I(),L(`span`,Hx,`↓`+D(a.value.behind),1)):H(``,!0),S.value?(I(),L(`span`,Ux,[V(` vs `+D(S.value.ref)+`: ↑`+D(S.value.ahead)+` ↓`+D(S.value.behind)+` `,1),z(`button`,{class:`tag-x`,onClick:t[7]||=e=>S.value=null},[B(A(xl),{size:11})])])):H(``,!0),z(`span`,Wx,`+`+D(a.value.staged??0)+` ~`+D(a.value.unstaged??0)+` ?`+D(a.value.untracked??0),1),We.value?(I(),L(`a`,{key:3,class:`icon-button`,href:`${We.value}/tree/${a.value.branch??``}`,target:`_blank`,rel:`noopener`,title:`open on the remote`},[B(A(Ks),{size:15,style:{transform:`rotate(45deg)`}})],8,Gx)):H(``,!0),z(`button`,{class:`icon-button`,disabled:!!f.value||o.value||l.value,title:`refresh`,onClick:t[8]||=e=>Pe()},[B(A($c),{size:16})],8,Kx)]),z(`div`,qx,[z(`button`,{class:`small`,disabled:!!f.value,onClick:t[9]||=e=>Qe(`fetch`)},[B(A(Ws),{size:14}),t[47]||=V(`fetch`,-1)],8,Jx),z(`button`,{class:`small`,disabled:!!f.value,onClick:t[10]||=e=>Qe(`pull`)},[B(A(Ws),{size:14}),t[48]||=V(`pull`,-1)],8,Yx),z(`button`,{class:`small primary`,disabled:!!f.value,title:`push`,onClick:t[11]||=e=>Qe(`push`)},[B(A(Ks),{size:14}),t[49]||=V(`push`,-1)],8,Xx),z(`button`,{class:`small`,disabled:!!f.value,title:`stash changes`,onClick:t[12]||=e=>Qe(`stash-push`,{message:m.value.trim()||void 0})},[B(A(dl),{size:14}),t[50]||=V(`stash`,-1)],8,Zx),z(`button`,{class:`small`,disabled:!!f.value,title:`pop the newest stash`,onClick:t[13]||=e=>Qe(`stash-pop`)},[B(A(Hc),{size:14}),t[51]||=V(`unstash`,-1)],8,Qx)]),ee.value?(I(),L(`p`,$x,[V(D(ee.value)+` `,1),ee.value.includes(`upstream`)?(I(),L(`button`,{key:0,class:`small primary`,disabled:!!f.value,onClick:t[14]||=e=>Qe(`push`,{setUpstream:!0,ref:a.value.branch})},`push -u origin `+D(a.value.branch),9,eS)):ee.value.includes(`remote has work`)?(I(),L(`button`,{key:1,class:`small primary`,disabled:!!f.value,onClick:t[15]||=e=>Qe(`pull`)},`pull now`,8,tS)):H(``,!0)])):H(``,!0),te.value?(I(),L(`p`,nS,[t[52]||=V(` fast-forward is not possible — branches diverged. `,-1),z(`button`,{class:`small primary`,disabled:!!f.value,onClick:t[16]||=e=>Qe(`pull`,{rebase:!0})},`pull --rebase`,8,rS)])):H(``,!0),z(`section`,iS,[z(`div`,aS,[t[53]||=z(`h4`,null,`Commit`,-1),z(`span`,oS,D(Fe.value.length?`${h.value.size}/${Fe.value.length} files`:`no changes`),1),t[54]||=z(`span`,{class:`grow`},null,-1),d.value?(I(),L(`button`,{key:0,class:`small`,disabled:!!f.value,title:`check the files this session's agent touched`,onClick:ft},[B(A(_c),{size:13}),V(` session files`+D(re.value?` (${re.value.changed}/${re.value.total})`:``),1)],8,sS)):H(``,!0),d.value?(I(),L(`button`,{key:1,class:`small`,disabled:!!f.value,title:`what each turn of this session changed`,onClick:t[17]||=e=>ke.value=!ke.value},` turns `,8,cS)):H(``,!0)]),Ue.value?(I(),L(`p`,lS,[...t[55]||=[V(` git on the device cannot resolve an author, so commits would be refused. Set one for the account that runs the device: `,-1),z(`code`,null,`git config --global user.name "Your Name"`,-1),V(` and `,-1),z(`code`,null,`git config --global user.email "you@example.com"`,-1),V(` (or just this repo: `,-1),z(`code`,null,`git config user.name …`,-1),V(`), then restart the device so it picks the new config up. `,-1)]])):H(``,!0),ke.value?(I(),L(`div`,uS,[Oe.value.length?H(``,!0):(I(),L(`p`,dS,`no turns recorded yet for this session.`)),(I(!0),L(F,null,P(Oe.value,(e,t)=>(I(),L(`div`,{key:t,class:`cp-row`},[z(`code`,null,`t`+D(Oe.value.length-t),1),z(`span`,fS,D(e.when.slice(0,16).replace(`T`,` `)),1),z(`span`,pS,D(e.files.map(e=>`${e.path}×${e.writes}${e.a!==void 0||e.d!==void 0?` (+${e.a??0} −${e.d??0})`:``}`).join(`, `)||`(no file writes)`),1)]))),128))])):H(``,!0),Ve.value?(I(),L(`p`,mS,`showing the first 500 changed files — commit in smaller batches`)):H(``,!0),Be.value.length?(I(),L(`div`,hS,[z(`label`,gS,[z(`span`,_S,`Conflicts · `+D(Be.value.length)+` — pick a side per file`,1)]),(I(!0),L(F,null,P(Be.value,e=>(I(),L(`div`,{key:e.path,class:`file`},[z(`label`,vS,[z(`code`,yS,D(e.x)+D(e.y),1),z(`span`,{class:`path`,title:e.path},D(e.path),9,bS)]),z(`span`,xS,[z(`button`,{class:`icon-button`,title:`view the conflict`,onClick:t=>rt(e.path)},[B(A(hc),{size:13})],8,SS),z(`button`,{class:`small`,disabled:!!f.value,title:`keep this branch's version and stage it`,onClick:t=>tt(`ours`,e.path)},`ours`,8,CS),z(`button`,{class:`small`,disabled:!!f.value,title:`take the incoming version and stage it`,onClick:t=>tt(`theirs`,e.path)},`theirs`,8,wS)])]))),128))])):H(``,!0),Le.value.length?(I(),L(`div`,TS,[z(`label`,ES,[z(`input`,{type:`checkbox`,checked:Le.value.every(e=>h.value.has(e.path)),onChange:t[18]||=e=>Ke(Le.value)},null,40,DS),z(`span`,OS,`Staged · `+D(Le.value.length),1),t[58]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`icon-button`,title:`stage every changed file`,onClick:t[19]||=e=>$e(`stage`)},[B(A(Xc),{size:13}),t[56]||=V(` all`,-1)]),z(`button`,{class:`icon-button`,title:`unstage all (git reset HEAD)`,onClick:t[20]||=e=>et(Le.value.map(e=>e.path))},[B(A(Rc),{size:13}),t[57]||=V(` none`,-1)])]),(I(!0),L(F,null,P(Je(Le.value),e=>(I(),L(F,{key:e.dir},[e.dir===`.`?H(``,!0):(I(),L(`button`,{key:0,class:`dir-row`,onClick:t=>Ye(e.dir)},[B(A(rc),{size:12,class:E({open:e.open})},null,8,[`class`]),V(D(e.dir),1),z(`span`,AS,`· `+D(e.files.length),1)],8,kS)),(I(!0),L(F,null,P(e.files,t=>j((I(),L(`div`,{key:t.path,class:`file`},[z(`label`,jS,[z(`input`,{type:`checkbox`,checked:h.value.has(t.path),onChange:e=>Ge(t.path)},null,40,MS),z(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},D(t.x)+D(t.y),9,NS),z(`span`,{class:`path`,title:t.path},D(t.path),9,PS),Xe(t)?(I(),L(`span`,{key:0,class:E([`nums`,{bin:Xe(t)===`bin`}])},D(Xe(t)),3)):H(``,!0)]),z(`span`,FS,[z(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>rt(t.path)},[B(A(hc),{size:13})],8,IS),z(`button`,{class:`icon-button`,title:`unstage (git reset HEAD)`,onClick:e=>et([t.path])},[B(A(Rc),{size:13})],8,LS),z(`button`,{class:`icon-button`,title:`roll back to HEAD`,onClick:e=>$e(`discard`,t.path)},[B(A(uc),{size:13})],8,RS)])])),[[Ro,e.open]])),128))],64))),128))])):H(``,!0),Re.value.length?(I(),L(`div`,zS,[z(`label`,BS,[z(`input`,{type:`checkbox`,checked:Re.value.every(e=>h.value.has(e.path)),onChange:t[21]||=e=>Ke(Re.value)},null,40,VS),z(`span`,HS,`Unstaged · `+D(Re.value.length),1)]),(I(!0),L(F,null,P(Je(Re.value),e=>(I(),L(F,{key:e.dir},[e.dir===`.`?H(``,!0):(I(),L(`button`,{key:0,class:`dir-row`,onClick:t=>Ye(e.dir)},[B(A(rc),{size:12,class:E({open:e.open})},null,8,[`class`]),V(D(e.dir),1),z(`span`,WS,`· `+D(e.files.length),1)],8,US)),(I(!0),L(F,null,P(e.files,t=>j((I(),L(`div`,{key:t.path,class:`file`},[z(`label`,GS,[z(`input`,{type:`checkbox`,checked:h.value.has(t.path),onChange:e=>Ge(t.path)},null,40,KS),z(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},D(t.x)+D(t.y),9,qS),z(`span`,{class:`path`,title:t.path},D(t.path),9,JS),Xe(t)?(I(),L(`span`,{key:0,class:E([`nums`,{bin:Xe(t)===`bin`}])},D(Xe(t)),3)):H(``,!0)]),z(`span`,YS,[z(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>rt(t.path)},[B(A(hc),{size:13})],8,XS),t.x===`?`?(I(),L(`button`,{key:0,class:`icon-button`,title:`add to .gitignore`,onClick:e=>nt([t.path])},[B(A(Ys),{size:13})],8,ZS)):(I(),L(`button`,{key:1,class:`icon-button`,title:`stage (git add)`,onClick:e=>$e(`stage`,t.path)},[B(A(Xc),{size:13})],8,QS)),t.x===`?`?H(``,!0):(I(),L(`button`,{key:2,class:`icon-button`,title:`roll back to HEAD`,onClick:e=>$e(`discard`,t.path)},[B(A(uc),{size:13})],8,$S)),z(`button`,{class:`icon-button`,title:`copy path`,onClick:e=>Ze(t.path)},[B(A(sc),{size:13})],8,eC)])])),[[Ro,e.open]])),128))],64))),128))])):H(``,!0),y.value?(I(),L(`p`,tC,[z(`strong`,null,D(y.value.path),1),z(`span`,nC,[z(`button`,{class:E({on:b.value===`working`}),onClick:t[22]||=e=>{b.value=`working`,it()}},`working`,2),z(`button`,{class:E({on:b.value===`staged`}),onClick:t[23]||=e=>{b.value=`staged`,it()}},`staged`,2)]),at.value?(I(),L(`span`,rC,`binary file`)):y.value.text.length>8e3?(I(),L(`span`,iC,`truncated at 8000 chars`)):H(``,!0),z(`button`,{class:`icon-button`,title:`close diff`,onClick:t[24]||=e=>y.value=null},[B(A(xl),{size:13})]),at.value?H(``,!0):(I(),L(`pre`,aC,D(y.value.text.slice(0,8e3)),1))])):H(``,!0),j(z(`textarea`,{"onUpdate:modelValue":t[25]||=e=>m.value=e,rows:`4`,placeholder:`Commit message… (Ctrl+Enter to commit)`,onKeydown:[t[26]||=js(ks(e=>lt(),[`exact`,`prevent`]),[`enter`]),t[27]||=js(ks(e=>lt(),[`meta`,`prevent`]),[`enter`]),t[28]||=js(ks(e=>lt(),[`ctrl`,`prevent`]),[`enter`])]},null,544),[[ys,m.value]]),z(`div`,oC,[z(`button`,{class:`small`,disabled:!!f.value||!h.value.size,title:`ask the device's model for a message`,onClick:dt},[B(A(ll),{size:14}),t[59]||=V(` ai message`,-1)],8,sC),t[61]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`primary small`,disabled:!!f.value||!m.value.trim()||!Ie.value,onClick:t[29]||=e=>lt(!1)},[B(A(tc),{size:14}),V(` Commit`+D(h.value.size?` ${h.value.size} file${h.value.size>1?`s`:``}`:``),1)],8,cC),a.value.upstream?(I(),L(`button`,{key:0,class:`primary small`,disabled:!!f.value||!m.value.trim()||!Ie.value,title:`commit, then push`,onClick:t[30]||=e=>lt(!0)},[B(A(tc),{size:14}),t[60]||=V(` Commit & push `,-1)],8,lC)):H(``,!0)])]),z(`section`,uC,[z(`div`,dC,[z(`h4`,null,[B(A(Ec),{size:16}),t[62]||=V(` Log`,-1)]),t[64]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`small`,disabled:!!f.value,title:`save a checkpoint ref of HEAD`,onClick:mt},[B(A(_c),{size:13}),t[63]||=V(` checkpoint`,-1)],8,fC),z(`button`,{class:`small`,disabled:!!f.value,onClick:t[31]||=e=>ce.value=!ce.value},`checkpoints `+D(se.value.length?`(${se.value.length})`:``),9,pC),z(`button`,{class:`icon-button`,disabled:wt.value,title:`refresh log`,onClick:t[32]||=e=>Dt(!0)},[B(A($c),{size:14})],8,mC)]),ce.value?(I(),L(`div`,hC,[se.value.length?H(``,!0):(I(),L(`p`,gC,`no checkpoints yet — one click saves a named ref of HEAD.`)),(I(!0),L(F,null,P(se.value,e=>(I(),L(`div`,{key:e.name,class:`cp-row`},[z(`code`,null,D(e.name),1),z(`span`,_C,D(e.hash)+` · `+D(e.date),1),z(`span`,vC,D(e.subject),1),t[66]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`small`,disabled:!!f.value,title:`reset --hard to this checkpoint (this worktree)`,onClick:t=>gt(e.name)},[B(A(hl),{size:13}),t[65]||=V(` rewind`,-1)],8,yC)]))),128))])):H(``,!0),wt.value&&!Ct.value.length?(I(),L(`p`,bC,`loading log…`)):Ct.value.length?(I(),L(`div`,xC,[(I(!0),L(F,null,P(Ct.value,(e,t)=>(I(),L(F,{key:e.hash},[z(`div`,{class:`commit-row`,title:e.refs},[At.value[t]?(I(),L(`svg`,{key:0,class:`lane`,viewBox:`0 0 ${At.value[t].width*12+4} 24`,style:T({width:`${At.value[t].width*.75+.25}rem`,height:`1.5rem`}),"aria-hidden":`true`},[(I(!0),L(F,null,P(At.value[t].width,e=>(I(),L(`line`,{key:e,x1:jt(e-1),x2:jt(e-1),y1:`0`,y2:`24`,stroke:`#3a3134`,"stroke-width":`2`},null,8,wC))),128)),(I(!0),L(F,null,P(At.value[t].parents,(e,n)=>(I(),L(`line`,{key:`p`+n,x1:jt(At.value[t].lane),x2:jt(e),y1:`12`,y2:`24`,stroke:kt[e%kt.length],"stroke-width":`2`},null,8,TC))),128)),z(`circle`,{cx:jt(At.value[t].lane),cy:`12`,r:`4`,fill:kt[At.value[t].lane%kt.length]},null,8,EC)],12,CC)):H(``,!0),z(`button`,{class:`icon-button hash-btn`,title:`files in this commit`,onClick:t=>pt(e.hash)},[B(A(rc),{size:12,class:E({open:le.value.has(e.hash)})},null,8,[`class`])],8,DC),z(`code`,OC,[We.value?(I(),L(`a`,{key:0,href:`${We.value}/commit/${e.hash}`,target:`_blank`,rel:`noopener`,title:`on the remote`},D(e.hash),9,kC)):(I(),L(F,{key:1},[V(D(e.hash),1)],64))]),e.refs?(I(),L(`span`,AC,D(e.refs.split(`,`)[0]),1)):H(``,!0),z(`span`,jC,D(e.subject),1),z(`span`,MC,D(e.author)+` · `+D(e.date),1)],8,SC),le.value.has(e.hash)?(I(),L(`div`,NC,[(I(!0),L(F,null,P(le.value.get(e.hash),e=>(I(),L(`div`,{key:e.path,class:`cf`},[z(`code`,{class:`cf-status`,"data-s":e.status},D(e.status),9,PC),z(`span`,FC,D(e.path),1)]))),128)),le.value.get(e.hash)?.length?H(``,!0):(I(),L(`p`,IC,`no files (merge/empty commit)`))])):H(``,!0)],64))),128))])):Tt.value?(I(),L(`p`,LC,`log failed: `+D(Tt.value),1)):(I(),L(`p`,RC,`no commits`))]),z(`section`,zC,[z(`div`,BC,[z(`h4`,null,[B(A(Hc),{size:16}),t[67]||=V(` Worktrees`,-1)]),z(`div`,VC,[z(`button`,{class:`small`,disabled:!!f.value,onClick:t[33]||=e=>_.value=!_.value},[B(A(Xc),{size:13}),t[68]||=V(` worktree`,-1)],8,HC),_.value?(I(),L(`div`,UC,[(I(!0),L(F,null,P((a.value.branches??[]).filter(e=>!e.current),e=>(I(),L(`button`,{key:e.name,onClick:t=>vt(e.name)},[B(A(xc),{size:13}),z(`span`,null,D(e.name),1),t[69]||=z(`span`,{class:`muted-line`},`existing`,-1)],8,WC))),128)),z(`div`,GC,[j(z(`input`,{"onUpdate:modelValue":t[34]||=e=>v.value=e,placeholder:`or a NEW branch…`,onKeyup:t[35]||=js(e=>v.value.trim()&&vt(v.value.trim()),[`enter`])},null,544),[[ys,v.value]]),z(`button`,{disabled:!v.value.trim(),onClick:t[36]||=e=>vt(v.value.trim())},`create`,8,KC)])])):H(``,!0)])]),(I(!0),L(F,null,P(Ot.value,e=>(I(),L(`div`,{key:e.path,class:E([`wt`,{main:e.path===a.value.root}])},[z(`code`,{title:e.path},D(e.path),9,qC),z(`span`,JC,D(e.branch??e.head),1),t[70]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`icon-button`,disabled:!!f.value,title:`jump to this worktree (session or new)`,onClick:t=>bt(e.path)},[B(A(Gs),{size:13})],8,YC),z(`button`,{class:`small`,disabled:!!f.value,title:`create a session on this worktree`,onClick:t=>yt(e.path,e.branch)},`session`,8,XC),e.path===a.value.root?H(``,!0):(I(),L(`button`,{key:0,class:`icon-button`,disabled:!!f.value,onClick:t=>xt(e.path)},[B(A(xl),{size:13})],8,ZC)),e.path===a.value.root?(I(),R(A(tc),{key:1,size:13,class:`muted-line`})):H(``,!0)],2))),128))]),ge.value?(I(),L(`section`,QC,[z(`div`,$C,[z(`h4`,null,[B(A(wc),{size:16}),V(` `+D(he.value?`Pull requests`:_e.value+`s`),1)]),t[71]||=z(`span`,{class:`grow`},null,-1),!he.value&&ve.value?(I(),L(`a`,{key:0,class:`small btn-like`,href:ve.value,target:`_blank`,rel:`noopener`},`new `+D(_e.value),9,ew)):H(``,!0),he.value?H(``,!0):(I(),L(`a`,{key:1,class:`small btn-like`,href:ye.value,target:`_blank`,rel:`noopener`},`open `+D(_e.value)+`s`,9,tw)),he.value?H(``,!0):(I(),L(`a`,{key:2,class:`small btn-like`,href:ge.value,target:`_blank`,rel:`noopener`},`repo`,8,nw))]),he.value?(I(),L(F,{key:1},[z(`div`,iw,[t[74]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`small`,disabled:pe.value||!!f.value,onClick:xe},`create PR`,8,aw),z(`button`,{class:`small`,disabled:pe.value,onClick:t[37]||=e=>de.value=!de.value},D(de.value?`hide`:`list`),9,ow)]),de.value&&!ue.value.length&&!pe.value?(I(),L(`p`,sw,`no open PRs (or gh is not logged in on the device — every action will say so).`)):H(``,!0),de.value?(I(),L(`div`,cw,[(I(!0),L(F,null,P(ue.value,e=>(I(),L(`div`,{key:e.n,class:`pr-row`},[z(`code`,lw,`#`+D(e.n),1),z(`span`,{class:E([`tag`,{open:e.state===`OPEN`}])},D(e.state.toLowerCase())+D(e.draft?` · draft`:``),3),z(`span`,uw,D(e.title),1),z(`span`,dw,D(e.branch),1),t[75]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`icon-button`,title:`run checks`,disabled:pe.value,onClick:t=>Ce(e.n)},[B(A($c),{size:13})],8,fw),z(`button`,{class:`icon-button`,title:`comment`,disabled:pe.value,onClick:t=>Ee(e.n)},[B(A(sc),{size:13})],8,pw),e.state===`OPEN`?(I(),L(`button`,{key:0,class:`small`,disabled:pe.value||!!f.value,onClick:t=>we(e.n)},`squash & merge`,8,mw)):H(``,!0),z(`a`,{class:`icon-button`,href:e.url,target:`_blank`,rel:`noopener`,title:`open on the forge`},[B(A(Ks),{size:13,style:{transform:`rotate(45deg)`}})],8,hw)]))),128)),(I(!0),L(F,null,P(fe.value,([e,t])=>(I(),L(`pre`,{key:e,class:`pr-checks`},`#`+D(e)+` checks:`+D(`
|
|
80
|
-
`)+D(t),1))),128))])):H(``,!0)],64)):(I(),L(`p`,rw,[V(D(me.value===`gitlab`?`GitLab`:me.value===`bitbucket`?`Bitbucket`:`this forge`)+` — `+D(_e.value)+`s open on the website: review, approve and merge there (the device drives `,1),t[72]||=z(`code`,null,`git`,-1),t[73]||=V(` itself; only GitHub has a CLI it can drive). `,-1)]))])):H(``,!0),p.value?(I(),L(`pre`,gw,D(p.value.slice(0,6e3)),1)):H(``,!0)],64)):(I(),L(`p`,Ox,[...t[44]||=[V(`Not a git repository — run `,-1),z(`code`,null,`git init`,-1),V(` (or open a session inside a repo).`,-1)]]))],2)):H(``,!0),w.value?(I(),L(`div`,{key:5,class:`modal-veil`,onClick:t[40]||=ks(e=>w.value=null,[`self`])},[z(`div`,{class:E([`modal`,{danger:w.value.danger}]),role:`dialog`,"aria-modal":`true`},[z(`h5`,null,D(w.value.title),1),z(`p`,null,D(w.value.body),1),w.value.input?j((I(),L(`textarea`,{key:0,"onUpdate:modelValue":t[38]||=e=>ie.value=e,rows:`2`,placeholder:w.value.input.placeholder},null,8,_w)),[[ys,ie.value]]):H(``,!0),z(`div`,vw,[t[77]||=z(`span`,{class:`grow`},null,-1),z(`button`,{class:`small`,onClick:t[39]||=e=>w.value=null},[...t[76]||=[V(`cancel `,-1),z(`span`,{class:`muted-line`},`(esc)`,-1)]]),z(`button`,{class:E([`primary small`,{danger:w.value.danger}]),disabled:!(!w.value.input||ie.value.trim()),onClick:oe},D(w.value.confirmLabel??`confirm`),11,yw)])],2)])):H(``,!0)],64)):(I(),L(`p`,Sx,`No session selected — open a session to see its git.`))]))}}),[[`__scopeId`,`data-v-580f82d9`]]),xw={class:`host-panel`,"aria-label":`Device vitals`},Sw={class:`panel-heading`},Cw=[`disabled`],ww={key:0,class:`hint`},Tw={key:1,class:`message-error`},Ew={key:2,class:`hint`},Dw={class:`vitals-grid`},Ow={class:`vital`},kw={class:`vital`},Aw={key:0,class:`vital`},jw={class:`vital`},Mw={class:`vital`},Nw={class:`meter`},Pw={class:`meter-head`},Fw={class:`hint`},Iw=[`aria-valuenow`],Lw={class:`meter`},Rw={class:`meter-head`},zw={class:`hint`},Bw=[`aria-valuenow`],Vw={class:`path`},Hw={class:`hint`},Uw=of(N({__name:`HostPanel`,setup(e){let t=k(),n=k(!1),r=k(``),i=U(()=>q.value?.deviceId),a=U(()=>Vu.devices.value.find(e=>e.id===i.value)?.info?.keepAwake),o=e=>{if(!Number.isFinite(e)||e<=0)return`0`;let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=100||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`},s=e=>{let t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`},c=(e,t)=>t>0?Math.max(0,Math.min(100,Math.round(e/t*100))):0,l=U(()=>t.value?c(t.value.memory.usedBytes,t.value.memory.totalBytes):0),u=U(()=>t.value?.disk.known?c(t.value.disk.totalBytes-t.value.disk.freeBytes,t.value.disk.totalBytes):0);async function d(){let e=i.value;if(t.value=void 0,r.value=``,e){n.value=!0;try{t.value=await G(e).vitals()}catch(e){r.value=K(e).slice(0,160)}finally{n.value=!1}}}M(i,d,{immediate:!0});async function f(){await d(),r.value||Y(`Vitals refreshed.`)}return(e,c)=>(I(),L(`section`,xw,[z(`header`,Sw,[z(`span`,null,[B(A(il),{size:16}),c[0]||=V(`HOST`,-1)]),z(`button`,{class:`icon-button`,disabled:n.value||!i.value,"aria-label":`Refresh vitals`,title:`Refresh vitals`,onClick:f},[B(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,Cw)]),i.value?r.value?(I(),L(`p`,Tw,D(r.value),1)):t.value?(I(),L(F,{key:3},[z(`div`,Dw,[z(`div`,Ow,[c[1]||=z(`span`,{class:`label`},`Host uptime`,-1),z(`strong`,null,D(s(t.value.uptime)),1)]),z(`div`,kw,[c[2]||=z(`span`,{class:`label`},`Device process`,-1),z(`strong`,null,D(s(t.value.processUptime)),1),z(`em`,null,`pid `+D(t.value.pid),1)]),a.value?(I(),L(`div`,Aw,[c[3]||=z(`span`,{class:`label`},`Keep-awake`,-1),z(`strong`,null,D(a.value===`none`?`off`:a.value),1),z(`em`,null,D(a.value===`none`?`no inhibitor here`:`held while sessions run`),1)])):H(``,!0),z(`div`,jw,[c[4]||=z(`span`,{class:`label`},`Load (1/5/15m)`,-1),z(`strong`,null,D(t.value.loadavg.map(e=>e.toFixed(2)).join(` · `)),1),z(`em`,null,D(t.value.cpuCount)+` CPU`+D(t.value.cpuCount===1?``:`s`),1)]),z(`div`,Mw,[c[5]||=z(`span`,{class:`label`},`Sessions`,-1),z(`strong`,null,D(t.value.counts?.sessions??0),1),z(`em`,null,D(t.value.counts?.archived??0)+` archived`,1)])]),z(`div`,Nw,[z(`div`,Pw,[c[6]||=z(`span`,{class:`label`},`Memory`,-1),z(`span`,Fw,D(o(t.value.memory.usedBytes))+` / `+D(o(t.value.memory.totalBytes))+` · device `+D(o(t.value.memory.processRssBytes)),1)]),z(`div`,{class:`bar`,role:`meter`,"aria-valuenow":l.value,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-label":`Memory used`},[z(`i`,{style:T({width:`${l.value}%`}),class:E({high:l.value>=90})},null,6)],8,Iw)]),z(`div`,Lw,[z(`div`,Rw,[c[7]||=z(`span`,{class:`label`},`Disk · data dir`,-1),z(`span`,zw,[t.value.disk.known?(I(),L(F,{key:0},[V(D(o(t.value.disk.totalBytes-t.value.disk.freeBytes))+` used · `+D(o(t.value.disk.freeBytes))+` free `,1)],64)):(I(),L(F,{key:1},[V(`unknown on this volume`)],64))])]),z(`div`,{class:`bar`,role:`meter`,"aria-valuenow":u.value,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-label":`Disk used`},[z(`i`,{style:T({width:`${u.value}%`}),class:E({high:u.value>=90})},null,6)],8,Bw),z(`code`,Vw,D(t.value.disk.path),1)]),z(`p`,Hw,[B(A(Vs),{size:13}),c[8]||=V(` Read on demand — open this tab or press refresh. Nothing polls the device. `,-1)])],64)):(I(),L(`p`,Ew,D(n.value?`Reading host…`:`No vitals.`),1)):(I(),L(`p`,ww,`Select a session to see its device.`))]))}}),[[`__scopeId`,`data-v-481bbe80`]]);function Ww(e){let t=K(e);return e.code===`not_found`||/allowlist|not found/i.test(t)}function Gw(e,t){let n=Vu.devices.value.find(t=>t.id===e),r=n?.name||`This device`,i=n?.info;return i&&!i.packageVersion&&i.durableVersion?`${r} runs the pre-rename build (durable ${i.durableVersion}) — ${t} needs the new one. On that machine: npm i -g my-durable@latest, then dpi device stop && dpi device start.`:`${r} runs an older build — ${t}. Update it on that machine (\`dpi update\`).`}var Kw={class:`usage-panel`,"aria-label":`Device usage`},qw={class:`panel-heading`},Jw=[`disabled`],Yw={key:0,class:`hint`},Xw={key:1,class:`message-error`},Zw={key:2,class:`hint`},Qw={key:3,class:`hint`},$w={class:`usage-block`,"aria-labelledby":`usage-totals`},eT={class:`totals`},tT={class:`total`},nT={class:`total`},rT={class:`total`},iT={class:`total`},aT={class:`usage-block`,"aria-labelledby":`usage-models`},oT={class:`section-label block-label`},sT={class:`table-scroll`},cT={class:`usage-table`,"aria-label":`Usage by model`},lT=[`title`],uT={class:`num`},dT={class:`num`},fT={class:`share-col`},pT={class:`share`},mT=[`aria-valuenow`,`aria-label`],hT={class:`pct`},gT={class:`usage-block`,"aria-labelledby":`usage-projects`},_T={class:`section-label block-label`},vT={key:0,class:`hint`},yT={key:1,class:`rows`},bT=[`title`],xT={class:`row-main`},ST={class:`row-num`},CT={class:`row-num`},wT={class:`row-meta`},TT={class:`usage-block`,"aria-labelledby":`usage-sessions`},ET={key:0,class:`hint`},DT={key:1,class:`rows scroll`},OT=[`title`],kT={class:`row-main`},AT={class:`row-num`},jT={class:`row-num`},MT={class:`row-meta`},NT={class:`hint`},PT=of(N({__name:`UsagePanel`,setup(e){let t=k(),n=k(!1),r=k(``),i=U(()=>q.value?.deviceId),a=e=>Math.round(e||0).toLocaleString(`en-US`),o=e=>{let t=e||0;return t===0?`$0.0000`:t<1e-4?`$${t.toPrecision(2)}`:t<.01?`$${t.toFixed(6)}`:`$${t.toFixed(4)}`},s=U(()=>(t.value?.models??[]).reduce((e,t)=>Math.max(e,t.cost||0),0)),c=e=>s.value>0?Math.max(0,Math.min(100,Math.round((e||0)/s.value*100))):0,l=U(()=>{let e=t.value;return!e||!e.models.length&&!e.sessions.length&&!e.projects.length}),u=U(()=>t.value?new Date(t.value.at).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`}):``),d=(e,t)=>`${a(e)} ${t}${e===1?``:`s`}`;async function f(){let e=i.value;if(t.value=void 0,r.value=``,e){n.value=!0;try{t.value=await G(e).deviceUsage()}catch(e){r.value=Ww(e)?Gw(i.value,`usage`):K(e).slice(0,220)}finally{n.value=!1}}}M(i,f,{immediate:!0});async function p(){await f(),r.value||Y(`Usage refreshed.`)}return(e,s)=>(I(),L(`section`,Kw,[z(`header`,qw,[z(`span`,null,[B(A(Vs),{size:16}),s[0]||=V(`USAGE`,-1)]),z(`button`,{class:`icon-button`,disabled:n.value||!i.value,"aria-label":`Refresh usage`,title:`Refresh usage`,onClick:p},[B(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,Jw)]),i.value?r.value?(I(),L(`p`,Xw,D(r.value),1)):t.value?l.value?(I(),L(`p`,Qw,`No usage recorded yet.`)):(I(),L(F,{key:4},[z(`section`,$w,[s[6]||=z(`div`,{class:`section-label block-label`},[z(`span`,{id:`usage-totals`},`TOTALS`)],-1),z(`div`,eT,[z(`div`,tT,[s[1]||=z(`span`,{class:`label`},`Tokens`,-1),z(`strong`,null,D(a(t.value.totals.tokens)),1)]),z(`div`,nT,[s[2]||=z(`span`,{class:`label`},`Cost`,-1),z(`strong`,null,D(o(t.value.totals.cost)),1)]),z(`div`,rT,[s[3]||=z(`span`,{class:`label`},`Sessions`,-1),z(`strong`,null,D(a(t.value.sessions.length)),1),z(`em`,null,D(a(t.value.projects.length))+` projects`,1)]),z(`div`,iT,[s[4]||=z(`span`,{class:`label`},`Models`,-1),z(`strong`,null,D(a(t.value.models.length)),1),s[5]||=z(`em`,null,`costliest first`,-1)])])]),z(`section`,aT,[z(`div`,oT,[s[7]||=z(`span`,{id:`usage-models`},`BY MODEL`,-1),B(A(dc),{size:13})]),z(`div`,sT,[z(`table`,cT,[s[8]||=z(`colgroup`,null,[z(`col`),z(`col`),z(`col`),z(`col`)],-1),s[9]||=z(`thead`,null,[z(`tr`,null,[z(`th`,{scope:`col`},`Model`),z(`th`,{scope:`col`,class:`num`},`Tokens`),z(`th`,{scope:`col`,class:`num`},`Cost`),z(`th`,{scope:`col`,class:`share-col`},`Share`)])],-1),z(`tbody`,null,[(I(!0),L(F,null,P(t.value.models,e=>(I(),L(`tr`,{key:e.key},[z(`th`,{scope:`row`,class:`model-key`,title:`${e.key} — in ${e.input} · out ${e.output} · cache read ${e.cacheRead} · cache write ${e.cacheWrite}`},D(e.key),9,lT),z(`td`,uT,D(a(e.tokens)),1),z(`td`,dT,D(o(e.cost)),1),z(`td`,fT,[z(`div`,pT,[z(`div`,{class:`bar`,role:`meter`,"aria-valuenow":c(e.cost),"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-label":`${e.key} share of the costliest model`},[z(`i`,{style:T({width:`${c(e.cost)}%`}),class:E({high:c(e.cost)>90})},null,6)],8,mT),z(`em`,hT,D(c(e.cost))+`%`,1)])])]))),128))])])])]),z(`section`,gT,[z(`div`,_T,[s[10]||=z(`span`,{id:`usage-projects`},`BY PROJECT`,-1),B(A(vc),{size:13})]),t.value.projects.length?(I(),L(`ul`,yT,[(I(!0),L(F,null,P(t.value.projects,e=>(I(),L(`li`,{key:e.rootPath,class:`row`,title:e.rootPath},[z(`span`,xT,[z(`strong`,null,D(e.name),1),z(`em`,null,D(e.rootPath),1)]),z(`span`,ST,D(a(e.tokens))+` tok`,1),z(`span`,CT,D(o(e.cost)),1),z(`span`,wT,D(d(e.sessions,`session`)),1)],8,bT))),128))])):(I(),L(`p`,vT,`No project usage recorded yet.`))]),z(`section`,TT,[s[11]||=z(`div`,{class:`section-label block-label`},[z(`span`,{id:`usage-sessions`},`BY SESSION`)],-1),t.value.sessions.length?(I(),L(`ul`,DT,[(I(!0),L(F,null,P(t.value.sessions,e=>(I(),L(`li`,{key:e.id,class:`row`,title:e.cwd},[z(`span`,kT,[z(`strong`,null,D(e.name),1),z(`em`,null,D(e.project??e.cwd),1)]),z(`span`,AT,D(a(e.tokens))+` tok`,1),z(`span`,jT,D(o(e.cost)),1),z(`span`,MT,D(d(e.agents,`agent`)),1)],8,OT))),128))])):(I(),L(`p`,ET,`No session usage recorded yet.`))]),z(`p`,NT,[B(A(Vs),{size:13}),V(` Read on demand — open this tab or press refresh (`+D(u.value)+`). Nothing polls the device. `,1)])],64)):(I(),L(`p`,Zw,D(n.value?`Reading usage…`:`No usage recorded yet.`),1)):(I(),L(`p`,Yw,`Select a session to see its device's usage.`))]))}}),[[`__scopeId`,`data-v-e7ae1fd0`]]),FT={class:`schedules-panel`,"aria-label":`Scheduled sessions`},IT={class:`panel-heading`},LT=[`disabled`],RT=[`disabled`],zT={key:0,class:`hint`},BT={key:1,class:`message-error`},VT=[`disabled`],HT={key:0,value:``},UT={key:1,value:``},WT=[`value`],GT={class:`trigger-row`},KT={class:`inline`},qT=[`disabled`],JT={class:`inline`},YT=[`disabled`],XT={class:`row`},ZT=[`disabled`],QT={key:3,class:`hint`},$T={key:4,class:`schedule-list`},eE={class:`head`},tE={class:`tag`},nE={key:0,class:`tag running`},rE=[`title`],iE={class:`next`},aE={class:`cwd`},oE={key:0,class:`message-error`},sE={class:`row`},cE=[`disabled`,`onClick`],lE=[`disabled`,`onClick`],uE=[`disabled`,`onClick`],dE=of(N({__name:`SchedulesPanel`,setup(e){let t=k([]),n=k(``),r=k(``),i=k(!1),a=U(()=>q.value?.deviceId),o=()=>G(a.value??``),s=k(`60`),c=k(``),l=k(!1),u=k({name:``,cwd:``,prompt:``,model:``});async function d(){if(!a.value)return void(t.value=[]);i.value=!0,r.value=``;try{t.value=(await o().schedules()).schedules}catch(e){r.value=Ww(e)?Gw(a.value,`schedules`):K(e).slice(0,220)}finally{i.value=!1}}M(a,d,{immediate:!0});let f=e=>{if(!e)return`—`;let t=e-Date.now(),n=Math.round(Math.abs(t)/6e4),r=n<60?`${n}m`:n<1440?`${Math.round(n/60)}h`:`${Math.round(n/1440)}d`;return t>=0?`in ${r}`:`${r} ago`},p=e=>e.everyMinutes?`every ${e.everyMinutes}m`:`daily ${e.dailyAt}`;async function m(e,t,r){n.value=e;try{await t(),await d(),Y(r)}catch(e){Y(K(e).slice(0,140))}finally{n.value=``}}let h=e=>m(e.id,()=>o().updateSchedule(e.id,{enabled:!e.enabled}),e.enabled?`Schedule paused.`:`Schedule resumed.`),g=e=>m(e.id,()=>o().runSchedule(e.id),`${e.name}: run started.`),_=e=>J.dialog={kind:`prompt`,title:`Remove ${e.name}?`,hint:`The schedule stops being run. Sessions it already created are untouched.`,submit:`Remove schedule`,danger:!0,run:()=>m(e.id,()=>o().removeSchedule(e.id),`Schedule removed.`)},v=k([]),y=k(!1);async function b(){l.value=!0,u.value={name:``,cwd:``,prompt:``,model:``},v.value=[],y.value=!0;try{let e=await o().device();v.value=e.models.map(e=>({key:`${e.provider}/${e.id}`})),u.value.model=e.defaultModel}catch{v.value=[]}finally{y.value=!1}}async function x(){let e=u.value,[t,...r]=e.model.split(`/`),i=r.join(`/`);if(e.name.trim()&&e.cwd.trim()&&e.prompt.trim()){if(!t||!i){Y(y.value?`Still loading the model list — one moment.`:`Pick a model first.`);return}n.value=`new`;try{await o().createSchedule({name:e.name.trim(),cwd:e.cwd.trim(),prompt:e.prompt,model:{provider:t,modelId:i},...c.value.trim()?{dailyAt:c.value.trim()}:{everyMinutes:Number(s.value)||60}}),l.value=!1,await d(),Y(`Schedule created. The device runs it on its own clock.`)}catch(e){Y(K(e).slice(0,160))}finally{n.value=``}}}return(e,o)=>(I(),L(`section`,FT,[z(`header`,IT,[z(`span`,null,[B(A(ec),{size:16}),o[7]||=V(`SCHEDULES`,-1)]),z(`button`,{class:`icon-button`,disabled:i.value||!a.value,"aria-label":`Refresh schedules`,title:`Refresh schedules`,onClick:d},[B(A($c),{size:15,class:E({spin:i.value})},null,8,[`class`])],8,LT),z(`button`,{class:`icon-button`,disabled:!a.value,"aria-label":`Add schedule`,title:`Add schedule`,onClick:b},[B(A(Xc),{size:15})],8,RT)]),o[18]||=z(`p`,{class:`hint`},`Runs on the device's own clock — no browser needs to be open.`,-1),a.value?r.value?(I(),L(`p`,BT,D(r.value),1)):H(``,!0):(I(),L(`p`,zT,`Select a session to see its device.`)),l.value?(I(),L(`form`,{key:2,class:`add-form`,onSubmit:ks(x,[`prevent`])},[z(`label`,null,[o[8]||=V(`Name`,-1),j(z(`input`,{"onUpdate:modelValue":o[0]||=e=>u.value.name=e,placeholder:`Nightly smoke`,required:``},null,512),[[ys,u.value.name]])]),z(`label`,null,[o[9]||=V(`Directory`,-1),j(z(`input`,{"onUpdate:modelValue":o[1]||=e=>u.value.cwd=e,placeholder:`/home/me/project`,required:``},null,512),[[ys,u.value.cwd]])]),z(`label`,null,[o[10]||=V(`Prompt`,-1),j(z(`textarea`,{"onUpdate:modelValue":o[2]||=e=>u.value.prompt=e,rows:`3`,placeholder:`Run the tests and summarise failures`,required:``},null,512),[[ys,u.value.prompt]])]),z(`label`,null,[o[11]||=V(`Model `,-1),j(z(`select`,{"onUpdate:modelValue":o[3]||=e=>u.value.model=e,disabled:y.value},[y.value?(I(),L(`option`,HT,`loading…`)):v.value.length?H(``,!0):(I(),L(`option`,UT,`(no models — check the device)`)),(I(!0),L(F,null,P(v.value,e=>(I(),L(`option`,{key:e.key,value:e.key},D(e.key),9,WT))),128))],8,VT),[[Ss,u.value.model]])]),z(`div`,GT,[z(`label`,KT,[o[12]||=V(`Every `,-1),j(z(`input`,{"onUpdate:modelValue":o[4]||=e=>s.value=e,class:`num`,disabled:!!c.value.trim()},null,8,qT),[[ys,s.value]]),o[13]||=V(` min`,-1)]),o[15]||=z(`span`,{class:`muted`},`or`,-1),z(`label`,JT,[o[14]||=V(`daily at `,-1),j(z(`input`,{"onUpdate:modelValue":o[5]||=e=>c.value=e,class:`num time`,placeholder:`03:00`,disabled:!!s.value},null,8,YT),[[ys,c.value]])])]),z(`div`,XT,[z(`button`,{class:`primary small`,type:`submit`,disabled:n.value===`new`||y.value||!u.value.model},D(n.value===`new`?`creating…`:y.value?`loading models…`:`Create schedule`),9,ZT),z(`button`,{class:`small`,type:`button`,onClick:o[6]||=e=>l.value=!1},`Cancel`)])],32)):H(``,!0),!l.value&&!t.value.length&&a.value&&!r.value?(I(),L(`p`,QT,D(i.value?`Reading schedules…`:`No schedules yet. Press + to add one.`),1)):H(``,!0),t.value.length?(I(),L(`ul`,$T,[(I(!0),L(F,null,P(t.value,e=>(I(),L(`li`,{key:e.id,class:E([`schedule`,{off:!e.enabled}])},[z(`div`,eE,[z(`b`,null,D(e.name),1),z(`span`,tE,D(p(e)),1),e.running?(I(),L(`span`,nE,`running`)):e.lastOutcome===`failed`?(I(),L(`span`,{key:1,class:`tag bad`,title:e.lastError},`last run failed`,8,rE)):H(``,!0),z(`span`,iE,D(e.enabled?`next ${f(e.nextRunAt)}`:`paused`),1)]),z(`code`,aE,D(e.cwd),1),e.lastError?(I(),L(`p`,oE,D(e.lastError.slice(0,160)),1)):H(``,!0),z(`div`,sE,[z(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>g(e)},[B(A(Yc),{size:12}),o[16]||=V(`run now`,-1)],8,cE),z(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>h(e)},[B(A(Zc),{size:12}),V(D(e.enabled?`pause`:`resume`),1)],8,lE),z(`button`,{class:`small danger`,disabled:n.value===e.id,onClick:t=>_(e)},[B(A(ml),{size:12}),o[17]||=V(`remove`,-1)],8,uE)])],2))),128))])):H(``,!0)]))}}),[[`__scopeId`,`data-v-7a785dcc`]]),fE={class:`archive-panel`,"aria-label":`Old sessions`},pE={class:`panel-heading`},mE=[`disabled`],hE={key:0,class:`hint`},gE={key:1,class:`message-error`},_E={key:2,class:`hint`},vE={key:3,class:`old-list`},yE={class:`head`},bE=[`title`],xE={class:`meta`},SE=[`aria-label`,`onClick`],CE=[`aria-label`,`onClick`],wE={class:`facts`},TE={key:0,class:`cwd`},EE={key:1,class:`tag`},DE={class:`meta`},OE={class:`meta`},kE={key:2,class:`meta`},AE=of(N({__name:`ArchivePanel`,setup(e){let t=k(null),n=k(!1),r=k(``),i=U(()=>q.value?.deviceId),a=()=>G(i.value??``);async function o(){if(!i.value)return void(t.value=null);n.value=!0,r.value=``;try{t.value=(await a().archived()).sessions}catch(e){r.value=Ww(e)?Gw(i.value,`browsing old sessions`):K(e).slice(0,220)}finally{n.value=!1}}M(i,o,{immediate:!0});let s=e=>{if(e<=0)return`0`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=100||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`},c=e=>{let t=Math.max(0,(Date.now()-e)/1e3);return t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`};function l(e){J.dialog={kind:`prompt`,title:`Restore “${e.name}”?`,hint:`The session returns to the live list with its transcript and jobs intact. Nothing is copied — the bundle simply moves back.`,submit:`Restore`,run:async()=>{await a().restoreArchived(e.sessionId),await o(),Y(`${e.name} restored to the live list.`)}}}async function u(e){try{let t=await a().archivedTranscript(e.sessionId,`markdown`),n=new Blob([t.text??``],{type:`text/markdown`}),r=document.createElement(`a`);r.href=URL.createObjectURL(n),r.download=`${e.name.replace(/[^\w.-]+/g,`_`)||e.sessionId}.md`,r.click(),URL.revokeObjectURL(r.href)}catch(e){Y(K(e).slice(0,160))}}return(e,a)=>(I(),L(`section`,fE,[z(`header`,pE,[z(`span`,null,[B(A(Us),{size:16}),a[0]||=V(`ARCHIVE`,-1)]),z(`button`,{class:`icon-button`,disabled:n.value||!i.value,"aria-label":`Refresh archive`,title:`Refresh archive`,onClick:o},[B(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,mE)]),a[2]||=z(`p`,{class:`hint`},` Every session this device ever archived — read-only. Restore brings one back to the live list; nothing here deletes. `,-1),i.value?r.value?(I(),L(`p`,gE,D(r.value),1)):t.value&&!t.value.length?(I(),L(`p`,_E,`Nothing archived on this device yet.`)):H(``,!0):(I(),L(`p`,hE,`Select a session to see its device.`)),t.value?.length?(I(),L(`ul`,vE,[(I(!0),L(F,null,P(t.value,e=>(I(),L(`li`,{key:`${e.sessionId}-${e.archivedAt}`,class:`old`},[z(`div`,yE,[z(`b`,null,D(e.name),1),z(`span`,{class:`tag`,title:e.hasManifest?`bundled with full identity`:`old bundle — name unknown`},D(e.hasManifest?`manifest`:`legacy`),9,bE),z(`span`,xE,`archived `+D(c(e.archivedAt)),1),a[1]||=z(`span`,{class:`spacer`},null,-1),z(`button`,{class:`icon-button`,"aria-label":`Download transcript of ${e.name}`,title:`Download transcript (markdown)`,onClick:t=>u(e)},[B(A(pc),{size:13})],8,SE),z(`button`,{class:`icon-button`,"aria-label":`Restore ${e.name}`,title:`Restore to the live list`,onClick:t=>l(e)},[B(A(tl),{size:13})],8,CE)]),z(`div`,wE,[e.cwd?(I(),L(`span`,TE,D(e.cwd),1)):H(``,!0),e.model?(I(),L(`span`,EE,D(e.model),1)):H(``,!0),z(`span`,DE,D(e.turns>=0?`${e.turns} turns`:`turns unknown`),1),z(`span`,OE,D(s(e.bytes)),1),e.lastMessageAt?(I(),L(`span`,kE,`last message `+D(c(e.lastMessageAt)),1)):H(``,!0)])]))),128))])):H(``,!0)]))}}),[[`__scopeId`,`data-v-dfb29802`]]),jE={class:`graph-panel`,"aria-label":`Task graphs`},ME={class:`panel-heading`},NE=[`disabled`],PE=[`disabled`],FE={key:0,class:`hint`},IE={key:1,class:`message-error`},LE={key:2,class:`hint`},RE={class:`row`},zE=[`disabled`],BE={class:`head`},VE=[`title`],HE=[`aria-label`,`disabled`,`onClick`],UE=[`aria-label`,`onClick`],WE={class:`tasks`},GE=[`title`],KE={key:0,class:`deps`},qE={class:`tag`},JE={key:1,class:`err`},YE=of(N({__name:`GraphPanel`,setup(e){let t=k([]),n=k({}),r=k(!1),i=k(``),a=k(``),o=k(!1),s=k(``),c=U(()=>q.value?.deviceId),l=()=>G(c.value??``);async function u(){if(!c.value)return void(t.value=[]);r.value=!0,i.value=``;try{let e=await l().graphs();t.value=e.graphs,n.value={}}catch(e){i.value=Ww(e)?Gw(c.value,`running task-graphs`):K(e).slice(0,220)}finally{r.value=!1}}M(c,u,{immediate:!0});let d={ok:`ok`,failed:`bad`,running:`run`,pending:``,skipped:`skip`};function f(e,t){return n.value[e.id]?.tasks[t]?.status??e.lastRun?.tasks[t]?.status??`pending`}async function p(e){try{let t=await l().graph(e.id);n.value={...n.value,[e.id]:t.runs[0]??e.lastRun},t.runs.length||Y(`This graph has not run yet.`)}catch(e){Y(K(e).slice(0,140))}}async function m(e){a.value=e.id;try{let{run:t}=await l().runGraph(e.id);n.value={...n.value,[e.id]:t},Y(`Run started: ${Object.keys(t.tasks).length} tasks.`),p(e)}catch(e){Y(K(e).slice(0,140))}finally{a.value=``}}function h(e){J.dialog={kind:`prompt`,title:`Remove the graph "${e.name}"?`,hint:`The registry record goes. Sessions the graph created are never touched.`,submit:`Remove graph`,danger:!0,run:async()=>{await l().removeGraph(e.id),await u()}}}async function g(){let e=s.value.trim();if(e){a.value=`new`;try{let t=JSON.parse(e),n=await l().createGraph({name:String(t.name??``),cwd:String(t.cwd??``),tasks:t.tasks});o.value=!1,s.value=``,Y(`Graph "${n.name}" added (${n.tasks.length} tasks).`),await u()}catch(e){Y(K(e).slice(0,200))}finally{a.value=``}}}return(e,l)=>(I(),L(`section`,jE,[z(`header`,ME,[z(`span`,null,[B(A(gl),{size:16}),l[3]||=V(`DAG`,-1)]),z(`button`,{class:`icon-button`,disabled:r.value||!c.value,"aria-label":`Refresh graphs`,title:`Refresh`,onClick:u},[B(A($c),{size:15,class:E({spin:r.value})},null,8,[`class`])],8,NE),z(`button`,{class:`icon-button`,disabled:!c.value||!!i.value,"aria-label":`Add a graph`,title:`Add a graph from JSON`,onClick:l[0]||=e=>o.value=!o.value},[B(A(Xc),{size:15})],8,PE)]),l[7]||=z(`p`,{class:`hint`},`Tasks run on the device, in dependency order — one fresh session each.`,-1),c.value?i.value?(I(),L(`p`,IE,D(i.value),1)):!t.value.length&&!o.value?(I(),L(`p`,LE,` No graphs yet. Press + and paste a graph JSON ({ name, cwd, tasks: [{ id, name, prompt, dependsOn }] }). `)):H(``,!0):(I(),L(`p`,FE,`Select a session to see its device.`)),o.value?(I(),L(`form`,{key:3,class:`add-form`,onSubmit:ks(g,[`prevent`])},[z(`label`,null,[l[4]||=V(`Graph JSON `,-1),j(z(`textarea`,{"onUpdate:modelValue":l[1]||=e=>s.value=e,rows:`8`,placeholder:`{ "name": "nightly", "cwd": "~/work/app", "tasks": [{ "id": "build", "name": "Build", "prompt": "run the build", "dependsOn": [] }, { "id": "report", "name": "Report", "prompt": "summarise", "dependsOn": ["build"] }] }`},null,512),[[ys,s.value]])]),z(`div`,RE,[z(`button`,{class:`primary small`,type:`submit`,disabled:a.value===`new`},D(a.value===`new`?`adding…`:`Add graph`),9,zE),z(`button`,{class:`small`,type:`button`,onClick:l[2]||=e=>o.value=!1},`Cancel`)])],32)):H(``,!0),(I(!0),L(F,null,P(t.value,e=>(I(),L(`div`,{key:e.id,class:`graph`},[z(`div`,BE,[z(`b`,null,D(e.name),1),z(`code`,{class:`cwd`,title:e.cwd},D(e.cwd.split(`/`).filter(Boolean).at(-1)||e.cwd),9,VE),z(`span`,{class:E([`tag`,d[e.lastRun?.status??`pending`]??``])},D(e.lastRun?e.lastRun.status:`never run`),3),l[5]||=z(`span`,{class:`spacer`},null,-1),z(`button`,{class:`icon-button`,"aria-label":`Run ${e.name}`,title:`Run now`,disabled:a.value===e.id,onClick:t=>m(e)},[B(A(Yc),{size:14})],8,HE),z(`button`,{class:`icon-button`,"aria-label":`Remove ${e.name}`,title:`Remove graph`,onClick:t=>h(e)},[B(A(ml),{size:14})],8,UE)]),z(`ul`,WE,[(I(!0),L(F,null,P(e.tasks,t=>(I(),L(`li`,{key:t.id,class:E(d[f(e,t.id)])},[l[6]||=z(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),z(`span`,{class:`name`,title:t.prompt},D(t.name),9,GE),t.dependsOn.length?(I(),L(`code`,KE,`← `+D(t.dependsOn.join(`, `)),1)):H(``,!0),z(`span`,qE,D(f(e,t.id)),1),n.value[e.id]?.tasks[t.id]?.error?(I(),L(`em`,JE,D(n.value[e.id].tasks[t.id].error.slice(0,120)),1)):H(``,!0)],2))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-af2970aa`]]),XE={class:`notify-panel`,"aria-label":`Notification sinks`},ZE={class:`panel-heading`},QE=[`disabled`],$E=[`disabled`],eD=[`disabled`],tD={key:0,class:`hint`},nD={key:1,class:`message-error`},rD=[`placeholder`],iD={class:`row`},aD=[`disabled`],oD={key:3,class:`hint`},sD={key:4,class:`sink-list`},cD={class:`head`},lD={class:`tag`},uD={class:`next`},dD={class:`url`},fD={key:0,class:`hint`},pD={key:1,class:`message-error`},mD={class:`row`},hD=[`disabled`,`onClick`],gD=[`disabled`,`onClick`],_D={key:5,class:`results`,"aria-label":`Test results`},vD={class:`tag`},yD={key:0},bD=of(N({__name:`NotifyPanel`,setup(e){let t=k([]),n=k(``),r=k(``),i=k(!1),a=k([]),o=U(()=>q.value?.deviceId),s=()=>G(o.value??``),c=k(!1),l=k({kind:`webhook`,url:``,label:``,events:``});async function u(){if(!o.value)return void(t.value=[]);i.value=!0,r.value=``;try{t.value=(await s().notifySinks()).sinks}catch(e){r.value=Ww(e)?Gw(o.value,`notifications`):K(e).slice(0,220)}finally{i.value=!1}}M(o,u,{immediate:!0});let d=e=>{if(!e)return`never`;let t=Math.round((Date.now()-e)/6e4);return t<1?`just now`:t<60?`${t}m ago`:`${Math.round(t/60)}h ago`};async function f(){let e=l.value;if(e.url.trim()){n.value=`new`;try{await s().createNotifySink({kind:e.kind,url:e.url.trim(),...e.label.trim()?{label:e.label.trim()}:{},...e.events.trim()?{events:e.events.split(`,`).map(e=>e.trim()).filter(Boolean)}:{}}),c.value=!1,l.value={kind:`webhook`,url:``,label:``,events:``},await u(),Y(`Sink added on the device.`)}catch(e){Y(K(e).slice(0,160))}finally{n.value=``}}}async function p(e){n.value=e.id;try{await s().updateNotifySink(e.id,{enabled:!e.enabled}),await u()}catch(e){Y(K(e).slice(0,140))}finally{n.value=``}}function m(e){J.dialog={kind:`prompt`,title:`Remove this ${e.kind} sink?`,hint:`The device stops notifying this target. Nothing else changes.`,submit:`Remove sink`,danger:!0,run:async()=>{await s().removeNotifySink(e.id),await u()}}}async function h(){n.value=`test`,a.value=[];try{a.value=(await s().testNotifySinks()).results;let e=a.value.filter(e=>e.status===`failed`).length;Y(a.value.length?`Test: ${a.value.length-e} sent${e?`, ${e} failed`:``}.`:`No enabled sinks matched — nothing was sent.`)}catch(e){Y(K(e).slice(0,160))}finally{n.value=``}}return(e,s)=>(I(),L(`section`,XE,[z(`header`,ZE,[z(`span`,null,[B(A(Xs),{size:16}),s[6]||=V(`NOTIFY`,-1)]),z(`button`,{class:`icon-button`,disabled:i.value||!o.value,"aria-label":`Refresh sinks`,title:`Refresh sinks`,onClick:u},[B(A($c),{size:15,class:E({spin:i.value})},null,8,[`class`])],8,QE),z(`button`,{class:`icon-button`,disabled:!o.value||!t.value.length||n.value===`test`,"aria-label":`Send a test notification`,title:`Send a test event through every enabled sink`,onClick:h},[B(A(rl),{size:15})],8,$E),z(`button`,{class:`icon-button`,disabled:!o.value,"aria-label":`Add a sink`,title:`Add a sink`,onClick:s[0]||=e=>c.value=!c.value},[B(A(Xc),{size:15})],8,eD)]),s[14]||=z(`p`,{class:`hint`},`Delivered by the device — no browser needs to be open.`,-1),o.value?r.value?(I(),L(`p`,nD,D(r.value),1)):H(``,!0):(I(),L(`p`,tD,`Select a session to see its device.`)),c.value?(I(),L(`form`,{key:2,class:`add-form`,onSubmit:ks(f,[`prevent`])},[z(`label`,null,[s[8]||=V(`Kind `,-1),j(z(`select`,{"onUpdate:modelValue":s[1]||=e=>l.value.kind=e},[...s[7]||=[z(`option`,{value:`webhook`},`webhook (JSON POST)`,-1),z(`option`,{value:`ntfy`},`ntfy (topic)`,-1)]],512),[[Ss,l.value.kind]])]),z(`label`,null,[s[9]||=V(`URL `,-1),j(z(`input`,{"onUpdate:modelValue":s[2]||=e=>l.value.url=e,placeholder:l.value.kind===`ntfy`?`https://ntfy.sh/my-topic`:`https://example.com/hook`,required:``},null,8,rD),[[ys,l.value.url]])]),z(`label`,null,[s[10]||=V(`Label`,-1),j(z(`input`,{"onUpdate:modelValue":s[3]||=e=>l.value.label=e,placeholder:`phone`},null,512),[[ys,l.value.label]])]),z(`label`,null,[s[11]||=V(`Events `,-1),j(z(`input`,{"onUpdate:modelValue":s[4]||=e=>l.value.events=e,placeholder:`empty = all — e.g. session.failed,schedule.*`},null,512),[[ys,l.value.events]])]),z(`div`,iD,[z(`button`,{class:`primary small`,type:`submit`,disabled:n.value===`new`},D(n.value===`new`?`adding…`:`Add sink`),9,aD),z(`button`,{class:`small`,type:`button`,onClick:s[5]||=e=>c.value=!1},`Cancel`)]),s[12]||=z(`p`,{class:`hint`},[V(`LAN targets (192.168.x, localhost) need `),z(`code`,null,`DPI_NOTIFY_ALLOW_PRIVATE=1`),V(` on the device.`)],-1)],32)):H(``,!0),!c.value&&!t.value.length&&o.value&&!r.value?(I(),L(`p`,oD,` No sinks yet. Press + to add a webhook or an ntfy topic. `)):H(``,!0),t.value.length?(I(),L(`ul`,sD,[(I(!0),L(F,null,P(t.value,e=>(I(),L(`li`,{key:e.id,class:E([`sink`,{off:!e.enabled}])},[z(`div`,cD,[z(`span`,lD,D(e.kind),1),z(`b`,null,D(e.label||e.url),1),z(`em`,uD,D(e.lastError?`last failed`:`sent ${d(e.lastDeliveryAt)}`),1)]),z(`code`,dD,D(e.url),1),e.events?.length?(I(),L(`p`,fD,`events: `+D(e.events.join(`, `)),1)):H(``,!0),e.lastError?(I(),L(`p`,pD,D(e.lastError.slice(0,160)),1)):H(``,!0),z(`div`,mD,[z(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>p(e)},[B(A(Zc),{size:12}),V(D(e.enabled?`disable`:`enable`),1)],8,hD),z(`button`,{class:`small danger`,disabled:n.value===e.id,onClick:t=>m(e)},[B(A(ml),{size:12}),s[13]||=V(`remove`,-1)],8,gD)])],2))),128))])):H(``,!0),a.value.length?(I(),L(`ul`,_D,[(I(!0),L(F,null,P(a.value,e=>(I(),L(`li`,{key:e.id,class:E(e.status)},[z(`span`,vD,D(e.status),1),V(` `+D(e.kind)+` `+D(e.id.slice(0,8))+` `,1),e.detail?(I(),L(`em`,yD,D(e.detail),1)):H(``,!0)],2))),128))])):H(``,!0)]))}}),[[`__scopeId`,`data-v-305864c8`]]),xD={class:`env-panel`,"aria-label":`Device environment`},SD={class:`panel-heading`},CD=[`disabled`],wD=[`disabled`],TD={key:0,class:`hint`},ED={key:1,class:`message-error`},DD={key:2,class:`message-restart`},OD={class:`row`},kD=[`disabled`],AD={key:4,class:`hint`},jD={key:5,class:`var-list`},MD={class:`head`},ND={class:`key`},PD={class:`tag`},FD={key:0,class:`tag`,title:`Has its own setting; edit that instead`},ID=[`aria-label`,`title`,`onClick`],LD=[`aria-label`,`onClick`],RD=[`title`],zD={key:6,class:`hint path`},BD={class:`panel-heading keys-heading`},VD=[`disabled`],HD=[`disabled`],UD={key:7,class:`message-error`},WD={class:`row`},GD=[`disabled`],KD={key:9,class:`hint`},qD={key:10,class:`var-list`},JD={class:`head`},YD={class:`key`},XD={class:`tag`},ZD={key:0,class:`tag`,title:`Set by pi /login — read-only here`},QD=[`aria-label`,`onClick`],$D={class:`value`,title:`write-only — masked tail`},eO=of(N({__name:`EnvPanel`,setup(e){let t=k(null),n=k(!1),r=k(``),i=k(``),a=U(()=>q.value?.deviceId),o=()=>G(a.value??``),s=k(!1),c=k({key:``,value:``});async function l(){if(!a.value)return void(t.value=null);n.value=!0,r.value=``;try{t.value=await o().envView()}catch(e){r.value=Ww(e)?Gw(a.value,`editing env vars`):K(e).slice(0,220)}finally{n.value=!1}m()}M(a,l,{immediate:!0});let u=k(null),d=k(``),f=k(!1),p=k({providerId:``,key:``});async function m(){if(!a.value)return void(u.value=null);try{u.value=await o().piAuth(),d.value=``}catch(e){K(e),d.value=Ww(e)?Gw(a.value,`managing pi keys`):K(e).slice(0,220)}}async function h(){let e=p.value.providerId.trim();if(e&&p.value.key){i.value=`pi-key`;try{let t=await o().setPiApiKey(e,p.value.key);p.value={providerId:``,key:``},f.value=!1,await m(),Y(`${e} saved (now ${t.masked}) — restart the device to apply it.`)}catch(e){Y(K(e).slice(0,160))}finally{i.value=``}}}function g(e){J.dialog={kind:`prompt`,title:`Remove the ${e} key?`,hint:`The entry is deleted from pi's auth.json. pi's own logins are never touched. Restart the device to apply.`,submit:`Remove`,danger:!0,run:async()=>{await o().removePiApiKey(e),await m(),Y(`${e} removed — restart the device to apply it.`)}}}let _=e=>e.source===`file`&&!e.managed;async function v(){let e=c.value.key.trim().toUpperCase();if(e&&c.value.value){i.value=`new`;try{await o().setEnvVar(e,c.value.value),s.value=!1,c.value={key:``,value:``},await l(),Y(`${e} saved — restart the device to apply it.`)}catch(e){Y(K(e).slice(0,160))}finally{i.value=``}}}function y(e){J.dialog={kind:`prompt`,title:`Set ${e.key}`,label:`Value`,hint:e.secret?`The current value is secret and stays masked. Type a new value to replace it.`:`Single line. Applies after the next device restart.`,value:e.secret?``:e.masked,placeholder:e.secret?e.masked:``,submit:`Save value`,run:async t=>{if(!t)throw Error(`A value is required`);await o().setEnvVar(e.key,t),await l(),Y(`${e.key} saved — restart the device to apply it.`)}}}function b(e){J.dialog={kind:`prompt`,title:`Remove ${e.key} from the env file?`,hint:`The line is deleted from the file. Restart the device to apply it.`,submit:`Remove`,danger:!0,run:async()=>{await o().removeEnvVar(e.key),await l(),Y(`${e.key} removed — restart the device to apply it.`)}}}return(e,o)=>(I(),L(`section`,xD,[z(`header`,SD,[z(`span`,null,[B(A(gc),{size:16}),o[8]||=V(`ENV`,-1)]),z(`button`,{class:`icon-button`,disabled:n.value||!a.value,"aria-label":`Refresh env`,title:`Refresh`,onClick:l},[B(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,CD),z(`button`,{class:`icon-button`,disabled:!a.value||!!r.value,"aria-label":`Add an env var`,title:`Add an env var to the device's env file`,onClick:o[0]||=e=>s.value=!s.value},[B(A(Xc),{size:15})],8,wD)]),o[19]||=z(`p`,{class:`hint`},` The device's env file — loaded once at boot. Keys here reach the daemon and its sessions. `,-1),a.value?r.value?(I(),L(`p`,ED,D(r.value),1)):t.value?.restartRequired?(I(),L(`p`,DD,[...o[9]||=[V(` Changed since boot — restart the device (`,-1),z(`code`,null,`dpi device stop && dpi device start`,-1),V(`) to apply. `,-1)]])):H(``,!0):(I(),L(`p`,TD,`Select a session to see its device.`)),s.value?(I(),L(`form`,{key:3,class:`add-form`,onSubmit:ks(v,[`prevent`])},[z(`label`,null,[o[10]||=V(`Key (UPPER_SNAKE_CASE)`,-1),j(z(`input`,{"onUpdate:modelValue":o[1]||=e=>c.value.key=e,placeholder:`DPI_NOTIFY_ALLOW_PRIVATE`,required:``},null,512),[[ys,c.value.key]])]),z(`label`,null,[o[11]||=V(`Value`,-1),j(z(`input`,{"onUpdate:modelValue":o[2]||=e=>c.value.value=e,placeholder:`1`,required:``},null,512),[[ys,c.value.value]])]),z(`div`,OD,[z(`button`,{class:`primary small`,type:`submit`,disabled:i.value===`new`},D(i.value===`new`?`saving…`:`Save to env file`),9,kD),z(`button`,{class:`small`,type:`button`,onClick:o[3]||=e=>s.value=!1},`Cancel`)]),o[12]||=z(`p`,{class:`hint`},` Managed keys (DPI_TOKEN, DPI_PORT, start dirs…) have their own settings and are refused here. `,-1)],32)):H(``,!0),!s.value&&t.value&&!t.value.vars.length&&!r.value?(I(),L(`p`,AD,` No vars in the env file yet. `)):H(``,!0),t.value?.vars.length?(I(),L(`ul`,jD,[(I(!0),L(F,null,P(t.value.vars,e=>(I(),L(`li`,{key:e.key,class:E([`var`,{ro:!_(e)}])},[z(`div`,MD,[z(`code`,ND,D(e.key),1),z(`span`,PD,D(e.source===`process`?`process`:`file`),1),e.managed?(I(),L(`span`,FD,`managed`)):H(``,!0),o[13]||=z(`span`,{class:`spacer`},null,-1),_(e)?(I(),L(`button`,{key:1,class:`icon-button`,"aria-label":`Edit ${e.key}`,title:e.secret?`Replace the value`:`Edit the value`,onClick:t=>y(e)},[B(A(qc),{size:13})],8,ID)):H(``,!0),_(e)?(I(),L(`button`,{key:2,class:`icon-button`,"aria-label":`Remove ${e.key}`,title:`Remove from the env file`,onClick:t=>b(e)},[B(A(ml),{size:13})],8,LD)):H(``,!0)]),z(`code`,{class:`value`,title:e.secret?`secret — masked`:e.masked},D(e.masked),9,RD)],2))),128))])):H(``,!0),t.value?(I(),L(`p`,zD,D(t.value.envFile),1)):H(``,!0),z(`header`,BD,[z(`span`,null,[B(A(kc),{size:16}),o[14]||=V(`PI KEYS`,-1)]),z(`button`,{class:`icon-button`,disabled:n.value||!a.value,"aria-label":`Refresh pi keys`,title:`Refresh`,onClick:m},[B(A($c),{size:15})],8,VD),z(`button`,{class:`icon-button`,disabled:!a.value||!!d.value,"aria-label":`Add a pi provider key`,title:`Add a provider key to pi's auth.json`,onClick:o[4]||=e=>f.value=!f.value},[B(A(Xc),{size:15})],8,HD)]),o[20]||=z(`p`,{class:`hint`},[V(` Provider keys in pi's own `),z(`code`,null,`auth.json`),V(` — write-only: values are never shown, pi's interactive logins (oauth) are never touched. `)],-1),d.value?(I(),L(`p`,UD,D(d.value),1)):H(``,!0),f.value?(I(),L(`form`,{key:8,class:`add-form`,onSubmit:ks(h,[`prevent`])},[z(`label`,null,[o[15]||=V(`Provider id`,-1),j(z(`input`,{"onUpdate:modelValue":o[5]||=e=>p.value.providerId=e,placeholder:`zai`,required:``},null,512),[[ys,p.value.providerId]])]),z(`label`,null,[o[16]||=V(`Key`,-1),j(z(`input`,{"onUpdate:modelValue":o[6]||=e=>p.value.key=e,type:`password`,autocomplete:`off`,placeholder:`paste the api key`,required:``},null,512),[[ys,p.value.key]])]),z(`div`,WD,[z(`button`,{class:`primary small`,type:`submit`,disabled:i.value===`pi-key`},D(i.value===`pi-key`?`saving…`:`Save to auth.json`),9,GD),z(`button`,{class:`small`,type:`button`,onClick:o[7]||=e=>f.value=!1},`Cancel`)]),o[17]||=z(`p`,{class:`hint`},`Applies after the next device restart. Existing keys for other providers stay as they are.`,-1)],32)):H(``,!0),!f.value&&u.value&&!u.value.entries.length&&!d.value?(I(),L(`p`,KD,` No provider keys found. `)):H(``,!0),u.value?.entries.length?(I(),L(`ul`,qD,[(I(!0),L(F,null,P(u.value.entries,e=>(I(),L(`li`,{key:e.providerId,class:`var`},[z(`div`,JD,[z(`code`,YD,D(e.providerId),1),z(`span`,XD,D(e.source),1),e.type===`api_key`?H(``,!0):(I(),L(`span`,ZD,D(e.type),1)),o[18]||=z(`span`,{class:`spacer`},null,-1),e.type===`api_key`?(I(),L(`button`,{key:1,class:`icon-button`,"aria-label":`Remove ${e.providerId} key`,title:`Remove from auth.json`,onClick:t=>g(e.providerId)},[B(A(ml),{size:13})],8,QD)):H(``,!0)]),z(`code`,$D,D(e.masked),1)]))),128))])):H(``,!0)]))}}),[[`__scopeId`,`data-v-f6b52e88`]]),tO={class:`extensions-panel`},nO={class:`panel-heading`},rO={key:0,class:`task-empty`},iO=[`data-extension`],aO={class:`ext-head`},oO=[`aria-checked`,`aria-label`,`disabled`,`onClick`],sO=[`checked`,`disabled`,`onChange`],cO=N({__name:`ExtensionsPanel`,setup(e){let t=rn(),n=k(!1);async function r(){let e=nd.value;if(!e||!Xu.value)return void(t.value=void 0);t.value=await e.extensions().catch(()=>void 0)??t.value}M([nd,Xu,()=>JSON.stringify(fd.value.agent.extensions??null)],r,{immediate:!0});async function i(e){let r=nd.value;if(r&&!n.value){n.value=!0;try{let n=await Od(()=>r.setExtension(e));n&&(t.value=n),Cd()}finally{n.value=!1}}}return(e,r)=>(I(),L(`div`,tO,[z(`div`,nO,[r[0]||=z(`h2`,null,`Extensions`,-1),B(A(Qc),{size:18})]),r[3]||=z(`p`,{class:`hint`},` Custom harness capabilities for this agent. Turn one on and the next request uses it. The choice is stored with the agent, so it survives restarts. `,-1),t.value?H(``,!0):(I(),L(`p`,rO,`Loading extensions…`)),(I(!0),L(F,null,P(t.value?.extensions??[],e=>(I(),L(`article`,{key:e.name,class:E([`ext-card`,{on:e.enabled}]),"data-extension":e.name},[z(`div`,aO,[z(`div`,null,[z(`strong`,null,D(e.title),1),z(`code`,null,D(e.name),1)]),z(`button`,{class:E([`switch`,{on:e.enabled}]),role:`switch`,"aria-checked":e.enabled,"aria-label":e.title,disabled:n.value,onClick:t=>i({name:e.name,enabled:!e.enabled})},[...r[1]||=[z(`span`,null,null,-1)]],10,oO)]),z(`p`,null,D(e.description),1),e.prompts?(I(),L(`ul`,{key:0,class:E([`ext-prompts`,{off:!e.enabled}])},[(I(!0),L(F,null,P(e.prompts,e=>(I(),L(`li`,{key:e.id},[z(`label`,null,[z(`input`,{type:`checkbox`,checked:e.enabled,disabled:n.value,onChange:t=>i({prompt:e.id,enabled:t.target.checked})},null,40,sO),z(`code`,null,D(e.id),1)]),z(`span`,null,D(e.description),1),z(`details`,null,[r[2]||=z(`summary`,null,`View prompt`,-1),z(`pre`,null,D(e.text),1)])]))),128))],2)):H(``,!0)],10,iO))),128))]))}}),lO={class:`context-section`,"aria-labelledby":`context-title`},uO={class:`section-label`},dO={key:0,class:`hint`},fO={key:1,class:`hint`},pO={class:`context-numbers`},mO={class:`context-pct`},hO={key:0,class:`context-compacting`},gO=[`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],_O={class:`context-marker-label`},vO=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],yO={class:`context-marker-label`},bO={class:`hint context-hint`},xO={class:`modal compaction-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`compaction-title`},SO={class:`context-toggle`},CO=[`checked`],wO=512,TO=4096,EO=1024,DO=N({__name:`ContextBar`,setup(e){let t=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),n=U(()=>bd.value?.contextWindow??0),r=U(()=>{let e=yd.value;return e&&!bd.value?`${e.provider?`${e.provider} / `:``}${e.modelId}`:``}),i=U(()=>{let e=fd.value.entries;for(let t=e.length-1;t>=0;t--){if(e[t].kind!==`pi.assistant`)continue;let n=e[t].model?.find(e=>e.role===`assistant`)?.usage;if(n)return n.totalTokens||n.input+n.output+n.cacheRead+n.cacheWrite}return 0}),a=U(()=>fd.value.compactions.length>0),o=k(),s=U(()=>o.value??ed.value?.compaction??Uv(n.value));M(()=>JSON.stringify(ed.value?.compaction),e=>{o.value&&e===JSON.stringify(o.value)&&(o.value=void 0)});let c=k(),l=U(()=>J.dialog?.kind===`compaction`),u=()=>void(J.dialog=void 0);Gr(()=>l.value&&u());let d=U(()=>c.value??Wv(n.value,s.value)),f=e=>`${Math.min(100,Math.max(0,100*e/(n.value||1)))}%`,p=U(()=>Math.round(100*i.value/(n.value||1))),m=e=>{let t=e/(n.value||1);return t<.35?`start`:t>.65?`end`:`center`},h=(e,t)=>Math.min(n.value-EO,Math.max((t??TO)+EO,e)),g=(e,t)=>Math.min(t-EO,Math.max(TO,e));function _(e,t){let n=d.value,r=Math.round(t/wO)*wO;c.value=e===`wait`?{auto:n.auto,wait:h(r,n.auto)}:{auto:g(r,n.wait),wait:n.wait}}async function v(e){let t=rd.value;if(!t)return;let n=await Od(()=>t.setCompaction(e));n&&(o.value=n),c.value=void 0}function y(){let e=c.value;e&&v({reserveTokens:n.value-e.wait,...e.auto===void 0?{}:{backgroundTokens:e.wait-e.auto}})}let b=k(),x;function S(e,t){x=e,t.currentTarget.setPointerCapture(t.pointerId)}function C(e){if(!x||!b.value)return;let t=b.value.getBoundingClientRect();_(x,(e.clientX-t.left)/t.width*n.value)}function ee(){x&&(x=void 0,y())}function te(e,t){let n=(t.shiftKey?8192:1024)*(t.key===`ArrowRight`||t.key===`ArrowUp`?1:t.key===`ArrowLeft`||t.key===`ArrowDown`?-1:0);if(!n)return;t.preventDefault();let r=d.value;_(e,(e===`auto`?r.auto??TO:r.wait)+n)}return(e,o)=>(I(),L(F,null,[z(`section`,lO,[z(`div`,uO,[o[7]||=z(`span`,{id:`context-title`},`CONTEXT`,-1),n.value?(I(),L(`button`,{key:0,class:`context-details-toggle`,onClick:o[0]||=e=>A(J).dialog={kind:`compaction`}},[B(A(Oc),{size:16}),o[6]||=V(`Details `,-1)])):H(``,!0)]),r.value?(I(),L(`div`,dO,D(r.value)+` — not in this device's catalog, so its context window is unknown here. `,1)):n.value?(I(),L(F,{key:2},[z(`div`,pO,[z(`strong`,null,D(t(i.value)),1),z(`span`,null,`of `+D(t(n.value))+` tokens`,1),z(`span`,mO,D(p.value)+`%`,1),a.value?(I(),L(`span`,hO,[...o[8]||=[z(`i`,null,null,-1),V(`Compacting`,-1)]])):H(``,!0)]),z(`div`,{ref_key:`bar`,ref:b,class:E([`context-bar`,{off:!s.value.enabled}]),onPointermove:C,onPointerup:ee,onPointercancel:ee},[z(`div`,{class:E([`context-fill`,{hot:d.value.auto!==void 0&&i.value>=d.value.auto}]),style:T({width:f(i.value)})},null,6),z(`div`,{class:`context-reserve`,style:T({left:f(d.value.wait)}),title:`Reserved for the answer`},null,4),d.value.auto===void 0?H(``,!0):(I(),L(`button`,{key:0,class:E([`context-marker auto`,`label-${m(d.value.auto)}`]),role:`slider`,"aria-label":`Automatic compaction starts at`,"aria-valuemin":TO,"aria-valuemax":d.value.wait-EO,"aria-valuenow":d.value.auto,"aria-valuetext":`${t(d.value.auto)} tokens`,style:T({left:f(d.value.auto)}),onPointerdown:o[1]||=e=>S(`auto`,e),onKeydown:o[2]||=e=>te(`auto`,e),onKeyup:y,onBlur:y},[z(`span`,_O,`Auto-compact at `+D(t(d.value.auto)),1)],46,gO)),z(`button`,{class:E([`context-marker wait`,`label-${m(d.value.wait)}`]),role:`slider`,"aria-label":`The next request waits for a summary at`,"aria-valuemin":(d.value.auto??TO)+EO,"aria-valuemax":n.value-EO,"aria-valuenow":d.value.wait,"aria-valuetext":`${t(d.value.wait)} tokens, ${t(n.value-d.value.wait)} reserved`,style:T({left:f(d.value.wait)}),onPointerdown:o[3]||=e=>S(`wait`,e),onKeydown:o[4]||=e=>te(`wait`,e),onKeyup:y,onBlur:y},[z(`span`,yO,`Reserve at `+D(t(d.value.wait)),1)],46,vO)],34),z(`p`,bO,[s.value.enabled?(I(),L(F,{key:0},[o[9]||=V(`Compacts in the background at `,-1),z(`strong`,null,D(t(d.value.auto??d.value.wait)),1),o[10]||=V(` and waits at `,-1),z(`strong`,null,D(t(d.value.wait)),1),o[11]||=V(`.`,-1)],64)):(I(),L(F,{key:1},[V(`Automatic compaction is off.`)],64))])],64)):(I(),L(`div`,fO,`Pick a model to see its context window.`))]),(I(),R(lr,{to:`body`},[l.value?(I(),L(`div`,{key:0,class:`modal-backdrop`,onClick:ks(u,[`self`])},[z(`section`,xO,[z(`header`,null,[o[12]||=z(`h2`,{id:`compaction-title`},`Context compaction`,-1),z(`button`,{class:`icon-button`,"aria-label":`Close context compaction`,onClick:u},[B(A(xl),{size:18})])]),z(`p`,null,[o[13]||=V(` A summary starts in the background at `,-1),z(`strong`,null,D(t(d.value.auto??d.value.wait)),1),o[14]||=V(`. Above `,-1),z(`strong`,null,D(t(d.value.wait)),1),V(` the next request waits for it, keeping `+D(t(n.value-d.value.wait))+` free for the answer. Drag a marker on the bar to change either point. `,1)]),o[16]||=z(`p`,null,[V(`Older entries stay stored, and `),z(`code`,null,`search_history`),V(` still finds them.`)],-1),z(`label`,SO,[z(`input`,{type:`checkbox`,checked:s.value.enabled,onChange:o[5]||=e=>v({enabled:e.target.checked})},null,40,CO),o[15]||=V(` Automatic compaction `,-1)]),o[17]||=z(`p`,{class:`hint`},[V(` Applies to every agent in this session. `),z(`code`,null,`/compact`),V(` works either way. `)],-1),z(`footer`,null,[z(`button`,{class:`secondary`,onClick:u},`Close`)])])])):H(``,!0)]))],64))}}),OO=/^[A-Za-z_$][\w$]*$/,kO=e=>` `.repeat(e);function AO(e,t){let n=[],r=(e,t=`text`)=>n.push({text:e,kind:t});return r(`function`,`keyword`),r(` `),r(e,`function`),r(`(`,`punct`),r(`args`),r(`: `,`punct`),jO(t,0,r),r(`): `,`punct`),r(`Promise`,`type`),r(`<`,`punct`),r(`ToolResult`,`type`),r(`>;`,`punct`),n}function jO(e,t,n){if(!e||typeof e!=`object`)return n(`unknown`,`type`);if(`const`in e)return PO(e.const,n);if(e.enum)return NO(e.enum.map(e=>({const:e})),t,n);if(e.anyOf??e.oneOf)return NO(e.anyOf??e.oneOf,t,n);if(Array.isArray(e.type))return NO(e.type.map(t=>({...e,type:t})),t,n);switch(e.type){case`string`:case`boolean`:case`null`:return n(e.type,`type`);case`number`:case`integer`:return n(`number`,`type`);case`array`:{let r=!!(e.items?.anyOf??e.items?.oneOf??e.items?.enum);return r&&n(`(`,`punct`),jO(e.items,t,n),r&&n(`)`,`punct`),n(`[]`,`punct`)}case`object`:return MO(e,t,n);default:return n(`unknown`,`type`)}}function MO(e,t,n){let r=Object.entries(e.properties??{});if(!r.length)return e.additionalProperties&&typeof e.additionalProperties==`object`?(n(`Record`,`type`),n(`<`,`punct`),n(`string`,`type`),n(`, `,`punct`),jO(e.additionalProperties,t,n),n(`>`,`punct`)):n(`{}`,`punct`);let i=new Set(e.required??[]);n(`{`,`punct`),n(`
|
|
81
|
-
`);for(let[e,a]of r){let r=FO(a);r&&n(`${kO(t+1)}${r}\n`,`comment`),n(kO(t+1)),n(OO.test(e)?e:JSON.stringify(e),`property`),n(i.has(e)?`: `:`?: `,`punct`),jO(a,t+1,n),n(`;`,`punct`),n(`
|
|
82
|
-
`)}n(kO(t)),n(`}`,`punct`)}function NO(e,t,n){e.forEach((e,r)=>{r&&n(` | `,`punct`),jO(e,t,n)})}function PO(e,t){if(typeof e==`string`)return t(JSON.stringify(e),`string`);if(typeof e==`number`)return t(String(e),`number`);t(String(e),`type`)}function FO(e){let t=[e.description,e.minimum===void 0?``:`@minimum ${e.minimum}`,e.maximum===void 0?``:`@maximum ${e.maximum}`,e.default===void 0?``:`@default ${JSON.stringify(e.default)}`].filter(Boolean);return t.length?`/** ${t.join(` `)} */`:``}function IO(e){let t=document.createElement(`a`),n=(e.filename||`device-response`).replace(/[^A-Za-z0-9._-]/g,`_`).slice(0,80)||`device-response`;/\.zip$/i.test(e.filename)&&!/\.zip$/i.test(n)&&(n=`${n.slice(0,76)}.zip`),t.href=URL.createObjectURL(new Blob([e.bytes.slice()],{type:`application/zip`})),t.download=n,t.click(),URL.revokeObjectURL(t.href)}function LO(e,t={}){let n=t.fetchBundle??((e,t)=>G(e).exportSession(t)),r=t.download??IO,i=t.notify??(()=>{}),a=k(!1),o=k(``);async function s(){let{device:t,summary:s}=e.value;if(t&&s&&!a.value){a.value=!0,o.value=``;try{let e=await n(t.id,s.id);r(e),i(`Bundle downloaded (${Math.max(1,Math.round(e.bytes.length/1024))} KiB).`)}catch(e){o.value=`bundle export failed: ${K(e).slice(0,300)}`,i(o.value.slice(0,120))}finally{a.value=!1}}}return M(()=>e.value.summary?.id,()=>o.value=``),{exporting:a,error:o,run:s}}function RO(e){try{let t=JSON.parse(e);if(!t||Array.isArray(t)||typeof t!=`object`)throw Error(`App State must be a JSON object.`);return tb({},{operation:`update`,path:``,value:t}),``}catch(e){return K(e)}}function zO(e,t){let n=k(``),r=k(``),i=k(0),a=k(),o=k(!1),s=k(``),c=U(()=>n.value!==r.value),l=U(()=>c.value&&a.value!==t.value),u=U(()=>c.value&&(l.value||e.value?.revision!==i.value));function d(){n.value=JSON.stringify(e.value?.value??{},null,2),r.value=n.value,i.value=e.value?.revision??0,a.value=t.value,s.value=``}function f(e,t){n.value=JSON.stringify(e,null,2),r.value=n.value,i.value=t,s.value=``}M(e,()=>!c.value&&d(),{immediate:!0}),M(t,()=>d());let p;return M(n,()=>{clearTimeout(p),p=setTimeout(()=>s.value=c.value?RO(n.value):``,250)}),{draft:n,dirty:c,conflict:u,deviceChanged:l,saving:o,problem:s,revision:i,reset:d,commit:f}}var BO={key:0,class:`panel-rail`,"aria-label":`Inspector (collapsed)`},VO=[`title`],HO=[`aria-label`,`title`,`onClick`],UO={key:0,class:`count`},WO={class:`inspector-tabs`,role:`tablist`,"aria-label":`Session details`},GO=[`id`,`aria-selected`,`title`,`onClick`],KO={class:`tab-label`},qO={key:0,class:`count`},JO=[`title`],YO=[`aria-labelledby`],XO={class:`session-heading`},ZO=[`disabled`],QO=[`disabled`],$O=[`title`],ek={class:`cwd-trail`,dir:`rtl`},tk={dir:`ltr`},nk={class:`session-status`},rk={key:0,class:`background-pill`},ik=[`title`],ak={key:0,class:`message-error`,role:`alert`},ok=[`disabled`],sk={class:`model-section`},ck=[`src`],lk={key:0,class:`hint model-provenance`},uk={class:`thinking-row`},dk=[`value`],fk={class:`stats-section`,"aria-labelledby":`stats-title`},pk={class:`metrics`},mk=[`title`],hk={class:`usage-breakdown`,"aria-label":`Agent token and cost breakdown`},gk={scope:`row`},_k={class:`usage-total`},vk={class:`panel-heading`},yk={class:`hint app-state-description`},bk=[`disabled`],xk={class:`state-json-actions`},Sk={key:0,class:`hint`},Ck=[`disabled`],wk=[`disabled`],Tk={key:0,class:`message-error`,role:`alert`},Ek={key:1,class:`message-error`,role:`alert`},Dk={class:`panel-heading`},Ok={class:`tag`},kk={class:`hook-card`},Ak=[`aria-checked`],jk={key:0,class:`tag tool-disabled`},Mk={class:`tag`},Nk=[`aria-label`],Pk=of(N({__name:`Inspector`,setup(e){let t=U(()=>new Map(xd.value?.tools.map(e=>[e.name,AO(e.name,e.parameters)]))),n=[{id:`session`,label:`Session`,icon:yc},{id:`git`,label:`Git`,icon:xc},{id:`host`,label:`Host`,icon:Vs},{id:`usage`,label:`Usage`,icon:Jc},{id:`auto`,label:`Auto`,icon:ec},{id:`archive`,label:`Archive`,icon:Us},{id:`dag`,label:`DAG`,icon:gl},{id:`notify`,label:`Notify`,icon:Xs},{id:`env`,label:`Env`,icon:gc},{id:`state`,label:`State`,icon:Qs},{id:`tasks`,label:`Tasks`,icon:Vs},{id:`tools`,label:`Tools`,icon:bl},{id:`extensions`,label:`Extend`,icon:Qc}],r=U(()=>[{label:`Input`,tokens:_d.value.input,cost:_d.value.inputCost},{label:`Output`,tokens:_d.value.output,cost:_d.value.outputCost},{label:`Cache read`,tokens:_d.value.cacheRead,cost:_d.value.cacheReadCost},{label:`Cache write`,tokens:_d.value.cacheWrite,cost:_d.value.cacheWriteCost}]),i=U(()=>hd.value.filter(e=>e.background).length);function a(e,t){Od(async()=>{await nd.value.configure(e),await Cd(),t&&Y(t)})}async function o(){let e=Yu.value,t=ed.value;if(e&&t)try{let n=await G(e.id).agent(t.id,q.value?.agentId??1).transcript(`markdown`),r=new Blob([typeof n==`string`?n:JSON.stringify(n)],{type:`text/markdown`}),i=document.createElement(`a`);i.href=URL.createObjectURL(r),i.download=`${t.name.replace(/[^\w.-]+/g,`_`)||`session`}-${t.id.slice(0,8)}.md`,i.click(),URL.revokeObjectURL(i.href),Y(`Transcript downloaded.`)}catch(e){Y(`transcript download failed: ${K(e).slice(0,120)}`)}}let{exporting:s,error:c,run:l}=LO(U(()=>({device:Yu.value,summary:ed.value}))),u=k(!1);function d(){let e=Yu.value,t=ed.value;e&&t&&!u.value&&(J.dialog={kind:`prompt`,title:`Share this transcript publicly?`,hint:`Anyone with the link can read this session's transcripts. The link expires in 7 days and can be removed on the hub.`,submit:`Create share link`,run:async()=>{u.value=!0;try{let n=G(e.id),r=t.agents.length?t.agents:[{id:1,name:`main`}],i=[];for(let e of r){let r=await n.agent(t.id,e.id).transcript(`markdown`),a=typeof r==`string`?r:r.text??JSON.stringify(r,null,2);i.push({name:e.name||`agent ${e.id}`,markdown:a})}let a=await ku.createShare({title:`${t.name} · ${e.name}`,agents:i}),o=`${location.origin}${a.url}`;await navigator.clipboard?.writeText(o).catch(()=>{}),Y(`Share link copied — expires ${a.expiresAt.slice(0,10)}.`)}catch(e){Y(`share failed: ${K(e).slice(0,140)}`)}finally{u.value=!1}}})}function f(){let e=rd.value;e&&(J.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:ed.value?.name??``,submit:`Save name`,run:t=>e.rename(t)})}let p=k({});M(Yu,async e=>{if(p.value={},e)try{let{projects:t}=await G(e.id).projects(!0);p.value=Object.fromEntries(t.filter(e=>e.model).map(e=>[e.rootPath,e.model]))}catch{}},{immediate:!0});let m=U(()=>{let e=yd.value;if(!e)return!1;let t=ed.value?.cwd,n=Object.keys(p.value).filter(e=>t===e||(t??``).startsWith(`${e}/`)).sort((e,t)=>t.length-e.length),r=n.length?p.value[n[0]]:void 0,i=r?`${r.provider}/${r.modelId}`:Yu.value?.info?.defaultModel??``;return!!i&&i===`${e.provider}/${e.modelId}`}),h=U(()=>yd.value&&`model: ${yd.value.modelId} (${yd.value.provider})${m.value?` (default)`:``}`),g=$u.sharedState,{draft:_,dirty:v,conflict:y,deviceChanged:b,problem:x,revision:S,reset:C,commit:ee}=zO(g,Ju),te=k(!1),ne=k(``);async function re(e){if(!te.value&&nd.value){te.value=!0,ne.value=``;try{await nd.value.demo(`state`,e)}catch(e){ne.value=K(e)}finally{te.value=!1}}}async function w(){if(!(te.value||y.value||!nd.value)){ne.value=``,te.value=!0;try{let e=JSON.parse(_.value);if(!e||Array.isArray(e)||typeof e!=`object`)throw Error(`App State must be a JSON object.`);let t=await nd.value.demo(`state`,{operation:`update`,path:``,value:e,expectedRevision:S.value});ee(t.value,t.revision),Y(`Shared App State saved.`)}catch(e){ne.value=K(e)}finally{te.value=!1}}}let ie=U(()=>xd.value?.config.readOnly===!0),ae=U(()=>xd.value?.tools.filter(e=>e.offered).length??0);return(e,p)=>(I(),L(`aside`,{class:E([`inspector`,{collapsed:!A(Rd),overlay:A(J).inspectorOverlay}])},[A(Rd)?(I(),L(F,{key:1},[z(`div`,WO,[(I(),L(F,null,P(n,e=>z(`button`,{id:`inspector-tab-${e.id}`,key:e.id,role:`tab`,"aria-controls":`inspector-panel`,"aria-selected":A(J).tab===e.id,title:e.label,class:E({active:A(J).tab===e.id}),onClick:t=>A(J).tab=e.id},[(I(),R($r(e.icon),{size:18})),z(`span`,KO,D(e.label),1),e.id===`tasks`&&A(hd).length?(I(),L(`span`,qO,D(A(hd).length),1)):H(``,!0)],10,GO)),64)),z(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse inspector`,title:`Collapse inspector (${A(Wd).inspector})`,onClick:p[1]||=e=>A(Bd)()},[B(A(Uc),{size:18})],8,JO)]),z(`div`,{id:`inspector-panel`,class:E([`inspector-body`,{"session-panel":A(J).tab===`session`}]),role:`tabpanel`,"aria-labelledby":`inspector-tab-${A(J).tab}`},[A(J).tab===`session`?(I(),L(F,{key:0},[z(`section`,XO,[z(`h1`,null,[z(`span`,null,D(A(ed)?.name??`Loading session`),1),z(`button`,{class:`icon-button`,title:`Rename session`,"aria-label":`Rename session`,onClick:f},[B(A(qc),{size:18})]),z(`button`,{class:`icon-button`,title:`Download transcript (markdown)`,"aria-label":`Download transcript`,onClick:o},[B(A(pc),{size:18})]),z(`button`,{class:`icon-button`,title:`Download session bundle (.zip: manifest, transcripts, configs)`,"aria-label":`Download session bundle`,disabled:A(s),onClick:p[2]||=(...e)=>A(l)&&A(l)(...e)},[B(A(Hc),{size:18})],8,ZO),z(`button`,{class:`icon-button`,title:`Share a public read-only link to this transcript`,"aria-label":`Share transcript`,disabled:u.value,onClick:d},[B(A(al),{size:18})],8,QO)]),z(`button`,{class:`path cwd-button`,title:A(ed)?.cwd,"aria-label":`Show full working directory`,onClick:p[3]||=e=>A(J).dialog={kind:`path`,path:A(ed)?.cwd??``}},[B(A(yc),{size:18}),z(`span`,ek,[z(`bdi`,tk,D(A(ed)?.cwd),1)])],8,$O),z(`div`,nk,[z(`span`,{class:E([`status-pill`,{working:A(gd)}])},[p[10]||=z(`i`,null,null,-1),V(D(A(gd)?`Working`:`Idle`),1)],2),i.value?(I(),L(`span`,rk,D(i.value)+` background`,1)):H(``,!0),z(`span`,{class:`saved`,title:A(Yu)?.id},[B(A(il),{size:18}),V(D(A(Yu)?.name??A(Yu)?.id),1)],8,ik),A(Yu)?(I(),R(Eb,{key:1,device:A(Yu)},null,8,[`device`])):H(``,!0)]),A(c)?(I(),L(`p`,ak,[V(D(A(c))+` `,1),z(`button`,{class:`small`,disabled:A(s),onClick:p[4]||=(...e)=>A(l)&&A(l)(...e)},` retry `,8,ok)])):H(``,!0)]),A(Yu)?(I(),R(Ub,{key:0,device:A(Yu)},null,8,[`device`])):H(``,!0),z(`section`,sk,[p[18]||=z(`div`,{class:`section-label`},[z(`span`,null,`AGENT`)],-1),z(`button`,{class:`model-button`,onClick:p[5]||=e=>A(J).dialog={kind:`models`}},[z(`img`,{src:A(Md)(A(fd).agent.model?.modelId),alt:``},null,8,ck),z(`div`,null,[z(`strong`,null,D(A(vd)?.name??A(fd).agent.model?.modelId??`Loading…`),1),z(`small`,null,D(A(vd)?.tier??``)+` / `+D(A(fd).agent.model?.provider??``),1)]),B(A(nc),{size:18})]),h.value?(I(),L(`p`,lk,D(h.value),1)):H(``,!0),z(`div`,uk,[p[11]||=z(`span`,null,`Thinking`,-1),z(`select`,{"aria-label":`Thinking level`,value:A(fd).agent.thinkingLevel??`medium`,onChange:p[6]||=e=>a({thinkingLevel:e.target.value},`Thinking ${e.target.value}. Used on the next turn.`)},[(I(!0),L(F,null,P(A(Bv),e=>(I(),L(`option`,{key:e},D(e),1))),128))],40,dk)]),B(DO),z(`section`,fk,[p[17]||=z(`div`,{class:`section-label`},[z(`span`,{id:`stats-title`},`STATS`)],-1),z(`div`,pk,[z(`div`,{title:`${A(_d).tokens.toLocaleString(`en-US`)} total tokens`},[z(`span`,null,D(A(Ad)(A(_d).tokens)),1),p[12]||=z(`small`,null,`total tokens`,-1)],8,mk),z(`div`,null,[z(`span`,null,`$`+D(A(_d).cost.toFixed(4)),1),p[13]||=z(`small`,null,`agent cost`,-1)]),z(`div`,null,[z(`span`,null,D(A(xd)?.tools.length??0),1),p[14]||=z(`small`,null,`tools`,-1)])]),z(`table`,hk,[p[16]||=z(`thead`,null,[z(`tr`,null,[z(`th`,{scope:`col`},`Type`),z(`th`,{scope:`col`},`Tokens`),z(`th`,{scope:`col`},`Cost (USD)`)])],-1),z(`tbody`,null,[(I(!0),L(F,null,P(r.value,e=>(I(),L(`tr`,{key:e.label},[z(`th`,gk,D(e.label),1),z(`td`,null,D(e.tokens.toLocaleString(`en-US`)),1),z(`td`,null,`$`+D(e.cost.toFixed(4)),1)]))),128)),z(`tr`,_k,[p[15]||=z(`th`,{scope:`row`},`Total`,-1),z(`td`,null,D(A(_d).tokens.toLocaleString(`en-US`)),1),z(`td`,null,`$`+D(A(_d).cost.toFixed(4)),1)])])])])])],64)):H(``,!0),A(J).tab===`state`?(I(),L(F,{key:1},[z(`div`,vk,[p[19]||=z(`h2`,null,`App State`,-1),B(A(Qs),{size:18})]),z(`p`,yk,` One shared JSON object for every agent, session and fork on `+D(A(Yu)?.name??A(Yu)?.id)+`. You and your agents can read, create, update or delete values and fields. Changes appear live and persist across closed browsers, interrupted agents and backend restarts. `,1),j(z(`textarea`,{"onUpdate:modelValue":p[7]||=e=>nn(_)?_.value=e:null,class:`app-state-json`,"aria-label":`App State JSON`,spellcheck:`false`,disabled:te.value||!A(g),rows:`12`},null,8,bk),[[ys,A(_)]]),p[20]||=z(`p`,{class:`hint state-limits`},` One JSON object, at most 24 levels of nesting and 100,000 characters, checked as you type. `,-1),z(`div`,xk,[A(y)?(I(),L(`span`,Sk,D(A(b)?`Device changed since this draft loaded. Load the latest JSON before saving.`:`State changed elsewhere. Load the latest JSON before saving.`),1)):H(``,!0),A(v)?(I(),L(`button`,{key:1,class:`secondary`,disabled:te.value,onClick:p[8]||=(...e)=>A(C)&&A(C)(...e)},D(A(y)?`Load latest`:`Reset`),9,Ck)):H(``,!0),z(`button`,{class:`primary small`,disabled:!A(v)||te.value||A(y)||!!A(x),onClick:w},D(te.value?`Saving…`:`Save JSON`),9,wk)]),A(x)?(I(),L(`p`,Tk,D(A(x)),1)):H(``,!0),ne.value?(I(),L(`p`,Ek,D(ne.value),1)):H(``,!0),B(bb,{value:A(g)?.value??{},disabled:te.value||A(v)||!A(g),onChange:re},null,8,[`value`,`disabled`])],64)):H(``,!0),A(J).tab===`tasks`?(I(),R(bx,{key:2})):H(``,!0),A(J).tab===`git`?(I(),R(bw,{key:3})):H(``,!0),A(J).tab===`host`?(I(),R(Uw,{key:4})):H(``,!0),A(J).tab===`usage`?(I(),R(PT,{key:5})):H(``,!0),A(J).tab===`auto`?(I(),R(dE,{key:6})):H(``,!0),A(J).tab===`archive`?(I(),R(AE,{key:7})):H(``,!0),A(J).tab===`dag`?(I(),R(YE,{key:8})):H(``,!0),A(J).tab===`notify`?(I(),R(bD,{key:9})):H(``,!0),A(J).tab===`env`?(I(),R(eO,{key:10})):H(``,!0),A(J).tab===`extensions`?(I(),R(cO,{key:11})):H(``,!0),A(J).tab===`tools`?(I(),L(F,{key:12},[z(`div`,Dk,[p[21]||=z(`h2`,null,`Tools`,-1),z(`span`,Ok,D(ae.value)+` / `+D(A(xd)?.tools.length??0),1)]),p[25]||=z(`p`,{class:`hint`},` Every tool this agent's extensions provide. Open one to see its definition. `,-1),z(`div`,kk,[z(`div`,null,[B(A(sl),{size:18}),p[23]||=z(`strong`,null,`Read only`,-1),z(`button`,{class:E([`switch`,{on:ie.value}]),role:`switch`,"aria-checked":ie.value,"aria-label":`Read only`,onClick:p[9]||=e=>a({readOnly:!ie.value},ie.value?`Read only off. Every tool is back.`:`Read only on. Tools that write are disabled.`)},[...p[22]||=[z(`span`,null,null,-1)]],10,Ak)]),p[24]||=z(`p`,null,` Offers this agent only tools that read. Tools that create, update or delete leave its next request, and the choice is stored with the agent. `,-1)]),(I(!0),L(F,null,P(A(xd)?.tools,e=>(I(),L(`details`,{key:e.name,class:E([`tool-row`,{disabled:!e.offered}])},[z(`summary`,null,[B(A(bl),{size:18}),z(`strong`,null,D(e.name),1),e.offered?H(``,!0):(I(),L(`span`,jk,`disabled`)),z(`span`,Mk,D(e.replay===`safe`?`replay safe`:`interrupt on crash`),1)]),z(`p`,null,D(e.description),1),e.parameters?(I(),L(`pre`,{key:0,class:`tool-signature`,"aria-label":`${e.name} TypeScript definition`},[z(`code`,null,[(I(!0),L(F,null,P(t.value.get(e.name),(e,t)=>(I(),L(`span`,{key:t,class:E(`tk-${e.kind}`)},D(e.text),3))),128))])],8,Nk)):H(``,!0),z(`small`,null,D(e.replay===`safe`?`An interrupted execution may run again after recovery.`:`A crash records an interrupted result instead of rerunning this effect.`),1)],2))),128))],64)):H(``,!0)],10,YO)],64)):(I(),L(`div`,BO,[z(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand inspector`,title:`Expand inspector (${A(Wd).inspector})`,onClick:p[0]||=e=>A(zd)()},[B(A(Wc),{size:18})],8,VO),(I(),L(F,null,P(n,e=>z(`button`,{key:e.id,class:E([`rail-tab`,{active:A(J).tab===e.id}]),"aria-label":`Open ${e.label}`,title:e.label,onClick:t=>A(zd)(e.id)},[(I(),R($r(e.icon),{size:20})),e.id===`tasks`&&A(hd).length?(I(),L(`span`,UO,D(A(hd).length),1)):H(``,!0)],10,HO)),64))]))],2))}}),[[`__scopeId`,`data-v-419eb6ed`]]),Fk={class:`chat-empty`},Ik={class:`eyebrow`},Lk={key:3,class:`hint offline-error`},Rk={key:4,class:`offline-command`},zk={key:5,class:`hint`},Bk={key:6,class:`hint`},Vk={class:`offline-actions`},Hk=[`disabled`],Uk={key:7,class:`message-error`,role:`alert`},Wk=N({__name:`OfflinePanel`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=U(()=>{let e=t.device,n=e.source===`config`;switch(e.status){case`checking`:return{title:`Checking ${e.name}…`,text:`Probing the device. This view fills in as soon as it answers.`};case`unauthorized`:return e.transport===`tunnel`?{title:`${e.name} tunnel credentials are not valid`,text:`Pair the device again — the hub will mint a fresh credential.`}:{title:e.hasToken?`${e.name} rejected its token`:`No token for ${e.name}`,text:e.hasToken?`The device's DPI_TOKEN changed (a rotate or a rebuilt device). Copy the current token into this hub's registry, then check again.`:`This hub has no token for the device yet. Register it, then check again.`,command:n&&e.kind!==`url`?`just net register ${e.id}`:`just net register ${e.id} --token <token>`};case`mismatch`:return{title:`${e.name} answers as a different device`,text:`The URL now reaches a backend with another identity (a rebuilt VM or a new data directory). If that is expected, register it again: that trusts the identity it answers with now.`,command:e.kind===`url`?`just net register ${e.id} --token <token>`:`just net register ${e.id}`};case`incompatible`:return{title:`${e.name} speaks another API version`,text:`Update the device's dpi-backend.`,command:n?`just net deploy ${e.id}`:void 0};default:return{title:`${e.name} is offline`,text:`Last seen ${Nd(e.lastSeenAt)}. Its agents keep their state on the device and resume when its backend starts again. The tree shows the last known sessions.`,command:n?e.kind===`local`?`just backend run`:e.kind===`url`?void 0:`just net restart ${e.id}`:void 0,alt:n&&e.kind!==`local`&&e.kind!==`url`?`just net up ${e.id}`:void 0}}});async function a(){n.value=!0,r.value=``;try{let e=await ku.check(t.device.id);e.status===`online`&&Y(`${e.id} is online.`)}catch(e){r.value=K(e)}finally{n.value=!1}}async function o(e){try{await navigator.clipboard.writeText(e),Y(`Copied.`)}catch{Y(`Clipboard needs localhost or HTTPS. Select the text to copy.`)}}return(t,s)=>(I(),L(`section`,{class:E([`chat-panel offline-panel`,e.device.status]),"aria-live":`polite`},[z(`div`,Fk,[e.device.status===`checking`?(I(),R(A(Ic),{key:0,class:`spin`,size:30})):e.device.status===`mismatch`||e.device.status===`unauthorized`?(I(),R(A(ol),{key:1,size:30})):(I(),R(A(_l),{key:2,size:30})),z(`span`,Ik,D(e.device.kind.toUpperCase())+` · `+D(e.device.url??(e.device.transport===`tunnel`?`tunnel`:`no endpoint`)),1),z(`h2`,null,D(i.value.title),1),z(`p`,null,D(i.value.text),1),e.device.error?(I(),L(`p`,Lk,D(e.device.error),1)):H(``,!0),i.value.command?(I(),L(`div`,Rk,[z(`code`,null,D(i.value.command),1),z(`button`,{class:`icon-button`,"aria-label":`Copy command`,onClick:s[0]||=e=>o(i.value.command)},[B(A(sc),{size:18})])])):H(``,!0),i.value.command?(I(),L(`p`,zk,`Run it in this repo's terminal, then press Check now.`)):H(``,!0),i.value.alt?(I(),L(`p`,Bk,[s[2]||=V(` Never deployed or rebuilt? `,-1),z(`code`,null,D(i.value.alt),1),s[3]||=V(` provisions it from scratch. `,-1)])):H(``,!0),z(`div`,Vk,[z(`button`,{class:`secondary`,disabled:n.value,onClick:s[1]||=e=>a()},[B(A($c),{size:18}),V(D(n.value?`Checking…`:`Check now`),1)],8,Hk)]),r.value?(I(),L(`p`,Uk,D(r.value),1)):H(``,!0)])],2))}}),Gk={class:`dir-browser`},Kk={class:`dir-path`},qk=[`disabled`],Jk=[`aria-busy`],Yk=[`title`],Xk=[`aria-selected`,`title`,`onClick`],Zk={key:1,class:`hint`},Qk={key:0,class:`message-error`,role:`alert`},$k=N({__name:`DirBrowser`,props:si({deviceId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=Di(e,`modelValue`),r=k(),i=k(!1),a=k(``),o=0;async function s(e){let s=++o,c=t.deviceId;i.value=!0,a.value=``;try{let t=await G(c).dirs(e);return s===o?(r.value=t,t.path&&(n.value=t.path),t):void 0}catch(e){s===o&&(a.value=K(e));return}finally{s===o&&(i.value=!1)}}return M(()=>t.deviceId,async()=>{r.value=void 0;let e=await s(``),t=e?.dirs[0];t&&!e.path&&await s(t.path)},{immediate:!0}),(e,t)=>(I(),L(`div`,Gk,[z(`div`,Kk,[j(z(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,"aria-label":`Working directory`,required:``,placeholder:`/path/to/project`,spellcheck:`false`,autocomplete:`off`,onKeydown:t[1]||=js(ks(e=>s(n.value),[`prevent`]),[`enter`])},null,544),[[ys,n.value]]),z(`button`,{type:`button`,class:`secondary small`,disabled:i.value||!n.value,onClick:t[2]||=e=>s(n.value)},` Go `,8,qk)]),z(`div`,{class:`dir-list`,role:`listbox`,"aria-label":`Directories`,"aria-busy":i.value},[z(`button`,{type:`button`,class:`dir-item`,title:`Start directories`,onClick:t[3]||=e=>s(``)},[B(A(Dc),{size:16}),t[5]||=z(`span`,null,`Start dirs`,-1)]),r.value?.parent?(I(),L(`button`,{key:0,type:`button`,class:`dir-item`,title:r.value.parent,onClick:t[4]||=e=>s(r.value.parent)},[B(A(lc),{size:16}),t[6]||=z(`span`,null,`..`,-1)],8,Yk)):H(``,!0),(I(!0),L(F,null,P(r.value?.dirs,e=>(I(),L(`button`,{key:e.path,type:`button`,class:`dir-item`,role:`option`,"aria-selected":e.path===n.value,title:e.path,onClick:t=>s(e.path)},[e.path===n.value?(I(),R(A(yc),{key:0,size:16})):(I(),R(A(bc),{key:1,size:16})),z(`span`,null,D(e.name),1)],8,Xk))),128)),r.value&&!r.value.dirs.length?(I(),L(`p`,Zk,`No subdirectories.`)):H(``,!0)],8,Jk),a.value?(I(),L(`p`,Qk,D(a.value),1)):H(``,!0)]))}}),eA={key:0,class:`message-error`},tA=[`value`],nA={class:`field`},rA={key:0,class:`recent-cwds`},iA=[`title`,`onClick`],aA={key:0,class:`hint`,title:`The device has no provider key — it lists its built-in catalog, and chat needs OPENROUTER_API_KEY set in the device's env file`},oA=[`value`],sA=[`value`],cA={key:2,class:`message-error`,role:`alert`},lA=[`disabled`],uA=`dpi-recent-cwds`,dA=of(N({__name:`NewSessionDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>Vu.devices.value.filter(e=>e.status===`online`)),a=k(i.value.find(e=>e.id===n.deviceId)?.id??i.value[0]?.id??``),o=U(()=>i.value.find(e=>e.id===a.value)),s=U(()=>{let e=o.value?.info?.models??[];if(e.length)return e;let t=o.value?.info;return t?.defaultModel&&t.provider?[{id:t.defaultModel,provider:t.provider,name:`${t.defaultModel} (device default)`,tier:`—`,icon:`lab.png`,contextWindow:0,reasoning:!1,cost:{input:0,output:0}}]:[]}),c=U(()=>!s.value.length||(o.value?.info?.models?.length??0)===0),l=U(()=>!!o.value?.info?.providerKeyMissing),u=e=>`${e.provider}/${e.id}`,d=k({name:``,cwd:``,model:``,thinking:`medium`}),f=U(()=>{try{return JSON.parse(localStorage.getItem(uA)??`{}`)[a.value]??[]}catch{return[]}}),p=(e,t)=>{try{let n=JSON.parse(localStorage.getItem(uA)??`{}`),r=[t,...(n[e]??[]).filter(e=>e!==t)].slice(0,6);localStorage.setItem(uA,JSON.stringify({...n,[e]:r}))}catch{}},m=k(!1),h=k(``),g=k({});M(a,async e=>{if(g.value={},e)try{let{projects:t}=await G(e).projects(!0);g.value=Object.fromEntries(t.filter(e=>e.model).map(e=>[e.rootPath,e.model]))}catch{}},{immediate:!0}),M([()=>d.value.cwd,g],()=>{let e=d.value.cwd;if(!e)return;let t=Object.keys(g.value).filter(t=>e===t||e.startsWith(`${t}/`)).sort((e,t)=>t.length-e.length),n=t.length?g.value[t[0]]:void 0;n&&(d.value.model=`${n.provider}/${n.modelId}`)},{immediate:!0}),M(o,e=>{let t=s.value,n=t.find(t=>t.id===e?.info?.defaultModel)??t[0];d.value.model=n?u(n):``,d.value.cwd=``},{immediate:!0});async function _(){if(!m.value&&o.value){m.value=!0,h.value=``;try{let e=s.value.find(e=>u(e)===d.value.model)??s.value[0];if(!e)throw Error(`Choose a model`);let t=await G(o.value.id).createSession({name:d.value.name.trim()||`New session`,cwd:d.value.cwd.trim(),model:{provider:e.provider,modelId:e.id},thinkingLevel:d.value.thinking});p(o.value.id,t.cwd);let n=t.agents.find(e=>e.kind===`root`)??t.agents[0];id({deviceId:o.value.id,sessionId:t.id,agentId:n?.id??1}),Y(`Session created on ${o.value.id}.`),r(`close`)}catch(e){h.value=K(e)}finally{m.value=!1}}}return(e,t)=>(I(),L(`div`,{class:`modal-backdrop`,onClick:t[7]||=ks(e=>r(`close`),[`self`])},[z(`form`,{class:`modal session-modal`,onSubmit:ks(_,[`prevent`])},[z(`header`,null,[t[8]||=z(`div`,null,[z(`span`,{class:`eyebrow`},`A PERSISTENT WORKSPACE`),z(`h2`,null,`New session`)],-1),z(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close new session`,onClick:t[0]||=e=>r(`close`)},[B(A(xl),{size:18})])]),i.value.length?(I(),L(F,{key:1},[z(`label`,null,[t[9]||=V(`Device`,-1),j(z(`select`,{"onUpdate:modelValue":t[1]||=e=>a.value=e,"aria-label":`Device`},[(I(!0),L(F,null,P(i.value,e=>(I(),L(`option`,{key:e.id,value:e.id},D(e.name)+D(e.info?.hostname&&e.info.hostname!==e.name?` · ${e.info.hostname}`:``),9,tA))),128))],512),[[Ss,a.value]])]),z(`label`,null,[t[10]||=V(`Session name`,-1),j(z(`input`,{"onUpdate:modelValue":t[2]||=e=>d.value.name=e,autofocus:``,placeholder:`My durable agent`,maxlength:`100`},null,512),[[ys,d.value.name]])]),z(`div`,nA,[z(`span`,null,`Working directory on `+D(i.value.find(e=>e.id===a.value)?.name??a.value),1),f.value.length?(I(),L(`div`,rA,[(I(!0),L(F,null,P(f.value,e=>(I(),L(`button`,{key:e,type:`button`,class:E([`chip`,{on:e===d.value.cwd}]),title:e,onClick:t=>d.value.cwd=e},D(e.split(`/`).filter(Boolean).at(-1)||e),11,iA))),128))])):H(``,!0),B($k,{modelValue:d.value.cwd,"onUpdate:modelValue":t[3]||=e=>d.value.cwd=e,"device-id":a.value},null,8,[`modelValue`,`device-id`])]),z(`label`,null,[t[11]||=V(`Model`,-1),c.value||l.value?(I(),L(`span`,aA,`no API key on device — chat needs one`)):H(``,!0),j(z(`select`,{"onUpdate:modelValue":t[4]||=e=>d.value.model=e,"aria-label":`New session model`},[(I(!0),L(F,null,P(s.value,e=>(I(),L(`option`,{key:u(e),value:u(e)},D(e.tier)+` / `+D(e.name),9,oA))),128))],512),[[Ss,d.value.model]])]),z(`label`,null,[t[12]||=V(`Thinking`,-1),j(z(`select`,{"onUpdate:modelValue":t[5]||=e=>d.value.thinking=e,"aria-label":`New session thinking level`},[(I(!0),L(F,null,P(A(Bv),e=>(I(),L(`option`,{key:e,value:e},D(e),9,sA))),128))],512),[[Ss,d.value.thinking]])])],64)):(I(),L(`p`,eA,` No device is online. Start one with just backend run or just net up <id>, then try again. `)),h.value?(I(),L(`p`,cA,D(h.value),1)):H(``,!0),z(`footer`,null,[z(`button`,{type:`button`,class:`secondary`,onClick:t[6]||=e=>r(`close`)},`Cancel`),z(`button`,{class:`primary`,disabled:m.value||!d.value.model||!d.value.cwd||!o.value},[B(A(Xc),{size:18}),V(D(m.value?`Creating…`:`Create session`),1)],8,lA)])],32)]))}}),[[`__scopeId`,`data-v-4e298b1e`]]),fA=new Uint8Array(512),pA=new Uint8Array(256);(()=>{let e=1;for(let t=0;t<255;t++)fA[t]=e,pA[e]=t,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)fA[e]=fA[e-255]})();var mA=(e,t)=>e===0||t===0?0:fA[pA[e]+pA[t]];function hA(e){let t=[1];for(let n=0;n<e;n++){let e=Array(t.length+1).fill(0);for(let r=0;r<t.length;r++)e[r]^=t[r],e[r+1]^=mA(t[r],fA[n]);t=e}return t}function gA(e,t){let n=hA(t),r=Array(t).fill(0);for(let i of e){let e=i^r[0];r.shift(),r.push(0);for(let i=0;i<t;i++)r[i]^=mA(n[i+1],e)}return r}var _A=[21,25,29,33,37,41,45,49,53,57,61,65],vA=[19,34,55,80,108,136,156,194,232,274,324,370],yA=[7,10,15,20,26,36,40,48,60,72,80,96],bA=[7,10,15,20,26,18,20,24,30,18,20,24],xA=[[[1,19]],[[1,34]],[[1,55]],[[1,80]],[[1,108]],[[2,68]],[[2,78]],[[2,97]],[[2,116]],[[2,68],[2,69]],[[4,81]],[[2,92],[2,93]]],SA=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58]],CA=e=>e<=9?8:16;function wA(e){for(let t=1;t<=_A.length;t++)if(4+CA(t)+e*8<=vA[t-1]*8)return t;throw Error(`qr: payload too long (${e} bytes; v12L max ${vA[11]-3})`)}function TA(e,t){let n=[...new TextEncoder().encode(e)],r=[],i=(e,t)=>{for(let n=t-1;n>=0;n--)r.push(e>>n&1)};i(4,4),i(n.length,CA(t));for(let e of n)i(e,8);let a=vA[t-1],o=a*8;for(i(0,Math.min(4,o-r.length));r.length%8!=0;)r.push(0);let s=[236,17],c=0;for(;r.length<o;)i(s[c++%2],8);let l=[];for(let e=0;e<a;e++){let t=0;for(let n=0;n<8;n++)t=t<<1|r[e*8+n];l.push(t)}return l}function EA(e,t){let n=bA[e-1],r=[],i=0;for(let[n,a]of xA[e-1])for(let e=0;e<n;e++)r.push(t.slice(i,i+=a));let a=[],o=Math.max(...r.map(e=>e.length));for(let e=0;e<o;e++)for(let t of r)e<t.length&&a.push(t[e]);let s=r.map(e=>gA(e,n));for(let e=0;e<n;e++)for(let t of s)a.push(t[e]);return a}function DA(e){return Array.from({length:e},()=>Array(e).fill(!1))}function OA(e,t){let n=_A[t-1],r=(t,r)=>{for(let i=-1;i<=7;i++)for(let a=-1;a<=7;a++){let o=t+i,s=r+a;if(o<0||o>=n||s<0||s>=n)continue;let c=i>=0&&i<=6&&a>=0&&a<=6&&(i===0||i===6||a===0||a===6),l=i>=2&&i<=4&&a>=2&&a<=4;e[o][s]=c||l}};r(0,0),r(0,n-7),r(n-7,0);for(let t=8;t<n-8;t++)e[6][t]=t%2==0,e[t][6]=t%2==0;let i=SA[t-1];for(let t of i)for(let r of i)if(!(t<=8&&r<=8||t<=8&&r>=n-9||t>=n-9&&r<=8))for(let n=-2;n<=2;n++)for(let i=-2;i<=2;i++)e[t+n][r+i]=Math.max(Math.abs(n),Math.abs(i))!==1;if(e[n-8][8]=!0,t>=7){let r=t<<12;for(let e=17;e>=12;e--)r>>e&1&&(r^=7973<<e-12);let i=t<<12|r&4095;for(let t=0;t<18;t++){let r=(i>>t&1)==1,a=n-11+t%3,o=t/3|0;e[a][o]=r,e[o][a]=r}}}function kA(e){let t=8|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>9&1?1335:0);let r=(t<<10|n)^21522,i=[];for(let e=14;e>=0;e--)i.push((r>>e&1)==1);return i}function AA(e,t){let n=_A[0]*0+e.length,r=kA(t);for(let t=0;t<=5;t++)e[8][t]=r[t];e[8][7]=r[6],e[8][8]=r[7],e[7][8]=r[8];for(let t=9;t<15;t++)e[14-t][8]=r[t];for(let t=0;t<7;t++)e[n-1-t][8]=r[t];e[8][n-8]=r[7];for(let t=8;t<15;t++)e[8][n-15+t]=r[t];e[n-8][8]=!0}function jA(e,t,n,r){let i=e.length;_A[n-1]*_A[n-1];let a=e=>((t[e>>3]??0)>>7-(e&7)&1)==1,o=0,s=!0;for(let t=i-1;t>0;t-=2){t===6&&t--;for(let c=0;c<i;c++){let l=s?i-1-c:c;for(let i of[t,t-1]){if(NA(l,i,n))continue;if(o>=(vA[n-1]+yA[n-1])*8){o++;continue}let t=a(o++);MA(l,i,r)&&(t=!t),e[l][i]=t}}s=!s}}function MA(e,t,n){switch(n){case 0:return(e+t)%2==0;case 1:return e%2==0;case 2:return t%3==0;case 3:return(e+t)%3==0;case 4:return(Math.floor(e/2)+Math.floor(t/3))%2==0;case 5:return e*t%2+e*t%3==0;case 6:return(e*t%2+e*t%3)%2==0;default:return((e+t)%2+e*t%3)%2==0}}function NA(e,t,n){let r=_A[n-1];if(e<=8&&t<=8||e<=8&&t>=r-8||e>=r-8&&t<=8||e===6||t===6||n>=7&&(e>=r-11&&e<=r-9&&t<=5||t>=r-11&&t<=r-9&&e<=5))return!0;let i=SA[n-1];for(let n of i)for(let a of i)if(!(n<=8&&a<=8||n<=8&&a>=r-9||n>=r-9&&a<=8)&&Math.abs(e-n)<=2&&Math.abs(t-a)<=2)return!0;return!1}function PA(e){let t=e.length,n=0;for(let r=0;r<2;r++)for(let i=0;i<t;i++){let a=1;for(let o=1;o<t;o++)(r===0?e[i][o]:e[o][i])===(r===0?e[i][o-1]:e[o-1][i])?(a++,o===t-1&&a>=5&&(n+=3+(a-5))):(a>=5&&(n+=3+(a-5)),a=1)}for(let r=0;r<t-1;r++)for(let i=0;i<t-1;i++){let t=e[r][i];e[r][i+1]===t&&e[r+1][i]===t&&e[r+1][i+1]===t&&(n+=3)}let r=[!0,!1,!0,!0,!0,!1,!0,!1,!1,!1,!1],i=(e,t)=>{for(let i=0;i+11<=t;i++){let t=!0;for(let n=0;n<11;n++)if(e(i+n)!==r[n]){t=!1;break}t&&(n+=40)}};for(let n=0;n<t;n++)i(t=>e[n][t],t);for(let n=0;n<t;n++)i(t=>e[t][n],t);let a=0;for(let t of e)for(let e of t)e&&a++;let o=a*100/(t*t);return n+=Math.floor(Math.abs(o-50)/5)*10,n}function FA(e,t){let n=wA(new TextEncoder().encode(e).length),r=_A[n-1],i=EA(n,TA(e,n)),a=DA(r);return OA(a,n),jA(a,i,n,t),AA(a,t),a}function IA(e,t){if(t!==void 0)return FA(e,t);let n;for(let t=0;t<8;t++){let r=FA(e,t),i=PA(r);(!n||i<n.score)&&(n={m:r,score:i})}return n.m}function LA(e,t=160){let n=IA(e),r=n.length,i=t/(r+8),a=``;for(let e=0;e<r;e++)for(let t=0;t<r;t++)n[e][t]&&(a+=`<rect x="${((t+4)*i).toFixed(2)}" y="${((e+4)*i).toFixed(2)}" width="${i.toFixed(3)}" height="${i.toFixed(3)}"/>`);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${t}" shape-rendering="crispEdges"><rect width="${t}" height="${t}" fill="#fff"/><g fill="#000">${a}</g></svg>`}var RA={class:`device-handoff`,"aria-label":`Pair this machine`},zA={class:`row`},BA=[`disabled`],VA=[`disabled`],HA={key:0,class:`target`,"data-testid":`device-url`},UA={key:1,class:`err`},WA=of(N({__name:`DeviceHandoff`,props:{offerFragment:{}},setup(e){let t=e,n=k(`4780`),r=k(!1),i=U(()=>{let e=/^\d{1,5}$/.test(n.value)?Number(n.value):0;if(!(!e||e<1||e>65535))return`http://127.0.0.1:${e}/pair#${t.offerFragment}`});function a(){let e=i.value;e&&window.open(e,`_blank`,`noopener`)}async function o(){let e=i.value;if(e)try{await navigator.clipboard.writeText(e),r.value=!0,setTimeout(()=>r.value=!1,1600)}catch{}}return(e,t)=>(I(),L(`section`,RA,[z(`header`,null,[B(A(zc),{size:18}),t[1]||=z(`h3`,null,`Pair THIS machine`,-1)]),t[4]||=z(`p`,{class:`what`},[V(` If this browser runs on the device itself, open its local pairing page — the offer is relayed inside the link, nothing is sent to the hub. Start `),z(`code`,null,`dpi device`),V(` there first. `)],-1),z(`div`,zA,[z(`label`,null,[t[2]||=V(` local port `,-1),j(z(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,inputmode:`numeric`,spellcheck:`false`,"aria-label":`Local dpi backend port`},null,512),[[ys,n.value]])]),z(`button`,{class:`primary`,type:`button`,disabled:!i.value,onClick:a},[B(A(mc),{size:15}),t[3]||=V(`Open the device page `,-1)],8,BA),z(`button`,{class:`secondary`,type:`button`,disabled:!i.value,onClick:o},[B(A(sc),{size:15}),V(D(r.value?`Copied`:`Copy link`),1)],8,VA)]),i.value?(I(),L(`p`,HA,D(i.value),1)):H(``,!0),i.value?H(``,!0):(I(),L(`p`,UA,`port must be 1–65535`))]))}}),[[`__scopeId`,`data-v-1e8e00d8`]]);function GA(e){return ej(e)&&!KA(e)&&!ij(e)&&Symbol.asyncIterator in e}function KA(e){return Array.isArray(e)}function qA(e){return typeof e==`bigint`}function JA(e){return typeof e==`boolean`}function YA(e){return e instanceof globalThis.Date}function XA(e){return typeof e==`function`}function ZA(e){return ej(e)&&!KA(e)&&!ij(e)&&Symbol.iterator in e}function QA(e){return e===null}function $A(e){return typeof e==`number`}function ej(e){return typeof e==`object`&&!!e}function tj(e){return e instanceof globalThis.RegExp}function nj(e){return typeof e==`string`}function rj(e){return typeof e==`symbol`}function ij(e){return e instanceof globalThis.Uint8Array}function aj(e){return e===void 0}function oj(e){return e.map(e=>dj(e))}function sj(e){return new Date(e.getTime())}function cj(e){return new Uint8Array(e)}function lj(e){return new RegExp(e.source,e.flags)}function uj(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=dj(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=dj(e[n]);return t}function dj(e){return KA(e)?oj(e):YA(e)?sj(e):ij(e)?cj(e):tj(e)?lj(e):ej(e)?uj(e):e}function fj(e){return dj(e)}function pj(e,t){return fj(t===void 0?e:{...t,...e})}function mj(e){return typeof e==`object`&&!!e}function hj(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function gj(e){return e===void 0}function _j(e){return typeof e==`number`}var vj;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=mj(t);return e.AllowArrayObject?n:n&&!hj(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?_j(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=gj(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(vj||={});function yj(e){return globalThis.Object.freeze(e).map(e=>wj(e))}function bj(e){return e}function xj(e){return e}function Sj(e){return e}function Cj(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=wj(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=wj(e[n]);return globalThis.Object.freeze(t)}function wj(e){return KA(e)?yj(e):YA(e)?bj(e):ij(e)?xj(e):tj(e)?Sj(e):ej(e)?Cj(e):e}function X(e,t){let n=t===void 0?e:{...t,...e};switch(vj.InstanceMode){case`freeze`:return wj(n);case`clone`:return fj(n);default:return n}}var Tj=class extends Error{constructor(e){super(e)}},Ej=Symbol.for(`TypeBox.Transform`),Dj=Symbol.for(`TypeBox.Readonly`),Oj=Symbol.for(`TypeBox.Optional`),kj=Symbol.for(`TypeBox.Hint`),Z=Symbol.for(`TypeBox.Kind`);function Aj(e){return ej(e)&&e[Dj]===`Readonly`}function jj(e){return ej(e)&&e[Oj]===`Optional`}function Mj(e){return Gj(e,`Any`)}function Nj(e){return Gj(e,`Argument`)}function Pj(e){return Gj(e,`Array`)}function Fj(e){return Gj(e,`AsyncIterator`)}function Ij(e){return Gj(e,`BigInt`)}function Lj(e){return Gj(e,`Boolean`)}function Rj(e){return Gj(e,`Computed`)}function zj(e){return Gj(e,`Constructor`)}function Bj(e){return Gj(e,`Date`)}function Vj(e){return Gj(e,`Function`)}function Hj(e){return Gj(e,`Integer`)}function Uj(e){return Gj(e,`Intersect`)}function Wj(e){return Gj(e,`Iterator`)}function Gj(e,t){return ej(e)&&Z in e&&e[Z]===t}function Kj(e){return JA(e)||$A(e)||nj(e)}function qj(e){return Gj(e,`Literal`)}function Jj(e){return Gj(e,`MappedKey`)}function Yj(e){return Gj(e,`MappedResult`)}function Xj(e){return Gj(e,`Never`)}function Zj(e){return Gj(e,`Not`)}function Qj(e){return Gj(e,`Null`)}function $j(e){return Gj(e,`Number`)}function eM(e){return Gj(e,`Object`)}function tM(e){return Gj(e,`Promise`)}function nM(e){return Gj(e,`Record`)}function rM(e){return Gj(e,`Ref`)}function iM(e){return Gj(e,`RegExp`)}function aM(e){return Gj(e,`String`)}function oM(e){return Gj(e,`Symbol`)}function sM(e){return Gj(e,`TemplateLiteral`)}function cM(e){return Gj(e,`This`)}function lM(e){return ej(e)&&Ej in e}function uM(e){return Gj(e,`Tuple`)}function dM(e){return Gj(e,`Undefined`)}function fM(e){return Gj(e,`Union`)}function pM(e){return Gj(e,`Uint8Array`)}function mM(e){return Gj(e,`Unknown`)}function hM(e){return Gj(e,`Unsafe`)}function gM(e){return Gj(e,`Void`)}function _M(e){return ej(e)&&Z in e&&nj(e[Z])}function vM(e){return Mj(e)||Nj(e)||Pj(e)||Lj(e)||Ij(e)||Fj(e)||Rj(e)||zj(e)||Bj(e)||Vj(e)||Hj(e)||Uj(e)||Wj(e)||qj(e)||Jj(e)||Yj(e)||Xj(e)||Zj(e)||Qj(e)||$j(e)||eM(e)||tM(e)||nM(e)||rM(e)||iM(e)||aM(e)||oM(e)||sM(e)||cM(e)||uM(e)||dM(e)||fM(e)||pM(e)||mM(e)||hM(e)||gM(e)||_M(e)}var yM=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function bM(e){try{return new RegExp(e),!0}catch{return!1}}function xM(e){if(!nj(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function SM(e){return TM(e)||xN(e)}function CM(e){return aj(e)||qA(e)}function wM(e){return aj(e)||$A(e)}function TM(e){return aj(e)||JA(e)}function EM(e){return aj(e)||nj(e)}function DM(e){return aj(e)||nj(e)&&xM(e)&&bM(e)}function OM(e){return aj(e)||nj(e)&&xM(e)}function kM(e){return aj(e)||xN(e)}function AM(e){return ej(e)&&e[Oj]===`Optional`}function jM(e){return GM(e,`Any`)&&EM(e.$id)}function MM(e){return GM(e,`Argument`)&&$A(e.index)}function NM(e){return GM(e,`Array`)&&e.type===`array`&&EM(e.$id)&&xN(e.items)&&wM(e.minItems)&&wM(e.maxItems)&&TM(e.uniqueItems)&&kM(e.contains)&&wM(e.minContains)&&wM(e.maxContains)}function PM(e){return GM(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&EM(e.$id)&&xN(e.items)}function FM(e){return GM(e,`BigInt`)&&e.type===`bigint`&&EM(e.$id)&&CM(e.exclusiveMaximum)&&CM(e.exclusiveMinimum)&&CM(e.maximum)&&CM(e.minimum)&&CM(e.multipleOf)}function IM(e){return GM(e,`Boolean`)&&e.type===`boolean`&&EM(e.$id)}function LM(e){return GM(e,`Computed`)&&nj(e.target)&&KA(e.parameters)&&e.parameters.every(e=>xN(e))}function RM(e){return GM(e,`Constructor`)&&e.type===`Constructor`&&EM(e.$id)&&KA(e.parameters)&&e.parameters.every(e=>xN(e))&&xN(e.returns)}function zM(e){return GM(e,`Date`)&&e.type===`Date`&&EM(e.$id)&&wM(e.exclusiveMaximumTimestamp)&&wM(e.exclusiveMinimumTimestamp)&&wM(e.maximumTimestamp)&&wM(e.minimumTimestamp)&&wM(e.multipleOfTimestamp)}function BM(e){return GM(e,`Function`)&&e.type===`Function`&&EM(e.$id)&&KA(e.parameters)&&e.parameters.every(e=>xN(e))&&xN(e.returns)}function VM(e){return GM(e,`Integer`)&&e.type===`integer`&&EM(e.$id)&&wM(e.exclusiveMaximum)&&wM(e.exclusiveMinimum)&&wM(e.maximum)&&wM(e.minimum)&&wM(e.multipleOf)}function HM(e){return ej(e)&&Object.entries(e).every(([e,t])=>xM(e)&&xN(t))}function UM(e){return GM(e,`Intersect`)&&!(nj(e.type)&&e.type!==`object`)&&KA(e.allOf)&&e.allOf.every(e=>xN(e)&&!fN(e))&&EM(e.type)&&(TM(e.unevaluatedProperties)||kM(e.unevaluatedProperties))&&EM(e.$id)}function WM(e){return GM(e,`Iterator`)&&e.type===`Iterator`&&EM(e.$id)&&xN(e.items)}function GM(e,t){return ej(e)&&Z in e&&e[Z]===t}function KM(e){return YM(e)&&nj(e.const)}function qM(e){return YM(e)&&$A(e.const)}function JM(e){return YM(e)&&JA(e.const)}function YM(e){return GM(e,`Literal`)&&EM(e.$id)&&XM(e.const)}function XM(e){return JA(e)||$A(e)||nj(e)}function ZM(e){return GM(e,`MappedKey`)&&KA(e.keys)&&e.keys.every(e=>$A(e)||nj(e))}function QM(e){return GM(e,`MappedResult`)&&HM(e.properties)}function $M(e){return GM(e,`Never`)&&ej(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function eN(e){return GM(e,`Not`)&&xN(e.not)}function tN(e){return GM(e,`Null`)&&e.type===`null`&&EM(e.$id)}function nN(e){return GM(e,`Number`)&&e.type===`number`&&EM(e.$id)&&wM(e.exclusiveMaximum)&&wM(e.exclusiveMinimum)&&wM(e.maximum)&&wM(e.minimum)&&wM(e.multipleOf)}function rN(e){return GM(e,`Object`)&&e.type===`object`&&EM(e.$id)&&HM(e.properties)&&SM(e.additionalProperties)&&wM(e.minProperties)&&wM(e.maxProperties)}function iN(e){return GM(e,`Promise`)&&e.type===`Promise`&&EM(e.$id)&&xN(e.item)}function aN(e){return GM(e,`Record`)&&e.type===`object`&&EM(e.$id)&&SM(e.additionalProperties)&&ej(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&bM(t[0])&&ej(e.patternProperties)&&xN(e.patternProperties[t[0]])})(e)}function oN(e){return GM(e,`Ref`)&&EM(e.$id)&&nj(e.$ref)}function sN(e){return GM(e,`RegExp`)&&EM(e.$id)&&nj(e.source)&&nj(e.flags)&&wM(e.maxLength)&&wM(e.minLength)}function cN(e){return GM(e,`String`)&&e.type===`string`&&EM(e.$id)&&wM(e.minLength)&&wM(e.maxLength)&&DM(e.pattern)&&OM(e.format)}function lN(e){return GM(e,`Symbol`)&&e.type===`symbol`&&EM(e.$id)}function uN(e){return GM(e,`TemplateLiteral`)&&e.type===`string`&&nj(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function dN(e){return GM(e,`This`)&&EM(e.$id)&&nj(e.$ref)}function fN(e){return ej(e)&&Ej in e}function pN(e){return GM(e,`Tuple`)&&e.type===`array`&&EM(e.$id)&&$A(e.minItems)&&$A(e.maxItems)&&e.minItems===e.maxItems&&(aj(e.items)&&aj(e.additionalItems)&&e.minItems===0||KA(e.items)&&e.items.every(e=>xN(e)))}function mN(e){return GM(e,`Undefined`)&&e.type===`undefined`&&EM(e.$id)}function hN(e){return GM(e,`Union`)&&EM(e.$id)&&ej(e)&&KA(e.anyOf)&&e.anyOf.every(e=>xN(e))}function gN(e){return GM(e,`Uint8Array`)&&e.type===`Uint8Array`&&EM(e.$id)&&wM(e.minByteLength)&&wM(e.maxByteLength)}function _N(e){return GM(e,`Unknown`)&&EM(e.$id)}function vN(e){return GM(e,`Unsafe`)}function yN(e){return GM(e,`Void`)&&e.type===`void`&&EM(e.$id)}function bN(e){return ej(e)&&Z in e&&nj(e[Z])&&!yM.includes(e[Z])}function xN(e){return ej(e)&&(jM(e)||MM(e)||NM(e)||IM(e)||FM(e)||PM(e)||LM(e)||RM(e)||zM(e)||BM(e)||VM(e)||UM(e)||WM(e)||YM(e)||ZM(e)||QM(e)||$M(e)||eN(e)||tN(e)||nN(e)||rN(e)||iN(e)||aN(e)||oN(e)||sN(e)||cN(e)||lN(e)||uN(e)||dN(e)||pN(e)||mN(e)||hN(e)||gN(e)||_N(e)||vN(e)||yN(e)||bN(e))}var SN=`(true|false)`,CN=`(0|[1-9][0-9]*)`,wN=`(.*)`,TN=`(?!.*)`;`${SN}`;var EN=`^${CN}$`,DN=`^${wN}$`,ON=`^${TN}$`;function kN(e,t){return e.includes(t)}function AN(e){return[...new Set(e)]}function jN(e,t){return e.filter(e=>t.includes(e))}function MN(e,t){return e.reduce((e,t)=>jN(e,t),t)}function NN(e){return e.length===1?e[0]:e.length>1?MN(e.slice(1),e[0]):[]}function PN(e){let t=[];for(let n of e)t.push(...n);return t}function FN(e){return X({[Z]:`Any`},e)}function IN(e,t){return X({[Z]:`Array`,type:`array`,items:e},t)}function LN(e){return X({[Z]:`Argument`,index:e})}function RN(e,t){return X({[Z]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function zN(e,t,n){return X({[Z]:`Computed`,target:e,parameters:t},n)}function BN(e,t){let{[t]:n,...r}=e;return r}function VN(e,t){return t.reduce((e,t)=>BN(e,t),e)}function HN(e){return X({[Z]:`Never`,not:{}},e)}function UN(e){return X({[Z]:`MappedResult`,properties:e})}function WN(e,t,n){return X({[Z]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function GN(e,t,n){return X({[Z]:`Function`,type:`Function`,parameters:e,returns:t},n)}function KN(e,t){return X({[Z]:`Union`,anyOf:e},t)}function qN(e){return e.some(e=>jj(e))}function JN(e){return e.map(e=>jj(e)?YN(e):e)}function YN(e){return VN(e,[Oj])}function XN(e,t){return qN(e)?IF(KN(JN(e),t)):KN(JN(e),t)}function ZN(e,t){return e.length===1?X(e[0],t):e.length===0?HN(t):XN(e,t)}function QN(e,t){return e.length===0?HN(t):e.length===1?X(e[0],t):KN(e,t)}var $N=class extends Tj{};function eP(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function tP(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function nP(e,t){return tP(e,t,`(`)}function rP(e,t){return tP(e,t,`)`)}function iP(e,t){return tP(e,t,`|`)}function aP(e){if(!(nP(e,0)&&rP(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(nP(e,n)&&(t+=1),rP(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function oP(e){return e.slice(1,e.length-1)}function sP(e){let t=0;for(let n=0;n<e.length;n++)if(nP(e,n)&&(t+=1),rP(e,n)&&--t,iP(e,n)&&t===0)return!0;return!1}function cP(e){for(let t=0;t<e.length;t++)if(nP(e,t))return!0;return!1}function lP(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(nP(e,i)&&(t+=1),rP(e,i)&&--t,iP(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(dP(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(dP(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function uP(e){function t(e,t){if(!nP(e,t))throw new $N(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(nP(e,r)&&(n+=1),rP(e,r)&&--n,n===0)return[t,r];throw new $N(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(nP(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(nP(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(dP(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(dP(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function dP(e){return aP(e)?dP(oP(e)):sP(e)?lP(e):cP(e)?uP(e):{type:`const`,const:eP(e)}}function fP(e){return dP(e.slice(1,e.length-1))}var pP=class extends Tj{};function mP(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function hP(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function gP(e){return e.type===`const`&&e.const===`.*`}function _P(e){return mP(e)||gP(e)?!1:hP(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>_P(e)):e.type===`const`||(()=>{throw new pP(`Unknown expression type`)})()}function vP(e){return _P(fP(e.pattern))}var yP=class extends Tj{};function*bP(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of bP(e.slice(1)))yield`${t}${n}`}function*xP(e){return yield*bP(e.expr.map(e=>[...wP(e)]))}function*SP(e){for(let t of e.expr)yield*wP(t)}function*CP(e){return yield e.const}function*wP(e){return e.type===`and`?yield*xP(e):e.type===`or`?yield*SP(e):e.type===`const`?yield*CP(e):(()=>{throw new yP(`Unknown expression`)})()}function TP(e){let t=fP(e.pattern);return _P(t)?[...wP(t)]:[]}function EP(e,t){return X({[Z]:`Literal`,const:e,type:typeof e},t)}function DP(e){return X({[Z]:`Boolean`,type:`boolean`},e)}function OP(e){return X({[Z]:`BigInt`,type:`bigint`},e)}function kP(e){return X({[Z]:`Number`,type:`number`},e)}function AP(e){return X({[Z]:`String`,type:`string`},e)}function*jP(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield DP():t===`number`?yield kP():t===`bigint`?yield OP():t===`string`?yield AP():yield(()=>{let e=t.split(`|`).map(e=>EP(e.trim()));return e.length===0?HN():e.length===1?e[0]:ZN(e)})()}function*MP(e){if(e[1]!==`{`)return yield*[EP(`$`),...NP(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=jP(e.slice(2,t)),r=NP(e.slice(t+1));return yield*[...n,...r]}yield EP(e)}function*NP(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[EP(e.slice(0,t)),...MP(e.slice(t))];yield EP(e)}function PP(e){return[...NP(e)]}var FP=class extends Tj{};function IP(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function LP(e,t){return sM(e)?e.pattern.slice(1,e.pattern.length-1):fM(e)?`(${e.anyOf.map(e=>LP(e,t)).join(`|`)})`:$j(e)||Hj(e)||Ij(e)?`${t}${CN}`:aM(e)?`${t}${wN}`:qj(e)?`${t}${IP(e.const.toString())}`:Lj(e)?`${t}${SN}`:(()=>{throw new FP(`Unexpected Kind '${e[Z]}'`)})()}function RP(e){return`^${e.map(e=>LP(e,``)).join(``)}$`}function zP(e){return ZN(TP(e).map(e=>EP(e)))}function BP(e,t){let n=nj(e)?RP(PP(e)):RP(e);return X({[Z]:`TemplateLiteral`,type:`string`,pattern:n},t)}function VP(e){return TP(e).map(e=>e.toString())}function HP(e){let t=[];for(let n of e)t.push(...WP(n));return t}function UP(e){return[e.toString()]}function WP(e){return[...new Set(sM(e)?VP(e):fM(e)?HP(e.anyOf):qj(e)?UP(e.const):$j(e)||Hj(e)?[`[number]`]:[])]}function GP(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=aF(e,WP(t[i]),n);return r}function KP(e,t,n){return GP(e,t.properties,n)}function qP(e,t,n){return UN(KP(e,t,n))}function JP(e,t){return e.map(e=>nF(e,t))}function YP(e){return e.filter(e=>!Xj(e))}function XP(e,t){return GF(YP(JP(e,t)))}function ZP(e){return e.some(e=>Xj(e))?[]:e}function QP(e,t){return ZN(ZP(JP(e,t)))}function $P(e,t){return t in e?e[t]:t===`[number]`?ZN(e):HN()}function eF(e,t){return t===`[number]`?e:HN()}function tF(e,t){return t in e?e[t]:HN()}function nF(e,t){return Uj(e)?XP(e.allOf,t):fM(e)?QP(e.anyOf,t):uM(e)?$P(e.items??[],t):Pj(e)?eF(e.items,t):eM(e)?tF(e.properties,t):HN()}function rF(e,t){return t.map(t=>nF(e,t))}function iF(e,t){return ZN(rF(e,t))}function aF(e,t,n){if(rM(e)||rM(t)){if(!vM(e)||!vM(t))throw new Tj(`Index types using Ref parameters require both Type and Key to be of TSchema`);return zN(`Index`,[e,t])}return Yj(t)?qP(e,t,n):Jj(t)?lF(e,t,n):X(vM(t)?iF(e,WP(t)):iF(e,t),n)}function oF(e,t,n){return{[t]:aF(e,[t],fj(n))}}function sF(e,t,n){return t.reduce((t,r)=>({...t,...oF(e,r,n)}),{})}function cF(e,t,n){return sF(e,t.keys,n)}function lF(e,t,n){return UN(cF(e,t,n))}function uF(e,t){return X({[Z]:`Iterator`,type:`Iterator`,items:e},t)}function dF(e){return globalThis.Object.keys(e).filter(t=>!jj(e[t]))}function fF(e,t){let n=dF(e);return X(n.length>0?{[Z]:`Object`,type:`object`,required:n,properties:e}:{[Z]:`Object`,type:`object`,properties:e},t)}var pF=fF;function mF(e,t){return X({[Z]:`Promise`,type:`Promise`,item:e},t)}function hF(e){return X(VN(e,[Dj]))}function gF(e){return X({...e,[Dj]:`Readonly`})}function _F(e,t){return t===!1?hF(e):gF(e)}function vF(e,t){let n=t??!0;return Yj(e)?xF(e,n):_F(e,n)}function yF(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=vF(e[r],t);return n}function bF(e,t){return yF(e.properties,t)}function xF(e,t){return UN(bF(e,t))}function SF(e,t){return X(e.length>0?{[Z]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[Z]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function CF(e,t){return e in t?AF(e,t[e]):UN(t)}function wF(e){return{[e]:EP(e)}}function TF(e){let t={};for(let n of e)t[n]=EP(n);return t}function EF(e,t){return kN(t,e)?wF(e):TF(t)}function DF(e,t){return CF(e,EF(e,t))}function OF(e,t){return t.map(t=>AF(e,t))}function kF(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=AF(e,t[r]);return n}function AF(e,t){let n={...t};return jj(t)?IF(AF(e,VN(t,[Oj]))):Aj(t)?vF(AF(e,VN(t,[Dj]))):Yj(t)?CF(e,t.properties):Jj(t)?DF(e,t.keys):zj(t)?WN(OF(e,t.parameters),AF(e,t.returns),n):Vj(t)?GN(OF(e,t.parameters),AF(e,t.returns),n):Fj(t)?RN(AF(e,t.items),n):Wj(t)?uF(AF(e,t.items),n):Uj(t)?KF(OF(e,t.allOf),n):fM(t)?QN(OF(e,t.anyOf),n):uM(t)?SF(OF(e,t.items??[]),n):eM(t)?pF(kF(e,t.properties),n):Pj(t)?IN(AF(e,t.items),n):tM(t)?mF(AF(e,t.item),n):t}function jF(e,t){let n={};for(let r of e)n[r]=AF(r,t);return n}function MF(e,t,n){let r=vM(e)?WP(e):e;return pF(jF(r,t({[Z]:`MappedKey`,keys:r})),n)}function NF(e){return X(VN(e,[Oj]))}function PF(e){return X({...e,[Oj]:`Optional`})}function FF(e,t){return t===!1?NF(e):PF(e)}function IF(e,t){let n=t??!0;return Yj(e)?zF(e,n):FF(e,n)}function LF(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=IF(e[r],t);return n}function RF(e,t){return LF(e.properties,t)}function zF(e,t){return UN(RF(e,t))}function BF(e,t={}){let n=e.every(e=>eM(e)),r=vM(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return X(t.unevaluatedProperties===!1||vM(t.unevaluatedProperties)||n?{...r,[Z]:`Intersect`,type:`object`,allOf:e}:{...r,[Z]:`Intersect`,allOf:e},t)}function VF(e){return e.every(e=>jj(e))}function HF(e){return VN(e,[Oj])}function UF(e){return e.map(e=>jj(e)?HF(e):e)}function WF(e,t){return VF(e)?IF(BF(UF(e),t)):BF(UF(e),t)}function GF(e,t={}){if(e.length===1)return X(e[0],t);if(e.length===0)return HN(t);if(e.some(e=>lM(e)))throw Error(`Cannot intersect transform types`);return WF(e,t)}function KF(e,t){if(e.length===1)return X(e[0],t);if(e.length===0)return HN(t);if(e.some(e=>lM(e)))throw Error(`Cannot intersect transform types`);return BF(e,t)}function qF(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new Tj(`Ref: $ref must be a string`);return X({[Z]:`Ref`,$ref:t},n)}function JF(e,t){return zN(`Awaited`,[zN(e,t)])}function YF(e){return zN(`Awaited`,[qF(e)])}function XF(e){return KF($F(e))}function ZF(e){return QN($F(e))}function QF(e){return eI(e)}function $F(e){return e.map(e=>eI(e))}function eI(e,t){return X(Rj(e)?JF(e.target,e.parameters):Uj(e)?XF(e.allOf):fM(e)?ZF(e.anyOf):tM(e)?QF(e.item):rM(e)?YF(e.$ref):e,t)}function tI(e){let t=[];for(let n of e)t.push(cI(n));return t}function nI(e){return PN(tI(e))}function rI(e){return NN(tI(e))}function iI(e){return e.map((e,t)=>t.toString())}function aI(e){return[`[number]`]}function oI(e){return globalThis.Object.getOwnPropertyNames(e)}function sI(e){return lI?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function cI(e){return Uj(e)?nI(e.allOf):fM(e)?rI(e.anyOf):uM(e)?iI(e.items??[]):Pj(e)?aI(e.items):eM(e)?oI(e.properties):nM(e)?sI(e.patternProperties):[]}var lI=!1;function uI(e,t){return zN(`KeyOf`,[zN(e,t)])}function dI(e){return zN(`KeyOf`,[qF(e)])}function fI(e,t){return X(ZN(pI(cI(e))),t)}function pI(e){return e.map(e=>e===`[number]`?kP():EP(e))}function mI(e,t){return Rj(e)?uI(e.target,e.parameters):rM(e)?dI(e.$ref):Yj(e)?_I(e,t):fI(e,t)}function hI(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=mI(e[r],fj(t));return n}function gI(e,t){return hI(e.properties,t)}function _I(e,t){return UN(gI(e,t))}function vI(e){let t=[];for(let n of e)t.push(...cI(n));return AN(t)}function yI(e){return e.filter(e=>!Xj(e))}function bI(e,t){let n=[];for(let r of e)n.push(...rF(r,[t]));return yI(n)}function xI(e,t){let n={};for(let r of t)n[r]=GF(bI(e,r));return n}function SI(e,t){return pF(xI(e,vI(e)),t)}function CI(e){return X({[Z]:`Date`,type:`Date`},e)}function wI(e){return X({[Z]:`Null`,type:`null`},e)}function TI(e){return X({[Z]:`Symbol`,type:`symbol`},e)}function EI(e){return X({[Z]:`Undefined`,type:`undefined`},e)}function DI(e){return X({[Z]:`Uint8Array`,type:`Uint8Array`},e)}function OI(e){return X({[Z]:`Unknown`},e)}function kI(e){return e.map(e=>MI(e,!1))}function AI(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=vF(MI(e[n],!1));return t}function jI(e,t){return t===!0?e:vF(e)}function MI(e,t){return GA(e)||ZA(e)?jI(FN(),t):KA(e)?vF(SF(kI(e))):ij(e)?DI():YA(e)?CI():ej(e)?jI(pF(AI(e)),t):XA(e)?jI(GN([],OI()),t):aj(e)?EI():QA(e)?wI():rj(e)?TI():qA(e)?OP():$A(e)||JA(e)||nj(e)?EP(e):pF({})}function NI(e,t){return X(MI(e,!0),t)}function PI(e,t){return zj(e)?SF(e.parameters,t):HN(t)}function FI(e,t){if(aj(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return QN([...new Set(n)].map(e=>EP(e)),{...t,[kj]:`Enum`})}var II=class extends Tj{},Q;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(Q||={});function LI(e){return e===Q.False?e:Q.True}function RI(e){throw new II(e)}function zI(e){return $M(e)||UM(e)||hN(e)||_N(e)||jM(e)}function BI(e,t){return $M(t)?iL(e,t):UM(t)?eL(e,t):hN(t)?VL(e,t):_N(t)?UL(e,t):jM(t)?VI(e,t):RI(`StructuralRight`)}function VI(e,t){return Q.True}function HI(e,t){return UM(t)?eL(e,t):hN(t)&&t.anyOf.some(e=>jM(e)||_N(e))?Q.True:hN(t)?Q.Union:_N(t)||jM(t)?Q.True:Q.Union}function UI(e,t){return _N(e)?Q.False:jM(e)?Q.Union:$M(e)?Q.True:Q.False}function WI(e,t){return rN(t)&&xL(t)?Q.True:zI(t)?BI(e,t):NM(t)?LI(qL(e.items,t.items)):Q.False}function GI(e,t){return zI(t)?BI(e,t):PM(t)?LI(qL(e.items,t.items)):Q.False}function KI(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):FM(t)?Q.True:Q.False}function qI(e,t){return JM(e)||IM(e)?Q.True:Q.False}function JI(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):IM(t)?Q.True:Q.False}function YI(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):RM(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>LI(qL(t.parameters[n],e))===Q.True)?LI(qL(e.returns,t.returns)):Q.False:Q.False}function XI(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):zM(t)?Q.True:Q.False}function ZI(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):BM(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>LI(qL(t.parameters[n],e))===Q.True)?LI(qL(e.returns,t.returns)):Q.False:Q.False}function QI(e,t){return YM(e)&&$A(e.const)||nN(e)||VM(e)?Q.True:Q.False}function $I(e,t){return VM(t)||nN(t)?Q.True:zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):Q.False}function eL(e,t){return t.allOf.every(t=>qL(e,t)===Q.True)?Q.True:Q.False}function tL(e,t){return e.allOf.some(e=>qL(e,t)===Q.True)?Q.True:Q.False}function nL(e,t){return zI(t)?BI(e,t):WM(t)?LI(qL(e.items,t.items)):Q.False}function rL(e,t){return YM(t)&&t.const===e.const?Q.True:zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):cN(t)?ML(e,t):nN(t)?lL(e,t):VM(t)?QI(e,t):IM(t)?qI(e,t):Q.False}function iL(e,t){return Q.False}function aL(e,t){return Q.True}function oL(e){let[t,n]=[e,0];for(;eN(t);)t=t.not,n+=1;return n%2==0?t:OI()}function sL(e,t){return eN(e)?qL(oL(e),t):eN(t)?qL(e,oL(t)):RI(`Invalid fallthrough for Not`)}function cL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):tN(t)?Q.True:Q.False}function lL(e,t){return qM(e)||nN(e)||VM(e)?Q.True:Q.False}function uL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):VM(t)||nN(t)?Q.True:Q.False}function dL(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function fL(e){return xL(e)}function pL(e){return dL(e,0)||dL(e,1)&&`description`in e.properties&&hN(e.properties.description)&&e.properties.description.anyOf.length===2&&(cN(e.properties.description.anyOf[0])&&mN(e.properties.description.anyOf[1])||cN(e.properties.description.anyOf[1])&&mN(e.properties.description.anyOf[0]))}function mL(e){return dL(e,0)}function hL(e){return dL(e,0)}function gL(e){return dL(e,0)}function _L(e){return dL(e,0)}function vL(e){return xL(e)}function yL(e){let t=kP();return dL(e,0)||dL(e,1)&&`length`in e.properties&&LI(qL(e.properties.length,t))===Q.True}function bL(e){return dL(e,0)}function xL(e){let t=kP();return dL(e,0)||dL(e,1)&&`length`in e.properties&&LI(qL(e.properties.length,t))===Q.True}function SL(e){let t=GN([FN()],FN());return dL(e,0)||dL(e,1)&&`then`in e.properties&&LI(qL(e.properties.then,t))===Q.True}function CL(e,t){return qL(e,t)===Q.False||AM(e)&&!AM(t)?Q.False:Q.True}function wL(e,t){return _N(e)?Q.False:jM(e)?Q.Union:$M(e)||KM(e)&&fL(t)||qM(e)&&mL(t)||JM(e)&&hL(t)||lN(e)&&pL(t)||FM(e)&&gL(t)||cN(e)&&fL(t)||lN(e)&&pL(t)||nN(e)&&mL(t)||VM(e)&&mL(t)||IM(e)&&hL(t)||gN(e)&&vL(t)||zM(e)&&_L(t)||RM(e)&&bL(t)||BM(e)&&yL(t)?Q.True:aN(e)&&cN(DL(e))?t[kj]===`Record`?Q.True:Q.False:aN(e)&&nN(DL(e))&&dL(t,0)?Q.True:Q.False}function TL(e,t){return zI(t)?BI(e,t):aN(t)?kL(e,t):rN(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!AM(t.properties[n]))return Q.False;if(AM(t.properties[n]))return Q.True;if(CL(e.properties[n],t.properties[n])===Q.False)return Q.False}return Q.True})():Q.False}function EL(e,t){return zI(t)?BI(e,t):rN(t)&&SL(t)?Q.True:iN(t)?LI(qL(e.item,t.item)):Q.False}function DL(e){return EN in e.patternProperties?kP():DN in e.patternProperties?AP():RI(`Unknown record key pattern`)}function OL(e){return EN in e.patternProperties?e.patternProperties[EN]:DN in e.patternProperties?e.patternProperties[DN]:RI(`Unable to get record value schema`)}function kL(e,t){let[n,r]=[DL(t),OL(t)];return KM(e)&&nN(n)&&LI(qL(e,r))===Q.True?Q.True:gN(e)&&nN(n)||cN(e)&&nN(n)||NM(e)&&nN(n)?qL(e,r):rN(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(CL(r,e.properties[t])===Q.False)return Q.False;return Q.True})():Q.False}function AL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?qL(OL(e),OL(t)):Q.False}function jL(e,t){return qL(sN(e)?AP():e,sN(t)?AP():t)}function ML(e,t){return YM(e)&&nj(e.const)||cN(e)?Q.True:Q.False}function NL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):cN(t)?Q.True:Q.False}function PL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):lN(t)?Q.True:Q.False}function FL(e,t){return uN(e)?qL(zP(e),t):uN(t)?qL(e,zP(t)):RI(`Invalid fallthrough for TemplateLiteral`)}function IL(e,t){return NM(t)&&e.items!==void 0&&e.items.every(e=>qL(e,t.items)===Q.True)}function LL(e,t){return $M(e)?Q.True:_N(e)?Q.False:jM(e)?Q.Union:Q.False}function RL(e,t){return zI(t)?BI(e,t):rN(t)&&xL(t)||NM(t)&&IL(e,t)?Q.True:pN(t)?aj(e.items)&&!aj(t.items)||!aj(e.items)&&aj(t.items)?Q.False:aj(e.items)&&!aj(t.items)||e.items.every((e,n)=>qL(e,t.items[n])===Q.True)?Q.True:Q.False:Q.False}function zL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):gN(t)?Q.True:Q.False}function BL(e,t){return zI(t)?BI(e,t):rN(t)?wL(e,t):aN(t)?kL(e,t):yN(t)?GL(e,t):mN(t)?Q.True:Q.False}function VL(e,t){return t.anyOf.some(t=>qL(e,t)===Q.True)?Q.True:Q.False}function HL(e,t){return e.anyOf.every(e=>qL(e,t)===Q.True)?Q.True:Q.False}function UL(e,t){return Q.True}function WL(e,t){return $M(t)?iL(e,t):UM(t)?eL(e,t):hN(t)?VL(e,t):jM(t)?VI(e,t):cN(t)?ML(e,t):nN(t)?lL(e,t):VM(t)?QI(e,t):IM(t)?qI(e,t):NM(t)?UI(e,t):pN(t)?LL(e,t):rN(t)?wL(e,t):_N(t)?Q.True:Q.False}function GL(e,t){return mN(e)||mN(e)?Q.True:Q.False}function KL(e,t){return UM(t)?eL(e,t):hN(t)?VL(e,t):_N(t)?UL(e,t):jM(t)?VI(e,t):rN(t)?wL(e,t):yN(t)?Q.True:Q.False}function qL(e,t){return uN(e)||uN(t)?FL(e,t):sN(e)||sN(t)?jL(e,t):eN(e)||eN(t)?sL(e,t):jM(e)?HI(e,t):NM(e)?WI(e,t):FM(e)?KI(e,t):IM(e)?JI(e,t):PM(e)?GI(e,t):RM(e)?YI(e,t):zM(e)?XI(e,t):BM(e)?ZI(e,t):VM(e)?$I(e,t):UM(e)?tL(e,t):WM(e)?nL(e,t):YM(e)?rL(e,t):$M(e)?aL(e,t):tN(e)?cL(e,t):nN(e)?uL(e,t):rN(e)?TL(e,t):aN(e)?AL(e,t):cN(e)?NL(e,t):lN(e)?PL(e,t):pN(e)?RL(e,t):iN(e)?EL(e,t):gN(e)?zL(e,t):mN(e)?BL(e,t):hN(e)?HL(e,t):_N(e)?WL(e,t):yN(e)?KL(e,t):RI(`Unknown left type operand '${e[Z]}'`)}function JL(e,t){return qL(e,t)}function YL(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=$L(e[o],t,n,r,fj(i));return a}function XL(e,t,n,r,i){return YL(e.properties,t,n,r,i)}function ZL(e,t,n,r,i){return UN(XL(e,t,n,r,i))}function QL(e,t,n,r){let i=JL(e,t);return i===Q.Union?QN([n,r]):i===Q.True?n:r}function $L(e,t,n,r,i){return Yj(e)?ZL(e,t,n,r,i):Jj(e)?X(rR(e,t,n,r,i)):X(QL(e,t,n,r),i)}function eR(e,t,n,r,i){return{[e]:$L(EP(e),t,n,r,fj(i))}}function tR(e,t,n,r,i){return e.reduce((e,a)=>({...e,...eR(a,t,n,r,i)}),{})}function nR(e,t,n,r,i){return tR(e.keys,t,n,r,i)}function rR(e,t,n,r,i){return UN(nR(e,t,n,r,i))}function iR(e,t){return oR(zP(e),t)}function aR(e,t){let n=e.filter(e=>JL(e,t)===Q.False);return n.length===1?n[0]:QN(n)}function oR(e,t,n={}){return sM(e)?X(iR(e,t),n):Yj(e)?X(lR(e,t),n):X(fM(e)?aR(e.anyOf,t):JL(e,t)===Q.False?e:HN(),n)}function sR(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=oR(e[r],t);return n}function cR(e,t){return sR(e.properties,t)}function lR(e,t){return UN(cR(e,t))}function uR(e,t){return fR(zP(e),t)}function dR(e,t){let n=e.filter(e=>JL(e,t)!==Q.False);return n.length===1?n[0]:QN(n)}function fR(e,t,n){return sM(e)?X(uR(e,t),n):Yj(e)?X(hR(e,t),n):X(fM(e)?dR(e.anyOf,t):JL(e,t)===Q.False?HN():e,n)}function pR(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=fR(e[r],t);return n}function mR(e,t){return pR(e.properties,t)}function hR(e,t){return UN(mR(e,t))}function gR(e,t){return zj(e)?X(e.returns,t):HN(t)}function _R(e){return vF(IF(e))}function vR(e,t,n){return X({[Z]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function yR(e,t,n){let r={};for(let n of e)r[n]=t;return pF(r,{...n,[kj]:`Record`})}function bR(e,t,n){return vP(e)?yR(WP(e),t,n):vR(e.pattern,t,n)}function xR(e,t,n){return yR(WP(QN(e)),t,n)}function SR(e,t,n){return yR([e.toString()],t,n)}function CR(e,t,n){return vR(e.source,t,n)}function wR(e,t,n){return vR(aj(e.pattern)?DN:e.pattern,t,n)}function TR(e,t,n){return vR(DN,t,n)}function ER(e,t,n){return vR(ON,t,n)}function DR(e,t,n){return pF({true:t,false:t},n)}function OR(e,t,n){return vR(EN,t,n)}function kR(e,t,n){return vR(EN,t,n)}function AR(e,t,n={}){return fM(e)?xR(e.anyOf,t,n):sM(e)?bR(e,t,n):qj(e)?SR(e.const,t,n):Lj(e)?DR(e,t,n):Hj(e)?OR(e,t,n):$j(e)?kR(e,t,n):iM(e)?CR(e,t,n):aM(e)?wR(e,t,n):Mj(e)?TR(e,t,n):Xj(e)?ER(e,t,n):HN(n)}function jR(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function MR(e){let t=jR(e);return t===DN?AP():t===EN?kP():AP({pattern:t})}function NR(e){return e.patternProperties[jR(e)]}function PR(e,t){return t.parameters=JR(e,t.parameters),t.returns=YR(e,t.returns),t}function FR(e,t){return t.parameters=JR(e,t.parameters),t.returns=YR(e,t.returns),t}function IR(e,t){return t.allOf=JR(e,t.allOf),t}function LR(e,t){return t.anyOf=JR(e,t.anyOf),t}function RR(e,t){return aj(t.items)||(t.items=JR(e,t.items)),t}function zR(e,t){return t.items=YR(e,t.items),t}function BR(e,t){return t.items=YR(e,t.items),t}function VR(e,t){return t.items=YR(e,t.items),t}function HR(e,t){return t.item=YR(e,t.item),t}function UR(e,t){let n=qR(e,t.properties);return{...t,...pF(n)}}function WR(e,t){let n=AR(YR(e,MR(t)),YR(e,NR(t)));return{...t,...n}}function GR(e,t){return t.index in e?e[t.index]:OI()}function KR(e,t){let n=Aj(t),r=jj(t),i=YR(e,t);return n&&r?_R(i):n&&!r?vF(i):!n&&r?IF(i):i}function qR(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:KR(e,t[r])}),{})}function JR(e,t){return t.map(t=>YR(e,t))}function YR(e,t){return zj(t)?PR(e,t):Vj(t)?FR(e,t):Uj(t)?IR(e,t):fM(t)?LR(e,t):uM(t)?RR(e,t):Pj(t)?zR(e,t):Fj(t)?BR(e,t):Wj(t)?VR(e,t):tM(t)?HR(e,t):eM(t)?UR(e,t):nM(t)?WR(e,t):Nj(t)?GR(e,t):t}function XR(e,t){return YR(t,pj(e))}function ZR(e){return X({[Z]:`Integer`,type:`integer`},e)}function QR(e,t,n){return{[e]:lz(EP(e),t,fj(n))}}function $R(e,t,n){return e.reduce((e,r)=>({...e,...QR(r,t,n)}),{})}function ez(e,t,n){return $R(e.keys,t,n)}function tz(e,t,n){return UN(ez(e,t,n))}function nz(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function rz(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function iz(e){return e.toUpperCase()}function az(e){return e.toLowerCase()}function oz(e,t,n){let r=fP(e.pattern);return _P(r)?BP([QN(cz([...wP(r)].map(e=>EP(e)),t))],n):{...e,pattern:sz(e.pattern,t)}}function sz(e,t){return typeof e==`string`?t===`Uncapitalize`?nz(e):t===`Capitalize`?rz(e):t===`Uppercase`?iz(e):t===`Lowercase`?az(e):e:e.toString()}function cz(e,t){return e.map(e=>lz(e,t))}function lz(e,t,n={}){return Jj(e)?tz(e,t,n):sM(e)?oz(e,t,n):fM(e)?QN(cz(e.anyOf,t),n):qj(e)?EP(sz(e.const,t),n):X(e,n)}function uz(e,t={}){return lz(e,`Capitalize`,t)}function dz(e,t={}){return lz(e,`Lowercase`,t)}function fz(e,t={}){return lz(e,`Uncapitalize`,t)}function pz(e,t={}){return lz(e,`Uppercase`,t)}function mz(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=wz(e[i],t,fj(n));return r}function hz(e,t,n){return mz(e.properties,t,n)}function gz(e,t,n){return UN(hz(e,t,n))}function _z(e,t){return e.map(e=>Cz(e,t))}function vz(e,t){return e.map(e=>Cz(e,t))}function yz(e,t){let{[t]:n,...r}=e;return r}function bz(e,t){return t.reduce((e,t)=>yz(e,t),e)}function xz(e,t,n){let r=VN(e,[Ej,`$id`,`required`,`properties`]);return pF(bz(n,t),r)}function Sz(e){return QN(e.reduce((e,t)=>Kj(t)?[...e,EP(t)]:e,[]))}function Cz(e,t){return Uj(e)?KF(_z(e.allOf,t)):fM(e)?QN(vz(e.anyOf,t)):eM(e)?xz(e,t,e.properties):pF({})}function wz(e,t,n){let r=KA(t)?Sz(t):t,i=vM(t)?WP(t):t,a=rM(e),o=rM(t);return Yj(e)?gz(e,i,n):Jj(t)?Oz(e,t,n):a&&o||!a&&o||a&&!o?zN(`Omit`,[e,r],n):X({...Cz(e,i),...n})}function Tz(e,t,n){return{[t]:wz(e,[t],fj(n))}}function Ez(e,t,n){return t.reduce((t,r)=>({...t,...Tz(e,r,n)}),{})}function Dz(e,t,n){return Ez(e,t.keys,n)}function Oz(e,t,n){return UN(Dz(e,t,n))}function kz(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=Rz(e[i],t,fj(n));return r}function Az(e,t,n){return kz(e.properties,t,n)}function jz(e,t,n){return UN(Az(e,t,n))}function Mz(e,t){return e.map(e=>Lz(e,t))}function Nz(e,t){return e.map(e=>Lz(e,t))}function Pz(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Fz(e,t,n){let r=VN(e,[Ej,`$id`,`required`,`properties`]);return pF(Pz(n,t),r)}function Iz(e){return QN(e.reduce((e,t)=>Kj(t)?[...e,EP(t)]:e,[]))}function Lz(e,t){return Uj(e)?KF(Mz(e.allOf,t)):fM(e)?QN(Nz(e.anyOf,t)):eM(e)?Fz(e,t,e.properties):pF({})}function Rz(e,t,n){let r=KA(t)?Iz(t):t,i=vM(t)?WP(t):t,a=rM(e),o=rM(t);return Yj(e)?jz(e,i,n):Jj(t)?Hz(e,t,n):a&&o||!a&&o||a&&!o?zN(`Pick`,[e,r],n):X({...Lz(e,i),...n})}function zz(e,t,n){return{[t]:Rz(e,[t],fj(n))}}function Bz(e,t,n){return t.reduce((t,r)=>({...t,...zz(e,r,n)}),{})}function Vz(e,t,n){return Bz(e,t.keys,n)}function Hz(e,t,n){return UN(Vz(e,t,n))}function Uz(e,t){return zN(`Partial`,[zN(e,t)])}function Wz(e){return zN(`Partial`,[qF(e)])}function Gz(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=IF(e[n]);return t}function Kz(e,t){let n=VN(e,[Ej,`$id`,`required`,`properties`]);return pF(Gz(t),n)}function qz(e){return e.map(e=>Jz(e))}function Jz(e){return Rj(e)?Uz(e.target,e.parameters):rM(e)?Wz(e.$ref):Uj(e)?KF(qz(e.allOf)):fM(e)?QN(qz(e.anyOf)):eM(e)?Kz(e,e.properties):Ij(e)||Lj(e)||Hj(e)||qj(e)||Qj(e)||$j(e)||aM(e)||oM(e)||dM(e)?e:pF({})}function Yz(e,t){return Yj(e)?Qz(e,t):X({...Jz(e),...t})}function Xz(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Yz(e[r],fj(t));return n}function Zz(e,t){return Xz(e.properties,t)}function Qz(e,t){return UN(Zz(e,t))}function $z(e,t){return zN(`Required`,[zN(e,t)])}function eB(e){return zN(`Required`,[qF(e)])}function tB(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=VN(e[n],[Oj]);return t}function nB(e,t){let n=VN(e,[Ej,`$id`,`required`,`properties`]);return pF(tB(t),n)}function rB(e){return e.map(e=>iB(e))}function iB(e){return Rj(e)?$z(e.target,e.parameters):rM(e)?eB(e.$ref):Uj(e)?KF(rB(e.allOf)):fM(e)?QN(rB(e.anyOf)):eM(e)?nB(e,e.properties):Ij(e)||Lj(e)||Hj(e)||qj(e)||Qj(e)||$j(e)||aM(e)||oM(e)||dM(e)?e:pF({})}function aB(e,t){return Yj(e)?cB(e,t):X({...iB(e),...t})}function oB(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=aB(e[r],t);return n}function sB(e,t){return oB(e.properties,t)}function cB(e,t){return UN(sB(e,t))}function lB(e,t){return t.map(t=>rM(t)?uB(e,t.$ref):jB(e,t))}function uB(e,t){return t in e?rM(e[t])?uB(e,e[t].$ref):jB(e,e[t]):HN()}function dB(e){return eI(e[0])}function fB(e){return aF(e[0],e[1])}function pB(e){return mI(e[0])}function mB(e){return Yz(e[0])}function hB(e){return wz(e[0],e[1])}function gB(e){return Rz(e[0],e[1])}function _B(e){return aB(e[0])}function vB(e,t,n){let r=lB(e,n);return t===`Awaited`?dB(r):t===`Index`?fB(r):t===`KeyOf`?pB(r):t===`Partial`?mB(r):t===`Omit`?hB(r):t===`Pick`?gB(r):t===`Required`?_B(r):HN()}function yB(e,t){return IN(jB(e,t))}function bB(e,t){return RN(jB(e,t))}function xB(e,t,n){return WN(AB(e,t),jB(e,n))}function SB(e,t,n){return GN(AB(e,t),jB(e,n))}function CB(e,t){return KF(AB(e,t))}function wB(e,t){return uF(jB(e,t))}function TB(e,t){return pF(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:jB(e,t[r])}),{}))}function EB(e,t){let[n,r]=[jB(e,NR(t)),jR(t)],i=pj(t);return i.patternProperties[r]=n,i}function DB(e,t){return rM(t)?{...uB(e,t.$ref),[Ej]:t[Ej]}:t}function OB(e,t){return SF(AB(e,t))}function kB(e,t){return QN(AB(e,t))}function AB(e,t){return t.map(t=>jB(e,t))}function jB(e,t){return jj(t)?X(jB(e,VN(t,[Oj])),t):Aj(t)?X(jB(e,VN(t,[Dj])),t):lM(t)?X(DB(e,t),t):Pj(t)?X(yB(e,t.items),t):Fj(t)?X(bB(e,t.items),t):Rj(t)?X(vB(e,t.target,t.parameters)):zj(t)?X(xB(e,t.parameters,t.returns),t):Vj(t)?X(SB(e,t.parameters,t.returns),t):Uj(t)?X(CB(e,t.allOf),t):Wj(t)?X(wB(e,t.items),t):eM(t)?X(TB(e,t.properties),t):nM(t)?X(EB(e,t)):uM(t)?X(OB(e,t.items||[]),t):fM(t)?X(kB(e,t.anyOf),t):t}function MB(e,t){return t in e?jB(e,e[t]):HN()}function NB(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:MB(e,n)}),{})}var PB=class{constructor(e){let t=NB(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:X(this.$defs[e],t)};return X({[Z]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function FB(e){return new PB(e)}function IB(e,t){return X({[Z]:`Not`,not:e},t)}function LB(e,t){return Vj(e)?SF(e.parameters,t):HN()}var RB=0;function zB(e,t={}){aj(t.$id)&&(t.$id=`T${RB++}`);let n=pj(e({[Z]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,X({[kj]:`Recursive`,...n},t)}function BB(e,t){let n=nj(e)?new globalThis.RegExp(e):e;return X({[Z]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function VB(e){return Uj(e)?e.allOf:fM(e)?e.anyOf:uM(e)?e.items??[]:[]}function HB(e){return VB(e)}function UB(e,t){return Vj(e)?X(e.returns,t):HN(t)}var WB=class{constructor(e){this.schema=e}Decode(e){return new GB(this.schema,e)}},GB=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[Ej].Encode(e(n)),Decode:e=>this.decode(t[Ej].Decode(e))};return{...t,[Ej]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[Ej]:n}}Encode(e){return lM(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function KB(e){return new WB(e)}function qB(e={}){return X({[Z]:e[Z]??`Unsafe`},e)}function JB(e){return X({[Z]:`Void`,type:`void`},e)}var $=t({Any:()=>FN,Argument:()=>LN,Array:()=>IN,AsyncIterator:()=>RN,Awaited:()=>eI,BigInt:()=>OP,Boolean:()=>DP,Capitalize:()=>uz,Composite:()=>SI,Const:()=>NI,Constructor:()=>WN,ConstructorParameters:()=>PI,Date:()=>CI,Enum:()=>FI,Exclude:()=>oR,Extends:()=>$L,Extract:()=>fR,Function:()=>GN,Index:()=>aF,InstanceType:()=>gR,Instantiate:()=>XR,Integer:()=>ZR,Intersect:()=>KF,Iterator:()=>uF,KeyOf:()=>mI,Literal:()=>EP,Lowercase:()=>dz,Mapped:()=>MF,Module:()=>FB,Never:()=>HN,Not:()=>IB,Null:()=>wI,Number:()=>kP,Object:()=>pF,Omit:()=>wz,Optional:()=>IF,Parameters:()=>LB,Partial:()=>Yz,Pick:()=>Rz,Promise:()=>mF,Readonly:()=>vF,ReadonlyOptional:()=>_R,Record:()=>AR,Recursive:()=>zB,Ref:()=>qF,RegExp:()=>BB,Required:()=>aB,Rest:()=>HB,ReturnType:()=>UB,String:()=>AP,Symbol:()=>TI,TemplateLiteral:()=>BP,Transform:()=>KB,Tuple:()=>SF,Uint8Array:()=>DI,Uncapitalize:()=>fz,Undefined:()=>EI,Union:()=>QN,Unknown:()=>OI,Unsafe:()=>qB,Uppercase:()=>pz,Void:()=>JB}),YB={additionalProperties:!1},XB=$.String({pattern:`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`,minLength:36,maxLength:36}),ZB=$.String({pattern:`^[a-z0-9][a-z0-9-]{0,31}(?![\\s\\S])`,minLength:1,maxLength:32}),QB=$.String({pattern:`^sha256:[0-9a-f]{64}$`,minLength:71,maxLength:71}),$B=$.String({pattern:`^[A-Za-z0-9_-]{43}$`,minLength:43,maxLength:43}),eV=$.String({pattern:`^dpt_[A-Za-z0-9_-]{43}$`,minLength:47,maxLength:47}),tV=`[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`,nV=`^(?:${tV}|[A-Z2-7]{12}|[A-Z2-7]{8})(?![\\s\\S])`,rV=$.String({pattern:nV,minLength:8,maxLength:36}),iV=new RegExp(nV),aV=/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;function oV(e){return typeof e!=`string`||e.length>36?!1:iV.test(e)}function sV(e){if(typeof e!=`string`)return;if(aV.test(e)){let t=e.toLowerCase();return oV(t)?t:void 0}let t=e.replace(/[\s-]+/g,``).toUpperCase();if(oV(t)&&!(/[\s-]/.test(e)&&t.length!==12))return t}$.Object({type:$.Literal(`pair.request`),v:$.Literal(1),requestId:XB,code:rV,deviceUid:XB,deviceName:$.String({minLength:1,maxLength:64}),hostname:$.Optional($.String({minLength:1,maxLength:128})),platform:$.Optional($.String({minLength:1,maxLength:64})),publicKey:$.String({minLength:1,maxLength:256}),keyFingerprint:QB,clientTime:$.Integer(),hubNonce:$.Optional($B)},YB),$.Object({type:$.Literal(`pair.device-request`),v:$.Literal(1),requestId:XB,deviceUid:XB,deviceName:$.String({minLength:1,maxLength:64}),hostname:$.Optional($.String({minLength:1,maxLength:128})),platform:$.Optional($.String({minLength:1,maxLength:64})),publicKey:$.String({minLength:1,maxLength:256}),keyFingerprint:QB,clientTime:$.Integer(),hubNonce:$.Optional($B)},YB);var cV=$.Object({type:$.Literal(`pair.challenge`),v:$.Literal(1),enrollmentId:XB,nonce:$B,issuedAt:$.Integer(),hubId:XB,hubPublicKey:$.Optional($.String({minLength:1,maxLength:256})),hubKeyFingerprint:$.Optional(QB),hubSignature:$.Optional($.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86}))},YB);$.Object({type:$.Literal(`pair.device-ack`),v:$.Literal(1),codeId:XB,code:rV,expiresAt:$.Integer(),hubOrigin:$.String(),hubId:XB,challenge:cV},YB),$.Object({type:$.Literal(`pair.response`),v:$.Literal(1),enrollmentId:XB,nonce:$B,signature:$.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86})},YB),$.Object({type:$.Literal(`pair.pending`),v:$.Literal(1),enrollmentId:XB,state:$.Literal(`awaiting_approval`),expiresAt:$.Integer(),pollAfterMs:$.Integer({minimum:1})},YB),$.Object({type:$.Literal(`pair.token`),v:$.Literal(1),enrollmentId:XB,deviceUid:XB,deviceId:ZB,pairingEpoch:XB,credentialId:XB,generation:$.Integer({minimum:1}),hubId:XB,hubOrigin:$.String(),hubUrl:$.String(),tunnelToken:eV,issuedAt:$.Integer(),expiresAt:$.Null(),hubKeyFingerprint:$.Optional(QB)},YB),$.Object({enrollmentId:XB,deviceUid:XB,keyFingerprint:QB,replaceKey:$.Optional($.Boolean())},YB),$.Object({type:$.Literal(`pair.revoke`),v:$.Literal(1),deviceId:ZB,pairingEpoch:XB,reason:$.Union([$.Literal(`user`),$.Literal(`compromise`),$.Literal(`hub_migrated`)]),revokedAt:$.Integer()},YB);var lV=$.Object({type:$.Literal(`pair.error`),v:$.Literal(1),code:$.Union([$.Literal(`code_invalid`),$.Literal(`code_expired`),$.Literal(`code_used`),$.Literal(`code_in_use`),$.Literal(`rate_limited`),$.Literal(`signature_invalid`),$.Literal(`clock_skew`),$.Literal(`paired_elsewhere`),$.Literal(`hub_required`),$.Literal(`fingerprint_mismatch`),$.Literal(`identity_conflict`),$.Literal(`enrollment_lost`),$.Literal(`enrollment_cancelled`),$.Literal(`already_issued`),$.Literal(`challenge_expired`)]),message:$.String({maxLength:512}),retryAfterMs:$.Optional($.Integer({minimum:1}))},YB);$.Object({type:$.Literal(`pair.code`),v:$.Literal(1),codeId:XB,code:rV,expiresAt:$.Integer(),hubOrigin:$.String({maxLength:2048}),pairUrl:$.String({maxLength:4096}),offerUrl:$.Optional($.String({maxLength:2048}))},YB);var uV=$.Union([$.Literal(`open`),$.Literal(`awaiting_proof`),$.Literal(`awaiting_approval`),$.Literal(`approved`),$.Literal(`issued`),$.Literal(`connected`),$.Literal(`cancelled`),$.Literal(`expired`)]);$.Object({type:$.Literal(`pair.code-state`),v:$.Literal(1),codeId:XB,expiresAt:$.Integer(),phase:uV,enrollment:$.Optional($.Object({enrollmentId:XB,deviceUid:XB,deviceName:$.String({minLength:1,maxLength:64}),keyFingerprint:QB,proofVerified:$.Boolean(),keyChanged:$.Boolean()},YB)),deviceId:$.Optional(ZB),error:$.Optional(lV)},YB);function dV(e){if(typeof e!=`string`||e.length===0||e.length>2048)return{ok:!1,error:`origin: empty or too long`};if(/\s|\n|\r|\t/.test(e))return{ok:!1,error:`origin: whitespace not allowed`};let t;try{t=new URL(e)}catch{return{ok:!1,error:`origin: not a valid URL`}}return t.protocol!==`https:`&&!(t.protocol===`http:`&&/^(127\.0\.0\.1|\[::1\]|localhost)$/.test(t.hostname))?{ok:!1,error:`origin: HTTPS origin required`}:t.username||t.password?{ok:!1,error:`origin: userinfo not allowed`}:t.search||t.hash?{ok:!1,error:`origin: query/fragment not allowed`}:t.pathname!==`/`&&t.pathname!==``?{ok:!1,error:`origin: base path not allowed`}:{ok:!0,origin:t.origin,tunnelUrl:`${t.origin}/api/tunnel`}}function fV(e){if(e!==``&&/^[A-Za-z0-9_-]+$/.test(e))try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return}}var pV=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,mV=RegExp(`^${tV}$`),hV=/^sha256:[0-9a-f]{64}$/;function gV(e){let t=fV(e);if(!t||t.length>1024)return;let n;try{n=JSON.parse(new TextDecoder().decode(t))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(r.v!==2&&r.v!==3)return;let i=r.v===3?6:5;if(Object.keys(r).length!==i||typeof r.hub!=`string`)return;let a=dV(r.hub);if(a.ok&&a.origin===r.hub&&typeof r.id==`string`&&pV.test(r.id)&&typeof r.code==`string`&&mV.test(r.code)&&typeof r.exp==`number`&&Number.isSafeInteger(r.exp))return r.v===3?typeof r.kfp!=`string`||!hV.test(r.kfp)?void 0:{v:3,hub:r.hub,id:r.id,code:r.code,exp:r.exp,kfp:r.kfp}:{v:2,hub:r.hub,id:r.id,code:r.code,exp:r.exp}}function _V(e,t=Date.now()){let n=gV(e);if(n&&!(n.exp<t-3e4)&&!(n.exp>t+6e5))return n}function vV(e,t=Date.now()){let n;try{n=new URL(e)}catch{return}if(!/^\/pair\/?$/.test(n.pathname)||n.username||n.password||n.search||!n.hash.startsWith(`#offer=`))return;let r=_V(n.hash.slice(7),t);if(r&&r.hub===n.origin)return{offer:r,rest:`${n.origin}/pair`}}function yV(e){if(!/^\/pair\/?$/.test(e.pathname))return;if(e.hash.startsWith(`#offer=`)){let t=vV(e.href);if(t)return{code:t.offer.code,origin:e.origin,offerFragment:e.hash.slice(1)};let n=_V(e.hash.slice(7));return n&&n.hub!==e.origin?{error:`This pairing link does not belong to this hub. Open the original hub link instead.`}:{error:`Invalid pairing link. Use a complete link from the hub wizard.`}}let t=e.searchParams;if(!t.has(`code`)&&!t.has(`origin`)&&!t.has(`v`))return;let n=t.get(`code`),r=n===null?void 0:sV(n);if(e.username||e.password||e.hash||t.getAll(`code`).length!==1||!r||t.getAll(`v`).length!==1||t.get(`v`)!==`1`)return{error:`Invalid pairing link. Use a complete version 1 link from the hub wizard.`};if(t.has(`origin`))try{let n=new URL(t.get(`origin`));if(t.getAll(`origin`).length!==1||n.origin!==e.origin||n.pathname!==`/`||n.username||n.password||n.search||n.hash)throw Error(`origin mismatch`)}catch{return{error:`This pairing link does not belong to this hub. Open the original hub link instead.`}}return{code:r,origin:e.origin}}var bV=e=>/^\/pair\/?$/.test(e.pathname)?`/`:void 0,xV=e=>/^\/pair\/?$/.test(e.pathname)&&yV(e)===void 0?`/`:void 0,SV=4e3;async function CV(e){if(!e.needsCancel)return{closed:!0,confirmed:!0};let t,n=await Promise.race([e.cancel().catch(()=>`failed`),new Promise(n=>t=setTimeout(()=>n(`failed`),e.timeoutMs))]);return clearTimeout(t),{closed:n!==`issued`,confirmed:n===`cancelled`}}var wV={class:`modal pair-wizard`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pair-title`},TV={key:1,class:`pair-pending`,"aria-label":`Machines waiting for approval`},EV={class:`who`},DV={key:0,class:`muted`},OV={key:1,class:`muted`},kV={class:`fp`},AV={class:`row`},jV={class:`phase`},MV=[`onClick`],NV={key:2,class:`hint`},PV={class:`pair-steps`,"aria-label":`Pairing progress`},FV={class:`pair-grid`},IV={class:`pair-code-box`},LV={class:`pair-code`,"aria-label":`Pairing code`},RV={class:`pair-copy-actions`},zV=[`innerHTML`],BV={class:`pair-side`},VV={key:0,class:`hint`},HV={class:`pair-fingerprint`},UV={class:`fp`},WV={class:`pair-confirm`},GV={key:0,class:`pair-confirm warn`},KV=[`disabled`],qV=[`disabled`],JV={class:`hint`},YV=[`disabled`],XV={key:5,class:`error`,role:`alert`},ZV={key:4},QV={class:`error`,role:`alert`},$V=N({__name:`PairDeviceWizard`,props:{handoff:{}},emits:[`close`],setup(e,{expose:t,emit:n}){let r=n,i=e,a=k(`boot`),o=k(),s=k(),c=k(),l=k(``),u=k(!1),d=k(!1),f=k(!1),p=k(!1),m=k(!1),h=k(!1),g=k(),_=k([]),v=U(()=>{let e=s.value?.code??``;return!oV(e)||e.includes(`-`)?e:(e.match(/.{4}/g)??[]).join(`-`)}),y=U(()=>s.value?Ob(s.value):``),b=U(()=>y.value?LA(y.value,148):``),x=U(()=>c.value?.enrollment?.keyFingerprint??``),S=U(()=>c.value?.deviceId??``);M(S,e=>{g.value?.(),e&&(g.value=M(()=>Vu.devices.value.find(t=>t.id===e)?.status,e=>{e===`online`&&(Y(`Device paired and online.`),g.value?.(),g.value=void 0)},{immediate:!0}))});async function C(e){a.value=`boot`,l.value=``,f.value=!1,p.value=!1,c.value=void 0,s.value=void 0,o.value?.close();let t=jb();o.value=t;try{let n=e?await kb.resolveCode(e):await kb.createCode();if(t.closed()){await kb.cancel(n.codeId).catch(()=>{Y(`The late pairing code could not be cancelled. Check device credentials before retrying.`)});return}if(s.value=n,a.value=`code`,e){let e=bV(new URL(window.location.href));e&&window.history.replaceState(window.history.state,``,e)}Pb(t,n.codeId,{intervalMs:1e3,onState:e=>{c.value=e,e.phase===`awaiting_proof`?a.value=`proof`:e.phase===`awaiting_approval`||e.phase===`approved`?a.value=`approve`:e.phase===`issued`||e.phase===`connected`?a.value=`issued`:e.phase===`cancelled`?a.value=`cancelled`:e.phase===`expired`&&(a.value=`expired`)}}).catch(e=>{t.closed()||(l.value=e instanceof Error?e.message:String(e),a.value=`expired`)})}catch(e){l.value=e instanceof Error?e.message:String(e),a.value=`expired`}}async function ee(){let e=c.value,t=o.value;if(e?.enrollment&&t&&!u.value){u.value=!0,l.value=``;try{let t=await kb.approve(s.value.codeId,{enrollmentId:e.enrollment.enrollmentId,deviceUid:e.enrollment.deviceUid,keyFingerprint:e.enrollment.keyFingerprint,...p.value?{replaceKey:!0}:{}});c.value=t,(t.phase===`issued`||t.phase===`connected`)&&(a.value=`issued`)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}}async function te(e){if(!s.value)return`cancelled`;try{let t=await kb.cancel(s.value.codeId,void 0,e);return c.value=t,o.value&&(o.value.state=t),a.value=t.phase===`expired`?`expired`:`cancelled`,o.value?.close(),`cancelled`}catch(e){if(e instanceof Sl&&e.status===409&&String(e.code)===`already_issued`){let e=await kb.codeState(s.value.codeId).catch(()=>void 0);return e&&(c.value=e,o.value&&(o.value.state=e)),a.value=`issued`,l.value=`Credential already issued. Closing does not revoke it; choose Revoke explicitly if needed.`,`issued`}return l.value=e instanceof Error?e.message:String(e),`failed`}}let ne=()=>te(!1),re=()=>[`issued`,`connected`,`cancelled`,`expired`].includes(c.value?.phase??``);async function w(){let e=S.value;if(e){u.value=!0;try{await kb.revoke(e,`user`),Y(`Issued credential revoked.`),r(`close`)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}}async function ie(){if(s.value)try{await navigator.clipboard.writeText(s.value.code),m.value=!0,setTimeout(()=>m.value=!1,1500)}catch{l.value=`Clipboard unavailable; copy the code manually.`}}async function ae(){if(s.value)try{await navigator.clipboard.writeText(s.value.offerUrl??s.value.pairUrl),h.value=!0,setTimeout(()=>h.value=!1,1500)}catch{l.value=`Clipboard unavailable; copy the link manually.`}}async function oe(){if(!d.value){d.value=!0,u.value=!0;try{let e=await CV({needsCancel:!!s.value&&!re(),cancel:ne,timeoutMs:SV});if(!e.closed)return;o.value?.close(),g.value?.(),e.confirmed||Y(`Pairing cancellation was not confirmed. The code expires on its own; check device credentials before retrying.`),r(`close`)}finally{d.value=!1,u.value=!1}}}t({close:oe});let se;async function ce(){try{_.value=(await kb.pending()).codes}catch{}}async function le(e){s.value=void 0,c.value=void 0,l.value=``;let t=jb();o.value=t,a.value=e.phase===`approved_ready`?`approve`:`proof`,Pb(t,e.codeId,{intervalMs:1e3,onState:e=>{c.value=e,e.phase===`awaiting_proof`?a.value=`proof`:e.phase===`awaiting_approval`||e.phase===`approved`?a.value=`approve`:e.phase===`issued`||e.phase===`connected`?a.value=`issued`:e.phase===`cancelled`?a.value=`cancelled`:e.phase===`expired`&&(a.value=`expired`)}}).catch(e=>{l.value=e instanceof Error?e.message:String(e)})}return Vr(()=>{if(ce(),se=setInterval(()=>void ce(),3e3),i.handoff&&`error`in i.handoff){l.value=i.handoff.error,a.value=`expired`;return}C(i.handoff?.code)}),Wr(()=>{clearInterval(se);let e=o.value;e&&!e.closed()&&s.value&&!re()&&te(!0).then(e=>{e!==`cancelled`&&Y(`Pairing cancellation was not confirmed. Check device credentials before retrying.`)}),e?.close(),g.value?.()}),(e,t)=>(I(),L(`div`,{class:`modal-backdrop`,onClick:ks(oe,[`self`])},[z(`div`,wV,[z(`header`,null,[t[5]||=z(`h2`,{id:`pair-title`},`Pair a device`,-1),z(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,onClick:oe},[B(A(xl),{size:18})])]),i.handoff&&`offerFragment`in i.handoff&&i.handoff.offerFragment?(I(),R(WA,{key:0,"offer-fragment":i.handoff.offerFragment},null,8,[`offer-fragment`])):H(``,!0),_.value.length?(I(),L(`section`,TV,[t[6]||=z(`h3`,null,`Machines waiting for you`,-1),z(`ul`,null,[(I(!0),L(F,null,P(_.value,e=>(I(),L(`li`,{key:e.codeId},[z(`div`,EV,[z(`strong`,null,D(e.deviceName??`unnamed device`),1),e.hostname?(I(),L(`span`,DV,D(e.hostname),1)):H(``,!0),e.platform?(I(),L(`span`,OV,D(e.platform),1)):H(``,!0)]),z(`div`,kV,D(e.keyFingerprint),1),z(`div`,AV,[z(`span`,jV,D(e.phase.replaceAll(`_`,` `)),1),z(`button`,{type:`button`,class:`small`,onClick:t=>le(e)},`Review`,8,MV)])]))),128))]),t[7]||=z(`p`,{class:`hint`},` Compare each fingerprint with the machine's own terminal before approving. Codes are minted by the hub — nothing has to be copied to the machine. `,-1)])):H(``,!0),a.value===`boot`?(I(),L(`p`,NV,`Minting a pairing code…`)):s.value?(I(),L(F,{key:3},[z(`ol`,PV,[t[8]||=z(`li`,{class:E({on:!0})},`Code`,-1),z(`li`,{class:E({on:[`proof`,`approve`,`issued`].includes(a.value)})},`Proof`,2),z(`li`,{class:E({on:[`approve`,`issued`].includes(a.value)})},`Fingerprint`,2),z(`li`,{class:E({on:a.value===`issued`})},`Online`,2)]),z(`div`,FV,[z(`div`,IV,[z(`div`,LV,D(v.value),1),z(`div`,RV,[z(`button`,{type:`button`,class:`small`,onClick:ie},[B(A(sc),{size:14}),V(` `+D(m.value?`Copied`:`Copy code`),1)]),z(`button`,{type:`button`,class:`small`,onClick:ae,title:`Self-contained link: hub, code and expiry all in the fragment — it never reaches server logs`},[B(A(sc),{size:14}),V(` `+D(h.value?`Copied link`:`Copy link`),1)])]),t[9]||=z(`p`,{class:`hint`},` Run the device pairing command and scan, or enter this code on the device. Expires in 5 minutes. `,-1),z(`div`,{class:`pair-qr`,"aria-label":`Pairing QR code`,title:`Same offer link as Copy link: hub, code and expiry all in the #offer= fragment — it never reaches server logs`,innerHTML:b.value},null,8,zV)]),z(`div`,BV,[a.value===`code`||a.value===`proof`?(I(),L(`p`,VV,[B(A($c),{size:14,class:`spin`}),t[10]||=V(` Waiting for the device to submit its signing proof… `,-1)])):a.value===`approve`?(I(),L(F,{key:1},[z(`div`,HV,[t[11]||=z(`h3`,null,`Device key fingerprint`,-1),z(`code`,UV,D(x.value),1),t[12]||=z(`p`,{class:`hint`},` Compare ALL 64 hex characters with the fingerprint shown on the device screen. `,-1)]),z(`label`,WV,[j(z(`input`,{"onUpdate:modelValue":t[0]||=e=>f.value=e,type:`checkbox`},null,512),[[bs,f.value]]),t[13]||=V(` The fingerprint matches the device display exactly `,-1)]),c.value?.enrollment?.keyChanged?(I(),L(`label`,GV,[j(z(`input`,{"onUpdate:modelValue":t[1]||=e=>p.value=e,type:`checkbox`},null,512),[[bs,p.value]]),B(A(ol),{size:14}),t[14]||=V(` Device is already paired with a DIFFERENT key — replace the stored key (replaceKey) `,-1)])):H(``,!0),z(`button`,{type:`button`,class:`primary`,disabled:!f.value||u.value||c.value?.enrollment?.keyChanged===!0&&!p.value,onClick:ee},` Approve device `,8,KV),z(`button`,{type:`button`,class:`small`,disabled:u.value,onClick:ne},` Cancel pairing `,8,qV)],64)):a.value===`issued`?(I(),L(F,{key:2},[z(`p`,JV,[B(A(ic),{size:14}),t[15]||=V(` Credential issued. The device is connecting through the tunnel — you will get a toast once the monitor probe reports it online. `,-1)]),z(`button`,{type:`button`,class:`small`,onClick:oe},`Close`),z(`button`,{type:`button`,class:`small danger`,disabled:!S.value||u.value,title:`Mistaken approval? Revoke the credential now.`,onClick:w},` Revoke this credential `,8,YV)],64)):a.value===`cancelled`?(I(),L(F,{key:3},[t[16]||=z(`p`,{class:`hint`},`Pairing was cancelled (or the signature failed too many times).`,-1),z(`button`,{type:`button`,class:`small`,onClick:t[2]||=e=>C()},`Start over`)],64)):a.value===`expired`?(I(),L(F,{key:4},[t[17]||=z(`p`,{class:`hint`},`The pairing code expired.`,-1),z(`button`,{type:`button`,class:`small`,onClick:t[3]||=e=>C()},`New code`)],64)):H(``,!0),l.value?(I(),L(`p`,XV,D(l.value),1)):H(``,!0)])])],64)):(I(),L(`div`,ZV,[z(`p`,QV,D(l.value||`This pairing link is unavailable.`),1),z(`button`,{type:`button`,class:`small`,onClick:t[4]||=e=>C()},`New code`)]))])]))}}),eH={class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`device-credentials-title`},tH={class:`hint`},nH={key:1,class:`hint`},rH=N({__name:`DeviceCredentialsDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>Vu.devices.value.find(e=>e.id===n.deviceId));return(e,t)=>(I(),L(`div`,{class:`modal-backdrop`,onClick:t[2]||=ks(e=>r(`close`),[`self`])},[z(`section`,eH,[z(`header`,null,[t[3]||=z(`h2`,{id:`device-credentials-title`},`Device credentials`,-1),z(`button`,{class:`icon-button`,"aria-label":`Close device credentials`,onClick:t[0]||=e=>r(`close`)},[B(A(xl),{size:18})])]),i.value?(I(),L(F,{key:0},[z(`p`,null,[V(D(i.value.name)+` `,1),z(`code`,null,D(i.value.id),1)]),z(`p`,tH,D(i.value.status)+` · tunnel `+D(i.value.tunnel?.state??`disconnected`)+` · `+D(i.value.tunnel?.readerCount??0)+` readers `,1),B(Ub,{device:i.value},null,8,[`device`])],64)):(I(),L(`p`,nH,`This device is no longer in the registry.`)),z(`footer`,null,[z(`button`,{class:`secondary`,onClick:t[1]||=e=>r(`close`)},`Close`)])])]))}}),iH={id:`prompt-title`},aH=[`disabled`],oH={key:0,class:`hint`},sH={key:1},cH={key:0,class:`muted`},lH=[`placeholder`,`disabled`],uH=[`required`,`placeholder`,`aria-label`,`disabled`],dH={key:2,class:`message-error`,role:`alert`},fH=[`disabled`],pH=[`disabled`],mH=N({__name:`PromptDialog`,props:{dialog:{}},emits:[`close`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=k(r.dialog.value??``),o=k(!1),s=k(``),c=k(),l=!!r.dialog.label;async function u(){if(!o.value&&(!l||r.dialog.optional||a.value.trim())){o.value=!0,s.value=``;try{await r.dialog.run(a.value.trim()),i(`close`)}catch(e){s.value=K(e)}finally{o.value=!1}}}return Vr(()=>void An(()=>(c.value?.focus(),c.value?.select()))),t({busy:o}),(t,n)=>(I(),L(`div`,{class:`modal-backdrop`,onClick:n[4]||=ks(e=>!o.value&&i(`close`),[`self`])},[z(`form`,{class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`prompt-title`,onSubmit:ks(u,[`prevent`])},[z(`header`,null,[z(`h2`,iH,D(e.dialog.title),1),z(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,disabled:o.value,onClick:n[0]||=e=>i(`close`)},[B(A(xl),{size:18})],8,aH)]),e.dialog.hint?(I(),L(`p`,oH,D(e.dialog.hint),1)):H(``,!0),l?(I(),L(`label`,sH,[V(D(e.dialog.label)+` `,1),e.dialog.optional?(I(),L(`span`,cH,`(optional)`)):H(``,!0),e.dialog.multiline?j((I(),L(`textarea`,{key:1,ref_key:`input`,ref:c,"onUpdate:modelValue":n[1]||=e=>a.value=e,rows:`4`,placeholder:e.dialog.placeholder,disabled:o.value},null,8,lH)),[[ys,a.value]]):j((I(),L(`input`,{key:2,ref_key:`input`,ref:c,"onUpdate:modelValue":n[2]||=e=>a.value=e,maxlength:`100`,required:!e.dialog.optional,placeholder:e.dialog.placeholder,"aria-label":e.dialog.label,disabled:o.value},null,8,uH)),[[ys,a.value]])])):H(``,!0),s.value?(I(),L(`p`,dH,D(s.value),1)):H(``,!0),z(`footer`,null,[z(`button`,{type:`button`,class:`secondary`,disabled:o.value,onClick:n[3]||=e=>i(`close`)},` Cancel `,8,fH),z(`button`,{class:E([`primary`,{danger:e.dialog.danger}]),disabled:o.value||l&&!e.dialog.optional&&!a.value.trim()},D(o.value?`Working…`:e.dialog.submit),11,pH)])],32)]))}}),hH={class:`modal model-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Model picker`},gH={class:`eyebrow`},_H={class:`model-list`},vH={key:0,class:`model-row off-catalog`,"aria-disabled":`true`},yH=[`src`],bH=[`onClick`],xH=[`src`],SH={class:`hint`},CH=N({__name:`ModelPicker`,emits:[`close`],setup(e,{emit:t}){let n=t,r=k(``),i=k();Vr(()=>void An(()=>i.value?.focus()));let a=U(()=>dd.value.filter(e=>`${e.name} ${e.id} ${e.tier}`.toLowerCase().includes(r.value.toLowerCase()))),o=e=>{let t=yd.value;return!!t&&e.id===t.modelId&&e.provider===t.provider},s=U(()=>{let e=yd.value;return e&&!dd.value.some(t=>t.provider===e.provider&&t.id===e.modelId)?e:void 0});async function c(e){await Od(()=>nd.value.configure({model:{provider:e.provider,modelId:e.id}}))&&(await Cd(),Y(`Model saved. Used on the next turn.`),n(`close`))}return(e,t)=>(I(),L(`div`,{class:`modal-backdrop`,onClick:t[2]||=ks(e=>n(`close`),[`self`])},[z(`section`,hH,[z(`header`,null,[z(`div`,null,[z(`span`,gH,`PER AGENT · `+D(A(Yu)?.name??A(Yu)?.id),1),t[3]||=z(`h2`,null,`Choose a model`,-1)]),z(`button`,{class:`icon-button`,"aria-label":`Close model picker`,onClick:t[0]||=e=>n(`close`)},[B(A(xl),{size:18})])]),j(z(`input`,{ref_key:`searchInput`,ref:i,"onUpdate:modelValue":t[1]||=e=>r.value=e,placeholder:`Search models or tiers…`,"aria-label":`Search models`},null,512),[[ys,r.value]]),z(`div`,_H,[s.value?(I(),L(`div`,vH,[z(`img`,{src:A(Md)(s.value.modelId),alt:``},null,8,yH),z(`div`,null,[z(`strong`,null,D(s.value.modelId),1),z(`small`,null,D(s.value.provider)+` / current · not in this device's catalog`,1)])])):H(``,!0),(I(!0),L(F,null,P(a.value,e=>(I(),L(`button`,{key:`${e.provider}/${e.id}`,class:E({selected:o(e)}),onClick:t=>c(e)},[z(`img`,{src:A(Md)(e.id),alt:``},null,8,xH),z(`div`,null,[z(`strong`,null,D(e.name),1),z(`small`,null,D(e.tier)+` / `+D(e.provider)+` / `+D(A(Ad)(e.contextWindow))+` context`,1)]),o(e)?(I(),R(A(tc),{key:0,size:18})):H(``,!0)],10,bH))),128))]),z(`p`,SH,`Models available on `+D(A(Yu)?.id)+`. Provider keys stay on the device.`,1)])]))}}),wH={class:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`help-title`},TH={class:`dialog-head`},EH={class:`dialog-body`},DH={class:`n`},OH={class:`body`},kH={class:`help-callout`},AH={class:`dialog-foot`},jH={class:`right`},MH=N({__name:`HelpDialog`,setup(e){let t=[{title:`Pick a device, start a session`,body:`Every device in the tree runs dpi-backend. A session gets its own SQLite database on that device, in the directory you choose.`},{title:`Send work, then close the browser`,body:`The device owns the run. Reopening restores committed messages, state and live progress.`},{title:`Change state and fork`,body:`Edit App State by hand or through the agent. Every session and fork on a device shares it.`},{title:`Interrupt deliberately`,body:`Interrupt stops foreground work and owned subagents. Background jobs continue. Stop all includes them.`},{title:`Explore the boundaries`,body:`Queue a follow-up, steer after tools, wait for approval, compact context, reset or inspect raw state.`},{title:`Restart a device`,body:`Its tree dims and shows the restart command. Checkpointed jobs recover on boot. Replay-safe tools may rerun. Other interrupted tools return an error.`}];return(e,n)=>(I(),L(`div`,{class:`scrim`,onClick:n[2]||=ks(e=>A(J).dialog=void 0,[`self`])},[z(`section`,wH,[z(`div`,TH,[n[3]||=z(`div`,null,[z(`span`,{class:`dialog-eyebrow`},`LEARN BY DOING`),z(`h3`,{id:`help-title`},`What makes this durable?`)],-1),z(`button`,{class:`icon-button`,"aria-label":`Close help`,onClick:n[0]||=e=>A(J).dialog=void 0},[B(A(xl),{size:18})])]),z(`div`,EH,[(I(),L(F,null,P(t,(e,t)=>z(`div`,{key:e.title,class:`help-step`},[z(`span`,DH,D(String(t+1).padStart(2,`0`)),1),z(`div`,null,[z(`b`,null,D(e.title),1),z(`div`,OH,D(e.body),1)])])),64)),z(`div`,kH,[B(A(Oc),{size:18}),n[4]||=z(`span`,null,`Durable does not mean exactly-once external effects. Checkpoints protect progress. Tools still need their own idempotency.`,-1)])]),z(`div`,AH,[z(`div`,jH,[z(`button`,{class:`secondary`,type:`button`,onClick:n[1]||=e=>A(J).dialog=void 0},`Close`)])])])]))}}),NH=Gt({needed:!1,busy:!1,error:``}),PH=new Set,FH=e=>{let t=[...PH];PH=new Set;for(let n of t)n(e)},IH=()=>new Promise(e=>PH.add(e));async function LH(e){if(NH.busy||!e)return!1;NH.busy=!0,NH.error=``;try{let t=await fetch(`/api/session`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})});return await t.text().catch(()=>``),t.ok?(NH.needed=!1,FH(!0),!0):(NH.error=t.status===401?`That token was not accepted.`:t.status===429?`Too many attempts. Wait a minute and try again.`:`Login failed (${t.status}).`,!1)}catch{return NH.error=`Cannot reach the hub.`,!1}finally{NH.busy=!1}}var RH=e=>{try{return new URL(e,location.href).pathname===`/api/session`}catch{return e===`/api/session`}};function zH(e){return(async(t,n)=>{let r=()=>e(t,n),i=await r();if(i.status!==401||RH(typeof t==`string`?t:t instanceof URL?t.href:t.url)||n?.body instanceof ReadableStream)return i;NH.needed=!0;let a=await i.text().catch(()=>``);return await IH()?r():new Response(a,{status:i.status,headers:i.headers})})}function BH(){typeof window>`u`||window.__adminFetch||(window.__adminFetch=!0,window.fetch=zH(window.fetch.bind(window)))}var VH={class:`login-veil`,"data-testid":`login-card`},HH=[`disabled`],UH={key:0,class:`message-error`,role:`alert`},WH=[`disabled`],GH=N({__name:`LoginCard`,setup(e){let t=k(``),n=k();async function r(){if(NH.busy||!t.value.trim())return;let e=await LH(t.value.trim());t.value=``,e&&n.value?.blur()}return Vr(()=>void An(()=>n.value?.focus())),(e,i)=>(I(),L(`div`,VH,[z(`form`,{class:`modal login-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`login-title`,onSubmit:ks(r,[`prevent`])},[i[2]||=z(`header`,null,[z(`h2`,{id:`login-title`},`Admin token`)],-1),i[3]||=z(`p`,{class:`hint`},[V(` This hub is locked. Sign in with the token from its `),z(`code`,null,`admin.token`),V(` file. `)],-1),i[4]||=z(`label`,{for:`admin-token`},`Admin token`,-1),j(z(`input`,{id:`admin-token`,ref_key:`input`,ref:n,"onUpdate:modelValue":i[0]||=e=>t.value=e,type:`password`,name:`admin-token`,autocomplete:`off`,spellcheck:`false`,placeholder:`adm_…`,"aria-label":`Admin token`,disabled:A(NH).busy,onKeydown:i[1]||=js(e=>A(NH).error=``,[`esc`])},null,40,HH),[[ys,t.value]]),A(NH).error?(I(),L(`p`,UH,D(A(NH).error),1)):H(``,!0),z(`footer`,null,[z(`button`,{class:`primary`,type:`submit`,disabled:A(NH).busy||!t.value.trim()},D(A(NH).busy?`Checking…`:`Sign in`),9,WH)])],32)]))}}),KH={key:0,class:`toast`,role:`status`},qH=N({__name:`Toast`,setup(e){return(e,t)=>(I(),R(bo,{name:`toast`},{default:Hn(()=>[A(J).toast?(I(),L(`div`,KH,[B(A(tc),{size:18}),V(D(A(J).toast),1)])):H(``,!0)]),_:1}))}});function JH(e,t=!1){return e.kind===`pair`?`pair`:e.kind===`prompt`&&t?`keep`:`close`}var YH={class:`shell`,"data-testid":`app-shell`},XH={key:0,class:`error-banner`,role:`alert`},ZH={key:4,class:`welcome`,"data-testid":`welcome-empty`},QH=[`disabled`],$H={class:`welcome-features`},eU={class:`build-stamp`},tU={class:`modal path-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`path-title`},nU={class:`full-directory`},rU=N({__name:`App`,setup(e){let t=()=>Vu.devices.value.filter(e=>e.status===`online`).length,n=k(),r=k();function i(){J.dialog={kind:`new-session`,deviceId:q.value?.deviceId}}function a(e){let t=J.dialog?void 0:Gd(e);if(t)return e.preventDefault(),t===`tree`?Vd():Hd();if(e.key===`Escape`){if(J.dialog){let e=JH(J.dialog,r.value?.busy??!1);e===`pair`?n.value?.close():e===`close`&&(J.dialog=void 0);return}!e.repeat&&!e.isComposing&&gd.value&&(e.preventDefault(),Fd()),J.drawer=!1,J.inspectorOverlay=!1}}function o(e){let t=e.clientX,n=Gu.value,r=e=>Gu.value=Math.max(220,Math.min(560,n+e.clientX-t)),i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)}return Vr(()=>Af()),Vr(()=>{document.addEventListener(`keydown`,a),ld()}),Wr(()=>{zu.stop(),document.removeEventListener(`keydown`,a)}),(e,a)=>(I(),L(`div`,YH,[B(sf,{onNewSession:i}),A(J).error?(I(),L(`div`,XH,[B(A(Oc),{size:18}),z(`span`,null,D(A(J).error),1),z(`button`,{class:`icon-button`,"aria-label":`Dismiss error`,onClick:a[0]||=e=>A(J).error=``},`×`)])):H(``,!0),z(`main`,{class:`net-workspace`,style:T({"--tree-w":`${A(Gu)}px`})},[B(Gp),A(Ku).tree?(I(),L(`div`,{key:0,class:`tree-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize network tree`,onPointerdown:ks(o,[`prevent`])},null,32)):H(``,!0),A(J).drawer?(I(),L(`div`,{key:1,class:`tree-backdrop`,onClick:a[1]||=e=>A(J).drawer=!1})):H(``,!0),A(q)&&A(Yu)&&A(Xu)?(I(),L(F,{key:2},[B(Pk),A(J).inspectorOverlay?(I(),L(`div`,{key:0,class:`inspector-backdrop`,onClick:a[2]||=e=>A(Bd)()})):H(``,!0),(I(),R(Xy,{key:`${A(q).deviceId}/${A(q).sessionId}`}))],64)):A(q)&&A(Yu)?(I(),R(Wk,{key:3,device:A(Yu)},null,8,[`device`])):(I(),L(`section`,ZH,[a[14]||=z(`img`,{class:`welcome-symbol`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),a[15]||=z(`span`,{class:`eyebrow`},`THE DURABLE AGENT NETWORK`,-1),a[16]||=z(`h1`,null,[V(`Close the tab.`),z(`br`),V(`The work continues.`)],-1),a[17]||=z(`p`,null,`Agents run on your devices. This page is only a window into them.`,-1),z(`button`,{class:`primary`,disabled:!t(),onClick:i},[B(A(Xc),{size:18}),V(D(A(Vu).devices.value.length?`Create a session`:`Add a device to dpi-network.yaml`),1)],8,QH),z(`div`,$H,[z(`span`,null,[B(A(fc),{size:18}),a[11]||=V(`SQLite on each device`,-1)]),z(`span`,null,[B(A(Cc),{size:18}),a[12]||=V(`Branch any agent`,-1)]),z(`span`,null,[B(A(Vs),{size:18}),a[13]||=V(`Watch from anywhere`,-1)])]),z(`p`,eU,`ui `+D(A(`0.0.115`)),1)]))],4),B(uf),A(J).dialog?.kind===`pair`?(I(),R($V,{key:1,ref_key:`pairWizard`,ref:n,handoff:A(J).dialog.handoff,onClose:a[3]||=e=>A(J).dialog=void 0},null,8,[`handoff`])):H(``,!0),A(J).dialog?.kind===`credentials`?(I(),R(rH,{key:2,"device-id":A(J).dialog.deviceId,onClose:a[4]||=e=>A(J).dialog=void 0},null,8,[`device-id`])):H(``,!0),A(J).dialog?.kind===`new-session`?(I(),R(dA,{key:3,"device-id":A(J).dialog.deviceId,onClose:a[5]||=e=>A(J).dialog=void 0},null,8,[`device-id`])):A(J).dialog?.kind===`prompt`?(I(),R(mH,{key:4,ref_key:`promptDialog`,ref:r,dialog:A(J).dialog,onClose:a[6]||=e=>A(J).dialog=void 0},null,8,[`dialog`])):A(J).dialog?.kind===`models`?(I(),R(CH,{key:5,onClose:a[7]||=e=>A(J).dialog=void 0})):A(J).dialog?.kind===`path`?(I(),L(`div`,{key:6,class:`modal-backdrop`,onClick:a[10]||=ks(e=>A(J).dialog=void 0,[`self`])},[z(`section`,tU,[z(`header`,null,[a[18]||=z(`h2`,{id:`path-title`},`Working directory`,-1),z(`button`,{class:`icon-button`,"aria-label":`Close working directory`,onClick:a[8]||=e=>A(J).dialog=void 0},[B(A(xl),{size:18})])]),z(`code`,nU,D(A(J).dialog.path),1),z(`footer`,null,[z(`button`,{class:`secondary`,onClick:a[9]||=e=>A(J).dialog=void 0},`Close`)])])])):A(J).dialog?.kind===`help`?(I(),R(MH,{key:7})):H(``,!0),A(NH).needed?(I(),R(GH,{key:8})):H(``,!0),B(qH)]))}});BH();var iU=new URL(window.location.href);if(/^\/pair\/?$/.test(iU.pathname)){let e=yV(iU);e?(iU.search=``,iU.hash=``,window.history.replaceState(window.history.state,``,iU),J.dialog={kind:`pair`,handoff:e}):window.history.replaceState(window.history.state,``,xV(iU))}Fs(rU).mount(`#app`);{let e=window.visualViewport,t=document.documentElement,n=()=>{let n=Math.max(e?.height??window.innerHeight,window.innerHeight);t.style.setProperty(`--vvh`,`${Math.round(n)}px`)};e?.addEventListener(`resize`,n),e?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),window.addEventListener(`orientationchange`,n),n()}/[?&]debug=1\b/.test(location.search)&&setTimeout(()=>{let e=document.createElement(`pre`);e.style.cssText=`position:fixed;left:6px;bottom:6px;z-index:99999;background:#000d;color:#fff;padding:8px;font:11px/1.5 ui-monospace,monospace;max-width:92vw;border-radius:6px;white-space:pre-wrap`;let t=window.visualViewport,n=()=>{e.textContent=[`UA: ${navigator.userAgent}`,`innerW×H: ${innerWidth}×${innerHeight}`,`clientW: ${document.documentElement.clientWidth}`,`visualViewport: ${t?`${Math.round(t.width)}×${Math.round(t.height)} scale=${t.scale.toFixed(3)}`:`none`}`,`root font-size: ${getComputedStyle(document.documentElement).fontSize}`,`dpr: ${devicePixelRatio}`,`mq740: ${matchMedia(`(max-width: 740px)`).matches}`,`touch: ${matchMedia(`(pointer: coarse)`).matches}`].join(`
|
|
83
|
-
`)};t?.addEventListener(`resize`,n),t?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),n(),document.body.appendChild(e)},600);
|