my-durable 0.0.41 → 0.0.43
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/awake.ts +136 -0
- package/apps/dpi-backend/src/backup-cli.ts +220 -0
- package/apps/dpi-backend/src/backup.ts +523 -0
- package/apps/dpi-backend/src/diagnostics-cli.ts +134 -0
- package/apps/dpi-backend/src/diagnostics.ts +326 -0
- package/apps/dpi-backend/src/env-vars.ts +234 -0
- package/apps/dpi-backend/src/main.ts +1 -0
- package/apps/dpi-backend/src/projects.ts +33 -1
- package/apps/dpi-backend/src/routes.ts +21 -1
- package/apps/dpi-backend/src/store.ts +85 -3
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-BgKiQEMm.js +81 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-EulngMVY.css +1 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/EnvPanel.vue +268 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/HostPanel.vue +11 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/Inspector.vue +4 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/NewSessionDialog.vue +37 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/ProjectBar.vue +41 -1
- package/apps/dpi-sdk/src/api.ts +29 -2
- package/apps/dpi-sdk/src/client.ts +12 -0
- package/apps/dpi-sdk/src/protocol/rest-routes.ts +3 -0
- package/bin/dpi.mjs +16 -0
- package/docs/host-project-checklist.md +8 -8
- package/package.json +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-D6ClJqd8.css +0 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-DMb-n4O-.js +0 -81
|
@@ -1,81 +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]`,w=e=>v(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ne=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),re=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ie=/-\w/g,ae=re(e=>e.replace(ie,e=>e.slice(1).toUpperCase())),oe=/\B([A-Z])/g,se=re(e=>e.replace(oe,`-$1`).toLowerCase()),ce=re(e=>e.charAt(0).toUpperCase()+e.slice(1)),le=re(e=>e?`on${ce(e)}`:``),T=(e,t)=>!Object.is(e,t),ue=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},de=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},fe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},pe=e=>{let t=v(e)?Number(e):NaN;return isNaN(t)?e:t},me,he=()=>me||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function ge(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=v(r)?be(r):ge(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 O,Ie=new WeakSet,Le=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,Ie.has(this)&&(Ie.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ve(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,et(this),We(this);let e=O,t=Xe;O=this,Xe=!0;try{return this.fn()}finally{Ge(this),O=e,Xe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Je(e);this.deps=this.depsTail=void 0,et(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ie.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ke(this)&&this.run()}get dirty(){return Ke(this)}},Re=0,ze,Be;function Ve(e,t=!1){if(e.flags|=8,t){e.next=Be,Be=e;return}e.next=ze,ze=e}function He(){Re++}function Ue(){if(--Re>0)return;if(Be){let e=Be;for(Be=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;ze;){let t=ze;for(ze=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 We(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ge(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Je(r),Ye(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ke(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(qe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function qe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===tt)||(e.globalVersion=tt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ke(e))))return;e.flags|=2;let t=e.dep,n=O,r=Xe;O=e,Xe=!0;try{We(e);let n=e.fn(e._value);(t.version===0||T(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{O=n,Xe=r,Ge(e),e.flags&=-3}}function Je(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)Je(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ye(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Xe=!0,Ze=[];function Qe(){Ze.push(Xe),Xe=!1}function $e(){let e=Ze.pop();Xe=e===void 0||e}function et(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=O;O=void 0;try{t()}finally{O=e}}}var tt=0,nt=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}},rt=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(!O||!Xe||O===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==O)t=this.activeLink=new nt(O,this),O.deps?(t.prevDep=O.depsTail,O.depsTail.nextDep=t,O.depsTail=t):O.deps=O.depsTail=t,it(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=O.depsTail,t.nextDep=void 0,O.depsTail.nextDep=t,O.depsTail=t,O.deps===t&&(O.deps=e)}return t}trigger(e){this.version++,tt++,this.notify(e)}notify(e){He();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ue()}}};function it(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)it(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var at=new WeakMap,ot=Symbol(``),st=Symbol(``),ct=Symbol(``);function lt(e,t,n){if(Xe&&O){let t=at.get(e);t||at.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new rt),r.map=t,r.key=n),r.track()}}function ut(e,t,n,r,i,a){let o=at.get(e);if(!o){tt++;return}let s=e=>{e&&e.trigger()};if(He(),t===`clear`)o.forEach(s);else{let i=p(e),a=i&&w(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ct||!y(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ct)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(ot)),m(e)&&s(o.get(st)));break;case`delete`:i||(s(o.get(ot)),m(e)&&s(o.get(st)));break;case`set`:m(e)&&s(o.get(ot))}}Ue()}function dt(e){let t=Qt(e);return t===e||(lt(t,`iterate`,ct),Xt(e))?t:Yt(e)?Jt(e)?t.map(e=>tn(en(e))):t.map(tn):t.map(en)}function ft(e){return lt(e=Qt(e),`iterate`,ct),e}function pt(e,t){return Yt(e)?tn(Jt(e)?en(t):t):en(t)}var mt={__proto__:null,[Symbol.iterator](){return ht(this,Symbol.iterator,e=>pt(this,e))},concat(...e){return dt(this).concat(...e.map(e=>p(e)?dt(e):e))},entries(){return ht(this,`entries`,e=>(e[1]=pt(this,e[1]),e))},every(e,t){return _t(this,`every`,e,t,void 0,arguments)},filter(e,t){return _t(this,`filter`,e,t,e=>e.map(e=>pt(this,e)),arguments)},find(e,t){return _t(this,`find`,e,t,e=>pt(this,e),arguments)},findIndex(e,t){return _t(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return _t(this,`findLast`,e,t,e=>pt(this,e),arguments)},findLastIndex(e,t){return _t(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return _t(this,`forEach`,e,t,void 0,arguments)},includes(...e){return yt(this,`includes`,e)},indexOf(...e){return yt(this,`indexOf`,e)},join(e){return dt(this).join(e)},lastIndexOf(...e){return yt(this,`lastIndexOf`,e)},map(e,t){return _t(this,`map`,e,t,void 0,arguments)},pop(){return bt(this,`pop`)},push(...e){return bt(this,`push`,e)},reduce(e,...t){return vt(this,`reduce`,e,t)},reduceRight(e,...t){return vt(this,`reduceRight`,e,t)},shift(){return bt(this,`shift`)},some(e,t){return _t(this,`some`,e,t,void 0,arguments)},splice(...e){return bt(this,`splice`,e)},toReversed(){return dt(this).toReversed()},toSorted(e){return dt(this).toSorted(e)},toSpliced(...e){return dt(this).toSpliced(...e)},unshift(...e){return bt(this,`unshift`,e)},values(){return ht(this,`values`,e=>pt(this,e))}};function ht(e,t,n){let r=ft(e),i=r[t]();return r!==e&&!Xt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var gt=Array.prototype;function _t(e,t,n,r,i,a){let o=ft(e),s=o!==e&&!Xt(e),c=o[t];if(c!==gt[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,pt(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 vt(e,t,n,r){let i=ft(e),a=i!==e&&!Xt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=pt(e,t)),n.call(this,t,pt(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?pt(e,c):c}function yt(e,t,n){let r=Qt(e);lt(r,`iterate`,ct);let i=r[t](...n);return(i===-1||i===!1)&&Zt(n[0])?(n[0]=Qt(n[0]),r[t](...n)):i}function bt(e,t,n=[]){Qe(),He();let r=Qt(e)[t].apply(e,n);return Ue(),$e(),r}var xt=n(`__proto__,__v_isRef,__isVue`),St=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(y));function Ct(e){y(e)||(e=String(e));let t=Qt(this);return lt(t,`has`,e),t.hasOwnProperty(e)}var wt=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?Ht:Vt:i?Bt:zt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=p(e);if(!r){let e;if(a&&(e=mt[t]))return e;if(t===`hasOwnProperty`)return Ct}let o=Reflect.get(e,t,nn(e)?e:n);if((y(t)?St.has(t):xt(t))||(r||lt(e,`get`,t),i))return o;if(nn(o)){let e=a&&w(t)?o:o.value;return r&&b(e)?Kt(e):e}return b(o)?r?Kt(o):Wt(o):o}},Tt=class extends wt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=p(e)&&w(t);if(!this._isShallow){let e=Yt(i);if(!Xt(n)&&!Yt(n)&&(i=Qt(i),n=Qt(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===Qt(r)&&s&&(o?T(n,i)&&ut(e,`set`,t,n,i):ut(e,`add`,t,n)),s}deleteProperty(e,t){let n=f(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ut(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!y(t)||!St.has(t))&<(e,`has`,t),n}ownKeys(e){return lt(e,`iterate`,p(e)?`length`:ot),Reflect.ownKeys(e)}},Et=class extends wt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Dt=new Tt,Ot=new Et,kt=new Tt(!0),At=e=>e,jt=e=>Reflect.getPrototypeOf(e);function Mt(e,t,n){return function(...r){let i=this.__v_raw,a=Qt(i),o=m(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,u=i[e](...r),d=n?At:t?tn:en;return!t&<(a,`iterate`,c?st:ot),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 Nt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Pt(e,t){let n={get(n){let r=this.__v_raw,i=Qt(r),a=Qt(n);e||(T(n,a)&<(i,`get`,n),lt(i,`get`,a));let{has:o}=jt(i),s=t?At: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&<(Qt(t),`iterate`,ot),t.size},has(t){let n=this.__v_raw,r=Qt(n),i=Qt(t);return e||(T(t,i)&<(r,`has`,t),lt(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=Qt(a),s=t?At:e?tn:en;return!e&<(o,`iterate`,ot),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return l(n,e?{add:Nt(`add`),set:Nt(`set`),delete:Nt(`delete`),clear:Nt(`clear`)}:{add(e){let n=Qt(this),r=jt(n),i=Qt(e),a=!t&&!Xt(e)&&!Yt(e)?i:e;return r.has.call(n,a)||T(e,a)&&r.has.call(n,e)||T(i,a)&&r.has.call(n,i)||(n.add(a),ut(n,`add`,a,a)),this},set(e,n){!t&&!Xt(n)&&!Yt(n)&&(n=Qt(n));let r=Qt(this),{has:i,get:a}=jt(r),o=i.call(r,e);o||=(e=Qt(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?T(n,s)&&ut(r,`set`,e,n,s):ut(r,`add`,e,n),this},delete(e){let t=Qt(this),{has:n,get:r}=jt(t),i=n.call(t,e);i||=(e=Qt(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ut(t,`delete`,e,void 0,a),o},clear(){let e=Qt(this),t=e.size!==0,n=e.clear();return t&&ut(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Mt(r,e,t)}),n}function Ft(e,t){let n=Pt(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 It={get:Ft(!1,!1)},Lt={get:Ft(!1,!0)},Rt={get:Ft(!0,!1)},zt=new WeakMap,Bt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap;function Ut(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Wt(e){return Yt(e)?e:qt(e,!1,Dt,It,zt)}function Gt(e){return qt(e,!1,kt,Lt,Bt)}function Kt(e){return qt(e,!0,Ot,Rt,Vt)}function qt(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=Ut(ee(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Jt(e){return Yt(e)?Jt(e.__v_raw):!!(e&&e.__v_isReactive)}function Yt(e){return!!(e&&e.__v_isReadonly)}function Xt(e){return!!(e&&e.__v_isShallow)}function Zt(e){return e?!!e.__v_raw:!1}function Qt(e){let t=e&&e.__v_raw;return t?Qt(t):e}function $t(e){return!f(e,`__v_skip`)&&Object.isExtensible(e)&&de(e,`__v_skip`,!0),e}var en=e=>b(e)?Wt(e):e,tn=e=>b(e)?Kt(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 rt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Qt(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||Xt(e)||Yt(e);e=n?e:Qt(e),T(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 Jt(e)?e:new Proxy(e,sn)}var ln=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new rt,{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 rt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=tt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&O!==this)return Ve(this,!0),!0}get value(){let e=this.dep.track();return qe(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:Xt(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=Xt(e)):Jt(e)?(h=()=>f(e),y=!0):p(e)?(b=!0,y=e.some(e=>Jt(e)||Xt(e)),h=()=>e.map(e=>{if(nn(e))return e.value;if(Jt(e))return f(e);if(_(e))return d?d(e,2):e()})):h=_(e)?t?d?()=>d(e,2):e:()=>{if(g){Qe();try{g()}finally{$e()}}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)=>T(e,C[t])):T(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 Le(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){Qe(),yn(o,null,10,[e,i,a]),$e();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&&Ta(-1);let i=Vn(t),a=xa.length,o;try{o=e(...n)}finally{for(let e=xa.length;e>a;e--)Ca();Vn(i),r._d&&Ta(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=no(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&&(Qe(),bn(c,n,8,[e.el,s,e,t]),$e())}}function Wn(e,t){if(Ha){let n=Ha.provides,r=Ha.parent&&Ha.parent.provides;r===n&&(n=Ha.provides=Object.create(r)),n[e]=t}}function Gn(e,t,n=!1){let r=Ua();if(r||Di){let i=Di?Di._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(Ya){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=Ha;u.call=(e,t,n)=>bn(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{aa(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 Ya&&(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=Ka(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),aa(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),da(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 Hr(()=>{e.isMounted=!0}),Gr(()=>{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=Ua(),r=mr();return()=>{let i=t.default&&Er(t.default(),!0),a=i&&i.length?yr(i):n.subTree?V():void 0;if(!a)return;let o=Qt(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!==ya&&Tr(c,l);let u=n.subTree&&wr(n.subTree);if(u&&u.type!==ya&&!Oa(u,c)&&_r(n).type!==ya){let e=Sr(u,o,r,n);if(Tr(u,e),s===`out-in`&&c.type!==ya)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!==ya?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!==ya){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&&Oa(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(Pr(e))return e=Na(e),e.children=null,e}function wr(e){if(!Pr(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===P?(o.patchFlag&128&&i++,r=r.concat(Er(o.children,t,s))):(t||o.type!==ya)&&r.push(s==null?o:Na(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function Dr(e,t){return _(e)?l({name:e.name},t,{setup:e}):e}function Or(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function kr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var Ar=new WeakMap;function jr(e,t,n,i,a=!1){if(p(e)){e.forEach((e,r)=>jr(e,t&&(p(t)?t[r]:t),n,i,a));return}if(Nr(i)&&!a){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&jr(e,t,n,i.component.subTree);return}let s=i.shapeFlag&4?no(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=Qt(g),b=g===r?o:e=>!kr(h,e)&&f(y,e),x=(e,t)=>!(t&&kr(h,t));if(m!=null&&m!==d){if(Mr(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(),Ar.delete(e)};t.id=-1,Ar.set(e,t),aa(t,n)}else Mr(e),i()}}}function Mr(e){let t=Ar.get(e);t&&(t.flags|=8,Ar.delete(e))}he().requestIdleCallback,he().cancelIdleCallback;var Nr=e=>!!e.type.__asyncLoader,Pr=e=>e.type.__isKeepAlive;function Fr(e,t){Lr(e,`a`,t)}function Ir(e,t){Lr(e,`da`,t)}function Lr(e,t,n=Ha){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(zr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Pr(e.parent.vnode)&&Rr(r,t,n,e),e=e.parent}}function Rr(e,t,n,r){let i=zr(t,e,r,!0);Kr(()=>{u(r[t],i)},n)}function zr(e,t,n=Ha,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{Qe();let i=Ka(n),a=bn(t,n,e,r);return i(),$e(),a};return r?i.unshift(a):i.push(a),a}}var Br=e=>(t,n=Ha)=>{(!Ya||e===`sp`)&&zr(e,(...e)=>t(...e),n)},Vr=Br(`bm`),Hr=Br(`m`),Ur=Br(`bu`),Wr=Br(`u`),Gr=Br(`bum`),Kr=Br(`um`),qr=Br(`sp`),Jr=Br(`rtg`),Yr=Br(`rtc`);function Xr(e,t=Ha){zr(`ec`,e,t)}var Zr=`components`;function Qr(e,t){return ti(Zr,e,!0,t)||e}var $r=Symbol.for(`v-ndc`);function ei(e){return v(e)?ti(Zr,e,!1)||e:e||$r}function ti(e,t,n=!0,r=!1){let i=zn||Ha;if(i){let n=i.type;if(e===Zr){let e=ro(n,!1);if(e&&(e===t||e===ae(t)||e===ce(ae(t))))return n}let a=ni(i[e]||n[e],t)||ni(i.appContext[e],t);return!a&&r?n:a}}function ni(e,t){return e&&(e[t]||e[ae(t)]||e[ce(ae(t))])}function N(e,t,n,r){let i,a=n&&n[r],o=p(e);if(o||v(e)){let n=o&&Jt(e),r=!1,s=!1;n&&(r=!Xt(e),s=Yt(e),e=ft(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 ri=e=>e?Ja(e)?no(e):ri(e.parent):null,ii=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=>ri(e.parent),$root:e=>ri(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>mi(e),$forceUpdate:e=>e.f||=()=>{Mn(e.update)},$nextTick:e=>e.n||=An.bind(e.proxy),$watch:e=>Xn.bind(e)}),ai=(e,t)=>e!==r&&!e.__isScriptSetup&&f(e,t),oi={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(ai(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 li&&(s[t]=0)}let u=ii[t],d,p;if(u)return t===`$attrs`&<(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 ai(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)||ai(t,c)||f(o,c)||f(i,c)||f(ii,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 si(e){return p(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function ci(e,t){return!e||!t?e||t:p(e)&&p(t)?e.concat(t):l({},si(e),si(t))}var li=!0;function ui(e){let t=mi(e),n=e.proxy,r=e.ctx;li=!1,t.beforeCreate&&fi(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:w,renderTriggered:ne,errorCaptured:re,serverPrefetch:ie,expose:ae,inheritAttrs:oe,components:se,directives:ce,filters:le}=t;if(u&&di(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=Wt(t))}if(li=!0,o)for(let e in o){let t=o[e],i=H({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)pi(c[e],r,n,e);if(l){let e=_(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Wn(t,e[t])})}d&&fi(d,e,`c`);function T(e,t){p(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(T(Vr,f),T(Hr,m),T(Ur,h),T(Wr,g),T(Fr,v),T(Ir,y),T(Xr,re),T(Yr,w),T(Jr,ne),T(Gr,S),T(Kr,ee),T(qr,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&&Or(e)}function di(e,t,n=a){p(e)&&(e=yi(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 fi(e,t,n){bn(p(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function pi(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=>pi(e,t,n,r));else{let r=_(e.handler)?e.handler.bind(n):t[e.handler];_(r)&&M(i,r,e)}}}function mi(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=>hi(c,e,o,!0)),hi(c,t,o)),b(t)&&a.set(t,c),c}function hi(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&hi(e,a,n,!0),i&&i.forEach(t=>hi(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=gi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var gi={data:_i,props:Si,emits:Si,methods:xi,computed:xi,beforeCreate:bi,created:bi,beforeMount:bi,mounted:bi,beforeUpdate:bi,updated:bi,beforeDestroy:bi,beforeUnmount:bi,destroyed:bi,unmounted:bi,activated:bi,deactivated:bi,errorCaptured:bi,serverPrefetch:bi,components:xi,directives:xi,watch:Ci,provide:_i,inject:vi};function _i(e,t){return t?e?function(){return l(_(e)?e.call(this,this):e,_(t)?t.call(this,this):t)}:t:e}function vi(e,t){return xi(yi(e),yi(t))}function yi(e){if(p(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function bi(e,t){return e?[...new Set([].concat(e,t))]:t}function xi(e,t){return e?l(Object.create(null),e,t):t}function Si(e,t){return e?p(e)&&p(t)?[...new Set([...e,...t])]:l(Object.create(null),si(e),si(t??{})):t}function Ci(e,t){if(!e)return t;if(!t)return e;let n=l(Object.create(null),e);for(let r in t)n[r]=bi(e[r],t[r]);return n}function wi(){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 Ti=0;function Ei(e,t){return function(n,r=null){_(n)||(n=l({},n)),r!=null&&!b(r)&&(r=null);let i=wi(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Ti++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:oo,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||z(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,no(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=Di;Di=c;try{return e()}finally{Di=t}}};return c}}var Di=null;function Oi(e,t,n=r){let i=Ua(),a=ae(t),o=se(t),s=ki(e,a),c=un((s,c)=>{let l,u=r,d;return Jn(()=>{let t=e[a];T(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(!T(s,l)&&!(u!==r&&T(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),T(e,u)&&(T(e,s)&&!T(s,d)||p&&u!==r&&!T(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 ki=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ae(t)}Modifiers`]||e[`${se(t)}Modifiers`];function Ai(e,t,...n){if(e.isUnmounted)return;let i=e.vnode.props||r,a=n,o=t.startsWith(`update:`),s=o&&ki(i,t.slice(7));s&&(s.trim&&(a=n.map(e=>v(e)?e.trim():e)),s.number&&(a=a.map(fe)));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 ji=new WeakMap;function Mi(e,t,n=!1){let r=n?ji: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=Mi(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 Ni(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 Pi(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=Pa(u.call(t,e,d,f,m,p,h)),y=s}else{let e=t;v=Pa(e.length>1?e(f,{attrs:s,slots:o,emit:l}):e(f,null)),y=t.props?s:Fi(s)}}catch(t){xa.length=0,xn(t,e,1),v=z(ya)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(c)&&(y=Ii(y,a)),b=Na(b,y,!1,!0))}return n.dirs&&(b=Na(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 Fi=e=>{let t;for(let n in e)(n===`class`||n===`style`||s(n))&&((t||={})[n]=e[n]);return t},Ii=(e,t)=>{let n={};for(let r in e)(!c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Li(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?Ri(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(zi(o,r,n)&&!Ni(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||Ri(r,o,l):!!o;return!1}function Ri(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(zi(t,e,a)&&!Ni(n,a))return!0}return!1}function zi(e,t,n){let r=e[n],i=t[n];return n===`style`&&b(r)&&b(i)?!Oe(r,i):r!==i}function Bi({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 Vi={},Hi=()=>Object.create(Vi),Ui=e=>Object.getPrototypeOf(e)===Vi;function Wi(e,t,n,r=!1){let i={},a=Hi();e.propsDefaults=Object.create(null),Ki(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Gt(i):e.type.props?i:a,e.attrs=a}function Gi(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=Qt(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(Ni(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]=qi(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Ki(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]=qi(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&&ut(e.attrs,`set`,``)}function Ki(e,t,n,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let r in t){if(ne(r))continue;let l=t[r],u;a&&f(a,u=ae(r))?!o||!o.includes(u)?n[u]=l:(c||={})[u]=l:Ni(e.emitsOptions,r)||(!(r in i)||l!==i[r])&&(i[r]=l,s=!0)}if(o){let t=Qt(n),i=c||r;for(let r=0;r<o.length;r++){let s=o[r];n[s]=qi(a,t,s,i[s],e,!f(i,s))}}return s}function qi(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=Ka(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 Ji=new WeakMap;function Yi(e,t,n=!1){let a=n?Ji: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]=Yi(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]);Xi(t)&&(c[t]=r)}else if(s)for(let e in s){let t=ae(e);if(Xi(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 Xi(e){return e[0]!==`$`&&!ne(e)}var Zi=e=>e===`_`||e===`_ctx`||e===`$stable`,Qi=e=>p(e)?e.map(Pa):[Pa(e)],$i=(e,t,n)=>{if(t._n)return t;let r=Hn((...e)=>Qi(t(...e)),n);return r._c=!1,r},ea=(e,t,n)=>{let r=e._ctx;for(let n in e){if(Zi(n))continue;let i=e[n];if(_(i))t[n]=$i(n,i,r);else if(i!=null){let e=Qi(i);t[n]=()=>e}}},ta=(e,t)=>{let n=Qi(t);e.slots.default=()=>n},na=(e,t,n)=>{for(let r in t)(n||!Zi(r))&&(e[r]=t[r])},ra=(e,t,n)=>{let r=e.slots=Hi();if(e.vnode.shapeFlag&32){let e=t._;e?(na(r,t,n),n&&de(r,`_`,e,!0)):ea(t,r)}else t&&ta(e,t)},ia=(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:na(a,t,n):(o=!t.$stable,ea(t,a)),s=t}else t&&(ta(e,t),s={default:1});if(o)for(let e in a)!Zi(e)&&s[e]==null&&delete a[e]},aa=_a;function oa(e){return sa(e)}function sa(e,t){let n=he();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&&!Oa(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 va:y(e,t,n,r);break;case ya:b(e,t,n,r);break;case ba:e??x(t,n,r,s);break;case P: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?jr(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&jr(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&&re(e.children,d,null,r,i,ca(e,a),s,u),_&&Un(e,null,r,`created`),w(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!ne(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&Ra(f,r,e)}_&&Un(e,null,r,`beforeMount`);let v=ua(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&aa(()=>{try{f&&Ra(f,r,e),v&&g.enter(d),_&&Un(e,null,r,`mounted`)}finally{}},i)},w=(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||ga(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;w(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},re=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?Fa(e[l]):Pa(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&&la(n,!1),(g=h.onVnodeBeforeUpdate)&&Ra(g,n,t,e),f&&Un(t,e,n,`beforeUpdate`),n&&la(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,ca(t,a),o):s||pe(e,t,l,null,n,i,ca(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)&&aa(()=>{g&&Ra(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===P||!Oa(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)!ne(r)&&!(r in n)&&c(e,r,t[r],null,a,i);for(let r in n){if(ne(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),re(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)&&da(e,t,!0)):pe(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):T(e,t,c)},le=(e,t,n,r,i,a,o)=>{let s=e.component=Va(e,r,i);if(Pr(e)&&(s.ctx.renderer=Te),Xa(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,de,o),!e.el){let r=s.subTree=z(ya);b(null,r,t,n),e.placeholder=r.el}}else de(s,e,t,n,i,a,o)},T=(e,t,n)=>{let r=t.component=e.component;if(Li(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,fe(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},de=(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=pa(e);if(n){t&&(t.el=c.el,fe(e,t,o)),n.asyncDep.then(()=>{aa(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;la(e,!1),t?(t.el=c.el,fe(e,t,o)):t=c,n&&ue(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Ra(d,s,t,c),la(e,!0);let f=Pi(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),Se(p),e,i,a),t.el=f.el,u===null&&Bi(e,f.el),r&&aa(r,i),(d=t.props&&t.props.onVnodeUpdated)&&aa(()=>Ra(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=Nr(t);if(la(e,!1),l&&ue(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Ra(o,d,t),la(e,!0),s&&De){let t=()=>{e.subTree=Pi(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=Pi(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&aa(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;aa(()=>Ra(o,d,e),i)}(t.shapeFlag&256||d&&Nr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&aa(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Le(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),la(e,!0),l()},fe=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Gi(e,t.props,r,n),ia(e,t.children,n),Qe(),Fn(e),$e()},pe=(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){ge(l,d,n,r,i,a,o,s,c);return}if(f&256){me(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?ge(l,d,n,r,i,a,o,s,c):xe(l,i,a,!0):(u&8&&p(n,``),m&16&&re(d,n,r,i,a,o,s,c))},me=(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?Fa(t[p]):Pa(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?xe(e,a,o,!0,!1,f):re(t,n,r,a,o,s,c,l,f)},ge=(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?Fa(t[u]):Pa(t[u]);if(Oa(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?Fa(t[p]):Pa(t[p]);if(Oa(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?Fa(t[u]):Pa(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?Fa(t[u]):Pa(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&&Oa(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?fa(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||ha(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===P){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===ba){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),aa(()=>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&&(Qe(),jr(s,null,n,e,!0),$e()),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=!Nr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&Ra(_,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!==P||d>0&&d&64)?xe(l,t,n,!1,!0):(a===P&&d&384||!i&&u&16)&&xe(c,t,n),r&&ye(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&aa(()=>{_&&Ra(_,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===P){be(n,r);return}if(t===ba){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;ma(c),ma(l),r&&ue(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&&aa(s,t),aa(()=>{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:re,pc:pe,pbc:ae,n:Se,o:e},Ee,De;return t&&([Ee,De]=t(Te)),{render:we,hydrate:Ee,createApp:Ei(we,Ee)}}function ca({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 la({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ua(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function da(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]=Fa(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&da(t,a)),a.type===va&&(a.patchFlag===-1&&(a=i[e]=Fa(a)),a.el=t.el),a.type===ya&&!a.el&&(a.el=t.el)}}function fa(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 pa(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:pa(t)}function ma(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ha(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?ha(t.subTree):null}var ga=e=>e.__isSuspense;function _a(e,t){t&&t.pendingBranch?p(e)?t.effects.push(...e):t.effects.push(e):Pn(e)}var P=Symbol.for(`v-fgt`),va=Symbol.for(`v-txt`),ya=Symbol.for(`v-cmt`),ba=Symbol.for(`v-stc`),xa=[],Sa=null;function F(e=!1){xa.push(Sa=e?null:[])}function Ca(){xa.pop(),Sa=xa[xa.length-1]||null}var wa=1;function Ta(e,t=!1){wa+=e,e<0&&Sa&&t&&(Sa.hasOnce=!0)}function Ea(e){return e.dynamicChildren=wa>0?Sa||i:null,Ca(),wa>0&&Sa&&Sa.push(e),e}function I(e,t,n,r,i,a){return Ea(R(e,t,n,r,i,a,!0))}function L(e,t,n,r,i){return Ea(z(e,t,n,r,i,!0))}function Da(e){return e?e.__v_isVNode===!0:!1}function Oa(e,t){return e.type===t.type&&e.key===t.key}var ka=({key:e})=>e??null,Aa=({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 R(e,t=null,n=null,r=0,i=null,a=e===P?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ka(t),ref:t&&Aa(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?(Ia(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=v(n)?8:16),wa>0&&!o&&Sa&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Sa.push(c),c}var z=ja;function ja(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===$r)&&(e=ya),Da(e)){let r=Na(e,t,!0);return n&&Ia(r,n),wa>0&&!a&&Sa&&(r.shapeFlag&6?Sa[Sa.indexOf(e)]=r:Sa.push(r)),r.patchFlag=-2,r}if(io(e)&&(e=e.__vccOpts),t){t=Ma(t);let{class:e,style:n}=t;e&&!v(e)&&(t.class=E(e)),b(n)&&(Zt(n)&&!p(n)&&(n=l({},n)),t.style=ge(n))}let o=v(e)?1:ga(e)?128:er(e)?64:b(e)?4:_(e)?2:0;return R(e,t,n,r,i,o,a,!0)}function Ma(e){return e?Zt(e)||Ui(e)?l({},e):e:null}function Na(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?La(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&ka(l),ref:t&&t.ref?n&&a?p(a)?a.concat(Aa(t)):[a,Aa(t)]:Aa(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!==P?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&&Na(e.ssContent),ssFallback:e.ssFallback&&Na(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 B(e=` `,t=0){return z(va,null,e,t)}function V(e=``,t=!1){return t?(F(),L(ya,null,e)):z(ya,null,e)}function Pa(e){return e==null||typeof e==`boolean`?z(ya):p(e)?z(P,null,e.slice()):Da(e)?Fa(e):z(va,null,String(e))}function Fa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Na(e)}function Ia(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),Ia(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Ui(t)?t._ctx=zn:r===3&&zn&&(zn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(_(t)){if(r&65){Ia(e,{default:t});return}t={default:t,_ctx:zn},n=32}else t=String(t),r&64?(n=16,t=[B(t)]):n=8;e.children=t,e.shapeFlag|=n}function La(...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=ge([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 Ra(e,t,n,r=null){bn(e,t,7,[n,r])}var za=wi(),Ba=0;function Va(e,t,n){let i=e.type,a=(t?t.appContext:e.appContext)||za,o={uid:Ba++,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:Yi(i,a),emitsOptions:Mi(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=Ai.bind(null,o),e.ce&&e.ce(o),o}var Ha=null,Ua=()=>Ha||zn,Wa,Ga;{let e=he(),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)}};Wa=t(`__VUE_INSTANCE_SETTERS__`,e=>Ha=e),Ga=t(`__VUE_SSR_SETTERS__`,e=>Ya=e)}var Ka=e=>{let t=Ha;return Wa(e),e.scope.on(),()=>{e.scope.off(),Wa(t)}},qa=()=>{Ha&&Ha.scope.off(),Wa(null)};function Ja(e){return e.vnode.shapeFlag&4}var Ya=!1;function Xa(e,t=!1,n=!1){t&&Ga(t);let{props:r,children:i}=e.vnode,a=Ja(e);Wi(e,r,a,t),ra(e,i,n||t);let o=a?Za(e,t):void 0;return t&&Ga(!1),o}function Za(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,oi);let{setup:r}=n;if(r){Qe();let n=e.setupContext=r.length>1?to(e):null,i=Ka(e),a=yn(r,e,0,[e.props,n]),o=x(a);if($e(),i(),(o||e.sp)&&!Nr(e)&&Or(e),o){if(a.then(qa,qa),t)return a.then(n=>{Ga(!0);try{Qa(e,n,t)}finally{Ga(!1)}}).catch(t=>{xn(t,e,0)});e.asyncDep=a}else Qa(e,a,t)}else $a(e,t)}function Qa(e,t,n){_(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:b(t)&&(e.setupState=cn(t)),$a(e,n)}function $a(e,t,n){let r=e.type;e.render||=r.render||a;{let t=Ka(e);Qe();try{ui(e)}finally{$e(),t()}}}var eo={get(e,t){return lt(e,`get`,``),e[t]}};function to(e){return{attrs:new Proxy(e.attrs,eo),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function no(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 ii)return ii[n](e)},has(e,t){return t in e||t in ii}}):e.proxy}function ro(e,t=!0){return _(e)?e.displayName||e.name:e.name||t&&e.__name}function io(e){return _(e)&&`__vccOpts`in e}var H=(e,t)=>fn(e,t,Ya);function ao(e,t,n){try{Ta(-1);let r=arguments.length;return r===2?b(t)&&!p(t)?Da(t)?z(e,null,[t]):z(e,t):z(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Da(n)&&(n=[n]),z(e,t,n))}finally{Ta(1)}}var oo=`3.5.43`,so=void 0,co=typeof window<`u`&&window.trustedTypes;if(co)try{so=co.createPolicy(`vue`,{createHTML:e=>e})}catch{}var lo=so?e=>so.createHTML(e):e=>e,uo=`http://www.w3.org/2000/svg`,fo=`http://www.w3.org/1998/Math/MathML`,po=typeof document<`u`?document:null,mo=po&&po.createElement(`template`),ho={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`?po.createElementNS(uo,e):t===`mathml`?po.createElementNS(fo,e):n?po.createElement(e,{is:n}):po.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>po.createTextNode(e),createComment:e=>po.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>po.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{mo.innerHTML=lo(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=mo.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]}},go=`transition`,_o=`animation`,vo=Symbol(`_vtc`),yo={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},bo=l({},gr,yo),xo=(e=>(e.displayName=`Transition`,e.props=bo,e))((e,{slots:t})=>ao(br,wo(e),t)),So=(e,t=[])=>{p(e)?e.forEach(e=>e(...t)):e&&e(...t)},Co=e=>e?p(e)?e.some(e=>e.length>1):e.length>1:!1;function wo(e){let t={};for(let n in e)n in yo||(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=To(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,w=(e,t,n,r)=>{e._enterCancelled=r,Oo(e,t?d:s),Oo(e,t?u:o),n&&n()},ne=(e,t)=>{e._isLeaving=!1,Oo(e,f),Oo(e,m),Oo(e,p),t&&t()},re=e=>(t,n)=>{let i=e?ee:y,o=()=>w(t,e,n);So(i,[t,o]),ko(()=>{Oo(t,e?c:a),Do(t,e?d:s),Co(i)||jo(t,r,g,o)})};return l(t,{onBeforeEnter(e){So(v,[e]),Do(e,a),Do(e,o)},onBeforeAppear(e){So(C,[e]),Do(e,c),Do(e,u)},onEnter:re(!1),onAppear:re(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>ne(e,t);Do(e,f),e._enterCancelled?(Do(e,p),Fo(e)):(Fo(e),Do(e,p)),ko(()=>{e._isLeaving&&(Oo(e,f),Do(e,m),Co(x)||jo(e,r,_,n))}),So(x,[e,n])},onEnterCancelled(e){w(e,!1,void 0,!0),So(b,[e])},onAppearCancelled(e){w(e,!0,void 0,!0),So(te,[e])},onLeaveCancelled(e){ne(e),So(S,[e])}})}function To(e){if(e==null)return null;if(b(e))return[Eo(e.enter),Eo(e.leave)];{let t=Eo(e);return[t,t]}}function Eo(e){return pe(e)}function Do(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[vo]||(e[vo]=new Set)).add(t)}function Oo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[vo];n&&(n.delete(t),n.size||(e[vo]=void 0))}function ko(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Ao=0;function jo(e,t,n,r){let i=e._endId=++Ao,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=Mo(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 Mo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${go}Delay`),a=r(`${go}Duration`),o=No(i,a),s=r(`${_o}Delay`),c=r(`${_o}Duration`),l=No(s,c),u=null,d=0,f=0;t===go?o>0&&(u=go,d=o,f=a.length):t===_o?l>0&&(u=_o,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?go:_o:null,f=u?u===go?a.length:c.length:0);let p=u===go&&/\b(?:transform|all)(?:,|$)/.test(r(`${go}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function No(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Po(t)+Po(e[n])))}function Po(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Fo(e){return(e?e.ownerDocument:document).body.offsetHeight}function Io(e,t,n){let r=e[vo];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Lo=Symbol(`_vod`),Ro=Symbol(`_vsh`),zo={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Lo]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):Bo(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),Bo(e,!0),r.enter(e)):r.leave(e,()=>{Bo(e,!1)}):Bo(e,t))},beforeUnmount(e,{value:t}){Bo(e,t)}};function Bo(e,t){e.style.display=t?e[Lo]:`none`,e[Ro]=!t}var Vo=Symbol(``),Ho=/(?:^|;)\s*display\s*:/;function Uo(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]??Go(r,t,``)}else for(let e in t)n[e]??Go(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?Go(r,i,``):Yo(e,i,!v(t)&&t?t[i]:void 0,o)||Go(r,i,o)}}else if(i){if(t!==n){let e=r[Vo];e&&(n+=`;`+e),r.cssText=n,a=Ho.test(n)}}else t&&e.removeAttribute(`style`);Lo in e&&(e[Lo]=a?r.display:``,e[Ro]&&(r.display=`none`))}var Wo=/\s*!important$/;function Go(e,t,n){if(p(n))n.forEach(n=>Go(e,t,n));else if(n??=``,t.startsWith(`--`))Wo.test(n)?e.setProperty(t,n.replace(Wo,``),`important`):e.setProperty(t,n);else{let r=Jo(e,t);Wo.test(n)?e.setProperty(se(r),n.replace(Wo,``),`important`):e[r]=n}}var Ko=[`Webkit`,`Moz`,`ms`],qo={};function Jo(e,t){let n=qo[t];if(n)return n;let r=ae(t);if(r!==`filter`&&r in e)return qo[t]=r;r=ce(r);for(let n=0;n<Ko.length;n++){let i=Ko[n]+r;if(i in e)return qo[t]=i}return t}function Yo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&v(r)&&n===r}var Xo=`http://www.w3.org/1999/xlink`;function Zo(e,t,n,r,i,a=Se(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(Xo,t.slice(6,t.length)):e.setAttributeNS(Xo,t,n):n==null||a&&!Ce(n)?e.removeAttribute(t):e.setAttribute(t,a?``:y(n)?String(n):n)}function Qo(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?lo(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 $o(e,t,n,r){e.addEventListener(t,n,r)}function es(e,t,n,r){e.removeEventListener(t,n,r)}var ts=Symbol(`_vei`);function ns(e,t,n,r,i=null){let a=e[ts]||(e[ts]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=as(t);r?$o(e,n,a[t]=ls(r,i),s):o&&(es(e,n,o,s),a[t]=void 0)}}var rs=/(Once|Passive|Capture)$/,is=/^on:?(?:Once|Passive|Capture)$/;function as(e){let t,n;for(;(n=e.match(rs))&&!is.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 os=0,ss=Promise.resolve(),cs=()=>os||=(ss.then(()=>os=0),Date.now());function ls(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=cs(),n}var us=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,ds=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Io(e,r,o):t===`style`?Uo(e,n,r):s(t)?c(t)||ns(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):fs(e,t,r,o))?(Qo(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&Zo(e,t,r,o,a,t!==`value`)):e._isVueCE&&(ps(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!v(r)))?Qo(e,ae(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),Zo(e,t,r,o))};function fs(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&us(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 us(t)&&v(n)?!1:t in e}function ps(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 ms=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return p(t)?e=>ue(t,e):t};function hs(e){e.target.composing=!0}function gs(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var _s=Symbol(`_assign`),vs=Symbol(`_initialValue`);function ys(e,t,n){return t&&(e=e.trim()),n&&(e=fe(e)),e}var bs={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[vs]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[vs]=e.defaultValue.replace(/\r\n?/g,`
|
|
2
|
-
`))),e[_s]=ms(i);let a=r||i.props&&i.props.type===`number`;$o(e,t?`change`:`input`,t=>{t.target.composing||e[_s](ys(e.value,n,a))}),(n||a)&&$o(e,`change`,()=>{e.value=ys(e.value,n,a)}),t||($o(e,`compositionstart`,hs),$o(e,`compositionend`,gs),$o(e,`change`,gs))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[vs];delete e[vs],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[_s](ys(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[_s]=ms(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?fe(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)}},xs={deep:!0,created(e,t,n){e[_s]=ms(n),$o(e,`change`,()=>{let t=e._modelValue,n=Es(e),r=e.checked,i=e[_s];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(Ds(e,r))})},mounted:Ss,beforeUpdate(e,t,n){e[_s]=ms(n),Ss(e,t,n)}};function Ss(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,Ds(e,!0))}e.checked!==i&&(e.checked=i)}var Cs={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,$o(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?fe(Es(e)):Es(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[_s](i)}finally{An(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[_s]=ms(r)},mounted(e,{value:t}){Ts(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[_s]=ms(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!ws(t,n[1],n[0]))&&Ts(e,t)}};function ws(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 Ts(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=Es(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(Es(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Es(e){return`_value`in e?e._value:e.value}function Ds(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Os=[`ctrl`,`shift`,`alt`,`meta`],ks={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)=>Os.some(n=>e[`${n}Key`]&&!t.includes(n))},As=(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=ks[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},js={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ms=(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||js[e]===r))return e(n)}))},Ns=l({patchProp:ds},ho),Ps;function Fs(){return Ps||=oa(Ns)}var Is=((...e)=>{let t=Fs().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Rs(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,Ls(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Ls(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Rs(e){return v(e)?document.querySelector(e):e}var zs=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Bs={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`},Vs=({size:e,strokeWidth:t=2,absoluteStrokeWidth:n,color:r,iconNode:i,name:a,class:o,...s},{slots:c})=>ao(`svg`,{...Bs,width:e||Bs.width,height:e||Bs.height,stroke:r||Bs.stroke,"stroke-width":n?Number(t)*24/Number(e):t,class:[`lucide`,`lucide-${zs(a??`icon`)}`],...s},[...i.map(e=>ao(...e)),...c.default?[c.default()]:[]]),U=(e,t)=>(n,{slots:r})=>ao(Vs,{...n,iconNode:t,name:e},r),Hs=U(`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`}]]),Us=U(`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`}]]),Ws=U(`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`}]]),Gs=U(`ArrowDownToLineIcon`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Ks=U(`ArrowRightIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),qs=U(`ArrowUpFromLineIcon`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Js=U(`ArrowUpRightIcon`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ys=U(`ArrowUpIcon`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Xs=U(`BanIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),Zs=U(`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`}]]),Qs=U(`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`}]]),$s=U(`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`}]]),ec=U(`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`}]]),tc=U(`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`}]]),nc=U(`CheckIcon`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),rc=U(`ChevronDownIcon`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ic=U(`ChevronRightIcon`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ac=U(`CircleCheckIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),oc=U(`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`}]]),sc=U(`Clock3Icon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),cc=U(`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`}]]),lc=U(`CornerDownRightIcon`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),uc=U(`CornerLeftUpIcon`,[[`polyline`,{points:`14 9 9 4 4 9`,key:`m9oyvo`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),dc=U(`CornerUpLeftIcon`,[[`polyline`,{points:`9 14 4 9 9 4`,key:`881910`}],[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}]]),fc=U(`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`}]]),pc=U(`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`}]]),mc=U(`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`}]]),hc=U(`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`}]]),gc=U(`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`}]]),_c=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`LoaderCircleIcon`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ic=U(`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=U(`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=U(`MinusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),zc=U(`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=U(`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=U(`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=U(`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=U(`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=U(`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=U(`PanelLeftIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Kc=U(`PanelRightIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),qc=U(`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=U(`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=U(`PlayIcon`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Xc=U(`PlusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zc=U(`PowerIcon`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Qc=U(`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=U(`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=U(`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=U(`SearchIcon`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),nl=U(`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`}]]),rl=U(`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`}]]),il=U(`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`}]]),al=U(`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`}]]),ol=U(`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`}]]),sl=U(`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`}]]),cl=U(`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`}]]),ll=U(`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`}]]),ul=U(`TerminalIcon`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),dl=U(`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`}]]),fl=U(`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`}]]),pl=U(`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`}]]),ml=U(`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`}]]),hl=U(`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`}]]),gl=U(`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`}]]),_l=U(`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`}]]),vl=U(`XIcon`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),yl=e=>e.role===`assistant`,bl=e=>e.role===`toolResult`;function xl(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>e.type===`text`?e.text??``:``).join(``):``}function Sl(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 Cl(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 wl(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`&&bl(e)&&r.set(e.toolCallId,{entryId:t.id,message:e}),t.kind===`pi.assistant`&&yl(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:xl(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:Tl(o.summary)}:{}}:{callId:e,name:t,args:i,status:o?.status??`pending`,output:o?.output||void 0,...s?{nested:s}:{},...o?.summary?{summary:Tl(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(xl).join(`
|
|
3
|
-
`)});else if(t.kind===`pi.assistant`){let e=(t.model??[]).filter(yl);s.push({kind:`assistant`,id:t.id,streaming:!1,blocks:e.flatMap(o),error:e.map(Sl).find(Boolean),model:e[0]?.model})}else if(t.kind===`pi.tool-result`)for(let e of(t.model??[]).filter(bl))i.has(e.toolCallId)||s.push({kind:`tool-result`,id:t.id,name:e.toolName,text:xl(e),isError:e.isError});else s.push({kind:`event`,id:t.id,entryKind:t.kind,text:Cl(t),note:t.model?.length?(t.model??[]).map(xl).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 Tl(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 El(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??{}))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 Dl=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>void this.listeners.delete(e)}emit(){for(let e of this.listeners)e()}},Ol=()=>({items:[],entries:[],running:!1,generating:!1,inbox:[],agent:{},usage:{models:{},tools:{}},compactions:[],notices:[],docs:{},ready:!1});function kl(e,t,n){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]=String(r[i]??``)+n}function Al(e,t){if(t.type===`message`)return structuredClone(t.message);let n=[...e.content],r=t.contentIndex;if(t.type===`block`||t.type.endsWith(`_start`))n[r]=structuredClone(t.block);else if(t.type===`text_delta`){let e=n[r];n[r]={type:`text`,text:(e?.type===`text`?e.text:``)+t.delta}}else if(t.type===`thinking_delta`){let e=n[r];n[r]={type:`thinking`,thinking:(e?.type===`thinking`?e.thinking:``)+t.delta}}else if(t.type===`toolcall_delta`){let e=structuredClone(n[r]??{type:`toolCall`,id:``,name:``,arguments:{}});kl(e,t.path,t.delta),n[r]=e}return{...e,content:n}}var jl=class extends Dl{state=Ol();entries=new Map;live;tools=new Map;apply(e){switch(e.type){case`snapshot`:this.reset(e.snapshot),this.state.inbox=e.inbox;break;case`batch`:for(let t of e.events)this.event(t);break;case`inbox`:this.state.inbox=e.items;break;case`doc`:this.state.docs={...this.state.docs,[e.kind]:e.value};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=Ol(),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=wl(e,this.live,this.tools)}reset(e){this.entries=new Map(e.entries.map(e=>[e.id,e])),this.live=e.generation?.message?structuredClone(e.generation.message):void 0,this.tools=new Map(e.tools.map(e=>[e.callId,{name:e.name,status:e.status,output:e.output??``}]));for(let t of e.nestedTools){let e=this.tools.get(t.callId);this.tools.set(t.callId,{name:t.name,status:t.status,output:t.output??``,args:t.arguments,nested:{parentCallId:t.parentCallId,parentTaskId:t.parentTaskId,taskId:t.taskId},...t.summary?{summary:t.summary}:{},...e??{}})}this.state.running=!!e.run,this.state.agent=e.agent,this.state.usage=e.usage,this.state.retry=e.generation?.retry,this.state.compactions=e.compactions.map(e=>e.taskId),this.state.compactionFailure=e.compactionFailure,this.state.ready=!0}commit(e){if(this.entries.set(e.id,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)}}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=structuredClone(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=Al(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`:this.tools.set(e.toolCallId,{name:e.toolName,status:`running`,output:``,args: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`:{let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`running`,output:``},n=e.output;n&&`set`in n?t.output=n.set:n&&(t.output=t.output.slice(n.trimStart??0)+(n.append??``)),t.status=`running`,this.tools.set(e.toolCallId,t);return}case`tool_execution_end`:if(e.entry){this.tools.delete(e.toolCallId),this.entries.set(e.entry.id,e.entry);return}if(e.result){let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`done`,output:``};t.status=`done`,t.result={text:Bl(e.result),isError:e.result.isError},t.summary={isError:e.result.isError,durationMs:e.result.durationMs},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);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`:this.state.notices=[...this.state.notices.slice(-9),`${e.kind} failed: ${e.message}`];return;default:return}}},Ml=class extends Dl{state={agents:[],tasks:[],usage:{models:{},tools:{}},ready:!1};apply(e){if(e.type===`session`)this.state={agents:e.agents,tasks:e.tasks,usage:e.usage,ready:!0};else if(e.type===`agents`)this.state={...this.state,agents:e.agents};else if(e.type===`tasks`)this.state={...this.state,tasks: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 Nl(this.state.agents,e)}foregroundBusy(e){return this.state.tasks.some(t=>!t.background&&t.conversationId===e)}backgroundTasks(e){return this.state.tasks.filter(t=>t.background&&(e===void 0||t.conversationId===e))}};function Nl(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 Pl=e=>e,Fl=(e,t)=>`${e}/s/${t}`,Il=(e,t,n)=>`${e}/s/${t}/a/${n}`;function Ll(e,t,n){let r=new Map;for(let i of t.agents)r.set(i.id,{type:`agent`,key:Il(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 Rl(e){return e.map(e=>{let t=e.status!==`online`;return{type:`device`,key:Pl(e.id),device:e,status:e.status,stale:t,children:(e.tree?.sessions??[]).map(n=>({type:`session`,key:Fl(e.id,n.id),deviceId:e.id,session:n,stale:t,children:Ll(e.id,n,t)}))}})}var zl=class extends Dl{devices=[];apply(e){return e.type===`network`&&(this.devices=e.devices,this.emit(),!0)}device(e){return this.devices.find(t=>t.id===e)}tree(){return Rl(this.devices)}};function Bl(e){let t=e.structuredOutput;if(t==null)return``;let n=typeof t==`string`?t:JSON.stringify(t);return n.length>4e3?`${n.slice(0,4e3)}…`:n}var Vl=3e4;function Hl(e,t){return t&&/^\d+$/.test(t.trim())?Math.min(Vl,Math.max(1e3,Number(t)*1e3)):Math.min(Vl,1e3*2**Math.min(e,10))}function Ul(e){return Math.min(Vl,2e3*2**Math.min(e,10))}var Wl=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(),Ul(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(Hl(this.failures++,n)),!1}},Gl=`lab.png`;function Kl(e){return`/icons/${typeof e==`string`&&/^[\w.-]+\.(png|svg)$/.test(e)&&!e.includes(`..`)?e:Gl}`}var ql=class extends Error{code;status;constructor(e,t,n=0,r){super(t,r),this.code=e,this.status=n,this.name=`DpiError`}},Jl=16777216,Yl={initS:1,capS:15},Xl={codeCreate:{perMinute:5,capacity:5},start:{perMinute:20,capacity:20},verifyFails:{perWindow:100,windowMinutes:15},verifyTotal:{perMinute:300,capacity:300}},Zl={perMinute:60,capacity:120};Yl.initS,Xl.verifyFails.perWindow,Xl.verifyFails.windowMinutes,Zl.perMinute,Zl.capacity;function Ql(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*$l(e,t=45e3,n=Jl){let r=e.getReader(),i=new TextDecoder,a=()=>new ql(`invalid`,`SSE event exceeds ${n} bytes`),o=[],s=0,c=``;try{for(;;){let e,l=new Promise((n,r)=>{e=setTimeout(()=>r(new ql(`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+=Ql(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=Ql(e);if(t>n)throw a();f=f.slice(p+2),s-=t+2;let r=eu(e);r&&(yield r)}if(s>n)throw a();o=f?[f]:[],c=f.slice(-1)}}finally{r.cancel().catch(()=>{})}}function eu(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 tu=encodeURIComponent,nu=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,ru=class{token;baseUrl;constructor(e,t){this.token=t,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 ql(`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 ql(e?.code??(o.status===401?`unauthorized`:o.status===404?`not_found`:`internal`),e?.message??`${o.status} ${o.statusText}`,o.status)}return 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 ql(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}if(!r.ok||!r.body){let e=await r.json().catch(()=>void 0);throw new ql(e?.error?.code??(r.status===401?`unauthorized`:`unavailable`),e?.error?.message??`Stream failed (${r.status})`,r.status)}try{for await(let e of $l(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/${tu(e)}`,t)}archiveProject(e){return this.request(`POST`,`/v1/projects/${tu(e)}/archive`,{})}unarchiveProject(e){return this.request(`POST`,`/v1/projects/${tu(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/${tu(e)}`,t)}removeNotifySink(e){return this.request(`DELETE`,`/v1/notify/sinks/${tu(e)}`)}testNotifySinks(){return this.request(`POST`,`/v1/notify/test`,{})}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/${tu(e)}`,t)}removeSchedule(e){return this.request(`DELETE`,`/v1/schedules/${tu(e)}`)}runSchedule(e){return this.request(`POST`,`/v1/schedules/${tu(e)}/run`,{})}deviceUsage(){return this.request(`GET`,`/v1/device/usage`)}searchSessions(e){return this.request(`GET`,`/v1/sessions/search?q=${tu(e)}`)}dirs(e=``){return this.request(`GET`,`/v1/fs/dirs?path=${tu(e)}`)}deviceDoc(e){return this.request(`GET`,`/v1/docs/${tu(e)}`)}deviceEvents(e,t=[]){return this.stream(`/v1/events${t.length?`?docs=${t.map(tu).join(`,`)}`:``}`,e)}gitStatus(e,t={}){return this.request(`GET`,`/v1/git/status?path=${tu(e)}`,void 0,t)}gitOp(e,t,n={}){return this.request(`POST`,`/v1/git`,{path:e,op:t,...n})}exportSession(e){return this.request(`GET`,`/v1/sessions/${tu(e)}/export`)}sessionGitFiles(e){return this.request(`GET`,`/v1/sessions/${tu(e)}/git-files`)}sessionGitTurns(e){return this.request(`GET`,`/v1/sessions/${tu(e)}/git-turns`)}gitStatusBatch(e,t={}){return this.request(`POST`,`/v1/git/status-batch`,{paths:e},t)}sessions(){return this.request(`GET`,`/v1/sessions`)}createSession(e,t=nu()){return this.request(`POST`,`/v1/sessions`,e,{idempotencyKey:t})}session(e){return new iu(this,e)}agent(e,t){return new au(this,e,String(t))}},iu=class{client;ref;constructor(e,t){this.client=e,this.ref=t}get base(){return`/v1/sessions/${tu(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=nu()){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)}},au=class{client;session;agent;constructor(e,t,n){this.client=e,this.session=t,this.agent=n}get base(){return`/v1/sessions/${tu(this.session)}/agents/${tu(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=nu(),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=nu()){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/${tu(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(tu).join(`,`)}`:``}`,e)}},W=e=>new ru(`/api/devices/${encodeURIComponent(e)}`);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 ql(e?.code??`internal`,e?.message??`${r.status} ${r.statusText}`,r.status)}return i}var su={network:()=>ou(`GET`,`/network`),version:()=>ou(`GET`,`/version`),check:e=>ou(`POST`,`/devices/${encodeURIComponent(e)}/check`,{}),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})},cu=e=>e instanceof Error?e.message:String(e),lu=[`demo.job-runs`,`demo.workspace`],uu=e=>`${e.deviceId}/agent/${e.sessionId}/${e.agentId}?docs=${lu.join(`,`)}`,du=e=>`${e.deviceId}/session/${e.sessionId}`,fu=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 mu(e){let t=new zl,n=k(0);return t.subscribe(()=>n.value++),e.onNetwork(e=>t.apply({type:`network`,devices:e})),{model:t,devices:H(()=>(n.value,t.devices)),tree:H(()=>(n.value,t.tree()))}}function hu(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?fu(e):void 0)},{immediate:!0}),{sharedState:n,activity:r,status:i}}function gu(e,t){let n=new Ml,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?du(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:H(()=>(r.value,n.state)),status:i,fault:a}}function _u(e,t){let n=new jl,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?uu(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:H(()=>(r.value,{...n.state})),status:i,fault:a,version:r,retry:s}}var vu=new Wl,yu=k(vu.state);vu.onState(e=>yu.value=e);var bu=mu(vu),xu=k(),Su=k(),G=k(),Cu=k(new Set),wu=k(300),Tu=Wt({tree:!0,inspector:!0}),Eu=k(!1),Du=H(()=>G.value?.deviceId),Ou=H(()=>bu.devices.value.find(e=>e.id===Du.value)),ku=H(()=>Ou.value?.status===`online`),Au=gu(vu,H(()=>G.value?{deviceId:G.value.deviceId,sessionId:G.value.sessionId}:void 0)),ju=_u(vu,G),Mu=hu(vu,Du),Nu=H(()=>Ou.value?.tree?.sessions.find(e=>e.id===G.value?.sessionId)),Pu=H(()=>Du.value?W(Du.value):void 0),Fu=H(()=>G.value&&Pu.value?Pu.value.agent(G.value.sessionId,G.value.agentId):void 0),Iu=H(()=>G.value&&Pu.value?Pu.value.session(G.value.sessionId):void 0);function Lu(e){G.value=e,K.drawer=!1,Ru=!!e,zu()}var Ru=!1;function zu(){let e=G.value;if(!Ru||!e)return;let t=bu.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=>!Cu.value.has(e))&&(Cu.value=new Set([...Cu.value,...r])),n.has(e.agentId)&&(Ru=!1)}M(()=>bu.devices.value,zu);function Bu(e,t){let n=new Set(Cu.value);t??!n.has(e)?n.add(e):n.delete(e),Cu.value=n}var Vu=(()=>{let e=new Map;return(t,n)=>{clearTimeout(e.get(t)),e.set(t,setTimeout(()=>void su.uiSet(t,n).catch(()=>{}),300))}})();M(G,e=>Eu.value&&void su.uiSet(`tree.selected`,e??null).catch(()=>{})),M(wu,e=>Eu.value&&Vu(`tree.width`,e)),M(Tu,e=>Eu.value&&Vu(`layout.panels`,{...e}));async function Hu(){vu.start();try{let[e,t,n,r]=await Promise.all([su.network(),su.uiGet(`tree.selected`),su.uiGet(`tree.width`),su.uiGet(`layout.panels`)]);r&&Object.assign(Tu,r),su.version().then(e=>Su.value=e.version).catch(()=>{}),xu.value=e.configFile,bu.model.devices.length||bu.model.apply({type:`network`,devices:e.devices}),Cu.value=new Set,n&&(wu.value=n),t&&e.devices.some(e=>e.id===t.deviceId)?Lu(t):Uu(e.devices)}catch(e){K.error=cu(e)}finally{Eu.value=!0}}function Uu(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 Lu({deviceId:t.id,sessionId:e.id,agentId:n.id})}}M(()=>[ju.status.value,Nu.value],([e,t])=>{e===`fault`&&!t&&ku.value&&(q(`That session was archived on its device.`),Lu(void 0))});var Wu=H(()=>Ou.value?.info?.models??[]),Gu=ju.state,Ku=H(()=>Au.state.value.agents.length?Au.state.value.agents:Nu.value?.agents??[]),qu=H(()=>G.value?Nl(Ku.value,G.value.agentId):[]),Ju=H(()=>{let e=G.value?.agentId;if(e===void 0)return[];let t=Ku.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=Au.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}})}),Yu=H(()=>Gu.value.running||Ju.value.some(e=>!e.effectiveBackground&&e.conversationId===G.value?.agentId)),Xu=H(()=>El(Gu.value.usage)),Zu=H(()=>{let e=Gu.value.agent.model;return Wu.value.find(t=>t.provider===e?.provider&&t.id===e?.modelId)}),Qu=rn(),$u=0;async function ed(){let e=Fu.value,t=++$u;if(!e||!ku.value)return void(Qu.value=void 0);try{let n=await e.get();t===$u&&(Qu.value=n)}catch{t===$u&&(Qu.value=void 0)}}M([Fu,ku],()=>void ed(),{immediate:!0});var K=Wt({error:``,toast:``,drawer:!1,inspectorOverlay:!1,tab:`session`,composer:``,dialog:void 0}),td,nd=Wt([]),rd=1;function id(){for(let e of nd)e.read=!0}function q(e){K.toast=e,e&&(nd.unshift({id:rd++,text:e,at:Date.now(),read:!1}),nd.length>50&&(nd.length=50)),clearTimeout(td),td=setTimeout(()=>K.toast=``,4500)}async function ad(e){K.error=``;try{return await e()}catch(e){K.error=cu(e);return}}function od(e){K.composer=e,setTimeout(()=>document.querySelector(`.composer textarea`)?.focus())}var sd=e=>Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e),cd=e=>JSON.stringify(e,null,2),ld=(e=``)=>Kl(Wu.value.find(t=>t.id===e)?.icon);function ud(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 dd=k(!1);async function fd(){Yu.value&&!dd.value&&Fu.value&&(dd.value=!0,await ad(()=>Fu.value.abort(!1))&&q(`Foreground work interrupted. Background jobs continue.`),dd.value=!1)}var pd=window.matchMedia(`(max-width: 1100px)`),md=k(pd.matches);pd.addEventListener(`change`,e=>md.value=e.matches);var hd=H(()=>md.value?K.inspectorOverlay:Tu.inspector);function gd(e){e&&(K.tab=e),md.value?(K.drawer=!1,K.inspectorOverlay=!0):Tu.inspector=!0}function _d(){md.value?K.inspectorOverlay=!1:Tu.inspector=!1}function vd(){md.value?(K.drawer=!K.drawer)&&(K.inspectorOverlay=!1,Tu.tree=!0):Tu.tree=!Tu.tree}function yd(){hd.value?_d():gd()}var bd=/Mac|iPhone|iPad/.test(navigator.userAgent),xd=bd?{tree:`Ctrl+N`,inspector:`Ctrl+T`}:{tree:`Alt+Shift+N`,inspector:`Alt+Shift+T`};function Sd(e){if(!(!(bd?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 Cd={class:`topbar`},wd={class:`brand`},Td={class:`daemon`,"data-testid":`topbar-stats`},Ed=[`title`],Dd={class:`top-actions`},Od={key:0,class:`usage-chip`,title:`This session's token usage and cost`},kd=[`aria-label`,`title`],Ad={key:0,class:`bell-dot`},jd={key:0,class:`hint`},Md={class:`when`},Nd=[`disabled`],Pd=[`disabled`],Fd=Dr({__name:`TopBar`,emits:[`newSession`],setup(e,{emit:t}){let n=k(!1),r=H(()=>nd.filter(e=>!e.read).length),i=()=>{n.value=!n.value,n.value&&id()},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=H(()=>Xu.value.input+Xu.value.output+Xu.value.cacheRead+Xu.value.cacheWrite),s=H(()=>(Xu.value.inputCost??0)+(Xu.value.outputCost??0)+(Xu.value.cacheReadCost??0)+(Xu.value.cacheWriteCost??0)),c=H(()=>bu.devices.value.filter(e=>e.status===`online`).length),l=H(()=>bu.devices.value.reduce((e,t)=>e+(t.tree?.sessions.length??0),0)),u=H(()=>bu.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=Iu.value,t=G.value;if(!e||!t||d.value)return;d.value=!0;let n=await ad(()=>e.createAgent({}));d.value=!1,n&&(Lu({...t,agentId:n.id}),q(`New agent. Same session, same shared App State.`))}let p=t;return(e,t)=>(F(),I(`header`,Cd,[R(`div`,wd,[R(`button`,{class:`icon-button tree-toggle`,"aria-label":`Toggle network`,title:`Network`,onClick:t[0]||=e=>A(K).drawer=!A(K).drawer},[z(A(Gc),{size:19})]),t[6]||=R(`img`,{class:`brandmark`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),t[7]||=R(`strong`,null,`Durable Pi`,-1)]),t[15]||=R(`span`,{class:`topbar-sep`,"aria-hidden":`true`},null,-1),R(`div`,Td,[R(`span`,{class:E([`dot`,{off:!c.value}]),"aria-hidden":`true`},null,2),R(`span`,{class:`network-summary`,title:`${c.value} of ${A(bu).devices.value.length} devices online`},[z(A(Bc),{size:16}),B(D(c.value)+` of `+D(A(bu).devices.value.length)+` online`,1)],8,Ed),t[10]||=R(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),R(`span`,null,[R(`b`,null,D(l.value),1),t[8]||=B(` sessions`,-1)]),t[11]||=R(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),R(`span`,null,[R(`b`,null,D(u.value),1),t[9]||=B(` agents`,-1)])]),R(`div`,Dd,[R(`span`,{class:E([`chip connection`,{accent:A(yu)===`live`}])},[R(`span`,{class:E([`dot`,{off:A(yu)!==`live`}]),"aria-hidden":`true`},null,2),B(D(A(yu)===`live`?`Connected`:`Reconnecting`),1)],2),o.value?(F(),I(`span`,Od,D(o.value.toLocaleString())+` tok · $`+D(s.value.toFixed(3)),1)):V(``,!0),R(`button`,{class:`icon-button`,"aria-label":`Notifications${r.value?` (${r.value} unread)`:``}`,title:`Notification center${r.value?` — ${r.value} unread`:``}`,onClick:i},[z(A(Zs),{size:18}),r.value?(F(),I(`i`,Ad,D(r.value>9?`9+`:r.value),1)):V(``,!0)],8,kd),n.value?(F(),I(`div`,{key:1,class:`notif-panel`,onClick:t[2]||=As(()=>{},[`stop`])},[R(`header`,null,[t[12]||=R(`b`,null,`Notifications`,-1),R(`button`,{class:`icon-button`,"aria-label":`Close notifications`,onClick:t[1]||=e=>n.value=!1},`✕`)]),A(nd).length?V(``,!0):(F(),I(`p`,jd,`Nothing yet — events land here as they happen.`)),R(`ul`,null,[(F(!0),I(P,null,N(A(nd),e=>(F(),I(`li`,{key:e.id,class:E({unread:!e.read})},[R(`span`,Md,D(a(e.at)),1),R(`span`,null,D(e.text),1)],2))),128))])])):V(``,!0),R(`button`,{class:`icon-button`,title:`How this works`,"aria-label":`How this works`,onClick:t[3]||=e=>A(K).dialog={kind:`help`}},[z(A(oc),{size:19})]),R(`button`,{class:`secondary small new-agent-button`,disabled:!A(G)||!A(ku)||d.value,title:`Start a fresh agent in this session`,onClick:f},[z(A(Xc),{size:18}),t[13]||=B(`New agent `,-1)],8,Nd),R(`button`,{class:`primary small`,onClick:t[4]||=e=>p(`newSession`)},[z(A(Xc),{size:18}),t[14]||=B(`New session `,-1)]),R(`button`,{class:`icon-button inspector-toggle`,"aria-label":`Toggle inspector`,title:`Inspector`,disabled:!A(G)||!A(ku),onClick:t[5]||=e=>A(K).inspectorOverlay?A(_d)():A(gd)()},[z(A(Kc),{size:19})],8,Pd)])]))}}),Id=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ld=Id(Fd,[[`__scopeId`,`data-v-15b1b2ee`]]),Rd={class:`mnav`,"aria-label":`Panels`},zd={key:0,class:`badge`},Bd=Dr({__name:`MobileNav`,setup(e){function t(){K.drawer=!1,K.inspectorOverlay=!1}return(e,n)=>(F(),I(`nav`,Rd,[R(`button`,{type:`button`,class:E({"is-on":!A(K).drawer&&!A(hd)}),onClick:t},[z(A(Lc),{size:18}),n[2]||=B(`Chat `,-1)],2),R(`button`,{type:`button`,class:E({"is-on":A(hd)}),onClick:n[0]||=e=>A(hd)?A(_d)():A(gd)()},[z(A(Kc),{size:18}),n[3]||=B(`Details`,-1),A(Ju).length?(F(),I(`span`,zd,D(A(Ju).length),1)):V(``,!0)],2),R(`button`,{type:`button`,class:E({"is-on":A(K).drawer}),onClick:n[1]||=e=>A(vd)()},[z(A(pl),{size:18}),n[4]||=B(`Network `,-1)],2)]))}}),Vd=[`width`,`height`,`aria-label`],Hd=[`width`,`height`,`aria-label`],Ud=Dr({__name:`DeviceIcon`,props:{device:{},size:{default:16}},setup(e){let t=e,n=H(()=>{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=H(()=>{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`?(F(),I(`svg`,{key:0,class:`device-icon exe`,viewBox:`0 0 512 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[R(`title`,null,D(r.value),1),i[0]||=R(`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,Vd)):n.value===`apple`?(F(),I(`svg`,{key:1,class:`device-icon apple`,viewBox:`0 0 384 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[R(`title`,null,D(r.value),1),i[1]||=R(`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,Hd)):n.value===`laptop`?(F(),L(A(Ac),{key:2,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`])):(F(),L(A(rl),{key:3,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`]))}}),Wd=new Map,Gd=new Map;async function Kd(e,t){let n=t.filter(t=>!Qd(Zd(e,t),qd));if(n.length)try{let t=await W(e).gitStatusBatch(n,{timeoutMs:6e4});for(let[n,r]of Object.entries(t)){let t=Zd(e,n);t.status=r,t.at=Date.now(),t.error=``}}catch{}}var qd=6e4,Jd=!1;function Yd(){Jd||(Jd=!0,M(()=>bu.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[...Wd.keys()]){let[i,a]=r.split(`::`);if(i!==n.id||!a)continue;let o=Wd.get(r);e.some(e=>a===e.root||a.startsWith(e.root+`/`)||a.startsWith(e.root+`\\`))&&(o.loading||t-o.at<4e3||$d(i,a,{force:!0}))}}}))}var Xd=(e,t)=>`${e}::${t}`;function Zd(e,t){let n=Xd(e,t),r=Wd.get(n);return r||(r=Wt({at:0,status:null,error:``,loading:!1,refreshing:!1}),Wd.set(n,r)),r}var Qd=(e,t)=>e.at>0&&Date.now()-e.at<t&&(e.status!==null||e.error);async function $d(e,t,n={}){let{staleMs:r=6e4,force:i=!1,timeoutMs:a=6e4}=n;if(!e||!t)return;let o=Xd(e,t),s=Zd(e,t);if(!i&&Qd(s,r))return;let c=Gd.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 W(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,Gd.delete(o)}})();return Gd.set(o,l),l}var ef=new Map;function tf(){M(()=>bu.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 bu.devices.value){if(e.status!==`online`||!e.tree?.sessions.length)continue;let t=Date.now();t-(ef.get(e.id)??0)<6e4||(ef.set(e.id,t),Kd(e.id,e.tree.sessions.map(e=>e.cwd)))}},{immediate:!0})}var nf=(e,t)=>Zd(e,t).status?.branch,rf=[`aria-level`,`aria-expanded`,`aria-selected`,`data-key`,`title`],af=[`aria-label`],of={key:1,class:`chev`},sf={class:`name`},cf={class:`badge`},lf=[`title`],uf=[`aria-label`],df=[`disabled`,`aria-label`],ff=[`aria-label`],pf=[`checked`,`aria-label`],mf={class:`name`},hf={class:`path`},gf=[`title`],_f={key:2,class:`dot work`,title:`Working`},vf=[`title`],yf=[`disabled`,`aria-label`],bf=[`disabled`,`aria-label`],xf=[`disabled`,`aria-label`],Sf={class:`name`},Cf={key:3,class:`meta`},wf={key:4,class:`dot work`,title:`Working`},Tf=[`title`],Ef=[`disabled`,`aria-label`],Df=Id(Dr({__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=H(()=>n.node.children.length>0),a=H(()=>n.node.type===`device`?n.node.device:void 0),o=H(()=>n.node.type===`session`?n.node.session:void 0),s=H(()=>n.node.type===`agent`?n.node.agent:void 0),c=H(()=>o.value?o.value.agents.reduce((e,t)=>e+t.background,0):s.value?.background??0),l=H(()=>o.value?.busy||s.value?.busy),u=H(()=>{let e=a.value?.info?.packageVersion,t=Su.value;return!!(e&&t&&t!==`unknown`&&e!==t)}),d=H(()=>{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 · ${ud(e.lastSeenAt)}`}}),f=H(()=>{let e=a.value?.status;return e===`online`?`on`:e===`checking`?`chk`:e===`offline`?`off`:`err`}),p=H(()=>{let e=n.node;return e.type===`session`?nf(e.deviceId,e.session.cwd):void 0}),m=H(()=>a.value?.name??a.value?.id??o.value?.name??s.value?.name??``),h=H(()=>{if(a.value)return`${a.value.name} · ${a.value.url}${a.value.error?`\n${a.value.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)=>(F(),I(`div`,{class:E([`tree-row`,[e.node.type,{sel:e.selected,focus:e.focused,stale:e.node.stale}]]),style:ge({"--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:h.value,onClick:n[13]||=e=>r(`activate`)},[i.value?(F(),I(`button`,{key:0,class:`chev`,tabindex:`-1`,"aria-label":e.open?`Collapse ${m.value}`:`Expand ${m.value}`,onClick:n[0]||=As(e=>r(`toggle`),[`stop`])},[e.open?(F(),L(A(rc),{key:0,size:16})):(F(),L(A(ic),{key:1,size:16}))],8,af)):(F(),I(`span`,of)),a.value?(F(),I(P,{key:2},[R(`i`,{class:E([`dot`,f.value])},null,2),z(Ud,{device:a.value,size:16},null,8,[`device`]),R(`b`,sf,D(m.value),1),R(`span`,cf,D(a.value.kind),1),u.value?(F(),I(`span`,{key:0,class:`tag update`,title:`device runs ${a.value?.info?.packageVersion??`?`}; hub runs ${A(Su)}. Devices self-update: dpi update`},`update`,8,lf)):V(``,!0),R(`span`,{class:E([`meta`,{err:f.value===`err`}])},D(d.value),3),R(`span`,{class:`acts`,onClick:n[4]||=As(()=>{},[`stop`])},[a.value.pairing?(F(),I(`button`,{key:0,class:`icon-button`,"aria-label":`Manage credentials for ${m.value}`,title:`Manage device credentials, including while offline`,onClick:n[1]||=e=>r(`action`,`credentials`)},[z(A(kc),{size:16})],8,uf)):V(``,!0),R(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New session on ${m.value}`,title:`New session on this device`,onClick:n[2]||=e=>r(`action`,`new-session`)},[z(A(Xc),{size:16})],8,df),R(`button`,{class:`icon-button`,"aria-label":`Check ${m.value}`,title:`Check connection now`,onClick:n[3]||=e=>r(`action`,`check`)},[z(A($c),{size:16})],8,ff)])],64)):o.value?(F(),I(P,{key:3},[e.checkbox?(F(),I(`input`,{key:0,type:`checkbox`,class:`bulk-check`,checked:e.checked,"aria-label":`Select ${m.value}`,tabindex:`-1`,onClick:n[5]||=As(()=>{},[`stop`]),onChange:n[6]||=e=>r(`check`)},null,40,pf)):V(``,!0),z(A(yc),{class:`ico`,size:16}),R(`b`,mf,D(m.value),1),R(`span`,hf,`…/`+D(o.value.cwd.split(`/`).filter(Boolean).at(-1)),1),p.value?(F(),I(`span`,{key:1,class:`branch`,title:`git branch of ${o.value.cwd}`},`⎇ `+D(p.value),9,gf)):V(``,!0),l.value?(F(),I(`i`,_f)):V(``,!0),c.value?(F(),I(`span`,{key:3,class:`bg-count`,title:`${c.value} background task(s)`},[n[14]||=R(`i`,{class:`dot bg`},null,-1),B(D(c.value)+` bg`,1)],8,vf)):V(``,!0),R(`span`,{class:`acts`,onClick:n[10]||=As(()=>{},[`stop`])},[R(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New agent in ${m.value}`,title:`New agent in this session`,onClick:n[7]||=e=>r(`action`,`new-agent`)},[z(A(Xc),{size:16})],8,yf),R(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename session ${m.value}`,title:`Rename session`,onClick:n[8]||=e=>r(`action`,`rename`)},[z(A(qc),{size:16})],8,bf),R(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Archive session ${m.value}`,title:`Archive session`,onClick:n[9]||=e=>r(`action`,`archive`)},[z(A(Ws),{size:16})],8,xf)])],64)):s.value?(F(),I(P,{key:4},[s.value.kind===`fork`?(F(),L(A(Cc),{key:0,class:`ico`,size:16})):s.value.kind===`subagent`?(F(),L(A(lc),{key:1,class:`ico`,size:16})):(F(),L(A(Lc),{key:2,class:`ico root`,size:16})),R(`span`,Sf,D(m.value),1),s.value.kind===`fork`&&s.value.forkedAt!==void 0?(F(),I(`span`,Cf,`@ #`+D(s.value.forkedAt),1)):V(``,!0),l.value?(F(),I(`i`,wf)):V(``,!0),c.value?(F(),I(`span`,{key:5,class:`bg-count`,title:`${c.value} background task(s)`},[n[15]||=R(`i`,{class:`dot bg`},null,-1),B(D(c.value),1)],8,Tf)):V(``,!0),R(`span`,{class:`acts`,onClick:n[12]||=As(()=>{},[`stop`])},[R(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename agent ${m.value}`,title:`Rename agent`,onClick:n[11]||=e=>r(`action`,`rename`)},[z(A(qc),{size:16})],8,Ef)])],64)):V(``,!0)],14,rf))}}),[[`__scopeId`,`data-v-f2a70cbb`]]),Of={class:`project-bar`,"aria-label":`Projects`},kf={class:`project-head`},Af={class:`project-title`},jf=[`aria-label`,`title`],Mf={key:0,class:`project-hint`},Nf={key:0,class:`chips`},Pf=[`title`,`onClick`,`onDblclick`],Ff={class:`chip-name`},If={class:`chip-count`},Lf={key:1,class:`project-hint`},Rf={key:2,class:`project-actions`},zf=[`onClick`],Bf=[`onClick`],Vf=[`onClick`],Hf={key:3,class:`message-error`},Uf={key:4,class:`project-hint labels-hint`},Wf=Id(Dr({__name:`ProjectBar`,props:{active:{},activeModifiers:{}},emits:[`update:active`],setup(e,{expose:t}){let n=Oi(e,`active`),r=k([]),i=k(!1),a=k(``),o=k(!1),s=H(()=>bu.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=bu.devices.value.find(e=>e.id===n),i=await W(n).projects(o.value).catch(e=>{let r=cu(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;K.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 W(e.deviceId).updateProject(t.id,{customName:n});q(`Project renamed to ${r.customName??r.name}.`),await c()}}}function p(e){let t=e.project;K.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 W(e.deviceId).updateProject(t.id,{labels:n.split(`,`).map(e=>e.trim()).filter(Boolean)});q(r.labels.length?`Labels: ${r.labels.join(`, `)}.`:`Labels cleared on ${l(r)}.`),await c()}}}function m(e){let t=e.project,r=t.archivedAt!==null;K.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=W(e.deviceId);r?await i.unarchiveProject(t.id):await h(i,t.id),!r&&u(e)&&(n.value=void 0),await c()}}}let h=(e,t)=>e.archiveProject(t);return t({reload:c}),(e,t)=>(F(),I(`div`,Of,[R(`div`,kf,[R(`span`,Af,[z(A(vc),{size:13}),t[2]||=B(`PROJECTS`,-1)]),R(`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},[z(A(Ws),{size:12})],10,jf),i.value?(F(),I(`span`,Mf,`…`)):V(``,!0)]),r.value.length?(F(),I(`div`,Nf,[(F(!0),I(P,null,N(r.value,e=>(F(),I(`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`?(F(),L(A(bc),{key:0,size:11})):(F(),L(A(vc),{key:1,size:11})),R(`span`,Ff,D(l(e.project)),1),R(`em`,If,D(e.sessions),1),(F(!0),I(P,null,N(e.project.labels.slice(0,2),e=>(F(),I(`span`,{key:e,class:`chip-label`},D(e),1))),128))],42,Pf))),128))])):i.value?V(``,!0):(F(),I(`p`,Lf,` No projects yet — a project appears when a session starts in a folder. `)),n.value?(F(),I(`div`,Rf,[t[5]||=R(`span`,{class:`project-hint`},`filtering`,-1),(F(!0),I(P,null,N(r.value.filter(u),e=>(F(),I(P,{key:e.project.id},[R(`button`,{class:`small`,onClick:t=>f(e)},[z(A(qc),{size:12}),t[3]||=B(`name`,-1)],8,zf),R(`button`,{class:`small`,onClick:t=>p(e)},[z(A(ll),{size:12}),t[4]||=B(`labels`,-1)],8,Bf),R(`button`,{class:`small`,onClick:t=>m(e)},[e.project.archivedAt?(F(),L(A(Us),{key:0,size:12})):(F(),L(A(Ws),{key:1,size:12})),B(` `+D(e.project.archivedAt?`restore`:`archive`),1)],8,Vf),R(`button`,{class:`icon-button tiny`,"aria-label":`Clear project filter`,onClick:t[1]||=e=>n.value=void 0},[z(A(vl),{size:12})])],64))),128))])):V(``,!0),a.value?(F(),I(`p`,Hf,D(a.value),1)):V(``,!0),r.value.some(e=>e.project.labels.length)?(F(),I(`p`,Uf,[z(A(ll),{size:11}),B(`labels: `+D([...new Set(r.value.flatMap(e=>e.project.labels))].join(` · `)),1)])):V(``,!0)]))}}),[[`__scopeId`,`data-v-bc3704b7`]]),Gf={class:`tree-head`},Kf=[`aria-label`,`title`],qf=[`title`],Jf={class:`tree-search`},Yf={key:1,class:`searching`,"aria-label":`Searching devices`},Xf={key:0,class:`bulk-bar`},Zf=[`disabled`],Qf=[`disabled`],$f={class:`hit-head hint`},ep=[`title`,`onClick`],tp={class:`hit-name`},np={class:`hit-cwd`},rp={key:0,class:`hit-where`},ip={key:2,class:`hint tree-empty`},ap={key:3,class:`hint tree-empty`,"data-testid":`tree-empty`},op={key:1,class:`panel-rail`,"aria-label":`Network (collapsed)`},sp=[`title`],cp=[`title`,`aria-label`,`onClick`],lp=Id(Dr({__name:`NetworkSidebar`,setup(e){let t=H(()=>{let e=[],t=(n,r,i)=>{for(let a of n)e.push({node:a,depth:r,parent:i}),a.children.length&&Cu.value.has(a.key)&&t(a.children,r+1,a.key)};return t(bu.tree.value,0),e}),n=k(),r=k(),i=k(``),a=k([]),o=k(!1),s=H(()=>i.value.trim().toLowerCase()),c=H(()=>s.value.length>=2),l=H(()=>{let e=new Set;if(!c.value)return e;for(let t of bu.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=H(()=>{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=bu.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=H(()=>a.value.filter(e=>!t.value.some(t=>t.node.type===`session`&&t.node.session.id===e.id))),m;M(i,e=>{clearTimeout(m);let t=e.trim();if(t.length<2){a.value=[],o.value=!1;return}m=setTimeout(async()=>{o.value=!0;let e=[];for(let n of bu.devices.value.filter(e=>e.status===`online`)){let r=await W(n.id).searchSessions(t).catch(()=>void 0);for(let t of r?.matches??[])e.push({deviceId:n.id,id:t.id,name:t.name,cwd:t.cwd,where:t.where})}a.value=e,o.value=!1},250)});let h=()=>(i.value=``,a.value=[]),g=k(!1),_=k(new Set),v=k(``),y=e=>{if(e.type!==`session`)return;let t=new Set(_.value);t.has(e.session.id)?t.delete(e.session.id):t.add(e.session.id),_.value=t},b=async e=>{v.value=e;let n=0,r=[];for(let i of t.value.map(e=>e.node)){if(i.type!==`session`||!_.value.has(i.session.id))continue;let t=x(i);if(!t)continue;let a=W(t.id);try{e===`archive`?await a.session(i.session.id).archive():await a.agent(i.session.id,1).abort(!0),n++,e===`archive`&&G.value?.sessionId===i.session.id&&Lu(void 0)}catch{r.push(i.session.name)}}q(`${e}: ${n} done${r.length?`, ${r.length} failed (${r.slice(0,3).join(`, `)})`:``}`),_.value=new Set,v.value=``},x=e=>bu.devices.value.find(t=>t.id===(e.type===`device`?e.device.id:e.deviceId)),S=e=>x(e)?.status===`online`,C=e=>e.type===`agent`&&G.value?.deviceId===e.deviceId&&G.value.sessionId===e.sessionId&&G.value.agentId===e.agent.id;function ee(e){if(n.value=e.key,g.value&&e.type===`session`)return y(e);if(e.type===`device`)return Bu(e.key);if(e.type===`agent`)return Lu({deviceId:e.deviceId,sessionId:e.sessionId,agentId:e.agent.id});let t=e.session.agents.find(e=>e.kind===`root`)??e.session.agents[0];Bu(e.key,!0),t&&Lu({deviceId:e.deviceId,sessionId:e.session.id,agentId:t.id})}async function te(e,t){let n=x(e);if(!n)return;let r=W(n.id);if(e.type===`device`){t===`new-session`?K.dialog={kind:`new-session`,deviceId:n.id}:t===`check`?await ad(()=>su.check(n.id)):t===`credentials`&&(K.dialog={kind:`credentials`,deviceId:n.id});return}if(e.type===`session`){let i=e.session;if(t===`new-agent`){let e=await ad(()=>r.session(i.id).createAgent({}));e&&(Lu({deviceId:n.id,sessionId:i.id,agentId:e.id}),q(`New agent. Same session, same shared App State.`))}else t===`rename`?K.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:i.name,submit:`Save name`,run:e=>r.session(i.id).rename(e)}:t===`archive`&&(K.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(),G.value?.sessionId===i.id&&Lu(void 0)}});return}let i=e.agent;t===`rename`&&(K.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 w(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 ne(){n.value??=t.value[0]?.node.key}function re(e){let r=t.value.find(e=>e.node.key===n.value);if(e.key===`ArrowDown`)w(1);else if(e.key===`ArrowUp`)w(-1);else if(e.key===`ArrowRight`&&r){if(!r.node.children.length)return;Cu.value.has(r.node.key)?w(1):Bu(r.node.key,!0)}else if(e.key===`ArrowLeft`&&r)r.node.children.length&&Cu.value.has(r.node.key)?Bu(r.node.key,!1):r.parent&&(n.value=r.parent);else if((e.key===`Enter`||e.key===` `)&&r)ee(r.node);else return;e.preventDefault()}return(e,a)=>(F(),I(`aside`,{class:E([`network-sidebar`,{open:A(K).drawer,collapsed:!A(Tu).tree&&!A(K).drawer}]),"aria-label":`Network`},[A(Tu).tree||A(K).drawer?(F(),I(P,{key:0},[R(`header`,Gf,[R(`span`,null,[z(A(Bc),{size:16}),a[8]||=B(`NETWORK`,-1)]),R(`button`,{class:E([`icon-button`,{on:g.value}]),"aria-label":g.value?`Exit bulk select`:`Bulk manage sessions`,title:g.value?`Exit bulk select`:`Bulk manage sessions (select → archive / abort)`,onClick:a[0]||=e=>(g.value=!g.value,_.value=new Set)},[z(A(Pc),{size:15})],10,Kf),R(`button`,{class:`icon-button`,"aria-label":`Pair a device`,title:`Pair a device`,onClick:a[1]||=e=>A(K).dialog={kind:`pair`}},[z(A(Nc),{size:15})]),R(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse network`,title:`Collapse network (${A(xd).tree})`,onClick:a[2]||=e=>(A(Tu).tree=!1,A(K).drawer=!1)},[z(A(Uc),{size:18})],8,qf)]),R(`div`,Jf,[z(A(tl),{size:14,class:`search-icon`}),j(R(`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),[[bs,i.value]]),i.value?(F(),I(`button`,{key:0,class:`icon-button clear`,"aria-label":`Clear search`,onClick:h},[z(A(vl),{size:13})])):V(``,!0),o.value?(F(),I(`span`,Yf,`…`)):V(``,!0)]),z(Wf,{active:u.value,"onUpdate:active":a[4]||=e=>u.value=e},null,8,[`active`]),R(`div`,{ref_key:`list`,ref:r,class:`tree-list`,role:`tree`,tabindex:`0`,"aria-label":`Devices, sessions and agents`,onKeydown:re,onFocus:ne},[g.value&&_.value.size?(F(),I(`div`,Xf,[R(`span`,null,D(_.value.size)+` selected`,1),R(`button`,{class:`small`,disabled:!!v.value,onClick:a[5]||=e=>b(`abort`)},`abort work`,8,Zf),R(`button`,{class:`small danger`,disabled:!!v.value,onClick:a[6]||=e=>b(`archive`)},D(v.value===`archive`?`archiving…`:`archive`),9,Qf)])):V(``,!0),(F(!0),I(P,null,N(f.value,e=>(F(),L(Df,{key:e.node.key,node:e.node,depth:e.depth,open:A(Cu).has(e.node.key),selected:C(e.node),focused:n.value===e.node.key,online:S(e.node),checkbox:g.value&&e.node.type===`session`,checked:e.node.type===`session`&&_.value.has(e.node.session.id),onToggle:t=>A(Bu)(e.node.key),onActivate:t=>ee(e.node),onAction:t=>te(e.node,t),onCheck:t=>y(e.node)},null,8,[`node`,`depth`,`open`,`selected`,`focused`,`online`,`checkbox`,`checked`,`onToggle`,`onActivate`,`onAction`,`onCheck`]))),128)),c.value&&p.value.length?(F(),I(P,{key:1},[R(`div`,$f,D(p.value.length)+` more on device`,1),(F(!0),I(P,null,N(p.value,e=>(F(),I(`button`,{key:`${e.deviceId}-${e.id}`,class:`hit`,title:e.cwd,onClick:t=>A(Lu)({deviceId:e.deviceId,sessionId:e.id,agentId:1})},[R(`span`,tp,D(e.name),1),R(`code`,np,D(e.cwd),1),e.where.length?(F(),I(`em`,rp,D(e.where.join(` · `)),1)):V(``,!0)],8,ep))),128))],64)):V(``,!0),c.value&&!f.value.length&&!p.value.length?(F(),I(`p`,ip,` No session matches “`+D(i.value.trim())+`”. `,1)):V(``,!0),!t.value.length&&!c.value?(F(),I(`p`,ap,[...a[9]||=[B(` No devices yet. Declare them in `,-1),R(`code`,null,`dpi-network.yaml`,-1),B(` (start from `,-1),R(`code`,null,`dpi-network.example.yaml`,-1),B(`), then run `,-1),R(`code`,null,`just net up <id>`,-1),B(`. `,-1)]])):V(``,!0)],544)],64)):(F(),I(`div`,op,[R(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand network`,title:`Expand network (${A(xd).tree})`,onClick:a[7]||=e=>A(Tu).tree=!0},[z(A(Wc),{size:18})],8,sp),(F(!0),I(P,null,N(A(bu).devices.value,e=>(F(),I(`button`,{key:e.id,class:`rail-device`,title:`${e.id} · ${e.status}`,"aria-label":`Show ${e.id}`,onClick:t=>(A(Tu).tree=!0,A(Bu)(e.id,!0))},[z(Ud,{device:e,size:20},null,8,[`device`]),R(`i`,{class:E([`dot`,e.status===`online`?`on`:e.status===`checking`?`chk`:e.status===`offline`?`off`:`err`])},null,2)],8,cp))),128))]))],2))}}),[[`__scopeId`,`data-v-5ce92b7d`]]);function up(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var dp=up();function fp(e){dp=e}var pp={exec:()=>null};function mp(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(gp.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var hp=(()=>{try{return!0}catch{return!1}})(),gp={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|$))+/,vp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bp=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Sp=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Cp=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wp=mp(Cp).replace(/bull/g,Sp).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(),Tp=mp(Cp).replace(/bull/g,Sp).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(),Ep=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Dp=/^[^\n]+/,Op=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kp=mp(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Op).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ap=mp(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Sp).getRegex(),jp=`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`,Mp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Np=mp(`^ {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`,Mp).replace(`tag`,jp).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pp=mp(Ep).replace(`hr`,bp).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`,jp).getRegex(),Fp={blockquote:mp(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Pp).getRegex(),code:vp,def:kp,fences:yp,heading:xp,hr:bp,html:Np,lheading:wp,list:Ap,newline:_p,paragraph:Pp,table:pp,text:Dp},Ip=mp(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,bp).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`,jp).getRegex(),Lp={...Fp,lheading:Tp,table:Ip,paragraph:mp(Ep).replace(`hr`,bp).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ip).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`,jp).getRegex()},Rp={...Fp,html:mp(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Mp).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:pp,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:mp(Ep).replace(`hr`,bp).replace(`heading`,` *#{1,6} *[^
|
|
16
|
-
]`).replace(`lheading`,wp).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},zp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vp=/^( {2,}|\\)\n(?!\s*$)/,Hp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Up=/[\p{P}\p{S}]/u,Wp=/[\s\p{P}\p{S}]/u,Gp=/[^\s\p{P}\p{S}]/u,Kp=mp(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Wp).getRegex(),qp=/(?!~)[\p{P}\p{S}]/u,Jp=/(?!~)[\s\p{P}\p{S}]/u,Yp=/(?:[^\s\p{P}\p{S}]|~)/u,Xp=mp(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,hp?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Zp=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Qp=mp(Zp,`u`).replace(/punct/g,Up).getRegex(),$p=mp(Zp,`u`).replace(/punct/g,qp).getRegex(),em=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,tm=mp(em,`gu`).replace(/notPunctSpace/g,Gp).replace(/punctSpace/g,Wp).replace(/punct/g,Up).getRegex(),nm=mp(em,`gu`).replace(/notPunctSpace/g,Yp).replace(/punctSpace/g,Jp).replace(/punct/g,qp).getRegex(),rm=mp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Gp).replace(/punctSpace/g,Wp).replace(/punct/g,Up).getRegex(),im=mp(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Up).getRegex(),am=mp(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Gp).replace(/punctSpace/g,Wp).replace(/punct/g,Up).getRegex(),om=mp(/\\(punct)/,`gu`).replace(/punct/g,Up).getRegex(),sm=mp(/^<(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(),cm=mp(Mp).replace(`(?:-->|$)`,`-->`).getRegex(),lm=mp(`^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`,cm).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),um=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,dm=mp(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,um).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fm=mp(/^!?\[(label)\]\[(ref)\]/).replace(`label`,um).replace(`ref`,Op).getRegex(),pm=mp(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Op).getRegex(),mm=mp(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,fm).replace(`nolink`,pm).getRegex(),hm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,gm={_backpedal:pp,anyPunctuation:om,autolink:sm,blockSkip:Xp,br:Vp,code:Bp,del:pp,delLDelim:pp,delRDelim:pp,emStrongLDelim:Qp,emStrongRDelimAst:tm,emStrongRDelimUnd:rm,escape:zp,link:dm,nolink:pm,punctuation:Kp,reflink:fm,reflinkSearch:mm,tag:lm,text:Hp,url:pp},_m={...gm,link:mp(/^!?\[(label)\]\((.*?)\)/).replace(`label`,um).getRegex(),reflink:mp(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,um).getRegex()},vm={...gm,emStrongRDelimAst:nm,emStrongLDelim:$p,delLDelim:im,delRDelim:am,url:mp(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,hm).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:mp(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,hm).getRegex()},ym={...vm,br:mp(Vp).replace(`{2,}`,`*`).getRegex(),text:mp(vm.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},bm={normal:Fp,gfm:Lp,pedantic:Rp},xm={normal:gm,gfm:vm,breaks:ym,pedantic:_m},Sm={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Cm=e=>Sm[e];function wm(e,t){if(t){if(gp.escapeTest.test(e))return e.replace(gp.escapeReplace,Cm)}else if(gp.escapeTestNoEncode.test(e))return e.replace(gp.escapeReplaceNoEncode,Cm);return e}function Tm(e){try{e=encodeURI(e).replace(gp.percentDecode,`%`)}catch{return null}return e}function Em(e,t){let n=e.replace(gp.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(gp.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(gp.slashPipe,`|`);return n}function Dm(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 Om(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 km(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 Am(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 jm(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
17
|
-
`).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(`
|
|
18
|
-
`)}var Mm=class{options;rules;lexer;constructor(e){this.options=e||dp}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:Dm(e,`
|
|
19
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=jm(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=Dm(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:Dm(t[0],`
|
|
20
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Dm(t[0],`
|
|
21
|
-
`).split(`
|
|
22
|
-
`),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(`
|
|
23
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
24
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
25
|
-
${s}`:s,r=r?`${r}
|
|
26
|
-
${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+`
|
|
27
|
-
`+e.join(`
|
|
28
|
-
`),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+`
|
|
29
|
-
`+e.join(`
|
|
30
|
-
`),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(`
|
|
31
|
-
`);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=km(t[2].split(`
|
|
32
|
-
`,1)[0],t[1].length),l=e.split(`
|
|
33
|
-
`,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+`
|
|
34
|
-
`,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(`
|
|
35
|
-
`,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+=`
|
|
36
|
-
`+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+=`
|
|
37
|
-
`+l}u=!l.trim(),r+=p+`
|
|
38
|
-
`,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=Em(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
39
|
-
`):[],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(Em(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)===`
|
|
40
|
-
`?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=Dm(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Om(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)),Am(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 Am(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}}}},Nm=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||dp,this.options.tokenizer=this.options.tokenizer||new Mm,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:gp,block:bm.normal,inline:xm.normal};this.options.pedantic?(t.block=bm.pedantic,t.inline=xm.pedantic):this.options.gfm&&(t.block=bm.gfm,t.inline=this.options.breaks?xm.breaks:xm.gfm),this.tokenizer.rules=t}static get rules(){return{block:bm,inline:xm}}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(gp.carriageReturn,`
|
|
41
|
-
`),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(gp.tabCharGlobal,` `).replace(gp.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+=`
|
|
42
|
-
`: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(`
|
|
43
|
-
`)?``:`
|
|
44
|
-
`)+r.raw,n.text+=`
|
|
45
|
-
`+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(`
|
|
46
|
-
`)?``:`
|
|
47
|
-
`)+r.raw,n.text+=`
|
|
48
|
-
`+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(`
|
|
49
|
-
`)?``:`
|
|
50
|
-
`)+r.raw,a.text+=`
|
|
51
|
-
`+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(`
|
|
52
|
-
`)?``:`
|
|
53
|
-
`)+r.raw,n.text+=`
|
|
54
|
-
`+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}},Pm=class{options;parser;constructor(e){this.options=e||dp}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(gp.notSpaceStart)?.[0],i=e.replace(gp.endingNewline,``)+`
|
|
55
|
-
`;return r?`<pre><code class="language-`+wm(r)+`">`+(n?i:wm(i,!0))+`</code></pre>
|
|
56
|
-
`:`<pre><code>`+(n?i:wm(i,!0))+`</code></pre>
|
|
57
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
58
|
-
${this.parser.parse(e)}</blockquote>
|
|
59
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
60
|
-
`}hr(e){return`<hr>
|
|
61
|
-
`}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+`>
|
|
62
|
-
`+r+`</`+i+`>
|
|
63
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
64
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
65
|
-
`}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>
|
|
66
|
-
<thead>
|
|
67
|
-
`+t+`</thead>
|
|
68
|
-
`+r+`</table>
|
|
69
|
-
`}tablerow({text:e}){return`<tr>
|
|
70
|
-
${e}</tr>
|
|
71
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
72
|
-
`}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>${wm(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=Tm(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+wm(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=Tm(e);if(i===null)return wm(n);e=i;let a=`<img src="${e}" alt="${wm(n)}"`;return t&&(a+=` title="${wm(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:wm(e.text)}},Fm=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}},Im=class e{options;renderer;textRenderer;constructor(e){this.options=e||dp,this.options.renderer=this.options.renderer||new Pm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fm}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}},Lm=class{options;block;constructor(e){this.options=e||dp}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?Nm.lex:Nm.lexInline}provideParser(e=this.block){return e?Im.parse:Im.parseInline}},Rm=new class{defaults=up();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Im;Renderer=Pm;TextRenderer=Fm;Lexer=Nm;Tokenizer=Mm;Hooks=Lm;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 Pm(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 Mm(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 Lm;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]=Lm.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Lm.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 Nm.lex(e,t??this.defaults)}parser(e,t){return Im.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?Nm.lex:Nm.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?Im.parse:Im.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?Nm.lex:Nm.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?Im.parse:Im.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+=`
|
|
73
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+wm(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function zm(e,t){return Rm.parse(e,t)}zm.options=zm.setOptions=function(e){return Rm.setOptions(e),zm.defaults=Rm.defaults,fp(zm.defaults),zm},zm.getDefaults=up,zm.defaults=dp,zm.use=function(...e){return Rm.use(...e),zm.defaults=Rm.defaults,fp(zm.defaults),zm},zm.walkTokens=function(e,t){return Rm.walkTokens(e,t)},zm.parseInline=Rm.parseInline,zm.Parser=Im,zm.parser=Im.parse,zm.Renderer=Pm,zm.TextRenderer=Fm,zm.Lexer=Nm,zm.lexer=Nm.lex,zm.Tokenizer=Mm,zm.Hooks=Lm,zm.parse=zm,zm.options,zm.setOptions,zm.use,zm.walkTokens,zm.parseInline,Im.parse,Nm.lex;function Bm(e,t){this.v=e,this.k=t}function Vm(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 Hm(e){if(Array.isArray(e))return e}function Um(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 Wm(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
74
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gm(e,t){return Hm(e)||Um(e,t)||Km(e,t)||Wm()}function Km(e,t){if(e){if(typeof e==`string`)return Vm(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)?Vm(e,t):void 0}}function qm(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Bm;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)}qm.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},qm.prototype.next=function(e){return this._invoke(`next`,e)},qm.prototype.throw=function(e){return this._invoke(`throw`,e)},qm.prototype.return=function(e){return this._invoke(`return`,e)};var Jm=Object.entries,Ym=Object.setPrototypeOf,Xm=Object.isFrozen,Zm=Object.getPrototypeOf,Qm=Object.getOwnPropertyDescriptor,$m=Object.freeze,eh=Object.seal,th=Object.create,nh=typeof Reflect<`u`&&Reflect,rh=nh.apply,ih=nh.construct;$m||=function(e){return e},eh||=function(e){return e},rh||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ih||=function(e){return new e(...[...arguments].slice(1))};var ah=Th(Array.prototype.forEach);Array.prototype.indexOf;var oh=Th(Array.prototype.lastIndexOf),sh=Th(Array.prototype.pop),ch=Th(Array.prototype.push);Array.prototype.slice;var lh=Th(Array.prototype.splice),uh=Array.isArray,dh=Th(String.prototype.toLowerCase),fh=Th(String.prototype.toString),ph=Th(String.prototype.match),mh=Th(String.prototype.replace),hh=Th(String.prototype.indexOf),gh=Th(String.prototype.trim),_h=Th(Number.prototype.toString),vh=Th(Boolean.prototype.toString),yh=typeof BigInt>`u`?null:Th(BigInt.prototype.toString),bh=typeof Symbol>`u`?null:Th(Symbol.prototype.toString),xh=Th(Object.prototype.hasOwnProperty),Sh=Th(Object.prototype.toString),Ch=Th(RegExp.prototype.test),wh=Eh(TypeError);function Th(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return rh(e,t,n)}}function Eh(e){return function(){return ih(e,[...arguments])}}function Dh(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dh;if(Ym&&Ym(e,null),!uh(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Xm(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Oh(e){for(let t=0;t<e.length;t++)xh(e,t)||(e[t]=null);return e}function kh(e){let t=th(null);for(let r of Jm(e)){var n=Gm(r,2);let i=n[0],a=n[1];xh(e,i)&&(t[i]=uh(a)?Oh(a):a&&typeof a==`object`&&a.constructor===Object?kh(a):a)}return t}function Ah(e){switch(typeof e){case`string`:return e;case`number`:return _h(e);case`boolean`:return vh(e);case`bigint`:return yh?yh(e):`0`;case`symbol`:return bh?bh(e):`Symbol()`;case`undefined`:return Sh(e);case`function`:case`object`:{if(e===null)return Sh(e);let t=e,n=jh(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Sh(e)}return Sh(e)}default:return Sh(e)}}function jh(e,t){for(;e!==null;){let n=Qm(e,t);if(n){if(n.get)return Th(n.get);if(typeof n.value==`function`)return Th(n.value)}e=Zm(e)}function n(){return null}return n}function Mh(e){try{return Ch(e,``),!0}catch{return!1}}var Nh=$m(`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(`.`)),Ph=$m(`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(`.`)),Fh=$m([`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`]),Ih=$m([`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`]),Lh=$m(`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(`.`)),Rh=$m([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),zh=$m([`#text`]),Bh=$m(`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(`.`)),Vh=$m(`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(`.`)),Hh=$m(`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(`.`)),Uh=$m([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Wh=eh(/{{[\w\W]*|^[\w\W]*}}/g),Gh=eh(/<%[\w\W]*|^[\w\W]*%>/g),Kh=eh(/\${[\w\W]*/g),qh=eh(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jh=eh(/^aria-[\-\w]+$/),Yh=eh(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Xh=eh(/^(?:\w+script|data):/i),Zh=eh(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qh=eh(/^html$/i),$h=eh(/^[a-z][.\w]*(-[.\w]+)+$/i),eg=eh(/<[/\w!]/g),tg=eh(/<[/\w]/g),ng=eh(/<\/no(script|embed|frames)/i),rg=eh(/\/>/i),ig={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ag=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],og=$m(Dh({},ag)),sg=function(){let e={};return ah(ag,t=>{e[t]=eh(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),$m(e)}(),cg=function(){return typeof window>`u`?null:window},lg=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}},ug=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},dg=function(e,t,n,r){return xh(e,t)&&uh(e[t])?Dh(r.base?kh(r.base):{},e[t],r.transform):n},fg=function(e,t,n){let r=xh(e,t)?e[t]:void 0;return r&&typeof r==`object`?kh(r):n()};function pg(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cg(),t=e=>pg(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==ig.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=jh(d,`cloneNode`),p=jh(d,`remove`),m=jh(d,`removeAttributeNode`),h=jh(d,`nextSibling`),g=jh(d,`childNodes`),_=jh(d,`parentNode`),v=jh(d,`shadowRoot`),y=jh(d,`attributes`),b=o&&o.prototype?jh(o.prototype,`nodeType`):null,x=o&&o.prototype?jh(o.prototype,`nodeName`):null,S=o&&o.prototype?jh(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},ee=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let te,w=``,ne,re=!1,ie=0,ae=function(){if(ie>0)throw wh(`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.`)},oe=function(e){ae(),ie++;try{return te.createHTML(e)}finally{ie--}},se=function(e){ae(),ie++;try{return te.createScriptURL(e)}finally{ie--}},ce=function(){return re||=(ne=lg(u,i),!0),ne},le=n,T=le.implementation,ue=le.createNodeIterator,de=le.createDocumentFragment,fe=le.getElementsByTagName,pe=r.importNode,me=ug();t.isSupported=typeof Jm==`function`&&typeof _==`function`&&T&&T.createHTMLDocument!==void 0;let he=Wh,ge=Gh,_e=Kh,ve=qh,ye=Jh,be=Xh,E=Zh,xe=$h,Se=Yh,Ce=null,we=Dh({},[...Nh,...Ph,...Fh,...Lh,...zh]),Te=null,Ee=Dh({},[...Bh,...Vh,...Hh,...Uh]),De=Object.seal(th(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}})),Oe=null,ke=null,Ae=Object.seal(th(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),D=!0,je=!0,Me=!1,Ne=!0,Pe=!1,Fe=!0,O=!1,Ie=!1,Le=null,Re=null,ze=!1,Be=!1,Ve=!1,He=!1,Ue=!0,We=!1,Ge=`user-content-`,Ke=!0,qe=!1,Je={},Ye=null,Xe=Dh({},`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(`.`)),Ze=null,Qe=Dh({},[`audio`,`video`,`img`,`source`,`image`,`track`]),$e=null,et=Dh({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),tt=`http://www.w3.org/1998/Math/MathML`,nt=`http://www.w3.org/2000/svg`,rt=`http://www.w3.org/1999/xhtml`,it=rt,at=!1,ot=null,st=Dh({},[tt,nt,rt],fh),ct=$m([`mi`,`mo`,`mn`,`ms`,`mtext`]),lt=Dh({},ct),ut=$m([`annotation-xml`]),dt=Dh({},ut),ft=Dh({},[`title`,`style`,`font`,`a`,`script`]),pt=null,mt=[`application/xhtml+xml`,`text/html`],ht=null,gt=null,_t=n.createElement(`form`),vt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(gt&>===e)return;(!e||typeof e!=`object`)&&(e={}),e=kh(e),pt=mt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,ht=pt===`application/xhtml+xml`?fh:dh,Ce=dg(e,`ALLOWED_TAGS`,we,{transform:ht}),Te=dg(e,`ALLOWED_ATTR`,Ee,{transform:ht}),ot=dg(e,`ALLOWED_NAMESPACES`,st,{transform:fh}),$e=dg(e,`ADD_URI_SAFE_ATTR`,et,{transform:ht,base:et}),Ze=dg(e,`ADD_DATA_URI_TAGS`,Qe,{transform:ht,base:Qe}),Ye=dg(e,`FORBID_CONTENTS`,Xe,{transform:ht}),Oe=dg(e,`FORBID_TAGS`,kh({}),{transform:ht}),ke=dg(e,`FORBID_ATTR`,kh({}),{transform:ht}),Je=xh(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?kh(e.USE_PROFILES):e.USE_PROFILES:!1,D=e.ALLOW_ARIA_ATTR!==!1,je=e.ALLOW_DATA_ATTR!==!1,Me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Pe=e.SAFE_FOR_TEMPLATES||!1,Fe=e.SAFE_FOR_XML!==!1,O=e.WHOLE_DOCUMENT||!1,Be=e.RETURN_DOM||!1,Ve=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,Ue=e.SANITIZE_DOM!==!1,We=e.SANITIZE_NAMED_PROPS||!1,Ke=e.KEEP_CONTENT!==!1,qe=e.IN_PLACE||!1,Se=Mh(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Yh,it=typeof e.NAMESPACE==`string`?e.NAMESPACE:rt,lt=fg(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Dh({},ct)),dt=fg(e,`HTML_INTEGRATION_POINTS`,()=>Dh({},ut));let t=fg(e,`CUSTOM_ELEMENT_HANDLING`,()=>th(null));if(De=th(null),xh(t,`tagNameCheck`)&&vt(t.tagNameCheck)&&(De.tagNameCheck=t.tagNameCheck),xh(t,`attributeNameCheck`)&&vt(t.attributeNameCheck)&&(De.attributeNameCheck=t.attributeNameCheck),xh(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(De.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),eh(De),Pe&&(je=!1),Ve&&(Be=!0),Je&&(Ce=Dh({},zh),Te=th(null),Je.html===!0&&(Dh(Ce,Nh),Dh(Te,Bh)),Je.svg===!0&&(Dh(Ce,Ph),Dh(Te,Vh),Dh(Te,Uh)),Je.svgFilters===!0&&(Dh(Ce,Fh),Dh(Te,Vh),Dh(Te,Uh)),Je.mathMl===!0&&(Dh(Ce,Lh),Dh(Te,Hh),Dh(Te,Uh))),Ae.tagCheck=null,Ae.attributeCheck=null,xh(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Ae.tagCheck=e.ADD_TAGS:uh(e.ADD_TAGS)&&(Ce===we&&(Ce=kh(Ce)),Dh(Ce,e.ADD_TAGS,ht))),xh(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Ae.attributeCheck=e.ADD_ATTR:uh(e.ADD_ATTR)&&(Te===Ee&&(Te=kh(Te)),Dh(Te,e.ADD_ATTR,ht))),xh(e,`ADD_FORBID_CONTENTS`)&&uh(e.ADD_FORBID_CONTENTS)&&(Ye===Xe&&(Ye=kh(Ye)),Dh(Ye,e.ADD_FORBID_CONTENTS,ht)),Ke&&(Ce[`#text`]=!0),O&&Dh(Ce,[`html`,`head`,`body`]),Ce.table&&(Dh(Ce,[`tbody`]),delete Oe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw wh(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw wh(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=te;te=e.TRUSTED_TYPES_POLICY;try{w=oe(``)}catch(e){throw te=t,e}}else e.TRUSTED_TYPES_POLICY===null?(te=void 0,w=``):(te===void 0&&(te=ce()),te&&typeof w==`string`&&(w=oe(``)));$m&&$m(e),gt=e},bt=Dh({},[...Ph,...Fh,...Ih]),xt=Dh({},[...Lh,...Rh]),St=function(e,t,n){return t.namespaceURI===rt?e===`svg`:t.namespaceURI===tt?e===`svg`&&(n===`annotation-xml`||lt[n]):!!bt[e]},Ct=function(e,t,n){return t.namespaceURI===rt?e===`math`:t.namespaceURI===nt?e===`math`&&dt[n]:!!xt[e]},wt=function(e,t,n){return t.namespaceURI===nt&&!dt[n]||t.namespaceURI===tt&&!lt[n]?!1:!xt[e]&&(ft[e]||!bt[e])},Tt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:it,tagName:`template`});let n=dh(e.tagName),r=dh(t.tagName);return ot[e.namespaceURI]?e.namespaceURI===nt?St(n,t,r):e.namespaceURI===tt?Ct(n,t,r):e.namespaceURI===rt?wt(n,t,r):!!(pt===`application/xhtml+xml`&&ot[e.namespaceURI]):!1},Et=function(e){ch(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw wh(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Dt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Ot=function(e){jt(e);let t=g(e);if(t){let e=[];ah(t,t=>{ch(e,t)}),ah(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Dt(e,r,i)}},kt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ch(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(Be||Ve)try{Et(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},At=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`||Te[ht(i)]||Dt(e,r,i)}},jt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===ig.element&&At(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Mt=function(e,t){return Fe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Nt=function(e){if(!Fe)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===ig.processingInstruction||n===ig.comment&&Ch(tg,e.data)){try{p(e)}catch{}continue}if(n===ig.element){let t=e,n=ht(ee(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Mt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Pt=function(e){let t=null,r=null;if(ze)e=`<remove></remove>`+e;else{let t=ph(e,/^[\r\n\t ]+/);r=t&&t[0]}pt===`application/xhtml+xml`&&it===rt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=te?oe(e):e;if(it===rt)try{t=new l().parseFromString(i,pt)}catch{}if(!t||!t.documentElement){t=T.createDocument(it,`template`,null);try{t.documentElement.innerHTML=at?w:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),it===rt?fe.call(t,O?`html`:`body`)[0]:O?t.documentElement:a},Ft=function(e){let t=S?S(e):e.ownerDocument;return ue.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(e){return e=mh(e,he,` `),e=mh(e,ge,` `),e=mh(e,_e,` `),e},Lt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ue.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=It(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&ah(i,e=>{zt(e.content)&&Lt(e.content)})},Rt=function(e){let t=x?x(e):null;return typeof t!=`string`||ht(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)===ig.documentFragment}catch{return!1}},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Vt(e,n,r){e.length!==0&&ah(e,e=>{e.call(t,n,r,gt)})}let Ht=function(e,t){return!!(Fe&&e.hasChildNodes()&&!Bt(e.firstElementChild)&&Ch(eg,e.textContent)&&Ch(eg,e.innerHTML)||Fe&&e.namespaceURI===rt&&og[t]&&(Bt(e.firstElementChild)||typeof e.textContent==`string`&&Ch(sg[t],e.textContent))||e.nodeType===ig.processingInstruction||Fe&&e.nodeType===ig.comment&&Ch(tg,e.data))},Ut=function(e,t){return e instanceof RegExp?Ch(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Wt=function(e,t,n){if(!Oe[t]&&Xt(t)&&Ut(De.tagNameCheck,t))return!1;if(Ke&&!Ye[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 Et(e),!0},Gt=function(e,t,n,r){return e.length===0?t:t===n||t===r?kh(t):t},Kt=function(e,t){return e===t||_(e)!==null?!1:(qe&&jt(e),!0)},qt=function(e,n){if(Vt(me.beforeSanitizeElements,e,null),Kt(e,n))return!0;if(Rt(e))return Et(e),!0;let r=ht(ee(e));if(Ce=Gt(me.uponSanitizeElement,Ce,we,Le),Vt(me.uponSanitizeElement,e,{tagName:r,allowedTags:Ce}),Kt(e,n))return!0;if(Ht(e,r))return Et(e),!0;if(Oe[r]||!(Ae.tagCheck instanceof Function&&Ae.tagCheck(r))&&!Ce[r]){let t=Wt(e,r,n);return t===!1&&(Vt(me.afterSanitizeElements,e,null),Kt(e,n))?!0:t}if(C(e)===ig.element&&!Tt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Ch(ng,e.innerHTML))return Et(e),!0;if(Pe&&e.nodeType===ig.text){let n=It(e.textContent);e.textContent!==n&&(ch(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Vt(me.afterSanitizeElements,e,null),Kt(e,n)},Jt=function(e,t,r){if(ke[t]||Mt(t,e)||Ue&&(t===`id`||t===`name`)&&(r in n||r in _t))return!1;let i=Te[t]||Ae.attributeCheck instanceof Function&&Ae.attributeCheck(t,e);return je&&Ch(ve,t)||D&&Ch(ye,t)?!0:i?$e[t]||Ch(Se,mh(r,E,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&hh(r,`data:`)===0&&Ze[e]||Me&&!Ch(be,mh(r,E,``))?!0:!r:Xt(e)&&Ut(De.tagNameCheck,e)&&Ut(De.attributeNameCheck,t,e)||t===`is`&&De.allowCustomizedBuiltInElements&&Ut(De.tagNameCheck,r)},Yt=Dh({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Xt=function(e){return!Yt[dh(e)]&&Ch(xe,e)},Zt=function(e,t,n,r){if(te&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return oe(r);case`TrustedScriptURL`:return se(r)}return r},Qt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Rt(e)||(Et(e),!1)}catch{return kt(t,e),!1}},$t=function(e,n){if(Vt(me.beforeSanitizeAttributes,e,null),Kt(e,n))return;let r=e.attributes;if(!r||Rt(e))return;Te=Gt(me.uponSanitizeAttribute,Te,Ee,Re);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0},a=r.length,o=ht(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=ht(s),d=l,f=s===`value`?d:gh(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Vt(me.uponSanitizeAttribute,e,i),f=i.attrValue,We&&(u===`id`||u===`name`)&&hh(f,Ge)!==0&&(kt(s,e,n),f=Ge+f,p=!0),Fe&&Ch(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){kt(s,e,n);continue}if(u===`attributename`&&ph(f,`href`)){kt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){kt(s,e,n);continue}if(!Ne&&Ch(rg,f)){kt(s,e,n);continue}if(Pe&&(f=It(f)),!Jt(o,u,f)){kt(s,e,n);continue}f=Zt(o,u,c,f),f!==d&&Qt(e,s,c,f)&&p&&sh(t.removed)}}Vt(me.afterSanitizeAttributes,e,null),Kt(e,n)},en=function(e){let t=null,n=Ft(e);for(Vt(me.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Vt(me.uponSanitizeShadowNode,t,null),qt(t,e),$t(t,e),zt(t.content)&&en(t.content),C(t)===ig.element){let e=v(t);zt(e)&&(tn(e),en(e))}Vt(me.afterSanitizeShadowDOM,e,null)},tn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){en(e.shadow);continue}let n=e.node,r=C(n)===ig.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`&&ht(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(at=!e,at&&(e=`<!-->`),typeof e!=`string`&&!Bt(e)&&(e=Ah(e),typeof e!=`string`))throw wh(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ie?(Ce=Le,Te=Re):yt(n),(me.uponSanitizeElement.length>0||me.uponSanitizeAttribute.length>0)&&(Ce=kh(Ce)),me.uponSanitizeAttribute.length>0&&(Te=kh(Te)),t.removed=[];let c=qe&&typeof e!=`string`&&Bt(e);if(c){Nt(e);let t=ee(e);if(typeof t==`string`){let n=ht(t);if(!Ce[n]||Oe[n])throw Ot(e),wh(`root node is forbidden and cannot be sanitized in-place`)}if(Rt(e))throw Ot(e),wh(`root node is clobbered and cannot be sanitized in-place`);try{tn(e)}catch(t){throw Ot(e),t}}else if(Bt(e))i=Pt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===ig.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),tn(i);else{if(!Be&&!Pe&&!O&&e.indexOf(`<`)===-1)return te&&He?oe(e):e;if(i=Pt(e),!i)return Be?null:He?w:``}i&&ze&&Et(i.firstChild);let l=c?e:i;try{let e=Ft(l);for(;o=e.nextNode();)qt(o,l),$t(o,l),zt(o.content)&&en(o.content)}catch(n){throw c&&(Ot(e),ah(t.removed,e=>{e.element&&jt(e.element)})),n}if(c){let n=!1;if(ah(t.removed,t=>{t.element&&(t.element===e&&(n=!0),jt(t.element))}),n)throw wh(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Pe&&Lt(e),e}if(Be){if(Pe&&Lt(i),Ve)for(s=de.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Te.shadowroot||Te.shadowrootmode)&&(s=pe.call(r,s,!0)),s}let u=O?i.outerHTML:i.innerHTML;return O&&Ce[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Ch(Qh,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
75
|
-
`+u),Pe&&(u=It(u)),te&&He?oe(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yt(e),Ie=!0,Le=Ce,Re=Te},t.clearConfig=function(){gt=null,Ie=!1,Le=null,Re=null,te=ne,w=``},t.isValidAttribute=function(e,t,n){gt||yt({});let r=ht(e),i=ht(t);return Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&xh(me,e)&&ch(me[e],t)},t.removeHook=function(e,t){if(xh(me,e)){if(t!==void 0){let n=oh(me[e],t);return n===-1?void 0:lh(me[e],n,1)[0]}return sh(me[e])}},t.removeHooks=function(e){xh(me,e)&&(me[e]=[])},t.removeAllHooks=function(){me=ug()},t}var mg=pg();function hg(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 gg=`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(`.`),_g=[`form`,`style`,`script`,`button`,`select`,`textarea`,`iframe`,`object`,`embed`,`svg`,`math`],vg={a:[`href`,`title`],img:[`src`,`alt`,`title`],th:[`colspan`,`rowspan`,`align`],td:[`colspan`,`rowspan`,`align`],ol:[`start`],code:[`class`],input:[`type`,`checked`,`disabled`]},yg=[...new Set(Object.values(vg).flat())],bg=/^language-[\w-]+$/,xg=/^\d{1,4}$/,Sg=/^(left|right|center)$/i;function Cg(e,t,n){if(!Object.hasOwn(vg,e)||!vg[e].includes(t))return!1;switch(t){case`class`:return bg.test(n);case`type`:return n.toLowerCase()===`checkbox`;case`colspan`:case`rowspan`:case`start`:return xg.test(n);case`align`:return Sg.test(n);default:return!0}}var wg=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/i,Tg=/^\/api(\/|$)/i;function Eg(e,t){if(wg.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&&!Tg.test(n.pathname)}mg.isSupported&&mg.addHook(`afterSanitizeAttributes`,e=>{let t=e.nodeName.toLowerCase();for(let{name:n,value:r}of Array.from(e.attributes))Cg(t,n,r)||e.removeAttribute(n);if(t===`img`&&!Eg(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:hg(n,location.origin);r?(e.setAttribute(`href`,r),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):(e.removeAttribute(`href`),e.removeAttribute(`target`))});var Dg={ALLOWED_TAGS:gg,ALLOWED_ATTR:yg,FORBID_TAGS:_g,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1},Og=new Map;function kg(e){let t=Og.get(e);return t===void 0&&(t=mg.sanitize(zm.parse(e,{async:!1}),Dg),Og.size>400&&Og.delete(Og.keys().next().value),Og.set(e,t)),t}var Ag=`demo.job-runs`,jg=e=>e.status!==`running`&&e.status!==`waiting`,Mg=H(()=>Ou.value?.info?.jobs??[]),Ng=e=>Mg.value.find(t=>t.id===e),Pg=H(()=>{let e=Gu.value.docs[Ag];return Object.values(e?.items??{}).sort((e,t)=>t.id-e.id)}),Fg=e=>Pg.value.find(t=>t.id===e),Ig=e=>Pg.value.find(t=>t.toolCallId===e),Lg=k(Date.now());setInterval(()=>Lg.value=Date.now(),1e3);var Rg=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`,zg=k();async function Bg(e,t){if(!zg.value){zg.value=e;try{return await ad(t)}finally{zg.value=void 0}}}function Vg(e){md.value&&_d(),setTimeout(()=>document.querySelector(`[data-job-run="${e}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function Hg(e){let t=await Bg(`start:${e.id}`,()=>Fu.value.demo(`jobs`,{job:e.id}));t&&(q(`${e.title} started. It runs in the chat.`),Vg(t.taskId))}var Ug=(e,t)=>Bg(`decide:${e.id}`,()=>Fu.value.demo(`jobs/${e.id}/approval`,{approved:t})),Wg=e=>Bg(`stop:${e.id}`,()=>Iu.value.abortTask(e.id));function Gg(e){G.value&&Lu({...G.value,agentId:e})}var Kg=[`data-job-run`,`aria-label`],qg={class:`job-run-head`},Jg={class:`job-run-icon`},Yg={class:`job-run-titles`},Xg={class:`job-run-eyebrow`},Zg={class:`job-run-repeat`},Qg={key:0,class:`job-run-about`},$g={class:`job-run-meta`},e_={key:0,class:`job-run-resumed`},t_={class:`job-stepper`,"aria-label":`Phases`},n_=[`aria-current`],r_={class:`job-chip`},i_={class:`job-step-dot`},a_={class:`job-step-label`},o_={key:0,class:`job-step-progress`},s_={class:`job-phases`},c_=[`open`],l_={class:`job-phase-n`},u_={class:`job-phase-summary`},d_={class:`job-phase-time`},f_={key:0,class:`job-phase-about`},p_={key:1,class:`job-steps`},m_=[`open`],h_={key:1,class:`job-step-line`},g_=[`onClick`],__={key:2,class:`job-phase-empty`},v_={key:1,class:`job-approval`,role:`group`,"aria-label":`Approval`},y_={class:`job-approval-buttons`},b_=[`disabled`],x_=[`disabled`],S_={key:2,class:`message-error`},C_={class:`job-run-foot`},w_=[`disabled`],T_=Dr({__name:`JobCard`,props:{run:{}},setup(e){let t=e,n=H(()=>Ng(t.run.job)),r=H(()=>jg(t.run)),i=H(()=>Rg((t.run.endedAt??Lg.value)-t.run.startedAt)),a={running:`Running`,waiting:`Waiting for you`,completed:`Completed`,failed:`Failed`,aborted:`Stopped`,declined:`Declined`},o={command:ul,tool:_l,agent:Qs,state:$s,approval:al,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)?ao(`code`,{title:s(t)},t.label):ao(`span`,{class:`job-step-text`},t.label),r=t.status===`running`?ao(Fc,{size:15,class:`spin`}):t.status===`done`?ao(nc,{size:15}):t.status===`waiting`?ao(Tc,{size:15}):ao(vl,{size:15});return[ao(o[t.kind],{size:16,class:`job-step-kind`}),n,t.kind===`tool`&&t.detail?ao(`span`,{class:`job-step-args`,title:t.detail},t.detail):null,ao(`span`,{class:`job-step-state`},[r,t.ms!==void 0&&t.kind!==`note`?ao(`span`,Rg(t.ms)):null])]};c.props=[`step`];let l=e=>n.value?.phases.find(t=>t.id===e),u=e=>e.startedAt?Rg((e.endedAt??(e.status===`running`||e.status===`waiting`?Lg.value:e.startedAt))-e.startedAt):``,d=e=>e.status!==`pending`&&e.status!==`skipped`,f=H(()=>Object.entries(t.run.input)),p=H(()=>t.run.phases.find(e=>e.status===`waiting`));return(t,o)=>(F(),I(`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]}`},[R(`header`,qg,[R(`span`,Jg,[z(A(gl),{size:22})]),R(`div`,Yg,[R(`div`,Xg,[o[3]||=R(`span`,null,`DURABLE JOB`,-1),R(`span`,Zg,[z(A(el),{size:15}),B(`Repeatable workflow, run #`+D(e.run.run),1)])]),R(`h3`,null,D(e.run.title),1)]),R(`span`,{class:E([`job-run-status`,e.run.status])},[o[4]||=R(`i`,null,null,-1),B(D(a[e.run.status]),1)],2)]),n.value?(F(),I(`p`,Qg,D(n.value.summary),1)):V(``,!0),R(`div`,$g,[R(`span`,null,`task #`+D(e.run.id),1),R(`span`,null,D(e.run.startedBy===`agent`?`started by the agent`:`started by you`),1),R(`span`,null,D(i.value),1),(F(!0),I(P,null,N(f.value,([e,t])=>(F(),I(`span`,{key:e,class:`job-run-input`},D(e)+`=`+D(t),1))),128)),e.run.resumed?(F(),I(`span`,e_,`resumed `+D(e.run.resumed)+`× after restart`,1)):V(``,!0)]),R(`ol`,t_,[(F(!0),I(P,null,N(e.run.phases,(t,n)=>(F(),I(`li`,{key:t.id,class:E(`ph-${t.status}`),"aria-current":e.run.phase===t.id&&!r.value?`step`:void 0},[R(`span`,r_,[R(`span`,i_,[t.status===`done`?(F(),L(A(nc),{key:0,size:15})):t.status===`running`?(F(),L(A(Fc),{key:1,size:15,class:`spin`})):t.status===`waiting`?(F(),L(A(Tc),{key:2,size:15})):[`failed`,`aborted`].includes(t.status)?(F(),L(A(vl),{key:3,size:15})):(F(),I(P,{key:4},[B(D(n+1),1)],64))]),R(`span`,a_,D(t.label),1),t.progress?(F(),I(`span`,o_,D(t.progress.done)+`/`+D(t.progress.total),1)):V(``,!0)])],10,n_))),128))]),R(`div`,s_,[(F(!0),I(P,null,N(e.run.phases,(e,t)=>(F(),I(`details`,{key:e.id,class:E([`job-phase`,`ph-${e.status}`]),open:d(e)},[R(`summary`,null,[R(`span`,l_,D(t+1),1),R(`strong`,null,D(e.label),1),R(`span`,u_,D(e.summary??(e.status===`pending`?l(e.id)?.summary:e.status===`skipped`?`Skipped`:``)),1),R(`span`,d_,D(u(e)),1)]),e.status===`done`?V(``,!0):(F(),I(`p`,f_,D(l(e.id)?.summary),1)),e.steps.length?(F(),I(`ul`,p_,[(F(!0),I(P,null,N(e.steps,e=>(F(),I(`li`,{key:e.id,class:E([`k-${e.kind}`,`st-${e.status}`])},[e.detail&&e.kind!==`tool`?(F(),I(`details`,{key:0,open:e.status===`error`},[R(`summary`,null,[z(c,{step:e},null,8,[`step`])]),R(`pre`,null,D(e.detail),1)],8,m_)):(F(),I(`div`,h_,[z(c,{step:e},null,8,[`step`])])),e.kind===`agent`&&e.conversationId?(F(),I(`button`,{key:2,class:`text-button job-step-link`,onClick:t=>A(Gg)(e.conversationId)},` Open subagent #`+D(e.conversationId),9,g_)):V(``,!0)],2))),128))])):e.status===`pending`?(F(),I(`p`,__,`Not started yet.`)):V(``,!0)],10,c_))),128))]),e.run.approval===`pending`?(F(),I(`div`,v_,[R(`div`,null,[z(A(al),{size:20}),o[5]||=R(`strong`,null,`Approve to continue`,-1)]),R(`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),R(`div`,y_,[R(`button`,{class:`primary small`,disabled:!!A(zg),onClick:o[0]||=t=>A(Ug)(e.run,!0)},[z(A(nc),{size:18}),o[6]||=B(`Approve & continue `,-1)],8,b_),R(`button`,{class:`secondary`,disabled:!!A(zg),onClick:o[1]||=t=>A(Ug)(e.run,!1)},`Decline`,8,x_)])])):V(``,!0),e.run.error&&e.run.status!==`aborted`?(F(),I(`p`,S_,D(e.run.error),1)):V(``,!0),R(`footer`,C_,[R(`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?V(``,!0):(F(),I(`button`,{key:0,class:`secondary danger`,disabled:!!A(zg),onClick:o[2]||=t=>A(Wg)(e.run)},[z(A(Vc),{size:16}),o[7]||=B(`Stop `,-1)],8,w_))])],10,Kg))}}),E_={class:`message-label`},D_={class:`user-message`},O_={class:`message-label`},k_={key:0,class:`streaming`},A_={key:1},j_=[`aria-label`],M_=[`innerHTML`],N_={key:1,class:`thinking`},P_=[`data-call-id`],F_={class:`tool-status`},I_={class:`tool-section-label`},L_=[`aria-label`,`onClick`],R_={key:0,class:`typing`},z_={key:1,class:`message-error`},B_=[`aria-label`],V_={key:3,class:`live-tool`},H_={key:0},U_={class:`event-line`},W_=[`aria-label`],G_={key:0,class:`raw`},K_=Dr({__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)=>(F(),I(`article`,{class:E([`entry`,i(e.item)])},[e.item.kind===`user`?(F(),I(P,{key:0},[R(`div`,E_,[a[3]||=B(` YOU `,-1),R(`span`,null,`#`+D(e.item.id),1)]),R(`div`,D_,D(e.item.text),1)],64)):e.item.kind===`assistant`?(F(),I(P,{key:1},[R(`div`,O_,[a[5]||=B(` AGENT `,-1),e.item.streaming?(F(),I(`span`,k_,`Working`)):(F(),I(`span`,A_,`#`+D(e.item.id),1)),e.item.streaming?V(``,!0):(F(),I(`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)},[z(A(Cc),{size:18}),a[4]||=B(`Fork `,-1)],8,j_))]),(F(!0),I(P,null,N(e.item.blocks,(e,t)=>(F(),I(P,{key:t},[e.type===`text`?(F(),I(`div`,{key:0,class:`markdown`,innerHTML:A(kg)(e.text)},null,8,M_)):e.type===`thinking`?(F(),I(`details`,N_,[a[6]||=R(`summary`,null,`Thinking`,-1),R(`div`,null,D(e.text),1)])):(F(),I(`details`,{key:2,class:E([`tool-call`,{failed:e.call.status===`error`}]),"data-call-id":e.call.callId},[R(`summary`,null,[e.call.status===`error`?(F(),L(A(Oc),{key:0,size:18})):e.call.status===`done`?(F(),L(A(nc),{key:1,size:18})):e.call.status===`running`?(F(),L(A(Hs),{key:2,size:18})):(F(),L(A(_l),{key:3,size:18})),R(`strong`,null,D(e.call.name),1),R(`code`,null,D(A(cd)(e.call.args)?.slice(0,90)),1),R(`span`,F_,D(r(e.call)),1)]),a[10]||=R(`div`,{class:`tool-section-label`},`Input`,-1),R(`pre`,null,D(A(cd)(e.call.args)),1),e.call.result===void 0?e.call.output?(F(),I(P,{key:1},[a[9]||=R(`div`,{class:`tool-section-label`},`Live output`,-1),R(`pre`,null,D(e.call.output),1)],64)):V(``,!0):(F(),I(P,{key:0},[R(`div`,I_,[a[8]||=R(`span`,null,`Result`,-1),e.call.resultEntryId===void 0?V(``,!0):(F(),I(`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)},[z(A(Cc),{size:18}),a[7]||=B(`Fork `,-1)],8,L_))]),R(`pre`,null,D(e.call.result),1)],64))],10,P_)),e.type===`tool`&&e.call.name===`run_durable_job`&&A(Ig)(e.call.callId)?(F(),L(T_,{key:3,run:A(Ig)(e.call.callId)},null,8,[`run`])):V(``,!0)],64))),128)),e.item.streaming&&!e.item.blocks.length?(F(),I(`div`,R_,[...a[11]||=[R(`i`,null,null,-1),R(`i`,null,null,-1),R(`i`,null,null,-1)]])):V(``,!0),e.item.error?(F(),I(`div`,z_,D(e.item.error),1)):V(``,!0)],64)):e.item.kind===`tool-result`?(F(),I(`details`,{key:2,class:E([`tool-result`,{failed:e.item.isError}])},[R(`summary`,null,[e.item.isError?(F(),L(A(Oc),{key:1,size:18})):(F(),L(A(nc),{key:0,size:18})),R(`strong`,null,D(e.item.name),1),R(`span`,null,D(e.item.isError?`error`:`result`),1),R(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[1]||=As(t=>n(`fork`,e.item.id),[`prevent`])},[z(A(Cc),{size:18}),a[12]||=B(`Fork `,-1)],8,B_)]),R(`pre`,null,D(e.item.text),1)],2)):e.item.kind===`tool`?(F(),I(`div`,V_,[R(`div`,null,[z(A(Hs),{size:18}),R(`strong`,null,D(e.item.call.name),1),R(`span`,null,D(e.item.call.status),1)]),e.item.call.output?(F(),I(`pre`,H_,D(e.item.call.output),1)):V(``,!0),e.item.call.name===`run_durable_job`&&A(Ig)(e.item.call.callId)?(F(),L(T_,{key:1,run:A(Ig)(e.item.call.callId)},null,8,[`run`])):V(``,!0)])):e.item.entryKind===`demo.job`&&A(Fg)(e.item.data.taskId)?(F(),L(T_,{key:4,run:A(Fg)(e.item.data.taskId)},null,8,[`run`])):(F(),I(P,{key:5},[R(`div`,U_,[e.item.entryKind===`demo.state-change`?(F(),L(A($s),{key:0,size:18})):(F(),L(A(jc),{key:1,size:18})),R(`span`,null,D(e.item.text),1),R(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[2]||=t=>n(`fork`,e.item.id)},[z(A(Cc),{size:18}),a[13]||=B(`Fork `,-1)],8,W_)]),e.item.note?(F(),I(`details`,G_,[a[14]||=R(`summary`,null,`Context note`,-1),R(`pre`,null,D(e.item.note),1)])):V(``,!0)],64))],2))}}),q_={key:0,class:`git-chip-wrap`},J_=[`title`],Y_={class:`branch`},X_={key:0,class:`dirty`},Z_={key:1,class:`ahead`},Q_={key:2,class:`behind`},$_=Id(Dr({__name:`GitChip`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=H(()=>t.cwd??Nu.value?.cwd??``),r=H(()=>t.deviceId??Du.value),i=H(()=>Zd(r.value||`?`,n.value||`?`)),a=H(()=>i.value.status),o=H(()=>i.value.loading),s=H(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0));return $d(r.value||`?`,n.value||`?`),qr(()=>$d(r.value||`?`,n.value||`?`)),M([r,n],()=>void $d(r.value||`?`,n.value||`?`)),(e,t)=>a.value?.repo||o.value?(F(),I(`span`,q_,[R(`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(gd)(`git`)},[z(A(xc),{size:16,"aria-hidden":`true`}),R(`span`,Y_,D(a.value?.branch??a.value?.head??`…`),1),s.value?(F(),I(`span`,X_,`±`+D(s.value),1)):V(``,!0),a.value?.ahead?(F(),I(`span`,Z_,`↑`+D(a.value.ahead),1)):V(``,!0),a.value?.behind?(F(),I(`span`,Q_,`↓`+D(a.value.behind),1)):V(``,!0),z(A(rc),{size:14,"aria-hidden":`true`})],8,J_)])):V(``,!0)}}),[[`__scopeId`,`data-v-c0fb9e98`]]),ev=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,tv=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],nv={enabled:!0,reserveTokens:16384,backgroundTokens:32768,keepRecentTokens:2e3},rv={auto:2e5,wait:25e4};function iv(e){if(!(e>0))return{...nv};let t=Math.min(rv.wait,e-nv.reserveTokens),n=Math.min(rv.auto,t-nv.backgroundTokens);return{...nv,reserveTokens:e-t,backgroundTokens:t-n}}function av(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 ov=(e,t)=>{if(e===void 0)throw Error(`No ${t} selected`);return e},sv=[{name:`compact`,args:`[instructions]`,description:`Summarize older context; stored entries stay`,run:async e=>{await ov(Fu.value,`agent`).compact(e||void 0),q(`Compaction requested. /tasks shows its outcome.`)}},{name:`reset`,args:`[handoff note]`,description:`Start a fresh context; history stays stored`,run:async e=>{await ov(Fu.value,`agent`).reset(e||void 0),q(`New context started.`)}},{name:`tasks`,description:`Open the Tasks panel`,run:()=>gd(`tasks`)},{name:`new`,args:`[name]`,description:`New agent in this workspace`,run:async e=>{let t=ov(G.value,`workspace`),n=await ov(Iu.value,`workspace`).createAgent(e?{name:e}:{});Lu({...t,agentId:n.id}),q(`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??Gu.value.entries.filter(e=>e.kind===`pi.assistant`).at(-1)?.id;if(a===void 0)throw Error(`Nothing to fork yet`);let o=ov(G.value,`agent`),s=await ov(Fu.value,`agent`).fork({entryId:a,name:i||void 0});Lu({...o,agentId:s.id}),q(`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 ov(Fu.value,`agent`).rename(e),q(`Agent renamed to ${e}.`)}},{name:`model`,description:`Choose this agent's model`,run:()=>K.dialog={kind:`models`}},{name:`thinking`,args:`<level>`,description:`Thinking level: ${tv.join(`, `)}`,run:async e=>{if(!tv.includes(e))throw Error(`Levels: ${tv.join(`, `)}`);await ov(Fu.value,`agent`).configure({thinkingLevel:e}),await ed(),q(`Thinking ${e}. Used on the next turn.`)}},{name:`help`,description:`How this works, keys and commands`,run:()=>K.dialog={kind:`help`}}];function cv(e){let t=e.trim().match(/^\/(\S+)\s*([\s\S]*)$/),n=t&&sv.find(e=>e.name===t[1]);return n?{command:n,arg:t[2].trim()}:void 0}var lv={class:`composer-region`},uv={key:0,class:`queue`},dv=[`aria-label`,`onClick`],fv={class:`composer`},pv={key:0,class:`slash-menu`,role:`listbox`,"aria-label":`Slash commands`},mv=[`aria-selected`,`onMousedown`],hv={key:0,class:`slash-args`},gv={class:`slash-desc`},_v={class:`composer-toolbar`},vv={class:`composer-left`},yv={class:`lib-wrap`},bv=[`aria-label`],xv={key:0,class:`hint`},Sv={class:`save-row`},Cv=[`disabled`],wv=[`title`,`onClick`],Tv=[`aria-label`,`onClick`],Ev={class:`queue-mode`},Dv={class:`composer-right`},Ov=[`disabled`],kv=[`disabled`],Av=`dpi-prompt-library`,jv=Id(Dr({__name:`Composer`,setup(e){let t=k(`followUp`),n=k(!1),r=k(``),i=k([]),a=()=>{try{i.value=JSON.parse(localStorage.getItem(Av)??`[]`)}catch{i.value=[]}},o=()=>localStorage.setItem(Av,JSON.stringify(i.value));a();let s=()=>{let e=K.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=H(()=>ku.value&&Gu.value.ready&&ju.status.value===`live`&&yu.value===`live`),d=k(0),f=k(!1),p=H(()=>{let e=K.composer.match(/^\/(\S*)$/);return e&&!f.value?sv.filter(t=>t.name.startsWith(e[1].toLowerCase())):[]});M(()=>K.composer,()=>{d.value=0,K.composer.startsWith(`/`)||(f.value=!1)});async function m(e,t=!1){!e.args||t&&e.args.startsWith(`[`)&&K.composer===`/${e.name}`?(K.composer=`/${e.name}`,await _()):K.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=cv(e);return t?(l.value=!0,await ad(async()=>{await t.command.run(t.arg),K.composer=``}),l.value=!1,!0):!1}async function _(){let e=K.composer.trim(),n=Fu.value;if(!e||l.value||!n||!u.value||e.startsWith(`/`)&&await g(e))return;l.value=!0;let r=G.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:ev();sessionStorage.setItem(`dpi.pending-send`,JSON.stringify({key:i,content:e,mode:t.value,requestId:o})),await ad(async()=>{await n.send(e,t.value,o),sessionStorage.removeItem(`dpi.pending-send`),K.composer=``}),l.value=!1}function v(e){ad(()=>Fu.value.withdraw(e))}return(e,a)=>(F(),I(`div`,lv,[A(Gu).inbox.length?(F(),I(`div`,uv,[(F(!0),I(P,null,N(A(Gu).inbox,e=>(F(),I(`div`,{key:e.id},[z(A(sc),{size:18}),R(`span`,null,D(e.mode===`steer`?`Steer`:`Queued`)+`: `+D(e.content??`Context update`),1),R(`button`,{class:`icon-button`,"aria-label":`Withdraw submission ${e.id}`,title:`Withdraw queued input`,onClick:t=>v(e.id)},[z(A(vl),{size:18})],8,dv)]))),128))])):V(``,!0),R(`div`,fv,[p.value.length?(F(),I(`ul`,pv,[(F(!0),I(P,null,N(p.value,(e,t)=>(F(),I(`li`,{key:e.name,role:`option`,"aria-selected":t===d.value,class:E({active:t===d.value}),onMousedown:As(t=>m(e),[`prevent`])},[R(`code`,null,`/`+D(e.name),1),e.args?(F(),I(`span`,hv,D(e.args),1)):V(``,!0),R(`span`,gv,D(e.description),1)],42,mv))),128))])):V(``,!0),j(R(`textarea`,{"onUpdate:modelValue":a[0]||=e=>A(K).composer=e,rows:`2`,placeholder:`Give your agent something to do, or type / for commands…`,"aria-label":`Message your agent`,onKeydown:h},null,544),[[bs,A(K).composer]]),R(`div`,_v,[R(`div`,vv,[R(`div`,yv,[R(`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},[z(A(Mc),{size:18})],8,bv),n.value?(F(),I(`div`,{key:0,class:`lib`,onClick:a[4]||=As(()=>{},[`stop`])},[R(`header`,null,[a[7]||=R(`b`,null,`Prompts`,-1),R(`button`,{class:`icon-button`,"aria-label":`Close library`,onClick:a[2]||=e=>n.value=!1},[z(A(vl),{size:14})])]),i.value.length?V(``,!0):(F(),I(`p`,xv,`Type something below, give it a name, save it.`)),R(`div`,Sv,[j(R(`input`,{"onUpdate:modelValue":a[3]||=e=>r.value=e,placeholder:`name…`,onKeyup:Ms(s,[`enter`])},null,544),[[bs,r.value]]),R(`button`,{type:`button`,class:`small`,disabled:!A(K).composer.trim(),onClick:s},`save composer as`,8,Cv)]),R(`ul`,null,[(F(!0),I(P,null,N(i.value,e=>(F(),I(`li`,{key:e.name},[R(`button`,{type:`button`,class:`use`,title:e.text,onClick:t=>(A(K).composer=e.text,n.value=!1)},[R(`b`,null,D(e.name),1)],8,wv),R(`button`,{type:`button`,class:`icon-button`,"aria-label":`Delete ${e.name}`,onClick:t=>c(e.name)},[z(A(dl),{size:13})],8,Tv)]))),128))])])):V(``,!0)]),R(`div`,Ev,[j(R(`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]||=[R(`option`,{value:`followUp`},`Follow-up`,-1),R(`option`,{value:`steer`},`Steer`,-1),R(`option`,{value:`reject`},`Reject if busy`,-1)]],512),[[Cs,t.value]]),z(A(rc),{size:24,"aria-hidden":`true`})])]),R(`div`,Dv,[R(`button`,{class:`interrupt`,disabled:!A(Yu)||A(dd),title:`Stop foreground work and owned subagents (Escape). Background jobs continue.`,onClick:a[6]||=(...e)=>A(fd)&&A(fd)(...e)},[z(A(Vc),{size:24,class:`stop-sign`,fill:`currentColor`}),a[9]||=B(`Interrupt`,-1)],8,Ov),R(`button`,{class:`send`,"aria-label":`Send message`,disabled:!A(K).composer.trim()||l.value||!u.value,onClick:_},[z(A(Ys),{size:20})],8,kv)])])]),a[10]||=R(`div`,{class:`composer-footnote`},[R(`span`,null,[R(`i`,{class:`live-dot`}),B(`Closing this window never interrupts your agent.`)])],-1)]))}}),[[`__scopeId`,`data-v-b2af49ae`]]),Mv={class:`chat-panel`},Nv={class:`chat-header`},Pv={class:`lineage-picker`},Fv={class:`lineage-toolbar`},Iv=[`title`],Lv={class:`crumb-main`},Rv={class:`device-chip`},zv=[`title`],Bv={class:`crumb-main`},Vv={class:`crumb-name`},Hv=[`aria-current`,`title`,`onClick`],Uv={class:`crumb-kind`},Wv={class:`crumb-main`},Gv={class:`crumb-name`},Kv=[`disabled`],qv=[`aria-expanded`],Jv={key:0,class:`lineage-source`},Yv={id:`conversation-picker`,class:`conversation-picker`,role:`dialog`,"aria-label":`Choose conversation`},Xv=[`aria-label`,`aria-current`,`onClick`],Zv={class:`conversation-choice-content`},Qv={class:`choice-lineage`},$v={class:`choice-source`},ey={key:0,class:`agent-stream-status`,role:`alert`},ty=[`disabled`],ny={key:0,class:`chat-empty`},ry={key:0},iy={key:1},ay={key:0,class:`chat-empty`},oy={class:`starter-grid`},sy={key:1,class:`entry live-generation`},cy={class:`message-label`},ly={class:`streaming`},uy={key:2,class:`hint retry-note`},dy=Dr({__name:`AgentView`,setup(e){let t=k(),n=k(),r=k(!1),i=H(()=>Gu.value.items),a=H(()=>i.value.some(e=>e.kind===`assistant`&&e.streaming)),o=H(()=>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=H(()=>Ku.value.map(e=>({...e,lineage:Nl(Ku.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=H(()=>qu.value.at(-1)),u=e=>e.kind===`root`?`agent`:e.kind;function d(){G.value&&(Tu.tree=!0,Bu(G.value.deviceId,!0))}function f(){let e=Ku.value.find(e=>e.kind===`root`)??Ku.value[0];e&&p(e.id)}function p(e){r.value=!1,G.value&&Lu({...G.value,agentId:e})}function m(e){let t=Fu.value,n=G.value;t&&n&&(K.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});Lu({...n,agentId:i.id}),q(`Forked at entry #${e}. App State stays shared.`)}})}function h(){let e=Fu.value,t=l.value;e&&t&&(K.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(G,()=>{r.value=!1});let g=!0;return M(ju.version,()=>{let e=t.value;g=!e||e.scrollHeight-e.scrollTop-e.clientHeight<120},{flush:`pre`}),M(ju.version,()=>{g&&An(()=>t.value?.scrollTo({top:t.value.scrollHeight,behavior:`instant`}))}),M(()=>qu.value.length,()=>void An(()=>n.value&&(n.value.scrollLeft=n.value.scrollWidth))),(e,g)=>(F(),I(`section`,Mv,[R(`header`,Nv,[R(`div`,Pv,[R(`div`,Fv,[R(`nav`,{ref_key:`lineageNav`,ref:n,class:`crumbs conversation-lineage`,"aria-label":`Conversation lineage`},[R(`button`,{class:`crumb`,title:`${A(Ou)?.name} · ${A(Ou)?.url}`,onClick:d},[g[5]||=R(`span`,{class:`crumb-kind`},`device`,-1),R(`span`,Lv,[z(Ud,{device:A(Ou),size:18},null,8,[`device`]),R(`span`,Rv,D(A(Ou)?.name??A(Ou)?.id),1)])],8,Iv),z(A(ic),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),R(`button`,{class:`crumb`,title:A(Nu)?.cwd,onClick:f},[g[6]||=R(`span`,{class:`crumb-kind`},`workspace`,-1),R(`span`,Bv,[z(A(yc),{size:18,"aria-hidden":`true`}),R(`span`,Vv,D(A(Nu)?.name),1)])],8,zv),A(Nu)?.cwd?(F(),L($_,{key:0})):V(``,!0),(F(!0),I(P,null,N(A(qu),e=>(F(),I(P,{key:e.id},[z(A(ic),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),R(`button`,{class:E([`crumb`,{current:e.id===A(G)?.agentId}]),"aria-current":e.id===A(G)?.agentId?`page`:void 0,title:s(e),onClick:t=>p(e.id)},[R(`span`,Uv,D(u(e)),1),R(`span`,Wv,[e.kind===`fork`?(F(),L(A(Cc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`subagent`?(F(),L(A(lc),{key:1,size:18,"aria-hidden":`true`})):(F(),L(A(Lc),{key:2,size:18,"aria-hidden":`true`})),R(`span`,Gv,D(e.name),1)])],10,Hv)],64))),128))],512),R(`button`,{class:`icon-button`,"aria-label":`Rename agent`,title:`Rename this agent`,disabled:!l.value,onClick:h},[z(A(qc),{size:18})],8,Kv),R(`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},[z(A(rc),{size:18})],8,qv)]),l.value&&l.value.kind!==`root`?(F(),I(`div`,Jv,D(s(l.value)),1)):V(``,!0),r.value?(F(),I(P,{key:1},[R(`button`,{class:`conversation-menu-dismiss`,"aria-label":`Close conversation picker`,onClick:g[1]||=e=>r.value=!1}),R(`section`,Yv,[g[7]||=R(`div`,{class:`conversation-picker-heading`},`Roots & forks`,-1),(F(!0),I(P,null,N(c.value,e=>(F(),I(`button`,{key:e.id,class:E([`conversation-choice`,{selected:e.id===A(G)?.agentId}]),"aria-label":e.lineage.map(e=>e.name).join(` → `),"aria-current":e.id===A(G)?.agentId?`page`:void 0,onClick:t=>p(e.id)},[R(`div`,Zv,[R(`span`,Qv,[(F(!0),I(P,null,N(e.lineage,(t,n)=>(F(),I(P,{key:t.id},[n?(F(),L(A(ic),{key:0,size:18,"aria-hidden":`true`})):V(``,!0),R(`span`,{class:E({"choice-ancestor":n<e.lineage.length-1})},D(t.name),3)],64))),128))]),R(`span`,$v,D(s(e)),1)]),e.id===A(G)?.agentId?(F(),L(A(nc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`fork`?(F(),L(A(Cc),{key:1,size:18,"aria-hidden":`true`})):(F(),L(A(Lc),{key:2,size:18,"aria-hidden":`true`}))],10,Xv))),128))])],64)):V(``,!0)])]),A(ju).fault.value||A(ju).status.value===`fault`||A(ju).status.value===`reconnecting`||A(Gu).ready&&A(ju).status.value===`connecting`?(F(),I(`div`,ey,[R(`div`,null,[R(`strong`,null,D(A(Gu).ready?`Cached transcript is stale.`:`Agent stream unavailable.`),1),R(`p`,null,D(A(ju).fault.value||`Updates are paused while the stream reconnects.`),1),g[8]||=R(`p`,null,`Sending is paused until a fresh snapshot arrives. Your draft is kept.`,-1)]),R(`button`,{disabled:A(ju).status.value===`connecting`,onClick:g[2]||=(...e)=>A(ju).retry&&A(ju).retry(...e)},` Retry stream `,8,ty)])):V(``,!0),R(`div`,{ref_key:`chat`,ref:t,class:`chat-scroll`,"data-testid":`chat`},[A(Gu).ready?(F(),I(P,{key:1},[i.value.length?V(``,!0):(F(),I(`div`,ay,[g[13]||=R(`div`,{class:`agent-orb`},[R(`img`,{src:`/icons/durable-pi.svg`,alt:`Durable Pi`}),R(`i`)],-1),g[14]||=R(`span`,{class:`eyebrow`},`YOUR DURABLE AGENT IS READY`,-1),g[15]||=R(`h2`,null,`A conversation with continuity.`,-1),R(`p`,null,`Messages, tools and state live on `+D(A(Ou)?.id)+`, beyond this window.`,1),R(`div`,oy,[R(`button`,{onClick:g[3]||=e=>A(od)(`Inspect this directory using your tools and give me a brief overview. Do not modify any files.`)},[z(A(yc),{size:18}),g[9]||=R(`strong`,null,`Explore this directory`,-1),g[10]||=R(`span`,null,`See coding tools in action`,-1),z(A(Js),{size:18})]),R(`button`,{onClick:g[4]||=e=>A(od)(`Use read_state, then update_state to add a field called progress with value 1 and a boolean called ready with value false.`)},[z(A($s),{size:18}),g[11]||=R(`strong`,null,`Make a state change`,-1),g[12]||=R(`span`,null,`Watch the workspace update`,-1),z(A(Js),{size:18})])])])),(F(!0),I(P,null,N(i.value,e=>(F(),L(K_,{key:e.id,item:e,onFork:m},null,8,[`item`]))),128)),A(Gu).running&&!a.value&&!o.value?(F(),I(`div`,sy,[R(`div`,cy,[g[16]||=B(` AGENT `,-1),R(`span`,ly,D(A(Gu).retry?`Retry scheduled`:`Working`),1)]),g[17]||=R(`div`,{class:`typing`},[R(`i`),R(`i`),R(`i`)],-1)])):V(``,!0),A(Gu).retry?(F(),I(`p`,uy,` Retrying: `+D(A(Gu).retry.error),1)):V(``,!0),(F(!0),I(P,null,N(A(Gu).notices,(e,t)=>(F(),I(`p`,{key:t,class:`message-error`},D(e),1))),128))],64)):(F(),I(`div`,ny,[z(A(Hs),{size:30}),A(ju).status.value===`fault`?(F(),I(`h2`,ry,`This agent is unavailable.`)):(F(),I(`h2`,iy,`Connecting to the agent…`)),R(`p`,null,`The agent keeps working on `+D(A(Ou)?.id)+` while this view connects.`,1)]))],512),z(jv)]))}});function fy(e,t){return`${e}/${t.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}var py=[`data-state-path`],my={key:0,class:`state-field-heading`},hy=[`value`,`aria-label`,`disabled`],gy=[`value`],_y=[`aria-label`,`disabled`],vy=[`aria-label`,`disabled`],yy=[`aria-label`,`disabled`],by=[`value`],xy=[`disabled`],Sy=[`disabled`,`aria-label`],Cy={key:2,class:`state-number`},wy=[`aria-label`,`disabled`],Ty=[`aria-label`,`disabled`],Ey=[`aria-label`,`disabled`],Dy={key:3,class:`state-boolean`},Oy=[`aria-label`,`aria-checked`,`disabled`],ky=[`aria-label`,`disabled`],Ay={key:5,class:`muted`},jy=Dr({__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=H(()=>n.value===null?`null`:Array.isArray(n.value)?`array`:typeof n.value),a=H(()=>i.value===`object`||i.value===`array`),o=H(()=>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:fy(n.path,e),value:p[u.value]()}),l.value=``,d.value=!1)}return(t,n)=>{let _=Qr(`StateEditor`,!0);return F(),I(`div`,{class:E([`state-field`,{"state-root":e.path===``}]),"data-state-path":e.path},[e.path===``?V(``,!0):(F(),I(`div`,my,[R(`strong`,null,D(e.label),1),R(`select`,{value:i.value,"aria-label":`Type of ${e.path}`,disabled:e.disabled,onChange:n[0]||=e=>m(`update`,p[e.target.value]())},[(F(),I(P,null,N(f,e=>R(`option`,{key:e,value:e},D(e),9,gy)),64))],40,hy),R(`button`,{class:`icon-button`,"aria-label":`Delete ${e.path}`,title:`Delete field`,disabled:e.disabled,onClick:n[1]||=e=>m(`delete`)},[z(A(dl),{size:18})],8,_y)])),a.value?(F(),I(P,{key:1},[(F(!0),I(P,null,N(o.value,([t,i])=>(F(),L(_,{key:t,value:i,path:A(fy)(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.value===`array`?(F(),I(`form`,{key:0,class:`state-add`,onSubmit:As(g,[`prevent`])},[i.value===`array`?V(``,!0):j((F(),I(`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,vy)),[[bs,l.value]]),j(R(`select`,{"onUpdate:modelValue":n[4]||=e=>u.value=e,"aria-label":`New field type in ${e.path||`/`}`,disabled:e.disabled},[(F(),I(P,null,N(f,e=>R(`option`,{key:e,value:e},D(e),9,by)),64))],8,yy),[[Cs,u.value]]),R(`button`,{class:`secondary small`,disabled:e.disabled||i.value!==`array`&&!l.value.trim()},` Add `,8,xy),R(`button`,{type:`button`,class:`text-button`,onClick:n[5]||=e=>d.value=!1},`Cancel`)],32)):i.value===`array`?(F(),I(`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},[z(A(Xc),{size:18}),B(D(i.value===`array`?`Add item`:`Add field`),1)],8,Sy)):V(``,!0)],64)):i.value===`number`?(F(),I(`div`,Cy,[R(`button`,{class:`secondary`,"aria-label":`Decrement ${e.path}`,disabled:e.disabled,onClick:n[7]||=e=>m(`increment`,-1)},[z(A(Rc),{size:18})],8,wy),j(R(`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]||=Ms(e=>e.target.blur(),[`enter`])},null,40,Ty),[[bs,s.value]]),R(`button`,{class:`secondary`,"aria-label":`Increment ${e.path}`,disabled:e.disabled,onClick:n[11]||=e=>m(`increment`,1)},[z(A(Xc),{size:18})],8,Ey)])):i.value===`boolean`?(F(),I(`div`,Dy,[R(`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]||=[R(`span`,null,null,-1)]],10,Oy),R(`span`,null,D(e.value),1)])):i.value===`string`?j((F(),I(`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,ky)),[[bs,s.value]]):(F(),I(`span`,Ay,`null`))],10,py)}}}),My=[`data-status`],Ny=[`title`],Py=[`title`],Fy=[`href`],Iy=[`title`],Ly=Dr({__name:`TunnelStatusBar`,props:{device:{}},setup(e){let t=e,n=H(()=>t.device.status===`online`),r=H(()=>t.device.transport===`tunnel`),i=H(()=>n.value?r.value?`online · via tunnel`:`online · LAN`:r.value?`tunnel`:`LAN`),a=H(()=>t.device.tunnel?.state===`connected`);return(t,o)=>(F(),I(`span`,{class:`tunnel-status`,"data-status":e.device.status},[R(`span`,{class:`axis transport`,title:r.value?`Hub ⇄ device over the tunnel (WSS)`:`Hub → device over LAN`},[r.value?(F(),L(A(ec),{key:0,size:13,class:E({live:a.value})},null,8,[`class`])):(F(),L(A(hl),{key:1,size:13,class:E({live:n.value})},null,8,[`class`])),B(` `+D(i.value),1)],8,Ny),R(`span`,{class:E([`axis monitor`,e.device.status])},[e.device.status===`offline`?(F(),L(A(ml),{key:0,size:13})):(F(),I(P,{key:1},[B(D(e.device.status),1)],64))],2),r.value&&a.value&&e.device.tunnel?(F(),I(`span`,{key:0,class:`axis muted`,title:`tunnel last seen ${A(ud)(e.device.tunnel.lastSeenAt)}`},D(e.device.tunnel.readerCount)+` reader`+D(e.device.tunnel.readerCount===1?``:`s`),9,Py)):V(``,!0),e.device.url?(F(),I(`a`,{key:1,class:`axis url`,href:e.device.url,target:`_blank`,rel:`noreferrer`},D(e.device.url),9,Fy)):V(``,!0),e.device.lastSeenAt?(F(),I(`span`,{key:2,class:`axis muted`,title:`last probe ${A(ud)(e.device.lastSeenAt)}`},D(A(ud)(e.device.lastSeenAt)),9,Iy)):V(``,!0)],8,My))}});async function Ry(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 ql(e?.code??`internal`,e?.message??`${a.status} ${a.statusText}`,a.status)}return o}function zy(e){return e.offerUrl??e.pairUrl}var By={pending:e=>Ry(`GET`,`/pair/codes`,void 0,e),pairings:e=>Ry(`GET`,`/pairings`,void 0,e),createCode:e=>Ry(`POST`,`/pair/code`,{},e),resolveCode:(e,t)=>Ry(`POST`,`/pair/resolve`,{code:e},t),codeState:(e,t)=>Ry(`GET`,`/pair/codes/${encodeURIComponent(e)}`,void 0,t),approve:(e,t,n)=>Ry(`POST`,`/pair/codes/${encodeURIComponent(e)}/approve`,t,n),cancel:(e,t,n)=>Ry(`POST`,`/pair/codes/${encodeURIComponent(e)}/cancel`,{},t,n),rotate:(e,t)=>Ry(`POST`,`/pairings/${encodeURIComponent(e)}/rotate`,{},t),revoke:(e,t=`user`,n)=>Ry(`POST`,`/pairings/${encodeURIComponent(e)}/revoke`,{reason:t},n)},Vy=0;function Hy(){let e=++Vy,t=!1;return{gen:e,close:()=>t=!0,closed:()=>t}}var Uy=class extends Error{codeId;constructor(e){super(`pairing poll timed out for ${e}`),this.codeId=e,this.name=`PollTimeout`}},Wy=e=>e===`issued`||e===`cancelled`||e===`expired`;async function Gy(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 Uy(t);let a=await By.codeState(t,n.signal);if(e.closed())return;if(e.state=a,n.onState?.(a),Wy(a.phase))return a;await new Promise(e=>setTimeout(e,r))}}var Ky={key:0,class:`token-manager`,"aria-label":`Credential manager`},qy={class:`credential-fingerprint`},Jy=[`title`],Yy={key:0,class:`rotation-badge`,role:`status`},Xy={class:`token-actions`},Zy=[`disabled`],Qy=[`disabled`],$y={key:1,class:`message-error`,role:`alert`},eb=Dr({__name:`TokenManager`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=H(()=>t.device.pairing);async function a(){if(!n.value){n.value=!0,r.value=``;try{await By.rotate(t.device.id),q(`Rotation queued — it completes when the device acknowledges the new credential.`)}catch(e){r.value=cu(e)}finally{n.value=!1}}}async function o(){n.value||(K.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 By.revoke(t.device.id,`user`),q(`Revoke committed on the hub. The tunnel is cut; the device cleans up on its next contact.`)}})}return(e,t)=>i.value?(F(),I(`section`,Ky,[R(`header`,null,[z(A(kc),{size:15}),t[0]||=R(`h3`,null,`Credential`,-1),R(`span`,{class:E([`pairing-status`,i.value.status])},D(i.value.status),3)]),R(`dl`,null,[t[1]||=R(`dt`,null,`Key fingerprint`,-1),R(`dd`,null,[R(`code`,qy,D(i.value.keyFingerprint),1)]),t[2]||=R(`dt`,null,`Paired`,-1),R(`dd`,{title:new Date(i.value.pairedAt).toISOString()},D(A(ud)(i.value.pairedAt)),9,Jy),t[3]||=R(`dt`,null,`Generation`,-1),R(`dd`,null,D(i.value.credentialGeneration),1)]),i.value.rotationPending?(F(),I(`p`,Yy,[z(A($c),{size:13,class:`spin`}),t[4]||=B(` rotation queued — waiting for the device to ACK `,-1)])):V(``,!0),R(`div`,Xy,[i.value.status===`paired`?(F(),I(`button`,{key:0,class:`small`,disabled:n.value||i.value.rotationPending,onClick:a},[z(A($c),{size:14}),t[5]||=B(` Rotate credential `,-1)],8,Zy)):V(``,!0),i.value.status===`paired`?(F(),I(`button`,{key:1,class:`small danger`,disabled:n.value,onClick:o},[z(A(ol),{size:14}),t[6]||=B(` Revoke `,-1)],8,Qy)):V(``,!0)]),r.value?(F(),I(`p`,$y,D(r.value),1)):V(``,!0)])):V(``,!0)}}),tb={class:`tasks-panel`},nb={class:`panel-heading`},rb={class:`tag`},ib={key:0,class:`message-error`,role:`alert`},ab={class:`task-section`,"aria-label":`Durable jobs`},ob={key:0,class:`task-empty`},sb=[`data-job`],cb={class:`job-def-head`},lb={key:0,class:`tag`},ub={class:`tag`},db=[`aria-label`],fb=[`title`],pb={class:`job-def-meta`},mb=[`title`],hb=[`title`],gb={key:0,class:`job-def-last`},_b=[`onClick`],vb=[`disabled`,`onClick`],yb=[`disabled`,`onClick`],bb=[`disabled`,`onClick`],xb={class:`task-section`,"aria-label":`Agent activity`},Sb={class:`panel-heading`},Cb={key:0,class:`task-empty`},wb={key:1,class:`task-tree`},Tb=[`data-task-kind`],Eb={class:`tag`},Db={key:0,class:`task-phase`},Ob=[`onClick`],kb=[`disabled`],Ab={class:`raw`},jb=Dr({__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=H(()=>new Map(Mg.value.map(e=>[e.id,Pg.value.find(t=>t.job===e.id)]))),s=H(()=>{let e=Ju.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:_l,name:e.label??`Tool call`,what:`tool call`}:e.kind===`pi.generation`?{icon:Qs,name:`Model response`,what:`generation`}:e.kind===`pi.compaction`?{icon:jc,name:`Compaction`,what:`compaction`}:e.kind.startsWith(`demo.job.`)?{icon:gl,name:e.label??Ng(e.kind.slice(9))?.title??e.kind,what:`durable job`}:e.kind===`demo.job-approval`?{icon:al,name:`Approval`,what:`waits for you`}:{icon:Hs,name:e.label??e.kind,what:e.kind},l=e=>e.state.phase?e.kind.startsWith(`demo.job.`)?Ng(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&&Fu.value){n.value=!0,t.value=``;try{await Fu.value.abort(!0)}catch(e){t.value=cu(e)}finally{n.value=!1}}}async function d(e){let n=Iu.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=cu(e)}}let f=H(()=>r.value.filter(e=>e.state.status===`terminal`).slice(-12).reverse());return(e,r)=>(F(),I(`div`,tb,[R(`div`,nb,[r[0]||=R(`h2`,null,`Tasks`,-1),R(`span`,rb,D(A(Ju).length)+` active`,1)]),t.value?(F(),I(`p`,ib,D(t.value),1)):V(``,!0),R(`section`,ab,[R(`h3`,null,[z(A(el),{size:18}),r[1]||=B(`Durable jobs`,-1)]),r[2]||=R(`p`,{class:`hint`},[B(` 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 `),R(`code`,null,`list_durable_jobs`),B(`, starts them with `),R(`code`,null,`run_durable_job`),B(` and checks them with `),R(`code`,null,`check_durable_job`),B(`. Runs play out live in the chat. `)],-1),A(Mg).length?V(``,!0):(F(),I(`p`,ob,` This device has no durable jobs. Deploy the latest backend to it. `)),(F(!0),I(P,null,N(A(Mg),e=>(F(),I(`article`,{key:e.id,class:`job-def`,"data-job":e.id},[R(`div`,cb,[z(A(gl),{size:18}),R(`strong`,null,D(e.title),1),e.approval?(F(),I(`span`,lb,`needs approval`)):V(``,!0),R(`span`,ub,`~`+D(e.seconds)+`s`,1)]),R(`p`,null,D(e.summary),1),R(`ol`,{class:`job-chain`,"aria-label":`${e.title} phases`},[(F(!0),I(P,null,N(e.phases,(e,t)=>(F(),I(`li`,{key:e.id,title:e.summary},[R(`span`,null,D(t+1),1),B(D(e.label),1),e.kind===`repeat`?(F(),L(A(el),{key:0,size:13})):V(``,!0),e.kind===`approval`?(F(),L(A(al),{key:1,size:13})):V(``,!0)],8,fb))),128))],8,db),R(`div`,pb,[(F(!0),I(P,null,N(e.inputs,e=>(F(),I(`code`,{key:e.name,title:e.description},D(e.name)+`=`+D(e.default),9,mb))),128)),R(`code`,{title:`Each run saves its result to App State ${e.resultPath}`},`→ `+D(e.resultPath),9,hb)]),o.value.get(e.id)?(F(),I(`div`,gb,[R(`span`,null,[B(`Run #`+D(o.value.get(e.id).run)+`: `,1),R(`strong`,null,D(a(o.value.get(e.id).status)),1),A(jg)(o.value.get(e.id))?V(``,!0):(F(),I(P,{key:0},[B(` in `+D(o.value.get(e.id).phases.find(t=>t.id===o.value.get(e.id).phase)?.label),1)],64))]),R(`button`,{class:`text-button`,onClick:t=>A(Vg)(o.value.get(e.id).id)},` Show in chat `,8,_b),o.value.get(e.id).approval===`pending`?(F(),I(P,{key:0},[R(`button`,{class:`primary small`,disabled:!!A(zg),onClick:t=>A(Ug)(o.value.get(e.id),!0)},` Approve `,8,vb),R(`button`,{class:`secondary`,disabled:!!A(zg),onClick:t=>A(Ug)(o.value.get(e.id),!1)},` Decline `,8,yb)],64)):V(``,!0)])):V(``,!0),R(`button`,{class:`secondary job-def-run`,disabled:!!A(zg)||!A(Fu),onClick:t=>A(Hg)(e)},[z(A(Yc),{size:16}),B(`Run `+D(e.title),1)],8,bb)],8,sb))),128))]),R(`section`,xb,[R(`div`,Sb,[r[3]||=R(`h3`,null,`Agent activity`,-1),z(A(Hs),{size:18})]),r[5]||=R(`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?(F(),I(`ul`,wb,[(F(!0),I(P,null,N(s.value,({task:e,depth:t})=>(F(),I(`li`,{key:e.id,class:`task-row`,style:ge({"--depth":t}),"data-task-kind":e.kind},[(F(),L(ei(c(e).icon),{size:16})),R(`strong`,null,D(c(e).name),1),R(`span`,Eb,D(a(e.state.status)),1),l(e)?(F(),I(`span`,Db,D(l(e)),1)):V(``,!0),R(`small`,null,`#`+D(e.id)+` `+D(c(e).what)+`, agent #`+D(e.conversationId)+D(e.effectiveBackground?`, background`:``),1),(F(!0),I(P,null,N(e.conversations,e=>(F(),I(`button`,{key:e,class:`text-button`,onClick:t=>A(Gg)(e)},` Open agent #`+D(e),9,Ob))),128))],12,Tb))),128))])):(F(),I(`p`,Cb,`Nothing running. Send a message or run a job.`)),r[6]||=R(`p`,{class:`hint`},` Interrupt or Esc stops foreground work and what it owns. Stop all also stops background runs. `,-1),R(`button`,{class:`secondary danger`,disabled:!A(Ju).length||n.value,onClick:u},[z(A(Vc),{size:18}),r[4]||=B(`Stop all `,-1)],8,kb)]),R(`details`,{class:`raw task-section`,onToggle:d},[R(`summary`,null,[z(A(sc),{size:18}),r[7]||=B(`Runtime details`,-1)]),r[9]||=R(`p`,{class:`hint`},` Recent task results and recovery records, read from the device when opened. `,-1),(F(!0),I(P,null,N(f.value,e=>(F(),I(`details`,{key:e.id,class:`raw`},[R(`summary`,null,[B(D(e.kind)+` #`+D(e.id),1),R(`span`,null,D(a(e.state.outcome?.status??e.state.status)),1)]),R(`pre`,null,D(JSON.stringify(e.state.outcome,null,2)),1)]))),128)),R(`details`,Ab,[r[8]||=R(`summary`,null,`Recovery inspection`,-1),R(`pre`,null,D(JSON.stringify(i.value,null,2)),1)])],32)]))}}),Mb={class:`git-pane`},Nb={key:0,class:`hint`},Pb={key:0,class:`hint`},Fb={key:1,class:`muted-line`},Ib={key:2,class:`message-error`},Lb={key:0,class:`hint`},Rb={key:0,class:`message-error merge-banner`},zb=[`disabled`],Bb={class:`panel-heading git-top`},Vb={class:`branch-wrap`},Hb=[`disabled`],Ub={key:0,class:`menu`},Wb=[`onClick`],Gb={class:`muted-line`},Kb={class:`new-branch`},qb=[`disabled`],Jb={class:`auto-stash`},Yb={class:`tag`},Xb={key:0,class:`tag`},Zb={key:1,class:`tag`},Qb={key:2,class:`tag`,title:`vs the picked base`},$b={class:`tag`},ex=[`href`],tx=[`disabled`],nx={class:`row ops`},rx=[`disabled`],ix=[`disabled`],ax=[`disabled`],ox=[`disabled`],sx=[`disabled`],cx={key:1,class:`message-error hintbox`},lx=[`disabled`],ux=[`disabled`],dx={key:2,class:`message-error hintbox`},fx=[`disabled`],px={class:`task-section`,"aria-label":`Commit`},mx={class:`panel-heading`},hx={class:`tag`},gx=[`disabled`],_x=[`disabled`],vx={key:0,class:`hintbox warn`},yx={key:1,class:`cps turns`},bx={key:0,class:`hint`},xx={class:`muted-line`},Sx={class:`cp-subj`},Cx={key:2,class:`muted-line cap`},wx={key:3,class:`files conflicts`},Tx={class:`file all`},Ex={class:`muted-line conflict-head`},Dx={class:`file-label`},Ox={class:`xy`},kx=[`title`],Ax={class:`file-acts`},jx=[`onClick`],Mx=[`disabled`,`onClick`],Nx=[`disabled`,`onClick`],Px={key:4,class:`files`},Fx={class:`file all`},Ix=[`checked`],Lx={class:`muted-line`},Rx=[`onClick`],zx={class:`muted-line`},Bx={class:`file-label`},Vx=[`checked`,`onChange`],Hx=[`title`],Ux=[`title`],Wx={class:`file-acts`},Gx=[`onClick`],Kx=[`onClick`],qx=[`onClick`],Jx={key:5,class:`files`},Yx={class:`file all`},Xx=[`checked`],Zx={class:`muted-line`},Qx=[`onClick`],$x={class:`muted-line`},eS={class:`file-label`},tS=[`checked`,`onChange`],nS=[`title`],rS=[`title`],iS={class:`file-acts`},aS=[`onClick`],oS=[`onClick`],sS=[`onClick`],cS=[`onClick`],lS=[`onClick`],uS={key:6,class:`file-diff`},dS={class:`mode-chips`},fS={key:0,class:`nums bin`},pS={key:1,class:`nums`},mS={key:2},hS={class:`row`},gS=[`disabled`],_S=[`disabled`],vS=[`disabled`],yS={class:`task-section`,"aria-label":`Log`},bS={class:`panel-heading`},xS=[`disabled`],SS=[`disabled`],CS=[`disabled`],wS={key:0,class:`cps`},TS={key:0,class:`hint`},ES={class:`muted-line`},DS={class:`cp-subj`},OS=[`disabled`,`onClick`],kS={key:1,class:`hint`},AS={key:2,class:`commits`},jS=[`title`],MS=[`width`],NS=[`x1`,`x2`],PS=[`x1`,`x2`,`stroke`],FS=[`cx`,`fill`],IS=[`onClick`],LS={class:`hash`},RS=[`href`],zS={key:1,class:`refs`},BS={class:`subject`},VS={class:`muted-line who`},HS={key:0,class:`commit-files`},US=[`data-s`],WS={class:`path`},GS={key:0,class:`hint`},KS={key:3,class:`message-error`},qS={key:4,class:`hint`},JS={class:`task-section`,"aria-label":`Worktrees`},YS={class:`panel-heading`},XS={class:`branch-wrap`},ZS=[`disabled`],QS={key:0,class:`menu`},$S=[`onClick`],eC={class:`new-branch`},tC=[`disabled`],nC=[`title`],rC={class:`muted-line`},iC=[`disabled`,`onClick`],aC=[`disabled`,`onClick`],oC=[`disabled`,`onClick`],sC={key:3,class:`task-section`,"aria-label":`Pull requests`},cC={class:`panel-heading`},lC=[`disabled`],uC=[`disabled`],dC={key:0,class:`hint`},fC={key:1,class:`commits`},pC={class:`hash`},mC={class:`subject`},hC={class:`muted-line who`},gC=[`disabled`,`onClick`],_C=[`disabled`,`onClick`],vC=[`disabled`,`onClick`],yC=[`href`],bC={key:4,class:`op-out`},xC=[`placeholder`],SC={class:`row`},CC=[`disabled`],wC=Id(Dr({__name:`GitPanel`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=H(()=>t.cwd??Nu.value?.cwd??``),r=H(()=>t.deviceId??Du.value),i=H(()=>Zd(r.value||`?`,n.value||`?`)),a=H(()=>i.value.status),o=H(()=>i.value.loading),s=H(()=>i.value.refreshing),c=H(()=>i.value.error),l=H(()=>{let e=Nu.value;return e&&e.cwd===n.value&&!t.deviceId?e.id:void 0}),u=k(``),d=k(``),f=k(``),p=k(new Set),m=k(!1),h=k(!1),g=k(``),_=k(null),v=k(`working`),y=H(()=>`dpi-git-draft:${r.value}:${n.value}`),b=k(null),x=k(!0),S=k(``),C=k(!1),ee=k([]),te=H(()=>{if(!ee.value.length||!n.value)return null;let e=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,t=new Set(ee.value);return{changed:(a.value?.files??[]).filter(n=>t.has(e(n.path))).length,total:ee.value.length}}),w=k(null),ne=k(``),re=e=>{ne.value=e.input?.value??``,w.value=e},ie=()=>{let e=w.value;w.value=null,e&&e.action(ne.value)};window.addEventListener(`keydown`,e=>{e.key===`Escape`&&w.value&&(w.value=null)});let ae=k([]),oe=k(!1),se=k(new Map),ce=k([]),le=k(!1),T=k(new Map),ue=k(!1),de=H(()=>/github\.com|gitlab/i.test(a.value?.remoteUrl??``)),fe=async()=>{if(r.value&&n.value){ue.value=!0;try{let e=await W(r.value).gitOp(n.value,`pr-list`);ce.value=e.prs??[]}catch(e){q(`pr list failed: ${e.message.slice(0,120)}`)}finally{ue.value=!1}}};M(le,e=>{e&&fe()});let pe=()=>re({title:`Create pull request`,body:`head: ${a.value?.branch??`?`}`,confirmLabel:`Create PR`,input:{placeholder:`PR title`,value:f.value.trim()||``},action:e=>void me(e)});async function me(e){if(r.value&&n.value&&e.trim()){ue.value=!0;try{q((await W(r.value).gitOp(n.value,`pr-create`,{message:e.trim(),body:e.trim()})).text.split(`
|
|
76
|
-
`)[0]??`PR created`),await fe()}catch(e){q(`pr create failed: ${e.message.slice(0,140)}`)}finally{ue.value=!1}}}async function he(e){if(r.value&&n.value){ue.value=!0;try{let t=await W(r.value).gitOp(n.value,`pr-checks`,{n:e});T.value=new Map(T.value).set(e,t.text.slice(0,1500))}catch(e){q(`pr checks failed: ${e.message.slice(0,120)}`)}finally{ue.value=!1}}}let ge=e=>re({title:`Merge PR #${e}?`,body:`squash-merge via gh on the device.`,confirmLabel:`Squash & merge`,danger:!0,action:()=>void _e(e)});async function _e(e){if(r.value&&n.value){ue.value=!0;try{q((await W(r.value).gitOp(n.value,`pr-merge`,{n:e})).text||`PR #${e} merged`),await fe(),await Ee()}catch(e){q(`pr merge failed: ${e.message.slice(0,140)}`)}finally{ue.value=!1}}}let ve=e=>re({title:`Comment on PR #${e}`,body:`posted as the device's gh login`,confirmLabel:`Comment`,input:{placeholder:`comment…`,value:``},action:t=>void ye(e,t)});async function ye(e,t){if(r.value&&n.value&&t.trim()){ue.value=!0;try{q((await W(r.value).gitOp(n.value,`pr-comment`,{n:e,body:t.trim()})).text||`comment posted`)}catch(e){q(`pr comment failed: ${e.message.slice(0,140)}`)}finally{ue.value=!1}}}let be=k([]),xe=k(!1),Se=async()=>{if(r.value&&l.value)try{let e=await W(r.value).sessionGitTurns(l.value);be.value=e.turns}catch{be.value=[]}};M(xe,e=>{e&&Se()});let Ce=0;window.addEventListener(`focus`,()=>{!n.value||Date.now()-Ce<15e3||(Ce=Date.now(),$d(r.value||`?`,n.value||`?`,{force:!0}))});let we=k(new Set),Te=()=>{typeof localStorage<`u`&&(f.value=localStorage.getItem(y.value)??``)};Yd(),$d(r.value||`?`,n.value||`?`),Te(),qr(()=>$d(r.value||`?`,n.value||`?`)),M(f,e=>{typeof localStorage<`u`&&(e?localStorage.setItem(y.value,e):localStorage.removeItem(y.value))}),M([r,n],()=>{m.value=!1,h.value=!1,_.value=null,b.value=null,S.value=``,C.value=!1,ee.value=[],se.value=new Map,we.value=new Set,$d(r.value||`?`,n.value||`?`),Te()});let Ee=()=>(p.value=new Set,_.value=null,$d(r.value||`?`,n.value||`?`,{force:!0})),De=H(()=>a.value?.files??[]);M(De,e=>{let t=new Set;for(let n of e)n.x!==`?`&&n.y!==`?`&&t.add(n.path);p.value=t},{immediate:!0});let Oe=H(()=>De.value.some(e=>p.value.has(e.path))),ke=H(()=>De.value.filter(e=>!je(e)&&e.x!==` `&&e.x!==`?`)),Ae=H(()=>De.value.filter(e=>!je(e)&&(e.x===` `||e.x===`?`))),je=e=>`UAD`.includes(e.x)&&`UAD`.includes(e.y),Me=H(()=>De.value.filter(je)),Ne=H(()=>De.value.length>=500),Pe=H(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0)>0),Fe=H(()=>!a.value?.identity?.name||!a.value?.identity?.email),O=H(()=>{let e=a.value?.remoteUrl??``,t=e.match(/git@([^:]+):(.+?)(?:\.git)?$/)??e.match(/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);return t?`https://${t[1]}/${t[2]}`:``}),Ie=e=>{let t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},Le=e=>{let t=e.every(e=>p.value.has(e.path)),n=new Set(p.value);for(let r of e)t?n.delete(r.path):n.add(r.path);p.value=n},Re=e=>{let t=e.lastIndexOf(`/`);return t===-1?`.`:e.slice(0,t)},ze=e=>{let t=new Map;for(let n of e){let e=Re(n.path);t.has(e)||t.set(e,[]),t.get(e).push(n)}return[...t.entries()].map(([e,t])=>({dir:e,files:t,open:!we.value.has(e)}))},Be=e=>{let t=new Set(we.value);t.has(e)?t.delete(e):t.add(e),we.value=t},Ve=e=>e.a===void 0&&e.d===void 0?``:e.a===-1||e.d===-1?`bin`:`+${e.a??0} −${e.d??0}`,He=e=>{navigator.clipboard?.writeText(e).then(()=>q(`copied ${e}`))};async function Ue(e,t={}){if(r.value&&n.value){u.value=e,d.value=``;try{let i=await W(r.value).gitOp(n.value,e,t);d.value=i.text||`(empty)`,e===`push`&&(S.value=``),e===`pull`&&(C.value=!1),[`fetch`,`pull`,`push`,`stash-push`,`stash-pop`].includes(e)&&q(`git ${e} ✓`),await Ee(),vt(!0)}catch(t){let n=t.message;e===`push`&&(/no upstream|has no upstream|upstream is gone/i.test(n)?S.value=`no upstream — set it while pushing?`:/fetch first|non-fast-forward|rejected.*fetch|behind/i.test(n)?S.value=`the remote has work you lack — pull first`:/authentication|permission|could not read|403|denied/i.test(n)?S.value=`credentials rejected on the device — check its git login`:S.value=``),e===`pull`&&/not possible to fast-forward|divergent|unrelated histories/i.test(n)&&(C.value=!0),q(`git ${e}: ${n.slice(0,160)}`)}finally{u.value=``}}}async function We(e,t,i=!1){if(!r.value||!n.value||(i&&(u.value=e),!t&&e!==`stage`))return;if(e===`discard`&&t&&!i){re({title:`Roll back to HEAD?`,body:`${t} — uncommitted changes are lost.`,confirmLabel:`Roll back`,danger:!0,action:()=>void We(e,t,!0)});return}u.value=e;let a=t?[t]:De.value.filter(e=>e.x===` `||e.x===`M`).map(e=>e.path);try{q((await W(r.value).gitOp(n.value,e,{files:a})).text),await Ee()}catch(t){q(`${e} failed: ${t.message.slice(0,140)}`)}finally{u.value=``}}async function Ge(e){if(r.value&&n.value&&e.length){u.value=`unstage`;try{q((await W(r.value).gitOp(n.value,`unstage`,{files:e})).text),await Ee()}catch(e){q(`unstage failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function Ke(e,t){if(r.value&&n.value){u.value=`resolve`;try{q((await W(r.value).gitOp(n.value,`resolve`,{side:e,files:[t]})).text),await Ee()}catch(e){q(`resolve failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function qe(e){if(r.value&&n.value&&e.length){u.value=`ignore`;try{q((await W(r.value).gitOp(n.value,`ignore`,{lines:e})).text),await Ee()}catch(e){q(`ignore failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function Je(e){if(r.value&&n.value){if(_.value?.path===e)return _.value=null;u.value=`diff`;try{let t=await W(r.value).gitOp(n.value,`diff-file`,{target:e,staged:v.value===`staged`});_.value={path:e,text:t.text}}catch(e){q(`diff failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}let Ye=async()=>{let e=_.value?.path;_.value=null,e&&await Je(e)},Xe=H(()=>/Binary files .* differ/i.test(_.value?.text??``));async function Ze(){if(r.value&&n.value){u.value=`abort`;try{q((await W(r.value).gitOp(n.value,`merge-abort`)).text),await Ee()}catch(e){q(`abort failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function Qe(e){if(m.value=!1,r.value&&n.value){u.value=`compare`;try{let t=await W(r.value).gitOp(n.value,`compare`,{ref:e});b.value={ref:e,ahead:t.ahead??0,behind:t.behind??0}}catch(e){q(`compare failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function $e(e,t=!1){if(m.value=!1,!r.value||!n.value||e===a.value?.branch&&!t)return;u.value=`switch`;let i=W(r.value),o=!1;try{if(x.value&&!t&&Pe.value&&(await i.gitOp(n.value,`stash-push`,{message:`dpi auto-stash before ${e}`}),o=!0),q((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)&&q(`stash popped WITH CONFLICTS — resolve in the file list`)}catch{q(`switched, but the stash did not pop — resolve manually (git stash list)`)}await Ee(),vt(!0)}catch(e){if(q(`switch failed: ${e.message.slice(0,140)}`),o)try{await i.gitOp(n.value,`stash-pop`)}catch{}}finally{u.value=``}}async function et(e=!1){if(!r.value||!n.value||!f.value.trim())return;u.value=`commit`;let t=De.value.filter(e=>p.value.has(e.path)).map(e=>e.path);if(!t.length)return q(`check the files to commit — nothing is selected`);let i=W(r.value);try{if(q((await i.gitOp(n.value,`commit`,{message:f.value.trim(),...a.value?.merge?{}:{files:t}})).text),f.value=``,e)try{q(`pushed: ${(await i.gitOp(n.value,`push`)).text.slice(0,80)}`)}catch(e){q(`committed, but push failed: ${e.message.slice(0,120)}`)}await Ee(),vt(!0)}catch(e){q(`commit failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}function tt(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 nt(){if(!r.value||!n.value)return;let e=De.value.filter(e=>p.value.has(e.path)).map(e=>e.path);if(!e.length)return q(`check files first — the model summarises THOSE`);u.value=`ai`;let t=W(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=bu.devices.value.find(e=>e.id===r.value)?.info,s=tt(o);if(!s.length)return u.value=``,q(`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(`
|
|
77
|
-
`)[0]?.slice(0,100):``;if(i){f.value=i;return}c.push(`${e.provider}/${e.id}: ${n.status===`unanswered`?n.reason:`empty answer`}`)}finally{t.session(r).archive().catch(()=>{})}}q(`ai message failed on every model — ${c.join(`; `).slice(0,140)}`)}catch(e){q(`ai message failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}async function rt(){if(r.value&&l.value){u.value=`session-files`;try{let e=await W(r.value).sessionGitFiles(l.value);ee.value=e.files;let t=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,i=new Set(e.files.map(t)),a=De.value.filter(e=>i.has(t(e.path)));p.value=new Set(a.map(e=>e.path)),q(a.length?`${a.length} session file(s) still changed — checked`:`the session touched nothing that is still changed`)}catch(e){q(`session files failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function it(e){if(se.value.has(e)){se.value.delete(e),se.value=new Map(se.value);return}if(r.value&&n.value)try{let t=await W(r.value).gitOp(n.value,`show-files`,{target:e});se.value=new Map(se.value).set(e,t.changed??[])}catch(e){q(`commit files failed: ${e.message.slice(0,120)}`)}}async function at(){if(!r.value||!n.value)return;let e=`cp-${new Date().toISOString().slice(0,16).replace(/[-:T]/g,``)}`;u.value=`checkpoint`;try{q((await W(r.value).gitOp(n.value,`checkpoint`,{name:e})).text),oe.value=!0,await ot()}catch(e){q(`checkpoint failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}async function ot(){if(r.value&&n.value)try{let e=await W(r.value).gitOp(n.value,`checkpoints`);ae.value=e.checkpoints??[]}catch{ae.value=[]}}async function st(e){if(!r.value||!n.value)return;let t=e;re({title:`Rewind to ${t}?`,body:`reset --hard — ALL uncommitted changes in this worktree are LOST.`,confirmLabel:`Rewind`,danger:!0,action:()=>void ct(t)})}async function ct(e){if(r.value&&n.value){u.value=`rewind`;try{q((await W(r.value).gitOp(n.value,`rewind`,{name:e})).text),await Ee(),vt(!0)}catch(e){q(`rewind failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}M(oe,e=>{e&&ot()});async function lt(e){if(h.value=!1,!r.value||!n.value||!a.value?.root)return;let t=a.value.root,i=`${t.slice(0,t.lastIndexOf(`/`))}/${t.slice(t.lastIndexOf(`/`)+1)}-${e.replace(/[/\\]+/g,`-`)}`;u.value=`wt`;try{q((await W(r.value).gitOp(n.value,`worktree-add`,{branch:e,target:i})).text.split(`
|
|
78
|
-
`)[0]??`worktree ${i}`),g.value=``,await Ee()}catch(e){q(`worktree failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}async function ut(e,t){if(r.value){u.value=`session`;try{let n=bu.devices.value.find(e=>e.id===r.value)?.info,i=tt(n)[0];if(!i)return q(`no model available on ${r.value} — cannot create a session`);let a=await W(r.value).createSession({name:t??e.slice(e.lastIndexOf(`/`)+1),cwd:e,model:{provider:i.provider,modelId:i.id}});Lu({deviceId:r.value,sessionId:a.id,agentId:1}),q(`session "${a.name}" on ${e}`)}catch(e){q(`session failed: ${e.message.slice(0,160)}`)}finally{u.value=``}}}async function dt(e){if(r.value){u.value=`go`;try{let t=(await W(r.value).sessions()).find(t=>t.cwd===e);t?(Lu({deviceId:r.value,sessionId:t.id,agentId:1}),q(`switched to session "${t.name}"`)):await ut(e,null)}catch(e){q(`switch failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function ft(e){if(!r.value||!n.value)return;u.value=`wt`;let t=`Uncommitted changes in it will be LOST.`;try{let n=(await W(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{}re({title:`Remove worktree?`,body:`${e} — ${t}`,confirmLabel:`Remove`,danger:!0,action:()=>void pt(e)})}async function pt(e){u.value=`wt`;try{await W(r.value).gitOp(n.value,`worktree-remove`,{target:e}),await Ee()}catch(e){q(`remove failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}let mt=k([]),ht=k(!1),gt=k(``),_t=0;async function vt(e=!1){if(r.value&&n.value&&!(!e&&mt.value.length&&Date.now()-_t<12e4)){ht.value=!0;try{let e=await W(r.value).gitOp(n.value,`log-list`);mt.value=e.commits??[],gt.value=``,_t=Date.now()}catch(e){gt.value=e.message.slice(0,120)}finally{ht.value=!1}}}vt(),M([r,n],()=>{mt.value=[],_t=0,vt()});let yt=H(()=>(a.value?.worktrees??[]).filter(e=>e.path)),bt=[`#4f8cc9`,`#b8860b`,`#7aa25c`,`#a061ba`,`#c96f6f`,`#5fa8a0`],xt=H(()=>{let e=new Map,t=[],n=[];for(let r of mt.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}),St=e=>e*12+7;return(e,t)=>(F(),I(`div`,Mb,[n.value?(F(),I(P,{key:1},[o.value?(F(),I(`p`,Pb,`loading git…`)):s.value?(F(),I(`p`,Fb,`refreshing…`)):V(``,!0),c.value?(F(),I(`p`,Ib,[B(D(c.value)+` `,1),R(`button`,{onClick:t[0]||=e=>Ee()},`retry`)])):V(``,!0),a.value?(F(),I(`div`,{key:3,class:E({stale:!!c.value||!!s.value})},[a.value.repo?(F(),I(P,{key:1},[a.value.merge?(F(),I(`p`,Rb,[B(` merge in progress — `+D(a.value.conflicts??Me.value.length)+` unmerged path(s). Resolve them in the lists above, or `,1),R(`button`,{class:`small`,disabled:!!u.value,onClick:t[1]||=e=>Ze()},`abort merge`,8,zb)])):V(``,!0),R(`div`,Bb,[R(`div`,Vb,[R(`button`,{class:`branch-btn`,disabled:!!u.value,onClick:t[2]||=e=>m.value=!m.value},[z(A(xc),{size:16}),R(`strong`,null,D(a.value.branch??`detached`),1),z(A(rc),{size:14})],8,Hb),m.value?(F(),I(`div`,Ub,[(F(!0),I(P,null,N(a.value.branches??[],e=>(F(),I(`button`,{key:e.name,class:E({cur:e.current}),onClick:t=>$e(e.name)},[z(A(xc),{size:13}),R(`span`,null,D(e.name),1),R(`span`,Gb,D(e.current?`current`:e.upstream?`→ ${e.upstream}`:``),1),t[42]||=R(`span`,{class:`grow`},null,-1),e.current?V(``,!0):(F(),L(A(Sc),{key:0,size:13,title:`compare with this base`,onClick:As(t=>Qe(e.name),[`stop`])},null,8,[`onClick`]))],10,Wb))),128)),R(`div`,Kb,[j(R(`input`,{"onUpdate:modelValue":t[3]||=e=>g.value=e,placeholder:`new branch…`,onKeyup:t[4]||=Ms(e=>g.value.trim()&&$e(g.value.trim(),!0),[`enter`])},null,544),[[bs,g.value]]),R(`button`,{disabled:!g.value.trim(),onClick:t[5]||=e=>$e(g.value.trim(),!0)},[z(A(Xc),{size:13})],8,qb)]),R(`label`,Jb,[j(R(`input`,{type:`checkbox`,"onUpdate:modelValue":t[6]||=e=>x.value=e},null,512),[[xs,x.value]]),t[43]||=B(` auto-stash on switch`,-1)])])):V(``,!0)]),R(`span`,Yb,D(a.value.upstream??`no upstream`),1),a.value.ahead?(F(),I(`span`,Xb,`↑`+D(a.value.ahead),1)):V(``,!0),a.value.behind?(F(),I(`span`,Zb,`↓`+D(a.value.behind),1)):V(``,!0),b.value?(F(),I(`span`,Qb,[B(` vs `+D(b.value.ref)+`: ↑`+D(b.value.ahead)+` ↓`+D(b.value.behind)+` `,1),R(`button`,{class:`tag-x`,onClick:t[7]||=e=>b.value=null},[z(A(vl),{size:11})])])):V(``,!0),R(`span`,$b,`+`+D(a.value.staged??0)+` ~`+D(a.value.unstaged??0)+` ?`+D(a.value.untracked??0),1),O.value?(F(),I(`a`,{key:3,class:`icon-button`,href:`${O.value}/tree/${a.value.branch??``}`,target:`_blank`,rel:`noopener`,title:`open on the remote`},[z(A(qs),{size:15,style:{transform:`rotate(45deg)`}})],8,ex)):V(``,!0),R(`button`,{class:`icon-button`,disabled:!!u.value||o.value||s.value,title:`refresh`,onClick:t[8]||=e=>Ee()},[z(A($c),{size:16})],8,tx)]),R(`div`,nx,[R(`button`,{class:`small`,disabled:!!u.value,onClick:t[9]||=e=>Ue(`fetch`)},[z(A(Gs),{size:14}),t[44]||=B(`fetch`,-1)],8,rx),R(`button`,{class:`small`,disabled:!!u.value,onClick:t[10]||=e=>Ue(`pull`)},[z(A(Gs),{size:14}),t[45]||=B(`pull`,-1)],8,ix),R(`button`,{class:`small primary`,disabled:!!u.value,title:`push`,onClick:t[11]||=e=>Ue(`push`)},[z(A(qs),{size:14}),t[46]||=B(`push`,-1)],8,ax),R(`button`,{class:`small`,disabled:!!u.value,title:`stash changes`,onClick:t[12]||=e=>Ue(`stash-push`,{message:f.value.trim()||void 0})},[z(A(cl),{size:14}),t[47]||=B(`stash`,-1)],8,ox),R(`button`,{class:`small`,disabled:!!u.value,title:`pop the newest stash`,onClick:t[13]||=e=>Ue(`stash-pop`)},[z(A(Hc),{size:14}),t[48]||=B(`unstash`,-1)],8,sx)]),S.value?(F(),I(`p`,cx,[B(D(S.value)+` `,1),S.value.includes(`upstream`)?(F(),I(`button`,{key:0,class:`small primary`,disabled:!!u.value,onClick:t[14]||=e=>Ue(`push`,{setUpstream:!0,ref:a.value.branch})},`push -u origin `+D(a.value.branch),9,lx)):S.value.includes(`remote has work`)?(F(),I(`button`,{key:1,class:`small primary`,disabled:!!u.value,onClick:t[15]||=e=>Ue(`pull`)},`pull now`,8,ux)):V(``,!0)])):V(``,!0),C.value?(F(),I(`p`,dx,[t[49]||=B(` fast-forward is not possible — branches diverged. `,-1),R(`button`,{class:`small primary`,disabled:!!u.value,onClick:t[16]||=e=>Ue(`pull`,{rebase:!0})},`pull --rebase`,8,fx)])):V(``,!0),R(`section`,px,[R(`div`,mx,[t[50]||=R(`h4`,null,`Commit`,-1),R(`span`,hx,D(De.value.length?`${p.value.size}/${De.value.length} files`:`no changes`),1),t[51]||=R(`span`,{class:`grow`},null,-1),l.value?(F(),I(`button`,{key:0,class:`small`,disabled:!!u.value,title:`check the files this session's agent touched`,onClick:rt},[z(A(_c),{size:13}),B(` session files`+D(te.value?` (${te.value.changed}/${te.value.total})`:``),1)],8,gx)):V(``,!0),l.value?(F(),I(`button`,{key:1,class:`small`,disabled:!!u.value,title:`what each turn of this session changed`,onClick:t[17]||=e=>xe.value=!xe.value},` turns `,8,_x)):V(``,!0)]),Fe.value?(F(),I(`p`,vx,[...t[52]||=[B(`git user.name/user.email is not set on the device — `,-1),R(`code`,null,`dpi device config`,-1),B(` or `,-1),R(`code`,null,`git config --global`,-1),B(` before committing.`,-1)]])):V(``,!0),xe.value?(F(),I(`div`,yx,[be.value.length?V(``,!0):(F(),I(`p`,bx,`no turns recorded yet for this session.`)),(F(!0),I(P,null,N(be.value,(e,t)=>(F(),I(`div`,{key:t,class:`cp-row`},[R(`code`,null,`t`+D(be.value.length-t),1),R(`span`,xx,D(e.when.slice(0,16).replace(`T`,` `)),1),R(`span`,Sx,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))])):V(``,!0),Ne.value?(F(),I(`p`,Cx,`showing the first 500 changed files — commit in smaller batches`)):V(``,!0),Me.value.length?(F(),I(`div`,wx,[R(`label`,Tx,[R(`span`,Ex,`Conflicts · `+D(Me.value.length)+` — pick a side per file`,1)]),(F(!0),I(P,null,N(Me.value,e=>(F(),I(`div`,{key:e.path,class:`file`},[R(`label`,Dx,[R(`code`,Ox,D(e.x)+D(e.y),1),R(`span`,{class:`path`,title:e.path},D(e.path),9,kx)]),R(`span`,Ax,[R(`button`,{class:`icon-button`,title:`view the conflict`,onClick:t=>Je(e.path)},[z(A(gc),{size:13})],8,jx),R(`button`,{class:`small`,disabled:!!u.value,title:`keep this branch's version and stage it`,onClick:t=>Ke(`ours`,e.path)},`ours`,8,Mx),R(`button`,{class:`small`,disabled:!!u.value,title:`take the incoming version and stage it`,onClick:t=>Ke(`theirs`,e.path)},`theirs`,8,Nx)])]))),128))])):V(``,!0),ke.value.length?(F(),I(`div`,Px,[R(`label`,Fx,[R(`input`,{type:`checkbox`,checked:ke.value.every(e=>p.value.has(e.path)),onChange:t[18]||=e=>Le(ke.value)},null,40,Ix),R(`span`,Lx,`Staged · `+D(ke.value.length),1),t[55]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`icon-button`,title:`stage every changed file`,onClick:t[19]||=e=>We(`stage`)},[z(A(Xc),{size:13}),t[53]||=B(` all`,-1)]),R(`button`,{class:`icon-button`,title:`unstage all (git reset HEAD)`,onClick:t[20]||=e=>Ge(ke.value.map(e=>e.path))},[z(A(Rc),{size:13}),t[54]||=B(` none`,-1)])]),(F(!0),I(P,null,N(ze(ke.value),e=>(F(),I(P,{key:e.dir},[e.dir===`.`?V(``,!0):(F(),I(`button`,{key:0,class:`dir-row`,onClick:t=>Be(e.dir)},[z(A(ic),{size:12,class:E({open:e.open})},null,8,[`class`]),B(D(e.dir),1),R(`span`,zx,`· `+D(e.files.length),1)],8,Rx)),(F(!0),I(P,null,N(e.files,t=>j((F(),I(`div`,{key:t.path,class:`file`},[R(`label`,Bx,[R(`input`,{type:`checkbox`,checked:p.value.has(t.path),onChange:e=>Ie(t.path)},null,40,Vx),R(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},D(t.x)+D(t.y),9,Hx),R(`span`,{class:`path`,title:t.path},D(t.path),9,Ux),Ve(t)?(F(),I(`span`,{key:0,class:E([`nums`,{bin:Ve(t)===`bin`}])},D(Ve(t)),3)):V(``,!0)]),R(`span`,Wx,[R(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>Je(t.path)},[z(A(gc),{size:13})],8,Gx),R(`button`,{class:`icon-button`,title:`unstage (git reset HEAD)`,onClick:e=>Ge([t.path])},[z(A(Rc),{size:13})],8,Kx),R(`button`,{class:`icon-button`,title:`roll back to HEAD`,onClick:e=>We(`discard`,t.path)},[z(A(dc),{size:13})],8,qx)])])),[[zo,e.open]])),128))],64))),128))])):V(``,!0),Ae.value.length?(F(),I(`div`,Jx,[R(`label`,Yx,[R(`input`,{type:`checkbox`,checked:Ae.value.every(e=>p.value.has(e.path)),onChange:t[21]||=e=>Le(Ae.value)},null,40,Xx),R(`span`,Zx,`Unstaged · `+D(Ae.value.length),1)]),(F(!0),I(P,null,N(ze(Ae.value),e=>(F(),I(P,{key:e.dir},[e.dir===`.`?V(``,!0):(F(),I(`button`,{key:0,class:`dir-row`,onClick:t=>Be(e.dir)},[z(A(ic),{size:12,class:E({open:e.open})},null,8,[`class`]),B(D(e.dir),1),R(`span`,$x,`· `+D(e.files.length),1)],8,Qx)),(F(!0),I(P,null,N(e.files,t=>j((F(),I(`div`,{key:t.path,class:`file`},[R(`label`,eS,[R(`input`,{type:`checkbox`,checked:p.value.has(t.path),onChange:e=>Ie(t.path)},null,40,tS),R(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},D(t.x)+D(t.y),9,nS),R(`span`,{class:`path`,title:t.path},D(t.path),9,rS),Ve(t)?(F(),I(`span`,{key:0,class:E([`nums`,{bin:Ve(t)===`bin`}])},D(Ve(t)),3)):V(``,!0)]),R(`span`,iS,[R(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>Je(t.path)},[z(A(gc),{size:13})],8,aS),t.x===`?`?(F(),I(`button`,{key:0,class:`icon-button`,title:`add to .gitignore`,onClick:e=>qe([t.path])},[z(A(Xs),{size:13})],8,oS)):(F(),I(`button`,{key:1,class:`icon-button`,title:`stage (git add)`,onClick:e=>We(`stage`,t.path)},[z(A(Xc),{size:13})],8,sS)),t.x===`?`?V(``,!0):(F(),I(`button`,{key:2,class:`icon-button`,title:`roll back to HEAD`,onClick:e=>We(`discard`,t.path)},[z(A(dc),{size:13})],8,cS)),R(`button`,{class:`icon-button`,title:`copy path`,onClick:e=>He(t.path)},[z(A(cc),{size:13})],8,lS)])])),[[zo,e.open]])),128))],64))),128))])):V(``,!0),_.value?(F(),I(`p`,uS,[R(`strong`,null,D(_.value.path),1),R(`span`,dS,[R(`button`,{class:E({on:v.value===`working`}),onClick:t[22]||=e=>{v.value=`working`,Ye()}},`working`,2),R(`button`,{class:E({on:v.value===`staged`}),onClick:t[23]||=e=>{v.value=`staged`,Ye()}},`staged`,2)]),Xe.value?(F(),I(`span`,fS,`binary file`)):_.value.text.length>8e3?(F(),I(`span`,pS,`truncated at 8000 chars`)):V(``,!0),R(`button`,{class:`icon-button`,title:`close diff`,onClick:t[24]||=e=>_.value=null},[z(A(vl),{size:13})]),Xe.value?V(``,!0):(F(),I(`pre`,mS,D(_.value.text.slice(0,8e3)),1))])):V(``,!0),j(R(`textarea`,{"onUpdate:modelValue":t[25]||=e=>f.value=e,rows:`4`,placeholder:`Commit message… (Ctrl+Enter to commit)`,onKeydown:[t[26]||=Ms(As(e=>et(),[`exact`,`prevent`]),[`enter`]),t[27]||=Ms(As(e=>et(),[`meta`,`prevent`]),[`enter`]),t[28]||=Ms(As(e=>et(),[`ctrl`,`prevent`]),[`enter`])]},null,544),[[bs,f.value]]),R(`div`,hS,[R(`button`,{class:`small`,disabled:!!u.value||!p.value.size,title:`ask the device's model for a message`,onClick:nt},[z(A(sl),{size:14}),t[56]||=B(` ai message`,-1)],8,gS),t[58]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`primary small`,disabled:!!u.value||!f.value.trim()||!Oe.value,onClick:t[29]||=e=>et(!1)},[z(A(nc),{size:14}),B(` Commit`+D(p.value.size?` ${p.value.size} file${p.value.size>1?`s`:``}`:``),1)],8,_S),a.value.upstream?(F(),I(`button`,{key:0,class:`primary small`,disabled:!!u.value||!f.value.trim()||!Oe.value,title:`commit, then push`,onClick:t[30]||=e=>et(!0)},[z(A(nc),{size:14}),t[57]||=B(` Commit & push `,-1)],8,vS)):V(``,!0)])]),R(`section`,yS,[R(`div`,bS,[R(`h4`,null,[z(A(Ec),{size:16}),t[59]||=B(` Log`,-1)]),t[61]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`small`,disabled:!!u.value,title:`save a checkpoint ref of HEAD`,onClick:at},[z(A(_c),{size:13}),t[60]||=B(` checkpoint`,-1)],8,xS),R(`button`,{class:`small`,disabled:!!u.value,onClick:t[31]||=e=>oe.value=!oe.value},`checkpoints `+D(ae.value.length?`(${ae.value.length})`:``),9,SS),R(`button`,{class:`icon-button`,disabled:ht.value,title:`refresh log`,onClick:t[32]||=e=>vt(!0)},[z(A($c),{size:14})],8,CS)]),oe.value?(F(),I(`div`,wS,[ae.value.length?V(``,!0):(F(),I(`p`,TS,`no checkpoints yet — one click saves a named ref of HEAD.`)),(F(!0),I(P,null,N(ae.value,e=>(F(),I(`div`,{key:e.name,class:`cp-row`},[R(`code`,null,D(e.name),1),R(`span`,ES,D(e.hash)+` · `+D(e.date),1),R(`span`,DS,D(e.subject),1),t[63]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`small`,disabled:!!u.value,title:`reset --hard to this checkpoint (this worktree)`,onClick:t=>st(e.name)},[z(A(fl),{size:13}),t[62]||=B(` rewind`,-1)],8,OS)]))),128))])):V(``,!0),ht.value&&!mt.value.length?(F(),I(`p`,kS,`loading log…`)):mt.value.length?(F(),I(`div`,AS,[(F(!0),I(P,null,N(mt.value,(e,t)=>(F(),I(P,{key:e.hash},[R(`div`,{class:`commit-row`,title:e.refs},[xt.value[t]?(F(),I(`svg`,{key:0,class:`lane`,width:xt.value[t].width*12+4,height:`24`,"aria-hidden":`true`},[(F(!0),I(P,null,N(xt.value[t].width,e=>(F(),I(`line`,{key:e,x1:St(e-1),x2:St(e-1),y1:`0`,y2:`24`,stroke:`#3a3134`,"stroke-width":`2`},null,8,NS))),128)),(F(!0),I(P,null,N(xt.value[t].parents,(e,n)=>(F(),I(`line`,{key:`p`+n,x1:St(xt.value[t].lane),x2:St(e),y1:`12`,y2:`24`,stroke:bt[e%bt.length],"stroke-width":`2`},null,8,PS))),128)),R(`circle`,{cx:St(xt.value[t].lane),cy:`12`,r:`4`,fill:bt[xt.value[t].lane%bt.length]},null,8,FS)],8,MS)):V(``,!0),R(`button`,{class:`icon-button hash-btn`,title:`files in this commit`,onClick:t=>it(e.hash)},[z(A(ic),{size:12,class:E({open:se.value.has(e.hash)})},null,8,[`class`])],8,IS),R(`code`,LS,[O.value?(F(),I(`a`,{key:0,href:`${O.value}/commit/${e.hash}`,target:`_blank`,rel:`noopener`,title:`on the remote`},D(e.hash),9,RS)):(F(),I(P,{key:1},[B(D(e.hash),1)],64))]),e.refs?(F(),I(`span`,zS,D(e.refs.split(`,`)[0]),1)):V(``,!0),R(`span`,BS,D(e.subject),1),R(`span`,VS,D(e.author)+` · `+D(e.date),1)],8,jS),se.value.has(e.hash)?(F(),I(`div`,HS,[(F(!0),I(P,null,N(se.value.get(e.hash),e=>(F(),I(`div`,{key:e.path,class:`cf`},[R(`code`,{class:`cf-status`,"data-s":e.status},D(e.status),9,US),R(`span`,WS,D(e.path),1)]))),128)),se.value.get(e.hash)?.length?V(``,!0):(F(),I(`p`,GS,`no files (merge/empty commit)`))])):V(``,!0)],64))),128))])):gt.value?(F(),I(`p`,KS,`log failed: `+D(gt.value),1)):(F(),I(`p`,qS,`no commits`))]),R(`section`,JS,[R(`div`,YS,[R(`h4`,null,[z(A(Hc),{size:16}),t[64]||=B(` Worktrees`,-1)]),R(`div`,XS,[R(`button`,{class:`small`,disabled:!!u.value,onClick:t[33]||=e=>h.value=!h.value},[z(A(Xc),{size:13}),t[65]||=B(` worktree`,-1)],8,ZS),h.value?(F(),I(`div`,QS,[(F(!0),I(P,null,N((a.value.branches??[]).filter(e=>!e.current),e=>(F(),I(`button`,{key:e.name,onClick:t=>lt(e.name)},[z(A(xc),{size:13}),R(`span`,null,D(e.name),1),t[66]||=R(`span`,{class:`muted-line`},`existing`,-1)],8,$S))),128)),R(`div`,eC,[j(R(`input`,{"onUpdate:modelValue":t[34]||=e=>g.value=e,placeholder:`or a NEW branch…`,onKeyup:t[35]||=Ms(e=>g.value.trim()&<(g.value.trim()),[`enter`])},null,544),[[bs,g.value]]),R(`button`,{disabled:!g.value.trim(),onClick:t[36]||=e=>lt(g.value.trim())},`create`,8,tC)])])):V(``,!0)])]),(F(!0),I(P,null,N(yt.value,e=>(F(),I(`div`,{key:e.path,class:E([`wt`,{main:e.path===a.value.root}])},[R(`code`,{title:e.path},D(e.path),9,nC),R(`span`,rC,D(e.branch??e.head),1),t[67]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`icon-button`,disabled:!!u.value,title:`jump to this worktree (session or new)`,onClick:t=>dt(e.path)},[z(A(Ks),{size:13})],8,iC),R(`button`,{class:`small`,disabled:!!u.value,title:`create a session on this worktree`,onClick:t=>ut(e.path,e.branch)},`session`,8,aC),e.path===a.value.root?V(``,!0):(F(),I(`button`,{key:0,class:`icon-button`,disabled:!!u.value,onClick:t=>ft(e.path)},[z(A(vl),{size:13})],8,oC)),e.path===a.value.root?(F(),L(A(nc),{key:1,size:13,class:`muted-line`})):V(``,!0)],2))),128))]),de.value?(F(),I(`section`,sC,[R(`div`,cC,[R(`h4`,null,[z(A(wc),{size:16}),t[68]||=B(` Pull requests`,-1)]),t[69]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`small`,disabled:ue.value||!!u.value,onClick:pe},`create PR`,8,lC),R(`button`,{class:`small`,disabled:ue.value,onClick:t[37]||=e=>le.value=!le.value},D(le.value?`hide`:`list`),9,uC)]),le.value&&!ce.value.length&&!ue.value?(F(),I(`p`,dC,`no open PRs (or gh is not logged in on the device — every action will say so).`)):V(``,!0),le.value?(F(),I(`div`,fC,[(F(!0),I(P,null,N(ce.value,e=>(F(),I(`div`,{key:e.n,class:`pr-row`},[R(`code`,pC,`#`+D(e.n),1),R(`span`,{class:E([`tag`,{open:e.state===`OPEN`}])},D(e.state.toLowerCase())+D(e.draft?` · draft`:``),3),R(`span`,mC,D(e.title),1),R(`span`,hC,D(e.branch),1),t[70]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`icon-button`,title:`run checks`,disabled:ue.value,onClick:t=>he(e.n)},[z(A($c),{size:13})],8,gC),R(`button`,{class:`icon-button`,title:`comment`,disabled:ue.value,onClick:t=>ve(e.n)},[z(A(cc),{size:13})],8,_C),e.state===`OPEN`?(F(),I(`button`,{key:0,class:`small`,disabled:ue.value||!!u.value,onClick:t=>ge(e.n)},`squash & merge`,8,vC)):V(``,!0),R(`a`,{class:`icon-button`,href:e.url,target:`_blank`,rel:`noopener`,title:`open on the forge`},[z(A(qs),{size:13,style:{transform:`rotate(45deg)`}})],8,yC)]))),128)),(F(!0),I(P,null,N(T.value,([e,t])=>(F(),I(`pre`,{key:e,class:`pr-checks`},`#`+D(e)+` checks:`+D(`
|
|
79
|
-
`)+D(t),1))),128))])):V(``,!0)])):V(``,!0),d.value?(F(),I(`pre`,bC,D(d.value.slice(0,6e3)),1)):V(``,!0)],64)):(F(),I(`p`,Lb,[...t[41]||=[B(`Not a git repository — run `,-1),R(`code`,null,`git init`,-1),B(` (or open a session inside a repo).`,-1)]]))],2)):V(``,!0),w.value?(F(),I(`div`,{key:4,class:`modal-veil`,onClick:t[40]||=As(e=>w.value=null,[`self`])},[R(`div`,{class:E([`modal`,{danger:w.value.danger}]),role:`dialog`,"aria-modal":`true`},[R(`h5`,null,D(w.value.title),1),R(`p`,null,D(w.value.body),1),w.value.input?j((F(),I(`textarea`,{key:0,"onUpdate:modelValue":t[38]||=e=>ne.value=e,rows:`2`,placeholder:w.value.input.placeholder},null,8,xC)),[[bs,ne.value]]):V(``,!0),R(`div`,SC,[t[72]||=R(`span`,{class:`grow`},null,-1),R(`button`,{class:`small`,onClick:t[39]||=e=>w.value=null},[...t[71]||=[B(`cancel `,-1),R(`span`,{class:`muted-line`},`(esc)`,-1)]]),R(`button`,{class:E([`primary small`,{danger:w.value.danger}]),disabled:!(!w.value.input||ne.value.trim()),onClick:ie},D(w.value.confirmLabel??`confirm`),11,CC)])],2)])):V(``,!0)],64)):(F(),I(`p`,Nb,`No session selected — open a session to see its git.`))]))}}),[[`__scopeId`,`data-v-e5829ed1`]]),TC={class:`host-panel`,"aria-label":`Device vitals`},EC={class:`panel-heading`},DC=[`disabled`],OC={key:0,class:`hint`},kC={key:1,class:`message-error`},AC={key:2,class:`hint`},jC={class:`vitals-grid`},MC={class:`vital`},NC={class:`vital`},PC={class:`vital`},FC={class:`vital`},IC={class:`meter`},LC={class:`meter-head`},RC={class:`hint`},zC=[`aria-valuenow`],BC={class:`meter`},VC={class:`meter-head`},HC={class:`hint`},UC=[`aria-valuenow`],WC={class:`path`},GC={class:`hint`},KC=Id(Dr({__name:`HostPanel`,setup(e){let t=k(),n=k(!1),r=k(``),i=H(()=>G.value?.deviceId),a=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]}`},o=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`},s=(e,t)=>t>0?Math.max(0,Math.min(100,Math.round(e/t*100))):0,c=H(()=>t.value?s(t.value.memory.usedBytes,t.value.memory.totalBytes):0),l=H(()=>t.value?.disk.known?s(t.value.disk.totalBytes-t.value.disk.freeBytes,t.value.disk.totalBytes):0);async function u(){let e=i.value;if(t.value=void 0,r.value=``,e){n.value=!0;try{t.value=await W(e).vitals()}catch(e){r.value=cu(e).slice(0,160)}finally{n.value=!1}}}M(i,u,{immediate:!0});async function d(){await u(),r.value||q(`Vitals refreshed.`)}return(e,s)=>(F(),I(`section`,TC,[R(`header`,EC,[R(`span`,null,[z(A(rl),{size:16}),s[0]||=B(`HOST`,-1)]),R(`button`,{class:`icon-button`,disabled:n.value||!i.value,"aria-label":`Refresh vitals`,title:`Refresh vitals`,onClick:d},[z(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,DC)]),i.value?r.value?(F(),I(`p`,kC,D(r.value),1)):t.value?(F(),I(P,{key:3},[R(`div`,jC,[R(`div`,MC,[s[1]||=R(`span`,{class:`label`},`Host uptime`,-1),R(`strong`,null,D(o(t.value.uptime)),1)]),R(`div`,NC,[s[2]||=R(`span`,{class:`label`},`Device process`,-1),R(`strong`,null,D(o(t.value.processUptime)),1),R(`em`,null,`pid `+D(t.value.pid),1)]),R(`div`,PC,[s[3]||=R(`span`,{class:`label`},`Load (1/5/15m)`,-1),R(`strong`,null,D(t.value.loadavg.map(e=>e.toFixed(2)).join(` · `)),1),R(`em`,null,D(t.value.cpuCount)+` CPU`+D(t.value.cpuCount===1?``:`s`),1)]),R(`div`,FC,[s[4]||=R(`span`,{class:`label`},`Sessions`,-1),R(`strong`,null,D(t.value.counts?.sessions??0),1),R(`em`,null,D(t.value.counts?.archived??0)+` archived`,1)])]),R(`div`,IC,[R(`div`,LC,[s[5]||=R(`span`,{class:`label`},`Memory`,-1),R(`span`,RC,D(a(t.value.memory.usedBytes))+` / `+D(a(t.value.memory.totalBytes))+` · device `+D(a(t.value.memory.processRssBytes)),1)]),R(`div`,{class:`bar`,role:`meter`,"aria-valuenow":c.value,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-label":`Memory used`},[R(`i`,{style:ge({width:`${c.value}%`}),class:E({high:c.value>=90})},null,6)],8,zC)]),R(`div`,BC,[R(`div`,VC,[s[6]||=R(`span`,{class:`label`},`Disk · data dir`,-1),R(`span`,HC,[t.value.disk.known?(F(),I(P,{key:0},[B(D(a(t.value.disk.totalBytes-t.value.disk.freeBytes))+` used · `+D(a(t.value.disk.freeBytes))+` free `,1)],64)):(F(),I(P,{key:1},[B(`unknown on this volume`)],64))])]),R(`div`,{class:`bar`,role:`meter`,"aria-valuenow":l.value,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-label":`Disk used`},[R(`i`,{style:ge({width:`${l.value}%`}),class:E({high:l.value>=90})},null,6)],8,UC),R(`code`,WC,D(t.value.disk.path),1)]),R(`p`,GC,[z(A(Hs),{size:13}),s[7]||=B(` Read on demand — open this tab or press refresh. Nothing polls the device. `,-1)])],64)):(F(),I(`p`,AC,D(n.value?`Reading host…`:`No vitals.`),1)):(F(),I(`p`,OC,`Select a session to see its device.`))]))}}),[[`__scopeId`,`data-v-9881887a`]]),qC={class:`usage-panel`,"aria-label":`Device usage`},JC={class:`panel-heading`},YC=[`disabled`],XC={key:0,class:`hint`},ZC={key:1,class:`message-error`},QC={key:2,class:`hint`},$C={key:3,class:`hint`},ew={class:`usage-block`,"aria-labelledby":`usage-totals`},tw={class:`totals`},nw={class:`total`},rw={class:`total`},iw={class:`total`},aw={class:`total`},ow={class:`usage-block`,"aria-labelledby":`usage-models`},sw={class:`section-label block-label`},cw={class:`table-scroll`},lw={class:`usage-table`,"aria-label":`Usage by model`},uw=[`title`],dw={class:`num`},fw={class:`num`},pw={class:`share-col`},mw={class:`share`},hw=[`aria-valuenow`,`aria-label`],gw={class:`pct`},_w={class:`usage-block`,"aria-labelledby":`usage-projects`},vw={class:`section-label block-label`},yw={key:0,class:`hint`},bw={key:1,class:`rows`},xw=[`title`],Sw={class:`row-main`},Cw={class:`row-num`},ww={class:`row-num`},Tw={class:`row-meta`},Ew={class:`usage-block`,"aria-labelledby":`usage-sessions`},Dw={key:0,class:`hint`},Ow={key:1,class:`rows scroll`},kw=[`title`],Aw={class:`row-main`},jw={class:`row-num`},Mw={class:`row-num`},Nw={class:`row-meta`},Pw={class:`hint`},Fw=Id(Dr({__name:`UsagePanel`,setup(e){let t=k(),n=k(!1),r=k(``),i=H(()=>G.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=H(()=>(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=H(()=>{let e=t.value;return!e||!e.models.length&&!e.sessions.length&&!e.projects.length}),u=H(()=>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 W(e).deviceUsage()}catch(e){r.value=cu(e).slice(0,160)}finally{n.value=!1}}}M(i,f,{immediate:!0});async function p(){await f(),r.value||q(`Usage refreshed.`)}return(e,s)=>(F(),I(`section`,qC,[R(`header`,JC,[R(`span`,null,[z(A(Hs),{size:16}),s[0]||=B(`USAGE`,-1)]),R(`button`,{class:`icon-button`,disabled:n.value||!i.value,"aria-label":`Refresh usage`,title:`Refresh usage`,onClick:p},[z(A($c),{size:15,class:E({spin:n.value})},null,8,[`class`])],8,YC)]),i.value?r.value?(F(),I(`p`,ZC,D(r.value),1)):t.value?l.value?(F(),I(`p`,$C,`No usage recorded yet.`)):(F(),I(P,{key:4},[R(`section`,ew,[s[6]||=R(`div`,{class:`section-label block-label`},[R(`span`,{id:`usage-totals`},`TOTALS`)],-1),R(`div`,tw,[R(`div`,nw,[s[1]||=R(`span`,{class:`label`},`Tokens`,-1),R(`strong`,null,D(a(t.value.totals.tokens)),1)]),R(`div`,rw,[s[2]||=R(`span`,{class:`label`},`Cost`,-1),R(`strong`,null,D(o(t.value.totals.cost)),1)]),R(`div`,iw,[s[3]||=R(`span`,{class:`label`},`Sessions`,-1),R(`strong`,null,D(a(t.value.sessions.length)),1),R(`em`,null,D(a(t.value.projects.length))+` projects`,1)]),R(`div`,aw,[s[4]||=R(`span`,{class:`label`},`Models`,-1),R(`strong`,null,D(a(t.value.models.length)),1),s[5]||=R(`em`,null,`costliest first`,-1)])])]),R(`section`,ow,[R(`div`,sw,[s[7]||=R(`span`,{id:`usage-models`},`BY MODEL`,-1),z(A(fc),{size:13})]),R(`div`,cw,[R(`table`,lw,[s[8]||=R(`colgroup`,null,[R(`col`),R(`col`),R(`col`),R(`col`)],-1),s[9]||=R(`thead`,null,[R(`tr`,null,[R(`th`,{scope:`col`},`Model`),R(`th`,{scope:`col`,class:`num`},`Tokens`),R(`th`,{scope:`col`,class:`num`},`Cost`),R(`th`,{scope:`col`,class:`share-col`},`Share`)])],-1),R(`tbody`,null,[(F(!0),I(P,null,N(t.value.models,e=>(F(),I(`tr`,{key:e.key},[R(`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,uw),R(`td`,dw,D(a(e.tokens)),1),R(`td`,fw,D(o(e.cost)),1),R(`td`,pw,[R(`div`,mw,[R(`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`},[R(`i`,{style:ge({width:`${c(e.cost)}%`}),class:E({high:c(e.cost)>90})},null,6)],8,hw),R(`em`,gw,D(c(e.cost))+`%`,1)])])]))),128))])])])]),R(`section`,_w,[R(`div`,vw,[s[10]||=R(`span`,{id:`usage-projects`},`BY PROJECT`,-1),z(A(vc),{size:13})]),t.value.projects.length?(F(),I(`ul`,bw,[(F(!0),I(P,null,N(t.value.projects,e=>(F(),I(`li`,{key:e.rootPath,class:`row`,title:e.rootPath},[R(`span`,Sw,[R(`strong`,null,D(e.name),1),R(`em`,null,D(e.rootPath),1)]),R(`span`,Cw,D(a(e.tokens))+` tok`,1),R(`span`,ww,D(o(e.cost)),1),R(`span`,Tw,D(d(e.sessions,`session`)),1)],8,xw))),128))])):(F(),I(`p`,yw,`No project usage recorded yet.`))]),R(`section`,Ew,[s[11]||=R(`div`,{class:`section-label block-label`},[R(`span`,{id:`usage-sessions`},`BY SESSION`)],-1),t.value.sessions.length?(F(),I(`ul`,Ow,[(F(!0),I(P,null,N(t.value.sessions,e=>(F(),I(`li`,{key:e.id,class:`row`,title:e.cwd},[R(`span`,Aw,[R(`strong`,null,D(e.name),1),R(`em`,null,D(e.project??e.cwd),1)]),R(`span`,jw,D(a(e.tokens))+` tok`,1),R(`span`,Mw,D(o(e.cost)),1),R(`span`,Nw,D(d(e.agents,`agent`)),1)],8,kw))),128))])):(F(),I(`p`,Dw,`No session usage recorded yet.`))]),R(`p`,Pw,[z(A(Hs),{size:13}),B(` Read on demand — open this tab or press refresh (`+D(u.value)+`). Nothing polls the device. `,1)])],64)):(F(),I(`p`,QC,D(n.value?`Reading usage…`:`No usage recorded yet.`),1)):(F(),I(`p`,XC,`Select a session to see its device's usage.`))]))}}),[[`__scopeId`,`data-v-81e8eb49`]]),Iw={class:`schedules-panel`,"aria-label":`Scheduled sessions`},Lw={class:`panel-heading`},Rw=[`disabled`],zw=[`disabled`],Bw={key:0,class:`hint`},Vw={key:1,class:`message-error`},Hw=[`value`],Uw={class:`trigger-row`},Ww={class:`inline`},Gw=[`disabled`],Kw={class:`inline`},qw=[`disabled`],Jw={class:`row`},Yw=[`disabled`],Xw={key:3,class:`hint`},Zw={key:4,class:`schedule-list`},Qw={class:`head`},$w={class:`tag`},eT={key:0,class:`tag running`},tT=[`title`],nT={class:`next`},rT={class:`cwd`},iT={key:0,class:`message-error`},aT={class:`row`},oT=[`disabled`,`onClick`],sT=[`disabled`,`onClick`],cT=[`disabled`,`onClick`],lT=Id(Dr({__name:`SchedulesPanel`,setup(e){let t=k([]),n=k(``),r=k(``),i=k(!1),a=H(()=>G.value?.deviceId),o=()=>W(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){let t=e.code;r.value=t===`not_found`||/allowlist/i.test(cu(e))?"This device runs an older build: update it (`dpi update`) to use schedules.":cu(e).slice(0,160)}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(),q(r)}catch(e){q(cu(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 finished.`),_=e=>K.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([]);async function y(){l.value=!0,u.value={name:``,cwd:(G.value?.sessionId,``),prompt:``,model:``};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=[]}}async function b(){let e=u.value,[t,...r]=e.model.split(`/`),i=r.join(`/`);if(e.name.trim()&&e.cwd.trim()&&e.prompt.trim()&&t&&i){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(),q(`Schedule created. The device runs it on its own clock.`)}catch(e){q(cu(e).slice(0,160))}finally{n.value=``}}}return(e,o)=>(F(),I(`section`,Iw,[R(`header`,Lw,[R(`span`,null,[z(A(tc),{size:16}),o[7]||=B(`SCHEDULES`,-1)]),R(`button`,{class:`icon-button`,disabled:i.value||!a.value,"aria-label":`Refresh schedules`,title:`Refresh schedules`,onClick:d},[z(A($c),{size:15,class:E({spin:i.value})},null,8,[`class`])],8,Rw),R(`button`,{class:`icon-button`,disabled:!a.value,"aria-label":`Add schedule`,title:`Add schedule`,onClick:y},[z(A(Xc),{size:15})],8,zw)]),o[18]||=R(`p`,{class:`hint`},`Runs on the device's own clock — no browser needs to be open.`,-1),a.value?r.value?(F(),I(`p`,Vw,D(r.value),1)):V(``,!0):(F(),I(`p`,Bw,`Select a session to see its device.`)),l.value?(F(),I(`form`,{key:2,class:`add-form`,onSubmit:As(b,[`prevent`])},[R(`label`,null,[o[8]||=B(`Name`,-1),j(R(`input`,{"onUpdate:modelValue":o[0]||=e=>u.value.name=e,placeholder:`Nightly smoke`,required:``},null,512),[[bs,u.value.name]])]),R(`label`,null,[o[9]||=B(`Directory`,-1),j(R(`input`,{"onUpdate:modelValue":o[1]||=e=>u.value.cwd=e,placeholder:`/home/me/project`,required:``},null,512),[[bs,u.value.cwd]])]),R(`label`,null,[o[10]||=B(`Prompt`,-1),j(R(`textarea`,{"onUpdate:modelValue":o[2]||=e=>u.value.prompt=e,rows:`3`,placeholder:`Run the tests and summarise failures`,required:``},null,512),[[bs,u.value.prompt]])]),R(`label`,null,[o[11]||=B(`Model `,-1),j(R(`select`,{"onUpdate:modelValue":o[3]||=e=>u.value.model=e},[(F(!0),I(P,null,N(v.value,e=>(F(),I(`option`,{key:e.key,value:e.key},D(e.key),9,Hw))),128))],512),[[Cs,u.value.model]])]),R(`div`,Uw,[R(`label`,Ww,[o[12]||=B(`Every `,-1),j(R(`input`,{"onUpdate:modelValue":o[4]||=e=>s.value=e,class:`num`,disabled:!!c.value.trim()},null,8,Gw),[[bs,s.value]]),o[13]||=B(` min`,-1)]),o[15]||=R(`span`,{class:`muted`},`or`,-1),R(`label`,Kw,[o[14]||=B(`daily at `,-1),j(R(`input`,{"onUpdate:modelValue":o[5]||=e=>c.value=e,class:`num time`,placeholder:`03:00`,disabled:!!s.value},null,8,qw),[[bs,c.value]])])]),R(`div`,Jw,[R(`button`,{class:`primary small`,type:`submit`,disabled:n.value===`new`},D(n.value===`new`?`creating…`:`Create schedule`),9,Yw),R(`button`,{class:`small`,type:`button`,onClick:o[6]||=e=>l.value=!1},`Cancel`)])],32)):V(``,!0),!l.value&&!t.value.length&&a.value&&!r.value?(F(),I(`p`,Xw,` No schedules yet. Press + to add one. `)):V(``,!0),t.value.length?(F(),I(`ul`,Zw,[(F(!0),I(P,null,N(t.value,e=>(F(),I(`li`,{key:e.id,class:E([`schedule`,{off:!e.enabled}])},[R(`div`,Qw,[R(`b`,null,D(e.name),1),R(`span`,$w,D(p(e)),1),e.running?(F(),I(`span`,eT,`running`)):e.lastOutcome===`failed`?(F(),I(`span`,{key:1,class:`tag bad`,title:e.lastError},`last run failed`,8,tT)):V(``,!0),R(`span`,nT,D(e.enabled?`next ${f(e.nextRunAt)}`:`paused`),1)]),R(`code`,rT,D(e.cwd),1),e.lastError?(F(),I(`p`,iT,D(e.lastError.slice(0,160)),1)):V(``,!0),R(`div`,aT,[R(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>g(e)},[z(A(Yc),{size:12}),o[16]||=B(`run now`,-1)],8,oT),R(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>h(e)},[z(A(Zc),{size:12}),B(D(e.enabled?`pause`:`resume`),1)],8,sT),R(`button`,{class:`small danger`,disabled:n.value===e.id,onClick:t=>_(e)},[z(A(dl),{size:12}),o[17]||=B(`remove`,-1)],8,cT)])],2))),128))])):V(``,!0)]))}}),[[`__scopeId`,`data-v-7f6db3c9`]]),uT={class:`notify-panel`,"aria-label":`Notification sinks`},dT={class:`panel-heading`},fT=[`disabled`],pT=[`disabled`],mT=[`disabled`],hT={key:0,class:`hint`},gT={key:1,class:`message-error`},_T=[`placeholder`],vT={class:`row`},yT=[`disabled`],bT={key:3,class:`hint`},xT={key:4,class:`sink-list`},ST={class:`head`},CT={class:`tag`},wT={class:`next`},TT={class:`url`},ET={key:0,class:`hint`},DT={key:1,class:`message-error`},OT={class:`row`},kT=[`disabled`,`onClick`],AT=[`disabled`,`onClick`],jT={key:5,class:`results`,"aria-label":`Test results`},MT={class:`tag`},NT={key:0},PT=Id(Dr({__name:`NotifyPanel`,setup(e){let t=k([]),n=k(``),r=k(``),i=k(!1),a=k([]),o=H(()=>G.value?.deviceId),s=()=>W(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){let t=e.code;r.value=t===`not_found`||/allowlist/i.test(cu(e))?"This device runs an older build: update it (`dpi update`) to use notifications.":cu(e).slice(0,160)}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(),q(`Sink added on the device.`)}catch(e){q(cu(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){q(cu(e).slice(0,140))}finally{n.value=``}}function m(e){K.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;q(a.value.length?`Test: ${a.value.length-e} sent${e?`, ${e} failed`:``}.`:`No enabled sinks matched — nothing was sent.`)}catch(e){q(cu(e).slice(0,160))}finally{n.value=``}}return(e,s)=>(F(),I(`section`,uT,[R(`header`,dT,[R(`span`,null,[z(A(Zs),{size:16}),s[6]||=B(`NOTIFY`,-1)]),R(`button`,{class:`icon-button`,disabled:i.value||!o.value,"aria-label":`Refresh sinks`,title:`Refresh sinks`,onClick:u},[z(A($c),{size:15,class:E({spin:i.value})},null,8,[`class`])],8,fT),R(`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},[z(A(nl),{size:15})],8,pT),R(`button`,{class:`icon-button`,disabled:!o.value,"aria-label":`Add a sink`,title:`Add a sink`,onClick:s[0]||=e=>c.value=!c.value},[z(A(Xc),{size:15})],8,mT)]),s[14]||=R(`p`,{class:`hint`},`Delivered by the device — no browser needs to be open.`,-1),o.value?r.value?(F(),I(`p`,gT,D(r.value),1)):V(``,!0):(F(),I(`p`,hT,`Select a session to see its device.`)),c.value?(F(),I(`form`,{key:2,class:`add-form`,onSubmit:As(f,[`prevent`])},[R(`label`,null,[s[8]||=B(`Kind `,-1),j(R(`select`,{"onUpdate:modelValue":s[1]||=e=>l.value.kind=e},[...s[7]||=[R(`option`,{value:`webhook`},`webhook (JSON POST)`,-1),R(`option`,{value:`ntfy`},`ntfy (topic)`,-1)]],512),[[Cs,l.value.kind]])]),R(`label`,null,[s[9]||=B(`URL `,-1),j(R(`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,_T),[[bs,l.value.url]])]),R(`label`,null,[s[10]||=B(`Label`,-1),j(R(`input`,{"onUpdate:modelValue":s[3]||=e=>l.value.label=e,placeholder:`phone`},null,512),[[bs,l.value.label]])]),R(`label`,null,[s[11]||=B(`Events `,-1),j(R(`input`,{"onUpdate:modelValue":s[4]||=e=>l.value.events=e,placeholder:`empty = all — e.g. session.failed,schedule.*`},null,512),[[bs,l.value.events]])]),R(`div`,vT,[R(`button`,{class:`primary small`,type:`submit`,disabled:n.value===`new`},D(n.value===`new`?`adding…`:`Add sink`),9,yT),R(`button`,{class:`small`,type:`button`,onClick:s[5]||=e=>c.value=!1},`Cancel`)]),s[12]||=R(`p`,{class:`hint`},[B(`LAN targets (192.168.x, localhost) need `),R(`code`,null,`DPI_NOTIFY_ALLOW_PRIVATE=1`),B(` on the device.`)],-1)],32)):V(``,!0),!c.value&&!t.value.length&&o.value&&!r.value?(F(),I(`p`,bT,` No sinks yet. Press + to add a webhook or an ntfy topic. `)):V(``,!0),t.value.length?(F(),I(`ul`,xT,[(F(!0),I(P,null,N(t.value,e=>(F(),I(`li`,{key:e.id,class:E([`sink`,{off:!e.enabled}])},[R(`div`,ST,[R(`span`,CT,D(e.kind),1),R(`b`,null,D(e.label||e.url),1),R(`em`,wT,D(e.lastError?`last failed`:`sent ${d(e.lastDeliveryAt)}`),1)]),R(`code`,TT,D(e.url),1),e.events?.length?(F(),I(`p`,ET,`events: `+D(e.events.join(`, `)),1)):V(``,!0),e.lastError?(F(),I(`p`,DT,D(e.lastError.slice(0,160)),1)):V(``,!0),R(`div`,OT,[R(`button`,{class:`small`,disabled:n.value===e.id,onClick:t=>p(e)},[z(A(Zc),{size:12}),B(D(e.enabled?`disable`:`enable`),1)],8,kT),R(`button`,{class:`small danger`,disabled:n.value===e.id,onClick:t=>m(e)},[z(A(dl),{size:12}),s[13]||=B(`remove`,-1)],8,AT)])],2))),128))])):V(``,!0),a.value.length?(F(),I(`ul`,jT,[(F(!0),I(P,null,N(a.value,e=>(F(),I(`li`,{key:e.id,class:E(e.status)},[R(`span`,MT,D(e.status),1),B(` `+D(e.kind)+` `+D(e.id.slice(0,8))+` `,1),e.detail?(F(),I(`em`,NT,D(e.detail),1)):V(``,!0)],2))),128))])):V(``,!0)]))}}),[[`__scopeId`,`data-v-4b0b0465`]]),FT={class:`extensions-panel`},IT={class:`panel-heading`},LT={key:0,class:`task-empty`},RT=[`data-extension`],zT={class:`ext-head`},BT=[`aria-checked`,`aria-label`,`disabled`,`onClick`],VT=[`checked`,`disabled`,`onChange`],HT=Dr({__name:`ExtensionsPanel`,setup(e){let t=rn(),n=k(!1);async function r(){let e=Fu.value;if(!e||!ku.value)return void(t.value=void 0);t.value=await e.extensions().catch(()=>void 0)??t.value}M([Fu,ku,()=>JSON.stringify(Gu.value.agent.extensions??null)],r,{immediate:!0});async function i(e){let r=Fu.value;if(r&&!n.value){n.value=!0;try{let n=await ad(()=>r.setExtension(e));n&&(t.value=n),ed()}finally{n.value=!1}}}return(e,r)=>(F(),I(`div`,FT,[R(`div`,IT,[r[0]||=R(`h2`,null,`Extensions`,-1),z(A(Qc),{size:18})]),r[3]||=R(`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?V(``,!0):(F(),I(`p`,LT,`Loading extensions…`)),(F(!0),I(P,null,N(t.value?.extensions??[],e=>(F(),I(`article`,{key:e.name,class:E([`ext-card`,{on:e.enabled}]),"data-extension":e.name},[R(`div`,zT,[R(`div`,null,[R(`strong`,null,D(e.title),1),R(`code`,null,D(e.name),1)]),R(`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]||=[R(`span`,null,null,-1)]],10,BT)]),R(`p`,null,D(e.description),1),e.prompts?(F(),I(`ul`,{key:0,class:E([`ext-prompts`,{off:!e.enabled}])},[(F(!0),I(P,null,N(e.prompts,e=>(F(),I(`li`,{key:e.id},[R(`label`,null,[R(`input`,{type:`checkbox`,checked:e.enabled,disabled:n.value,onChange:t=>i({prompt:e.id,enabled:t.target.checked})},null,40,VT),R(`code`,null,D(e.id),1)]),R(`span`,null,D(e.description),1),R(`details`,null,[r[2]||=R(`summary`,null,`View prompt`,-1),R(`pre`,null,D(e.text),1)])]))),128))],2)):V(``,!0)],10,RT))),128))]))}}),UT={class:`context-section`,"aria-labelledby":`context-title`},WT={class:`section-label`},GT={key:0,class:`hint`},KT={class:`context-numbers`},qT={class:`context-pct`},JT={key:0,class:`context-compacting`},YT=[`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],XT={class:`context-marker-label`},ZT=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],QT={class:`context-marker-label`},$T={class:`hint context-hint`},eE={class:`modal compaction-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`compaction-title`},tE={class:`context-toggle`},nE=[`checked`],rE=512,iE=4096,aE=1024,oE=Dr({__name:`ContextBar`,setup(e){let t=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),n=H(()=>Zu.value?.contextWindow??0),r=H(()=>{let e=Gu.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}),i=H(()=>Gu.value.compactions.length>0),a=k(),o=H(()=>a.value??Nu.value?.compaction??iv(n.value));M(()=>JSON.stringify(Nu.value?.compaction),e=>{a.value&&e===JSON.stringify(a.value)&&(a.value=void 0)});let s=k(),c=H(()=>K.dialog?.kind===`compaction`),l=()=>void(K.dialog=void 0);Kr(()=>c.value&&l());let u=H(()=>s.value??av(n.value,o.value)),d=e=>`${Math.min(100,Math.max(0,100*e/(n.value||1)))}%`,f=H(()=>Math.round(100*r.value/(n.value||1))),p=e=>{let t=e/(n.value||1);return t<.35?`start`:t>.65?`end`:`center`},m=(e,t)=>Math.min(n.value-aE,Math.max((t??iE)+aE,e)),h=(e,t)=>Math.min(t-aE,Math.max(iE,e));function g(e,t){let n=u.value,r=Math.round(t/rE)*rE;s.value=e===`wait`?{auto:n.auto,wait:m(r,n.auto)}:{auto:h(r,n.wait),wait:n.wait}}async function _(e){let t=Iu.value;if(!t)return;let n=await ad(()=>t.setCompaction(e));n&&(a.value=n),s.value=void 0}function v(){let e=s.value;e&&_({reserveTokens:n.value-e.wait,...e.auto===void 0?{}:{backgroundTokens:e.wait-e.auto}})}let y=k(),b;function x(e,t){b=e,t.currentTarget.setPointerCapture(t.pointerId)}function S(e){if(!b||!y.value)return;let t=y.value.getBoundingClientRect();g(b,(e.clientX-t.left)/t.width*n.value)}function C(){b&&(b=void 0,v())}function ee(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=u.value;g(e,(e===`auto`?r.auto??iE:r.wait)+n)}return(e,a)=>(F(),I(P,null,[R(`section`,UT,[R(`div`,WT,[a[7]||=R(`span`,{id:`context-title`},`CONTEXT`,-1),n.value?(F(),I(`button`,{key:0,class:`context-details-toggle`,onClick:a[0]||=e=>A(K).dialog={kind:`compaction`}},[z(A(Oc),{size:16}),a[6]||=B(`Details `,-1)])):V(``,!0)]),n.value?(F(),I(P,{key:1},[R(`div`,KT,[R(`strong`,null,D(t(r.value)),1),R(`span`,null,`of `+D(t(n.value))+` tokens`,1),R(`span`,qT,D(f.value)+`%`,1),i.value?(F(),I(`span`,JT,[...a[8]||=[R(`i`,null,null,-1),B(`Compacting`,-1)]])):V(``,!0)]),R(`div`,{ref_key:`bar`,ref:y,class:E([`context-bar`,{off:!o.value.enabled}]),onPointermove:S,onPointerup:C,onPointercancel:C},[R(`div`,{class:E([`context-fill`,{hot:u.value.auto!==void 0&&r.value>=u.value.auto}]),style:ge({width:d(r.value)})},null,6),R(`div`,{class:`context-reserve`,style:ge({left:d(u.value.wait)}),title:`Reserved for the answer`},null,4),u.value.auto===void 0?V(``,!0):(F(),I(`button`,{key:0,class:E([`context-marker auto`,`label-${p(u.value.auto)}`]),role:`slider`,"aria-label":`Automatic compaction starts at`,"aria-valuemin":iE,"aria-valuemax":u.value.wait-aE,"aria-valuenow":u.value.auto,"aria-valuetext":`${t(u.value.auto)} tokens`,style:ge({left:d(u.value.auto)}),onPointerdown:a[1]||=e=>x(`auto`,e),onKeydown:a[2]||=e=>ee(`auto`,e),onKeyup:v,onBlur:v},[R(`span`,XT,`Auto-compact at `+D(t(u.value.auto)),1)],46,YT)),R(`button`,{class:E([`context-marker wait`,`label-${p(u.value.wait)}`]),role:`slider`,"aria-label":`The next request waits for a summary at`,"aria-valuemin":(u.value.auto??iE)+aE,"aria-valuemax":n.value-aE,"aria-valuenow":u.value.wait,"aria-valuetext":`${t(u.value.wait)} tokens, ${t(n.value-u.value.wait)} reserved`,style:ge({left:d(u.value.wait)}),onPointerdown:a[3]||=e=>x(`wait`,e),onKeydown:a[4]||=e=>ee(`wait`,e),onKeyup:v,onBlur:v},[R(`span`,QT,`Reserve at `+D(t(u.value.wait)),1)],46,ZT)],34),R(`p`,$T,[o.value.enabled?(F(),I(P,{key:0},[a[9]||=B(`Compacts in the background at `,-1),R(`strong`,null,D(t(u.value.auto??u.value.wait)),1),a[10]||=B(` and waits at `,-1),R(`strong`,null,D(t(u.value.wait)),1),a[11]||=B(`.`,-1)],64)):(F(),I(P,{key:1},[B(`Automatic compaction is off.`)],64))])],64)):(F(),I(`div`,GT,`Pick a model to see its context window.`))]),(F(),L(lr,{to:`body`},[c.value?(F(),I(`div`,{key:0,class:`modal-backdrop`,onClick:As(l,[`self`])},[R(`section`,eE,[R(`header`,null,[a[12]||=R(`h2`,{id:`compaction-title`},`Context compaction`,-1),R(`button`,{class:`icon-button`,"aria-label":`Close context compaction`,onClick:l},[z(A(vl),{size:18})])]),R(`p`,null,[a[13]||=B(` A summary starts in the background at `,-1),R(`strong`,null,D(t(u.value.auto??u.value.wait)),1),a[14]||=B(`. Above `,-1),R(`strong`,null,D(t(u.value.wait)),1),B(` the next request waits for it, keeping `+D(t(n.value-u.value.wait))+` free for the answer. Drag a marker on the bar to change either point. `,1)]),a[16]||=R(`p`,null,[B(`Older entries stay stored, and `),R(`code`,null,`search_history`),B(` still finds them.`)],-1),R(`label`,tE,[R(`input`,{type:`checkbox`,checked:o.value.enabled,onChange:a[5]||=e=>_({enabled:e.target.checked})},null,40,nE),a[15]||=B(` Automatic compaction `,-1)]),a[17]||=R(`p`,{class:`hint`},[B(` Applies to every agent in this session. `),R(`code`,null,`/compact`),B(` works either way. `)],-1),R(`footer`,null,[R(`button`,{class:`secondary`,onClick:l},`Close`)])])])):V(``,!0)]))],64))}}),sE=/^[A-Za-z_$][\w$]*$/,cE=e=>` `.repeat(e);function lE(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`),uE(t,0,r),r(`): `,`punct`),r(`Promise`,`type`),r(`<`,`punct`),r(`ToolResult`,`type`),r(`>;`,`punct`),n}function uE(e,t,n){if(!e||typeof e!=`object`)return n(`unknown`,`type`);if(`const`in e)return pE(e.const,n);if(e.enum)return fE(e.enum.map(e=>({const:e})),t,n);if(e.anyOf??e.oneOf)return fE(e.anyOf??e.oneOf,t,n);if(Array.isArray(e.type))return fE(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`),uE(e.items,t,n),r&&n(`)`,`punct`),n(`[]`,`punct`)}case`object`:return dE(e,t,n);default:return n(`unknown`,`type`)}}function dE(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`),uE(e.additionalProperties,t,n),n(`>`,`punct`)):n(`{}`,`punct`);let i=new Set(e.required??[]);n(`{`,`punct`),n(`
|
|
80
|
-
`);for(let[e,a]of r){let r=mE(a);r&&n(`${cE(t+1)}${r}\n`,`comment`),n(cE(t+1)),n(sE.test(e)?e:JSON.stringify(e),`property`),n(i.has(e)?`: `:`?: `,`punct`),uE(a,t+1,n),n(`;`,`punct`),n(`
|
|
81
|
-
`)}n(cE(t)),n(`}`,`punct`)}function fE(e,t,n){e.forEach((e,r)=>{r&&n(` | `,`punct`),uE(e,t,n)})}function pE(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 mE(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(` `)} */`:``}var hE={key:0,class:`panel-rail`,"aria-label":`Inspector (collapsed)`},gE=[`title`],_E=[`aria-label`,`title`,`onClick`],vE={key:0,class:`count`},yE={class:`inspector-tabs`,role:`tablist`,"aria-label":`Session details`},bE=[`id`,`aria-selected`,`onClick`],xE={key:0,class:`count`},SE=[`title`],CE=[`aria-labelledby`],wE={class:`session-heading`},TE=[`disabled`],EE=[`title`],DE={class:`cwd-trail`,dir:`rtl`},OE={dir:`ltr`},kE={class:`session-status`},AE={key:0,class:`background-pill`},jE=[`title`],ME={class:`model-section`},NE=[`src`],PE={class:`thinking-row`},FE=[`value`],IE={class:`stats-section`,"aria-labelledby":`stats-title`},LE={class:`metrics`},RE=[`title`],zE={class:`usage-breakdown`,"aria-label":`Agent token and cost breakdown`},BE={scope:`row`},VE={class:`usage-total`},HE={class:`panel-heading`},UE={class:`hint app-state-description`},WE=[`disabled`],GE={class:`state-json-actions`},KE={key:0,class:`hint`},qE=[`disabled`],JE=[`disabled`],YE={key:0,class:`message-error`,role:`alert`},XE={class:`panel-heading`},ZE={class:`tag`},QE={class:`hook-card`},$E=[`aria-checked`],eD={key:0,class:`tag tool-disabled`},tD={class:`tag`},nD=[`aria-label`],rD=Id(Dr({__name:`Inspector`,setup(e){let t=H(()=>new Map(Qu.value?.tools.map(e=>[e.name,lE(e.name,e.parameters)]))),n=[{id:`session`,label:`Session`,icon:yc},{id:`git`,label:`Git`,icon:xc},{id:`host`,label:`Host`,icon:Hs},{id:`usage`,label:`Usage`,icon:Jc},{id:`auto`,label:`Auto`,icon:tc},{id:`notify`,label:`Notify`,icon:Zs},{id:`state`,label:`State`,icon:$s},{id:`tasks`,label:`Tasks`,icon:Hs},{id:`tools`,label:`Tools`,icon:_l},{id:`extensions`,label:`Extend`,icon:Qc}],r=H(()=>[{label:`Input`,tokens:Xu.value.input,cost:Xu.value.inputCost},{label:`Output`,tokens:Xu.value.output,cost:Xu.value.outputCost},{label:`Cache read`,tokens:Xu.value.cacheRead,cost:Xu.value.cacheReadCost},{label:`Cache write`,tokens:Xu.value.cacheWrite,cost:Xu.value.cacheWriteCost}]),i=H(()=>Ju.value.filter(e=>e.background).length),a=k(!1);function o(e,t){ad(async()=>{await Fu.value.configure(e),await ed(),t&&q(t)})}async function s(){let e=Ou.value,t=Nu.value;if(e&&t)try{let n=await W(e.id).agent(t.id,G.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),q(`Transcript downloaded.`)}catch(e){q(`transcript download failed: ${cu(e).slice(0,120)}`)}}async function c(){let e=Ou.value,t=Nu.value;if(e&&t){a.value=!0;try{let n=await W(e.id).exportSession(t.id),r=Uint8Array.from(atob(n.base64),e=>e.charCodeAt(0)),i=URL.createObjectURL(new Blob([r],{type:n.mime||`application/zip`})),a=document.createElement(`a`);a.href=i,a.download=n.filename,a.click(),URL.revokeObjectURL(i),q(`Bundle downloaded (${Math.max(1,Math.round(n.bytes/1024))} KiB).`)}catch(e){q(`bundle export failed: ${cu(e).slice(0,120)}`)}finally{a.value=!1}}}function l(){let e=Iu.value;e&&(K.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:Nu.value?.name??``,submit:`Save name`,run:t=>e.rename(t)})}let u=Mu.sharedState,d=k(``),f=k(``),p=k(0),m=k(!1),h=k(``),g=H(()=>d.value!==f.value),_=H(()=>g.value&&u.value?.revision!==p.value);function v(){d.value=cd(u.value?.value??{}),f.value=d.value,p.value=u.value?.revision??0,h.value=``}M(u,()=>!g.value&&v(),{immediate:!0});async function y(e){if(!m.value&&Fu.value){m.value=!0,h.value=``;try{await Fu.value.demo(`state`,e)}catch(e){h.value=cu(e)}finally{m.value=!1}}}async function b(){if(!m.value&&Fu.value){h.value=``,m.value=!0;try{let e=JSON.parse(d.value);if(!e||Array.isArray(e)||typeof e!=`object`)throw Error(`App State must be a JSON object.`);let t=await Fu.value.demo(`state`,{operation:`update`,path:``,value:e,expectedRevision:p.value});d.value=cd(t.value),f.value=d.value,p.value=t.revision,q(`Shared App State saved.`)}catch(e){h.value=cu(e)}finally{m.value=!1}}}let x=H(()=>Qu.value?.config.readOnly===!0),S=H(()=>Qu.value?.tools.filter(e=>e.offered).length??0);return(e,f)=>(F(),I(`aside`,{class:E([`inspector`,{collapsed:!A(hd),overlay:A(K).inspectorOverlay}])},[A(hd)?(F(),I(P,{key:1},[R(`div`,yE,[(F(),I(P,null,N(n,e=>R(`button`,{id:`inspector-tab-${e.id}`,key:e.id,role:`tab`,"aria-controls":`inspector-panel`,"aria-selected":A(K).tab===e.id,class:E({active:A(K).tab===e.id}),onClick:t=>A(K).tab=e.id},[(F(),L(ei(e.icon),{size:18})),B(D(e.label),1),e.id===`tasks`&&A(Ju).length?(F(),I(`span`,xE,D(A(Ju).length),1)):V(``,!0)],10,bE)),64)),R(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse inspector`,title:`Collapse inspector (${A(xd).inspector})`,onClick:f[1]||=e=>A(_d)()},[z(A(Uc),{size:18})],8,SE)]),R(`div`,{id:`inspector-panel`,class:E([`inspector-body`,{"session-panel":A(K).tab===`session`}]),role:`tabpanel`,"aria-labelledby":`inspector-tab-${A(K).tab}`},[A(K).tab===`session`?(F(),I(P,{key:0},[R(`section`,wE,[R(`h1`,null,[R(`span`,null,D(A(Nu)?.name??`Loading session`),1),R(`button`,{class:`icon-button`,title:`Rename session`,"aria-label":`Rename session`,onClick:l},[z(A(qc),{size:18})]),R(`button`,{class:`icon-button`,title:`Download transcript (markdown)`,"aria-label":`Download transcript`,onClick:s},[z(A(mc),{size:18})]),R(`button`,{class:`icon-button`,title:`Download session bundle (.zip: manifest, transcripts, configs)`,"aria-label":`Download session bundle`,disabled:a.value,onClick:c},[z(A(Hc),{size:18})],8,TE)]),R(`button`,{class:`path cwd-button`,title:A(Nu)?.cwd,"aria-label":`Show full working directory`,onClick:f[2]||=e=>A(K).dialog={kind:`path`,path:A(Nu)?.cwd??``}},[z(A(yc),{size:18}),R(`span`,DE,[R(`bdi`,OE,D(A(Nu)?.cwd),1)])],8,EE),R(`div`,kE,[R(`span`,{class:E([`status-pill`,{working:A(Yu)}])},[f[7]||=R(`i`,null,null,-1),B(D(A(Yu)?`Working`:`Idle`),1)],2),i.value?(F(),I(`span`,AE,D(i.value)+` background`,1)):V(``,!0),R(`span`,{class:`saved`,title:A(Ou)?.id},[z(A(rl),{size:18}),B(D(A(Ou)?.name??A(Ou)?.id),1)],8,jE),A(Ou)?(F(),L(Ly,{key:1,device:A(Ou)},null,8,[`device`])):V(``,!0)])]),A(Ou)?(F(),L(eb,{key:0,device:A(Ou)},null,8,[`device`])):V(``,!0),R(`section`,ME,[f[15]||=R(`div`,{class:`section-label`},[R(`span`,null,`AGENT`)],-1),R(`button`,{class:`model-button`,onClick:f[3]||=e=>A(K).dialog={kind:`models`}},[R(`img`,{src:A(ld)(A(Gu).agent.model?.modelId),alt:``},null,8,NE),R(`div`,null,[R(`strong`,null,D(A(Zu)?.name??A(Gu).agent.model?.modelId??`Loading…`),1),R(`small`,null,D(A(Zu)?.tier??``)+` / `+D(A(Gu).agent.model?.provider??``),1)]),z(A(rc),{size:18})]),R(`div`,PE,[f[8]||=R(`span`,null,`Thinking`,-1),R(`select`,{"aria-label":`Thinking level`,value:A(Gu).agent.thinkingLevel??`low`,onChange:f[4]||=e=>o({thinkingLevel:e.target.value},`Thinking ${e.target.value}. Used on the next turn.`)},[(F(!0),I(P,null,N(A(tv),e=>(F(),I(`option`,{key:e},D(e),1))),128))],40,FE)]),z(oE),R(`section`,IE,[f[14]||=R(`div`,{class:`section-label`},[R(`span`,{id:`stats-title`},`STATS`)],-1),R(`div`,LE,[R(`div`,{title:`${A(Xu).tokens.toLocaleString(`en-US`)} total tokens`},[R(`span`,null,D(A(sd)(A(Xu).tokens)),1),f[9]||=R(`small`,null,`total tokens`,-1)],8,RE),R(`div`,null,[R(`span`,null,`$`+D(A(Xu).cost.toFixed(4)),1),f[10]||=R(`small`,null,`agent cost`,-1)]),R(`div`,null,[R(`span`,null,D(A(Qu)?.tools.length??0),1),f[11]||=R(`small`,null,`tools`,-1)])]),R(`table`,zE,[f[13]||=R(`thead`,null,[R(`tr`,null,[R(`th`,{scope:`col`},`Type`),R(`th`,{scope:`col`},`Tokens`),R(`th`,{scope:`col`},`Cost (USD)`)])],-1),R(`tbody`,null,[(F(!0),I(P,null,N(r.value,e=>(F(),I(`tr`,{key:e.label},[R(`th`,BE,D(e.label),1),R(`td`,null,D(e.tokens.toLocaleString(`en-US`)),1),R(`td`,null,`$`+D(e.cost.toFixed(4)),1)]))),128)),R(`tr`,VE,[f[12]||=R(`th`,{scope:`row`},`Total`,-1),R(`td`,null,D(A(Xu).tokens.toLocaleString(`en-US`)),1),R(`td`,null,`$`+D(A(Xu).cost.toFixed(4)),1)])])])])])],64)):V(``,!0),A(K).tab===`state`?(F(),I(P,{key:1},[R(`div`,HE,[f[16]||=R(`h2`,null,`App State`,-1),z(A($s),{size:18})]),R(`p`,UE,` One shared JSON object for every agent, session and fork on `+D(A(Ou)?.name??A(Ou)?.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(R(`textarea`,{"onUpdate:modelValue":f[5]||=e=>d.value=e,class:`app-state-json`,"aria-label":`App State JSON`,spellcheck:`false`,disabled:m.value||!A(u),rows:`12`},null,8,WE),[[bs,d.value]]),R(`div`,GE,[_.value?(F(),I(`span`,KE,`State changed elsewhere. Load the latest JSON before saving.`)):V(``,!0),g.value?(F(),I(`button`,{key:1,class:`secondary`,disabled:m.value,onClick:v},D(_.value?`Load latest`:`Reset`),9,qE)):V(``,!0),R(`button`,{class:`primary small`,disabled:!g.value||m.value||_.value,onClick:b},D(m.value?`Saving…`:`Save JSON`),9,JE)]),h.value?(F(),I(`p`,YE,D(h.value),1)):V(``,!0),z(jy,{value:A(u)?.value??{},disabled:m.value||g.value||!A(u),onChange:y},null,8,[`value`,`disabled`])],64)):V(``,!0),A(K).tab===`tasks`?(F(),L(jb,{key:2})):V(``,!0),A(K).tab===`git`?(F(),L(wC,{key:3})):V(``,!0),A(K).tab===`host`?(F(),L(KC,{key:4})):V(``,!0),A(K).tab===`usage`?(F(),L(Fw,{key:5})):V(``,!0),A(K).tab===`auto`?(F(),L(lT,{key:6})):V(``,!0),A(K).tab===`notify`?(F(),L(PT,{key:7})):V(``,!0),A(K).tab===`extensions`?(F(),L(HT,{key:8})):V(``,!0),A(K).tab===`tools`?(F(),I(P,{key:9},[R(`div`,XE,[f[17]||=R(`h2`,null,`Tools`,-1),R(`span`,ZE,D(S.value)+` / `+D(A(Qu)?.tools.length??0),1)]),f[21]||=R(`p`,{class:`hint`},` Every tool this agent's extensions provide. Open one to see its definition. `,-1),R(`div`,QE,[R(`div`,null,[z(A(al),{size:18}),f[19]||=R(`strong`,null,`Read only`,-1),R(`button`,{class:E([`switch`,{on:x.value}]),role:`switch`,"aria-checked":x.value,"aria-label":`Read only`,onClick:f[6]||=e=>o({readOnly:!x.value},x.value?`Read only off. Every tool is back.`:`Read only on. Tools that write are disabled.`)},[...f[18]||=[R(`span`,null,null,-1)]],10,$E)]),f[20]||=R(`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)]),(F(!0),I(P,null,N(A(Qu)?.tools,e=>(F(),I(`details`,{key:e.name,class:E([`tool-row`,{disabled:!e.offered}])},[R(`summary`,null,[z(A(_l),{size:18}),R(`strong`,null,D(e.name),1),e.offered?V(``,!0):(F(),I(`span`,eD,`disabled`)),R(`span`,tD,D(e.replay===`safe`?`replay safe`:`interrupt on crash`),1)]),R(`p`,null,D(e.description),1),e.parameters?(F(),I(`pre`,{key:0,class:`tool-signature`,"aria-label":`${e.name} TypeScript definition`},[R(`code`,null,[(F(!0),I(P,null,N(t.value.get(e.name),(e,t)=>(F(),I(`span`,{key:t,class:E(`tk-${e.kind}`)},D(e.text),3))),128))])],8,nD)):V(``,!0),R(`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)):V(``,!0)],10,CE)],64)):(F(),I(`div`,hE,[R(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand inspector`,title:`Expand inspector (${A(xd).inspector})`,onClick:f[0]||=e=>A(gd)()},[z(A(Wc),{size:18})],8,gE),(F(),I(P,null,N(n,e=>R(`button`,{key:e.id,class:E([`rail-tab`,{active:A(K).tab===e.id}]),"aria-label":`Open ${e.label}`,title:e.label,onClick:t=>A(gd)(e.id)},[(F(),L(ei(e.icon),{size:20})),e.id===`tasks`&&A(Ju).length?(F(),I(`span`,vE,D(A(Ju).length),1)):V(``,!0)],10,_E)),64))]))],2))}}),[[`__scopeId`,`data-v-9e10c16d`]]),iD={class:`chat-empty`},aD={class:`eyebrow`},oD={key:3,class:`hint offline-error`},sD={key:4,class:`offline-command`},cD={key:5,class:`hint`},lD={key:6,class:`hint`},uD={class:`offline-actions`},dD=[`disabled`],fD={key:7,class:`message-error`,role:`alert`},pD=Dr({__name:`OfflinePanel`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=H(()=>{let e=t.device,n=e.source===`config`;switch(e.status){case`checking`:return{title:`Checking ${e.id}…`,text:`Probing the device. This view fills in as soon as it answers.`};case`unauthorized`:return e.transport===`tunnel`?{title:`${e.id} tunnel credentials are not valid`,text:`Pair the device again — the hub will mint a fresh credential.`}:{title:e.hasToken?`${e.id} rejected its token`:`No token for ${e.id}`,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.id} 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.id} speaks another API version`,text:`Update the device's dpi-backend.`,command:n?`just net deploy ${e.id}`:void 0};default:return{title:`${e.id} is offline`,text:`Last seen ${ud(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 su.check(t.device.id);e.status===`online`&&q(`${e.id} is online.`)}catch(e){r.value=cu(e)}finally{n.value=!1}}async function o(e){try{await navigator.clipboard.writeText(e),q(`Copied.`)}catch{q(`Clipboard needs localhost or HTTPS. Select the text to copy.`)}}return(t,s)=>(F(),I(`section`,{class:E([`chat-panel offline-panel`,e.device.status]),"aria-live":`polite`},[R(`div`,iD,[e.device.status===`checking`?(F(),L(A(Ic),{key:0,class:`spin`,size:30})):e.device.status===`mismatch`||e.device.status===`unauthorized`?(F(),L(A(il),{key:1,size:30})):(F(),L(A(ml),{key:2,size:30})),R(`span`,aD,D(e.device.kind.toUpperCase())+` · `+D(e.device.url??(e.device.transport===`tunnel`?`tunnel`:`no endpoint`)),1),R(`h2`,null,D(i.value.title),1),R(`p`,null,D(i.value.text),1),e.device.error?(F(),I(`p`,oD,D(e.device.error),1)):V(``,!0),i.value.command?(F(),I(`div`,sD,[R(`code`,null,D(i.value.command),1),R(`button`,{class:`icon-button`,"aria-label":`Copy command`,onClick:s[0]||=e=>o(i.value.command)},[z(A(cc),{size:18})])])):V(``,!0),i.value.command?(F(),I(`p`,cD,`Run it in this repo's terminal, then press Check now.`)):V(``,!0),i.value.alt?(F(),I(`p`,lD,[s[2]||=B(` Never deployed or rebuilt? `,-1),R(`code`,null,D(i.value.alt),1),s[3]||=B(` provisions it from scratch. `,-1)])):V(``,!0),R(`div`,uD,[R(`button`,{class:`secondary`,disabled:n.value,onClick:s[1]||=e=>a()},[z(A($c),{size:18}),B(D(n.value?`Checking…`:`Check now`),1)],8,dD)]),r.value?(F(),I(`p`,fD,D(r.value),1)):V(``,!0)])],2))}}),mD={class:`dir-browser`},hD={class:`dir-path`},gD=[`disabled`],_D=[`aria-busy`],vD=[`title`],yD=[`aria-selected`,`title`,`onClick`],bD={key:1,class:`hint`},xD={key:0,class:`message-error`,role:`alert`},SD=Dr({__name:`DirBrowser`,props:ci({deviceId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=Oi(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 W(c).dirs(e);return s===o?(r.value=t,t.path&&(n.value=t.path),t):void 0}catch(e){s===o&&(a.value=cu(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)=>(F(),I(`div`,mD,[R(`div`,hD,[j(R(`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]||=Ms(As(e=>s(n.value),[`prevent`]),[`enter`])},null,544),[[bs,n.value]]),R(`button`,{type:`button`,class:`secondary small`,disabled:i.value||!n.value,onClick:t[2]||=e=>s(n.value)},` Go `,8,gD)]),R(`div`,{class:`dir-list`,role:`listbox`,"aria-label":`Directories`,"aria-busy":i.value},[R(`button`,{type:`button`,class:`dir-item`,title:`Start directories`,onClick:t[3]||=e=>s(``)},[z(A(Dc),{size:16}),t[5]||=R(`span`,null,`Start dirs`,-1)]),r.value?.parent?(F(),I(`button`,{key:0,type:`button`,class:`dir-item`,title:r.value.parent,onClick:t[4]||=e=>s(r.value.parent)},[z(A(uc),{size:16}),t[6]||=R(`span`,null,`..`,-1)],8,vD)):V(``,!0),(F(!0),I(P,null,N(r.value?.dirs,e=>(F(),I(`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?(F(),L(A(yc),{key:0,size:16})):(F(),L(A(bc),{key:1,size:16})),R(`span`,null,D(e.name),1)],8,yD))),128)),r.value&&!r.value.dirs.length?(F(),I(`p`,bD,`No subdirectories.`)):V(``,!0)],8,_D),a.value?(F(),I(`p`,xD,D(a.value),1)):V(``,!0)]))}}),CD={key:0,class:`message-error`},wD=[`value`],TD={class:`field`},ED={key:0,class:`recent-cwds`},DD=[`title`,`onClick`],OD={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`},kD=[`value`],AD={key:2,class:`message-error`,role:`alert`},jD=[`disabled`],MD=`dpi-recent-cwds`,ND=Id(Dr({__name:`NewSessionDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=H(()=>bu.devices.value.filter(e=>e.status===`online`)),a=k(i.value.find(e=>e.id===n.deviceId)?.id??i.value[0]?.id??``),o=H(()=>i.value.find(e=>e.id===a.value)),s=H(()=>{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=H(()=>!s.value.length||(o.value?.info?.models?.length??0)===0),l=H(()=>!!o.value?.info?.providerKeyMissing),u=e=>`${e.provider}/${e.id}`,d=k({name:``,cwd:``,model:``}),f=H(()=>{try{return JSON.parse(localStorage.getItem(MD)??`{}`)[a.value]??[]}catch{return[]}}),p=(e,t)=>{try{let n=JSON.parse(localStorage.getItem(MD)??`{}`),r=[t,...(n[e]??[]).filter(e=>e!==t)].slice(0,6);localStorage.setItem(MD,JSON.stringify({...n,[e]:r}))}catch{}},m=k(!1),h=k(``);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 g(){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 W(o.value.id).createSession({name:d.value.name.trim()||`New session`,cwd:d.value.cwd.trim(),model:{provider:e.provider,modelId:e.id}});p(o.value.id,t.cwd);let n=t.agents.find(e=>e.kind===`root`)??t.agents[0];Lu({deviceId:o.value.id,sessionId:t.id,agentId:n?.id??1}),q(`Session created on ${o.value.id}.`),r(`close`)}catch(e){h.value=cu(e)}finally{m.value=!1}}}return(e,t)=>(F(),I(`div`,{class:`modal-backdrop`,onClick:t[6]||=As(e=>r(`close`),[`self`])},[R(`form`,{class:`modal session-modal`,onSubmit:As(g,[`prevent`])},[R(`header`,null,[t[7]||=R(`div`,null,[R(`span`,{class:`eyebrow`},`A PERSISTENT WORKSPACE`),R(`h2`,null,`New session`)],-1),R(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close new session`,onClick:t[0]||=e=>r(`close`)},[z(A(vl),{size:18})])]),i.value.length?(F(),I(P,{key:1},[R(`label`,null,[t[8]||=B(`Device`,-1),j(R(`select`,{"onUpdate:modelValue":t[1]||=e=>a.value=e,"aria-label":`Device`},[(F(!0),I(P,null,N(i.value,e=>(F(),I(`option`,{key:e.id,value:e.id},D(e.name)+D(e.info?.hostname&&e.info.hostname!==e.name?` · ${e.info.hostname}`:``),9,wD))),128))],512),[[Cs,a.value]])]),R(`label`,null,[t[9]||=B(`Session name`,-1),j(R(`input`,{"onUpdate:modelValue":t[2]||=e=>d.value.name=e,autofocus:``,placeholder:`My durable agent`,maxlength:`100`},null,512),[[bs,d.value.name]])]),R(`div`,TD,[R(`span`,null,`Working directory on `+D(i.value.find(e=>e.id===a.value)?.name??a.value),1),f.value.length?(F(),I(`div`,ED,[(F(!0),I(P,null,N(f.value,e=>(F(),I(`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,DD))),128))])):V(``,!0),z(SD,{modelValue:d.value.cwd,"onUpdate:modelValue":t[3]||=e=>d.value.cwd=e,"device-id":a.value},null,8,[`modelValue`,`device-id`])]),R(`label`,null,[t[10]||=B(`Model`,-1),c.value||l.value?(F(),I(`span`,OD,`no API key on device — chat needs one`)):V(``,!0),j(R(`select`,{"onUpdate:modelValue":t[4]||=e=>d.value.model=e,"aria-label":`New session model`},[(F(!0),I(P,null,N(s.value,e=>(F(),I(`option`,{key:u(e),value:u(e)},D(e.tier)+` / `+D(e.name),9,kD))),128))],512),[[Cs,d.value.model]])])],64)):(F(),I(`p`,CD,` No device is online. Start one with just backend run or just net up <id>, then try again. `)),h.value?(F(),I(`p`,AD,D(h.value),1)):V(``,!0),R(`footer`,null,[R(`button`,{type:`button`,class:`secondary`,onClick:t[5]||=e=>r(`close`)},`Cancel`),R(`button`,{class:`primary`,disabled:m.value||!d.value.model||!d.value.cwd||!o.value},[z(A(Xc),{size:18}),B(D(m.value?`Creating…`:`Create session`),1)],8,jD)])],32)]))}}),[[`__scopeId`,`data-v-09171f1a`]]),PD=new Uint8Array(512),FD=new Uint8Array(256);(()=>{let e=1;for(let t=0;t<255;t++)PD[t]=e,FD[e]=t,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)PD[e]=PD[e-255]})();var ID=(e,t)=>e===0||t===0?0:PD[FD[e]+FD[t]];function LD(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]^=ID(t[r],PD[n]);t=e}return t}function RD(e,t){let n=LD(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]^=ID(n[i+1],e)}return r}var zD=[21,25,29,33,37,41,45,49,53,57,61,65],BD=[19,34,55,80,108,136,156,194,232,274,324,370],VD=[7,10,15,20,26,36,40,48,60,72,80,96],HD=[7,10,15,20,26,18,20,24,30,18,20,24],UD=[[[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]]],WD=[[],[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]],GD=e=>e<=9?8:16;function KD(e){for(let t=1;t<=zD.length;t++)if(4+GD(t)+e*8<=BD[t-1]*8)return t;throw Error(`qr: payload too long (${e} bytes; v12L max ${BD[11]-3})`)}function qD(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,GD(t));for(let e of n)i(e,8);let a=BD[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 JD(e,t){let n=HD[e-1],r=[],i=0;for(let[n,a]of UD[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=>RD(e,n));for(let e=0;e<n;e++)for(let t of s)a.push(t[e]);return a}function YD(e){return Array.from({length:e},()=>Array(e).fill(!1))}function XD(e,t){let n=zD[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=WD[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 ZD(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 QD(e,t){let n=zD[0]*0+e.length,r=ZD(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 $D(e,t,n,r){let i=e.length;zD[n-1]*zD[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(tO(l,i,n))continue;if(o>=(BD[n-1]+VD[n-1])*8){o++;continue}let t=a(o++);eO(l,i,r)&&(t=!t),e[l][i]=t}}s=!s}}function eO(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 tO(e,t,n){let r=zD[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=WD[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 nO(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 rO(e,t){let n=KD(new TextEncoder().encode(e).length),r=zD[n-1],i=JD(n,qD(e,n)),a=YD(r);return XD(a,n),$D(a,i,n,t),QD(a,t),a}function iO(e,t){if(t!==void 0)return rO(e,t);let n;for(let t=0;t<8;t++){let r=rO(e,t),i=nO(r);(!n||i<n.score)&&(n={m:r,score:i})}return n.m}function aO(e,t=160){let n=iO(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 oO={class:`device-handoff`,"aria-label":`Pair this machine`},sO={class:`row`},cO=[`disabled`],lO=[`disabled`],uO={key:0,class:`target`,"data-testid":`device-url`},dO={key:1,class:`err`},fO=Id(Dr({__name:`DeviceHandoff`,props:{offerFragment:{}},setup(e){let t=e,n=k(`4780`),r=k(!1),i=H(()=>{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)=>(F(),I(`section`,oO,[R(`header`,null,[z(A(zc),{size:18}),t[1]||=R(`h3`,null,`Pair THIS machine`,-1)]),t[4]||=R(`p`,{class:`what`},[B(` 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 `),R(`code`,null,`dpi device`),B(` there first. `)],-1),R(`div`,sO,[R(`label`,null,[t[2]||=B(` local port `,-1),j(R(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,inputmode:`numeric`,spellcheck:`false`,"aria-label":`Local dpi backend port`},null,512),[[bs,n.value]])]),R(`button`,{class:`primary`,type:`button`,disabled:!i.value,onClick:a},[z(A(hc),{size:15}),t[3]||=B(`Open the device page `,-1)],8,cO),R(`button`,{class:`secondary`,type:`button`,disabled:!i.value,onClick:o},[z(A(cc),{size:15}),B(D(r.value?`Copied`:`Copy link`),1)],8,lO)]),i.value?(F(),I(`p`,uO,D(i.value),1)):V(``,!0),i.value?V(``,!0):(F(),I(`p`,dO,`port must be 1–65535`))]))}}),[[`__scopeId`,`data-v-01884b7b`]]);function pO(e){return SO(e)&&!mO(e)&&!EO(e)&&Symbol.asyncIterator in e}function mO(e){return Array.isArray(e)}function hO(e){return typeof e==`bigint`}function gO(e){return typeof e==`boolean`}function _O(e){return e instanceof globalThis.Date}function vO(e){return typeof e==`function`}function yO(e){return SO(e)&&!mO(e)&&!EO(e)&&Symbol.iterator in e}function bO(e){return e===null}function xO(e){return typeof e==`number`}function SO(e){return typeof e==`object`&&!!e}function CO(e){return e instanceof globalThis.RegExp}function wO(e){return typeof e==`string`}function TO(e){return typeof e==`symbol`}function EO(e){return e instanceof globalThis.Uint8Array}function DO(e){return e===void 0}function OO(e){return e.map(e=>NO(e))}function kO(e){return new Date(e.getTime())}function AO(e){return new Uint8Array(e)}function jO(e){return new RegExp(e.source,e.flags)}function MO(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=NO(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=NO(e[n]);return t}function NO(e){return mO(e)?OO(e):_O(e)?kO(e):EO(e)?AO(e):CO(e)?jO(e):SO(e)?MO(e):e}function PO(e){return NO(e)}function FO(e,t){return PO(t===void 0?e:{...t,...e})}function IO(e){return typeof e==`object`&&!!e}function LO(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function RO(e){return e===void 0}function zO(e){return typeof e==`number`}var BO;(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=IO(t);return e.AllowArrayObject?n:n&&!LO(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?zO(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=RO(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(BO||={});function VO(e){return globalThis.Object.freeze(e).map(e=>KO(e))}function HO(e){return e}function UO(e){return e}function WO(e){return e}function GO(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=KO(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=KO(e[n]);return globalThis.Object.freeze(t)}function KO(e){return mO(e)?VO(e):_O(e)?HO(e):EO(e)?UO(e):CO(e)?WO(e):SO(e)?GO(e):e}function J(e,t){let n=t===void 0?e:{...t,...e};switch(BO.InstanceMode){case`freeze`:return KO(n);case`clone`:return PO(n);default:return n}}var qO=class extends Error{constructor(e){super(e)}},JO=Symbol.for(`TypeBox.Transform`),YO=Symbol.for(`TypeBox.Readonly`),XO=Symbol.for(`TypeBox.Optional`),ZO=Symbol.for(`TypeBox.Hint`),Y=Symbol.for(`TypeBox.Kind`);function QO(e){return SO(e)&&e[YO]===`Readonly`}function $O(e){return SO(e)&&e[XO]===`Optional`}function ek(e){return X(e,`Any`)}function tk(e){return X(e,`Argument`)}function nk(e){return X(e,`Array`)}function rk(e){return X(e,`AsyncIterator`)}function ik(e){return X(e,`BigInt`)}function ak(e){return X(e,`Boolean`)}function ok(e){return X(e,`Computed`)}function sk(e){return X(e,`Constructor`)}function ck(e){return X(e,`Date`)}function lk(e){return X(e,`Function`)}function uk(e){return X(e,`Integer`)}function dk(e){return X(e,`Intersect`)}function fk(e){return X(e,`Iterator`)}function X(e,t){return SO(e)&&Y in e&&e[Y]===t}function pk(e){return gO(e)||xO(e)||wO(e)}function mk(e){return X(e,`Literal`)}function hk(e){return X(e,`MappedKey`)}function gk(e){return X(e,`MappedResult`)}function _k(e){return X(e,`Never`)}function vk(e){return X(e,`Not`)}function yk(e){return X(e,`Null`)}function bk(e){return X(e,`Number`)}function xk(e){return X(e,`Object`)}function Sk(e){return X(e,`Promise`)}function Ck(e){return X(e,`Record`)}function wk(e){return X(e,`Ref`)}function Tk(e){return X(e,`RegExp`)}function Ek(e){return X(e,`String`)}function Dk(e){return X(e,`Symbol`)}function Ok(e){return X(e,`TemplateLiteral`)}function kk(e){return X(e,`This`)}function Ak(e){return SO(e)&&JO in e}function jk(e){return X(e,`Tuple`)}function Mk(e){return X(e,`Undefined`)}function Nk(e){return X(e,`Union`)}function Pk(e){return X(e,`Uint8Array`)}function Fk(e){return X(e,`Unknown`)}function Ik(e){return X(e,`Unsafe`)}function Lk(e){return X(e,`Void`)}function Rk(e){return SO(e)&&Y in e&&wO(e[Y])}function zk(e){return ek(e)||tk(e)||nk(e)||ak(e)||ik(e)||rk(e)||ok(e)||sk(e)||ck(e)||lk(e)||uk(e)||dk(e)||fk(e)||mk(e)||hk(e)||gk(e)||_k(e)||vk(e)||yk(e)||bk(e)||xk(e)||Sk(e)||Ck(e)||wk(e)||Tk(e)||Ek(e)||Dk(e)||Ok(e)||kk(e)||jk(e)||Mk(e)||Nk(e)||Pk(e)||Fk(e)||Ik(e)||Lk(e)||Rk(e)}var Bk=`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 Vk(e){try{return new RegExp(e),!0}catch{return!1}}function Hk(e){if(!wO(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 Uk(e){return Kk(e)||VA(e)}function Wk(e){return DO(e)||hO(e)}function Gk(e){return DO(e)||xO(e)}function Kk(e){return DO(e)||gO(e)}function qk(e){return DO(e)||wO(e)}function Jk(e){return DO(e)||wO(e)&&Hk(e)&&Vk(e)}function Yk(e){return DO(e)||wO(e)&&Hk(e)}function Xk(e){return DO(e)||VA(e)}function Zk(e){return SO(e)&&e[XO]===`Optional`}function Qk(e){return Z(e,`Any`)&&qk(e.$id)}function $k(e){return Z(e,`Argument`)&&xO(e.index)}function eA(e){return Z(e,`Array`)&&e.type===`array`&&qk(e.$id)&&VA(e.items)&&Gk(e.minItems)&&Gk(e.maxItems)&&Kk(e.uniqueItems)&&Xk(e.contains)&&Gk(e.minContains)&&Gk(e.maxContains)}function tA(e){return Z(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&qk(e.$id)&&VA(e.items)}function nA(e){return Z(e,`BigInt`)&&e.type===`bigint`&&qk(e.$id)&&Wk(e.exclusiveMaximum)&&Wk(e.exclusiveMinimum)&&Wk(e.maximum)&&Wk(e.minimum)&&Wk(e.multipleOf)}function rA(e){return Z(e,`Boolean`)&&e.type===`boolean`&&qk(e.$id)}function iA(e){return Z(e,`Computed`)&&wO(e.target)&&mO(e.parameters)&&e.parameters.every(e=>VA(e))}function aA(e){return Z(e,`Constructor`)&&e.type===`Constructor`&&qk(e.$id)&&mO(e.parameters)&&e.parameters.every(e=>VA(e))&&VA(e.returns)}function oA(e){return Z(e,`Date`)&&e.type===`Date`&&qk(e.$id)&&Gk(e.exclusiveMaximumTimestamp)&&Gk(e.exclusiveMinimumTimestamp)&&Gk(e.maximumTimestamp)&&Gk(e.minimumTimestamp)&&Gk(e.multipleOfTimestamp)}function sA(e){return Z(e,`Function`)&&e.type===`Function`&&qk(e.$id)&&mO(e.parameters)&&e.parameters.every(e=>VA(e))&&VA(e.returns)}function cA(e){return Z(e,`Integer`)&&e.type===`integer`&&qk(e.$id)&&Gk(e.exclusiveMaximum)&&Gk(e.exclusiveMinimum)&&Gk(e.maximum)&&Gk(e.minimum)&&Gk(e.multipleOf)}function lA(e){return SO(e)&&Object.entries(e).every(([e,t])=>Hk(e)&&VA(t))}function uA(e){return Z(e,`Intersect`)&&!(wO(e.type)&&e.type!==`object`)&&mO(e.allOf)&&e.allOf.every(e=>VA(e)&&!MA(e))&&qk(e.type)&&(Kk(e.unevaluatedProperties)||Xk(e.unevaluatedProperties))&&qk(e.$id)}function dA(e){return Z(e,`Iterator`)&&e.type===`Iterator`&&qk(e.$id)&&VA(e.items)}function Z(e,t){return SO(e)&&Y in e&&e[Y]===t}function fA(e){return hA(e)&&wO(e.const)}function pA(e){return hA(e)&&xO(e.const)}function mA(e){return hA(e)&&gO(e.const)}function hA(e){return Z(e,`Literal`)&&qk(e.$id)&&gA(e.const)}function gA(e){return gO(e)||xO(e)||wO(e)}function _A(e){return Z(e,`MappedKey`)&&mO(e.keys)&&e.keys.every(e=>xO(e)||wO(e))}function vA(e){return Z(e,`MappedResult`)&&lA(e.properties)}function yA(e){return Z(e,`Never`)&&SO(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function bA(e){return Z(e,`Not`)&&VA(e.not)}function xA(e){return Z(e,`Null`)&&e.type===`null`&&qk(e.$id)}function SA(e){return Z(e,`Number`)&&e.type===`number`&&qk(e.$id)&&Gk(e.exclusiveMaximum)&&Gk(e.exclusiveMinimum)&&Gk(e.maximum)&&Gk(e.minimum)&&Gk(e.multipleOf)}function CA(e){return Z(e,`Object`)&&e.type===`object`&&qk(e.$id)&&lA(e.properties)&&Uk(e.additionalProperties)&&Gk(e.minProperties)&&Gk(e.maxProperties)}function wA(e){return Z(e,`Promise`)&&e.type===`Promise`&&qk(e.$id)&&VA(e.item)}function TA(e){return Z(e,`Record`)&&e.type===`object`&&qk(e.$id)&&Uk(e.additionalProperties)&&SO(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&Vk(t[0])&&SO(e.patternProperties)&&VA(e.patternProperties[t[0]])})(e)}function EA(e){return Z(e,`Ref`)&&qk(e.$id)&&wO(e.$ref)}function DA(e){return Z(e,`RegExp`)&&qk(e.$id)&&wO(e.source)&&wO(e.flags)&&Gk(e.maxLength)&&Gk(e.minLength)}function OA(e){return Z(e,`String`)&&e.type===`string`&&qk(e.$id)&&Gk(e.minLength)&&Gk(e.maxLength)&&Jk(e.pattern)&&Yk(e.format)}function kA(e){return Z(e,`Symbol`)&&e.type===`symbol`&&qk(e.$id)}function AA(e){return Z(e,`TemplateLiteral`)&&e.type===`string`&&wO(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function jA(e){return Z(e,`This`)&&qk(e.$id)&&wO(e.$ref)}function MA(e){return SO(e)&&JO in e}function NA(e){return Z(e,`Tuple`)&&e.type===`array`&&qk(e.$id)&&xO(e.minItems)&&xO(e.maxItems)&&e.minItems===e.maxItems&&(DO(e.items)&&DO(e.additionalItems)&&e.minItems===0||mO(e.items)&&e.items.every(e=>VA(e)))}function PA(e){return Z(e,`Undefined`)&&e.type===`undefined`&&qk(e.$id)}function FA(e){return Z(e,`Union`)&&qk(e.$id)&&SO(e)&&mO(e.anyOf)&&e.anyOf.every(e=>VA(e))}function IA(e){return Z(e,`Uint8Array`)&&e.type===`Uint8Array`&&qk(e.$id)&&Gk(e.minByteLength)&&Gk(e.maxByteLength)}function LA(e){return Z(e,`Unknown`)&&qk(e.$id)}function RA(e){return Z(e,`Unsafe`)}function zA(e){return Z(e,`Void`)&&e.type===`void`&&qk(e.$id)}function BA(e){return SO(e)&&Y in e&&wO(e[Y])&&!Bk.includes(e[Y])}function VA(e){return SO(e)&&(Qk(e)||$k(e)||eA(e)||rA(e)||nA(e)||tA(e)||iA(e)||aA(e)||oA(e)||sA(e)||cA(e)||uA(e)||dA(e)||hA(e)||_A(e)||vA(e)||yA(e)||bA(e)||xA(e)||SA(e)||CA(e)||wA(e)||TA(e)||EA(e)||DA(e)||OA(e)||kA(e)||AA(e)||jA(e)||NA(e)||PA(e)||FA(e)||IA(e)||LA(e)||RA(e)||zA(e)||BA(e))}var HA=`(true|false)`,UA=`(0|[1-9][0-9]*)`,WA=`(.*)`,GA=`(?!.*)`;`${HA}`;var KA=`^${UA}$`,qA=`^${WA}$`,JA=`^${GA}$`;function YA(e,t){return e.includes(t)}function XA(e){return[...new Set(e)]}function ZA(e,t){return e.filter(e=>t.includes(e))}function QA(e,t){return e.reduce((e,t)=>ZA(e,t),t)}function $A(e){return e.length===1?e[0]:e.length>1?QA(e.slice(1),e[0]):[]}function ej(e){let t=[];for(let n of e)t.push(...n);return t}function tj(e){return J({[Y]:`Any`},e)}function nj(e,t){return J({[Y]:`Array`,type:`array`,items:e},t)}function rj(e){return J({[Y]:`Argument`,index:e})}function ij(e,t){return J({[Y]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function aj(e,t,n){return J({[Y]:`Computed`,target:e,parameters:t},n)}function oj(e,t){let{[t]:n,...r}=e;return r}function sj(e,t){return t.reduce((e,t)=>oj(e,t),e)}function cj(e){return J({[Y]:`Never`,not:{}},e)}function lj(e){return J({[Y]:`MappedResult`,properties:e})}function uj(e,t,n){return J({[Y]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function dj(e,t,n){return J({[Y]:`Function`,type:`Function`,parameters:e,returns:t},n)}function fj(e,t){return J({[Y]:`Union`,anyOf:e},t)}function pj(e){return e.some(e=>$O(e))}function mj(e){return e.map(e=>$O(e)?hj(e):e)}function hj(e){return sj(e,[XO])}function gj(e,t){return pj(e)?nN(fj(mj(e),t)):fj(mj(e),t)}function _j(e,t){return e.length===1?J(e[0],t):e.length===0?cj(t):gj(e,t)}function vj(e,t){return e.length===0?cj(t):e.length===1?J(e[0],t):fj(e,t)}var yj=class extends qO{};function bj(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function xj(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function Sj(e,t){return xj(e,t,`(`)}function Cj(e,t){return xj(e,t,`)`)}function wj(e,t){return xj(e,t,`|`)}function Tj(e){if(!(Sj(e,0)&&Cj(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(Sj(e,n)&&(t+=1),Cj(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function Ej(e){return e.slice(1,e.length-1)}function Dj(e){let t=0;for(let n=0;n<e.length;n++)if(Sj(e,n)&&(t+=1),Cj(e,n)&&--t,wj(e,n)&&t===0)return!0;return!1}function Oj(e){for(let t=0;t<e.length;t++)if(Sj(e,t))return!0;return!1}function kj(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(Sj(e,i)&&(t+=1),Cj(e,i)&&--t,wj(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(jj(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(jj(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function Aj(e){function t(e,t){if(!Sj(e,t))throw new yj(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(Sj(e,r)&&(n+=1),Cj(e,r)&&--n,n===0)return[t,r];throw new yj(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(Sj(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(Sj(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(jj(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(jj(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function jj(e){return Tj(e)?jj(Ej(e)):Dj(e)?kj(e):Oj(e)?Aj(e):{type:`const`,const:bj(e)}}function Mj(e){return jj(e.slice(1,e.length-1))}var Nj=class extends qO{};function Pj(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 Fj(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 Ij(e){return e.type===`const`&&e.const===`.*`}function Lj(e){return Pj(e)||Ij(e)?!1:Fj(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>Lj(e)):e.type===`const`||(()=>{throw new Nj(`Unknown expression type`)})()}function Rj(e){return Lj(Mj(e.pattern))}var zj=class extends qO{};function*Bj(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of Bj(e.slice(1)))yield`${t}${n}`}function*Vj(e){return yield*Bj(e.expr.map(e=>[...Wj(e)]))}function*Hj(e){for(let t of e.expr)yield*Wj(t)}function*Uj(e){return yield e.const}function*Wj(e){return e.type===`and`?yield*Vj(e):e.type===`or`?yield*Hj(e):e.type===`const`?yield*Uj(e):(()=>{throw new zj(`Unknown expression`)})()}function Gj(e){let t=Mj(e.pattern);return Lj(t)?[...Wj(t)]:[]}function Kj(e,t){return J({[Y]:`Literal`,const:e,type:typeof e},t)}function qj(e){return J({[Y]:`Boolean`,type:`boolean`},e)}function Jj(e){return J({[Y]:`BigInt`,type:`bigint`},e)}function Yj(e){return J({[Y]:`Number`,type:`number`},e)}function Xj(e){return J({[Y]:`String`,type:`string`},e)}function*Zj(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield qj():t===`number`?yield Yj():t===`bigint`?yield Jj():t===`string`?yield Xj():yield(()=>{let e=t.split(`|`).map(e=>Kj(e.trim()));return e.length===0?cj():e.length===1?e[0]:_j(e)})()}function*Qj(e){if(e[1]!==`{`)return yield*[Kj(`$`),...$j(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=Zj(e.slice(2,t)),r=$j(e.slice(t+1));return yield*[...n,...r]}yield Kj(e)}function*$j(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[Kj(e.slice(0,t)),...Qj(e.slice(t))];yield Kj(e)}function eM(e){return[...$j(e)]}var tM=class extends qO{};function nM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function rM(e,t){return Ok(e)?e.pattern.slice(1,e.pattern.length-1):Nk(e)?`(${e.anyOf.map(e=>rM(e,t)).join(`|`)})`:bk(e)||uk(e)||ik(e)?`${t}${UA}`:Ek(e)?`${t}${WA}`:mk(e)?`${t}${nM(e.const.toString())}`:ak(e)?`${t}${HA}`:(()=>{throw new tM(`Unexpected Kind '${e[Y]}'`)})()}function iM(e){return`^${e.map(e=>rM(e,``)).join(``)}$`}function aM(e){return _j(Gj(e).map(e=>Kj(e)))}function oM(e,t){let n=wO(e)?iM(eM(e)):iM(e);return J({[Y]:`TemplateLiteral`,type:`string`,pattern:n},t)}function sM(e){return Gj(e).map(e=>e.toString())}function cM(e){let t=[];for(let n of e)t.push(...uM(n));return t}function lM(e){return[e.toString()]}function uM(e){return[...new Set(Ok(e)?sM(e):Nk(e)?cM(e.anyOf):mk(e)?lM(e.const):bk(e)||uk(e)?[`[number]`]:[])]}function dM(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=TM(e,uM(t[i]),n);return r}function fM(e,t,n){return dM(e,t.properties,n)}function pM(e,t,n){return lj(fM(e,t,n))}function mM(e,t){return e.map(e=>SM(e,t))}function hM(e){return e.filter(e=>!_k(e))}function gM(e,t){return dN(hM(mM(e,t)))}function _M(e){return e.some(e=>_k(e))?[]:e}function vM(e,t){return _j(_M(mM(e,t)))}function yM(e,t){return t in e?e[t]:t===`[number]`?_j(e):cj()}function bM(e,t){return t===`[number]`?e:cj()}function xM(e,t){return t in e?e[t]:cj()}function SM(e,t){return dk(e)?gM(e.allOf,t):Nk(e)?vM(e.anyOf,t):jk(e)?yM(e.items??[],t):nk(e)?bM(e.items,t):xk(e)?xM(e.properties,t):cj()}function CM(e,t){return t.map(t=>SM(e,t))}function wM(e,t){return _j(CM(e,t))}function TM(e,t,n){if(wk(e)||wk(t)){if(!zk(e)||!zk(t))throw new qO(`Index types using Ref parameters require both Type and Key to be of TSchema`);return aj(`Index`,[e,t])}return gk(t)?pM(e,t,n):hk(t)?kM(e,t,n):J(zk(t)?wM(e,uM(t)):wM(e,t),n)}function EM(e,t,n){return{[t]:TM(e,[t],PO(n))}}function DM(e,t,n){return t.reduce((t,r)=>({...t,...EM(e,r,n)}),{})}function OM(e,t,n){return DM(e,t.keys,n)}function kM(e,t,n){return lj(OM(e,t,n))}function AM(e,t){return J({[Y]:`Iterator`,type:`Iterator`,items:e},t)}function jM(e){return globalThis.Object.keys(e).filter(t=>!$O(e[t]))}function MM(e,t){let n=jM(e);return J(n.length>0?{[Y]:`Object`,type:`object`,required:n,properties:e}:{[Y]:`Object`,type:`object`,properties:e},t)}var NM=MM;function PM(e,t){return J({[Y]:`Promise`,type:`Promise`,item:e},t)}function FM(e){return J(sj(e,[YO]))}function IM(e){return J({...e,[YO]:`Readonly`})}function LM(e,t){return t===!1?FM(e):IM(e)}function RM(e,t){let n=t??!0;return gk(e)?VM(e,n):LM(e,n)}function zM(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=RM(e[r],t);return n}function BM(e,t){return zM(e.properties,t)}function VM(e,t){return lj(BM(e,t))}function HM(e,t){return J(e.length>0?{[Y]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[Y]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function UM(e,t){return e in t?XM(e,t[e]):lj(t)}function WM(e){return{[e]:Kj(e)}}function GM(e){let t={};for(let n of e)t[n]=Kj(n);return t}function KM(e,t){return YA(t,e)?WM(e):GM(t)}function qM(e,t){return UM(e,KM(e,t))}function JM(e,t){return t.map(t=>XM(e,t))}function YM(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=XM(e,t[r]);return n}function XM(e,t){let n={...t};return $O(t)?nN(XM(e,sj(t,[XO]))):QO(t)?RM(XM(e,sj(t,[YO]))):gk(t)?UM(e,t.properties):hk(t)?qM(e,t.keys):sk(t)?uj(JM(e,t.parameters),XM(e,t.returns),n):lk(t)?dj(JM(e,t.parameters),XM(e,t.returns),n):rk(t)?ij(XM(e,t.items),n):fk(t)?AM(XM(e,t.items),n):dk(t)?fN(JM(e,t.allOf),n):Nk(t)?vj(JM(e,t.anyOf),n):jk(t)?HM(JM(e,t.items??[]),n):xk(t)?NM(YM(e,t.properties),n):nk(t)?nj(XM(e,t.items),n):Sk(t)?PM(XM(e,t.item),n):t}function ZM(e,t){let n={};for(let r of e)n[r]=XM(r,t);return n}function QM(e,t,n){let r=zk(e)?uM(e):e;return NM(ZM(r,t({[Y]:`MappedKey`,keys:r})),n)}function $M(e){return J(sj(e,[XO]))}function eN(e){return J({...e,[XO]:`Optional`})}function tN(e,t){return t===!1?$M(e):eN(e)}function nN(e,t){let n=t??!0;return gk(e)?aN(e,n):tN(e,n)}function rN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=nN(e[r],t);return n}function iN(e,t){return rN(e.properties,t)}function aN(e,t){return lj(iN(e,t))}function oN(e,t={}){let n=e.every(e=>xk(e)),r=zk(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return J(t.unevaluatedProperties===!1||zk(t.unevaluatedProperties)||n?{...r,[Y]:`Intersect`,type:`object`,allOf:e}:{...r,[Y]:`Intersect`,allOf:e},t)}function sN(e){return e.every(e=>$O(e))}function cN(e){return sj(e,[XO])}function lN(e){return e.map(e=>$O(e)?cN(e):e)}function uN(e,t){return sN(e)?nN(oN(lN(e),t)):oN(lN(e),t)}function dN(e,t={}){if(e.length===1)return J(e[0],t);if(e.length===0)return cj(t);if(e.some(e=>Ak(e)))throw Error(`Cannot intersect transform types`);return uN(e,t)}function fN(e,t){if(e.length===1)return J(e[0],t);if(e.length===0)return cj(t);if(e.some(e=>Ak(e)))throw Error(`Cannot intersect transform types`);return oN(e,t)}function pN(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new qO(`Ref: $ref must be a string`);return J({[Y]:`Ref`,$ref:t},n)}function mN(e,t){return aj(`Awaited`,[aj(e,t)])}function hN(e){return aj(`Awaited`,[pN(e)])}function gN(e){return fN(yN(e))}function _N(e){return vj(yN(e))}function vN(e){return bN(e)}function yN(e){return e.map(e=>bN(e))}function bN(e,t){return J(ok(e)?mN(e.target,e.parameters):dk(e)?gN(e.allOf):Nk(e)?_N(e.anyOf):Sk(e)?vN(e.item):wk(e)?hN(e.$ref):e,t)}function xN(e){let t=[];for(let n of e)t.push(ON(n));return t}function SN(e){return ej(xN(e))}function CN(e){return $A(xN(e))}function wN(e){return e.map((e,t)=>t.toString())}function TN(e){return[`[number]`]}function EN(e){return globalThis.Object.getOwnPropertyNames(e)}function DN(e){return kN?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function ON(e){return dk(e)?SN(e.allOf):Nk(e)?CN(e.anyOf):jk(e)?wN(e.items??[]):nk(e)?TN(e.items):xk(e)?EN(e.properties):Ck(e)?DN(e.patternProperties):[]}var kN=!1;function AN(e,t){return aj(`KeyOf`,[aj(e,t)])}function jN(e){return aj(`KeyOf`,[pN(e)])}function MN(e,t){return J(_j(NN(ON(e))),t)}function NN(e){return e.map(e=>e===`[number]`?Yj():Kj(e))}function PN(e,t){return ok(e)?AN(e.target,e.parameters):wk(e)?jN(e.$ref):gk(e)?LN(e,t):MN(e,t)}function FN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=PN(e[r],PO(t));return n}function IN(e,t){return FN(e.properties,t)}function LN(e,t){return lj(IN(e,t))}function RN(e){let t=[];for(let n of e)t.push(...ON(n));return XA(t)}function zN(e){return e.filter(e=>!_k(e))}function BN(e,t){let n=[];for(let r of e)n.push(...CM(r,[t]));return zN(n)}function VN(e,t){let n={};for(let r of t)n[r]=dN(BN(e,r));return n}function HN(e,t){return NM(VN(e,RN(e)),t)}function UN(e){return J({[Y]:`Date`,type:`Date`},e)}function WN(e){return J({[Y]:`Null`,type:`null`},e)}function GN(e){return J({[Y]:`Symbol`,type:`symbol`},e)}function KN(e){return J({[Y]:`Undefined`,type:`undefined`},e)}function qN(e){return J({[Y]:`Uint8Array`,type:`Uint8Array`},e)}function JN(e){return J({[Y]:`Unknown`},e)}function YN(e){return e.map(e=>QN(e,!1))}function XN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=RM(QN(e[n],!1));return t}function ZN(e,t){return t===!0?e:RM(e)}function QN(e,t){return pO(e)||yO(e)?ZN(tj(),t):mO(e)?RM(HM(YN(e))):EO(e)?qN():_O(e)?UN():SO(e)?ZN(NM(XN(e)),t):vO(e)?ZN(dj([],JN()),t):DO(e)?KN():bO(e)?WN():TO(e)?GN():hO(e)?Jj():xO(e)||gO(e)||wO(e)?Kj(e):NM({})}function $N(e,t){return J(QN(e,!0),t)}function eP(e,t){return sk(e)?HM(e.parameters,t):cj(t)}function tP(e,t){if(DO(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return vj([...new Set(n)].map(e=>Kj(e)),{...t,[ZO]:`Enum`})}var nP=class extends qO{},Q;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(Q||={});function rP(e){return e===Q.False?e:Q.True}function iP(e){throw new nP(e)}function aP(e){return yA(e)||uA(e)||FA(e)||LA(e)||Qk(e)}function oP(e,t){return yA(t)?wP(e,t):uA(t)?bP(e,t):FA(t)?sF(e,t):LA(t)?lF(e,t):Qk(t)?sP(e,t):iP(`StructuralRight`)}function sP(e,t){return Q.True}function cP(e,t){return uA(t)?bP(e,t):FA(t)&&t.anyOf.some(e=>Qk(e)||LA(e))?Q.True:FA(t)?Q.Union:LA(t)||Qk(t)?Q.True:Q.Union}function lP(e,t){return LA(e)?Q.False:Qk(e)?Q.Union:yA(e)?Q.True:Q.False}function uP(e,t){return CA(t)&&VP(t)?Q.True:aP(t)?oP(e,t):eA(t)?rP(pF(e.items,t.items)):Q.False}function dP(e,t){return aP(t)?oP(e,t):tA(t)?rP(pF(e.items,t.items)):Q.False}function fP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):nA(t)?Q.True:Q.False}function pP(e,t){return mA(e)||rA(e)?Q.True:Q.False}function mP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):rA(t)?Q.True:Q.False}function hP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):aA(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>rP(pF(t.parameters[n],e))===Q.True)?rP(pF(e.returns,t.returns)):Q.False:Q.False}function gP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):oA(t)?Q.True:Q.False}function _P(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):sA(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>rP(pF(t.parameters[n],e))===Q.True)?rP(pF(e.returns,t.returns)):Q.False:Q.False}function vP(e,t){return hA(e)&&xO(e.const)||SA(e)||cA(e)?Q.True:Q.False}function yP(e,t){return cA(t)||SA(t)?Q.True:aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):Q.False}function bP(e,t){return t.allOf.every(t=>pF(e,t)===Q.True)?Q.True:Q.False}function xP(e,t){return e.allOf.some(e=>pF(e,t)===Q.True)?Q.True:Q.False}function SP(e,t){return aP(t)?oP(e,t):dA(t)?rP(pF(e.items,t.items)):Q.False}function CP(e,t){return hA(t)&&t.const===e.const?Q.True:aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):OA(t)?QP(e,t):SA(t)?kP(e,t):cA(t)?vP(e,t):rA(t)?pP(e,t):Q.False}function wP(e,t){return Q.False}function TP(e,t){return Q.True}function EP(e){let[t,n]=[e,0];for(;bA(t);)t=t.not,n+=1;return n%2==0?t:JN()}function DP(e,t){return bA(e)?pF(EP(e),t):bA(t)?pF(e,EP(t)):iP(`Invalid fallthrough for Not`)}function OP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):xA(t)?Q.True:Q.False}function kP(e,t){return pA(e)||SA(e)||cA(e)?Q.True:Q.False}function AP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):cA(t)||SA(t)?Q.True:Q.False}function jP(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function MP(e){return VP(e)}function NP(e){return jP(e,0)||jP(e,1)&&`description`in e.properties&&FA(e.properties.description)&&e.properties.description.anyOf.length===2&&(OA(e.properties.description.anyOf[0])&&PA(e.properties.description.anyOf[1])||OA(e.properties.description.anyOf[1])&&PA(e.properties.description.anyOf[0]))}function PP(e){return jP(e,0)}function FP(e){return jP(e,0)}function IP(e){return jP(e,0)}function LP(e){return jP(e,0)}function RP(e){return VP(e)}function zP(e){let t=Yj();return jP(e,0)||jP(e,1)&&`length`in e.properties&&rP(pF(e.properties.length,t))===Q.True}function BP(e){return jP(e,0)}function VP(e){let t=Yj();return jP(e,0)||jP(e,1)&&`length`in e.properties&&rP(pF(e.properties.length,t))===Q.True}function HP(e){let t=dj([tj()],tj());return jP(e,0)||jP(e,1)&&`then`in e.properties&&rP(pF(e.properties.then,t))===Q.True}function UP(e,t){return pF(e,t)===Q.False||Zk(e)&&!Zk(t)?Q.False:Q.True}function WP(e,t){return LA(e)?Q.False:Qk(e)?Q.Union:yA(e)||fA(e)&&MP(t)||pA(e)&&PP(t)||mA(e)&&FP(t)||kA(e)&&NP(t)||nA(e)&&IP(t)||OA(e)&&MP(t)||kA(e)&&NP(t)||SA(e)&&PP(t)||cA(e)&&PP(t)||rA(e)&&FP(t)||IA(e)&&RP(t)||oA(e)&&LP(t)||aA(e)&&BP(t)||sA(e)&&zP(t)?Q.True:TA(e)&&OA(qP(e))?t[ZO]===`Record`?Q.True:Q.False:TA(e)&&SA(qP(e))&&jP(t,0)?Q.True:Q.False}function GP(e,t){return aP(t)?oP(e,t):TA(t)?YP(e,t):CA(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!Zk(t.properties[n]))return Q.False;if(Zk(t.properties[n]))return Q.True;if(UP(e.properties[n],t.properties[n])===Q.False)return Q.False}return Q.True})():Q.False}function KP(e,t){return aP(t)?oP(e,t):CA(t)&&HP(t)?Q.True:wA(t)?rP(pF(e.item,t.item)):Q.False}function qP(e){return KA in e.patternProperties?Yj():qA in e.patternProperties?Xj():iP(`Unknown record key pattern`)}function JP(e){return KA in e.patternProperties?e.patternProperties[KA]:qA in e.patternProperties?e.patternProperties[qA]:iP(`Unable to get record value schema`)}function YP(e,t){let[n,r]=[qP(t),JP(t)];return fA(e)&&SA(n)&&rP(pF(e,r))===Q.True?Q.True:IA(e)&&SA(n)||OA(e)&&SA(n)||eA(e)&&SA(n)?pF(e,r):CA(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(UP(r,e.properties[t])===Q.False)return Q.False;return Q.True})():Q.False}function XP(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?pF(JP(e),JP(t)):Q.False}function ZP(e,t){return pF(DA(e)?Xj():e,DA(t)?Xj():t)}function QP(e,t){return hA(e)&&wO(e.const)||OA(e)?Q.True:Q.False}function $P(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):OA(t)?Q.True:Q.False}function eF(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):kA(t)?Q.True:Q.False}function tF(e,t){return AA(e)?pF(aM(e),t):AA(t)?pF(e,aM(t)):iP(`Invalid fallthrough for TemplateLiteral`)}function nF(e,t){return eA(t)&&e.items!==void 0&&e.items.every(e=>pF(e,t.items)===Q.True)}function rF(e,t){return yA(e)?Q.True:LA(e)?Q.False:Qk(e)?Q.Union:Q.False}function iF(e,t){return aP(t)?oP(e,t):CA(t)&&VP(t)||eA(t)&&nF(e,t)?Q.True:NA(t)?DO(e.items)&&!DO(t.items)||!DO(e.items)&&DO(t.items)?Q.False:DO(e.items)&&!DO(t.items)||e.items.every((e,n)=>pF(e,t.items[n])===Q.True)?Q.True:Q.False:Q.False}function aF(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):IA(t)?Q.True:Q.False}function oF(e,t){return aP(t)?oP(e,t):CA(t)?WP(e,t):TA(t)?YP(e,t):zA(t)?dF(e,t):PA(t)?Q.True:Q.False}function sF(e,t){return t.anyOf.some(t=>pF(e,t)===Q.True)?Q.True:Q.False}function cF(e,t){return e.anyOf.every(e=>pF(e,t)===Q.True)?Q.True:Q.False}function lF(e,t){return Q.True}function uF(e,t){return yA(t)?wP(e,t):uA(t)?bP(e,t):FA(t)?sF(e,t):Qk(t)?sP(e,t):OA(t)?QP(e,t):SA(t)?kP(e,t):cA(t)?vP(e,t):rA(t)?pP(e,t):eA(t)?lP(e,t):NA(t)?rF(e,t):CA(t)?WP(e,t):LA(t)?Q.True:Q.False}function dF(e,t){return PA(e)||PA(e)?Q.True:Q.False}function fF(e,t){return uA(t)?bP(e,t):FA(t)?sF(e,t):LA(t)?lF(e,t):Qk(t)?sP(e,t):CA(t)?WP(e,t):zA(t)?Q.True:Q.False}function pF(e,t){return AA(e)||AA(t)?tF(e,t):DA(e)||DA(t)?ZP(e,t):bA(e)||bA(t)?DP(e,t):Qk(e)?cP(e,t):eA(e)?uP(e,t):nA(e)?fP(e,t):rA(e)?mP(e,t):tA(e)?dP(e,t):aA(e)?hP(e,t):oA(e)?gP(e,t):sA(e)?_P(e,t):cA(e)?yP(e,t):uA(e)?xP(e,t):dA(e)?SP(e,t):hA(e)?CP(e,t):yA(e)?TP(e,t):xA(e)?OP(e,t):SA(e)?AP(e,t):CA(e)?GP(e,t):TA(e)?XP(e,t):OA(e)?$P(e,t):kA(e)?eF(e,t):NA(e)?iF(e,t):wA(e)?KP(e,t):IA(e)?aF(e,t):PA(e)?oF(e,t):FA(e)?cF(e,t):LA(e)?uF(e,t):zA(e)?fF(e,t):iP(`Unknown left type operand '${e[Y]}'`)}function mF(e,t){return pF(e,t)}function hF(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=yF(e[o],t,n,r,PO(i));return a}function gF(e,t,n,r,i){return hF(e.properties,t,n,r,i)}function _F(e,t,n,r,i){return lj(gF(e,t,n,r,i))}function vF(e,t,n,r){let i=mF(e,t);return i===Q.Union?vj([n,r]):i===Q.True?n:r}function yF(e,t,n,r,i){return gk(e)?_F(e,t,n,r,i):hk(e)?J(CF(e,t,n,r,i)):J(vF(e,t,n,r),i)}function bF(e,t,n,r,i){return{[e]:yF(Kj(e),t,n,r,PO(i))}}function xF(e,t,n,r,i){return e.reduce((e,a)=>({...e,...bF(a,t,n,r,i)}),{})}function SF(e,t,n,r,i){return xF(e.keys,t,n,r,i)}function CF(e,t,n,r,i){return lj(SF(e,t,n,r,i))}function wF(e,t){return EF(aM(e),t)}function TF(e,t){let n=e.filter(e=>mF(e,t)===Q.False);return n.length===1?n[0]:vj(n)}function EF(e,t,n={}){return Ok(e)?J(wF(e,t),n):gk(e)?J(kF(e,t),n):J(Nk(e)?TF(e.anyOf,t):mF(e,t)===Q.False?e:cj(),n)}function DF(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=EF(e[r],t);return n}function OF(e,t){return DF(e.properties,t)}function kF(e,t){return lj(OF(e,t))}function AF(e,t){return MF(aM(e),t)}function jF(e,t){let n=e.filter(e=>mF(e,t)!==Q.False);return n.length===1?n[0]:vj(n)}function MF(e,t,n){return Ok(e)?J(AF(e,t),n):gk(e)?J(FF(e,t),n):J(Nk(e)?jF(e.anyOf,t):mF(e,t)===Q.False?cj():e,n)}function NF(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=MF(e[r],t);return n}function PF(e,t){return NF(e.properties,t)}function FF(e,t){return lj(PF(e,t))}function IF(e,t){return sk(e)?J(e.returns,t):cj(t)}function LF(e){return RM(nN(e))}function RF(e,t,n){return J({[Y]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function zF(e,t,n){let r={};for(let n of e)r[n]=t;return NM(r,{...n,[ZO]:`Record`})}function BF(e,t,n){return Rj(e)?zF(uM(e),t,n):RF(e.pattern,t,n)}function VF(e,t,n){return zF(uM(vj(e)),t,n)}function HF(e,t,n){return zF([e.toString()],t,n)}function UF(e,t,n){return RF(e.source,t,n)}function WF(e,t,n){return RF(DO(e.pattern)?qA:e.pattern,t,n)}function GF(e,t,n){return RF(qA,t,n)}function KF(e,t,n){return RF(JA,t,n)}function qF(e,t,n){return NM({true:t,false:t},n)}function JF(e,t,n){return RF(KA,t,n)}function YF(e,t,n){return RF(KA,t,n)}function XF(e,t,n={}){return Nk(e)?VF(e.anyOf,t,n):Ok(e)?BF(e,t,n):mk(e)?HF(e.const,t,n):ak(e)?qF(e,t,n):uk(e)?JF(e,t,n):bk(e)?YF(e,t,n):Tk(e)?UF(e,t,n):Ek(e)?WF(e,t,n):ek(e)?GF(e,t,n):_k(e)?KF(e,t,n):cj(n)}function ZF(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function QF(e){let t=ZF(e);return t===qA?Xj():t===KA?Yj():Xj({pattern:t})}function $F(e){return e.patternProperties[ZF(e)]}function eI(e,t){return t.parameters=mI(e,t.parameters),t.returns=hI(e,t.returns),t}function tI(e,t){return t.parameters=mI(e,t.parameters),t.returns=hI(e,t.returns),t}function nI(e,t){return t.allOf=mI(e,t.allOf),t}function rI(e,t){return t.anyOf=mI(e,t.anyOf),t}function iI(e,t){return DO(t.items)||(t.items=mI(e,t.items)),t}function aI(e,t){return t.items=hI(e,t.items),t}function oI(e,t){return t.items=hI(e,t.items),t}function sI(e,t){return t.items=hI(e,t.items),t}function cI(e,t){return t.item=hI(e,t.item),t}function lI(e,t){let n=pI(e,t.properties);return{...t,...NM(n)}}function uI(e,t){let n=XF(hI(e,QF(t)),hI(e,$F(t)));return{...t,...n}}function dI(e,t){return t.index in e?e[t.index]:JN()}function fI(e,t){let n=QO(t),r=$O(t),i=hI(e,t);return n&&r?LF(i):n&&!r?RM(i):!n&&r?nN(i):i}function pI(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:fI(e,t[r])}),{})}function mI(e,t){return t.map(t=>hI(e,t))}function hI(e,t){return sk(t)?eI(e,t):lk(t)?tI(e,t):dk(t)?nI(e,t):Nk(t)?rI(e,t):jk(t)?iI(e,t):nk(t)?aI(e,t):rk(t)?oI(e,t):fk(t)?sI(e,t):Sk(t)?cI(e,t):xk(t)?lI(e,t):Ck(t)?uI(e,t):tk(t)?dI(e,t):t}function gI(e,t){return hI(t,FO(e))}function _I(e){return J({[Y]:`Integer`,type:`integer`},e)}function vI(e,t,n){return{[e]:kI(Kj(e),t,PO(n))}}function yI(e,t,n){return e.reduce((e,r)=>({...e,...vI(r,t,n)}),{})}function bI(e,t,n){return yI(e.keys,t,n)}function xI(e,t,n){return lj(bI(e,t,n))}function SI(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function CI(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function wI(e){return e.toUpperCase()}function TI(e){return e.toLowerCase()}function EI(e,t,n){let r=Mj(e.pattern);return Lj(r)?oM([vj(OI([...Wj(r)].map(e=>Kj(e)),t))],n):{...e,pattern:DI(e.pattern,t)}}function DI(e,t){return typeof e==`string`?t===`Uncapitalize`?SI(e):t===`Capitalize`?CI(e):t===`Uppercase`?wI(e):t===`Lowercase`?TI(e):e:e.toString()}function OI(e,t){return e.map(e=>kI(e,t))}function kI(e,t,n={}){return hk(e)?xI(e,t,n):Ok(e)?EI(e,t,n):Nk(e)?vj(OI(e.anyOf,t),n):mk(e)?Kj(DI(e.const,t),n):J(e,n)}function AI(e,t={}){return kI(e,`Capitalize`,t)}function jI(e,t={}){return kI(e,`Lowercase`,t)}function MI(e,t={}){return kI(e,`Uncapitalize`,t)}function NI(e,t={}){return kI(e,`Uppercase`,t)}function PI(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=WI(e[i],t,PO(n));return r}function FI(e,t,n){return PI(e.properties,t,n)}function II(e,t,n){return lj(FI(e,t,n))}function LI(e,t){return e.map(e=>UI(e,t))}function RI(e,t){return e.map(e=>UI(e,t))}function zI(e,t){let{[t]:n,...r}=e;return r}function BI(e,t){return t.reduce((e,t)=>zI(e,t),e)}function VI(e,t,n){let r=sj(e,[JO,`$id`,`required`,`properties`]);return NM(BI(n,t),r)}function HI(e){return vj(e.reduce((e,t)=>pk(t)?[...e,Kj(t)]:e,[]))}function UI(e,t){return dk(e)?fN(LI(e.allOf,t)):Nk(e)?vj(RI(e.anyOf,t)):xk(e)?VI(e,t,e.properties):NM({})}function WI(e,t,n){let r=mO(t)?HI(t):t,i=zk(t)?uM(t):t,a=wk(e),o=wk(t);return gk(e)?II(e,i,n):hk(t)?JI(e,t,n):a&&o||!a&&o||a&&!o?aj(`Omit`,[e,r],n):J({...UI(e,i),...n})}function GI(e,t,n){return{[t]:WI(e,[t],PO(n))}}function KI(e,t,n){return t.reduce((t,r)=>({...t,...GI(e,r,n)}),{})}function qI(e,t,n){return KI(e,t.keys,n)}function JI(e,t,n){return lj(qI(e,t,n))}function YI(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=iL(e[i],t,PO(n));return r}function XI(e,t,n){return YI(e.properties,t,n)}function ZI(e,t,n){return lj(XI(e,t,n))}function QI(e,t){return e.map(e=>rL(e,t))}function $I(e,t){return e.map(e=>rL(e,t))}function eL(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function tL(e,t,n){let r=sj(e,[JO,`$id`,`required`,`properties`]);return NM(eL(n,t),r)}function nL(e){return vj(e.reduce((e,t)=>pk(t)?[...e,Kj(t)]:e,[]))}function rL(e,t){return dk(e)?fN(QI(e.allOf,t)):Nk(e)?vj($I(e.anyOf,t)):xk(e)?tL(e,t,e.properties):NM({})}function iL(e,t,n){let r=mO(t)?nL(t):t,i=zk(t)?uM(t):t,a=wk(e),o=wk(t);return gk(e)?ZI(e,i,n):hk(t)?cL(e,t,n):a&&o||!a&&o||a&&!o?aj(`Pick`,[e,r],n):J({...rL(e,i),...n})}function aL(e,t,n){return{[t]:iL(e,[t],PO(n))}}function oL(e,t,n){return t.reduce((t,r)=>({...t,...aL(e,r,n)}),{})}function sL(e,t,n){return oL(e,t.keys,n)}function cL(e,t,n){return lj(sL(e,t,n))}function lL(e,t){return aj(`Partial`,[aj(e,t)])}function uL(e){return aj(`Partial`,[pN(e)])}function dL(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=nN(e[n]);return t}function fL(e,t){let n=sj(e,[JO,`$id`,`required`,`properties`]);return NM(dL(t),n)}function pL(e){return e.map(e=>mL(e))}function mL(e){return ok(e)?lL(e.target,e.parameters):wk(e)?uL(e.$ref):dk(e)?fN(pL(e.allOf)):Nk(e)?vj(pL(e.anyOf)):xk(e)?fL(e,e.properties):ik(e)||ak(e)||uk(e)||mk(e)||yk(e)||bk(e)||Ek(e)||Dk(e)||Mk(e)?e:NM({})}function hL(e,t){return gk(e)?vL(e,t):J({...mL(e),...t})}function gL(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=hL(e[r],PO(t));return n}function _L(e,t){return gL(e.properties,t)}function vL(e,t){return lj(_L(e,t))}function yL(e,t){return aj(`Required`,[aj(e,t)])}function bL(e){return aj(`Required`,[pN(e)])}function xL(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=sj(e[n],[XO]);return t}function SL(e,t){let n=sj(e,[JO,`$id`,`required`,`properties`]);return NM(xL(t),n)}function CL(e){return e.map(e=>wL(e))}function wL(e){return ok(e)?yL(e.target,e.parameters):wk(e)?bL(e.$ref):dk(e)?fN(CL(e.allOf)):Nk(e)?vj(CL(e.anyOf)):xk(e)?SL(e,e.properties):ik(e)||ak(e)||uk(e)||mk(e)||yk(e)||bk(e)||Ek(e)||Dk(e)||Mk(e)?e:NM({})}function TL(e,t){return gk(e)?OL(e,t):J({...wL(e),...t})}function EL(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=TL(e[r],t);return n}function DL(e,t){return EL(e.properties,t)}function OL(e,t){return lj(DL(e,t))}function kL(e,t){return t.map(t=>wk(t)?AL(e,t.$ref):ZL(e,t))}function AL(e,t){return t in e?wk(e[t])?AL(e,e[t].$ref):ZL(e,e[t]):cj()}function jL(e){return bN(e[0])}function ML(e){return TM(e[0],e[1])}function NL(e){return PN(e[0])}function PL(e){return hL(e[0])}function FL(e){return WI(e[0],e[1])}function IL(e){return iL(e[0],e[1])}function LL(e){return TL(e[0])}function RL(e,t,n){let r=kL(e,n);return t===`Awaited`?jL(r):t===`Index`?ML(r):t===`KeyOf`?NL(r):t===`Partial`?PL(r):t===`Omit`?FL(r):t===`Pick`?IL(r):t===`Required`?LL(r):cj()}function zL(e,t){return nj(ZL(e,t))}function BL(e,t){return ij(ZL(e,t))}function VL(e,t,n){return uj(XL(e,t),ZL(e,n))}function HL(e,t,n){return dj(XL(e,t),ZL(e,n))}function UL(e,t){return fN(XL(e,t))}function WL(e,t){return AM(ZL(e,t))}function GL(e,t){return NM(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:ZL(e,t[r])}),{}))}function KL(e,t){let[n,r]=[ZL(e,$F(t)),ZF(t)],i=FO(t);return i.patternProperties[r]=n,i}function qL(e,t){return wk(t)?{...AL(e,t.$ref),[JO]:t[JO]}:t}function JL(e,t){return HM(XL(e,t))}function YL(e,t){return vj(XL(e,t))}function XL(e,t){return t.map(t=>ZL(e,t))}function ZL(e,t){return $O(t)?J(ZL(e,sj(t,[XO])),t):QO(t)?J(ZL(e,sj(t,[YO])),t):Ak(t)?J(qL(e,t),t):nk(t)?J(zL(e,t.items),t):rk(t)?J(BL(e,t.items),t):ok(t)?J(RL(e,t.target,t.parameters)):sk(t)?J(VL(e,t.parameters,t.returns),t):lk(t)?J(HL(e,t.parameters,t.returns),t):dk(t)?J(UL(e,t.allOf),t):fk(t)?J(WL(e,t.items),t):xk(t)?J(GL(e,t.properties),t):Ck(t)?J(KL(e,t)):jk(t)?J(JL(e,t.items||[]),t):Nk(t)?J(YL(e,t.anyOf),t):t}function QL(e,t){return t in e?ZL(e,e[t]):cj()}function $L(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:QL(e,n)}),{})}var eR=class{constructor(e){let t=$L(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:J(this.$defs[e],t)};return J({[Y]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function tR(e){return new eR(e)}function nR(e,t){return J({[Y]:`Not`,not:e},t)}function rR(e,t){return lk(e)?HM(e.parameters,t):cj()}var iR=0;function aR(e,t={}){DO(t.$id)&&(t.$id=`T${iR++}`);let n=FO(e({[Y]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,J({[ZO]:`Recursive`,...n},t)}function oR(e,t){let n=wO(e)?new globalThis.RegExp(e):e;return J({[Y]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function sR(e){return dk(e)?e.allOf:Nk(e)?e.anyOf:jk(e)?e.items??[]:[]}function cR(e){return sR(e)}function lR(e,t){return lk(e)?J(e.returns,t):cj(t)}var uR=class{constructor(e){this.schema=e}Decode(e){return new dR(this.schema,e)}},dR=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[JO].Encode(e(n)),Decode:e=>this.decode(t[JO].Decode(e))};return{...t,[JO]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[JO]:n}}Encode(e){return Ak(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function fR(e){return new uR(e)}function pR(e={}){return J({[Y]:e[Y]??`Unsafe`},e)}function mR(e){return J({[Y]:`Void`,type:`void`},e)}var $=t({Any:()=>tj,Argument:()=>rj,Array:()=>nj,AsyncIterator:()=>ij,Awaited:()=>bN,BigInt:()=>Jj,Boolean:()=>qj,Capitalize:()=>AI,Composite:()=>HN,Const:()=>$N,Constructor:()=>uj,ConstructorParameters:()=>eP,Date:()=>UN,Enum:()=>tP,Exclude:()=>EF,Extends:()=>yF,Extract:()=>MF,Function:()=>dj,Index:()=>TM,InstanceType:()=>IF,Instantiate:()=>gI,Integer:()=>_I,Intersect:()=>fN,Iterator:()=>AM,KeyOf:()=>PN,Literal:()=>Kj,Lowercase:()=>jI,Mapped:()=>QM,Module:()=>tR,Never:()=>cj,Not:()=>nR,Null:()=>WN,Number:()=>Yj,Object:()=>NM,Omit:()=>WI,Optional:()=>nN,Parameters:()=>rR,Partial:()=>hL,Pick:()=>iL,Promise:()=>PM,Readonly:()=>RM,ReadonlyOptional:()=>LF,Record:()=>XF,Recursive:()=>aR,Ref:()=>pN,RegExp:()=>oR,Required:()=>TL,Rest:()=>cR,ReturnType:()=>lR,String:()=>Xj,Symbol:()=>GN,TemplateLiteral:()=>oM,Transform:()=>fR,Tuple:()=>HM,Uint8Array:()=>qN,Uncapitalize:()=>MI,Undefined:()=>KN,Union:()=>vj,Unknown:()=>JN,Unsafe:()=>pR,Uppercase:()=>NI,Void:()=>mR}),hR={additionalProperties:!1},gR=$.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}),_R=$.String({pattern:`^[a-z0-9][a-z0-9-]{0,31}(?![\\s\\S])`,minLength:1,maxLength:32}),vR=$.String({pattern:`^sha256:[0-9a-f]{64}$`,minLength:71,maxLength:71}),yR=$.String({pattern:`^[A-Za-z0-9_-]{43}$`,minLength:43,maxLength:43}),bR=$.String({pattern:`^dpt_[A-Za-z0-9_-]{43}$`,minLength:47,maxLength:47}),xR=`[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`,SR=`^(?:${xR}|[A-Z2-7]{12}|[A-Z2-7]{8})(?![\\s\\S])`,CR=$.String({pattern:SR,minLength:8,maxLength:36}),wR=new RegExp(SR),TR=/^[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 ER(e){return typeof e!=`string`||e.length>36?!1:wR.test(e)}function DR(e){if(typeof e!=`string`)return;if(TR.test(e)){let t=e.toLowerCase();return ER(t)?t:void 0}let t=e.replace(/[\s-]+/g,``).toUpperCase();if(ER(t)&&!(/[\s-]/.test(e)&&t.length!==12))return t}$.Object({type:$.Literal(`pair.request`),v:$.Literal(1),requestId:gR,code:CR,deviceUid:gR,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:vR,clientTime:$.Integer(),hubNonce:$.Optional(yR)},hR),$.Object({type:$.Literal(`pair.device-request`),v:$.Literal(1),requestId:gR,deviceUid:gR,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:vR,clientTime:$.Integer(),hubNonce:$.Optional(yR)},hR);var OR=$.Object({type:$.Literal(`pair.challenge`),v:$.Literal(1),enrollmentId:gR,nonce:yR,issuedAt:$.Integer(),hubId:gR,hubPublicKey:$.Optional($.String({minLength:1,maxLength:256})),hubKeyFingerprint:$.Optional(vR),hubSignature:$.Optional($.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86}))},hR);$.Object({type:$.Literal(`pair.device-ack`),v:$.Literal(1),codeId:gR,code:CR,expiresAt:$.Integer(),hubOrigin:$.String(),hubId:gR,challenge:OR},hR),$.Object({type:$.Literal(`pair.response`),v:$.Literal(1),enrollmentId:gR,nonce:yR,signature:$.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86})},hR),$.Object({type:$.Literal(`pair.pending`),v:$.Literal(1),enrollmentId:gR,state:$.Literal(`awaiting_approval`),expiresAt:$.Integer(),pollAfterMs:$.Integer({minimum:1})},hR),$.Object({type:$.Literal(`pair.token`),v:$.Literal(1),enrollmentId:gR,deviceUid:gR,deviceId:_R,pairingEpoch:gR,credentialId:gR,generation:$.Integer({minimum:1}),hubId:gR,hubOrigin:$.String(),hubUrl:$.String(),tunnelToken:bR,issuedAt:$.Integer(),expiresAt:$.Null(),hubKeyFingerprint:$.Optional(vR)},hR),$.Object({enrollmentId:gR,deviceUid:gR,keyFingerprint:vR,replaceKey:$.Optional($.Boolean())},hR),$.Object({type:$.Literal(`pair.revoke`),v:$.Literal(1),deviceId:_R,pairingEpoch:gR,reason:$.Union([$.Literal(`user`),$.Literal(`compromise`),$.Literal(`hub_migrated`)]),revokedAt:$.Integer()},hR);var kR=$.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}))},hR);$.Object({type:$.Literal(`pair.code`),v:$.Literal(1),codeId:gR,code:CR,expiresAt:$.Integer(),hubOrigin:$.String({maxLength:2048}),pairUrl:$.String({maxLength:4096}),offerUrl:$.Optional($.String({maxLength:2048}))},hR);var AR=$.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:gR,expiresAt:$.Integer(),phase:AR,enrollment:$.Optional($.Object({enrollmentId:gR,deviceUid:gR,deviceName:$.String({minLength:1,maxLength:64}),keyFingerprint:vR,proofVerified:$.Boolean(),keyChanged:$.Boolean()},hR)),deviceId:$.Optional(_R),error:$.Optional(kR)},hR);function jR(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 MR(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 NR=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,PR=RegExp(`^${xR}$`),FR=/^sha256:[0-9a-f]{64}$/;function IR(e){let t=MR(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=jR(r.hub);if(a.ok&&a.origin===r.hub&&typeof r.id==`string`&&NR.test(r.id)&&typeof r.code==`string`&&PR.test(r.code)&&typeof r.exp==`number`&&Number.isSafeInteger(r.exp))return r.v===3?typeof r.kfp!=`string`||!FR.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 LR(e,t=Date.now()){let n=IR(e);if(n&&!(n.exp<t-3e4)&&!(n.exp>t+6e5))return n}function RR(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=LR(n.hash.slice(7),t);if(r&&r.hub===n.origin)return{offer:r,rest:`${n.origin}/pair`}}function zR(e){if(!/^\/pair\/?$/.test(e.pathname))return;if(e.hash.startsWith(`#offer=`)){let t=RR(e.href);if(t)return{code:t.offer.code,origin:e.origin,offerFragment:e.hash.slice(1)};let n=LR(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:DR(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 BR=e=>/^\/pair\/?$/.test(e.pathname)?`/`:void 0,VR=e=>/^\/pair\/?$/.test(e.pathname)&&zR(e)===void 0?`/`:void 0,HR=4e3;async function UR(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 WR={class:`modal pair-wizard`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pair-title`},GR={key:1,class:`pair-pending`,"aria-label":`Machines waiting for approval`},KR={class:`who`},qR={key:0,class:`muted`},JR={key:1,class:`muted`},YR={class:`fp`},XR={class:`row`},ZR={class:`phase`},QR=[`onClick`],$R={key:2,class:`hint`},ez={class:`pair-steps`,"aria-label":`Pairing progress`},tz={class:`pair-grid`},nz={class:`pair-code-box`},rz={class:`pair-code`,"aria-label":`Pairing code`},iz={class:`pair-copy-actions`},az=[`innerHTML`],oz={class:`pair-side`},sz={key:0,class:`hint`},cz={class:`pair-fingerprint`},lz={class:`fp`},uz={class:`pair-confirm`},dz={key:0,class:`pair-confirm warn`},fz=[`disabled`],pz=[`disabled`],mz={class:`hint`},hz=[`disabled`],gz={key:5,class:`error`,role:`alert`},_z={key:4},vz={class:`error`,role:`alert`},yz=Dr({__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=H(()=>{let e=s.value?.code??``;return!ER(e)||e.includes(`-`)?e:(e.match(/.{4}/g)??[]).join(`-`)}),y=H(()=>s.value?zy(s.value):``),b=H(()=>y.value?aO(y.value,148):``),x=H(()=>c.value?.enrollment?.keyFingerprint??``),S=H(()=>c.value?.deviceId??``);M(S,e=>{g.value?.(),e&&(g.value=M(()=>bu.devices.value.find(t=>t.id===e)?.status,e=>{e===`online`&&(q(`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=Hy();o.value=t;try{let n=e?await By.resolveCode(e):await By.createCode();if(t.closed()){await By.cancel(n.codeId).catch(()=>{q(`The late pairing code could not be cancelled. Check device credentials before retrying.`)});return}if(s.value=n,a.value=`code`,e){let e=BR(new URL(window.location.href));e&&window.history.replaceState(window.history.state,``,e)}Gy(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 By.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 By.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 ql&&e.status===409&&String(e.code)===`already_issued`){let e=await By.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 w=()=>te(!1),ne=()=>[`issued`,`connected`,`cancelled`,`expired`].includes(c.value?.phase??``);async function re(){let e=S.value;if(e){u.value=!0;try{await By.revoke(e,`user`),q(`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 UR({needsCancel:!!s.value&&!ne(),cancel:w,timeoutMs:HR});if(!e.closed)return;o.value?.close(),g.value?.(),e.confirmed||q(`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 By.pending()).codes}catch{}}async function le(e){s.value=void 0,c.value=void 0,l.value=``;let t=Hy();o.value=t,a.value=e.phase===`approved_ready`?`approve`:`proof`,Gy(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 Hr(()=>{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)}),Gr(()=>{clearInterval(se);let e=o.value;e&&!e.closed()&&s.value&&!ne()&&te(!0).then(e=>{e!==`cancelled`&&q(`Pairing cancellation was not confirmed. Check device credentials before retrying.`)}),e?.close(),g.value?.()}),(e,t)=>(F(),I(`div`,{class:`modal-backdrop`,onClick:As(oe,[`self`])},[R(`div`,WR,[R(`header`,null,[t[5]||=R(`h2`,{id:`pair-title`},`Pair a device`,-1),R(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,onClick:oe},[z(A(vl),{size:18})])]),i.handoff&&`offerFragment`in i.handoff&&i.handoff.offerFragment?(F(),L(fO,{key:0,"offer-fragment":i.handoff.offerFragment},null,8,[`offer-fragment`])):V(``,!0),_.value.length?(F(),I(`section`,GR,[t[6]||=R(`h3`,null,`Machines waiting for you`,-1),R(`ul`,null,[(F(!0),I(P,null,N(_.value,e=>(F(),I(`li`,{key:e.codeId},[R(`div`,KR,[R(`strong`,null,D(e.deviceName??`unnamed device`),1),e.hostname?(F(),I(`span`,qR,D(e.hostname),1)):V(``,!0),e.platform?(F(),I(`span`,JR,D(e.platform),1)):V(``,!0)]),R(`div`,YR,D(e.keyFingerprint),1),R(`div`,XR,[R(`span`,ZR,D(e.phase.replaceAll(`_`,` `)),1),R(`button`,{type:`button`,class:`small`,onClick:t=>le(e)},`Review`,8,QR)])]))),128))]),t[7]||=R(`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)])):V(``,!0),a.value===`boot`?(F(),I(`p`,$R,`Minting a pairing code…`)):s.value?(F(),I(P,{key:3},[R(`ol`,ez,[t[8]||=R(`li`,{class:E({on:!0})},`Code`,-1),R(`li`,{class:E({on:[`proof`,`approve`,`issued`].includes(a.value)})},`Proof`,2),R(`li`,{class:E({on:[`approve`,`issued`].includes(a.value)})},`Fingerprint`,2),R(`li`,{class:E({on:a.value===`issued`})},`Online`,2)]),R(`div`,tz,[R(`div`,nz,[R(`div`,rz,D(v.value),1),R(`div`,iz,[R(`button`,{type:`button`,class:`small`,onClick:ie},[z(A(cc),{size:14}),B(` `+D(m.value?`Copied`:`Copy code`),1)]),R(`button`,{type:`button`,class:`small`,onClick:ae,title:`Self-contained link: hub, code and expiry all in the fragment — it never reaches server logs`},[z(A(cc),{size:14}),B(` `+D(h.value?`Copied link`:`Copy link`),1)])]),t[9]||=R(`p`,{class:`hint`},` Run the device pairing command and scan, or enter this code on the device. Expires in 5 minutes. `,-1),R(`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,az)]),R(`div`,oz,[a.value===`code`||a.value===`proof`?(F(),I(`p`,sz,[z(A($c),{size:14,class:`spin`}),t[10]||=B(` Waiting for the device to submit its signing proof… `,-1)])):a.value===`approve`?(F(),I(P,{key:1},[R(`div`,cz,[t[11]||=R(`h3`,null,`Device key fingerprint`,-1),R(`code`,lz,D(x.value),1),t[12]||=R(`p`,{class:`hint`},` Compare ALL 64 hex characters with the fingerprint shown on the device screen. `,-1)]),R(`label`,uz,[j(R(`input`,{"onUpdate:modelValue":t[0]||=e=>f.value=e,type:`checkbox`},null,512),[[xs,f.value]]),t[13]||=B(` The fingerprint matches the device display exactly `,-1)]),c.value?.enrollment?.keyChanged?(F(),I(`label`,dz,[j(R(`input`,{"onUpdate:modelValue":t[1]||=e=>p.value=e,type:`checkbox`},null,512),[[xs,p.value]]),z(A(il),{size:14}),t[14]||=B(` Device is already paired with a DIFFERENT key — replace the stored key (replaceKey) `,-1)])):V(``,!0),R(`button`,{type:`button`,class:`primary`,disabled:!f.value||u.value||c.value?.enrollment?.keyChanged===!0&&!p.value,onClick:ee},` Approve device `,8,fz),R(`button`,{type:`button`,class:`small`,disabled:u.value,onClick:w},` Cancel pairing `,8,pz)],64)):a.value===`issued`?(F(),I(P,{key:2},[R(`p`,mz,[z(A(ac),{size:14}),t[15]||=B(` Credential issued. The device is connecting through the tunnel — you will get a toast once the monitor probe reports it online. `,-1)]),R(`button`,{type:`button`,class:`small`,onClick:oe},`Close`),R(`button`,{type:`button`,class:`small danger`,disabled:!S.value||u.value,title:`Mistaken approval? Revoke the credential now.`,onClick:re},` Revoke this credential `,8,hz)],64)):a.value===`cancelled`?(F(),I(P,{key:3},[t[16]||=R(`p`,{class:`hint`},`Pairing was cancelled (or the signature failed too many times).`,-1),R(`button`,{type:`button`,class:`small`,onClick:t[2]||=e=>C()},`Start over`)],64)):a.value===`expired`?(F(),I(P,{key:4},[t[17]||=R(`p`,{class:`hint`},`The pairing code expired.`,-1),R(`button`,{type:`button`,class:`small`,onClick:t[3]||=e=>C()},`New code`)],64)):V(``,!0),l.value?(F(),I(`p`,gz,D(l.value),1)):V(``,!0)])])],64)):(F(),I(`div`,_z,[R(`p`,vz,D(l.value||`This pairing link is unavailable.`),1),R(`button`,{type:`button`,class:`small`,onClick:t[4]||=e=>C()},`New code`)]))])]))}}),bz={class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`device-credentials-title`},xz={class:`hint`},Sz={key:1,class:`hint`},Cz=Dr({__name:`DeviceCredentialsDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=H(()=>bu.devices.value.find(e=>e.id===n.deviceId));return(e,t)=>(F(),I(`div`,{class:`modal-backdrop`,onClick:t[2]||=As(e=>r(`close`),[`self`])},[R(`section`,bz,[R(`header`,null,[t[3]||=R(`h2`,{id:`device-credentials-title`},`Device credentials`,-1),R(`button`,{class:`icon-button`,"aria-label":`Close device credentials`,onClick:t[0]||=e=>r(`close`)},[z(A(vl),{size:18})])]),i.value?(F(),I(P,{key:0},[R(`p`,null,[B(D(i.value.name)+` `,1),R(`code`,null,D(i.value.id),1)]),R(`p`,xz,D(i.value.status)+` · tunnel `+D(i.value.tunnel?.state??`disconnected`)+` · `+D(i.value.tunnel?.readerCount??0)+` readers `,1),z(eb,{device:i.value},null,8,[`device`])],64)):(F(),I(`p`,Sz,`This device is no longer in the registry.`)),R(`footer`,null,[R(`button`,{class:`secondary`,onClick:t[1]||=e=>r(`close`)},`Close`)])])]))}}),wz={id:`prompt-title`},Tz=[`disabled`],Ez={key:0,class:`hint`},Dz={key:1},Oz={key:0,class:`muted`},kz=[`placeholder`,`disabled`],Az=[`required`,`placeholder`,`aria-label`,`disabled`],jz={key:2,class:`message-error`,role:`alert`},Mz=[`disabled`],Nz=[`disabled`],Pz=Dr({__name:`PromptDialog`,props:{dialog:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=k(n.dialog.value??``),a=k(!1),o=k(``),s=k(),c=!!n.dialog.label;async function l(){if(!a.value&&(!c||n.dialog.optional||i.value.trim())){a.value=!0,o.value=``;try{await n.dialog.run(i.value.trim()),r(`close`)}catch(e){o.value=cu(e)}finally{a.value=!1}}}return Hr(()=>void An(()=>(s.value?.focus(),s.value?.select()))),(t,n)=>(F(),I(`div`,{class:`modal-backdrop`,onClick:n[4]||=As(e=>!a.value&&r(`close`),[`self`])},[R(`form`,{class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`prompt-title`,onSubmit:As(l,[`prevent`])},[R(`header`,null,[R(`h2`,wz,D(e.dialog.title),1),R(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,disabled:a.value,onClick:n[0]||=e=>r(`close`)},[z(A(vl),{size:18})],8,Tz)]),e.dialog.hint?(F(),I(`p`,Ez,D(e.dialog.hint),1)):V(``,!0),c?(F(),I(`label`,Dz,[B(D(e.dialog.label)+` `,1),e.dialog.optional?(F(),I(`span`,Oz,`(optional)`)):V(``,!0),e.dialog.multiline?j((F(),I(`textarea`,{key:1,ref_key:`input`,ref:s,"onUpdate:modelValue":n[1]||=e=>i.value=e,rows:`4`,placeholder:e.dialog.placeholder,disabled:a.value},null,8,kz)),[[bs,i.value]]):j((F(),I(`input`,{key:2,ref_key:`input`,ref:s,"onUpdate:modelValue":n[2]||=e=>i.value=e,maxlength:`100`,required:!e.dialog.optional,placeholder:e.dialog.placeholder,"aria-label":e.dialog.label,disabled:a.value},null,8,Az)),[[bs,i.value]])])):V(``,!0),o.value?(F(),I(`p`,jz,D(o.value),1)):V(``,!0),R(`footer`,null,[R(`button`,{type:`button`,class:`secondary`,disabled:a.value,onClick:n[3]||=e=>r(`close`)},` Cancel `,8,Mz),R(`button`,{class:E([`primary`,{danger:e.dialog.danger}]),disabled:a.value||c&&!e.dialog.optional&&!i.value.trim()},D(a.value?`Working…`:e.dialog.submit),11,Nz)])],32)]))}}),Fz={class:`modal model-modal`},Iz={class:`eyebrow`},Lz={class:`model-list`},Rz=[`onClick`],zz=[`src`],Bz={class:`hint`},Vz=Dr({__name:`ModelPicker`,emits:[`close`],setup(e,{emit:t}){let n=t,r=k(``),i=H(()=>Wu.value.filter(e=>`${e.name} ${e.id} ${e.tier}`.toLowerCase().includes(r.value.toLowerCase()))),a=e=>e.id===Gu.value.agent.model?.modelId&&e.provider===Gu.value.agent.model?.provider;async function o(e){await ad(()=>Fu.value.configure({model:{provider:e.provider,modelId:e.id}}))&&(await ed(),q(`Model saved. Used on the next turn.`),n(`close`))}return(e,t)=>(F(),I(`div`,{class:`modal-backdrop`,onClick:t[2]||=As(e=>n(`close`),[`self`])},[R(`section`,Fz,[R(`header`,null,[R(`div`,null,[R(`span`,Iz,`PER AGENT · `+D(A(Ou)?.id),1),t[3]||=R(`h2`,null,`Choose a model`,-1)]),R(`button`,{class:`icon-button`,"aria-label":`Close model picker`,onClick:t[0]||=e=>n(`close`)},[z(A(vl),{size:18})])]),j(R(`input`,{"onUpdate:modelValue":t[1]||=e=>r.value=e,placeholder:`Search models or tiers…`,"aria-label":`Search models`},null,512),[[bs,r.value]]),R(`div`,Lz,[(F(!0),I(P,null,N(i.value,e=>(F(),I(`button`,{key:`${e.provider}/${e.id}`,class:E({selected:a(e)}),onClick:t=>o(e)},[R(`img`,{src:A(ld)(e.id),alt:``},null,8,zz),R(`div`,null,[R(`strong`,null,D(e.name),1),R(`small`,null,D(e.tier)+` / `+D(e.provider)+` / `+D(A(sd)(e.contextWindow))+` context`,1)]),a(e)?(F(),L(A(nc),{key:0,size:18})):V(``,!0)],10,Rz))),128))]),R(`p`,Bz,`Models available on `+D(A(Ou)?.id)+`. Provider keys stay on the device.`,1)])]))}}),Hz={class:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`help-title`},Uz={class:`dialog-head`},Wz={class:`dialog-body`},Gz={class:`n`},Kz={class:`body`},qz={class:`help-callout`},Jz={class:`dialog-foot`},Yz={class:`right`},Xz=Dr({__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)=>(F(),I(`div`,{class:`scrim`,onClick:n[2]||=As(e=>A(K).dialog=void 0,[`self`])},[R(`section`,Hz,[R(`div`,Uz,[n[3]||=R(`div`,null,[R(`span`,{class:`dialog-eyebrow`},`LEARN BY DOING`),R(`h3`,{id:`help-title`},`What makes this durable?`)],-1),R(`button`,{class:`icon-button`,"aria-label":`Close help`,onClick:n[0]||=e=>A(K).dialog=void 0},[z(A(vl),{size:18})])]),R(`div`,Wz,[(F(),I(P,null,N(t,(e,t)=>R(`div`,{key:e.title,class:`help-step`},[R(`span`,Gz,D(String(t+1).padStart(2,`0`)),1),R(`div`,null,[R(`b`,null,D(e.title),1),R(`div`,Kz,D(e.body),1)])])),64)),R(`div`,qz,[z(A(Oc),{size:18}),n[4]||=R(`span`,null,`Durable does not mean exactly-once external effects. Checkpoints protect progress. Tools still need their own idempotency.`,-1)])]),R(`div`,Jz,[R(`div`,Yz,[R(`button`,{class:`secondary`,type:`button`,onClick:n[1]||=e=>A(K).dialog=void 0},`Close`)])])])]))}}),Zz=Wt({needed:!1,busy:!1,error:``}),Qz=new Set,$z=e=>{let t=[...Qz];Qz=new Set;for(let n of t)n(e)},eB=()=>new Promise(e=>Qz.add(e));async function tB(e){if(Zz.busy||!e)return!1;Zz.busy=!0,Zz.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?(Zz.needed=!1,$z(!0),!0):(Zz.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 Zz.error=`Cannot reach the hub.`,!1}finally{Zz.busy=!1}}var nB=e=>{try{return new URL(e,location.href).pathname===`/api/session`}catch{return e===`/api/session`}};function rB(e){return(async(t,n)=>{let r=()=>e(t,n),i=await r();if(i.status!==401||nB(typeof t==`string`?t:t instanceof URL?t.href:t.url)||n?.body instanceof ReadableStream)return i;Zz.needed=!0;let a=await i.text().catch(()=>``);return await eB()?r():new Response(a,{status:i.status,headers:i.headers})})}function iB(){typeof window>`u`||window.__adminFetch||(window.__adminFetch=!0,window.fetch=rB(window.fetch.bind(window)))}var aB={class:`login-veil`,"data-testid":`login-card`},oB=[`disabled`],sB={key:0,class:`message-error`,role:`alert`},cB=[`disabled`],lB=Dr({__name:`LoginCard`,setup(e){let t=k(``),n=k();async function r(){if(Zz.busy||!t.value.trim())return;let e=await tB(t.value.trim());t.value=``,e&&n.value?.blur()}return Hr(()=>void An(()=>n.value?.focus())),(e,i)=>(F(),I(`div`,aB,[R(`form`,{class:`modal login-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`login-title`,onSubmit:As(r,[`prevent`])},[i[2]||=R(`header`,null,[R(`h2`,{id:`login-title`},`Admin token`)],-1),i[3]||=R(`p`,{class:`hint`},[B(` This hub is locked. Sign in with the token from its `),R(`code`,null,`admin.token`),B(` file. `)],-1),i[4]||=R(`label`,{for:`admin-token`},`Admin token`,-1),j(R(`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(Zz).busy,onKeydown:i[1]||=Ms(e=>A(Zz).error=``,[`esc`])},null,40,oB),[[bs,t.value]]),A(Zz).error?(F(),I(`p`,sB,D(A(Zz).error),1)):V(``,!0),R(`footer`,null,[R(`button`,{class:`primary`,type:`submit`,disabled:A(Zz).busy||!t.value.trim()},D(A(Zz).busy?`Checking…`:`Sign in`),9,cB)])],32)]))}}),uB={key:0,class:`toast`,role:`status`},dB=Dr({__name:`Toast`,setup(e){return(e,t)=>(F(),L(xo,{name:`toast`},{default:Hn(()=>[A(K).toast?(F(),I(`div`,uB,[z(A(nc),{size:18}),B(D(A(K).toast),1)])):V(``,!0)]),_:1}))}}),fB={class:`shell`,"data-testid":`app-shell`},pB={key:0,class:`error-banner`,role:`alert`},mB={key:4,class:`welcome`,"data-testid":`welcome-empty`},hB=[`disabled`],gB={class:`welcome-features`},_B={class:`modal path-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`path-title`},vB={class:`full-directory`},yB=Dr({__name:`App`,setup(e){let t=()=>bu.devices.value.filter(e=>e.status===`online`).length,n=k();function r(){K.dialog={kind:`new-session`,deviceId:G.value?.deviceId}}function i(e){let t=K.dialog?void 0:Sd(e);if(t)return e.preventDefault(),t===`tree`?vd():yd();if(e.key===`Escape`){if(K.dialog){K.dialog.kind===`pair`?n.value?.close():K.dialog=void 0;return}!e.repeat&&!e.isComposing&&Yu.value&&(e.preventDefault(),fd()),K.drawer=!1,K.inspectorOverlay=!1}}function a(e){let t=e.clientX,n=wu.value,r=e=>wu.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 Hr(()=>tf()),Hr(()=>{document.addEventListener(`keydown`,i),Hu()}),Gr(()=>{vu.stop(),document.removeEventListener(`keydown`,i)}),(e,i)=>(F(),I(`div`,fB,[z(Ld,{onNewSession:r}),A(K).error?(F(),I(`div`,pB,[z(A(Oc),{size:18}),R(`span`,null,D(A(K).error),1),R(`button`,{class:`icon-button`,"aria-label":`Dismiss error`,onClick:i[0]||=e=>A(K).error=``},`×`)])):V(``,!0),R(`main`,{class:`net-workspace`,style:ge({"--tree-w":`${A(wu)}px`})},[z(lp),A(Tu).tree?(F(),I(`div`,{key:0,class:`tree-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize network tree`,onPointerdown:As(a,[`prevent`])},null,32)):V(``,!0),A(K).drawer?(F(),I(`div`,{key:1,class:`tree-backdrop`,onClick:i[1]||=e=>A(K).drawer=!1})):V(``,!0),A(G)&&A(Ou)&&A(ku)?(F(),I(P,{key:2},[z(rD),A(K).inspectorOverlay?(F(),I(`div`,{key:0,class:`inspector-backdrop`,onClick:i[2]||=e=>A(_d)()})):V(``,!0),(F(),L(dy,{key:`${A(G).deviceId}/${A(G).sessionId}`}))],64)):A(G)&&A(Ou)?(F(),L(pD,{key:3,device:A(Ou)},null,8,[`device`])):(F(),I(`section`,mB,[i[14]||=R(`img`,{class:`welcome-symbol`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),i[15]||=R(`span`,{class:`eyebrow`},`THE DURABLE AGENT NETWORK`,-1),i[16]||=R(`h1`,null,[B(`Close the tab.`),R(`br`),B(`The work continues.`)],-1),i[17]||=R(`p`,null,`Agents run on your devices. This page is only a window into them.`,-1),R(`button`,{class:`primary`,disabled:!t(),onClick:r},[z(A(Xc),{size:18}),B(D(A(bu).devices.value.length?`Create a session`:`Add a device to dpi-network.yaml`),1)],8,hB),R(`div`,gB,[R(`span`,null,[z(A(pc),{size:18}),i[11]||=B(`SQLite on each device`,-1)]),R(`span`,null,[z(A(Cc),{size:18}),i[12]||=B(`Branch any agent`,-1)]),R(`span`,null,[z(A(Hs),{size:18}),i[13]||=B(`Watch from anywhere`,-1)])])]))],4),z(Bd),A(K).dialog?.kind===`pair`?(F(),L(yz,{key:1,ref_key:`pairWizard`,ref:n,handoff:A(K).dialog.handoff,onClose:i[3]||=e=>A(K).dialog=void 0},null,8,[`handoff`])):V(``,!0),A(K).dialog?.kind===`credentials`?(F(),L(Cz,{key:2,"device-id":A(K).dialog.deviceId,onClose:i[4]||=e=>A(K).dialog=void 0},null,8,[`device-id`])):V(``,!0),A(K).dialog?.kind===`new-session`?(F(),L(ND,{key:3,"device-id":A(K).dialog.deviceId,onClose:i[5]||=e=>A(K).dialog=void 0},null,8,[`device-id`])):A(K).dialog?.kind===`prompt`?(F(),L(Pz,{key:4,dialog:A(K).dialog,onClose:i[6]||=e=>A(K).dialog=void 0},null,8,[`dialog`])):A(K).dialog?.kind===`models`?(F(),L(Vz,{key:5,onClose:i[7]||=e=>A(K).dialog=void 0})):A(K).dialog?.kind===`path`?(F(),I(`div`,{key:6,class:`modal-backdrop`,onClick:i[10]||=As(e=>A(K).dialog=void 0,[`self`])},[R(`section`,_B,[R(`header`,null,[i[18]||=R(`h2`,{id:`path-title`},`Working directory`,-1),R(`button`,{class:`icon-button`,"aria-label":`Close working directory`,onClick:i[8]||=e=>A(K).dialog=void 0},[z(A(vl),{size:18})])]),R(`code`,vB,D(A(K).dialog.path),1),R(`footer`,null,[R(`button`,{class:`secondary`,onClick:i[9]||=e=>A(K).dialog=void 0},`Close`)])])])):A(K).dialog?.kind===`help`?(F(),L(Xz,{key:7})):V(``,!0),A(Zz).needed?(F(),L(lB,{key:8})):V(``,!0),z(dB)]))}});iB();var bB=new URL(window.location.href);if(/^\/pair\/?$/.test(bB.pathname)){let e=zR(bB);e?(bB.search=``,bB.hash=``,window.history.replaceState(window.history.state,``,bB),K.dialog={kind:`pair`,handoff:e}):window.history.replaceState(window.history.state,``,VR(bB))}Is(yB).mount(`#app`);
|