gestalt-mobile 0.44.2 → 0.44.3
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/dist/client/assets/index-DEVCzFB9.css +1 -0
- package/dist/client/assets/index-DYZT_mLU.js +108 -0
- package/dist/client/index.html +2 -2
- package/dist/server/server/composition.contracts.js +108 -0
- package/dist/server/server/composition.js +23 -6
- package/dist/server/server/features/sessions/application/resume-command.js +3 -1
- package/dist/server/server/platform/codex/session-runtime.js +10 -5
- package/dist/server/server/platform/persistence/sqlite-event-journal.js +16 -0
- package/dist/server/shared/contracts/attention-report.js +12 -0
- package/dist/server/shared/contracts/plan-signal.js +2 -1
- package/package.json +1 -1
- package/dist/client/assets/index-6WgZCe9g.js +0 -107
- package/dist/client/assets/index-BKls66uM.css +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
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,O=16384,te=32768,ne=1<<25,re=65536,ie=1<<18,ae=1<<19,oe=1<<20,se=1<<25,ce=65536,le=1<<21,k=1<<22,A=1<<23,ue=Symbol(`$state`),de=Symbol(`legacy props`),fe=Symbol(``),pe=Symbol(`attributes`),me=Symbol(`class`),he=Symbol(`style`),ge=Symbol(`text`),_e=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 j(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function xe(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Se(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ce(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function we(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Te(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ee(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function De(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Oe(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ke(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ae(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var je={},Me=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(),je;return N=e}function He(){return Ve(_n(N))}function P(e){if(M){if(_n(N)!==null)throw Le(),je;N=e}}function F(e=1){if(M){for(var t=e,n=N;t--;)n=_n(n);N=n}}function Ue(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 We(e){if(!e||e.nodeType!==8)throw Le(),je;return e.data}function Ge(e){return e===this.v}function Ke(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function qe(e){return!Ke(e,this.v)}var Je=!1;function Ye(){Je=!0}var Xe=null;function Ze(e){Xe=e}function Qe(e,t=!1,n){Xe={p:Xe,i:!1,c:null,e:null,s:e,x:null,r:or,l:Je&&!t?{s:null,u:null,$:[]}:null}}function $e(e){var t=Xe,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,Xe=t.p,e??{}}function et(){return!Je||Xe!==null&&Xe.l===null}var tt=[];function nt(){var e=tt;tt=[],x(e)}function rt(e){if(tt.length===0&&!Pt){var t=tt;queueMicrotask(()=>{t===tt&&nt()})}tt.push(e)}function it(){for(;tt.length>0;)nt()}function at(e){var t=or;if(t===null)return rr.f|=A,e;if(!(t.f&32768)&&!(t.f&4))throw e;ot(e,t)}function ot(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 st=~(E|D|T);function I(e,t){e.f=e.f&st|t}function ct(e){e.f&512||e.deps===null?I(e,T):I(e,D)}function lt(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=ce,lt(t.deps))}function ut(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),lt(e.deps),I(e,T)}var dt=!1;function ft(e){var t=dt;try{return dt=!1,[e(),dt]}finally{dt=t}}function pt(e){let t=0,n=$t(0),r;return()=>{An()&&(G(n),Ln(()=>(t===0&&(r=Or(()=>e(()=>rn(n)))),t+=1,()=>{rt(()=>{--t,t===0&&(r?.(),r=void 0,rn(n))})})))}}var mt=re|ae;function ht(e,t,n,r){new gt(e,t,n,r)}var gt=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=pt(()=>(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()},mt),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)),rt(()=>{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){ut(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=Xe;sr(this.#i),ar(this.#i),Ze(this.#i.ctx);try{return Bt.ensure(),e()}catch(e){return at(e),null}finally{sr(t),ar(n),Ze(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,rt(()=>{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),F(),Ve(Ue()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){ze();return}r=!0,i&&Ae(),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){ot(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 ot(e,this.#i.parent),null}}))};rt(()=>{var t;try{t=this.transform_error(e)}catch(e){ot(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ot(e,this.#i&&this.#i.parent)):o(t)})}};function _t(e,t,n,r){let i=et()?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=vt(),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){ot(e,s)}yt()}}var d=bt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Ct(e))).then(u).catch(e=>ot(e,s)).finally(d)}l?l.then(()=>{c(),f(),yt()}):f()}function vt(){var e=or,t=rr,n=Xe,r=R;return function(i=!0){sr(e),ar(t),Ze(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function yt(e=!0){sr(null),ar(null),Ze(null),e&&R?.deactivate()}function bt(){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:Xe,deps:null,effects:null,equals:Ge,f:t,fn:e,reactions:null,rv:0,v:Me,wv:0,parent:or,ac:null}}var St=Symbol(`obsolete`);function Ct(e,t,n){let r=or;r===null&&j();var i=void 0,a=$t(Me),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(yt)}catch(e){n.reject(e),yt()}var c=R;if(o){if(t.f&32768)var l=bt();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|=A,tn(a,t)):(a.f&8388608&&(a.f^=A),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=qe,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!==Me&&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))){I(e,T);return}tr||(Mt===null?ct(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)I(r,E),t(r);for(r of n.m)I(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),I(e,E),this.schedule(e);for(let e of this.#d)I(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),I(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)ut(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==Me&&!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,rt(()=>{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&&rt(()=>{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(it(),R===null)return n;R.flush()}}finally{Pt=t}}function Ht(){try{Te()}catch(e){ot(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)&&(I(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),I(e,T);for(var n=e.first;n!==null;)Jt(n,t),n=n.next}}function Yt(e){I(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:Ge,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=qe),Je&&n&&Xe!==null&&Xe.l!==null&&(Xe.l.s??=[]).push(r),r}function B(e,t,n=!1){return rr!==null&&(!ir||rr.f&131072)&&et()&&rr.f&4325394&&(cr===null||!cr.has(e))&&ke(),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&&ct(t)}e.wv=vr(),an(e,E,n),et()&&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&&I(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=et(),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&&I(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||ue 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)&&De();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(Me,a));n.set(t,e),rn(i)}}else B(r,Me),rn(i);return!0},get(t,r,i){if(r===ue)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]:Me),a)),n.set(r,o)),o!==void 0){var l=G(o);return l===Me?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!==Me)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===ue)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Me||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]):Me,a)),n.set(t,r)),G(r)===Me)?!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(Me,a)),n.set(d+``,f)):B(f,Me)}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!==Me;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!==Me});for(var[r,a]of n)a.v!==Me&&!(r in e)&&t.push(r);return t},setPrototypeOf(){Oe()}})}function sn(e){try{if(typeof e==`object`&&e&&ue in e)return e[ue]}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[me]=void 0,e[pe]=null,e[he]=void 0,e.__e=void 0),y(n)&&(n[ge]=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[_e]?.()})},{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[_e];i?e[_e]=()=>{i(),r(!0)}:e[_e]=()=>r(!0),wn()}function Dn(e){or===null&&(rr===null&&we(e),Ce()),tr&&Se(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:Xe,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|=re))}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 I(t,T),t.teardown=e,t}function Mn(e){Dn(`$effect`);var t=or.f;if(!rr&&t&32&&Xe!==null&&!Xe.i){var n=Xe;(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(k|ae,e)}function Ln(e,t=0){return kn(8|t,e)}function W(e,t=[],n=[],r=[]){_t(r,t,n,t=>{kn(8,()=>{e(...t.map(G))})})}function Rn(e,t=[],n=[],r=[]){_t(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|=ne,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^=ne,e.f|=O;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||(I(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&&I(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?I(a,E):a.f&1024&&I(a,D),qt(a))}}function xr(e){var t=ur,n=dr,r=fr,i=rr,a=cr,o=Xe,s=ir,c=gr,l=e.f;ur=null,dr=0,fr=null,rr=l&96?null:e,cr=null,Ze(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|=te;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(et()&&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^=A),d}catch(e){return at(e)}finally{e.f^=le,ur=t,dr=n,fr=r,rr=i,cr=a,Ze(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!==Me&&ct(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)){I(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&te)===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===Me)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(ue in e)Ar(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&ue 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`?rt(()=>{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[ge]??=e.nodeValue)&&(e[ge]=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());ht(o,{pending:()=>{}},t=>{Qe({});var n=Xe;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(),je;$e()},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?re:0;function o(e,t){if(M){var n=We(r);if(e!==parseInt(n.substring(1))){var a=Ue();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=!et();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&&We(o)===`[!`!=(e===0)&&(o=Ue(),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&&xe(``,``,``),M&&e>0&&Ve(Ue()),!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&&rt(()=>{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(),je;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)))},re)}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|=ie})}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&&Ke(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[me];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[me]=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[he];if(M||i!==t){var a=xi(t,r);(!M||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[he]=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[_e]=n,rt(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[fe]=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[pe]??={[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?.[ue]===t}function Ui(e={},t,n,r){var i=Xe.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=!Je||(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=ue in e||de in e;d=m(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,h=!1;a?[p,h]=ft(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&Ee(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){Xe===null&&be(`onMount`),Je&&Xe.l!==null?qi(Xe).m.push(e):Mn(()=>{let t=Or(e);if(typeof t==`function`)return t})}function Ki(e){Xe===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">Copy session to CLI</button>`),ha=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),ga=q(`<div class="svelte-t9laac"><dt class="svelte-t9laac"> </dt> <dd class="svelte-t9laac"> </dd></div>`),_a=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>`),va=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="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>`,1);function ya(e,t){Qe(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,`onlock`,3,()=>{}),l=$(t,`ondevices`,3,()=>{}),u=$(t,`onnotifications`,3,()=>{}),d=$(t,`onscratchpad`,3,()=>{}),f=$(t,`onquit`,3,async()=>{}),p=$(t,`copyToCliAvailable`,3,!0),m=z(null),h=z(null),g=z(null),_=z(!1);function v(){G(h)?.showModal(),queueMicrotask(()=>G(g)?.focus())}async function y(){B(_,!0);try{await f()()}catch{B(_,!1)}}function b(){G(_)||G(h)?.close()}function x(){G(_)||queueMicrotask(()=>G(m)?.focus())}var S=va(),C=H(S),w=V(C),T=V(w),E=e=>{var t=sa();W(()=>Q(t,`src`,a())),J(e,t)},D=e=>{var t=ca();F(2),J(e,t)};X(T,e=>{a()?e(E):e(D,-1)}),F(4),P(w);var ee=U(w,2),O=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(ee,e=>{n()&&e(O)});var te=U(ee,2),ne=V(te),re=e=>{var t=da(),n=V(t);P(t),W(()=>Y(n,`${i()??``}% left`)),J(e,t)};X(ne,e=>{i()!==null&&e(re)});var ie=U(ne,2),ae=e=>{var n=fa();K(`click`,n,function(...e){t.ondetach?.apply(this,e)}),J(e,n)};X(ie,e=>{t.ondetach&&e(ae)}),Ui(U(ie,2),e=>B(m,e),()=>G(m)),P(te),P(C);var oe=U(C,2),se=U(V(oe),2),ce=U(V(se),2);Z(ce,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(ce);var le;Ei(ce),P(se);var k=U(se,2),A=U(k,2),ue=U(A,2),de=e=>{var n=ma();W(()=>n.disabled=!p()),K(`click`,n,function(...e){t.oncopytocli?.apply(this,e)}),J(e,n)};X(ue,e=>{t.oncopytocli&&e(de)});var fe=U(ue,2),pe=e=>{var t=ha(),n=H(t),r=U(n,2);K(`click`,n,e=>l()(e.currentTarget)),K(`click`,r,function(...e){c()?.apply(this,e)}),J(e,t)};X(fe,e=>{o()&&e(pe)});var me=U(fe,2),he=e=>{var t=_a(),n=U(V(t),2);Z(n,21,s,e=>e.id,(e,t)=>{var n=ga(),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(me,e=>{s().length&&e(he)});var ge=U(me,2),_e=V(ge);P(ge),P(oe);var ve=U(oe,2),ye=U(V(ve),4),be=V(ye);Ui(be,e=>B(g,e),()=>G(g));var j=U(be,2),xe=V(j,!0);P(j),P(ye),P(ve),Ui(ve,e=>B(h,e),()=>G(h)),W(()=>{le!==(le=t.theme)&&(ce.value=(ce.__value=t.theme)??``,Ti(ce,t.theme)),Q(ve,`aria-busy`,G(_)),be.disabled=G(_),j.disabled=G(_),Y(xe,G(_)?`Quitting…`:`Quit`)}),K(`change`,ce,e=>t.onthemechange(e.currentTarget.value)),K(`click`,k,function(...e){u()?.apply(this,e)}),K(`click`,A,function(...e){d()?.apply(this,e)}),K(`click`,_e,v),Lr(`cancel`,ve,e=>G(_)?e.preventDefault():x()),Lr(`close`,ve,x),K(`click`,be,b),K(`click`,j,()=>void y()),J(e,S),$e()}Rr([`click`,`change`]);function ba(e){return e.reduce((e,t)=>{let n=xa(t);return n?.kind===`Command`?(n.status===`completed`&&(e.successful+=1),n.status===`failed`&&(e.failed+=1),e):e},{successful:0,failed:0})}function xa(e){if(Sa(e))return null;let[t,n]=e.label.split(` · `,2);return{kind:t,...n?{status:n}:{},content:Ca(t,e.detail)}}function Sa(e){return e.label.startsWith(`Tool`)&&(e.detail.includes(`context_mode`)||/(^|[_:])ctx_[a-z]/i.test(e.detail))}function Ca(e,t){return e===`Command`?wa(t):e===`File change`||e===`fileChange`?t.split(`
|
|
4
|
+
`).filter(Boolean).join(`, `):t}function wa(e){let t=e.match(/^\/bin\/bash -lc "([\s\S]*)"$/);return t?t[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`):e}var Ta=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>`),Ea=q(`<li class="activity-row svelte-thyolt"><small class="activity-type svelte-thyolt"> </small> <span class="activity-content svelte-thyolt"> </span></li>`),Da=q(`<ul class="activity-list svelte-thyolt"></ul>`),Oa=q(`<details class="chat-activity svelte-thyolt"><summary class="svelte-thyolt">activity</summary> <!> <!></details>`),ka=q(`<section class="live-activity svelte-thyolt" aria-label="Current activity"><strong class="svelte-thyolt">activity</strong> <!> <!></section>`);function Aa(e,t){Qe(t,!0);let n=e=>{var t=Ta(),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=Da();Z(t,21,()=>G(c),e=>e.id,(e,t)=>{var n=Ea(),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=xa(e);return t&&t.kind.toLowerCase().replaceAll(` `,``)!==`filechange`?[{id:e.id,...t}]:[]})),o=L(()=>G(a).some(e=>e.kind===`Command`)),s=L(()=>ba(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=Oa(),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=ka(),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),$e()}var ja=q(`<summary><!></summary>`),Ma=q(`<button><!></button>`);function Na(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=ja();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=Ma();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 Pa=e=>({working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`})[e];function Fa(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 ${Pa(t.root.state)}; subagents ${Pa(t.aggregateSubagents)}.`:``,critical:r&&(!e||e.root.state!==t.root.state)?`l0 ${Pa(t.root.state)}.`:``}}function Ia(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 La=q(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <span class="agent-metadata svelte-d9jh4j"> </span> <time class="svelte-d9jh4j"> </time></li>`),Ra=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>`),za=q(`<details class="agents svelte-d9jh4j"><!> <ul class="svelte-d9jh4j"><!></ul></details>`),Ba=q(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <small class="svelte-d9jh4j"> </small></li>`),Va=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>`),Ha=q(`<p class="visually-hidden svelte-d9jh4j" role="alert"> </p>`),Ua=q(`<p class="visually-hidden svelte-d9jh4j" aria-live="polite" aria-atomic="true"> </p> <!>`,1),Wa=q(`<section aria-label="Agent activity"><!> <!></section>`);function Ga(e,t){Qe(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=Ia(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=Fa(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=Wa();let S;var C=V(x),w=e=>{var n=za(),r=V(n);Na(r,{element:`summary`,compact:!0,full:!0,get state(){return G(f)},children:(e,n)=>{F();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=La(),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=Ra(),r=U(V(n),2),i=V(r,!0);P(r),F(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=Va(),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=Ba(),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}`:``} —
|
|
5
|
+
${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]??``}
|
|
6
|
+
${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=Ua(),n=H(t),r=V(n,!0);P(n);var i=U(n,2),a=e=>{var t=Ha(),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),$e()}Ye();var Ka=q(`<main class="svelte-iw6wrs"><h1 class="svelte-iw6wrs">Activity evidence</h1> <!><!></main>`);function qa(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=Ka(),i=U(V(r),2);Ga(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)}));Ga(e,{get activity(){return G(r)}})}}),P(r),J(e,r)}function Ja(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 Ya=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)&&Ja(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`&&Ja(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),Ja(r.agentActivity,e)&&this.#p(e,a,r.agentActivity),this.#u.onAuthoritativeSnapshot?.(e,r)}else i===n&&Ja(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 Xa(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 Za(e){if(typeof e!=`string`||!e.trim())return;let t=e.trim();return t.length<=4e3?t:`${t.slice(0,3999)}…`}var Qa=`Checkpoint handoff failed. Autopilot is reconnecting this session automatically. If it cannot recover, restore or reopen the session.`,$a=(e,t=600)=>typeof e==`string`&&e.length<=t,eo=e=>$a(e,64)&&!Number.isNaN(Date.parse(e));function to(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)&&$a(t.updatedAt,64)&&(t.reason===void 0||$a(t.reason,80))&&(t.nextEvaluationAt===void 0||$a(t.nextEvaluationAt,64))&&(t.health===void 0||no(t.health))}function no(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||eo(n.resumeAt))&&eo(t.observedAt)&&eo(t.lastTransitionAt)&&$a(t.nextExpectedAction)&&(t.degradationReason===void 0||[`missingContinuation`,`invalidWaitLease`,`controllerUnavailable`,`staleTransition`,`planMismatch`].includes(t.degradationReason))}function ro(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 $a(t.requestId,256)&&(t.turnId===null||$a(t.turnId,256))&&(t.requestedAt===null||$a(t.requestedAt,64))&&(t.supervisorReport===void 0||$a(t.supervisorReport,4e3))&&$a(r.reason,64)&&$a(r.summary)&&$a(r.requestedAction)&&$a(r.resumeCondition,64)&&(r.executorReplacement===void 0||io(r.executorReplacement))}function io(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 ao(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`orgPlanAttention`&&ro({requestId:t.requestId,turnId:t.turnId??null,requestedAt:t.requestedAt??null,attention:t.payload,supervisorReport:t.supervisorReport})}function oo(e){return{requestId:e.requestId,turnId:e.turnId,requestedAt:e.requestedAt,attention:e.payload,...e.supervisorReport?{supervisorReport:e.supervisorReport}:{}}}var so=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.`},co=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=Xa){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=Za(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),to(i.autopilot)&&!i.autopilot.enabled&&this.#t.delete(e))}catch(t){this.#m(e,n)&&this.#o.get(e)===r&&this.#r.set(e,so(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){to(t)&&(this.#e.set(e,t),t.health?.phase===`checkpointRecovery`?this.#i.set(e,Qa):this.#i.delete(e))}#g(e,t){if(ro(t))this.#t.set(e,t);else if(ao(t))this.#t.set(e,oo(t));else if(Array.isArray(t)){let n=t.find(ao);n?this.#t.set(e,oo(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])})}},lo=q(`<span aria-hidden="true" class="svelte-1qf1ppf"> </span> `,1),uo=q(`<div class="control-row svelte-1qf1ppf"><span class="status svelte-1qf1ppf"><span aria-hidden="true" class="svelte-1qf1ppf"> </span> </span> <!></div>`),fo=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 po(e,t){Qe(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:Qa},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=fo();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`);Na(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=lo(),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=uo(),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`);Na(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)=>{F();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),$e()}var mo=q(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="supervisor-report svelte-1hnxk0w"> </dd></div>`),ho=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
|
|
7
|
+
guidance below.</dd></div>`),go=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 _o(e,t){Qe(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=go(),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=mo(),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,ho())};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),O=U(ee,2);Sn(O);var te=U(O,2),ne=V(te,!0);P(te);var re=U(te,2),ie=V(re),ae=V(ie,!0);P(ie);var oe=U(ie,2);P(re),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(O,`id`,`${n()}-guidance`),Q(O,`aria-describedby`,`${n()}-guidance-help`),Q(O,`aria-invalid`,e),Q(te,`id`,`${n()}-guidance-help`),Y(ne,G(l)||`Up to 600 characters. Do not include secrets.`),ie.disabled=i,Y(ae,r()?`Updating…`:t.attention.attention.executorReplacement?`Authorize replacement`:`Resume`),oe.disabled=r()},[()=>!!G(l),()=>r()||!!G(l)]),zi(O,()=>G(a),e=>B(a,e)),K(`click`,ie,()=>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),$e()}Rr([`click`]);var vo=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 yo(e,t){Qe(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=vo(),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),$e()}Rr([`click`]);function bo(e,t=`gestalt-mobile.autopilot-attention-toasts.v1`,n=100){let r=xo(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 xo(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 So=[{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 Co(e){let t=e.match(/^\/([^\s]*)$/);return t?t[1].toLowerCase():null}function wo(e){let t=Co(e);return t===null?[]:So.filter(e=>e.name.startsWith(t))}function To(e){let t=e.match(/^\/([^\s]+)\s*$/)?.[1]?.toLowerCase();return So.find(e=>e.name===t)?.argumentPicker}function Eo(e){return[...e].sort((e,t)=>Do(t,e)||t.localeCompare(e))}function Do(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 Oo=q(`Ready <span class="block-cursor svelte-1264sfg" aria-hidden="true"></span>`,1),ko=q(`<p id="writer-hint" class="writer-hint svelte-1264sfg"> </p>`),Ao=q(`<button type="button" class="svelte-1264sfg">Retry send</button>`),jo=q(`<div class="writer-feedback svelte-1264sfg" role="alert" aria-atomic="true"><p class="svelte-1264sfg"> </p> <!></div>`),Mo=q(`<li><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code> <small class="svelte-1264sfg"> </small></button></li>`),No=q(`<ul id="chat-command-completion" class="command-menu svelte-1264sfg" aria-label="Chat commands"></ul>`),Po=q(`<li class="svelte-1264sfg"><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code></button></li>`),Fo=q(`<ul class="command-menu svelte-1264sfg" aria-label="Available models"></ul>`),Io=q(`<ul class="command-menu svelte-1264sfg" aria-label="Reasoning efforts"></ul>`),Lo=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>`),Ro=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>`),zo=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>`),Bo=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>`),Vo=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="" class="svelte-1264sfg"></textarea> <!></div></form>`);function Ho(e,t){Qe(t,!0);let n=$(t,`detached`,3,!1),r=$(t,`retryMessage`,3,null),i=$(t,`retryable`,3,!1),a=$(t,`models`,19,()=>[]),o=$(t,`provider`,3,`codex`),s=$(t,`onscrollbottom`,3,()=>{}),c=$(t,`onmodelselect`,3,()=>{}),l=$(t,`onqueue`,3,()=>{}),u=$(t,`oninterruptsend`,3,()=>{}),d=$(t,`onretry`,3,()=>{}),f=z(0),p=z(null),m=z(!1),h=L(()=>wo(t.message)),g=L(()=>Co(t.message)),_=L(()=>G(g)!==null&&G(g)!==G(p)&&G(h).length>0),v=L(()=>To(t.message)),y=L(()=>G(v)===`models`),b=L(()=>Eo(a())),x=L(()=>G(v)===`reasoning`),S=L(()=>!t.activeTurnId&&!t.starting&&!!t.message.trim()),C=L(()=>!!t.message.trim()),w=L(()=>i()&&!r());function T(e){B(m,!1),e===`queue`?l()():u()()}function E(e,n=!1){B(p,null),B(f,0),t.onchange(e),n&&s()()}function D(e=G(f)){let t=G(h)[e];t&&E(`/${t.name} `,!0)}function ee(e){if(e.key===`Enter`&&e.ctrlKey&&!e.isComposing){if(t.activeTurnId&&!t.starting&&G(C)){e.preventDefault(),T(`queue`);return}if(G(S)){e.preventDefault(),t.onsend();return}}if(G(_)){if(e.key===`ArrowDown`){e.preventDefault(),B(f,(G(f)+1)%G(h).length);return}if(e.key===`ArrowUp`){e.preventDefault(),B(f,(G(f)-1+G(h).length)%G(h).length);return}if(e.key===`Escape`){e.preventDefault(),B(p,G(g),!0);return}if(e.key===`Tab`){e.preventDefault(),D();return}}}var O=Vo(),te=V(O),ne=V(te),re=e=>{var t=Oo();F(),J(e,t)},ie=e=>{var n=Gr();W(()=>Y(n,t.status)),J(e,n)};X(ne,e=>{t.status===`Ready.`?e(re):e(ie,-1)}),P(te);var ae=U(te,2),oe=e=>{var t=ko(),n=V(t);P(t),W(()=>Y(n,`You can read this conversation. Sending will connect to ${o()===`kimi`?`Kimi`:`Codex`}.`)),J(e,t)};X(ae,e=>{n()&&e(oe)});var se=U(ae,2),ce=e=>{var n=jo(),a=V(n),o=V(a,!0);P(a);var s=U(a,2),c=e=>{var n=Ao();W(()=>n.disabled=t.starting),K(`click`,n,function(...e){d()?.apply(this,e)}),J(e,n)};X(s,e=>{i()&&e(c)}),P(n),W(()=>Y(o,r())),J(e,n)};X(se,e=>{r()&&e(ce)});var le=U(se,2),k=e=>{var t=No();Z(t,23,()=>G(h),e=>e.name,(e,t,n)=>{var r=Mo(),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(f)?`command-selected`:void 0),`svelte-1264sfg`),Y(o,`/${G(t).name??``}`),Y(c,G(t).description)}),K(`click`,i,()=>D(G(n))),J(e,r)}),P(t),J(e,t)};X(le,e=>{G(_)&&e(k)});var A=U(le,2),ue=e=>{var t=Fo();Z(t,20,()=>G(b),e=>e,(e,t)=>{var n=Po(),r=V(n),i=V(r),a=V(i,!0);P(i),P(r),P(n),W(()=>Y(a,t)),K(`click`,r,()=>{c()(t),s()()}),J(e,n)}),P(t),J(e,t)};X(A,e=>{G(y)&&e(ue)});var de=U(A,2),fe=e=>{var t=Io();Z(t,20,()=>[`low`,`medium`,`high`],e=>e,(e,t)=>{var n=Po(),r=V(n),i=V(r),a=V(i,!0);P(i),P(r),P(n),W(()=>Y(a,t)),K(`click`,r,()=>E(`/reasoning ${t} `,!0)),J(e,n)}),P(t),J(e,t)};X(de,e=>{G(x)&&e(fe)});var pe=U(de,2),me=V(pe);Sn(me);var he=U(me,2),ge=e=>{var t=Ro(),n=V(t),r=U(n,2),i=e=>{var t=Lo(),n=V(t),r=U(n,2);P(t),K(`click`,n,()=>T(`queue`)),K(`click`,r,()=>T(`interrupt-send`)),J(e,t)};X(r,e=>{G(m)&&e(i)}),P(t),W(()=>Q(n,`aria-expanded`,G(m))),K(`click`,n,()=>B(m,!G(m))),J(e,t)},_e=e=>{var n=zo();W(()=>n.disabled=t.starting),K(`click`,n,function(...e){t.oninterrupt?.apply(this,e)}),J(e,n)},ve=e=>{var n=Bo();W(()=>{Q(n,`aria-label`,G(w)?`Retry send`:`Send prompt`),n.disabled=!G(S)}),K(`click`,n,function(...e){(G(w)?d():t.onsend)?.apply(this,e)}),J(e,n)};X(he,e=>{t.activeTurnId&&G(C)?e(ge):t.activeTurnId?e(_e,1):e(ve,-1)}),P(pe),P(O),W(()=>{Q(O,`aria-busy`,t.starting),Q(te,`aria-label`,t.status),Pi(me,t.message),Q(me,`aria-describedby`,n()?`writer-hint`:void 0)}),K(`input`,me,e=>E(e.currentTarget.value)),K(`keydown`,me,ee),J(e,O),$e()}Rr([`click`,`input`,`keydown`]);function Uo(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(`
|
|
8
|
+
`).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 Wo(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 Go(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 Ko(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(e)}function qo(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 Jo=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>`),Yo=q(`<li data-status="failed" class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code></li>`),Xo=q(`<section aria-label="Failed commands"><strong>Failed commands</strong> <ul class="activity-list svelte-11ye6aj"></ul></section>`),Zo=q(`<li class="svelte-11ye6aj"><small class="svelte-11ye6aj"> </small> <span class="svelte-11ye6aj"> </span></li>`),Qo=q(`<ul class="activity-list svelte-11ye6aj" aria-label="Work activity"></ul>`),$o=q(`<time class="svelte-11ye6aj"> </time>`),es=q(`<span class="svelte-11ye6aj">time unknown</span>`),ts=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>`),ns=q(`<section aria-label="Files changed"><strong>Files changed</strong> <ul class="file-list svelte-11ye6aj"></ul></section>`),rs=q(`<details class="work-details svelte-11ye6aj"><summary class="svelte-11ye6aj"> </summary> <div class="work-details-content svelte-11ye6aj"><!> <!> <!> <!></div></details>`);function is(e,t){Qe(t,!0);let n=$(t,`now`,19,()=>Date.now()),r=L(()=>ba(t.activities)),i=L(()=>t.activities.flatMap(e=>{let t=xa(e);return t?.kind===`Command`&&t.status===`failed`?[{id:e.id,command:t.content}]:[]})),a=L(()=>Uo(t.activities)),o=L(()=>Wo(G(a))),s=L(()=>t.activities.flatMap(e=>{let t=xa(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=rs(),o=V(t),c=V(o,!0);P(o);var u=U(o,2),d=V(u),f=e=>{var t=Jo(),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=Xo(),n=U(V(t),2);Z(n,21,()=>G(i),e=>e.id,(e,t)=>{var n=Yo(),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=Qo();Z(t,21,()=>G(s),e=>e.id,(e,t)=>{var n=Zo(),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=ns(),r=U(V(t),2);Z(r,21,()=>G(a),e=>e.path,(e,t)=>{var r=ts(),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=$o(),i=V(r,!0);P(r),W((e,t)=>{Q(r,`datetime`,e),Y(i,t)},[()=>new Date(G(t).touchedAt).toISOString(),()=>qo(G(t).touchedAt,n())]),J(e,r)},p=e=>{J(e,es())};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),$e()}function as(e){if(!e||typeof e!=`object`)return null;let t=e.command;return typeof t==`string`&&t.trim()?t:null}function os(e){if(!ss(e))return null;let t=e.changes;if(!Array.isArray(t))return null;let n=t.map(e=>ss(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 ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var cs=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>`),ls=q(`<label class="custom svelte-77f3gb">Your custom answer <input required="" class="svelte-77f3gb"/></label>`),us=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>`),fs=q(`<form class="quiz-form svelte-77f3gb"><fieldset class="questions svelte-77f3gb"></fieldset> <button type="submit">Send answers</button></form>`);function ps(e,t){Qe(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=fs(),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=cs(),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=us(),l=H(c),u=V(l);Ni(u);var d=U(u,2);P(l);var f=U(l,2),p=e=>{var i=ls(),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),$e()}Rr([`change`,`click`,`input`]);function ms(e,t=2){if(!xs(e)||!Array.isArray(e.questions)||e.questions.length<1||e.questions.length>8)return null;let n=e.questions.map(e=>_s(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 hs(e){return!xs(e)||!Array.isArray(e.questions)||e.questions.length>3?null:ms({questions:e.questions.map(e=>xs(e)?{id:e.id,header:e.header,question:e.question,choices:e.options,allowCustom:e.isOther===!0,isSecret:e.isSecret===!0}:e)},1)}function gs(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 _s(e,t){if(!xs(e)||!Array.isArray(e.choices)||e.choices.length<t||e.choices.length>5||!ys(e.id)||!bs(e.header,120)||!bs(e.question,600)||typeof e.allowCustom!=`boolean`)return null;let n=e.choices.map(vs);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 vs(e){return!xs(e)||!bs(e.label,160)||!bs(e.description,600)?null:{label:e.label,description:e.description}}function ys(e){return typeof e==`string`&&/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)}function bs(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function xs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ss=q(`<p class="interaction-result svelte-ajsqcq" data-interaction-state="resolved" tabindex="-1"> </p>`),Cs=q(`<p class="interaction-submitting svelte-ajsqcq" data-interaction-state="submitting">Submitting…</p>`),ws=q(`<p>Codex sent an invalid quiz request.</p>`),Ts=q(`<p>Grant the requested permissions for this turn only.</p> <button type="button">Approve</button>`,1),Es=q(`<pre class="command-approval-command svelte-ajsqcq"><code> </code></pre>`),Ds=q(`<p class="command-approval-missing svelte-ajsqcq">Command details were not provided.</p>`),Os=q(`<p>Approve this command?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),ks=q(`<li><code> </code></li>`),As=q(`<ul class="file-change-approval-targets svelte-ajsqcq" aria-label="Files to change"></ul>`),js=q(`<p class="file-change-approval-missing svelte-ajsqcq">File details were not provided.</p>`),Ms=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),Ns=q(`<button type="button">Approve</button><button type="button">Deny</button>`,1),Ps=q(`<p class="interaction-failed svelte-ajsqcq" data-interaction-state="failed">Could not send. Try again.</p> <button type="button">Retry</button>`,1),Fs=q(`<!> <!> <!>`,1),Is=q(`<li class="svelte-ajsqcq"><span class="submitted-question svelte-ajsqcq"><strong> </strong> </span> <span class="submitted-answer svelte-ajsqcq"> </span></li>`),Ls=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>`),Rs=q(`<article><p class="interaction-kind svelte-ajsqcq"> </p> <!> <!></article>`);function zs(e,t){Qe(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=Rs();let u;var d=V(l),f=V(d,!0);P(d);var p=U(d,2),m=e=>{var t=Ss(),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=Fs(),a=H(n),l=e=>{J(e,Cs())};X(a,e=>{G(c)&&e(l)});var u=U(a,2),d=e=>{let n=L(()=>G(i).kind===`quiz`?ms(G(i).payload):hs(G(i).payload));var r=Kr(),a=H(r),l=e=>{{let r=L(()=>o(G(i).requestId));ps(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,ws())};X(a,e=>{G(n)?e(l):e(u,-1)}),J(e,r)},f=e=>{var n=Ts(),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(()=>as(G(i).payload));var r=Os(),a=U(H(r),2),o=e=>{var t=Es(),r=V(t),i=V(r,!0);P(r),P(t),W(()=>Y(i,G(n))),J(e,t)},l=e=>{J(e,Ds())};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(()=>os(G(i).payload));var r=Ms(),a=U(H(r),2),o=e=>{var t=As();Z(t,20,()=>G(n),e=>e,(e,t)=>{var n=ks(),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,js())};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=Ns(),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=Ps();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=Ls(),r=U(V(t),2);Z(r,21,()=>n()[G(i).requestId],e=>e.id,(e,t)=>{var n=Is(),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),F(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),$e()}Rr([`click`]);function Bs(e){let t=[],n=[],r=()=>{n.length&&(t.push({id:n.at(-1).id,kind:`assistant`,commentary:n.map(e=>e.text).join(`
|
|
9
|
+
|
|
10
|
+
`),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(`
|
|
11
|
+
|
|
12
|
+
`):null,answer:i.text,...i.turnId?{turnId:i.turnId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt}}),n=[]}return r(),t}function Vs(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(...Hs(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(...Hs(i)),t}function Hs(e){let t=[],n=e.split(`
|
|
13
|
+
`),r=0,i=e=>{let i=n.slice(r,e).join(`
|
|
14
|
+
`);i&&t.push({kind:`text`,parts:Ks(i)})};for(let e=0;e<n.length;e+=1){let a=Us(n[e]??``);if(a){i(e),t.push({kind:`heading`,level:a.level,parts:Ks(a.text)}),r=e+1;continue}if(e===n.length-1)continue;let o=Ws(n[e]??``),s=Ws(n[e+1]??``);if(!o||!s||o.length!==s.length||!s.every(Gs))continue;i(e),e+=2;let c=[];for(;e<n.length;){let t=Ws(n[e]??``);if(!t||t.length!==o.length)break;c.push(t),e+=1}t.push({kind:`table`,headers:o.map(Ks),rows:c.map(e=>e.map(Ks))}),r=e,--e}return i(n.length),t.length?t:[{kind:`text`,parts:Ks(e)}]}function Us(e){let t=/^ {0,3}(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$/.exec(e);return t?{level:t[1].length,text:t[2]??``}:null}function Ws(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 Gs(e){return/^:?-{3,}:?$/.test(e)}function Ks(e){let t=[],n=/\[([^\]]+)\]\((https?:\/\/[^\s)]+|codex:\/\/[^\s)]+|\/[^\s)]+)\)|`([^`]+)`|\*\*([^*\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:Ks(i[4])}:{kind:`link`,text:i[1]??``,href:i[2]??``}),r=(i.index??0)+i[0].length}let i=e.slice(r);return i&&t.push({kind:`text`,text:i}),t}var qs=/^(.*\.org)(?::\d+(?::\d+)?)?(?:#L\d+(?:C\d+)?)?$/;function Js(e){try{return decodeURIComponent(e)}catch{return null}}function Ys(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 Xs(e,t){let n=Js(e),r=Js(t),i=n?qs.exec(n):null;if(!i||!r)return null;let a=Ys(i[1]??``),o=Ys(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 Zs(e){let t=Js(e);if(!t)return!1;let n=qs.exec(t);return!!(n&&Ys(n[1]??``))}async function Qs(e,t=globalThis.navigator?.clipboard,n=ec){if(!t)return $s(e,n);try{return await t.writeText(e),!0}catch{return $s(e,n)}}function $s(e,t){try{return t(e)}catch{return!1}}function ec(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 tc=q(`<a class="svelte-1im954t"> </a>`),nc=q(`<a target="_blank" rel="noreferrer" class="svelte-1im954t"> </a>`),rc=q(`<code class="svelte-1im954t"> </code>`),ic=q(`<strong class="svelte-1im954t"><!></strong>`),ac=q(`<time class="svelte-1im954t"> </time>`),oc=q(`<span class="touch-unknown svelte-1im954t">time unknown</span>`),sc=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>`),cc=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>`),lc=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>`),uc=q(`<th scope="col" class="svelte-1im954t"><!></th>`),dc=q(`<td class="svelte-1im954t"><!></td>`),fc=q(`<tr></tr>`),pc=q(`<div class="table-scroll svelte-1im954t"><table class="svelte-1im954t"><thead><tr></tr></thead><tbody></tbody></table></div>`),mc=q(`<h1 class="svelte-1im954t"><!></h1>`),hc=q(`<h2 class="svelte-1im954t"><!></h2>`),gc=q(`<h3 class="svelte-1im954t"><!></h3>`),_c=q(`<h4 class="svelte-1im954t"><!></h4>`),vc=q(`<h5 class="svelte-1im954t"><!></h5>`),yc=q(`<h6 class="svelte-1im954t"><!></h6>`),bc=q(`<div class="svelte-1im954t"><!></div>`),xc=q(`<li class="audit-incomplete svelte-1im954t" role="status">Earlier Autopilot audit entries are not shown; this timeline contains the retained recent
|
|
15
|
+
audit.</li>`),Sc=q(`<li class="svelte-1im954t"><time class="svelte-1im954t"> </time></li>`),Cc=q(`<details><summary class="svelte-1im954t"> </summary> <ul></ul></details>`),wc=q(`<aside class="autopilot-audit svelte-1im954t" aria-label="Autopilot audit entry"><strong>Autopilot</strong> <!> <!></aside>`),Tc=q(`<time class="svelte-1im954t"> <!></time>`),Ec=q(`<div class="entry-heading svelte-1im954t"><strong>working</strong></div> <!> <!>`,1),Dc=q(`<section><!></section>`),Oc=q(`<div class="entry-heading svelte-1im954t"><strong>prompt</strong> <!></div> <div class="entry-content svelte-1im954t"><!></div> <!> <!>`,1),kc=q(`<div class="commentary-content live-commentary svelte-1im954t"><!></div>`),Ac=q(`<!> <!>`,1),jc=q(`<button class="commentary-toggle svelte-1im954t" type="button"><span aria-hidden="true"> </span> commentary</button>`),Mc=q(`<div class="answer-history svelte-1im954t"><!></div>`),Nc=q(`<div class="commentary-content svelte-1im954t"><!></div>`),Pc=q(`<section class="answer-turn svelte-1im954t"><div class="entry-heading svelte-1im954t"><strong> </strong> <!></div> <!> <!> <div class="entry-content svelte-1im954t"><!></div> <!></section>`),Fc=q(`<div class="entry-content svelte-1im954t"><!></div>`),Ic=q(`<details><summary>commentary</summary> <!></details> <!>`,1),Lc=q(`<section><div class="entry-heading svelte-1im954t"><strong> </strong> <!></div> <!> <!></section>`),Rc=q(`<li><!></li>`),zc=q(`<li class="interaction-only svelte-1im954t"><!></li>`),Bc=q(`<li class="progress-item svelte-1im954t"><section><!></section></li>`),Vc=q(`<ol aria-label="Chat messages" class="svelte-1im954t"><!> <!> <!> <!></ol>`);function Hc(e,t){Qe(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=tc(),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&&Zs(G(r).href)),s=e=>{var t=nc(),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):e(s,-1)}),J(e,n)},s=e=>{var t=rc(),n=V(t,!0);P(t),W(()=>Y(n,G(r).text)),J(e,t)},c=e=>{var t=ic(),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(()=>Uo(t())),r=L(()=>Wo(G(n)));var i=Kr(),a=H(i),o=e=>{var t=cc(),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=sc(),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=ac(),r=V(n,!0);P(n),W((e,t)=>{Q(n,`datetime`,e),Y(r,t)},[()=>new Date(G(t).touchedAt).toISOString(),()=>qo(G(t).touchedAt,G(y))]),J(e,n)},f=e=>{J(e,oc())};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??``}
|
|
16
|
+
${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,()=>Vs(t()),ei,(e,t)=>{var r=Kr(),i=H(r),a=e=>{var n=lc(),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 k(G(t).text)),J(e,n)},o=e=>{var r=pc(),i=V(r),a=V(i),o=V(a);Z(o,21,()=>G(t).headers,ei,(e,t)=>{var r=uc(),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=fc();Z(r,21,()=>G(t),ei,(e,t)=>{var r=dc(),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=mc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},o=e=>{var r=hc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},s=e=>{var r=gc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},c=e=>{var r=_c(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},l=e=>{var r=vc(),i=V(r);n(i,()=>G(t).parts),P(r),J(e,r)},u=e=>{var r=yc(),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=bc(),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(()=>Bs(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 O(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 te(e){return e.kind===`user`?t.activities.filter(t=>O(t)===e.id):[]}function ne(){return t.activities.filter(e=>!D(e)&&!O(e))}let re=L(ne);function ie(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 Go(G(_)[e-1]?.occurredAt,t)}function ce(e,n){!t.onopenorg||!Zs(n)||(e.preventDefault(),t.onopenorg(n))}function le(e){return`Copy code block: ${(e.trim().split(`
|
|
17
|
+
`)[0]?.trim()||`empty block`).slice(0,48)}`}async function k(e){g()(await Qs(e,u()))}var A=Vc(),ue=V(A),de=e=>{J(e,xc())};X(ue,e=>{o()&&e(de)});var fe=U(ue,2);Z(fe,19,()=>G(_),e=>e.id,(e,t,n)=>{var a=Rc(),o=V(a),s=e=>{var n=wc(),r=U(V(n)),i=U(r),a=e=>{var n=ac(),r=V(n,!0);P(n),W((e,t)=>{Q(n,`datetime`,e),Y(r,t)},[()=>new Date(G(t).occurredAt).toISOString(),()=>Ko(G(t).occurredAt)]),J(e,n)};X(i,e=>{G(t).occurredAt&&e(a)});var o=U(i,2),s=e=>{var n=Cc(),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=Sc(),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(),()=>Ko(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(()=>te(G(t)));var o=Oc(),s=H(o),u=U(V(s),2),g=e=>{var r=Tc(),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(),()=>Ko(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)));zs(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=Dc(),i=V(n),o=e=>{var t=Ec(),n=U(H(t),2);{let e=L(()=>ie(G(a)));Aa(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=>{is(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=Pc(),o=V(a),s=V(o),c=V(s,!0);P(s);var l=U(s,2),u=e=>{var r=Tc(),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(),()=>Ko(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=Ac(),a=H(n),o=e=>{var n=kc(),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(()=>ie(G(r)));Aa(s,{get activities(){return G(e)},variant:`live`})}J(e,n)},p=L(()=>ae(G(t))),m=e=>{var n=Mc(),r=V(n),i=e=>{var n=jc(),r=V(n),i=V(r,!0);P(r),F(),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||ie(G(r)).length);X(d,e=>{G(p)?e(f):G(h)&&e(m,1)});var g=U(d,2),_=e=>{var n=Nc(),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),is(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=Lc(),s=V(o),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=e=>{var r=Tc(),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(),()=>Ko(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=Ac(),r=H(n),o=e=>{var n=Fc(),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(()=>ie(G(a)));Aa(s,{get activities(){return G(e)},variant:`live`})}J(e,n)},m=L(()=>ae(G(t))),h=e=>{var n=Ic(),r=H(n),o=U(V(r),2);i(o,()=>G(t).commentary),P(r),is(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 pe=U(fe,2),me=e=>{var t=zc();zs(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(pe,e=>{G(x).length===0&&G(w).length&&e(me)});var he=U(pe,2),ge=e=>{var t=Bc(),n=V(t),i=V(n),o=e=>{var t=Ec(),n=U(H(t),2);{let e=L(()=>ie(G(re)));Aa(n,{get activities(){return G(e)},variant:`live`})}var i=U(n,2);r(i,()=>G(re)),J(e,t)},s=e=>{is(e,{get activities(){return G(re)},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(he,e=>{G(re).length&&e(ge)}),P(A),J(e,A),$e()}Rr([`click`]);var Uc=[150,300,600];function Wc(e){return new Promise(t=>setTimeout(t,e))}function Gc(e){return e.status===502||e.status===503||e.status===504}async function Kc(e=fetch){for(let t=0;t<=Uc.length;t+=1){let n;try{n=await e(`/api/bootstrap`)}catch(e){if(e instanceof Error&&e.name===`AbortError`)throw e;if(t===Uc.length)throw Error(`BOOTSTRAP_FAILED`);await Wc(Uc[t]);continue}if(n.ok)return n.json();if(!Gc(n)||t===Uc.length)throw Error(`BOOTSTRAP_FAILED`);await Wc(Uc[t])}throw Error(`BOOTSTRAP_FAILED`)}var qc=`gestalt-mobile`,Jc=2,Yc=[`settings`,`drafts`,`cursors`,`messages`];function Xc(e){return new Promise((t,n)=>{let r=e.open(qc,Jc);r.onupgradeneeded=()=>{for(let e of Yc)r.result.objectStoreNames.contains(e)||r.result.createObjectStore(e)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}function Zc(e,t,n){return el(e.transaction(t,`readonly`).objectStore(t).get(n))}function Qc(e,t,n,r){return el(e.transaction(t,`readwrite`).objectStore(t).put(r,n))}function $c(e,t,n){return el(e.transaction(t,`readwrite`).objectStore(t).delete(n))}function el(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var tl=`chat-projections`,nl=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 rl(e=globalThis.indexedDB){if(!e)return{read:async()=>null,write:async()=>{}};let t=Xc(e);return{read:async e=>{try{return await Zc(await t,tl,e)}catch{return null}},write:async(e,n)=>{try{await Qc(await t,tl,e,nl(n))}catch{}}}}var il=`chat-session`;function al(e){return new URLSearchParams(e).get(`chat-session`)?.trim()||null}function ol(e,t){let n=new URL(e);return n.search=``,n.hash=``,n.searchParams.set(il,t),n.toString()}function sl(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 cl(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 ll(t,`reason`)===`resourceBudget`?`Stopped background work at its resource limit`:`Stopped executor background work`;if(e===`autopilot.turn-failed`)return ll(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 ll(t,`outcome`)===`failed`?`Attention resolution failed`:`Attention resolved`;if(e!==`autopilot.updated`)return null;let n=ll(t,`state`),r=ll(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 ll(e,t){return e&&typeof e==`object`?e[t]:void 0}function ul(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 dl(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(`
|
|
18
|
+
`);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=ul(e.changes);return{id:e.id,label:`File change · ${String(e.status??`unknown`)}`,detail:e.paths.join(`
|
|
19
|
+
`),...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 fl=()=>({sessionId:null,cursor:0,snapshotting:!1,lifecycle:`finished`,activeTurnId:null,messages:[],activities:[],prompts:[],interactions:[],autopilotAuditTruncated:!1,buffered:new Map}),pl=(e=null)=>({...fl(),sessionId:e});function ml(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 hl(e){return{id:e.id,role:`audit`,text:e.label,occurredAt:e.occurredAt,...e.controlId?{controlId:e.controlId}:{},complete:!0}}function gl(e){let t=_l(e.occurredAt),n=cl(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?hl({id:`audit:${e.sequence}`,label:n,occurredAt:t,...r?{controlId:r}:{}}):null}function _l(e){if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function vl(e){let t=_l(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 yl(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 bl(e,t){return e?t===`finished`||t===`interrupted`?t:`working`:t===`working`||t===`starting`||t===`recoverable`?`finished`:t}function xl(e){return[...new Map(e.map(e=>[e.key??e.id??``,e])).values()]}function Sl(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 Cl(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=ml(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=xl([...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 xl([...f.get(-1)??[],...s.flatMap((e,t)=>[e,...f.get(t)??[]])])}function wl(e,t){if(!t||typeof t!=`object`)return pl(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 pl(e);let r=[`submitting`,`accepted`,`failed`,`canonical`],i=[`pending`,`submitting`,`resolved`,`failed`],a=[`starting`,`working`,`finished`,`interrupted`,`recoverable`];return{...pl(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 Tl(e,t){if(!Number.isInteger(t.baseSequence)||t.baseSequence<0)return e;if(t.baseSequence<e.cursor)return Ll({...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(vl),a=new Map(e.interactions.map(e=>[e.requestId,e])),o=xl(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=xl(t.items.flatMap(e=>{let t=dl(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(Sl,[...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:bl(t.activeTurnId,e.cursor===0&&e.lifecycle===`finished`?`working`:e.lifecycle),prompts:r,messages:xl(Cl(l,r,e.messages).concat(u.map(hl))).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 Ll({...d,messages:El(d.messages)})}function El(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 Dl(e){return{...e,snapshotting:!0}}function Ol(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 kl(e,t,n,r){let i=Ol(e,t,n,r);return i===e?e:{...i,lifecycle:`working`}}function Al(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 jl(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 Ml(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 Nl(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&e.state!==`resolved`?{...e,state:`failed`,attemptedOutcome:n}:e)}}function Pl(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t?{...e,state:`resolved`,...yl(e,n)?{attemptedOutcome:yl(e,n)}:{}}:e)}}function Fl(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=_l(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=Pl(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=Il(r.changes);n={...n,activities:Sl(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`:bl(e,n.lifecycle)}}let a=gl(t);return a&&!n.messages.some(e=>e.id===a.id)&&(n={...n,messages:El([...n.messages,a])}),n}function Il(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 Ll(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=Fl({...n,buffered:t},e),t=new Map(n.buffered)}}function Rl(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 zl={read:async()=>null,write:async()=>{}},Bl=[250,750,1500],Vl=e=>!!e&&typeof e==`object`,Hl=e=>Vl(e)&&typeof e.path==`string`&&Number.isInteger(e.additions)&&e.additions>=0&&Number.isInteger(e.deletions)&&e.deletions>=0,Ul=e=>Vl(e)&&typeof e.id==`string`&&typeof e.kind==`string`,Wl=e=>Vl(e)&&typeof e.id==`string`&&Array.isArray(e.items)&&e.items.every(Ul)&&(e.startedAt===null||typeof e.startedAt==`number`)&&(e.completedAt===null||typeof e.completedAt==`number`),Gl=e=>!Vl(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`),Kl=e=>Vl(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`),ql=e=>Vl(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(Hl))&&(e.turnId===void 0||typeof e.turnId==`string`)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),Jl=e=>!Vl(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(Ul)||!e.turns.every(Wl)||!e.interactions.every(Gl)||e.activities!==void 0&&(!Array.isArray(e.activities)||!e.activities.every(ql))||e.autopilotAudit!==void 0&&(!Array.isArray(e.autopilotAudit)||!e.autopilotAudit.every(Kl))||e.autopilotAuditTruncated!==void 0&&typeof e.autopilotAuditTruncated!=`boolean`||e.currentSequence!==void 0&&(!Number.isInteger(e.currentSequence)||e.currentSequence<0)?null:e,Yl=class{#e=pl();#t=null;#n=0;#r=-1;#i=null;#a=null;#o=null;#s=0;#c=!1;#l=!1;#u=null;#d=0;#f=!1;#p=new Set;#m=new Set;#h;constructor(e){this.#h={...e,websocket:e.websocket??(e=>new WebSocket(e)),cache:e.cache??zl,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??Xa,now:e.now??Date.now},this.#h.document.addEventListener(`visibilitychange`,this.#g),this.#h.window.addEventListener(`focus`,this.#g)}get view(){return Object.freeze({...this.#e,status:Rl(this.#e),starting:this.#e.lifecycle===`starting`})}canSubmit(e){return this.#t?e===`send`?!this.#e.activeTurnId:!!(this.#e.activeTurnId&&(e!==`queue`||this.#h.relay.queueTurnInput)):!1}select(e,t={}){if(this.#f||this.#t===e)return;this.#k(),this.#t=e,this.#l=e!==null&&t.history===`empty`;let n=++this.#n;this.#e=pl(e),this.#T(),e&&this.#_(e,n)}async send(e,t=this.#h.createKey()){let n=this.#t,r=this.#n,i=`${n}:${r}:${t}`;if(!(!n||!e.trim()||this.#e.activeTurnId||this.#p.has(i))){this.#p.add(i),this.#w(Ol(this.#e,t,e.trim(),this.#h.now()));try{let i=await this.#h.relay.startTurn(n,e.trim(),t);this.#E(n,r)&&(this.#l=!1,this.#w(Al(this.#e,t,i.activeTurnId??null))),this.#h.onSendAccepted?.(n,t)}catch(e){this.#E(n,r)&&(this.#w(jl(this.#e,t)),this.#h.onSendError?.(e,t))}finally{this.#p.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.#h.createKey()){let n=this.#t,r=this.#e.activeTurnId,i=this.#h.relay.queueTurnInput,a=this.#n,o=`${n}:${a}:${t}`;if(!(!n||!r||!i||!e.trim()||this.#p.has(o))){this.#p.add(o),this.#w(kl(this.#e,t,e.trim(),this.#h.now()));try{let o=await i(n,r,e.trim(),t);this.#E(n,a)&&this.#w(Al(this.#e,t,o.activeTurnId)),this.#h.onSendAccepted?.(n,t)}catch(e){this.#E(n,a)&&(this.#w(jl(this.#e,t)),this.#h.onSendError?.(e,t))}finally{this.#p.delete(o)}}}async interruptAndSend(e,t=this.#h.createKey()){let n=this.#t,r=this.#e.activeTurnId,i=this.#n,a=`${n}:${i}:${t}`;if(!(!n||!r||!e.trim()||this.#p.has(a))){this.#p.add(a),this.#w(Ol(this.#e,t,e.trim(),this.#h.now()));try{await this.#h.relay.interruptTurn(n,r).catch(()=>void 0);let a=await this.#D(n,i,e.trim(),t);this.#E(n,i)&&this.#w(Al(this.#e,t,a.activeTurnId??null)),this.#h.onSendAccepted?.(n,t)}catch(e){this.#E(n,i)&&(this.#w(jl(this.#e,t)),this.#h.onSendError?.(e,t))}finally{this.#p.delete(a)}}}async interrupt(){let e=this.#t,t=this.#e.activeTurnId;if(!(!e||!t))try{await this.#h.relay.interruptTurn(e,t)}catch{}}async respond(e,t,n=this.#h.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.#m.has(s))){this.#m.add(s),this.#w(Ml(this.#e,e,o));try{let n=await this.#h.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.#E(r,i)&&this.#w(Pl(this.#e,e,a))}catch{this.#E(r,i)&&this.#w(Nl(this.#e,e,t))}finally{this.#m.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.#x(this.#t,this.#n)}dispose(){this.#f||(this.#f=!0,this.#k(),this.#h.document.removeEventListener(`visibilitychange`,this.#g),this.#h.window.removeEventListener(`focus`,this.#g))}#g=()=>{this.#h.document.visibilityState===`visible`&&this.refresh()};async#_(e,t){let n=this.#l;if(n||this.#x(e,t),this.#v(e,t),n)return;let r=await this.#h.cache.read(e).catch(()=>null);!this.#E(e,t)||this.#r===t||!r||(this.#e=wl(e,r),this.#T())}#v(e,t){if(!this.#E(e,t)||this.#i)return;let n=this.#h.location.protocol===`https:`?`wss:`:`ws:`,r;try{r=this.#h.websocket(`${n}//${this.#h.location.host}/api/sessions/${encodeURIComponent(e)}/events?after=${this.#e.cursor}`)}catch{this.#e={...this.#e,lifecycle:`recoverable`},this.#T(),this.#u=this.#h.setTimeout(()=>this.#v(e,t),Math.min(1e3*2**this.#d++,1e4));return}this.#i=r,r.onopen=()=>{this.#E(e,t)&&this.#i===r&&(this.#d=0,this.#l||this.#x(e,t))},r.onmessage=n=>this.#y(e,t,String(n.data)),r.onclose=()=>{!this.#E(e,t)||this.#i!==r||(this.#i=null,this.#u=this.#h.setTimeout(()=>this.#v(e,t),Math.min(1e3*2**this.#d++,1e4)))}}#y(e,t,n){if(!this.#E(e,t))return;let r;try{r=JSON.parse(n)}catch{return}if(r.type===`relay.resyncRequired`){this.#l=!1,this.#x(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.#b(i))return;this.#l=!1;let a=Fl(this.#e,i);this.#w(a),this.#h.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.#h.onSessionEvent?.(i),a.snapshotting&&this.#x(e,t)}#b(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`}#x(e,t){if(this.#a?.id===e&&this.#a.generation===t)return this.#a.promise;if(!this.#E(e,t))return Promise.resolve();let n=this.#e.snapshotting&&this.#e.buffered.size>0;this.#e=Dl(this.#e),this.#T();let r=this.#h.relay.getHistory(e).then(r=>{let i=Jl(r);if(this.#E(e,t)){if(!i){this.#w({...this.#e,snapshotting:!1,lifecycle:`recoverable`});return}this.#s=0,this.#c=!1,this.#o&&this.#h.clearTimeout(this.#o),this.#o=null,this.#r=t,this.#w(Tl(this.#e,i));for(let t of i.items)t.kind===`user`&&typeof t.operationId==`string`&&this.#h.onHistoryPromptAccepted?.(e,t.operationId);n&&this.#C(e,t)}}).catch(n=>{if(this.#E(e,t)){this.#w({...this.#e,snapshotting:!1,lifecycle:`recoverable`});let r=Bl[this.#s++];r===void 0?this.#c||(this.#c=!0,this.#h.onHistoryError?.(n)):this.#S(e,t,r)}}).finally(()=>{this.#a?.promise===r&&(this.#a=null,this.#E(e,t)&&this.#e.snapshotting&&this.#x(e,t))});return this.#a={id:e,generation:t,promise:r},r}#S(e,t,n){this.#o&&this.#h.clearTimeout(this.#o);let r=this.#h.setTimeout(()=>{this.#o===r&&(this.#o=null,this.#E(e,t)&&this.#x(e,t))},n);this.#o=r}#C(e,t){let n=this.#i;this.#i=null,n?.close(),this.#u&&this.#h.clearTimeout(this.#u),this.#u=null,this.#v(e,t)}#w(e){this.#e=e,this.#T(),this.#t&&this.#h.cache.write(this.#t,this.#e).catch(()=>{})}#T(){this.#h.publish(this.view)}#E(e,t){return!this.#f&&this.#t===e&&this.#n===t}async#D(e,t,n,r){let i;for(let a of[0,50,150,300]){if(!this.#E(e,t))throw Error(`SESSION_CHANGED`);a&&await this.#O(a);try{return await this.#h.relay.startTurn(e,n,r)}catch(e){if(!Xl(e,`SESSION_TURN_ACTIVE`))throw e;i=e}}throw i}#O(e){return new Promise(t=>this.#h.setTimeout(t,e))}#k(){this.#u&&this.#h.clearTimeout(this.#u),this.#u=null,this.#o&&this.#h.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 Xl(e,t){return Vl(e)&&e.code===t}var Zl=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}},Ql=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 $l(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 eu={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.`};function tu(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(eu,r)?r:Object.hasOwn(eu,n)?n:t,a=typeof e==`object`&&e&&`retryable`in e?e.retryable===!0:!0;return{code:i,message:eu[i],retryable:a}}var nu=q(`<small class="svelte-1izxxv2"> </small>`),ru=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>`),iu=q(`<ol aria-label="Recent notifications" class="svelte-1izxxv2"></ol>`),au=q(`<p class="empty svelte-1izxxv2" role="status">No recent notifications.</p>`),ou=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 su(e,t){Qe(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=ou(),o=V(a),s=V(o),c=U(s,2);pi(V(c),()=>i),F(2),P(c),P(o);var l=U(o,2),u=e=>{var t=iu();Z(t,21,()=>G(n),e=>e.id,(e,t)=>{var n=ru(),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=nu(),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,au())};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),$e()}Rr([`click`]);var cu={error:null,success:5e3,warning:1e4,info:7e3},lu=`gestalt-mobile.notification-history`;function uu(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function du(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 fu(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=du(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(lu,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=cu[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)}}}var pu=q(`<small class="svelte-1a0rutm"> </small>`),mu=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>`),hu=q(`<div class="toast-viewport svelte-1a0rutm" aria-label="Notifications"></div>`);function gu(e,t){Qe(t,!0);let n=z([]),r=L(()=>G(n).slice(-3));Gi(()=>t.queue.subscribe(e=>B(n,e)));var i=hu();Z(i,21,()=>G(r),e=>e.id,(e,n)=>{var r=mu();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),$e()}Rr([`focusin`,`focusout`,`click`]);var _u=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 vu(e,t){Qe(t,!0);let n=fu();Gi(()=>{t.variant===`stacked`&&n.enqueue({kind:`success`,message:`Cloned.`}),n.enqueue({kind:`error`,code:`GIT_CLONE_FAILED`,message:`Clone failed.`})});var r=_u();gu(U(H(r),4),{get queue(){return n}}),J(e,r),$e()}var yu={sessionBase:()=>!0,gitRepositoryTarget:e=>e.isGitRepository,cloneDestination:e=>!e.isGitRepository};function bu(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 xu(e,t){let n=new Set(e);return t.isGitRepository||(n.has(t.id)?n.delete(t.id):n.add(t.id)),n}function Su(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 Cu(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 wu(e,t){for(let n of e){if(n.id===t)return n;let e=wu(n.children,t);if(e)return e}}function Tu(e,t,n,r){if(e){let i=wu(n,e);if(i&&r(i))return i.id;let a=Cu(t,e);for(let e of a.toReversed()){let t=wu(n,e);if(t&&r(t))return t.id}}return Eu(n).find(r)?.id??null}function Eu(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}var Du=q(`<button class="disclosure svelte-6z3q4v" type="button" tabindex="-1"><span aria-hidden="true"> </span></button>`),Ou=q(`<span class="disclosure-spacer svelte-6z3q4v" aria-hidden="true"></span>`),ku=q(`<span class="repository-badge svelte-6z3q4v">Git</span>`),Au=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>`),ju=q(`<div class="filesystem-tree svelte-6z3q4v" role="tree"></div>`);function Mu(e,t){Qe(t,!0);let n=$(t,`isSelectable`,3,()=>!0),r=z(null),i=on({}),a=L(()=>Su(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(xu(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=ju();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=Au();let g;var _=V(h),v=e=>{var n=Du(),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,Ou())};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 O=U(w,2),te=e=>{J(e,ku())};X(O,e=>{G(u).isGitRepository&&e(te)}),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),$e()}Rr([`click`,`keydown`]);var Nu=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 Pu(e,t){Qe(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=Nu(),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`?yu.sessionBase:yu.gitRepositoryTarget);Mu(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),$e()}function Fu(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 Iu(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 Lu=q(`<p class="clone-status svelte-pudr3t" role="status"> </p>`),Ru=q(`<option> </option>`),zu=q(`<section aria-label="Confirm push"><p> </p> <button type="button">Confirm push</button> <button type="button">Cancel</button></section>`),Bu=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>`),Vu=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>`),Hu=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"> </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),Uu=q(`<p>This workspace is not a Git repository.</p>`),Wu=q(`<p role="status">Loading repository status…</p>`),Gu=q(`<p><strong> </strong> is available as a Clone destination. Select a Git repository
|
|
20
|
+
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),Ku=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),qu=q(`<p role="alert"> </p>`),Ju=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
|
|
21
|
+
destinations.</p></div> <!> <button id="browse-files" type="button">Browse files</button></section> <form class="clone-form svelte-pudr3t"><div class="clone-controls svelte-pudr3t"><div class="clone-field clone-destination svelte-pudr3t"><span class="field-label svelte-pudr3t">Destination</span> <output aria-live="polite" class="svelte-pudr3t"> </output></div> <div class="clone-field svelte-pudr3t"><label for="git-clone-address">Git address</label> <input id="git-clone-address" name="address" required="" autocomplete="url" inputmode="url" enterkeyhint="done" placeholder="https://example.com/owner/repository.git" aria-describedby="clone-help"/></div> <button type="submit" class="svelte-pudr3t"> </button></div> <p id="clone-help" class="svelte-pudr3t">The repository is cloned inside the selected workspace.</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 Yu(e,t){Qe(t,!0);let n=z(``),r=L(()=>t.selectedWorkspace&&!t.selectedWorkspace.isGitRepository?t.selectedWorkspace:null);function i(e){e.preventDefault(),!(!G(n).trim()||t.cloning)&&t.onclone(G(n).trim())}var a=Ju(),o=U(V(a),2),s=U(V(o),2);{let e=L(()=>t.selectedWorkspace?.id??null);Mu(s,{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 c=U(s,2);P(o);var l=U(o,2),u=V(l),d=V(u),f=U(V(d),2),p=V(f,!0);P(f),P(d);var m=U(d,2),h=U(V(m),2);Ni(h),P(m);var g=U(m,2),_=V(g,!0);P(g),P(u);var v=U(u,4),y=e=>{var n=Lu(),r=V(n,!0);P(n),W(()=>Y(r,t.cloneStatus)),J(e,n)};X(v,e=>{t.cloneStatus&&e(y)}),P(l);var b=U(l,2),x=U(V(b),2),S=e=>{var n=Kr(),r=H(n),i=e=>{var n=Kr(),r=H(n),i=e=>{var n=Hu(),r=H(n),i=V(r),a=U(V(i),2);Z(a,20,()=>t.summary.branches??[],e=>e,(e,t)=>{var n=Ru(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(a);var o;Ei(a);var s=U(a,2),c=V(s);P(s);var l=U(s,2),u=V(l);P(l);var d=U(l,2),f=V(d),p=V(f,!0);P(f),P(d);var m=U(d,2),h=V(m);P(m),P(i);var g=U(i,2),_=V(g),v=U(_,2),y=U(V(v));P(v),P(g),P(r);var b=U(r,2),x=e=>{var n=zu(),r=V(n),i=V(r);P(r);var a=U(r,2),o=U(a,2);P(n),W(()=>Y(i,`Push HEAD to ${t.summary.upstream??``}?`)),K(`click`,a,function(...e){t.onpush?.apply(this,e)}),K(`click`,o,function(...e){t.oncancelpush?.apply(this,e)}),J(e,n)};X(b,e=>{t.confirmingPush&&e(x)});var S=U(b,2),C=e=>{var n=Vu(),r=U(V(n),2);Z(r,21,()=>t.summary.commits,e=>e.hash,(e,t)=>{var n=Bu(),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)},[()=>Iu(G(t).authoredAt)]),J(e,n)}),P(r),P(n),J(e,n)};X(S,e=>{t.summary.commits.length&&e(C)}),W(e=>{a.disabled=t.refreshing||t.checkingOut||!t.summary.branches?.length,o!==(o=t.summary.branch??``)&&(a.value=(a.__value=t.summary.branch??``)??``,Ti(a,t.summary.branch??``)),Y(c,`Upstream: ${t.summary.upstream??`none`??``}`),Y(u,`Ahead ${t.summary.ahead??``}; behind ${t.summary.behind??``}.`),Q(f,`datetime`,t.summary.fetchedAt??void 0),Y(p,e),Y(h,`Changes: ${t.summary.dirty.staged??``} staged, ${t.summary.dirty.unstaged??``} unstaged, ${t.summary.dirty.untracked??``} untracked.`),_.disabled=t.refreshing||t.checkingOut||!t.summary.upstream||t.summary.ahead<1||t.summary.behind>0,v.disabled=t.refreshing||t.checkingOut,Y(y,` ${t.refreshing?`Pulling…`:`Pull`}`)},[()=>Fu(t.summary.fetchedAt)]),K(`change`,a,e=>t.oncheckout(e.currentTarget.value)),K(`click`,_,function(...e){t.onopenpushconfirmation?.apply(this,e)}),K(`click`,v,function(...e){t.onpull?.apply(this,e)}),J(e,n)},a=e=>{J(e,Uu())};X(r,e=>{t.summary.available?e(i):e(a,-1)}),J(e,n)},a=e=>{J(e,Wu())};X(r,e=>{t.summary?e(i):t.error||e(a,1)}),J(e,n)},C=e=>{var n=Gu(),r=H(n),i=V(r),a=V(i,!0);P(i),F(),P(r),F(2),W(()=>Y(a,t.selectedWorkspace.name)),J(e,n)},w=e=>{var t=Ku();F(2),J(e,t)};X(x,e=>{t.selectedWorkspace?.isGitRepository?e(S):t.selectedWorkspace?e(C,1):e(w,-1)});var T=U(x,2),E=e=>{var n=qu(),r=V(n,!0);P(n),W(()=>Y(r,t.error)),J(e,n)};X(T,e=>{t.error&&e(E)}),P(b),P(a),W(()=>{c.disabled=!t.selectedWorkspace,Y(p,G(r)?`~/${G(r).relativePath}`:`Select a non-repository folder`),g.disabled=t.cloning,Y(_,t.cloning?`Cloning…`:`Clone`)}),K(`click`,c,e=>t.onbrowsefiles(e.currentTarget)),Lr(`submit`,l,i),zi(h,()=>G(n),e=>B(n,e)),J(e,a),$e()}Rr([`click`,`change`]);var Xu=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 Zu(e,t,n,r,i){let a=new Set(Qu(e).filter(e=>e.isGitRepository).map(e=>e.id)),o=wu(t,n),s=o?Qu(o.children).filter(e=>e.isGitRepository&&!a.has(e.id)):[],c=$u(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&&Cu(t,u).forEach(e=>d.add(e)),!l&&o&&d.add(o.id),{selectedId:u,expandedIds:d}}function Qu(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}function $u(e){return(e.trim().replace(/[?#].*$/,``).replace(/\/+$/,``).split(/[/:]/).at(-1)??``).replace(/\.git$/i,``)}function ed(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 nd(e){return[`Submitted quiz answers:`,...e.map(e=>`- ${e.header} — ${e.question}\n ${e.answer.trim().replaceAll(`
|
|
22
|
+
`,`
|
|
23
|
+
`)}`)].join(`
|
|
24
|
+
`)}function rd(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{quit:()=>n(`/api/maintenance/quit`,{}),listSessions:e=>s(`/api/sessions`,e),checkWorkspaceFileReferences:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/references`,{paths:t},{},r),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 id=[`authoring-start`,`work-start`,`checkpoint`,`update`,`supervision-start`,`resync`];function ad(e){return typeof e==`string`&&(id.includes(e)||/^review:[A-Za-z0-9._-]{1,128}:REVIEWED$/.test(e)||/^l2:[A-Za-z0-9._-]{1,128}:(WIP|DONE)$/.test(e))}function od(e){if(!e||typeof e!=`object`)return!1;let t=e;return sd(t.plan)&&(t.reason===null||ad(t.reason))}function sd(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 cd(e){return e instanceof Error?e.message:`Could not load the plan.`}function ld(e){return{...e,...e.skills?{skills:[...e.skills]}:{},description:{...e.description},children:e.children.map(ld)}}function ud(e){return{...e,steps:e.steps.map(ld)}}function dd(e,t){return e.kind===`unavailable`&&e.sessionId===t}function fd(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:ud(e)}:{kind:`unavailable`,sessionId:t})}).catch(e=>{o?.signal.aborted||a!==i||n!==t||c({kind:`error`,sessionId:t,error:cd(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`&&(sd(t.payload)||od(t.payload))){let n=od(t.payload)?t.payload.plan:t.payload;s=t.sequence,c({kind:`ready`,sessionId:e,plan:ud(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`):dd(r,t)?`chat`:null:null}catch(e){return n===t?a===o?(c({kind:`error`,sessionId:t,plan:i,error:cd(e)}),null):dd(r,t)?`chat`:null:null}},dispose(){o?.abort(),o=null,n=null,++i,c({kind:`unavailable`,sessionId:null})}}}function pd(e){if(!e)return null;let t=md(e.steps,e.currentStepId)?.measurement?.weeklyRemainingCurrent;return typeof t==`number`&&Number.isFinite(t)&&t>=0&&t<=100?Math.round(t):null}function md(e,t){for(let n of e){if(n.id===t)return n;let e=md(n.children,t);if(e)return e}}function hd(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 gd=q(`<a class="svelte-nywawl"><code class="svelte-nywawl"> </code></a>`),_d=q(`<code class="svelte-nywawl"> </code>`),vd=q(`<span class="notes svelte-nywawl"></span>`);function yd(e,t){Qe(t,!0);let n=$(t,`verifiedReferences`,19,()=>new Set),r=L(()=>t.text.split(/(=[^=\n]+=)/g));var i=vd();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=gd(),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=_d(),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),$e()}Rr([`click`]);function bd(e,t){return t===void 0?`L${e}`:`L${e}.${t}`}function xd(e){let t=e.steps.filter(e=>e.reviewStatus===`REVIEWED`).length,n=e.steps.length,r=Sd(e),i=e.steps.find(e=>e.state===`DONE`&&e.reviewStatus===`UNREVIEWED`);return i?{phase:`awaiting review`,label:`Awaiting ${bd(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 Sd(e){for(let[t,n]of e.steps.entries()){if(n.id===e.currentStepId)return{id:n.id,position:bd(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:bd(t+1,r+1),title:e.title,state:e.state}}}}var Cd=q(`<span class="wip-effort svelte-hmxg46"> </span>`),wd=q(`<li class="svelte-hmxg46"><span class="wip-position svelte-hmxg46" aria-hidden="true"> </span> <span class="wip-title svelte-hmxg46"> </span> <!></li>`),Td=q(`<ol class="wip-steps svelte-hmxg46" aria-label="Work in progress plan steps"></ol>`),Ed=q(`<li class="svelte-hmxg46"><span aria-hidden="true" class="position svelte-hmxg46"> </span> <span aria-hidden="true" class="state"> </span></li>`),Dd=q(`<ol class="step-markers svelte-hmxg46" aria-label="Plan step progress"></ol>`),Od=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 kd(e,t){Qe(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:bd(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:bd(t+1,n+1),state:e.state,level:e.level,title:e.title}))])),a=L(()=>G(i).filter(e=>e.state===`WIP`)),o=L(()=>xd(t.plan)),s=L(()=>Math.max(t.plan.totalSteps,1));var c=Od(),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=Td();Z(n,21,()=>G(a),e=>e.id,(e,n)=>{var r=wd(),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=Cd(),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=Dd();Z(n,21,()=>G(i),e=>e.id,(e,n)=>{var r=Ed(),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),$e()}var Ad=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>`),jd=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>`),Md=q(`<section aria-labelledby="plan-title" class="svelte-3rmyvg"><h2 id="plan-title" class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg"> </p></section>`),Nd=q(`<p class="svelte-3rmyvg"> </p>`),Pd=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Subtitle</dt> <dd class="svelte-3rmyvg"> </dd></div>`),Fd=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Date</dt> <dd class="svelte-3rmyvg"> </dd></div>`),Id=q(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Keywords</dt> <dd class="svelte-3rmyvg"> </dd></div>`),Ld=q(`<dl class="metadata svelte-3rmyvg"><!> <!> <!></dl>`),Rd=q(`<p class="svelte-3rmyvg">No plan steps have been retained yet.</p>`),zd=q(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg"> </strong> <!></p>`),Bd=q(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg">Skills:</strong> </p>`),Vd=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>`),Hd=q(`<ol class="svelte-3rmyvg"></ol>`),Ud=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>`),Wd=q(`<ol class="plan-steps svelte-3rmyvg"></ol>`),Gd=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>`),Kd=q(`<p class="visually-hidden svelte-3rmyvg" aria-live="polite" aria-atomic="true"> </p> <!>`,1);function qd(e,t){Qe(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)?xd(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 bd(n+1);let e=r.children.findIndex(e=>e.id===t);if(e>=0)return bd(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=Kd(),w=H(S),T=V(w,!0);P(w);var E=U(w,2),D=e=>{J(e,Ad())},ee=e=>{J(e,jd())},O=e=>{var n=Md(),r=U(V(n),2),i=V(r,!0);P(r),P(n),W(()=>Y(i,t.state.error)),J(e,n)},te=e=>{var n=Gd(),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);kd(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=Nd(),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=Ld(),n=V(t),r=e=>{var t=Pd(),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=Fd(),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=Id(),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,Rd())},O=e=>{var n=Wd();Z(n,23,()=>G(c).steps,e=>e.id,(e,n,i)=>{var o=Ud(),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=zd(),c=V(s),l=V(c);P(c),yd(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=Bd(),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),O=e=>{var o=Hd();Z(o,23,()=>G(n).children,e=>e.id,(e,n,o)=>{var s=Vd(),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=zd(),c=V(s),l=V(c);P(c),yd(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=Bd(),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),()=>bd(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(O)}),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),()=>bd(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(O,-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(O,2):G(c)&&e(te,3)}),W(()=>Y(T,G(p))),J(e,S),$e()}Rr([`click`]);var Jd=/^(\*+)\s+(?:(TODO|WIP|DONE)\s+)?(?:\[#([ABC])\]\s+)?(.+)$/,Yd=/^#\+([A-Z][A-Z0-9_-]*):\s*(.*)$/i,Xd=/^:([A-Z][A-Z0-9_]*):\s*(.*)$/,Zd=/^-\s+([^:]+?)\s+::\s*(.*)$/;function Qd(e){let t=[],n=[],r=[],i=e.replace(/\r\n?/g,`
|
|
25
|
+
`).split(`
|
|
26
|
+
`),a=null,o=!1,s=null,c=0,l=()=>{a&&r.push({...a,properties:[...a.properties],descriptions:[...a.descriptions],body:$d(a.body)})};for(let e of i){let r=Jd.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=Yd.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=Xd.exec(e);t&&a.properties.push([t[1],t[2].trim()]);continue}let i=Zd.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}${`
|
|
27
|
+
`.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:$d(n),sections:r}}function $d(e){let t=[...e];for(;t[0]?.trim()===``;)t.shift();for(;t.at(-1)?.trim()===``;)t.pop();return t}var ef=q(`<div class="svelte-h7gaqo"><dt class="svelte-h7gaqo"> </dt> <dd class="svelte-h7gaqo"><!></dd></div>`),tf=q(`<dl class="metadata svelte-h7gaqo"></dl>`),nf=q(`<p class="svelte-h7gaqo"><!></p>`),rf=q(`<p class="svelte-h7gaqo">This Org document has no headings.</p>`),af=q(`<h3 class="svelte-h7gaqo"> </h3>`),of=q(`<h4 class="svelte-h7gaqo"> </h4>`),sf=q(`<span> </span>`),cf=q(`<span class="priority svelte-h7gaqo"> </span>`),lf=q(`<dl class="descriptions svelte-h7gaqo"></dl>`),uf=q(`<p><!></p>`),df=q(`<details class="properties svelte-h7gaqo"><summary class="svelte-h7gaqo">Properties</summary> <dl class="svelte-h7gaqo"></dl></details>`),ff=q(`<section class="org-section svelte-h7gaqo"><div class="section-heading svelte-h7gaqo"><!> <!> <!></div> <!> <!> <!></section>`),pf=q(`<div class="sections svelte-h7gaqo"></div>`),mf=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 hf(e,t){Qe(t,!0);let n=$(t,`verifiedReferences`,19,()=>new Set),r=L(()=>Qd(t.preview.source)),i=L(()=>G(r).metadata.filter(([e])=>e!==`TITLE`));var a=mf(),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=tf();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=ef(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);yd(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=nf();yd(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,rf())},v=e=>{var i=pf();Z(i,23,()=>G(r).sections,(e,t)=>`${t}:${e.level}:${e.title}`,(e,r)=>{var i=ff();let a;var o=V(i),s=V(o),c=e=>{var t=af(),n=V(t,!0);P(t),W(()=>Y(n,G(r).title)),J(e,t)},l=e=>{var t=of(),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=sf(),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=cf(),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=lf();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=ef(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);yd(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=uf();let a;yd(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=df(),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=ef(),c=V(s),l=V(c,!0);P(c);var u=U(c,2),d=V(u);{let e=L(()=>o()||`—`);yd(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),$e()}Rr([`click`]);var gf=q(`<span> </span>`),_f=q(`<span class="subtitle svelte-x2ko9l"> </span>`),vf=q(`<div class="catalog-progress svelte-x2ko9l"><progress class="svelte-x2ko9l"> </progress> <span class="svelte-x2ko9l"> </span></div> <!>`,1),yf=q(`<span class="subtitle svelte-x2ko9l">Org document</span>`),bf=q(`<span class="archive-tag svelte-x2ko9l">Archived</span>`),xf=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>`),Sf=q(`<p>Waiting for the application workspace…</p>`),Cf=q(`<p>Finding Org plans…</p>`),wf=q(`<p> </p>`),Tf=q(`<p>No .org files were found in .gestalt folders below the application workspace.</p>`),Ef=q(`<ul aria-label="Unfinished plans" class="svelte-x2ko9l"></ul>`),Df=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>`),Of=q(`<p class="scope svelte-x2ko9l">Org plans in .gestalt folders below the application workspace.</p> <!> <!>`,1),kf=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 Af(e,t){Qe(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=xf(),l=V(c),u=V(l),d=V(u,!0);P(u);var f=U(u,2),p=V(f),g=e=>{var t=gf(),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=vf(),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=_f(),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,yf())};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,bf())};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}`);Na(E,{get label(){return G(e)},onclick:()=>m(n().planName),children:(e,t)=>{F();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));Na(e,{get label(){return G(i)},get disabled(){return G(a)},onclick:()=>h(n().planName),children:(e,t)=>{F();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=hd(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=>{hf(e,{get preview(){return t.state},onclose:p,get onreference(){return t.onreference},get verifiedReferences(){return G(i)}})},y=e=>{qd(e,{get state(){return t.state},onclose:p,get onreference(){return t.onreference},get verifiedReferences(){return G(i)}})},x=e=>{var r=kf(),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,Sf())},u=e=>{J(e,Cf())},p=e=>{var n=wf(),r=V(n,!0);P(n),W(()=>Y(r,t.catalog.error)),J(e,n)},m=e=>{J(e,Tf())},h=e=>{var t=Of(),r=U(H(t),2),i=e=>{var t=Ef();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=Df(),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),$e()}var jf=`settings`,Mf=`drafts`,Nf=`cursors`,Pf=`selected-session`,Ff={text:``,revision:0},If=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 Lf(e=globalThis.indexedDB){if(!e)return Rf;let t=Xc(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 Qc(await t,Mf,e,i)}catch{}});n.set(e,o),await o};return{async readSelectedSession(){try{return await Zc(await t,jf,Pf)??null}catch{return null}},async saveSelectedSession(e){try{let n=await t;e?await Qc(n,jf,Pf,e):await $c(n,jf,Pf)}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 Zc(await t,Mf,e),i=If(n)?n:typeof n==`string`?{text:n,revision:0}:Ff,a=r.get(e);return a&&a.revision>=i.revision?a:(r.set(e,i),i)}catch{return r.get(e)??Ff}},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)??Ff;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 Zc(await t,Mf,e);n=If(r)?r:typeof r==`string`?{text:r,revision:0}:Ff}catch{n=Ff}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 Qc(await t,Mf,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 Zc(await t,Nf,e);return typeof n==`number`&&Number.isSafeInteger(n)&&n>=0?n:0}catch{return 0}},async saveCursor(e,n){try{await Qc(await t,Nf,e,n)}catch{}}}}var Rf={readSelectedSession:async()=>null,saveSelectedSession:async()=>{},readDraft:async()=>``,saveDraft:async()=>{},readDraftEnvelope:async()=>Ff,saveDraftEnvelope:async()=>{},replaceDraftText:async()=>{},addPendingDraftOperation:async()=>{},consumeAcceptedDraft:async()=>null,readCursor:async()=>0,saveCursor:async()=>{}};function zf(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 Bf(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 Vf(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 Hf(e){let t=/^\/home\/[^/]+/.exec(e)?.[0];if(!t)return e;let n=e.slice(t.length);return n?`~${n}`:`~/`}var Uf=[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],Wf=(e,t=b)=>{var n=Jf(),r=H(n),i=e=>{J(e,Gf())};X(r,e=>{(t().plan||t().lastOrgPlan?.attached)&&e(i)});var a=U(r,2),o=e=>{var n=Kf(),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(a,e=>{t().lastOrgPlan&&e(o)});var s=U(a,2),c=e=>{var n=qf(),r=V(n);{let e=L(()=>`Plan progress for ${t().plan.title}`);kd(r,{compact:!0,get plan(){return t().plan},get label(){return G(e)}})}P(n),J(e,n)};X(s,e=>{t().plan&&e(c)}),J(e,n)},Gf=q(`<span class="profile-badge svelte-hxb22h">Org plan attached</span>`),Kf=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>`),qf=q(`<div class="session-plan-progress svelte-hxb22h"><!></div>`),Jf=q(`<!> <!> <!>`,1),Yf=q(`<details class="session-verdict svelte-hxb22h"><summary class="svelte-hxb22h"><span aria-hidden="true"></span> </summary> <p class="svelte-hxb22h"> </p></details>`),Xf=q(`<time class="svelte-hxb22h"> </time>`),Zf=q(`<div class="svelte-hxb22h"> </div>`),Qf=q(`<span class="profile-badge svelte-hxb22h"> </span>`),$f=q(`<span class="profile-badge svelte-hxb22h">Kimi</span>`),ep=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>`),tp=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>`),np=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>`),rp=q(`<ul class="session-list svelte-hxb22h" aria-label="Saved sessions"></ul>`),ip=q(`<p class="svelte-hxb22h">No saved sessions yet.</p>`),ap=q(`<option class="svelte-hxb22h"> </option>`),op=q(`<option class="svelte-hxb22h">Loading models…</option>`),sp=q(`<option class="svelte-hxb22h">Choose automatically</option>`),cp=q(`<p class="skills-profile-error svelte-hxb22h" role="alert"> </p>`),lp=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>`),up=q(`<label for="model-thinking" class="svelte-hxb22h">Model thinking <select id="model-thinking" class="svelte-hxb22h"></select></label>`),dp=q(`<label for="sandbox" class="svelte-hxb22h">Sandbox</label> <label for="approval-policy" class="svelte-hxb22h">Approval policy</label>`,1),fp=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),pp=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>`),mp=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>`),gp=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 _p(e,t){Qe(t,!0);let n=$(t,`activitySnapshots`,19,()=>new Map),r=$(t,`autopilotSnapshots`,19,()=>new Map),i=$(t,`autopilotPending`,19,()=>new Set),a=$(t,`autopilotAttention`,19,()=>new Map),o=$(t,`models`,19,()=>[]),s=$(t,`selectedModel`,3,``),c=$(t,`reasoningEffort`,3,`medium`),l=$(t,`executorModels`,19,()=>[]),u=$(t,`executorModel`,3,`gpt-5.6-terra`),d=$(t,`executorReasoningEffort`,3,`high`),f=$(t,`onreasoningchange`,3,()=>{}),p=$(t,`onexecutormodelchange`,3,()=>{}),m=$(t,`onexecutorreasoningchange`,3,()=>{}),h=$(t,`provider`,3,`codex`),g=$(t,`kimiAvailable`,3,!1),_=$(t,`modelsLoading`,3,!1),v=$(t,`onmodelchange`,3,()=>{}),y=$(t,`onproviderchange`,3,()=>{}),b=$(t,`onautopilottoggle`,3,()=>{}),x=$(t,`onactivityopen`,3,()=>{}),S=$(t,`onautopilotresolve`,3,()=>{}),C=$(t,`savingDefaults`,3,!1),w=$(t,`advancedExpanded`,15,!1),T=$(t,`onsavedefaults`,3,()=>{}),E=L(()=>t.sessions.filter(e=>e.state===`ready`||e.state===`turnActive`)),D=L(()=>t.sessions.filter(e=>e.state!==`ready`&&e.state!==`turnActive`)),ee=L(()=>t.recentSessions.filter(e=>!G(E).some(t=>t.threadId===e.id&&(t.provider??`codex`)===(e.provider??`codex`)))),O=L(()=>wu(t.workspaceTree,t.workspaceId)),te=z(null),ne=z(null);function re(e){B(ne,e,!0),G(te)?.showModal()}var ie=gp(),ae=H(ie),oe=U(V(ae),4),se=V(oe);Na(se,{onclick:()=>G(te)?.close(),children:(e,t)=>{F(),J(e,Gr(`Cancel`))},$$slots:{default:!0}}),Na(U(se,2),{primary:!0,onclick:()=>{G(ne)&&t.onclose(G(ne)),G(te)?.close()},children:(e,t)=>{F(),J(e,Gr(`Close session`))},$$slots:{default:!0}}),P(oe),P(ae),Ui(ae,e=>B(te,e),()=>G(te));var ce=U(ae,2),le=U(V(ce),2),k=e=>{var s=tp(),c=U(V(s),2);Z(c,21,()=>G(E),e=>e.id,(e,s)=>{let c=L(()=>Bf(G(s))),l=L(()=>$l(G(s).sessionStatus)?G(s).sessionStatus:null);var u=ep();let d;var f=V(u),p=V(f);{let e=L(()=>G(s).id===t.selectedSessionId?`page`:void 0);Na(p,{compact:!0,full:!0,get current(){return G(e)},onclick:()=>t.onselectopen(G(s).id),children:(e,t)=>{F(),J(e,Gr(`Open`))},$$slots:{default:!0}})}var m=U(p,2),h=e=>{Na(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(G(s).resumeCommand),children:(e,t)=>{F(),J(e,Gr(`Copy CLI`))},$$slots:{default:!0}})};X(m,e=>{G(s).resumeCommand&&G(s).provider!==`kimi`&&e(h)});var g=U(m,2),_=e=>{{let t=L(()=>r().get(G(s).id)??G(s).autopilot??null),n=L(()=>`session-autopilot-${G(s).id}`),a=L(()=>i().has(G(s).id));po(e,{compact:!0,indicatorOnly:!0,get autopilot(){return G(t)},get controlId(){return G(n)},get pending(){return G(a)},ontoggle:e=>b()(G(s).id,e)})}};X(g,e=>{G(s).provider!==`kimi`&&e(_)});var v=U(g,2);{let e=L(()=>n().get(G(s).id)??G(s).agentActivity??null),t=L(()=>G(s).model??o()?.[0]);Ga(v,{compact:!0,get activity(){return G(e)},get rootModel(){return G(t)},get plan(){return G(s).plan},onopen:()=>x()(G(s).id)})}Na(U(v,2),{compact:!0,full:!0,onclick:()=>re(G(s).id),children:(e,t)=>{F(),J(e,Gr(`Close`))},$$slots:{default:!0}}),P(f);var y=U(f,2),C=V(y),w=V(C),T=e=>{var t=Yf(),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(l).state),Q(t,`aria-label`,`${G(l).state===`working`?`Working`:`Idle`}: ${G(l).reason}`),Q(n,`aria-label`,`${G(l).state===`working`?`Working`:`Idle`}: ${G(l).reason}`),i=Si(r,1,`verdict-dot svelte-hxb22h`,null,i,{live:G(l).state===`working`&&G(l).confidence===`fresh`}),Y(a,` ${G(l).state===`working`?`Working`:`Idle`}`),Y(s,`${G(l).reason??``}. ${G(l).nextExpectedAction??``}
|
|
28
|
+
Evidence confidence: ${G(l).confidence??``}.`)}),J(e,t)};X(w,e=>{G(l)&&e(T)});var E=U(w,2),D=e=>{var t=Xf(),n=V(t,!0);P(t),W((e,r)=>{Q(t,`datetime`,e),Y(n,r)},[()=>new Date(G(c).updatedAt).toISOString(),()=>zf(G(c).updatedAt)]),J(e,t)},ee=e=>{var t=Zf(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>zf(null)]),J(e,t)};X(E,e=>{G(c).updatedAt===null?e(ee,-1):e(D)});var O=U(E,2),te=V(O,!0);P(O);var ne=U(O,2),ie=e=>{var t=Qf(),n=V(t);P(t),W(()=>Y(n,`Model: ${G(s).model??``}`)),J(e,t)};X(ne,e=>{G(s).model&&e(ie)});var ae=U(ne,2),oe=e=>{J(e,$f())};X(ae,e=>{G(s).provider===`kimi`&&e(oe)});var se=U(ae,2),ce=e=>{var t=Qf(),n=V(t);P(t),W(()=>Y(n,`Branch: ${G(s).branch??``}`)),J(e,t)};X(se,e=>{G(s).branch&&e(ce)});var le=U(se,2),k=e=>{var t=Qf(),n=V(t);P(t),W(()=>Y(n,`Skills profile: ${G(s).effectiveSkillSelection.selectedProfileName??``}`)),J(e,t)};X(le,e=>{G(s).effectiveSkillSelection?.selectedProfileName&&e(k)}),Wf(U(le,2),()=>G(s)),P(C);var A=U(C,2);{let e=L(()=>a().get(G(s).id)??null),t=L(()=>`session-attention-${G(s).id}`),n=L(()=>i().has(G(s).id));_o(A,{get attention(){return G(e)},get controlId(){return G(t)},get pending(){return G(n)},onresolve:(e,t)=>S()(G(s).id,e,t)})}var ue=U(A,2);{let e=L(()=>r().get(G(s).id)??G(s).autopilot??null),t=L(()=>a().get(G(s).id)??null),n=L(()=>`session-autopilot-safety-${G(s).id}`),o=L(()=>i().has(G(s).id));yo(ue,{get autopilot(){return G(e)},get attention(){return G(t)},get controlId(){return G(n)},get pending(){return G(o)},onrecover:()=>b()(G(s).id,!0),ondisable:()=>b()(G(s).id,!1)})}P(y),P(u),W(e=>{d=Si(u,1,`managed-session open-session svelte-hxb22h`,null,d,{"current-session":G(s).id===t.selectedSessionId}),Y(te,e)},[()=>Hf(G(c).workspacePath)]),J(e,u)}),P(c),P(s),J(e,s)};X(le,e=>{G(E).length&&e(k)});var A=U(le,2),ue=e=>{var n=rp();Z(n,21,()=>G(D),e=>e.id,(e,n)=>{let r=L(()=>Bf(G(n)));var i=np(),a=V(i),o=V(a);{let e=L(()=>t.openingSessionId===G(n).id);Na(o,{compact:!0,full:!0,get disabled(){return G(e)},onclick:()=>t.onopen(G(n).id),children:(e,r)=>{F();var i=Gr();W(()=>Y(i,t.openingSessionId===G(n).id?`Opening…`:`Open`)),J(e,i)},$$slots:{default:!0}})}var s=U(o,2),c=e=>{Na(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(G(n).resumeCommand),children:(e,t)=>{F(),J(e,Gr(`Copy CLI`))},$$slots:{default:!0}})};X(s,e=>{G(n).resumeCommand&&G(n).provider!==`kimi`&&e(c)}),Na(U(s,2),{compact:!0,full:!0,onclick:()=>t.onforget(G(n).id),children:(e,t)=>{F(),J(e,Gr(`Forget`))},$$slots:{default:!0}}),P(a);var l=U(a,2),u=V(l),d=e=>{var t=Xf(),n=V(t,!0);P(t),W((e,r)=>{Q(t,`datetime`,e),Y(n,r)},[()=>new Date(G(r).updatedAt).toISOString(),()=>zf(G(r).updatedAt)]),J(e,t)},f=e=>{var t=Zf(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>zf(null)]),J(e,t)};X(u,e=>{G(r).updatedAt===null?e(f,-1):e(d)});var p=U(u,2),m=V(p,!0);P(p);var h=U(p,2),g=e=>{var t=Qf(),r=V(t);P(t),W(()=>Y(r,`Model: ${G(n).model??``}`)),J(e,t)};X(h,e=>{G(n).model&&e(g)});var _=U(h,2),v=e=>{J(e,$f())};X(_,e=>{G(n).provider===`kimi`&&e(v)});var y=U(_,2),b=e=>{var t=Qf(),r=V(t);P(t),W(()=>Y(r,`Branch: ${G(n).branch??``}`)),J(e,t)};X(y,e=>{G(n).branch&&e(b)});var x=U(y,2),S=e=>{var t=Qf(),r=V(t);P(t),W(()=>Y(r,`Skills profile: ${G(n).effectiveSkillSelection.selectedProfileName??``}`)),J(e,t)};X(x,e=>{G(n).effectiveSkillSelection?.selectedProfileName&&e(S)}),Wf(U(x,2),()=>G(n)),P(l),P(i),W(e=>Y(m,e),[()=>Hf(G(r).workspacePath)]),J(e,i)}),P(n),J(e,n)},de=e=>{J(e,ip())};X(A,e=>{G(D).length?e(ue):G(E).length||e(de,1)});var fe=U(A,2),pe=U(V(fe),2),me=V(pe);{let e=L(()=>G(O)?.id??null);Mu(me,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return G(e)},get isSelectable(){return yu.sessionBase},label:`Session base`,get onexpandedchange(){return t.onexpandedchange},onselect:e=>t.onworkspacechange(e.id)})}P(pe);var he=U(pe,2),ge=V(he),_e=U(V(ge)),ve=V(_e);ve.value=ve.__value=``,Z(U(ve),17,()=>t.skillProfiles,e=>e.name,(e,t)=>{var n=ap(),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(_e);var ye;Ei(_e),P(ge);var be=U(ge,2),j=U(V(be)),xe=V(j),Se=e=>{var t=op();t.value=t.__value=``,J(e,t)},Ce=e=>{var t=sp();t.value=t.__value=``,J(e,t)};X(xe,e=>{_()?e(Se):o().length===0&&e(Ce,1)}),Z(U(xe),16,o,e=>e,(e,t)=>{var n=ap(),r=V(n,!0);P(n);var i={};W(()=>{Y(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),J(e,n)}),P(j);var we;Ei(j),P(be),P(he);var Te=U(he,2),Ee=e=>{var n=cp(),r=V(n,!0);P(n),W(()=>Y(r,t.skillProfileError)),J(e,n)};X(Te,e=>{t.skillProfileError&&e(Ee)});var De=U(Te,2),Oe=U(V(De),2),ke=V(Oe),Ae=V(ke),je=V(Ae),Me=e=>{var t=lp(),n=U(V(t),2),r=U(V(n));Z(r,20,()=>[...new Set([u(),...l()])],e=>e,(e,t)=>{var n=ap(),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,()=>Uf,e=>e,(e,t)=>{var n=ap(),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=u())&&(r.value=(r.__value=u())??``,Ti(r,u())),s!==(s=d())&&(o.value=(o.__value=d())??``,Ti(o,d()))}),K(`change`,r,e=>p()(e.currentTarget.value)),K(`change`,o,e=>m()(e.currentTarget.value)),J(e,t)};X(je,e=>{h()===`codex`&&e(Me)});var Ne=U(je,2),Pe=U(V(Ne),2),Fe=e=>{var t=up(),n=U(V(t));Z(n,20,()=>Uf,e=>e,(e,t)=>{var n=ap(),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=c())&&(n.value=(n.__value=c())??``,Ti(n,c()))}),K(`change`,n,e=>f()(e.currentTarget.value)),J(e,t)};X(Pe,e=>{h()===`codex`&&e(Fe)});var Ie=U(Pe,2),Le=U(V(Ie),2),Re=V(Le);Re.value=Re.__value=`codex`;var ze=U(Re),M=V(ze);P(ze),ze.value=ze.__value=`kimi`,P(Le);var Be;Ei(Le),P(Ie),P(Ne),P(Ae);var N=U(Ae,2);let Ve;var He=V(N),Ue=e=>{var t=dp();F(2),J(e,t)};X(He,e=>{h()!==`kimi`&&e(Ue)}),P(N);var We=U(N,2);let Ge;var Ke=V(We),qe=e=>{var n=fp(),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(Ke,e=>{h()!==`kimi`&&e(qe)}),P(We);var Je=U(We,2),Ye=V(Je);Na(Ye,{class:`manage-profiles-button`,id:`manage-skill-profiles`,onclick:e=>t.onmanageprofiles(e.currentTarget),children:(e,t)=>{F(),J(e,Gr(`Manage skill profiles`))},$$slots:{default:!0}});var Xe=U(Ye,2);{let e=L(()=>C()||_()||!s());Na(Xe,{class:`save-defaults-button`,get disabled(){return G(e)},get onclick(){return T()},children:(e,t)=>{F();var n=Gr();W(()=>Y(n,C()?`Saving…`:`Save as defaults`)),J(e,n)},$$slots:{default:!0}})}P(Je),P(ke),P(Oe),P(De);var Ze=U(De,2),et=V(Ze);{let e=L(()=>!G(O)||t.startingSession||_()||o().length>0&&!s());Na(et,{class:`new-session-button`,type:`submit`,full:!0,primary:!0,get disabled(){return G(e)},children:(e,n)=>{F();var r=Gr();W(()=>Y(r,t.startingSession?`Creating…`:`Create session`)),J(e,r)},$$slots:{default:!0}})}P(Ze),P(fe);var tt=U(fe,2),nt=U(V(tt),2),rt=e=>{var n=mp();Z(n,21,()=>G(ee),e=>(e.provider??`codex`)+`:`+e.id,(e,n)=>{var r=pp(),i=V(r),a=V(i),o=e=>{var t=Xf(),r=V(t,!0);P(t),W((e,n)=>{Q(t,`datetime`,e),Y(r,n)},[()=>new Date(G(n).recencyAt*1e3).toISOString(),()=>zf(G(n).recencyAt*1e3)]),J(e,t)},s=e=>{var t=Zf(),n=V(t,!0);P(t),W(e=>Y(n,e),[()=>zf(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=Qf(),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,$f())};X(f,e=>{G(n).provider===`kimi`&&e(p)});var m=U(f,2),h=e=>{var t=Qf(),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=Qf(),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);Na(y,{onclick:()=>t.onopenrecent(G(n)),children:(e,t)=>{F(),J(e,Gr(`Open`))},$$slots:{default:!0}});var b=U(y,2),x=e=>{Na(e,{onclick:()=>t.oncopyresume(G(n).resumeCommand),children:(e,t)=>{F(),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),[()=>Hf(G(n).cwd)]),J(e,r)}),P(n),J(e,n)},it=e=>{J(e,hp())};X(nt,e=>{G(ee).length?e(rt):e(it,-1)}),P(tt),P(ce),W(()=>{ye!==(ye=t.selectedSkillProfile)&&(_e.value=(_e.__value=t.selectedSkillProfile)??``,Ti(_e,t.selectedSkillProfile)),j.disabled=_()||o().length===0,we!==(we=s())&&(j.value=(j.__value=s())??``,Ti(j,s())),ze.disabled=!g(),Y(M,`Kimi${g()?``:` (unavailable)`}`),Be!==(Be=h())&&(Le.value=(Le.__value=h())??``,Ti(Le,h())),Ve=wi(N,``,Ve,{"grid-template-columns":h()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`}),Ge=wi(We,``,Ge,{"grid-template-columns":h()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`})}),Lr(`close`,ae,()=>B(ne,null)),Lr(`submit`,fe,e=>{e.preventDefault(),t.onstart()}),K(`change`,_e,e=>t.onskillprofilechange(e.currentTarget.value)),K(`change`,j,e=>v()(e.currentTarget.value)),K(`change`,Le,e=>y()(e.currentTarget.value)),Wi(`open`,`toggle`,De,w,w),J(e,ie),$e()}Rr([`change`]);function vp(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 yp=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 bp({chatEnabled:e}){return[`sessions`,`git`,...e?[`chat`]:[],`plan`]}function xp(e,t,n={chatEnabled:!0}){let r=bp(n);return r[(r.indexOf(e)+t+r.length)%r.length]}var Sp=q(`<nav class="bottom-navigation" aria-label="Primary"><button>Sessions</button> <button>Git</button> <button>Chat</button> <button>Plan</button></nav>`);function Cp(e,t){Qe(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=xp(t.activeTab,n,{chatEnabled:t.chatEnabled});t.onselect(i),r[i]?.focus()}var a=Sp(),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),$e()}Rr([`keydown`,`click`]);var wp=q(`<option> </option>`),Tp=q(`<p id="skills-status" aria-live="polite">Loading skills…</p>`),Ep=q(`<p id="skills-status">No skills were discovered for this workspace and Codex profile.</p>`),Dp=q(`<p id="skills-status" class="notice svelte-dg6sjj" role="status"> </p>`),Op=q(`<p id="skills-status" class="error svelte-dg6sjj" role="alert"> </p>`),kp=q(`<p id="skills-status" class="error svelte-dg6sjj" role="alert" tabindex="-1"> </p>`),Ap=q(`<p id="skills-status" role="status">Profile saved.</p>`),jp=q(`<p id="skills-status" role="status">Profile deleted.</p>`),Mp=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>`),Np=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
|
|
29
|
+
removed from the profile.</p> <ul class="svelte-dg6sjj"></ul></section>`),Pp=q(`<p class="svelte-dg6sjj"> </p>`),Fp=q(`<li> </li>`),Ip=q(`<dt class="svelte-dg6sjj">Tool dependencies</dt> <dd class="svelte-dg6sjj"><ul class="svelte-dg6sjj"></ul></dd>`,1),Lp=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>`),Rp=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),zp=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 Bp(e,t){Qe(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=zp(),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 O=U(ee);O.value=O.__value=`__default__`,Z(U(O),17,()=>G(d),e=>e.name,(e,t)=>{var n=wp(),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 te=U(D,4);Ni(te),P(E);var ne=U(E,2),re=V(ne,!0);P(ne);var ie=U(ne,2),ae=V(ie);Ui(ae,e=>B(s,e),()=>G(s));var oe=U(ae,2),se=V(oe,!0);P(oe),P(ie),P(T);var ce=U(T,2),le=U(V(ce),2),k=V(le);P(le);var A=U(le,2),ue=V(A),de=U(ue,2);P(A),P(ce),Ui(ce,e=>B(c,e),()=>G(c));var fe=U(ce,2),pe=e=>{J(e,Tp())},me=e=>{J(e,Ep())},he=e=>{var t=Dp(),n=V(t);P(t),W(()=>Y(n,`Discovery warning: ${G(u).status.message??``}`)),J(e,t)},ge=e=>{var t=Op(),n=V(t,!0);P(t),W(()=>Y(n,G(u).status.message)),J(e,t)},_e=e=>{var t=kp(),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,Ap())},ye=e=>{J(e,jp())},be=e=>{var t=Op(),n=V(t,!0);P(t),W(()=>Y(n,G(u).status.message)),J(e,t)};X(fe,e=>{G(u).status.kind===`loading`?e(pe):G(u).status.kind===`empty`?e(me,1):G(u).status.kind===`warning`?e(he,2):G(u).status.kind===`invalid-profile`||G(u).status.kind===`error`?e(ge,3):G(u).status.kind===`save-failed`?e(_e,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 j=U(fe,2),xe=e=>{var t=Rp(),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=Np(),n=U(V(t),4);Z(n,21,()=>G(u).missingSkills,e=>e.path,(e,t)=>{var n=Mp(),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=Lp();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=Pp(),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=Pp(),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=Ip(),r=U(H(n),2),i=V(r);Z(i,21,()=>G(t).dependencies.tools,e=>`${e.type}:${e.value}`,(e,t)=>{var n=Fp(),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(j,e=>{(G(u).skills.length>0||G(u).missingSkills.length>0)&&e(xe)}),P(S),W(()=>{Y(w,r()),Pi(te,G(u).saveAsName),Y(re,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(k,`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`,te,e=>{G(u).saveAsName=e.currentTarget.value,f()}),K(`click`,ae,g),K(`click`,ue,()=>void v()),K(`click`,de,()=>void _()),J(e,S),$e()}Rr([`change`,`input`,`click`]);var Vp=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=>!Hp(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:Up(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:Up(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:Up(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:Up(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 Hp(e){return e.startsWith(`gestalt:`)}function Up(e){return e instanceof Error?e.message:`Unknown relay error.`}var Wp=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),Gp=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)}})),Kp=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}}})),qp=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})),Jp=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})),Yp=o((e=>{var t=Gp().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}})),Xp=o((e=>{var t=Gp().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Zp=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}})),Qp=o((e=>{var t=Kp(),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}}})),$p=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]]}})),em=o((e=>{var t=$p();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}})),tm=o(((e,t)=>{var n=em();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})),nm=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),rm=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
|
|
30
|
+
]))+`;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)}})),im=o((e=>{var t=nm(),n=rm();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}}})),am=o((e=>{var t=Gp(),n=Qp(),r=Kp(),i=im(),a=nm(),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}})),om=o((e=>{var t=Gp(),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}})),sm=o(((e,t)=>{var n=im();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})),cm=o(((e,t)=>{var n=im(),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})),lm=o(((e,t)=>{var n=im();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})),um=o(((e,t)=>{var n=im(),r=Gp();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]+`
|
|
31
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),dm=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)})),fm=o((e=>{var t=im(),n=sm(),r=cm(),i=lm(),a=um(),o=rm(),s=Gp(),c=dm();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)+`.
|
|
32
|
+
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()))}})),pm=o((e=>{var t=Gp(),n=Kp(),r=qp(),i=Jp(),a=Yp(),o=Xp(),s=Zp(),c=Qp(),l=tm(),u=am(),d=om(),f=im(),p=fm();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(`
|
|
33
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
34
|
+
Minimum version required to store current data is: `+c+`.
|
|
35
|
+
`);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)}})),mm=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=mm();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)}})),gm=o((e=>{var t=mm();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>
|
|
36
|
+
`;return typeof a==`function`&&a(null,p),p}})),_m=c(o((e=>{var t=Wp(),n=pm(),r=hm(),i=gm();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 vm(e){return`${e.replace(/\/$/,``)}/?bootstrap=1`}async function ym(e){return _m.toDataURL(vm(e),{errorCorrectionLevel:`M`,margin:1,width:256})}async function bm(e){return _m.toDataURL(e,{errorCorrectionLevel:`M`,margin:1,width:256})}var xm=q(`<p class="feedback svelte-1nygetn" role="status"> </p>`),Sm=q(`<span class="svelte-1nygetn">At least one authorized device is required.</span>`),Cm=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>`),wm=q(`<ul aria-label="Authorized devices" class="svelte-1nygetn"></ul>`),Tm=q(`<p role="status" class="svelte-1nygetn">No authorized devices are available. Refresh this page before making changes.</p>`),Em=q(`<button type="button" class="svelte-1nygetn">Create enrollment link</button>`),Dm=q(`<img alt="QR code for the enrollment link" class="svelte-1nygetn"/>`),Om=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),km=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 Am(e,t){Qe(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 bm(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 O=km(),te=H(O),ne=V(te),re=V(ne);F(2),P(ne);var ie=U(ne,2),ae=e=>{var t=xm(),n=V(t,!0);P(t),W(()=>Y(n,G(i))),J(e,t)};X(ie,e=>{G(i)&&e(ae)});var oe=U(ie,2),se=e=>{var t=wm();Z(t,21,()=>G(f),e=>e.id,(e,t)=>{var n=Cm(),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=Sm();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,Tm())};X(oe,e=>{G(f).length?e(se):e(ce,-1)});var le=U(oe,2),k=U(V(le),2),A=e=>{var t=Em();K(`click`,t,()=>void x()),J(e,t)},ue=e=>{var t=Om(),r=H(t),i=V(r,!0);P(r);var c=U(r,2),l=e=>{var t=Dm();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(k,e=>{G(a)?e(ue,-1):e(A)}),P(le),P(te);var de=U(te,2),fe=U(V(de),4),pe=U(V(fe));P(fe),P(de),Ui(de,e=>B(c,e),()=>G(c)),K(`click`,re,function(...e){t.onclose?.apply(this,e)}),K(`click`,pe,()=>void E()),J(e,O),$e()}Rr([`click`]);async function jm(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 Mm(e){return{list:()=>jm(e(`/api/auth/devices`,{credentials:`same-origin`})),rename:(t,n)=>jm(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({nickname:n})})),revoke:t=>jm(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:`same-origin`})),createTicket:()=>jm(e(`/api/auth/enrollment-tickets`,{method:`POST`,credentials:`same-origin`})),ticketStatus:()=>jm(e(`/api/auth/enrollment-tickets/current`,{credentials:`same-origin`})),cancelTicket:()=>jm(e(`/api/auth/enrollment-tickets/current`,{method:`DELETE`,credentials:`same-origin`}))}}var Nm=`gestalt-mobile.scratchpad`;function Pm(){try{return window.localStorage}catch{return null}}function Fm(e){try{return e?.getItem(`gestalt-mobile.scratchpad`)??``}catch{return``}}function Im(e,t){try{return e?(e.setItem(Nm,t),!0):!1}catch{return!1}}function Lm(e){try{return e?(e.removeItem(Nm),!0):!1}catch{return!1}}var Rm=q(`<p class="feedback svelte-eu5bnq" role="status"> </p>`),zm=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>`),Bm=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>`),Vm=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 Hm(e,t){Qe(t,!0);let n=$(t,`storage`,19,Pm),r=$(t,`clipboard`,19,()=>globalThis.navigator?.clipboard),i=z(null),a=z(null),o=z(null),s=z(``),c=z(!1),l=z(``);Gi(async()=>{B(s,Fm(n()),!0),await Tr(),G(i)?.showModal(),G(a)?.focus()});function u(e){B(s,e,!0),B(l,Im(n(),e)?``:`This browser could not save the scratchpad. Keep this window open until you copy the text.`,!0)}async function d(){if(!r()?.readText){B(l,`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(s).length,n=G(a)?.selectionEnd??G(s).length;u(`${G(s).slice(0,t)}${e}${G(s).slice(n)}`),await Tr();let i=t+e.length;G(a)?.focus(),G(a)?.setSelectionRange(i,i)}catch{B(l,`Clipboard paste was not permitted. Long-press the text field and choose Paste.`),G(a)?.focus()}}async function f(){B(c,!0),B(l,``),await Tr(),G(o)?.focus()}function p(){B(c,!1),G(a)?.focus()}function m(){if(!Lm(n())){B(l,`This browser could not clear its saved scratchpad.`);return}B(s,``),B(c,!1),B(l,``),G(a)?.focus()}var h=Vm(),g=V(h),_=V(g),v=U(V(_),2);P(_);var y=U(_,4);Sn(y),Ui(y,e=>B(a,e),()=>G(a));var b=U(y,2),x=e=>{var t=Rm(),n=V(t,!0);P(t),W(()=>Y(n,G(l))),J(e,t)};X(b,e=>{G(l)&&e(x)});var S=U(b,2),C=e=>{var t=zm(),n=U(V(t),4),r=V(n);Ui(r,e=>B(o,e),()=>G(o));var i=U(r,2);P(n),P(t),K(`click`,r,p),K(`click`,i,m),J(e,t)},w=e=>{var t=Bm(),n=V(t),r=U(n,2),o=U(r,2),c=U(o,2);P(t),W(()=>o.disabled=!G(s)),K(`click`,n,()=>void d()),K(`click`,r,()=>G(a)?.select()),K(`click`,o,()=>void f()),K(`click`,c,()=>G(i)?.close()),J(e,t)};X(S,e=>{G(c)?e(C):e(w,-1)}),P(g),P(h),Ui(h,e=>B(i,e),()=>G(i)),W(()=>Pi(y,G(s))),Lr(`close`,h,function(...e){t.onclose?.apply(this,e)}),K(`click`,v,()=>G(i)?.close()),K(`input`,y,e=>u(e.currentTarget.value)),J(e,h),$e()}Rr([`click`,`input`]);var Um=e=>typeof e==`object`&&e?Object.entries(e):[],Wm=(e,t)=>`${e}/${JSON.stringify(t)}`;function Gm(e){let t=new Set,n=[{value:e,id:``}];for(;n.length;){let e=n.pop(),r=Um(e.value);if(r.length){t.add(e.id);for(let[t,i]of r)n.push({value:i,id:Wm(e.id,t)})}}return t}function Km(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=Um(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:Wm(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 qm=q(`<button type="button" class="svelte-7x7m8l"> </button>`),Jm=q(`<div class="json-row svelte-7x7m8l"><span class="fold-column svelte-7x7m8l"><!></span> <code class="svelte-7x7m8l"> </code></div>`),Ym=q(`<div class="json-tree svelte-7x7m8l" aria-label="JSON contents"></div>`);function Xm(e,t){Qe(t,!0);let n=$(t,`unfolded`,3,!1),r=L(()=>JSON.parse(t.text)),i=L(()=>n()?Gm(G(r)):new Set([``])),a=L(()=>Km(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=Ym();Z(s,21,()=>G(a),e=>e.id,(e,t)=>{var n=Jm(),r=V(n),i=V(r),a=e=>{var n=qm(),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),$e()}Rr([`click`]);var Zm=q(`<button class="disclosure svelte-am0nvt" type="button"> </button>`),Qm=q(`<span class="disclosure svelte-am0nvt"></span>`),$m=q(`<span class="unsupported svelte-am0nvt">Files cannot be destinations</span>`),eh=q(`<span class="unsupported svelte-am0nvt">Unsupported link</span>`),th=q(`<span role="status">Loading…</span>`),nh=q(`<button type="button" class="svelte-am0nvt"> </button>`),rh=q(`<div role="group"><!> <!> <!> <!></div>`),ih=q(`<div role="treeitem"><div class="tree-row svelte-am0nvt" role="presentation"><!> <span class="tree-label svelte-am0nvt"> </span><!></div> <!></div>`),ah=q(`<p role="status">Loading files…</p>`),oh=q(`<button type="button" class="svelte-am0nvt">Retry loading files</button>`),sh=q(`<button type="button" class="svelte-am0nvt">Load more in root</button>`),ch=q(`<div class="file-tree svelte-am0nvt" role="tree" aria-label="Files"><!> <!> <!> <!></div>`);function lh(e,t){Qe(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=ch();{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=ih();let b;var x=V(y);let S;var C=V(x),w=e=>{var t=Zm(),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,Qm())};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),O=e=>{J(e,$m())},te=e=>{var t=eh();W(()=>Q(t,`id`,`${G(i).path}-unsupported`)),J(e,t)};X(ee,e=>{r()&&!G(g)?e(O):G(i).kind===`symlink`&&e(te,1)}),P(x);var ne=U(x,2),re=n=>{let r=L(()=>u(G(i).path));var o=rh(),s=V(o),c=e=>{J(e,th())};X(s,e=>{G(r).loading&&e(c)});var l=U(s,2),d=e=>{var n=nh(),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=nh(),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)},ie=L(()=>G(g)&&d(G(i).path));X(ne,e=>{G(ie)&&e(re)}),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,ah())};X(_,e=>{G(c).loading&&e(v)});var y=U(_,2),x=e=>{var r=oh();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=sh();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),$e()}Rr([`keydown`,`click`]);var uh=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?dh(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 dh(e,t){let n=new Set(e.map(e=>e.path));return[...e,...t.filter(e=>!n.has(e.path))]}function fh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ph=fh();function mh(e){ph=e}var hh={exec:()=>null};function gh(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 _h(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 vh=((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:gh(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:gh(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:gh(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:gh(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:gh(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ph})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:gh(e=>RegExp(`^ {0,${e}}>`))},bh=/^(?:[ \t]*(?:\n|$))+/,xh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ch=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Th=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Eh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dh=_h(Eh).replace(/bull/g,Th).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(),Oh=_h(Eh).replace(/bull/g,Th).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(),kh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ah=/^[^\n]+/,jh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Mh=_h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,jh).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nh=_h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Th).getRegex(),Ph=`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`,Fh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ih=_h(`^ {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`,Fh).replace(`tag`,Ph).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Lh=e=>_h(kh).replace(`hr`,Ch).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`,Ph).getRegex(),Rh=Lh(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),zh=Lh(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Bh={blockquote:_h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,zh).getRegex(),code:xh,def:Mh,fences:Sh,heading:wh,hr:Ch,html:Ih,lheading:Dh,list:Nh,newline:bh,paragraph:Rh,table:hh,text:Ah},Vh=_h(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ch).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`,Ph).getRegex(),Hh={...Bh,lheading:Oh,table:Vh,paragraph:_h(kh).replace(`hr`,Ch).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Vh).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`,Ph).getRegex()},Uh={...Bh,html:_h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Fh).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:hh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:_h(kh).replace(`hr`,Ch).replace(`heading`,` *#{1,6} *[^
|
|
37
|
+
]`).replace(`lheading`,Dh).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Wh=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Gh=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Kh=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,qh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jh=/[\p{P}\p{S}]/u,Yh=/[\s\p{P}\p{S}]/u,Xh=/[^\s\p{P}\p{S}]/u,Zh=_h(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Yh).getRegex(),Qh=/[\p{Pi}\p{Ps}"']/u,$h=/(?!~)[\p{P}\p{S}]/u,eg=/(?!~)[\s\p{P}\p{S}]/u,tg=/(?:[^\s\p{P}\p{S}]|~)/u,ng=_h(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,vh?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),rg=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ig=_h(rg,`u`).replace(/punct/g,Jh).getRegex(),ag=_h(rg,`u`).replace(/punct/g,$h).getRegex(),og=_h(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Qh).replace(/punct/g,Jh).getRegex(),sg=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,cg=_h(sg,`gu`).replace(/notPunctSpace/g,Xh).replace(/punctSpace/g,Yh).replace(/punct/g,Jh).getRegex(),lg=_h(sg,`gu`).replace(/notPunctSpace/g,tg).replace(/punctSpace/g,eg).replace(/punct/g,$h).getRegex(),ug=_h(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Xh).replace(/punctSpace/g,Yh).replace(/punct/g,Jh).getRegex(),dg=_h(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Xh).replace(/punctSpace/g,Yh).replace(/punct/g,Jh).getRegex(),fg=_h(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Xh).replace(/punctSpace/g,Yh).replace(/punct/g,Jh).getRegex(),pg=_h(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Jh).getRegex(),mg=_h(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Xh).replace(/punctSpace/g,Yh).replace(/punct/g,Jh).getRegex(),hg=_h(/\\(punct)/,`gu`).replace(/punct/g,Jh).getRegex(),gg=_h(/^<(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(),_g=_h(Fh).replace(`(?:-->|$)`,`-->`).getRegex(),vg=_h(`^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`,_g).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),yg=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,bg=_h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,yg).getRegex(),xg=_h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,bg).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Sg=_h(/^!?\[(label)\]\[(ref)\]/).replace(`label`,bg).replace(`ref`,jh).getRegex(),Cg=_h(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,jh).getRegex(),wg=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Tg=_h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,yg).getRegex(),Eg=_h(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,_h(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Tg).replace(`ref`,wg).getRegex()).replace(`nolink`,_h(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,wg).getRegex()).getRegex(),Dg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Og=_h(/(?: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(),kg={_backpedal:hh,anyPunctuation:hg,autolink:gg,blockSkip:ng,br:Kh,code:Gh,del:hh,delLDelim:hh,delRDelim:hh,emStrongLDelim:ig,emStrongRDelimAst:cg,emStrongRDelimUnd:dg,escape:Wh,link:xg,nolink:Cg,punctuation:Zh,reflink:Sg,reflinkSearch:Eg,tag:vg,text:qh,url:hh},Ag={...kg,emStrongLDelim:og,emStrongRDelimAst:ug,emStrongRDelimUnd:fg,link:_h(/^!?\[(label)\]\((.*?)\)/).replace(`label`,bg).getRegex(),reflink:_h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,bg).getRegex()},jg={...kg,emStrongRDelimAst:lg,emStrongLDelim:ag,delLDelim:pg,delRDelim:mg,url:_h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Og).replace(`protocol`,Dg).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:_h(/^(?:[^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`,Dg).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Mg={...jg,br:_h(Kh).replace(`{2,}`,`*`).getRegex(),text:_h(jg.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ng={normal:Bh,gfm:Hh,pedantic:Uh},Pg={normal:kg,gfm:jg,breaks:Mg,pedantic:Ag},Fg={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ig=e=>Fg[e];function Lg(e,t){if(t){if(yh.escapeTest.test(e))return e.replace(yh.escapeReplace,Ig)}else if(yh.escapeTestNoEncode.test(e))return e.replace(yh.escapeReplaceNoEncode,Ig);return e}function Rg(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 zg(e){try{e=encodeURI(e).replace(yh.percentDecode,`%`)}catch{return null}return e}function Bg(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 Vg(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 Hg(e){let t=e.split(`
|
|
38
|
+
`),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(`
|
|
39
|
+
`)}function Ug(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Wg(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 Gg(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 Kg(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 qg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
40
|
+
`).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(`
|
|
41
|
+
`)}function Jg(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 Yg=class{options;rules;lexer;constructor(e){this.options=e||ph}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]:Hg(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=qg(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=Vg(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Vg(t[0],`
|
|
42
|
+
`),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:Vg(t[0],`
|
|
43
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Vg(t[0],`
|
|
44
|
+
`).split(`
|
|
45
|
+
`),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(`
|
|
46
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
47
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
48
|
+
${s}`:s,r=r?`${r}
|
|
49
|
+
${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(`
|
|
50
|
+
`),o=t.raw+`
|
|
51
|
+
`+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(`
|
|
52
|
+
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
53
|
+
${d.join(`
|
|
54
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
55
|
+
`+e.join(`
|
|
56
|
+
`),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(`
|
|
57
|
+
`);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(`
|
|
58
|
+
`,1)[0],l=t[1].length,u=this.options.pedantic?Gg(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>Gg(e,l)),d=e.split(`
|
|
59
|
+
`,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+`
|
|
60
|
+
`,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(`
|
|
61
|
+
`,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+=`
|
|
62
|
+
`+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+=`
|
|
63
|
+
`+d}f=!d.trim(),r+=l+`
|
|
64
|
+
`,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=Hg(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=Ug(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:Vg(t[0],`
|
|
65
|
+
`),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=Bg(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
66
|
+
`):[],a={type:`table`,raw:Vg(t[0],`
|
|
67
|
+
`),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(Bg(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:Vg(t[0],`
|
|
68
|
+
`),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)===`
|
|
69
|
+
`?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&&Jg(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=Vg(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Wg(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)),Kg(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&&Jg(e,n[1],r,this.rules))return;let i=t[Ug((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 Kg(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]:Rg(t[0]),escaped:e}}}},Xg=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ph,this.options.tokenizer=this.options.tokenizer||new Yg,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:Ng.normal,inline:Pg.normal};this.options.pedantic?(t.block=Ng.pedantic,t.inline=Pg.pedantic):this.options.gfm&&(t.block=Ng.gfm,this.options.breaks?t.inline=Pg.breaks:t.inline=Pg.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ng,inline:Pg}}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,`
|
|
70
|
+
`),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+=`
|
|
71
|
+
`: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(`
|
|
72
|
+
`)?``:`
|
|
73
|
+
`)+i.raw,n.text+=`
|
|
74
|
+
`+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(`
|
|
75
|
+
`)?``:`
|
|
76
|
+
`)+i.raw,n.text+=`
|
|
77
|
+
`+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(`
|
|
78
|
+
`)?``:`
|
|
79
|
+
`)+i.raw,r.text+=`
|
|
80
|
+
`+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(`
|
|
81
|
+
`)?``:`
|
|
82
|
+
`)+i.raw,n.text+=`
|
|
83
|
+
`+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,Ug(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,Ug(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)}},Zg=class{options;parser;constructor(e){this.options=e||ph}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(yh.notSpaceStart)?.[0],i=e?e.replace(yh.endingNewline,``)+`
|
|
84
|
+
`:``;return r?`<pre><code class="language-`+Lg(r)+`">`+(n?i:Lg(i,!0))+`</code></pre>
|
|
85
|
+
`:`<pre><code>`+(n?i:Lg(i,!0))+`</code></pre>
|
|
86
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
87
|
+
${this.parser.parse(e)}</blockquote>
|
|
88
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
89
|
+
`}hr(e){return`<hr>
|
|
90
|
+
`}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+`>
|
|
91
|
+
`+r+`</`+i+`>
|
|
92
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
93
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
94
|
+
`}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>
|
|
95
|
+
<thead>
|
|
96
|
+
`+t+`</thead>
|
|
97
|
+
`+r+`</table>
|
|
98
|
+
`}tablerow({text:e}){return`<tr>
|
|
99
|
+
${e}</tr>
|
|
100
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
101
|
+
`}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>${Lg(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?Lg(n,!0):this.parser.parseInline(r),o=zg(e);if(o===null)return a;e=Lg(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Lg(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=zg(e);if(i===null)return Lg(n);e=i;let a=`<img src="${Lg(e)}" alt="${Lg(n)}"`;return t&&(a+=` title="${Lg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Lg(e.text)}},Qg=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}},$g=class e{options;renderer;textRenderer;constructor(e){this.options=e||ph,this.options.renderer=this.options.renderer||new Zg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qg}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}},e_=class{options;block;constructor(e){this.options=e||ph}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?Xg.lex:Xg.lexInline}provideParser(e=this.block){return e?$g.parse:$g.parseInline}},t_=new class{defaults=fh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$g;Renderer=Zg;TextRenderer=Qg;Lexer=Xg;Tokenizer=Yg;Hooks=e_;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 Zg(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 Yg(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 e_;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];e_.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&e_.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 Xg.lex(e,t??this.defaults)}parser(e,t){return $g.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?Xg.lex:Xg.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?$g.parse:$g.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?Xg.lex:Xg.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?$g.parse:$g.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+=`
|
|
102
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Lg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function n_(e,t){return t_.parse(e,t)}n_.options=n_.setOptions=function(e){return t_.setOptions(e),n_.defaults=t_.defaults,mh(n_.defaults),n_},n_.getDefaults=fh,n_.defaults=ph;function r_(...e){return t_.use(...e),n_.defaults=t_.defaults,mh(n_.defaults),n_}n_.use=r_,n_.walkTokens=function(e,t){return t_.walkTokens(e,t)},n_.parseInline=t_.parseInline,n_.Parser=$g,n_.parser=$g.parse,n_.Renderer=Zg,n_.TextRenderer=Qg,n_.Lexer=Xg,n_.lexer=Xg.lex,n_.Tokenizer=Yg,n_.Hooks=e_,n_.parse=n_,n_.options,n_.setOptions,n_.walkTokens,n_.parseInline,$g.parse,Xg.lex;function i_(e,t){this.v=e,this.k=t}function a_(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 o_(e){if(Array.isArray(e))return e}function s_(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 c_(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
103
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l_(e,t){return o_(e)||s_(e,t)||u_(e,t)||c_()}function u_(e,t){if(e){if(typeof e==`string`)return a_(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)?a_(e,t):void 0}}function d_(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof i_;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)}d_.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},d_.prototype.next=function(e){return this._invoke(`next`,e)},d_.prototype.throw=function(e){return this._invoke(`throw`,e)},d_.prototype.return=function(e){return this._invoke(`return`,e)};var f_=Object.entries,p_=Object.setPrototypeOf,m_=Object.isFrozen,h_=Object.getPrototypeOf,g_=Object.getOwnPropertyDescriptor,__=Object.freeze,v_=Object.seal,y_=Object.create,b_=typeof Reflect<`u`&&Reflect,x_=b_.apply,S_=b_.construct;__||=function(e){return e},v_||=function(e){return e},x_||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},S_||=function(e){return new e(...[...arguments].slice(1))};var C_=U_(Array.prototype.forEach);Array.prototype.indexOf;var w_=U_(Array.prototype.lastIndexOf),T_=U_(Array.prototype.pop),E_=U_(Array.prototype.push);Array.prototype.slice;var D_=U_(Array.prototype.splice),O_=Array.isArray,k_=U_(String.prototype.toLowerCase),A_=U_(String.prototype.toString),j_=U_(String.prototype.match),M_=U_(String.prototype.replace),N_=U_(String.prototype.indexOf),P_=U_(String.prototype.trim),F_=U_(Number.prototype.toString),I_=U_(Boolean.prototype.toString),L_=typeof BigInt>`u`?null:U_(BigInt.prototype.toString),R_=typeof Symbol>`u`?null:U_(Symbol.prototype.toString),z_=U_(Object.prototype.hasOwnProperty),B_=U_(Object.prototype.toString),V_=U_(RegExp.prototype.test),H_=W_(TypeError);function U_(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return x_(e,t,n)}}function W_(e){return function(){return S_(e,[...arguments])}}function G_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:k_;if(p_&&p_(e,null),!O_(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(m_(t)||(t[r]=e),i=e)}e[i]=!0}return e}function K_(e){for(let t=0;t<e.length;t++)z_(e,t)||(e[t]=null);return e}function q_(e){let t=y_(null);for(let r of f_(e)){var n=l_(r,2);let i=n[0],a=n[1];z_(e,i)&&(O_(a)?t[i]=K_(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=q_(a):t[i]=a)}return t}function J_(e){switch(typeof e){case`string`:return e;case`number`:return F_(e);case`boolean`:return I_(e);case`bigint`:return L_?L_(e):`0`;case`symbol`:return R_?R_(e):`Symbol()`;case`undefined`:return B_(e);case`function`:case`object`:{if(e===null)return B_(e);let t=e,n=Y_(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:B_(e)}return B_(e)}default:return B_(e)}}function Y_(e,t){for(;e!==null;){let n=g_(e,t);if(n){if(n.get)return U_(n.get);if(typeof n.value==`function`)return U_(n.value)}e=h_(e)}function n(){return null}return n}function X_(e){try{return V_(e,``),!0}catch{return!1}}var Z_=__(`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(`.`)),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(`.`)),$_=__([`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`]),ev=__([`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`]),tv=__(`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(`.`)),nv=__([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),rv=__([`#text`]),iv=__(`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(`.`)),av=__(`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(`.`)),ov=__(`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(`.`)),sv=__([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),cv=v_(/{{[\w\W]*|^[\w\W]*}}/g),lv=v_(/<%[\w\W]*|^[\w\W]*%>/g),uv=v_(/\${[\w\W]*/g),dv=v_(/^data-[\-\w.\u00B7-\uFFFF]+$/),fv=v_(/^aria-[\-\w]+$/),pv=v_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mv=v_(/^(?:\w+script|data):/i),hv=v_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gv=v_(/^html$/i),_v=v_(/^[a-z][.\w]*(-[.\w]+)+$/i),vv=v_(/<[/\w!]/g),yv=v_(/<[/\w]/g),bv=v_(/<\/no(script|embed|frames)/i),xv=v_(/\/>/i),Sv={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cv=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],wv=__(G_({},Cv)),Tv=function(){let e={};return C_(Cv,t=>{e[t]=v_(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),__(e)}(),Ev=function(){return typeof window>`u`?null:window},Dv=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}},Ov=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},kv=function(e,t,n,r){return z_(e,t)&&O_(e[t])?G_(r.base?q_(r.base):{},e[t],r.transform):n},Av=function(e,t,n){let r=z_(e,t)?e[t]:void 0;return r&&typeof r==`object`?q_(r):n()};function jv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ev(),t=e=>jv(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Sv.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=Y_(d,`cloneNode`),p=Y_(d,`remove`),m=Y_(d,`removeAttributeNode`),h=Y_(d,`nextSibling`),g=Y_(d,`childNodes`),_=Y_(d,`parentNode`),v=Y_(d,`shadowRoot`),y=Y_(d,`attributes`),b=o&&o.prototype?Y_(o.prototype,`nodeType`):null,x=o&&o.prototype?Y_(o.prototype,`nodeName`):null,S=o&&o.prototype?Y_(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,O=0,te=function(){if(O>0)throw H_(`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.`)},ne=function(e){te(),O++;try{return T.createHTML(e)}finally{O--}},re=function(e){te(),O++;try{return T.createScriptURL(e)}finally{O--}},ie=function(){return ee||=(D=Dv(u,i),!0),D},ae=n,oe=ae.implementation,se=ae.createNodeIterator,ce=ae.createDocumentFragment,le=ae.getElementsByTagName,k=r.importNode,A=Ov();t.isSupported=typeof f_==`function`&&typeof _==`function`&&oe&&oe.createHTMLDocument!==void 0;let ue=cv,de=lv,fe=uv,pe=dv,me=fv,he=mv,ge=hv,_e=_v,ve=pv,ye=null,be=G_({},[...Z_,...Q_,...$_,...tv,...rv]),j=null,xe=G_({},[...iv,...av,...ov,...sv]),Se=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}})),Ce=null,we=null,Te=Object.seal(y_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ee=!0,De=!0,Oe=!1,ke=!0,Ae=!1,je=!0,Me=!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={},F=null,Ue=G_({},`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(`.`)),We=null,Ge=G_({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ke=null,qe=G_({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Je=`http://www.w3.org/1998/Math/MathML`,Ye=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=G_({},[Je,Ye,Xe],A_),tt=__([`mi`,`mo`,`mn`,`ms`,`mtext`]),nt=G_({},tt),rt=__([`annotation-xml`]),it=G_({},rt),at=G_({},[`title`,`style`,`font`,`a`,`script`]),ot=null,st=[`application/xhtml+xml`,`text/html`],I=null,ct=null,lt=n.createElement(`form`),ut=function(e){return e instanceof RegExp||e instanceof Function},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ct&&ct===e)return;(!e||typeof e!=`object`)&&(e={}),e=q_(e),ot=st.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,I=ot===`application/xhtml+xml`?A_:k_,ye=kv(e,`ALLOWED_TAGS`,be,{transform:I}),j=kv(e,`ALLOWED_ATTR`,xe,{transform:I}),$e=kv(e,`ALLOWED_NAMESPACES`,et,{transform:A_}),Ke=kv(e,`ADD_URI_SAFE_ATTR`,qe,{transform:I,base:qe}),We=kv(e,`ADD_DATA_URI_TAGS`,Ge,{transform:I,base:Ge}),F=kv(e,`FORBID_CONTENTS`,Ue,{transform:I}),Ce=kv(e,`FORBID_TAGS`,q_({}),{transform:I}),we=kv(e,`FORBID_ATTR`,q_({}),{transform:I}),P=z_(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?q_(e.USE_PROFILES):e.USE_PROFILES:!1,Ee=e.ALLOW_ARIA_ATTR!==!1,De=e.ALLOW_DATA_ATTR!==!1,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ae=e.SAFE_FOR_TEMPLATES||!1,je=e.SAFE_FOR_XML!==!1,Me=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=X_(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pv,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,nt=Av(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>G_({},tt)),it=Av(e,`HTML_INTEGRATION_POINTS`,()=>G_({},rt));let t=Av(e,`CUSTOM_ELEMENT_HANDLING`,()=>y_(null));if(Se=y_(null),z_(t,`tagNameCheck`)&&ut(t.tagNameCheck)&&(Se.tagNameCheck=t.tagNameCheck),z_(t,`attributeNameCheck`)&&ut(t.attributeNameCheck)&&(Se.attributeNameCheck=t.attributeNameCheck),z_(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Se.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),v_(Se),Ae&&(De=!1),Re&&(Le=!0),P&&(ye=G_({},rv),j=y_(null),P.html===!0&&(G_(ye,Z_),G_(j,iv)),P.svg===!0&&(G_(ye,Q_),G_(j,av),G_(j,sv)),P.svgFilters===!0&&(G_(ye,$_),G_(j,av),G_(j,sv)),P.mathMl===!0&&(G_(ye,tv),G_(j,ov),G_(j,sv))),Te.tagCheck=null,Te.attributeCheck=null,z_(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Te.tagCheck=e.ADD_TAGS:O_(e.ADD_TAGS)&&(ye===be&&(ye=q_(ye)),G_(ye,e.ADD_TAGS,I))),z_(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Te.attributeCheck=e.ADD_ATTR:O_(e.ADD_ATTR)&&(j===xe&&(j=q_(j)),G_(j,e.ADD_ATTR,I))),z_(e,`ADD_FORBID_CONTENTS`)&&O_(e.ADD_FORBID_CONTENTS)&&(F===Ue&&(F=q_(F)),G_(F,e.ADD_FORBID_CONTENTS,I)),Ve&&(ye[`#text`]=!0),Me&&G_(ye,[`html`,`head`,`body`]),ye.table&&(G_(ye,[`tbody`]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw H_(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw H_(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=ne(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=ie()),T&&typeof E==`string`&&(E=ne(``)));__&&__(e),ct=e},ft=G_({},[...Q_,...$_,...ev]),pt=G_({},[...tv,...nv]),mt=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===Je?e===`svg`&&(n===`annotation-xml`||nt[n]):!!ft[e]},ht=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===Ye?e===`math`&&it[n]:!!pt[e]},gt=function(e,t,n){return t.namespaceURI===Ye&&!it[n]||t.namespaceURI===Je&&!nt[n]?!1:!pt[e]&&(at[e]||!ft[e])},_t=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ze,tagName:`template`});let n=k_(e.tagName),r=k_(t.tagName);return $e[e.namespaceURI]?e.namespaceURI===Ye?mt(n,t,r):e.namespaceURI===Je?ht(n,t,r):e.namespaceURI===Xe?gt(n,t,r):!!(ot===`application/xhtml+xml`&&$e[e.namespaceURI]):!1},vt=function(e){E_(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw H_(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},yt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},bt=function(e){Ct(e);let t=g(e);if(t){let e=[];C_(t,t=>{E_(e,t)}),C_(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`&&yt(e,r,i)}},xt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}E_(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{vt(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`||j[I(i)]||yt(e,r,i)}},Ct=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Sv.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 je?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},wt=function(e){if(!je)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Sv.processingInstruction||n===Sv.comment&&V_(yv,e.data)){try{p(e)}catch{}continue}if(n===Sv.element){let t=e,n=I(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=j_(e,/^[\r\n\t ]+/);r=t&&t[0]}ot===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?ne(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,ot)}catch{}if(!t||!t.documentElement){t=oe.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?le.call(t,Me?`html`:`body`)[0]:Me?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=M_(e,ue,` `),e=M_(e,de,` `),e=M_(e,fe,` `),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&&C_(i,e=>{At(e.content)&&Ot(e.content)})},kt=function(e){let t=x?x(e):null;return typeof t!=`string`||I(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)===Sv.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&&C_(e,e=>{e.call(t,n,r,ct)})}let Mt=function(e,t){return!!(je&&e.hasChildNodes()&&!R(e.firstElementChild)&&V_(vv,e.textContent)&&V_(vv,e.innerHTML)||je&&e.namespaceURI===Xe&&wv[t]&&(R(e.firstElementChild)||typeof e.textContent==`string`&&V_(Tv[t],e.textContent))||e.nodeType===Sv.processingInstruction||je&&e.nodeType===Sv.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(!Ce[t]&&Bt(t)&&Nt(Se.tagNameCheck,t))return!1;if(Ve&&!F[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 vt(e),!0},Ft=function(e,t,n,r){return e.length===0?t:t===n||t===r?q_(t):t},It=function(e,t){return e===t||_(e)!==null?!1:(He&&Ct(e),!0)},Lt=function(e,n){if(jt(A.beforeSanitizeElements,e,null),It(e,n))return!0;if(kt(e))return vt(e),!0;let r=I(w(e));if(ye=Ft(A.uponSanitizeElement,ye,be,Pe),jt(A.uponSanitizeElement,e,{tagName:r,allowedTags:ye}),It(e,n))return!0;if(Mt(e,r))return vt(e),!0;if(Ce[r]||!(Te.tagCheck instanceof Function&&Te.tagCheck(r))&&!ye[r]){let t=Pt(e,r,n);return t===!1&&(jt(A.afterSanitizeElements,e,null),It(e,n))?!0:t}if(C(e)===Sv.element&&!_t(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&V_(bv,e.innerHTML))return vt(e),!0;if(Ae&&e.nodeType===Sv.text){let n=Dt(e.textContent);e.textContent!==n&&(E_(t.removed,{element:e.cloneNode()}),e.textContent=n)}return jt(A.afterSanitizeElements,e,null),It(e,n)},Rt=function(e,t,r){if(we[t]||L(t,e)||M&&(t===`id`||t===`name`)&&(r in n||r in lt))return!1;let i=j[t]||Te.attributeCheck instanceof Function&&Te.attributeCheck(t,e);return De&&V_(pe,t)||Ee&&V_(me,t)?!0:i?Ke[t]||V_(ve,M_(r,ge,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&N_(r,`data:`)===0&&We[e]||Oe&&!V_(he,M_(r,ge,``))?!0:!r:Bt(e)&&Nt(Se.tagNameCheck,e)&&Nt(Se.attributeNameCheck,t,e)||t===`is`&&Se.allowCustomizedBuiltInElements&&Nt(Se.tagNameCheck,r)},zt=G_({},[`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[k_(e)]&&V_(_e,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 ne(r);case`TrustedScriptURL`:return re(r)}return r},Ht=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),kt(e)?(vt(e),!1):!0}catch{return xt(t,e),!1}},Ut=function(e,n){if(jt(A.beforeSanitizeAttributes,e,null),It(e,n))return;let r=e.attributes;if(!r||kt(e))return;j=Ft(A.uponSanitizeAttribute,j,xe,Fe);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},a=r.length,o=I(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=I(s),d=l,f=s===`value`?d:P_(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,jt(A.uponSanitizeAttribute,e,i),f=i.attrValue,Be&&(u===`id`||u===`name`)&&N_(f,N)!==0&&(xt(s,e,n),f=N+f,p=!0),je&&V_(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){xt(s,e,n);continue}if(u===`attributename`&&j_(f,`href`)){xt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){xt(s,e,n);continue}if(!ke&&V_(xv,f)){xt(s,e,n);continue}if(Ae&&(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&&T_(t.removed)}}jt(A.afterSanitizeAttributes,e,null),It(e,n)},Wt=function(e){let t=null,n=Et(e);for(jt(A.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(jt(A.uponSanitizeShadowNode,t,null),Lt(t,e),Ut(t,e),At(t.content)&&Wt(t.content),C(t)===Sv.element){let e=v(t);At(e)&&(Gt(e),Wt(e))}jt(A.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)===Sv.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`&&I(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(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!R(e)&&(e=J_(e),typeof e!=`string`))throw H_(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ne?(ye=Pe,j=Fe):dt(n),(A.uponSanitizeElement.length>0||A.uponSanitizeAttribute.length>0)&&(ye=q_(ye)),A.uponSanitizeAttribute.length>0&&(j=q_(j)),t.removed=[];let c=He&&typeof e!=`string`&&R(e);if(c){wt(e);let t=w(e);if(typeof t==`string`){let n=I(t);if(!ye[n]||Ce[n])throw bt(e),H_(`root node is forbidden and cannot be sanitized in-place`)}if(kt(e))throw bt(e),H_(`root node is clobbered and cannot be sanitized in-place`);try{Gt(e)}catch(t){throw bt(e),t}}else if(R(e))i=Tt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Sv.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Gt(i);else{if(!Le&&!Ae&&!Me&&e.indexOf(`<`)===-1)return T&&ze?ne(e):e;if(i=Tt(e),!i)return Le?null:ze?E:``}i&&Ie&&vt(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&&(bt(e),C_(t.removed,e=>{e.element&&Ct(e.element)})),n}if(c){let n=!1;if(C_(t.removed,t=>{t.element&&(t.element===e&&(n=!0),Ct(t.element))}),n)throw H_(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Ae&&Ot(e),e}if(Le){if(Ae&&Ot(i),Re)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(j.shadowroot||j.shadowrootmode)&&(s=k.call(r,s,!0)),s}let u=Me?i.outerHTML:i.innerHTML;return Me&&ye[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&V_(gv,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
104
|
+
`+u),Ae&&(u=Dt(u)),T&&ze?ne(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dt(e),Ne=!0,Pe=ye,Fe=j},t.clearConfig=function(){ct=null,Ne=!1,Pe=null,Fe=null,T=D,E=``},t.isValidAttribute=function(e,t,n){ct||dt({});let r=I(e),i=I(t);return Rt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&z_(A,e)&&E_(A[e],t)},t.removeHook=function(e,t){if(z_(A,e)){if(t!==void 0){let n=w_(A[e],t);return n===-1?void 0:D_(A[e],n,1)[0]}return T_(A[e])}},t.removeHooks=function(e){z_(A,e)&&(A[e]=[])},t.removeAllHooks=function(){A=Ov()},t}var Mv=jv();function Nv(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 Pv(e){return Mv.sanitize(n_.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 Fv(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 Iv(e,t){return t.startsWith(`/`)?t:[...e.split(`/`).slice(0,-1),t].join(`/`)}var Lv=q(`<span class="format svelte-14yf39v"> </span>`),Rv=q(`<p role="status">Loading preview…</p>`),zv=q(`<p>This item could not be opened.</p> <!>`,1),Bv=q(`<p class="empty svelte-14yf39v">This folder is empty.</p>`),Vv=q(`<!> <!>`,1),Hv=q(`<div class="markdown svelte-14yf39v"></div>`),Uv=q(`<pre><code> </code></pre>`),Wv=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 Gv(e,t){Qe(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(``),p=L(()=>G(i)?Nv(G(i)):{format:`text`,text:``}),m=L(()=>G(p).format===`markdown`&&!G(s)?Pv(G(p).text):``),h=null,g=null;async function _(e,n=!0){n&&G(i)&&B(d,[...G(d),G(i).path],!0),h?.abort(),G(u)?.close(),B(u,null);let p=new AbortController;h=p,B(f,e,!0),B(a,!0),B(o,!1),B(i,null),B(s,!1),B(c,!1);try{let n=await t.readFile(t.target.workspaceId,e,p.signal);if(p.signal.aborted)return;if(B(i,n,!0),B(f,n.path,!0),n.kind===`directory`){let e=new uh(t.target.workspaceId,t.listDirectory,()=>{B(l,G(l)+1)},t.onerror);B(u,e,!0),await e.load(n.path)}}catch(e){if(p.signal.aborted)return;B(o,!0),t.onerror(e)}finally{p.signal.aborted||(B(a,!1),await Tr(),r?.focus())}}function v(){let e=G(d).at(-1);e!==void 0&&(B(d,G(d).slice(0,-1),!0),_(e,!1))}function y(e){let t=(e.target instanceof Element?e.target.closest(`a`):null)?.getAttribute(`href`);!t||/^(?:https?:|mailto:|#)/i.test(t)||(e.preventDefault(),_(Iv(G(f),t)))}function b(e){return e.addEventListener(`click`,y),{destroy:()=>e.removeEventListener(`click`,y)}}Gi(()=>(g=document.activeElement instanceof HTMLElement?document.activeElement:null,n.showModal(),_(t.target.path,!1),()=>{h?.abort(),G(u)?.close(),n.close(),g?.focus()}));var x=Wv(),S=V(x),C=V(S),w=V(C),T=V(w,!0);P(w),Ui(w,e=>r=e,()=>r);var E=U(w,2),D=V(E,!0);P(E),P(C),Na(U(C,2),{get onclick(){return t.onclose},label:`Close file preview`,children:(e,t)=>{F(),J(e,Gr(`Close`))},$$slots:{default:!0}}),P(S);var ee=U(S,2),O=V(ee);{let e=L(()=>!G(d).length);Na(O,{onclick:v,get disabled(){return G(e)},children:(e,t)=>{F(),J(e,Gr(`Back`))},$$slots:{default:!0}})}var te=U(O,2),ne=e=>{Na(e,{onclick:()=>{B(s,!G(s))},get pressed(){return G(s)},children:(e,t)=>{F();var n=Gr();W(()=>Y(n,G(s)?`Show formatted`:`Show source`)),J(e,n)},$$slots:{default:!0}})};X(te,e=>{G(i)?.kind===`file`&&G(p).format!==`text`&&e(ne)});var re=U(te,2),ie=e=>{{let t=L(()=>G(c)?`Fold all JSON`:`Unfold all JSON`);Na(e,{onclick:()=>{B(c,!G(c))},get pressed(){return G(c)},get label(){return G(t)},children:(e,t)=>{F();var n=Gr();W(()=>Y(n,G(c)?`Unfolded`:`Folded`)),J(e,n)},$$slots:{default:!0}})}};X(re,e=>{G(p).format===`json`&&!G(s)&&e(ie)});var ae=U(re,2),oe=e=>{var t=Lv(),n=V(t);P(t),W((e,t)=>Y(n,`${e??``} · ${t??``} bytes`),[()=>G(p).format.toUpperCase(),()=>G(i).size.toLocaleString()]),J(e,t)};X(ae,e=>{G(i)?.kind===`file`&&e(oe)}),P(ee);var se=U(ee,2),ce=V(se),le=e=>{J(e,Rv())},k=e=>{var t=zv();Na(U(H(t),2),{onclick:()=>void _(G(f),!1),children:(e,t)=>{F(),J(e,Gr(`Retry`))},$$slots:{default:!0}}),J(e,t)},A=e=>{var t=Vv(),n=H(t);lh(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`?_(e):n?.kind===`directory`&&G(u)?.expand(e)}});var r=U(n,2),a=e=>{J(e,Bv())},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)},ue=e=>{var t=Kr(),n=H(t),r=e=>{var t=Hv();li(t,()=>G(m),!0),P(t),fi(t,e=>b?.(e)),J(e,t)},a=e=>{Xm(e,{get text(){return G(p).text},get unfolded(){return G(c)}})},o=e=>{var t=Uv();let n;var r=V(t),a=V(r,!0);P(r),P(t),W(()=>{n=Si(t,1,`svelte-14yf39v`,null,n,{json:G(p).format===`json`}),Y(a,G(s)?G(i).content:G(p).text)}),J(e,t)};X(n,e=>{G(m)?e(r):G(p).format===`json`&&!G(s)?e(a,1):e(o,-1)}),J(e,t)};X(ce,e=>{G(a)?e(le):G(o)?e(k,1):G(i)?.kind===`directory`&&G(u)?e(A,2):G(i)?.kind===`file`&&e(ue,3)}),P(se),P(x),Ui(x,e=>n=e,()=>n),W(e=>{Y(T,e),Y(D,G(f)||`/`)},[()=>G(f).split(`/`).filter(Boolean).at(-1)||`Workspace files`]),Lr(`cancel`,x,e=>{e.preventDefault(),t.onclose()}),J(e,x),$e()}var Kv=25*1024*1024;function qv(e){return[...e].map(e=>({file:e,status:e.size>26214400?`too-large`:`queued`}))}function Jv(e){return e.findIndex(e=>e.status===`queued`)}var Yv={phase:`idle`};function Xv(e,t){return{phase:`picking`,kind:e,source:t}}function Zv(e,t){return e.phase===`picking`?{...e,destination:t}:e}function Qv(e){return e.phase!==`picking`||e.destination===void 0?e:{...e,phase:`submitting`}}function $v(e,t){return e.phase===`submitting`?{...e,phase:`conflict`,replaceAllowed:t}:e}function ey(e){return e.phase===`submitting`?{...e,phase:`failed`}:e}function ty(e,t){return e.phase!==`picking`||!e.source||e.kind===`move`&&ny(e.source)===t?!1:!(t===e.source||t.startsWith(`${e.source}/`))}function ny(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}var ry=q(`<li> </li>`),iy=q(`<button type="button" class="svelte-qx7639">Replace</button>`),ay=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>`),oy=q(`<button type="button" class="svelte-qx7639">Cancel uploads</button>`),sy=q(`<section class="picker svelte-qx7639" aria-label="Upload queue" aria-live="polite"><p class="svelte-qx7639"> </p> <ul></ul> <!></section>`),cy=q(`<button type="button" class="svelte-qx7639">View</button>`),ly=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>`),uy=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>`),dy=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>`),fy=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>`),py=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>`),my=q(`<section aria-label="File browser error"><p class="svelte-qx7639">Files could not be read. Try again.</p></section>`),hy=q(`<p role="status" class="svelte-qx7639">This folder is empty.</p>`),gy=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 _y(e,t){Qe(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(Yv)),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 uh(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??Jv(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},Xa(),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,qv(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 O(){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),Xa()),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 te(){B(d,!0),await Tr(),G(p)?.focus()}function ne(e){G(u)&&B(c,Xv(e,G(u)),!0)}function re(e){ty(G(c),e)&&B(c,Zv(G(c),e),!0)}async function ie(e=`reject`){if(!G(s)||G(c).phase!==`picking`&&G(c).phase!==`conflict`)return;let i=G(c).phase===`picking`?Qv(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},Xa()),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,Yv,!0)}catch(e){let n=e;n.status===409?(B(c,$v(i,n.replaceAllowed===!0),!0),await Tr(),G(l)?.focus()):(B(c,ey(i),!0),t.onerror(e))}}}var ae=gy(),oe=V(ae),se=V(oe),ce=V(se),le=V(ce),k=V(le,!0);P(le),Ui(le,e=>B(a,e),()=>G(a));var A=U(le,2),ue=V(A,!0);P(A),P(ce);var de=U(ce,2);P(se);var fe=U(se,2),pe=V(fe);P(fe);var me=U(fe,2),he=V(me);Ui(he,e=>B(m,e),()=>G(m));var ge=U(he,2),_e=V(ge);P(ge);var ve=U(ge,2);P(me);var ye=U(me,2),be=e=>{var t=sy(),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=ry(),r=V(n);P(n),W(()=>Y(r,`${G(t).file.name??``}: ${G(t).path??G(t).status??``}${G(t).status===`too-large`?` (maximum ${Kv/1024/1024} MiB)`:``}`)),J(e,n)}),P(i);var a=U(i,2),o=e=>{var t=ay(),n=V(t),r=e=>{var t=iy();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=oy();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 j=U(ye,2),xe=e=>{var n=ly(),r=V(n),i=e=>{var n=cy();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,()=>ne(`copy`)),K(`click`,o,()=>ne(`move`)),K(`click`,s,()=>void te()),J(e,n)};X(j,e=>{G(s)&&G(c).phase===`idle`&&G(b)&&G(b).kind!==`symlink`&&e(xe)});var Se=U(j,2),Ce=e=>{var t=uy(),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 O()),J(e,t)};X(Se,e=>{G(d)&&G(b)&&e(Ce)});var we=U(Se,2),Te=e=>{var t=dy(),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??``}`)},[()=>!ty(G(c),``)]),K(`click`,u,()=>re(``)),K(`click`,d,()=>void ie()),K(`click`,p,()=>B(c,Yv,!0)),J(e,t)},Ee=e=>{var t=fy(),n=U(V(t),2),r=V(n,!0);P(n);var i=U(n,2),a=V(i),o=e=>{var t=iy();K(`click`,t,()=>void ie(`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 ie(`keep-both`)),K(`click`,u,()=>B(c,Yv,!0)),J(e,t)},De=e=>{var t=py(),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,Yv,!0)),J(e,t)};X(we,e=>{G(c).phase===`picking`?e(Te):G(c).phase===`conflict`?e(Ee,1):G(c).phase===`failed`&&e(De,2)});var Oe=U(we,2),ke=e=>{J(e,my())},Ae=e=>{J(e,hy())};X(Oe,e=>{G(s)&&!G(y).loading&&G(y).error?e(ke):G(s)&&!G(y).loading&&G(y).entries.length===0&&e(Ae,1)});var je=U(Oe,2),Me=e=>{var t=Kr();$r(H(t),()=>G(o),e=>{{let t=L(()=>G(c).phase===`picking`);lh(e,{get controller(){return G(s)},get revision(){return G(o)},get destinationMode(){return G(t)},ondestinationselect:re,onselectionchange:e=>B(u,e,!0)})}}),J(e,t)};X(je,e=>{G(s)&&e(Me)}),P(oe),P(ae),Ui(ae,e=>B(i,e),()=>G(i)),W(()=>{Y(k,G(x)),Y(ue,G(c).phase===`picking`?`Choose destination folder.`:`Browse folders and select a position.`),pe.disabled=G(y).loading,Y(_e,`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`,de,S),K(`click`,pe,()=>void G(s)?.refresh()),K(`change`,he,e=>E(e.currentTarget.files)),K(`click`,ve,()=>G(m)?.click()),J(e,ae),$e()}Rr([`click`,`change`]);var vy=q(`<main class="evidence-mode svelte-1d2e8zz"><!></main>`),yy=q(`<span class="detached-chat-model svelte-1d2e8zz"> </span>`),by=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>`),xy=q(`<!> <!> <div class="chat-controls svelte-1d2e8zz" aria-label="Chat controls"><!> <!></div> <div class="chat-tail svelte-1d2e8zz" aria-hidden="true"></div>`,1),Sy=q(`<p> </p>`),Cy=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>`),wy=q(`<p>Loading skill profiles…</p>`),Ty=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>`),Ey=q(`<!> <!> <!> <!>`,1),Dy=q(`<main class="swipe-surface svelte-1d2e8zz"><!> <!> <!> <!></main> <!>`,1);function Oy(e,t){Qe(t,!0);let n=$(t,`oncreatepasskey`,3,()=>{}),r=al(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(null),f=!1,p=z(`Loading relay…`),m=z(on(Or(()=>t.theme))),h=z(on([])),g=`gpt-6.1-sol`,_=z(`medium`),v=z(`gpt-5.6-terra`),y=z(`high`),b=z({codex:[g],kimi:[]}),x=z([]),S=z(null),C=z(`codex`),w=z({codex:g,kimi:``}),T=z(null),E=z(null),D=L(()=>G(T)?.kimi.available??!1),ee=L(()=>G(D)?G(C):`codex`),O=z([]),te=z(null),ne=z(`list`),re=z([]),ie=z(``),ae=z(``),oe=z(``),se=z(!1),ce=z(!1),le=z(on(new Set)),k=z(null),A=z(on([])),ue=z(new Map),de=z({snapshots:new Map,attention:new Map,pending:new Set,errors:new Map}),fe=z(new Map),pe=0,me=null,he=L(()=>G(A).some(e=>e.id===G(k))),ge=z(on([])),_e=z(`workspace-git`),ve=z(`never`),ye=z(on({starting:!1,error:null})),be=L(()=>G(ye).starting),j=z(null),xe=0,Se=z(null),Ce=z(null),we=z(``),Te=0,Ee=new Map,De=z(on({kind:`unavailable`,sessionId:null})),Oe=z({kind:`no-workspace`}),ke=z(null),Ae=z(null),je=z(!1),Me=null,Ne=null,Pe=0,Fe=null,Ie=null,Le=!1,Re=z(on([])),ze=0,M=z(null),Be=L(()=>G(h)[0]?.id??null),N=L(()=>G(A).find(e=>e.id===G(k))?.workspacePath??null),Ve=L(()=>G(A).find(e=>e.id===G(k))??null),He=L(()=>Hf(G(Ve)?.workspacePath??``)),F=L(()=>G(Ve)?`${G(Ve).provider===`kimi`?`Kimi · `:``}${G(Ve).model??g}`:g);function Ue(e){return`kind`in e&&e.kind===`org-source`}function We(e){return r?e.filter(e=>e.id===G(k)):e}let Ge=L(()=>G(ke)&&Ue(G(ke))?G(ke):G(ke)?{kind:`ready`,sessionId:`catalog`,plan:G(ke)}:G(je)?null:G(De).kind===`ready`||G(De).kind===`closing`||G(De).kind===`error`&&G(De).plan?G(De):null),Ke=L(()=>pd(G(De).kind===`ready`||G(De).kind===`closing`||G(De).kind===`error`?G(De).plan:void 0)),qe=z(on({workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null})),Je=L(()=>G(qe).workspaceId),Ye=z(on(new Set)),Xe=z(!1),Ze=z(!1),et=z(null),tt=z(null),nt=z(null),rt=on({}),it=z({}),at=z(null),ot=``,st=new Zl({requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e),reducedMotion:()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,scrollTail:e=>G(at)?.scrollIntoView({block:`end`,behavior:e})}),I=new Ql(e=>void Tr().then(e),e=>{G(a)===`chat`&&st.request(e)}),ct=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.`:``:``}),lt=rd((e,n)=>t.authorizedFetch(e,n)),ut=new co(lt,e=>B(de,e)),dt=new Ya({relay:lt,publish:e=>B(ue,new Map(e)),onEvent:(e,t)=>ut.observe(e,t),onAuthoritativeSnapshot:(e,t)=>ut.applyAuthoritative(e,t)}),ft=new Yl({relay:lt,cache:rl(),publish:e=>B(i,e,!0),onSessionEvent:e=>Jn(e),onRelayEvent:e=>{G(k)&&dt.observe(G(k),e)},onHistoryError:e=>{B(p,Gn(e,`SESSION_HISTORY_READ_FAILED`),!0)},onSendError:(e,t)=>{let n=tu(e,`MESSAGE_SEND_FAILED`);if(n.code===`SESSION_WORKSPACE_UNAVAILABLE`){B(Se,null),B(Ce,null),vt.enqueue({kind:`warning`,...n});return}B(Se,n.message,!0),B(Ce,n.retryable?t:null,!0),B(p,Gn(e,`MESSAGE_SEND_FAILED`),!0)},onSendAccepted:(e,t)=>{G(Ce)===t&&(B(Se,null),B(Ce,null));let n=Ee.get(t);n&&n.sessionId===e&&Xt(n)},onHistoryPromptAccepted:(e,t)=>{let n=Ee.get(t);n&&n.sessionId===e&&Xt(n)}}),pt=new yp({start:lt.startSession},Xa,e=>B(ye,e,!0)),mt=new Xu({getSummary:lt.getGitSummary,pull:lt.pullGit,checkout:lt.checkoutGitBranch},e=>!!wu(G(h),e)?.isGitRepository,e=>B(qe,e,!0),(e,t)=>Gn(e,t)),ht=Mm((e,n)=>t.authorizedFetch(e,n)),gt=fd({getPlan:lt.getPlan,closePlan:lt.closePlan},e=>{B(De,e,!0),(e.kind===`ready`||e.kind===`closing`)&&B(A,G(A).map(t=>t.id===e.sessionId?{...t,plan:e.plan}:t),!0)}),_t=Lf(),vt=fu({historyStorage:uu()}),yt=new URLSearchParams(location.search).get(`tree-evidence`),bt=new URLSearchParams(location.search).get(`toast-evidence`),xt=new URLSearchParams(location.search).get(`activity-evidence`),St=bo(window.sessionStorage),Ct=new Set;Mn(()=>{for(let[e,t]of G(de).attention){let n=`${e}:${t.requestId}`;St.claim(n)&&vt.enqueue({kind:`error`,code:`AUTOPILOT_ATTENTION_${t.requestId}`,message:`Autopilot needs your attention.`})}}),Mn(()=>{let e=new Set;for(let[t,n]of G(de).errors){let r=`${t}:${n}`;e.add(r),!Ct.has(r)&&(Ct.add(r),vt.enqueue({kind:`error`,message:n}))}for(let t of Ct)e.has(t)||Ct.delete(t)});function wt(){B(c,!0)}function Tt(){B(c,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}function Et(){B(s,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}async function Dt(){try{await lt.quit()}catch(e){throw Gn(e,`QUIT_FAILED`),e}}Gi(async()=>{if(!(yt===`sessions`||yt===`git`||bt===`error`||bt===`stacked`))try{let e=await Kc(t.authorizedFetch);B(oe,Tu(G(oe)||null,G(h),e.workspaces,yu.sessionBase)??``,!0),B(h,e.workspaces,!0),B(O,e.profiles),B(b,{codex:[...new Set([g,...e.models?.codex??[]])],kimi:e.models?.kimi??[]}),B(w,{...G(w),kimi:G(w).kimi||(e.models?.kimi?.[0]??``)}),B(T,e.capabilities?.providers??null);try{if(e.sessionDefaultsError)throw Error(`SESSION_DEFAULTS_READ_FAILED`);let t=e.sessionDefaults;t&&(B(_e,t.sandbox,!0),B(ve,t.approvalPolicy,!0),B(ie,t.skillProfile,!0),B(C,t.provider,!0),B(_,t.reasoningEffort??`medium`,!0),B(v,t.executorModel??`gpt-5.6-terra`,!0),B(y,t.executorReasoningEffort??`high`,!0),B(w,{...G(w),[t.provider]:t.model}),wu(e.workspaces,t.workspaceId)&&B(oe,t.workspaceId,!0),G(b)[t.provider].includes(t.model)||B(b,{...G(b),[t.provider]:[t.model,...G(b)[t.provider]]}))}catch(e){Gn(e,`SESSION_DEFAULTS_READ_FAILED`)}B(x,e.versions??[]),B(S,e.branding?.headerIconUrl??null,!0),r||await bn(),B(le,bu(G(h)),!0),B(Ye,bu(G(h)),!0);let n=r?null:await _t.readSelectedSession();if(B(k,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(k)){let e=await _t.readDraftEnvelope(G(k));B(we,e.text,!0),Te=e.revision,Zt(G(k),e.pending)}B(A,e.sessions,!0);let i=We(e.sessions.filter(e=>[`ready`,`turnActive`].includes(e.state)));dt.bootstrap(i,G(k)),ut.bootstrap(i),r||Lt(),gt.select(G(k)),G(k)?ft.select(G(k)):r&&B(p,`This session is no longer open in Gestalt Mobile.`)}catch(e){B(p,Gn(e,`RELAY_UNAVAILABLE`),!0)}}),Mn(()=>{if(!G(at))return;let e=new IntersectionObserver(([e])=>st.observeTail(e?.isIntersecting??!1),{root:null});return e.observe(G(at)),()=>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===ot||(ot=n,t===`chat`&&Ot(`content`))});function Ot(e){I.schedule(e)}function kt(){I.invalidate(),st.reset(),B(a,`chat`),wn(`chat`),Ot(`initial`),Tn()}function At(e){B(m,oa(e),!0)}function R(){if(!G(k))return;let e=window.open(ol(location.href,G(k)),sl(G(k)),`popup,width=760,height=900`);if(!e){vt.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(()=>{Me?.abort(),Ne?.abort(),I.invalidate(),st.cancel(),ft.dispose(),dt.dispose(),ut.dispose(),gt.dispose(),mt.dispose(),pt.dispose(),G(te)?.dispose()});async function jt(e){B(C,e,!0);let t=G(b)[e];if(!G(w)[e]&&t[0]&&B(w,{...G(w),[e]:t[0]}),!(t.length>0)){B(E,e,!0);try{let t=await lt.listSessionModels(e);B(b,{...G(b),[e]:t.models}),!G(w)[e]&&t.models[0]&&B(w,{...G(w),[e]:t.models[0]})}catch(e){Gn(e,`SESSION_MODELS_READ_FAILED`)}finally{G(E)===e&&B(E,null)}}}async function Mt(){if(!G(oe)||G(be))return;let e=G(D)?G(C):`codex`,t=vp({workspaceId:G(oe),profile:`default`,profileState:`ok`});if(t.profile){B(p,t.profile,!0);return}B(p,`Starting session…`);let n=await pt.start(G(oe),{provider:e,sandbox:G(_e),approvalPolicy:G(ve),model:G(w)[e]||void 0,...e===`codex`?{reasoningEffort:G(_),executorModel:G(v),executorReasoningEffort:G(y)}:{},skillProfile:G(ie)||void 0});if(!n){G(ye).error&&B(p,Gn(Error(G(ye).error),`SESSION_START_FAILED`),!0);return}try{B(k,n.id,!0);for(let e of n.effectiveSkillSelection?.warnings??[])vt.enqueue({kind:`warning`,code:`SKILL_PROFILE_MISSING_SKILL`,message:e});gt.select(n.id),_t.saveSelectedSession(n.id),await Nt();let e=await _t.readDraftEnvelope(n.id);B(we,e.text,!0),Te=e.revision,Zt(n.id,e.pending),ft.select(n.id,{history:`empty`}),dt.select(n.id),kt(),B(p,`Session started.`)}catch(e){B(p,Gn(e,`SESSION_START_FAILED`),!0)}}async function Nt(){let e=++pe;me?.abort();let t=new AbortController;me=t;try{let n=await lt.listSessions(t.signal);if(e!==pe||t.signal.aborted)return;B(A,n.map(e=>G(fe).has(e.id)?{...e,plan:G(fe).get(e.id)}:e),!0);let r=We(G(A).filter(e=>[`ready`,`turnActive`].includes(e.state)));dt.bootstrap(r,G(k)),ut.bootstrap(r)}catch(e){if(t.signal.aborted||qn(e))return;throw e}finally{me===t&&(me=null)}}async function Pt(e,t){await ut.toggle(e,t),e===G(k)&&Nt().catch(()=>{})}async function Ft(e){await Pt(e,!0),await Tr(),e===G(k)&&document.getElementById(`chat-autopilot-${e}-button`)?.focus({preventScroll:!0})}async function It(e,t,n){await ut.resolve(e,t,n),e===G(k)&&Nt().catch(()=>{})}async function Lt(){try{B(ge,await lt.listRecentSessions(),!0)}catch{B(ge,[],!0)}}async function Rt(){try{await Promise.all([Nt(),Lt()])}catch(e){B(p,Gn(e,`SESSION_REFRESH_FAILED`),!0)}}async function zt(e){B(p,`Opening session…`),B(j,e,!0);let t=++xe;try{B(k,e,!0),B(Se,null),B(Ce,null),gt.select(e),_t.saveSelectedSession(e),ft.select(e),dt.select(e),kt();let n=await _t.readDraftEnvelope(e);t===xe&&G(k)===e&&(B(we,n.text,!0),Te=n.revision,Zt(e,n.pending))}catch(e){B(p,Gn(e,`SESSION_HISTORY_READ_FAILED`),!0)}finally{t===xe&&B(j,null)}}async function Bt(e){B(p,`Opening recent session…`);try{let t=await lt.openRecentSession(e.id,e.cwd,e.provider??`codex`);G(A).some(e=>e.id===t.id)||B(A,[...G(A),t],!0),Rt(),await zt(t.id)}catch(e){B(p,Gn(e,`SESSION_HISTORY_READ_FAILED`),!0)}}async function Vt(e){B(p,`Closing session…`);try{await lt.releaseSession(e),G(k)===e&&(B(k,null),B(a,`sessions`),_t.saveSelectedSession(null),ft.select(null),dt.select(null),gt.select(null)),await Rt(),B(p,`Session closed.`)}catch(e){B(p,Gn(e,`SESSION_CLOSE_FAILED`),!0)}}async function Ht(){B(se,!0);try{if(!(await t.authorizedFetch(`/api/session-defaults`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({workspaceId:G(oe),skillProfile:G(ie),provider:G(ee),model:G(w)[G(ee)],reasoningEffort:G(_),executorModel:G(v),executorReasoningEffort:G(y),sandbox:G(_e),approvalPolicy:G(ve)})})).ok)throw Error(`SESSION_DEFAULTS_SAVE_FAILED`);B(p,`Session defaults saved.`),vt.enqueue({kind:`success`,message:`Session defaults saved.`})}catch(e){Gn(e,`SESSION_DEFAULTS_SAVE_FAILED`)}finally{B(se,!1)}}async function Ut(e){let t=G(A).find(t=>t.id===e);try{await lt.forgetSession(e),G(k)===e&&(ft.select(null),dt.select(null),B(k,null),_t.saveSelectedSession(null),gt.select(null)),await Rt(),B(ge,Vf(G(ge),t),!0)}catch(e){B(p,`Could not forget session: ${Wn(e)}`)}}async function Wt(e){await Qs(e)?(B(p,`Resume command copied.`),vt.enqueue({kind:`success`,message:G(p)})):B(p,Gn(Error(`SESSION_COPY_FAILED`),`SESSION_COPY_FAILED`),!0)}async function Gt(e){if(!(!G(k)||G(i)?.activeTurnId))try{let t=await lt.selectModel(G(k),e);B(A,G(A).map(e=>e.id===t.id?{...e,...t}:e),!0),B(we,``),B(p,`Model changed to ${e}; it applies to the next turn.`)}catch(e){B(p,`Could not change model: ${Wn(e)}`)}}async function Kt(e){if(!G(k)||!G(we).trim()||!ft.canSubmit(e)||[...Ee.values()].some(e=>e.sessionId===G(k)&&e.revision===Te))return;let t=Xa(),n={sessionId:G(k),revision:Te,text:G(we),operationId:t,kind:e};Ee.set(t,n),_t.addPendingDraftOperation(G(k),n),e===`send`?ft.send(n.text,t):e===`queue`?ft.queue(n.text,t):ft.interruptAndSend(n.text,t)}let qt=()=>Kt(`send`),Jt=()=>Kt(`queue`),Yt=()=>Kt(`interrupt-send`);async function Xt(e){let t=await _t.consumeAcceptedDraft(e.sessionId,e.revision,e.operationId);t&&Ee.delete(e.operationId),t&&e.sessionId===G(k)&&e.revision===Te?(G(Ce)===e.operationId&&(B(Ce,null),B(Se,null)),B(we,``),Te=t.revision,Ot(`explicit`)):e.sessionId===G(k)&&e.revision===Te&&(B(Se,null),B(Ce,e.operationId,!0),vt.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 Zt(e,t){for(let n of t??[])Ee.set(n.operationId,{sessionId:e,...n});e===G(k)&&(t?.length??0)>0&&(B(Se,null),B(Ce,t[0].operationId,!0),vt.enqueue({kind:`warning`,code:`PROMPT_RECOVERY_${G(Ce)}`,message:`A submitted prompt is being recovered. It will not be sent again automatically. Retry is available.`}))}async function Qt(){if(!G(Ce))return;B(Se,null);let e=Ee.get(G(Ce));if(!e){await ft.retryPrompt(G(Ce));return}e.kind===`send`?await ft.send(e.text,e.operationId):e.kind===`queue`?await ft.queue(e.text,e.operationId):await ft.interruptAndSend(e.text,e.operationId)}async function $t(){await ft.interrupt()}function en(){G(a)===`chat`&&G(k)&&ft.refresh()}function tn(e){if(r||e===`chat`&&!G(he))return;let t=G(a)!==e;G(a)===`chat`&&e!==`chat`&&(I.invalidate(),st.cancel()),B(a,e,!0),wn(e),e===`chat`&&(en(),st.reset(),Ot(`initial`),t&&Tn()),e===`git`&&G(Je)&&mt.refresh(),e===`plan`&&(G(k)&>.refresh(G(k)),t||_n()),e===`sessions`&&(G(ne)===`profile-manager`&&Cn(!1),Rt(),G(k)&>.refresh(G(k)))}Mn(()=>{let e=G(Be);G(a)===`plan`&&Or(()=>pn(e))});let nn=!1;function rn(){document.visibilityState!==`visible`||nn||(nn=!0,queueMicrotask(()=>{nn=!1,document.visibilityState===`visible`&&(G(a)===`git`&&G(Je)&&mt.refresh(),G(a)===`sessions`&&(Rt(),G(k)&>.refresh(G(k))))}))}let an=null;function sn(e){return e instanceof Element&&e.closest(`button, input, textarea, select, a, summary, [contenteditable]`)!==null}function cn(e){e.pointerType!==`touch`||sn(e.target)||(an={pointerId:e.pointerId,x:e.clientX,y:e.clientY})}function dn(e){if(!an||e.pointerId!==an.pointerId)return;let t=an;an=null;let n=e.clientX-t.x,r=e.clientY-t.y;Math.abs(n)<48||Math.abs(n)<=Math.abs(r)||tn(xp(G(a),n<0?1:-1,{chatEnabled:G(he)}))}function fn(e){an?.pointerId===e.pointerId&&(an=null)}function pn(e=G(Be),t=!1){if(Me&&Ie===e)return;if(Me?.abort(),t||(Ne?.abort(),B(ke,null),B(Ae,null)),!e){B(Oe,{kind:`no-workspace`});return}let n=new AbortController;Me=n,Ie=e;let r=++Pe;B(Oe,Fe?.workspaceId===e?{...Fe,refreshing:!0}:{kind:`loading`,workspaceId:e}),lt.listWorkspacePlans(e,n.signal).then(t=>{r!==Pe||n.signal.aborted||(Fe={kind:`ready`,workspaceId:e,entries:t},B(Oe,Fe))}).catch(t=>{r!==Pe||n.signal.aborted||(G(Ge)||vt.enqueue({kind:`error`,code:`WORKSPACE_PLANS_READ_FAILED`,message:`Workspace Org files could not be listed. Try opening the Plan tab again.`}),B(Oe,Fe?.workspaceId===e?Fe:{kind:`error`,workspaceId:e,error:t instanceof Error?t.message:`Could not load workspace plans.`}))}).finally(()=>{Me===n&&(Me=null)})}function mn(e,t=!1,n=!0){let r=t?G(Ve)?.workspaceId:G(Be);if(!r)return;Ne?.abort();let i=new AbortController;Ne=i;let o=++ze;Le=t,(t&&G(k)?lt.openSessionPlan(G(k),e):lt.getWorkspacePlan(r,e,i.signal)).then(t=>{o!==ze||i.signal.aborted||(B(ke,t),B(Ae,e,!0),B(je,!1),n&&Tr().then(()=>{requestAnimationFrame(()=>{o===ze&&!i.signal.aborted&&G(a)===`plan`&&window.scrollTo({top:0,behavior:`instant`})})}))}).catch(()=>{o!==ze||i.signal.aborted||vt.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(()=>{Ne===i&&(Ne=null)})}function hn(e){let t=G(Ve)?.workspaceId,n=G(N),r=n?Xs(e,n):null;if(!t||!r){vt.enqueue({kind:`error`,code:`ORG_LINK_OUTSIDE_WORKSPACE`,message:`This Org file is not inside the selected workspace and cannot be opened.`});return}tn(`plan`),Tr().then(()=>{G(Ve)?.workspaceId!==t||G(N)!==n||mn(r,!0)})}function gn(){B(ke,null),B(Ae,null),B(je,!0),pn()}function _n(){G(k)&>.refresh(G(k)),G(Ae)&&mn(G(Ae),Le,!1),pn(G(Be),!0)}async function vn(e){let t=G(Be);if(!(!t||G(Re).includes(e))){B(Re,[...G(Re),e],!0);try{await lt.archiveWorkspacePlan(t,e),Fe?.workspaceId===t&&(Me?.abort(),Me=null,Fe={...Fe,entries:Fe.entries.map(t=>t.planName===e?{...t,archived:!0}:t)},B(Oe,Fe),pn(t,!0)),vt.enqueue({kind:`success`,message:`Plan archived.`})}catch{vt.enqueue({kind:`error`,code:`PLAN_ARCHIVE_FAILED`,message:`The plan could not be archived. Check that it is writable and try again.`})}finally{B(Re,G(Re).filter(t=>t!==e),!0)}}}async function yn(e,t){let n=new Vp(lt);await n.load(e,t),B(te,n,!0)}async function bn(){try{let e=await lt.listSkillProfiles();B(re,e.profiles.filter(e=>!(`error`in e)));let t=e.profiles.find(e=>`error`in e);B(ae,t&&`error`in t?t.error.message:``,!0),G(re).some(e=>e.name===G(ie))||B(ie,``)}catch(e){B(re,[]),B(ae,e instanceof Error?e.message:`Unable to load saved skill profiles.`,!0)}}async function xn(e){let t=G(oe)||G(h)[0]?.id||``,n=G(O).find(e=>e.state===`ok`)?.name??``;if(!t||!n){B(p,`Choose a workspace and available Codex profile before managing skill profiles.`);return}await yn(t,n),B(ne,`profile-manager`)}function Sn(e){queueMicrotask(()=>e.focus())}async function Cn(e=!0){if(B(ne,`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 Tn(){Tr().then(()=>{G(a)===`chat`&&document.getElementById(`message`)?.focus({preventScroll:!0})})}function En(e){mt.select(e.id),B(Xe,!1)}async function Dn(e,t){let n=!G(Ae)||Le,r=n?G(Ve)?.workspaceId:G(Be),i=G(Ae)??``;if(!r)return[];let a=e=>n?e:Fv(i,e),o=new Set;try{for(let n=0;n<e.length;n+=64){if(t.aborted)return[];(await lt.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||Gn(e,`WORKSPACE_FILES_READ_FAILED`),[]}}function On(e){let t=!G(Ae)||Le,n=t?G(Ve)?.workspaceId:G(Be);n&&B(l,{workspaceId:n,path:t?e:Fv(G(Ae)??``,e)},!0)}function kn(e){let t=G(Je)?wu(G(h),G(Je)):null;t&&(B(u,t,!0),B(d,e,!0))}async function An(){B(u,null),await Tr(),G(d)?.focus({preventScroll:!0})}function jn(){f||(f=!0,queueMicrotask(()=>{f=!1,G(Je)&&mt.refresh()}))}async function Nn(){let e=G(Je);!e||!wu(G(h),e)?.isGitRepository||(B(tt,G(tt)??Xa(),!0),await mt.pull(G(tt)),G(qe).error||B(tt,null))}async function Pn(e){if(G(Ze))return;let n=G(Je)?wu(G(h),G(Je)):void 0;if(!n||n.isGitRepository){B(et,null),vt.enqueue({kind:`error`,code:`INVALID_CLONE_DESTINATION`,message:`Select a non-repository folder before cloning.`});return}let r=n.id;B(Ze,!0),B(et,null);try{await lt.cloneGitRepository(r,e);let n=await Kc(t.authorizedFetch),i=Zu(G(h),n.workspaces,r,e,G(Ye));B(oe,Tu(G(oe)||null,G(h),n.workspaces,yu.sessionBase)??``,!0),B(h,n.workspaces,!0),mt.select(i.selectedId),B(Ye,i.expandedIds,!0),B(et,`Repository cloned into the selected workspace.`),vt.enqueue({kind:`success`,message:`Repository cloned.`})}catch(e){Gn(e,`GIT_CLONE_FAILED`)}finally{B(Ze,!1)}}async function Fn(e){G(Je)&&await mt.checkout(e)}async function In(){let e=G(Je);if(e){B(nt,G(nt)??Xa(),!0);try{await lt.pushGit(e,G(nt)),B(Xe,!1),await mt.refresh(),B(nt,null)}catch(e){Gn(e,`GIT_PUSH_FAILED`)}}}async function Ln(e,t){Ot(`explicit`),await ft.respond(e,{decision:t})}async function zn(e){Ot(`explicit`);let t=e.kind===`quiz`?ms(e.payload):hs(e.payload);if(!t)return;let n=t.questions.map(t=>({id:t.id,answer:rt[`${e.requestId}:${t.id}`]??``})),r=t.questions.map((e,t)=>({id:e.id,header:e.header,question:e.question,answer:n[t]?.answer??``}));B(it,{...G(it),[e.requestId]:r});let a=e.kind===`quiz`?gs(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=nd(r);G(i)?.activeTurnId?await ft.queue(e,t):await ft.send(e,t)}let o=ft.view.prompts.find(e=>e.operationId===t);if(e.kind===`quiz`&&(!o||o.state===`failed`))return;await ft.respond(e.requestId,a)}catch{B(p,`Could not send quiz answers. Please try again.`)}}async function Bn(e){let t=ed(e.payload);if(!t){B(p,`Codex sent an invalid permission request.`);return}Ot(`explicit`),await ft.respond(e.requestId,t)}function Vn(e){e.kind===`quiz`||e.kind===`userInput`?zn(e):e.kind===`permissionsApproval`?Bn(e):ft.retryInteraction(e.requestId)}function Hn(e,t,n){rt[`${e}:${t}`]=n}function Un(e){B(we,e,!0),Te+=1;let t=G(k);t&&_t.replaceDraftText(t,e,Te)}function Wn(e){return e instanceof Error?e.message:`Unknown relay error.`}function Gn(e,t){let n=tu(e,t);return vt.enqueue({kind:`error`,...n}),n.message}function Kn(e){vt.enqueue(e?{kind:`success`,message:`Code copied.`}:{kind:`error`,message:`Code could not be copied. Select it and copy it manually.`})}function qn(e){return(e instanceof DOMException||e instanceof Error)&&e.name===`AbortError`}function Jn(e){let t=G(k);if(!t||e.type===`agent.activity.updated`)return;if(e.type===`session.status.updated`){let n=e.payload;$l(n)&&B(A,G(A).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(A,G(A).map(e=>e.id===t?{...e,...n}:e),!0);return}if(e.type!==`plan.updated`&&e.type!==`plan.closed`)return;if(gt.applyEvent(t,e),e.type===`plan.closed`){B(fe,new Map(G(fe)).set(t,void 0)),B(A,G(A).map(e=>e.id===t?{...e,plan:void 0}:e),!0);return}let n=od(e.payload)?e.payload.plan:sd(e.payload)?e.payload:null;n&&B(fe,new Map(G(fe)).set(t,n)),n&&B(A,G(A).map(e=>e.id===t?{...e,plan:n}:e),!0)}var Yn=Kr();di(`1d2e8zz`,e=>{Rn(()=>{un.title=r&&G(He)?`Chat · ${G(He)} · Gestalt Mobile`:`Gestalt Mobile`})}),Lr(`focus`,ln,rn),Lr(`visibilitychange`,un,rn);var Xn=H(Yn),Zn=e=>{qa(e,{})},Qn=e=>{vu(e,{get variant(){return bt}})},$n=e=>{var t=vy();Pu(V(t),{get context(){return yt}}),P(t),J(e,t)},er=e=>{var d=Dy(),f=H(d),C=V(f),T=e=>{{let n=L(()=>G(a)===`chat`?Hf(G(A).find(e=>e.id===G(k))?.workspacePath??``):null),r=L(()=>G(a)===`chat`?G(F):null),i=L(()=>G(a)===`chat`&&G(k)?R:void 0),c=L(()=>G(a)===`chat`&&G(Ve)?()=>{G(Ve)?.resumeCommand&&Wt(G(Ve).resumeCommand)}:void 0),l=L(()=>!!G(Ve)?.resumeCommand);ya(e,{get theme(){return G(m)},get sessionPath(){return G(n)},get sessionModel(){return G(r)},get weeklyQuotaRemaining(){return G(Ke)},get brandIconUrl(){return G(S)},get componentVersions(){return G(x)},get passkeyAuthEnabled(){return t.passkeyAuthEnabled},get onlock(){return t.onlock},ondevices:()=>B(o,!0),onnotifications:()=>B(s,!0),onscratchpad:wt,onquit:Dt,onthemechange:At,get ondetach(){return G(i)},get oncopytocli(){return G(c)},get copyToCliAvailable(){return G(l)}})}};X(C,e=>{!G(o)&&!G(s)&&!r&&e(T)});var O=U(C,2),fe=e=>{var t=by(),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(Ve).provider===`kimi`?`Kimi · `:``}${G(Ve).model??``}`)),J(e,t)};X(o,e=>{G(Ve)?.model&&e(s)}),P(t),W(()=>{Q(i,`title`,G(He)||r),Y(a,G(He)||r)}),J(e,t)};X(O,e=>{r&&e(fe)});var pe=U(O,2);gu(pe,{get queue(){return vt}});var me=U(pe,2),ye=e=>{Am(e,{get client(){return ht},onclose:()=>{B(o,!1),Tr().then(()=>document.querySelector(`.menu-trigger`)?.focus())},get onlock(){return t.onlock},oncreatepasskey:e=>n()(e)})},xe=e=>{su(e,{get queue(){return vt},onclose:Et})},Te=e=>{var t=Ey(),n=H(t),o=e=>{var t=Cy(),n=U(V(t),2);{let e=L(()=>G(k)?G(de).attention.get(G(k))??null:null),t=L(()=>`chat-attention-${G(k)??`none`}`),r=L(()=>G(k)?G(de).pending.has(G(k)):!1);_o(n,{get attention(){return G(e)},get controlId(){return G(t)},get pending(){return G(r)},onresolve:(e,t)=>G(k)&&It(G(k),e,t)})}var a=U(n,2);{let e=L(()=>G(k)?G(de).snapshots.get(G(k))??null:null),t=L(()=>G(k)?G(de).attention.get(G(k))??null:null),n=L(()=>`chat-autopilot-safety-${G(k)??`none`}`),r=L(()=>G(k)?G(de).pending.has(G(k)):!1);yo(a,{get autopilot(){return G(e)},get attention(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},onrecover:()=>G(k)&&void Ft(G(k)),ondisable:()=>G(k)&&Pt(G(k),!1)})}var o=U(a,2),s=V(o,!0);P(o);var c=U(o,2),l=e=>{var t=xy(),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]:[]);Hc(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 rt},get submittedAnswers(){return G(it)},onanswer:Hn,onquiz:e=>void zn(e),onpermission:e=>void Bn(e),ondecision:(e,t)=>void Ln(e,t),onretry:Vn,onopenorg:hn,oncopyresult:Kn})}var r=U(n,2);{let e=L(()=>G(i)?.status??G(p)),t=L(()=>G(i)?.activeTurnId??null),n=L(()=>G(i)?.starting??!1),a=L(()=>!!(G(A).find(e=>e.id===G(k))&&![`ready`,`turnActive`].includes(G(A).find(e=>e.id===G(k))?.state??``))),o=L(()=>G(Ce)!==null),s=L(()=>G(b)[G(A).find(e=>e.id===G(k))?.provider??`codex`]),c=L(()=>G(A).find(e=>e.id===G(k))?.provider??`codex`);Ho(r,{get status(){return G(e)},get message(){return G(we)},get activeTurnId(){return G(t)},get starting(){return G(n)},get detached(){return G(a)},get retryMessage(){return G(Se)},get retryable(){return G(o)},get models(){return G(s)},get provider(){return G(c)},onchange:Un,onscrollbottom:()=>Ot(`explicit`),onmodelselect:e=>void Gt(e),onsend:()=>void qt(),onqueue:()=>void Jt(),oninterruptsend:()=>void Yt(),onretry:()=>void Qt(),oninterrupt:()=>void $t()})}var a=U(r,2),o=V(a),s=e=>{{let t=L(()=>G(de).snapshots.get(G(k))??null),n=L(()=>`chat-autopilot-${G(k)}`),r=L(()=>G(de).pending.has(G(k)));po(e,{compact:!0,get autopilot(){return G(t)},get controlId(){return G(n)},get pending(){return G(r)},ontoggle:e=>G(k)&&Pt(G(k),e)})}};X(o,e=>{G(Ve)?.provider!==`kimi`&&e(s)});var c=U(o,2);{let e=L(()=>G(ue).get(G(k))??null),t=L(()=>G(A).find(e=>e.id===G(k))?.model??g),n=L(()=>G(A).find(e=>e.id===G(k))?.plan);Ga(c,{compact:!0,get activity(){return G(e)},get rootModel(){return G(t)},get plan(){return G(n)},onopen:()=>G(k)&&void dt.resync(G(k))})}P(a),Ui(U(a,2),e=>B(at,e),()=>G(at)),J(e,t)},u=e=>{var t=Sy(),n=V(t,!0);P(t),W(()=>Y(n,r?G(p):G(D)?`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(k)?e(l):e(u,-1)}),P(t),W(()=>Y(s,G(ct))),J(e,t)},s=e=>{Af(e,{get catalog(){return G(Oe)},get state(){return G(Ge)},onopen:mn,onarchive:vn,get archivingPlans(){return G(Re)},onclose:gn,onreference:On,checkreferences:Dn})},c=e=>{{let t=L(()=>G(Je)?wu(G(h),G(Je))??null:null);Yu(e,{get workspaceTree(){return G(h)},get selectedWorkspace(){return G(t)},get expandedIds(){return G(Ye)},get summary(){return G(qe).summary},get refreshing(){return G(qe).refreshing},get checkingOut(){return G(qe).checkingOut},get cloning(){return G(Ze)},get error(){return G(qe).error},get cloneStatus(){return G(et)},get confirmingPush(){return G(Xe)},onpull:()=>void Nn(),oncheckout:e=>void Fn(e),onopenpushconfirmation:()=>B(Xe,!0),onpush:()=>void In(),oncancelpush:()=>B(Xe,!1),onselect:En,onexpandedchange:e=>B(Ye,e,!0),onbrowsefiles:kn,onclone:e=>void Pn(e)})}},d=e=>{var t=Kr(),n=H(t),r=e=>{var t=Ty(),n=V(t),r=V(n);pi(r,()=>Sn);var i=U(r,2);P(n);var a=U(n,2),o=e=>{Bp(e,{get skillsState(){return G(te)},onrefresh:()=>G(te)?.refresh()??Promise.resolve(),onprofileschange:()=>void bn(),heading:`Skill profile editor`})},s=e=>{J(e,wy())};X(a,e=>{G(te)?e(o):e(s,-1)}),P(t),K(`click`,i,()=>void Cn()),J(e,t)},i=e=>{{let t=L(()=>G(E)===G(ee));_p(e,{get sessions(){return G(A)},get recentSessions(){return G(ge)},get selectedSessionId(){return G(k)},get activitySnapshots(){return G(ue)},get autopilotSnapshots(){return G(de).snapshots},get autopilotPending(){return G(de).pending},get autopilotAttention(){return G(de).attention},get workspaceTree(){return G(h)},get workspaceId(){return G(oe)},get expandedIds(){return G(le)},get sandbox(){return G(_e)},get approvalPolicy(){return G(ve)},get models(){return G(b)[G(ee)]},get selectedModel(){return G(w)[G(ee)]},get reasoningEffort(){return G(_)},get executorModels(){return G(b).codex},get executorModel(){return G(v)},get executorReasoningEffort(){return G(y)},onreasoningchange:e=>B(_,e,!0),onexecutormodelchange:e=>B(v,e,!0),onexecutorreasoningchange:e=>B(y,e,!0),get provider(){return G(ee)},get kimiAvailable(){return G(D)},get modelsLoading(){return G(t)},get skillProfiles(){return G(re)},get selectedSkillProfile(){return G(ie)},get skillProfileError(){return G(ae)},get startingSession(){return G(be)},get openingSessionId(){return G(j)},get savingDefaults(){return G(se)},onsavedefaults:()=>void Ht(),onworkspacechange:e=>B(oe,e,!0),onexpandedchange:e=>B(le,e,!0),onsandboxchange:e=>B(_e,e,!0),onapprovalpolicychange:e=>B(ve,e,!0),onmodelchange:e=>B(w,{...G(w),[G(ee)]:e}),onproviderchange:e=>void jt(e),onskillprofilechange:e=>B(ie,e,!0),onmanageprofiles:e=>void xn(e),onopen:zt,onselectopen:zt,onclose:e=>void Vt(e),onautopilottoggle:Pt,onactivityopen:e=>void dt.resync(e),onautopilotresolve:It,onopenrecent:e=>void Bt(e),onforget:e=>void Ut(e),oncopyresume:e=>void Wt(e),onstart:()=>void Mt(),get advancedExpanded(){return G(ce)},set advancedExpanded(e){B(ce,e,!0)}})}};X(n,e=>{G(ne)===`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 f=U(n,2),m=e=>{_y(e,{get root(){return G(u)},onview:e=>{G(u)&&B(l,{workspaceId:G(u).id,path:e},!0)},get listDirectory(){return lt.listWorkspaceDirectory},get copyEntry(){return lt.copyWorkspaceEntry},get moveEntry(){return lt.moveWorkspaceEntry},get deleteEntry(){return lt.deleteWorkspaceEntry},get uploadFile(){return lt.uploadWorkspaceFile},onclose:()=>void An(),onerror:e=>Gn(e,`WORKSPACE_FILES_READ_FAILED`),onsuccess:e=>vt.enqueue({kind:`success`,message:e}),onmutation:jn})};X(f,e=>{G(u)&&e(m)});var x=U(f,2),S=e=>{Gv(e,{get target(){return G(l)},get readFile(){return lt.getWorkspaceFilePreview},get listDirectory(){return lt.listWorkspaceDirectory},onclose:()=>{B(l,null)},onerror:e=>Gn(e,`WORKSPACE_FILES_READ_FAILED`)})};X(x,e=>{G(l)&&e(S)});var C=U(x,2),T=e=>{Cp(e,{get activeTab(){return G(a)},get chatEnabled(){return G(he)},get focusTab(){return G(M)},onselect:tn})};X(C,e=>{r||e(T)}),J(e,t)};X(me,e=>{G(o)&&t.passkeyAuthEnabled?e(ye):G(s)?e(xe,1):e(Te,-1)}),P(f);var Ee=U(f,2),De=e=>{Hm(e,{onclose:Tt})};X(Ee,e=>{G(c)&&e(De)}),K(`pointerdown`,f,cn),K(`pointerup`,f,dn),Lr(`pointercancel`,f,fn),J(e,d)};X(Xn,e=>{xt===`true`?e(Zn):bt===`error`||bt===`stacked`?e(Qn,1):yt===`sessions`||yt===`git`?e($n,2):e(er,-1)}),J(e,Yn),$e()}Rr([`pointerdown`,`pointerup`,`click`]);function ky(){throw Error(`AUTH_RESPONSE_INVALID`)}async function Ay(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 jy(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 My(e){return!!e&&typeof e==`object`&&!!e.options&&typeof e.options.challenge==`string`}function Ny(e){return!!e&&typeof e==`object`&&e.status===`authenticated`}function Py(e=fetch){async function t(){let t=await Ay(await e(`/api/auth/status`,{credentials:`same-origin`}));return jy(t)||ky(),t}async function n(t,n={}){let r=await Ay(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return My(r)||ky(),r}async function r(t,n){let r=await Ay(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return Ny(r)||ky(),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 Fy(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 Iy(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 Ly(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 Ry(){return zy.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var zy={stubThis:e=>e};function By(e){let{id:t}=e;return{...e,id:Ly(t),transports:e.transports}}function Vy(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 Hy=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 Uy({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 Hy({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 Hy({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 Hy({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 Hy({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 Hy({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Hy({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 Hy({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Hy({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(!Vy(t))return new Hy({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Hy({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 Hy({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 Hy({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 Wy=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}}},Gy=[`cross-platform`,`platform`];function Ky(e){if(e&&!(Gy.indexOf(e)<0))return e}async function qy(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(!Ry())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Ly(t.challenge),user:{...t.user,id:Ly(t.user.id)},excludeCredentials:t.excludeCredentials?.map(By)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Wy.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Uy({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){Jy(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Iy(e))}catch(e){Jy(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Iy(c.getAuthenticatorData())}catch(e){Jy(`getAuthenticatorData()`,e)}return{id:o,rawId:Iy(s),response:{attestationObject:Iy(c.attestationObject),clientDataJSON:Iy(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Ky(a.authenticatorAttachment)}}function Jy(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 Yy(){if(!Ry())return Xy.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Xy.stubThis(new Promise(e=>e(!1))):Xy.stubThis(e.isConditionalMediationAvailable())}var Xy={stubThis:e=>e};function Zy({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 Hy({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Hy({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Vy(t))return new Hy({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Hy({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 Hy({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 Qy(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(!Ry())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(By));let a={...t,challenge:Ly(t.challenge),allowCredentials:i},o={};if(n){if(!await Yy())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=Wy.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Zy({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=Iy(u.userHandle)),{id:c,rawId:Iy(l),response:{authenticatorData:Iy(u.authenticatorData),clientDataJSON:Iy(u.clientDataJSON),signature:Iy(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Ky(s.authenticatorAttachment)}}function $y(e){return typeof e==`object`&&e?e:{}}function eb(e){let t=$y(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 eb(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 tb(){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(!tb()){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 rb=q(`<p class="warning svelte-1c5qcm6">This one-time link authorizes one new passkey. Choose a nickname and complete the passkey
|
|
105
|
+
prompt before it expires.</p>`),ib=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
|
|
106
|
+
first-device access. Enroll this device before exposing the instance, and confirm you are at the
|
|
107
|
+
canonical address before continuing.</p>`),ab=q(`<p class="error svelte-1c5qcm6">Passkeys require a secure browser on this device.</p>`),ob=q(`<p class="feedback svelte-1c5qcm6"> </p>`),sb=q(`<img alt="QR code for the first-device setup link" class="svelte-1c5qcm6"/>`),cb=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
|
|
108
|
+
authorize that device.</p> <a class="svelte-1c5qcm6"> </a> <button type="button" class="copy svelte-1c5qcm6">Copy setup link</button></div></div>`),lb=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 ub(e,t){Qe(t,!0);let n=z(``),r=z(null),i=z(!1),a=z(null),o=!0,s=!0,c=L(()=>vm(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||ym(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 qy({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,eb(e),!0)}finally{B(i,!1)}}}var g=lb(),_=V(g),v=U(V(_),2),y=V(v,!0);P(v);var b=U(v,2),x=e=>{J(e,rb())},S=e=>{J(e,ib())};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,ab())},ee=L(()=>!u());X(E,e=>{G(ee)&&e(D)});var O=U(E,2),te=e=>{var t=ob(),n=V(t,!0);P(t),W(()=>Y(n,G(r))),J(e,t)};X(O,e=>{G(r)&&e(te)});var ne=U(O,2),re=e=>{var t=cb(),n=V(t),r=e=>{var t=sb();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(ne,e=>{t.enrollmentTicket||e(re)}),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),$e()}Rr([`click`]);var db=q(`<p class="error svelte-1byekj9">Passkeys require this relay to be opened over a secure connection.</p>`),fb=q(`<p class="error svelte-1byekj9">This browser does not support passkeys. Use an authorized browser or device.</p>`),pb=q(`<p class="svelte-1byekj9"> </p> <button class="sign-in svelte-1byekj9" type="button"> </button>`,1),mb=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 hb(e,t){Qe(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)?eb(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 Qy({optionsJSON:e});await t.client.verifyLogin(n),t.onAuthenticated()}catch(e){B(n,o(e),!0)}finally{B(r,!1)}}}var c=mb(),l=V(c),u=U(V(l),4),d=e=>{J(e,db())},f=e=>{J(e,fb())},p=e=>{var t=pb(),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),$e()}Rr([`click`]);var gb=q(`<p>Checking this device…</p>`),_b=q(`<h1 class="svelte-y74n0s">Passkey support is required</h1> <p> </p>`,1),vb=q(`<h1 class="svelte-y74n0s">Unable to check this device</h1> <p> </p> <button type="button" class="svelte-y74n0s">Try again</button>`,1),yb=q(`<main class="auth-gate svelte-y74n0s" aria-live="polite"><!></main>`);function bb(e,t){Qe(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=Py(),c=nb(s,e=>B(a,e,!0)),l=Fy(()=>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=>{Oy(e,{get authorizedFetch(){return l},get theme(){return n()},get passkeyAuthEnabled(){return G(a).passkeyAuthEnabled},onlock:()=>void d(),oncreatepasskey:u})},h=e=>{ub(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=>{hb(e,{get client(){return s},get message(){return G(a).message},onAuthenticated:()=>c.authenticated()})},_=e=>{var t=yb(),n=V(t),r=e=>{J(e,gb())},i=e=>{var t=_b(),n=U(H(t),2),r=V(n,!0);P(n),W(()=>Y(r,G(a).message)),J(e,t)},o=e=>{var t=vb(),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),$e()}Rr([`click`]);function xb(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 Sb(e,t,n,r=qr,i={}){return r(bb,{target:e,props:{enrollmentTicket:xb(t,n),initialTheme:aa(i)}})}function Cb(){return{readyState:document.readyState,addLoadListener:e=>window.addEventListener(`load`,e,{once:!0}),serviceWorker:navigator.serviceWorker}}function wb(e=Cb()){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 Tb=document.getElementById(`app`);if(!Tb)throw Error(`Missing application mount target`);Sb(Tb,window.location,window.history),wb();
|