gestalt-mobile 0.48.1 → 0.49.0
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/README.md +12 -0
- package/dist/client/assets/index-C3IKYq_X.js +113 -0
- package/dist/client/index.html +1 -1
- package/dist/server/server/app.js +1 -1
- package/dist/server/server/composition.contracts.js +3 -0
- package/dist/server/server/composition.js +3 -0
- package/dist/server/server/features/maintenance/register-routes.js +3 -1
- package/dist/server/server/features/maintenance/upgrade/endpoint.js +30 -0
- package/dist/server/server/platform/codex/codex-serena.js +4 -0
- package/dist/server/server/platform/maintenance/managed-upgrade.js +67 -0
- package/dist/server/shared/contracts/upgrade.js +6 -0
- package/package.json +1 -1
- package/dist/client/assets/index-DvIxykMj.js +0 -112
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=Array.isArray,u=Array.prototype.indexOf,d=Array.prototype.includes,f=Array.from,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,g=Object.prototype,_=Array.prototype,v=Object.getPrototypeOf,y=Object.isExtensible,b=()=>{};function x(e){for(var t=0;t<e.length;t++)e[t]()}function S(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function C(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var w=1<<24,T=1024,E=2048,D=4096,ee=8192,te=16384,ne=32768,re=1<<25,ie=65536,O=1<<18,ae=1<<19,oe=1<<20,se=1<<25,ce=65536,le=1<<21,ue=1<<22,k=1<<23,de=Symbol(`$state`),fe=Symbol(`legacy props`),pe=Symbol(``),me=Symbol(`attributes`),he=Symbol(`class`),ge=Symbol(`style`),_e=Symbol(`text`),A=Symbol(`form reset`),ve=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ye=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function be(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function xe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Se(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ce(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function we(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Te(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ee(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function De(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Oe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ke(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ae(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function je(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Me={},j=Symbol(`uninitialized`),Ne=`http://www.w3.org/1999/xhtml`,Pe=`http://www.w3.org/2000/svg`,Fe=`http://www.w3.org/1998/Math/MathML`;function Ie(){console.warn(`https://svelte.dev/e/derived_inert`)}function Le(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Re(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function ze(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function Be(e){M=e}var N;function Ve(e){if(e===null)throw Le(),Me;return N=e}function He(){return Ve(_n(N))}function P(e){if(M){if(_n(N)!==null)throw Le(),Me;N=e}}function Ue(e=1){if(M){for(var t=e,n=N;t--;)n=_n(n);N=n}}function We(e=!0){for(var t=0,n=N;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=_n(n);e&&n.remove(),n=i}}function Ge(e){if(!e||e.nodeType!==8)throw Le(),Me;return e.data}function Ke(e){return e===this.v}function qe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Je(e){return!qe(e,this.v)}var Ye=!1;function Xe(){Ye=!0}var Ze=null;function Qe(e){Ze=e}function $e(e,t=!1,n){Ze={p:Ze,i:!1,c:null,e:null,s:e,x:null,r:or,l:Ye&&!t?{s:null,u:null,$:[]}:null}}function et(e){var t=Ze,n=t.e;if(n!==null){t.e=null;for(var r of n)Nn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ze=t.p,e??{}}function tt(){return!Ye||Ze!==null&&Ze.l===null}var nt=[];function rt(){var e=nt;nt=[],x(e)}function it(e){if(nt.length===0&&!Pt){var t=nt;queueMicrotask(()=>{t===nt&&rt()})}nt.push(e)}function at(){for(;nt.length>0;)rt()}function ot(e){var t=or;if(t===null)return rr.f|=k,e;if(!(t.f&32768)&&!(t.f&4))throw e;st(e,t)}function st(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}var ct=~(E|D|T);function F(e,t){e.f=e.f&ct|t}function lt(e){e.f&512||e.deps===null?F(e,T):F(e,D)}function ut(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=ce,ut(t.deps))}function dt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ut(e.deps),F(e,T)}var ft=!1;function pt(e){var t=ft;try{return ft=!1,[e(),ft]}finally{ft=t}}function mt(e){let t=0,n=$t(0),r;return()=>{An()&&(G(n),Ln(()=>(t===0&&(r=Or(()=>e(()=>rn(n)))),t+=1,()=>{it(()=>{--t,t===0&&(r?.(),r=void 0,rn(n))})})))}}var ht=ie|ae;function gt(e,t,n,r){new _t(e,t,n,r)}var _t=class{parent;is_pending=!1;transform_error;#e;#t=M?N:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=mt(()=>(this.#m=$t(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=or;t.b=this,t.f|=128,n(e)},this.parent=or.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=zn(()=>{if(M){let e=this.#t;He();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},ht),M&&(this.#e=N)}#g(){try{this.#a=Vn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Vn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Vn(()=>e(this.#e)),it(()=>{var e=this.#c=document.createDocumentFragment(),t=hn();e.append(t),this.#a=this.#x(()=>Vn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Jn(this.#o,()=>{this.#o=null}),this.#b(R))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Vn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Qn(this.#a,e);let t=this.#n.pending;this.#o=Vn(()=>t(this.#e))}else this.#b(R)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){dt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=or,n=rr,r=Ze;sr(this.#i),ar(this.#i),Qe(this.#i.ctx);try{return Bt.ensure(),e()}catch(e){return ot(e),null}finally{sr(t),ar(n),Qe(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Jn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,it(()=>{this.#d=!1,this.#m&&tn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),G(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;R?.is_fork?(this.#a&&R.skip_effect(this.#a),this.#o&&R.skip_effect(this.#o),this.#s&&R.skip_effect(this.#s),R.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Gn(this.#a),null),this.#o&&=(Gn(this.#o),null),this.#s&&=(Gn(this.#s),null),M&&(Ve(this.#t),Ue(),Ve(We()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){ze();return}r=!0,i&&je(),this.#s!==null&&Jn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){st(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Vn(()=>{var t=or;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return st(e,this.#i.parent),null}}))};it(()=>{var t;try{t=this.transform_error(e)}catch(e){st(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>st(e,this.#i&&this.#i.parent)):o(t)})}};function vt(e,t,n,r){let i=tt()?xt:wt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=or,c=yt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){st(e,s)}bt()}}var d=I();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Ct(e))).then(u).catch(e=>st(e,s)).finally(d)}l?l.then(()=>{c(),f(),bt()}):f()}function yt(){var e=or,t=rr,n=Ze,r=R;return function(i=!0){sr(e),ar(t),Qe(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function bt(e=!0){sr(null),ar(null),Qe(null),e&&R?.deactivate()}function I(){var e=or,t=e.b,n=R,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function xt(e){var t=2|E;return or!==null&&(or.f|=ae),{ctx:Ze,deps:null,effects:null,equals:Ke,f:t,fn:e,reactions:null,rv:0,v:j,wv:0,parent:or,ac:null}}var St=Symbol(`obsolete`);function Ct(e,t,n){let r=or;r===null&&xe();var i=void 0,a=$t(j),o=!rr,s=new Set;return In(()=>{var t=or,n=S();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ve&&n.reject(e)}).finally(bt)}catch(e){n.reject(e),bt()}var c=R;if(o){if(t.f&32768)var l=I();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(St);else for(let e of s.values())e.reject(St);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==St&&(c.activate(),t?(a.f|=k,tn(a,t)):(a.f&8388608&&(a.f^=k),tn(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),jn(()=>{for(let e of s)e.reject(St)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function L(e){let t=xt(e);return lr(t),t}function wt(e){let t=xt(e);return t.equals=Je,t}function Tt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Gn(t[n])}}function Et(e){var t,n=or,r=e.parent;if(!tr&&r!==null&&e.v!==j&&r.f&24576)return Ie(),e.v;sr(r);try{e.f&=~ce,Tt(e),t=xr(e)}finally{sr(n)}return t}function Dt(e){var t=Et(e);if(!e.equals(t)&&(e.wv=vr(),(!R?.is_fork||e.deps===null)&&(R===null?e.v=t:(R.capture(e,t,!0),jt?.capture(e,t,!0)),e.deps===null))){F(e,T);return}tr||(Mt===null?lt(e):(An()||R?.is_fork)&&Mt.set(e,t))}function Ot(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ve),t.fn!==null&&(t.teardown=b),t.ac=null,Cr(t,0),Un(t))}function kt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&wr(t)}var At=null,R=null,jt=null,Mt=null,Nt=null,Pt=!1,Ft=!1,It=null,Lt=null,Rt=0,zt=1,Bt=class e{id=zt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){At===null?At=this:(At.#n=this,this.#t=At),At=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)F(r,E),t(r);for(r of n.m)F(r,D),t(r)}this.#p.add(e)}#g(){this.#e=!0,Rt++>1e3&&(this.#x(),Ht());for(let e of this.#u)this.#d.delete(e),F(e,E),this.schedule(e);for(let e of this.#d)F(e,D),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=It=[],r=[],i=Lt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Yt(e),this.#h()||this.discard(),t}if(R=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(It=null,Lt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Jt(e,t);i.length>0&&R.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),jt=this,Wt(r),Wt(n),jt=null,this.#s?.resolve();var s=R;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=T;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=T:i&4?t.push(r):yr(r)&&(i&16&&this.#d.add(r),wr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),F(i,E),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),R=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)dt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==j&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),Mt?.set(e,t)),this.is_fork||(e.v=t)}activate(){R=this}deactivate(){R=null,Mt=null}flush(){try{Ft=!0,R=this,this.#g()}finally{Rt=0,Nt=null,It=null,Lt=null,Ft=!1,R=null,Mt=null,Zt.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(St);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,it(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=S()).promise}static ensure(){if(R===null){let t=R=new e;!Ft&&!Pt&&it(()=>{t.#e||t.flush()})}return R}apply(){Mt=null}schedule(e){if(Nt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(It!==null&&t===or&&(rr===null||!(rr.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=T}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?At=e:t.#t=e,this.linked=!1}}};function Vt(e){var t=Pt;Pt=!0;try{var n;for(e&&(R!==null&&!R.is_fork&&R.flush(),n=e());;){if(at(),R===null)return n;R.flush()}}finally{Pt=t}}function Ht(){try{Ee()}catch(e){st(e,Nt)}}var Ut=null;function Wt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&yr(r)&&(Ut=new Set,wr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&qn(r),Ut?.size>0)){Zt.clear();for(let e of Ut){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Ut.has(n)&&(Ut.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||wr(n)}}Ut.clear()}}Ut=null}}function Gt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Gt(i,t,n,r):e&4194320&&!(e&2048)&&Kt(i,t,r)&&(F(i,E),qt(i))}}function Kt(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(d.call(t,r))return!0;if(r.f&2&&Kt(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function qt(e){R.schedule(e)}function Jt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),F(e,T);for(var n=e.first;n!==null;)Jt(n,t),n=n.next}}function Yt(e){F(e,T);for(var t=e.first;t!==null;)Yt(t),t=t.next}var Xt=new Set,Zt=new Map,Qt=!1;function $t(e,t){return{f:0,v:e,reactions:null,equals:Ke,rv:0,wv:0}}function z(e,t){let n=$t(e,t);return lr(n),n}function en(e,t=!1,n=!0){let r=$t(e);return t||(r.equals=Je),Ye&&n&&Ze!==null&&Ze.l!==null&&(Ze.l.s??=[]).push(r),r}function B(e,t,n=!1){return rr!==null&&(!ir||rr.f&131072)&&tt()&&rr.f&4325394&&(cr===null||!cr.has(e))&&Ae(),tn(e,n?on(t):t,Lt)}function tn(e,t,n=null){if(!e.equals(t)){Zt.set(e,tr?t:e.v);var r=Bt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Et(t),Mt===null&<(t)}e.wv=vr(),an(e,E,n),tt()&&or!==null&&or.f&1024&&!(or.f&96)&&(fr===null?pr([e]):fr.push(e)),!r.is_fork&&Xt.size>0&&!Qt&&nn()}return t}function nn(){Qt=!1;for(let e of Xt){e.f&1024&&F(e,D);let t;try{t=yr(e)}catch{t=!0}t&&wr(e)}Xt.clear()}function rn(e){B(e,e.v+1)}function an(e,t,n){var r=e.reactions;if(r!==null)for(var i=tt(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===or)){var l=(c&E)===0;if(l&&F(s,t),c&131072)Xt.add(s);else if(c&2){var u=s;Mt?.delete(u),c&65536||(c&512&&(or===null||!(or.f&2097152))&&(s.f|=ce),an(u,D,n))}else if(l){var d=s;c&16&&Ut!==null&&Ut.add(d),n===null?qt(d):n.push(d)}}}}function on(e){if(typeof e!=`object`||!e||de in e)return e;let t=v(e);if(t!==g&&t!==_)return e;var n=new Map,r=l(e),i=z(0),a=null,o=gr,s=e=>{if(gr===o)return e();var t=rr,n=gr;ar(null),_r(o);var r=e();return ar(t),_r(n),r};return r&&n.set(`length`,z(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Oe();var i=n.get(t);return i===void 0?s(()=>{var e=z(r.value,a);return n.set(t,e),e}):B(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>z(j,a));n.set(t,e),rn(i)}}else B(r,j),rn(i);return!0},get(t,r,i){if(r===de)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||m(t,r)?.writable)&&(o=s(()=>z(on(c?t[r]:j),a)),n.set(r,o)),o!==void 0){var l=G(o);return l===j?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=G(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==j)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===de)return!0;var r=n.get(t),i=r!==void 0&&r.v!==j||Reflect.has(e,t);return(r!==void 0||or!==null&&(!i||m(e,t)?.writable))&&(r===void 0&&(r=s(()=>z(i?on(e[t]):j,a)),n.set(t,r)),G(r)===j)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>z(j,a)),n.set(d+``,f)):B(f,j)}if(l===void 0)(!u||m(e,t)?.writable)&&(l=s(()=>z(void 0,a)),B(l,on(o)),n.set(t,l));else{u=l.v!==j;var p=s(()=>on(o));B(l,p)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(c,o),!u){if(r&&typeof t==`string`){var g=n.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&B(g,_+1)}rn(i)}return!0},ownKeys(e){G(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==j});for(var[r,a]of n)a.v!==j&&!(r in e)&&t.push(r);return t},setPrototypeOf(){ke()}})}function sn(e){try{if(typeof e==`object`&&e&&de in e)return e[de]}catch{}return e}function cn(e,t){return Object.is(sn(e),sn(t))}var ln,un,dn,fn,pn;function mn(){if(ln===void 0){ln=window,un=document,dn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;fn=m(t,`firstChild`).get,pn=m(t,`nextSibling`).get,y(e)&&(e[he]=void 0,e[me]=null,e[ge]=void 0,e.__e=void 0),y(n)&&(n[_e]=void 0)}}function hn(e=``){return document.createTextNode(e)}function gn(e){return fn.call(e)}function _n(e){return pn.call(e)}function V(e,t){if(!M)return gn(e);var n=gn(N);if(n===null)n=N.appendChild(hn());else if(t&&n.nodeType!==3){var r=hn();return n?.before(r),Ve(r),r}return t&&xn(n),Ve(n),n}function H(e,t=!1){if(!M){var n=gn(e);return n instanceof Comment&&n.data===``?_n(n):n}if(t){if(N?.nodeType!==3){var r=hn();return N?.before(r),Ve(r),r}xn(N)}return N}function U(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=_n(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=hn();return r===null?i?.after(a):r.before(a),Ve(a),a}xn(r)}return Ve(r),r}function vn(e){e.textContent=``}function yn(){return!1}function bn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function xn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Sn(e){M&&gn(e)!==null&&vn(e)}var Cn=!1;function wn(){Cn||(Cn=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[A]?.()})},{capture:!0}))}function Tn(e){var t=rr,n=or;ar(null),sr(null);try{return e()}finally{ar(t),sr(n)}}function En(e,t,n,r=n){e.addEventListener(t,()=>Tn(n));let i=e[A];i?e[A]=()=>{i(),r(!0)}:e[A]=()=>r(!0),wn()}function Dn(e){or===null&&(rr===null&&Te(e),we()),tr&&Ce(e)}function On(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function kn(e,t){var n=or;n!==null&&n.f&8192&&(e|=ee);var r={ctx:Ze,deps:null,nodes:null,f:e|E|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};R?.register_created_effect(r);var i=r;if(e&4)It===null?Bt.ensure().schedule(r):It.push(r);else if(t!==null){try{wr(r)}catch(e){throw Gn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ie))}if(i!==null&&(i.parent=n,n!==null&&On(i,n),rr!==null&&rr.f&2&&!(e&64))){var a=rr;(a.effects??=[]).push(i)}return r}function An(){return rr!==null&&!ir}function jn(e){let t=kn(8,null);return F(t,T),t.teardown=e,t}function Mn(e){Dn(`$effect`);var t=or.f;if(!rr&&t&32&&Ze!==null&&!Ze.i){var n=Ze;(n.e??=[]).push(e)}else return Nn(e)}function Nn(e){return kn(4|oe,e)}function Pn(e){Bt.ensure();let t=kn(64|ae,e);return(e={})=>new Promise(n=>{e.outro?Jn(t,()=>{Gn(t),n(void 0)}):(Gn(t),n(void 0))})}function Fn(e){return kn(4,e)}function In(e){return kn(ue|ae,e)}function Ln(e,t=0){return kn(8|t,e)}function W(e,t=[],n=[],r=[]){vt(r,t,n,t=>{kn(8,()=>{e(...t.map(G))})})}function Rn(e,t=[],n=[],r=[]){vt(r,t,n,t=>{kn(4,()=>e(...t.map(G)))})}function zn(e,t=0){return kn(16|t,e)}function Bn(e,t=0){return kn(w|t,e)}function Vn(e){return kn(32|ae,e)}function Hn(e){var t=e.teardown;if(t!==null){let e=tr,n=rr;nr(!0),ar(null);try{t.call(null)}finally{nr(e),ar(n)}}}function Un(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Tn(()=>{e.abort(ve)});var r=n.next;n.f&64?n.parent=null:Gn(n,t),n=r}}function Wn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Gn(t),t=n}}function Gn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Kn(e.nodes.start,e.nodes.end),n=!0),e.f|=re,Un(e,t&&!n),Cr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Hn(e),e.f^=re,e.f|=te;var i=e.parent;i!==null&&i.first!==null&&qn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Kn(e,t){for(;e!==null;){var n=e===t?null:_n(e);e.remove(),e=n}}function qn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Jn(e,t,n=!0){var r=[];Yn(e,r,!0);var i=()=>{n&&Gn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Yn(e,t,n){if(!(e.f&8192)){e.f^=ee;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;Yn(i,t,o?n:!1)}i=a}}}function Xn(e){Zn(e,!0)}function Zn(e,t){if(e.f&8192){e.f^=ee,e.f&1024||(F(e,E),Bt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;Zn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Qn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:_n(n);t.append(n),n=i}}var $n=null,er=!1,tr=!1;function nr(e){tr=e}var rr=null,ir=!1;function ar(e){rr=e}var or=null;function sr(e){or=e}var cr=null;function lr(e){rr!==null&&(cr??=new Set).add(e)}var ur=null,dr=0,fr=null;function pr(e){fr=e}var mr=1,hr=0,gr=hr;function _r(e){gr=e}function vr(){return++mr}function yr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~ce),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(yr(a)&&Dt(a),a.wv>e.wv)return!0}t&512&&Mt===null&&F(e,T)}return!1}function br(e,t,n=!0){var r=e.reactions;if(r!==null&&!(cr!==null&&cr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?br(a,t,!1):t===a&&(n?F(a,E):a.f&1024&&F(a,D),qt(a))}}function xr(e){var t=ur,n=dr,r=fr,i=rr,a=cr,o=Ze,s=ir,c=gr,l=e.f;ur=null,dr=0,fr=null,rr=l&96?null:e,cr=null,Qe(e.ctx),ir=!1,gr=++hr,e.ac!==null&&(Tn(()=>{e.ac.abort(ve)}),e.ac=null);try{e.f|=le;var u=e.fn,d=u();e.f|=ne;var f=e.deps,p=R?.is_fork;if(ur!==null){var m;if(p||Cr(e,dr),f!==null&&dr>0)for(f.length=dr+ur.length,m=0;m<ur.length;m++)f[dr+m]=ur[m];else e.deps=f=ur;if(An()&&e.f&512)for(m=dr;m<f.length;m++)(f[m].reactions??=[]).push(e)}else!p&&f!==null&&dr<f.length&&(Cr(e,dr),f.length=dr);if(tt()&&fr!==null&&!ir&&f!==null&&!(e.f&6146))for(m=0;m<fr.length;m++)br(fr[m],e);if(i!==null&&i!==e){if(hr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=hr;if(t!==null)for(let e of t)e.rv=hr;fr!==null&&(r===null?r=fr:r.push(...fr))}return e.f&8388608&&(e.f^=k),d}catch(e){return ot(e)}finally{e.f^=le,ur=t,dr=n,fr=r,rr=i,cr=a,Qe(o),ir=s,gr=c}}function Sr(e,t){let n=t.reactions;if(n!==null){var r=u.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(ur===null||!d.call(ur,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~ce),a.v!==j&<(a),Ot(a),Cr(a,0)}}function Cr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Sr(e,n[r])}function wr(e){var t=e.f;if(!(t&16384)){F(e,T);var n=or,r=er;or=e,er=!0;try{t&16777232?Wn(e):Un(e),Hn(e);var i=xr(e);e.teardown=typeof i==`function`?i:null,e.wv=mr}finally{er=r,or=n}}}async function Tr(){await Promise.resolve(),Vt()}function G(e){var t=(e.f&2)!=0;if($n?.add(e),rr!==null&&!ir&&!(or!==null&&or.f&16384)&&(cr===null||!cr.has(e))){var n=rr.deps;if(rr.f&2097152)e.rv<hr&&(e.rv=hr,ur===null&&n!==null&&n[dr]===e?dr++:ur===null?ur=[e]:ur.push(e));else{rr.deps??=[],d.call(rr.deps,e)||rr.deps.push(e);var r=e.reactions;r===null?e.reactions=[rr]:d.call(r,rr)||r.push(rr)}}if(tr&&Zt.has(e))return Zt.get(e);if(t){var i=e;if(tr){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Dr(i))&&(a=Et(i)),Zt.set(i,a),a}var o=(i.f&512)==0&&!ir&&rr!==null&&(er||(rr.f&512)!=0),s=(i.f&ne)===0;yr(i)&&(o&&(i.f|=512),Dt(i)),o&&!s&&(kt(i),Er(i))}if(Mt?.has(e))return Mt.get(e);if(e.f&8388608)throw e.v;return e.v}function Er(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(kt(t),Er(t))}function Dr(e){if(e.v===j)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Zt.has(t)||t.f&2&&Dr(t))return!0;return!1}function Or(e){var t=ir;try{return ir=!0,e()}finally{ir=t}}function kr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(de in e)Ar(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&de in n&&Ar(n)}}}function Ar(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Ar(e[n],t)}catch{}let n=v(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=h(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var jr=[`touchstart`,`touchmove`];function Mr(e){return jr.includes(e)}var Nr=Symbol(`events`),Pr=new Set,Fr=new Set;function Ir(e,t,n,r={}){function i(e){if(r.capture||Br.call(t,e),!e.cancelBubble)return Tn(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?it(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Lr(e,t,n,r,i){var a={capture:r,passive:i},o=Ir(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&jn(()=>{t.removeEventListener(e,o,a)})}function K(e,t,n){(t[Nr]??={})[e]=n}function Rr(e){for(var t=0;t<e.length;t++)Pr.add(e[t]);for(var n of Fr)n(e)}var zr=null;function Br(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;zr=e;var o=0,s=zr===e&&e[Nr];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Nr]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){p(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=rr,d=or;ar(null),sr(null);try{for(var f,m=[];a!==null&&a!==t;){try{var h=a[Nr]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){f?m.push(e):f=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(f){for(let e of m)queueMicrotask(()=>{throw e});throw f}}finally{e[Nr]=t,delete e.currentTarget,ar(u),sr(d)}}}var Vr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Hr(e){return Vr?.createHTML(e)??e}function Ur(e){var t=bn(`template`);return t.innerHTML=Hr(e.replaceAll(`<!>`,`<!---->`)),t.content}function Wr(e,t){var n=or;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(M)return Wr(N,null),N;i===void 0&&(i=Ur(a?e:`<!>`+e),n||(i=gn(i)));var t=r||dn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=gn(t),s=t.lastChild;Wr(o,s)}else Wr(t,t);return t}}function Gr(e=``){if(!M){var t=hn(e+``);return Wr(t,t),t}var n=N;return n.nodeType===3?xn(n):(n.before(n=hn()),Ve(n)),Wr(n,n),n}function Kr(){if(M)return Wr(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=hn();return e.append(t,n),Wr(t,n),e}function J(e,t){if(M){var n=or;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=N),He();return}e!==null&&e.before(t)}function Y(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[_e]??=e.nodeValue)&&(e[_e]=n,e.nodeValue=`${n}`)}function qr(e,t){return Yr(e,t)}var Jr=new Map;function Yr(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){mn();var c=void 0,l=Pn(()=>{var o=n??t.appendChild(hn());gt(o,{pending:()=>{}},t=>{$e({});var n=Ze;if(a&&(n.c=a),i&&(r.$$events=i),M&&Wr(t,null),c=e(t,r)||{},M&&(or.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw Le(),Me;et()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Mr(r);for(let e of[t,document]){var a=Jr.get(e);a===void 0&&(a=new Map,Jr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,Br,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(f(Pr)),Fr.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=Jr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Br),r.delete(e),r.size===0&&Jr.delete(n)):r.set(e,i)}Fr.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return Xr.set(c,l),c}var Xr=new WeakMap,Zr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Xn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Xn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Gn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Qn(r,t),t.append(hn()),this.#n.set(e,{effect:r,fragment:t})}else Gn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Jn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Gn(n.effect),this.#n.delete(e))};ensure(e,t){var n=R,r=yn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=hn();i.append(a),this.#n.set(e,{effect:Vn(()=>t(a)),fragment:i})}else this.#t.set(e,Vn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else M&&(this.anchor=N),this.#a(n)}};function X(e,t,n=!1){var r;M&&(r=N,He());var i=new Zr(e),a=n?ie:0;function o(e,t){if(M){var n=Ge(r);if(e!==parseInt(n.substring(1))){var a=We();Ve(a),i.anchor=a,Be(!1),i.ensure(e,t),Be(!0);return}}i.ensure(e,t)}zn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Qr=Symbol(`NaN`);function $r(e,t,n){M&&He();var r=new Zr(e),i=!tt();zn(()=>{var e=t();e!==e&&(e=Qr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function ei(e,t){return t}function ti(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];Jn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;ni(e,f(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null;if(c){var l=n,u=l.parentNode;vn(u),u.append(l),e.items.clear()}ni(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function ni(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=se,Qn(a,document.createDocumentFragment())):Gn(t[i],n)}}var ri;function Z(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=M?Ve(gn(c)):c.appendChild(hn())}M&&He();var u=null,d=wt(()=>{var e=n();return l(e)?e:e==null?[]:f(e)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=u,ai(v,p,o,t,r),u!==null&&(p.length===0?u.f&33554432?(u.f^=se,si(u,null,o)):Xn(u):Jn(u,()=>{u=null})))}function _(e){v.pending.delete(e)}var v={effect:zn(()=>{p=G(d);var e=p.length;let c=!1;M&&Ge(o)===`[!`!=(e===0)&&(o=We(),Ve(o),Be(!1),c=!0);for(var l=new Set,f=R,v=yn(),y=0;y<e;y+=1){M&&N.nodeType===8&&N.data===`]`&&(o=N,c=!0,Be(!1));var b=p[y],x=r(b,y),S=h?null:s.get(x);S?(S.v&&tn(S.v,b),S.i&&tn(S.i,y),v&&f.unskip_effect(S.e)):(S=oi(s,h?o:ri??=hn(),b,x,y,i,t,n),h||(S.e.f|=se),s.set(x,S)),l.add(x)}if(e===0&&a&&!u&&(h?u=Vn(()=>a(o)):(u=Vn(()=>a(ri??=hn())),u.f|=se)),e>l.size&&Se(``,``,``),M&&e>0&&Ve(We()),!h)if(m.set(f,l),v){for(let[e,t]of s)l.has(e)||f.skip_effect(t.e);f.oncommit(g),f.ondiscard(_)}else g(f);c&&Be(!0),G(d)}),flags:t,items:s,pending:m,outrogroups:null,fallback:u};h=!1,M&&(o=N)}function ii(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function ai(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=ii(e.effect.first),l,u=null,d,p=[],m=[],h,g,_,v;if(a)for(v=0;v<o;v+=1)h=t[v],g=i(h,v),_=s.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(d??=new Set).add(_));for(v=0;v<o;v+=1){if(h=t[v],g=i(h,v),_=s.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Xn(_),a&&(_.nodes?.a?.unfix(),(d??=new Set).delete(_))),_.f&33554432)if(_.f^=se,_===c)si(_,null,n);else{var y=u?u.next:c;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),ci(e,u,_),ci(e,_,y),si(_,y,n),u=_,p=[],m=[],c=ii(u.next);continue}if(_!==c){if(l!==void 0&&l.has(_)){if(p.length<m.length){var b=m[0],x;u=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)si(p[x],b,n);for(x=0;x<m.length;x+=1)l.delete(m[x]);ci(e,S.prev,C.next),ci(e,u,S),ci(e,C,b),c=b,u=C,--v,p=[],m=[]}else l.delete(_),si(_,c,n),ci(e,_.prev,_.next),ci(e,_,u===null?e.effect.first:u.next),ci(e,u,_),u=_;continue}for(p=[],m=[];c!==null&&c!==_;)(l??=new Set).add(c),m.push(c),c=ii(c.next);if(c===null)continue}_.f&33554432||p.push(_),u=_,c=ii(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(ni(e,f(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var w=[];if(l!==void 0)for(_ of l)_.f&8192||w.push(_);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&w.push(c),c=ii(c.next);var T=w.length;if(T>0){var E=r&4&&o===0?n:null;if(a){for(v=0;v<T;v+=1)w[v].nodes?.a?.measure();for(v=0;v<T;v+=1)w[v].nodes?.a?.fix()}ti(e,w,E)}}a&&it(()=>{if(d!==void 0)for(_ of d)_.nodes?.a?.apply()})}function oi(e,t,n,r,i,a,o,s){var c=o&1?o&16?$t(n):en(n,!1,!1):null,l=o&2?$t(i):null;return{v:c,i:l,e:Vn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function si(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=_n(r);if(a.before(r),r===i)return;r=o}}function ci(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function li(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;M&&(o=Ve(gn(c)))}W(()=>{var e=or;if(s===(s=t()??``)){M&&He();return}if(n&&!M){e.nodes=null,c.innerHTML=s,s!==``&&Wr(gn(c),c.lastChild);return}if(e.nodes!==null&&(Kn(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(M){for(var a=N.data,l=He(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=_n(l);if(l===null)throw Le(),Me;Wr(N,u),o=Ve(l);return}var d=bn(r?`svg`:i?`math`:`template`,r?Pe:i?Fe:void 0);d.innerHTML=s;var f=r||i?d:d.content;if(Wr(gn(f),f.lastChild),r||i)for(;gn(f);)o.before(gn(f));else o.before(f)}})}function ui(e,t,...n){var r=new Zr(e);zn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},ie)}function di(e,t){let n=null,r=M;var i;if(M){n=N;for(var a=gn(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=_n(a);if(a===null)Be(!1);else{var o=_n(a);a.remove(),Ve(o)}}M||(i=document.head.appendChild(hn()));try{zn(()=>{var e=Vn(()=>t(i));e.f|=O})}finally{r&&(Be(!0),Ve(n))}}function fi(e,t,n){Fn(()=>{var r=Or(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Ln(()=>{var e=n();kr(e),i&&qe(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function pi(e,t){var n=void 0,r;Bn(()=>{n!==(n=t())&&(r&&=(Gn(r),null),n&&(r=Vn(()=>{Fn(()=>n(e))})))})}function mi(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=mi(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function hi(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=mi(e))&&(r&&(r+=` `),r+=t);return r}function gi(e){return typeof e==`object`?hi(e):e??``}var _i=[...`
|
|
2
|
+
\r\f\xA0\v`];function vi(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||_i.includes(r[o-1]))&&(s===r.length||_i.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function yi(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function bi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function xi(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(bi)),i&&c.push(...Object.keys(i).map(bi));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=bi(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=yi(r)),i&&(n+=yi(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Si(e,t,n,r,i,a){var o=e[he];if(M||o!==n||o===void 0){var s=vi(n,r,a);(!M||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[he]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Ci(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function wi(e,t,n,r){var i=e[ge];if(M||i!==t){var a=xi(t,r);(!M||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[ge]=t}else r&&(Array.isArray(r)?(Ci(e,n?.[0],r[0]),Ci(e,n?.[1],r[1],`important`)):Ci(e,n,r));return r}function Ti(e,t,n=!1){if(e.multiple){if(t==null)return;if(!l(t))return Re();for(var r of e.options)r.selected=t.includes(Oi(r));return}for(r of e.options)if(cn(Oi(r),t)){r.selected=!0;return}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Ei(e){var t=new MutationObserver(()=>{Ti(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),jn(()=>{t.disconnect()})}function Di(e,t,n=t){var r=new WeakSet,i=!0;En(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),Oi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&Oi(o)}n(a),e.__value=a,R!==null&&r.add(R)}),Fn(()=>{var a=t();if(e===document.activeElement){var o=R;if(r.has(o))return}if(Ti(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=Oi(s),n(a))}e.__value=a,i=!1}),Ei(e)}function Oi(e){return`__value`in e?e.__value:e.value}var ki=Symbol(`is custom element`),Ai=Symbol(`is html`),ji=ye?`link`:`LINK`,Mi=ye?`progress`:`PROGRESS`;function Ni(e){if(M){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[A]=n,it(n),wn()}}function Pi(e,t){var n=Ii(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Mi)||(e.value=t??``)}function Fi(e,t){var n=Ii(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Q(e,t,n,r){var i=Ii(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ji)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[pe]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ri(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Ii(e){return e[me]??={[ki]:e.nodeName.includes(`-`),[Ai]:e.namespaceURI===Ne}}var Li=new Map;function Ri(e){var t=e.getAttribute(`is`)||e.nodeName,n=Li.get(t);if(n)return n;Li.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=h(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.push(o);i=v(i)}return n}function zi(e,t,n=t){var r=new WeakSet;En(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Bi(e)?Vi(a):a,n(a),R!==null&&r.add(R),await Tr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(M&&e.defaultValue!==e.value||Or(t)==null&&e.value)&&(n(Bi(e)?Vi(e.value):e.value),R!==null&&r.add(R)),Ln(()=>{var n=t();if(e===document.activeElement){var i=R;if(r.has(i))return}Bi(e)&&n===Vi(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function Bi(e){var t=e.type;return t===`number`||t===`range`}function Vi(e){return e===``?null:+e}function Hi(e,t){return e===t||e?.[de]===t}function Ui(e={},t,n,r){var i=Ze.r,a=or;return Fn(()=>{var o,s;return Ln(()=>{o=s,s=r?.()||[],Or(()=>{Hi(n(...s),e)||(t(e,...s),o&&Hi(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Hi(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Wi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Ln(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&jn(()=>{n.removeEventListener(t,a)})}function $(e,t,n,r){var i=!Ye||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=void 0,u=()=>o&&i?(l??=xt(r),G(l)):(c&&(c=!1,s=o?Or(r):r),s);let d;if(a){var f=de in e||fe in e;d=m(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,h=!1;a?[p,h]=pt(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&De(t),d(p)));var g=i?()=>{var n=e[t];return n===void 0?u():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return g;if(d){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&d(t?g():e),e):g()})}var v=!1,y=(n&1?xt:wt)(()=>(v=!1,g()));a&&G(y);var b=or;return(function(e,t){if(arguments.length>0){let n=t?G(y):i&&a?on(e):e;return B(y,n),v=!0,s!==void 0&&(s=n),e}return tr&&v||b.f&16384?y.v:G(y)})}function Gi(e){Ze===null&&be(`onMount`),Ye&&Ze.l!==null?qi(Ze).m.push(e):Mn(()=>{let t=Or(e);if(typeof t==`function`)return t})}function Ki(e){Ze===null&&be(`onDestroy`),Gi(()=>()=>Or(e))}function qi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var Ji=`gestalt-mobile.theme`,Yi=`dyne-org`,Xi=[{id:`dyne-org`,label:`Dyne.org`,colorScheme:`light`,logoTone:`dark`},{id:`minimal-light`,label:`Minimal light`,colorScheme:`light`,logoTone:`dark`},{id:`minimal-dark`,label:`Minimal dark`,colorScheme:`dark`,logoTone:`light`}];function Zi(e){return typeof e==`string`&&Xi.some(t=>t.id===e)}function Qi(e){return e===`light`?`minimal-light`:e===`dark`?`minimal-dark`:Zi(e)?e:Yi}function $i(e){return Xi.find(t=>t.id===e)||ea(e)}function ea(e){throw Error(`Unknown theme ID: ${e}`)}function ta(e){try{return e?.getItem(`gestalt-mobile.theme`)??null}catch{return null}}function na(e){if(`storage`in e)return e.storage??null;try{return window.localStorage}catch{return null}}function ra(e){return`meta`in e?e.meta??null:document.querySelector(`meta[name="color-scheme"]`)}function ia(e,t={}){let n=t.root??document.documentElement,r=ra(t),i=$i(e);return n.dataset.theme=i.id,n.dataset.logoTone=i.logoTone,n.style.colorScheme=i.colorScheme,r&&(r.content=i.colorScheme),i.id}function aa(e={}){return ia(Qi(ta(na(e))),e)}function oa(e,t={}){let n=ia(e,t);try{na(t)?.setItem(Ji,n)}catch{}return n}var sa=q(`<img class="brand-icon brand-icon-custom" alt=""/>`),ca=q(`<img class="brand-icon light-asset" src="/branding/p_glogo_grey.svg" alt=""/> <img class="brand-icon dark-asset" src="/branding/p_glogo_white.svg" alt=""/>`,1),la=q(`<span class="session-model svelte-t9laac"><small> </small></span>`),ua=q(`<p class="session-path svelte-t9laac"> <!></p>`),da=q(`<span class="weekly-quota" aria-label="Weekly quota remaining"> </span>`),fa=q(`<button class="detach-chat svelte-t9laac" type="button" aria-label="Open Chat in a separate window" title="Open Chat in a separate window"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-t9laac"><path d="M14 5h5v5M19 5l-8 8"></path><path d="M18 13v5a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"></path></svg></button>`),pa=q(`<option> </option>`),ma=q(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide"> </button>`),ha=q(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Copy session to CLI</button>`),ga=q(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Authorized devices</button> <button type="button" class="lock-relay" popovertarget="configuration-panel" popovertargetaction="hide">Lock Gestalt Mobile</button>`,1),_a=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac">Phase</dt> <dd class="svelte-t9laac"> </dd></div>`),va=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac">Files</dt> <dd class="svelte-t9laac"> </dd></div>`),ya=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac">Records</dt> <dd class="svelte-t9laac"> </dd></div>`),ba=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac">Last update</dt> <dd class="svelte-t9laac"><time> </time></dd></div>`),xa=q(`<p class="svelte-t9laac"> </p>`),Sa=q(`<section class="component-versions xerj-status svelte-t9laac" aria-labelledby="xerj-status-title"><h2 id="xerj-status-title" class="svelte-t9laac">Source discovery</h2> <dl class="svelte-t9laac"><div class="svelte-t9laac"><dt class="svelte-t9laac">XERJ</dt> <dd class="svelte-t9laac"> </dd></div> <div class="svelte-t9laac"><dt class="svelte-t9laac">Root</dt> <dd class="xerj-root svelte-t9laac"> </dd></div> <!> <!> <!> <!></dl> <!></section>`),Ca=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac"> </dt> <dd class="svelte-t9laac"> </dd></div>`),wa=q(`<section class="component-versions svelte-t9laac" aria-labelledby="component-versions-title"><h2 id="component-versions-title" class="svelte-t9laac">Versions</h2> <dl class="svelte-t9laac"></dl></section>`),Ta=q(`<p role="status" class="svelte-t9laac">Updating and waiting for Mobile to reconnect…</p>`),Ea=q(`<header class="app-header"><a class="brand" href="/" aria-label="Gestalt Mobile"><!> <img class="brand-logotype light-asset" src="/branding/t_glogo_grey.svg" alt=""/> <img class="brand-logotype dark-asset" src="/branding/t_glogo_white.svg" alt=""/></a> <!> <div class="header-actions"><!> <!> <button class="menu-trigger" type="button" popovertarget="configuration-panel" aria-label="Open configuration"><span class="menu-lines" aria-hidden="true"><span></span><span></span><span></span></span></button></div></header> <div id="configuration-panel" class="configuration-panel" popover="auto"><div class="configuration-brand" aria-label="Dyne"><img class="configuration-logo light-asset" src="/branding/dyne-logotype-black.svg" alt=""/> <img class="configuration-logo dark-asset" src="/branding/dyne-logotype-white.svg" alt=""/></div> <label class="appearance-control" for="appearance"><span aria-hidden="true">aA</span> <select id="appearance" aria-label="Appearance"></select></label> <!> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Notifications</button> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Scratchpad</button> <!> <!> <!> <!> <div class="maintenance-actions svelte-t9laac"><button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac">Upgrade</button> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="quit-relay svelte-t9laac">Quit</button></div></div> <dialog aria-labelledby="quit-title" aria-describedby="quit-description" class="svelte-t9laac"><h2 id="quit-title" class="svelte-t9laac">Quit Gestalt Mobile?</h2> <p id="quit-description" class="svelte-t9laac">This stops Gestalt Mobile and every session process it started, including work that is currently
|
|
3
|
+
running. Saved sessions remain available the next time Gestalt Mobile starts.</p> <div class="dialog-actions svelte-t9laac"><button type="button" class="svelte-t9laac">Cancel</button> <button class="confirm-quit svelte-t9laac" type="button"> </button></div></dialog> <dialog aria-labelledby="upgrade-title" aria-describedby="upgrade-description" class="svelte-t9laac"><h2 id="upgrade-title" class="svelte-t9laac">Upgrade Gestalt?</h2> <p id="upgrade-description" class="svelte-t9laac">Update Gestalt and restart Mobile with its current settings. Running work will be interrupted
|
|
4
|
+
when Mobile restarts. Saved sessions are preserved, and this page will reconnect automatically.</p> <!> <div class="dialog-actions svelte-t9laac"><button type="button" class="svelte-t9laac">Cancel</button> <button type="button" class="svelte-t9laac"> </button></div></dialog>`,1);function Da(e,t){$e(t,!0);let n=$(t,`sessionPath`,3,null),r=$(t,`sessionModel`,3,null),i=$(t,`weeklyQuotaRemaining`,3,null),a=$(t,`brandIconUrl`,3,null),o=$(t,`passkeyAuthEnabled`,3,!0),s=$(t,`componentVersions`,19,()=>[]),c=$(t,`onconfigurationchange`,3,()=>{}),l=$(t,`contextualActions`,19,()=>[]),u=$(t,`onlock`,3,()=>{}),d=$(t,`ondevices`,3,()=>{}),f=$(t,`onnotifications`,3,()=>{}),p=$(t,`onscratchpad`,3,()=>{}),m=$(t,`onquit`,3,async()=>{}),h=$(t,`onupgrade`,3,async()=>{}),g=$(t,`copyToCliAvailable`,3,!0),_=z(null),v=z(null),y=z(null),b=z(!1),x=z(null),S=z(null),C=z(!1);function w(){G(x)?.showModal(),queueMicrotask(()=>G(S)?.focus())}async function T(){if(!G(C)){B(C,!0);try{await h()()}catch{B(C,!1)}}}function E(){G(v)?.showModal(),queueMicrotask(()=>G(y)?.focus())}async function D(){B(b,!0);try{await m()()}catch{B(b,!1)}}function ee(){G(b)||G(v)?.close()}function te(){!G(b)&&!G(C)&&queueMicrotask(()=>G(_)?.focus())}var ne=Ea(),re=H(ne),ie=V(re),O=V(ie),ae=e=>{var t=sa();W(()=>Q(t,`src`,a())),J(e,t)},oe=e=>{var t=ca();Ue(2),J(e,t)};X(O,e=>{a()?e(ae):e(oe,-1)}),Ue(4),P(ie);var se=U(ie,2),ce=e=>{var t=ua(),i=V(t,!0),a=U(i),o=e=>{var t=la(),n=V(t),i=V(n);P(n),P(t),W(()=>Y(i,`· ${r()??``}`)),J(e,t)};X(a,e=>{r()&&e(o)}),P(t),W(()=>{Q(t,`title`,n()),Y(i,n())}),J(e,t)};X(se,e=>{n()&&e(ce)});var le=U(se,2),ue=V(le),k=e=>{var t=da(),n=V(t);P(t),W(()=>Y(n,`${i()??``}% left`)),J(e,t)};X(ue,e=>{i()!==null&&e(k)});var de=U(ue,2),fe=e=>{var n=fa();K(`click`,n,function(...e){t.ondetach?.apply(this,e)}),J(e,n)};X(de,e=>{t.ondetach&&e(fe)}),Ui(U(de,2),e=>B(_,e),()=>G(_)),P(le),P(re);var pe=U(re,2),me=U(V(pe),2),he=U(V(me),2);Z(he,21,()=>Xi,e=>e.id,(e,t)=>{var n=pa(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,G(t).label),i!==(i=G(t).id)&&(n.value=(n.__value=G(t).id)??``)}),J(e,n)}),P(he);var ge;Ei(he),P(me);var _e=U(me,2);Z(_e,17,l,e=>e.id,(e,t)=>{var n=ma(),r=V(n,!0);P(n),W(()=>Y(r,G(t).label)),K(`click`,n,function(...e){G(t).run?.apply(this,e)}),J(e,n)});var A=U(_e,2),ve=U(A,2),ye=U(ve,2),be=e=>{var n=ha();W(()=>n.disabled=!g()),K(`click`,n,function(...e){t.oncopytocli?.apply(this,e)}),J(e,n)};X(ye,e=>{t.oncopytocli&&e(be)});var xe=U(ye,2),Se=e=>{var t=ga(),n=H(t),r=U(n,2);K(`click`,n,e=>d()(e.currentTarget)),K(`click`,r,function(...e){u()?.apply(this,e)}),J(e,t)};X(xe,e=>{o()&&e(Se)});var Ce=U(xe,2),we=e=>{var n=Sa(),r=U(V(n),2),i=V(r),a=U(V(i),2),o=V(a,!0);P(a),P(i);var s=U(i,2),c=U(V(s),2),l=V(c,!0);P(c),P(s);var u=U(s,2),d=e=>{var n=_a(),r=U(V(n),2),i=V(r);P(r),P(n),W(e=>Y(i,`${t.xerj.phase??``}${e??``}`),[()=>t.xerj.percent===void 0?``:` · ${Math.round(t.xerj.percent)}%`]),J(e,n)};X(u,e=>{t.xerj.phase&&e(d)});var f=U(u,2),p=e=>{var n=va(),r=U(V(n),2),i=V(r,!0);P(r),P(n),W(e=>Y(i,e),[()=>t.xerj.files.toLocaleString()]),J(e,n)};X(f,e=>{t.xerj.files!==void 0&&e(p)});var m=U(f,2),h=e=>{var n=ya(),r=U(V(n),2),i=V(r,!0);P(r),P(n),W(e=>Y(i,e),[()=>t.xerj.records.toLocaleString()]),J(e,n)};X(m,e=>{t.xerj.records!==void 0&&e(h)});var g=U(m,2),_=e=>{var n=ba(),r=U(V(n),2),i=V(r),a=V(i,!0);P(i),P(r),P(n),W(e=>{Q(i,`datetime`,t.xerj.lastUpdate),Y(a,e)},[()=>new Date(t.xerj.lastUpdate).toLocaleString()]),J(e,n)};X(g,e=>{t.xerj.lastUpdate&&e(_)}),P(r);var v=U(r,2),y=e=>{var n=xa(),r=V(n,!0);P(n),W(()=>Y(r,t.xerj.message)),J(e,n)};X(v,e=>{t.xerj.message&&e(y)}),P(n),W(()=>{Y(o,t.xerj.state),Y(l,t.xerj.root)}),J(e,n)};X(Ce,e=>{t.xerj&&e(we)});var Te=U(Ce,2),Ee=e=>{var t=wa(),n=U(V(t),2);Z(n,21,s,e=>e.id,(e,t)=>{var n=Ca(),r=V(n),i=V(r,!0);P(r);var a=U(r,2),o=V(a,!0);P(a),P(n),W(()=>{Y(i,G(t).label),Q(a,`title`,G(t).version??`Version unavailable`),Y(o,G(t).version??`Unavailable`)}),J(e,n)}),P(n),P(t),J(e,t)};X(Te,e=>{s().length&&e(Ee)});var De=U(Te,2),Oe=V(De),ke=U(Oe,2);P(De),P(pe);var Ae=U(pe,2),je=U(V(Ae),4),Me=V(je);Ui(Me,e=>B(y,e),()=>G(y));var j=U(Me,2),Ne=V(j,!0);P(j),P(je),P(Ae),Ui(Ae,e=>B(v,e),()=>G(v));var Pe=U(Ae,2),Fe=U(V(Pe),4),Ie=e=>{J(e,Ta())};X(Fe,e=>{G(C)&&e(Ie)});var Le=U(Fe,2),Re=V(Le);Ui(Re,e=>B(S,e),()=>G(S));var ze=U(Re,2),M=V(ze,!0);P(ze),P(Le),P(Pe),Ui(Pe,e=>B(x,e),()=>G(x)),W(()=>{ge!==(ge=t.theme)&&(he.value=(he.__value=t.theme)??``,Ti(he,t.theme)),Oe.disabled=G(C)||G(b),ke.disabled=G(C),Q(Ae,`aria-busy`,G(b)),Me.disabled=G(b),j.disabled=G(b),Y(Ne,G(b)?`Quitting…`:`Quit`),Q(Pe,`aria-busy`,G(C)),Re.disabled=G(C),ze.disabled=G(C),Y(M,G(C)?`Upgrading…`:`Upgrade and restart`)}),Lr(`toggle`,pe,e=>c()(e.newState===`open`)),K(`change`,he,e=>t.onthemechange(e.currentTarget.value)),K(`click`,A,function(...e){f()?.apply(this,e)}),K(`click`,ve,function(...e){p()?.apply(this,e)}),K(`click`,Oe,w),K(`click`,ke,E),Lr(`cancel`,Ae,e=>G(b)?e.preventDefault():te()),Lr(`close`,Ae,te),K(`click`,Me,ee),K(`click`,j,()=>void D()),Lr(`cancel`,Pe,e=>G(C)?e.preventDefault():te()),Lr(`close`,Pe,te),K(`click`,Re,()=>G(x)?.close()),K(`click`,ze,()=>void T()),J(e,ne),et()}Rr([`click`,`change`]);async function Oa(e,t,n,r=1e3,i=15*6e4){let a=Date.now()+i;for(;Date.now()<a;){n.throwIfAborted();let i;try{i=await t(AbortSignal.any([n,AbortSignal.timeout(5e3)]))}catch{n.throwIfAborted()}if(i&&i.instanceId!==e)return;if(i?.phase===`failed`)throw Error(i.message??`Upgrade failed. Check the Gestalt update log.`);await new Promise((e,t)=>{let i=setTimeout(()=>{n.removeEventListener(`abort`,a),e()},r),a=()=>{clearTimeout(i),n.removeEventListener(`abort`,a),t(n.reason)};n.addEventListener(`abort`,a,{once:!0})})}throw Error(`Mobile has not reconnected yet. Check the Gestalt update-restart.log and reload when it is ready.`)}function ka(e){return[[`Handoff trace`,e.handoffTrace??`Unavailable`],[`Control`,e.control??`Unavailable`],[`Mobile session`,e.mobileSession],[`Codex thread`,e.codexThread??`Unavailable`],...e.provider===`kimi`?[[`Kimi thread`,e.sourceThread??`Unavailable`]]:[]]}var Aa=q(`<div class="svelte-vx755z"><dt class="svelte-vx755z"> </dt> <dd class="svelte-vx755z"> </dd></div>`),ja=q(`<div class="debug-identifiers svelte-vx755z"><h3 class="svelte-vx755z">Debug identifiers</h3> <dl class="svelte-vx755z"></dl> <h3 class="svelte-vx755z">Versions</h3> <dl class="svelte-vx755z"></dl></div>`);function Ma(e,t){$e(t,!0);var n=ja(),r=U(V(n),2);Z(r,21,()=>ka(t.context),([e,t])=>e,(e,t)=>{var n=L(()=>C(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=Aa(),o=V(a),s=V(o,!0);P(o);var c=U(o,2),l=V(c,!0);P(c),P(a),W(()=>{Y(s,r()),Y(l,i())}),J(e,a)}),P(r);var i=U(r,4);Z(i,21,()=>t.context.versions,e=>e.id,(e,t)=>{var n=Aa(),r=V(n),i=V(r,!0);P(r);var a=U(r,2),o=V(a,!0);P(a),P(n),W(()=>{Y(i,G(t).label),Y(o,G(t).version??`Unavailable`)}),J(e,n)}),P(i),P(n),J(e,n),et()}var Na=q(`<dialog aria-labelledby="debug-title" aria-describedby="debug-description" class="svelte-f06alb"><h2 id="debug-title" class="svelte-f06alb">Confirm spawning a new Gestalt DEBUG session?</h2> <p id="debug-description" class="svelte-f06alb">Capture a redacted diagnostic trace and start an independent agent in ~/.gestalt/self-debug to
|
|
5
|
+
investigate and fix the error.</p> <!> <div class="dialog-actions svelte-f06alb"><button type="button" class="svelte-f06alb">Cancel</button> <button type="button" class="svelte-f06alb"> </button></div></dialog>`);function Pa(e,t){$e(t,!0);let n,r,i=z(!1);Gi(()=>{n.showModal(),r.focus()});async function a(){if(!G(i)){B(i,!0);try{await t.onconfirm()}catch{}finally{B(i,!1)}}}var o=Na(),s=U(V(o),4);Ma(s,{get context(){return t.confirmation.context}});var c=U(s,2),l=V(c);Ui(l,e=>r=e,()=>r);var u=U(l,2),d=V(u,!0);P(u),P(c),P(o),Ui(o,e=>n=e,()=>n),W(()=>{Q(o,`aria-busy`,G(i)),l.disabled=G(i),u.disabled=G(i),Y(d,G(i)?`Preparing Self DEBUG…`:`Start Self DEBUG`)}),Lr(`cancel`,o,e=>{G(i)&&e.preventDefault()}),Lr(`close`,o,function(...e){t.onclose?.apply(this,e)}),K(`click`,l,()=>n.close()),K(`click`,u,()=>void a()),J(e,o),et()}Rr([`click`]);function Fa(e,t,n){return n?e.filter(e=>e.tab===t&&e.available(n)):[]}function Ia(e){return e.reduce((e,t)=>{let n=La(t);return n?.kind===`Command`?(n.status===`completed`&&(e.successful+=1),n.status===`failed`&&(e.failed+=1),e):e},{successful:0,failed:0})}function La(e){if(Ra(e))return null;let[t,n]=e.label.split(` · `,2);return{kind:t,...n?{status:n}:{},content:za(t,e.detail)}}function Ra(e){return e.label.startsWith(`Tool`)&&(e.detail.includes(`context_mode`)||/(^|[_:])ctx_[a-z]/i.test(e.detail))}function za(e,t){return e===`Command`?Ba(t):e===`File change`||e===`fileChange`?t.split(`
|
|
6
|
+
`).filter(Boolean).join(`, `):t}function Ba(e){let t=e.match(/^\/bin\/bash -lc "([\s\S]*)"$/);return t?t[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`):e}var Va=q(`<dl class="command-counts svelte-thyolt"><div data-command-outcome="successful" class="svelte-thyolt"><dt class="svelte-thyolt">Successful commands</dt> <dd class="svelte-thyolt"> </dd></div> <div data-command-outcome="failed" class="svelte-thyolt"><dt class="svelte-thyolt">Failed commands</dt> <dd class="svelte-thyolt"> </dd></div></dl>`),Ha=q(`<li class="activity-row svelte-thyolt"><small class="activity-type svelte-thyolt"> </small> <span class="activity-content svelte-thyolt"> </span></li>`),Ua=q(`<ul class="activity-list svelte-thyolt"></ul>`),Wa=q(`<details class="chat-activity svelte-thyolt"><summary class="svelte-thyolt">activity</summary> <!> <!></details>`),Ga=q(`<section class="live-activity svelte-thyolt" aria-label="Current activity"><strong class="svelte-thyolt">activity</strong> <!> <!></section>`);function Ka(e,t){$e(t,!0);let n=e=>{var t=Va(),n=V(t),r=U(V(n),2),i=V(r,!0);P(r),P(n);var a=U(n,2),o=U(V(a),2),c=V(o,!0);P(o),P(a),P(t),W(()=>{Y(i,G(s).successful),Y(c,G(s).failed)}),J(e,t)},r=e=>{var t=Kr(),n=H(t),r=e=>{var t=Ua();Z(t,21,()=>G(c),e=>e.id,(e,t)=>{var n=Ha(),r=V(n),i=V(r);P(r);var a=U(r,2),o=V(a,!0);P(a),P(n),W(e=>{Q(n,`data-activity-kind`,e),Q(n,`data-activity-status`,G(t).status),Y(i,`${G(t).kind??``}${G(t).status?` · ${G(t).status}`:``}`),Y(o,G(t).content)},[()=>G(t).kind.toLowerCase().replaceAll(` `,`-`)]),J(e,n)}),P(t),J(e,t)};X(n,e=>{G(c).length&&e(r)}),J(e,t)},i=$(t,`variant`,3,`summary`),a=L(()=>t.activities.flatMap(e=>{let t=La(e);return t&&t.kind.toLowerCase().replaceAll(` `,``)!==`filechange`?[{id:e.id,...t}]:[]})),o=L(()=>G(a).some(e=>e.kind===`Command`)),s=L(()=>Ia(t.activities)),c=L(()=>G(a).filter(e=>e.kind!==`Command`));var l=Kr(),u=H(l),d=e=>{var t=Kr(),a=H(t),s=e=>{var t=Wa(),i=U(V(t),2),a=e=>{n(e)};X(i,e=>{G(o)&&e(a)});var s=U(i,2);r(s),P(t),J(e,t)},c=e=>{var t=Ga(),i=U(V(t),2),a=e=>{n(e)};X(i,e=>{G(o)&&e(a)});var s=U(i,2);r(s),P(t),J(e,t)};X(a,e=>{i()===`summary`?e(s):e(c,-1)}),J(e,t)};X(u,e=>{(G(o)||G(c).length)&&e(d)}),J(e,l),et()}var qa=q(`<summary><!></summary>`),Ja=q(`<button><!></button>`);function Ya(e,t){let n=$(t,`element`,3,`button`),r=$(t,`type`,3,`button`),i=$(t,`disabled`,3,!1),a=$(t,`compact`,3,!1),o=$(t,`full`,3,!1),s=$(t,`primary`,3,!1),c=$(t,`accentPressed`,3,!1);var l=Kr(),u=H(l),d=e=>{var n=qa();ui(V(n),()=>t.children),P(n),W(()=>{Q(n,`id`,t.id),Si(n,1,gi([`app-control`,t.class,{compact:a(),full:o(),primary:s(),accentPressed:c()}]),`svelte-6ey372`),Q(n,`data-state`,t.state)}),J(e,n)},f=e=>{var n=Ja();ui(V(n),()=>t.children),P(n),W(()=>{Q(n,`id`,t.id),Q(n,`type`,r()),n.disabled=i(),Si(n,1,gi([`app-control`,t.class,{compact:a(),full:o(),primary:s(),accentPressed:c()}]),`svelte-6ey372`),Q(n,`aria-label`,t.label),Q(n,`aria-current`,t.current),Q(n,`aria-pressed`,t.pressed),Q(n,`aria-describedby`,t.describedby),Q(n,`aria-disabled`,t.ariaDisabled)}),K(`click`,n,function(...e){t.onclick?.apply(this,e)}),J(e,n)};X(u,e=>{n()===`summary`?e(d):e(f,-1)}),J(e,l)}Rr([`click`]);var Xa=e=>({working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`})[e];function Za(e,t){if(!t)return{polite:``,critical:``};let n=!e||e.root.state!==t.root.state||e.aggregateSubagents!==t.aggregateSubagents,r=t.root.state===`blocked`||t.root.state===`awaitingHuman`;return{polite:n?`l0 ${Xa(t.root.state)}; subagents ${Xa(t.aggregateSubagents)}.`:``,critical:r&&(!e||e.root.state!==t.root.state)?`l0 ${Xa(t.root.state)}.`:``}}function Qa(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`recently`;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`<1m`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);if(a<24)return`${a}h`;let o=Math.floor(a/24);if(o<7)return`${o}d`;let s=Math.floor(o/7);if(s<5)return`${s}w`;let c=Math.floor(o/30);return c<12?`${c}mo`:`${Math.floor(o/365)}y`}var $a=q(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <span class="agent-metadata svelte-d9jh4j"> </span> <time class="svelte-d9jh4j"> </time></li>`),eo=q(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j">l0</strong> <span class="agent-metadata svelte-d9jh4j"> </span> <span class="unavailable svelte-d9jh4j" role="status">activity unavailable</span></li>`),to=q(`<details class="agents svelte-d9jh4j"><!> <ul class="svelte-d9jh4j"><!></ul></details>`),no=q(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <small class="svelte-d9jh4j"> </small></li>`),ro=q(`<div class="chips svelte-d9jh4j"><span class="chip svelte-d9jh4j"><span aria-hidden="true" class="svelte-d9jh4j">●</span> </span> <details class="children svelte-d9jh4j"><summary class="chip svelte-d9jh4j"><span aria-hidden="true" class="svelte-d9jh4j">◆</span> </summary> <ul class="svelte-d9jh4j"></ul></details> <span class="freshness svelte-d9jh4j"> </span></div>`),io=q(`<p class="visually-hidden svelte-d9jh4j" role="alert"> </p>`),ao=q(`<p class="visually-hidden svelte-d9jh4j" aria-live="polite" aria-atomic="true"> </p> <!>`,1),oo=q(`<section aria-label="Agent activity"><!> <!></section>`);function so(e,t){$e(t,!0);let n=$(t,`compact`,3,!1),r=$(t,`popupAlign`,3,`end`),i=$(t,`onopen`,3,()=>{}),a={working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`},o={working:0,awaitingAgent:1,awaitingHuman:1,blocked:1,idle:2,disconnected:3},s=z(``),c=z(``),l=null,u=z(on(Date.now())),d=L(()=>t.activity?`${t.activity.sessionId}:${t.activity.root.state}:${t.activity.aggregateSubagents}`:``),f=L(()=>t.activity?[`blocked`,`awaitingHuman`,`disconnected`].includes(t.activity.root.state)?t.activity.root.state:t.activity.aggregateSubagents:`unavailable`);function p(e){return e.canonicalTaskName??e.canonicalPosition?.toLowerCase()??e.nickname??e.role??e.id}function m(){return`l0`}function h(e){return e===void 0?`(ctx: —)`:`(ctx: ${e}%)`}function g(e){let t=/^L([1-9]\d*)(?:\.([1-9]\d*))?$/.exec(e??``);return t?Number(t[1])*1e3+Number(t[2]??0):2**53-1}function _(e,t){return g(e.canonicalPosition)-g(t.canonicalPosition)||(e.continuationGeneration??1)-(t.continuationGeneration??1)||o[e.state]-o[t.state]||p(e).localeCompare(p(t))}let v=L(()=>t.activity?[{key:`root`,name:m(),planOrder:-1,generation:0,contextUsedPercent:t.activity.root.contextUsedPercent,role:`supervisor`,...t.rootModel?{model:t.rootModel}:{},state:t.activity.root.state,lastActivityAt:t.activity.root.lastActivityAt},...t.activity.subagents.map(e=>({key:`child:${e.id}`,name:p(e),planOrder:g(e.canonicalPosition),generation:e.continuationGeneration??1,contextUsedPercent:e.contextUsedPercent,...e.role?{role:e.role}:{},...e.model?{model:e.model}:{},state:e.state,lastActivityAt:e.lastActivityAt}))].sort((e,t)=>e.planOrder-t.planOrder||e.generation-t.generation||o[e.state]-o[t.state]||e.name.localeCompare(t.name)):[]),y=L(()=>t.activity?[...t.activity.subagents].sort(_):[]);Gi(()=>{let e=window.setInterval(()=>B(u,Date.now(),!0),6e4);return()=>window.clearInterval(e)});function b(e,t){let n=Qa(t,G(u));return e===`idle`||e===`disconnected`?`${a[e]} since ${n}`:`${a[e]} · active ${n} ago`}Mn(()=>{if(!G(d))return;let e=Or(()=>t.activity),n=Or(()=>l);if(!e)return;let r=Za(n?.sessionId===e.sessionId?n:null,e);r.polite&&B(s,r.polite,!0),r.critical?B(c,r.critical,!0):e.root.state!==`blocked`&&e.root.state!==`awaitingHuman`&&B(c,``),l=e});var x=oo();let S;var C=V(x),w=e=>{var n=to(),r=V(n);Ya(r,{element:`summary`,compact:!0,full:!0,get state(){return G(f)},children:(e,n)=>{Ue();var r=Gr();W(()=>Y(r,`Agents (${(t.activity?.subagents.length??0)+1})`)),J(e,r)},$$slots:{default:!0}});var a=U(r,2),o=V(a),s=e=>{var t=Kr();Z(H(t),17,()=>G(v),e=>e.key,(e,t)=>{var n=$a(),r=V(n),i=V(r,!0);P(r);var a=U(r,2),o=V(a,!0);P(a);var s=U(a,2),c=V(s,!0);P(s),P(n),W((e,n)=>{Y(i,G(t).name),Y(o,e),Q(s,`datetime`,G(t).lastActivityAt),Y(c,n)},[()=>[h(G(t).contextUsedPercent),G(t).role,G(t).model?`Model: ${G(t).model}`:`Model unavailable`].filter(Boolean).join(` · `),()=>b(G(t).state,G(t).lastActivityAt)]),J(e,n)}),J(e,t)},c=e=>{var n=eo(),r=U(V(n),2),i=V(r,!0);P(r),Ue(2),P(n),W(e=>Y(i,e),[()=>[`(ctx: —)`,`supervisor`,t.rootModel?`Model: ${t.rootModel}`:`Model unavailable`].filter(Boolean).join(` · `)]),J(e,n)};X(o,e=>{t.activity?e(s):e(c,-1)}),P(a),P(n),Lr(`toggle`,n,e=>e.currentTarget.open&&i()()),J(e,n)},T=e=>{var n=ro(),r=V(n),i=U(V(r));P(r);var o=U(r,2),s=V(o),c=U(V(s));P(s);var l=U(s,2);Z(l,21,()=>G(y),e=>e.id,(e,t)=>{var n=no(),r=V(n),i=V(r,!0);P(r);var o=U(r),s=U(o),c=V(s,!0);P(s),P(n),W((e,n)=>{Y(i,e),Y(o,` · ${n??``}${G(t).role?` · ${G(t).role}`:``}${G(t).model?` · Model: ${G(t).model}`:``} —
|
|
7
|
+
${a[G(t).state]??``} `),Y(c,G(t).lastActivityAt)},[()=>p(G(t)),()=>h(G(t).contextUsedPercent)]),J(e,n)}),P(l),P(o);var u=U(o,2),d=V(u,!0);P(u),P(n),W(e=>{Q(r,`data-state`,t.activity.root.state),Y(i,` l0: ${a[t.activity.root.state]??``}
|
|
8
|
+
${e??``}`),Q(s,`data-state`,t.activity.aggregateSubagents),Y(c,` Subagents: ${a[t.activity.aggregateSubagents]??``} (${t.activity.subagents.length??``})`),Y(d,t.activity.confidence===`fresh`?`Current`:t.activity.confidence===`reconciling`?`Checking updates`:`May be stale`)},[()=>h(t.activity.root.contextUsedPercent)]),J(e,n)};X(C,e=>{n()?e(w):t.activity&&e(T,1)});var E=U(C,2),D=e=>{var t=ao(),n=H(t),r=V(n,!0);P(n);var i=U(n,2),a=e=>{var t=io(),n=V(t,!0);P(t),W(()=>Y(n,G(c))),J(e,t)};X(i,e=>{G(c)&&e(a)}),W(()=>Y(r,G(s))),J(e,t)};X(E,e=>{t.activity&&e(D)}),P(x),W(()=>S=Si(x,1,`agent-activity svelte-d9jh4j`,null,S,{compact:n(),"align-start":r()===`start`})),J(e,x),et()}Xe();var co=q(`<main class="svelte-iw6wrs"><h1 class="svelte-iw6wrs">Activity evidence</h1> <!><!></main>`);function lo(e){let t={sessionId:`evidence`,confidence:`reconciling`,aggregateSubagents:`working`,root:{state:`awaitingAgent`,observedAt:`2026-01-01T00:00:00.000Z`,lastActivityAt:`2026-01-01T00:00:00.000Z`},subagents:[{id:`α-worker`,nickname:`α worker`,role:`research`,state:`working`,observedAt:`2026-01-01T00:00:00.000Z`,lastActivityAt:`2026-01-01T00:00:00.000Z`}]},n=[`working`,`awaitingAgent`,`awaitingHuman`,`blocked`,`idle`,`disconnected`];var r=co(),i=U(V(r),2);so(i,{get activity(){return t}}),Z(U(i),1,()=>n,e=>e,(e,n)=>{{let r=wt(()=>({...t,sessionId:G(n),confidence:G(n)===`blocked`?`stale`:`fresh`,root:{...t.root,state:G(n)},aggregateSubagents:G(n)}));so(e,{get activity(){return G(r)}})}}),P(r),J(e,r)}function uo(e,t){if(!e||typeof e!=`object`)return!1;let n=e,r=new Set([`working`,`idle`,`awaitingAgent`,`awaitingHuman`,`blocked`,`disconnected`]),i=(e,t=256)=>typeof e==`string`&&e.length<=t,a=e=>Array.isArray(e)&&e.length<=64&&e.every(e=>{let t=e;return t&&typeof t==`object`&&[`running`,`detached-active`,`exited-awaiting-result`,`result-consumed`,`terminated-for-budget`].includes(t.state)&&[`executor`,`supervisor`].includes(t.ownership)&&i(t.observedAt,64)&&!Number.isNaN(Date.parse(t.observedAt))}),o=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return i(t.state,32)&&r.has(t.state)&&i(t.observedAt,64)&&i(t.lastActivityAt,64)&&!Number.isNaN(Date.parse(t.observedAt))&&!Number.isNaN(Date.parse(t.lastActivityAt))&&(t.reason===void 0||i(t.reason,64))&&(t.contextUsedPercent===void 0||Number.isInteger(t.contextUsedPercent)&&t.contextUsedPercent>=0&&t.contextUsedPercent<=100)};return i(n.sessionId)&&(!t||n.sessionId===t)&&o(n.root)&&Array.isArray(n.subagents)&&n.subagents.length<=64&&n.subagents.every(e=>o(e)&&i(e.id)&&(e.nickname===void 0||i(e.nickname))&&(e.role===void 0||i(e.role))&&(e.model===void 0||i(e.model))&&(e.canonicalTaskName===void 0||i(e.canonicalTaskName))&&(e.canonicalPosition===void 0||i(e.canonicalPosition,32))&&(e.continuationGeneration===void 0||Number.isInteger(e.continuationGeneration)&&e.continuationGeneration>0)&&(e.outcome===void 0||[`partial`,`cancelled`,`failed`].includes(e.outcome))&&(e.ownedProcesses===void 0||a(e.ownedProcesses)))&&i(n.aggregateSubagents,32)&&r.has(n.aggregateSubagents)&&(n.confidence===`fresh`||n.confidence===`stale`||n.confidence===`reconciling`)}var fo=class{#e=new Map;#t=new Map;#n=new Set;#r=new Map;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#c=null;#l=!1;#u;constructor(e){this.#u={...e,websocket:e.websocket??(e=>new WebSocket(e)),location:e.location??location,setTimeout:e.setTimeout??setTimeout,clearTimeout:e.clearTimeout??clearTimeout}}get(e){return e?this.#e.get(e)??null:null}bootstrap(e,t){for(let t of e)!this.#e.has(t.id)&&uo(t.agentActivity,t.id)&&this.#p(t.id,this.#t.get(t.id)??0,t.agentActivity);this.sync(e.map(e=>e.id),t)}sync(e,t){if(!this.#l){this.#c=t,this.#n=new Set(e);for(let e of this.#n)this.#i.has(e)||this.#i.set(e,0);for(let e of[...this.#i.keys()])this.#n.has(e)||this.remove(e);for(let[e,n]of this.#r)(e===t||!this.#n.has(e))&&(n.close(),this.#r.delete(e));for(let e of this.#n)this.hydrate(e),e!==t&&!this.#r.has(e)&&this.#f(e)}}select(e){this.sync([...this.#n],e)}remove(e){this.#n.delete(e),this.#i.set(e,(this.#i.get(e)??0)+1),this.#r.get(e)?.close(),this.#r.delete(e);let t=this.#a.get(e);t&&this.#u.clearTimeout(t),this.#a.delete(e),this.#o.delete(e),this.#s.delete(e),this.#e.delete(e),this.#t.delete(e),this.#u.publish(this.#e)}observe(e,t){if(this.#l||!this.#n.has(e)||!Number.isInteger(t.sequence))return;let n=this.#t.get(e)??0;t.sequence<=n||(t.sequence>n+1&&(this.#t.set(e,t.sequence-1),this.resync(e)),this.#t.set(e,t.sequence),this.#u.onEvent?.(e,t),t.type===`agent.activity.updated`&&uo(t.payload,e)&&this.#p(e,t.sequence,t.payload))}async hydrate(e){let t=this.#i.get(e)??0,n=this.#t.get(e)??0;try{let r=await this.#u.relay.getSession(e);if(!this.#d(e,t))return;let i=this.#t.get(e)??0,a=r.currentSequence;if(Number.isInteger(a)){if(a<i)return;this.#t.set(e,a),uo(r.agentActivity,e)&&this.#p(e,a,r.agentActivity),this.#u.onAuthoritativeSnapshot?.(e,r)}else i===n&&uo(r.agentActivity,e)&&(this.#p(e,i,r.agentActivity),this.#u.onAuthoritativeSnapshot?.(e,r))}catch{this.#m(e)}}async resync(e){let t=this.#o.get(e);if(t)return t;let n=this.#i.get(e)??0;this.#m(e);let r;return r=(async()=>{try{await this.#u.relay.refreshActivity(e),this.#d(e,n)&&await this.hydrate(e)}catch{}finally{this.#o.get(e)===r&&this.#o.delete(e)}})(),this.#o.set(e,r),r}dispose(){this.#l=!0;for(let e of[...this.#n])this.remove(e)}#d(e,t){return!this.#l&&this.#n.has(e)&&this.#i.get(e)===t}#f(e){let t=this.#i.get(e)??0,n=this.#u.location.protocol===`https:`?`wss:`:`ws:`,r=this.#u.websocket(`${n}//${this.#u.location.host}/api/sessions/${encodeURIComponent(e)}/events?after=${this.#t.get(e)??0}`);this.#r.set(e,r),r.onmessage=n=>{if(!(!this.#d(e,t)||this.#r.get(e)!==r))try{this.#s.delete(e);let t=JSON.parse(String(n.data));t.type===`relay.resyncRequired`?this.resync(e):t.type===`relay.event`&&t.event&&this.observe(e,t.event)}catch{}},r.onclose=()=>{if(!this.#d(e,t)||this.#c===e)return;this.#r.delete(e),this.#m(e);let n=this.#s.get(e)??0,r=(this.#u.reconnectDelaysMs??[250,1e3,5e3])[n];r!==void 0&&(this.#s.set(e,n+1),this.#a.set(e,this.#u.setTimeout(()=>{this.#a.delete(e),this.#d(e,t)&&e!==this.#c&&this.#f(e)},r)))}}#p(e,t,n){let r=this.#e.get(e);this.#t.set(e,Math.max(t,this.#t.get(e)??0)),JSON.stringify(r)!==JSON.stringify(n)&&(this.#e.set(e,n),this.#u.publish(this.#e))}#m(e){let t=this.#e.get(e);t&&t.confidence===`fresh`&&(this.#e.set(e,{...t,confidence:`stale`}),this.#u.publish(this.#e))}};function po(e=globalThis.crypto,t=Date.now,n=Math.random){return typeof e?.randomUUID==`function`?e.randomUUID():`k-${t().toString(36)}-${Math.floor(n()*4294967296).toString(36)}`}function mo(e){if(typeof e!=`string`||!e.trim())return;let t=e.trim();return t.length<=4e3?t:`${t.slice(0,3999)}…`}var ho=`Checkpoint handoff failed. Autopilot is reconnecting this session automatically. If it cannot recover, restore or reopen the session.`,go=(e,t=600)=>typeof e==`string`&&e.length<=t,_o=e=>go(e,64)&&!Number.isNaN(Date.parse(e));function vo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.enabled==`boolean`&&typeof t.state==`string`&&[`disabled`,`monitoring`,`backoff`,`attentionRequired`,`completed`,`safetyPaused`].includes(t.state)&&!!t.retry&&typeof t.retry==`object`&&Number.isInteger(t.retry.position)&&Number.isInteger(t.retry.limit)&&go(t.updatedAt,64)&&(t.reason===void 0||go(t.reason,80))&&(t.nextEvaluationAt===void 0||go(t.nextEvaluationAt,64))&&(t.health===void 0||yo(t.health))}function yo(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.wait||typeof t.wait!=`object`)return!1;let n=t.wait;return typeof t.healthy==`boolean`&&typeof t.phase==`string`&&[`off`,`rootWorking`,`continuationScheduled`,`waitingForAgentEvent`,`checkingState`,`needsYou`,`safetyPaused`,`complete`,`checkpointRecovery`,`degraded`].includes(t.phase)&&[`active`,`probeRequired`,`parked`,`retrying`,`attentionRequired`,`safetyPaused`,`none`].includes(t.supervision)&&typeof n.present==`boolean`&&Array.isArray(n.wakeCategories)&&n.wakeCategories.length<=9&&new Set(n.wakeCategories).size===n.wakeCategories.length&&n.wakeCategories.every(e=>[`planChanged`,`reviewChanged`,`checkpointChanged`,`interactionChanged`,`executorChanged`,`processExited`,`processResultAvailable`,`processLimitBreached`,`agentActivityChanged`].includes(e))&&(n.resumeAt===void 0||_o(n.resumeAt))&&_o(t.observedAt)&&_o(t.lastTransitionAt)&&go(t.nextExpectedAction)&&(t.degradationReason===void 0||[`missingContinuation`,`invalidWaitLease`,`controllerUnavailable`,`staleTransition`,`planMismatch`].includes(t.degradationReason))}function bo(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.attention;if(!n||typeof n!=`object`)return!1;let r=n;return go(t.requestId,256)&&(t.turnId===null||go(t.turnId,256))&&(t.requestedAt===null||go(t.requestedAt,64))&&(t.supervisorReport===void 0||go(t.supervisorReport,4e3))&&go(r.reason,64)&&go(r.summary)&&go(r.requestedAction)&&go(r.resumeCondition,64)&&(r.executorReplacement===void 0||xo(r.executorReplacement))}function xo(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).length===1&&typeof t.canonicalTaskName==`string`&&/^l[1-9][0-9]*$/.test(t.canonicalTaskName)}function So(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`orgPlanAttention`&&bo({requestId:t.requestId,turnId:t.turnId??null,requestedAt:t.requestedAt??null,attention:t.payload,supervisorReport:t.supervisorReport})}function Co(e){return{requestId:e.requestId,turnId:e.turnId,requestedAt:e.requestedAt,attention:e.payload,...e.supervisorReport?{supervisorReport:e.supervisorReport}:{}}}var wo=e=>{let t=e&&typeof e==`object`?e.code:void 0;return t===`AUTOPILOT_PLAN_REQUIRED`?`An incomplete supervised plan is required before Autopilot can start.`:t===`AUTOPILOT_PLAN_COMPLETE`?`This plan is complete, so Autopilot is unavailable.`:t===`AUTOPILOT_SESSION_UNAVAILABLE`?`This session is unavailable for Autopilot.`:e instanceof Error?e.message:`Could not update Autopilot.`},To=class{relay;publish;createKey;#e=new Map;#t=new Map;#n=new Set;#r=new Map;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#c=new Map;#l=new Map;#u=new Map;#d=new Map;#f=new Set;#p=!1;constructor(e,t,n=po){this.relay=e,this.publish=t,this.createKey=n}bootstrap(e){if(this.#p)return;let t=new Set(e.map(e=>e.id));for(let e of this.#f)t.has(e)||this.remove(e);this.#f=t;for(let t of e){this.#a.has(t.id)||this.#a.set(t.id,0),this.#o.has(t.id)||this.#o.set(t.id,0);let e=this.#d.get(t.id)??0,n=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null,r=this.#l.get(t.id);!this.#n.has(t.id)&&(r===void 0||n!==null&&n>r)&&(n!==null&&n>e||!this.#e.has(t.id)&&e===0)&&(n!==null&&(this.#d.set(t.id,n),r!==void 0&&n>r&&this.#l.delete(t.id)),this.#_(t.id,t))}this.#v()}observe(e,t){if(this.#p||!this.#f.has(e)||!Number.isInteger(t.sequence))return;let n=this.#d.get(e)??0;if(!(t.sequence<=n)){if(this.#d.set(e,t.sequence),this.#o.set(e,(this.#o.get(e)??0)+1),t.type===`autopilot.updated`&&this.#h(e,t.payload),t.type===`org-plan.attention-required`&&this.#g(e,t.payload),t.type===`agentMessageCompleted`&&t.payload&&typeof t.payload==`object`){let n=t.payload,r=this.#t.get(e),i=mo(n.text);r?.turnId&&r.turnId===n.turnId&&n.phase===`final_answer`&&i&&this.#t.set(e,{...r,supervisorReport:i})}t.type===`org-plan.attention-resolved`&&(t.payload&&typeof t.payload==`object`&&t.payload.outcome,this.#t.delete(e)),this.#v()}}async hydrate(e,t){let n=this.#a.get(e)??0,r=(this.#u.get(e)??0)+1;this.#u.set(e,r);let i=t??this.#d.get(e)??0,a=this.#s.get(e),o=this.#c.get(e)??0;try{let t=await this.relay.getSession(e);if(!this.#m(e,n)||this.#u.get(e)!==r||(this.#c.get(e)??0)!==o||this.#s.has(e)&&this.#s.get(e)!==a)return;let s=this.#d.get(e)??0,c=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null;c!==null&&c>s?(this.#d.set(e,c),this.#_(e,t)):c===null&&s===i&&this.#_(e,t),this.#v()}catch{}}async toggle(e,t){if(this.#p||!this.#f.has(e)||this.#n.has(e))return;let n=this.#a.get(e)??0,r=this.#o.get(e)??0;this.#s.set(e,(this.#s.get(e)??0)+1),this.#c.set(e,(this.#c.get(e)??0)+1),this.#n.add(e),this.#r.delete(e),this.#i.delete(e),this.#v();try{let i=await this.relay.setAutopilot(e,t,this.createKey());this.#m(e,n)&&this.#o.get(e)===r&&(this.#h(e,i.autopilot),this.#o.set(e,r+1),this.#l.set(e,this.#d.get(e)??0),vo(i.autopilot)&&!i.autopilot.enabled&&this.#t.delete(e))}catch(t){this.#m(e,n)&&this.#o.get(e)===r&&this.#r.set(e,wo(t))}finally{this.#m(e,n)&&(this.#n.delete(e),this.#c.set(e,(this.#c.get(e)??0)+1)),this.#v()}}async resolve(e,t,n){let r=this.#t.get(e);if(!r||this.#n.has(e)||this.#p)return;let i=n?.trim();if(i&&i.length>600){this.#r.set(e,`Guidance must be 600 characters or fewer.`),this.#v();return}let a=this.#a.get(e)??0,o=this.#o.get(e)??0;this.#c.set(e,(this.#c.get(e)??0)+1),this.#n.add(e),this.#r.delete(e),this.#v();try{await this.relay.resolveAttention(e,r.requestId,{operationKey:this.createKey(),action:t,...i?{guidance:i}:{}}),this.#m(e,a)&&this.#o.get(e)===o&&await this.hydrate(e)}catch(t){this.#m(e,a)&&this.#o.get(e)===o&&this.#r.set(e,t instanceof Error?t.message:`Could not resolve attention.`)}finally{this.#m(e,a)&&(this.#n.delete(e),this.#c.set(e,(this.#c.get(e)??0)+1)),this.#v()}}remove(e){this.#a.set(e,(this.#a.get(e)??0)+1),this.#f.delete(e),this.#e.delete(e),this.#t.delete(e),this.#n.delete(e),this.#r.delete(e),this.#d.delete(e),this.#o.delete(e),this.#s.delete(e),this.#c.delete(e),this.#l.delete(e),this.#u.delete(e),this.#v()}dispose(){this.#p=!0,this.#f.clear(),this.#e.clear(),this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#u.clear(),this.#o.clear(),this.#s.clear(),this.#c.clear(),this.#l.clear(),this.#v()}#m(e,t){return!this.#p&&this.#f.has(e)&&this.#a.get(e)===t}#h(e,t){vo(t)&&(this.#e.set(e,t),t.health?.phase===`checkpointRecovery`?this.#i.set(e,ho):this.#i.delete(e))}#g(e,t){if(bo(t))this.#t.set(e,t);else if(So(t))this.#t.set(e,Co(t));else if(Array.isArray(t)){let n=t.find(So);n?this.#t.set(e,Co(n)):this.#t.delete(e)}}applyAuthoritative(e,t){if(this.#p||!this.#f.has(e)||this.#n.has(e))return;let n=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null,r=this.#d.get(e)??0,i=this.#l.get(e);i!==void 0&&(n===null||n<=i)||n!==null&&n<r||(n!==null&&(this.#d.set(e,n),i!==void 0&&n>i&&this.#l.delete(e)),this.#_(e,t),this.#v())}#_(e,t){this.#o.set(e,(this.#o.get(e)??0)+1),this.#h(e,t.autopilot),this.#g(e,t.pendingInteractions)}#v(){this.publish({snapshots:new Map(this.#e),attention:new Map(this.#t),pending:new Set(this.#n),errors:new Map([...this.#r,...this.#i])})}},Eo=q(`<span aria-hidden="true" class="svelte-1qf1ppf"> </span> `,1),Do=q(`<div class="control-row svelte-1qf1ppf"><span class="status svelte-1qf1ppf"><span aria-hidden="true" class="svelte-1qf1ppf"> </span> </span> <!></div>`),Oo=q(`<section aria-label="Autopilot"><p class="visually-hidden svelte-1qf1ppf" data-testid="autopilot-live-status" aria-live="polite" aria-atomic="true"> </p> <!> <p> </p></section>`);function ko(e,t){$e(t,!0);let n=$(t,`controlId`,3,`autopilot-control`),r=$(t,`compact`,3,!1),i=$(t,`indicatorOnly`,3,!1),a=$(t,`pending`,3,!1),o=$(t,`ontoggle`,3,()=>{}),s={disabled:`Off`,monitoring:`Monitoring`,backoff:`Waiting to continue`,attentionRequired:`Paused for attention`,completed:`Complete`,safetyPaused:`Safety paused`},c={off:`Off`,rootWorking:`On · root working`,continuationScheduled:`On · continuation scheduled`,waitingForAgentEvent:`On · waiting for agent event`,checkingState:`On · checking state`,needsYou:`Paused · needs you`,safetyPaused:`Safety paused`,complete:`Complete`,checkpointRecovery:`Recovering checkpoint handoff`,degraded:`On · continuation unavailable`},l={planRequired:`An incomplete supervised plan is required before Autopilot can start.`,planComplete:`This plan is complete, so Autopilot is unavailable.`,sessionUnavailable:`This session is unavailable for Autopilot.`,attentionRequired:`Autopilot is paused because an agent is waiting for human input.`,noPlanProgress:`Autopilot paused because the plan did not make durable progress.`,reconcileFailed:`Autopilot paused because it could not safely confirm session state.`,startUnavailable:`Automatic continuation could not start because the session runtime is unavailable. Restore or reopen the session, then retry Autopilot.`,actionRateExceeded:`Autopilot paused after too many automatic actions in ten minutes. Wait for the safety window to clear, or continue manually.`,planRemoved:`The retained plan was removed.`,planReplaced:`The retained plan changed. Enable Autopilot again after reviewing it.`,sessionEnded:`This session ended.`,manualDisabled:`Autopilot is off.`,safetyPaused:`Autopilot paused after a repeated or invalid automatic continuation. Resume manually when ready.`,checkpointHandoffFailed:ho},u=L(()=>t.autopilot?t.autopilot.health?c[t.autopilot.health.phase]:s[t.autopilot.state]:`Unavailable`),d=L(()=>t.autopilot?.state===`backoff`&&t.autopilot.retry.position>0&&t.autopilot.retry.limit>0?`Retry ${t.autopilot.retry.position} of ${t.autopilot.retry.limit}.`:null),f=L(()=>(t.autopilot?.reason?l[t.autopilot.reason]:null)??G(d)??t.autopilot?.health?.nextExpectedAction??(t.autopilot?.state===`monitoring`?`Autopilot is monitoring this supervised plan.`:t.autopilot?.state===`attentionRequired`?`Autopilot is paused because human attention is required.`:`Autopilot state is loading from the relay.`)),p=L(()=>`Autopilot status: ${G(u)}. ${G(f)}`),m=L(()=>t.autopilot?.enabled??!1),h=L(()=>t.autopilot?.state===`safetyPaused`||t.autopilot?.health?.phase===`degraded`);var g=Oo();let _;var v=V(g),y=V(v,!0);P(v);var b=U(v,2),x=e=>{{let t=L(()=>`${n()}-button`),r=L(()=>i()?`Autopilot: ${a()?`Updating`:G(u)}`:void 0),s=L(()=>`${n()}-help`);Ya(e,{get id(){return G(t)},compact:!0,full:!0,get pressed(){return G(m)},get accentPressed(){return i()},get label(){return G(r)},get describedby(){return G(s)},get ariaDisabled(){return a()},onclick:()=>{a()||o()(!G(m))},children:(e,t)=>{var n=Kr(),r=H(n),o=e=>{J(e,Gr(`Autopilot`))},s=e=>{var t=Eo(),n=H(t),r=V(n,!0);P(n);var i=U(n);W(()=>{Y(r,G(m)?`●`:`○`),Y(i,` Autopilot: ${(a()?`Updating…`:G(u))??``}`)}),J(e,t)};X(r,e=>{i()?e(o):e(s,-1)}),J(e,n)},$$slots:{default:!0}})}},S=e=>{var r=Do(),i=V(r),s=V(i),c=V(s,!0);P(s);var l=U(s);P(i);var d=U(i,2);{let e=L(()=>`${n()}-button`),t=L(()=>`${n()}-help`);Ya(d,{get id(){return G(e)},get pressed(){return G(m)},get describedby(){return G(t)},get ariaDisabled(){return a()},onclick:()=>{a()||o()(!G(m))},children:(e,t)=>{Ue();var n=Gr();W(()=>Y(n,a()?`Updating…`:G(m)?`Pause`:`Enable`)),J(e,n)},$$slots:{default:!0}})}P(r),W(()=>{Q(i,`data-state`,t.autopilot?.state??`unavailable`),Y(c,G(m)?`●`:`○`),Y(l,` Autopilot: ${G(u)??``}`)}),J(e,r)};X(b,e=>{r()?e(x):e(S,-1)});var C=U(b,2);let w;var T=V(C,!0);P(C),P(g),W(()=>{_=Si(g,1,`autopilot-control svelte-1qf1ppf`,null,_,{compact:r(),"has-error":i()&&G(h)}),Y(y,G(p)),Q(C,`id`,`${n()}-help`),w=Si(C,1,`svelte-1qf1ppf`,null,w,{"visually-hidden":r()}),Y(T,G(f))}),J(e,g),et()}var Ao=q(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="supervisor-report svelte-1hnxk0w"> </dd></div>`),jo=q(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="svelte-1hnxk0w">The supervisor has not supplied an explanation yet. You can ask for details in the
|
|
9
|
+
guidance below.</dd></div>`),Mo=q(`<section class="attention svelte-1hnxk0w" role="alert"><h3 class="svelte-1hnxk0w">Autopilot needs your attention</h3> <dl class="svelte-1hnxk0w"><div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Reason</dt> <dd class="svelte-1hnxk0w"> </dd></div> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">What happened</dt> <dd class="svelte-1hnxk0w"> </dd></div> <!> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Requested action</dt> <dd class="svelte-1hnxk0w"> </dd></div> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Resume when</dt> <dd class="svelte-1hnxk0w"> </dd></div></dl> <label>Optional guidance for the resumed work</label> <textarea maxlength="600" class="svelte-1hnxk0w"></textarea> <p class="guidance-help svelte-1hnxk0w"> </p> <div class="actions svelte-1hnxk0w"><button type="button" class="svelte-1hnxk0w"> </button> <button type="button" class="svelte-1hnxk0w">Disable Autopilot</button></div></section>`);function No(e,t){$e(t,!0);let n=$(t,`controlId`,3,`autopilot-attention`),r=$(t,`pending`,3,!1),i=$(t,`onresolve`,3,()=>{}),a=z(``),o={planChange:`Plan change needs approval`,hardBlock:`Work is blocked`,missingDependency:`A required capability is missing`,permissionRequired:`Permission is needed`,externalState:`An external condition changed`,materialAmbiguity:`A decision is needed`},s={userGuidance:`You have provided the decision or guidance below.`,planRevision:`You have approved or revised the plan.`,dependencyInstalled:`The required capability is available.`,permissionGranted:`The required permission has been granted.`,externalStateChanged:`The blocker has been resolved, or you have provided a way forward below.`},c=L(()=>t.attention?.attention.summary.startsWith(`Supervised execution requires human attention (`)),l=L(()=>G(a).trim().length>600?`Guidance must be 600 characters or fewer.`:``);var u=Kr(),d=H(u),f=e=>{var u=Mo(),d=V(u),f=U(d,2),p=V(f),m=U(V(p),2),h=V(m,!0);P(m),P(p);var g=U(p,2),_=U(V(g),2),v=V(_,!0);P(_),P(g);var y=U(g,2),b=e=>{var n=Ao(),r=U(V(n),2),i=V(r,!0);P(r),P(n),W(()=>Y(i,t.attention.supervisorReport)),J(e,n)},x=e=>{J(e,jo())};X(y,e=>{t.attention.supervisorReport?e(b):G(c)&&e(x,1)});var S=U(y,2),C=U(V(S),2),w=V(C,!0);P(C),P(S);var T=U(S,2),E=U(V(T),2),D=V(E,!0);P(E),P(T),P(f);var ee=U(f,2),te=U(ee,2);Sn(te);var ne=U(te,2),re=V(ne,!0);P(ne);var ie=U(ne,2),O=V(ie),ae=V(O,!0);P(O);var oe=U(O,2);P(ie),P(u),W((e,i)=>{Q(u,`aria-labelledby`,`${n()}-title`),Q(d,`id`,`${n()}-title`),Y(h,o[t.attention.attention.reason]??`Supervised work needs attention`),Y(v,G(c)?`The supervisor has paused work and needs your help to continue.`:t.attention.attention.summary),Y(w,G(c)?`Resolve the blocker or describe a way forward below, then choose Resume. You can also disable Autopilot.`:t.attention.attention.requestedAction),Y(D,s[t.attention.attention.resumeCondition]??`You are ready for the supervisor to continue.`),Q(ee,`for`,`${n()}-guidance`),Q(te,`id`,`${n()}-guidance`),Q(te,`aria-describedby`,`${n()}-guidance-help`),Q(te,`aria-invalid`,e),Q(ne,`id`,`${n()}-guidance-help`),Y(re,G(l)||`Up to 600 characters. Do not include secrets.`),O.disabled=i,Y(ae,r()?`Updating…`:t.attention.attention.executorReplacement?`Authorize replacement`:`Resume`),oe.disabled=r()},[()=>!!G(l),()=>r()||!!G(l)]),zi(te,()=>G(a),e=>B(a,e)),K(`click`,O,()=>G(a).trim()?i()(`resume`,G(a)):i()(`resume`)),K(`click`,oe,()=>i()(`disableAutopilot`)),J(e,u)};X(d,e=>{t.attention&&e(f)}),J(e,u),et()}Rr([`click`]);var Po=q(`<section class="safety-stop svelte-yp6bgs" role="alert"><h3 class="svelte-yp6bgs">Autopilot safety stop</h3> <p class="svelte-yp6bgs"> </p> <p class="svelte-yp6bgs"> </p> <div class="actions svelte-yp6bgs"><button type="button" class="svelte-yp6bgs"> </button> <button type="button" class="svelte-yp6bgs">Disable Autopilot</button></div></section>`);function Fo(e,t){$e(t,!0);let n=$(t,`controlId`,3,`autopilot-safety-stop`),r=$(t,`pending`,3,!1),i=$(t,`onrecover`,3,()=>{}),a=$(t,`ondisable`,3,()=>{}),o={attentionRequired:`The coordinator stopped because it needs a human safety decision, but no actionable agent request is available.`,noPlanProgress:`The coordinator stopped because recent automatic turns made no durable plan progress.`,reconcileFailed:`The coordinator stopped because it could not safely confirm the session state.`,startUnavailable:`The coordinator stopped because the session runtime was unavailable when it tried to start an automatic turn.`,actionRateExceeded:`The coordinator stopped because it reached the automatic-action safety limit.`},s=L(()=>t.autopilot?.reason&&!t.attention?o[t.autopilot.reason]??null:null),c=L(()=>t.autopilot?.reason===`startUnavailable`?`There is no pending agent attention request to answer. Restore or reopen this session, then retry Autopilot.`:t.autopilot?.reason===`actionRateExceeded`?`There is no pending agent attention request to answer. Wait for the ten-minute safety window to clear, or continue manually.`:`There is no pending agent attention request to answer. Retry the supported Autopilot coordinator after addressing the cause, or disable it.`);var l=Kr(),u=H(l),d=e=>{var t=Po(),o=V(t),l=U(o,2),u=V(l,!0);P(l);var d=U(l,2),f=V(d,!0);P(d);var p=U(d,2),m=V(p),h=V(m,!0);P(m);var g=U(m,2);P(p),P(t),W(()=>{Q(t,`aria-labelledby`,`${n()}-title`),Q(o,`id`,`${n()}-title`),Y(u,G(s)),Y(f,G(c)),m.disabled=r(),Y(h,r()?`Updating…`:`Retry Autopilot`),g.disabled=r()}),K(`click`,m,function(...e){i()?.apply(this,e)}),K(`click`,g,function(...e){a()?.apply(this,e)}),J(e,t)};X(u,e=>{t.autopilot?.state===`attentionRequired`&&G(s)&&e(d)}),J(e,l),et()}Rr([`click`]);function Io(e,t=`gestalt-mobile.autopilot-attention-toasts.v1`,n=100){let r=Lo(e,t,n);return{claim(i){if(r.has(i))return!1;r=new Set([...r,i].slice(-n));try{e?.setItem(t,JSON.stringify([...r]))}catch{}return!0}}}function Lo(e,t,n){try{let r=JSON.parse(e?.getItem(t)??`[]`);return new Set(Array.isArray(r)?r.filter(e=>typeof e==`string`).slice(-n):[])}catch{return new Set}}var Ro=[{name:`model`,description:`Choose the model for the next turn`,argumentPicker:`models`},{name:`reasoning`,description:`Choose reasoning effort for the next turn`,argumentPicker:`reasoning`}];function zo(e){let t=e.match(/^\/([^\s]*)$/);return t?t[1].toLowerCase():null}function Bo(e){let t=zo(e);return t===null?[]:Ro.filter(e=>e.name.startsWith(t))}function Vo(e){let t=e.match(/^\/([^\s]+)\s*$/)?.[1]?.toLowerCase();return Ro.find(e=>e.name===t)?.argumentPicker}function Ho(e){return[...e].sort((e,t)=>Uo(t,e)||t.localeCompare(e))}function Uo(e,t){let n=e.match(/\d+(?:\.\d+)*/)?.[0].split(`.`).map(Number)??[],r=t.match(/\d+(?:\.\d+)*/)?.[0].split(`.`).map(Number)??[];for(let e=0;e<Math.max(n.length,r.length);e+=1){let t=(n[e]??0)-(r[e]??0);if(t)return t}return 0}var Wo=q(`Ready <span class="block-cursor svelte-1264sfg" aria-hidden="true"></span>`,1),Go=q(`<p id="writer-hint" class="writer-hint svelte-1264sfg"> </p>`),Ko=q(`<button type="button" class="svelte-1264sfg">Retry send</button>`),qo=q(`<div class="writer-feedback svelte-1264sfg" role="alert" aria-atomic="true"><p class="svelte-1264sfg"> </p> <!></div>`),Jo=q(`<li><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code> <small class="svelte-1264sfg"> </small></button></li>`),Yo=q(`<ul id="chat-command-completion" class="command-menu svelte-1264sfg" aria-label="Chat commands"></ul>`),Xo=q(`<li class="svelte-1264sfg"><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code></button></li>`),Zo=q(`<ul class="command-menu svelte-1264sfg" aria-label="Available models"></ul>`),Qo=q(`<ul class="command-menu svelte-1264sfg" aria-label="Reasoning efforts"></ul>`),$o=q(`<div id="prompt-action-panel" class="action-panel svelte-1264sfg" aria-label="Prompt actions"><button type="button" class="svelte-1264sfg">Queue message</button> <button type="button" class="svelte-1264sfg">Interrupt and send</button></div>`),es=q(`<div class="prompt-action svelte-1264sfg"><button type="button" aria-label="Choose prompt action" aria-controls="prompt-action-panel" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><circle cx="6" cy="12" r="1.5" class="svelte-1264sfg"></circle><circle cx="12" cy="12" r="1.5" class="svelte-1264sfg"></circle><circle cx="18" cy="12" r="1.5" class="svelte-1264sfg"></circle></svg></button> <!></div>`),ts=q(`<button type="button" aria-label="Interrupt" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><path d="m7 7 10 10M17 7 7 17" class="svelte-1264sfg"></path></svg></button>`),ns=q(`<button type="button" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><path d="M9 10 5 14l4 4M5 14h8a6 6 0 0 0 6-6V6" class="svelte-1264sfg"></path></svg></button>`),rs=q(`<form class="svelte-1264sfg"><p role="status" aria-live="polite" aria-atomic="true" class="svelte-1264sfg"><!></p> <!> <!> <!> <!> <!> <div class="prompt-row svelte-1264sfg"><textarea id="message" aria-label="Prompt" placeholder="Prompt" rows="1" required=""></textarea> <!></div></form>`);function is(e,t){$e(t,!0);let n=$(t,`newEmpty`,3,!1),r=$(t,`detached`,3,!1),i=$(t,`retryMessage`,3,null),a=$(t,`retryable`,3,!1),o=$(t,`models`,19,()=>[]),s=$(t,`provider`,3,`codex`),c=$(t,`onscrollbottom`,3,()=>{}),l=$(t,`onmodelselect`,3,()=>{}),u=$(t,`onqueue`,3,()=>{}),d=$(t,`oninterruptsend`,3,()=>{}),f=$(t,`onretry`,3,()=>{}),p=z(0),m=z(null),h=z(!1),g=L(()=>Bo(t.message)),_=L(()=>zo(t.message)),v=L(()=>G(_)!==null&&G(_)!==G(m)&&G(g).length>0),y=L(()=>Vo(t.message)),b=L(()=>G(y)===`models`),x=L(()=>Ho(o())),S=L(()=>G(y)===`reasoning`),C=L(()=>!t.activeTurnId&&!t.starting&&!!t.message.trim()),w=L(()=>!!t.message.trim()),T=L(()=>a()&&!i());function E(e){B(h,!1),e===`queue`?u()():d()()}function D(e,n=!1){B(m,null),B(p,0),t.onchange(e),n&&c()()}function ee(e=G(p)){let t=G(g)[e];t&&D(`/${t.name} `,!0)}function te(e){if(e.key===`Enter`&&e.ctrlKey&&!e.isComposing){if(t.activeTurnId&&!t.starting&&G(w)){e.preventDefault(),E(`queue`);return}if(G(C)){e.preventDefault(),t.onsend();return}}if(G(v)){if(e.key===`ArrowDown`){e.preventDefault(),B(p,(G(p)+1)%G(g).length);return}if(e.key===`ArrowUp`){e.preventDefault(),B(p,(G(p)-1+G(g).length)%G(g).length);return}if(e.key===`Escape`){e.preventDefault(),B(m,G(_),!0);return}if(e.key===`Tab`){e.preventDefault(),ee();return}}}var ne=rs(),re=V(ne),ie=V(re),O=e=>{var t=Wo();Ue(),J(e,t)},ae=e=>{var n=Gr();W(()=>Y(n,t.status)),J(e,n)};X(ie,e=>{t.status===`Ready.`?e(O):e(ae,-1)}),P(re);var oe=U(re,2),se=e=>{var t=Go(),n=V(t);P(t),W(()=>Y(n,`You can read this conversation. Sending will connect to ${s()===`kimi`?`Kimi`:`Codex`}.`)),J(e,t)};X(oe,e=>{r()&&e(se)});var ce=U(oe,2),le=e=>{var n=qo(),r=V(n),o=V(r,!0);P(r);var s=U(r,2),c=e=>{var n=Ko();W(()=>n.disabled=t.starting),K(`click`,n,function(...e){f()?.apply(this,e)}),J(e,n)};X(s,e=>{a()&&e(c)}),P(n),W(()=>Y(o,i())),J(e,n)};X(ce,e=>{i()&&e(le)});var ue=U(ce,2),k=e=>{var t=Yo();Z(t,23,()=>G(g),e=>e.name,(e,t,n)=>{var r=Jo(),i=V(r),a=V(i),o=V(a);P(a);var s=U(a,2),c=V(s,!0);P(s),P(i),P(r),W(()=>{Si(r,1,gi(G(n)===G(p)?`command-selected`:void 0),`svelte-1264sfg`),Y(o,`/${G(t).name??``}`),Y(c,G(t).description)}),K(`click`,i,()=>ee(G(n))),J(e,r)}),P(t),J(e,t)};X(ue,e=>{G(v)&&e(k)});var de=U(ue,2),fe=e=>{var t=Zo();Z(t,20,()=>G(x),e=>e,(e,t)=>{var n=Xo(),r=V(n),i=V(r),a=V(i,!0);P(i),P(r),P(n),W(()=>Y(a,t)),K(`click`,r,()=>{l()(t),c()()}),J(e,n)}),P(t),J(e,t)};X(de,e=>{G(b)&&e(fe)});var pe=U(de,2),me=e=>{var t=Qo();Z(t,20,()=>[`low`,`medium`,`high`],e=>e,(e,t)=>{var n=Xo(),r=V(n),i=V(r),a=V(i,!0);P(i),P(r),P(n),W(()=>Y(a,t)),K(`click`,r,()=>D(`/reasoning ${t} `,!0)),J(e,n)}),P(t),J(e,t)};X(pe,e=>{G(S)&&e(me)});var he=U(pe,2),ge=V(he);Sn(ge);let _e;var A=U(ge,2),ve=e=>{var t=es(),n=V(t),r=U(n,2),i=e=>{var t=$o(),n=V(t),r=U(n,2);P(t),K(`click`,n,()=>E(`queue`)),K(`click`,r,()=>E(`interrupt-send`)),J(e,t)};X(r,e=>{G(h)&&e(i)}),P(t),W(()=>Q(n,`aria-expanded`,G(h))),K(`click`,n,()=>B(h,!G(h))),J(e,t)},ye=e=>{var n=ts();W(()=>n.disabled=t.starting),K(`click`,n,function(...e){t.oninterrupt?.apply(this,e)}),J(e,n)},be=e=>{var n=ns();W(()=>{Q(n,`aria-label`,G(T)?`Retry send`:`Send prompt`),n.disabled=!G(C)}),K(`click`,n,function(...e){(G(T)?f():t.onsend)?.apply(this,e)}),J(e,n)};X(A,e=>{t.activeTurnId&&G(w)?e(ve):t.activeTurnId?e(ye,1):e(be,-1)}),P(he),P(ne),W(()=>{Q(ne,`aria-busy`,t.starting),Q(re,`aria-label`,t.status),Pi(ge,t.message),Q(ge,`aria-describedby`,r()?`writer-hint`:void 0),_e=Si(ge,1,`svelte-1264sfg`,null,_e,{"new-empty":n()})}),K(`input`,ge,e=>D(e.currentTarget.value)),K(`keydown`,ge,te),J(e,ne),et()}Rr([`click`,`input`,`keydown`]);function as(e){let t=new Map;for(let n of e){if(!n.label.toLowerCase().replaceAll(` `,``).startsWith(`filechange`))continue;let e=n.changes?.length?n.changes:n.detail.split(`
|
|
10
|
+
`).filter(Boolean).map(e=>({path:e,additions:null,deletions:null}));for(let r of e){let e=t.get(r.path),i=typeof r.additions==`number`&&typeof r.deletions==`number`;t.set(r.path,{path:r.path,additions:i&&e?.additions!==null?(e?.additions??0)+r.additions:null,deletions:i&&e?.deletions!==null?(e?.deletions??0)+r.deletions:null,...n.occurredAt===void 0?e?.touchedAt===void 0?{}:{touchedAt:e.touchedAt}:{touchedAt:Math.max(e?.touchedAt??0,n.occurredAt)}})}}return[...t.values()]}function os(e){return{files:e.length,additions:e.every(e=>e.additions!==null)?e.reduce((e,t)=>e+t.additions,0):null,deletions:e.every(e=>e.deletions!==null)?e.reduce((e,t)=>e+t.deletions,0):null}}function ss(e,t){if(e===void 0||t===void 0||!Number.isFinite(e)||!Number.isFinite(t))return null;let n=Math.floor(Math.max(0,t-e)/6e4);if(n<1)return`moments later`;if(n<60)return`${n} minute${n===1?``:`s`} later`;let r=Math.floor(n/60);if(r<24)return`${r} hour${r===1?``:`s`} later`;let i=Math.floor(r/24);return`${i} day${i===1?``:`s`} later`}function cs(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(e)}function ls(e,t){let n=Math.floor(Math.max(0,t-e)/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}var us=q(`<dl class="command-counts svelte-11ye6aj"><div class="svelte-11ye6aj"><dt class="svelte-11ye6aj">Successful commands</dt> <dd class="svelte-11ye6aj"> </dd></div> <div class="svelte-11ye6aj"><dt class="svelte-11ye6aj">Failed commands</dt> <dd class="svelte-11ye6aj"> </dd></div></dl>`),ds=q(`<li data-status="failed" class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code></li>`),fs=q(`<section aria-label="Failed commands"><strong>Failed commands</strong> <ul class="activity-list svelte-11ye6aj"></ul></section>`),ps=q(`<li class="svelte-11ye6aj"><small class="svelte-11ye6aj"> </small> <span class="svelte-11ye6aj"> </span></li>`),ms=q(`<ul class="activity-list svelte-11ye6aj" aria-label="Work activity"></ul>`),hs=q(`<time class="svelte-11ye6aj"> </time>`),gs=q(`<span class="svelte-11ye6aj">time unknown</span>`),_s=q(`<li class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code> <span class="file-counts svelte-11ye6aj" aria-label="Line changes"><span class="svelte-11ye6aj"> </span><span class="svelte-11ye6aj"> </span></span> <!></li>`),vs=q(`<section aria-label="Files changed"><strong>Files changed</strong> <ul class="file-list svelte-11ye6aj"></ul></section>`),ys=q(`<details class="work-details svelte-11ye6aj"><summary class="svelte-11ye6aj"> </summary> <div class="work-details-content svelte-11ye6aj"><!> <!> <!> <!></div></details>`);function bs(e,t){$e(t,!0);let n=$(t,`now`,19,()=>Date.now()),r=L(()=>Ia(t.activities)),i=L(()=>t.activities.flatMap(e=>{let t=La(e);return t?.kind===`Command`&&t.status===`failed`?[{id:e.id,command:t.content}]:[]})),a=L(()=>as(t.activities)),o=L(()=>os(G(a))),s=L(()=>t.activities.flatMap(e=>{let t=La(e);return t&&t.kind!==`Command`&&t.kind!==`File change`?[{id:e.id,...t}]:[]})),c=L(()=>t.activities.length),l=L(()=>G(a).length?`${G(o).files} ${G(o).files===1?`file`:`files`} changed · +${G(o).additions??`?`} −${G(o).deletions??`?`}`:`Work details · ${G(c)} ${G(c)===1?`activity`:`activities`}`);var u=Kr(),d=H(u),f=e=>{var t=ys(),o=V(t),c=V(o,!0);P(o);var u=U(o,2),d=V(u),f=e=>{var t=us(),n=V(t),i=U(V(n),2),a=V(i,!0);P(i),P(n);var o=U(n,2),s=U(V(o),2),c=V(s,!0);P(s),P(o),P(t),W(()=>{Y(a,G(r).successful),Y(c,G(r).failed)}),J(e,t)};X(d,e=>{(G(r).successful||G(r).failed)&&e(f)});var p=U(d,2),m=e=>{var t=fs(),n=U(V(t),2);Z(n,21,()=>G(i),e=>e.id,(e,t)=>{var n=ds(),r=V(n),i=V(r,!0);P(r),P(n),W(()=>Y(i,G(t).command)),J(e,n)}),P(n),P(t),J(e,t)};X(p,e=>{G(i).length&&e(m)});var h=U(p,2),g=e=>{var t=ms();Z(t,21,()=>G(s),e=>e.id,(e,t)=>{var n=ps(),r=V(n),i=V(r);P(r);var a=U(r,2),o=V(a,!0);P(a),P(n),W(()=>{Q(n,`data-status`,G(t).status),Y(i,`${G(t).kind??``}${G(t).status?` · ${G(t).status}`:``}`),Y(o,G(t).content)}),J(e,n)}),P(t),J(e,t)};X(h,e=>{G(s).length&&e(g)});var _=U(h,2),v=e=>{var t=vs(),r=U(V(t),2);Z(r,21,()=>G(a),e=>e.path,(e,t)=>{var r=_s(),i=V(r),a=V(i,!0);P(i);var o=U(i,2),s=V(o),c=V(s);P(s);var l=U(s),u=V(l);P(l),P(o);var d=U(o,2),f=e=>{var r=hs(),i=V(r,!0);P(r),W((e,t)=>{Q(r,`datetime`,e),Y(i,t)},[()=>new Date(G(t).touchedAt).toISOString(),()=>ls(G(t).touchedAt,n())]),J(e,r)},p=e=>{J(e,gs())};X(d,e=>{G(t).touchedAt===void 0?e(p,-1):e(f)}),P(r),W(()=>{Y(a,G(t).path),Y(c,`+${G(t).additions??`?`??``}`),Y(u,`-${G(t).deletions??`?`??``}`)}),J(e,r)}),P(r),P(t),J(e,t)};X(_,e=>{G(a).length&&e(v)}),P(u),P(t),W(()=>Y(c,G(l))),J(e,t)};X(d,e=>{G(c)&&e(f)}),J(e,u),et()}function xs(e){if(!e||typeof e!=`object`)return null;let t=e.command;return typeof t==`string`&&t.trim()?t:null}function Ss(e){if(!Cs(e))return null;let t=e.changes;if(!Array.isArray(t))return null;let n=t.map(e=>Cs(e)&&typeof e.path==`string`&&e.path.trim()?e.path:null).filter(e=>e!==null);return n.length===t.length&&n.length>0?n:null}function Cs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ws=q(`<div class="choice svelte-77f3gb"><input type="radio" class="svelte-77f3gb"/> <label class="svelte-77f3gb"><strong> </strong><span class="svelte-77f3gb"> </span></label></div>`),Ts=q(`<label class="custom svelte-77f3gb">Your custom answer <input required="" class="svelte-77f3gb"/></label>`),Es=q(`<div class="choice svelte-77f3gb"><input type="radio" class="svelte-77f3gb"/> <label class="svelte-77f3gb"><strong>Custom answer</strong><span class="svelte-77f3gb">Provide your own response.</span></label></div> <!>`,1),Ds=q(`<fieldset class="svelte-77f3gb"><legend class="svelte-77f3gb"><strong> </strong><span class="svelte-77f3gb"> </span></legend> <div class="choices svelte-77f3gb"><!> <!></div></fieldset>`),Os=q(`<form class="quiz-form svelte-77f3gb"><fieldset class="questions svelte-77f3gb"></fieldset> <button type="submit">Send answers</button></form>`);function ks(e,t){$e(t,!0);let n=$(t,`disabled`,3,!1),r=on({}),i=on({}),a=L(()=>t.quiz.questions.every(e=>!!t.answers[e.id]?.trim()));async function o(e){i[e]=!0,t.onanswer(e,t.answers[e]??``),await Tr(),r[e]?.focus()}var s=Os(),c=V(s);Z(c,21,()=>t.quiz.questions,e=>e.id,(e,n)=>{let a=L(()=>`${t.requestId}-${G(n).id}-custom`),s=L(()=>G(n).choices.some(e=>e.label===t.answers[G(n).id]));var c=Ds(),l=V(c),u=V(l),d=V(u,!0);P(u);var f=U(u),p=V(f,!0);P(f),P(l);var m=U(l,2),h=V(m);Z(h,17,()=>G(n).choices,e=>`${G(n).id}-${e.label}`,(e,r)=>{let a=L(()=>`${t.requestId}-${G(n).id}-${G(r).label}`);var o=ws(),s=V(o);Ni(s);var c=U(s,2),l=V(c),u=V(l,!0);P(l);var d=U(l),f=V(d,!0);P(d),P(c),P(o),W(()=>{Q(s,`id`,G(a)),Q(s,`name`,`${t.requestId}-${G(n).id}`),Fi(s,t.answers[G(n).id]===G(r).label),Q(c,`for`,G(a)),Y(u,G(r).label),Y(f,G(r).description)}),K(`change`,s,()=>{i[G(n).id]=!1,t.onanswer(G(n).id,G(r).label)}),J(e,o)});var g=U(h,2),_=e=>{var c=Es(),l=H(c),u=V(l);Ni(u);var d=U(u,2);P(l);var f=U(l,2),p=e=>{var i=Ts(),o=U(V(i));Ni(o),Ui(o,(e,t)=>r[t.id]=e,e=>r?.[e.id],()=>[G(n)]),P(i),W(()=>{Q(i,`for`,`${G(a)}-text`),Q(o,`id`,`${G(a)}-text`),Q(o,`type`,G(n).isSecret?`password`:`text`),Pi(o,t.answers[G(n).id])}),K(`input`,o,e=>t.onanswer(G(n).id,e.currentTarget.value)),J(e,i)},m=L(()=>i[G(n).id]||!!t.answers[G(n).id]&&!G(s));X(f,e=>{G(m)&&e(p)}),W(e=>{Q(u,`id`,G(a)),Q(u,`name`,`${t.requestId}-${G(n).id}`),Fi(u,e),Q(d,`for`,G(a))},[()=>i[G(n).id]||!!t.answers[G(n).id]&&!G(s)]),K(`change`,u,()=>o(G(n).id)),K(`click`,u,()=>{i[G(n).id]&&o(G(n).id)}),J(e,c)};X(g,e=>{G(n).allowCustom&&e(_)}),P(m),P(c),W(()=>{Y(d,G(n).header),Y(p,G(n).question)}),J(e,c)}),P(c);var l=U(c,2);P(s),W(()=>{c.disabled=n(),l.disabled=n()||!G(a)}),Lr(`submit`,s,e=>{e.preventDefault(),G(a)&&t.onsubmit()}),J(e,s),et()}Rr([`change`,`click`,`input`]);function As(e,t=2){if(!Ls(e)||!Array.isArray(e.questions)||e.questions.length<1||e.questions.length>8)return null;let n=e.questions.map(e=>Ns(e,t));if(n.some(e=>e===null))return null;let r=n;return new Set(r.map(e=>e.id)).size===r.length?{questions:r}:null}function js(e){return!Ls(e)||!Array.isArray(e.questions)||e.questions.length>3?null:As({questions:e.questions.map(e=>Ls(e)?{id:e.id,header:e.header,question:e.question,choices:e.options,allowCustom:e.isOther===!0,isSecret:e.isSecret===!0}:e)},1)}function Ms(e){return{contentItems:[{type:`inputText`,text:JSON.stringify({answers:Object.fromEntries(e.filter(e=>e.answer.trim()).map(e=>[e.id,e.answer]))})}],success:!0}}function Ns(e,t){if(!Ls(e)||!Array.isArray(e.choices)||e.choices.length<t||e.choices.length>5||!Fs(e.id)||!Is(e.header,120)||!Is(e.question,600)||typeof e.allowCustom!=`boolean`)return null;let n=e.choices.map(Ps);return n.some(e=>e===null)?null:{id:e.id,header:e.header,question:e.question,choices:n,allowCustom:e.allowCustom,isSecret:e.isSecret===!0}}function Ps(e){return!Ls(e)||!Is(e.label,160)||!Is(e.description,600)?null:{label:e.label,description:e.description}}function Fs(e){return typeof e==`string`&&/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)}function Is(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function Ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Rs=q(`<p class="interaction-result svelte-ajsqcq" data-interaction-state="resolved" tabindex="-1"> </p>`),zs=q(`<p class="interaction-submitting svelte-ajsqcq" data-interaction-state="submitting">Submitting…</p>`),Bs=q(`<p>Codex sent an invalid quiz request.</p>`),Vs=q(`<p>Grant the requested permissions for this turn only.</p> <button type="button">Approve</button>`,1),Hs=q(`<pre class="command-approval-command svelte-ajsqcq"><code> </code></pre>`),Us=q(`<p class="command-approval-missing svelte-ajsqcq">Command details were not provided.</p>`),Ws=q(`<p>Approve this command?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),Gs=q(`<li><code> </code></li>`),Ks=q(`<ul class="file-change-approval-targets svelte-ajsqcq" aria-label="Files to change"></ul>`),qs=q(`<p class="file-change-approval-missing svelte-ajsqcq">File details were not provided.</p>`),Js=q(`<p>Approve changes to these files?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),Ys=q(`<button type="button">Approve</button><button type="button">Deny</button>`,1),Xs=q(`<p class="interaction-failed svelte-ajsqcq" data-interaction-state="failed">Could not send. Try again.</p> <button type="button">Retry</button>`,1),Zs=q(`<!> <!> <!>`,1),Qs=q(`<li class="svelte-ajsqcq"><span class="submitted-question svelte-ajsqcq"><strong> </strong> </span> <span class="submitted-answer svelte-ajsqcq"> </span></li>`),$s=q(`<section class="submitted-answers svelte-ajsqcq" aria-label="Submitted answers" aria-live="polite"><p class="svelte-ajsqcq"><strong>Submitted answers</strong></p> <ol class="svelte-ajsqcq"></ol> <p class="submitted-note svelte-ajsqcq">Recorded in this chat view before delivery.</p></section>`),ec=q(`<article><p class="interaction-kind svelte-ajsqcq"> </p> <!> <!></article>`);function tc(e,t){$e(t,!0);let n=$(t,`submittedAnswers`,19,()=>({})),r=$(t,`onretry`,3,()=>{}),i=z(null),a=on({}),o=e=>Object.fromEntries(Object.entries(t.answers).filter(([t])=>t.startsWith(`${e}:`)).map(([t,n])=>[t.slice(e.length+1),n]));function s(e,t){B(i,e.requestId,!0),t()}Mn(()=>{let e=t.interactions.find(e=>e.requestId===G(i));e?.state===`resolved`&&(Tr().then(()=>a[e.requestId]?.focus()),B(i,null))});var c=Kr();Z(H(c),17,()=>t.interactions,e=>e.key??e.requestId,(e,i)=>{let c=L(()=>G(i).state===`submitting`);var l=ec();let u;var d=V(l),f=V(d,!0);P(d);var p=U(d,2),m=e=>{var t=Rs(),n=V(t,!0);P(t),Ui(t,(e,t)=>a[t.requestId]=e,e=>a?.[e.requestId],()=>[G(i)]),W(()=>Y(n,G(i).attemptedOutcome===`denied`?`Denied`:G(i).attemptedOutcome===`dismissed`?`No longer awaiting a response`:G(i).attemptedOutcome===`answered`?`Answers sent`:`Approved`)),J(e,t)},h=e=>{var n=Zs(),a=H(n),l=e=>{J(e,zs())};X(a,e=>{G(c)&&e(l)});var u=U(a,2),d=e=>{let n=L(()=>G(i).kind===`quiz`?As(G(i).payload):js(G(i).payload));var r=Kr(),a=H(r),l=e=>{{let r=L(()=>o(G(i).requestId));ks(e,{get requestId(){return G(i).requestId},get quiz(){return G(n)},get answers(){return G(r)},get disabled(){return G(c)},onanswer:(e,n)=>t.onanswer(G(i).requestId,e,n),onsubmit:()=>s(G(i),()=>t.onquiz(G(i)))})}},u=e=>{J(e,Bs())};X(a,e=>{G(n)?e(l):e(u,-1)}),J(e,r)},f=e=>{var n=Vs(),r=U(H(n),2);W(()=>r.disabled=G(c)),K(`click`,r,()=>s(G(i),()=>t.onpermission(G(i)))),J(e,n)},p=e=>{let n=L(()=>xs(G(i).payload));var r=Ws(),a=U(H(r),2),o=e=>{var t=Hs(),r=V(t),i=V(r,!0);P(r),P(t),W(()=>Y(i,G(n))),J(e,t)},l=e=>{J(e,Us())};X(a,e=>{G(n)?e(o):e(l,-1)});var u=U(a,2),d=V(u),f=U(d,2);P(u),W(()=>{d.disabled=G(c),f.disabled=G(c)}),K(`click`,d,()=>s(G(i),()=>t.ondecision(G(i).requestId,`accept`))),K(`click`,f,()=>s(G(i),()=>t.ondecision(G(i).requestId,`decline`))),J(e,r)},m=e=>{let n=L(()=>Ss(G(i).payload));var r=Js(),a=U(H(r),2),o=e=>{var t=Ks();Z(t,20,()=>G(n),e=>e,(e,t)=>{var n=Gs(),r=V(n),i=V(r,!0);P(r),P(n),W(()=>Y(i,t)),J(e,n)}),P(t),J(e,t)},l=e=>{J(e,qs())};X(a,e=>{G(n)?e(o):e(l,-1)});var u=U(a,2),d=V(u),f=U(d,2);P(u),W(()=>{d.disabled=G(c),f.disabled=G(c)}),K(`click`,d,()=>s(G(i),()=>t.ondecision(G(i).requestId,`accept`))),K(`click`,f,()=>s(G(i),()=>t.ondecision(G(i).requestId,`decline`))),J(e,r)},h=e=>{var n=Ys(),r=H(n),a=U(r);W(()=>{r.disabled=G(c),a.disabled=G(c)}),K(`click`,r,()=>s(G(i),()=>t.ondecision(G(i).requestId,`accept`))),K(`click`,a,()=>s(G(i),()=>t.ondecision(G(i).requestId,`decline`))),J(e,n)};X(u,e=>{G(i).kind===`userInput`||G(i).kind===`quiz`?e(d):G(i).kind===`permissionsApproval`?e(f,1):G(i).kind===`commandApproval`?e(p,2):G(i).kind===`fileChangeApproval`?e(m,3):e(h,-1)});var g=U(u,2),_=e=>{var t=Xs();K(`click`,U(H(t),2),()=>r()(G(i))),J(e,t)};X(g,e=>{G(i).state===`failed`&&e(_)}),J(e,n)};X(p,e=>{G(i).state===`resolved`?e(m):e(h,-1)});var g=U(p,2),_=e=>{var t=$s(),r=U(V(t),2);Z(r,21,()=>n()[G(i).requestId],e=>e.id,(e,t)=>{var n=Qs(),r=V(n),i=V(r),a=V(i,!0);P(i);var o=U(i);P(r);var s=U(r,2),c=V(s,!0);P(s),P(n),W(()=>{Y(a,G(t).header),Y(o,` — ${G(t).question??``}`),Y(c,G(t).answer)}),J(e,n)}),P(r),Ue(2),P(t),J(e,t)};X(g,e=>{n()[G(i).requestId]?.length&&e(_)}),P(l),W(()=>{u=Si(l,1,`svelte-ajsqcq`,null,u,{resolved:G(i).state===`resolved`}),Y(f,G(i).kind)}),J(e,l)}),J(e,c),et()}Rr([`click`]);function nc(e){let t=[],n=[],r=()=>{n.length&&(t.push({id:n.at(-1).id,kind:`assistant`,commentary:n.map(e=>e.text).join(`
|
|
11
|
+
|
|
12
|
+
`),answer:null,...n.at(-1)?.turnId?{turnId:n.at(-1).turnId}:{},...n.at(-1)?.occurredAt===void 0?{}:{occurredAt:n.at(-1).occurredAt}}),n=[])};for(let i of e){if(i.role===`audit`){r(),t.push({id:i.id,kind:`audit`,text:i.text,...i.controlId?{controlId:i.controlId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt},count:1,timestamps:i.occurredAt===void 0?[]:[i.occurredAt]});continue}if(i.role===`user`){r(),t.push({id:i.id,kind:`user`,text:i.text,...i.turnId?{turnId:i.turnId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt}});continue}if(i.phase===`commentary`){n.push(i);continue}t.push({id:i.id,kind:`assistant`,commentary:n.length?n.map(e=>e.text).join(`
|
|
13
|
+
|
|
14
|
+
`):null,answer:i.text,...i.turnId?{turnId:i.turnId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt}}),n=[]}return r(),t}function rc(e){let t=[],n=/```[^\n]*\n([\s\S]*?)```/g,r=0;for(let i of e.matchAll(n)){let n=e.slice(r,i.index);n&&t.push(...ic(n)),t.push({kind:`code`,text:i[1]??``}),r=(i.index??0)+i[0].length}let i=e.slice(r);return(i||!t.length)&&t.push(...ic(i)),t}function ic(e){let t=[],n=e.split(`
|
|
15
|
+
`),r=0,i=e=>{let i=n.slice(r,e).join(`
|
|
16
|
+
`);i&&t.push({kind:`text`,parts:cc(i)})};for(let e=0;e<n.length;e+=1){let a=ac(n[e]??``);if(a){i(e),t.push({kind:`heading`,level:a.level,parts:cc(a.text)}),r=e+1;continue}if(e===n.length-1)continue;let o=oc(n[e]??``),s=oc(n[e+1]??``);if(!o||!s||o.length!==s.length||!s.every(sc))continue;i(e),e+=2;let c=[];for(;e<n.length;){let t=oc(n[e]??``);if(!t||t.length!==o.length)break;c.push(t),e+=1}t.push({kind:`table`,headers:o.map(cc),rows:c.map(e=>e.map(cc))}),r=e,--e}return i(n.length),t.length?t:[{kind:`text`,parts:cc(e)}]}function ac(e){let t=/^ {0,3}(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$/.exec(e);return t?{level:t[1].length,text:t[2]??``}:null}function oc(e){let t=e.trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(Boolean)?n:null}function sc(e){return/^:?-{3,}:?$/.test(e)}function cc(e){let t=[],n=/\[([^\]]+)\]\((https?:\/\/[^\s)]+|codex:\/\/[^\s)]+|file:\/\/[^\s)]+|\/[^\s)]+|\.{1,2}\/[^\s)]+|[^\s:()]+\.[a-zA-Z\d]+(?::\d+(?::\d+)?)?(?:#L\d+(?:C\d+)?)?|<(?:https?:\/\/|codex:\/\/|file:\/\/|\/|\.{1,2}\/)[^>\n]+>)\)|`([^`]+)`|\*\*([^*\n]+)\*\*/g,r=0;for(let i of e.matchAll(n)){let n=e.slice(r,i.index);n&&t.push({kind:`text`,text:n}),t.push(i[3]?{kind:`code`,text:i[3]}:i[4]?{kind:`strong`,parts:cc(i[4])}:{kind:`link`,text:i[1]??``,href:(i[2]??``).replace(/^<|>$/g,``)}),r=(i.index??0)+i[0].length}let i=e.slice(r);return i&&t.push({kind:`text`,text:i}),t}function lc(e){let t=/(?::(\d+)(?::\d+)?|#L(\d+)(?:C\d+)?)$/.exec(e);if(!t)return{path:e};let n=Number(t[1]??t[2]);return{path:e.slice(0,t.index),...Number.isSafeInteger(n)&&n>0?{line:n}:{}}}function uc(e,t=!0){let n;try{n=t?decodeURIComponent(e):e}catch{return null}if(n.startsWith(`file://`))try{let e=new URL(n);if(e.hostname&&e.hostname!==`localhost`)return null;n=decodeURIComponent(e.pathname+e.hash)}catch{return null}let r=lc(n);return n=r.path,/^[a-z][a-z\d+.-]*:/i.test(n)||n.startsWith(`//`)||/[\u0000-\u001f\\]/.test(n)||!n||n.startsWith(`#`)||n.includes(`?`)||n.includes(`#`)||!n.startsWith(`/`)&&!n.startsWith(`./`)&&!n.startsWith(`../`)&&!/\.[a-z\d]+$/i.test(n)?null:r}function dc(e,t=!0){return uc(e,t)?.path??null}var fc=/^(.*\.org)(?::\d+(?::\d+)?)?(?:#L\d+(?:C\d+)?)?$/;function pc(e){try{return decodeURIComponent(e)}catch{return null}}function mc(e){if(!e.startsWith(`/`)||e.includes(`\0`))return null;let t=[];for(let n of e.split(`/`))if(!(!n||n===`.`)){if(n===`..`){if(t.length===0)return null;t.pop();continue}t.push(n)}return t}function hc(e,t){let n=pc(e),r=pc(t),i=n?fc.exec(n):null;if(!i||!r)return null;let a=mc(i[1]??``),o=mc(r);if(!a||!o||a.length<=o.length||o.some((e,t)=>a[t]!==e))return null;let s=a.slice(o.length).join(`/`);return s.endsWith(`.org`)&&s!==`.org`?s:null}function gc(e){let t=pc(e);if(!t)return!1;let n=fc.exec(t);return!!(n&&mc(n[1]??``))}async function _c(e,t=globalThis.navigator?.clipboard,n=yc){if(!t)return vc(e,n);try{return await t.writeText(e),!0}catch{return vc(e,n)}}function vc(e,t){try{return t(e)}catch{return!1}}function yc(e){if(typeof document>`u`||!document.body)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;opacity:0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}var bc=q(`<a class="svelte-1im954t"> </a>`),xc=q(`<a target="_blank" rel="noreferrer" class="svelte-1im954t"> </a>`),Sc=q(`<code class="svelte-1im954t"> </code>`),Cc=q(`<strong class="svelte-1im954t"><!></strong>`),wc=q(`<time class="svelte-1im954t"> </time>`),Tc=q(`<span class="touch-unknown svelte-1im954t">time unknown</span>`),Ec=q(`<li class="svelte-1im954t"><code class="file-path svelte-1im954t"> </code> <span class="file-counts svelte-1im954t" aria-label="Line changes"><span class="additions svelte-1im954t"> </span> <span class="deletions svelte-1im954t"> </span></span> <!></li>`),Dc=q(`<details class="file-changes svelte-1im954t"><summary class="svelte-1im954t"> <span class="additions svelte-1im954t"> </span> <span class="deletions svelte-1im954t"> </span></summary> <section aria-label="Files changed"><ul class="svelte-1im954t"></ul></section></details>`),Oc=q(`<div class="code-block svelte-1im954t"><button class="code-copy svelte-1im954t" type="button" title="Copy code"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1im954t"><rect x="9" y="9" width="10" height="10" rx="2"></rect><path d="M15 9V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"></path></svg></button> <pre class="svelte-1im954t"><code class="svelte-1im954t"> </code></pre></div>`),kc=q(`<th scope="col" class="svelte-1im954t"><!></th>`),Ac=q(`<td class="svelte-1im954t"><!></td>`),jc=q(`<tr></tr>`),Mc=q(`<div class="table-scroll svelte-1im954t"><table class="svelte-1im954t"><thead><tr></tr></thead><tbody></tbody></table></div>`),Nc=q(`<h1 class="svelte-1im954t"><!></h1>`),Pc=q(`<h2 class="svelte-1im954t"><!></h2>`),Fc=q(`<h3 class="svelte-1im954t"><!></h3>`),Ic=q(`<h4 class="svelte-1im954t"><!></h4>`),Lc=q(`<h5 class="svelte-1im954t"><!></h5>`),Rc=q(`<h6 class="svelte-1im954t"><!></h6>`),zc=q(`<div class="svelte-1im954t"><!></div>`),Bc=q(`<li class="audit-incomplete svelte-1im954t" role="status">Earlier Autopilot audit entries are not shown; this timeline contains the retained recent
|
|
17
|
+
audit.</li>`),Vc=q(`<li class="svelte-1im954t"><time class="svelte-1im954t"> </time></li>`),Hc=q(`<details><summary class="svelte-1im954t"> </summary> <ul></ul></details>`),Uc=q(`<aside class="autopilot-audit svelte-1im954t" aria-label="Autopilot audit entry"><strong>Autopilot</strong> <!> <!></aside>`),Wc=q(`<time class="svelte-1im954t"> <!></time>`),Gc=q(`<div class="entry-heading svelte-1im954t"><strong>working</strong></div> <!> <!>`,1),Kc=q(`<section><!></section>`),qc=q(`<div class="entry-heading svelte-1im954t"><strong>prompt</strong> <!></div> <div class="entry-content svelte-1im954t"><!></div> <!> <!>`,1),Jc=q(`<div class="commentary-content live-commentary svelte-1im954t"><!></div>`),Yc=q(`<!> <!>`,1),Xc=q(`<button class="commentary-toggle svelte-1im954t" type="button"><span aria-hidden="true"> </span> commentary</button>`),Zc=q(`<div class="answer-history svelte-1im954t"><!></div>`),Qc=q(`<div class="commentary-content svelte-1im954t"><!></div>`),$c=q(`<section class="answer-turn svelte-1im954t"><div class="entry-heading svelte-1im954t"><strong> </strong> <!></div> <!> <!> <div class="entry-content svelte-1im954t"><!></div> <!></section>`),el=q(`<div class="entry-content svelte-1im954t"><!></div>`),tl=q(`<details><summary>commentary</summary> <!></details> <!>`,1),nl=q(`<section><div class="entry-heading svelte-1im954t"><strong> </strong> <!></div> <!> <!></section>`),rl=q(`<li><!></li>`),il=q(`<li class="interaction-only svelte-1im954t"><!></li>`),al=q(`<li class="progress-item svelte-1im954t"><section><!></section></li>`),ol=q(`<ol aria-label="Chat messages" class="svelte-1im954t"><!> <!> <!> <!></ol>`);function sl(e,t){$e(t,!0);let n=(e,r=b)=>{var i=Kr();Z(H(i),17,r,ei,(e,r)=>{var i=Kr(),a=H(i),o=e=>{var n=Kr(),i=H(n),a=e=>{var t=bc(),n=V(t,!0);P(t),W(()=>{Q(t,`href`,G(r).href),Y(n,G(r).text)}),K(`click`,t,e=>ce(e,G(r).href)),J(e,t)},o=L(()=>t.onopenorg&&gc(G(r).href)),s=e=>{var n=bc(),i=V(n,!0);P(n),W(()=>{Q(n,`href`,G(r).href),Y(i,G(r).text)}),K(`click`,n,e=>{e.preventDefault();let n=uc(G(r).href);n.line?t.onopenfile?.(n.path,n.line):t.onopenfile?.(n.path)}),J(e,n)},c=L(()=>t.onopenfile&&dc(G(r).href)),l=e=>{var t=xc(),n=V(t,!0);P(t),W(()=>{Q(t,`href`,G(r).href),Y(n,G(r).text)}),J(e,t)};X(i,e=>{G(o)?e(a):G(c)?e(s,1):e(l,-1)}),J(e,n)},s=e=>{var t=Sc(),n=V(t,!0);P(t),W(()=>Y(n,G(r).text)),J(e,t)},c=e=>{var t=Cc(),i=V(t);n(i,()=>G(r).parts),P(t),J(e,t)},l=e=>{var t=Gr();W(()=>Y(t,G(r).text)),J(e,t)};X(a,e=>{G(r).kind===`link`?e(o):G(r).kind===`code`?e(s,1):G(r).kind===`strong`?e(c,2):e(l,-1)}),J(e,i)}),J(e,i)},r=(e,t=b)=>{let n=L(()=>as(t())),r=L(()=>os(G(n)));var i=Kr(),a=H(i),o=e=>{var t=Dc(),i=V(t),a=V(i),o=U(a),s=V(o);P(o);var c=U(o,2),l=V(c);P(c),P(i);var u=U(i,2),d=V(u);Z(d,21,()=>G(n),e=>e.path,(e,t)=>{var n=Ec(),r=V(n),i=V(r,!0);P(r);var a=U(r,2),o=V(a),s=V(o);P(o);var c=U(o,2),l=V(c);P(c),P(a);var u=U(a,2),d=e=>{var n=wc(),r=V(n,!0);P(n),W((e,t)=>{Q(n,`datetime`,e),Y(r,t)},[()=>new Date(G(t).touchedAt).toISOString(),()=>ls(G(t).touchedAt,G(y))]),J(e,n)},f=e=>{J(e,Tc())};X(u,e=>{G(t).touchedAt===void 0?e(f,-1):e(d)}),P(n),W(()=>{Y(i,G(t).path),Y(s,`+${G(t).additions??`?`??``}`),Y(l,`−${G(t).deletions??`?`??``}`)}),J(e,n)}),P(d),P(u),P(t),W(()=>{Y(a,`${G(r).files??``}
|
|
18
|
+
${G(r).files===1?`file`:`files`} changed · `),Y(s,`+${G(r).additions??`?`??``}`),Y(l,`−${G(r).deletions??`?`??``}`)}),J(e,t)};X(a,e=>{G(n).length&&e(o)}),J(e,i)},i=(e,t=b)=>{var r=Kr();Z(H(r),17,()=>rc(t()),ei,(e,t)=>{var r=Kr(),i=H(r),a=e=>{var n=Oc(),r=V(n),i=U(r,2),a=V(i),o=V(a,!0);P(a),P(i),P(n),W(e=>{Q(r,`aria-label`,e),Y(o,G(t).text)},[()=>le(G(t).text)]),K(`click`,r,()=>void ue(G(t).text)),J(e,n)},o=e=>{var r=Mc(),i=V(r),a=V(i),o=V(a);Z(o,21,()=>G(t).headers,ei,(e,t)=>{var r=kc(),i=V(r);n(i,()=>G(t)),P(r),J(e,r)}),P(o),P(a);var s=U(a);Z(s,21,()=>G(t).rows,ei,(e,t)=>{var r=jc();Z(r,21,()=>G(t),ei,(e,t)=>{var r=Ac(),i=V(r);n(i,()=>G(t)),P(r),J(e,r)}),P(r),J(e,r)}),P(s),P(i),P(r),J(e,r)},s=e=>{var r=Kr(),i=H(r),a=e=>{var r=Nc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},o=e=>{var r=Pc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},s=e=>{var r=Fc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},c=e=>{var r=Ic(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},l=e=>{var r=Lc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},u=e=>{var r=Rc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)};X(i,e=>{G(t).level===1?e(a):G(t).level===2?e(o,1):G(t).level===3?e(s,2):G(t).level===4?e(c,3):G(t).level===5?e(l,4):e(u,-1)}),J(e,r)},c=e=>{var r=zc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)};X(i,e=>{G(t).kind===`code`?e(a):G(t).kind===`table`?e(o,1):G(t).kind===`heading`?e(s,2):e(c,-1)}),J(e,r)}),J(e,r)},a=$(t,`activeTurnId`,3,null),o=$(t,`autopilotAuditTruncated`,3,!1),s=$(t,`interactions`,19,()=>[]),c=$(t,`answers`,19,()=>({})),l=$(t,`submittedAnswers`,19,()=>({})),u=$(t,`clipboard`,19,()=>globalThis.navigator?.clipboard),d=$(t,`onanswer`,3,()=>{}),f=$(t,`onquiz`,3,()=>{}),p=$(t,`onpermission`,3,()=>{}),m=$(t,`ondecision`,3,()=>{}),h=$(t,`onretry`,3,()=>{}),g=$(t,`oncopyresult`,3,()=>{}),_=L(()=>nc(t.messages)),v=on({}),y=z(on(Date.now()));Gi(()=>{let e=globalThis.setInterval(()=>B(y,Date.now(),!0),1e3);return()=>globalThis.clearInterval(e)});let x=L(()=>G(_).filter(e=>e.kind===`user`)),S=L(()=>G(_).filter(e=>e.kind===`assistant`)),C=L(()=>G(S).at(-1)?.id),w=L(()=>s().filter(e=>!e.turnId||!G(x).some(t=>t.turnId===e.turnId)));function T(e){let t=G(x).findLast(t=>t.turnId&&t.turnId===e.turnId);if(t)return t.id;let n=e.occurredAt;if(n!==void 0){let e=G(x).findLast(e=>e.occurredAt!==void 0&&e.occurredAt<=n);if(e)return e.id}return G(x).at(-1)?.id??null}function E(e){return e.kind===`user`?s().filter(t=>T(t)===e.id):[]}function D(e){if(e.turnId){let t=G(S).findLast(t=>t.turnId===e.turnId);if(t)return t.id}return e.occurredAt===void 0?G(C)??null:G(S).find(t=>t.answer!==null&&t.occurredAt!==void 0&&t.occurredAt>=e.occurredAt)?.id??null}function ee(e){return e.kind===`assistant`?t.activities.filter(t=>D(t)===e.id):[]}function te(e){if(D(e))return null;if(e.turnId){let t=G(x).findLast(t=>t.turnId===e.turnId);if(t)return t.id}return e.occurredAt===void 0?null:G(x).findLast(t=>t.occurredAt!==void 0&&t.occurredAt<=e.occurredAt)?.id??null}function ne(e){return e.kind===`user`?t.activities.filter(t=>te(t)===e.id):[]}function re(){return t.activities.filter(e=>!D(e)&&!te(e))}let ie=L(re);function O(e){return e.filter(e=>!e.label.toLowerCase().replaceAll(` `,``).startsWith(`filechange`))}function ae(e){return!!(e.kind===`assistant`&&a()&&(e.turnId===a()||!e.turnId&&e.id===G(C)))}function oe(e){return!!(e.kind===`user`&&a()&&(e.turnId===a()||!e.turnId))}function se(e,t){return ss(G(_)[e-1]?.occurredAt,t)}function ce(e,n){!t.onopenorg||!gc(n)||(e.preventDefault(),t.onopenorg(n))}function le(e){return`Copy code block: ${(e.trim().split(`
|
|
19
|
+
`)[0]?.trim()||`empty block`).slice(0,48)}`}async function ue(e){g()(await _c(e,u()))}var k=ol(),de=V(k),fe=e=>{J(e,Bc())};X(de,e=>{o()&&e(fe)});var pe=U(de,2);Z(pe,19,()=>G(_),e=>e.id,(e,t,n)=>{var a=rl(),o=V(a),s=e=>{var n=Uc(),r=U(V(n)),i=U(r),a=e=>{var n=wc(),r=V(n,!0);P(n),W((e,t)=>{Q(n,`datetime`,e),Y(r,t)},[()=>new Date(G(t).occurredAt).toISOString(),()=>cs(G(t).occurredAt)]),J(e,n)};X(i,e=>{G(t).occurredAt&&e(a)});var o=U(i,2),s=e=>{var n=Hc(),r=V(n),i=V(r);P(r);var a=U(r,2);Z(a,21,()=>G(t).timestamps,e=>`${G(t).id}:${e}`,(e,t)=>{var n=Vc(),r=V(n),i=V(r,!0);P(r),P(n),W((e,t)=>{Q(r,`datetime`,e),Y(i,t)},[()=>new Date(G(t)).toISOString(),()=>cs(G(t))]),J(e,n)}),P(a),P(n),W(()=>Y(i,`Show ${G(t).count??``} timestamps`)),J(e,n)};X(o,e=>{G(t).count>1&&e(s)}),P(n),W(()=>Y(r,` ${G(t).text??``}${G(t).count>1?` · ${G(t).count} times`:``} `)),J(e,n)},u=e=>{let a=L(()=>ne(G(t)));var o=qc(),s=H(o),u=U(V(s),2),g=e=>{var r=Wc(),i=V(r),a=U(i),o=e=>{var r=Gr();W(e=>Y(r,`· ${e??``}`),[()=>se(G(n),G(t).occurredAt)]),J(e,r)},s=L(()=>se(G(n),G(t).occurredAt));X(a,e=>{G(s)&&e(o)}),P(r),W((e,t)=>{Q(r,`datetime`,e),Y(i,`${t??``} `)},[()=>new Date(G(t).occurredAt).toISOString(),()=>cs(G(t).occurredAt)]),J(e,r)};X(u,e=>{G(t).occurredAt&&e(g)}),P(s);var _=U(s,2),v=V(_);i(v,()=>G(t).text),P(_);var b=U(_,2);{let e=L(()=>E(G(t)));tc(b,{get interactions(){return G(e)},get answers(){return c()},get submittedAnswers(){return l()},get onanswer(){return d()},get onquiz(){return f()},get onpermission(){return p()},get ondecision(){return m()},get onretry(){return h()}})}var x=U(b,2),S=e=>{var n=Kc(),i=V(n),o=e=>{var t=Gc(),n=U(H(t),2);{let e=L(()=>O(G(a)));Ka(n,{get activities(){return G(e)},variant:`live`})}var i=U(n,2);r(i,()=>G(a)),J(e,t)},s=L(()=>oe(G(t))),c=e=>{bs(e,{get activities(){return G(a)},get now(){return G(y)}})};X(i,e=>{G(s)?e(o):e(c,-1)}),P(n),W(e=>Si(n,1,e,`svelte-1im954t`),[()=>gi(oe(G(t))?`progress-turn`:`orphan-activity-turn`)]),J(e,n)};X(x,e=>{G(a).length&&e(S)}),J(e,o)},g=e=>{let r=L(()=>ee(G(t)));var a=$c(),o=V(a),s=V(o),c=V(s,!0);P(s);var l=U(s,2),u=e=>{var r=Wc(),i=V(r),a=U(i),o=e=>{var r=Gr();W(e=>Y(r,`· ${e??``}`),[()=>se(G(n),G(t).occurredAt)]),J(e,r)},s=L(()=>se(G(n),G(t).occurredAt));X(a,e=>{G(s)&&e(o)}),P(r),W((e,t)=>{Q(r,`datetime`,e),Y(i,`${t??``} `)},[()=>new Date(G(t).occurredAt).toISOString(),()=>cs(G(t).occurredAt)]),J(e,r)};X(l,e=>{G(t).occurredAt&&e(u)}),P(o);var d=U(o,2),f=e=>{var n=Yc(),a=H(n),o=e=>{var n=Jc(),r=V(n);i(r,()=>G(t).commentary),P(n),J(e,n)};X(a,e=>{G(t).commentary&&e(o)});var s=U(a,2);{let e=L(()=>O(G(r)));Ka(s,{get activities(){return G(e)},variant:`live`})}J(e,n)},p=L(()=>ae(G(t))),m=e=>{var n=Zc(),r=V(n),i=e=>{var n=Xc(),r=V(n),i=V(r,!0);P(r),Ue(),P(n),W(e=>{Q(n,`aria-expanded`,e),Q(n,`aria-controls`,`commentary-${G(t).id}`),Y(i,v[G(t).id]?`⌄`:`›`)},[()=>!!v[G(t).id]]),K(`click`,n,()=>v[G(t).id]=!v[G(t).id]),J(e,n)};X(r,e=>{G(t).commentary&&e(i)}),P(n),J(e,n)},h=L(()=>G(t).commentary||O(G(r)).length);X(d,e=>{G(p)?e(f):G(h)&&e(m,1)});var g=U(d,2),_=e=>{var n=Qc(),r=V(n);i(r,()=>G(t).commentary),P(n),W(()=>Q(n,`id`,`commentary-${G(t).id}`)),J(e,n)},b=L(()=>!ae(G(t))&&G(t).commentary&&v[G(t).id]);X(g,e=>{G(b)&&e(_)});var x=U(g,2),S=V(x);i(S,()=>G(t).answer),P(x),bs(U(x,2),{get activities(){return G(r)},get now(){return G(y)}}),P(a),W(e=>Y(c,e),[()=>ae(G(t))?`working`:`answer`]),J(e,a)},_=e=>{let a=L(()=>ee(G(t)));var o=nl(),s=V(o),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=e=>{var r=Wc(),i=V(r),a=U(i),o=e=>{var r=Gr();W(e=>Y(r,`· ${e??``}`),[()=>se(G(n),G(t).occurredAt)]),J(e,r)},s=L(()=>se(G(n),G(t).occurredAt));X(a,e=>{G(s)&&e(o)}),P(r),W((e,t)=>{Q(r,`datetime`,e),Y(i,`${t??``} `)},[()=>new Date(G(t).occurredAt).toISOString(),()=>cs(G(t).occurredAt)]),J(e,r)};X(u,e=>{G(t).occurredAt&&e(d)}),P(s);var f=U(s,2),p=e=>{var n=Yc(),r=H(n),o=e=>{var n=el(),r=V(n);i(r,()=>G(t).commentary),P(n),J(e,n)};X(r,e=>{G(t).commentary&&e(o)});var s=U(r,2);{let e=L(()=>O(G(a)));Ka(s,{get activities(){return G(e)},variant:`live`})}J(e,n)},m=L(()=>ae(G(t))),h=e=>{var n=tl(),r=H(n),o=U(V(r),2);i(o,()=>G(t).commentary),P(r),bs(U(r,2),{get activities(){return G(a)},get now(){return G(y)}}),J(e,n)};X(f,e=>{G(m)?e(p):e(h,-1)});var g=U(f,2),_=e=>{r(e,()=>G(a))},v=L(()=>ae(G(t)));X(g,e=>{G(v)&&e(_)}),P(o),W((e,t)=>{Si(o,1,e,`svelte-1im954t`),Y(l,t)},[()=>gi(ae(G(t))?`progress-turn`:`commentary-turn`),()=>ae(G(t))?`working`:`commentary`]),J(e,o)};X(o,e=>{G(t).kind===`audit`?e(s):G(t).kind===`user`?e(u,1):G(t).answer===null?G(t).commentary!==null&&e(_,3):e(g,2)}),P(a),W(()=>Si(a,1,gi(G(t).kind===`user`?`prompt-turn`:G(t).kind===`audit`?`audit-item`:`answer-item`),`svelte-1im954t`)),J(e,a)});var me=U(pe,2),he=e=>{var t=il();tc(V(t),{get interactions(){return G(w)},get answers(){return c()},get submittedAnswers(){return l()},get onanswer(){return d()},get onquiz(){return f()},get onpermission(){return p()},get ondecision(){return m()},get onretry(){return h()}}),P(t),J(e,t)};X(me,e=>{G(x).length===0&&G(w).length&&e(he)});var ge=U(me,2),_e=e=>{var t=al(),n=V(t),i=V(n),o=e=>{var t=Gc(),n=U(H(t),2);{let e=L(()=>O(G(ie)));Ka(n,{get activities(){return G(e)},variant:`live`})}var i=U(n,2);r(i,()=>G(ie)),J(e,t)},s=e=>{bs(e,{get activities(){return G(ie)},get now(){return G(y)}})};X(i,e=>{a()?e(o):e(s,-1)}),P(n),P(t),W(()=>Si(n,1,gi(a()?`progress-turn`:`orphan-activity-turn`),`svelte-1im954t`)),J(e,t)};X(ge,e=>{G(ie).length&&e(_e)}),P(k),J(e,k),et()}Rr([`click`]);var cl=[150,300,600];function ll(e){return new Promise(t=>setTimeout(t,e))}function ul(e){return e.status===502||e.status===503||e.status===504}async function dl(e=fetch){for(let t=0;t<=cl.length;t+=1){let n;try{n=await e(`/api/bootstrap`)}catch(e){if(e instanceof Error&&e.name===`AbortError`)throw e;if(t===cl.length)throw Error(`BOOTSTRAP_FAILED`);await ll(cl[t]);continue}if(n.ok)return n.json();if(!ul(n)||t===cl.length)throw Error(`BOOTSTRAP_FAILED`);await ll(cl[t])}throw Error(`BOOTSTRAP_FAILED`)}var fl=`gestalt-mobile`,pl=2,ml=[`settings`,`drafts`,`cursors`,`messages`];function hl(e){return new Promise((t,n)=>{let r=e.open(fl,pl);r.onupgradeneeded=()=>{for(let e of ml)r.result.objectStoreNames.contains(e)||r.result.createObjectStore(e)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}function gl(e,t,n){return yl(e.transaction(t,`readonly`).objectStore(t).get(n))}function _l(e,t,n,r){return yl(e.transaction(t,`readwrite`).objectStore(t).put(r,n))}function vl(e,t,n){return yl(e.transaction(t,`readwrite`).objectStore(t).delete(n))}function yl(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var bl=`chat-projections`,xl=e=>({version:1,cursor:e.cursor,lifecycle:e.lifecycle,activeTurnId:e.activeTurnId,messages:e.messages.filter(e=>e.role===`user`).slice(-200),activities:[],prompts:e.prompts.slice(-200),interactions:e.interactions.map(({requestId:e,key:t,kind:n,turnId:r,state:i,operationId:a,attemptedOutcome:o})=>({requestId:e,key:t,kind:n,...r?{turnId:r}:{},state:i,...a?{operationId:a}:{},...i===`resolved`&&(o===`approved`||o===`denied`||o===`answered`||o===`dismissed`)?{attemptedOutcome:o}:{},...typeof o==`object`&&o&&(o.decision===`accept`||o.decision===`decline`)?{attemptedOutcome:{decision:o.decision}}:{}})).slice(-200),buffered:[]});function Sl(e=globalThis.indexedDB){if(!e)return{read:async()=>null,write:async()=>{}};let t=hl(e);return{read:async e=>{try{return await gl(await t,bl,e)}catch{return null}},write:async(e,n)=>{try{await _l(await t,bl,e,xl(n))}catch{}}}}var Cl=`chat-session`;function wl(e){return new URLSearchParams(e).get(`chat-session`)?.trim()||null}function Tl(e,t){let n=new URL(e);return n.search=``,n.hash=``,n.searchParams.set(Cl,t),n.toString()}function El(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`gestalt-chat-${(t>>>0).toString(36)}`}function Dl(e,t){if(e===`autopilot.turn-started`)return`Continued execution automatically`;if(e===`autopilot.final-rejected`)return`Kept incomplete supervised work active`;if(e===`autopilot.executor-resumed`)return`Resumed the assigned executor`;if(e===`autopilot.process-monitoring`)return`Monitoring executor background work`;if(e===`autopilot.process-result-consumed`)return`Consumed background work result`;if(e===`autopilot.process-terminated`)return Ol(t,`reason`)===`resourceBudget`?`Stopped background work at its resource limit`:`Stopped executor background work`;if(e===`autopilot.turn-failed`)return Ol(t,`code`)===`START_UNAVAILABLE`?`Automatic continuation could not start: session runtime unavailable`:`Automatic continuation failed`;if(e===`org-plan.attention-required`)return`Needs attention`;if(e===`org-plan.attention-resolved`)return Ol(t,`outcome`)===`failed`?`Attention resolution failed`:`Attention resolved`;if(e!==`autopilot.updated`)return null;let n=Ol(t,`state`),r=Ol(t,`reason`);return n===`completed`?`Completed the supervised plan`:n===`attentionRequired`&&r===`noPlanProgress`?`Automatic continuation stopped: no agent progress`:n===`attentionRequired`&&r===`reconcileFailed`?`Automatic continuation stopped: agent status unavailable`:n===`attentionRequired`&&r===`actionRateExceeded`?`Automatic continuation stopped: too many automatic actions`:null}function Ol(e,t){return e&&typeof e==`object`?e[t]:void 0}function kl(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0?[{path:t.path,additions:t.additions,deletions:t.deletions}]:[]}):[]}function Al(e){if(typeof e.id!=`string`)return null;let t={...typeof e.turnId==`string`?{turnId:e.turnId}:{},...typeof e.actorTurnId==`string`?{actorTurnId:e.actorTurnId}:{},...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{}};if(e.kind===`reasoning`&&Array.isArray(e.summary)){let n=e.summary.filter(e=>typeof e==`string`).join(`
|
|
20
|
+
`);return n?{id:e.id,label:`Reasoning summary`,detail:n,...t}:null}if(e.kind===`plan`&&typeof e.text==`string`)return{id:e.id,label:`Plan`,detail:e.text,...t};if(e.kind===`command`&&typeof e.command==`string`)return{id:e.id,label:`Command · ${String(e.status??`unknown`)}`,detail:e.command,...t};if(e.kind===`fileChange`&&Array.isArray(e.paths)){let n=kl(e.changes);return{id:e.id,label:`File change · ${String(e.status??`unknown`)}`,detail:e.paths.join(`
|
|
21
|
+
`),...n.length?{changes:n}:{},...t}}return e.kind===`tool`&&typeof e.name==`string`?{id:e.id,label:`Tool · ${String(e.status??`unknown`)}`,detail:e.name,...t}:null}var jl=()=>({sessionId:null,cursor:0,snapshotting:!1,lifecycle:`finished`,activeTurnId:null,messages:[],activities:[],prompts:[],interactions:[],autopilotAuditTruncated:!1,buffered:new Map}),Ml=(e=null)=>({...jl(),sessionId:e});function Nl(e){return e.kind===`autopilot`?{id:`item:${e.id}`,role:`audit`,text:`Continued execution automatically`,...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{},...typeof e.controlId==`string`?{controlId:e.controlId}:{},complete:!0}:e.kind!==`user`&&e.kind!==`agent`||typeof e.text!=`string`?null:{id:`item:${e.id}`,role:e.kind===`user`?`user`:`assistant`,text:e.text,...e.phase===`commentary`||e.phase===`final_answer`?{phase:e.phase}:{},...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{},...typeof e.turnId==`string`?{turnId:e.turnId}:{},complete:!0}}function Pl(e){return{id:e.id,role:`audit`,text:e.label,occurredAt:e.occurredAt,...e.controlId?{controlId:e.controlId}:{},complete:!0}}function Fl(e){let t=Il(e.occurredAt),n=Dl(e.type,e.payload),r=e.payload&&typeof e.payload==`object`&&typeof e.payload.controlId==`string`?e.payload.controlId:void 0;return n&&t!==void 0?Pl({id:`audit:${e.sequence}`,label:n,occurredAt:t,...r?{controlId:r}:{}}):null}function Il(e){if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Ll(e){let t=Il(e.requestedAt);return{requestId:e.requestId,key:`interaction:${e.requestId}`,kind:e.kind,turnId:e.turnId,payload:`payload`in e?e.payload:null,state:e.resolvedAt?e.outcome===`failed`?`failed`:`resolved`:`pending`,...e.resolvedAt?{attemptedOutcome:e.outcome}:{},...t===void 0?{}:{occurredAt:t}}}function Rl(e,t){return t===`approved`||t===`denied`||t===`answered`||t===`dismissed`||t===`failed`?t:e?.kind===`quiz`||e?.kind===`userInput`?`answered`:typeof t==`object`&&t&&t.decision===`decline`?`denied`:e?`approved`:void 0}function zl(e,t){return e?t===`finished`||t===`interrupted`?t:`working`:t===`working`||t===`starting`||t===`recoverable`?`finished`:t}function Bl(e){return[...new Map(e.map(e=>[e.key??e.id??``,e])).values()]}function Vl(e,t){return e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?{...t,...t.occurredAt===void 0&&e.occurredAt!==void 0?{occurredAt:e.occurredAt}:{}}:e):[...e,t]}function Hl(e,t,n){let r=new Map(n.map(e=>[e.id,e])),i=new Map(n.map((e,t)=>[e.id,t])),a=new Set(t.filter(e=>e.state!==`canonical`).map(e=>e.operationId)),o=new Set,s=e.flatMap(e=>{let i=Nl(e);if(!i)return[];if(e.kind===`user`){let n=t.find(t=>typeof e.operationId==`string`&&e.operationId===t.operationId||typeof e.turnId==`string`&&e.turnId===t.turnId),s=!n&&t.filter(t=>t.state!==`canonical`&&t.text===e.text).length===1?t.find(t=>t.state!==`canonical`&&t.text===e.text):void 0,c=n??s;if(c){a.delete(c.operationId);let e=r.get(c.key),t={...i,id:c.key,turnId:c.turnId??i.turnId,...i.occurredAt===void 0&&e?.occurredAt!==void 0?{occurredAt:e.occurredAt}:{}};return o.add(t.id),[e&&e.text===t.text&&e.turnId===t.turnId&&e.complete===t.complete&&e.occurredAt===t.occurredAt?e:t]}}if(e.kind===`agent`&&typeof e.turnId==`string`){let t=r.get(`assistant:${e.id}`)??n.find(t=>t.role===`assistant`&&t.turnId===e.turnId&&t.text===i.text&&(t.phase===i.phase||!t.complete));if(t){o.add(t.id);let e={...i,id:t.id,turnId:i.turnId??t.turnId,...i.occurredAt===void 0&&t.occurredAt!==void 0?{occurredAt:t.occurredAt}:{}};return[t.text===e.text&&t.phase===e.phase&&t.occurredAt===e.occurredAt?t:e]}}return o.add(i.id),[i]}),c=t.filter(e=>a.has(e.operationId)).map(e=>r.get(e.key)??{id:e.key,role:`user`,text:e.text,complete:e.state===`failed`,...e.turnId?{turnId:e.turnId}:{}}),l=n.filter(e=>e.role===`assistant`&&e.id.startsWith(`assistant:`)&&!o.has(e.id)),u=Bl([...c,...l]),d=new Map(s.map((e,t)=>[e.id,t])),f=new Map;for(let e of u){let t=null;if(e.turnId){for(let n=s.length-1;n>=0;--n)if(s[n]?.turnId===e.turnId){t=n;break}}if(t===null){let r=i.get(e.id);if(r!==void 0){for(let e=r-1;e>=0;--e){let r=d.get(n[e].id);if(r!==void 0){t=r;break}}if(t===null)for(let e=r+1;e<n.length;e+=1){let r=d.get(n[e].id);if(r!==void 0){t=r-1;break}}}}let r=t??s.length-1;f.set(r,[...f.get(r)??[],e])}return Bl([...f.get(-1)??[],...s.flatMap((e,t)=>[e,...f.get(t)??[]])])}function Ul(e,t){if(!t||typeof t!=`object`)return Ml(e);let n=t;if(!Number.isInteger(n.cursor)||n.cursor<0||!Array.isArray(n.messages)||!Array.isArray(n.prompts)||!Array.isArray(n.interactions))return Ml(e);let r=[`submitting`,`accepted`,`failed`,`canonical`],i=[`pending`,`submitting`,`resolved`,`failed`],a=[`starting`,`working`,`finished`,`interrupted`,`recoverable`];return{...Ml(e),sessionId:e,cursor:n.cursor,lifecycle:a.includes(n.lifecycle)?n.lifecycle:`finished`,activeTurnId:typeof n.activeTurnId==`string`||n.activeTurnId===null?n.activeTurnId:null,snapshotting:!1,buffered:new Map,messages:n.messages.filter(e=>!!(e&&typeof e.id==`string`&&(e.role===`user`||e.role===`assistant`||e.role===`audit`)&&typeof e.text==`string`&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200),activities:Array.isArray(n.activities)?n.activities.filter(e=>!!(e&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0}))&&(e.turnId===void 0||typeof e.turnId==`string`))).slice(-200):[],prompts:n.prompts.filter(e=>!!(e&&typeof e.operationId==`string`&&typeof e.key==`string`&&typeof e.text==`string`&&r.includes(e.state)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200),interactions:n.interactions.filter(e=>!!(e&&typeof e.requestId==`string`&&typeof e.key==`string`&&typeof e.kind==`string`&&(e.turnId===void 0||e.turnId===null||typeof e.turnId==`string`)&&i.includes(e.state)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200)}}function Wl(e,t){if(!Number.isInteger(t.baseSequence)||t.baseSequence<0)return e;if(t.baseSequence<e.cursor)return nu({...e,snapshotting:!1});let n=t.items.filter(e=>e.kind===`user`),r=e.prompts.map(t=>{let r=n.some(e=>typeof e.turnId==`string`&&e.turnId===t.turnId||typeof e.operationId==`string`&&e.operationId===t.operationId),i=n.filter(e=>e.text===t.text),a=!t.turnId&&i.length===1&&e.prompts.filter(e=>e.state!==`canonical`&&e.text===t.text).length===1;return r||a?{...t,state:`canonical`}:t}),i=t.interactions.map(Ll),a=new Map(e.interactions.map(e=>[e.requestId,e])),o=Bl(i.map(e=>{let t=a.get(e.requestId);return t?.state===`resolved`?t:{...e,...e.occurredAt===void 0&&t?.occurredAt!==void 0?{occurredAt:t.occurredAt}:{}}})),s=Bl(t.items.flatMap(e=>{let t=Al(e);return t?[{...t,key:`activity:${t.id}`}]:[]}).concat((t.activities??[]).map(e=>({...e,key:`activity:${e.id}`})))).map(e=>({id:e.id,label:e.label,detail:e.detail,...e.turnId?{turnId:e.turnId}:{},...e.actorTurnId?{actorTurnId:e.actorTurnId}:{},...e.occurredAt===void 0?{}:{occurredAt:e.occurredAt},...e.changes?{changes:e.changes}:{}})).reduce(Vl,[...e.activities]),c=new Map(t.turns.map(e=>[e.id,e])),l=t.items.map(e=>{if(typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt))return e;let t=typeof e.turnId==`string`?c.get(e.turnId):void 0,n=e.kind===`agent`?t?.completedAt??t?.startedAt:t?.startedAt??t?.completedAt;return typeof n==`number`&&Number.isFinite(n)?{...e,occurredAt:n}:e}),u=(t.autopilotAudit??[]).filter(e=>typeof e?.id==`string`&&typeof e.label==`string`&&typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),d={...e,cursor:Math.max(e.cursor,t.baseSequence),snapshotting:!1,activeTurnId:t.activeTurnId,lifecycle:zl(t.activeTurnId,e.cursor===0&&e.lifecycle===`finished`?`working`:e.lifecycle),prompts:r,messages:Bl(Hl(l,r,e.messages).concat(u.map(Pl))).sort((e,t)=>(e.occurredAt??2**53-1)-(t.occurredAt??2**53-1)),activities:s,interactions:o,autopilotAuditTruncated:t.autopilotAuditTruncated===!0,buffered:new Map([...e.buffered].filter(([e])=>e>t.baseSequence))};return nu({...d,messages:Gl(d.messages)})}function Gl(e){let t=new Set;return e.filter(e=>e.role!==`audit`||!e.controlId?!0:t.has(e.controlId)?!1:(t.add(e.controlId),!0))}function Kl(e){return{...e,snapshotting:!0}}function ql(e,t,n,r){if(!n.trim()||e.prompts.some(e=>e.operationId===t))return e;let i={operationId:t,key:`prompt:${t}`,text:n,state:`submitting`,turnId:null,...typeof r==`number`&&Number.isFinite(r)?{occurredAt:r}:{}};return{...e,lifecycle:`starting`,prompts:[...e.prompts,i],messages:[...e.messages,{id:i.key,role:`user`,text:n,...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt},complete:!1}]}}function Jl(e,t,n,r){let i=ql(e,t,n,r);return i===e?e:{...i,lifecycle:`working`}}function Yl(e,t,n){return{...e,activeTurnId:n??e.activeTurnId,lifecycle:n?`working`:e.lifecycle,prompts:e.prompts.map(e=>e.operationId===t?{...e,state:`accepted`,turnId:n}:e),messages:e.messages.map(e=>e.id===`prompt:${t}`?{...e,complete:!0,...n?{turnId:n}:{}}:e)}}function Xl(e,t){return{...e,lifecycle:`recoverable`,prompts:e.prompts.map(e=>e.operationId===t?{...e,state:`failed`}:e),messages:e.messages.map(e=>e.id===`prompt:${t}`?{...e,complete:!0}:e)}}function Zl(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&(e.state===`pending`||e.state===`failed`)?{...e,state:`submitting`,...n?{operationId:n}:{}}:e)}}function Ql(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&e.state!==`resolved`?{...e,state:`failed`,attemptedOutcome:n}:e)}}function $l(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t?{...e,state:`resolved`,...Rl(e,n)?{attemptedOutcome:Rl(e,n)}:{}}:e)}}function eu(e,t){if(!Number.isInteger(t.sequence)||t.sequence<=e.cursor)return e;if(e.snapshotting||t.sequence>e.cursor+1){let n=new Map(e.buffered);return n.set(t.sequence,t),{...e,snapshotting:!0,buffered:n}}let n={...e,cursor:t.sequence},r=t.payload,i=Il(t.occurredAt);if(t.type===`agentMessageDelta`&&typeof r?.text==`string`){let e=typeof r.turnId==`string`?r.turnId:n.activeTurnId??void 0,t=`assistant:${typeof r.itemId==`string`?r.itemId:e??`live`}`,a=n.messages.find(e=>e.id===t);n={...n,lifecycle:n.activeTurnId?`working`:n.lifecycle,messages:a?n.messages.map(e=>e.id===t?{...e,text:e.text+r.text,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:{},complete:r.phase===`final_answer`||e.complete,...e.occurredAt===void 0&&i!==void 0?{occurredAt:i}:{}}:e):[...n.messages,{id:t,role:`assistant`,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:{},text:r.text,...e?{turnId:e}:{},...i===void 0?{}:{occurredAt:i},complete:r.phase===`final_answer`}]}}else if((t.type===`agentMessageStarted`||t.type===`agentMessageCompleted`)&&typeof r.text==`string`){let e=`assistant:${typeof r.itemId==`string`?r.itemId:n.activeTurnId??`live`}`,a=n.messages.find(t=>t.id===e),o=t.type===`agentMessageCompleted`,s={id:e,role:`assistant`,text:o&&r.text?r.text:a?.text??r.text,complete:o,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:a?.phase?{phase:a.phase}:{},...typeof r.turnId==`string`?{turnId:r.turnId}:a?.turnId?{turnId:a.turnId}:n.activeTurnId?{turnId:n.activeTurnId}:{},...a?.occurredAt===void 0?i===void 0?{}:{occurredAt:i}:{occurredAt:a.occurredAt}};n={...n,lifecycle:n.activeTurnId?`working`:n.lifecycle,messages:a?n.messages.map(t=>t.id===e?s:t):[...n.messages,s]}}else if(t.type===`turnCompleted`||t.type===`turnInterrupted`)n={...n,activeTurnId:null,lifecycle:t.type===`turnCompleted`||n.lifecycle===`finished`?`finished`:`interrupted`,messages:n.messages.map(e=>e.role===`assistant`?{...e,complete:!0}:e)};else if(t.type===`interaction.requested`&&typeof r?.requestId==`string`&&typeof r.kind==`string`){let e=n.interactions.find(e=>e.requestId===r.requestId);if(!e||e.state===`resolved`){let t={requestId:r.requestId,key:`interaction:${r.requestId}`,kind:r.kind,turnId:typeof r.turnId==`string`?r.turnId:n.activeTurnId,payload:r.payload,state:`pending`,...i===void 0?{}:{occurredAt:i}};n={...n,interactions:e?n.interactions.map(e=>e.requestId===r.requestId?t:e):[...n.interactions,t]}}}else if(t.type===`interaction.resolved`&&typeof r?.requestId==`string`)n=$l(n,r.requestId,r.outcome);else if(t.type===`activity.updated`&&typeof r?.id==`string`&&typeof r.label==`string`&&typeof r.detail==`string`){let e=tu(r.changes);n={...n,activities:Vl(n.activities,{id:r.id,label:r.label,detail:r.detail,...i===void 0?{}:{occurredAt:i},...e.length?{changes:e}:{},...typeof r.turnId==`string`?{turnId:r.turnId}:n.activeTurnId?{turnId:n.activeTurnId}:{},...typeof r.actorTurnId==`string`?{actorTurnId:r.actorTurnId}:{}})}}else if(t.type===`session.updated`&&r?.activeTurnId!==void 0){let e=typeof r.activeTurnId==`string`?r.activeTurnId:null;n={...n,activeTurnId:e,lifecycle:e?`working`:zl(e,n.lifecycle)}}let a=Fl(t);return a&&!n.messages.some(e=>e.id===a.id)&&(n={...n,messages:Gl([...n.messages,a])}),n}function tu(e){return!Array.isArray(e)||e.length>1e3?[]:e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0?[{path:t.path,additions:t.additions,deletions:t.deletions}]:[]})}function nu(e){let t=new Map(e.buffered),n={...e,snapshotting:!1,buffered:t};for(;;){let e=t.get(n.cursor+1);if(!e)return{...n,buffered:t,snapshotting:t.size>0};t.delete(e.sequence),n=eu({...n,buffered:t},e),t=new Map(n.buffered)}}function ru(e){return e.sessionId?e.snapshotting||e.lifecycle===`recoverable`?`Connection interrupted. Reconnecting…`:e.lifecycle===`starting`?`Starting Codex turn…`:e.lifecycle===`working`?`Codex is working…`:e.lifecycle===`interrupted`?`Codex turn interrupted.`:`Ready.`:`Choose a workspace and start a session.`}var iu={read:async()=>null,write:async()=>{}},au=[250,750,1500],ou=e=>!!e&&typeof e==`object`,su=e=>ou(e)&&typeof e.path==`string`&&Number.isInteger(e.additions)&&e.additions>=0&&Number.isInteger(e.deletions)&&e.deletions>=0,cu=e=>ou(e)&&typeof e.id==`string`&&typeof e.kind==`string`,lu=e=>ou(e)&&typeof e.id==`string`&&Array.isArray(e.items)&&e.items.every(cu)&&(e.startedAt===null||typeof e.startedAt==`number`)&&(e.completedAt===null||typeof e.completedAt==`number`),uu=e=>!ou(e)||typeof e.requestId!=`string`||typeof e.kind!=`string`||!(e.turnId===null||typeof e.turnId==`string`)||!(e.requestedAt===null||typeof e.requestedAt==`string`)?!1:e.resolvedAt===null?Object.hasOwn(e,`payload`):typeof e.resolvedAt==`string`&&(e.outcome===`approved`||e.outcome===`denied`||e.outcome===`answered`||e.outcome===`dismissed`||e.outcome===`failed`)&&!Object.hasOwn(e,`payload`),du=e=>ou(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)&&(e.controlId===void 0||typeof e.controlId==`string`),fu=e=>ou(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(su))&&(e.turnId===void 0||typeof e.turnId==`string`)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),pu=e=>!ou(e)||!Number.isInteger(e.baseSequence)||e.baseSequence<0||!(e.activeTurnId===null||typeof e.activeTurnId==`string`)||!Array.isArray(e.items)||!Array.isArray(e.turns)||!Array.isArray(e.interactions)||!e.items.every(cu)||!e.turns.every(lu)||!e.interactions.every(uu)||e.activities!==void 0&&(!Array.isArray(e.activities)||!e.activities.every(fu))||e.autopilotAudit!==void 0&&(!Array.isArray(e.autopilotAudit)||!e.autopilotAudit.every(du))||e.autopilotAuditTruncated!==void 0&&typeof e.autopilotAuditTruncated!=`boolean`||e.currentSequence!==void 0&&(!Number.isInteger(e.currentSequence)||e.currentSequence<0)?null:e,mu=class{#e=Ml();#t=null;#n=0;#r=-1;#i=null;#a=null;#o=null;#s=0;#c=!1;#l=!1;#u=new Set;#d=null;#f=0;#p=!1;#m=new Set;#h=new Set;#g;constructor(e){this.#g={...e,websocket:e.websocket??(e=>new WebSocket(e)),cache:e.cache??iu,location:e.location??location,document:e.document??document,window:e.window??window,setTimeout:e.setTimeout??((e,t)=>setTimeout(e,t)),clearTimeout:e.clearTimeout??(e=>clearTimeout(e)),createKey:e.createKey??po,now:e.now??Date.now},this.#g.document.addEventListener(`visibilitychange`,this.#_),this.#g.window.addEventListener(`focus`,this.#_)}get view(){return Object.freeze({...this.#e,status:ru(this.#e),starting:this.#e.lifecycle===`starting`,newEmpty:this.#l&&!hu(this.#e)})}canSubmit(e){return this.#t?e===`send`?!this.#e.activeTurnId:!!(this.#e.activeTurnId&&(e!==`queue`||this.#g.relay.queueTurnInput)):!1}select(e,t={}){if(this.#p||this.#t===e)return;this.#j(),this.#t=e,e&&t.history===`empty`&&this.#u.add(e),this.#l=e!==null&&this.#u.has(e);let n=++this.#n;this.#e=Ml(e),this.#E(),e&&this.#v(e,n)}async send(e,t=this.#g.createKey()){let n=this.#t,r=this.#n,i=`${n}:${r}:${t}`;if(!(!n||!e.trim()||this.#e.activeTurnId||this.#m.has(i))){this.#m.add(i),this.#T(ql(this.#e,t,e.trim(),this.#g.now()));try{let i=await this.#g.relay.startTurn(n,e.trim(),t);this.#O(n,r)&&(this.#D(n),this.#T(Yl(this.#e,t,i.activeTurnId??null))),this.#g.onSendAccepted?.(n,t)}catch(e){this.#O(n,r)&&(this.#T(Xl(this.#e,t)),this.#g.onSendError?.(e,t))}finally{this.#m.delete(i)}}}async retryPrompt(e){let t=this.#e.prompts.find(t=>t.operationId===e);t?.state===`failed`&&await this.send(t.text,e)}async queue(e,t=this.#g.createKey()){let n=this.#t,r=this.#e.activeTurnId,i=this.#g.relay.queueTurnInput,a=this.#n,o=`${n}:${a}:${t}`;if(!(!n||!r||!i||!e.trim()||this.#m.has(o))){this.#m.add(o),this.#T(Jl(this.#e,t,e.trim(),this.#g.now()));try{let o=await i(n,r,e.trim(),t);this.#O(n,a)&&this.#T(Yl(this.#e,t,o.activeTurnId)),this.#g.onSendAccepted?.(n,t)}catch(e){this.#O(n,a)&&(this.#T(Xl(this.#e,t)),this.#g.onSendError?.(e,t))}finally{this.#m.delete(o)}}}async interruptAndSend(e,t=this.#g.createKey()){let n=this.#t,r=this.#e.activeTurnId,i=this.#n,a=`${n}:${i}:${t}`;if(!(!n||!r||!e.trim()||this.#m.has(a))){this.#m.add(a),this.#T(ql(this.#e,t,e.trim(),this.#g.now()));try{await this.#g.relay.interruptTurn(n,r).catch(()=>void 0);let a=await this.#k(n,i,e.trim(),t);this.#O(n,i)&&this.#T(Yl(this.#e,t,a.activeTurnId??null)),this.#g.onSendAccepted?.(n,t)}catch(e){this.#O(n,i)&&(this.#T(Xl(this.#e,t)),this.#g.onSendError?.(e,t))}finally{this.#m.delete(a)}}}async interrupt(){let e=this.#t,t=this.#e.activeTurnId;if(!(!e||!t))try{await this.#g.relay.interruptTurn(e,t)}catch{}}async respond(e,t,n=this.#g.createKey()){let r=this.#t,i=this.#n,a=this.#e.interactions.find(t=>t.requestId===e),o=a?.operationId??n,s=`${r}:${i}:${o}`;if(!(!r||!a||a.state===`resolved`||a.state===`submitting`||this.#h.has(s))){this.#h.add(s),this.#T(Zl(this.#e,e,o));try{let n=await this.#g.relay.respondInteraction(r,e,t,o),a=n&&(n.outcome===`approved`||n.outcome===`denied`||n.outcome===`answered`||n.outcome===`dismissed`||n.outcome===`failed`)?n.outcome:t;this.#O(r,i)&&this.#T($l(this.#e,e,a))}catch{this.#O(r,i)&&this.#T(Ql(this.#e,e,t))}finally{this.#h.delete(s)}}}async retryInteraction(e,t){let n=this.#e.interactions.find(t=>t.requestId===e);if(n?.state!==`failed`||!n.operationId)return;let r=t??n.attemptedOutcome,i=r===`approved`?{decision:`accept`}:r===`denied`?{decision:`decline`}:r;i!==void 0&&await this.respond(e,i,n.operationId)}refresh(){this.#t&&!this.#l&&this.#S(this.#t,this.#n)}dispose(){this.#p||(this.#p=!0,this.#j(),this.#g.document.removeEventListener(`visibilitychange`,this.#_),this.#g.window.removeEventListener(`focus`,this.#_))}#_=()=>{this.#g.document.visibilityState===`visible`&&this.refresh()};async#v(e,t){let n=this.#l;if(n||this.#S(e,t),this.#y(e,t),n)return;let r=await this.#g.cache.read(e).catch(()=>null);!this.#O(e,t)||this.#r===t||!r||(this.#e=Ul(e,r),this.#E())}#y(e,t){if(!this.#O(e,t)||this.#i)return;let n=this.#g.location.protocol===`https:`?`wss:`:`ws:`,r;try{r=this.#g.websocket(`${n}//${this.#g.location.host}/api/sessions/${encodeURIComponent(e)}/events?after=${this.#e.cursor}`)}catch{this.#e={...this.#e,lifecycle:`recoverable`},this.#E(),this.#d=this.#g.setTimeout(()=>this.#y(e,t),Math.min(1e3*2**this.#f++,1e4));return}this.#i=r,r.onopen=()=>{this.#O(e,t)&&this.#i===r&&(this.#f=0,this.#l||this.#S(e,t))},r.onmessage=n=>this.#b(e,t,String(n.data)),r.onclose=()=>{!this.#O(e,t)||this.#i!==r||(this.#i=null,this.#d=this.#g.setTimeout(()=>this.#y(e,t),Math.min(1e3*2**this.#f++,1e4)))}}#b(e,t,n){if(!this.#O(e,t))return;let r;try{r=JSON.parse(n)}catch{return}if(r.type===`relay.resyncRequired`){this.#S(e,t);return}if(r.type!==`relay.event`||!r.event||typeof r.event!=`object`)return;let i=r.event;if(!Number.isInteger(i.sequence)||typeof i.type!=`string`||!this.#x(i))return;([`agentMessageDelta`,`agentMessageStarted`,`agentMessageCompleted`,`activity.updated`,`interaction.requested`,`interaction.resolved`,`turnCompleted`,`turnInterrupted`].includes(i.type)||i.type===`session.updated`&&typeof i.payload.activeTurnId==`string`)&&this.#D(e);let a=eu(this.#e,i);this.#T(a),this.#g.onRelayEvent?.(i),(i.type===`session.updated`||i.type===`plan.updated`||i.type===`plan.closed`||i.type===`agent.activity.updated`||i.type===`session.status.updated`||i.type===`autopilot.updated`||i.type===`org-plan.attention-required`||i.type===`org-plan.attention-resolved`)&&this.#g.onSessionEvent?.(i),a.snapshotting&&this.#S(e,t)}#x(e){let t=e.payload;if(!t||typeof t!=`object`)return e.type===`turnCompleted`||e.type===`turnInterrupted`||e.type===`plan.closed`;let n=t;return e.type===`agentMessageDelta`||e.type===`agentMessageStarted`||e.type===`agentMessageCompleted`?typeof n.text==`string`:e.type===`interaction.requested`?typeof n.requestId==`string`&&typeof n.kind==`string`:e.type===`interaction.resolved`?typeof n.requestId==`string`:e.type===`session.updated`?n.activeTurnId===null||typeof n.activeTurnId==`string`:e.type===`activity.updated`?typeof n.id==`string`&&typeof n.label==`string`&&typeof n.detail==`string`:e.type===`agent.activity.updated`?typeof n.sessionId==`string`&&!!n.root&&Array.isArray(n.subagents):e.type===`session.status.updated`?typeof n.state==`string`&&typeof n.reason==`string`:e.type===`autopilot.updated`||e.type===`org-plan.attention-required`||e.type===`org-plan.attention-resolved`||[`autopilot.continuation-scheduled`,`autopilot.control-issued`,`autopilot.turn-started`,`autopilot.turn-failed`].includes(e.type)?!0:e.type===`plan.updated`||e.type===`plan.closed`}#S(e,t){if(this.#a?.id===e&&this.#a.generation===t)return this.#a.promise;if(!this.#O(e,t))return Promise.resolve();let n=this.#e.snapshotting&&this.#e.buffered.size>0;this.#e=Kl(this.#e),this.#E();let r=this.#g.relay.getHistory(e).then(r=>{let i=pu(r);if(this.#O(e,t)){if(!i){this.#T({...this.#e,snapshotting:!1,lifecycle:`recoverable`});return}this.#s=0,this.#c=!1,this.#o&&this.#g.clearTimeout(this.#o),this.#o=null,this.#r=t,this.#T(Wl(this.#e,i));for(let t of i.items)t.kind===`user`&&typeof t.operationId==`string`&&this.#g.onHistoryPromptAccepted?.(e,t.operationId);n&&this.#w(e,t)}}).catch(n=>{if(this.#O(e,t)){this.#T({...this.#e,snapshotting:!1,lifecycle:`recoverable`});let r=au[this.#s++];r===void 0?!this.#l&&!this.#c&&(this.#c=!0,this.#g.onHistoryError?.(n)):this.#C(e,t,r)}}).finally(()=>{this.#a?.promise===r&&(this.#a=null,this.#O(e,t)&&this.#e.snapshotting&&this.#S(e,t))});return this.#a={id:e,generation:t,promise:r},r}#C(e,t,n){this.#o&&this.#g.clearTimeout(this.#o);let r=this.#g.setTimeout(()=>{this.#o===r&&(this.#o=null,this.#O(e,t)&&this.#S(e,t))},n);this.#o=r}#w(e,t){let n=this.#i;this.#i=null,n?.close(),this.#d&&this.#g.clearTimeout(this.#d),this.#d=null,this.#y(e,t)}#T(e){this.#t&&hu(e)&&this.#D(this.#t),this.#e=e,this.#E(),this.#t&&this.#g.cache.write(this.#t,this.#e).catch(()=>{})}#E(){this.#g.publish(this.view)}#D(e){this.#u.delete(e),this.#t===e&&(this.#l=!1)}#O(e,t){return!this.#p&&this.#t===e&&this.#n===t}async#k(e,t,n,r){let i;for(let a of[0,50,150,300]){if(!this.#O(e,t))throw Error(`SESSION_CHANGED`);a&&await this.#A(a);try{return await this.#g.relay.startTurn(e,n,r)}catch(e){if(!gu(e,`SESSION_TURN_ACTIVE`))throw e;i=e}}throw i}#A(e){return new Promise(t=>this.#g.setTimeout(t,e))}#j(){this.#d&&this.#g.clearTimeout(this.#d),this.#d=null,this.#o&&this.#g.clearTimeout(this.#o),this.#o=null,this.#s=0,this.#c=!1,this.#l=!1;let e=this.#i;this.#i=null,e?.close()}};function hu(e){return!!(e.activeTurnId||e.messages.length||e.activities.length||e.prompts.length||e.interactions.length)}function gu(e,t){return ou(e)&&e.code===t}var _u=class{#e=!0;#t=null;#n;constructor(e){this.#n=e}get following(){return this.#e}observeTail(e){this.#e=e}reset(){this.cancel(),this.#e=!0}request(e){e!==`content`&&(this.#e=!0),!(e===`content`&&!this.#e)&&this.#t===null&&(this.#t=this.#n.requestFrame(()=>{this.#t=null,this.#n.scrollTail(e===`initial`||this.#n.reducedMotion()?`auto`:`smooth`)}))}cancel(){this.#t!==null&&this.#n.cancelFrame(this.#t),this.#t=null}},vu=class{afterCommit;request;#e=0;constructor(e,t){this.afterCommit=e,this.request=t}schedule(e){let t=this.#e;this.afterCommit(()=>{t===this.#e&&this.request(e)})}invalidate(){this.#e+=1}};function yu(e){if(!e||typeof e!=`object`)return!1;let t=e;return(t.state===`working`||t.state===`idle`)&&[`needsYou`,`complete`,`rootTurn`,`agent`,`process`,`autopilot`,`incompleteWithoutContinuation`,`stopped`,`disconnected`,`unknown`].includes(t.reason)&&[`fresh`,`stale`,`reconciling`].includes(t.confidence)&&typeof t.observedAt==`string`&&!Number.isNaN(Date.parse(t.observedAt))&&typeof t.nextExpectedAction==`string`&&t.nextExpectedAction.length>0&&t.nextExpectedAction.length<=240}var bu={FILE_PREVIEW_NOT_FOUND:`This file or folder no longer exists. Check the path and try again.`,FILE_PREVIEW_UNREADABLE:`This path could not be read. It must be inside the workspace and accessible without symbolic links.`,FILE_PREVIEW_UNSUPPORTED:`Preview supports UTF-8 text files and folders. This item cannot be displayed.`,FILE_PREVIEW_TOO_LARGE:`This file exceeds the 1 MiB preview limit. Open it locally to view its contents.`,INVALID_FILE_PREVIEW:`This file reference is invalid. Check its path and try again.`,RELAY_UNAVAILABLE:`The relay is unavailable. Check the connection and try again.`,SESSION_HISTORY_UNAVAILABLE:`Session history is unavailable. Check the relay connection and try opening the session again.`,SESSION_HISTORY_READ_FAILED:`Session history could not be read. The conversation remains saved; try again shortly.`,SESSION_WRITER_BUSY:`This thread is active in another Codex client. Release it there, then retry sending here.`,SESSION_WORKSPACE_UNAVAILABLE:`This session workspace is unavailable. Your message remains in the conversation for copying; restore workspace access before sending again.`,SESSION_RUNTIME_DEPENDENCY_FAILED:`A required Codex runtime dependency is unavailable. Check Codex, then retry.`,CODEX_PROTOCOL_INCOMPATIBLE:`The installed Codex runtime is incompatible with this relay. Update Codex before retrying.`,SESSION_ROLLOUT_MISSING:`This stored thread is no longer available.`,SESSION_RUNTIME_UNAVAILABLE:`The Codex runtime is unavailable. Retry shortly.`,SESSION_START_FAILED:`The session could not be started. Try again.`,ORG_EXECUTOR_PROFILE_UNAVAILABLE:`The Org-plan executor profile could not be read. Restore the installed Gestalt agent profile and try again.`,ORG_EXECUTOR_PROFILE_INVALID:`The Org-plan executor profile has invalid model settings. Repair the installed profile and try again.`,SESSION_CLOSE_FAILED:`The session could not be closed. Try again.`,SESSION_COPY_FAILED:`The CLI resume command could not be copied. Check clipboard access and try again.`,SESSION_DEFAULTS_READ_FAILED:`Saved session defaults could not be loaded. Using built-in defaults; check the configuration file and reload.`,SESSION_DEFAULTS_SAVE_FAILED:`Session defaults could not be saved. Try again.`,SESSION_MODELS_READ_FAILED:`Models could not be loaded for this provider. Select another provider and try again.`,SESSION_REFRESH_FAILED:`Sessions could not be refreshed. Try again.`,MESSAGE_SEND_FAILED:`The message was not sent. Your draft is preserved.`,GIT_SUMMARY_FAILED:`Repository status could not be loaded. Select it again to retry.`,GIT_PULL_FAILED:`The branch could not be refreshed. Resolve any Git conflicts and try again.`,GIT_CHECKOUT_FAILED:`The branch could not be selected. Refresh Git status and try again.`,GIT_PUSH_FAILED:`The push failed. Refresh Git status and resolve remote divergence first.`,GIT_CLONE_FAILED:`Clone failed.`,WORKSPACE_FILES_READ_FAILED:`Files could not be read. Try again.`,QUIT_FAILED:`Gestalt Mobile could not quit cleanly. Try again or stop it from the terminal.`,UPGRADE_FAILED:`Gestalt could not complete the upgrade and reconnect. Check update-restart.log and reload when Mobile is ready.`,UPGRADE_UNAVAILABLE:`Start Mobile with gestalt mobile to enable upgrades.`,DEBUG_CONTEXT_FAILED:`Session diagnostics could not be read. Reopen DEBUG to try again.`,DEBUG_START_FAILED:`Self DEBUG could not start. Check Sessions for a saved debug session before trying again.`,DEBUG_TRACE_FAILED:`The diagnostic trace could not be opened. Check that the saved JSON file is still available.`,DEBUG_CONFIRMATION_EXPIRED:`The debug confirmation expired. Reopen DEBUG to confirm current session details.`,DEBUG_SOURCE_CHANGED:`The source session changed. Reopen DEBUG to confirm current session details.`};function xu(e,t){let n=e instanceof Error?e.message:``,r=typeof e==`object`&&e&&`code`in e&&typeof e.code==`string`?e.code:``,i=Object.hasOwn(bu,r)?r:Object.hasOwn(bu,n)?n:t,a=typeof e==`object`&&e&&`retryable`in e?e.retryable===!0:!0;return{code:i,message:bu[i],retryable:a}}var Su=q(`<small class="svelte-1izxxv2"> </small>`),Cu=q(`<li class="svelte-1izxxv2"><div class="notification-meta svelte-1izxxv2"><strong class="svelte-1izxxv2"> </strong> <time class="svelte-1izxxv2"> </time></div> <p class="svelte-1izxxv2"> </p> <!></li>`),wu=q(`<ol aria-label="Recent notifications" class="svelte-1izxxv2"></ol>`),Tu=q(`<p class="empty svelte-1izxxv2" role="status">No recent notifications.</p>`),Eu=q(`<main class="notification-history svelte-1izxxv2" aria-labelledby="notification-history-title"><header class="svelte-1izxxv2"><button type="button" class="svelte-1izxxv2">Back</button> <div><h1 id="notification-history-title" tabindex="-1" class="svelte-1izxxv2">Recent notifications</h1> <p class="svelte-1izxxv2">The latest notifications saved in this browser.</p></div></header> <!></main>`);function Du(e,t){$e(t,!0);let n=z([]),r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});Gi(()=>t.queue.subscribeHistory(e=>B(n,e)));function i(e){Tr().then(()=>e.focus())}var a=Eu(),o=V(a),s=V(o),c=U(s,2);pi(V(c),()=>i),Ue(2),P(c),P(o);var l=U(o,2),u=e=>{var t=wu();Z(t,21,()=>G(n),e=>e.id,(e,t)=>{var n=Cu(),i=V(n),a=V(i),o=V(a,!0);P(a);var s=U(a,2),c=V(s,!0);P(s),P(i);var l=U(i,2),u=V(l,!0);P(l);var d=U(l,2),f=e=>{var n=Su(),r=V(n);P(n),W(()=>Y(r,`Repeated ${G(t).occurrences??``} times.`)),J(e,n)};X(d,e=>{G(t).occurrences>1&&e(f)}),P(n),W((e,r)=>{Q(n,`data-kind`,G(t).kind),Y(o,G(t).kind),Q(s,`datetime`,e),Y(c,r),Y(u,G(t).message)},[()=>new Date(G(t).updatedAt).toISOString(),()=>r.format(G(t).updatedAt)]),J(e,n)}),P(t),J(e,t)},d=e=>{J(e,Tu())};X(l,e=>{G(n).length?e(u):e(d,-1)}),P(a),K(`click`,s,function(...e){t.onclose?.apply(this,e)}),J(e,a),et()}Rr([`click`]);var Ou={error:null,success:5e3,warning:1e4,info:7e3},ku=`gestalt-mobile.notification-history`;function Au(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function ju(e,t){try{let n=JSON.parse(e?.getItem(`gestalt-mobile.notification-history`)??`[]`);return Array.isArray(n)?n.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`&&[`error`,`success`,`warning`,`info`].includes(String(e.kind))&&typeof e.message==`string`&&typeof e.occurrences==`number`&&typeof e.createdAt==`number`&&typeof e.updatedAt==`number`).slice(-t):[]}catch{return[]}}function Mu(e={}){let t=e.now??Date.now,n=e.setTimer??setTimeout,r=e.clearTimer??clearTimeout,i=new Set,a=new Set,o=new Map,s=[],c=e.historyLimit??50,l=ju(e.historyStorage,c),u=0,d=()=>s.map(e=>({...e})),f=()=>[...l].reverse().map(e=>({...e})),p=()=>i.forEach(e=>e(d())),m=()=>{try{e.historyStorage?.setItem(ku,JSON.stringify(l))}catch{}},h=()=>{m(),a.forEach(e=>e(f()))},g=e=>{let t=o.get(e);t?.handle&&r(t.handle),t&&(t.handle=null)},_=e=>{s.some(t=>t.id===e)&&(g(e),o.delete(e),s=s.filter(t=>t.id!==e),p())},v=e=>{let r=o.get(e);!r||r.pauseReasons.size>0||(r.startedAt=t(),r.handle=n(()=>_(e),r.remaining))};return{enqueue(e){if(e.code){let n=s.find(t=>t.kind===e.kind&&t.code===e.code);if(n)return s=s.map(e=>e.id===n.id?{...e,occurrences:e.occurrences+1}:e),l=l.map(e=>e.id===n.id?{...e,occurrences:e.occurrences+1,updatedAt:t()}:e),p(),h(),n.id}let n=t(),r=`toast-${n}-${++u}`,i={...e,id:r,occurrences:1};s=[...s,i],l=[...l,{...i,createdAt:n,updatedAt:n}].slice(-c);let a=Ou[e.kind];return a!==null&&(o.set(r,{handle:null,remaining:a,startedAt:t(),pauseReasons:new Set}),v(r)),p(),h(),r},dismiss:_,pause(e,n){let r=o.get(e);!r||r.pauseReasons.has(n)||(r.pauseReasons.add(n),r.handle&&(r.remaining=Math.max(0,r.remaining-(t()-r.startedAt)),g(e)))},resume(e,t){let n=o.get(e);!n||!n.pauseReasons.delete(t)||n.pauseReasons.size>0||v(e)},snapshot:d,historySnapshot:f,subscribe(e){return i.add(e),e(d()),()=>i.delete(e)},subscribeHistory(e){return a.add(e),e(f()),()=>a.delete(e)}}}function Nu(e){if(e.type!==`activity.updated`||!e.payload||typeof e.payload!=`object`)return null;let t=e.payload;return t.id!==`gestalt-serena-availability`||t.label!==`Serena unavailable`?null:{kind:`warning`,code:`SERENA_UNAVAILABLE`,message:`Serena is unavailable in this session. Use native code tools. Connection availability will be checked when the runtime resumes.`}}var Pu=q(`<small class="svelte-1a0rutm"> </small>`),Fu=q(`<section aria-atomic="true"><span class="toast-symbol svelte-1a0rutm" aria-hidden="true"> </span> <span class="toast-copy svelte-1a0rutm"><strong class="svelte-1a0rutm"> </strong> <span> </span> <!></span> <button type="button" class="svelte-1a0rutm"><span aria-hidden="true">×</span></button></section>`),Iu=q(`<div class="toast-viewport svelte-1a0rutm" aria-label="Notifications"></div>`);function Lu(e,t){$e(t,!0);let n=z([]),r=L(()=>G(n).slice(-3));Gi(()=>t.queue.subscribe(e=>B(n,e)));var i=Iu();Z(i,21,()=>G(r),e=>e.id,(e,n)=>{var r=Fu();let i;var a=V(r),o=V(a,!0);P(a);var s=U(a,2),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u,!0);P(u);var f=U(u,2),p=e=>{var t=Pu(),r=V(t);P(t),W(()=>Y(r,`Repeated ${G(n).occurrences??``} times.`)),J(e,t)};X(f,e=>{G(n).occurrences>1&&e(p)}),P(s);var m=U(s,2);P(r),W(()=>{i=Si(r,1,`toast svelte-1a0rutm`,null,i,{error:G(n).kind===`error`,success:G(n).kind===`success`,warning:G(n).kind===`warning`}),Q(r,`role`,G(n).kind===`error`?`alert`:`status`),Q(r,`aria-live`,G(n).kind===`error`?`assertive`:`polite`),Y(o,G(n).kind===`error`||G(n).kind===`warning`?`!`:G(n).kind===`success`?`✓`:`i`),Y(l,G(n).kind===`error`?`Error`:G(n).kind===`success`?`Success`:G(n).kind===`warning`?`Warning`:`Info`),Y(d,G(n).message),Q(m,`aria-label`,`Dismiss ${G(n).kind} notification`)}),Lr(`pointerenter`,r,()=>t.queue.pause(G(n).id,`hover`)),Lr(`pointerleave`,r,()=>t.queue.resume(G(n).id,`hover`)),K(`focusin`,r,()=>t.queue.pause(G(n).id,`focus`)),K(`focusout`,r,()=>t.queue.resume(G(n).id,`focus`)),K(`click`,m,()=>t.queue.dismiss(G(n).id)),J(e,r)}),P(i),J(e,i),et()}Rr([`focusin`,`focusout`,`click`]);var Ru=q(`<main class="evidence-page svelte-1j55xyh"><h1 class="svelte-1j55xyh">Git repository</h1> <p>Choose a destination and clone a repository.</p> <div class="evidence-composer svelte-1j55xyh"><label for="evidence-prompt">Prompt</label> <textarea id="evidence-prompt" class="evidence-prompt svelte-1j55xyh" rows="1">Review repository status</textarea></div></main> <nav class="evidence-nav svelte-1j55xyh" aria-label="Primary evidence navigation"><button type="button" class="svelte-1j55xyh">Sessions</button> <button type="button" aria-pressed="true" class="svelte-1j55xyh">Git</button> <button type="button" class="svelte-1j55xyh">Chat</button></nav> <!>`,1);function zu(e,t){$e(t,!0);let n=Mu();Gi(()=>{t.variant===`stacked`&&n.enqueue({kind:`success`,message:`Cloned.`}),n.enqueue({kind:`error`,code:`GIT_CLONE_FAILED`,message:`Clone failed.`})});var r=Ru();Lu(U(H(r),4),{get queue(){return n}}),J(e,r),et()}var Bu={sessionBase:()=>!0,gitRepositoryTarget:e=>e.isGitRepository,cloneDestination:e=>!e.isGitRepository};function Vu(e){let t=new Set,n=(e,r)=>{!e.isGitRepository&&r<=2&&t.add(e.id),e.children.forEach(e=>n(e,r+1))};return e.forEach(e=>n(e,1)),t}function Hu(e,t){let n=new Set(e);return t.isGitRepository||(n.has(t.id)?n.delete(t.id):n.add(t.id)),n}function Uu(e,t){let n=[],r=(e,i,a)=>{n.push({node:e,level:i,parentId:a}),!e.isGitRepository&&t.has(e.id)&&e.children.forEach(t=>r(t,i+1,e.id))};return e.forEach(e=>r(e,1,null)),n}function Wu(e,t){let n=(e,r)=>{if(e.id===t)return r;for(let t of e.children){let i=n(t,[...r,e.id]);if(i)return i}return null};for(let t of e){let e=n(t,[]);if(e)return e}return[]}function Gu(e,t){for(let n of e){if(n.id===t)return n;let e=Gu(n.children,t);if(e)return e}}function Ku(e,t,n,r){if(e){let i=Gu(n,e);if(i&&r(i))return i.id;let a=Wu(t,e);for(let e of a.toReversed()){let t=Gu(n,e);if(t&&r(t))return t.id}}return qu(n).find(r)?.id??null}function qu(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}var Ju=q(`<button class="disclosure svelte-6z3q4v" type="button" tabindex="-1"><span aria-hidden="true"> </span></button>`),Yu=q(`<span class="disclosure-spacer svelte-6z3q4v" aria-hidden="true"></span>`),Xu=q(`<span class="repository-badge svelte-6z3q4v">Git</span>`),Zu=q(`<div class="tree-row svelte-6z3q4v"><!> <button type="button" role="treeitem"><span class="selection-mark svelte-6z3q4v" aria-hidden="true"> </span> <span class="node-copy svelte-6z3q4v"><span class="node-name svelte-6z3q4v"> </span> <span class="node-path svelte-6z3q4v"> </span></span> <!></button></div>`),Qu=q(`<div class="filesystem-tree svelte-6z3q4v" role="tree"></div>`);function $u(e,t){$e(t,!0);let n=$(t,`isSelectable`,3,()=>!0),r=z(null),i=on({}),a=L(()=>Uu(t.roots,t.expandedIds)),o=L(()=>G(r)&&G(a).some(({node:e})=>e.id===G(r))?G(r):t.selectedId&&G(a).some(({node:e})=>e.id===t.selectedId)?t.selectedId:G(a)[0]?.node.id??null);function s(e){return!e.isGitRepository&&e.children.length>0}function c(e){return e===`.`?`~/`:`~/${e}`}function l(e){B(r,e,!0),i[e]?.focus()}function u(e,t){let n=Math.max(0,Math.min(G(a).length-1,t)),r=G(a)[n];r&&n!==e&&l(r.node.id)}function d(e){n()(e)&&t.onselect(e)}function f(e){s(e)&&t.onexpandedchange(Hu(t.expandedIds,e))}function p(e,n,r){let{node:i,parentId:o}=n;switch(e.key){case`ArrowUp`:e.preventDefault(),u(r,r-1);break;case`ArrowDown`:e.preventDefault(),u(r,r+1);break;case`ArrowRight`:if(!s(i))return;e.preventDefault(),t.expandedIds.has(i.id)?G(a)[r+1]?.parentId===i.id&&u(r,r+1):f(i);break;case`ArrowLeft`:if(!t.expandedIds.has(i.id)&&!o)return;e.preventDefault(),s(i)&&t.expandedIds.has(i.id)?f(i):o&&l(o);break;case`Home`:e.preventDefault(),u(r,0);break;case`End`:e.preventDefault(),u(r,G(a).length-1);break;case`Enter`:case` `:e.preventDefault(),d(i);break}}var m=Qu();Z(m,23,()=>G(a),e=>e.node.id,(e,a,l)=>{let u=L(()=>G(a).node),m=L(()=>s(G(u)));var h=Zu();let g;var _=V(h),v=e=>{var n=Ju(),r=V(n),i=V(r,!0);P(r),P(n),W((e,t)=>{Q(n,`aria-label`,e),Y(i,t)},[()=>`${t.expandedIds.has(G(u).id)?`Collapse`:`Expand`} ${G(u).name}`,()=>t.expandedIds.has(G(u).id)?`−`:`+`]),K(`click`,n,()=>f(G(u))),J(e,n)},y=e=>{J(e,Yu())};X(_,e=>{G(m)?e(v):e(y,-1)});var b=U(_,2);let x;var S=V(b),C=V(S,!0);P(S);var w=U(S,2),T=V(w),E=V(T,!0);P(T);var D=U(T,2),ee=V(D,!0);P(D),P(w);var te=U(w,2),ne=e=>{J(e,Xu())};X(te,e=>{G(u).isGitRepository&&e(ne)}),P(b),Ui(b,(e,t)=>i[t.id]=e,e=>i?.[e.id],()=>[G(u)]),P(h),W((e,n,r,i,s)=>{g=wi(h,``,g,e),x=Si(b,1,`tree-item svelte-6z3q4v`,null,x,{selected:t.selectedId===G(u).id,repository:G(u).isGitRepository}),Q(b,`aria-level`,G(a).level),Q(b,`aria-expanded`,n),Q(b,`aria-selected`,t.selectedId===G(u).id),Q(b,`aria-disabled`,r),Q(b,`tabindex`,G(o)===G(u).id?0:-1),Q(b,`title`,i),Y(C,t.selectedId===G(u).id?`✓`:``),Y(E,G(u).name),Y(ee,s)},[()=>({"--tree-level":Math.min(G(a).level-1,6)}),()=>G(m)?t.expandedIds.has(G(u).id):void 0,()=>!n()(G(u)),()=>c(G(u).relativePath),()=>c(G(u).relativePath)]),Lr(`focus`,b,()=>B(r,G(u).id,!0)),K(`keydown`,b,e=>p(e,G(a),G(l))),K(`click`,b,()=>d(G(u))),J(e,h)}),P(m),W(()=>Q(m,`aria-label`,t.label)),J(e,m),et()}Rr([`click`,`keydown`]);var ed=q(`<section class="evidence-shell svelte-1d6w4ti" aria-labelledby="evidence-title"><p class="eyebrow svelte-1d6w4ti"> </p> <h1 id="evidence-title" class="svelte-1d6w4ti"> </h1> <p class="instructions svelte-1d6w4ti"> </p> <!></section>`);function td(e,t){$e(t,!0);let n=(e,t)=>({id:e,name:t,relativePath:e,isGitRepository:!0,children:[]}),r=[{id:`.`,name:`development-workspace-with-a-long-name`,relativePath:`.`,isGitRepository:!1,children:[{id:`dyne`,name:`dyne`,relativePath:`dyne`,isGitRepository:!1,children:[{id:`dyne/mobile-applications`,name:`mobile-applications-and-experiments`,relativePath:`dyne/mobile-applications`,isGitRepository:!1,children:[n(`dyne/mobile-applications/gestalt-mobile`,`gestalt-mobile-with-an-extraordinarily-long-repository-name`)]},n(`dyne/zenroom`,`zenroom`),n(`dyne/zenflows`,`zenflows`),n(`dyne/did`,`did-toolkit`),n(`dyne/api`,`api-gateway`),n(`dyne/docs`,`documentation-portal`)]},{id:`personal`,name:`personal-projects`,relativePath:`personal`,isGitRepository:!1,children:[]}]}],i=z(on(new Set([`.`,`dyne`,`dyne/mobile-applications`]))),a=z(null),o=L(()=>t.context===`sessions`?`dyne/mobile-applications`:`dyne/mobile-applications/gestalt-mobile`),s=L(()=>G(a)??G(o));var c=ed(),l=V(c),u=V(l,!0);P(l);var d=U(l,2),f=V(d,!0);P(d);var p=U(d,2),m=V(p,!0);P(p);var h=U(p,2);{let e=L(()=>t.context===`sessions`?`Session base`:`Git repository`),n=L(()=>t.context===`sessions`?Bu.sessionBase:Bu.gitRepositoryTarget);$u(h,{get roots(){return r},get expandedIds(){return G(i)},get selectedId(){return G(s)},get label(){return G(e)},get isSelectable(){return G(n)},onexpandedchange:e=>B(i,e,!0),onselect:e=>B(a,e.id,!0)})}P(c),W(()=>{Y(u,t.context===`sessions`?`Sessions`:`Git`),Y(f,t.context===`sessions`?`Session base`:`Git repository`),Y(m,t.context===`sessions`?`Select the folder Codex should use as its working directory.`:`Select a repository for Git actions.`)}),J(e,c),et()}function nd(e){return e.branch===null?{enabled:!1,reason:`Select a local branch to push.`}:e.upstream?(e.behind??0)>0?{enabled:!1,reason:`Pull upstream changes before pushing.`}:e.ahead<1?{enabled:!1,reason:`There are no commits to push.`}:{enabled:!0,reason:null}:e.branch?e.originUrl?{enabled:!0,reason:null}:{enabled:!1,reason:`No origin remote is configured.`}:{enabled:!1,reason:`Select a local branch to push.`}}function rd(e,t=Date.now()){if(!e)return`Not fetched yet`;let n=Math.max(0,t-new Date(e).getTime()),r=Math.floor(n/6e4);if(r<1)return`Fetched just now`;if(r<60)return`Fetched ${r}m ago`;let i=Math.floor(r/60);return i<24?`Fetched ${i}h ago`:`Fetched ${Math.floor(i/24)}d ago`}function id(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown time`;let r=Math.round((n-t)/1e3),i=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]],[a,o]=i.find(([,e])=>Math.abs(r)>=e)??i.at(-1);return new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(r/o),a)}var ad=q(`<p class="clone-status svelte-pudr3t" role="status"> </p>`),od=q(`<option> </option>`),sd=q(`<p class="svelte-pudr3t"> </p>`),cd=q(`<p id="git-push-help" class="action-help svelte-pudr3t"> </p>`),ld=q(`<section aria-label="Confirm push"><p> </p> <button type="button"> </button> <button type="button">Cancel</button></section>`),ud=q(`<li class="commit-entry svelte-pudr3t"><div class="commit-subject svelte-pudr3t"><code class="svelte-pudr3t"> </code><span> </span></div> <div class="commit-meta svelte-pudr3t"><span> </span><time class="svelte-pudr3t"> </time></div></li>`),dd=q(`<section class="commit-history svelte-pudr3t" aria-labelledby="recent-commits-title"><h3 id="recent-commits-title" class="svelte-pudr3t">Recent commits</h3> <ol class="commit-list svelte-pudr3t" aria-label="Recent commits"></ol></section>`),fd=q(`<div class="git-overview svelte-pudr3t"><div class="git-status svelte-pudr3t"><label for="git-branch">Branch</label> <select id="git-branch"></select> <p class="svelte-pudr3t"> </p> <!> <p class="svelte-pudr3t"><time> </time></p> <p class="svelte-pudr3t"> </p></div> <div class="git-actions svelte-pudr3t"><button type="button" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" class="svelte-pudr3t"><span aria-hidden="true">↓</span> </button> <!></div></div> <!> <!>`,1),pd=q(`<p>This workspace is not a Git repository.</p>`),md=q(`<p role="status">Loading repository status…</p>`),hd=q(`<p><strong> </strong> is available as a Clone destination. Select a Git repository
|
|
22
|
+
to inspect branches and enable repository actions.</p> <div class="git-actions svelte-pudr3t" aria-label="Repository actions unavailable"><button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↓</span> Pull</button></div>`,1),gd=q(`<p>Select a folder above to choose a Clone destination or inspect a Git repository.</p> <div class="git-actions svelte-pudr3t" aria-label="Repository actions unavailable"><button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↓</span> Pull</button></div>`,1),_d=q(`<p role="alert"> </p>`),vd=q(`<section class="git-view svelte-pudr3t" aria-labelledby="git-title"><h2 id="git-title" class="visually-hidden">Git</h2> <section class="git-tree svelte-pudr3t" aria-labelledby="git-tree-title"><div class="section-heading svelte-pudr3t"><h3 id="git-tree-title" class="svelte-pudr3t">Repository and clone destination</h3> <p class="svelte-pudr3t">Select any folder. Git repositories enable repository actions; other folders are clone
|
|
23
|
+
destinations.</p></div> <!> <button id="browse-files" type="button" class="svelte-pudr3t">Browse files</button></section> <form class="clone-form svelte-pudr3t"><div class="clone-controls svelte-pudr3t"><div class="clone-field svelte-pudr3t"><label for="git-clone-address" class="svelte-pudr3t">Git address</label> <input id="git-clone-address" name="address" autocomplete="url" inputmode="url" enterkeyhint="done" aria-describedby="clone-help"/></div> <button type="submit" class="svelte-pudr3t"> </button></div> <p id="clone-help" class="svelte-pudr3t"> </p> <!></form> <section class="repository-details svelte-pudr3t" aria-labelledby="repository-details-title"><h3 id="repository-details-title" class="svelte-pudr3t">Repository details</h3> <!> <!></section></section>`);function yd(e,t){$e(t,!0);let n=$(t,`pushing`,3,!1),r=z(``),i=L(()=>t.selectedWorkspace&&!t.selectedWorkspace.isGitRepository?t.selectedWorkspace:null),a=L(()=>!!t.selectedWorkspace?.isGitRepository),o=L(()=>G(a)?t.summary?.originUrl??``:G(r)),s=L(()=>t.summary?nd(t.summary):{enabled:!1,reason:null});function c(e){e.preventDefault(),!(!G(i)||!G(r).trim()||t.cloning)&&t.onclone(G(r).trim())}var l=vd(),u=U(V(l),2),d=U(V(u),2);{let e=L(()=>t.selectedWorkspace?.id??null);$u(d,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return G(e)},label:`Git repository and clone destination`,get onexpandedchange(){return t.onexpandedchange},get onselect(){return t.onselect}})}var f=U(d,2);P(u);var p=U(u,2),m=V(p),h=V(m),g=U(V(h),2);Ni(g),P(h);var _=U(h,2),v=V(_,!0);P(_),P(m);var y=U(m,2),b=V(y,!0);P(y);var x=U(y,2),S=e=>{var n=ad(),r=V(n,!0);P(n),W(()=>Y(r,t.cloneStatus)),J(e,n)};X(x,e=>{t.cloneStatus&&e(S)}),P(p);var C=U(p,2),w=U(V(C),2),T=e=>{var r=Kr(),i=H(r),a=e=>{var r=Kr(),i=H(r),a=e=>{var r=fd(),i=H(r),a=V(i),o=U(V(a),2);Z(o,20,()=>t.summary.branches??[],e=>e,(e,t)=>{var n=od(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(o);var c;Ei(o);var l=U(o,2),u=V(l);P(l);var d=U(l,2),f=e=>{var n=sd(),r=V(n);P(n),W(()=>Y(r,`Ahead ${t.summary.ahead??``}; behind ${t.summary.behind??``}.`)),J(e,n)};X(d,e=>{t.summary.upstream&&e(f)});var p=U(d,2),m=V(p),h=V(m,!0);P(m),P(p);var g=U(p,2),_=V(g);P(g),P(a);var v=U(a,2),y=V(v),b=U(y,2),x=U(V(b));P(b);var S=U(b,2),C=e=>{var t=cd(),n=V(t,!0);P(t),W(()=>Y(n,G(s).reason)),J(e,t)};X(S,e=>{!G(s).enabled&&G(s).reason&&e(C)}),P(v),P(i);var w=U(i,2),T=e=>{var r=ld(),i=V(r),a=V(i,!0);P(i);var o=U(i,2),s=V(o,!0);P(o);var c=U(o,2);P(r),W(()=>{Y(a,t.summary.upstream?`Push ${t.summary.branch??`HEAD`} to ${t.summary.upstream}?`:`Publish ${t.summary.branch} to origin and set its upstream?`),o.disabled=n(),Y(s,n()?`Pushing…`:`Confirm push`),c.disabled=n()}),K(`click`,o,function(...e){t.onpush?.apply(this,e)}),K(`click`,c,function(...e){t.oncancelpush?.apply(this,e)}),J(e,r)};X(w,e=>{t.confirmingPush&&e(T)});var E=U(w,2),D=e=>{var n=dd(),r=U(V(n),2);Z(r,21,()=>t.summary.commits,e=>e.hash,(e,t)=>{var n=ud(),r=V(n),i=V(r),a=V(i,!0);P(i);var o=U(i),s=V(o,!0);P(o),P(r);var c=U(r,2),l=V(c),u=V(l,!0);P(l);var d=U(l),f=V(d,!0);P(d),P(c),P(n),W(e=>{Q(i,`title`,G(t).hash),Y(a,G(t).shortHash),Y(s,G(t).subject),Y(u,G(t).author),Q(d,`datetime`,G(t).authoredAt),Q(d,`title`,G(t).authoredAt),Y(f,e)},[()=>id(G(t).authoredAt)]),J(e,n)}),P(r),P(n),J(e,n)};X(E,e=>{t.summary.commits.length&&e(D)}),W(e=>{o.disabled=t.refreshing||t.checkingOut||!t.summary.branches?.length,c!==(c=t.summary.branch??``)&&(o.value=(o.__value=t.summary.branch??``)??``,Ti(o,t.summary.branch??``)),Y(u,`Upstream: ${t.summary.upstream??`not configured`??``}`),Q(m,`datetime`,t.summary.fetchedAt??void 0),Y(h,e),Y(_,`Changes: ${t.summary.dirty.staged??``} staged, ${t.summary.dirty.unstaged??``} unstaged, ${t.summary.dirty.untracked??``} untracked.`),y.disabled=t.refreshing||t.checkingOut||n()||!G(s).enabled,Q(y,`aria-describedby`,G(s).enabled?void 0:`git-push-help`),b.disabled=t.refreshing||t.checkingOut||n()||!t.summary.upstream,Y(x,` ${t.refreshing?`Pulling…`:`Pull`}`)},[()=>rd(t.summary.fetchedAt)]),K(`change`,o,e=>t.oncheckout(e.currentTarget.value)),K(`click`,y,function(...e){t.onopenpushconfirmation?.apply(this,e)}),K(`click`,b,function(...e){t.onpull?.apply(this,e)}),J(e,r)},o=e=>{J(e,pd())};X(i,e=>{t.summary.available?e(a):e(o,-1)}),J(e,r)},o=e=>{J(e,md())};X(i,e=>{t.summary?e(a):t.error||e(o,1)}),J(e,r)},E=e=>{var n=hd(),r=H(n),i=V(r),a=V(i,!0);P(i),Ue(),P(r),Ue(2),W(()=>Y(a,t.selectedWorkspace.name)),J(e,n)},D=e=>{var t=gd();Ue(2),J(e,t)};X(w,e=>{t.selectedWorkspace?.isGitRepository?e(T):t.selectedWorkspace?e(E,1):e(D,-1)});var ee=U(w,2),te=e=>{var n=_d(),r=V(n,!0);P(n),W(()=>Y(r,t.error)),J(e,n)};X(ee,e=>{t.error&&e(te)}),P(C),P(l),W(e=>{f.disabled=!t.selectedWorkspace,Pi(g,G(o)),g.readOnly=G(a),g.required=!G(a),Q(g,`placeholder`,G(a)?`No origin remote`:`https://example.com/owner/repository.git`),_.disabled=e,Y(v,t.cloning?`Cloning…`:`Clone`),Y(b,G(a)?t.summary?.originUrl?`Origin remote. Select a folder to clone another repository.`:`No origin remote is configured for this repository.`:t.selectedWorkspace?`Clone into ${t.selectedWorkspace.name}.`:`Select a folder to clone a repository.`)},[()=>t.cloning||!G(i)||!G(r).trim()]),K(`click`,f,e=>t.onbrowsefiles(e.currentTarget)),Lr(`submit`,p,c),K(`input`,g,e=>B(r,e.currentTarget.value,!0)),J(e,l),et()}Rr([`click`,`input`,`change`]);var bd=class{transport;isRepository;onChange;errorMessage;#e={workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null};#t=0;#n=null;#r=!1;constructor(e,t,n,r){this.transport=e,this.isRepository=t,this.onChange=n,this.errorMessage=r}get state(){return this.#e}select(e){this.#a();let t=e,n=!!(t&&this.isRepository(t));this.#s({workspaceId:t,summary:null,loading:n,refreshing:!1,checkingOut:!1,error:null}),n&&this.refresh()}async refresh(){let e=this.#e.workspaceId;if(!e||!this.isRepository(e))return;let t=this.#i(),n=this.#t;this.#s({...this.#e,loading:!0,error:null});try{let r=await this.transport.getSummary(e,t.signal);this.#o(n,e,t)&&this.#s({...this.#e,summary:r,loading:!1})}catch(r){this.#o(n,e,t)&&!t.signal.aborted&&this.#s({...this.#e,summary:null,loading:!1,error:this.errorMessage(r,`GIT_SUMMARY_FAILED`)})}}async pull(e){let t=this.#e.workspaceId;if(!t||this.#e.refreshing)return;let n=this.#i(),r=this.#t;this.#s({...this.#e,refreshing:!0,error:null});try{await this.transport.pull(t,e,n.signal),this.#o(r,t,n)&&(this.#s({...this.#e,refreshing:!1}),await this.refresh())}catch(e){this.#o(r,t,n)&&!n.signal.aborted&&this.#s({...this.#e,refreshing:!1,error:this.errorMessage(e,`GIT_PULL_FAILED`)})}}async checkout(e){let t=this.#e.workspaceId;if(!t||this.#e.checkingOut||e===this.#e.summary?.branch)return;let n=this.#i(),r=this.#t;this.#s({...this.#e,checkingOut:!0,error:null});try{await this.transport.checkout(t,e,n.signal),this.#o(r,t,n)&&(this.#s({...this.#e,checkingOut:!1}),await this.refresh())}catch(e){this.#o(r,t,n)&&!n.signal.aborted&&this.#s({...this.#e,checkingOut:!1,error:this.errorMessage(e,`GIT_CHECKOUT_FAILED`)})}}dispose(){this.#r=!0,this.#a()}#i(){return this.#a(),this.#n=new AbortController,++this.#t,this.#n}#a(){this.#n?.abort(),this.#n=null,++this.#t}#o(e,t,n){return!this.#r&&e===this.#t&&this.#e.workspaceId===t&&this.#n===n}#s(e){this.#r||(this.#e=e,this.onChange(e))}};function xd(e,t,n,r,i){let a=new Set(Sd(e).filter(e=>e.isGitRepository).map(e=>e.id)),o=Gu(t,n),s=o?Sd(o.children).filter(e=>e.isGitRepository&&!a.has(e.id)):[],c=Cd(r),l=s.find(e=>e.name===c)??(s.length===1?s[0]:void 0),u=l?.id??o?.id??null,d=new Set(i);return u&&Wu(t,u).forEach(e=>d.add(e)),!l&&o&&d.add(o.id),{selectedId:u,expandedIds:d}}function Sd(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}function Cd(e){return(e.trim().replace(/[?#].*$/,``).replace(/\/+$/,``).split(/[/:]/).at(-1)??``).replace(/\.git$/i,``)}function wd(e){if(typeof e!=`object`||!e)return null;let t=e.permissions;if(typeof t!=`object`||!t)return null;let n=t;return{permissions:{...n.network===null||n.network===void 0?{}:{network:n.network},...n.fileSystem===null||n.fileSystem===void 0?{}:{fileSystem:n.fileSystem}},scope:`turn`}}function Td(e){return{answers:Object.fromEntries(e.filter(e=>e.answer.trim()).map(e=>[e.id,{answers:[e.answer]}]))}}function Ed(e){return[`Submitted quiz answers:`,...e.map(e=>`- ${e.header} — ${e.question}\n ${e.answer.trim().replaceAll(`
|
|
24
|
+
`,`
|
|
25
|
+
`)}`)].join(`
|
|
26
|
+
`)}function Dd(e=fetch){async function t(e){let t=await e.json().catch(()=>null),n=typeof t?.code==`string`&&/^[A-Z0-9_]+$/.test(t.code)?t.code:void 0,r=n?.startsWith(`AUTOPILOT_`)&&e.status===409?`Relay request failed (${e.status}).`:typeof t?.detail==`string`&&t.detail.length<=600?t.detail:typeof t?.title==`string`?t.title:`Relay request failed (${e.status}).`;return Object.assign(Error(r),{...n?{code:n}:{},...typeof t?.replaceAllowed==`boolean`?{replaceAllowed:t.replaceAllowed}:{},status:e.status})}async function n(n,r,i={},a){let o=await e(n,{method:`POST`,headers:{"content-type":`application/json`,...i},body:JSON.stringify(r),signal:a});if(!o.ok)throw await t(o);return o.json()}async function r(n,r,i={}){let a=await e(n,{method:`PUT`,headers:{"content-type":`application/json`,...i},body:JSON.stringify(r)});if(!a.ok)throw await t(a);return a.json()}async function i(n,r,i,a){let o=await e(n,{method:`PUT`,headers:{"content-type":`application/octet-stream`,"idempotency-key":i},body:r,signal:a});if(!o.ok)throw await t(o);return o.json()}async function a(n,r,i){let a=await e(n,{method:`DELETE`,headers:{"content-type":`application/json`,"idempotency-key":i},body:JSON.stringify(r)});if(!a.ok)throw await t(a);return a.json()}async function o(n){let r=await e(n,{method:`DELETE`});if(!r.ok)throw await t(r)}async function s(n,r){let i=await e(n,r?{signal:r}:void 0);if(!i.ok)throw await t(i);return i.json()}async function c(n,r){let i=await e(n,{signal:r});if(i.status===204)return null;if(!i.ok)throw await t(i);return i.json()}return{debugConfirmation:e=>s(`/api/sessions/${encodeURIComponent(e)}/debug`),startSelfDebug:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/debug`,{confirmationId:t}),readDebugTrace:(e,t)=>s(`/api/sessions/${encodeURIComponent(e)}/debug/trace`,t),quit:()=>n(`/api/maintenance/quit`,{}),upgrade:()=>n(`/api/maintenance/upgrade`,{}),upgradeStatus:e=>s(`/api/maintenance/upgrade`,e),listSessions:e=>s(`/api/sessions`,e),checkWorkspaceFileReferences:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/references`,{paths:t},{},r),getSessionFilePreview:(e,t,n)=>s(`/api/sessions/${encodeURIComponent(e)}/files/preview?${new URLSearchParams({path:t})}`,n),getWorkspaceFilePreview:(e,t,n)=>s(`/api/workspaces/${encodeURIComponent(e)}/files/preview?${new URLSearchParams({path:t})}`,n),listWorkspaceDirectory:(e,t={},n)=>{let r=new URLSearchParams;t.directory!==void 0&&r.set(`directory`,t.directory),t.cursor!==void 0&&r.set(`cursor`,t.cursor),t.limit!==void 0&&r.set(`limit`,String(t.limit));let i=r.size===0?``:`?${r}`;return s(`/api/workspaces/${encodeURIComponent(e)}/files${i}`,n)},copyWorkspaceEntry:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/copy`,t,{"idempotency-key":r}),moveWorkspaceEntry:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/move`,t,{"idempotency-key":r}),uploadWorkspaceFile:(e,t,n,r)=>{let a=new URLSearchParams({directory:t.directory,filename:t.filename,conflict:t.conflict});return i(`/api/workspaces/${encodeURIComponent(e)}/files/upload?${a}`,t.file,n,r)},deleteWorkspaceEntry:(e,t,n)=>a(`/api/workspaces/${encodeURIComponent(e)}/files`,{path:t,recursive:!0},n),getSession:e=>s(`/api/sessions/${encodeURIComponent(e)}`),refreshActivity:e=>n(`/api/sessions/${encodeURIComponent(e)}/activity/refresh`,{}),setAutopilot:(e,t,n)=>r(`/api/sessions/${encodeURIComponent(e)}/autopilot`,{enabled:t},n?{"idempotency-key":n}:{}),resolveAttention:(e,t,r)=>n(`/api/sessions/${encodeURIComponent(e)}/attention/${encodeURIComponent(t)}/resolve`,r),listRecentSessions:()=>s(`/api/sessions/recent-threads`),openRecentSession:(e,t,r=`codex`)=>n(`/api/sessions/recent-threads/open`,{threadId:e,cwd:t,provider:r}),listSessionModels:e=>n(`/api/session-models/${encodeURIComponent(e)}`,{}),startSession:(e,t={},r)=>n(`/api/sessions`,{workspaceId:e,profile:`default`,provider:`codex`,...t},r?{"idempotency-key":r}:{}),startTurn:(e,t,r)=>n(`/api/sessions/${encodeURIComponent(e)}/turns`,{text:t},r?{"idempotency-key":r}:{}),selectModel:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/model`,{model:t}),interruptTurn:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/turns/${encodeURIComponent(t)}/interrupt`,{}),queueTurnInput:(e,t,r,i)=>n(`/api/sessions/${encodeURIComponent(e)}/turns/${encodeURIComponent(t)}/queue`,{text:r},i?{"idempotency-key":i}:{}),restoreSession:e=>n(`/api/sessions/${encodeURIComponent(e)}/restore`,{}),releaseSession:e=>n(`/api/sessions/${encodeURIComponent(e)}/release`,{}),forgetSession:n=>e(`/api/sessions/${encodeURIComponent(n)}`,{method:`DELETE`}).then(async e=>{if(!e.ok)throw await t(e)}),getHistory:e=>s(`/api/sessions/${encodeURIComponent(e)}/history`),getPlan:(e,t)=>c(`/api/sessions/${encodeURIComponent(e)}/plan`,t),closePlan:e=>o(`/api/sessions/${encodeURIComponent(e)}/plan`),listWorkspacePlans:(e,t)=>s(`/api/workspaces/${encodeURIComponent(e)}/plans`,t),archiveWorkspacePlan:(e,t)=>n(`/api/workspaces/${encodeURIComponent(e)}/plans/${encodeURIComponent(t)}/archive`,{}),getWorkspacePlan:(e,t,n)=>s(`/api/workspaces/${encodeURIComponent(e)}/plans/${encodeURIComponent(t)}`,n),openSessionPlan:(e,t)=>r(`/api/sessions/${encodeURIComponent(e)}/plan`,{planName:t}),getGitSummary:(e,t)=>s(`/api/git/repositories/${encodeURIComponent(e)}`,t),cloneGitRepository:(e,t)=>n(`/api/git/clone`,{workspaceId:e,address:t}),refreshGit:(e,t)=>n(`/api/git/repositories/${encodeURIComponent(e)}/refresh`,{},t?{"idempotency-key":t}:{}),pullGit:(e,t,r)=>n(`/api/git/repositories/${encodeURIComponent(e)}/pull`,{},t?{"idempotency-key":t}:{},r),checkoutGitBranch:(e,t,r)=>n(`/api/git/repositories/${encodeURIComponent(e)}/checkout`,{branch:t},{},r),pushGit:(e,t)=>n(`/api/git/repositories/${encodeURIComponent(e)}/push`,{},t?{"idempotency-key":t}:{}),listAvailableSkills:(e,t,n=!1,r)=>s(`/api/skills?${new URLSearchParams({workspaceId:e,profile:t,...n?{refresh:`true`}:{}}).toString()}`,r),listSkillProfiles:e=>s(`/api/skill-profiles`,e),replaceSkillProfile:(e,t)=>r(`/api/skill-profiles/${encodeURIComponent(e)}`,t),deleteSkillProfile:e=>o(`/api/skill-profiles/${encodeURIComponent(e)}`),respondInteraction:(e,t,r,i)=>n(`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}`,r,i?{"idempotency-key":i}:{})}}var Od=[`authoring-start`,`work-start`,`checkpoint`,`update`,`supervision-start`,`resync`];function kd(e){return typeof e==`string`&&(Od.includes(e)||/^review:[A-Za-z0-9._-]{1,128}:REVIEWED$/.test(e)||/^l2:[A-Za-z0-9._-]{1,128}:(WIP|DONE)$/.test(e))}function Ad(e){if(!e||typeof e!=`object`)return!1;let t=e;return jd(t.plan)&&(t.reason===null||kd(t.reason))}function jd(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.title==`string`&&Array.isArray(t.steps)&&typeof t.totalSteps==`number`&&typeof t.doneSteps==`number`&&typeof t.allDone==`boolean`&&typeof t.currentStepId==`string`}function Md(e){return e instanceof Error?e.message:`Could not load the plan.`}function Nd(e){return{...e,...e.skills?{skills:[...e.skills]}:{},description:{...e.description},children:e.children.map(Nd)}}function Pd(e){return{...e,steps:e.steps.map(Nd)}}function Fd(e,t){return e.kind===`unavailable`&&e.sessionId===t}function Id(e,t){let n=null,r={kind:`unavailable`,sessionId:null},i=0,a=0,o=null,s=0,c=e=>{++a,r=e,t(e)},l=(t,r)=>{o?.abort(),o=new AbortController;let a=++i,l=s;r||c({kind:`loading`,sessionId:t}),e.getPlan(t,o.signal).then(e=>{a!==i||n!==t||s===l&&c(e?{kind:`ready`,sessionId:t,plan:Pd(e)}:{kind:`unavailable`,sessionId:t})}).catch(e=>{o?.signal.aborted||a!==i||n!==t||c({kind:`error`,sessionId:t,error:Md(e),...r?{plan:r}:{}})})};return{select(e){if(o?.abort(),n=e,s=0,!e){++i,c({kind:`unavailable`,sessionId:null});return}l(e,void 0)},refresh(e){if(n!==e)return;let t=r.kind===`ready`||r.kind===`closing`||r.kind===`error`?r.plan:void 0;l(e,t)},applyEvent(e,t){if(!(n!==e||t.sequence<=s)){if(t.type===`plan.updated`&&(jd(t.payload)||Ad(t.payload))){let n=Ad(t.payload)?t.payload.plan:t.payload;s=t.sequence,c({kind:`ready`,sessionId:e,plan:Pd(n)})}t.type===`plan.closed`&&(s=t.sequence,c({kind:`unavailable`,sessionId:e}))}},async close(){if(r.kind!==`ready`&&r.kind!==`error`||!r.plan?.allDone)return null;let{sessionId:t,plan:i}=r;c({kind:`closing`,sessionId:t,plan:i});let o=a;try{return await e.closePlan(t),n===t?a===o?(c({kind:`unavailable`,sessionId:t}),`chat`):Fd(r,t)?`chat`:null:null}catch(e){return n===t?a===o?(c({kind:`error`,sessionId:t,plan:i,error:Md(e)}),null):Fd(r,t)?`chat`:null:null}},dispose(){o?.abort(),o=null,n=null,++i,c({kind:`unavailable`,sessionId:null})}}}function Ld(e){if(!e)return null;let t=Rd(e.steps,e.currentStepId)?.measurement?.weeklyRemainingCurrent;return typeof t==`number`&&Number.isFinite(t)&&t>=0&&t<=100?Math.round(t):null}function Rd(e,t){for(let n of e){if(n.id===t)return n;let e=Rd(n.children,t);if(e)return e}}function zd(e){let t=new Set,n=e=>{for(let n of e.matchAll(/=([^=\n]+)=/g)){let e=n[1].trim();e&&t.add(e)}};if(e?.kind===`org-source`)n(e.source);else if(e&&`plan`in e&&e.plan){let t=[...e.plan.steps];for(;t.length;){let e=t.pop();Object.values(e.description).forEach(e=>{e&&n(e)}),t.push(...e.children)}}return[...t]}var Bd=q(`<a class="svelte-nywawl"><code class="svelte-nywawl"> </code></a>`),Vd=q(`<code class="svelte-nywawl"> </code>`),Hd=q(`<span class="notes svelte-nywawl"></span>`);function Ud(e,t){$e(t,!0);let n=$(t,`verifiedReferences`,19,()=>new Set),r=L(()=>t.text.split(/(=[^=\n]+=)/g));var i=Hd();Z(i,21,()=>G(r),ei,(e,r)=>{var i=Kr(),a=H(i),o=e=>{var i=Kr(),a=H(i),o=e=>{var n=Bd(),i=V(n),a=V(i,!0);P(i),P(n),W((e,t)=>{Q(n,`href`,e),Y(a,t)},[()=>`#file-preview=${encodeURIComponent(G(r).slice(1,-1).trim())}`,()=>G(r).slice(1,-1)]),K(`click`,n,e=>{e.preventDefault(),t.onreference?.(G(r).slice(1,-1).trim())}),J(e,n)},s=L(()=>t.onreference&&n().has(G(r).slice(1,-1).trim())),c=e=>{var t=Vd(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>G(r).slice(1,-1)]),J(e,t)};X(a,e=>{G(s)?e(o):e(c,-1)}),J(e,i)},s=L(()=>G(r).startsWith(`=`)&&G(r).endsWith(`=`)&&G(r).length>2),c=e=>{var t=Gr();W(()=>Y(t,G(r))),J(e,t)};X(a,e=>{G(s)?e(o):e(c,-1)}),J(e,i)}),P(i),J(e,i),et()}Rr([`click`]);function Wd(e,t){return t===void 0?`L${e}`:`L${e}.${t}`}function Gd(e){let t=e.steps.filter(e=>e.reviewStatus===`REVIEWED`).length,n=e.steps.length,r=Kd(e),i=e.steps.find(e=>e.state===`DONE`&&e.reviewStatus===`UNREVIEWED`);return i?{phase:`awaiting review`,label:`Awaiting ${Wd(e.steps.indexOf(i)+1)} review`,current:r,reviewedL1s:t,totalL1s:n}:n>0&&t===n?{phase:`terminal review`,label:`Terminal review`,current:r,reviewedL1s:t,totalL1s:n}:t>0&&!r?{phase:`milestone reported`,label:`Preparing milestone summary`,current:r,reviewedL1s:t,totalL1s:n}:r?{phase:`implementing`,label:`Implementing ${r.position} ${r.title}`,current:r,reviewedL1s:t,totalL1s:n}:{phase:e.allDone?`terminal review`:`implementing`,label:e.allDone?`Terminal review`:`Implementing`,current:r,reviewedL1s:t,totalL1s:n}}function Kd(e){for(let[t,n]of e.steps.entries()){if(n.id===e.currentStepId)return{id:n.id,position:Wd(t+1),title:n.title,state:n.state};let r=n.children.findIndex(t=>t.id===e.currentStepId);if(r>=0){let e=n.children[r];return{id:e.id,position:Wd(t+1,r+1),title:e.title,state:e.state}}}}var qd=q(`<span class="wip-effort svelte-hmxg46"> </span>`),Jd=q(`<li class="svelte-hmxg46"><span class="wip-position svelte-hmxg46" aria-hidden="true"> </span> <span class="wip-title svelte-hmxg46"> </span> <!></li>`),Yd=q(`<ol class="wip-steps svelte-hmxg46" aria-label="Work in progress plan steps"></ol>`),Xd=q(`<li class="svelte-hmxg46"><span aria-hidden="true" class="position svelte-hmxg46"> </span> <span aria-hidden="true" class="state"> </span></li>`),Zd=q(`<ol class="step-markers svelte-hmxg46" aria-label="Plan step progress"></ol>`),Qd=q(`<div><div class="progress-heading svelte-hmxg46"><span> </span> <span> </span></div> <progress class="svelte-hmxg46"> </progress> <span class="review-status"> </span> <!></div>`);function $d(e,t){$e(t,!0);let n=$(t,`compact`,3,!1),r=$(t,`label`,3,`Plan progress`),i=L(()=>t.plan.steps.flatMap((e,t)=>[{id:e.id,position:Wd(t+1),state:e.state,level:e.level,title:e.title,...e.description.effort?{effort:e.description.effort}:{}},...e.children.map((e,n)=>({id:e.id,position:Wd(t+1,n+1),state:e.state,level:e.level,title:e.title}))])),a=L(()=>G(i).filter(e=>e.state===`WIP`)),o=L(()=>Gd(t.plan)),s=L(()=>Math.max(t.plan.totalSteps,1));var c=Qd(),l=V(c),u=V(l),d=V(u);P(u);var f=U(u,2),p=V(f);P(f),P(l);var m=U(l,2),h=V(m);P(m);var g=U(m,2),_=V(g,!0);P(g);var v=U(g,2),y=e=>{var n=Yd();Z(n,21,()=>G(a),e=>e.id,(e,n)=>{var r=Jd(),i=V(r),a=V(i);P(i);var o=U(i,2),s=V(o,!0);P(o);var c=U(o,2),l=e=>{var t=qd(),r=V(t);P(t),W(()=>Y(r,`Effort: ${G(n).effort??``}`)),J(e,t)};X(c,e=>{G(n).level===1&&G(n).effort&&e(l)}),P(r),W(()=>{Q(r,`aria-current`,G(n).id===t.plan.currentStepId?`step`:void 0),Q(r,`aria-label`,`${G(n).position}: ${G(n).title}, WIP${G(n).level===1&&G(n).effort?`, effort ${G(n).effort}`:``}`),Y(a,`${G(n).position??``} · WIP`),Y(s,G(n).title)}),J(e,r)}),P(n),J(e,n)},b=e=>{var n=Zd();Z(n,21,()=>G(i),e=>e.id,(e,n)=>{var r=Xd(),i=V(r),a=V(i,!0);P(i);var o=U(i,2),s=V(o,!0);P(o),P(r),W(()=>{Q(r,`data-state`,G(n).state),Q(r,`aria-current`,G(n).id===t.plan.currentStepId?`step`:void 0),Q(r,`aria-label`,`${G(n).position}: ${G(n).state}`),Y(a,G(n).position),Y(s,G(n).state)}),J(e,r)}),P(n),J(e,n)};X(v,e=>{n()&&G(a).length?e(y):!n()&&G(i).length&&e(b,1)}),P(c),W(()=>{Si(c,1,gi([`plan-progress`,{compact:n()}]),`svelte-hmxg46`),Y(d,`${t.plan.doneSteps??``} / ${t.plan.totalSteps??``} work items done`),Y(p,`· ${G(o).reviewedL1s??``} / ${G(o).totalL1s??``} reviewed`),Q(m,`aria-label`,r()),Pi(m,t.plan.doneSteps),Q(m,`max`,G(s)),Y(h,`${t.plan.doneSteps??``} of ${t.plan.totalSteps??``} work items done`),Q(g,`data-phase`,G(o).phase),Y(_,G(o).label)}),J(e,c),et()}var ef=q(`<section aria-labelledby="plan-title" class="svelte-3rmyvg"><h2 id="plan-title" class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">Loading plan…</p></section>`),tf=q(`<section aria-labelledby="plan-title" class="svelte-3rmyvg"><h2 id="plan-title" class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">No retained plan for this session.</p></section>`),nf=q(`<section aria-labelledby="plan-title" class="svelte-3rmyvg"><h2 id="plan-title" class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg"> </p></section>`),rf=q(`<p class="svelte-3rmyvg"> </p>`),af=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Subtitle</dt> <dd class="svelte-3rmyvg"> </dd></div>`),of=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Date</dt> <dd class="svelte-3rmyvg"> </dd></div>`),sf=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Keywords</dt> <dd class="svelte-3rmyvg"> </dd></div>`),cf=q(`<dl class="metadata svelte-3rmyvg"><!> <!> <!></dl>`),lf=q(`<p class="svelte-3rmyvg">No plan steps have been retained yet.</p>`),uf=q(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg"> </strong> <!></p>`),df=q(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg">Skills:</strong> </p>`),ff=q(`<li class="svelte-3rmyvg"><details class="svelte-3rmyvg"><summary class="svelte-3rmyvg"><strong class="svelte-3rmyvg"><span class="position svelte-3rmyvg"> </span> </strong> <span class="svelte-3rmyvg"> </span> <span class="svelte-3rmyvg"> </span></summary> <!> <!></details></li>`),pf=q(`<ol class="svelte-3rmyvg"></ol>`),mf=q(`<li class="svelte-3rmyvg"><details class="svelte-3rmyvg"><summary class="svelte-3rmyvg"><strong class="svelte-3rmyvg"><span class="position svelte-3rmyvg"> </span> </strong> <span class="svelte-3rmyvg"> </span> <span class="svelte-3rmyvg"> </span> <span class="measurement svelte-3rmyvg"> </span></summary> <!> <!> <!></details></li>`),hf=q(`<ol class="plan-steps svelte-3rmyvg"></ol>`),gf=q(`<section class="plan svelte-3rmyvg" aria-labelledby="plan-title"><header class="svelte-3rmyvg"><div class="svelte-3rmyvg"><h2 id="plan-title" class="svelte-3rmyvg"> </h2></div> <button class="close svelte-3rmyvg" aria-label="Close plan and return to list">×</button></header> <!> <p class="svelte-3rmyvg"> </p> <!> <!> <!></section>`),_f=q(`<p class="visually-hidden svelte-3rmyvg" aria-live="polite" aria-atomic="true"> </p> <!>`,1);function vf(e,t){$e(t,!0);let n={effort:`Effort`,goal:`Goal`,notes:`Notes`,why:`Why`,change:`Change`,tests:`Tests`,doneWhen:`Done when`},r=$(t,`verifiedReferences`,19,()=>new Set),i=z(on(new Set)),a=on({}),o=null,s=0,c=L(()=>t.state.kind===`ready`||t.state.kind===`closing`||t.state.kind===`error`?t.state.plan:void 0),l=L(()=>G(c)?m(G(c).steps,G(c).currentStepId):void 0),u=L(()=>G(c)?h(G(c).steps,G(c).currentStepId):void 0),d=L(()=>G(c)?Gd(G(c)):void 0),f=L(()=>G(c)?g(G(c).steps,G(c).currentStepId):new Set),p=L(()=>t.state.kind===`loading`?`Loading plan.`:t.state.kind===`unavailable`?`No retained plan for this session.`:t.state.kind===`error`&&!G(c)?t.state.error:t.state.kind===`closing`?`Closing completed plan.`:G(c)?G(l)?`${G(d)?.label??`Current step: ${G(u)} ${G(l).title}`}. ${G(c).doneSteps} of ${G(c).totalSteps} work items done.${t.state.kind===`error`?` ${t.state.error}`:``}`:`${G(d)?.label??`Plan progress`}. ${G(c).doneSteps} of ${G(c).totalSteps} work items done.${t.state.kind===`error`?` ${t.state.error}`:``}`:``);Mn(()=>{let e=G(c)?.currentStepId||null;if(!e||o===e)return;let t=o===null;o=e;let n=++s;t||Tr().then(()=>{n!==s||G(c)?.currentStepId!==e||a[e]?.scrollIntoView({behavior:`auto`,block:`nearest`,inline:`nearest`})})});function m(e,t){for(let n of e){if(n.id===t)return n;let e=m(n.children,t);if(e)return e}}function h(e,t){for(let[n,r]of e.entries()){if(r.id===t)return Wd(n+1);let e=r.children.findIndex(e=>e.id===t);if(e>=0)return Wd(n+1,e+1)}}function g(e,t,n=[]){for(let r of e){if(r.id===t)return new Set([...n,r.id]);let e=g(r.children,t,[...n,r.id]);if(e.size)return e}return new Set}function _(e){return G(i).has(e)||G(f).has(e)}function v(e,t){B(i,t?new Set([...G(i),e]):new Set([...G(i)].filter(t=>t!==e)),!0)}function y(e){return e.description.goal??e.description.why??e.title}function b(e){let t=e.measurement;if(!t)return`Measurements unavailable`;let n=[];return t.elapsedSeconds!==void 0&&n.push(`${Math.floor(t.elapsedSeconds/60)}m ${t.elapsedSeconds%60}s elapsed`),t.weeklyPercentUsed!==void 0&&n.push(`${t.weeklyPercentUsed}% observed account-wide usage`),t.tokensUsed!==void 0&&n.push(`${t.tokensUsed.toLocaleString()} tokens used`),n.join(` · `)||`Measurements unavailable`}function x(e){return Object.keys(n).flatMap(t=>{let r=e.description[t];return r?[[n[t],r]]:[]})}var S=_f(),w=H(S),T=V(w,!0);P(w);var E=U(w,2),D=e=>{J(e,ef())},ee=e=>{J(e,tf())},te=e=>{var n=nf(),r=U(V(n),2),i=V(r,!0);P(r),P(n),W(()=>Y(i,t.state.error)),J(e,n)},ne=e=>{var n=gf(),i=V(n),o=V(i),s=V(o),f=V(s,!0);P(s),P(o);var p=U(o,2);P(i);var m=U(i,2);$d(m,{get plan(){return G(c)}});var h=U(m,2),g=V(h);P(h);var S=U(h,2),w=e=>{var n=rf(),r=V(n,!0);P(n),W(()=>Y(r,t.state.error)),J(e,n)};X(S,e=>{t.state.kind===`error`&&e(w)});var T=U(S,2),E=e=>{var t=cf(),n=V(t),r=e=>{var t=af(),n=U(V(t),2),r=V(n,!0);P(n),P(t),W(()=>Y(r,G(c).subtitle)),J(e,t)};X(n,e=>{G(c).subtitle&&e(r)});var i=U(n,2),a=e=>{var t=of(),n=U(V(t),2),r=V(n,!0);P(n),P(t),W(()=>Y(r,G(c).date)),J(e,t)};X(i,e=>{G(c).date&&e(a)});var o=U(i,2),s=e=>{var t=sf(),n=U(V(t),2),r=V(n,!0);P(n),P(t),W(()=>Y(r,G(c).keywords)),J(e,t)};X(o,e=>{G(c).keywords&&e(s)}),P(t),J(e,t)};X(T,e=>{(G(c).subtitle||G(c).date||G(c).keywords)&&e(E)});var D=U(T,2),ee=e=>{J(e,lf())},te=e=>{var n=hf();Z(n,23,()=>G(c).steps,e=>e.id,(e,n,i)=>{var o=mf(),s=V(o),c=V(s),l=V(c),u=V(l),d=V(u,!0);P(u);var f=U(u);P(l);var p=U(l,2),m=V(p);P(p);var h=U(p,2),g=V(h,!0);P(h);var S=U(h,2),w=V(S,!0);P(S),P(c);var T=U(c,2);Z(T,17,()=>x(G(n)),([e,t])=>e,(e,n)=>{var i=L(()=>C(G(n),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=uf(),c=V(s),l=V(c);P(c),Ud(U(c,2),{get text(){return o()},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(s),W(()=>Y(l,`${a()??``}:`)),J(e,s)});var E=U(T,2),D=e=>{var t=df(),r=U(V(t));P(t),W(e=>Y(r,` ${e??``}`),[()=>G(n).skills.join(`, `)]),J(e,t)};X(E,e=>{G(n).skills?.length&&e(D)});var ee=U(E,2),te=e=>{var o=pf();Z(o,23,()=>G(n).children,e=>e.id,(e,n,o)=>{var s=ff(),c=V(s),l=V(c),u=V(l),d=V(u),f=V(d,!0);P(d);var p=U(d);P(u);var m=U(u,2),h=V(m);P(m);var g=U(m,2),b=V(g,!0);P(g),P(l);var S=U(l,2);Z(S,17,()=>x(G(n)),([e,t])=>e,(e,n)=>{var i=L(()=>C(G(n),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=uf(),c=V(s),l=V(c);P(c),Ud(U(c,2),{get text(){return o()},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(s),W(()=>Y(l,`${a()??``}:`)),J(e,s)});var w=U(S,2),T=e=>{var t=df(),r=U(V(t));P(t),W(e=>Y(r,` ${e??``}`),[()=>G(n).skills.join(`, `)]),J(e,t)};X(w,e=>{G(n).skills?.length&&e(T)}),P(c),Ui(c,(e,t)=>a[t.id]=e,e=>a?.[e.id],()=>[G(n)]),P(s),W((e,t,r)=>{Q(c,`data-step-id`,G(n).id),c.open=e,Y(f,t),Y(p,` ${G(n).title??``}`),Y(h,`${G(n).state??``} · Priority ${G(n).priority??``}${G(n).reviewStatus?` · ${G(n).reviewStatus}`:``}`),Y(b,r)},[()=>_(G(n).id),()=>Wd(G(i)+1,G(o)+1),()=>y(G(n))]),Lr(`toggle`,c,e=>v(G(n).id,e.currentTarget.open)),J(e,s)}),P(o),J(e,o)};X(ee,e=>{G(n).children.length&&e(te)}),P(s),Ui(s,(e,t)=>a[t.id]=e,e=>a?.[e.id],()=>[G(n)]),P(o),W((e,t,r,i)=>{Q(s,`data-step-id`,G(n).id),s.open=e,Y(d,t),Y(f,` ${G(n).title??``}`),Y(m,`${G(n).state??``} · Priority ${G(n).priority??``}${G(n).reviewStatus?` · ${G(n).reviewStatus}`:``}`),Y(g,r),Y(w,i)},[()=>_(G(n).id),()=>Wd(G(i)+1),()=>y(G(n)),()=>b(G(n))]),Lr(`toggle`,s,e=>v(G(n).id,e.currentTarget.open)),J(e,o)}),P(n),J(e,n)};X(D,e=>{G(c).steps.length===0?e(ee):e(te,-1)}),P(n),W(()=>{Y(f,G(c).title),Y(g,`${G(d)?.label??``}. Current: ${G(l)?`${G(u)} ${G(l).title} (${G(l).state})`:`No current step`}`)}),K(`click`,p,function(...e){t.onclose?.apply(this,e)}),J(e,n)};X(E,e=>{t.state.kind===`loading`?e(D):t.state.kind===`unavailable`?e(ee,1):t.state.kind===`error`&&!G(c)?e(te,2):G(c)&&e(ne,3)}),W(()=>Y(T,G(p))),J(e,S),et()}Rr([`click`]);var yf=/^(\*+)\s+(?:(TODO|WIP|DONE)\s+)?(?:\[#([ABC])\]\s+)?(.+)$/,bf=/^#\+([A-Z][A-Z0-9_-]*):\s*(.*)$/i,xf=/^:([A-Z][A-Z0-9_]*):\s*(.*)$/,Sf=/^-\s+([^:]+?)\s+::\s*(.*)$/;function Cf(e){let t=[],n=[],r=[],i=e.replace(/\r\n?/g,`
|
|
27
|
+
`).split(`
|
|
28
|
+
`),a=null,o=!1,s=null,c=0,l=()=>{a&&r.push({...a,properties:[...a.properties],descriptions:[...a.descriptions],body:wf(a.body)})};for(let e of i){let r=yf.exec(e);if(r){l(),a={level:r[1].length,title:r[4].trim(),...r[2]?{state:r[2]}:{},...r[3]?{priority:r[3]}:{},properties:[],descriptions:[],body:[]},o=!1,s=null,c=0;continue}if(!a){let r=bf.exec(e);r?t.push([r[1].toUpperCase(),r[2].trim()]):n.push(e);continue}if(e===`:PROPERTIES:`){o=!0;continue}if(o&&e===`:END:`){o=!1,s=null,c=0;continue}if(o){let t=xf.exec(e);t&&a.properties.push([t[1],t[2].trim()]);continue}let i=Sf.exec(e);if(i)a.descriptions.push([i[1].trim(),i[2].trim()]),s=a.descriptions.length-1,c=0;else if(s!==null&&/^[ \t]+\S/.test(e)){let[t,n]=a.descriptions[s];a.descriptions[s]=[t,`${n}${`
|
|
29
|
+
`.repeat(c+1)}${e.replace(/^(?: |\t)/,``)}`],c=0}else s!==null&&!e.trim()?c+=1:(s=null,c=0,a.body.push(e))}return l(),{metadata:t,preamble:wf(n),sections:r}}function wf(e){let t=[...e];for(;t[0]?.trim()===``;)t.shift();for(;t.at(-1)?.trim()===``;)t.pop();return t}var Tf=q(`<div class="svelte-h7gaqo"><dt class="svelte-h7gaqo"> </dt> <dd class="svelte-h7gaqo"><!></dd></div>`),Ef=q(`<dl class="metadata svelte-h7gaqo"></dl>`),Df=q(`<p class="svelte-h7gaqo"><!></p>`),Of=q(`<p class="svelte-h7gaqo">This Org document has no headings.</p>`),kf=q(`<h3 class="svelte-h7gaqo"> </h3>`),Af=q(`<h4 class="svelte-h7gaqo"> </h4>`),jf=q(`<span> </span>`),Mf=q(`<span class="priority svelte-h7gaqo"> </span>`),Nf=q(`<dl class="descriptions svelte-h7gaqo"></dl>`),Pf=q(`<p><!></p>`),Ff=q(`<details class="properties svelte-h7gaqo"><summary class="svelte-h7gaqo">Properties</summary> <dl class="svelte-h7gaqo"></dl></details>`),If=q(`<section class="org-section svelte-h7gaqo"><div class="section-heading svelte-h7gaqo"><!> <!> <!></div> <!> <!> <!></section>`),Lf=q(`<div class="sections svelte-h7gaqo"></div>`),Rf=q(`<article class="org-document svelte-h7gaqo" aria-labelledby="org-document-title"><header class="svelte-h7gaqo"><div><h2 id="org-document-title" class="svelte-h7gaqo"> </h2> <code class="svelte-h7gaqo"> </code></div> <button class="close svelte-h7gaqo" type="button" aria-label="Close plan and return to list">×</button></header> <!> <!> <!></article>`);function zf(e,t){$e(t,!0);let n=$(t,`verifiedReferences`,19,()=>new Set),r=L(()=>Cf(t.preview.source)),i=L(()=>G(r).metadata.filter(([e])=>e!==`TITLE`));var a=Rf(),o=V(a),s=V(o),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u,!0);P(u),P(s);var f=U(s,2);P(o);var p=U(o,2),m=e=>{var r=Ef();Z(r,21,()=>G(i),([e,t])=>`${e}:${t}`,(e,r)=>{var i=L(()=>C(G(r),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=Tf(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);Ud(d,{get text(){return G(e)},get onreference(){return t.onreference},get verifiedReferences(){return n()}})}P(u),P(s),W(()=>Y(l,a())),J(e,s)}),P(r),J(e,r)};X(p,e=>{G(i).length&&e(m)});var h=U(p,2);Z(h,19,()=>G(r).preamble,(e,t)=>`preamble:${t}:${e}`,(e,r)=>{var i=Kr(),a=H(i),o=e=>{var i=Df();Ud(V(i),{get text(){return G(r)},get onreference(){return t.onreference},get verifiedReferences(){return n()}}),P(i),J(e,i)},s=L(()=>G(r).trim());X(a,e=>{G(s)&&e(o)}),J(e,i)});var g=U(h,2),_=e=>{J(e,Of())},v=e=>{var i=Lf();Z(i,23,()=>G(r).sections,(e,t)=>`${t}:${e.level}:${e.title}`,(e,r)=>{var i=If();let a;var o=V(i),s=V(o),c=e=>{var t=kf(),n=V(t,!0);P(t),W(()=>Y(n,G(r).title)),J(e,t)},l=e=>{var t=Af(),n=V(t,!0);P(t),W(()=>Y(n,G(r).title)),J(e,t)};X(s,e=>{G(r).level===1?e(c):e(l,-1)});var u=U(s,2),d=e=>{var t=jf(),n=V(t,!0);P(t),W(e=>{Si(t,1,e,`svelte-h7gaqo`),Y(n,G(r).state)},[()=>`state state-${G(r).state.toLowerCase()}`]),J(e,t)};X(u,e=>{G(r).state&&e(d)});var f=U(u,2),p=e=>{var t=Mf(),n=V(t);P(t),W(()=>Y(n,`Priority ${G(r).priority??``}`)),J(e,t)};X(f,e=>{G(r).priority&&e(p)}),P(o);var m=U(o,2),h=e=>{var i=Nf();Z(i,21,()=>G(r).descriptions,([e,t])=>`${e}:${t}`,(e,r)=>{var i=L(()=>C(G(r),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=Tf(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);Ud(d,{get text(){return G(e)},get onreference(){return t.onreference},get verifiedReferences(){return n()}})}P(u),P(s),W(()=>Y(l,a())),J(e,s)}),P(i),J(e,i)};X(m,e=>{G(r).descriptions.length&&e(h)});var g=U(m,2);Z(g,19,()=>G(r).body,(e,t)=>`${t}:${e}`,(e,r)=>{var i=Kr(),a=H(i),o=e=>{var i=Pf();let a;Ud(V(i),{get text(){return G(r)},get onreference(){return t.onreference},get verifiedReferences(){return n()}}),P(i),W(e=>a=Si(i,1,`svelte-h7gaqo`,null,a,e),[()=>({"list-item":G(r).trimStart().startsWith(`- `)})]),J(e,i)},s=L(()=>G(r).trim());X(a,e=>{G(s)&&e(o)}),J(e,i)});var _=U(g,2),v=e=>{var i=Ff(),a=U(V(i),2);Z(a,21,()=>G(r).properties,([e,t])=>`${e}:${t}`,(e,r)=>{var i=L(()=>C(G(r),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=Tf(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);Ud(d,{get text(){return G(e)},get onreference(){return t.onreference},get verifiedReferences(){return n()}})}P(u),P(s),W(()=>Y(l,a())),J(e,s)}),P(a),P(i),J(e,i)};X(_,e=>{G(r).properties.length&&e(v)}),P(i),W(e=>a=wi(i,``,a,e),[()=>({"--org-depth":Math.max(0,G(r).level-1)})]),J(e,i)}),P(i),J(e,i)};X(g,e=>{G(r).sections.length===0?e(_):e(v,-1)}),P(a),W(()=>{Y(l,t.preview.title),Y(d,t.preview.planName)}),K(`click`,f,function(...e){t.onclose?.apply(this,e)}),J(e,a),et()}Rr([`click`]);var Bf=q(`<span> </span>`),Vf=q(`<span class="subtitle svelte-x2ko9l"> </span>`),Hf=q(`<div class="catalog-progress svelte-x2ko9l"><progress class="svelte-x2ko9l"> </progress> <span class="svelte-x2ko9l"> </span></div> <!>`,1),Uf=q(`<span class="subtitle svelte-x2ko9l">Org document</span>`),Wf=q(`<span class="archive-tag svelte-x2ko9l">Archived</span>`),Gf=q(`<li class="plan-row svelte-x2ko9l"><div class="plan-details svelte-x2ko9l"><strong> </strong> <div class="plan-path svelte-x2ko9l"><!> <span> </span></div> <!> <!></div> <div class="plan-actions svelte-x2ko9l"><!> <!></div></li>`),Kf=q(`<p>Waiting for the application workspace…</p>`),qf=q(`<p>Finding Org plans…</p>`),Jf=q(`<p> </p>`),Yf=q(`<p>No .org files were found in .gestalt folders below the application workspace.</p>`),Xf=q(`<ul aria-label="Unfinished plans" class="svelte-x2ko9l"></ul>`),Zf=q(`<section class="completed svelte-x2ko9l" aria-labelledby="completed-plans-title"><h3 id="completed-plans-title" class="svelte-x2ko9l">Completed and archived</h3> <ul aria-label="Completed and archived plans" class="svelte-x2ko9l"></ul></section>`),Qf=q(`<p class="scope svelte-x2ko9l">Org plans in .gestalt folders below the application workspace.</p> <!> <!>`,1),$f=q(`<section class="plans svelte-x2ko9l" aria-labelledby="plans-title"><div class="catalog-heading svelte-x2ko9l"><h2 id="plans-title" tabindex="-1" class="svelte-x2ko9l">ORG Plans</h2> <span role="status">(updating…)</span></div> <!></section>`);function ep(e,t){$e(t,!0);let n=(e,n=b)=>{let i=L(()=>n().planName.split(`/`)),a=L(()=>G(i).slice(0,-1)),s=L(()=>G(a).slice(0,2).filter((e,t)=>t===0||e!==`.gestalt`).join(`/`));var c=Gf(),l=V(c),u=V(l),d=V(u,!0);P(u);var f=U(u,2),p=V(f),g=e=>{var t=Bf(),n=V(t,!0);P(t),W(()=>Y(n,G(s))),J(e,t)};X(p,e=>{G(s)&&e(g)});var _=U(p,2),v=V(_,!0);P(_),P(f);var y=U(f,2),x=e=>{var t=Hf(),r=H(t),i=V(r),a=V(i);P(i);var o=U(i,2),s=V(o);P(o),P(r);var c=U(r,2),l=e=>{var t=Vf(),r=V(t,!0);P(t),W(()=>Y(r,n().subtitle)),J(e,t)};X(c,e=>{n().subtitle&&e(l)}),W(e=>{Q(i,`aria-label`,`Completion for ${n().title}`),Pi(i,n().doneSteps),Q(i,`max`,e),Y(a,`${n().doneSteps??``} of ${n().totalSteps??``} work items complete`),Y(s,`${n().doneSteps??``} / ${n().totalSteps??``}`)},[()=>Math.max(1,n().totalSteps)]),J(e,t)},S=e=>{J(e,Uf())};X(y,e=>{n().previewAvailable!==!1&&n().totalSteps!==void 0&&n().doneSteps!==void 0?e(x):e(S,-1)});var C=U(y,2),w=e=>{J(e,Wf())};X(C,e=>{n().archived&&e(w)}),P(l);var T=U(l,2),E=V(T);{let e=L(()=>`${n().allDone||n().archived?`Reopen`:`Open`} ${n().title}`);Ya(E,{get label(){return G(e)},onclick:()=>m(n().planName),children:(e,t)=>{Ue();var r=Gr();W(()=>Y(r,n().allDone||n().archived?`Reopen`:`Open`)),J(e,r)},$$slots:{default:!0}})}var D=U(E,2),ee=e=>{{let i=L(()=>`Archive ${n().title}`),a=L(()=>!t.onarchive||n().archived||r().includes(n().planName));Ya(e,{get label(){return G(i)},get disabled(){return G(a)},onclick:()=>h(n().planName),children:(e,t)=>{Ue();var i=Gr();W(e=>Y(i,e),[()=>r().includes(n().planName)?`Archiving…`:`Archive`]),J(e,i)},$$slots:{default:!0}})}};X(D,e=>{!n().allDone&&!n().archived&&e(ee)}),P(T),P(c),Ui(c,e=>o[n().planName]=e,()=>o?.[n().planName]),W(e=>{Q(c,`aria-label`,`${n().title} (${n().planName})`),Y(d,n().title),Q(f,`title`,n().planName),Y(v,e)},[()=>G(i).at(-1)]),J(e,c)},r=$(t,`archivingPlans`,19,()=>[]),i=z(on(new Set));Mn(()=>{let e=zd(t.state),n=t.checkreferences,r=new AbortController;return B(i,new Set,!0),e.length&&n&&n(e,r.signal).then(e=>{r.signal.aborted||B(i,new Set(e),!0)}).catch(()=>{}),()=>r.abort()});let a=z(null),o=on({}),s=z(null),c=z(null),l=!1,u=!1,d=L(()=>t.catalog.kind===`ready`?t.catalog.entries.filter(e=>e.allDone!==!0&&!e.archived):[]),f=L(()=>t.catalog.kind===`ready`?t.catalog.entries.filter(e=>e.allDone===!0||e.archived):[]);function p(){t.onclose()}function m(e){B(c,e,!0),t.onopen(e)}function h(e){B(s,e,!0),t.onarchive?.(e)}Mn(()=>{let e=G(s);if(e&&t.catalog.kind===`ready`&&t.catalog.entries.some(t=>t.planName===e&&t.archived)&&queueMicrotask(()=>{o[e]?.querySelector(`button`)?.focus(),B(s,null)}),t.state){l=!0;return}if(l&&(l=!1,u=!0),!u)return;let n=t.catalog.kind,r=G(c);queueMicrotask(()=>{let e=r?o[r]?.querySelector(`button`):void 0;e?.isConnected?(e.focus(),u=!1):n!==`loading`&&(G(a)?.focus(),u=!1)})});var g=Kr(),_=H(g),v=e=>{zf(e,{get preview(){return t.state},onclose:p,get onreference(){return t.onreference},get verifiedReferences(){return G(i)}})},y=e=>{vf(e,{get state(){return t.state},onclose:p,get onreference(){return t.onreference},get verifiedReferences(){return G(i)}})},x=e=>{var r=$f(),i=V(r),o=V(i);Ui(o,e=>B(a,e),()=>G(a));var s=U(o,2);P(i);var c=U(i,2),l=e=>{J(e,Kf())},u=e=>{J(e,qf())},p=e=>{var n=Jf(),r=V(n,!0);P(n),W(()=>Y(r,t.catalog.error)),J(e,n)},m=e=>{J(e,Yf())},h=e=>{var t=Qf(),r=U(H(t),2),i=e=>{var t=Xf();Z(t,21,()=>G(d),e=>e.planName,(e,t)=>{n(e,()=>G(t))}),P(t),J(e,t)};X(r,e=>{G(d).length>0&&e(i)});var a=U(r,2),o=e=>{var t=Zf(),r=U(V(t),2);Z(r,21,()=>G(f),e=>e.planName,(e,t)=>{n(e,()=>G(t))}),P(r),P(t),J(e,t)};X(a,e=>{G(f).length>0&&e(o)}),J(e,t)};X(c,e=>{t.catalog.kind===`no-workspace`?e(l):t.catalog.kind===`loading`?e(u,1):t.catalog.kind===`error`?e(p,2):t.catalog.entries.length===0?e(m,3):e(h,-1)}),P(r),W(()=>{Si(s,1,gi([`catalog-update`,{inactive:t.catalog.kind!==`ready`||!t.catalog.refreshing}]),`svelte-x2ko9l`),Q(s,`aria-hidden`,t.catalog.kind!==`ready`||!t.catalog.refreshing)}),J(e,r)};X(_,e=>{t.state?.kind===`org-source`?e(v):t.state?e(y,1):e(x,-1)}),J(e,g),et()}var tp=`settings`,np=`drafts`,rp=`cursors`,ip=`selected-session`,ap={text:``,revision:0},op=e=>{if(!e||typeof e!=`object`)return!1;let t=e,n=t.pending;return typeof t.text==`string`&&Number.isSafeInteger(t.revision)&&t.revision>=0&&(n===void 0||Array.isArray(n)&&n.every(e=>!!e&&typeof e.operationId==`string`&&typeof e.text==`string`&&Number.isSafeInteger(e.revision)&&e.revision>=0&&(e.kind===`send`||e.kind===`queue`||e.kind===`interrupt-send`)))};function sp(e=globalThis.indexedDB){if(!e)return cp;let t=hl(e),n=new Map,r=new Map,i=async(e,i)=>{let a=r.get(e);if(a&&a.revision>i.revision)return;r.set(e,i);let o=(n.get(e)??Promise.resolve()).catch(()=>void 0).then(async()=>{if(r.get(e)===i)try{await _l(await t,np,e,i)}catch{}});n.set(e,o),await o};return{async readSelectedSession(){try{return await gl(await t,tp,ip)??null}catch{return null}},async saveSelectedSession(e){try{let n=await t;e?await _l(n,tp,ip,e):await vl(n,tp,ip)}catch{}},async readDraft(e){return(await this.readDraftEnvelope(e)).text},async saveDraft(e,t){let n=await this.readDraftEnvelope(e);await i(e,{text:t,revision:n.revision+1})},async readDraftEnvelope(e){try{let n=await gl(await t,np,e),i=op(n)?n:typeof n==`string`?{text:n,revision:0}:ap,a=r.get(e);return a&&a.revision>=i.revision?a:(r.set(e,i),i)}catch{return r.get(e)??ap}},saveDraftEnvelope:i,replaceDraftText:async(e,t,n)=>{let a=r.get(e);await i(e,{text:t,revision:n,pending:a?.pending})},addPendingDraftOperation:async(e,t)=>{let n=r.get(e)??ap;await i(e,{...n,pending:[...(n.pending??[]).filter(e=>e.operationId!==t.operationId),t].slice(-8)})},consumeAcceptedDraft:async(e,i,a)=>{let o=n.get(e)??Promise.resolve(),s=null,c=o.catch(()=>void 0).then(async()=>{let n=r.get(e);if(!n)try{let r=await gl(await t,np,e);n=op(r)?r:typeof r==`string`?{text:r,revision:0}:ap}catch{n=ap}if(!(n.revision!==i||!n.pending?.some(e=>e.operationId===a))){s={text:``,revision:n.revision+1,pending:n.pending.filter(e=>e.operationId!==a)},r.set(e,s);try{await _l(await t,np,e,s)}catch{r.get(e)===s&&r.set(e,n),s=null}}});return n.set(e,c),await c,s},async readCursor(e){try{let n=await gl(await t,rp,e);return typeof n==`number`&&Number.isSafeInteger(n)&&n>=0?n:0}catch{return 0}},async saveCursor(e,n){try{await _l(await t,rp,e,n)}catch{}}}}var cp={readSelectedSession:async()=>null,saveSelectedSession:async()=>{},readDraft:async()=>``,saveDraft:async()=>{},readDraftEnvelope:async()=>ap,saveDraftEnvelope:async()=>{},replaceDraftText:async()=>{},addPendingDraftOperation:async()=>{},consumeAcceptedDraft:async()=>null,readCursor:async()=>0,saveCursor:async()=>{}};function lp(e,t=Date.now()){if(e===null)return`Unknown activity time`;let n=Math.max(0,t-e),r=Math.floor(n/(3600*1e3));if(r<1)return`Less than an hour ago`;if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.floor(r/24);return`${i} day${i===1?``:`s`} ago`}function up(e){return!!(e?.plan||e?.lastOrgPlan?.attached)}function dp(e){let t=e.updatedAt?Date.parse(e.updatedAt):NaN;return{threadId:e.threadId??null,workspacePath:e.workspacePath??`Workspace unavailable`,updatedAt:Number.isFinite(t)?t:null}}function fp(e,t){if(!t?.threadId||!t.workspacePath||!t.resumeCommand||e.some(e=>e.id===t.threadId&&(e.provider??`codex`)===(t.provider??`codex`)))return e;let n=t.updatedAt?Date.parse(t.updatedAt)/1e3:NaN,r={id:t.threadId,cwd:t.workspacePath,recencyAt:Number.isFinite(n)?n:null,resumeCommand:t.resumeCommand,...t.provider===void 0?{}:{provider:t.provider},...t.model===void 0?{}:{model:t.model},...t.effectiveSkillSelection?.selectedProfileName===void 0?{}:{skillProfile:t.effectiveSkillSelection.selectedProfileName},...t.lastOrgPlan===void 0?{}:{orgPlanFilename:t.lastOrgPlan.filename}};return[...e,r].sort((e,t)=>(t.recencyAt??-1/0)-(e.recencyAt??-1/0))}function pp(e){let t=/^\/home\/[^/]+/.exec(e)?.[0];if(!t)return e;let n=e.slice(t.length);return n?`~${n}`:`~/`}var mp=[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],hp=(e,t=b)=>{var n=yp(),r=H(n),i=e=>{J(e,gp())},a=L(()=>up(t()));X(r,e=>{G(a)&&e(i)});var o=U(r,2),s=e=>{var n=_p(),r=V(n),i=V(r,!0);P(r);var a=U(r,2),o=V(a,!0);P(a),P(n),W(()=>{Y(i,t().lastOrgPlan.title),Y(o,t().lastOrgPlan.filename)}),J(e,n)};X(o,e=>{t().lastOrgPlan&&e(s)});var c=U(o,2),l=e=>{var n=vp(),r=V(n);{let e=L(()=>`Plan progress for ${t().plan.title}`);$d(r,{compact:!0,get plan(){return t().plan},get label(){return G(e)}})}P(n),J(e,n)};X(c,e=>{t().plan&&e(l)}),J(e,n)},gp=q(`<span class="profile-badge svelte-hxb22h">Org plan attached</span>`),_p=q(`<span class="org-plan-metadata svelte-hxb22h"><span class="org-plan-title svelte-hxb22h"> </span> <span class="org-plan-filename svelte-hxb22h"> </span></span>`),vp=q(`<div class="session-plan-progress svelte-hxb22h"><!></div>`),yp=q(`<!> <!> <!>`,1),bp=q(`<details class="self-debug-details svelte-hxb22h"><summary class="svelte-hxb22h">Self DEBUG</summary> <!> <button type="button" class="svelte-hxb22h">Redacted diagnostic trace (JSON)</button></details>`),xp=q(`<!> <!>`,1),Sp=q(`<details class="session-verdict svelte-hxb22h"><summary class="svelte-hxb22h"><span aria-hidden="true"></span> </summary> <p class="svelte-hxb22h"> </p></details>`),Cp=q(`<time class="svelte-hxb22h"> </time>`),wp=q(`<div class="svelte-hxb22h"> </div>`),Tp=q(`<span class="profile-badge svelte-hxb22h"> </span>`),Ep=q(`<span class="profile-badge svelte-hxb22h">Kimi</span>`),Dp=q(`<li><div class="session-actions svelte-hxb22h" aria-label="Session actions"><!> <!> <!> <!></div> <div class="session-details svelte-hxb22h"><!> <div class="session-summary svelte-hxb22h"><!> <!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!> <!></div> <!> <!></div></li>`),Op=q(`<section aria-labelledby="open-sessions-title" class="svelte-hxb22h"><h3 id="open-sessions-title" class="svelte-hxb22h">Open sessions</h3> <ul class="session-list svelte-hxb22h" aria-label="Open sessions"></ul></section>`),kp=q(`<li class="managed-session svelte-hxb22h"><div class="session-actions svelte-hxb22h"><!> <!> <!></div> <div class="session-details svelte-hxb22h"><!> <!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!> <!></div></li>`),Ap=q(`<ul class="session-list svelte-hxb22h" aria-label="Saved sessions"></ul>`),jp=q(`<p class="svelte-hxb22h">No saved sessions yet.</p>`),Mp=q(`<option class="svelte-hxb22h"> </option>`),Np=q(`<option class="svelte-hxb22h">Loading models…</option>`),Pp=q(`<option class="svelte-hxb22h">Choose automatically</option>`),Fp=q(`<p class="skills-profile-error svelte-hxb22h" role="alert"> </p>`),Ip=q(`<fieldset class="executor-settings svelte-hxb22h"><legend class="svelte-hxb22h">Org-plan executor</legend> <label for="executor-model" class="svelte-hxb22h">Executor model <select id="executor-model" class="svelte-hxb22h"></select></label> <label for="executor-thinking" class="svelte-hxb22h">Executor thinking <select id="executor-thinking" class="svelte-hxb22h"></select></label></fieldset>`),Lp=q(`<label for="model-thinking" class="svelte-hxb22h">Model thinking <select id="model-thinking" class="svelte-hxb22h"></select></label>`),Rp=q(`<label for="sandbox" class="svelte-hxb22h">Sandbox</label> <label for="approval-policy" class="svelte-hxb22h">Approval policy</label>`,1),zp=q(`<select id="sandbox" class="svelte-hxb22h"><option class="svelte-hxb22h">workspace-git (Git writable)</option><option class="svelte-hxb22h">workspace-write</option><option class="svelte-hxb22h">read-only</option><option class="svelte-hxb22h">danger-full-access</option></select> <select id="approval-policy" class="svelte-hxb22h"><option class="svelte-hxb22h">Ask on all commands</option><option class="svelte-hxb22h">Ask out of workspace</option><option class="svelte-hxb22h">Never ask for approval</option></select>`,1),Bp=q(`<li class="recent-session svelte-hxb22h"><div class="session-details svelte-hxb22h"><!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!></div> <div class="session-actions svelte-hxb22h"><!> <!></div></li>`),Vp=q(`<ul class="session-list recent-session-list svelte-hxb22h" aria-label="Recent sessions"></ul>`),Hp=q(`<p class="svelte-hxb22h">No other recent sessions found.</p>`),Up=q(`<dialog aria-labelledby="close-session-title" class="svelte-hxb22h"><h2 id="close-session-title" class="svelte-hxb22h">Close session?</h2> <p class="svelte-hxb22h">You can reopen this session from the session list.</p> <div class="dialog-actions svelte-hxb22h"><!> <!></div></dialog> <section aria-labelledby="sessions-title" class="svelte-hxb22h"><h2 id="sessions-title" class="visually-hidden svelte-hxb22h">Sessions</h2> <!> <!> <form class="svelte-hxb22h"><h3 class="new-session-title svelte-hxb22h">New session</h3> <div class="session-base svelte-hxb22h"><!></div> <div class="essential-settings svelte-hxb22h"><label for="skills-profile" class="svelte-hxb22h">Skills profile <select id="skills-profile" class="svelte-hxb22h"><option class="svelte-hxb22h">Default</option><!></select></label> <label for="model" class="svelte-hxb22h">Model <select id="model" class="svelte-hxb22h"><!><!></select></label></div> <!> <details class="advanced-settings svelte-hxb22h"><summary class="svelte-hxb22h">Advanced settings</summary> <div class="advanced-content svelte-hxb22h"><section class="session-settings svelte-hxb22h" aria-label="New session settings"><div class="advanced-model-settings svelte-hxb22h"><!> <fieldset class="supervisor-settings svelte-hxb22h"><legend class="svelte-hxb22h">Main supervisor</legend> <!> <div class="provider-control svelte-hxb22h"><label for="session-provider" class="svelte-hxb22h">Provider</label> <select id="session-provider" class="svelte-hxb22h"><option class="svelte-hxb22h">Codex</option><option class="svelte-hxb22h"> </option></select></div></fieldset></div> <div class="session-setting-labels svelte-hxb22h"><!></div> <div class="session-setting-controls svelte-hxb22h"><!></div> <div class="session-secondary-actions svelte-hxb22h"><!> <!></div></section></div></details> <div class="create-session-actions svelte-hxb22h"><!></div></form> <section aria-labelledby="recent-sessions-title" class="svelte-hxb22h"><h3 id="recent-sessions-title" class="svelte-hxb22h">Recent sessions</h3> <!></section></section>`,1);function Wp(e,t){$e(t,!0);let n=(e,t=b)=>{var n=Kr(),r=H(n),i=e=>{var n=bp(),r=U(V(n),2);Ma(r,{get context(){return t().selfDebug.context}});var i=U(r,2);P(n),K(`click`,i,e=>ee()(t(),e.currentTarget)),J(e,n)};X(r,e=>{t().selfDebug&&e(i)}),J(e,n)},r=$(t,`activitySnapshots`,19,()=>new Map),i=$(t,`autopilotSnapshots`,19,()=>new Map),a=$(t,`autopilotPending`,19,()=>new Set),o=$(t,`autopilotAttention`,19,()=>new Map),s=$(t,`models`,19,()=>[]),c=$(t,`selectedModel`,3,``),l=$(t,`reasoningEffort`,3,`medium`),u=$(t,`executorModels`,19,()=>[]),d=$(t,`executorModel`,3,`gpt-5.6-terra`),f=$(t,`executorReasoningEffort`,3,`high`),p=$(t,`onreasoningchange`,3,()=>{}),m=$(t,`onexecutormodelchange`,3,()=>{}),h=$(t,`onexecutorreasoningchange`,3,()=>{}),g=$(t,`provider`,3,`codex`),_=$(t,`kimiAvailable`,3,!1),v=$(t,`modelsLoading`,3,!1),y=$(t,`onmodelchange`,3,()=>{}),x=$(t,`onproviderchange`,3,()=>{}),S=$(t,`onautopilottoggle`,3,()=>{}),C=$(t,`onactivityopen`,3,()=>{}),w=$(t,`onautopilotresolve`,3,()=>{}),T=$(t,`savingDefaults`,3,!1),E=$(t,`advancedExpanded`,15,!1),D=$(t,`onsavedefaults`,3,()=>{}),ee=$(t,`ondebugtrace`,3,()=>{}),te=L(()=>t.sessions.filter(e=>e.state===`ready`||e.state===`turnActive`)),ne=L(()=>t.sessions.filter(e=>e.state!==`ready`&&e.state!==`turnActive`)),re=L(()=>t.recentSessions.filter(e=>!G(te).some(t=>t.threadId===e.id&&(t.provider??`codex`)===(e.provider??`codex`)))),ie=L(()=>Gu(t.workspaceTree,t.workspaceId)),O=z(null),ae=z(null);function oe(e){B(ae,e,!0),G(O)?.showModal()}var se=Up(),ce=H(se),le=U(V(ce),4),ue=V(le);Ya(ue,{onclick:()=>G(O)?.close(),children:(e,t)=>{Ue(),J(e,Gr(`Cancel`))},$$slots:{default:!0}}),Ya(U(ue,2),{primary:!0,onclick:()=>{G(ae)&&t.onclose(G(ae)),G(O)?.close()},children:(e,t)=>{Ue(),J(e,Gr(`Close session`))},$$slots:{default:!0}}),P(le),P(ce),Ui(ce,e=>B(O,e),()=>G(O));var k=U(ce,2),de=U(V(k),2),fe=e=>{var c=Op(),l=U(V(c),2);Z(l,21,()=>G(te),e=>e.id,(e,c)=>{let l=L(()=>dp(G(c))),u=L(()=>yu(G(c).sessionStatus)?G(c).sessionStatus:null);var d=Dp();let f;var p=V(d),m=V(p);{let e=L(()=>G(c).id===t.selectedSessionId?`page`:void 0);Ya(m,{compact:!0,full:!0,get current(){return G(e)},onclick:()=>t.onselectopen(G(c).id),children:(e,t)=>{Ue(),J(e,Gr(`Open`))},$$slots:{default:!0}})}var h=U(m,2),g=e=>{Ya(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(G(c).resumeCommand),children:(e,t)=>{Ue(),J(e,Gr(`Copy CLI`))},$$slots:{default:!0}})};X(h,e=>{G(c).resumeCommand&&G(c).provider!==`kimi`&&e(g)});var _=U(h,2),v=e=>{var t=xp(),n=H(t),o=e=>{{let t=L(()=>i().get(G(c).id)??G(c).autopilot??null),n=L(()=>`session-autopilot-${G(c).id}`),r=L(()=>a().has(G(c).id));ko(e,{compact:!0,indicatorOnly:!0,get autopilot(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},ontoggle:e=>S()(G(c).id,e)})}};X(n,e=>{G(c).provider!==`kimi`&&e(o)});var l=U(n,2);{let e=L(()=>r().get(G(c).id)??G(c).agentActivity??null),t=L(()=>G(c).model??s()?.[0]);so(l,{compact:!0,get activity(){return G(e)},get rootModel(){return G(t)},get plan(){return G(c).plan},onopen:()=>C()(G(c).id)})}J(e,t)},y=L(()=>up(G(c)));X(_,e=>{G(y)&&e(v)}),Ya(U(_,2),{compact:!0,full:!0,onclick:()=>oe(G(c).id),children:(e,t)=>{Ue(),J(e,Gr(`Close`))},$$slots:{default:!0}}),P(p);var b=U(p,2),x=V(b);n(x,()=>G(c));var T=U(x,2),E=V(T),D=e=>{var t=Sp(),n=V(t),r=V(n);let i;var a=U(r);P(n);var o=U(n,2),s=V(o);P(o),P(t),W(()=>{Q(t,`data-state`,G(u).state),Q(t,`aria-label`,`${G(u).state===`working`?`Working`:`Idle`}: ${G(u).reason}`),Q(n,`aria-label`,`${G(u).state===`working`?`Working`:`Idle`}: ${G(u).reason}`),i=Si(r,1,`verdict-dot svelte-hxb22h`,null,i,{live:G(u).state===`working`&&G(u).confidence===`fresh`}),Y(a,` ${G(u).state===`working`?`Working`:`Idle`}`),Y(s,`${G(u).reason??``}. ${G(u).nextExpectedAction??``}
|
|
30
|
+
Evidence confidence: ${G(u).confidence??``}.`)}),J(e,t)};X(E,e=>{G(u)&&e(D)});var ee=U(E,2),te=e=>{var t=Cp(),n=V(t,!0);P(t),W((e,r)=>{Q(t,`datetime`,e),Y(n,r)},[()=>new Date(G(l).updatedAt).toISOString(),()=>lp(G(l).updatedAt)]),J(e,t)},ne=e=>{var t=wp(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>lp(null)]),J(e,t)};X(ee,e=>{G(l).updatedAt===null?e(ne,-1):e(te)});var re=U(ee,2),ie=V(re,!0);P(re);var O=U(re,2),ae=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Model: ${G(c).model??``}`)),J(e,t)};X(O,e=>{G(c).model&&e(ae)});var se=U(O,2),ce=e=>{J(e,Ep())};X(se,e=>{G(c).provider===`kimi`&&e(ce)});var le=U(se,2),ue=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Branch: ${G(c).branch??``}`)),J(e,t)};X(le,e=>{G(c).branch&&e(ue)});var k=U(le,2),de=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Skills profile: ${G(c).effectiveSkillSelection.selectedProfileName??``}`)),J(e,t)};X(k,e=>{G(c).effectiveSkillSelection?.selectedProfileName&&e(de)}),hp(U(k,2),()=>G(c)),P(T);var fe=U(T,2);{let e=L(()=>o().get(G(c).id)??null),t=L(()=>`session-attention-${G(c).id}`),n=L(()=>a().has(G(c).id));No(fe,{get attention(){return G(e)},get controlId(){return G(t)},get pending(){return G(n)},onresolve:(e,t)=>w()(G(c).id,e,t)})}var pe=U(fe,2);{let e=L(()=>i().get(G(c).id)??G(c).autopilot??null),t=L(()=>o().get(G(c).id)??null),n=L(()=>`session-autopilot-safety-${G(c).id}`),r=L(()=>a().has(G(c).id));Fo(pe,{get autopilot(){return G(e)},get attention(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},onrecover:()=>S()(G(c).id,!0),ondisable:()=>S()(G(c).id,!1)})}P(b),P(d),W(e=>{f=Si(d,1,`managed-session open-session svelte-hxb22h`,null,f,{"current-session":G(c).id===t.selectedSessionId}),Y(ie,e)},[()=>pp(G(l).workspacePath)]),J(e,d)}),P(l),P(c),J(e,c)};X(de,e=>{G(te).length&&e(fe)});var pe=U(de,2),me=e=>{var r=Ap();Z(r,21,()=>G(ne),e=>e.id,(e,r)=>{let i=L(()=>dp(G(r)));var a=kp(),o=V(a),s=V(o);{let e=L(()=>t.openingSessionId===G(r).id);Ya(s,{compact:!0,full:!0,get disabled(){return G(e)},onclick:()=>t.onopen(G(r).id),children:(e,n)=>{Ue();var i=Gr();W(()=>Y(i,t.openingSessionId===G(r).id?`Opening…`:`Open`)),J(e,i)},$$slots:{default:!0}})}var c=U(s,2),l=e=>{Ya(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(G(r).resumeCommand),children:(e,t)=>{Ue(),J(e,Gr(`Copy CLI`))},$$slots:{default:!0}})};X(c,e=>{G(r).resumeCommand&&G(r).provider!==`kimi`&&e(l)}),Ya(U(c,2),{compact:!0,full:!0,onclick:()=>t.onforget(G(r).id),children:(e,t)=>{Ue(),J(e,Gr(`Forget`))},$$slots:{default:!0}}),P(o);var u=U(o,2),d=V(u);n(d,()=>G(r));var f=U(d,2),p=e=>{var t=Cp(),n=V(t,!0);P(t),W((e,r)=>{Q(t,`datetime`,e),Y(n,r)},[()=>new Date(G(i).updatedAt).toISOString(),()=>lp(G(i).updatedAt)]),J(e,t)},m=e=>{var t=wp(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>lp(null)]),J(e,t)};X(f,e=>{G(i).updatedAt===null?e(m,-1):e(p)});var h=U(f,2),g=V(h,!0);P(h);var _=U(h,2),v=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Model: ${G(r).model??``}`)),J(e,t)};X(_,e=>{G(r).model&&e(v)});var y=U(_,2),b=e=>{J(e,Ep())};X(y,e=>{G(r).provider===`kimi`&&e(b)});var x=U(y,2),S=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Branch: ${G(r).branch??``}`)),J(e,t)};X(x,e=>{G(r).branch&&e(S)});var C=U(x,2),w=e=>{var t=Tp(),n=V(t);P(t),W(()=>Y(n,`Skills profile: ${G(r).effectiveSkillSelection.selectedProfileName??``}`)),J(e,t)};X(C,e=>{G(r).effectiveSkillSelection?.selectedProfileName&&e(w)}),hp(U(C,2),()=>G(r)),P(u),P(a),W(e=>Y(g,e),[()=>pp(G(i).workspacePath)]),J(e,a)}),P(r),J(e,r)},he=e=>{J(e,jp())};X(pe,e=>{G(ne).length?e(me):G(te).length||e(he,1)});var ge=U(pe,2),_e=U(V(ge),2),A=V(_e);{let e=L(()=>G(ie)?.id??null);$u(A,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return G(e)},get isSelectable(){return Bu.sessionBase},label:`Session base`,get onexpandedchange(){return t.onexpandedchange},onselect:e=>t.onworkspacechange(e.id)})}P(_e);var ve=U(_e,2),ye=V(ve),be=U(V(ye)),xe=V(be);xe.value=xe.__value=``,Z(U(xe),17,()=>t.skillProfiles,e=>e.name,(e,t)=>{var n=Mp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,G(t).name),i!==(i=G(t).name)&&(n.value=(n.__value=G(t).name)??``)}),J(e,n)}),P(be);var Se;Ei(be),P(ye);var Ce=U(ye,2),we=U(V(Ce)),Te=V(we),Ee=e=>{var t=Np();t.value=t.__value=``,J(e,t)},De=e=>{var t=Pp();t.value=t.__value=``,J(e,t)};X(Te,e=>{v()?e(Ee):s().length===0&&e(De,1)}),Z(U(Te),16,s,e=>e,(e,t)=>{var n=Mp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(we);var Oe;Ei(we),P(Ce),P(ve);var ke=U(ve,2),Ae=e=>{var n=Fp(),r=V(n,!0);P(n),W(()=>Y(r,t.skillProfileError)),J(e,n)};X(ke,e=>{t.skillProfileError&&e(Ae)});var je=U(ke,2),Me=U(V(je),2),j=V(Me),Ne=V(j),Pe=V(Ne),Fe=e=>{var t=Ip(),n=U(V(t),2),r=U(V(n));Z(r,20,()=>[...new Set([d(),...u()])],e=>e,(e,t)=>{var n=Mp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(r);var i;Ei(r),P(n);var a=U(n,2),o=U(V(a));Z(o,20,()=>mp,e=>e,(e,t)=>{var n=Mp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(o);var s;Ei(o),P(a),P(t),W(()=>{i!==(i=d())&&(r.value=(r.__value=d())??``,Ti(r,d())),s!==(s=f())&&(o.value=(o.__value=f())??``,Ti(o,f()))}),K(`change`,r,e=>m()(e.currentTarget.value)),K(`change`,o,e=>h()(e.currentTarget.value)),J(e,t)};X(Pe,e=>{g()===`codex`&&e(Fe)});var Ie=U(Pe,2),Le=U(V(Ie),2),Re=e=>{var t=Lp(),n=U(V(t));Z(n,20,()=>mp,e=>e,(e,t)=>{var n=Mp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(n);var r;Ei(n),P(t),W(()=>{r!==(r=l())&&(n.value=(n.__value=l())??``,Ti(n,l()))}),K(`change`,n,e=>p()(e.currentTarget.value)),J(e,t)};X(Le,e=>{g()===`codex`&&e(Re)});var ze=U(Le,2),M=U(V(ze),2),Be=V(M);Be.value=Be.__value=`codex`;var N=U(Be),Ve=V(N);P(N),N.value=N.__value=`kimi`,P(M);var He;Ei(M),P(ze),P(Ie),P(Ne);var We=U(Ne,2);let Ge;var Ke=V(We),qe=e=>{var t=Rp();Ue(2),J(e,t)};X(Ke,e=>{g()!==`kimi`&&e(qe)}),P(We);var Je=U(We,2);let Ye;var Xe=V(Je),Ze=e=>{var n=zp(),r=H(n),i=V(r);i.value=i.__value=`workspace-git`;var a=U(i);a.value=a.__value=`workspace-write`;var o=U(a);o.value=o.__value=`read-only`;var s=U(o);s.value=s.__value=`danger-full-access`,P(r);var c;Ei(r);var l=U(r,2),u=V(l);u.value=u.__value=`untrusted`;var d=U(u);d.value=d.__value=`on-request`;var f=U(d);f.value=f.__value=`never`,P(l);var p;Ei(l),W(()=>{c!==(c=t.sandbox)&&(r.value=(r.__value=t.sandbox)??``,Ti(r,t.sandbox)),p!==(p=t.approvalPolicy)&&(l.value=(l.__value=t.approvalPolicy)??``,Ti(l,t.approvalPolicy))}),K(`change`,r,e=>t.onsandboxchange(e.currentTarget.value)),K(`change`,l,e=>t.onapprovalpolicychange(e.currentTarget.value)),J(e,n)};X(Xe,e=>{g()!==`kimi`&&e(Ze)}),P(Je);var Qe=U(Je,2),tt=V(Qe);Ya(tt,{class:`manage-profiles-button`,id:`manage-skill-profiles`,onclick:e=>t.onmanageprofiles(e.currentTarget),children:(e,t)=>{Ue(),J(e,Gr(`Manage skill profiles`))},$$slots:{default:!0}});var nt=U(tt,2);{let e=L(()=>T()||v()||!c());Ya(nt,{class:`save-defaults-button`,get disabled(){return G(e)},get onclick(){return D()},children:(e,t)=>{Ue();var n=Gr();W(()=>Y(n,T()?`Saving…`:`Save as defaults`)),J(e,n)},$$slots:{default:!0}})}P(Qe),P(j),P(Me),P(je);var rt=U(je,2),it=V(rt);{let e=L(()=>!G(ie)||t.startingSession||v()||s().length>0&&!c());Ya(it,{class:`new-session-button`,type:`submit`,full:!0,primary:!0,get disabled(){return G(e)},children:(e,n)=>{Ue();var r=Gr();W(()=>Y(r,t.startingSession?`Creating…`:`Create session`)),J(e,r)},$$slots:{default:!0}})}P(rt),P(ge);var at=U(ge,2),ot=U(V(at),2),st=e=>{var n=Vp();Z(n,21,()=>G(re),e=>(e.provider??`codex`)+`:`+e.id,(e,n)=>{var r=Bp(),i=V(r),a=V(i),o=e=>{var t=Cp(),r=V(t,!0);P(t),W((e,n)=>{Q(t,`datetime`,e),Y(r,n)},[()=>new Date(G(n).recencyAt*1e3).toISOString(),()=>lp(G(n).recencyAt*1e3)]),J(e,t)},s=e=>{var t=wp(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>lp(null)]),J(e,t)};X(a,e=>{G(n).recencyAt===null?e(s,-1):e(o)});var c=U(a,2),l=V(c,!0);P(c);var u=U(c,2),d=e=>{var t=Tp(),r=V(t);P(t),W(()=>Y(r,`Model: ${G(n).model??``}`)),J(e,t)};X(u,e=>{G(n).model&&e(d)});var f=U(u,2),p=e=>{J(e,Ep())};X(f,e=>{G(n).provider===`kimi`&&e(p)});var m=U(f,2),h=e=>{var t=Tp(),r=V(t);P(t),W(()=>Y(r,`Skills profile: ${G(n).skillProfile??``}`)),J(e,t)};X(m,e=>{G(n).skillProfile&&e(h)});var g=U(m,2),_=e=>{var t=Tp(),r=V(t);P(t),W(()=>Y(r,`Org plan: ${G(n).orgPlanFilename??``}`)),J(e,t)};X(g,e=>{G(n).orgPlanFilename&&e(_)}),P(i);var v=U(i,2),y=V(v);Ya(y,{onclick:()=>t.onopenrecent(G(n)),children:(e,t)=>{Ue(),J(e,Gr(`Open`))},$$slots:{default:!0}});var b=U(y,2),x=e=>{Ya(e,{onclick:()=>t.oncopyresume(G(n).resumeCommand),children:(e,t)=>{Ue(),J(e,Gr(`Copy to CLI`))},$$slots:{default:!0}})};X(b,e=>{G(n).resumeCommand&&e(x)}),P(v),P(r),W(e=>Y(l,e),[()=>pp(G(n).cwd)]),J(e,r)}),P(n),J(e,n)},ct=e=>{J(e,Hp())};X(ot,e=>{G(re).length?e(st):e(ct,-1)}),P(at),P(k),W(()=>{Se!==(Se=t.selectedSkillProfile)&&(be.value=(be.__value=t.selectedSkillProfile)??``,Ti(be,t.selectedSkillProfile)),we.disabled=v()||s().length===0,Oe!==(Oe=c())&&(we.value=(we.__value=c())??``,Ti(we,c())),N.disabled=!_(),Y(Ve,`Kimi${_()?``:` (unavailable)`}`),He!==(He=g())&&(M.value=(M.__value=g())??``,Ti(M,g())),Ge=wi(We,``,Ge,{"grid-template-columns":g()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`}),Ye=wi(Je,``,Ye,{"grid-template-columns":g()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`})}),Lr(`close`,ce,()=>B(ae,null)),Lr(`submit`,ge,e=>{e.preventDefault(),t.onstart()}),K(`change`,be,e=>t.onskillprofilechange(e.currentTarget.value)),K(`change`,we,e=>y()(e.currentTarget.value)),K(`change`,M,e=>x()(e.currentTarget.value)),Wi(`open`,`toggle`,je,E,E),J(e,se),et()}Rr([`click`,`change`]);function Gp(e){let t={};return e.workspaceId||(t.workspaceId=`Choose a workspace.`),e.profile||(t.profile=`Choose a profile.`),e.profile&&e.profileState&&e.profileState!==`ok`&&(t.profile=`Sign in to this profile before starting Codex.`),t}var Kp=class{transport;key;onChange;#e={starting:!1,error:null};#t=0;#n=!1;#r=null;constructor(e,t,n){this.transport=e,this.key=t,this.onChange=n}get state(){return this.#e}async start(e,t){if(this.#n||this.#e.starting||!e)return null;let n=++this.#t;this.#a({starting:!0,error:null});let r=this.#r??=this.key();try{let i=await this.transport.start(e,t,r);return this.#i(n)&&(this.#r=null),this.#i(n)?i:null}catch(e){return this.#i(n)&&this.#a({starting:!1,error:e instanceof Error?e.message:`Could not start session.`}),null}finally{this.#i(n)&&this.#a({...this.#e,starting:!1})}}dispose(){this.#n=!0,++this.#t}#i(e){return!this.#n&&e===this.#t}#a(e){this.#n||(this.#e=e,this.onChange(e))}};function qp({chatEnabled:e}){return[`sessions`,`git`,...e?[`chat`]:[],`plan`]}function Jp(e,t,n={chatEnabled:!0}){let r=qp(n);return r[(r.indexOf(e)+t+r.length)%r.length]}var Yp=q(`<nav class="bottom-navigation" aria-label="Primary"><button>Sessions</button> <button>Git</button> <button>Chat</button> <button>Plan</button></nav>`);function Xp(e,t){$e(t,!0);let n=$(t,`focusTab`,3,null),r=on({});Mn(()=>{n()&&r[n()]?.focus()});function i(e){let n=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:null;if(n===null)return;e.preventDefault();let i=Jp(t.activeTab,n,{chatEnabled:t.chatEnabled});t.onselect(i),r[i]?.focus()}var a=Yp(),o=V(a);Ui(o,e=>r.sessions=e,()=>r?.sessions);var s=U(o,2);Ui(s,e=>r.git=e,()=>r?.git);var c=U(s,2);Ui(c,e=>r.chat=e,()=>r?.chat);var l=U(c,2);Ui(l,e=>r.plan=e,()=>r?.plan),P(a),W(()=>{Q(o,`aria-pressed`,t.activeTab===`sessions`),Q(s,`aria-pressed`,t.activeTab===`git`),Q(c,`aria-pressed`,t.activeTab===`chat`),c.disabled=!t.chatEnabled,Q(l,`aria-pressed`,t.activeTab===`plan`)}),K(`keydown`,o,i),K(`click`,o,()=>t.onselect(`sessions`)),K(`keydown`,s,i),K(`click`,s,()=>t.onselect(`git`)),K(`keydown`,c,i),K(`click`,c,()=>t.onselect(`chat`)),K(`keydown`,l,i),K(`click`,l,()=>t.onselect(`plan`)),J(e,a),et()}Rr([`keydown`,`click`]);var Zp=q(`<option> </option>`),Qp=q(`<p id="skills-status" aria-live="polite">Loading skills…</p>`),$p=q(`<p id="skills-status">No skills were discovered for this workspace and Codex profile.</p>`),em=q(`<p id="skills-status" class="notice svelte-dg6sjj" role="status"> </p>`),tm=q(`<p id="skills-status" class="error svelte-dg6sjj" role="alert"> </p>`),nm=q(`<p id="skills-status" class="error svelte-dg6sjj" role="alert" tabindex="-1"> </p>`),rm=q(`<p id="skills-status" role="status">Profile saved.</p>`),im=q(`<p id="skills-status" role="status">Profile deleted.</p>`),am=q(`<li class="svelte-dg6sjj"><div class="svelte-dg6sjj"><strong> </strong> <span class="missing-state svelte-dg6sjj">Missing · disabled</span> <span class="path svelte-dg6sjj"> </span></div> <button type="button" class="remove-missing svelte-dg6sjj">Remove</button></li>`),om=q(`<section class="missing-skills svelte-dg6sjj" aria-labelledby="missing-skills-title"><h3 id="missing-skills-title" class="svelte-dg6sjj">Missing skills</h3> <p class="svelte-dg6sjj">These saved paths no longer exist. They are disabled for new sessions until restored or
|
|
31
|
+
removed from the profile.</p> <ul class="svelte-dg6sjj"></ul></section>`),sm=q(`<p class="svelte-dg6sjj"> </p>`),cm=q(`<li> </li>`),lm=q(`<dt class="svelte-dg6sjj">Tool dependencies</dt> <dd class="svelte-dg6sjj"><ul class="svelte-dg6sjj"></ul></dd>`,1),um=q(`<li class="skill-card svelte-dg6sjj"><label class="skill-toggle svelte-dg6sjj"><input type="checkbox" class="svelte-dg6sjj"/> <span class="svelte-dg6sjj"> </span> <span class="state svelte-dg6sjj"> </span></label> <div class="skill-details svelte-dg6sjj"><!> <!> <dl class="svelte-dg6sjj"><dt class="svelte-dg6sjj">Path</dt> <dd class="path svelte-dg6sjj"> </dd> <!></dl></div></li>`),dm=q(`<div class="skills-toolbar svelte-dg6sjj"><button type="button" class="refresh-skills svelte-dg6sjj" aria-label="Refresh skills"><span aria-hidden="true" class="svelte-dg6sjj">↻</span><span class="svelte-dg6sjj">Refresh</span></button> <p class="summary svelte-dg6sjj"> </p></div> <!> <ul class="skill-list svelte-dg6sjj"></ul>`,1),fm=q(`<section class="skills-view svelte-dg6sjj" aria-labelledby="skills-title"><h2 id="skills-title"> </h2> <p class="intro svelte-dg6sjj">Create or edit a complete skills selection.</p> <form aria-describedby="skills-status" class="svelte-dg6sjj"><div class="field-grid svelte-dg6sjj"><label for="skills-existing-profile" class="svelte-dg6sjj">Skill profile</label> <select id="skills-existing-profile" class="svelte-dg6sjj"><option>New profile</option><option>Default</option><!></select> <label for="skills-save-as" class="svelte-dg6sjj">Save as</label> <input id="skills-save-as" name="save-as" autocomplete="off" class="svelte-dg6sjj"/></div> <p class="save-intent svelte-dg6sjj" aria-live="polite"> </p> <div class="profile-actions svelte-dg6sjj"><button type="button" class="svelte-dg6sjj">Delete profile</button> <button type="submit" class="svelte-dg6sjj"> </button></div></form> <dialog aria-labelledby="delete-profile-title" class="svelte-dg6sjj"><h3 id="delete-profile-title">Delete skill profile?</h3> <p> </p> <div class="dialog-actions svelte-dg6sjj"><button type="button" class="svelte-dg6sjj">Cancel</button> <button type="button" class="svelte-dg6sjj">Delete profile</button></div></dialog> <!> <!></section>`);function pm(e,t){$e(t,!0);let n=$(t,`skillsState`,7),r=$(t,`heading`,3,`Manage skill profiles`),i=z(0),a=z(null),o=z(null),s=z(null),c=z(null),l=z(`__new__`),u=L(()=>(G(i),n())),d=L(()=>G(u).profiles.filter(e=>!(`error`in e)));function f(){n(Object.assign(Object.create(Object.getPrototypeOf(n())),n())),B(i,G(i)+1)}async function p(){await t.onrefresh(),f()}function m(e){B(l,e.currentTarget.value,!0),G(l)===`__new__`||G(l)===`__default__`?G(u).selectDefaultProfile():G(u).selectProfile(G(l)),f()}async function h(e){e.preventDefault(),await G(u).save(),f(),G(u).status.kind===`saved`&&(B(l,G(u).selectedProfileName,!0),t.onprofileschange()),G(u).status.kind===`save-failed`&&(await Tr(),G(a)?.focus())}function g(){G(c)?.showModal()}async function _(){G(c)?.close(),await G(u).deleteSelectedProfile(),f(),G(u).status.kind===`deleted`&&(B(l,`__new__`),t.onprofileschange()),await Tr(),G(o)?.focus()}async function v(){G(c)?.close(),await Tr(),G(s)?.focus()}function y(e){return e&&/^#[0-9a-f]{3,8}$/i.test(e)?e:void 0}function b(e){return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function x(e){let t=e.currentTarget.closest(`.skill-card`);requestAnimationFrame(()=>t?.scrollIntoView({block:`nearest`,inline:`nearest`}))}var S=fm(),C=V(S),w=V(C,!0);P(C);var T=U(C,4),E=V(T),D=U(V(E),2),ee=V(D);ee.value=ee.__value=`__new__`;var te=U(ee);te.value=te.__value=`__default__`,Z(U(te),17,()=>G(d),e=>e.name,(e,t)=>{var n=Zp(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,G(t).name),i!==(i=G(t).name)&&(n.value=(n.__value=G(t).name)??``)}),J(e,n)}),P(D),Ui(D,e=>B(o,e),()=>G(o));var ne=U(D,4);Ni(ne),P(E);var re=U(E,2),ie=V(re,!0);P(re);var O=U(re,2),ae=V(O);Ui(ae,e=>B(s,e),()=>G(s));var oe=U(ae,2),se=V(oe,!0);P(oe),P(O),P(T);var ce=U(T,2),le=U(V(ce),2),ue=V(le);P(le);var k=U(le,2),de=V(k),fe=U(de,2);P(k),P(ce),Ui(ce,e=>B(c,e),()=>G(c));var pe=U(ce,2),me=e=>{J(e,Qp())},he=e=>{J(e,$p())},ge=e=>{var t=em(),n=V(t);P(t),W(()=>Y(n,`Discovery warning: ${G(u).status.message??``}`)),J(e,t)},_e=e=>{var t=tm(),n=V(t,!0);P(t),W(()=>Y(n,G(u).status.message)),J(e,t)},A=e=>{var t=nm(),n=V(t,!0);P(t),Ui(t,e=>B(a,e),()=>G(a)),W(()=>Y(n,G(u).status.message)),J(e,t)},ve=e=>{J(e,rm())},ye=e=>{J(e,im())},be=e=>{var t=tm(),n=V(t,!0);P(t),W(()=>Y(n,G(u).status.message)),J(e,t)};X(pe,e=>{G(u).status.kind===`loading`?e(me):G(u).status.kind===`empty`?e(he,1):G(u).status.kind===`warning`?e(ge,2):G(u).status.kind===`invalid-profile`||G(u).status.kind===`error`?e(_e,3):G(u).status.kind===`save-failed`?e(A,4):G(u).status.kind===`saved`?e(ve,5):G(u).status.kind===`deleted`?e(ye,6):G(u).status.kind===`delete-failed`&&e(be,7)});var xe=U(pe,2),Se=e=>{var t=dm(),n=H(t),r=V(n),i=U(r,2),a=V(i);P(i),P(n);var o=U(n,2),s=e=>{var t=om(),n=U(V(t),4);Z(n,21,()=>G(u).missingSkills,e=>e.path,(e,t)=>{var n=am(),r=V(n),i=V(r),a=V(i,!0);P(i);var o=U(i,4),s=V(o,!0);P(o),P(r);var c=U(r,2);P(n),W(e=>{Y(a,G(t).name),Y(s,e),Q(c,`aria-label`,`Remove missing skill ${G(t).name} from profile`)},[()=>b(G(t).path)]),K(`click`,c,()=>{G(u).removeMissingSkill(G(t).path),f()}),J(e,n)}),P(n),P(t),J(e,t)};X(o,e=>{G(u).missingSkills.length>0&&e(s)});var c=U(o,2);Z(c,21,()=>G(u).skills,e=>e.path,(e,t)=>{var n=um();let r;var i=V(n),a=V(i);Ni(a);var o=U(a,2),s=V(o,!0);P(o);var c=U(o,2),l=V(c,!0);P(c),P(i);var d=U(i,2),p=V(d),m=e=>{var n=sm(),r=V(n,!0);P(n),W(()=>Y(r,G(t).description)),J(e,n)};X(p,e=>{G(t).description&&e(m)});var h=U(p,2),g=e=>{var n=sm(),r=V(n,!0);P(n),W(()=>Y(r,G(t).shortDescription)),J(e,n)};X(h,e=>{G(t).shortDescription&&e(g)});var _=U(h,2),v=U(V(_),2),S=V(v,!0);P(v);var C=U(v,2),w=e=>{var n=lm(),r=U(H(n),2),i=V(r);Z(i,21,()=>G(t).dependencies.tools,e=>`${e.type}:${e.value}`,(e,t)=>{var n=cm(),r=V(n);P(n),W(()=>Y(r,`${G(t).type??``}: ${G(t).value??``}${G(t).description?` — ${G(t).description}`:``}`)),J(e,n)}),P(i),P(r),J(e,n)};X(C,e=>{G(t).dependencies?.tools?.length&&e(w)}),P(_),P(d),P(n),W((e,o)=>{r=wi(n,``,r,e),Q(i,`for`,`skill-${G(t).path}`),Q(a,`id`,`skill-${G(t).path}`),Fi(a,G(t).enabled),a.disabled=G(t).alwaysAdvertised,Y(s,G(t).displayName??G(t).name),Y(l,G(t).alwaysAdvertised?`Always advertised`:G(t).enabled?`Enabled`:`Disabled`),Y(S,o)},[()=>({"--brand-color":y(G(t).brandColor)}),()=>b(G(t).path)]),Lr(`focus`,a,x),K(`change`,a,e=>{G(u).toggle(G(t).path,e.currentTarget.checked),f()}),J(e,n)}),P(c),W(()=>Y(a,`${G(u).enabledCount??``} of ${G(u).skills.length??``} skills enabled.`)),K(`click`,r,()=>void p()),J(e,t)};X(xe,e=>{(G(u).skills.length>0||G(u).missingSkills.length>0)&&e(Se)}),P(S),W(()=>{Y(w,r()),Pi(ne,G(u).saveAsName),Y(ie,G(u).saveIntent===`replace`?`Saved the selected profile.`:`Creating a new saved profile.`),ae.disabled=!G(u).selectedProfileName||G(u).status.kind===`deleting`,oe.disabled=G(u).status.kind===`saving`,Y(se,G(u).status.kind===`saving`?`Saving profile…`:`Save profile`),Y(ue,`Delete ${G(u).selectedProfileName??``}? Existing sessions keep their saved skill set.`)}),Lr(`submit`,T,h),K(`change`,D,m),Di(D,()=>G(l),e=>B(l,e)),K(`input`,ne,e=>{G(u).saveAsName=e.currentTarget.value,f()}),K(`click`,ae,g),K(`click`,de,()=>void v()),K(`click`,fe,()=>void _()),J(e,S),et()}Rr([`change`,`input`,`click`]);var mm=class{client;workspaceId=``;codexProfile=``;selectedProfileName=``;saveAsName=``;source=`native`;skills=[];missingSkills=[];profiles=[];status={kind:`idle`};baseline=new Map;missingBaseline=new Map;saving=!1;deleting=!1;request=null;generation=0;disposed=!1;constructor(e){this.client=e}get enabledCount(){return this.skills.filter(e=>e.enabled).length}get dirty(){return this.skills.some(e=>this.baseline.get(e.path)!==e.enabled)||this.missingSkills.some(e=>this.missingBaseline.get(e.path)?.enabled!==e.enabled)||[...this.missingBaseline].some(([e])=>!this.missingSkills.some(t=>t.path===e))}get saveIntent(){return this.profiles.some(e=>!(`error`in e)&&e.name===this.saveAsName.trim())?`replace`:`create`}async load(e,t){let n=this.beginRequest(),r=this.generation;this.workspaceId=e,this.codexProfile=t,this.status={kind:`loading`};try{let[i,a]=await Promise.all([this.client.listAvailableSkills(e,t,!0,n.signal),this.client.listSkillProfiles(n.signal)]);if(!this.current(r,n))return;this.applyAvailable(i),this.profiles=a.profiles.map(e=>`error`in e?e:{...e,skills:e.skills.filter(e=>!hm(e.name))});let o=a.profiles.find(e=>`error`in e);o&&`error`in o?this.status={kind:`invalid-profile`,message:o.error.message}:i.errors.length?this.status={kind:`warning`,message:i.errors.map(e=>e.message).join(` `)}:this.status=this.skills.length?{kind:`ready`}:{kind:`empty`}}catch(e){if(!this.current(r,n)||n.signal.aborted)return;this.status={kind:`error`,message:gm(e)}}}async refresh(){let e=this.beginRequest(),t=this.generation;this.status={kind:`loading`};try{let n=await this.client.listAvailableSkills(this.workspaceId,this.codexProfile,!0,e.signal);if(!this.current(t,e))return;this.applyAvailable(n),this.status=this.missingSkills.length?this.missingSkillsStatus():n.errors.length?{kind:`warning`,message:n.errors.map(e=>e.message).join(` `)}:this.skills.length?{kind:`ready`}:{kind:`empty`}}catch(n){if(!this.current(t,e)||e.signal.aborted)return;this.status={kind:`error`,message:gm(n)}}}selectProfile(e){let t=this.profiles.find(t=>!(`error`in t)&&t.name===e);if(!t||`error`in t){this.status={kind:`invalid-profile`,message:`Select a valid saved profile.`};return}this.selectedProfileName=t.name,this.saveAsName=t.name;let n=new Map(t.skills.map(e=>[e.path,e.enabled])),r=new Set(this.skills.map(e=>e.path)),i=t.skills.filter(e=>!r.has(e.path));this.skills=this.skills.map(e=>({...e,enabled:n.get(e.path)??!1})),this.missingSkills=i.map(e=>({...e,enabled:!1})),this.baseline=new Map(this.skills.map(e=>[e.path,e.enabled])),this.missingBaseline=new Map(i.map(e=>[e.path,{...e}])),this.status=this.missingSkills.length?this.missingSkillsStatus():this.skills.length?{kind:`ready`}:{kind:`empty`}}selectDefaultProfile(){this.selectedProfileName=``,this.saveAsName=``,this.missingSkills=[],this.skills=this.skills.map(e=>({...e,enabled:e.effectiveEnabled})),this.captureBaseline(),this.status=this.skills.length?{kind:`ready`}:{kind:`empty`}}toggle(e,t){this.skills=this.skills.map(n=>n.path===e&&!n.alwaysAdvertised?{...n,enabled:t}:n)}removeMissingSkill(e){this.missingSkills=this.missingSkills.filter(t=>t.path!==e),this.status=this.missingSkills.length?this.missingSkillsStatus():this.skills.length?{kind:`ready`}:{kind:`empty`}}reset(){this.skills=this.skills.map(e=>({...e,enabled:this.baseline.get(e.path)??!1})),this.missingSkills=[...this.missingBaseline.values()].map(e=>({...e,enabled:!1})),this.missingSkills.length&&(this.status=this.missingSkillsStatus())}async save(){let e=this.saveAsName.trim();if(this.saving||this.deleting)return;if(!e){this.status={kind:`save-failed`,message:`Enter a profile name before saving.`};return}this.saving=!0,this.status={kind:`saving`};let t=this.savePayload(e);try{let n=await this.client.replaceSkillProfile(e,t);this.profiles=[...this.profiles.filter(e=>`error`in e||e.name!==n.name),n].sort((e,t)=>e.name.localeCompare(t.name)),this.selectedProfileName=n.name,this.saveAsName=n.name,this.captureBaseline(),this.status={kind:`saved`}}catch(e){this.status={kind:`save-failed`,message:gm(e)}}finally{this.saving=!1}}async deleteSelectedProfile(){let e=this.selectedProfileName;if(!(this.saving||this.deleting)){if(!e){this.status={kind:`delete-failed`,message:`Select a saved profile before deleting.`};return}this.deleting=!0,this.status={kind:`deleting`};try{await this.client.deleteSkillProfile(e),this.profiles=this.profiles.filter(t=>`error`in t||t.name!==e),this.selectedProfileName=``,this.saveAsName=``,this.missingSkills=[],this.captureBaseline(),this.status={kind:`deleted`}}catch(e){this.status={kind:`delete-failed`,message:gm(e)}}finally{this.deleting=!1}}}dispose(){this.disposed=!0,++this.generation,this.request?.abort(),this.request=null}beginRequest(){return this.request?.abort(),this.request=new AbortController,++this.generation,this.request}current(e,t){return!this.disposed&&e===this.generation&&this.request===t}savePayload(e=this.saveAsName.trim()){return{version:1,name:e,skills:this.skills.map(({name:e,path:t,enabled:n})=>({name:e,path:t,enabled:n})).concat(this.missingSkills).sort((e,t)=>e.path.localeCompare(t.path))}}applyAvailable(e){let t=new Map(this.skills.filter(e=>this.baseline.get(e.path)!==e.enabled).map(e=>[e.path,e.enabled])),n=new Map(this.missingSkills.map(e=>[e.path,e.enabled]));this.source=e.source;let r=e.skills.filter(e=>!e.alwaysAdvertised);this.skills=r.map(e=>({...e,enabled:t.get(e.path)??n.get(e.path)??e.effectiveEnabled}));let i=new Set(r.map(e=>e.path));this.missingSkills=this.missingSkills.filter(e=>!i.has(e.path)),this.baseline=new Map(r.map(e=>[e.path,this.baseline.get(e.path)??e.effectiveEnabled]))}captureBaseline(){this.baseline=new Map(this.skills.map(e=>[e.path,e.enabled])),this.missingBaseline=new Map(this.missingSkills.map(e=>[e.path,{...e}]))}missingSkillsStatus(){let e=this.missingSkills.length;return{kind:`warning`,message:`${e} saved ${e===1?`skill is`:`skills are`} missing and disabled. Remove ${e===1?`it`:`them`} from this profile, or restore the skill installation.`}}};function hm(e){return e!==`gestalt:serena`&&e.startsWith(`gestalt:`)}function gm(e){return e instanceof Error?e.message:`Unknown relay error.`}var _m=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),vm=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),ym=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),bm=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),xm=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Sm=o((e=>{var t=vm().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Cm=o((e=>{var t=vm().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),wm=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Tm=o((e=>{var t=ym(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Em=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Dm=o((e=>{var t=Em();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Om=o(((e,t)=>{var n=Dm();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),km=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Am=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
32
|
+
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),jm=o((e=>{var t=km(),n=Am();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Mm=o((e=>{var t=vm(),n=Tm(),r=ym(),i=jm(),a=km(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Nm=o((e=>{var t=vm(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Pm=o(((e,t)=>{var n=jm();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Fm=o(((e,t)=>{var n=jm(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Im=o(((e,t)=>{var n=jm();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Lm=o(((e,t)=>{var n=jm(),r=vm();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
33
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Rm=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),zm=o((e=>{var t=jm(),n=Pm(),r=Fm(),i=Im(),a=Lm(),o=Am(),s=vm(),c=Rm();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
34
|
+
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Bm=o((e=>{var t=vm(),n=ym(),r=bm(),i=xm(),a=Sm(),o=Cm(),s=wm(),c=Tm(),l=Om(),u=Mm(),d=Nm(),f=jm(),p=zm();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
35
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
36
|
+
Minimum version required to store current data is: `+c+`.
|
|
37
|
+
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Vm=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Hm=o((e=>{var t=Vm();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Um=o((e=>{var t=Vm();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
38
|
+
`;return typeof a==`function`&&a(null,p),p}})),Wm=c(o((e=>{var t=_m(),n=Bm(),r=Hm(),i=Um();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function Gm(e){return`${e.replace(/\/$/,``)}/?bootstrap=1`}async function Km(e){return Wm.toDataURL(Gm(e),{errorCorrectionLevel:`M`,margin:1,width:256})}async function qm(e){return Wm.toDataURL(e,{errorCorrectionLevel:`M`,margin:1,width:256})}var Jm=q(`<p class="feedback svelte-1nygetn" role="status"> </p>`),Ym=q(`<span class="svelte-1nygetn">At least one authorized device is required.</span>`),Xm=q(`<li class="svelte-1nygetn"><form class="svelte-1nygetn"><label class="svelte-1nygetn">Nickname</label><input name="nickname" class="svelte-1nygetn"/> <p class="svelte-1nygetn"> <!><!></p> <button type="submit" class="svelte-1nygetn">Rename</button> <button type="button" class="svelte-1nygetn">Revoke</button> <!></form></li>`),Zm=q(`<ul aria-label="Authorized devices" class="svelte-1nygetn"></ul>`),Qm=q(`<p role="status" class="svelte-1nygetn">No authorized devices are available. Refresh this page before making changes.</p>`),$m=q(`<button type="button" class="svelte-1nygetn">Create enrollment link</button>`),eh=q(`<img alt="QR code for the enrollment link" class="svelte-1nygetn"/>`),th=q(`<p role="status" class="svelte-1nygetn"> </p> <!> <label for="enrollment-link" class="svelte-1nygetn">Enrollment link</label><textarea id="enrollment-link" readonly="" rows="3" class="svelte-1nygetn"></textarea> <div class="actions svelte-1nygetn"><button type="button" class="svelte-1nygetn">Copy enrollment link</button><button type="button" class="svelte-1nygetn">Create passkey here</button><button type="button" class="svelte-1nygetn">Cancel link</button><button type="button" class="svelte-1nygetn">Replace link</button></div>`,1),nh=q(`<main class="devices svelte-1nygetn" aria-labelledby="devices-title"><header class="svelte-1nygetn"><button type="button" class="svelte-1nygetn">Back</button> <h1 id="devices-title" class="svelte-1nygetn">Authorized devices</h1></header> <!> <!> <section aria-labelledby="add-title" class="svelte-1nygetn"><h2 id="add-title" class="svelte-1nygetn">Authorize another device</h2> <!></section></main> <dialog aria-labelledby="revoke-title" class="svelte-1nygetn"><h2 id="revoke-title" class="svelte-1nygetn">Revoke authorized device?</h2> <p class="svelte-1nygetn">This immediately signs out sessions created by this passkey.</p> <form method="dialog" class="svelte-1nygetn"><button type="submit" class="svelte-1nygetn">Keep device</button><button type="button" class="svelte-1nygetn">Revoke device</button></form></dialog>`,1);function rh(e,t){$e(t,!0);let n=$(t,`oncreatepasskey`,3,()=>{}),r=z(on([])),i=z(``),a=z(null),o=z(`none`),s=z(null),c=z(null),l=z(null),u=z(null),d=z(on(Date.now())),f=L(()=>[...G(r)].sort((e,t)=>e.createdAt.localeCompare(t.createdAt))),p=L(()=>G(a)?Math.max(0,Math.ceil((Date.parse(G(a).expiresAt)-G(d))/1e3)):0),m=L(()=>`${Math.floor(G(p)/60)}:${String(G(p)%60).padStart(2,`0`)}`);function h(e){let t=e.trim();return[...t].length>=1&&[...t].length<=64}function g(){G(u)&&clearInterval(G(u)),B(u,null)}function _(){g(),B(u,setInterval(()=>void b(),15e3),!0)}function v(){return!!(G(a)&&G(o)===`pending`&&G(p)>0&&document.visibilityState===`visible`)}async function y(){try{B(r,(await t.client.list()).devices,!0)}catch{B(i,`Could not refresh authorized devices. Try again.`)}}async function b(){if(!v()){G(p)===0&&G(a)&&B(o,`expired`),g();return}try{B(o,(await t.client.ticketStatus()).status,!0),G(o)!==`pending`&&(g(),G(o)===`used`&&await y())}catch{g()}}async function x(){B(i,``);try{B(a,await t.client.createTicket(),!0),B(o,`pending`),B(s,await qm(G(a).url),!0),B(d,Date.now(),!0),_()}catch{B(i,`Could not create an enrollment link. Try again.`)}}async function S(){try{B(o,(await t.client.cancelTicket()).status,!0),B(a,null),B(s,null),g()}catch{B(i,`Could not cancel the enrollment link. Try again.`)}}async function C(){await S(),G(i)||await x()}async function w(e,n){if(!h(n)){B(i,`Device nicknames must be 1–64 characters.`);return}B(i,``);try{await t.client.rename(e.id,n.trim()),await y()}catch{B(i,`Could not rename this device. Try again.`)}}function T(e){G(f).length>1&&(B(l,e,!0),G(c)?.showModal())}async function E(){if(G(l))try{await t.client.revoke(G(l).id),G(c)?.close(),G(l).current?t.onlock():await y()}catch{B(i,`This device could not be revoked. Try again.`)}}async function D(){if(G(a))try{await navigator.clipboard.writeText(G(a).url)}catch{B(i,`Copy is unavailable here. Select the visible link instead.`)}}function ee(){document.visibilityState===`visible`&&G(o)===`pending`&&G(p)>0?(b(),_()):g()}Gi(()=>{y(),document.addEventListener(`visibilitychange`,ee);let e=setInterval(()=>B(d,Date.now(),!0),1e3);return()=>clearInterval(e)}),Ki(()=>{g(),document.removeEventListener(`visibilitychange`,ee)});var te=nh(),ne=H(te),re=V(ne),ie=V(re);Ue(2),P(re);var O=U(re,2),ae=e=>{var t=Jm(),n=V(t,!0);P(t),W(()=>Y(n,G(i))),J(e,t)};X(O,e=>{G(i)&&e(ae)});var oe=U(O,2),se=e=>{var t=Zm();Z(t,21,()=>G(f),e=>e.id,(e,t)=>{var n=Xm(),r=V(n),i=V(r),a=U(i);Ni(a);var o=U(a,2),s=V(o),c=U(s),l=e=>{var n=Gr();W(e=>Y(n,`· Last used ${e??``}`),[()=>new Date(G(t).lastUsedAt).toLocaleDateString()]),J(e,n)};X(c,e=>{G(t).lastUsedAt&&e(l)});var u=U(c),d=e=>{J(e,Gr(`· This device`))};X(u,e=>{G(t).current&&e(d)}),P(o);var p=U(o,4),m=U(p,2),h=e=>{var n=Ym();W(()=>Q(n,`id`,`final-${G(t).id}`)),J(e,n)};X(m,e=>{G(f).length===1&&e(h)}),P(r),P(n),W(e=>{Q(i,`for`,`nickname-${G(t).id}`),Q(a,`id`,`nickname-${G(t).id}`),Pi(a,G(t).nickname),Q(a,`aria-label`,`Nickname for ${G(t).nickname}`),Y(s,`Added ${e??``}`),p.disabled=G(f).length===1,Q(p,`aria-describedby`,G(f).length===1?`final-${G(t).id}`:void 0)},[()=>new Date(G(t).createdAt).toLocaleDateString()]),Lr(`submit`,r,e=>{e.preventDefault(),w(G(t),String(new FormData(e.currentTarget).get(`nickname`)??``))}),K(`click`,p,()=>T(G(t))),J(e,n)}),P(t),J(e,t)},ce=e=>{J(e,Qm())};X(oe,e=>{G(f).length?e(se):e(ce,-1)});var le=U(oe,2),ue=U(V(le),2),k=e=>{var t=$m();K(`click`,t,()=>void x()),J(e,t)},de=e=>{var t=th(),r=H(t),i=V(r,!0);P(r);var c=U(r,2),l=e=>{var t=eh();W(()=>Q(t,`src`,G(s))),J(e,t)};X(c,e=>{G(s)&&e(l)});var u=U(c,3);Sn(u);var d=U(u,2),f=V(d),p=U(f),h=U(p),g=U(h);P(d),W(()=>{Y(i,G(o)===`pending`?`Enrollment link is active for ${G(m)}.`:`Enrollment link is ${G(o)}.`),Pi(u,G(a).url)}),K(`click`,f,()=>void D()),K(`click`,p,()=>n()(G(a).ticket)),K(`click`,h,()=>void S()),K(`click`,g,()=>void C()),J(e,t)};X(ue,e=>{G(a)?e(de,-1):e(k)}),P(le),P(ne);var fe=U(ne,2),pe=U(V(fe),4),me=U(V(pe));P(pe),P(fe),Ui(fe,e=>B(c,e),()=>G(c)),K(`click`,ie,function(...e){t.onclose?.apply(this,e)}),K(`click`,me,()=>void E()),J(e,te),et()}Rr([`click`]);async function ih(e){if(e=await e,!e.ok){let t;try{let n=await e.json();typeof n==`object`&&n&&`code`in n&&typeof n.code==`string`&&(t=n.code)}catch{}throw Error(t??`AUTH_REQUEST_FAILED_${e.status}`)}if(e.status!==204)return e.json()}function ah(e){return{list:()=>ih(e(`/api/auth/devices`,{credentials:`same-origin`})),rename:(t,n)=>ih(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({nickname:n})})),revoke:t=>ih(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:`same-origin`})),createTicket:()=>ih(e(`/api/auth/enrollment-tickets`,{method:`POST`,credentials:`same-origin`})),ticketStatus:()=>ih(e(`/api/auth/enrollment-tickets/current`,{credentials:`same-origin`})),cancelTicket:()=>ih(e(`/api/auth/enrollment-tickets/current`,{method:`DELETE`,credentials:`same-origin`}))}}var oh=`gestalt-mobile.scratchpad`;function sh(){try{return window.localStorage}catch{return null}}function ch(e){try{return e?.getItem(`gestalt-mobile.scratchpad`)??``}catch{return``}}function lh(e,t){try{return e?(e.setItem(oh,t),!0):!1}catch{return!1}}function uh(e){try{return e?(e.removeItem(oh),!0):!1}catch{return!1}}var dh=q(`<p class="feedback svelte-eu5bnq" role="status"> </p>`),fh=q(`<section class="clear-confirmation svelte-eu5bnq" aria-labelledby="clear-scratchpad-title"><p id="clear-scratchpad-title" class="svelte-eu5bnq"><strong>Clear the entire scratchpad?</strong></p> <p class="svelte-eu5bnq">This cannot be undone.</p> <div class="actions svelte-eu5bnq"><button type="button" class="svelte-eu5bnq">Keep text</button> <button type="button" class="danger svelte-eu5bnq">Clear all</button></div></section>`),ph=q(`<footer class="actions svelte-eu5bnq"><button type="button" class="svelte-eu5bnq">Paste</button> <button type="button" class="svelte-eu5bnq">Select all</button> <button type="button" class="danger svelte-eu5bnq">Clear</button> <button type="button" class="svelte-eu5bnq">Close</button></footer>`),mh=q(`<dialog aria-labelledby="scratchpad-title" class="svelte-eu5bnq"><section class="scratchpad-shell svelte-eu5bnq"><header class="svelte-eu5bnq"><div><h2 id="scratchpad-title" class="svelte-eu5bnq">Scratchpad</h2> <p id="scratchpad-help" class="svelte-eu5bnq">Saved automatically in this browser.</p></div> <button type="button" class="close svelte-eu5bnq" aria-label="Close scratchpad">×</button></header> <label for="scratchpad-text" class="svelte-eu5bnq">Scratchpad text</label> <textarea id="scratchpad-text" aria-describedby="scratchpad-help" class="svelte-eu5bnq"></textarea> <!> <!></section></dialog>`);function hh(e,t){$e(t,!0);let n=$(t,`storage`,19,sh),r=$(t,`clipboard`,19,()=>globalThis.navigator?.clipboard),i=z(null),a=z(null),o=z(null),s=z(null),c=z(``),l=z(!1),u=z(``);Gi(async()=>{B(c,ch(n()),!0),await Tr(),G(i)?.showModal(),G(o)?.focus({preventScroll:!0})});function d(e){B(c,e,!0),B(u,lh(n(),e)?``:`This browser could not save the scratchpad. Keep this window open until you copy the text.`,!0)}async function f(){if(!r()?.readText){B(u,`Clipboard paste is unavailable here. Long-press the text field and choose Paste.`),G(a)?.focus();return}try{let e=await r().readText(),t=G(a)?.selectionStart??G(c).length,n=G(a)?.selectionEnd??G(c).length;d(`${G(c).slice(0,t)}${e}${G(c).slice(n)}`),await Tr();let i=t+e.length;G(a)?.focus(),G(a)?.setSelectionRange(i,i)}catch{B(u,`Clipboard paste was not permitted. Long-press the text field and choose Paste.`),G(a)?.focus()}}async function p(){B(l,!0),B(u,``),await Tr(),G(s)?.focus()}function m(){B(l,!1),G(a)?.focus()}function h(){if(!uh(n())){B(u,`This browser could not clear its saved scratchpad.`);return}B(c,``),B(l,!1),B(u,``),G(a)?.focus()}var g=mh(),_=V(g),v=V(_),y=U(V(v),2);Ui(y,e=>B(o,e),()=>G(o)),P(v);var b=U(v,4);Sn(b),Ui(b,e=>B(a,e),()=>G(a));var x=U(b,2),S=e=>{var t=dh(),n=V(t,!0);P(t),W(()=>Y(n,G(u))),J(e,t)};X(x,e=>{G(u)&&e(S)});var C=U(x,2),w=e=>{var t=fh(),n=U(V(t),4),r=V(n);Ui(r,e=>B(s,e),()=>G(s));var i=U(r,2);P(n),P(t),K(`click`,r,m),K(`click`,i,h),J(e,t)},T=e=>{var t=ph(),n=V(t),r=U(n,2),o=U(r,2),s=U(o,2);P(t),W(()=>o.disabled=!G(c)),K(`click`,n,()=>void f()),K(`click`,r,()=>G(a)?.select()),K(`click`,o,()=>void p()),K(`click`,s,()=>G(i)?.close()),J(e,t)};X(C,e=>{G(l)?e(w):e(T,-1)}),P(_),P(g),Ui(g,e=>B(i,e),()=>G(i)),W(()=>Pi(b,G(c))),Lr(`close`,g,function(...e){t.onclose?.apply(this,e)}),K(`click`,y,()=>G(i)?.close()),K(`input`,b,e=>d(e.currentTarget.value)),J(e,g),et()}Rr([`click`,`input`]);var gh=q(`<span><span class="line-number svelte-1xq0jc8" aria-hidden="true"></span><span class="line-text svelte-1xq0jc8"> </span></span>`),_h=q(`<pre aria-label="File source" class="svelte-1xq0jc8"><code></code></pre>`);function vh(e,t){$e(t,!0);let n=L(()=>t.text.split(`
|
|
39
|
+
`));var r=_h(),i=V(r);Z(i,21,()=>G(n),ei,(e,r,i,a)=>{var o=gh();let s;Q(o,`data-line`,i+1);var c=V(o);Q(c,`data-number`,i+1);var l=U(c),u=V(l);P(l),P(o),W(()=>{s=Si(o,1,`source-line svelte-1xq0jc8`,null,s,{highlighted:i+1===t.line}),Q(o,`aria-label`,i+1===t.line?`Highlighted line ${t.line}`:void 0),Y(u,`${G(r)??``}${i<G(n).length-1?`
|
|
40
|
+
`:``}`)}),J(e,o)}),P(i),P(r),J(e,r),et()}var yh=e=>typeof e==`object`&&e?Object.entries(e):[],bh=(e,t)=>`${e}/${JSON.stringify(t)}`;function xh(e){let t=new Set,n=[{value:e,id:``}];for(;n.length;){let e=n.pop(),r=yh(e.value);if(r.length){t.add(e.id);for(let[t,i]of r)n.push({value:i,id:bh(e.id,t)})}}return t}function Sh(e,t){let n=[{value:e,id:``,depth:0,prefix:``,comma:``,label:`JSON root`}],r=[];for(;n.length;){let e=n.pop();if(`closing`in e){r.push(e.closing);continue}let i=yh(e.value),a=e.value!==null&&typeof e.value==`object`,o=Array.isArray(e.value),s=o?`[`:`{`,c=o?`]`:`}`,l=i.length>0&&t.has(e.id);if(r.push({id:e.id,depth:e.depth,label:e.label,expandable:i.length>0,expanded:l,kind:a?`container`:e.value===null?`null`:typeof e.value,text:e.prefix+(a?s+(l?``:i.length?` … ${i.length} ${o?`items`:`keys`} ${c}`:c):JSON.stringify(e.value))+(l?``:e.comma)}),l){n.push({closing:{id:`${e.id}:close`,depth:e.depth,text:c+e.comma,expandable:!1,expanded:!1,label:e.label,kind:`container`}});for(let t=i.length-1;t>=0;t--){let[r,a]=i[t];n.push({value:a,id:bh(e.id,r),depth:e.depth+1,prefix:o?``:`${JSON.stringify(r)}: `,comma:t<i.length-1?`,`:``,label:`${e.label}${o?`[${r}]`:`.${r}`}`})}}}return r}var Ch=q(`<button type="button" class="svelte-7x7m8l"> </button>`),wh=q(`<div class="json-row svelte-7x7m8l"><span class="fold-column svelte-7x7m8l"><!></span> <code class="svelte-7x7m8l"> </code></div>`),Th=q(`<div class="json-tree svelte-7x7m8l" aria-label="JSON contents"></div>`);function Eh(e,t){$e(t,!0);let n=$(t,`unfolded`,3,!1),r=L(()=>JSON.parse(t.text)),i=L(()=>n()?xh(G(r)):new Set([``])),a=L(()=>Sh(G(r),G(i)));function o(e){let t=new Set(G(i));if(t.has(e))t.delete(e);else{for(let n of t)n.startsWith(`${e}/`)&&t.delete(n);t.add(e)}B(i,t)}var s=Th();Z(s,21,()=>G(a),e=>e.id,(e,t)=>{var n=wh(),r=V(n),i=V(r),a=e=>{var n=Ch(),r=V(n,!0);P(n),W(()=>{Q(n,`aria-label`,`${G(t).expanded?`Fold`:`Unfold`} ${G(t).label}`),Q(n,`aria-expanded`,G(t).expanded),Y(r,G(t).expanded?`−`:`+`)}),K(`click`,n,()=>o(G(t).id)),J(e,n)};X(i,e=>{G(t).expandable&&e(a)}),P(r);var s=U(r,2);let c;var l=V(s,!0);P(s),P(n),W(()=>{Q(n,`data-kind`,G(t).kind),c=wi(s,``,c,{"padding-inline-start":`${G(t).depth*1.2}em`}),Y(l,G(t).text)}),J(e,n)}),P(s),J(e,s),et()}Rr([`click`]);var Dh=q(`<button class="disclosure svelte-am0nvt" type="button"> </button>`),Oh=q(`<span class="disclosure svelte-am0nvt"></span>`),kh=q(`<span class="unsupported svelte-am0nvt">Files cannot be destinations</span>`),Ah=q(`<span class="unsupported svelte-am0nvt">Unsupported link</span>`),jh=q(`<span role="status">Loading…</span>`),Mh=q(`<button type="button" class="svelte-am0nvt"> </button>`),Nh=q(`<div role="group"><!> <!> <!> <!></div>`),Ph=q(`<div role="treeitem"><div class="tree-row svelte-am0nvt" role="presentation"><!> <span class="tree-label svelte-am0nvt"> </span><!></div> <!></div>`),Fh=q(`<p role="status">Loading files…</p>`),Ih=q(`<button type="button" class="svelte-am0nvt">Retry loading files</button>`),Lh=q(`<button type="button" class="svelte-am0nvt">Load more in root</button>`),Rh=q(`<div class="file-tree svelte-am0nvt" role="tree" aria-label="Files"><!> <!> <!> <!></div>`);function zh(e,t){$e(t,!0);let n=$(t,`directory`,3,``),r=$(t,`destinationMode`,3,!1),i=$(t,`ondestinationselect`,3,()=>{}),a=$(t,`onselectionchange`,3,()=>{}),o=on({}),s=z(``),c=L(()=>t.revision<0?{entries:[],loading:!1,error:!1}:u(n())),l=L(()=>{if(t.revision<0)return[];let e=[],r=(t,n)=>{for(let i of u(t).entries)e.push({entry:i,level:n,parent:t}),i.kind===`directory`&&d(i.path)&&r(i.path,n+1)};return r(n(),1),e});function u(e){return t.revision,t.controller.state(e)}function d(e){return t.revision,t.controller.expanded.has(e)}function f(e){B(s,e,!0),o[e]?.focus()}function p(e){d(e.path)?t.controller.collapse(e.path):t.controller.expand(e.path)}function m(e,n,r){e.stopPropagation();let i=n.entry,a=n.parent,o=e=>{let t=G(l)[Math.max(0,Math.min(G(l).length-1,e))];t&&f(t.entry.path)};switch(e.key){case`ArrowDown`:e.preventDefault(),o(r+1);break;case`ArrowUp`:e.preventDefault(),o(r-1);break;case`Home`:e.preventDefault(),o(0);break;case`End`:e.preventDefault(),o(G(l).length-1);break;case`ArrowRight`:i.kind===`directory`&&(e.preventDefault(),d(i.path)?o(r+1):p(i));break;case`ArrowLeft`:e.preventDefault(),i.kind===`directory`&&d(i.path)?t.controller.collapse(i.path):a&&f(a);break;case`Enter`:case` `:e.preventDefault(),h(i);break}}function h(e){if(e.kind!==`symlink`){if(r()){e.kind===`directory`&&i()(e.path);return}t.controller.select(e.path),a()(e.path)}}var g=Rh();{let e=(n,i=b,a=b)=>{var c=Kr();Z(H(c),17,()=>u(i()).entries,e=>e.path,(n,i,c,f)=>{let g=L(()=>G(i).kind===`directory`),_=L(()=>G(l).find(e=>e.entry.path===G(i).path)),v=L(()=>G(l).findIndex(e=>e.entry.path===G(i).path));var y=Ph();let b;var x=V(y);let S;var C=V(x),w=e=>{var t=Dh(),n=V(t,!0);P(t),W((e,r)=>{Q(t,`aria-label`,e),Y(n,r)},[()=>`${d(G(i).path)?`Collapse`:`Expand`} ${G(i).name}`,()=>d(G(i).path)?`−`:`+`]),K(`click`,t,e=>{e.stopPropagation(),p(G(i))}),J(e,t)},T=e=>{J(e,Oh())};X(C,e=>{G(g)?e(w):e(T,-1)});var E=U(C,2),D=V(E,!0);P(E);var ee=U(E),te=e=>{J(e,kh())},ne=e=>{var t=Ah();W(()=>Q(t,`id`,`${G(i).path}-unsupported`)),J(e,t)};X(ee,e=>{r()&&!G(g)?e(te):G(i).kind===`symlink`&&e(ne,1)}),P(x);var re=U(x,2),ie=n=>{let r=L(()=>u(G(i).path));var o=Nh(),s=V(o),c=e=>{J(e,jh())};X(s,e=>{G(r).loading&&e(c)});var l=U(s,2),d=e=>{var n=Mh(),r=V(n);P(n),W(()=>Y(r,`Retry ${G(i).name??``}`)),K(`click`,n,()=>void t.controller.load(G(i).path)),J(e,n)};X(l,e=>{G(r).error&&e(d)});var f=U(l,2);e(f,()=>G(i).path,()=>a()+1);var p=U(f,2),m=e=>{var n=Mh(),r=V(n);P(n),W(()=>Y(r,`Load more in ${G(i).name??``}`)),K(`click`,n,()=>void t.controller.load(G(i).path,!0)),J(e,n)};X(p,e=>{G(r).cursor&&e(m)}),P(o),W(()=>Q(o,`aria-label`,`Contents of ${G(i).name}`)),J(n,o)},O=L(()=>G(g)&&d(G(i).path));X(re,e=>{G(O)&&e(ie)}),P(y),Ui(y,(e,t)=>o[t.path]=e,e=>o?.[e.path],()=>[G(i)]),W(e=>{b=Si(y,1,`treeitem svelte-am0nvt`,null,b,{symlink:G(i).kind===`symlink`}),Q(y,`aria-level`,a()),Q(y,`aria-expanded`,e),Q(y,`aria-selected`,G(i).kind===`symlink`?`false`:t.controller.selectedPath===G(i).path),Q(y,`aria-disabled`,G(i).kind===`symlink`),Q(y,`aria-describedby`,G(i).kind===`symlink`?`${G(i).path}-unsupported`:void 0),Q(y,`tabindex`,G(s)===G(i).path||!G(s)&&G(v)===0?0:-1),S=wi(x,``,S,{"--level":a()}),Y(D,G(i).name)},[()=>G(g)?d(G(i).path):void 0]),Lr(`focus`,y,()=>B(s,G(i).path,!0)),K(`keydown`,y,e=>m(e,G(_),G(v))),K(`click`,y,e=>{e.stopPropagation(),h(G(i))}),J(n,y)}),J(n,c)};var _=V(g),v=e=>{J(e,Fh())};X(_,e=>{G(c).loading&&e(v)});var y=U(_,2),x=e=>{var r=Ih();K(`click`,r,()=>void t.controller.load(n())),J(e,r)};X(y,e=>{G(c).error&&e(x)});var S=U(y,2);e(S,n,()=>1);var C=U(S,2),w=e=>{var r=Lh();K(`click`,r,()=>void t.controller.load(n(),!0)),J(e,r)};X(C,e=>{G(c).cursor&&e(w)}),P(g)}J(e,g),et()}Rr([`keydown`,`click`]);var Bh=class{workspaceId;read;changed;failed;expanded=new Set([``]);selectedPath=``;pages=new Map;generations=new Map;requests=new Map;version=0;constructor(e,t,n,r=()=>{}){this.workspaceId=e,this.read=t,this.changed=n,this.failed=r}state(e){return this.pages.get(e)??{entries:[],loading:!1,error:!1}}async load(e=``,t=!1){let n=this.state(e);if(n.loading||t&&!n.cursor)return;let r=(this.generations.get(e)??0)+1;this.generations.set(e,r),this.requests.get(e)?.abort();let i=new AbortController;this.requests.set(e,i),this.pages.set(e,{...n,loading:!0,error:!1}),this.publish();try{let a=await this.read(this.workspaceId,{directory:e,...t?{cursor:n.cursor}:{}},i.signal);if(i.signal.aborted||this.generations.get(e)!==r)return;let o=t?Vh(n.entries,a.entries):a.entries;this.pages.set(e,{entries:o,cursor:a.nextCursor,loading:!1,error:!1})}catch(t){if(i.signal.aborted||this.generations.get(e)!==r)return;this.pages.set(e,{...n,loading:!1,error:!0}),this.failed(t)}finally{this.requests.get(e)===i&&this.requests.delete(e),this.publish()}}async expand(e){this.expanded.add(e),this.publish(),this.pages.has(e)||await this.load(e)}collapse(e){this.expanded.delete(e),this.generations.set(e,(this.generations.get(e)??0)+1),this.requests.get(e)?.abort(),this.publish()}async refresh(e=``){this.invalidateBranch(e),await this.load(e)}select(e){this.selectedPath=e,this.publish()}close(){this.requests.forEach(e=>e.abort()),this.requests.clear()}invalidateBranch(e){for(let t of[...this.pages.keys()])(t===e||t.startsWith(e?`${e}/`:``))&&(this.pages.delete(t),this.generations.set(t,(this.generations.get(t)??0)+1),this.requests.get(t)?.abort())}publish(){this.version+=1,this.changed()}};function Vh(e,t){let n=new Set(e.map(e=>e.path));return[...e,...t.filter(e=>!n.has(e.path))]}function Hh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Uh=Hh();function Wh(e){Uh=e}var Gh={exec:()=>null};function Kh(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function qh(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(Yh.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Jh=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Yh={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,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:Kh(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Kh(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Kh(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Kh(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Kh(e=>RegExp(`^ {0,${e}}(?:</?(?:${ug})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Kh(e=>RegExp(`^ {0,${e}}>`))},Xh=/^(?:[ \t]*(?:\n|$))+/,Zh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,eg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,tg=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ng=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,rg=qh(ng).replace(/bull/g,tg).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ig=qh(ng).replace(/bull/g,tg).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ag=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,og=/^[^\n]+/,sg=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cg=qh(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,sg).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lg=qh(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,tg).getRegex(),ug=`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`,dg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,fg=qh(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,dg).replace(`tag`,ug).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pg=e=>qh(ag).replace(`hr`,$h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ug).getRegex(),mg=pg(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),hg=pg(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),gg={blockquote:qh(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,hg).getRegex(),code:Zh,def:cg,fences:Qh,heading:eg,hr:$h,html:fg,lheading:rg,list:lg,newline:Xh,paragraph:mg,table:Gh,text:og},_g=qh(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,$h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ug).getRegex(),vg={...gg,lheading:ig,table:_g,paragraph:qh(ag).replace(`hr`,$h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,_g).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ug).getRegex()},yg={...gg,html:qh(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,dg).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:Gh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:qh(ag).replace(`hr`,$h).replace(`heading`,` *#{1,6} *[^
|
|
41
|
+
]`).replace(`lheading`,rg).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},bg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sg=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Cg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wg=/[\p{P}\p{S}]/u,Tg=/[\s\p{P}\p{S}]/u,Eg=/[^\s\p{P}\p{S}]/u,Dg=qh(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Tg).getRegex(),Og=/[\p{Pi}\p{Ps}"']/u,kg=/(?!~)[\p{P}\p{S}]/u,Ag=/(?!~)[\s\p{P}\p{S}]/u,jg=/(?:[^\s\p{P}\p{S}]|~)/u,Mg=qh(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Jh?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ng=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pg=qh(Ng,`u`).replace(/punct/g,wg).getRegex(),Fg=qh(Ng,`u`).replace(/punct/g,kg).getRegex(),Ig=qh(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Og).replace(/punct/g,wg).getRegex(),Lg=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Rg=qh(Lg,`gu`).replace(/notPunctSpace/g,Eg).replace(/punctSpace/g,Tg).replace(/punct/g,wg).getRegex(),zg=qh(Lg,`gu`).replace(/notPunctSpace/g,jg).replace(/punctSpace/g,Ag).replace(/punct/g,kg).getRegex(),Bg=qh(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Eg).replace(/punctSpace/g,Tg).replace(/punct/g,wg).getRegex(),Vg=qh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Eg).replace(/punctSpace/g,Tg).replace(/punct/g,wg).getRegex(),Hg=qh(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Eg).replace(/punctSpace/g,Tg).replace(/punct/g,wg).getRegex(),Ug=qh(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,wg).getRegex(),Wg=qh(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Eg).replace(/punctSpace/g,Tg).replace(/punct/g,wg).getRegex(),Gg=qh(/\\(punct)/,`gu`).replace(/punct/g,wg).getRegex(),Kg=qh(/^<(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(),qg=qh(dg).replace(`(?:-->|$)`,`-->`).getRegex(),Jg=qh(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,qg).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Yg=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Xg=qh(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Yg).getRegex(),Zg=qh(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Xg).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Qg=qh(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Xg).replace(`ref`,sg).getRegex(),$g=qh(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,sg).getRegex(),e_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,t_=qh(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Yg).getRegex(),n_=qh(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,qh(/^!?\[(label)\]\[(ref)\]/).replace(`label`,t_).replace(`ref`,e_).getRegex()).replace(`nolink`,qh(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,e_).getRegex()).getRegex(),r_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,i_=qh(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),a_={_backpedal:Gh,anyPunctuation:Gg,autolink:Kg,blockSkip:Mg,br:Sg,code:xg,del:Gh,delLDelim:Gh,delRDelim:Gh,emStrongLDelim:Pg,emStrongRDelimAst:Rg,emStrongRDelimUnd:Vg,escape:bg,link:Zg,nolink:$g,punctuation:Dg,reflink:Qg,reflinkSearch:n_,tag:Jg,text:Cg,url:Gh},o_={...a_,emStrongLDelim:Ig,emStrongRDelimAst:Bg,emStrongRDelimUnd:Hg,link:qh(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Xg).getRegex(),reflink:qh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Xg).getRegex()},s_={...a_,emStrongRDelimAst:zg,emStrongLDelim:Fg,delLDelim:Ug,delRDelim:Wg,url:qh(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,i_).replace(`protocol`,r_).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:qh(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,r_).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},c_={...s_,br:qh(Sg).replace(`{2,}`,`*`).getRegex(),text:qh(s_.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},l_={normal:gg,gfm:vg,pedantic:yg},u_={normal:a_,gfm:s_,breaks:c_,pedantic:o_},d_={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},f_=e=>d_[e];function p_(e,t){if(t){if(Yh.escapeTest.test(e))return e.replace(Yh.escapeReplace,f_)}else if(Yh.escapeTestNoEncode.test(e))return e.replace(Yh.escapeReplaceNoEncode,f_);return e}function m_(e){return e.replace(Yh.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function h_(e){try{e=encodeURI(e).replace(Yh.percentDecode,`%`)}catch{return null}return e}function g_(e,t){let n=e.replace(Yh.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Yh.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(Yh.slashPipe,`|`);return n}function __(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 v_(e){let t=e.split(`
|
|
42
|
+
`),n=t.length-1;for(;n>=0&&Yh.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
43
|
+
`)}function y_(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function b_(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 x_(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 S_(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function C_(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
44
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
45
|
+
`)}function w_(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var T_=class{options;rules;lexer;constructor(e){this.options=e||Uh}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=this.options.pedantic?t[0]:v_(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=C_(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=__(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:__(t[0],`
|
|
46
|
+
`),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:__(t[0],`
|
|
47
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=__(t[0],`
|
|
48
|
+
`).split(`
|
|
49
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;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(`
|
|
50
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
51
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
52
|
+
${s}`:s,r=r?`${r}
|
|
53
|
+
${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=e.join(`
|
|
54
|
+
`),o=t.raw+`
|
|
55
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
56
|
+
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
57
|
+
${d.join(`
|
|
58
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
59
|
+
`+e.join(`
|
|
60
|
+
`),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(`
|
|
61
|
+
`);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=t[2].split(`
|
|
62
|
+
`,1)[0],l=t[1].length,u=this.options.pedantic?x_(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>x_(e,l)),d=e.split(`
|
|
63
|
+
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
|
|
64
|
+
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
|
|
65
|
+
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
|
|
66
|
+
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
|
|
67
|
+
`+d}f=!d.trim(),r+=l+`
|
|
68
|
+
`,e=e.substring(l.length+1),u=m.slice(p)}}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,[]),!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))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.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 n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.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=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}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){let e=v_(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=y_(t[1]).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],`
|
|
69
|
+
`),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=g_(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
70
|
+
`):[],a={type:`table`,raw:__(t[0],`
|
|
71
|
+
`),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(g_(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],`
|
|
72
|
+
`),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)===`
|
|
73
|
+
`?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 n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&w_(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=__(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=b_(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 i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),S_(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.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 r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&w_(e,n[1],r,this.rules))return;let i=t[y_((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return S_(n,i,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 i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}else if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,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,autolink:!0,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,autolink:!0,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:e?t[0]:m_(t[0]),escaped:e}}}},E_=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Uh,this.options.tokenizer=this.options.tokenizer||new T_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Yh,block:l_.normal,inline:u_.normal};this.options.pedantic?(t.block=l_.pedantic,t.inline=u_.pedantic):this.options.gfm&&(t.block=l_.gfm,this.options.breaks?t.inline=u_.breaks:t.inline=u_.gfm),this.tokenizer.rules=t}static get rules(){return{block:l_,inline:u_}}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(Yh.carriageReturn,`
|
|
74
|
+
`),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){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Yh.tabCharGlobal,` `).replace(Yh.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
75
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
76
|
+
`)?``:`
|
|
77
|
+
`)+i.raw,n.text+=`
|
|
78
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
79
|
+
`)?``:`
|
|
80
|
+
`)+i.raw,n.text+=`
|
|
81
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=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&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
82
|
+
`)?``:`
|
|
83
|
+
`)+i.raw,r.text+=`
|
|
84
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
85
|
+
`)?``:`
|
|
86
|
+
`)+i.raw,n.text+=`
|
|
87
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,y_(e.slice(n+1,-1))))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,y_(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=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&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},D_=class{options;parser;constructor(e){this.options=e||Uh}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Yh.notSpaceStart)?.[0],i=e?e.replace(Yh.endingNewline,``)+`
|
|
88
|
+
`:``;return r?`<pre><code class="language-`+p_(r)+`">`+(n?i:p_(i,!0))+`</code></pre>
|
|
89
|
+
`:`<pre><code>`+(n?i:p_(i,!0))+`</code></pre>
|
|
90
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
91
|
+
${this.parser.parse(e)}</blockquote>
|
|
92
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
93
|
+
`}hr(e){return`<hr>
|
|
94
|
+
`}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+`>
|
|
95
|
+
`+r+`</`+i+`>
|
|
96
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
97
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
98
|
+
`}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>
|
|
99
|
+
<thead>
|
|
100
|
+
`+t+`</thead>
|
|
101
|
+
`+r+`</table>
|
|
102
|
+
`}tablerow({text:e}){return`<tr>
|
|
103
|
+
${e}</tr>
|
|
104
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
105
|
+
`}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>${p_(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?p_(n,!0):this.parser.parseInline(r),o=h_(e);if(o===null)return a;e=p_(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+p_(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=h_(e);if(i===null)return p_(n);e=i;let a=`<img src="${p_(e)}" alt="${p_(n)}"`;return t&&(a+=` title="${p_(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:p_(e.text)}},O_=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}},k_=class e{options;renderer;textRenderer;constructor(e){this.options=e||Uh,this.options.renderer=this.options.renderer||new D_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new O_}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`,`checkbox`,`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`,`checkbox`,`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}},A_=class{options;block;constructor(e){this.options=e||Uh}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?E_.lex:E_.lexInline}provideParser(e=this.block){return e?k_.parse:k_.parseInline}},j_=new class{defaults=Hh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=k_;Renderer=D_;TextRenderer=O_;Lexer=E_;Tokenizer=T_;Hooks=A_;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 D_(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 T_(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 A_;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];A_.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&A_.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)}: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 E_.lex(e,t??this.defaults)}parser(e,t){return k_.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?E_.lex:E_.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?k_.parse:k_.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?E_.lex:E_.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?k_.parse:k_.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+=`
|
|
106
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+p_(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function M_(e,t){return j_.parse(e,t)}M_.options=M_.setOptions=function(e){return j_.setOptions(e),M_.defaults=j_.defaults,Wh(M_.defaults),M_},M_.getDefaults=Hh,M_.defaults=Uh;function N_(...e){return j_.use(...e),M_.defaults=j_.defaults,Wh(M_.defaults),M_}M_.use=N_,M_.walkTokens=function(e,t){return j_.walkTokens(e,t)},M_.parseInline=j_.parseInline,M_.Parser=k_,M_.parser=k_.parse,M_.Renderer=D_,M_.TextRenderer=O_,M_.Lexer=E_,M_.lexer=E_.lex,M_.Tokenizer=T_,M_.Hooks=A_,M_.parse=M_,M_.options,M_.setOptions,M_.walkTokens,M_.parseInline,k_.parse,E_.lex;function P_(e,t){this.v=e,this.k=t}function F_(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 I_(e){if(Array.isArray(e))return e}function L_(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 R_(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
107
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z_(e,t){return I_(e)||L_(e,t)||B_(e,t)||R_()}function B_(e,t){if(e){if(typeof e==`string`)return F_(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)?F_(e,t):void 0}}function V_(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof P_;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)}V_.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},V_.prototype.next=function(e){return this._invoke(`next`,e)},V_.prototype.throw=function(e){return this._invoke(`throw`,e)},V_.prototype.return=function(e){return this._invoke(`return`,e)};var H_=Object.entries,U_=Object.setPrototypeOf,W_=Object.isFrozen,G_=Object.getPrototypeOf,K_=Object.getOwnPropertyDescriptor,q_=Object.freeze,J_=Object.seal,Y_=Object.create,X_=typeof Reflect<`u`&&Reflect,Z_=X_.apply,Q_=X_.construct;q_||=function(e){return e},J_||=function(e){return e},Z_||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Q_||=function(e){return new e(...[...arguments].slice(1))};var $_=yv(Array.prototype.forEach);Array.prototype.indexOf;var ev=yv(Array.prototype.lastIndexOf),tv=yv(Array.prototype.pop),nv=yv(Array.prototype.push);Array.prototype.slice;var rv=yv(Array.prototype.splice),iv=Array.isArray,av=yv(String.prototype.toLowerCase),ov=yv(String.prototype.toString),sv=yv(String.prototype.match),cv=yv(String.prototype.replace),lv=yv(String.prototype.indexOf),uv=yv(String.prototype.trim),dv=yv(Number.prototype.toString),fv=yv(Boolean.prototype.toString),pv=typeof BigInt>`u`?null:yv(BigInt.prototype.toString),mv=typeof Symbol>`u`?null:yv(Symbol.prototype.toString),hv=yv(Object.prototype.hasOwnProperty),gv=yv(Object.prototype.toString),_v=yv(RegExp.prototype.test),vv=bv(TypeError);function yv(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Z_(e,t,n)}}function bv(e){return function(){return Q_(e,[...arguments])}}function xv(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:av;if(U_&&U_(e,null),!iv(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(W_(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Sv(e){for(let t=0;t<e.length;t++)hv(e,t)||(e[t]=null);return e}function Cv(e){let t=Y_(null);for(let r of H_(e)){var n=z_(r,2);let i=n[0],a=n[1];hv(e,i)&&(iv(a)?t[i]=Sv(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Cv(a):t[i]=a)}return t}function wv(e){switch(typeof e){case`string`:return e;case`number`:return dv(e);case`boolean`:return fv(e);case`bigint`:return pv?pv(e):`0`;case`symbol`:return mv?mv(e):`Symbol()`;case`undefined`:return gv(e);case`function`:case`object`:{if(e===null)return gv(e);let t=e,n=Tv(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:gv(e)}return gv(e)}default:return gv(e)}}function Tv(e,t){for(;e!==null;){let n=K_(e,t);if(n){if(n.get)return yv(n.get);if(typeof n.value==`function`)return yv(n.value)}e=G_(e)}function n(){return null}return n}function Ev(e){try{return _v(e,``),!0}catch{return!1}}var Dv=q_(`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(`.`)),Ov=q_(`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(`.`)),kv=q_([`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`]),Av=q_([`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`]),jv=q_(`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(`.`)),Mv=q_([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Nv=q_([`#text`]),Pv=q_(`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(`.`)),Fv=q_(`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(`.`)),Iv=q_(`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(`.`)),Lv=q_([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Rv=J_(/{{[\w\W]*|^[\w\W]*}}/g),zv=J_(/<%[\w\W]*|^[\w\W]*%>/g),Bv=J_(/\${[\w\W]*/g),Vv=J_(/^data-[\-\w.\u00B7-\uFFFF]+$/),Hv=J_(/^aria-[\-\w]+$/),Uv=J_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wv=J_(/^(?:\w+script|data):/i),Gv=J_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kv=J_(/^html$/i),qv=J_(/^[a-z][.\w]*(-[.\w]+)+$/i),Jv=J_(/<[/\w!]/g),Yv=J_(/<[/\w]/g),Xv=J_(/<\/no(script|embed|frames)/i),Zv=J_(/\/>/i),Qv={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$v=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],ey=q_(xv({},$v)),ty=function(){let e={};return $_($v,t=>{e[t]=J_(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),q_(e)}(),ny=function(){return typeof window>`u`?null:window},ry=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}},iy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ay=function(e,t,n,r){return hv(e,t)&&iv(e[t])?xv(r.base?Cv(r.base):{},e[t],r.transform):n},oy=function(e,t,n){let r=hv(e,t)?e[t]:void 0;return r&&typeof r==`object`?Cv(r):n()};function sy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ny(),t=e=>sy(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Qv.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=Tv(d,`cloneNode`),p=Tv(d,`remove`),m=Tv(d,`removeAttributeNode`),h=Tv(d,`nextSibling`),g=Tv(d,`childNodes`),_=Tv(d,`parentNode`),v=Tv(d,`shadowRoot`),y=Tv(d,`attributes`),b=o&&o.prototype?Tv(o.prototype,`nodeType`):null,x=o&&o.prototype?Tv(o.prototype,`nodeName`):null,S=o&&o.prototype?Tv(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=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 T,E=``,D,ee=!1,te=0,ne=function(){if(te>0)throw vv(`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.`)},re=function(e){ne(),te++;try{return T.createHTML(e)}finally{te--}},ie=function(e){ne(),te++;try{return T.createScriptURL(e)}finally{te--}},O=function(){return ee||=(D=ry(u,i),!0),D},ae=n,oe=ae.implementation,se=ae.createNodeIterator,ce=ae.createDocumentFragment,le=ae.getElementsByTagName,ue=r.importNode,k=iy();t.isSupported=typeof H_==`function`&&typeof _==`function`&&oe&&oe.createHTMLDocument!==void 0;let de=Rv,fe=zv,pe=Bv,me=Vv,he=Hv,ge=Wv,_e=Gv,A=qv,ve=Uv,ye=null,be=xv({},[...Dv,...Ov,...kv,...jv,...Nv]),xe=null,Se=xv({},[...Pv,...Fv,...Iv,...Lv]),Ce=Object.seal(Y_(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}})),we=null,Te=null,Ee=Object.seal(Y_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,je=!1,Me=!0,j=!1,Ne=!1,Pe=null,Fe=null,Ie=!1,Le=!1,Re=!1,ze=!1,M=!0,Be=!1,N=`user-content-`,Ve=!0,He=!1,P={},Ue=null,We=xv({},`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(`.`)),Ge=null,Ke=xv({},[`audio`,`video`,`img`,`source`,`image`,`track`]),qe=null,Je=xv({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ye=`http://www.w3.org/1998/Math/MathML`,Xe=`http://www.w3.org/2000/svg`,Ze=`http://www.w3.org/1999/xhtml`,Qe=Ze,$e=!1,et=null,tt=xv({},[Ye,Xe,Ze],ov),nt=q_([`mi`,`mo`,`mn`,`ms`,`mtext`]),rt=xv({},nt),it=q_([`annotation-xml`]),at=xv({},it),ot=xv({},[`title`,`style`,`font`,`a`,`script`]),st=null,ct=[`application/xhtml+xml`,`text/html`],F=null,lt=null,ut=n.createElement(`form`),dt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(lt&<===e)return;(!e||typeof e!=`object`)&&(e={}),e=Cv(e),st=ct.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,F=st===`application/xhtml+xml`?ov:av,ye=ay(e,`ALLOWED_TAGS`,be,{transform:F}),xe=ay(e,`ALLOWED_ATTR`,Se,{transform:F}),et=ay(e,`ALLOWED_NAMESPACES`,tt,{transform:ov}),qe=ay(e,`ADD_URI_SAFE_ATTR`,Je,{transform:F,base:Je}),Ge=ay(e,`ADD_DATA_URI_TAGS`,Ke,{transform:F,base:Ke}),Ue=ay(e,`FORBID_CONTENTS`,We,{transform:F}),we=ay(e,`FORBID_TAGS`,Cv({}),{transform:F}),Te=ay(e,`FORBID_ATTR`,Cv({}),{transform:F}),P=hv(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Cv(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,j=e.WHOLE_DOCUMENT||!1,Le=e.RETURN_DOM||!1,Re=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,Ie=e.FORCE_BODY||!1,M=e.SANITIZE_DOM!==!1,Be=e.SANITIZE_NAMED_PROPS||!1,Ve=e.KEEP_CONTENT!==!1,He=e.IN_PLACE||!1,ve=Ev(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Uv,Qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ze,rt=oy(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>xv({},nt)),at=oy(e,`HTML_INTEGRATION_POINTS`,()=>xv({},it));let t=oy(e,`CUSTOM_ELEMENT_HANDLING`,()=>Y_(null));if(Ce=Y_(null),hv(t,`tagNameCheck`)&&dt(t.tagNameCheck)&&(Ce.tagNameCheck=t.tagNameCheck),hv(t,`attributeNameCheck`)&&dt(t.attributeNameCheck)&&(Ce.attributeNameCheck=t.attributeNameCheck),hv(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Ce.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),J_(Ce),je&&(Oe=!1),Re&&(Le=!0),P&&(ye=xv({},Nv),xe=Y_(null),P.html===!0&&(xv(ye,Dv),xv(xe,Pv)),P.svg===!0&&(xv(ye,Ov),xv(xe,Fv),xv(xe,Lv)),P.svgFilters===!0&&(xv(ye,kv),xv(xe,Fv),xv(xe,Lv)),P.mathMl===!0&&(xv(ye,jv),xv(xe,Iv),xv(xe,Lv))),Ee.tagCheck=null,Ee.attributeCheck=null,hv(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Ee.tagCheck=e.ADD_TAGS:iv(e.ADD_TAGS)&&(ye===be&&(ye=Cv(ye)),xv(ye,e.ADD_TAGS,F))),hv(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Ee.attributeCheck=e.ADD_ATTR:iv(e.ADD_ATTR)&&(xe===Se&&(xe=Cv(xe)),xv(xe,e.ADD_ATTR,F))),hv(e,`ADD_FORBID_CONTENTS`)&&iv(e.ADD_FORBID_CONTENTS)&&(Ue===We&&(Ue=Cv(Ue)),xv(Ue,e.ADD_FORBID_CONTENTS,F)),Ve&&(ye[`#text`]=!0),j&&xv(ye,[`html`,`head`,`body`]),ye.table&&(xv(ye,[`tbody`]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw vv(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw vv(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=re(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=O()),T&&typeof E==`string`&&(E=re(``)));q_&&q_(e),lt=e},pt=xv({},[...Ov,...kv,...Av]),mt=xv({},[...jv,...Mv]),ht=function(e,t,n){return t.namespaceURI===Ze?e===`svg`:t.namespaceURI===Ye?e===`svg`&&(n===`annotation-xml`||rt[n]):!!pt[e]},gt=function(e,t,n){return t.namespaceURI===Ze?e===`math`:t.namespaceURI===Xe?e===`math`&&at[n]:!!mt[e]},_t=function(e,t,n){return t.namespaceURI===Xe&&!at[n]||t.namespaceURI===Ye&&!rt[n]?!1:!mt[e]&&(ot[e]||!pt[e])},vt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Qe,tagName:`template`});let n=av(e.tagName),r=av(t.tagName);return et[e.namespaceURI]?e.namespaceURI===Xe?ht(n,t,r):e.namespaceURI===Ye?gt(n,t,r):e.namespaceURI===Ze?_t(n,t,r):!!(st===`application/xhtml+xml`&&et[e.namespaceURI]):!1},yt=function(e){nv(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw vv(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},bt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},I=function(e){Ct(e);let t=g(e);if(t){let e=[];$_(t,t=>{nv(e,t)}),$_(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`&&bt(e,r,i)}},xt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}nv(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(Le||Re)try{yt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},St=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`||xe[F(i)]||bt(e,r,i)}},Ct=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Qv.element&&St(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},L=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},wt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Qv.processingInstruction||n===Qv.comment&&_v(Yv,e.data)){try{p(e)}catch{}continue}if(n===Qv.element){let t=e,n=F(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&L(`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])}},Tt=function(e){let t=null,r=null;if(Ie)e=`<remove></remove>`+e;else{let t=sv(e,/^[\r\n\t ]+/);r=t&&t[0]}st===`application/xhtml+xml`&&Qe===Ze&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?re(e):e;if(Qe===Ze)try{t=new l().parseFromString(i,st)}catch{}if(!t||!t.documentElement){t=oe.createDocument(Qe,`template`,null);try{t.documentElement.innerHTML=$e?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Qe===Ze?le.call(t,j?`html`:`body`)[0]:j?t.documentElement:a},Et=function(e){let t=S?S(e):e.ownerDocument;return se.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Dt=function(e){return e=cv(e,de,` `),e=cv(e,fe,` `),e=cv(e,pe,` `),e},Ot=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=se.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=Dt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&$_(i,e=>{At(e.content)&&Ot(e.content)})},kt=function(e){let t=x?x(e):null;return typeof t!=`string`||F(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)},At=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Qv.documentFragment}catch{return!1}},R=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function jt(e,n,r){e.length!==0&&$_(e,e=>{e.call(t,n,r,lt)})}let Mt=function(e,t){return!!(Me&&e.hasChildNodes()&&!R(e.firstElementChild)&&_v(Jv,e.textContent)&&_v(Jv,e.innerHTML)||Me&&e.namespaceURI===Ze&&ey[t]&&(R(e.firstElementChild)||typeof e.textContent==`string`&&_v(ty[t],e.textContent))||e.nodeType===Qv.processingInstruction||Me&&e.nodeType===Qv.comment&&_v(Yv,e.data))},Nt=function(e,t){return e instanceof RegExp?_v(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Pt=function(e,t,n){if(!we[t]&&Bt(t)&&Nt(Ce.tagNameCheck,t))return!1;if(Ve&&!Ue[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 yt(e),!0},Ft=function(e,t,n,r){return e.length===0?t:t===n||t===r?Cv(t):t},It=function(e,t){return e===t||_(e)!==null?!1:(He&&Ct(e),!0)},Lt=function(e,n){if(jt(k.beforeSanitizeElements,e,null),It(e,n))return!0;if(kt(e))return yt(e),!0;let r=F(w(e));if(ye=Ft(k.uponSanitizeElement,ye,be,Pe),jt(k.uponSanitizeElement,e,{tagName:r,allowedTags:ye}),It(e,n))return!0;if(Mt(e,r))return yt(e),!0;if(we[r]||!(Ee.tagCheck instanceof Function&&Ee.tagCheck(r))&&!ye[r]){let t=Pt(e,r,n);return t===!1&&(jt(k.afterSanitizeElements,e,null),It(e,n))?!0:t}if(C(e)===Qv.element&&!vt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&_v(Xv,e.innerHTML))return yt(e),!0;if(je&&e.nodeType===Qv.text){let n=Dt(e.textContent);e.textContent!==n&&(nv(t.removed,{element:e.cloneNode()}),e.textContent=n)}return jt(k.afterSanitizeElements,e,null),It(e,n)},Rt=function(e,t,r){if(Te[t]||L(t,e)||M&&(t===`id`||t===`name`)&&(r in n||r in ut))return!1;let i=xe[t]||Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e);return Oe&&_v(me,t)||De&&_v(he,t)?!0:i?qe[t]||_v(ve,cv(r,_e,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&lv(r,`data:`)===0&&Ge[e]||ke&&!_v(ge,cv(r,_e,``))?!0:!r:Bt(e)&&Nt(Ce.tagNameCheck,e)&&Nt(Ce.attributeNameCheck,t,e)||t===`is`&&Ce.allowCustomizedBuiltInElements&&Nt(Ce.tagNameCheck,r)},zt=xv({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Bt=function(e){return!zt[av(e)]&&_v(A,e)},Vt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},Ht=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),kt(e)?(yt(e),!1):!0}catch{return xt(t,e),!1}},Ut=function(e,n){if(jt(k.beforeSanitizeAttributes,e,null),It(e,n))return;let r=e.attributes;if(!r||kt(e))return;xe=Ft(k.uponSanitizeAttribute,xe,Se,Fe);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0},a=r.length,o=F(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=F(s),d=l,f=s===`value`?d:uv(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,jt(k.uponSanitizeAttribute,e,i),f=i.attrValue,Be&&(u===`id`||u===`name`)&&lv(f,N)!==0&&(xt(s,e,n),f=N+f,p=!0),Me&&_v(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){xt(s,e,n);continue}if(u===`attributename`&&sv(f,`href`)){xt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){xt(s,e,n);continue}if(!Ae&&_v(Zv,f)){xt(s,e,n);continue}if(je&&(f=Dt(f)),!Rt(o,u,f)){xt(s,e,n);continue}f=Vt(o,u,c,f),f!==d&&Ht(e,s,c,f)&&p&&tv(t.removed)}}jt(k.afterSanitizeAttributes,e,null),It(e,n)},Wt=function(e){let t=null,n=Et(e);for(jt(k.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(jt(k.uponSanitizeShadowNode,t,null),Lt(t,e),Ut(t,e),At(t.content)&&Wt(t.content),C(t)===Qv.element){let e=v(t);At(e)&&(Gt(e),Wt(e))}jt(k.afterSanitizeShadowDOM,e,null)},Gt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Wt(e.shadow);continue}let n=e.node,r=C(n)===Qv.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`&&F(e)===`template`){let e=n.content;At(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);At(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($e=!e,$e&&(e=`<!-->`),typeof e!=`string`&&!R(e)&&(e=wv(e),typeof e!=`string`))throw vv(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ne?(ye=Pe,xe=Fe):ft(n),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(ye=Cv(ye)),k.uponSanitizeAttribute.length>0&&(xe=Cv(xe)),t.removed=[];let c=He&&typeof e!=`string`&&R(e);if(c){wt(e);let t=w(e);if(typeof t==`string`){let n=F(t);if(!ye[n]||we[n])throw I(e),vv(`root node is forbidden and cannot be sanitized in-place`)}if(kt(e))throw I(e),vv(`root node is clobbered and cannot be sanitized in-place`);try{Gt(e)}catch(t){throw I(e),t}}else if(R(e))i=Tt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Qv.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Gt(i);else{if(!Le&&!je&&!j&&e.indexOf(`<`)===-1)return T&&ze?re(e):e;if(i=Tt(e),!i)return Le?null:ze?E:``}i&&Ie&&yt(i.firstChild);let l=c?e:i;try{let e=Et(l);for(;o=e.nextNode();)Lt(o,l),Ut(o,l),At(o.content)&&Wt(o.content)}catch(n){throw c&&(I(e),$_(t.removed,e=>{e.element&&Ct(e.element)})),n}if(c){let n=!1;if($_(t.removed,t=>{t.element&&(t.element===e&&(n=!0),Ct(t.element))}),n)throw vv(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return je&&Ot(e),e}if(Le){if(je&&Ot(i),Re)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(xe.shadowroot||xe.shadowrootmode)&&(s=ue.call(r,s,!0)),s}let u=j?i.outerHTML:i.innerHTML;return j&&ye[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&_v(Kv,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
108
|
+
`+u),je&&(u=Dt(u)),T&&ze?re(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ft(e),Ne=!0,Pe=ye,Fe=xe},t.clearConfig=function(){lt=null,Ne=!1,Pe=null,Fe=null,T=D,E=``},t.isValidAttribute=function(e,t,n){lt||ft({});let r=F(e),i=F(t);return Rt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&hv(k,e)&&nv(k[e],t)},t.removeHook=function(e,t){if(hv(k,e)){if(t!==void 0){let n=ev(k[e],t);return n===-1?void 0:rv(k[e],n,1)[0]}return tv(k[e])}},t.removeHooks=function(e){hv(k,e)&&(k[e]=[])},t.removeAllHooks=function(){k=iy()},t}var cy=sy();function ly(e){if(e.kind!==`file`)return{format:`text`,text:``};if(/\.(md|markdown)$/i.test(e.path))return{format:`markdown`,text:e.content};if(/\.json$/i.test(e.path))try{return{format:`json`,text:JSON.stringify(JSON.parse(e.content),null,2)}}catch{}return{format:`text`,text:e.content}}function uy(e){return cy.sanitize(M_.parse(e,{async:!1,gfm:!0}),{ALLOWED_TAGS:[`p`,`br`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`strong`,`em`,`del`,`blockquote`,`ul`,`ol`,`li`,`pre`,`code`,`hr`,`table`,`thead`,`tbody`,`tr`,`th`,`td`,`a`],ALLOWED_ATTR:[`href`,`title`,`start`]})}function dy(e,t){let n=t.trim();if(n.startsWith(`/`))return n;let r=e.split(`/`),i=r.indexOf(`.gestalt`);return[...i<0?[]:r.slice(0,i),n].filter(Boolean).join(`/`)}function fy(e,t){return t.startsWith(`/`)?t:[...e.split(`/`).slice(0,-1),t].join(`/`)}var py=q(`<span class="line-target svelte-14yf39v" role="status"> </span>`),my=q(`<span class="format svelte-14yf39v"> </span>`),hy=q(`<p role="status">Loading preview…</p>`),gy=q(`<p>This item could not be opened.</p> <!>`,1),_y=q(`<p class="empty svelte-14yf39v">This folder is empty.</p>`),vy=q(`<!> <!>`,1),yy=q(`<div class="markdown svelte-14yf39v"></div>`),by=q(`<dialog class="file-viewer svelte-14yf39v" aria-labelledby="file-viewer-title"><header class="svelte-14yf39v"><div class="title svelte-14yf39v"><h2 id="file-viewer-title" tabindex="-1" class="svelte-14yf39v"> </h2> <p class="svelte-14yf39v"> </p></div> <!></header> <nav aria-label="Preview controls" class="svelte-14yf39v"><!> <!> <!> <!> <!></nav> <div class="contents svelte-14yf39v"><!></div></dialog>`);function xy(e,t){$e(t,!0);let n,r,i=z(null),a=z(!0),o=z(!1),s=z(!1),c=z(!1),l=z(0),u=z(null),d=z(on([])),f=z(void 0),p=z(``),m=L(()=>G(i)?.kind===`file`?G(i).content.split(`
|
|
109
|
+
`).length:0),h=L(()=>G(i)?ly(G(i)):{format:`text`,text:``}),g=L(()=>G(h).format===`markdown`&&!G(s)?uy(G(h).text):``),_=null,v=null;async function y(e,n=!0,m){let h=lc(e),g=h.path;n&&G(i)&&B(d,[...G(d),{path:G(i).path,line:G(f)}],!0),B(f,Number.isSafeInteger(m)&&m>0?m:h.line,!0),_?.abort(),G(u)?.close(),B(u,null);let v=new AbortController;_=v,B(p,g,!0),B(a,!0),B(o,!1),B(i,null),B(s,!!G(f),!0),B(c,!1);try{let e=await t.readFile(t.target.workspaceId,g,v.signal);if(v.signal.aborted)return;if(B(i,e,!0),B(p,e.path,!0),e.kind===`directory`){let n=new Bh(t.target.workspaceId,t.listDirectory,()=>{B(l,G(l)+1)},t.onerror);B(u,n,!0),await n.load(e.path)}}catch(e){if(v.signal.aborted)return;B(o,!0),t.onerror(e)}finally{v.signal.aborted||(B(a,!1),await Tr(),r?.focus({preventScroll:!0}),b())}}function b(){!G(f)||!G(i)||G(i).kind!==`file`||n.querySelector(`[data-line="${G(f)}"]`)?.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`})}async function x(){B(s,!G(s)),await Tr(),G(s)&&b()}function S(){let e=G(d).at(-1);e!==void 0&&(B(d,G(d).slice(0,-1),!0),y(e.path,!1,e.line))}function C(e){let t=(e.target instanceof Element?e.target.closest(`a`):null)?.getAttribute(`href`);if(!t||/^(?:https?:|mailto:|#)/i.test(t))return;e.preventDefault();let n=uc(t)??lc(t);y(fy(G(p),n.path),!0,n.line)}function w(e){return e.addEventListener(`click`,C),{destroy:()=>e.removeEventListener(`click`,C)}}Gi(()=>(v=document.activeElement instanceof HTMLElement?document.activeElement:null,n.showModal(),y(t.target.path,!1,t.target.line),()=>{_?.abort(),G(u)?.close(),n.close(),v?.focus()}));var T=by(),E=V(T),D=V(E),ee=V(D),te=V(ee,!0);P(ee),Ui(ee,e=>r=e,()=>r);var ne=U(ee,2),re=V(ne,!0);P(ne),P(D),Ya(U(D,2),{get onclick(){return t.onclose},label:`Close file preview`,children:(e,t)=>{Ue(),J(e,Gr(`Close`))},$$slots:{default:!0}}),P(E);var ie=U(E,2),O=V(ie);{let e=L(()=>!G(d).length);Ya(O,{onclick:S,get disabled(){return G(e)},children:(e,t)=>{Ue(),J(e,Gr(`Back`))},$$slots:{default:!0}})}var ae=U(O,2),oe=e=>{Ya(e,{onclick:()=>void x(),get pressed(){return G(s)},children:(e,t)=>{Ue();var n=Gr();W(()=>Y(n,G(s)?`Show formatted`:`Show source`)),J(e,n)},$$slots:{default:!0}})};X(ae,e=>{G(i)?.kind===`file`&&G(h).format!==`text`&&e(oe)});var se=U(ae,2),ce=e=>{{let t=L(()=>G(c)?`Fold all JSON`:`Unfold all JSON`);Ya(e,{onclick:()=>{B(c,!G(c))},get pressed(){return G(c)},get label(){return G(t)},children:(e,t)=>{Ue();var n=Gr();W(()=>Y(n,G(c)?`Unfolded`:`Folded`)),J(e,n)},$$slots:{default:!0}})}};X(se,e=>{G(h).format===`json`&&!G(s)&&e(ce)});var le=U(se,2),ue=e=>{var t=py(),n=V(t,!0);P(t),W(()=>Y(n,G(f)<=G(m)?`Line ${G(f)}`:`Line ${G(f)} unavailable (${G(m)} lines)`)),J(e,t)};X(le,e=>{G(f)&&G(i)?.kind===`file`&&e(ue)});var k=U(le,2),de=e=>{var t=my(),n=V(t);P(t),W((e,t)=>Y(n,`${e??``} · ${t??``} bytes`),[()=>G(h).format.toUpperCase(),()=>G(i).size.toLocaleString()]),J(e,t)};X(k,e=>{G(i)?.kind===`file`&&e(de)}),P(ie);var fe=U(ie,2),pe=V(fe),me=e=>{J(e,hy())},he=e=>{var t=gy();Ya(U(H(t),2),{onclick:()=>void y(G(p),!1,G(f)),children:(e,t)=>{Ue(),J(e,Gr(`Retry`))},$$slots:{default:!0}}),J(e,t)},ge=e=>{var t=vy(),n=H(t);zh(n,{get controller(){return G(u)},get revision(){return G(l)},get directory(){return G(i).path},onselectionchange:e=>{let t=e.split(`/`).slice(0,-1).join(`/`),n=G(u)?.state(t).entries.find(t=>t.path===e);n?.kind===`file`?y(e):n?.kind===`directory`&&G(u)?.expand(e)}});var r=U(n,2),a=e=>{J(e,_y())},o=L(()=>!G(u).state(G(i).path).entries.length&&!G(u).state(G(i).path).error);X(r,e=>{G(o)&&e(a)}),J(e,t)},_e=e=>{var t=Kr(),n=H(t),r=e=>{var t=yy();li(t,()=>G(g),!0),P(t),fi(t,e=>w?.(e)),J(e,t)},a=e=>{Eh(e,{get text(){return G(h).text},get unfolded(){return G(c)}})},o=e=>{{let t=L(()=>G(s)?G(i).content:G(h).text);vh(e,{get text(){return G(t)},get line(){return G(f)}})}};X(n,e=>{G(g)?e(r):G(h).format===`json`&&!G(s)?e(a,1):e(o,-1)}),J(e,t)};X(pe,e=>{G(a)?e(me):G(o)?e(he,1):G(i)?.kind===`directory`&&G(u)?e(ge,2):G(i)?.kind===`file`&&e(_e,3)}),P(fe),P(T),Ui(T,e=>n=e,()=>n),W(e=>{Y(te,e),Y(re,G(p)||`/`)},[()=>G(p).split(`/`).filter(Boolean).at(-1)||`Workspace files`]),Lr(`cancel`,T,e=>{e.preventDefault(),t.onclose()}),J(e,T),et()}var Sy=25*1024*1024;function Cy(e){return[...e].map(e=>({file:e,status:e.size>26214400?`too-large`:`queued`}))}function wy(e){return e.findIndex(e=>e.status===`queued`)}var Ty={phase:`idle`};function Ey(e,t){return{phase:`picking`,kind:e,source:t}}function Dy(e,t){return e.phase===`picking`?{...e,destination:t}:e}function Oy(e){return e.phase!==`picking`||e.destination===void 0?e:{...e,phase:`submitting`}}function ky(e,t){return e.phase===`submitting`?{...e,phase:`conflict`,replaceAllowed:t}:e}function Ay(e){return e.phase===`submitting`?{...e,phase:`failed`}:e}function jy(e,t){return e.phase!==`picking`||!e.source||e.kind===`move`&&My(e.source)===t?!1:!(t===e.source||t.startsWith(`${e.source}/`))}function My(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}var Ny=q(`<li> </li>`),Py=q(`<button type="button" class="svelte-qx7639">Replace</button>`),Fy=q(`<div class="browser-actions svelte-qx7639" aria-label="Upload conflict"><!> <button type="button" class="svelte-qx7639">Keep both</button> <button type="button" class="svelte-qx7639">Cancel remaining</button></div>`),Iy=q(`<button type="button" class="svelte-qx7639">Cancel uploads</button>`),Ly=q(`<section class="picker svelte-qx7639" aria-label="Upload queue" aria-live="polite"><p class="svelte-qx7639"> </p> <ul></ul> <!></section>`),Ry=q(`<button type="button" class="svelte-qx7639">View</button>`),zy=q(`<div class="browser-actions svelte-qx7639" aria-label="Selected file actions"><!> <button type="button" class="svelte-qx7639">Copy</button> <button type="button" class="svelte-qx7639">Move</button> <button type="button" class="svelte-qx7639">Delete</button></div>`),By=q(`<section class="picker svelte-qx7639" aria-label="Delete confirmation" aria-live="assertive"><h3> </h3> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Cancel</button> <button type="button" class="svelte-qx7639"> </button></div></section>`),Vy=q(`<section class="picker svelte-qx7639" aria-label="Choose destination folder" aria-live="polite"><p class="svelte-qx7639"><strong> </strong> </p> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Use root folder</button> <button type="button" class="svelte-qx7639"> </button> <button type="button" class="svelte-qx7639">Cancel</button></div></section>`),Hy=q(`<section class="picker svelte-qx7639" tabindex="-1" aria-label="File conflict" aria-live="assertive"><h3>Destination already contains this item</h3> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><!> <button type="button" class="svelte-qx7639">Keep both</button> <button type="button" class="svelte-qx7639">Cancel</button></div></section>`),Uy=q(`<section class="picker svelte-qx7639" aria-label="Transfer failed"><p role="status" class="svelte-qx7639">Transfer could not be completed.</p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Try again</button><button type="button" class="svelte-qx7639">Cancel</button></div></section>`),Wy=q(`<section aria-label="File browser error"><p class="svelte-qx7639">Files could not be read. Try again.</p></section>`),Gy=q(`<p role="status" class="svelte-qx7639">This folder is empty.</p>`),Ky=q(`<dialog aria-labelledby="file-browser-title" class="svelte-qx7639"><section class="file-browser-shell svelte-qx7639"><header class="svelte-qx7639"><div class="svelte-qx7639"><h2 id="file-browser-title" tabindex="-1" class="svelte-qx7639"> </h2> <p class="svelte-qx7639"> </p></div> <button type="button" class="close svelte-qx7639" aria-label="Close file browser">×</button></header> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Refresh</button></div> <div class="upload-actions svelte-qx7639"><input class="visually-hidden svelte-qx7639" type="file" multiple="" aria-label="Choose files to upload"/> <p class="svelte-qx7639"> </p> <button type="button" class="svelte-qx7639">Upload files</button></div> <!> <!> <!> <!> <!> <!></section></dialog>`);function qy(e,t){$e(t,!0);let n=$(t,`onsuccess`,3,()=>{}),r=$(t,`onmutation`,3,()=>{}),i=z(null),a=z(null),o=z(0),s=z(null),c=z(on(Ty)),l=z(null),u=z(``),d=z(!1),f=z(!1),p=z(null),m=z(null),h=z(on([])),g=z(!1),_=z(null),v=z(null),y=L(()=>G(o)<0?{entries:[],loading:!1,error:!1}:G(s)?.state(``)??{entries:[],loading:!0,error:!1}),b=L(()=>{if(!G(s)||!G(u))return;let e=G(u).includes(`/`)?G(u).slice(0,G(u).lastIndexOf(`/`)):``;return G(s).state(e).entries.find(e=>e.path===G(u))}),x=L(()=>`Files in ${t.root.relativePath===`.`?`~/`:`~/${t.root.relativePath}`}`);Gi(async()=>{B(s,new Bh(t.root.id,t.listDirectory,()=>{B(o,G(o)+1)},t.onerror),!0),await Tr(),G(i)?.showModal(),G(a)?.focus(),await G(s).load()}),Ki(()=>G(s)?.close());function S(){G(c).phase===`submitting`||G(f)||(G(_)?.abort(),G(s)?.close(),G(i)?.close())}let C=L(()=>G(b)?.kind===`directory`||!G(u)?G(u):``),w=L(()=>G(C)||``);async function T(e=`reject`){if(!(G(g)||!G(s))){B(g,!0);try{for(;;){let n=G(v)?.index??wy(G(h));if(B(v,null),n<0)break;let i=G(h)[n];if(!i||i.status===`too-large`)continue;B(h,G(h).map((e,t)=>t===n?{...e,status:`uploading`}:e),!0);let a=new AbortController;B(_,a,!0);try{let o=await t.uploadFile(t.root.id,{directory:G(w),filename:i.file.name,conflict:e,file:i.file},po(),a.signal);B(h,G(h).map((e,t)=>t===n?{...e,status:`completed`,path:o.path}:e),!0),await G(s).refresh(G(w)),G(s).select(G(w)),B(u,G(w),!0),r()(),e=`reject`}catch(e){let r=e;if(r.status===409){B(h,G(h).map((e,t)=>t===n?{...e,status:`queued`}:e),!0),B(v,{index:n,replaceAllowed:r.replaceAllowed===!0},!0);break}B(h,G(h).map((e,t)=>t===n?{...e,status:a.signal.aborted?`cancelled`:`failed`}:e),!0),t.onerror(e)}finally{B(_,null)}}}finally{B(g,!1);let e=G(h).filter(e=>e.status===`completed`).length;e&&n()(`Uploaded ${e} file${e===1?``:`s`}.`)}}}function E(e){!e||e.length===0||(B(h,Cy(e),!0),T())}function D(){G(_)?.abort(),B(h,G(h).map(e=>e.status===`queued`||e.status===`uploading`?{...e,status:`cancelled`}:e),!0),B(v,null)}function ee(e){if(G(c).phase===`submitting`||G(f)){e.preventDefault();return}e.preventDefault(),S()}async function te(){if(!(!G(u)||G(f))){B(f,!0);try{let e=G(u).includes(`/`)?G(u).slice(0,G(u).lastIndexOf(`/`)):``;await t.deleteEntry(t.root.id,G(u),po()),await G(s)?.refresh(e),G(s)?.select(e),B(u,e,!0),n()(`Deleted item.`),r()(),B(d,!1)}catch(e){t.onerror(e)}finally{B(f,!1)}}}async function ne(){B(d,!0),await Tr(),G(p)?.focus()}function re(e){G(u)&&B(c,Ey(e,G(u)),!0)}function ie(e){jy(G(c),e)&&B(c,Dy(G(c),e),!0)}async function O(e=`reject`){if(!G(s)||G(c).phase!==`picking`&&G(c).phase!==`conflict`)return;let i=G(c).phase===`picking`?Oy(G(c)):{...G(c),phase:`submitting`};if(!(!i.source||i.destination===void 0||!i.kind)){B(c,i,!0);try{let a=await(i.kind===`copy`?t.copyEntry:t.moveEntry)(t.root.id,{source:i.source,destinationDirectory:i.destination,conflict:e},po()),o=i.source.includes(`/`)?i.source.slice(0,i.source.lastIndexOf(`/`)):``;i.kind===`copy`?await G(s).refresh(i.destination):await Promise.all([G(s).refresh(o),G(s).refresh(i.destination)]),G(s).select(a.path),n()(`${i.kind===`copy`?`Copied`:`Moved`} ${a.path}.`),r()(),B(c,Ty,!0)}catch(e){let n=e;n.status===409?(B(c,ky(i,n.replaceAllowed===!0),!0),await Tr(),G(l)?.focus()):(B(c,Ay(i),!0),t.onerror(e))}}}var ae=Ky(),oe=V(ae),se=V(oe),ce=V(se),le=V(ce),ue=V(le,!0);P(le),Ui(le,e=>B(a,e),()=>G(a));var k=U(le,2),de=V(k,!0);P(k),P(ce);var fe=U(ce,2);P(se);var pe=U(se,2),me=V(pe);P(pe);var he=U(pe,2),ge=V(he);Ui(ge,e=>B(m,e),()=>G(m));var _e=U(ge,2),A=V(_e);P(_e);var ve=U(_e,2);P(he);var ye=U(he,2),be=e=>{var t=Ly(),n=V(t),r=V(n);P(n);var i=U(n,2);Z(i,21,()=>G(h),e=>e.file,(e,t)=>{var n=Ny(),r=V(n);P(n),W(()=>Y(r,`${G(t).file.name??``}: ${G(t).path??G(t).status??``}${G(t).status===`too-large`?` (maximum ${Sy/1024/1024} MiB)`:``}`)),J(e,n)}),P(i);var a=U(i,2),o=e=>{var t=Fy(),n=V(t),r=e=>{var t=Py();K(`click`,t,()=>void T(`replace`)),J(e,t)};X(n,e=>{G(v).replaceAllowed&&e(r)});var i=U(n,2),a=U(i,2);P(t),K(`click`,i,()=>void T(`keep-both`)),K(`click`,a,D),J(e,t)},s=e=>{var t=Iy();K(`click`,t,D),J(e,t)};X(a,e=>{G(v)?e(o):G(g)&&e(s,1)}),P(t),W((e,t)=>Y(r,`${e??``} queued, ${t??``} completed`),[()=>G(h).filter(e=>e.status===`queued`).length,()=>G(h).filter(e=>e.status===`completed`).length]),J(e,t)};X(ye,e=>{G(h).length&&e(be)});var xe=U(ye,2),Se=e=>{var n=zy(),r=V(n),i=e=>{var n=Ry();K(`click`,n,()=>t.onview?.(G(u))),J(e,n)};X(r,e=>{t.onview&&e(i)});var a=U(r,2),o=U(a,2),s=U(o,2);P(n),K(`click`,a,()=>re(`copy`)),K(`click`,o,()=>re(`move`)),K(`click`,s,()=>void ne()),J(e,n)};X(xe,e=>{G(s)&&G(c).phase===`idle`&&G(b)&&G(b).kind!==`symlink`&&e(Se)});var Ce=U(xe,2),we=e=>{var t=By(),n=V(t),r=V(n,!0);P(n);var i=U(n,2),a=V(i,!0);P(i);var o=U(i,2),s=V(o);Ui(s,e=>B(p,e),()=>G(p));var c=U(s,2),l=V(c,!0);P(c),P(o),P(t),W(()=>{Y(r,G(b).kind===`directory`?`Delete folder and all contents`:`Delete file`),Y(a,G(u)),s.disabled=G(f),c.disabled=G(f),Y(l,G(f)?`Deleting…`:`Delete`)}),K(`click`,s,()=>B(d,!1)),K(`click`,c,()=>void te()),J(e,t)};X(Ce,e=>{G(d)&&G(b)&&e(we)});var Te=U(Ce,2),Ee=e=>{var t=Vy(),n=V(t),r=V(n),i=V(r);P(r);var a=U(r);P(n);var o=U(n,2),s=V(o);P(o);var l=U(o,2),u=V(l),d=U(u,2),f=V(d);P(d);var p=U(d,2);P(l),P(t),W(e=>{Y(i,`${G(c).kind===`copy`?`Copy`:`Move`}:`),Y(a,` ${G(c).source??``}`),Y(s,`Destination: ${(G(c).destination===``?`root folder`:G(c).destination??`choose a folder`)??``}`),u.disabled=e,d.disabled=G(c).destination===void 0,Y(f,`Confirm ${G(c).kind??``}`)},[()=>!jy(G(c),``)]),K(`click`,u,()=>ie(``)),K(`click`,d,()=>void O()),K(`click`,p,()=>B(c,Ty,!0)),J(e,t)},De=e=>{var t=Hy(),n=U(V(t),2),r=V(n,!0);P(n);var i=U(n,2),a=V(i),o=e=>{var t=Py();K(`click`,t,()=>void O(`replace`)),J(e,t)};X(a,e=>{G(c).replaceAllowed&&e(o)});var s=U(a,2),u=U(s,2);P(i),P(t),Ui(t,e=>B(l,e),()=>G(l)),W(()=>Y(r,G(c).destination)),K(`click`,s,()=>void O(`keep-both`)),K(`click`,u,()=>B(c,Ty,!0)),J(e,t)},Oe=e=>{var t=Uy(),n=U(V(t),2),r=V(n),i=U(r);P(n),P(t),K(`click`,r,()=>B(c,{...G(c),phase:`picking`},!0)),K(`click`,i,()=>B(c,Ty,!0)),J(e,t)};X(Te,e=>{G(c).phase===`picking`?e(Ee):G(c).phase===`conflict`?e(De,1):G(c).phase===`failed`&&e(Oe,2)});var ke=U(Te,2),Ae=e=>{J(e,Wy())},je=e=>{J(e,Gy())};X(ke,e=>{G(s)&&!G(y).loading&&G(y).error?e(Ae):G(s)&&!G(y).loading&&G(y).entries.length===0&&e(je,1)});var Me=U(ke,2),j=e=>{var n=Kr();$r(H(n),()=>G(o),e=>{{let n=L(()=>G(c).phase===`picking`);zh(e,{get controller(){return G(s)},get revision(){return G(o)},get destinationMode(){return G(n)},ondestinationselect:ie,onselectionchange:async e=>{B(u,e,!0);let n=e.split(`/`).slice(0,-1).join(`/`);G(s)?.state(n).entries.find(t=>t.path===e)?.kind!==`file`||!t.onview||G(d)||(await Tr(),!(G(u)!==e||G(c).phase!==`idle`||!G(i)?.open)&&(G(i)?.querySelector(`[role="treeitem"][aria-selected="true"]`)?.focus(),t.onview(e)))}})}}),J(e,n)};X(Me,e=>{G(s)&&e(j)}),P(oe),P(ae),Ui(ae,e=>B(i,e),()=>G(i)),W(()=>{Y(ue,G(x)),Y(de,G(c).phase===`picking`?`Choose destination folder.`:`Browse folders and select a position.`),me.disabled=G(y).loading,Y(A,`Upload destination: ${(G(b)?.kind===`file`?`Select a folder first`:G(u)||`root folder`)??``}`),ve.disabled=G(b)?.kind===`file`||G(g)}),Lr(`close`,ae,function(...e){t.onclose?.apply(this,e)}),Lr(`cancel`,ae,ee),K(`click`,fe,S),K(`click`,me,()=>void G(s)?.refresh()),K(`change`,ge,e=>E(e.currentTarget.files)),K(`click`,ve,()=>G(m)?.click()),J(e,ae),et()}Rr([`click`,`change`]);var Jy=q(`<main class="evidence-mode svelte-1d2e8zz"><!></main>`),Yy=q(`<span class="detached-chat-model svelte-1d2e8zz"> </span>`),Xy=q(`<header class="detached-chat-header svelte-1d2e8zz"><div class="detached-chat-context svelte-1d2e8zz"><span class="svelte-1d2e8zz">Chat</span> <strong class="svelte-1d2e8zz"> </strong></div> <!></header>`),Zy=q(`<div class="chat-controls svelte-1d2e8zz" aria-label="Chat controls"><!> <!></div>`),Qy=q(`<!> <!> <!> <div class="chat-tail svelte-1d2e8zz" aria-hidden="true"></div>`,1),$y=q(`<p> </p>`),eb=q(`<section class="chat-view svelte-1d2e8zz" aria-labelledby="chat-title"><h2 id="chat-title" class="visually-hidden">Chat</h2> <!> <!> <p class="visually-hidden" aria-live="polite" aria-atomic="true"> </p> <!></section>`),tb=q(`<p>Loading skill profiles…</p>`),nb=q(`<section class="session-profile-manager" aria-labelledby="session-profile-manager-title"><div class="session-profile-manager-header svelte-1d2e8zz"><h2 id="session-profile-manager-title" tabindex="-1" class="svelte-1d2e8zz">Manage skill profiles</h2> <button type="button" class="close-profile-manager svelte-1d2e8zz" aria-label="Close skill profile editor">×</button></div> <!></section>`),rb=q(`<!> <!> <!> <!> <!> <!>`,1),ib=q(`<main class="swipe-surface svelte-1d2e8zz"><!> <!> <!> <!></main> <!>`,1);function ab(e,t){$e(t,!0);let n=$(t,`oncreatepasskey`,3,()=>{}),r=wl(location.search),i=z(null),a=z(on(r?`chat`:`sessions`)),o=z(!1),s=z(!1),c=z(!1),l=z(null),u=z(null),d=z(!1),f=z(null),p=null,m=0,h=z(null),g=z(null),_=!1,v=z(`Loading relay…`),y=z(on(Or(()=>t.theme))),b=z(on([])),x=`gpt-6.1-sol`,S=z(`medium`),C=z(`gpt-5.6-terra`),w=z(`high`),T=z({codex:[x],kimi:[]}),E=z([]),D=z(void 0),ee=z(!1),te;function ne(e){B(D,e,!0),e?.state===`error`&&e.message!==te?(te=e.message,kt.enqueue({kind:`warning`,message:e.message??`XERJ is unavailable. Run gestalt doctor.`})):e?.state!==`error`&&(te=void 0)}Mn(()=>{if(!G(ee)||!Or(()=>G(D)))return;let e=new AbortController,n,r=async()=>{try{let n=await t.authorizedFetch(`/api/xerj`,{signal:e.signal});if(!n.ok)throw Error(`XERJ status unavailable`);let r=await n.json();e.signal.aborted||ne(r)}catch{e.signal.aborted||kt.enqueue({kind:`warning`,message:`Could not refresh XERJ status. Reopen configuration to retry.`});return}e.signal.aborted||(n=setTimeout(()=>void r(),5e3))};return r(),()=>{e.abort(),clearTimeout(n)}});let re=z(null),ie=z(`codex`),O=z({codex:x,kimi:``}),ae=z(null),oe=z(null),se=L(()=>G(ae)?.kimi.available??!1),ce=L(()=>G(se)?G(ie):`codex`),le=z([]),ue=z(null),k=z(`list`),de=z([]),fe=z(``),pe=z(``),me=z(``),he=z(!1),ge=z(!1),_e=z(on(new Set)),A=z(null),ve=z(on([])),ye=z(new Map),be=z({snapshots:new Map,attention:new Map,pending:new Set,errors:new Map}),xe=z(new Map),Se=0,Ce=null,we=L(()=>G(ve).some(e=>e.id===G(A))),Te=z(on([])),Ee=z(`workspace-git`),De=z(`never`),Oe=z(on({starting:!1,error:null})),ke=L(()=>G(Oe).starting),Ae=z(null),je=0,Me=z(null),j=z(null),Ne=z(``),Pe=0,Fe=new Map,Ie=z(on({kind:`unavailable`,sessionId:null})),Le=z({kind:`no-workspace`}),Re=z(null),ze=z(null),M=z(!1),Be=null,N=null,Ve=0,He=null,Ue=null,We=!1,Ge=z(on([])),Ke=0,qe=z(null),Je=L(()=>G(b)[0]?.id??null),Ye=L(()=>G(ve).find(e=>e.id===G(A))?.workspacePath??null),Xe=L(()=>G(ve).find(e=>e.id===G(A))??null),Ze=L(()=>Fa([{id:`debug`,label:`DEBUG`,tab:`chat`,available:e=>!!e.threadId,run:()=>void Kt()}],G(a),G(Xe))),Qe=L(()=>pp(G(Xe)?.workspacePath??``)),tt=L(()=>G(Xe)?`${G(Xe).provider===`kimi`?`Kimi · `:``}${G(Xe).model??x}`:x);function nt(e){return`kind`in e&&e.kind===`org-source`}function rt(e){return r?e.filter(e=>e.id===G(A)):e}let it=L(()=>G(Re)&&nt(G(Re))?G(Re):G(Re)?{kind:`ready`,sessionId:`catalog`,plan:G(Re)}:G(M)?null:G(Ie).kind===`ready`||G(Ie).kind===`closing`||G(Ie).kind===`error`&&G(Ie).plan?G(Ie):null),at=L(()=>Ld(G(Ie).kind===`ready`||G(Ie).kind===`closing`||G(Ie).kind===`error`?G(Ie).plan:void 0)),ot=z(on({workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null})),st=L(()=>G(ot).workspaceId),ct=z(on(new Set)),F=z(!1),lt=z(!1),ut=z(!1),dt=z(null),ft=z(null),pt=z(null),mt=on({}),ht=z({}),gt=z(null),_t=``,vt=new _u({requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e),reducedMotion:()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,scrollTail:e=>G(gt)?.scrollIntoView({block:`end`,behavior:e})}),yt=new vu(e=>void Tr().then(e),e=>{G(a)===`chat`&&vt.request(e)}),bt=L(()=>{let e=G(i)?.interactions.findLast(e=>e.state!==`pending`);return e?e.state===`submitting`?`Sending decision.`:e.state===`failed`?`Could not send decision. Retry is available.`:e.state===`resolved`?e.attemptedOutcome===`denied`?`Decision denied.`:e.attemptedOutcome===`dismissed`?`Request is no longer awaiting a response.`:e.attemptedOutcome===`answered`?`Answers sent.`:`Decision approved.`:``:``}),I=Dd((e,n)=>t.authorizedFetch(e,n)),xt=new To(I,e=>B(be,e)),St=new fo({relay:I,publish:e=>B(ye,new Map(e)),onEvent:(e,t)=>xt.observe(e,t),onAuthoritativeSnapshot:(e,t)=>xt.applyAuthoritative(e,t)}),Ct=new mu({relay:I,cache:Sl(),publish:e=>B(i,e,!0),onSessionEvent:e=>fr(e),onRelayEvent:e=>{G(A)&&St.observe(G(A),e);let t=Nu(e);t&&kt.enqueue(t)},onHistoryError:e=>{B(v,lr(e,`SESSION_HISTORY_READ_FAILED`),!0)},onSendError:(e,t)=>{let n=xu(e,`MESSAGE_SEND_FAILED`);if(n.code===`SESSION_WORKSPACE_UNAVAILABLE`){B(Me,null),B(j,null),kt.enqueue({kind:`warning`,...n});return}B(Me,n.message,!0),B(j,n.retryable?t:null,!0),B(v,lr(e,`MESSAGE_SEND_FAILED`),!0)},onSendAccepted:(e,t)=>{G(j)===t&&(B(Me,null),B(j,null));let n=Fe.get(t);n&&n.sessionId===e&&vn(n)},onHistoryPromptAccepted:(e,t)=>{let n=Fe.get(t);n&&n.sessionId===e&&vn(n)}}),wt=new Kp({start:I.startSession},po,e=>B(Oe,e,!0)),Tt=new bd({getSummary:I.getGitSummary,pull:I.pullGit,checkout:I.checkoutGitBranch},e=>!!Gu(G(b),e)?.isGitRepository,e=>B(ot,e,!0),(e,t)=>lr(e,t)),Et=ah((e,n)=>t.authorizedFetch(e,n)),Dt=Id({getPlan:I.getPlan,closePlan:I.closePlan},e=>{B(Ie,e,!0),(e.kind===`ready`||e.kind===`closing`)&&B(ve,G(ve).map(t=>t.id===e.sessionId?{...t,plan:e.plan}:t),!0)}),Ot=sp(),kt=Mu({historyStorage:Au()}),At=new URLSearchParams(location.search).get(`tree-evidence`),R=new URLSearchParams(location.search).get(`toast-evidence`),jt=new URLSearchParams(location.search).get(`activity-evidence`),Mt=Io(window.sessionStorage),Nt=new Set;Mn(()=>{for(let[e,t]of G(be).attention){let n=`${e}:${t.requestId}`;Mt.claim(n)&&kt.enqueue({kind:`error`,code:`AUTOPILOT_ATTENTION_${t.requestId}`,message:`Autopilot needs your attention.`})}}),Mn(()=>{let e=new Set;for(let[t,n]of G(be).errors){let r=`${t}:${n}`;e.add(r),!Nt.has(r)&&(Nt.add(r),kt.enqueue({kind:`error`,message:n}))}for(let t of Nt)e.has(t)||Nt.delete(t)});function Pt(){B(c,!0)}function Ft(){B(c,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}function It(){B(s,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}async function Lt(){try{await I.quit()}catch(e){throw lr(e,`QUIT_FAILED`),e}}let Rt=new AbortController;async function zt(){try{await Oa((await I.upgrade()).instanceId,I.upgradeStatus,Rt.signal),window.location.reload()}catch(e){throw Rt.signal.aborted||lr(e,`UPGRADE_FAILED`),e}}Gi(async()=>{if(!(At===`sessions`||At===`git`||R===`error`||R===`stacked`))try{let e=await dl(t.authorizedFetch);B(me,Ku(G(me)||null,G(b),e.workspaces,Bu.sessionBase)??``,!0),B(b,e.workspaces,!0),B(le,e.profiles),B(T,{codex:[...new Set([x,...e.models?.codex??[]])],kimi:e.models?.kimi??[]}),B(O,{...G(O),kimi:G(O).kimi||(e.models?.kimi?.[0]??``)}),B(ae,e.capabilities?.providers??null);try{if(e.sessionDefaultsError)throw Error(`SESSION_DEFAULTS_READ_FAILED`);let t=e.sessionDefaults;t&&(B(Ee,t.sandbox,!0),B(De,t.approvalPolicy,!0),B(fe,t.skillProfile,!0),B(ie,t.provider,!0),B(S,t.reasoningEffort??`medium`,!0),B(C,t.executorModel??`gpt-5.6-terra`,!0),B(w,t.executorReasoningEffort??`high`,!0),B(O,{...G(O),[t.provider]:t.model}),Gu(e.workspaces,t.workspaceId)&&B(me,t.workspaceId,!0),G(T)[t.provider].includes(t.model)||B(T,{...G(T),[t.provider]:[t.model,...G(T)[t.provider]]}))}catch(e){lr(e,`SESSION_DEFAULTS_READ_FAILED`)}B(E,e.versions??[]),ne(e.xerj),B(re,e.branding?.headerIconUrl??null,!0),r||await Bn(),B(_e,Vu(G(b)),!0),B(ct,Vu(G(b)),!0);let n=r?null:await Ot.readSelectedSession();if(B(A,r?e.sessions.find(e=>e.id===r)?.id??null:e.sessions.some(e=>e.id===n)?n:e.sessions[0]?.id??null,!0),G(A)){let e=await Ot.readDraftEnvelope(G(A));B(Ne,e.text,!0),Pe=e.revision,yn(G(A),e.pending)}B(ve,e.sessions,!0);let i=rt(e.sessions.filter(e=>[`ready`,`turnActive`].includes(e.state)));St.bootstrap(i,G(A)),xt.bootstrap(i),r||tn(),Dt.select(G(A)),G(A)?Ct.select(G(A)):r&&B(v,`This session is no longer open in Gestalt Mobile.`)}catch(e){B(v,lr(e,`RELAY_UNAVAILABLE`),!0)}}),Mn(()=>{if(!G(gt))return;let e=new IntersectionObserver(([e])=>vt.observeTail(e?.isIntersecting??!1),{root:null});return e.observe(G(gt)),()=>e.disconnect()}),Mn(()=>{let e=G(i),t=G(a),n=e?JSON.stringify({messages:e.messages.map(({id:e,text:t,complete:n})=>[e,t,n]),activities:e.activities.map(({id:e,label:t,detail:n})=>[e,t,n]),interactions:e.interactions.map(({key:e,state:t,attemptedOutcome:n})=>[e,t,n])}):``;!n||n===_t||(_t=n,t===`chat`&&Bt(`content`))});function Bt(e){yt.schedule(e)}function Vt(){yt.invalidate(),vt.reset(),B(a,`chat`),Wn(`chat`),Bt(`initial`),Gn()}function Ht(e){B(y,oa(e),!0)}function Ut(){if(!G(A))return;let e=window.open(Tl(location.href,G(A)),El(G(A)),`popup,width=760,height=900`);if(!e){kt.enqueue({kind:`error`,message:`The Chat window was blocked. Allow pop-ups for this site and try again.`});return}try{e.opener=null}catch{}e.focus()}Ki(()=>{Rt.abort(),Be?.abort(),N?.abort(),yt.invalidate(),vt.cancel(),Ct.dispose(),St.dispose(),xt.dispose(),Dt.dispose(),Tt.dispose(),wt.dispose(),G(ue)?.dispose()});async function Wt(e){B(ie,e,!0);let t=G(T)[e];if(!G(O)[e]&&t[0]&&B(O,{...G(O),[e]:t[0]}),!(t.length>0)){B(oe,e,!0);try{let t=await I.listSessionModels(e);B(T,{...G(T),[e]:t.models}),!G(O)[e]&&t.models[0]&&B(O,{...G(O),[e]:t.models[0]})}catch(e){lr(e,`SESSION_MODELS_READ_FAILED`)}finally{G(oe)===e&&B(oe,null)}}}async function Gt(){if(!G(me)||G(ke))return;let e=G(se)?G(ie):`codex`,t=Gp({workspaceId:G(me),profile:`default`,profileState:`ok`});if(t.profile){B(v,t.profile,!0);return}B(v,`Starting session…`);let n=await wt.start(G(me),{provider:e,sandbox:G(Ee),approvalPolicy:G(De),model:G(O)[e]||void 0,...e===`codex`?{reasoningEffort:G(S),executorModel:G(C),executorReasoningEffort:G(w)}:{},skillProfile:G(fe)||void 0});if(!n){G(Oe).error&&B(v,lr(Error(G(Oe).error),`SESSION_START_FAILED`),!0);return}try{B(A,n.id,!0);for(let e of n.effectiveSkillSelection?.warnings??[])kt.enqueue({kind:`warning`,code:`SKILL_PROFILE_MISSING_SKILL`,message:e});Dt.select(n.id),Ot.saveSelectedSession(n.id),await Zt();let e=await Ot.readDraftEnvelope(n.id);B(Ne,e.text,!0),Pe=e.revision,yn(n.id,e.pending),Ct.select(n.id,{history:`empty`}),St.select(n.id),Vt(),B(v,`Session started.`)}catch(e){B(v,lr(e,`SESSION_START_FAILED`),!0)}}async function Kt(){if(!G(Xe)?.threadId||G(d))return;let e=G(Xe).id,t=++m;B(d,!0);try{let n=await I.debugConfirmation(e);t===m&&G(A)===e&&G(a)===`chat`&&B(u,n)}catch(e){lr(e,`DEBUG_CONTEXT_FAILED`)}finally{t===m&&B(d,!1)}}function qt(){B(u,null),queueMicrotask(()=>document.querySelector(`.menu-trigger`)?.focus())}async function Jt(){let e=G(u);if(e)try{let t=await I.startSelfDebug(e.context.mobileSession,e.confirmationId);B(u,null),await Zt(),await rn(t.id)}catch(e){throw lr(e,`DEBUG_START_FAILED`),nn(),e}}function Yt(e,t){p=t,B(f,e)}function Xt(){B(f,null),queueMicrotask(()=>p?.focus())}async function Zt(){let e=++Se;Ce?.abort();let t=new AbortController;Ce=t;try{let n=await I.listSessions(t.signal);if(e!==Se||t.signal.aborted)return;B(ve,n.map(e=>G(xe).has(e.id)?{...e,plan:G(xe).get(e.id)}:e),!0);let r=rt(G(ve).filter(e=>[`ready`,`turnActive`].includes(e.state)));St.bootstrap(r,G(A)),xt.bootstrap(r)}catch(e){if(t.signal.aborted||dr(e))return;throw e}finally{Ce===t&&(Ce=null)}}async function Qt(e,t){await xt.toggle(e,t),e===G(A)&&Zt().catch(()=>{})}async function $t(e){await Qt(e,!0),await Tr(),e===G(A)&&document.getElementById(`chat-autopilot-${e}-button`)?.focus({preventScroll:!0})}async function en(e,t,n){await xt.resolve(e,t,n),e===G(A)&&Zt().catch(()=>{})}async function tn(){try{B(Te,await I.listRecentSessions(),!0)}catch{B(Te,[],!0)}}async function nn(){try{await Promise.all([Zt(),tn()])}catch(e){B(v,lr(e,`SESSION_REFRESH_FAILED`),!0)}}async function rn(e){B(v,`Opening session…`),B(Ae,e,!0);let t=++je;try{B(A,e,!0),B(Me,null),B(j,null),Dt.select(e),Ot.saveSelectedSession(e),Ct.select(e),St.select(e),Vt();let n=await Ot.readDraftEnvelope(e);t===je&&G(A)===e&&(B(Ne,n.text,!0),Pe=n.revision,yn(e,n.pending))}catch(e){B(v,lr(e,`SESSION_HISTORY_READ_FAILED`),!0)}finally{t===je&&B(Ae,null)}}async function an(e){B(v,`Opening recent session…`);try{let t=await I.openRecentSession(e.id,e.cwd,e.provider??`codex`);G(ve).some(e=>e.id===t.id)||B(ve,[...G(ve),t],!0),nn(),await rn(t.id)}catch(e){B(v,lr(e,`SESSION_HISTORY_READ_FAILED`),!0)}}async function sn(e){B(v,`Closing session…`);try{await I.releaseSession(e),G(A)===e&&(B(A,null),B(a,`sessions`),Ot.saveSelectedSession(null),Ct.select(null),St.select(null),Dt.select(null)),await nn(),B(v,`Session closed.`)}catch(e){B(v,lr(e,`SESSION_CLOSE_FAILED`),!0)}}async function cn(){B(he,!0);try{if(!(await t.authorizedFetch(`/api/session-defaults`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({workspaceId:G(me),skillProfile:G(fe),provider:G(ce),model:G(O)[G(ce)],reasoningEffort:G(S),executorModel:G(C),executorReasoningEffort:G(w),sandbox:G(Ee),approvalPolicy:G(De)})})).ok)throw Error(`SESSION_DEFAULTS_SAVE_FAILED`);B(v,`Session defaults saved.`),kt.enqueue({kind:`success`,message:`Session defaults saved.`})}catch(e){lr(e,`SESSION_DEFAULTS_SAVE_FAILED`)}finally{B(he,!1)}}async function dn(e){let t=G(ve).find(t=>t.id===e);try{await I.forgetSession(e),G(A)===e&&(Ct.select(null),St.select(null),B(A,null),Ot.saveSelectedSession(null),Dt.select(null)),await nn(),B(Te,fp(G(Te),t),!0)}catch(e){B(v,`Could not forget session: ${cr(e)}`)}}async function fn(e){await _c(e)?(B(v,`Resume command copied.`),kt.enqueue({kind:`success`,message:G(v)})):B(v,lr(Error(`SESSION_COPY_FAILED`),`SESSION_COPY_FAILED`),!0)}async function pn(e){if(!(!G(A)||G(i)?.activeTurnId))try{let t=await I.selectModel(G(A),e);B(ve,G(ve).map(e=>e.id===t.id?{...e,...t}:e),!0),B(Ne,``),B(v,`Model changed to ${e}; it applies to the next turn.`)}catch(e){B(v,`Could not change model: ${cr(e)}`)}}async function mn(e){if(!G(A)||!G(Ne).trim()||!Ct.canSubmit(e)||[...Fe.values()].some(e=>e.sessionId===G(A)&&e.revision===Pe))return;let t=po(),n={sessionId:G(A),revision:Pe,text:G(Ne),operationId:t,kind:e};Fe.set(t,n),Ot.addPendingDraftOperation(G(A),n),e===`send`?Ct.send(n.text,t):e===`queue`?Ct.queue(n.text,t):Ct.interruptAndSend(n.text,t)}let hn=()=>mn(`send`),gn=()=>mn(`queue`),_n=()=>mn(`interrupt-send`);async function vn(e){let t=await Ot.consumeAcceptedDraft(e.sessionId,e.revision,e.operationId);t&&Fe.delete(e.operationId),t&&e.sessionId===G(A)&&e.revision===Pe?(G(j)===e.operationId&&(B(j,null),B(Me,null)),B(Ne,``),Pe=t.revision,Bt(`explicit`)):e.sessionId===G(A)&&e.revision===Pe&&(B(Me,null),B(j,e.operationId,!0),kt.enqueue({kind:`warning`,code:`PROMPT_LOCAL_RECOVERY_${e.operationId}`,message:`The accepted prompt could not be saved locally. Keep this text until recovery completes. Retry is available.`}))}function yn(e,t){for(let n of t??[])Fe.set(n.operationId,{sessionId:e,...n});e===G(A)&&(t?.length??0)>0&&(B(Me,null),B(j,t[0].operationId,!0),kt.enqueue({kind:`warning`,code:`PROMPT_RECOVERY_${G(j)}`,message:`A submitted prompt is being recovered. It will not be sent again automatically. Retry is available.`}))}async function bn(){if(!G(j))return;B(Me,null);let e=Fe.get(G(j));if(!e){await Ct.retryPrompt(G(j));return}e.kind===`send`?await Ct.send(e.text,e.operationId):e.kind===`queue`?await Ct.queue(e.text,e.operationId):await Ct.interruptAndSend(e.text,e.operationId)}async function xn(){await Ct.interrupt()}function Sn(){G(a)===`chat`&&G(A)&&Ct.refresh()}function Cn(e){if(r||e===`chat`&&!G(we))return;let t=G(a)!==e;G(a)===`chat`&&e!==`chat`&&(yt.invalidate(),vt.cancel()),B(a,e,!0),Wn(e),e===`chat`&&(Sn(),vt.reset(),Bt(`initial`),t&&Gn()),e===`git`&&G(st)&&Tt.refresh(),e===`plan`&&(G(A)&&Dt.refresh(G(A)),t||In()),e===`sessions`&&(G(k)===`profile-manager`&&Un(!1),nn(),G(A)&&Dt.refresh(G(A)))}Mn(()=>{let e=G(Je);G(a)===`plan`&&Or(()=>jn(e))});let wn=!1;function Tn(){document.visibilityState!==`visible`||wn||(wn=!0,queueMicrotask(()=>{wn=!1,document.visibilityState===`visible`&&(G(a)===`git`&&G(st)&&Tt.refresh(),G(a)===`sessions`&&(nn(),G(A)&&Dt.refresh(G(A))))}))}let En=null;function Dn(e){return e instanceof Element&&e.closest(`button, input, textarea, select, a, summary, [contenteditable]`)!==null}function On(e){e.pointerType!==`touch`||Dn(e.target)||(En={pointerId:e.pointerId,x:e.clientX,y:e.clientY})}function kn(e){if(!En||e.pointerId!==En.pointerId)return;let t=En;En=null;let n=e.clientX-t.x,r=e.clientY-t.y;Math.abs(n)<48||Math.abs(n)<=Math.abs(r)||Cn(Jp(G(a),n<0?1:-1,{chatEnabled:G(we)}))}function An(e){En?.pointerId===e.pointerId&&(En=null)}function jn(e=G(Je),t=!1){if(Be&&Ue===e)return;if(Be?.abort(),t||(N?.abort(),B(Re,null),B(ze,null)),!e){B(Le,{kind:`no-workspace`});return}let n=new AbortController;Be=n,Ue=e;let r=++Ve;B(Le,He?.workspaceId===e?{...He,refreshing:!0}:{kind:`loading`,workspaceId:e}),I.listWorkspacePlans(e,n.signal).then(t=>{r!==Ve||n.signal.aborted||(He={kind:`ready`,workspaceId:e,entries:t},B(Le,He))}).catch(t=>{r!==Ve||n.signal.aborted||(G(it)||kt.enqueue({kind:`error`,code:`WORKSPACE_PLANS_READ_FAILED`,message:`Workspace Org files could not be listed. Try opening the Plan tab again.`}),B(Le,He?.workspaceId===e?He:{kind:`error`,workspaceId:e,error:t instanceof Error?t.message:`Could not load workspace plans.`}))}).finally(()=>{Be===n&&(Be=null)})}function Nn(e,t=!1,n=!0){let r=t?G(Xe)?.workspaceId:G(Je);if(!r)return;N?.abort();let i=new AbortController;N=i;let o=++Ke;We=t,(t&&G(A)?I.openSessionPlan(G(A),e):I.getWorkspacePlan(r,e,i.signal)).then(t=>{o!==Ke||i.signal.aborted||(B(Re,t),B(ze,e,!0),B(M,!1),n&&Tr().then(()=>{requestAnimationFrame(()=>{o===Ke&&!i.signal.aborted&&G(a)===`plan`&&window.scrollTo({top:0,behavior:`instant`})})}))}).catch(()=>{o!==Ke||i.signal.aborted||kt.enqueue({kind:`error`,code:`WORKSPACE_PLAN_OPEN_${e}`,message:`This Org file could not be opened. Check that it is readable and try again.`})}).finally(()=>{N===i&&(N=null)})}function Pn(e){let t=G(Xe)?.workspaceId,n=G(Ye),r=n?hc(e,n):null;if(!t||!r){kt.enqueue({kind:`error`,code:`ORG_LINK_OUTSIDE_WORKSPACE`,message:`This Org file is not inside the selected workspace and cannot be opened.`});return}Cn(`plan`),Tr().then(()=>{G(Xe)?.workspaceId!==t||G(Ye)!==n||Nn(r,!0)})}function Fn(){B(Re,null),B(ze,null),B(M,!0),jn()}function In(){G(A)&&Dt.refresh(G(A)),G(ze)&&Nn(G(ze),We,!1),jn(G(Je),!0)}async function Ln(e){let t=G(Je);if(!(!t||G(Ge).includes(e))){B(Ge,[...G(Ge),e],!0);try{await I.archiveWorkspacePlan(t,e),He?.workspaceId===t&&(Be?.abort(),Be=null,He={...He,entries:He.entries.map(t=>t.planName===e?{...t,archived:!0}:t)},B(Le,He),jn(t,!0)),kt.enqueue({kind:`success`,message:`Plan archived.`})}catch{kt.enqueue({kind:`error`,code:`PLAN_ARCHIVE_FAILED`,message:`The plan could not be archived. Check that it is writable and try again.`})}finally{B(Ge,G(Ge).filter(t=>t!==e),!0)}}}async function zn(e,t){let n=new mm(I);await n.load(e,t),B(ue,n,!0)}async function Bn(){try{let e=await I.listSkillProfiles();B(de,e.profiles.filter(e=>!(`error`in e)));let t=e.profiles.find(e=>`error`in e);B(pe,t&&`error`in t?t.error.message:``,!0),G(de).some(e=>e.name===G(fe))||B(fe,``)}catch(e){B(de,[]),B(pe,e instanceof Error?e.message:`Unable to load saved skill profiles.`,!0)}}async function Vn(e){let t=G(me)||G(b)[0]?.id||``,n=G(le).find(e=>e.state===`ok`)?.name??``;if(!t||!n){B(v,`Choose a workspace and available Codex profile before managing skill profiles.`);return}await zn(t,n),B(k,`profile-manager`)}function Hn(e){queueMicrotask(()=>e.focus())}async function Un(e=!0){if(B(k,`list`),await Tr(),e){let e=document.getElementById(`manage-skill-profiles`),t=e?.closest(`.advanced-settings`);t&&(t.open=!0),e?.focus()}}function Wn(e){requestAnimationFrame(()=>{G(a)===e&&e!==`chat`&&window.scrollTo({top:0})})}function Gn(){Tr().then(()=>{G(a)===`chat`&&document.getElementById(`message`)?.focus({preventScroll:!0})})}function Kn(e){Tt.select(e.id),B(F,!1)}async function qn(e,t){let n=!G(ze)||We,r=n?G(Xe)?.workspaceId:G(Je),i=G(ze)??``;if(!r)return[];let a=e=>n?e:dy(i,e),o=new Set;try{for(let n=0;n<e.length;n+=64){if(t.aborted)return[];(await I.checkWorkspaceFileReferences(r,e.slice(n,n+64).map(a),t)).paths.forEach(e=>o.add(e))}return e.filter(e=>o.has(a(e)))}catch(e){return t.aborted||lr(e,`WORKSPACE_FILES_READ_FAILED`),[]}}function Jn(e){let t=!G(ze)||We,n=t?G(Xe)?.workspaceId:G(Je);n&&B(l,{workspaceId:n,path:t?e:dy(G(ze)??``,e)},!0)}function Yn(e){let t=G(st)?Gu(G(b),G(st)):null;t&&(B(h,t,!0),B(g,e,!0))}async function Xn(){B(h,null),await Tr(),G(g)?.focus({preventScroll:!0})}function Zn(){_||(_=!0,queueMicrotask(()=>{_=!1,G(st)&&Tt.refresh()}))}async function Qn(){let e=G(st);!e||!Gu(G(b),e)?.isGitRepository||(B(ft,G(ft)??po(),!0),await Tt.pull(G(ft)),G(ot).error||B(ft,null))}async function $n(e){if(G(lt))return;let n=G(st)?Gu(G(b),G(st)):void 0;if(!n||n.isGitRepository){B(dt,null),kt.enqueue({kind:`error`,code:`INVALID_CLONE_DESTINATION`,message:`Select a non-repository folder before cloning.`});return}let r=n.id;B(lt,!0),B(dt,null);try{await I.cloneGitRepository(r,e);let n=await dl(t.authorizedFetch),i=xd(G(b),n.workspaces,r,e,G(ct));B(me,Ku(G(me)||null,G(b),n.workspaces,Bu.sessionBase)??``,!0),B(b,n.workspaces,!0),Tt.select(i.selectedId),B(ct,i.expandedIds,!0),B(dt,`Repository cloned into the selected workspace.`),kt.enqueue({kind:`success`,message:`Repository cloned.`})}catch(e){lr(e,`GIT_CLONE_FAILED`)}finally{B(lt,!1)}}async function er(e){G(st)&&await Tt.checkout(e)}async function tr(){let e=G(st);if(!(!e||G(ut))){B(ut,!0),B(pt,G(pt)??po(),!0);try{await I.pushGit(e,G(pt)),B(F,!1),await Tt.refresh(),B(pt,null)}catch(e){lr(e,`GIT_PUSH_FAILED`)}finally{B(ut,!1)}}}async function nr(e,t){Bt(`explicit`),await Ct.respond(e,{decision:t})}async function rr(e){Bt(`explicit`);let t=e.kind===`quiz`?As(e.payload):js(e.payload);if(!t)return;let n=t.questions.map(t=>({id:t.id,answer:mt[`${e.requestId}:${t.id}`]??``})),r=t.questions.map((e,t)=>({id:e.id,header:e.header,question:e.question,answer:n[t]?.answer??``}));B(ht,{...G(ht),[e.requestId]:r});let a=e.kind===`quiz`?Ms(n):Td(n);try{let t=`quiz-answer:${e.requestId}`,n=G(i)?.prompts.find(e=>e.operationId===t);if(!n||n.state===`failed`){let e=Ed(r);G(i)?.activeTurnId?await Ct.queue(e,t):await Ct.send(e,t)}let o=Ct.view.prompts.find(e=>e.operationId===t);if(e.kind===`quiz`&&(!o||o.state===`failed`))return;await Ct.respond(e.requestId,a)}catch{B(v,`Could not send quiz answers. Please try again.`)}}async function ir(e){let t=wd(e.payload);if(!t){B(v,`Codex sent an invalid permission request.`);return}Bt(`explicit`),await Ct.respond(e.requestId,t)}function ar(e){e.kind===`quiz`||e.kind===`userInput`?rr(e):e.kind===`permissionsApproval`?ir(e):Ct.retryInteraction(e.requestId)}function or(e,t,n){mt[`${e}:${t}`]=n}function sr(e){B(Ne,e,!0),Pe+=1;let t=G(A);t&&Ot.replaceDraftText(t,e,Pe)}function cr(e){return e instanceof Error?e.message:`Unknown relay error.`}function lr(e,t){let n=xu(e,t);return kt.enqueue({kind:`error`,...n}),n.message}function ur(e){kt.enqueue(e?{kind:`success`,message:`Code copied.`}:{kind:`error`,message:`Code could not be copied. Select it and copy it manually.`})}function dr(e){return(e instanceof DOMException||e instanceof Error)&&e.name===`AbortError`}function fr(e){let t=G(A);if(!t||e.type===`agent.activity.updated`)return;if(e.type===`session.status.updated`){let n=e.payload;yu(n)&&B(ve,G(ve).map(e=>e.id===t?{...e,sessionStatus:n}:e),!0);return}if(e.type===`session.updated`&&typeof e.payload==`object`&&e.payload!==null){let n=e.payload;n.id===t&&B(ve,G(ve).map(e=>e.id===t?{...e,...n}:e),!0);return}if(e.type!==`plan.updated`&&e.type!==`plan.closed`)return;if(Dt.applyEvent(t,e),e.type===`plan.closed`){B(xe,new Map(G(xe)).set(t,void 0)),B(ve,G(ve).map(e=>e.id===t?{...e,plan:void 0}:e),!0);return}let n=Ad(e.payload)?e.payload.plan:jd(e.payload)?e.payload:null;n&&B(xe,new Map(G(xe)).set(t,n)),n&&B(ve,G(ve).map(e=>e.id===t?{...e,plan:n}:e),!0)}var pr=Kr();di(`1d2e8zz`,e=>{Rn(()=>{un.title=r&&G(Qe)?`Chat · ${G(Qe)} · Gestalt Mobile`:`Gestalt Mobile`})}),Lr(`focus`,ln,Tn),Lr(`visibilitychange`,un,Tn);var mr=H(pr),hr=e=>{lo(e,{})},gr=e=>{zu(e,{get variant(){return R}})},_r=e=>{var t=Jy();td(V(t),{get context(){return At}}),P(t),J(e,t)},vr=e=>{var d=ib(),p=H(d),m=V(p),g=e=>{{let n=L(()=>G(a)===`chat`?pp(G(ve).find(e=>e.id===G(A))?.workspacePath??``):null),r=L(()=>G(a)===`chat`?G(tt):null),i=L(()=>G(a)===`chat`&&G(A)?Ut:void 0),c=L(()=>G(a)===`chat`&&G(Xe)?()=>{G(Xe)?.resumeCommand&&fn(G(Xe).resumeCommand)}:void 0),l=L(()=>!!G(Xe)?.resumeCommand);Da(e,{get theme(){return G(y)},get sessionPath(){return G(n)},get sessionModel(){return G(r)},get weeklyQuotaRemaining(){return G(at)},get brandIconUrl(){return G(re)},get componentVersions(){return G(E)},get xerj(){return G(D)},onconfigurationchange:e=>B(ee,e,!0),get contextualActions(){return G(Ze)},get passkeyAuthEnabled(){return t.passkeyAuthEnabled},get onlock(){return t.onlock},ondevices:()=>B(o,!0),onnotifications:()=>B(s,!0),onscratchpad:Pt,onquit:Lt,onupgrade:zt,onthemechange:Ht,get ondetach(){return G(i)},get oncopytocli(){return G(c)},get copyToCliAvailable(){return G(l)}})}};X(m,e=>{!G(o)&&!G(s)&&!r&&e(g)});var _=U(m,2),te=e=>{var t=Xy(),n=V(t),i=U(V(n),2),a=V(i,!0);P(i),P(n);var o=U(n,2),s=e=>{var t=Yy(),n=V(t);P(t),W(()=>Y(n,`${G(Xe).provider===`kimi`?`Kimi · `:``}${G(Xe).model??``}`)),J(e,t)};X(o,e=>{G(Xe)?.model&&e(s)}),P(t),W(()=>{Q(i,`title`,G(Qe)||r),Y(a,G(Qe)||r)}),J(e,t)};X(_,e=>{r&&e(te)});var ne=U(_,2);Lu(ne,{get queue(){return kt}});var ie=U(ne,2),ae=e=>{rh(e,{get client(){return Et},onclose:()=>{B(o,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())},get onlock(){return t.onlock},oncreatepasskey:e=>n()(e)})},le=e=>{Du(e,{get queue(){return kt},onclose:It})},xe=e=>{var t=rb(),n=H(t),o=e=>{var t=eb(),n=U(V(t),2);{let e=L(()=>G(A)?G(be).attention.get(G(A))??null:null),t=L(()=>`chat-attention-${G(A)??`none`}`),r=L(()=>G(A)?G(be).pending.has(G(A)):!1);No(n,{get attention(){return G(e)},get controlId(){return G(t)},get pending(){return G(r)},onresolve:(e,t)=>G(A)&&en(G(A),e,t)})}var a=U(n,2);{let e=L(()=>G(A)?G(be).snapshots.get(G(A))??null:null),t=L(()=>G(A)?G(be).attention.get(G(A))??null:null),n=L(()=>`chat-autopilot-safety-${G(A)??`none`}`),r=L(()=>G(A)?G(be).pending.has(G(A)):!1);Fo(a,{get autopilot(){return G(e)},get attention(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},onrecover:()=>G(A)&&void $t(G(A)),ondisable:()=>G(A)&&Qt(G(A),!1)})}var o=U(a,2),s=V(o,!0);P(o);var c=U(o,2),u=e=>{var t=Qy(),n=H(t);{let e=L(()=>G(i)?[...G(i).messages]:[]),t=L(()=>G(i)?[...G(i).activities]:[]),r=L(()=>G(i)?.activeTurnId??null),a=L(()=>G(i)?.autopilotAuditTruncated??!1),o=L(()=>G(i)?[...G(i).interactions]:[]);sl(n,{get messages(){return G(e)},get activities(){return G(t)},get activeTurnId(){return G(r)},get autopilotAuditTruncated(){return G(a)},get interactions(){return G(o)},get answers(){return mt},get submittedAnswers(){return G(ht)},onanswer:or,onquiz:e=>void rr(e),onpermission:e=>void ir(e),ondecision:(e,t)=>void nr(e,t),onretry:ar,onopenorg:Pn,onopenfile:(e,t)=>{G(Xe)?.workspaceId&&B(l,{workspaceId:G(Xe).workspaceId,sessionId:G(Xe).id,path:e,line:t},!0)},oncopyresult:ur})}var r=U(n,2);{let e=L(()=>G(i)?.newEmpty??!1),t=L(()=>G(i)?.status??G(v)),n=L(()=>G(i)?.activeTurnId??null),a=L(()=>G(i)?.starting??!1),o=L(()=>!!(G(ve).find(e=>e.id===G(A))&&![`ready`,`turnActive`].includes(G(ve).find(e=>e.id===G(A))?.state??``))),s=L(()=>G(j)!==null),c=L(()=>G(T)[G(ve).find(e=>e.id===G(A))?.provider??`codex`]),l=L(()=>G(ve).find(e=>e.id===G(A))?.provider??`codex`);is(r,{get newEmpty(){return G(e)},get status(){return G(t)},get message(){return G(Ne)},get activeTurnId(){return G(n)},get starting(){return G(a)},get detached(){return G(o)},get retryMessage(){return G(Me)},get retryable(){return G(s)},get models(){return G(c)},get provider(){return G(l)},onchange:sr,onscrollbottom:()=>Bt(`explicit`),onmodelselect:e=>void pn(e),onsend:()=>void hn(),onqueue:()=>void gn(),oninterruptsend:()=>void _n(),onretry:()=>void bn(),oninterrupt:()=>void xn()})}var a=U(r,2),o=e=>{var t=Zy(),n=V(t),r=e=>{{let t=L(()=>G(be).snapshots.get(G(A))??null),n=L(()=>`chat-autopilot-${G(A)}`),r=L(()=>G(be).pending.has(G(A)));ko(e,{compact:!0,get autopilot(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},ontoggle:e=>G(A)&&Qt(G(A),e)})}};X(n,e=>{G(Xe)?.provider!==`kimi`&&e(r)});var i=U(n,2);{let e=L(()=>G(ye).get(G(A))??null),t=L(()=>G(ve).find(e=>e.id===G(A))?.model??x),n=L(()=>G(ve).find(e=>e.id===G(A))?.plan);so(i,{compact:!0,get activity(){return G(e)},get rootModel(){return G(t)},get plan(){return G(n)},onopen:()=>G(A)&&void St.resync(G(A))})}P(t),J(e,t)},s=L(()=>up(G(Xe)));X(a,e=>{G(s)&&e(o)}),Ui(U(a,2),e=>B(gt,e),()=>G(gt)),J(e,t)},d=e=>{var t=$y(),n=V(t,!0);P(t),W(()=>Y(n,r?G(v):G(se)?`Start a session from the Sessions tab to chat with Codex or Kimi.`:`Start a session from the Sessions tab to chat with Codex.`)),J(e,t)};X(c,e=>{G(A)?e(u):e(d,-1)}),P(t),W(()=>Y(s,G(bt))),J(e,t)},s=e=>{ep(e,{get catalog(){return G(Le)},get state(){return G(it)},onopen:Nn,onarchive:Ln,get archivingPlans(){return G(Ge)},onclose:Fn,onreference:Jn,checkreferences:qn})},c=e=>{{let t=L(()=>G(st)?Gu(G(b),G(st))??null:null);yd(e,{get workspaceTree(){return G(b)},get selectedWorkspace(){return G(t)},get expandedIds(){return G(ct)},get summary(){return G(ot).summary},get refreshing(){return G(ot).refreshing},get checkingOut(){return G(ot).checkingOut},get cloning(){return G(lt)},get pushing(){return G(ut)},get error(){return G(ot).error},get cloneStatus(){return G(dt)},get confirmingPush(){return G(F)},onpull:()=>void Qn(),oncheckout:e=>void er(e),onopenpushconfirmation:()=>B(F,!0),onpush:()=>void tr(),oncancelpush:()=>B(F,!1),onselect:Kn,onexpandedchange:e=>B(ct,e,!0),onbrowsefiles:Yn,onclone:e=>void $n(e)})}},d=e=>{var t=Kr(),n=H(t),r=e=>{var t=nb(),n=V(t),r=V(n);pi(r,()=>Hn);var i=U(r,2);P(n);var a=U(n,2),o=e=>{pm(e,{get skillsState(){return G(ue)},onrefresh:()=>G(ue)?.refresh()??Promise.resolve(),onprofileschange:()=>void Bn(),heading:`Skill profile editor`})},s=e=>{J(e,tb())};X(a,e=>{G(ue)?e(o):e(s,-1)}),P(t),K(`click`,i,()=>void Un()),J(e,t)},i=e=>{{let t=L(()=>G(oe)===G(ce));Wp(e,{get sessions(){return G(ve)},get recentSessions(){return G(Te)},get selectedSessionId(){return G(A)},get activitySnapshots(){return G(ye)},get autopilotSnapshots(){return G(be).snapshots},get autopilotPending(){return G(be).pending},get autopilotAttention(){return G(be).attention},get workspaceTree(){return G(b)},get workspaceId(){return G(me)},get expandedIds(){return G(_e)},get sandbox(){return G(Ee)},get approvalPolicy(){return G(De)},get models(){return G(T)[G(ce)]},get selectedModel(){return G(O)[G(ce)]},get reasoningEffort(){return G(S)},get executorModels(){return G(T).codex},get executorModel(){return G(C)},get executorReasoningEffort(){return G(w)},onreasoningchange:e=>B(S,e,!0),onexecutormodelchange:e=>B(C,e,!0),onexecutorreasoningchange:e=>B(w,e,!0),get provider(){return G(ce)},get kimiAvailable(){return G(se)},get modelsLoading(){return G(t)},get skillProfiles(){return G(de)},get selectedSkillProfile(){return G(fe)},get skillProfileError(){return G(pe)},get startingSession(){return G(ke)},get openingSessionId(){return G(Ae)},get savingDefaults(){return G(he)},onsavedefaults:()=>void cn(),onworkspacechange:e=>B(me,e,!0),onexpandedchange:e=>B(_e,e,!0),onsandboxchange:e=>B(Ee,e,!0),onapprovalpolicychange:e=>B(De,e,!0),onmodelchange:e=>B(O,{...G(O),[G(ce)]:e}),onproviderchange:e=>void Wt(e),onskillprofilechange:e=>B(fe,e,!0),onmanageprofiles:e=>void Vn(e),onopen:rn,onselectopen:rn,onclose:e=>void sn(e),onautopilottoggle:Qt,onactivityopen:e=>void St.resync(e),onautopilotresolve:en,onopenrecent:e=>void an(e),onforget:e=>void dn(e),oncopyresume:e=>void fn(e),onstart:()=>void Gt(),ondebugtrace:(e,t)=>void Yt(e,t),get advancedExpanded(){return G(ge)},set advancedExpanded(e){B(ge,e,!0)}})}};X(n,e=>{G(k)===`profile-manager`?e(r):e(i,-1)}),J(e,t)};X(n,e=>{G(a)===`chat`?e(o):G(a)===`plan`?e(s,1):G(a)===`git`?e(c,2):e(d,-1)});var p=U(n,2),m=e=>{Pa(e,{get confirmation(){return G(u)},onconfirm:Jt,onclose:qt})};X(p,e=>{G(u)&&e(m)});var g=U(p,2),_=e=>{let t=L(()=>G(f));{let n=L(()=>({workspaceId:G(t).workspaceId??G(t).id,path:G(t).selfDebug.tracePath}));xy(e,{get target(){return G(n)},readFile:async(e,n,r)=>{let i=JSON.stringify(await I.readDebugTrace(G(t).id,r),null,2);return{kind:`file`,path:n,content:i,size:new TextEncoder().encode(i).byteLength}},get listDirectory(){return I.listWorkspaceDirectory},onclose:Xt,onerror:e=>lr(e,`DEBUG_TRACE_FAILED`)})}};X(g,e=>{G(f)?.selfDebug&&e(_)});var y=U(g,2),E=e=>{qy(e,{get root(){return G(h)},onview:e=>{G(h)&&B(l,{workspaceId:G(h).id,path:e},!0)},get listDirectory(){return I.listWorkspaceDirectory},get copyEntry(){return I.copyWorkspaceEntry},get moveEntry(){return I.moveWorkspaceEntry},get deleteEntry(){return I.deleteWorkspaceEntry},get uploadFile(){return I.uploadWorkspaceFile},onclose:()=>void Xn(),onerror:e=>lr(e,`WORKSPACE_FILES_READ_FAILED`),onsuccess:e=>kt.enqueue({kind:`success`,message:e}),onmutation:Zn})};X(y,e=>{G(h)&&e(E)});var D=U(y,2),ee=e=>{xy(e,{get target(){return G(l)},readFile:(e,t,n)=>G(l)?.sessionId?I.getSessionFilePreview(G(l).sessionId,t,n):I.getWorkspaceFilePreview(e,t,n),get listDirectory(){return I.listWorkspaceDirectory},onclose:()=>{B(l,null)},onerror:e=>lr(e,`WORKSPACE_FILES_READ_FAILED`)})};X(D,e=>{G(l)&&e(ee)});var te=U(D,2),ne=e=>{Xp(e,{get activeTab(){return G(a)},get chatEnabled(){return G(we)},get focusTab(){return G(qe)},onselect:Cn})};X(te,e=>{r||e(ne)}),J(e,t)};X(ie,e=>{G(o)&&t.passkeyAuthEnabled?e(ae):G(s)?e(le,1):e(xe,-1)}),P(p);var Se=U(p,2),Ce=e=>{hh(e,{onclose:Ft})};X(Se,e=>{G(c)&&e(Ce)}),K(`pointerdown`,p,On),K(`pointerup`,p,kn),Lr(`pointercancel`,p,An),J(e,d)};X(mr,e=>{jt===`true`?e(hr):R===`error`||R===`stacked`?e(gr,1):At===`sessions`||At===`git`?e(_r,2):e(vr,-1)}),J(e,pr),et()}Rr([`pointerdown`,`pointerup`,`click`]);function ob(){throw Error(`AUTH_RESPONSE_INVALID`)}async function sb(e){if(!e.ok){let t;try{let n=await e.json();typeof n==`object`&&n&&`code`in n&&typeof n.code==`string`&&(t=n.code)}catch{}throw Error(t??`AUTH_REQUEST_FAILED_${e.status}`)}return e.json()}function cb(e){return!!e&&typeof e==`object`&&[`bootstrap`,`locked`,`authenticated`].includes(e.status)&&typeof e.publicOrigin==`string`&&(e.passkeyAuthEnabled===void 0||typeof e.passkeyAuthEnabled==`boolean`)}function lb(e){return!!e&&typeof e==`object`&&!!e.options&&typeof e.options.challenge==`string`}function ub(e){return!!e&&typeof e==`object`&&e.status===`authenticated`}function db(e=fetch){async function t(){let t=await sb(await e(`/api/auth/status`,{credentials:`same-origin`}));return cb(t)||ob(),t}async function n(t,n={}){let r=await sb(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return lb(r)||ob(),r}async function r(t,n){let r=await sb(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return ub(r)||ob(),r}return{status:t,registrationOptions:e=>n(`/api/auth/register/options`,e?{enrollmentTicket:e}:{}),verifyRegistration:(e,t)=>r(`/api/auth/register/verify`,{response:e,nickname:t}),loginOptions:()=>n(`/api/auth/login/options`),verifyLogin:e=>r(`/api/auth/login/verify`,{response:e}),logout:async()=>{let t=await e(`/api/auth/logout`,{method:`POST`,credentials:`same-origin`});if(!t.ok)throw Error(`AUTH_REQUEST_FAILED_${t.status}`)}}}function fb(e,t=fetch){return async(n,r)=>{let i=await t(n,{...r,credentials:`same-origin`});return i.status===401&&(await i.clone().json().catch(()=>null))?.code===`AUTH_REQUIRED`&&e(),i}}function pb(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function mb(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function hb(){return gb.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var gb={stubThis:e=>e};function _b(e){let{id:t}=e;return{...e,id:mb(t),transports:e.transports}}function vb(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var yb=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function bb({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new yb({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new yb({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new yb({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new yb({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new yb({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new yb({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new yb({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new yb({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!vb(t))return new yb({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new yb({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new yb({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new yb({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var xb=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},Sb=[`cross-platform`,`platform`];function Cb(e){if(e&&!(Sb.indexOf(e)<0))return e}async function wb(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!hb())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:mb(t.challenge),user:{...t.user,id:mb(t.user.id)},excludeCredentials:t.excludeCredentials?.map(_b)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=xb.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw bb({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){Tb(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=pb(e))}catch(e){Tb(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=pb(c.getAuthenticatorData())}catch(e){Tb(`getAuthenticatorData()`,e)}return{id:o,rawId:pb(s),response:{attestationObject:pb(c.attestationObject),clientDataJSON:pb(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Cb(a.authenticatorAttachment)}}function Tb(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function Eb(){if(!hb())return Db.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Db.stubThis(new Promise(e=>e(!1))):Db.stubThis(e.isConditionalMediationAvailable())}var Db={stubThis:e=>e};function Ob({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new yb({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new yb({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!vb(t))return new yb({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new yb({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new yb({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function kb(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!hb())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(_b));let a={...t,challenge:mb(t.challenge),allowCredentials:i},o={};if(n){if(!await Eb())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=xb.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Ob({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=pb(u.userHandle)),{id:c,rawId:pb(l),response:{authenticatorData:pb(u.authenticatorData),clientDataJSON:pb(u.clientDataJSON),signature:pb(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Cb(s.authenticatorAttachment)}}function Ab(e){return typeof e==`object`&&e?e:{}}function jb(e){let t=Ab(e),n=typeof t.code==`string`?t.code:``;switch(n){case`ERROR_CEREMONY_ABORTED`:return`The passkey request was cancelled. You can safely try again.`;case`ERROR_INVALID_DOMAIN`:case`ERROR_INVALID_RP_ID`:return`The passkey provider rejected this site’s domain identity. Open the canonical HTTPS address and try again.`;case`ERROR_INVALID_USER_ID_LENGTH`:case`ERROR_MALFORMED_PUBKEYCREDPARAMS`:return`The relay supplied passkey options this browser could not use (${n}).`;case`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`:return`This passkey provider does not support the discoverable credential required for sign-in. Try another passkey provider or browser.`;case`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`:case`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`:return`This passkey provider could not perform the required screen-lock verification. Check the device screen lock or try another provider.`;case`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`:return`This passkey is already registered on this device. Try signing in instead.`;case`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`:return`This passkey provider supports none of the relay’s allowed cryptographic algorithms. Try another provider or browser.`;case`ERROR_AUTHENTICATOR_GENERAL_ERROR`:return`The phone’s passkey provider accepted device verification but could not create the credential (ERROR_AUTHENTICATOR_GENERAL_ERROR). Try another browser or passkey provider on this phone.`;case`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`:return jb(t.cause)}switch(typeof t.message==`string`?t.message:``){case`INVALID_REGISTRATION_REQUEST`:return`The relay did not understand the passkey response from this browser. Refresh the page and try again.`;case`REGISTRATION_COOKIE_MISSING`:return`The registration session cookie was not returned by this browser. Allow site cookies, refresh, and try again.`;case`REGISTRATION_NOT_AVAILABLE`:return`This registration attempt expired or is no longer available. Refresh the page and start again.`;case`REGISTRATION_VERIFICATION_FAILED`:return`Your device created the passkey, but the relay could not verify it. Try again and check the relay diagnostics if it persists.`;case`ORIGIN_NOT_ALLOWED`:return`This page is not using the relay’s configured public address. Open the canonical HTTPS address and try again.`;case`ENROLLMENT_NOT_AUTHORIZED`:return`This relay is no longer accepting first-device registration.`;case`AUTHENTICATION_FAILED`:return`We could not complete sign-in. Please try again.`}let r=typeof t.name==`string`?t.name:``;switch(r){case`NotAllowedError`:return`The passkey request was cancelled or timed out. Try again when ready.`;case`InvalidStateError`:return`This passkey is already registered on this device. Try signing in instead.`;case`AbortError`:return`The passkey request was cancelled. You can safely try again.`;case`SecurityError`:return`Passkeys require this device to use the configured secure site.`;case`ConstraintError`:case`DataError`:case`EncodingError`:return`This browser could not use the passkey options supplied by the relay. Refresh the page and try again.`;case`NetworkError`:return`The connection was interrupted while completing the passkey request. Check the connection and try again.`;case`OperationError`:case`UnknownError`:return`This browser or passkey provider could not finish the passkey request after device verification. Try again or use another browser on this device.`;case`TypeError`:return`This browser rejected the passkey request data. Refresh the page and try again.`;default:return/^[A-Za-z]+Error$/.test(r)?`The passkey request failed inside this browser (${r}). Try another browser or passkey provider on this device.`:`We could not complete authentication. Please try again.`}}function Mb(){return typeof window<`u`&&window.isSecureContext&&window.PublicKeyCredential!==void 0}function Nb(e,t){async function n(n){t({kind:`checking`});try{let{status:r,publicOrigin:i,passkeyAuthEnabled:a=!0}=await e.status();if(!a){let e={kind:`authenticated`,passkeyAuthEnabled:!1};return t(e),e}if(!Mb()){let e={kind:`unsupported`,message:`Passkeys require a secure browser on this device.`};return t(e),e}let o=r===`authenticated`?{kind:`authenticated`,passkeyAuthEnabled:!0}:r===`bootstrap`?{kind:`bootstrap`,publicOrigin:i}:n?{kind:`enrollment`,publicOrigin:i}:{kind:`locked`};return t(o),o}catch{let e={kind:`error`,message:`We could not check this device. Please try again.`};return t(e),e}}function r(){t({kind:`authenticated`,passkeyAuthEnabled:!0})}function i(e){t({kind:`locked`,...e?{message:e}:{}})}return{check:n,retry:n,authenticated:r,locked:i}}var Pb=q(`<p class="warning svelte-1c5qcm6">This one-time link authorizes one new passkey. Choose a nickname and complete the passkey
|
|
110
|
+
prompt before it expires.</p>`),Fb=q(`<p class="warning svelte-1c5qcm6"><strong class="svelte-1c5qcm6">Trust-on-first-use:</strong> anyone who can reach an empty relay instance could claim
|
|
111
|
+
first-device access. Enroll this device before exposing the instance, and confirm you are at the
|
|
112
|
+
canonical address before continuing.</p>`),Ib=q(`<p class="error svelte-1c5qcm6">Passkeys require a secure browser on this device.</p>`),Lb=q(`<p class="feedback svelte-1c5qcm6"> </p>`),Rb=q(`<img alt="QR code for the first-device setup link" class="svelte-1c5qcm6"/>`),zb=q(`<div class="handoff svelte-1c5qcm6"><!> <div class="svelte-1c5qcm6"><h2 class="svelte-1c5qcm6">Continue on your phone</h2> <p class="svelte-1c5qcm6">Scanning opens this same setup page. You will still choose a nickname and explicitly
|
|
113
|
+
authorize that device.</p> <a class="svelte-1c5qcm6"> </a> <button type="button" class="copy svelte-1c5qcm6">Copy setup link</button></div></div>`),Bb=q(`<main class="enrollment svelte-1c5qcm6" aria-live="polite"><section class="card svelte-1c5qcm6" aria-labelledby="enrollment-title"><p class="brand svelte-1c5qcm6">Gestalt / Dyne</p> <h1 id="enrollment-title" class="svelte-1c5qcm6"> </h1> <!> <label for="device-nickname" class="svelte-1c5qcm6">Device nickname</label> <input id="device-nickname" name="device-nickname" autocomplete="nickname" required="" enterkeyhint="done" class="svelte-1c5qcm6"/> <button class="authorize svelte-1c5qcm6" type="button"> </button> <!> <!> <!></section></main>`);function Vb(e,t){$e(t,!0);let n=z(``),r=z(null),i=z(!1),a=z(null),o=!0,s=!0,c=L(()=>Gm(t.canonicalOrigin)),l=null;function u(){return window.isSecureContext&&window.PublicKeyCredential!==void 0}function d(){l&&clearInterval(l),l=null}function f(e){if(o=!1,d(),e===`authenticated`){t.onAuthenticated();return}t.onLocked(`Another device has already enrolled this relay. Sign in with that device’s passkey.`)}async function p(){if(document.visibilityState===`visible`)try{let e=await t.client.status();if(e.status!==`bootstrap`){if(!s)return;f(e.status)}}catch{}}Gi(()=>{t.enrollmentTicket||Km(t.canonicalOrigin).then(e=>{s&&B(a,e,!0)}).catch(()=>{s&&B(r,`Setup QR unavailable. Use the setup link below.`)});let e=window.matchMedia?.(`(min-width: 768px)`).matches??!1;!t.enrollmentTicket&&e&&(l=setInterval(()=>void p(),15e3))}),Ki(()=>{s=!1,o=!1,d()});async function m(){if(!navigator.clipboard?.writeText){B(r,`Copy is unavailable here. Select and copy the visible setup link.`);return}try{await navigator.clipboard.writeText(G(c)),B(r,`Setup link copied.`)}catch{B(r,`Copy is unavailable here. Select and copy the visible setup link.`)}}async function h(){let e=G(n).trim();if(!e){B(r,`Enter a device nickname before authorizing it.`);return}if(!u()){B(r,`Passkeys require a secure browser on this device.`);return}if(!(G(i)||!o)){B(i,!0),B(r,null);try{let{options:n}=await t.client.registrationOptions(t.enrollmentTicket);if(!s||!o)return;let r=await wb({optionsJSON:n});if(!s||!o||(await t.client.verifyRegistration(r,e),!s||!o))return;d(),t.onAuthenticated()}catch(e){if(e instanceof Error&&[`AUTH_REQUEST_FAILED_409`,`BOOTSTRAP_ALREADY_CLAIMED`].includes(e.message)){d(),t.onLocked(`Another device completed setup first. Sign in with that device’s passkey.`);return}B(r,jb(e),!0)}finally{B(i,!1)}}}var g=Bb(),_=V(g),v=U(V(_),2),y=V(v,!0);P(v);var b=U(v,2),x=e=>{J(e,Pb())},S=e=>{J(e,Fb())};X(b,e=>{t.enrollmentTicket?e(x):e(S,-1)});var C=U(b,4);Ni(C);var w=U(C,2),T=V(w,!0);P(w);var E=U(w,2),D=e=>{J(e,Ib())},ee=L(()=>!u());X(E,e=>{G(ee)&&e(D)});var te=U(E,2),ne=e=>{var t=Lb(),n=V(t,!0);P(t),W(()=>Y(n,G(r))),J(e,t)};X(te,e=>{G(r)&&e(ne)});var re=U(te,2),ie=e=>{var t=zb(),n=V(t),r=e=>{var t=Rb();W(()=>Q(t,`src`,G(a))),J(e,t)};X(n,e=>{G(a)&&e(r)});var i=U(n,2),o=U(V(i),4),s=V(o,!0);P(o);var l=U(o,2);P(i),P(t),W(()=>{Q(o,`href`,G(c)),Y(s,G(c))}),K(`click`,l,()=>void m()),J(e,t)};X(re,e=>{t.enrollmentTicket||e(ie)}),P(_),P(g),W(e=>{Y(y,t.enrollmentTicket?`Authorize this device`:`Authorize the first device`),w.disabled=e,Y(T,G(i)?`Authorizing device…`:`Authorize this device`)},[()=>G(i)||!u()]),zi(C,()=>G(n),e=>B(n,e)),K(`click`,w,()=>void h()),J(e,g),et()}Rr([`click`]);var Hb=q(`<p class="error svelte-1byekj9">Passkeys require this relay to be opened over a secure connection.</p>`),Ub=q(`<p class="error svelte-1byekj9">This browser does not support passkeys. Use an authorized browser or device.</p>`),Wb=q(`<p class="svelte-1byekj9"> </p> <button class="sign-in svelte-1byekj9" type="button"> </button>`,1),Gb=q(`<main class="login svelte-1byekj9" aria-live="polite"><section class="card svelte-1byekj9" aria-labelledby="login-title"><p class="brand svelte-1byekj9">Gestalt / Dyne</p> <h1 id="login-title" class="svelte-1byekj9">Unlock relay</h1> <!></section></main>`);function Kb(e,t){$e(t,!0);let n=z(``),r=z(!1),i=z(void 0);function a(){return window.isSecureContext&&window.PublicKeyCredential!==void 0}function o(e){return e instanceof Error&&[`NotAllowedError`,`AbortError`,`SecurityError`].includes(e.name)?jb(e):`We could not complete sign-in. Please try again.`}Gi(()=>{B(n,t.message??`Use a passkey from an authorized device to unlock this relay.`,!0),G(i)?.focus()});async function s(){if(!(G(r)||!a())){B(r,!0),B(n,``);try{let{options:e}=await t.client.loginOptions(),n=await kb({optionsJSON:e});await t.client.verifyLogin(n),t.onAuthenticated()}catch(e){B(n,o(e),!0)}finally{B(r,!1)}}}var c=Gb(),l=V(c),u=U(V(l),4),d=e=>{J(e,Hb())},f=e=>{J(e,Ub())},p=e=>{var t=Wb(),a=H(t),o=V(a,!0);P(a);var c=U(a,2),l=V(c,!0);P(c),Ui(c,e=>B(i,e),()=>G(i)),W(()=>{Y(o,G(n)),c.disabled=G(r),Y(l,G(r)?`Waiting for passkey…`:`Sign in with a passkey`)}),K(`click`,c,()=>void s()),J(e,t)};X(u,e=>{window.isSecureContext?window.PublicKeyCredential===void 0?e(f,1):e(p,-1):e(d)}),P(l),P(c),J(e,c),et()}Rr([`click`]);var qb=q(`<p>Checking this device…</p>`),Jb=q(`<h1 class="svelte-y74n0s">Passkey support is required</h1> <p> </p>`,1),Yb=q(`<h1 class="svelte-y74n0s">Unable to check this device</h1> <p> </p> <button type="button" class="svelte-y74n0s">Try again</button>`,1),Xb=q(`<main class="auth-gate svelte-y74n0s" aria-live="polite"><!></main>`);function Zb(e,t){$e(t,!0);let n=$(t,`initialTheme`,3,`dyne-org`),r=z(void 0),i=L(()=>G(r)??t.enrollmentTicket),a=z(on({kind:`checking`})),o=!1,s=db(),c=Nb(s,e=>B(a,e,!0)),l=fb(()=>c.locked(`Your session ended. Sign in with your passkey to continue.`));Gi(()=>{c.check(G(i))});function u(e){B(r,e,!0),B(a,{kind:`enrollment`,publicOrigin:G(a).kind===`authenticated`?``:`http://localhost`},!0)}async function d(){if(!(o||G(a).kind!==`authenticated`)){o=!0,c.locked(`Relay locked. Sign in with your passkey to continue.`);try{await s.logout()}catch{c.locked(`Relay locked locally. Recheck your connection before signing in again.`)}finally{o=!1}}}var f=Kr(),p=H(f),m=e=>{ab(e,{get authorizedFetch(){return l},get theme(){return n()},get passkeyAuthEnabled(){return G(a).passkeyAuthEnabled},onlock:()=>void d(),oncreatepasskey:u})},h=e=>{Vb(e,{get client(){return s},get canonicalOrigin(){return G(a).publicOrigin},get enrollmentTicket(){return G(i)},onAuthenticated:()=>c.authenticated(),onLocked:e=>c.locked(e)})},g=e=>{Kb(e,{get client(){return s},get message(){return G(a).message},onAuthenticated:()=>c.authenticated()})},_=e=>{var t=Xb(),n=V(t),r=e=>{J(e,qb())},i=e=>{var t=Jb(),n=U(H(t),2),r=V(n,!0);P(n),W(()=>Y(r,G(a).message)),J(e,t)},o=e=>{var t=Yb(),n=U(H(t),2),r=V(n,!0);P(n);var i=U(n,2);W(()=>Y(r,G(a).message)),K(`click`,i,()=>void c.retry()),J(e,t)};X(n,e=>{G(a).kind===`checking`?e(r):G(a).kind===`unsupported`?e(i,1):G(a).kind===`error`&&e(o,2)}),P(t),J(e,t)};X(p,e=>{G(a).kind===`authenticated`?e(m):G(a).kind===`bootstrap`||G(a).kind===`enrollment`?e(h,1):G(a).kind===`locked`?e(g,2):e(_,-1)}),J(e,f),et()}Rr([`click`]);function Qb(e,t){let n=e.hash;if(!n.startsWith(`#enroll=`))return;let r=/^#enroll=([^&]+)$/.exec(n);if(t.replaceState(t.state,``,`${e.pathname}${e.search}`),!(!r||!r[1]))try{return decodeURIComponent(r[1])||void 0}catch{return}}function $b(e,t,n,r=qr,i={}){return r(Zb,{target:e,props:{enrollmentTicket:Qb(t,n),initialTheme:aa(i)}})}function ex(){return{readyState:document.readyState,addLoadListener:e=>window.addEventListener(`load`,e,{once:!0}),serviceWorker:navigator.serviceWorker}}function tx(e=ex()){if(!e.serviceWorker)return;let t=()=>{e.serviceWorker?.register(`/service-worker.js`,{scope:`/`}).catch(()=>void 0)};if(e.readyState===`complete`){t();return}e.addLoadListener(t)}var nx=document.getElementById(`app`);if(!nx)throw Error(`Missing application mount target`);$b(nx,window.location,window.history),tx();
|