koppler 0.0.1 → 0.0.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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return typeof e?.then==`function`}function m(e){return e()}function h(e){for(var t=0;t<e.length;t++)e[t]()}function g(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _(e,t,n=!1){return e===void 0?n?t():t:e}function v(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}function y(e,t){var n={};for(var r in e)t.includes(r)||(n[r]=e[r]);for(var i of Object.getOwnPropertySymbols(e))Object.propertyIsEnumerable.call(e,i)&&!t.includes(i)&&(n[i]=e[i]);return n}var b=1<<24,x=1024,S=2048,C=4096,w=8192,ee=16384,T=32768,te=1<<25,E=65536,ne=1<<19,re=1<<20,ie=1<<25,ae=1<<21,oe=1<<22,se=1<<23,ce=Symbol(`$state`),le=Symbol(`component`),ue=Symbol(`legacy props`),de=Symbol(``),fe=Symbol(`attributes`),pe=Symbol(`class`),me=Symbol(`style`),he=Symbol(`text`),ge=Symbol(`form reset`),_e=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ve=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ye={},be=Symbol(`uninitialized`),xe=`http://www.w3.org/1999/xhtml`,Se=`http://www.w3.org/2000/svg`;function Ce(){console.warn(`https://svelte.dev/e/derived_inert`)}function we(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Te(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Ee(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var D=!1;function De(e){D=e}var Oe;function ke(e){if(e===null)throw we(),ye;return Oe=e}function Ae(){return ke(wn(Oe))}function O(e){if(D){if(wn(Oe)!==null)throw we(),ye;Oe=e}}function je(e=1){if(D){for(var t=e,n=Oe;t--;)n=wn(n);Oe=n}}function Me(e=!0){for(var t=0,n=Oe;;){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=wn(n);e&&n.remove(),n=i}}function Ne(e){if(!e||e.nodeType!==8)throw we(),ye;return e.data}function Pe(e){return e===this.v}function Fe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ie(e){return!Fe(e,this.v)}function Le(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Re(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ze(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Be(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ve(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function He(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ue(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function We(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Ge(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ke(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function qe(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Je(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ye=!1;function Xe(){Ye=!0}var Ze=[];function Qe(e,t=!1,n=!1){return $e(e,new Map,``,Ze,null,n)}function $e(t,n,r,i,a=null,o=!1){if(typeof t==`object`&&t){var c=n.get(t);if(c!==void 0)return c;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(e(t)){var u=Array(t.length);n.set(t,u),a!==null&&n.set(a,u);for(var d=0;d<t.length;d+=1){var f=t[d];d in t&&(u[d]=$e(f,n,r,i,null,o))}return u}if(l(t)===s){u={},n.set(t,u),a!==null&&n.set(a,u);for(var p of Object.keys(t))u[p]=$e(t[p],n,r,i,null,o);return u}if(t instanceof Date)return t.getTime(),structuredClone(t);if(typeof t.toJSON==`function`&&!o)return $e(t.toJSON(),n,r,i,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}function et(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return t?.c??null}function tt(e,t){return e===null&&Le(t),e.c??=new Map(et(e)||void 0)}var nt=null;function rt(e){nt=e}function it(e){return tt(nt,`getContext`).get(e)}function at(e,t){return tt(nt,`setContext`).set(e,t),t}function ot(e){return tt(nt,`hasContext`).has(e)}function k(e,t=!1,n){nt={p:nt,i:!1,c:null,e:null,s:e,x:null,r:ur,l:Ye&&!t?{s:null,u:null,$:[]}:null}}function A(e){var t=nt,n=t.e;if(n!==null){t.e=null;for(var r of n)Ln(r)}return e!==void 0&&(t.x=e),t.i=!0,nt=t.p,st(e)}function st(e={}){return i(e,le,{value:!0}),e}function ct(){return!Ye||nt!==null&&nt.l===null}var lt=[];function ut(){var e=lt;lt=[],h(e)}function dt(e){if(lt.length===0&&!Vt){var t=lt;queueMicrotask(()=>{t===lt&&ut()})}lt.push(e)}function ft(){for(;lt.length>0;)ut()}var pt=~(S|C|x);function mt(e,t){e.f=e.f&pt|t}function ht(e){e.f&512||e.deps===null?mt(e,x):mt(e,C)}function gt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),mt(e,x)}function _t(e,t){if(t){let t=document.body;e.autofocus=!0,dt(()=>{document.activeElement===t&&e.focus()})}}function vt(e){D&&Cn(e)!==null&&Tn(e)}var yt=!1;function bt(){yt||(yt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ge]?.()})},{capture:!0}))}function xt(e){var t=sr,n=ur;lr(null),dr(null);try{return e()}finally{lr(t),dr(n)}}function St(e,t,n,r=n){e.addEventListener(t,()=>xt(n));let i=e[ge];e[ge]=i?()=>{i(),r(!0)}:()=>r(!0),bt()}function Ct(e,t,n,r){let i=ct()?Dt:At;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=ur,c=wt(),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){An(e,s)}Tt()}}var d=Et();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>kt(e))).then(u).catch(e=>An(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),Tt())}):f()}function wt(){var e=ur,t=sr,n=nt,r=Lt;return function(i=!0){dr(e),lr(t),rt(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Tt(e=!0){dr(null),lr(null),rt(null),e&&Lt?.deactivate()}function Et(){var e=ur,t=e.b,n=Lt,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 Dt(e){var t=2|S;return ur!==null&&(ur.f|=ne),{ctx:nt,deps:null,effects:null,equals:Pe,f:t,fn:e,reactions:null,rv:0,v:be,wv:0,parent:ur,ac:null}}var Ot=Symbol(`obsolete`);function kt(e,t,n){let r=ur;r===null&&Re();var i=void 0,a=an(be),o=!sr,s=new Set;return Hn(()=>{var t=ur,n=g();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==_e&&n.reject(e)}).finally(Tt)}catch(e){n.reject(e),Tt()}var c=Lt;if(o){if(t.f&32768)var l=Et();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Ot);else for(let e of s.values())e.reject(Ot);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Ot&&(c.activate(),t?(a.f|=se,ln(a,t)):(a.f&8388608&&(a.f^=se),ln(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Fn(()=>{for(let e of s)e.reject(Ot)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function j(e){let t=Dt(e);return pr(t),t}function At(e){let t=Dt(e);return t.equals=Ie,t}function jt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Xn(t[n])}}function Mt(e){var t,n=ur,r=e.parent;if(!ar&&r!==null&&e.v!==be&&r.f&24576)return Ce(),e.v;dr(r);try{jt(e),t=Tr(e)}finally{dr(n)}return t}function Nt(e){var t=Mt(e);!e.equals(t)&&(e.wv=Sr(),(!Lt?.is_fork||e.deps===null)&&(Lt===null?e.v=t:(Lt.capture(e,t,!0),Rt?.capture(e,t,!0)),e.deps===null))?mt(e,x):ar||(zt===null?ht(e):(Pn()||Lt?.is_fork)&&zt.set(e,t))}function Pt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&xt(()=>{t.ac.abort(_e),t.ac=null}),t.fn!==null&&(t.teardown=f),Or(t,0),Jn(t))}function Ft(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&kr(t)}var It=null,Lt=null,Rt=null,zt=null,Bt=null,Vt=!1,Ht=!1,Ut=null,Wt=null,Gt=0,Kt=1,qt=class e{id=Kt++;#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(){It===null?It=this:(It.#n=this,this.#t=It),It=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)mt(r,S),t(r);for(r of n.m)mt(r,C),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=x}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),mt(e,S),this.schedule(e);for(let e of this.#d)mt(e,C),this.schedule(e);this.apply();for(var t=Ut=[],n=[],r=Wt=[];this.#c.length>0;){Gt++>1e3&&(this.#S(),Yt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw en(e),this.#h()||this.discard(),t}}if(Lt=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Ut=null,Wt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)$t(e,t);r.length>0&&Lt.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Rt=this,Zt(n),Zt(t),Rt=null,this.#s?.resolve();var o=Lt;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(nn.clear(),o.#_())}}#v(e,t,n){e.f^=x;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=x:i&4?t.push(r):Cr(r)&&(i&16&&this.#d.add(r),kr(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}}}#y(){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}#b(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&&!(e.f&2&&!(e.f&6144)))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),mt(i,S),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),Lt=this,this.#_()}#x(e){for(var t=0;t<e.length;t+=1)gt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==be&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),zt?.set(e,t)),this.is_fork||(e.v=t)}activate(){Lt=this}deactivate(){Lt=null,zt=null}flush(){try{Ht=!0,Lt=this,this.#_()}finally{Gt=0,Bt=null,Ut=null,Wt=null,Ht=!1,Lt=null,zt=null,nn.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(Ot);this.#S(),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,dt(()=>{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??=g()).promise}static ensure(){if(Lt===null){let t=Lt=new e;!Ht&&!Vt&&dt(()=>{t.#e||t.flush()})}return Lt}apply(){zt=null}schedule(e){Bt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?It=e:t.#t=e,this.linked=!1}}};function Jt(e){var t=Vt,n=Rt;Rt=null,Vt=!0;try{var r;for(e&&(Jt(),r=e());;){if(ft(),Lt===null)return r;Lt.flush()}}finally{Vt=t,Rt=n}}function Yt(){try{Ue()}catch(e){An(e,Bt)}}var Xt=null;function Zt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Cr(r)&&(Xt=new Set,kr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Qn(r),Xt?.size>0)){nn.clear();for(let e of Xt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Xt.has(n)&&(Xt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||kr(n)}}Xt.clear()}}Xt=null}}function Qt(e){Lt.schedule(e)}function $t(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),mt(e,x);for(var n=e.first;n!==null;)$t(n,t),n=n.next}}function en(e){mt(e,x);for(var t=e.first;t!==null;)en(t),t=t.next}var tn=new Set,nn=new Map,rn=!1;function an(e,t){return{f:0,v:e,reactions:null,equals:Pe,rv:0,wv:0}}function M(e,t){let n=an(e,t);return pr(n),n}function on(e,t=!1,n=!0){let r=an(e);return t||(r.equals=Ie),Ye&&n&&nt!==null&&nt.l!==null&&(nt.l.s??=[]).push(r),r}function N(e,t,n=!1){return sr!==null&&(!cr||sr.f&131072)&&ct()&&sr.f&4325394&&(fr===null||!fr.has(e))&&qe(),ln(e,n?pn(t):t,Wt)}var sn=null,cn=0;function ln(e,t,n=null){if(!e.equals(t)){ar?nn.set(e,t):nn.has(e)||nn.set(e,e.v);var r=qt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Mt(t),zt===null&&ht(t)}e.wv=Sr(),sn=null,cn=0,fn(e,S,n),sn=null,ct()&&ur!==null&&ur.f&1024&&!(ur.f&96)&&(gr===null?_r([e]):gr.push(e)),!r.is_fork&&tn.size>0&&!rn&&un()}return t}function un(){rn=!1;for(let e of tn){e.f&1024&&mt(e,C);let t;try{t=Cr(e)}catch{t=!0}t&&kr(e)}tn.clear()}function dn(e){N(e,e.v+1)}function fn(e,t,n){var r=e.reactions;if(r!==null){var i=ct(),a=r.length;if(cn+=a,cn>1e5&&sn===null&&(sn=new Set),sn!==null){if(sn.has(e))return;sn.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==ur){var l=(c&S)===0;if(l&&mt(s,t),c&131072)tn.add(s);else if(c&2){var u=s;zt?.delete(u),fn(u,C,n)}else if(l){var d=s;c&16&&Xt!==null&&Xt.add(d),n===null?Qt(d):n.push(d)}}}}}function pn(t){if(typeof t!=`object`||!t||ce in t||le in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=M(0),u=null,d=br,f=e=>{if(br===d)return e();var t=sr,n=br;lr(null),xr(d);var r=e();return lr(t),xr(n),r};return i&&r.set(`length`,M(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Ge();var i=r.get(t);return i===void 0?f(()=>{var e=M(n.value,u);return r.set(t,e),e}):N(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>M(be,u));r.set(t,e),dn(o)}}else N(n,be),dn(o);return!0},get(e,n,i){if(n===ce)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>M(pn(s?e[n]:be),u)),r.set(n,o)),o!==void 0){var c=z(o);return c===be?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var n=Reflect.getOwnPropertyDescriptor(e,t),i=r.get(t);if(i!==void 0){var a=z(i);if(a===be)return;if(n&&`value`in n)n.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return n},has(e,t){if(t===ce)return!0;var n=r.get(t),i=n!==void 0&&n.v!==be||Reflect.has(e,t);return(n!==void 0||ur!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>M(i?pn(e[t]):be,u)),r.set(t,n)),z(n)===be)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>M(be,u)),r.set(d+``,p)):N(p,be)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>M(void 0,u)),N(c,pn(n)),r.set(t,c));else{l=c.v!==be;var m=f(()=>pn(n));N(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&N(g,_+1)}dn(o)}return!0},ownKeys(e){z(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==be});for(var[n,i]of r)i.v!==be&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ke()}})}function mn(e){try{if(typeof e==`object`&&e&&ce in e)return e[ce]}catch{}return e}function hn(e,t){return Object.is(mn(e),mn(t))}var gn,_n,vn,yn,bn;function xn(){if(gn===void 0){gn=window,_n=document,vn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;yn=a(t,`firstChild`).get,bn=a(t,`nextSibling`).get,u(e)&&(e[pe]=void 0,e[fe]=null,e[me]=void 0,e.__e=void 0),u(n)&&(n[he]=void 0)}}function Sn(e=``){return document.createTextNode(e)}function Cn(e){return yn.call(e)}function wn(e){return bn.call(e)}function P(e,t){if(!D)return Cn(e);var n=Cn(Oe);if(n===null)n=Oe.appendChild(Sn());else if(t&&n.nodeType!==3){var r=Sn();return n?.before(r),ke(r),r}return t&&On(n),ke(n),n}function F(e,t=!1){if(!D){var n=Cn(e);return n instanceof Comment&&n.data===``?wn(n):n}if(t){if(Oe?.nodeType!==3){var r=Sn();return Oe?.before(r),ke(r),r}On(Oe)}return Oe}function I(e,t=!1){if(!D)return Cn(e);var n=P(e,t);return O(e),n}function L(e,t=1,n=!1){let r=D?Oe:e;for(var i;t--;)i=r,r=wn(r);if(!D)return r;if(n){if(r?.nodeType!==3){var a=Sn();return r===null?i?.after(a):r.before(a),ke(a),a}On(r)}return ke(r),r}function Tn(e){e.textContent=``}function En(){return!1}function Dn(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 On(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 kn(e){var t=ur;if(t===null)return sr.f|=se,e;if(!(t.f&32768)&&!(t.f&4))throw e;An(e,t)}function An(e,t){if(e===ye)throw e;if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function jn(e){ur===null&&(sr===null&&He(e),Ve()),ar&&Be(e)}function Mn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Nn(e,t){var n=ur;n!==null&&n.f&8192&&(e|=w);var r={ctx:nt,deps:null,nodes:null,f:e|S|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Lt?.register_created_effect(r);var i=r;if(e&4)Ut===null?qt.ensure().schedule(r):Ut.push(r);else if(t!==null){try{kr(r)}catch(e){throw Xn(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|=E))}if(i!==null&&(i.parent=n,n!==null&&Mn(i,n),sr!==null&&sr.f&2&&!(e&64))){var a=sr;(a.effects??=[]).push(i)}return r}function Pn(){return sr!==null&&!cr}function Fn(e){let t=Nn(8,null);return mt(t,x),t.teardown=e,t}function In(e){jn(`$effect`);var t=ur.f;if(!sr&&t&32&&nt!==null&&!nt.i){var n=nt;(n.e??=[]).push(e)}else return Ln(e)}function Ln(e){return Nn(4|re,e)}function Rn(e){return jn(`$effect.pre`),Nn(8|re,e)}function zn(e){qt.ensure();let t=Nn(64|ne,e);return()=>{Xn(t)}}function Bn(e){qt.ensure();let t=Nn(64|ne,e);return(e={})=>new Promise(n=>{e.outro?$n(t,()=>{Xn(t),n(void 0)}):(Xn(t),n(void 0))})}function Vn(e){return Nn(4,e)}function Hn(e){return Nn(oe|ne,e)}function Un(e,t=0){return Nn(8|t,e)}function R(e,t=[],n=[],r=[]){Ct(r,t,n,t=>{Nn(8,()=>{e(...t.map(z))})})}function Wn(e,t=0){return Nn(16|t,e)}function Gn(e,t=0){return Nn(b|t,e)}function Kn(e){return Nn(32|ne,e)}function qn(e){var t=e.teardown;if(t!==null){let n=ar,r=sr;or(!0),lr(null);try{t.call(null)}catch(t){An(t,e.parent)}finally{or(n),lr(r)}}}function Jn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&xt(()=>{e.abort(_e)});var r=n.next;n.f&64?n.parent=null:Xn(n,t),n=r}}function Yn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Xn(t),t=n}}function Xn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Zn(e.nodes.start,e.nodes.end),n=!0),e.f|=te,Jn(e,t&&!n),Or(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();qn(e),e.f^=te,e.f|=ee;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 Zn(e,t){for(;e!==null;){var n=e===t?null:wn(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 $n(e,t,n=!0){var r=[];e.f|=256,er(e,r,!0);var i=()=>{n&&Xn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function er(e,t,n){if(!(e.f&8192)){e.f^=w;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)||!!(i.f&32)&&!!(e.f&16);er(i,t,o?n:!1)}i=a}}}function tr(e){e.f&=-257,nr(e,!0)}function nr(e,t){if(!(e.f&256)&&e.f&8192){e.f^=w,e.f&1024||(mt(e,S),qt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);nr(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 rr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:wn(n);t.append(n),n=i}}var ir=null,ar=!1;function or(e){ar=e}var sr=null,cr=!1;function lr(e){sr=e}var ur=null;function dr(e){ur=e}var fr=null;function pr(e){sr!==null&&(sr.f&2097152||sr.f&2)&&(fr??=new Set).add(e)}var mr=null,hr=0,gr=null;function _r(e){gr=e}var vr=1,yr=0,br=yr;function xr(e){br=e}function Sr(){return++vr}function Cr(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Cr(a)&&Nt(a),a.wv>e.wv)return!0}t&512&&zt===null&&mt(e,x)}return!1}function wr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(fr!==null&&fr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?wr(a,t,!1):t===a&&(n?mt(a,S):a.f&1024&&mt(a,C),Qt(a))}}function Tr(e){var t=mr,n=hr,r=gr,i=sr,a=fr,o=nt,s=cr,c=br,l=e.f;mr=null,hr=0,gr=null,sr=l&96?null:e,fr=null,rt(e.ctx),cr=!1,br=++yr,e.ac!==null&&(xt(()=>{e.ac.abort(_e)}),e.ac=null);try{e.f|=ae;var u=e.fn,d=u();e.f|=T;var f=Er(e);if(ct()&&gr!==null&&!cr&&f!==null&&!(e.f&6146))for(var p=0;p<gr.length;p++)wr(gr[p],e);if(i!==null&&i!==e){if(yr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=yr;if(t!==null)for(let e of t)e.rv=yr;gr!==null&&(r===null?r=gr:r.push(...gr))}return e.f&8388608&&(e.f^=se),d}catch(t){return Er(e),kn(t)}finally{e.f^=ae,mr=t,hr=n,gr=r,sr=i,fr=a,rt(o),cr=s,br=c}}function Er(e){var t=e.deps,n=Lt?.is_fork;if(mr!==null){var r;if(n||Or(e,hr),t!==null&&hr>0)for(t.length=hr+mr.length,r=0;r<mr.length;r++)t[hr+r]=mr[r];else e.deps=t=mr;if(Pn()&&e.f&512)for(r=hr;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&hr<t.length&&(Or(e,hr),t.length=hr);return t}function Dr(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(mr===null||!n.call(mr,r))){var s=r;s.f&512&&(s.f^=512),s.v!==be&&ht(s),s.ac!==null&&xt(()=>{s.ac.abort(_e),s.ac=null,mt(s,S)}),Pt(s),Or(s,0)}}function Or(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Dr(e,n[r])}function kr(e){var t=e.f;if(!(t&16384)){mt(e,x);var n=ur;ur=e;try{t&16777232?Yn(e):Jn(e),qn(e);var r=Tr(e);e.teardown=typeof r==`function`?r:null,e.wv=vr}finally{ur=n}}}async function Ar(){await Promise.resolve(),Jt()}function z(e){var t=!!(e.f&2);if(ir?.add(e),sr!==null&&!cr&&!(ur!==null&&ur.f&16384)&&(fr===null||!fr.has(e))){var r=sr.deps;if(sr.f&2097152)e.rv<yr&&(e.rv=yr,mr===null&&r!==null&&r[hr]===e?hr++:mr===null?mr=[e]:mr.push(e));else{sr.deps??=[],n.call(sr.deps,e)||sr.deps.push(e);var i=e.reactions;i===null?e.reactions=[sr]:n.call(i,sr)||i.push(sr)}}if(ar&&nn.has(e))return nn.get(e);if(t){var a=e;if(ar){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Mr(a))&&(o=Mt(a)),nn.set(a,o),o}var s=!(a.f&512)&&!cr&&sr!==null&&!!(sr.f&512),c=(a.f&T)===0;Cr(a)&&(s&&(a.f|=512),Nt(a)),s&&!c&&(Ft(a),jr(a))}if(zt?.has(e))return zt.get(e);if(e.f&8388608)throw e.v;return e.v}function jr(e){if(e.f|=512,e.deps!==null)for(let r of e.deps){var t=r.reactions;t===null?r.reactions=[e]:n.call(t,e)||t.push(e),r.f&2&&!(r.f&512)&&(Ft(r),jr(r))}}function Mr(e){if(e.v===be)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(nn.has(t)||t.f&2&&Mr(t))return!0;return!1}function Nr(e){var t=cr;try{return cr=!0,e()}finally{cr=t}}function Pr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(ce in e)Fr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&ce in n&&Fr(n)}}}function Fr(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{Fr(e[n],t)}catch{}let n=l(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=o(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}function Ir(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var Lr=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function Rr(e){return Lr.includes(e)}var zr=`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(`.`),Br={formnovalidate:`formNoValidate`,ismap:`isMap`,nomodule:`noModule`,playsinline:`playsInline`,readonly:`readOnly`,defaultvalue:`defaultValue`,defaultchecked:`defaultChecked`,srcobject:`srcObject`,novalidate:`noValidate`,allowfullscreen:`allowFullscreen`,disablepictureinpicture:`disablePictureInPicture`,disableremoteplayback:`disableRemotePlayback`};function Vr(e){return e=e.toLowerCase(),Br[e]??e}[...zr];var Hr=[`touchstart`,`touchmove`];function Ur(e){return Hr.includes(e)}var Wr=[`textarea`,`script`,`style`,`title`];function Gr(e){return Wr.includes(e)}var Kr=Symbol(`events`),qr=new Set,Jr=new Set;function Yr(e,t,n,r={}){function i(e){if(r.capture||ei.call(t,e),!e.cancelBubble)return xt(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,dt(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Xr(e,t,n,r={}){var i=Yr(t,e,n,r);return()=>{i.__removed=!0,e.removeEventListener(t,i,r)}}function B(e,t,n,r,i){var a={capture:r,passive:i},o=Yr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Fn(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function V(e,t,n){(t[Kr]??={})[e]=n}function Zr(e){for(var t=0;t<e.length;t++)qr.add(e[t]);for(var n of Jr)n(e)}var Qr=null,$r=!1;function ei(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;Qr=e,$r||($r=!0,setTimeout(()=>{$r=!1,Qr=null}));var s=0,c=Qr===e&&e[Kr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[Kr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=sr,f=ur;lr(null),dr(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[Kr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Kr]=t,delete e.currentTarget,lr(d),dr(f)}}}var ti=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ni(e){return ti?.createHTML(e)??e}function ri(e){var t=Dn(`template`);return t.innerHTML=ni(e.replaceAll(`<!>`,`<!---->`)),t.content}function ii(e,t){var n=ur;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function H(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(D)return ii(Oe,null),Oe;i===void 0&&(i=ri(a?e:`<!>`+e),n||(i=Cn(i)));var t=r||vn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Cn(t),s=t.lastChild;ii(o,s)}else ii(t,t);return t}}function ai(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=!!(t&1),a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(D)return ii(Oe,null),Oe;if(!o){var e=Cn(ri(a));if(i)for(o=document.createDocumentFragment();Cn(e);)o.appendChild(Cn(e));else o=Cn(e)}var t=o.cloneNode(!0);if(i){var n=Cn(t),r=t.lastChild;ii(n,r)}else ii(t,t);return t}}function oi(e,t){return ai(e,t,`svg`)}function si(e=``){if(!D){var t=Sn(e+``);return ii(t,t),t}var n=Oe;return n.nodeType===3?On(n):(n.before(n=Sn()),ke(n)),ii(n,n),n}function ci(){if(D)return ii(Oe,null),Oe;var e=document.createDocumentFragment(),t=document.createComment(``),n=Sn();return e.append(t,n),ii(t,n),e}function U(e,t){if(D){var n=ur;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=Oe),Ae()}else e!==null&&e.before(t)}function li(){if(D&&Oe&&Oe.nodeType===8&&Oe.textContent?.startsWith(`$`)){let e=Oe.textContent.substring(1);return Ae(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function ui(e){let t=0,n=an(0),r;return()=>{Pn()&&(z(n),Un(()=>(t===0&&(r=Nr(()=>e(()=>dn(n)))),t+=1,()=>{dt(()=>{--t,t===0&&(r?.(),r=void 0,dn(n))})})))}}var di=E|ne;function fi(e,t,n,r){new pi(e,t,n,r)}var pi=class{parent;is_pending=!1;transform_error;#e;#t=D?Oe: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=ui(()=>(this.#m=an(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=ur;t.b=this,t.f|=128,n(e)},this.parent=ur.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Wn(()=>{if(D){let e=Ne(this.#t);Ae();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#_(t)}else t?this.#b():this.#g()}else this.#x()},di),D&&(this.#e=Oe)}#g(){try{this.#a=Kn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);dt(r),t&&(this.#s=Kn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{this.#y()||(t?Ee():(t=!0,n&&Je(),this.#s!==null&&$n(this.#s,()=>{this.#s=null}),this.#C(()=>{this.#x()})))};return{reset:r,invoke_onerror:()=>{if(!this.#y())try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){An(e,this.#i&&this.#i.parent)}}}}#y(){return(this.#i.f&(ee|te))!==0}#b(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Kn(()=>e(this.#e)),dt(()=>{if(!this.#y()){var e=this.#c=document.createDocumentFragment(),t=Sn(),n=!1;e.append(t),this.#a=this.#C(()=>{try{return Kn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){An(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#S(Lt)):this.#u===0&&(this.#e.before(e),this.#c=null,$n(this.#o,()=>{this.#o=null}),this.#S(Lt))}}))}#x(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Kn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();rr(this.#a,e);let t=this.#n.pending;this.#o=Kn(()=>t(this.#e))}else this.#S(Lt)}catch(e){this.error(e)}}#S(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){gt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#C(e){var t=ur,n=sr,r=nt;dr(this.#i),lr(this.#i),rt(this.#i.ctx);try{return qt.ensure(),e()}finally{dr(t),lr(n),rt(r)}}#w(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#S(t),this.#o&&$n(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#w(e,t)}update_pending_count(e,t){this.#w(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,dt(()=>{this.#d=!1,this.#m&&ln(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),z(this.#m)}error(e){if(e===ye||!this.#n.onerror&&!this.#n.failed)throw e;Lt?.is_fork?(this.#a&&Lt.skip_effect(this.#a),this.#o&&Lt.skip_effect(this.#o),this.#s&&Lt.skip_effect(this.#s),Lt.oncommit(()=>{this.#y()||this.#T(e)})):this.#T(e)}#T(e){this.#a&&=(Xn(this.#a),null),this.#o&&=(Xn(this.#o),null),this.#s&&=(Xn(this.#s),null),D&&(ke(this.#t),je(),ke(Me()));let t=this.#n.failed,n=e=>{if(this.#y())return;let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&!this.#y()&&(this.#s=this.#C(()=>{try{return Kn(()=>{var r=ur;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return An(e,this.#i.parent),null}}))};dt(()=>{if(!this.#y()){var t;try{t=this.transform_error(e)}catch(e){An(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>An(e,this.#i&&this.#i.parent)):n(t)}})}};function W(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[he]??=e.nodeValue)&&(e[he]=n,e.nodeValue=`${n}`)}function mi(e,t){return gi(e,t)}var hi=new Map;function gi(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){xn();var l=void 0,u=Bn(()=>{var s=n??t.appendChild(Sn());fi(s,{pending:()=>{}},t=>{k({});var n=nt;if(o&&(n.c=o),a&&(i.$$events=a),D&&ii(t,null),l=e(t,i)||st(),D&&(ur.nodes.end=Oe,Oe===null||Oe.nodeType!==8||Oe.data!==`]`))throw we(),ye;A()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=Ur(r);for(let e of[t,document]){var a=hi.get(e);a===void 0&&(a=new Map,hi.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,ei,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(qr)),Jr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=hi.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,ei),r.delete(e),r.size===0&&hi.delete(n)):r.set(e,i)}Jr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return _i.set(l,u),l}var _i=new WeakMap,vi=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)tr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(tr(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&&(Xn(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();rr(r,t),t.append(Sn()),this.#n.set(e,{effect:r,fragment:t})}else Xn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),$n(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)||(Xn(n.effect),this.#n.delete(e))};ensure(e,t){var n=Lt,r=En();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=Sn();i.append(a),this.#n.set(e,{effect:Kn(()=>t(a)),fragment:i})}else this.#t.set(e,Kn(()=>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 D&&(this.anchor=Oe),this.#a(n)}},yi=0,bi=1,xi=2;function Si(e,t,n,r,i){D&&Ae();var a=ct(),o=be,s=a?an(o):on(o,!1,!1),c=a?an(o):on(o,!1,!1),l=new vi(e);Wn(()=>{var a=Lt,o=t(),u=!1;let d=D&&p(o)===(e.data===`[!`);if(d&&(ke(Me()),De(!1)),p(o)){var f=wt(),m=!1;let e=e=>{if(!u){m=!0,f(!1),Lt===a&&a.deactivate(),qt.ensure();try{e()}finally{Tt(!1),Vt||Jt()}}};o.then(t=>{e(()=>{ln(s,t),l.ensure(bi,r&&(e=>r(e,s)))})},t=>{e(()=>{if(ln(c,t),l.ensure(xi,i&&(e=>i(e,c))),!i)throw c.v})}),D?l.ensure(yi,n):dt(()=>{m||e(()=>{l.ensure(yi,n)})})}else ln(s,o),l.ensure(bi,r&&(e=>r(e,s)));return d&&De(!0),()=>{u=!0}})}function G(e,t,n=!1){var r;D&&(r=Oe,Ae());var i=new vi(e),a=n?E:0;function o(e,t){if(D){var n=Ne(r);if(e!==parseInt(n.substring(1))){var a=Me();ke(a),i.anchor=a,De(!1),i.ensure(e,t),De(!0);return}}i.ensure(e,t)}Wn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Ci=Symbol(`NaN`);function wi(e,t,n){D&&Ae();var r=new vi(e),i=!ct();Wn(()=>{var e=t();e!==e&&(e=Ci),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function Ti(e,t){D&&ke(Cn(e)),Un(()=>{var n=t();for(var r in n){var i=n[r];i==null||i===``?e.style.removeProperty(r):e.style.setProperty(r,i)}})}function Ei(e,t){return t}function Di(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];$n(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Oi(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;Tn(d),d.append(u),e.items.clear()}Oi(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Oi(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|=ie,rr(a,document.createDocumentFragment())):Xn(t[i],n)}}var ki;function K(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=D?ke(Cn(u)):u.appendChild(Sn())}D&&Ae();var d=null,f=At(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p=new Map,m=!0;function h(e){if(!(_.effect.f&16384)){_.pending.delete(e);var t=z(f);_.fallback=d,ji(_,t,c,n,a),d!==null&&(t.length===0?d.f&33554432?(d.f^=ie,Ni(d,null,c)):tr(d):$n(d,()=>{d=null}))}}function g(e){_.pending.delete(e)}var _={effect:Wn(()=>{var e=z(f),t=e.length;let r=!1;D&&Ne(c)===`[!`!=(t===0)&&(c=Me(),ke(c),De(!1),r=!0);for(var u=new Set,_=Lt,v=En(),y=0;y<t;y+=1){D&&Oe.nodeType===8&&Oe.data===`]`&&(c=Oe,r=!0,De(!1));var b=e[y],x=a(b,y),S=m?null:l.get(x);S?(S.v&&ln(S.v,b),S.i&&ln(S.i,y),v&&_.unskip_effect(S.e)):(S=Mi(l,m?c:ki??=Sn(),b,x,y,o,n,i),m||(S.e.f|=ie),l.set(x,S)),u.add(x)}if(t===0&&s&&!d&&(m?d=Kn(()=>s(c)):(d=Kn(()=>s(ki??=Sn())),d.f|=ie)),t>u.size&&ze(``,``,``),D&&t>0&&ke(Me()),!m){if(p.set(_,u),v){for(let[e,t]of l)u.has(e)||_.skip_effect(t.e);_.oncommit(h),_.ondiscard(g)}else h(_)}r&&De(!0),z(f)}),flags:n,items:l,pending:p,outrogroups:null,fallback:d};m=!1,D&&(c=Oe)}function Ai(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function ji(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Ai(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(tr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ie,_===l)Ni(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Pi(e,d,_),Pi(e,_,y),Ni(_,y,n),d=_,p=[],m=[],l=Ai(d.next);continue}}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)Ni(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Pi(e,S.prev,C.next),Pi(e,d,S),Pi(e,C,b),l=b,d=C,--v,p=[],m=[]}else u.delete(_),Ni(_,l,n),Pi(e,_.prev,_.next),Pi(e,_,d===null?e.effect.first:d.next),Pi(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Ai(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Ai(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Oi(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var w=[];if(u!==void 0)for(_ of u)_.f&8192||w.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&w.push(l),l=Ai(l.next);var ee=w.length;if(ee>0){var T=i&4&&s===0?n:null;if(o){for(v=0;v<ee;v+=1)w[v].nodes?.a?.measure();for(v=0;v<ee;v+=1)w[v].nodes?.a?.fix()}Di(e,w,T)}}o&&dt(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Mi(e,t,n,r,i,a,o,s){var c=o&1?o&16?an(n):on(n,!1,!1):null,l=o&2?an(i):null;return{v:c,i:l,e:Kn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ni(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=wn(r);if(a.before(r),r===i)return;r=o}}function Pi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Fi(e,t,...n){var r=new vi(e);Wn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},E)}function Ii(e,t,n){var r;D&&(r=Oe,Ae());var i=new vi(e);Wn(()=>{var e=t()??null;if(D&&Ne(r)===`[`!=(e!==null)){var a=Me();ke(a),i.anchor=a,De(!1),i.ensure(e,e&&(t=>n(t,e))),De(!0)}else i.ensure(e,e&&(t=>n(t,e)))},E)}function Li(e,t,n,r,i,a){let o=D;D&&Ae();var s=null;D&&Oe.nodeType===1&&(s=Oe,Ae());var c=D?Oe:e,l=new vi(c,!1);Wn(()=>{let e=t()||null;var a=i?i():n||e===`svg`?Se:void 0;if(e===null)l.ensure(null,null);else return l.ensure(e,t=>{if(e){var n=D;if(s=D?s:Dn(e,a),ii(s,s),r){var i=null;D&&Gr(e)&&s.append(i=document.createComment(``));var o=D?Cn(s):s.appendChild(Sn());D&&(o===null?De(!1):ke(o)),r(s,o),i?.remove()}ur.nodes.end=s,n||t.before(s)}D&&ke(t)}),()=>{}},E),Fn(()=>{}),o&&(De(!0),ke(c))}function Ri(e,t,n){Vn(()=>{var r=Nr(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Un(()=>{var e=n();Pr(e),i&&Fe(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function zi(e,t){var n=void 0,r;Gn(()=>{n!==(n=t())&&(r&&=(Xn(r),null),n&&(r=Kn(()=>{Vn(()=>n(e))})))})}function Bi(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=Bi(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Vi(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Bi(e))&&(r&&(r+=` `),r+=t);return r}function Hi(e){return typeof e==`object`?Vi(e):e??``}var Ui=[...`
|
|
2
|
+
\r\f\xA0\v`];function Wi(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||Ui.includes(r[o-1]))&&(s===r.length||Ui.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Gi(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 Ki(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function qi(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(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Ki)),i&&c.push(...Object.keys(i).map(Ki));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=Ki(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+=Gi(r)),i&&(n+=Gi(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ji(e,t,n,r,i,a){var o=e[pe];if(D||o!==n||o===void 0){var s=Wi(n,r,a);(!D||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[pe]=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 Yi(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 Xi(e,t,n,r){var i=e[me];if(D||i!==t){var a=qi(t,r);(!D||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[me]=t}else r&&(Array.isArray(r)?(Yi(e,n?.[0],r[0]),Yi(e,n?.[1],r[1],`important`)):Yi(e,n,r));return r}function Zi(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function Qi(e,t){var n=!(`__defaultValue`in e);(n||e.__defaultValue!==t)&&(e.__defaultValue=t,$i(e,!n||`__value`in e))}function $i(t,n){var r=t.__defaultValue,i=t.multiple,a=i?r??[]:null;if(!i||e(a)){var o=t.selectedIndex,s=n&&i?new Set(t.selectedOptions):null;for(var c of t.options){var l=ra(c);Zi(c,i?a.includes(l):hn(l,r))}if(n){if(s!==null)for(c of t.options){var u=s.has(c);c.selected!==u&&(c.selected=u)}else t.selectedIndex!==o&&(t.selectedIndex=o)}}}function ea(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return Te();for(var i of t.options)i.selected=n.includes(ra(i))}else{for(i of t.options)if(hn(ra(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}}function ta(e){var t=new MutationObserver(t=>{t.every(ia)||(`__defaultValue`in e&&$i(e,!1),`__value`in e&&ea(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),Fn(()=>{t.disconnect()})}function na(e,t,n=t){var r=new WeakSet,i=!0;St(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),ra);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&ra(o)}n(a),e.__value=a,Lt!==null&&r.add(Lt)}),Vn(()=>{var a=t();if(e===document.activeElement){var o=Lt;if(r.has(o))return}if(ea(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=ra(s),n(a))}e.__value=a,i=!1})}function ra(e){return`__value`in e?e.__value:e.value}function ia(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var aa=Symbol(`class`),oa=Symbol(`style`),sa=Symbol(`is custom element`),ca=Symbol(`is html`),la=ve?`link`:`LINK`,ua=ve?`input`:`INPUT`,da=ve?`option`:`OPTION`,fa=ve?`select`:`SELECT`,pa=ve?`progress`:`PROGRESS`;function ma(e){if(D){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[ge]=n,dt(n),bt()}}function ha(e,t){var n=ya(e);n.value!==(n.value=t??void 0)&&(e.value!==t||t===0&&e.nodeName===pa)&&(e.value=t??``)}function ga(e,t){var n=ya(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function q(e,t,n,r){var i=ya(e);D&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===la)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[de]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&xa(e).has(t)?e[t]=n:e.setAttribute(t,n))}function _a(e,t,n,r,i=!1,a=!1){D&&i&&e.nodeName===ua&&(`defaultValue`in n||`defaultChecked`in n||ma(e));var o=ya(e),s=o[sa],c=!o[ca];let l=D&&s;l&&De(!1);var u=t||{},d=e.nodeName===da,f=e.nodeName===fa;try{for(var p in t)!(p in n)&&p[0]+p[1]!==`$$`&&(n[p]=null);n.class?n.class=Hi(n.class):(r||n[aa])&&(n.class=null),n[oa]&&(n.style??=null);var m=xa(e);if(e.nodeName===ua&&`type`in n&&(`value`in n||`__value`in n)){var h=n.type;(h!==u.type||h===void 0&&e.hasAttribute(`type`))&&(u.type=h,q(e,`type`,h,a))}for(let i in n){let l=n[i];if(d&&i===`value`&&l==null)e.value=e.__value=``,u[i]=l;else if(i===`class`)Ji(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,l,r,t?.[aa],n[aa]),u[i]=l,u[aa]=n[aa];else if(i===`style`)Xi(e,l,t?.[oa],n[oa]),u[i]=l,u[oa]=n[oa];else{var g=u[i];if(l!==g||l===void 0&&e.hasAttribute(i)){u[i]=l;var _=i[0]+i[1];if(_!==`$$`){if(_===`on`){let t={},n=`$$`+i,r=i.slice(2);var v=Rr(r);if(Ir(r)&&(r=r.slice(0,-7),t.capture=!0),!v&&g){if(l!=null)continue;e.removeEventListener(r,u[n],t),u[n]=null}if(v)V(r,e,l),Zr([r]);else if(l!=null){function a(e){u[i].call(this,e)}u[n]=Yr(r,e,a,t)}}else if(i===`style`)q(e,i,l);else if(i===`autofocus`)_t(e,!!l);else if(!s&&(i===`__value`||i===`value`&&l!=null))e.__value=l,(g==null||e.value!==l||l===0&&e.nodeName===pa)&&(e.value=l);else if(i===`selected`&&d)Zi(e,l);else{var y=i;c||(y=Vr(y));var b=y===`defaultValue`||y===`defaultChecked`;if(f&&y===`defaultValue`)continue;if(l==null&&!s&&!b){if(o[i]=null,y===`value`||y===`checked`){let n=e,r=t===void 0;if(y===`value`){let e=n.defaultValue;n.removeAttribute(y),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i)}else b||(s||typeof l!=`string`)&&m.has(y)?(e[y]=l,y in o&&(o[y]=be)):typeof l!=`function`&&q(e,y,l,a)}}}}}}finally{l&&De(!0)}return u}function va(e,t,n=[],r=[],i=[],a,o=!1,s=!1){Ct(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===fa,l=!1;if(Gn(()=>{var u=t(...n.map(z)),d=_a(e,r,u,a,o,s);if(l&&c){var f=e;`defaultValue`in u&&Qi(f,u.defaultValue),`value`in u&&ea(f,u.value)}for(let e of Object.getOwnPropertySymbols(i))u[e]||Xn(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var p=u[t];t.description===`@attach`&&(!r||p!==r[t])&&(i[t]&&Xn(i[t]),i[t]=Kn(()=>zi(e,()=>p))),d[t]=p}r=d}),c){var u=e;Vn(()=>{var e=r;`defaultValue`in e&&Qi(u,e.defaultValue),ea(u,e.value,!0),ta(u)})}l=!0})}function ya(e){return e[fe]??={[sa]:e.nodeName.includes(`-`),[ca]:e.namespaceURI===xe}}var ba=new Map;function xa(e){var t=e.getAttribute(`is`)||e.nodeName,n=ba.get(t);if(n)return n;ba.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function Sa(e,t,n=t){var r=new WeakSet;St(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Da(e)?Oa(a):a,n(a),Lt!==null&&r.add(Lt),await Ar(),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))}}}),(D&&e.defaultValue!==e.value||Nr(t)==null&&e.value)&&(n(Da(e)?Oa(e.value):e.value),Lt!==null&&r.add(Lt)),Un(()=>{var n=t();if(e===document.activeElement){var i=Lt;if(r.has(i))return}Da(e)&&n===Oa(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Ca=new Set;function wa(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),St(n,`change`,()=>{var e=n.__value;a&&(e=Ea(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Un(()=>{var e=r();D&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=hn(n.__value,e)}),Fn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Ca.has(o)||(Ca.add(o),dt(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Ca.delete(o)})),dt(()=>{if(s){var e=a?Ea(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Ta(e,t,n=t){St(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(D&&e.defaultChecked!==e.checked||Nr(t)==null)&&n(e.checked),Un(()=>{e.checked=!!t()})}function Ea(e,t,n){for(var r=new Set,i=0;i<e.length;i+=1)e[i].checked&&r.add(e[i].__value);return n||r.delete(t),Array.from(r)}function Da(e){var t=e.type;return t===`number`||t===`range`}function Oa(e){return e===``?null:+e}var ka=new class e{#e=new WeakMap;#t;#n;static entries=new WeakMap;constructor(e){this.#n=e}observe(e,t){var n=this.#e.get(e)||new Set;return n.add(t),this.#e.set(e,n),this.#r().observe(e,this.#n),()=>{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Aa(e,t,n){var r=ka.observe(e,()=>n(e[t]));Vn(()=>(Nr(()=>n(e[t])),r))}function ja(e,t){return e===t||e?.[ce]===t}function Ma(e=st(),t,n,r){var i=nt.r,a=ur;return Vn(()=>{var o,s;return Un(()=>{o=s,s=r?.()||[],Nr(()=>{ja(n(...s),e)||(t(e,...s),o&&ja(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&&ja(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Na(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Un(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&Fn(()=>{n.removeEventListener(t,a)})}function Pa(e=!1){let t=nt,n=t.l.u;if(!n)return;let r=()=>Pr(t.s);if(e){let e=0,n={},i=Dt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>z(i)}n.b.length&&Rn(()=>{Fa(t,r),h(n.b)}),In(()=>{let e=Nr(()=>n.m.map(m));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&In(()=>{Fa(t,r),h(n.a)})}function Fa(e,t){if(e.l.s)for(let t of e.l.s)z(t);t()}var Ia=!1;function La(e){var t=Ia;try{return Ia=!1,[e(),Ia]}finally{Ia=t}}var Ra={get(e,t){if(!e.exclude.has(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.has(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return!e.exclude.has(t)&&t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.has(t))}};function J(e,t,n){return new Proxy({props:e,exclude:t},Ra)}var za={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ce||t===ue)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ba(...e){return new Proxy({props:e},za)}function Y(e,t,n,r){var i=!Ye||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=Dt(r),z(u)):(l&&(l=!1,c=s?Nr(r):r),c);let f;if(o){var p=ce in e||ue in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=La(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&We(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?Dt:At)(()=>(v=!1,g()));o&&z(y);var b=ur;return(function(e,t){if(arguments.length>0){let n=t?z(y):i&&o?pn(e):e;return N(y,n),v=!0,c!==void 0&&(c=n),e}return ar&&v||b.f&16384?y.v:z(y)})}function Va(e){nt===null&&Le(`onMount`),Ye&&nt.l!==null?Ua(nt).m.push(e):In(()=>{let t=Nr(e);if(typeof t==`function`)return t})}function Ha(e){nt===null&&Le(`onDestroy`),Va(()=>()=>Nr(e))}function Ua(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function X(e,t){let n=Y(t,`size`,3,16),r=Y(t,`filled`,3,!1);var i=ci(),a=F(i);{let e=j(()=>r()?`currentColor`:`none`),i=j(()=>t.label?`img`:void 0),o=j(()=>t.label?void 0:`true`);Ii(a,()=>t.of,(r,a)=>{a(r,{get size(){return n()},strokeWidth:1.5,absoluteStrokeWidth:!0,get fill(){return z(e)},get role(){return z(i)},get"aria-label"(){return t.label},get"aria-hidden"(){return z(o)}})})}U(e,i)}var Wa={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ga=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim();function Ka(e){return e!=null}function qa(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??Wa.width,a=e.size??e.height??Wa.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Ga(...c):Ga(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??Wa[`stroke-width`])*Number(e.size??e.width??Wa.width)/Number(t.size??t.width??Wa.width):t.strokeWidth??Wa[`stroke-width`];return[`svg`,{...Object.entries(Wa).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Ka(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Ka(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Ka(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}var Ja=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ya=Symbol(`lucide-context`),Xa=()=>it(Ya),Za=new Set([`$$slots`,`$$events`,`$$legacy`,`color`,`size`,`width`,`height`,`strokeWidth`,`absoluteStrokeWidth`,`nonScalingStroke`,`iconNode`,`icon`,`class`,`children`]),Qa=oi(`<svg><!><!></svg>`);function $a(e,t){k(t,!0);let n=Xa()??{},r=Y(t,`color`,19,()=>n.color??`currentColor`),i=Y(t,`size`,19,()=>n.size??24),a=Y(t,`width`,19,i),o=Y(t,`height`,19,i),s=Y(t,`strokeWidth`,19,()=>n.strokeWidth??2),c=Y(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),l=Y(t,`nonScalingStroke`,19,()=>n.nonScalingStroke??!1),u=Y(t,`iconNode`,19,()=>[]),d=Y(t,`icon`,19,()=>({node:u(),aliases:[],size:24})),p=J(t,Za),m=j(()=>!!t.children||Ja(p)),h=j(()=>qa(d(),{color:r(),width:a(),height:o(),strokeWidth:s(),absoluteStrokeWidth:c(),nonScalingStroke:l(),className:Ga(`lucide-icon`,n.class),hasA11yProp:z(m),attributes:p})),g=j(()=>v(z(h),3)),y=j(()=>z(g)[1]),b=j(()=>_(z(g)[2],()=>[],!0)),x=j(()=>({...z(y),class:[...z(y).class.split(` `),t.class]}));var S=Qa();va(S,()=>({...z(x)}));var C=P(S);K(C,17,()=>z(b),Ei,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1];var a=ci();Li(F(a),r,!0,(e,t)=>{va(e,()=>({...i()}))}),U(e,a)}),Fi(L(C),()=>t.children??f),O(S),U(e,S),A()}var eo=new Set([`$$slots`,`$$events`,`$$legacy`]);function to(e,t){let n=J(t,eo),r={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var no=new Set([`$$slots`,`$$events`,`$$legacy`]);function ro(e,t){let n=J(t,no),r={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var io=new Set([`$$slots`,`$$events`,`$$legacy`]);function ao(e,t){let n=J(t,io),r={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var oo=new Set([`$$slots`,`$$events`,`$$legacy`]);function so(e,t){let n=J(t,oo),r={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var co=new Set([`$$slots`,`$$events`,`$$legacy`]);function lo(e,t){let n=J(t,co),r={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var uo=new Set([`$$slots`,`$$events`,`$$legacy`]);function fo(e,t){let n=J(t,uo),r={name:`sprout`,size:24,node:[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`}],[`path`,{d:`M5 21h14`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var po=new Set([`$$slots`,`$$events`,`$$legacy`]);function mo(e,t){let n=J(t,po),r={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]],aliases:[`terminal-square`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var ho=new Set([`$$slots`,`$$events`,`$$legacy`]);function go(e,t){let n=J(t,ho),r={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`}],[`path`,{d:`M14 11v6`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]],aliases:[`trash-2`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var _o=new Set([`$$slots`,`$$events`,`$$legacy`]);function vo(e,t){let n=J(t,_o),r={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var yo=e=>typeof e==`object`&&!!e&&!Array.isArray(e),bo=/\{\{\s*([a-z0-9-]+)\.([A-Za-z]\w*)\s*\}\}/g,xo=/^\{\{\s*([a-z0-9-]+)\.([A-Za-z]\w*)\s*\}\}$/,So=e=>typeof e==`string`&&!e.includes(`{{`)||typeof e==`number`||typeof e==`boolean`;function Co(e){let t=(r,i,a)=>{let o=`${r}.${i}`,s=Object.hasOwn(e,r)?e[r]:void 0;if(!yo(s)||a.includes(o))return;if(Object.hasOwn(s,i)){let e=n(s[i],[...a,o]);return So(e)?e:void 0}if(i!==`port`&&i!==`host`)return;let c=t(r,`url`,[...a,o]);if(typeof c!=`string`||!URL.canParse(c))return;let{port:l,hostname:u}=new URL(c);return i===`host`?u:Number(l)||void 0},n=(e,r)=>{if(typeof e==`string`){let n=xo.exec(e);return n?t(n[1]??``,n[2]??``,r)??e:e.replace(bo,(e,n,i)=>{let a=t(n,i,r);return a===void 0?e:String(a)})}return Array.isArray(e)?e.map(e=>n(e,r)):yo(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t,r)])):e};return n}function wo(e){return!yo(e)||!yo(e.apps)?e:Co(e.apps)(e,[])}var To=80,Eo=90,Do=(e,t)=>e[t];function Oo(e,t){let n=e.map(e=>[...e]),r=[],i={};n.forEach((e,t)=>{for(let n of e)i[n]=t});for(let e of t){let t=Do(i,e.from)<=Do(i,e.to),a=t?e.to:e.from,o=t?e.from:e.to;if(i[o]!==i[a]){for(let t=Do(i,o)+1;t<Do(i,a);t++){let a=`~${e.from}>${e.to}:${String(t)}`;i[a]=t,n[t]?.push(a),r.push([o,a]),o=a}r.push([o,a])}}return{rows:n,links:r,row:i}}var ko=e=>{let t={};for(let n of e)n.forEach((e,n)=>t[e]=n);return t};function Ao(e,t,n){let r=ko(e),i=0;return t.forEach(([e,a],o)=>{for(let[s,c]of t.slice(o+1))n[e]===n[s]&&(Do(r,e)-Do(r,s))*(Do(r,a)-Do(r,c))<0&&i++}),i}function jo(e,t){let{rows:n,links:r,row:i}=Oo(e,t),a={};for(let[e,t]of r)(a[e]??=[]).push(t),(a[t]??=[]).push(e);let o=n.map(e=>[...e]),s=Ao(n,r,i);for(let e=0;e<12&&s;e++){let t=e%2==0,c=t?n.map((e,t)=>t).slice(1):n.map((e,t)=>n.length-2-t).filter(e=>e>=0);for(let e of c){let r=ko(n),o=n=>{let o=(a[n]??[]).filter(n=>i[n]===e+(t?-1:1));return o.length?o.reduce((e,t)=>e+Do(r,t),0)/o.length:Do(r,n)};n[e]?.sort((e,t)=>o(e)-o(t))}let l=Ao(n,r,i);l<s&&(s=l,o=n.map(e=>[...e]))}return e.forEach((e,t)=>{e.splice(0,e.length,...(o[t]??[]).filter(e=>!e.startsWith(`~`)))}),s}function Mo(e,t){let n=Object.fromEntries(e.map(e=>[e,[]]));for(let{from:e,to:r}of t)e in n&&r in n&&e!==r&&n[e]?.push(r);let r=e=>{let t=[e];for(let e=0;e<t.length;e++)for(let r of n[t[e]??``]??[])t.includes(r)||t.push(r);return t.length},i=new Set(Object.values(n).flat()),a=[...e.filter(e=>!i.has(e)).sort((e,t)=>r(t)-r(e)),...[...e].sort((e,t)=>r(t)-r(e))],o=Object.fromEntries(e.map(e=>[e,[]])),s=[],c={},l=e=>{c[e]=`open`;for(let t of n[e]??[])c[t]!==`open`&&(o[e]?.push(t),c[t]||l(t));c[e]=`done`,s.push(e)};for(let e of a)c[e]||l(e);let u=[...s].reverse(),d=Object.fromEntries(e.map(e=>[e,0]));for(let e of u)for(let t of o[e]??[])d[t]=Math.max(Do(d,t),Do(d,e)+1);for(let e of s){let t=(o[e]??[]).map(e=>Do(d,e));t.length&&(d[e]=Math.max(Do(d,e),Math.min(...t)-1))}return d}function No(e,t,n,r,i,a){let o={};e.forEach((e,t)=>{for(let n of e)o[n]=t});let s={};for(let{from:e,to:n}of t)e in o&&n in o&&o[e]!==o[n]&&((s[e]??=[]).push(n),(s[n]??=[]).push(e));let c=Object.fromEntries(Object.keys(o).map(e=>[e,Do(n,e)+a(e)]));for(let t=0,n=1/0;t<500&&n>.01;t++){n=0;for(let o of t%2?[...e].reverse():e){let e=[];o.forEach((t,n)=>{let s=o[n-1];e.push(s===void 0?0:(e[n-1]??0)+r(s)-a(s)+i+a(t))});let t=[];o.forEach((n,r)=>{let i=s[n]??[],a=i.length||.001,o=i.length?i.reduce((e,t)=>e+Do(c,t),0)/i.length:Do(c,n);for(t.push({sum:(o-(e[r]??0))*a,weight:a,count:1});;){let e=t.at(-1),n=t.at(-2);if(!e||!n||n.sum/n.weight<=e.sum/e.weight)break;t.pop(),n.sum+=e.sum,n.weight+=e.weight,n.count+=e.count}});let l=0;for(let r of t)for(let t=0;t<r.count;t++,l++){let t=o[l]??``,i=r.sum/r.weight+(e[l]??0);n=Math.max(n,Math.abs(i-Do(c,t))),c[t]=i}}}for(let e of Object.keys(c))n[e]=Do(c,e)-a(e)}function Po(e,t,n,r=`down`,i=!1,{pad:a,tight:o=!1,anchor:s}={pad:0}){let c=Mo(e,t),l=[];for(let t of e)(l[Do(c,t)]??=[]).push(t);let u=l.filter(Boolean);if(jo(u,t.filter(({from:e,to:t})=>e in c&&t in c&&e!==t)),i)for(let e of u)e.reverse();let d=Object.fromEntries(e.map(e=>[e,n(e)])),f=o?.6:1,p=r===`down`,m=p?`w`:`h`,h=p?`h`:`w`,g=p?To*f:Eo*.6*f,_=p?Eo*f:To*1.6*f,v=e=>e.reduce((e,t)=>e+Do(d,t)[m],0)+g*(e.length-1),y=Math.max(...u.map(v)),b={},x={},S=a+40;for(let e of u){let t=a+40+(y-v(e))/2;for(let n of e)b[n]=t,x[n]=S,t+=Do(d,n)[m]+g;S+=Math.max(...e.map(e=>Do(d,e)[h]))+_}No(u,t,b,e=>Do(d,e)[m],g,e=>s?.(e)??Do(d,e)[m]/2);let C=Math.min(...Object.values(b)),w={};for(let t of e){let e=Math.round(Do(b,t)-C+a+40);w[t]=p?{x:e,y:Do(x,t)}:{x:Do(x,t),y:e}}return w}function Fo(e,t,n,r,i={}){let a=t=>{let n=Do(e,t),{w:i,h:a}=r(t);return{...n,w:i,h:a,cx:n.x+i/2,cy:n.y+a/2}},o=a(t.from),s=a(t.to),c=Math.max(s.x-(o.x+o.w),o.x-(s.x+s.w)),l=Math.max(s.y-(o.y+o.h),o.y-(s.y+s.h)),u=s.cy>o.cy?{fromSide:`bottom`,toSide:`top`}:{fromSide:`top`,toSide:`bottom`},d=s.cx>=o.cx?{fromSide:`right`,toSide:`left`}:{fromSide:`left`,toSide:`right`},[f,p]=l>c||l===c&&n===`down`?[u,d]:[d,u],m=e=>i[t.from]!==e.fromSide&&i[t.to]!==e.toSide;return m(f)||!m(p)?f:p}function Io(e,t){let n=e=>[...e].sort((e,t)=>e[0]-t[0]).reduce((e,[t,n])=>{let r=e.at(-1);return r&&t<=r[1]?r[1]=Math.max(r[1],n):e.push([t,n]),e},[]),r=n(e),i=n(t).flatMap(([e,t])=>{let n=[],i=e;for(let[e,a]of r)a<=i||e>=t||(e>i&&n.push([i,e]),i=Math.max(i,a));return i<t&&n.push([i,t]),n});return{show:e=>e-i.reduce((t,[n,r])=>t+Math.max(0,Math.min(e,r)-n),0),back:e=>{let t=0;for(let[n,r]of i){if(e<n-t)break;t+=r-n}return e+t}}}var Lo={top:[0,-1],right:[1,0],bottom:[0,1],left:[-1,0]},Ro={top:`bottom`,bottom:`top`,left:`right`,right:`left`},zo=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),Bo=(e,t,n)=>t?{x:e.x+Lo[t][0]*n,y:e.y+Lo[t][1]*n}:e,Vo=({x:e,y:t})=>`${String(e)},${String(t)}`,Ho=({x:e,y:t,w:n,h:r},i)=>({top:{x:e+n/2,y:t},right:{x:e+n,y:t+r/2},bottom:{x:e+n/2,y:t+r},left:{x:e,y:t+r/2}})[i];function Uo(e,t,n,r){let i=zo(Math.hypot(n.x-e.x,n.y-e.y)*.4,30,140);return[e,Bo(e,t,i),Bo(n,r,i),n]}function Wo(e,t,n,r){let[,i,a]=Uo(e,t,n,r);return`M${Vo(e)} C${Vo(i)} ${Vo(a)} ${Vo(n)}`}function Go(e,t,n,r,i){let a=Bo(e,t,40),o=[a,...i,Bo(n,r,40)],s=`M${Vo(e)} L${Vo(a)}`;for(let t=0;t<o.length-1;t++){let r=o[t-1]??e,i=o[t]??e,a=o[t+1]??n,c=o[t+2]??n,l={x:i.x+(a.x-r.x)/6,y:i.y+(a.y-r.y)/6},u={x:a.x-(c.x-i.x)/6,y:a.y-(c.y-i.y)/6};s+=` C${Vo(l)} ${Vo(u)} ${Vo(a)}`}return`${s} L${Vo(n)}`}var Ko=e=>e===`left`||e===`right`,qo=e=>[[`from`,e.from,e.fromSide,e.to],[`to`,e.to,e.toSide,e.from]];function Jo(e){let t=new Map;return e.forEach((e,n)=>{for(let[r,i,a,o]of qo(e)){let s=`${i}|${a}`,c=t.get(s)??[];c.push({cable:e,index:n,end:r,side:a,id:i,other:o}),t.set(s,c)}}),t}var Yo=(e,t)=>t>1?Math.min(26,(e-48)/(t-1)):0,Xo=e=>e.every(t=>t.other===e[0]?.other)&&e.every(({cable:e,end:t,side:n})=>(t===`from`?e.toSide:e.fromSide)===Ro[n])?e[0]?.other:void 0;function Zo(e,t){for(let n of Jo(e).values()){let[{id:e,side:r}={id:``,side:`top`}]=n,i=Ko(r)?`y`:`x`,a=e=>i===`x`?e.w:e.h,o=e=>e[i]+a(e)/2,s=t(e),c=Xo(n),l;if(c){let e=Math.max(s[i],t(c)[i]),r=Math.min(s[i]+a(s),t(c)[i]+a(t(c))),u=Math.min(Yo(a(s),n.length),Yo(a(t(c)),n.length));r-e>=u*(n.length-1)+32&&(l=Math.round((e+r)/2-o(s)))}let u=Ho(s,r),[d,f]=Lo[r],p=({cable:e,end:n,other:r})=>{let a=Ho(t(r),n===`from`?e.toSide:e.fromSide),[o,s]=[a.x-u.x,a.y-u.y];return Math.atan2(i===`x`?o:s,o*d+s*f)};n.sort((e,n)=>p(e)-p(n)||o(t(e.other))-o(t(n.other))).forEach(({cable:e,end:t},n)=>{e[`${t}Slot`]=n,l?e[`${t}Shift`]=l:t===`from`?delete e.fromShift:delete e.toShift})}}function Qo(e,{cardOf:t,coveredBelow:n}){let r={},i=[];for(let a of Jo(e).values()){let[{id:e,side:o}={id:``,side:`top`}]=a,s=t(e);if(!s)continue;let c=Ko(o)?`y`:`x`,l=e=>c===`x`?e.w:e.h,u=l(s),d=a.length;a.sort((e,t)=>(e.cable[`${e.end}Slot`]??1/0)-(t.cable[`${t.end}Slot`]??1/0)||e.index-t.index);let{covered:f,atRight:p}=o===`bottom`&&n?.(e)||{covered:0,atRight:!1},m=f&&u-f>=56?u-f:0,h=m?p?m/2-u/2:f+m/2-u/2:0,g=d>1?Math.min(26,((m||u)-(m?20:48))/(d-1)):0,_=h;if(!h){let e=t(Xo(a)??``);e&&(g=Math.min(g,Yo(l(e),d)));let n=a.map(({cable:e,end:t})=>e[`${t}Shift`]).find(e=>e!==void 0)??0,r=Math.max(0,u/2-16-(d-1)/2*g);_=zo(n,-r,r)}a.forEach(({index:e,end:t},n)=>{r[`${String(e)}|${t}`]=_+(n-(d-1)/2)*g}),d===1&&!_&&i.push({id:e,side:o})}return{offset:r,onPort:i}}var $o=[[`cli`,`Koppler`],[`ide`,`Your IDE`]],es={tool:`docker`,fix:`Install a Docker runtime (Docker Desktop or Colima)`},ts={tool:`npm`,fix:`Comes with Node`},ns={dotnet:{label:`.NET`,runIn:$o,serves:!0,needs:[{tool:`dotnet`,fix:`Install the .NET SDK the repo targets`}]},flutter:{label:`Flutter`,runIn:$o,serves:!1,platforms:[[`ios`,`iOS simulator`],[`android`,`Android emulator`],[`phone`,`Phone`]],needs:[{tool:`fvm`,fix:`brew tap leoafarias/fvm && brew install fvm`}]},node:{label:`Node`,runIn:$o,serves:!0,needs:[ts]},web:{label:`Web`,runIn:$o,serves:!1,browser:!0,needs:[ts]},lambda:{label:`Lambda`,runIn:$o,serves:!0,needs:[es,{tool:`aws`,fix:`brew install awscli`}]},sam:{label:`AWS SAM`,runIn:$o,serves:!0,needs:[es,{tool:`sam`,fix:`brew install aws-sam-cli (or: uv tool install aws-sam-cli)`}]},other:{label:`Other`,runIn:$o,serves:!0}},rs=(e,t)=>e.read(t)??``,is=(e,t)=>t.map(t=>rs(e,t)).join(`
|
|
3
|
+
`).toLowerCase(),as=(e,t)=>t?` ${e}${String(t)}`:``,os=e=>is(e,[`pyproject.toml`,`requirements.txt`,`Pipfile`]);function ss(e){return e.has(`uv.lock`)?`uv run `:e.has(`poetry.lock`)?`poetry run `:e.has(`Pipfile`)?`pipenv run `:e.has(`.venv/bin/python`)?`.venv/bin/`:``}var cs=e=>/spring-boot|springframework\.boot/.test(is(e,[`pom.xml`,`build.gradle`,`build.gradle.kts`])),ls=e=>[`compose.yaml`,`compose.yml`,`docker-compose.yml`,`docker-compose.yaml`].find(t=>e.has(t)),us={reactnative:{label:`React Native`,color:[`#087EA4`,`#58C4DC`],serves:!1,platforms:[[`ios`,`iOS simulator`],[`android`,`Android emulator`]],detect:e=>/"(expo|react-native)"\s*:/.test(rs(e,`package.json`)),start:(e,{platform:t=`ios`})=>/"expo"\s*:/.test(rs(e,`package.json`))?`npx expo start --${t}`:`npx react-native run-${t}`},go:{label:`Go`,color:[`#00758D`,`#5AD1E6`],detect:e=>e.has(`go.mod`),start:e=>{if(e.has(`main.go`))return`go run .`;let t=e.list(`cmd`);return t.length===1?`go run ./cmd/${t[0]??``}`:null}},rust:{label:`Rust`,color:[`#A0522D`,`#E8A27C`],detect:e=>e.has(`Cargo.toml`),start:()=>`cargo run`},java:{label:`Java / Kotlin`,color:[`#B0562B`,`#F0975F`],detect:e=>e.has(`pom.xml`)||e.has(`build.gradle`)||e.has(`build.gradle.kts`),port:e=>cs(e)?8080:null,start:e=>e.has(`pom.xml`)?cs(e)?`${e.has(`mvnw`)?`./mvnw`:`mvn`} spring-boot:run`:null:`${e.has(`gradlew`)?`./gradlew`:`gradle`} ${cs(e)?`bootRun`:`run`}`},python:{label:`Python`,color:[`#2F6F9F`,`#7FB8E6`],detect:e=>[`manage.py`,`pyproject.toml`,`requirements.txt`,`Pipfile`].some(t=>e.has(t)),port:e=>{let t=os(e);return e.has(`manage.py`)||/fastapi|uvicorn/.test(t)?8e3:t.includes(`flask`)?5e3:null},start:(e,{port:t})=>{let n=ss(e),r=os(e);if(e.has(`manage.py`))return`${n}python manage.py runserver${as(``,t)}`;if(/fastapi|uvicorn/.test(r)){let r=[`main.py`,`app/main.py`,`src/main.py`].find(t=>e.has(t))?.replace(/\.py$/,``).replace(/\//g,`.`);return r?`${n}uvicorn ${r}:app --reload${as(`--port `,t)}`:null}return r.includes(`flask`)?`${n}flask run${as(`--port `,t)}`:null}},ruby:{label:`Ruby`,color:[`#B3261E`,`#F28B82`],detect:e=>e.has(`Gemfile`),port:e=>e.has(`config/application.rb`)?3e3:null,start:(e,{port:t})=>e.has(`config/application.rb`)?`bin/rails server${as(`-p `,t)}`:null},php:{label:`PHP`,color:[`#6C5FC7`,`#A99FF5`],detect:e=>e.has(`artisan`)||e.has(`composer.json`),port:e=>e.has(`artisan`)?8e3:null,start:(e,{port:t})=>e.has(`artisan`)?`php artisan serve${as(`--port=`,t)}`:null},compose:{label:`Docker Compose`,color:[`#1D63ED`,`#7AA7FF`],detect:e=>!!ls(e),port:e=>Number(/["'\s-](\d{2,5}):\d{2,5}["'\s]/.exec(rs(e,ls(e)??``))?.[1])||null,start:()=>`docker compose up`,stop:`docker compose down`}};for(let[e,t]of Object.entries(us))ns[e]={label:t.label,runIn:$o,serves:t.serves!==!1,...t.platforms&&{platforms:t.platforms},...t.color&&{color:t.color}};Object.keys(ns);var ds={kinds:ns,recipes:us,custom:[]},fs=new WeakMap;function ps(e){let t=e?.kinds;if(typeof t!=`object`||!t)return ds;let n=fs.get(t);if(n)return n;let r={kinds:{...ns},recipes:{...us},custom:[]};for(let[e,n]of Object.entries(t)){if(!/^[a-z0-9-]{1,32}$/.test(e)||Object.hasOwn(ns,e)||typeof n!=`object`||!n)continue;let t=n,i=[t.detect??[]].flat().filter(e=>typeof e==`string`),a=typeof t.label==`string`&&t.label?t.label:e;r.recipes[e]={label:a,detect:e=>i.length>0&&i.every(t=>e.has(t)),port:()=>Number(t.port)||null,start:()=>typeof t.start==`string`&&t.start?t.start:null},r.kinds[e]={label:a,runIn:$o,serves:t.serves!==!1,custom:!0},r.custom.push(e)}return fs.set(t,r),r}var ms=e=>ps(e).kinds;function hs(e,t){let n=e?.kind,r=ms(t);return n!==void 0&&Object.hasOwn(r,n)&&r[n]||{label:n??`App`,runIn:$o,serves:!0}}var gs=e=>typeof e==`string`?e:``,_s=e=>({branch:e?.branch||``,run:e?.run||`cli`,...e?.platform&&{platform:e.platform},...gs(e?.note)&&{note:gs(e?.note)},...e?.tunnels===!1&&{tunnels:!1},...e?.queues===!0&&{queues:!0},...gs(e?.changes)&&{changes:gs(e?.changes)},...Array.isArray(e?.libraries)&&e.libraries.length>0&&{libraries:e.libraries.map(String).sort()},...e?.restart===!0&&{restart:!0},...e?.watch===!0&&{watch:!0}}),vs=e=>e?.run===`mock`?{branch:``,run:`mock`,...e.restart===!0&&{restart:!0}}:_s(e);function ys(e){let t=e?.nodes??{},n=Array.isArray(t)?t.map(e=>[e.id,e]):Object.entries(t),r=Object.fromEntries(n.filter(([e])=>typeof e==`string`).map(([e,t])=>[e,vs(t)])),i=(Array.isArray(e?.edges)?e.edges:[]).filter(e=>!!e&&Object.hasOwn(r,e.from)&&Object.hasOwn(r,e.to)).map(e=>({from:e.from,to:e.to})),a=Object.fromEntries(Object.entries(e?.queues??{}).flatMap(([e,t])=>t===`local`?[[e,`local`]]:[]));return{env:e?.env??null,nodes:r,edges:i,queues:a}}var bs=(e,t)=>e.edges.filter(e=>e.from===t).map(e=>e.to).sort(),xs=e=>e.toUpperCase(),Ss=e=>({ide:`your IDE`,cli:`the command line`,mock:`a mock`})[e];function Cs(e,t,n,r,i){let a=t.nodes[e],o=n.nodes[e];if(!a||!o)return[];let s=e=>i.name?.(e)??e,c=[];o.restart&&c.push(`you asked to restart it`),r&&c.push(`the environment changes from ${xs(r.from)} to ${xs(r.to)}`),a.branch!==o.branch&&a.run!==`mock`&&o.run!==`mock`&&c.push(`its branch changes from ${a.branch||i.current?.(e)||`the current one`} to ${o.branch||`the current one`}`),a.run!==o.run&&c.push(`it moves from ${Ss(a.run)} to ${Ss(o.run)}`),(a.platform??``)!==(o.platform??``)&&o.run===`cli`&&c.push(`its device changes to ${String(o.platform)}`);let l=bs(t,e),u=bs(n,e);for(let e of u.filter(e=>!l.includes(e)))c.push(`it starts calling your local ${s(e)}`);for(let e of l.filter(e=>!u.includes(e)))c.push(`it goes back to the deployed ${s(e)}`);(a.note??``)!==(o.note??``)&&c.push(`its note changed`);let d=a.libraries??[],f=o.libraries??[];for(let e of f.filter(e=>!d.includes(e)))c.push(`it uses your local ${e}`);for(let e of d.filter(e=>!f.includes(e)))c.push(`it goes back to the published ${e}`);let p=(e,t,n)=>t.queues===!0&&Object.hasOwn(e.queues,n);for(let r of i.queuesOf?.(e)??[])p(t,a,r)!==p(n,o,r)&&c.push(`it moves to the ${p(n,o,r)?`local`:`deployed`} ${r} queue`);return c}function ws(e,t,n={}){let r=ys(e),i=ys(t),a=n.strays??[],o=r.env&&i.env&&r.env!==i.env&&Object.keys(r.nodes).length>0?{from:r.env,to:i.env}:null,s=[],c=[],l=[],u=[];for(let[e,t]of Object.entries(i.nodes))if(!Object.hasOwn(r.nodes,e)){let r=n.startedOn?.(e)===i.env&&bs(i,e).length===0&&!t.note&&!t.branch;a.includes(e)?r?u.push({id:e,why:[`you started it with koppler run`]}):c.push({id:e,why:[`it is running, but not from a run Koppler recorded`]}):s.push({id:e,why:[]})}else if(n.running?.(e)===!1&&t.run!==`ide`)s.push({id:e,why:[`it was started before but is not running now`]});else{let t=Cs(e,r,i,o,n);(t.length>0?c:u).push({id:e,why:t})}for(let e of[...Object.keys(r.nodes),...a])!Object.hasOwn(i.nodes,e)&&!l.some(t=>t.id===e)&&l.push({id:e,why:[]});let d=s.length+c.length+l.length===0;return{env:i.env,envChange:o,starts:s,restarts:c,stops:l,keeps:u,nothing:d}}var Ts=[[`starts`,`START`],[`restarts`,`RESTART`],[`stops`,`STOP AND REVERT`],[`keeps`,`KEEP RUNNING`]];function Es(e,t={}){let n=e=>t.name?.(e)??e,r=e=>n(e.id)+(e.why.length>0?` (${e.why.join(`; `)})`:``),i=Ts.filter(([t])=>e[t].length>0).map(([t,n])=>`${n}: ${e[t].map(r).join(`, `)}`);return i.length>0?i:[`NOTHING TO CHANGE`]}var Ds=[`sqs`,`kafka`];function Os(e,t){let n=e?.apps?.[t];return[...new Set([...Object.keys(n?.publishes??{}),...Object.keys(n?.reads??{})])]}function ks(e){let t=e?.envs??[],n=e?.protected;return Array.isArray(n)?t.filter(e=>n.includes(e)):t.slice(1)}var As=(e,t)=>ks(e).includes(t),js=[[`valkey`,`Cache (Valkey)`],[`redis`,`Cache (Redis)`],[`aurora`,`Database (Aurora)`],[`postgres`,`Database (Postgres)`],[`mysql`,`Database (MySQL)`],[`mongo`,`Database (MongoDB)`],[`db`,`Database`],[`rds`,`Database`]];function Ms(e){if(e.what)return e.what;let t=(e.tunnel??``).toLowerCase(),n=t.split(/[.-]/);return js.find(([e])=>n.includes(e)||e.length>3&&t.includes(e))?.[1]??`Tunnel`}function Ns(e){let t=new Map;for(let n of e){let e=`${n.tunnel}:${String(n.port)}`,r=t.get(e)??{host:n.tunnel,port:n.port,original:n.port,bind:`localhost`,apps:[],envs:{},what:Ms(n),connectsAs:n.connectsAs};r.apps.includes(n.app)||r.apps.push(n.app),n.env&&(r.envs[n.app]=n.env),t.set(e,r)}return[...t.values()]}function Ps(e,t=[]){let n=Ns(e),r=new Set([...t,...n.map(e=>e.port)]),i=e=>e.apps.every(t=>e.envs[t]),a=2;for(let e of new Set(n.map(e=>e.original))){let t=n.filter(t=>t.original===e);t.sort((e,t)=>Number(i(e))-Number(i(t)));for(let n of t.slice(1))if(i(n)){let t=e+2;for(;r.has(t);)t++;r.add(t),n.port=t,n.settings=n.apps.map(e=>({app:e,env:n.envs[e]??``,value:`localhost:${String(t)}`}))}else n.bind=`127.0.0.${String(a++)}`,n.needsAlias=!0}return n}function Fs(e,t=e=>e){let n=e=>e.what===`Tunnel`?`tunnel`:`${e.what.replace(/ \(.*\)$/,``).toLowerCase()} tunnel`,r=e=>`${e.apps.map(t).join(` and `)}'s ${n(e)}`;return e.flatMap(i=>{let a=e.filter(e=>e!==i&&e.original===i.original).map(r).join(` and `),o=String(i.port);return i.settings?[`${r(i)} moves from port ${String(i.original)} to ${o}, to make room for ${a}.`]:i.needsAlias?[`${r(i)} keeps port ${o} on its own address, ${i.bind}, next to ${a}. Needs a one-time sudo step.`]:i.apps.length>1?[`${i.apps.map(t).join(` and `)} share one ${n(i)} on port ${o}.`]:[]})}var Is=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ls={0:e=>({...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([e,t])=>[e,{run:`cli`,...t}]))})};function Rs(e){if(!Is(e))return{error:`It is not a preset.`};let{name:t,nodes:n,edges:r,version:i}=e;if(typeof t!=`string`||!t.trim())return{error:`It has no name.`};if(!Is(n)||Object.keys(n).length===0)return{error:`It has no apps.`};let a=typeof i==`number`&&Number.isInteger(i)&&i>=0?i:0;if(a>1)return{error:`It was saved by a newer Koppler (${`preset format ${String(a)}, this one reads up to 1`}). Update Koppler.`};let o={...e,name:t,nodes:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Is(t)?t:{}])),edges:Array.isArray(r)?r:[]};for(let e=a;e<1;e++)o={...Ls[e]?.(o)??o,version:e+1};return{preset:o,migratedFrom:a<1?a:null}}function zs(e,t,n,r,i){let a=n.runIn(e),o=n.platforms(e),s=typeof t.run==`string`?t.run:``,c=a.includes(s)?s:a.includes(`cli`)?`cli`:a[0]??`cli`;s&&c!==s&&i.push(`${r} cannot run in "${s}", using ${c}`);let l={run:c},u=typeof t.platform==`string`?t.platform:``,d=o[0];d!==void 0&&c===`cli`&&(l.platform=o.includes(u)?u:d,u&&l.platform!==u&&i.push(`${r} has no "${u}" platform, using ${l.platform}`));let f=typeof t.branch==`string`?t.branch.trim():``;if(f){l.branch=f;let t=n.branches(e);t&&!t.includes(f)&&i.push(`${r} has no branch ${f} in your clone (fetch it first)`)}return typeof t.note==`string`&&t.note.trim()&&(l.note=t.note),t.tunnels===!1&&(l.tunnels=!1),t.queues===!0&&(l.queues=!0),t.watch===!0&&(l.watch=!0),l}var Bs=e=>Is(e)&&typeof e.from==`string`&&typeof e.to==`string`;function Vs(e,t){let n=Rs(e);if(n.error!==void 0)return{error:n.error};let r=n.preset,i=[],a=e=>t.name?.(e)??e;(!Is(e)||!Number.isInteger(e.version))&&i.push(`it had no version, read as the oldest format`);let o=Object.keys(r.nodes),s=o.filter(e=>!t.known(e)),c=o.filter(e=>t.known(e)&&!t.cloned(e)),l=o.filter(e=>t.known(e)&&t.cloned(e));if(l.length===0)return{error:s.length===o.length?`None of its apps are in this stack (${s.join(`, `)}).`:`None of its apps are cloned here (${c.join(`, `)}).`};s.length>0&&i.push(`not in this stack: ${s.join(`, `)}`),c.length>0&&i.push(`not cloned: ${c.map(a).join(`, `)}`);let u=Object.fromEntries(l.map(e=>[e,zs(e,r.nodes[e]??{},t,a(e),i)])),d=[],f=0;for(let e of r.edges.filter(Bs)){let{from:n,to:r}=e;!Object.hasOwn(u,n)||!Object.hasOwn(u,r)?t.known(n)&&t.known(r)&&f++:d.some(e=>e.from===n&&e.to===r)||(t.canCall(n,r)?d.push({from:n,to:r}):i.push(`${a(n)} does not call ${a(r)}, cable left out`))}f>0&&i.push(`${String(f)} ${f===1?`cable`:`cables`} left out with their apps`),n.migratedFrom!==null&&n.migratedFrom>0&&i.push(`updated from preset format ${String(n.migratedFrom)}`);let p={name:r.name.trim().slice(0,80),version:1,nodes:u,edges:d};return r.source&&(p.source=r.source),{preset:p,notes:i}}var Hs=e=>Is(e)&&typeof e.x==`number`&&typeof e.y==`number`,Us=e=>t=>e.from===t.from&&e.to===t.to;function Ws(e,t){let n=new Set(t.remove??[]),r=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e))),i=r(e.nodes),a=Is(e.layout)?e.layout:void 0,o=r(Is(a?.nodes)?a.nodes:{}),s=Object.values(o).filter(Hs),c=Math.min(...s.map(e=>e.y));for(let e of t.add??[])i[e]||(i[e]={run:`cli`},s.length&&(o[e]={x:Math.max(...s.map(e=>e.x))+340,y:c},c+=240));for(let[e,n]of Object.entries(t.branch??{}))i[e]&&(i[e]={...i[e],branch:n});for(let[e,n]of Object.entries(t.note??{})){let{note:t,...r}=i[e]??{};i[e]&&(i[e]=n.trim()?{...r,note:n}:r)}let l=e.edges.filter(Bs).filter(e=>!n.has(e.from)&&!n.has(e.to)&&!(t.uncable??[]).some(Us(e)));for(let e of t.cable??[])l.some(Us(e))||l.push({from:e.from,to:e.to});if(!a||t.arrange){let{layout:t,...n}=e;return{...n,nodes:i,edges:l}}let u=new Set(l.map(e=>`${e.from}>${e.to}`)),d=Object.fromEntries(Object.entries(Is(a.sides)?a.sides:{}).filter(([e])=>u.has(e)));return{...e,nodes:i,edges:l,layout:{...a,nodes:o,sides:d}}}function Gs(e,t=e=>e,n=!1){let r=(e=[])=>e.map(t).join(`, `),i=(e=[])=>e.map(e=>`${t(e.from)} to ${t(e.to)}`).join(`, `);return[e.add?.length&&`${n?`add`:`added`} ${r(e.add)}`,e.remove?.length&&`${n?`remove`:`removed`} ${r(e.remove)}`,e.cable?.length&&`${n?`cable`:`cabled`} ${i(e.cable)}`,e.uncable?.length&&`${n?`take the cable off`:`took the cable off`} ${i(e.uncable)}`,...Object.entries(e.branch??{}).map(([e,r])=>`${n?`put `:``}${t(e)} on ${r}`),...Object.entries(e.note??{}).map(([e,r])=>r.trim()?`${n?`add `:``}a note on ${t(e)}`:`${n?`take the `:`no `}note${n?` off `:` on `}${t(e)}`),e.arrange&&(n?`lay it out afresh`:`arranged`)].filter(Boolean).join(`; `)}async function Ks(e){try{let t=await fetch(`data/${e}.json`);return t.ok?await t.json():null}catch{return null}}async function qs(){let[e,t,n]=await Promise.all([Ks(`registry`),Ks(`local`),Ks(`state`)]);return e?{stack:e,clones:t?.apps??{},roots:t?.roots??[],saved:n}:null}async function Js(e,t={},n=!1){let r=location.pathname.split(`/`)[2]??``;try{return await fetch(`/${e}?token=${encodeURIComponent(r)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),keepalive:n})}catch{return null}}var Ys=async(e,t=!1)=>!!(await Js(`state`,e,t))?.ok;async function Xs(e,t={}){let n=await Js(e,t);return n?await n.json().catch(()=>({error:`The canvas server answered ${String(n.status)}.`})):{error:`Could not reach the canvas server.`}}var Zs=()=>Ks(`repos`),Qs={cli:`Koppler`,ide:`Me`,mock:`Mock`},$s=.6,ec=[[`down`,!1],[`right`,!1],[`down`,!0],[`right`,!0]],tc=e=>`tunnel:${e.host}:${String(e.original)}`,nc={w:230,h:58,gap:40},rc=[`bottom`,`right`,`left`,`top`],ic=8,ac=24,oc=44,sc={w:300,h:240,gap:32},cc=(e,t,n)=>({id:`${e}>${t}`,source:e,target:t,type:`cable`,data:n}),lc=e=>e.selected?{...e,selected:!1}:e,Z=new class{#e=M(``);get stack(){return z(this.#e)}set stack(e){N(this.#e,e,!0)}#t=M(``);get dir(){return z(this.#t)}set dir(e){N(this.#t,e,!0)}#n=M(!1);get setup(){return z(this.#n)}set setup(e){N(this.#n,e,!0)}#r=M([]);get known(){return z(this.#r)}set known(e){N(this.#r,e)}#i=M(``);get env(){return z(this.#i)}set env(e){N(this.#i,e,!0)}#a=M([]);get nodes(){return z(this.#a)}set nodes(e){N(this.#a,e)}#o=[];#s=j(()=>{let e=this.nodes;return e.length===this.#o.length&&e.every((e,t)=>e.id===this.#o[t]?.id&&e.data===this.#o[t].data)||(this.#o=e),this.#o});get cards(){return z(this.#s)}set cards(e){N(this.#s,e)}#c=M([]);get edges(){return z(this.#c)}set edges(e){N(this.#c,e)}#l=M(null);get hovered(){return z(this.#l)}set hovered(e){N(this.#l,e)}#u=M([]);#d=j(()=>z(this.#u).includes(this.env));get protected(){return z(this.#d)}set protected(e){N(this.#d,e)}toFlow=e=>e;zoom=()=>1;#f=j(()=>this.edges.map(e=>({from:e.source,to:e.target,...e.data})));get cables(){return z(this.#f)}set cables(e){N(this.#f,e)}#p=M([]);get infra(){return z(this.#p)}set infra(e){N(this.#p,e)}#m=M({});get queues(){return z(this.#m)}set queues(e){N(this.#m,e)}#h=M({});get hiddenQueues(){return z(this.#h)}set hiddenQueues(e){N(this.#h,e)}#g=M({});get hiddenOutside(){return z(this.#g)}set hiddenOutside(e){N(this.#g,e)}#_=M([]);get pinned(){return z(this.#_)}set pinned(e){N(this.#_,e)}pin(e){this.pinned.includes(e)||(this.pinned=[...this.pinned,e])}unpin(e){this.pinned=this.pinned.filter(t=>t!==e)}#v=j(()=>new Map(this.infra.map(({id:e,position:t,measured:n})=>[e,{...this.shown(t,e),w:n?.width??nc.w,h:n?.height??nc.h}])));get infraBoxes(){return z(this.#v)}set infraBoxes(e){N(this.#v,e)}#y=M(!1);get present(){return z(this.#y)}set present(e){N(this.#y,e,!0)}entering=!1;#b=M(!1);get brief(){return z(this.#b)}set brief(e){N(this.#b,e,!0)}#x=j(()=>{if(!this.brief||this.live||this.present)return;let e=this.nodes.filter(e=>e.selected);return e.length===1?e[0]:void 0});get panelCard(){return z(this.#x)}set panelCard(e){N(this.#x,e)}#S=M({});get fullHeights(){return z(this.#S)}set fullHeights(e){N(this.#S,e)}#C=j(()=>new Map([...this.nodes,...this.infra].map(({id:e,measured:t})=>{let n=t?.height??0,r=this.fullHeights[e]??0;return[e,this.brief&&n&&r>n?(r-n)/2:0]})));#w(e=(e,t)=>t.y){let t=[],n=[];for(let{id:r,position:i,measured:a}of[...this.nodes,...this.infra]){let o=a?.height;if(!o)continue;let s=e(r,i),c=z(this.#C).get(r)??0;t.push([s+c,s+c+o]);let l=this.fullHeights[r]??0;c&&n.push([s,s+c]),l>o&&n.push([s+c+o,s+l])}return Io(this.brief?t:[],this.brief?n:[])}#T=Io([],[]);#E=null;#D=()=>[...this.nodes,...this.infra].map(({id:e,position:t,measured:n})=>`${e} ${String(t.x)} ${String(t.y)} ${String(n?.height??0)}`).join(`|`);#O=j(()=>{let e=this.#D();return[...this.nodes,...this.infra].some(e=>e.dragging)||this.brief&&this.#E===e||(this.#E=null,this.#T=this.#w()),this.#T});get squeezed(){return z(this.#O)}set squeezed(e){N(this.#O,e)}shown=(e,t=``)=>({x:e.x,y:this.squeezed.show(e.y+(z(this.#C).get(t)??0))});stored=(e,t=``)=>({x:e.x,y:this.squeezed.back(e.y)-(z(this.#C).get(t)??0)});dropped(e,t){let n=z(this.#C).get(e)??0,r=this.squeezed.back(t.y)-n;if(this.brief)return{x:t.x,y:r};for(let i=0;i<4;i++)r=this.#w((t,n)=>t===e?r:n.y).back(t.y)-n;return{x:t.x,y:r}}#k=j(()=>new Map(this.nodes.flatMap(({id:e,position:t,measured:n})=>n?.width&&n.height?[[e,{...this.shown(t,e),w:n.width,h:n.height}]]:[])));get boxes(){return z(this.#k)}set boxes(e){N(this.#k,e)}#A=M();#j=M([]);get unplaced(){return z(this.#j)}set unplaced(e){N(this.#j,e)}#M(e){return this.nodes.some(t=>t.id===e&&t.data.run===`mock`)}tunnelsOf(e){if(this.#M(e))return[];let t=z(this.#A)?.apps[e];return((this.env===this.envs[0]?void 0:t?.envs?.[this.env]?.prereqs)??t?.prereqs??[]).flatMap(e=>{let{tunnel:t,port:n}=e;return t&&n&&Number.isInteger(n)&&n<65536?[{...e,tunnel:t,port:n}]:[]})}tunnelPath(e,t){let n=z(this.#A)?.apps[e],r=this.env===this.envs[0]?void 0:n?.envs?.[this.env]?.prereqs,i=(r??n?.prereqs??[]).findIndex(e=>e.tunnel===t);return`apps.${e}.${r?`envs.${this.env}.`:``}prereqs[${String(i)}]`}#N=j(()=>Ps(this.cards.filter(e=>!e.data.hideTunnels).flatMap(({id:e})=>this.tunnelsOf(e).map(t=>({app:e,tunnel:t.tunnel,port:t.port,env:t.env,what:Ms(t),connectsAs:t.connectsAs}))),this.cards.flatMap(({id:e})=>{let t=Number(new URL(z(this.#A)?.apps[e]?.url??`http://none`).port);return t?[t]:[]})));get plan(){return z(this.#N)}set plan(e){N(this.#N,e)}ledBy(e){return[...this.plan.filter(t=>t.apps[0]===e).map(tc),...this.boardQueues.filter(t=>this.#R(t)===e).map(e=>`queue:${e.id}`)]}#P=j(()=>new Set(this.cards.map(e=>e.id)));#F=j(()=>new Set(this.cards.filter(e=>e.data.showQueues).map(e=>e.id)));commandsOf(e){return Object.entries(z(this.#A)?.apps[e]?.commands??{}).filter(([,e])=>(e.show??`both`)!==`cli`)}#I(e){return!!z(this.#A)?.apps[e]?.outside}#L=j(()=>{let e=z(this.#A)?.apps??{};return Object.entries(z(this.#A)?.queues??{}).flatMap(([t,n])=>{let r=n=>Object.keys(e).filter(r=>Object.hasOwn(e[r]?.[n]??{},t)&&(z(this.#F).has(r)||this.#I(r))),[i,a]=[r(`publishes`),r(`reads`)];return!this.hiddenQueues[t]&&[...i,...a].some(e=>z(this.#F).has(e))?[{id:t,queue:n,pubs:i,reads:a}]:[]})});get boardQueues(){return z(this.#L)}set boardQueues(e){N(this.#L,e)}ownedBy(e){let t=t=>[...t.pubs,...t.reads].filter(e=>z(this.#P).has(e)||this.#I(e)&&!this.hiddenOutside[e]).every(t=>t===e);return this.ledBy(e).filter(e=>e.startsWith(`tunnel:`)||this.boardQueues.some(n=>`queue:${n.id}`===e&&t(n)))}#R(e){return[...e.pubs,...e.reads].find(e=>z(this.#P).has(e))}queueName(e){return z(this.#A)?.queues?.[e]?.name??e}switchesOver(e){if(this.#M(e))return!1;let t=this.cards.find(t=>t.id===e)?.data.branch,n=this.app(e);return!!(t&&n?.current&&t!==n.current&&n.dirty)}localLibraries(e){let t=this.cards.find(t=>t.id===e)?.data.libraries??[],n=this.app(e)?.libraries??[];return t.filter(e=>n.some(t=>t.name===e))}borrowsTunnels(e){if(this.env===this.envs[0])return!1;let t=z(this.#A)?.apps[e],n=t?.envs?.[this.env]?.prereqs??[],r=this.cards.find(t=>t.id===e)?.data.hideTunnels;return[`sso`,`signIn`,`tunnel`,`hosts`].some(e=>(t?.prereqs??[]).some(t=>t[e])&&!n.some(t=>t[e])&&!(e!==`sso`&&e!==`signIn`&&r))}queuesOf(e){return this.#M(e)?[]:Os(z(this.#A),e).filter(e=>z(this.#A)?.queues?.[e])}#z=j(()=>{let e=e=>this.#I(e)?`outside:${e}`:e;return[...this.boardQueues.flatMap(({id:t,pubs:n,reads:r})=>[...n.map(n=>({from:e(n),to:`queue:${t}`,queue:t})),...r.map(n=>({from:`queue:${t}`,to:e(n),queue:t}))]),...this.cards.flatMap(({id:e})=>Object.keys(z(this.#A)?.apps[e]?.consumes??{}).filter(e=>this.#I(e)).map(t=>({from:e,to:`outside:${t}`}))),...Object.entries(z(this.#A)?.apps??{}).flatMap(([e,t])=>this.#I(e)?Object.keys(t.consumes??{}).filter(e=>this.cards.some(t=>t.id===e)).map(t=>({from:`outside:${e}`,to:t})):[])]});get flows(){return z(this.#z)}set flows(e){N(this.#z,e)}infraSide(e){let t=new Set(this.cables.flatMap(t=>[t.from===e&&t.fromSide,t.to===e&&t.toSide]));return rc.find(e=>!t.has(e))??`bottom`}deployedCalls(e){return this.#M(e)?[]:(this.app(e)?.calls??[]).flatMap(t=>{let n=this.app(t);return n&&!n.outside&&!this.edges.some(n=>n.id===`${e}>${t}`)?[n]:[]})}callLocally(e,t){this.add(t),this.nodes.some(e=>e.id===t)&&this.connect(e,t)}setQueue(e,t){let{[e]:n,...r}=this.queues;this.queues=t?{...r,[e]:`local`}:r,this.syncInfra()}showQueues(e,t){let n=Object.entries(this.hiddenQueues).filter(([t])=>!e.includes(t));this.hiddenQueues=Object.fromEntries(t?n:[...n,...e.map(e=>[e,!0])])}#B=j(()=>this.plan.flatMap(e=>e.apps.map(t=>({from:t,to:tc(e),tunnel:e}))));get links(){return z(this.#B)}set links(e){N(this.#B,e)}#V=j(()=>{let e=[...this.nodes,...this.infra].filter(e=>e.selected),t=this.edges.filter(e=>e.selected),[n]=e,[r]=t;if(e.length===1&&!t.length&&n){let e=[n.id];for(let{from:t,to:r}of[...this.cables,...this.links,...this.flows])(t===n.id||r===n.id)&&e.push(t,r);return{id:n.id,near:e}}return!e.length&&t.length===1&&r?{id:null,cable:[r.source,r.target],near:[r.source,r.target]}:null});get focus(){return z(this.#V)}set focus(e){N(this.#V,e)}dimmed=e=>!!this.focus&&!this.focus.near.includes(e);lit=(e,t)=>{let n=this.focus;return n?n.cable?n.cable[0]===e&&n.cable[1]===t:e===n.id||t===n.id:!1};dimmedLink=(e,t)=>!!this.focus&&!this.lit(e,t);#H(e){let t=this.boxes.get(e),n=this.ledBy(e).flatMap(e=>this.infraBoxes.get(e)??[]).filter(e=>t&&e.y>t.y&&e.x<t.x+t.w&&e.x+e.w>t.x);return{covered:n.length?Math.max(...n.map(e=>e.w+12)):0,atRight:!!t&&!!n.length&&n.every(e=>Math.abs(e.x+e.w-t.x-t.w)<2)}}#U=j(()=>Qo(this.cables,{cardOf:e=>this.boxes.get(e),coveredBelow:e=>this.#H(e)}));get ends(){return z(this.#U)}set ends(e){N(this.#U,e)}#W(e,t,n=this.boxes.get(e)??{w:260,h:200},r=!1,i){let a=this.nodes.find(t=>t.id===e),o=new Set(r?this.ownedBy(e):this.ledBy(e));if(!a||!o.size)return t;let s={...a.position,...n},c=i??this.infraSide(e),l=c===`bottom`?s.y+s.h+nc.gap/2:c===`top`?s.y-nc.gap/2:s.y;return t.map(e=>{if(!o.has(e.id))return e;let t=this.infraBoxes.get(e.id)??nc;c===`top`&&(l-=t.h);let n=c===`right`?s.x+s.w+nc.gap:c===`left`?s.x-nc.gap-t.w:s.x,r={...e,position:{x:n,y:l}};return l+=c===`top`?-nc.gap/2:t.h+nc.gap/2,r})}syncInfra(e={}){let t=new Map(this.infra.map(e=>[e.id,e])),n=[],r=this.plan.map(r=>{let i=tc(r),a=t.get(i);!a&&!e[i]&&n.push(r.apps[0]??``);let o=r.apps.flatMap(e=>this.tunnelsOf(e)).find(e=>e.tunnel===r.host)?.note;return{...a,id:i,type:`tunnel`,deletable:!1,position:a?.position??e[i]??{x:0,y:0},data:{what:r.what,local:`${r.bind}:${String(r.port)}`,moved:!!r.settings||!!r.needsAlias,host:r.host,about:[r.settings?`Moved from port ${String(r.original)} so it does not clash with another tunnel on the board.`:``,r.needsAlias?`Keeps port ${String(r.port)} on its own loopback address, ${r.bind}, so it does not clash (needs sudo once).`:``,typeof o==`string`?o:``].filter(Boolean),apps:r.apps,settings:this.tunnelPath(r.apps[0]??``,r.host)}}}),i=this.env.toUpperCase(),a=e=>z(this.#A)?.apps[e]?.name??e,o=this.boardQueues.map(r=>{let o=`queue:${r.id}`,s=t.get(o),c=this.#R(r);!s&&!e[o]&&c&&n.push(c);let l=Ds.includes(r.queue.type),u=l&&this.queues[r.id]===`local`,d=r.reads.filter(e=>z(this.#P).has(e)).map(a),f=!u&&d.length?d.join(` and `):``;return{...s,id:o,type:`queue`,deletable:!1,position:s?.position??e[o]??{x:0,y:0},data:{queue:r.id,name:r.queue.name,kind:r.queue.type.toUpperCase(),can:l,local:u,shares:f?`Your local ${f} reads the ${i} queue`:``,about:[r.queue.envs?.[this.env]?.queue??r.queue.queue??r.id,f?`It takes messages the deployed ${i} reader would get. Switch to Local to give your run its own copy.`:``].filter(Boolean)}}}),s=[...new Set([...this.flows.flatMap(e=>[e.from,e.to]),...this.pinned.filter(e=>this.#I(e)).map(e=>`outside:${e}`)])].filter(e=>e.startsWith(`outside:`)&&!this.hiddenOutside[e.slice(8)]).map(n=>{let r=z(this.#A)?.apps[n.slice(8)],o=t.get(n),s=this.env===this.envs[0]?void 0:r?.envs?.[this.env]?.deployedUrl,c=typeof s==`string`?s:r?.deployedUrl??``,l=URL.canParse(c)?new URL(c).hostname:``,u=typeof r?.outside==`string`?`: ${r.outside.replace(/\.+$/,``)}`:``;return{...o,id:n,type:`outside`,deletable:!1,position:o?.position??e[n]??{x:0,y:0},data:{name:r?.name??n.slice(8),where:l?`${i}: ${l}`:`Outside, never runs`,about:[`${r?.name??n.slice(8)} does not run on this Mac${u}. Koppler cannot check calls to it.`,l?`The ${i} board uses ${c}.`:``,...this.flows.filter(e=>e.from===n).map(e=>`It sends to the deployed ${a(e.to)}, not to your local one.`)].filter(Boolean)}}}),c=[...r,...o,...s];for(let e of n)c=this.#W(e,c);for(let n of s.filter(n=>!t.has(n.id)&&!e[n.id])){let e=this.#G(n.id,c);c=c.map(t=>t.id===n.id?{...t,position:e}:t)}this.infra=c,this.unplaced=[...new Set([...this.unplaced,...n])]}#G(e,t,n=e=>this.boxes.get(e)??{w:260,h:200}){let r=nc,i=i=>{let a=t.find(t=>t.id===i&&(t.id===e||t.position.x||t.position.y)),o=this.nodes.find(e=>e.id===i);return a?{...a.position,...this.infraBoxes.get(i)??r}:o&&{...o.position,...n(i)}},a=this.flows.flatMap(t=>{let n=t.from===e?t.to:t.to===e?t.from:void 0,r=n===void 0?void 0:i(n);return r?[{at:r,before:t.to===e}]:[]}),o=[...this.nodes.map(e=>i(e.id)),...t.filter(t=>t.id!==e).map(e=>i(e.id))],s=e=>o.every(t=>!t||e.x+r.w+16<=t.x||t.x+t.w+16<=e.x||e.y+r.h+16<=t.y||t.y+t.h+16<=e.y),[c]=a;if(!c)return{x:40,y:40};let{at:l,before:u}=c,d=u?[l.x+l.w+80,l.x-r.w-80]:[l.x-r.w-80,l.x+l.w+80],f=[{x:d[0]??0,y:l.y},{x:d[1]??0,y:l.y},{x:l.x,y:l.y+l.h+40},{x:l.x,y:l.y-r.h-40},...Array.from({length:9},(e,t)=>({x:d[0]??0,y:l.y+(t+1)*(r.h+24)}))];return f.find(s)??f[0]??{x:40,y:40}}settle(){let e=e=>e.every(e=>e.measured?.width);if(!this.unplaced.length||!e(this.nodes)||!e(this.infra))return;let t=this.infra;for(let e of this.unplaced)t=this.#W(e,t);this.unplaced=[],this.infra=t}pushed(e,t,n,r){let i=new Set(this.ledBy(e));return r.map(e=>i.has(e.id)&&e.position.y>=t?{...e,position:{x:e.position.x,y:e.position.y+n}}:e)}followed(e,t,n){let r=new Set(this.ownedBy(e));return n.map(e=>r.has(e.id)&&!e.selected&&!e.dragging?{...e,position:{x:e.position.x+t.x,y:e.position.y+t.y}}:e)}hideTunnel(e){let t=this.infra.find(t=>t.id===e),n=new Set(t?.type===`tunnel`?t.data.apps:[]);this.nodes=this.nodes.map(e=>n.has(e.id)?{...e,data:{...e.data,hideTunnels:!0}}:e)}flowNodes(){return[...this.nodes,...this.infra].map(e=>{let t=this.shown(e.position,e.id);return this.#K.set(e.id,t),{...e,position:t}})}#K=new Map;#q={};fromFlow(e,t,n){let r=new Map([...this.nodes,...this.infra].map(e=>[e.id,e])),i=[],a=e.map(e=>{let t=r.get(e.id),n=e.dragging||t?.dragging?{...e,position:e.type===`app`?this.#J(e.id,e.position,i):this.#Y(e.id,e.position,i)}:e;if(t?.dragging&&!n.dragging)return{...n,position:this.dropped(n.id,n.position)};let a=t&&(this.#K.get(t.id)??this.shown(t.position,t.id));return t&&a?.x===n.position.x&&a.y===n.position.y?{...n,position:t.position}:{...n,position:this.stored(n.position,n.id)}}),o=e.every(e=>!e.dragging)?[]:i;o.join()!==this.snapped.join()&&(this.snapped=o);let s=new Map(this.nodes.map(e=>[e.id,e.position])),c={},l=a.filter(e=>e.type!==`app`),u=a.filter(e=>e.type===`app`);for(let{id:e,measured:r}of u){let i=this.#q[e],a=r?.height;a&&(this.#q[e]={brief:t,height:a});let o=n&&i?.brief===t&&a?a-i.height:0;o&&(c[e]={bottom:i?.height??0,by:o});let s=this.boxes.get(e);if(o&&s){let t=e=>!!e&&e.y>=s.y+(i?.height??0)&&e.x<s.x+s.w&&s.x<e.x+e.w;for(let n of u.filter(n=>n.id!==e&&t(this.boxes.get(n.id))))l=this.followed(n.id,{x:0,y:o},l);u=u.map(n=>n.id!==e&&t(this.boxes.get(n.id))?{...n,position:{x:n.position.x,y:n.position.y+o}}:n)}}for(let{id:e,position:t}of u){let n=c[e];n&&(l=this.pushed(e,t.y+n.bottom,n.by,l));let r=s.get(e);r&&(r.x!==t.x||r.y!==t.y)&&(l=this.followed(e,{x:t.x-r.x,y:t.y-r.y},l))}return this.nodes=u,this.infra=l,this.brief&&e.some(e=>e.dragging||r.get(e.id)?.dragging)&&(this.#E=this.#D()),Object.keys(c).length>0}#J(e,t,n){let r=this.boxes.get(e);if(!r)return t;let i=ic/(this.view?.zoom??1),a={...r,x:t.x,y:t.y},o=(e,t,n)=>{let r=this.cables[e];if(!r)return;let i=r[`${t}Side`],a=Ho(n,i),o=this.ends.offset[`${String(e)}|${t}`]??0;return{side:i,at:Lo[i][0]===0?{...a,x:a.x+o}:{...a,y:a.y+o}}},s,c;this.cables.forEach((t,n)=>{let r=t.from===e?`from`:t.to===e?`to`:null;if(!r||t.from===t.to)return;let l=r===`from`?`to`:`from`,u=this.boxes.get(t[l]);if(!u||this.nodes.some(e=>e.id===t[l]&&e.dragging))return;let d=o(n,r,a),f=o(n,l,u);if(!d||!f)return;let p=Lo[d.side][0]!==0,m=p?f.at.y-d.at.y:f.at.x-d.at.x,h={by:m,cable:`${t.from}>${t.to}`};Math.abs(m)>i||(p&&(!c||Math.abs(m)<Math.abs(c.by))&&(c=h),!p&&(!s||Math.abs(m)<Math.abs(s.by))&&(s=h))});let l=new Set(this.ownedBy(e)),u=[...this.links.filter(t=>t.from===e).map(e=>e.to),...this.flows.flatMap(t=>t.from===e?[t.to]:t.to===e?[t.from]:[])].filter(e=>!l.has(e));for(let t of new Set(u)){let n=this.infraBoxes.get(t);if(!n||this.infra.some(e=>e.id===t&&e.dragging))continue;let r=Math.max(n.x-(a.x+a.w),a.x-(n.x+n.w)),o=Math.max(n.y-(a.y+a.h),a.y-(n.y+n.h))>=r,l=o?n.x+n.w/2-(a.x+a.w/2):n.y+n.h/2-(a.y+a.h/2);if(Math.abs(l)>i)continue;let u={by:l,cable:`${e}>${t}`};o&&(!s||Math.abs(l)<Math.abs(s.by))&&(s=u),!o&&(!c||Math.abs(l)<Math.abs(c.by))&&(c=u)}let d=s?.by??0,f=c?.by??0;for(let e of[s,c])e&&n.push(e.cable,e.cable.split(`>`).reverse().join(`>`));return{x:t.x+d,y:t.y+f}}#Y(e,t,n){let r=this.infraBoxes.get(e);if(!r)return t;let i=ic/(this.view?.zoom??1),a={...r,x:t.x,y:t.y},o=[...this.links.filter(t=>t.to===e).map(e=>e.from),...this.flows.flatMap(t=>t.from===e?[t.to]:t.to===e?[t.from]:[])],s,c;for(let e of new Set(o)){let t=this.boxes.get(e)??this.infraBoxes.get(e);if(!t||[...this.nodes,...this.infra].some(t=>t.id===e&&t.dragging))continue;let n=Math.max(t.x-(a.x+a.w),a.x-(t.x+t.w)),r=Math.max(t.y-(a.y+a.h),a.y-(t.y+t.h))>=n,o=r?t.x+t.w/2-(a.x+a.w/2):t.y+t.h/2-(a.y+a.h/2);if(Math.abs(o)>i)continue;let l=r?s:c;l&&Math.abs(l.by)<=Math.abs(o)||(r?s={by:o,partner:e}:c={by:o,partner:e})}for(let t of[s,c])t&&n.push(`${t.partner}>${e}`,`${e}>${t.partner}`);return{x:a.x+(s?.by??0),y:a.y+(c?.by??0)}}#X=M([]);get snapped(){return z(this.#X)}set snapped(e){N(this.#X,e)}#Z=M();get view(){return z(this.#Z)}set view(e){N(this.#Z,e)}#Q=M(!1);get unsaved(){return z(this.#Q)}set unsaved(e){N(this.#Q,e,!0)}#$={};#ee=M(!1);get live(){return z(this.#ee)}set live(e){N(this.#ee,e,!0)}#te=``;#ne={};goLive(){this.live||=(this.commit(),this.#ne=this.saved(),this.#te=this.content(),!0)}goEdit(){this.live&&=(this.setContent(this.#te),!1)}content(){return JSON.stringify({name:this.name,nodes:this.nodes.map(({id:e,type:t,position:n,data:r})=>({id:e,type:t,position:n,data:r})),infra:this.infra.map(({id:e,position:t})=>({id:e,position:t})),queues:this.queues,hiddenQueues:this.hiddenQueues,hiddenOutside:this.hiddenOutside,pinned:this.pinned,edges:this.edges.map(({id:e,source:t,target:n,type:r,data:i})=>({id:e,source:t,target:n,type:r,data:i}))})}setContent(e){let{name:t,nodes:n,edges:r,infra:i,queues:a,hiddenQueues:o,hiddenOutside:s,pinned:c}=JSON.parse(e);this.name=t,this.pinned=c,this.nodes=n,this.edges=r,this.queues=a,this.hiddenQueues=o,this.hiddenOutside=s,this.syncInfra(Object.fromEntries(i.map(({id:e,position:t})=>[e,t]))),this.infra=this.infra.map(e=>({...e,position:i.find(t=>t.id===e.id)?.position??e.position}))}#re=M(null);get name(){return z(this.#re)}set name(e){N(this.#re,e,!0)}#ie=M([]);get own(){return z(this.#ie)}set own(e){N(this.#ie,e)}get team(){return z(this.#A)?.presets??[]}#ae=M(null);get opened(){return z(this.#ae)}set opened(e){N(this.#ae,e,!0)}#oe(){let e=e=>this.app(e);return{known:t=>!!e(t),cloned:t=>!!e(t)?.cloned,name:t=>e(t)?.name??t,canCall:(t,n)=>!e(t)?.outside&&!!e(n)&&!e(n)?.outside&&!!e(n)?.answers,runIn:t=>(e(t)?.runIn??[]).map(([e])=>e),platforms:t=>(e(t)?.platforms??[]).map(([e])=>e),branches:t=>{let n=e(t)?.branches??[];return n.length&&n.length<300?n:null}}}#se(e){return{name:e,version:1,nodes:Object.fromEntries(this.nodes.map(({id:e,data:t})=>[e,{run:t.run,...t.platform&&{platform:t.platform},...t.branch&&{branch:t.branch},...t.note&&{note:t.note},...t.hideTunnels&&{tunnels:!1},...t.showQueues&&this.queuesOf(e).length>0&&{queues:!0},...t.watch&&t.run===`cli`&&{watch:!0}}])),edges:this.edges.map(({source:e,target:t})=>({from:e,to:t})),...this.pinned.length&&{outside:this.pinned}}}#ce(){let e=e=>Object.fromEntries(e.map(({id:e,position:t})=>[e,{x:Math.round(t.x),y:Math.round(t.y)}]));return{nodes:e(this.nodes),infra:e(this.infra),sides:Object.fromEntries(this.edges.map(({id:e,data:t})=>[e,[t.fromSide,t.toSide,null,null,t.fromSlot??null,t.toSlot??null,t.points??null,t.fromShift??null,t.toShift??null]]))}}#le(){let e=e=>{let t={...this.own.find(t=>t.name===e),...this.#se(e),layout:this.#ce()},n=this.own.some(t=>t.name===e)?this.own.map(n=>n.name===e?t:n):[...this.own,t];JSON.stringify(n)!==JSON.stringify(this.own)&&(this.own=n),this.name!==e&&(this.name=e)};if(this.own.some(e=>e.name===this.name)){e(this.name??``);return}if(!this.nodes.length||this.scratch&&this.nodes.length<2)return;this.scratch=!1;let t=this.team.find(e=>e.name===this.name),n=e=>JSON.stringify([e.nodes,e.edges.map(e=>`${e.from}>${e.to}`).sort()]),r=t&&Vs(t,this.#oe()).preset;if(t&&r&&n(this.#se(t.name))===n(r))return;let i=t&&this.own.find(e=>e.name===`${t.name} (local)`||e.name===`${t.name} (mine)`),a=this.nodes[0]?.data.name??`Untitled`,o=this.nodes.length>1?`${a} + ${String(this.nodes.length-1)}`:a;e(i?.name??this.uniqueName(t?`${t.name} (local)`:this.name||o))}uniqueName(e){let t=new Set([...this.team,...this.own].map(e=>e.name)),n=e;for(let r=2;t.has(n);r++)n=`${e} (${String(r)})`;return n}#ue=M([]);get trash(){return z(this.#ue)}set trash(e){N(this.#ue,e)}#de=M([]);get recent(){return z(this.#de)}set recent(e){N(this.#de,e)}rename(e){let t=e.trim().slice(0,80),n=this.name;return this.own.some(e=>e.name===n)?t?t===n?null:[...this.team,...this.own].some(e=>e.name===t)?`A board is already called ${t}. Pick another name.`:(this.own=this.own.map(e=>e.name===n?{...e,name:t}:e),this.name=t,null):`Give the board a name first.`:`Only a board of your own can be renamed.`}duplicate(){if(!this.nodes.length)return;this.#le();let e=this.nodes[0]?.data.name??`Untitled`,t=this.uniqueName(`${this.name??e} copy`);this.own=[...this.own,{...this.#se(t),layout:this.#ce()}],this.name=t}deleteBoard(e){let t=this.own.find(t=>t.name===e);t&&(this.own=this.own.filter(e=>e!==t),this.trash=[{...t,deleted:new Date().toISOString()},...this.trash].slice(0,20),this.name===e&&this.newBoard())}restore(e){let{deleted:t,...n}=e,r={...n,name:this.uniqueName(e.name)};this.trash=this.trash.filter(t=>t!==e),this.own=[...this.own,r],this.nodes.length||this.openBoard(r)}importBoards(e,t){let n=e?.presets,r=(Array.isArray(e)?e:Array.isArray(n)?n:[e]).map(e=>Rs(e)),i=r.flatMap(e=>e.preset?[{...e.preset,name:e.preset.name.trim().slice(0,80),source:t}]:[]),[a]=i;if(!a)return{error:r[0]?.error??`No board found in it.`};let o=Vs(a,this.#oe());if(o.error!==void 0)return{error:o.error};let s=[...new Map(i.map(e=>[e.name,e])).values()];this.own=[...this.own.filter(e=>!s.some(t=>t.name===e.name)),...s];let c=this.openBoard(a);return c.error===void 0?{notes:c.notes,name:a.name}:c}forTeam(e){let{layout:t,outside:n}=e;return{...JSON.parse(this.asShared(e)),...t?{layout:t}:{},...n?{outside:n}:{}}}keptForTeam(e,t){let n=[...z(this.#A)?.presets??[]];n[e]=t,z(this.#A)&&N(this.#A,{...z(this.#A),presets:n})}asShared(e){let{name:t,nodes:n,edges:r}=e;return JSON.stringify({name:t,version:Rs(e).preset?.version??1,nodes:n,edges:r},null,2)}#fe=M([]);get dismissed(){return z(this.#fe)}set dismissed(e){N(this.#fe,e)}#pe=M(!1);get scratch(){return z(this.#pe)}set scratch(e){N(this.#pe,e,!0)}alone(e){let t=[...this.own,...this.team].find(e=>e.name===this.name);return this.newBoard(),this.scratch=!0,this.add(e),this.opened=`fit`,t}newBoard(){this.scratch=!1,this.dismissed=[],this.name=null,this.nodes=[],this.edges=[],this.queues={},this.hiddenQueues={},this.hiddenOutside={},this.pinned=[]}openBoard(e){if(!Object.keys(e.nodes).length)return this.newBoard(),this.name=e.name,{notes:[]};let t=Vs(e,this.#oe());if(t.error!==void 0)return{error:t.error};let{preset:n,notes:r}=t,i=e.layout??{},a=e=>{let{x:t,y:n}=i.nodes?.[e]??{};return typeof t==`number`&&typeof n==`number`&&Number.isFinite(t)&&Number.isFinite(n)?{x:t,y:n}:null},o=Object.keys(n.nodes),s=o.every(a);this.scratch=!1,this.dismissed=[],this.recent=[{name:n.name,at:new Date().toISOString()},...this.recent.filter(e=>e.name!==n.name)].slice(0,20),this.name=n.name,this.queues={},this.hiddenQueues={},this.hiddenOutside={},this.pinned=Array.isArray(e.outside)?e.outside.filter(e=>typeof e==`string`):[],this.infra=this.infra.map(lc),this.nodes=o.flatMap(e=>{let t=this.app(e),r=n.nodes[e];if(!t||!r)return[];let i={...r,hideTunnels:r.tunnels===!1,showQueues:r.queues===!0};return[this.#ve(t,s&&a(e)||{x:0,y:0},i)]});let c=Object.fromEntries(this.nodes.map(({id:e,position:t})=>[e,t])),l=e=>typeof e==`string`&&e in Lo,u=(e,t)=>Number.isInteger(t)?{[e]:t}:{},d=(e,t)=>typeof t==`number`&&Number.isFinite(t)?{[e]:t}:{};return this.edges=n.edges.map(({from:e,to:t})=>{let[n,r,,,a,o,f,p,m]=i.sides?.[`${e}>${t}`]??[];return!s||!l(n)||!l(r)?cc(e,t,Fo(c,{from:e,to:t},`down`,()=>({w:260,h:160}))):cc(e,t,{fromSide:n,toSide:r,...u(`fromSlot`,a),...u(`toSlot`,o),...d(`fromShift`,p),...d(`toShift`,m),...Array.isArray(f)&&{points:f}})}),this.infra=[],this.syncInfra(s?i.infra??{}:{}),this.opened=s?`fit`:`arrange`,{notes:r}}clear(){this.nodes=[],this.edges=[]}#me=M([]);get apps(){return z(this.#me)}set apps(e){N(this.#me,e)}#he=j(()=>new Map(this.apps.map(e=>[e.id,e])));app=e=>z(this.#he).get(e);nameOf=e=>z(this.#he).get(e)?.name??e;#ge=M([]);get envs(){return z(this.#ge)}set envs(e){N(this.#ge,e)}#_e=M([]);get roots(){return z(this.#_e)}set roots(e){N(this.#_e,e)}area=()=>new DOMRect;show=()=>void 0;#ve(e,t,n={}){let{id:r,name:i,kind:a,kindLabel:o,runIn:s,platforms:c}=e,l=s.some(([e])=>e===n.run)?n.run:s[0]?.[0],u=c.some(([e])=>e===n.platform)?n.platform:c[0]?.[0];return{id:r,type:`app`,position:t,data:{name:i,kind:a,kindLabel:o,...n.hideTunnels===!0&&{hideTunnels:!0},...n.showQueues===!0&&{showQueues:!0},...n.watch===!0&&{watch:!0},...(n.changes===`take-along`||n.changes===`set-aside`)&&{changes:n.changes},...Array.isArray(n.libraries)&&{libraries:n.libraries.filter(e=>typeof e==`string`)},branch:n.branch??``,run:l??`cli`,...u&&{platform:u},note:n.note??``}}}async reload(){this.commit(),await Ys(this.saved());let e=await qs();e&&this.open(e)}open({stack:e,clones:t,roots:n,saved:r}){let i=wo(e);N(this.#A,i),N(this.#u,i.envs.filter(e=>As(i,e))),this.stack=i.name??``,this.dir=(i.source??``).replace(/\/stack\.json$/,``),this.setup=!!i.setup,this.known=i.stacks??[],this.envs=i.envs,this.env=r?.env??i.envs[0]??``,this.roots=n,this.apps=Object.entries(i.apps).map(([e,n])=>({id:e,name:n.name,kind:n.kind,kindLabel:hs(n,i).label,slug:n.slug??``,cloned:!!t[e],calls:[...new Set([...Object.keys(n.consumes??{}),...Object.keys(i.found?.[e]??{})])],known:Object.keys(n.consumes??{}),answers:hs(n,i).serves||Object.entries(i.apps).some(([t,n])=>t!==e&&(n.consumes?.[e]??i.found?.[t]?.[e])),serves:!!n.url,runIn:[...hs(n,i).runIn,...n.mock?.length?[[`mock`,`Mock`]]:[]],platforms:hs(n,i).platforms??[],current:t[e]?.branch??``,branches:t[e]?.branches??[],dirty:t[e]?.dirty??0,libraries:(t[e]?.libraries??[]).map(({name:e,path:t})=>({name:e,path:t})),...n.outside&&{outside:typeof n.outside==`string`?n.outside:`an outside system`}})),this.nodes=this.apps.flatMap(e=>{let t=r?.nodes?.[e.id];return t?[this.#ve(e,{x:t.x,y:t.y},t)]:[]}),this.fullHeights=Object.fromEntries(Object.entries(r?.nodes??{}).flatMap(([e,t])=>typeof t?.full==`number`&&t.full>0?[[e,t.full]]:[]));let a=new Set(this.nodes.map(({id:e})=>e));this.edges=(r?.edges??[]).filter(({from:e,to:t})=>a.has(e)&&a.has(t)).map(({from:e,to:t,fromSide:n,toSide:r,...i})=>cc(e,t,{fromSide:n??`right`,toSide:r??`left`,...i})),this.#$=r??{},this.name=typeof r?.preset==`string`?r.preset:null,this.own=Array.isArray(r?.presets)?r.presets:[],this.scratch=r?.scratch===!0,this.dismissed=Array.isArray(r?.dismissed)?r.dismissed:[],this.trash=Array.isArray(r?.trash)?r.trash:[],this.recent=Array.isArray(r?.recent)?r.recent:[],this.infra=[],this.queues=r?.queues??{},this.hiddenQueues=r?.hiddenQueues??{},this.hiddenOutside=r?.hiddenOutside??{},this.pinned=Array.isArray(r?.outside)?r.outside:[],this.syncInfra(r?.infra??{});let{zoom:o,pan:s}=r??{};this.view=o&&s?{x:s.x,y:s.y,zoom:o}:void 0}commit(){!this.live&&!this.nodes.some(e=>e.dragging)&&this.#le()}get changes(){return[z(this.#A),this.live,this.env,this.name,this.scratch,this.view,this.nodes,this.edges,this.infra,this.own,this.trash,this.recent,this.dismissed,this.fullHeights,this.queues,this.hiddenQueues,this.hiddenOutside,this.pinned]}saved(){if(this.live)return{...this.#ne,env:this.env};let e=this.#$.nodes??{};return{mode:`auto`,...this.#$,preset:this.name,presets:this.own,trash:this.trash,recent:this.recent,scratch:this.scratch||void 0,dismissed:this.dismissed.length?this.dismissed:void 0,env:this.env,...this.view&&{zoom:this.view.zoom,pan:{x:this.view.x,y:this.view.y}},nodes:Object.fromEntries(this.nodes.map(({id:t,position:n,data:{branch:r,run:i,platform:a,note:o,hideTunnels:s,showQueues:c,watch:l,changes:u,libraries:d}})=>[t,{...e[t],x:Math.round(n.x),y:Math.round(n.y),branch:r,run:i,...a&&{platform:a},note:o,hideTunnels:s?!0:void 0,showQueues:c?!0:void 0,watch:l?!0:void 0,changes:u,libraries:d?.length?d:void 0,full:this.fullHeights[t]}])),edges:this.edges.map(({source:e,target:t,data:n})=>({from:e,to:t,...n})),queues:this.queues,hiddenQueues:this.hiddenQueues,hiddenOutside:Object.keys(this.hiddenOutside).length?this.hiddenOutside:void 0,outside:this.pinned.length?this.pinned:void 0,infra:Object.fromEntries(this.infra.map(({id:e,position:t})=>[e,{x:Math.round(t.x),y:Math.round(t.y)}]))}}add(e,t){let n=this.app(e);if(!n||n.outside||!n.cloned||this.nodes.some(t=>t.id===e))return;if(t){let e=this.toFlow(t);this.#ye(this.#ve(n,this.stored({x:e.x-sc.w/2,y:e.y-22})));return}let r=this.area(),i=this.toFlow({x:r.left,y:r.top}),a=this.toFlow({x:r.right,y:r.bottom}),o=this.nodes.map(({id:e,position:t})=>this.boxes.get(e)??{...this.shown(t,e),w:sc.w,h:sc.h}),s=(e,t)=>o.every(n=>e+sc.w+sc.gap<=n.x||n.x+n.w+sc.gap<=e||t+sc.h+sc.gap<=n.y||n.y+n.h+sc.gap<=t),c=(e,t,n)=>Array.from({length:Math.max(0,Math.floor((t-n-e-40)/40)+1)},(t,n)=>e+40+n*40),l=(e,t)=>e-t,u=(e,t)=>[...new Set([...e,...t])],d=u(o.map(e=>e.y).sort(l),c(i.y,a.y,sc.h)).filter(e=>e>=i.y&&e+sc.h<=a.y),f=u(o.map(e=>e.x+e.w+sc.gap).sort(l),c(i.x,a.x,sc.w)).filter(e=>e>=i.x&&e+sc.w<=a.x),p;for(let e of d)if(p=f.filter(t=>s(t,e)).map(t=>({x:t,y:e}))[0],p)break;let m=this.nodes.length*32;this.#ye(this.#ve(n,this.stored(p??{x:i.x+48+m,y:i.y+48+m})))}selectAll(){let e=e=>e.selected?e:{...e,selected:!0};this.nodes=this.nodes.map(e),this.infra=this.infra.map(e),this.edges=this.edges.map(lc)}pick(e){let t=t=>!!t.selected==(t.id===e)?t:{...t,selected:t.id===e};this.infra=this.infra.map(t),this.edges=this.edges.map(lc),this.nodes=this.nodes.map(t)}#ye(e){this.infra=this.infra.map(lc),this.edges=this.edges.map(lc),this.nodes=[...this.nodes.map(lc),{...e,selected:!0}]}showOutside(e,t){let{[e]:n,...r}=this.hiddenOutside;this.hiddenOutside=t?r:{...r,[e]:!0},t?this.pin(e):this.unpin(e),this.syncInfra()}set(e,t){this.nodes=this.nodes.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)}cablesOf(e){let t=e=>this.app(e),n=this.cards.flatMap(n=>n.id===e?[]:t(n.id)??[]),r=n.filter(t=>this.edges.some(n=>n.id===`${e}>${t.id}`)),i=n.filter(e=>!r.includes(e)),a=i.filter(n=>t(e)?.calls.includes(n.id)),o=i.filter(t=>!t.outside&&t.answers&&!t.calls.includes(e));return{can:a.length?a:o,wired:r}}uncabled(e){return this.cards.length>1&&!this.edges.some(t=>t.source===e||t.target===e)}connect(e,t){let n=cc(e,t,Fo(Object.fromEntries(this.nodes.map(({id:e,position:t})=>[e,t])),{from:e,to:t},`down`,e=>this.boxes.get(e)??{w:260,h:160}));this.edges=[...this.edges.filter(e=>e.id!==n.id),n]}cut(e,t){this.edges=this.edges.filter(n=>n.id!==`${e}>${t}`)}remove(e){this.nodes=this.nodes.filter(t=>t.id!==e),this.edges=this.edges.filter(t=>t.source!==e&&t.target!==e)}edit(e,t,n=!1){if(this.name!==e){let r=this.own.find(t=>t.name===e)??this.team.find(t=>t.name===e)??(n?{name:e,version:1,nodes:{},edges:[]}:void 0);if(!r)return!1;let i={...Ws(r,t),name:e};if(JSON.stringify(i)===JSON.stringify(r))return!1;let a=this.own.some(t=>t.name===e);return this.own=a?this.own.map(t=>t.name===e?i:t):[...this.own,i],!0}let r=this.content(),i=e=>this.cards.some(t=>t.id===e);for(let e of t.remove??[])this.remove(e);for(let e of t.add??[])this.add(e);for(let[e,n]of Object.entries(t.branch??{}))this.set(e,{branch:n});for(let[e,n]of Object.entries(t.note??{}))this.set(e,{note:n});for(let{from:e,to:n}of t.uncable??[])this.cut(e,n);for(let{from:e,to:n}of t.cable??[])i(e)&&i(n)&&!this.edges.some(t=>t.id===`${e}>${n}`)&&this.connect(e,n);return t.arrange&&(this.opened=`arrange`),this.content()!==r||!!t.arrange}#be={key:``,version:0};arrange(e=e=>this.boxes.get(e)??{w:260,h:160}){let t=()=>JSON.stringify(this.nodes.map(({id:e,position:t})=>[e,t.x,t.y])),n=t(),r=n===this.#be.key?this.#be.version+1:0;for(let i=0;i<ec.length;i++,r++){let[i,a]=ec[r%ec.length]??ec[0];if(this.#xe(e,i,a),t()!==n)break}this.#be={key:t(),version:r}}#xe(e,t,n){let r=this.cables.map(({from:e,to:t})=>({from:e,to:t})),i=e=>t===`down`&&r.some(t=>t.from===e)?`right`:`bottom`,a=n=>{let i=this.ledBy(n).filter(e=>this.ownedBy(n).includes(e)).map(e=>this.infraBoxes.get(e)??nc),{w:a,h:o}=e(n);if(!i.length)return{w:a,h:o};let s=i.reduce((e,t)=>e+t.h+nc.gap/2,0),c=Math.max(...i.map(e=>e.w));return t===`down`&&r.some(e=>e.from===n)?{w:a+nc.gap+c,h:Math.max(o,s)}:{w:Math.max(a,c),h:o+s}},o=new Map(this.nodes.flatMap(e=>this.ownedBy(e.id).map(t=>[t,e.id]))),s=this.infra.filter(e=>e.type!==`tunnel`&&!o.has(e.id)).map(e=>e.id),c=e=>s.includes(e)||this.cards.some(t=>t.id===e),l=e=>o.get(e)??e,u=this.flows.map(({from:e,to:t})=>({from:l(e),to:l(t)})).filter(({from:e,to:t})=>e!==t&&c(e)&&c(t)),d=Po([...this.nodes.map(e=>e.id),...s],[...r,...u],e=>s.includes(e)?this.infraBoxes.get(e)??{w:220,h:70}:a(e),t,n,{pad:ac,anchor:n=>s.includes(n)?void 0:t===`down`?e(n).w/2:oc/2}),f=Object.fromEntries(this.nodes.filter(e=>this.ownedBy(e.id).length).map(e=>[e.id,i(e.id)])),p=r.map(n=>({...n,...Fo(d,n,t,e,f)}));Zo(p,t=>({...d[t]??{x:0,y:0},...e(t)})),this.nodes=this.nodes.map(e=>({...e,position:d[e.id]??e.position})),this.edges=p.map(({from:e,to:t,...n})=>cc(e,t,n));let m=this.infra.map(e=>{let t=d[e.id];return t?{...e,position:t}:e});for(let t of this.nodes)m=this.#W(t.id,m,e(t.id),!0,f[t.id]);this.infra=m}},uc={waiting:`Waiting`,building:`Building`,running:`Running`,unhealthy:`Unhealthy`,exited:`Exited`,"failed-to-start":`Failed to start`,"secret-missing":`Secret missing`},dc={waiting:e=>e||`Waiting.`,building:e=>`Building. ${e}`,running:()=>``,unhealthy:e=>`Unhealthy: ${e}`,exited:e=>`Exited. ${e}`,"failed-to-start":e=>`Failed to start: ${e}`,"secret-missing":e=>`Secret missing: ${e}. Set it under Credentials.`},Q=new class{#e=M(null);get status(){return z(this.#e)}set status(e){N(this.#e,e)}#t=M(!1);get asked(){return z(this.#t)}set asked(e){N(this.#t,e,!0)}#n;#r=``;watch(){let e=!1,t=async()=>{if(!(document.hidden||e)){e=!0;try{let e=await fetch(`data/status.json`),t=e.ok?await e.text():this.#r;t!==this.#r&&(this.#r=t,this.status=JSON.parse(t))}catch{}e=!1,this.asked||requestAnimationFrame(()=>requestAnimationFrame(()=>this.asked=!0))}};t(),clearInterval(this.#n),this.#n=setInterval(()=>void t(),1500)}sent(e){let{live:t,progress:n}=this.status??{},r=!t?.env||t.env===Z.env;return!!t?.nodes?.[e]&&r||!!n?.apps?.includes(e)&&n.env===Z.env}#i(e){return this.sent(e)?this.status?.apps?.[e]:void 0}up(e){let t=this.#i(e);return t?t.running?t.running.length>0:t.listening??null:null}state(e){let t=this.#i(e);if(t?.state)return t.state;if(!this.sent(e)||this.up(e))return null;let n=(this.status?.secrets?.[e]?.[Z.env]??[]).filter(e=>!e.stored).map(e=>e.name);return n.length?{state:`secret-missing`,detail:n.join(`, `)}:null}stateSaid(e){let t=this.state(e);return t?dc[t.state](t.detail).trim():``}about(e){let t=this.#i(e);if(t?.running)return this.where(e);if(t?.listening===void 0)return``;let n=String(t.port??``);return t.listening?`Running on port ${n}`:`Nothing is listening on port ${n}`}where(e){let t=this.#i(e);if(!t?.running){let n=this.status?.apps?.[e],r=n?.running?n.running.length>0:n?.listening===!0,i=(this.status?.live?.env??``).toUpperCase();return!t&&r&&this.status?.live?.nodes?.[e]?`Running for your ${i} board, not this one. Run switches it.`:``}let[n]=t.running;if(!n)return`Not running on a simulator or device`;let r={ios:`iOS simulator`,android:`Android`}[n.platform]??n.platform,i=n.source?`, started from ${n.source===`ide`?`your IDE`:`Koppler`}`:``,a=t.running.length>1?`, and ${String(t.running.length-1)} more`:``;return`Running on ${n.device} (${r})${n.flavor?`, ${n.flavor}`:``}${i}${a}`}steps(e){let t=this.#i(e)?.steps??[],n=this.up(e);return n===!0?t.map(e=>(e.label===`Start`||e.label===`Check`)&&(e.state===`user`||e.state===`todo`)?{label:e.label,state:`done`,detail:`Running.`}:e):n===!1?t.map(e=>e.label===`Check`&&e.state===`done`?{...e,state:`todo`,detail:`Not running right now.`}:e):t}hasLog(e){return!!this.status?.apps?.[e]?.logTail}tail(e){return this.status?.apps?.[e]?.logTail??``}tunnel(e,t){return t.some(e=>this.sent(e))?this.status?.ports?.[e]:void 0}};function fc(e){let t=t=>e.find(e=>e.state===t),[n,r,i]=[t(`failed`),t(`user`),t(`todo`)];return n?[`failed`,`Failed: ${n.label}`]:r?[`user`,`Waiting on you: ${r.label}`]:i?[`todo`,`Next: ${i.label}`]:[`done`,`All steps done`]}var pc=(e,t)=>Js(e,t,!0),mc=e=>{if(e.matches(`.svelte-flow__pane`))return`the empty board`;let t=e.matches(`input[type="radio"], input[type="checkbox"]`)&&e.closest(`label`)||e.closest(`button, a, [role="button"], [role="option"], [role="radio"], [role="menuitem"], label, input, select, summary, .svelte-flow__node, .svelte-flow__edge`)||e,n=t instanceof HTMLInputElement||t instanceof HTMLSelectElement?t.labels?.[0]:null,r=(t.getAttribute(`aria-label`)??t.getAttribute(`title`)??(n??t).textContent).replace(/\s+/g,` `).trim().slice(0,80),i=t.closest(`.svelte-flow__node, .svelte-flow__edge`)?.getAttribute(`data-id`)??``;return`${t.tagName.toLowerCase()}${r?` "${r}"`:``}${i?` in ${i}`:``}`},hc=e=>!!e.closest(`[type="password"], [data-secret]`),gc=new class{#e=M(!1);#t=[];#n;get forced(){return!!Q.status?.dev}get on(){return z(this.#e)||this.forced}set on(e){N(this.#e,e,!0);try{localStorage.setItem(`koppler-debug`,e?`on`:`off`)}catch{}e&&this.note(`debug`,`Debug log on`)}note(e,t,n){if(!this.on)return;let r={apps:Z.nodes.length,cables:Z.edges.length,view:Z.live?`live`:`edit`,env:Z.env,zoom:Math.round((Z.view?.zoom??1)*100)/100};this.#t.push({at:new Date().toISOString(),kind:e,what:t,...n&&{detail:n.slice(0,300)},board:r}),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.flush()},1500)}flush(){let e=this.#t.splice(0);e.length&&pc(`debug-log`,{entries:e})}async read(){return this.flush(),await new Promise(e=>setTimeout(e,300)),(await fetch(`temp/debug.jsonl?${String(Date.now())}`).then(e=>e.ok?e.text():``).catch(()=>``)).trim().split(`
|
|
4
|
+
`).slice(-300).join(`
|
|
5
|
+
`)}clear(){this.#t=[],pc(`debug-clear`,{})}watch(){try{N(this.#e,localStorage.getItem(`koppler-debug`)===`on`)}catch{}let e={capture:!0};addEventListener(`click`,e=>{e.target instanceof Element&&!hc(e.target)&&this.note(`click`,mc(e.target))},e),addEventListener(`change`,e=>{let t=e.target;if(!(t instanceof Element)||hc(t))return;let n=t instanceof HTMLInputElement&&t.type===`checkbox`?String(t.checked):t instanceof HTMLSelectElement||t instanceof HTMLInputElement&&t.type===`radio`?t.value:`(typed)`;this.note(`change`,mc(t),n)},e),addEventListener(`keydown`,e=>{let t=e.target instanceof Element&&!!e.target.closest(`input:not([type="radio"]):not([type="checkbox"]), textarea, select, [contenteditable]`);if(!e.metaKey&&!e.ctrlKey&&t||e.key.length>12)return;let n=[e.metaKey&&`Cmd`,e.ctrlKey&&`Ctrl`,e.shiftKey&&`Shift`,e.altKey&&`Alt`,e.key];this.note(`key`,n.filter(Boolean).join(`+`))},e),addEventListener(`error`,e=>{this.note(`error`,e.message||`page error`,e.filename?`${e.filename.split(`/`).pop()??``}:${String(e.lineno)}`:``)}),addEventListener(`unhandledrejection`,e=>{let t=e.reason,n=t instanceof Error?t.message:typeof t==`string`?t:``;this.note(`error`,n||`unhandled rejection`)}),addEventListener(`pagehide`,()=>{this.flush()})}},$=new class{#e=M(null);get now(){return z(this.#e)}set now(e){N(this.#e,e)}#t;show(e,t=`message`,n){clearTimeout(this.#t),gc.note(t,e),this.now={text:e,warning:t===`warning`,...n&&{action:n}},t!==`warning`&&(this.#t=setTimeout(()=>this.now=null,n?7e3:2600))}hide(){clearTimeout(this.#t),this.now=null}},_c={play:so,database:ro,sprout:fo,refresh:lo,trash:go,terminal:mo,upload:vo,download:ao};async function vc(e,t={}){let n=await Xs(`app-command`,{app:e.app,command:e.key,args:t});return`error`in n?n.error:($.show(`${e.command.label} started on ${e.appName}. The inbox says when it ends.`),null)}async function yc(e,t=!1){let n=await Xs(`open-terminal`,{app:e,env:Z.env,query:t});`error`in n?$.show(n.error,`warning`):$.show(t?`psql opens in a Terminal window.`:`A terminal opens in ${Z.nameOf(e)}'s clone.`)}var bc=H(`<p class="ask svelte-gr1w3a"> </p>`),xc=H(`<span class="opt svelte-gr1w3a">optional</span>`),Sc=H(`<option> </option>`),Cc=H(`<select class="svelte-gr1w3a"></select>`),wc=H(`<input class="svelte-gr1w3a"/>`),Tc=H(`<label class="svelte-gr1w3a"><span> <!></span> <!></label>`),Ec=H(`<button class="x svelte-gr1w3a" type="button" aria-label="Close"><!></button> <h2 id="command-title" class="svelte-gr1w3a"> </h2> <!> <form class="svelte-gr1w3a"><!> <p class="error svelte-gr1w3a" role="alert"> </p> <div class="acts svelte-gr1w3a"><button type="button" class="svelte-gr1w3a">Cancel</button> <button type="submit"> </button></div></form>`,1),Dc=H(`<dialog aria-labelledby="command-title" class="svelte-gr1w3a"><!></dialog>`);function Oc(e,t){k(t,!0);let n=M(void 0),r=M(null),i=M(pn({})),a=M(``),o=M(!1);function s(e){N(r,e),N(i,Object.fromEntries((e.command.args??[]).map(e=>[e.name,e.choices?.[0]??``])),!0),N(a,``),z(n)?.showModal()}let c=async e=>{e.preventDefault(),z(r)&&(N(o,!0),N(a,await vc(z(r),z(i))??``,!0),N(o,!1),z(a)||z(n)?.close())};var l={open:s},u=Dc(),d=P(u),f=e=>{let t=j(()=>z(r));var s=Ec(),l=F(s);X(P(l),{get of(){return to},size:14}),O(l);var u=L(l,2),d=I(u),f=L(u,2),p=e=>{var n=bc(),r=I(n,!0);R(()=>W(r,z(t).command.confirm)),U(e,n)};G(f,e=>{z(t).command.confirm&&e(p)});var m=L(f,2),h=P(m);K(h,17,()=>z(t).command.args??[],e=>e.name,(e,t)=>{var n=Tc(),r=P(n),a=P(r,!0),o=L(a),s=e=>{U(e,xc())};G(o,e=>{z(t).required||e(s)}),O(r);var c=L(r,2),l=e=>{var n=Cc();K(n,20,()=>z(t).choices??[],e=>e,(e,t)=>{var n=Sc(),r=I(n,!0),i={};R(()=>{W(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),U(e,n)}),O(n),ta(n),na(n,()=>z(i)[z(t).name],e=>z(i)[z(t).name]=e),U(e,n)},u=e=>{var n=wc();ma(n),R(()=>{n.required=!!z(t).required,q(n,`inputmode`,z(t).type===`number`?`decimal`:void 0),q(n,`pattern`,z(t).type===`number`?`-?\\d+(\\.\\d+)?`:void 0)}),Sa(n,()=>z(i)[z(t).name],e=>z(i)[z(t).name]=e),U(e,n)};G(c,e=>{z(t).type===`choice`?e(l):e(u,-1)}),O(n),R(()=>W(a,z(t).label??z(t).name)),U(e,n)});var g=L(h,2),_=I(g,!0),v=L(g,2),y=P(v),b=L(y,2);let x;var S=I(b,!0);O(v),O(m),R(()=>{W(d,`${z(t).command.label??``} on ${z(t).appName??``}`),W(_,z(a)),x=Ji(b,1,`go svelte-gr1w3a`,null,x,{danger:!!z(t).command.confirm}),b.disabled=z(o),W(S,z(t).command.label)}),V(`click`,l,()=>z(n)?.close()),B(`submit`,m,c),V(`click`,y,()=>z(n)?.close()),U(e,s)};return G(d,e=>{z(r)&&e(f)}),O(u),Ma(u,e=>N(n,e),()=>z(n)),U(e,u),A(l)}Zr([`click`]);var kc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ac(e,t){let n=J(t,kc),r={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]],aliases:[`sidebar`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var jc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mc(e,t){let n=J(t,jc),r={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Nc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pc(e,t){let n=J(t,Nc),r={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}function Fc(e,t){let n=Y(t,`size`,3,14);X(e,{get of(){return Pc},get size(){return n()}})}var Ic=H(`<span class="cmd nodrag nopan svelte-1mrkr86"><code class="svelte-1mrkr86"> </code> <button type="button" title="Copy this command" class="svelte-1mrkr86"> </button></span>`);function Lc(e,t){k(t,!0);let n=M(!1),r=async()=>{await navigator.clipboard.writeText(t.command).then(()=>!0,()=>!1)?(N(n,!0),setTimeout(()=>N(n,!1),1500)):$.show(`Copy is blocked here. Select the command and copy it.`,`warning`)};var i=Ic(),a=P(i),o=I(a,!0),s=L(a,2),c=I(s,!0);O(i),R(()=>{W(o,t.command),q(s,`aria-label`,t.label),W(c,z(n)?`Copied`:`Copy`)}),V(`click`,s,r),U(e,i),A()}Zr([`click`]);var Rc={value:()=>{}};function zc(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Bc(n)}function Bc(e){this._=e}function Vc(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Bc.prototype=zc.prototype={constructor:Bc,on:function(e,t){var n=this._,r=Vc(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Hc(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Uc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Uc(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bc(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Hc(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Uc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Rc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wc={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Gc(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Wc.hasOwnProperty(t)?{space:Wc[t],local:e}:e}function Kc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function qc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Jc(e){var t=Gc(e);return(t.local?qc:Kc)(t)}function Yc(){}function Xc(e){return e==null?Yc:function(){return this.querySelector(e)}}function Zc(e){typeof e!=`function`&&(e=Xc(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new zu(r,this._parents)}function Qc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $c(){return[]}function el(e){return e==null?$c:function(){return this.querySelectorAll(e)}}function tl(e){return function(){return Qc(e.apply(this,arguments))}}function nl(e){e=typeof e==`function`?tl(e):el(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new zu(r,i)}function rl(e){return function(){return this.matches(e)}}function il(e){return function(t){return t.matches(e)}}var al=Array.prototype.find;function ol(e){return function(){return al.call(this.children,e)}}function sl(){return this.firstElementChild}function cl(e){return this.select(e==null?sl:ol(typeof e==`function`?e:il(e)))}var ll=Array.prototype.filter;function ul(){return Array.from(this.children)}function dl(e){return function(){return ll.call(this.children,e)}}function fl(e){return this.selectAll(e==null?ul:dl(typeof e==`function`?e:il(e)))}function pl(e){typeof e!=`function`&&(e=rl(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new zu(r,this._parents)}function ml(e){return Array(e.length)}function hl(){return new zu(this._enter||this._groups.map(ml),this._parents)}function gl(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}gl.prototype={constructor:gl,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function _l(e){return function(){return e}}function vl(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new gl(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function yl(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new gl(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function bl(e){return e.__data__}function xl(e,t){if(!arguments.length)return Array.from(this,bl);var n=t?yl:vl,r=this._parents,i=this._groups;typeof e!=`function`&&(e=_l(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Sl(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new zu(o,r),o._enter=s,o._exit=c,o}function Sl(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Cl(){return new zu(this._exit||this._groups.map(ml),this._parents)}function wl(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Tl(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new zu(s,this._parents)}function El(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Dl(e){e||=Ol;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new zu(i,this._parents).order()}function Ol(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function jl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Ml(){let e=0;for(let t of this)++e;return e}function Nl(){return!this.node()}function Pl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Fl(e){return function(){this.removeAttribute(e)}}function Il(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ll(e,t){return function(){this.setAttribute(e,t)}}function Rl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Vl(e,t){var n=Gc(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Il:Fl:typeof t==`function`?n.local?Bl:zl:n.local?Rl:Ll)(n,t))}function Hl(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ul(e){return function(){this.style.removeProperty(e)}}function Wl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Gl(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Kl(e,t,n){return arguments.length>1?this.each((t==null?Ul:typeof t==`function`?Gl:Wl)(e,t,n??``)):ql(this.node(),e)}function ql(e,t){return e.style.getPropertyValue(t)||Hl(e).getComputedStyle(e,null).getPropertyValue(t)}function Jl(e){return function(){delete this[e]}}function Yl(e,t){return function(){this[e]=t}}function Xl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Zl(e,t){return arguments.length>1?this.each((t==null?Jl:typeof t==`function`?Xl:Yl)(e,t)):this.node()[e]}function Ql(e){return e.trim().split(/^|\s+/)}function $l(e){return e.classList||new eu(e)}function eu(e){this._node=e,this._names=Ql(e.getAttribute(`class`)||``)}eu.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function tu(e,t){for(var n=$l(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function nu(e,t){for(var n=$l(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function ru(e){return function(){tu(this,e)}}function iu(e){return function(){nu(this,e)}}function au(e,t){return function(){(t.apply(this,arguments)?tu:nu)(this,e)}}function ou(e,t){var n=Ql(e+``);if(arguments.length<2){for(var r=$l(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?au:t?ru:iu)(n,t))}function su(){this.textContent=``}function cu(e){return function(){this.textContent=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function uu(e){return arguments.length?this.each(e==null?su:(typeof e==`function`?lu:cu)(e)):this.node().textContent}function du(){this.innerHTML=``}function fu(e){return function(){this.innerHTML=e}}function pu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function mu(e){return arguments.length?this.each(e==null?du:(typeof e==`function`?pu:fu)(e)):this.node().innerHTML}function hu(){this.nextSibling&&this.parentNode.appendChild(this)}function gu(){return this.each(hu)}function _u(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vu(){return this.each(_u)}function yu(e){var t=typeof e==`function`?e:Jc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function bu(){return null}function xu(e,t){var n=typeof e==`function`?e:Jc(e),r=t==null?bu:typeof t==`function`?t:Xc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Su(){var e=this.parentNode;e&&e.removeChild(this)}function Cu(){return this.each(Su)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Eu(e){return this.select(e?Tu:wu)}function Du(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Ou(e){return function(t){e.call(this,t,this.__data__)}}function ku(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Au(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ju(e,t,n){return function(){var r=this.__on,i,a=Ou(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Mu(e,t,n){var r=ku(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?ju:Au,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Nu(e,t,n){var r=Hl(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Pu(e,t){return function(){return Nu(this,e,t)}}function Fu(e,t){return function(){return Nu(this,e,t.apply(this,arguments))}}function Iu(e,t){return this.each((typeof t==`function`?Fu:Pu)(e,t))}function*Lu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Ru=[null];function zu(e,t){this._groups=e,this._parents=t}function Bu(){return new zu([[document.documentElement]],Ru)}function Vu(){return this}zu.prototype=Bu.prototype={constructor:zu,select:Zc,selectAll:nl,selectChild:cl,selectChildren:fl,filter:pl,data:xl,enter:hl,exit:Cl,join:wl,merge:Tl,selection:Vu,order:El,sort:Dl,call:kl,nodes:Al,node:jl,size:Ml,empty:Nl,each:Pl,attr:Vl,style:Kl,property:Zl,classed:ou,text:uu,html:mu,raise:gu,lower:vu,append:yu,insert:xu,remove:Cu,clone:Eu,datum:Du,on:Mu,dispatch:Iu,[Symbol.iterator]:Lu};function Hu(e){return typeof e==`string`?new zu([[document.querySelector(e)]],[document.documentElement]):new zu([[e]],Ru)}function Uu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Wu(e,t){if(e=Uu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Gu={passive:!1},Ku={capture:!0,passive:!1};function qu(e){e.stopImmediatePropagation()}function Ju(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){var t=e.document.documentElement,n=Hu(e).on(`dragstart.drag`,Ju,Ku);`onselectstart`in t?n.on(`selectstart.drag`,Ju,Ku):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Xu(e,t){var n=e.document.documentElement,r=Hu(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Ju,Ku),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Zu=e=>()=>e;function Qu(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Qu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function ed(){return this.parentNode}function td(e,t){return t??{x:e.x,y:e.y}}function nd(){return navigator.maxTouchPoints||`ontouchstart`in this}function rd(){var e=$u,t=ed,n=td,r=nd,i={},a=zc(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Gu).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Hu(n.view).on(`mousemove.drag`,m,Ku).on(`mouseup.drag`,h,Ku),Yu(n.view),qu(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Ju(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Hu(e.view).on(`mousemove.drag mouseup.drag`,null),Xu(e.view,l),Ju(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(qu(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(Ju(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(qu(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=Wu(l||r,t),p,m,h;if((h=n.call(e,new Qu(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=Wu(l||a,t),_=o}u.call(r,e,new Qu(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Zu(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Zu(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Zu(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Zu(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function id(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ad(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function od(){}var sd=.7,cd=1/sd,ld=`\\s*([+-]?\\d+)\\s*`,ud=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,dd=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,fd=/^#([0-9a-f]{3,8})$/,pd=RegExp(`^rgb\\(${ld},${ld},${ld}\\)$`),md=RegExp(`^rgb\\(${dd},${dd},${dd}\\)$`),hd=RegExp(`^rgba\\(${ld},${ld},${ld},${ud}\\)$`),gd=RegExp(`^rgba\\(${dd},${dd},${dd},${ud}\\)$`),_d=RegExp(`^hsl\\(${ud},${dd},${dd}\\)$`),vd=RegExp(`^hsla\\(${ud},${dd},${dd},${ud}\\)$`),yd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};id(od,wd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bd,formatHex:bd,formatHex8:xd,formatHsl:Sd,formatRgb:Cd,toString:Cd});function bd(){return this.rgb().formatHex()}function xd(){return this.rgb().formatHex8()}function Sd(){return Ld(this).formatHsl()}function Cd(){return this.rgb().formatRgb()}function wd(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=fd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Td(t):n===3?new kd(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ed(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ed(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=pd.exec(e))?new kd(t[1],t[2],t[3],1):(t=md.exec(e))?new kd(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hd.exec(e))?Ed(t[1],t[2],t[3],t[4]):(t=gd.exec(e))?Ed(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_d.exec(e))?Id(t[1],t[2]/100,t[3]/100,1):(t=vd.exec(e))?Id(t[1],t[2]/100,t[3]/100,t[4]):yd.hasOwnProperty(e)?Td(yd[e]):e===`transparent`?new kd(NaN,NaN,NaN,0):null}function Td(e){return new kd(e>>16&255,e>>8&255,e&255,1)}function Ed(e,t,n,r){return r<=0&&(e=t=n=NaN),new kd(e,t,n,r)}function Dd(e){return e instanceof od||(e=wd(e)),e?(e=e.rgb(),new kd(e.r,e.g,e.b,e.opacity)):new kd}function Od(e,t,n,r){return arguments.length===1?Dd(e):new kd(e,t,n,r??1)}function kd(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}id(kd,Od,ad(od,{brighter(e){return e=e==null?cd:cd**+e,new kd(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?sd:sd**+e,new kd(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kd(Pd(this.r),Pd(this.g),Pd(this.b),Nd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ad,formatHex:Ad,formatHex8:jd,formatRgb:Md,toString:Md}));function Ad(){return`#${Fd(this.r)}${Fd(this.g)}${Fd(this.b)}`}function jd(){return`#${Fd(this.r)}${Fd(this.g)}${Fd(this.b)}${Fd((isNaN(this.opacity)?1:this.opacity)*255)}`}function Md(){let e=Nd(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Pd(this.r)}, ${Pd(this.g)}, ${Pd(this.b)}${e===1?`)`:`, ${e})`}`}function Nd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fd(e){return e=Pd(e),(e<16?`0`:``)+e.toString(16)}function Id(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new zd(e,t,n,r)}function Ld(e){if(e instanceof zd)return new zd(e.h,e.s,e.l,e.opacity);if(e instanceof od||(e=wd(e)),!e)return new zd;if(e instanceof zd)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new zd(o,s,c,e.opacity)}function Rd(e,t,n,r){return arguments.length===1?Ld(e):new zd(e,t,n,r??1)}function zd(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}id(zd,Rd,ad(od,{brighter(e){return e=e==null?cd:cd**+e,new zd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?sd:sd**+e,new zd(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new kd(Hd(e>=240?e-240:e+120,i,r),Hd(e,i,r),Hd(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new zd(Bd(this.h),Vd(this.s),Vd(this.l),Nd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Nd(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Bd(this.h)}, ${Vd(this.s)*100}%, ${Vd(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Bd(e){return e=(e||0)%360,e<0?e+360:e}function Vd(e){return Math.max(0,Math.min(1,e||0))}function Hd(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Ud=e=>()=>e;function Wd(e,t){return function(n){return e+n*t}}function Gd(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Kd(e){return(e=+e)==1?qd:function(t,n){return n-t?Gd(t,n,e):Ud(isNaN(t)?n:t)}}function qd(e,t){var n=t-e;return n?Wd(e,n):Ud(isNaN(e)?t:e)}var Jd=(function e(t){var n=Kd(t);function r(e,t){var r=n((e=Od(e)).r,(t=Od(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=qd(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Yd(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Xd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Zd(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=sf(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Qd(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $d(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ef(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=sf(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var tf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nf=new RegExp(tf.source,`g`);function rf(e){return function(){return e}}function af(e){return function(t){return e(t)+``}}function of(e,t){var n=tf.lastIndex=nf.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=tf.exec(e))&&(i=nf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:$d(r,i)})),n=nf.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?af(c[0].x):rf(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function sf(e,t){var n=typeof t,r;return t==null||n===`boolean`?Ud(t):(n===`number`?$d:n===`string`?(r=wd(t))?(t=r,Jd):of:t instanceof wd?Jd:t instanceof Date?Qd:Xd(t)?Yd:Array.isArray(t)?Zd:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?ef:$d)(e,t)}var cf=180/Math.PI,lf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function uf(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*cf,skewX:Math.atan(c)*cf,scaleX:o,scaleY:s}}var df;function ff(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?lf:uf(t.a,t.b,t.c,t.d,t.e,t.f)}function pf(e){return e==null||(df||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),df.setAttribute(`transform`,e),!(e=df.transform.baseVal.consolidate()))?lf:(e=e.matrix,uf(e.a,e.b,e.c,e.d,e.e,e.f))}function mf(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:$d(e,i)},{i:c-2,x:$d(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:$d(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:$d(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:$d(e,n)},{i:s-2,x:$d(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var hf=mf(ff,`px, `,`px)`,`deg)`),gf=mf(pf,`, `,`)`,`)`),_f=1e-12;function vf(e){return((e=Math.exp(e))+1/e)/2}function yf(e){return((e=Math.exp(e))-1/e)/2}function bf(e){return((e=Math.exp(2*e))-1)/(e+1)}var xf=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<_f)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=vf(y),c=s/(n*g)*(i*bf(t*r+y)-yf(y));return[a+c*d,o+c*f,s*i/vf(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Sf=0,Cf=0,wf=0,Tf=1e3,Ef,Df,Of=0,kf=0,Af=0,jf=typeof performance==`object`&&performance.now?performance:Date,Mf=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nf(){return kf||=(Mf(Pf),jf.now()+Af)}function Pf(){kf=0}function Ff(){this._call=this._time=this._next=null}Ff.prototype=If.prototype={constructor:Ff,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Nf():+n)+(t==null?0:+t),!this._next&&Df!==this&&(Df?Df._next=this:Ef=this,Df=this),this._call=e,this._time=n,Vf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vf())}};function If(e,t,n){var r=new Ff;return r.restart(e,t,n),r}function Lf(){Nf(),++Sf;for(var e=Ef,t;e;)(t=kf-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Sf}function Rf(){kf=(Of=jf.now())+Af,Sf=Cf=0;try{Lf()}finally{Sf=0,Bf(),kf=0}}function zf(){var e=jf.now(),t=e-Of;t>Tf&&(Af-=t,Of=e)}function Bf(){for(var e,t=Ef,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ef=n);Df=e,Vf(r)}function Vf(e){Sf||(Cf&&=clearTimeout(Cf),e-kf>24?(e<1/0&&(Cf=setTimeout(Rf,e-jf.now()-Af)),wf&&=clearInterval(wf)):(wf||=(Of=jf.now(),setInterval(zf,Tf)),Sf=1,Mf(Rf)))}function Hf(e,t,n){var r=new Ff;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Uf=zc(`start`,`end`,`cancel`,`interrupt`),Wf=[];function Gf(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Yf(e,n,{name:t,index:r,group:i,on:Uf,tween:Wf,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Kf(e,t){var n=Jf(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function qf(e,t){var n=Jf(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Jf(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Yf(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=If(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Hf(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Hf(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Xf(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function Zf(e){return this.each(function(){Xf(this,e)})}function Qf(e,t){var n,r;return function(){var i=qf(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function $f(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=qf(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function ep(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Jf(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Qf:$f)(n,e,t))}function tp(e,t,n){var r=e._id;return e.each(function(){var e=qf(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Jf(e,r).value[t]}}function np(e,t){var n;return(typeof t==`number`?$d:t instanceof wd?Jd:(n=wd(t))?(t=n,Jd):of)(e,t)}function rp(e){return function(){this.removeAttribute(e)}}function ip(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ap(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function op(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function sp(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function cp(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function lp(e,t){var n=Gc(e),r=n===`transform`?gf:np;return this.attrTween(e,typeof t==`function`?(n.local?cp:sp)(n,r,tp(this,`attr.`+e,t)):t==null?(n.local?ip:rp)(n):(n.local?op:ap)(n,r,t))}function up(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dp(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fp(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&dp(e,i)),n}return i._value=t,i}function pp(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&up(e,i)),n}return i._value=t,i}function mp(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Gc(e);return this.tween(n,(r.local?fp:pp)(r,t))}function hp(e,t){return function(){Kf(this,e).delay=+t.apply(this,arguments)}}function gp(e,t){return t=+t,function(){Kf(this,e).delay=t}}function _p(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?hp:gp)(t,e)):Jf(this.node(),t).delay}function vp(e,t){return function(){qf(this,e).duration=+t.apply(this,arguments)}}function yp(e,t){return t=+t,function(){qf(this,e).duration=t}}function bp(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?vp:yp)(t,e)):Jf(this.node(),t).duration}function xp(e,t){if(typeof t!=`function`)throw Error();return function(){qf(this,e).ease=t}}function Sp(e){var t=this._id;return arguments.length?this.each(xp(t,e)):Jf(this.node(),t).ease}function Cp(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();qf(this,e).ease=n}}function wp(e){if(typeof e!=`function`)throw Error();return this.each(Cp(this._id,e))}function Tp(e){typeof e!=`function`&&(e=rl(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new em(r,this._parents,this._name,this._id)}function Ep(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new em(o,this._parents,this._name,this._id)}function Dp(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Op(e,t,n){var r,i,a=Dp(t)?Kf:qf;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function kp(e,t){var n=this._id;return arguments.length<2?Jf(this.node(),n).on.on(e):this.each(Op(n,e,t))}function Ap(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function jp(){return this.on(`end.remove`,Ap(this._id))}function Mp(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Xc(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Gf(l[f],t,n,f,l,Jf(u,n)));return new em(a,this._parents,t,n)}function Np(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=el(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=Jf(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Gf(p,t,n,h,f,m);a.push(f),o.push(u)}return new em(a,o,t,n)}var Pp=Bu.prototype.constructor;function Fp(){return new Pp(this._groups,this._parents)}function Ip(e,t){var n,r,i;return function(){var a=ql(this,e),o=(this.style.removeProperty(e),ql(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function Lp(e){return function(){this.style.removeProperty(e)}}function Rp(e,t,n){var r,i=n+``,a;return function(){var o=ql(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function zp(e,t,n){var r,i,a;return function(){var o=ql(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),ql(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Bp(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=qf(this,e),l=c.on,u=c.value[a]==null?s||=Lp(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Vp(e,t,n){var r=(e+=``)==`transform`?hf:np;return t==null?this.styleTween(e,Ip(e,r)).on(`end.style.`+e,Lp(e)):typeof t==`function`?this.styleTween(e,zp(e,r,tp(this,`style.`+e,t))).each(Bp(this._id,e)):this.styleTween(e,Rp(e,r,t),n).on(`end.style.`+e,null)}function Hp(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Up(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Hp(e,a,n)),r}return a._value=t,a}function Wp(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Up(e,t,n??``))}function Gp(e){return function(){this.textContent=e}}function Kp(e){return function(){var t=e(this);this.textContent=t??``}}function qp(e){return this.tween(`text`,typeof e==`function`?Kp(tp(this,`text`,e)):Gp(e==null?``:e+``))}function Jp(e){return function(t){this.textContent=e.call(this,t)}}function Yp(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Jp(r)),t}return r._value=e,r}function Xp(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Yp(e))}function Zp(){for(var e=this._name,t=this._id,n=tm(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=Jf(c,t);Gf(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new em(r,this._parents,e,n)}function Qp(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=qf(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var $p=0;function em(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function tm(){return++$p}var nm=Bu.prototype;em.prototype={constructor:em,select:Mp,selectAll:Np,selectChild:nm.selectChild,selectChildren:nm.selectChildren,filter:Tp,merge:Ep,selection:Fp,transition:Zp,call:nm.call,nodes:nm.nodes,node:nm.node,size:nm.size,empty:nm.empty,each:nm.each,on:kp,attr:lp,attrTween:mp,style:Vp,styleTween:Wp,text:qp,textTween:Xp,remove:jp,tween:ep,delay:_p,duration:bp,ease:Sp,easeVarying:wp,end:Qp,[Symbol.iterator]:nm[Symbol.iterator]};function rm(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var im={time:null,delay:0,duration:250,ease:rm};function am(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function om(e){var t,n;e instanceof em?(t=e._id,e=e._name):(t=tm(),(n=im).time=Nf(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Gf(c,e,t,l,o,n||am(c,t));return new em(r,this._parents,e,t)}Bu.prototype.interrupt=Zf,Bu.prototype.transition=om;var sm=e=>()=>e;function cm(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function lm(e,t,n){this.k=e,this.x=t,this.y=n}lm.prototype={constructor:lm,scale:function(e){return e===1?this:new lm(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new lm(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var um=new lm(1,0,0);dm.prototype=lm.prototype;function dm(e){for(;!e.__zoom;)if(!(e=e.parentNode))return um;return e.__zoom}function fm(e){e.stopImmediatePropagation()}function pm(e){e.preventDefault(),e.stopImmediatePropagation()}function mm(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function hm(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function gm(){return this.__zoom||um}function _m(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vm(){return navigator.maxTouchPoints||`ontouchstart`in this}function ym(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function bm(){var e=mm,t=hm,n=ym,r=_m,i=vm,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=xf,l=zc(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,gm).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,ee).on(`dblclick.zoom`,T).filter(i).on(`touchstart.zoom`,te).on(`touchmove.zoom`,E).on(`touchend.zoom touchcancel.zoom`,ne).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,gm),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(um.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new lm(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new lm(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new lm(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Hu(this.that).datum();l.call(e,this.that,new cm(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Wu(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Xf(this),s.start();pm(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function ee(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Hu(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Wu(t,i),l=t.clientX,u=t.clientY;Yu(t.view),fm(t),a.mouse=[c,this.__zoom.invert(c)],Xf(this),a.start();function d(e){if(pm(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Wu(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Xu(e.view,a.moved),pm(e),a.event(e).end()}}function T(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Wu(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);pm(r),s>0?Hu(this).transition().duration(s).call(x,d,c,r):Hu(this).call(_.transform,d,c,r)}}function te(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(fm(t),s=0;s<i;++s)c=r[s],l=Wu(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Xf(this),a.start())}}function E(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(pm(e),s=0;s<a;++s)c=i[s],l=Wu(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function ne(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(fm(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Wu(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Hu(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:sm(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:sm(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:sm(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:sm([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var xm={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Sm=[[-1/0,-1/0],[1/0,1/0]],Cm=[`Enter`,` `,`Escape`],wm={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Tm;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Tm||={});var Em;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Em||={});var Dm;(function(e){e.Partial=`partial`,e.Full=`full`})(Dm||={});var Om={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},km;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(km||={});var Am;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Am||={});var jm;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(jm||={});var Mm={[jm.Left]:jm.Right,[jm.Right]:jm.Left,[jm.Top]:jm.Bottom,[jm.Bottom]:jm.Top},Nm=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Pm=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Fm=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Im=(e,t=[0,0])=>{let{width:n,height:r}=gh(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Lm=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):Fm(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,Xm(e,eh(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Qm(r):{x:0,y:0,width:0,height:0}},Rm=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Xm(n,eh(e)),r=!0)}),r?Qm(n):{x:0,y:0,width:0,height:0}},zm=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=nh(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Bm=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Vm(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=gh(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Hm({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=ph(Rm(Vm(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Um({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,xm.error005());else{let{width:e,height:t}=gh(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&hh(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=hh(d)?Km(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,xm.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Wm({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Bm(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Gm=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Km=(e={x:0,y:0},t,n)=>({x:Gm(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Gm(e.y,t[0][1],t[1][1]-(n?.height??0))});function qm(e,t,n){let{width:r,height:i}=gh(n),{x:a,y:o}=n.internals.positionAbsolute;return Km(e,[[a,o],[a+r,o+i]],t)}var Jm=(e,t,n)=>e<t?Gm(Math.abs(e-t),1,t)/t:e>n?-Gm(Math.abs(e-n),1,t)/t:0,Ym=(e,t,n=15,r=40)=>[Jm(e.x,r,t.width-r)*n,Jm(e.y,r,t.height-r)*n],Xm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Zm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Qm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),$m=(e,t=[0,0])=>{let{x:n,y:r}=Fm(e)?e.internals.positionAbsolute:Im(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},eh=(e,t=[0,0])=>{let{x:n,y:r}=Fm(e)?e.internals.positionAbsolute:Im(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},th=(e,t)=>Qm(Xm(Zm(e),Zm(t))),nh=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},rh=(e,t)=>nh(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),ih=e=>ah(e.width)&&ah(e.height)&&ah(e.x)&&ah(e.y),ah=e=>!isNaN(e)&&isFinite(e),oh=(e,t)=>(e,t)=>{},sh=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ch=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?sh(s,o):s},lh=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function uh(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function dh(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=uh(e,n),i=uh(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=uh(e.top??e.y??0,n),i=uh(e.bottom??e.y??0,n),a=uh(e.left??e.x??0,t),o=uh(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function fh(e,t,n,r,i,a){let{x:o,y:s}=lh(e,[t,n,r]),{x:c,y:l}=lh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var ph=(e,t,n,r,i,a)=>{let o=dh(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Gm(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=fh(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},mh=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function hh(e){return e!=null&&e!==`parent`}function gh(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function _h(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function vh(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function yh(e){return{...wm,...e||{}}}function bh(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(let n of e.keys())if(!t.has(n))return!1;return!0}function xh(e,t,n){if(!n)return;let r=[];e.forEach((e,n)=>{t?.has(n)||r.push(e)}),r.length&&n(r)}function Sh(e){return e===null?null:e?`valid`:`invalid`}function Ch(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=kh(e),s=ch({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?sh(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var wh=e=>({width:e.offsetWidth,height:e.offsetHeight}),Th=e=>e?.getRootNode?.()||window?.document,Eh=[`INPUT`,`SELECT`,`TEXTAREA`];function Dh(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Eh.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Oh=e=>`clientX`in e,kh=(e,t)=>{let n=Oh(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Ah=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...wh(t)}})};function jh({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Mh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Nh({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case jm.Left:return[t-Mh(t-r,a),n];case jm.Right:return[t+Mh(r-t,a),n];case jm.Top:return[t,n-Mh(n-i,a)];case jm.Bottom:return[t,n+Mh(i-n,a)]}}function Ph({sourceX:e,sourceY:t,sourcePosition:n=jm.Bottom,targetX:r,targetY:i,targetPosition:a=jm.Top,curvature:o=.25}){let[s,c]=Nh({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Nh({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=jh({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Fh({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Ih({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function Lh({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Xm(eh(e),eh(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),rh({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Qm(a))>0}var Rh=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,zh=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Bh=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,xm.error006()),t;let r=n.getEdgeId||Rh,i;return i=Nm(e)?{...e}:{...e,id:r(e)},zh(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Vh({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Fh({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Hh={[jm.Left]:{x:-1,y:0},[jm.Right]:{x:1,y:0},[jm.Top]:{x:0,y:-1},[jm.Bottom]:{x:0,y:1}},Uh=({source:e,sourcePosition:t=jm.Bottom,target:n})=>t===jm.Left||t===jm.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Wh=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Gh({source:e,sourcePosition:t=jm.Bottom,target:n,targetPosition:r=jm.Top,center:i,offset:a,stepPosition:o}){let s=Hh[t],c=Hh[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Uh({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Fh({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Kh(e,t,n,r){let i=Math.min(Wh(e,t)/2,Wh(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function qh({sourceX:e,sourceY:t,sourcePosition:n=jm.Bottom,targetX:r,targetY:i,targetPosition:a=jm.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Gh({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Kh(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Jh(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Yh(e){let{sourceNode:t,targetNode:n}=e;if(!Jh(t)||!Jh(n))return null;let r=t.internals.handleBounds||Xh(t.handles),i=n.internals.handleBounds||Xh(n.handles),a=Qh(r?.source??[],e.sourceHandle),o=Qh(e.connectionMode===Tm.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,xm.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||jm.Bottom,c=o?.position||jm.Top,l=Zh(t,a,s),u=Zh(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Xh(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Zh(e,t,n=jm.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??gh(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case jm.Top:return{x:i+o/2,y:a};case jm.Right:return{x:i+o,y:a+s/2};case jm.Bottom:return{x:i+o/2,y:a+s};case jm.Left:return{x:i,y:a+s/2}}}function Qh(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function $h(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function eg(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=$h(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}function tg(e,t,n,r,i){let a=.5;i===`start`?a=0:i===`end`&&(a=1);let o=[(e.x+e.width*a)*t.zoom+t.x,e.y*t.zoom+t.y-r],s=[-100*a,-100];switch(n){case jm.Right:o=[(e.x+e.width)*t.zoom+t.x+r,(e.y+e.height*a)*t.zoom+t.y],s=[0,-100*a];break;case jm.Bottom:o[1]=(e.y+e.height)*t.zoom+t.y+r,s[1]=0;break;case jm.Left:o=[e.x*t.zoom+t.x-r,(e.y+e.height*a)*t.zoom+t.y],s=[-100,-100*a]}return`translate(${o[0]}px, ${o[1]}px) translate(${s[0]}%, ${s[1]}%)`}var ng=1e3,rg=10,ig={nodeOrigin:[0,0],nodeExtent:Sm,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},ag={...ig,checkEquality:!0};function og(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function sg(e,t,n){let r=og(ig,n);for(let n of e.values())if(n.parentId)fg(n,e,t,r);else{let e=Km(Im(n,r.nodeOrigin),hh(n.extent)?n.extent:r.nodeExtent,gh(n));n.internals.positionAbsolute=e}}function cg(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function lg(e){return e===`manual`}function ug(e,t,n,r={}){let i=og(ag,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!lg(i.zIndexMode)?ng:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Km(Im(u,i.nodeOrigin),hh(u.extent)?u.extent:i.nodeExtent,gh(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:cg(u,e),z:pg(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&fg(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function dg(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function fg(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=og(ig,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dg(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*rg),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=mg(e,u,o,s,a&&!lg(c)?ng:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function pg(e,t,n){let r=ah(e.zIndex)?e.zIndex:0;return lg(n)?r:r+(e.selected?t:0)}function mg(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=gh(e),l=Im(e,n),u=hh(e.extent)?Km(l,e.extent,c):l,d=Km({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=qm(d,c,t));let f=pg(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function hg(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=th(a.get(n.parentId)?.expandedRect??$m(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=gh(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function gg(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=wh(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=hh(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=qm(h,s,n))}else m&&(h=Km(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Ah(`source`,r.nodeElement,p,d,e.id),target:Ah(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&fg(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:$m(g,i)}))}}if(f.length>0){let e=hg(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function _g({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function vg(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function yg(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;vg(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),vg(`target`,s,c,e,i,o),t.set(r.id,r)}}function bg(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:bg(n,t):!1}function xg(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Sg(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!bg(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Cg({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function wg({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=sh(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Tg({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Hu(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Zm(Rm(s)):null,x=v&&l?wg({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:sh(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Um({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Cg({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Ym(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Ch(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Sg(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Cg({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let ee=rd().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Ch(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=kh(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Ch(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=kh(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=kh(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Cg({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!xg(t,`.${g}`,v))&&(!_||xg(t,_,v))});f.call(ee)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Eg(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())rh(i,$m(e))>0&&r.push(e);return r}var Dg=250;function Og(e,t,n,r){let i=[],a=1/0,o=Eg(e,n,t+Dg);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Zh(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function kg(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Zh(o,c,c.position,!0)}:c}function Ag(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function jg(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Mg=()=>!0;function Ng(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Mg,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let ee=Th(e.target),T=0,te,{x:E,y:ne}=kh(e),re=Ag(a,w),ie=s?.getBoundingClientRect(),ae=!1;if(!ie||!re)return;let oe=kg(i,re,r,c,t);if(!oe)return;let se=kh(e,ie),ce=!1,le=null,ue=!1,de=null;function fe(){if(!u||!ie)return;let[e,t]=Ym(se,ie,S);f({x:e,y:t}),T=requestAnimationFrame(fe)}let pe={...oe,nodeId:i,type:re,position:oe.position},me=c.get(i),he={inProgress:!0,isValid:null,from:Zh(me,pe,jm.Left,!0),fromHandle:pe,fromPosition:pe.position,fromNode:me,to:se,toHandle:null,toPosition:Mm[pe.position],toNode:null,pointer:se};function ge(){ae=!0,y(he),m?.(e,{nodeId:i,handleId:r,handleType:re})}C===0&&ge();function _e(e){if(!ae){let{x:t,y:n}=kh(e),r=t-E,i=n-ne;if(!(r*r+i*i>C*C))return;ge()}if(!x()||!pe){ve(e);return}let a=b();se=kh(e,ie),te=Og(ch(se,a,!1,[1,1]),n,c,pe),ce||=(fe(),!0);let s=Pg(e,{handle:te,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:ee,lib:l,flowId:d,nodeLookup:c});de=s.handleDomNode,le=s.connection,ue=jg(!!te,s.isValid);let u=c.get(i),f=u?Zh(u,pe,jm.Left,!0):he.from,p={...he,from:f,isValid:ue,to:s.toHandle&&ue?lh({x:s.toHandle.x,y:s.toHandle.y},a):se,toHandle:s.toHandle,toPosition:ue&&s.toHandle?s.toHandle.position:Mm[pe.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:se};y(p),he=p}function ve(e){if(!(`touches`in e&&e.touches.length>0)){if(ae){(te||de)&&le&&ue&&h?.(le);let{inProgress:t,...n}=he,r={...n,toPosition:he.toHandle?he.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(T),ce=!1,ue=!1,le=null,de=null,ee.removeEventListener(`mousemove`,_e),ee.removeEventListener(`mouseup`,ve),ee.removeEventListener(`touchmove`,_e),ee.removeEventListener(`touchend`,ve)}}ee.addEventListener(`mousemove`,_e),ee.addEventListener(`mouseup`,ve),ee.addEventListener(`touchmove`,_e),ee.addEventListener(`touchend`,ve)}function Pg(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Mg,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=kh(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Ag(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Tm.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=kg(t,e,a,u,n,!0)}return _}var Fg={onPointerDown:Ng,isValid:Pg};function Ig({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Hu(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&mh()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=bm().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:Wu}}var Lg=e=>({x:e.x,y:e.y,zoom:e.k}),Rg=({x:e,y:t,zoom:n})=>um.translate(e,t).scale(n),zg=(e,t)=>e.target.closest(`.${t}`),Bg=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vg=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hg=(e,t=0,n=Vg,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Ug=e=>{let t=e.ctrlKey&&mh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Wg({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(zg(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=Wu(u),t=d*2**Ug(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Em.Vertical?0:u.deltaX*f,m=i===Em.Horizontal?0:u.deltaY*f;!mh()&&u.shiftKey&&i!==Em.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Lg(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function Gg({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=zg(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Kg({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Lg(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function qg({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Bg(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Lg(a.transform))}}function Jg({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Bg(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Lg(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Yg({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(zg(f,`${u}-flow__node`)||zg(f,`${u}-flow__edge`)||zg(f,`${u}-flow__selection`)||zg(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||zg(f,c)&&h||zg(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function Xg({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=bm().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=Hu(e).call(f);y({x:i.x,y:i.y,zoom:Gm(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(Ug);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?sf:xf).transform(Hg(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:ee,connectionInProgress:T,paneClickDistance:te,selectionOnDrag:E}){r&&!l.isZoomingOrPanning&&v();let ne=i&&!C&&!r;f.clickDistance(E?1/0:!ah(te)||te<0?0:te);let re=ne?Wg({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Gg({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,re,{passive:!1});let ie=Kg({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,ie);let ae=qg({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:ee});f.on(`zoom`,ae);let oe=Jg({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,oe);let se=Yg({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:T});f.filter(se),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=Rg(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=Rg(e);return await g(n,t),n}function x(e){if(p){let t=Rg(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?dm(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?sf:xf).scaleTo(Hg(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?sf:xf).scaleBy(Hg(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function ee(e){f?.scaleExtent(e)}function T(e){f?.translateExtent(e)}function te(e){let t=!ah(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:ee,setTranslateExtent:T,syncViewport:x,setClickDistance:te}}var Zg;(function(e){e.Line=`line`,e.Handle=`handle`})(Zg||={});var Qg=oh(`Svelte Flow`,`https://svelteflow.dev/`);function $g(e,t,n={}){return Bh(e,t,{...n,onError:n.onError??Qg})}function e_(){let e={};return[t=>{if(t&&!ot(e))throw Error(t);return it(e)},t=>at(e,t)]}var[t_,n_]=e_(),[r_,i_]=e_(),[a_,o_]=e_(),s_=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`type`,`position`,`style`,`class`,`isConnectable`,`isConnectableStart`,`isConnectableEnd`,`isValidConnection`,`onconnect`,`ondisconnect`,`children`]),c_=H(`<div><!></div>`);function l_(e,t){k(t,!0);let n=Y(t,`id`,3,null),r=Y(t,`type`,3,`source`),i=Y(t,`position`,19,()=>jm.Top),a=Y(t,`isConnectableStart`,3,!0),o=Y(t,`isConnectableEnd`,3,!0),s=J(t,s_),c=t_(`Handle must be used within a Custom Node component`),l=r_(`Handle must be used within a Custom Node component`),u=j(()=>r()===`target`),d=j(()=>t.isConnectable===void 0?l.value:t.isConnectable),p=Q_(),m=j(()=>p.ariaLabelConfig),h=null;Rn(()=>{if(t.onconnect||t.ondisconnect){p.edges;let e=p.connectionLookup.get(`${c}-${r()}${n()?`-${n()}`:``}`);if(h&&!bh(e,h)){let n=e??new Map;xh(h,n,t.ondisconnect),xh(n,h,t.onconnect)}h=new Map(e)}});let g=j(()=>{if(!p.connection.inProgress)return[!1,!1,!1,!1,null];let{fromHandle:e,toHandle:t,isValid:i}=p.connection,a=e&&e.nodeId===c&&e.type===r()&&e.id===n(),o=t&&t.nodeId===c&&t.type===r()&&t.id===n();return[!0,a,o,p.connectionMode===Tm.Strict?e?.type!==r():c!==e?.nodeId||n()!==e?.id,o&&i]}),_=j(()=>v(z(g),5)),y=j(()=>z(_)[0]),b=j(()=>z(_)[1]),x=j(()=>z(_)[2]),S=j(()=>z(_)[3]),C=j(()=>z(_)[4]);function w(e){let t=p.onbeforeconnect?p.onbeforeconnect(e):e;t&&(p.addEdge(t),p.onconnect?.(e))}function ee(e){let r=Oh(e);e.currentTarget&&(r&&e.button===0||!r)&&Fg.onPointerDown(e,{handleId:n(),nodeId:c,isTarget:z(u),connectionRadius:p.connectionRadius,domNode:p.domNode,nodeLookup:p.nodeLookup,connectionMode:p.connectionMode,lib:`svelte`,autoPanOnConnect:p.autoPanOnConnect,autoPanSpeed:p.autoPanSpeed,flowId:p.flowId,isValidConnection:t.isValidConnection||((...e)=>p.isValidConnection?.(...e)??!0),updateConnection:p.updateConnection,cancelConnection:p.cancelConnection,panBy:p.panBy,onConnect:w,onConnectStart:p.onconnectstart,onConnectEnd:(...e)=>p.onconnectend?.(...e),getTransform:()=>[p.viewport.x,p.viewport.y,p.viewport.zoom],getFromHandle:()=>p.connection.fromHandle,dragThreshold:p.connectionDragThreshold,handleDomNode:e.currentTarget})}function T(e){if(!c||!p.clickConnectStartHandle&&!a())return;if(!p.clickConnectStartHandle){p.onclickconnectstart?.(e,{nodeId:c,handleId:n(),handleType:r()}),p.clickConnectStartHandle={nodeId:c,type:r(),id:n()};return}let i=Th(e.target),o=t.isValidConnection??p.isValidConnection,{connectionMode:s,clickConnectStartHandle:l,flowId:u,nodeLookup:d}=p,{connection:f,isValid:m}=Fg.isValid(e,{handle:{nodeId:c,id:n(),type:r()},connectionMode:s,fromNodeId:l.nodeId,fromHandleId:l.id??null,fromType:l.type,isValidConnection:o,flowId:u,doc:i,lib:`svelte`,nodeLookup:d});m&&f&&w(f);let h=structuredClone(Qe(p.connection));delete h.inProgress,h.toPosition=h.toHandle?h.toHandle.position:null,p.onclickconnectend?.(e,h),p.clickConnectStartHandle=null}var te=c_(),E=()=>{};va(te,()=>({"data-handleid":n(),"data-nodeid":c,"data-handlepos":i(),"data-id":`${p.flowId??``}-${c??``}-${n()??`null`??``}-${r()??``}`,class:[`svelte-flow__handle`,`svelte-flow__handle-${i()}`,p.noDragClass,p.noPanClass,i(),t.class],onmousedown:ee,ontouchstart:ee,onclick:p.clickConnect?T:void 0,onkeypress:E,style:t.style,role:`button`,"aria-label":z(m)[`handle.ariaLabel`],tabindex:`-1`,...s,[aa]:{valid:z(C),connectingto:z(x),connectingfrom:z(b),source:!z(u),target:z(u),connectablestart:a(),connectableend:o(),connectable:z(d),connectionindicator:z(d)&&(!z(y)||z(S))&&(z(y)||p.clickConnectStartHandle?o():a())}})),Fi(P(te),()=>t.children??f),O(te),U(e,te),A()}var u_=H(`<!> <!>`,1);function d_(e,t){k(t,!0);let n=Y(t,`targetPosition`,19,()=>jm.Top),r=Y(t,`sourcePosition`,19,()=>jm.Bottom);var i=u_(),a=F(i);l_(a,{type:`target`,get position(){return n()}});var o=L(a);l_(L(o),{type:`source`,get position(){return r()}}),R(()=>W(o,` ${t.data?.label??``} `)),U(e,i),A()}var f_=H(` <!>`,1);function p_(e,t){k(t,!0);let n=Y(t,`data`,19,()=>({label:`Node`})),r=Y(t,`sourcePosition`,19,()=>jm.Bottom);je();var i=f_(),a=F(i);l_(L(a),{type:`source`,get position(){return r()}}),R(()=>W(a,`${n()?.label??``} `)),U(e,i),A()}var m_=H(` <!>`,1);function h_(e,t){k(t,!0);let n=Y(t,`data`,19,()=>({label:`Node`})),r=Y(t,`targetPosition`,19,()=>jm.Top);je();var i=m_(),a=F(i);l_(L(a),{type:`target`,get position(){return r()}}),R(()=>W(a,`${n()?.label??``} `)),U(e,i),A()}function g_(e,t){}function __(e,t,n){if(!n||!t)return;let r=n===`root`?t:t.querySelector(`.svelte-flow__${n}`);r&&r.appendChild(e)}function v_(e,t){let n=j(Q_),r=j(()=>z(n).domNode),i;return z(r)?__(e,z(r),t):i=zn(()=>{In(()=>{__(e,z(r),t),i?.()})}),{async update(t){__(e,z(r),t)},destroy(){e.parentNode&&e.parentNode.removeChild(e),i?.()}}}function y_(){let e=M(typeof window>`u`);if(z(e)){let t=zn(()=>{In(()=>{N(e,!1),t?.()})})}return{get value(){return z(e)}}}var b_=e=>Pm(e),x_=e=>Nm(e);function S_(e){return e===void 0?void 0:`${e}px`}var C_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},w_=new Set([`$$slots`,`$$events`,`$$legacy`,`x`,`y`,`width`,`height`,`selectEdgeOnClick`,`transparent`,`class`,`children`]),T_=H(`<div><!></div>`);function E_(e,t){k(t,!0);let n=Y(t,`x`,3,0),r=Y(t,`y`,3,0),i=Y(t,`selectEdgeOnClick`,3,!1),a=Y(t,`transparent`,3,!1),o=J(t,w_),s=Q_(),c=a_(`EdgeLabel must be used within a Custom Edge component`),l=j(()=>s.visible.edges.get(c)?.zIndex);var u=T_(),d=()=>{i()&&c&&s.handleEdgeSelection(c)};va(u,(e,s,c)=>({class:[`svelte-flow__edge-label`,{transparent:a()},t.class],tabindex:`-1`,onclick:d,...o,[oa]:{display:e,cursor:i()?`pointer`:void 0,transform:`translate(-50%, -50%) translate(${n()??``}px,${r()??``}px)`,"pointer-events":`all`,width:s,height:c,"z-index":z(l)}}),[()=>y_().value?`none`:void 0,()=>S_(t.width),()=>S_(t.height)],void 0,void 0,`svelte-1wg91mu`),Fi(P(u),()=>t.children??f),O(u),Ri(u,(e,t)=>v_?.(e,t),()=>`edge-labels`),U(e,u),A()}var D_=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`path`,`label`,`labelX`,`labelY`,`labelStyle`,`markerStart`,`markerEnd`,`style`,`interactionWidth`,`class`]),O_=oi(`<path></path>`),k_=oi(`<path fill="none"></path><!><!>`,1);function A_(e,t){let n=Y(t,`interactionWidth`,3,20),r=J(t,D_);var i=k_(),a=F(i),o=L(a),s=e=>{var i=O_();va(i,()=>({d:t.path,"stroke-opacity":0,"stroke-width":n(),fill:`none`,class:`svelte-flow__edge-interaction`,...r})),U(e,i)};G(o,e=>{n()>0&&e(s)});var c=L(o),l=e=>{E_(e,{get x(){return t.labelX},get y(){return t.labelY},get style(){return t.labelStyle},selectEdgeOnClick:!0,children:(e,n)=>{je();var r=si();R(()=>W(r,t.label)),U(e,r)},$$slots:{default:!0}})};G(c,e=>{t.label&&e(l)}),R(()=>{q(a,`id`,t.id),q(a,`d`,t.path),Ji(a,0,Hi([`svelte-flow__edge-path`,t.class])),q(a,`marker-start`,t.markerStart),q(a,`marker-end`,t.markerEnd),Xi(a,t.style)}),U(e,i)}function j_(e,t){k(t,!0);let n=j(()=>Ph({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,curvature:t.pathOptions?.curvature})),r=j(()=>v(z(n),3)),i=j(()=>z(r)[0]),a=j(()=>z(r)[1]),o=j(()=>z(r)[2]);A_(e,{get id(){return t.id},get path(){return z(i)},get labelX(){return z(a)},get labelY(){return z(o)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),A()}function M_(e,t){k(t,!0);let n=j(()=>qh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition})),r=j(()=>v(z(n),3)),i=j(()=>z(r)[0]),a=j(()=>z(r)[1]),o=j(()=>z(r)[2]);A_(e,{get path(){return z(i)},get labelX(){return z(a)},get labelY(){return z(o)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),A()}function N_(e,t){k(t,!0);let n=j(()=>Vh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY})),r=j(()=>v(z(n),3)),i=j(()=>z(r)[0]),a=j(()=>z(r)[1]),o=j(()=>z(r)[2]);A_(e,{get path(){return z(i)},get labelX(){return z(a)},get labelY(){return z(o)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),A()}function P_(e,t){k(t,!0);let n=j(()=>qh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,borderRadius:0})),r=j(()=>v(z(n),3)),i=j(()=>z(r)[0]),a=j(()=>z(r)[1]),o=j(()=>z(r)[2]);A_(e,{get path(){return z(i)},get labelX(){return z(a)},get labelY(){return z(o)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),A()}var F_=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],I_=[`difference`,`intersection`,`symmetricDifference`,`union`],L_=!1,R_=class e extends Set{#e=new Map;#t=M(0);#n=M(0);#r=br||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}L_||this.#a()}#i(e){return br===this.#r?M(e):an(e)}#a(){L_=!0;var t=e.prototype,n=Set.prototype;for(let e of F_)t[e]=function(...t){return z(this.#t),n[e].apply(this,t)};for(let r of I_)t[r]=function(...t){z(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return z(this.#t),!1;r=this.#i(!0),n.set(e,r)}return z(r),t}add(e){return super.has(e)||(super.add(e),N(this.#n,super.size),dn(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),N(r,!1)),t&&(N(this.#n,super.size),dn(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())N(t,!1);e.clear(),N(this.#n,0),dn(this.#t)}}keys(){return this.values()}values(){return z(this.#t),super.values()}entries(){return z(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return z(this.#n)}},z_=class extends Map{#e=new Map;#t=M(0);#n=M(0);#r=br||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return br===this.#r?M(e):an(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else return z(this.#t),!1}return z(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else{z(this.#t);return}}return z(n),super.get(e)}getOrInsert(e,t){return super.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return super.has(e)||this.set(e,t(e)),this.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),N(this.#n,super.size),dn(o);else if(i!==t){dn(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&dn(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),N(n,-1)),r&&(N(this.#n,super.size),dn(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;N(this.#n,0);for(var t of e.values())N(t,-1);dn(this.#t),e.clear()}}#a(){z(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)z(n)}keys(){return z(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return z(this.#n),super.size}},B_=class{#e;#t;constructor(e,t){this.#e=e,this.#t=ui(t)}get current(){return this.#t(),this.#e()}},V_=/\(.+\)/,H_=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),U_=class extends B_{constructor(e,t){let n=V_.test(e)||e.split(/[\s,]+/).some(e=>H_.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>Xr(r,`change`,e))}};function W_(e,t,n,r){let i=new Map;return zm(e,{x:0,y:0,width:n,height:r},t,!0).forEach(e=>{i.set(e.id,e)}),i}function G_(e){let{edges:t,defaultEdgeOptions:n,nodeLookup:r,previousEdges:i,connectionMode:a,onerror:o,onlyRenderVisible:s,elevateEdgesOnSelect:c,zIndexMode:l}=e,u=new Map;for(let d of t){let t=r.get(d.source),f=r.get(d.target);if(!t||!f||t.hidden||f.hidden)continue;if(s){let{visibleNodes:n,transform:r,width:i,height:a}=e;if(Lh({sourceNode:t,targetNode:f,width:i,height:a,transform:r}))n.set(t.id,t),n.set(f.id,f);else continue}let p=i.get(d.id);if(p&&d===p.edge&&t==p.sourceNode&&f==p.targetNode){u.set(d.id,p);continue}let m=Yh({id:d.id,sourceNode:t,targetNode:f,sourceHandle:d.sourceHandle||null,targetHandle:d.targetHandle||null,connectionMode:a,onError:o});m&&u.set(d.id,{...n,...d,...m,zIndex:Ih({selected:d.selected,zIndex:d.zIndex??n.zIndex,sourceNode:t,targetNode:f,elevateOnSelect:c,zIndexMode:l}),sourceNode:t,targetNode:f,edge:d})}return u}var K_=oh(`Svelte Flow`,`https://svelteflow.dev/`),q_={input:p_,output:h_,default:d_,group:g_},J_={straight:N_,smoothstep:M_,default:j_,step:P_};function Y_(e,t,n,r,i,a){return t&&!n&&r&&i?ph(Rm(a,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),r,i,.5,2,.1):n??{x:0,y:0,zoom:1}}function X_(e){class t{#e=j(()=>e.props.id??`1`);get flowId(){return z(this.#e)}set flowId(e){N(this.#e,e)}#t=M(null);get domNode(){return z(this.#t)}set domNode(e){N(this.#t,e)}#n=M(null);get panZoom(){return z(this.#n)}set panZoom(e){N(this.#n,e)}#r=M(e.width??0);get width(){return z(this.#r)}set width(e){N(this.#r,e)}#i=M(e.height??0);get height(){return z(this.#i)}set height(e){N(this.#i,e)}#a=M(e.props.zIndexMode??`basic`);get zIndexMode(){return z(this.#a)}set zIndexMode(e){N(this.#a,e)}#o=j(()=>{let{nodesInitialized:t}=ug(e.nodes,this.nodeLookup,this.parentLookup,{nodeExtent:this.nodeExtent,nodeOrigin:this.nodeOrigin,elevateNodesOnSelect:e.props.elevateNodesOnSelect??!0,checkEquality:!0,zIndexMode:this.zIndexMode});return this.fitViewQueued&&t&&(this.fitViewOptions?.duration?this.resolveFitView():queueMicrotask(()=>{this.resolveFitView()})),t});get nodesInitialized(){return z(this.#o)}set nodesInitialized(e){N(this.#o,e)}#s=j(()=>this.panZoom!==null);get viewportInitialized(){return z(this.#s)}set viewportInitialized(e){N(this.#s,e)}#c=j(()=>(yg(this.connectionLookup,this.edgeLookup,e.edges),e.edges));get _edges(){return z(this.#c)}set _edges(e){N(this.#c,e)}get nodes(){return this.nodesInitialized,e.nodes}set nodes(t){e.nodes=t}get edges(){return this._edges}set edges(t){e.edges=t}_prevSelectedNodes=[];_prevSelectedNodeIds=new Set;#l=j(()=>{let e=this._prevSelectedNodeIds.size,t=new Set,n=this.nodes.filter(e=>(e.selected&&(t.add(e.id),this._prevSelectedNodeIds.delete(e.id)),e.selected));return(e!==t.size||this._prevSelectedNodeIds.size>0)&&(this._prevSelectedNodes=n),this._prevSelectedNodeIds=t,this._prevSelectedNodes});get selectedNodes(){return z(this.#l)}set selectedNodes(e){N(this.#l,e)}_prevSelectedEdges=[];_prevSelectedEdgeIds=new Set;#u=j(()=>{let e=this._prevSelectedEdgeIds.size,t=new Set,n=this.edges.filter(e=>(e.selected&&(t.add(e.id),this._prevSelectedEdgeIds.delete(e.id)),e.selected));return(e!==t.size||this._prevSelectedEdgeIds.size>0)&&(this._prevSelectedEdges=n),this._prevSelectedEdgeIds=t,this._prevSelectedEdges});get selectedEdges(){return z(this.#u)}set selectedEdges(e){N(this.#u,e)}selectionChangeHandlers=new Map;nodeLookup=new Map;parentLookup=new Map;connectionLookup=new Map;edgeLookup=new Map;_prevVisibleEdges=new Map;#d=j(()=>{let{nodes:t,_edges:n,_prevVisibleEdges:r,nodeLookup:i,connectionMode:a,onerror:o,onlyRenderVisibleElements:s,defaultEdgeOptions:c,zIndexMode:l}=this,u,d,f={edges:n,defaultEdgeOptions:c,previousEdges:r,nodeLookup:i,connectionMode:a,elevateEdgesOnSelect:e.props.elevateEdgesOnSelect??!0,zIndexMode:l,onerror:o};if(s){let{viewport:e,width:t,height:n}=this,r=[e.x,e.y,e.zoom];u=W_(i,r,t,n),d=G_({...f,onlyRenderVisible:!0,visibleNodes:u,transform:r,width:t,height:n})}else u=this.nodeLookup,d=G_(f);return this._prevVisibleEdges=d,{nodes:u,edges:d}});get visible(){return z(this.#d)}set visible(e){N(this.#d,e)}#f=j(()=>e.props.nodesDraggable??!0);get nodesDraggable(){return z(this.#f)}set nodesDraggable(e){N(this.#f,e)}#p=j(()=>e.props.nodesConnectable??!0);get nodesConnectable(){return z(this.#p)}set nodesConnectable(e){N(this.#p,e)}#m=j(()=>e.props.elementsSelectable??!0);get elementsSelectable(){return z(this.#m)}set elementsSelectable(e){N(this.#m,e)}#h=j(()=>e.props.nodesFocusable??!0);get nodesFocusable(){return z(this.#h)}set nodesFocusable(e){N(this.#h,e)}#g=j(()=>e.props.edgesFocusable??!0);get edgesFocusable(){return z(this.#g)}set edgesFocusable(e){N(this.#g,e)}#_=j(()=>e.props.disableKeyboardA11y??!1);get disableKeyboardA11y(){return z(this.#_)}set disableKeyboardA11y(e){N(this.#_,e)}#v=j(()=>e.props.minZoom??.5);get minZoom(){return z(this.#v)}set minZoom(e){N(this.#v,e)}#y=j(()=>e.props.maxZoom??2);get maxZoom(){return z(this.#y)}set maxZoom(e){N(this.#y,e)}#b=j(()=>e.props.nodeOrigin??[0,0]);get nodeOrigin(){return z(this.#b)}set nodeOrigin(e){N(this.#b,e)}#x=j(()=>e.props.nodeExtent??Sm);get nodeExtent(){return z(this.#x)}set nodeExtent(e){N(this.#x,e)}#S=j(()=>e.props.translateExtent??Sm);get translateExtent(){return z(this.#S)}set translateExtent(e){N(this.#S,e)}#C=j(()=>e.props.defaultEdgeOptions??{});get defaultEdgeOptions(){return z(this.#C)}set defaultEdgeOptions(e){N(this.#C,e)}#w=j(()=>e.props.nodeDragThreshold??1);get nodeDragThreshold(){return z(this.#w)}set nodeDragThreshold(e){N(this.#w,e)}#T=j(()=>e.props.autoPanOnNodeDrag??!0);get autoPanOnNodeDrag(){return z(this.#T)}set autoPanOnNodeDrag(e){N(this.#T,e)}#E=j(()=>e.props.autoPanOnConnect??!0);get autoPanOnConnect(){return z(this.#E)}set autoPanOnConnect(e){N(this.#E,e)}#D=j(()=>e.props.autoPanOnNodeFocus??!0);get autoPanOnNodeFocus(){return z(this.#D)}set autoPanOnNodeFocus(e){N(this.#D,e)}#O=j(()=>e.props.autoPanSpeed??15);get autoPanSpeed(){return z(this.#O)}set autoPanSpeed(e){N(this.#O,e)}#k=j(()=>e.props.connectionDragThreshold??1);get connectionDragThreshold(){return z(this.#k)}set connectionDragThreshold(e){N(this.#k,e)}fitViewQueued=e.props.fitView??!1;fitViewOptions=e.props.fitViewOptions;fitViewResolver=null;#A=j(()=>e.props.snapGrid??null);get snapGrid(){return z(this.#A)}set snapGrid(e){N(this.#A,e)}#j=M(!1);get dragging(){return z(this.#j)}set dragging(e){N(this.#j,e)}#M=M(null);get selectionRect(){return z(this.#M)}set selectionRect(e){N(this.#M,e)}#N=M(!1);get selectionKeyPressed(){return z(this.#N)}set selectionKeyPressed(e){N(this.#N,e)}#P=M(!1);get multiselectionKeyPressed(){return z(this.#P)}set multiselectionKeyPressed(e){N(this.#P,e)}#F=M(!1);get deleteKeyPressed(){return z(this.#F)}set deleteKeyPressed(e){N(this.#F,e)}#I=M(!1);get panActivationKeyPressed(){return z(this.#I)}set panActivationKeyPressed(e){N(this.#I,e)}#L=M(!1);get zoomActivationKeyPressed(){return z(this.#L)}set zoomActivationKeyPressed(e){N(this.#L,e)}#R=M(null);get selectionRectMode(){return z(this.#R)}set selectionRectMode(e){N(this.#R,e)}#z=M(``);get ariaLiveMessage(){return z(this.#z)}set ariaLiveMessage(e){N(this.#z,e)}#B=j(()=>e.props.selectionMode??Dm.Partial);get selectionMode(){return z(this.#B)}set selectionMode(e){N(this.#B,e)}#V=j(()=>({...q_,...e.props.nodeTypes}));get nodeTypes(){return z(this.#V)}set nodeTypes(e){N(this.#V,e)}#H=j(()=>({...J_,...e.props.edgeTypes}));get edgeTypes(){return z(this.#H)}set edgeTypes(e){N(this.#H,e)}#U=j(()=>e.props.noPanClass??`nopan`);get noPanClass(){return z(this.#U)}set noPanClass(e){N(this.#U,e)}#W=j(()=>e.props.noDragClass??`nodrag`);get noDragClass(){return z(this.#W)}set noDragClass(e){N(this.#W,e)}#G=j(()=>e.props.noWheelClass??`nowheel`);get noWheelClass(){return z(this.#G)}set noWheelClass(e){N(this.#G,e)}#K=j(()=>yh(e.props.ariaLabelConfig));get ariaLabelConfig(){return z(this.#K)}set ariaLabelConfig(e){N(this.#K,e)}#q=M(Y_(this.nodesInitialized,e.props.fitView,e.props.initialViewport,this.width,this.height,this.nodeLookup));get _viewport(){return z(this.#q)}set _viewport(e){N(this.#q,e)}get viewport(){return e.viewport??this._viewport}set viewport(t){e.viewport&&=t,this._viewport=t}#J=M(Om);get _connection(){return z(this.#J)}set _connection(e){N(this.#J,e)}#Y=j(()=>this._connection.inProgress?{...this._connection,to:ch(this._connection.to,[this.viewport.x,this.viewport.y,this.viewport.zoom])}:this._connection);get connection(){return z(this.#Y)}set connection(e){N(this.#Y,e)}#X=j(()=>e.props.connectionMode??Tm.Strict);get connectionMode(){return z(this.#X)}set connectionMode(e){N(this.#X,e)}#Z=j(()=>e.props.connectionRadius??20);get connectionRadius(){return z(this.#Z)}set connectionRadius(e){N(this.#Z,e)}#Q=j(()=>e.props.isValidConnection??(()=>!0));get isValidConnection(){return z(this.#Q)}set isValidConnection(e){N(this.#Q,e)}#$=j(()=>e.props.selectNodesOnDrag??!0);get selectNodesOnDrag(){return z(this.#$)}set selectNodesOnDrag(e){N(this.#$,e)}#ee=j(()=>e.props.defaultMarkerColor===void 0?`#b1b1b7`:e.props.defaultMarkerColor);get defaultMarkerColor(){return z(this.#ee)}set defaultMarkerColor(e){N(this.#ee,e)}#te=j(()=>eg(e.edges,{defaultColor:this.defaultMarkerColor,id:this.flowId,defaultMarkerStart:this.defaultEdgeOptions.markerStart,defaultMarkerEnd:this.defaultEdgeOptions.markerEnd}));get markers(){return z(this.#te)}set markers(e){N(this.#te,e)}#ne=j(()=>e.props.onlyRenderVisibleElements??!1);get onlyRenderVisibleElements(){return z(this.#ne)}set onlyRenderVisibleElements(e){N(this.#ne,e)}#re=j(()=>e.props.onflowerror??K_);get onerror(){return z(this.#re)}set onerror(e){N(this.#re,e)}#ie=j(()=>e.props.ondelete);get ondelete(){return z(this.#ie)}set ondelete(e){N(this.#ie,e)}#ae=j(()=>e.props.onbeforedelete);get onbeforedelete(){return z(this.#ae)}set onbeforedelete(e){N(this.#ae,e)}#oe=j(()=>e.props.onbeforeconnect);get onbeforeconnect(){return z(this.#oe)}set onbeforeconnect(e){N(this.#oe,e)}#se=j(()=>e.props.onconnect);get onconnect(){return z(this.#se)}set onconnect(e){N(this.#se,e)}#ce=j(()=>e.props.onconnectstart);get onconnectstart(){return z(this.#ce)}set onconnectstart(e){N(this.#ce,e)}#le=j(()=>e.props.onconnectend);get onconnectend(){return z(this.#le)}set onconnectend(e){N(this.#le,e)}#ue=j(()=>e.props.onbeforereconnect);get onbeforereconnect(){return z(this.#ue)}set onbeforereconnect(e){N(this.#ue,e)}#de=j(()=>e.props.onreconnect);get onreconnect(){return z(this.#de)}set onreconnect(e){N(this.#de,e)}#fe=j(()=>e.props.onreconnectstart);get onreconnectstart(){return z(this.#fe)}set onreconnectstart(e){N(this.#fe,e)}#pe=j(()=>e.props.onreconnectend);get onreconnectend(){return z(this.#pe)}set onreconnectend(e){N(this.#pe,e)}#me=j(()=>e.props.clickConnect??!0);get clickConnect(){return z(this.#me)}set clickConnect(e){N(this.#me,e)}#he=j(()=>e.props.onclickconnectstart);get onclickconnectstart(){return z(this.#he)}set onclickconnectstart(e){N(this.#he,e)}#ge=j(()=>e.props.onclickconnectend);get onclickconnectend(){return z(this.#ge)}set onclickconnectend(e){N(this.#ge,e)}#_e=M(null);get clickConnectStartHandle(){return z(this.#_e)}set clickConnectStartHandle(e){N(this.#_e,e)}#ve=j(()=>e.props.onselectiondrag);get onselectiondrag(){return z(this.#ve)}set onselectiondrag(e){N(this.#ve,e)}#ye=j(()=>e.props.onselectiondragstart);get onselectiondragstart(){return z(this.#ye)}set onselectiondragstart(e){N(this.#ye,e)}#be=j(()=>e.props.onselectiondragstop);get onselectiondragstop(){return z(this.#be)}set onselectiondragstop(e){N(this.#be,e)}resolveFitView=async()=>{this.panZoom&&(await Hm({nodes:this.nodeLookup,width:this.width,height:this.height,panZoom:this.panZoom,minZoom:this.minZoom,maxZoom:this.maxZoom},this.fitViewOptions),this.fitViewResolver?.resolve(!0),this.fitViewQueued=!1,this.fitViewOptions=void 0,this.fitViewResolver=null)};_prefersDark=new U_(`(prefers-color-scheme: dark)`,e.props.colorModeSSR===`dark`);#xe=j(()=>e.props.colorMode===`system`?this._prefersDark.current?`dark`:`light`:e.props.colorMode??`light`);get colorMode(){return z(this.#xe)}set colorMode(e){N(this.#xe,e)}constructor(){}resetStoreValues(){this.dragging=!1,this.selectionRect=null,this.selectionRectMode=null,this.selectionKeyPressed=!1,this.multiselectionKeyPressed=!1,this.deleteKeyPressed=!1,this.panActivationKeyPressed=!1,this.zoomActivationKeyPressed=!1,this._connection=Om,this.clickConnectStartHandle=null,this.viewport=e.props.initialViewport??{x:0,y:0,zoom:1},this.ariaLiveMessage=``}}return new t}var Z_=xm.error001(`svelte`);function Q_(){let e=it($_);if(!e)throw Error(Z_);return e.getStore()}var $_=Symbol();function ev(e){let t=X_(e);function n(e){t.nodeTypes={...q_,...e}}function r(e){t.edgeTypes={...J_,...e}}function i(e){t.edges=$g(e,t.edges,{onError:t.onerror})}let a=(e,n=!1)=>{t.nodes=t.nodes.map(r=>{if(t.connection.inProgress&&t.connection.fromNode.id===r.id){let e=t.nodeLookup.get(r.id);e&&(t.connection={...t.connection,from:Zh(e,t.connection.fromHandle,jm.Left,!0)})}let i=e.get(r.id);return i?{...r,position:i.position,dragging:n}:r})};function o(e){let{changes:n,updatedInternals:r}=gg(e,t.nodeLookup,t.parentLookup,t.domNode,t.nodeOrigin,t.nodeExtent,t.zIndexMode);if(!r)return;sg(t.nodeLookup,t.parentLookup,{nodeOrigin:t.nodeOrigin,nodeExtent:t.nodeExtent,zIndexMode:t.zIndexMode}),t.fitViewQueued&&t.resolveFitView();let i=new Map;for(let e of n){let n=t.nodeLookup.get(e.id)?.internals.userNode;if(!n)continue;let r={...n};switch(e.type){case`dimensions`:{let t={...r.measured,...e.dimensions};e.setAttributes&&(r.width=e.dimensions?.width??r.width,r.height=e.dimensions?.height??r.height),r.measured=t;break}case`position`:r.position=e.position??r.position}i.set(e.id,r)}t.nodes=t.nodes.map(e=>i.get(e.id)??e)}function s(e){let n=t.fitViewResolver??Promise.withResolvers();return t.fitViewQueued=!0,t.fitViewOptions=e,t.fitViewResolver=n,t.nodes=[...t.nodes],n.promise}async function c(e,n,r){let i=r?.zoom===void 0?t.maxZoom:r.zoom,a=t.panZoom;return a?(await a.setViewport({x:t.width/2-e*i,y:t.height/2-n*i,zoom:i},{duration:r?.duration,ease:r?.ease,interpolate:r?.interpolate}),!0):!1}async function l(e,n){let r=t.panZoom;return r?r.scaleBy(e,n):!1}async function u(e){return l(1.2,e)}function d(e){return l(1/1.2,e)}function f(e){let n=t.panZoom;n&&(n.setScaleExtent([e,t.maxZoom]),t.minZoom=e)}function p(e){let n=t.panZoom;n&&(n.setScaleExtent([t.minZoom,e]),t.maxZoom=e)}function m(e){let n=t.panZoom;n&&(n.setTranslateExtent(e),t.translateExtent=e)}function h(e,t=null){let n=!1,r=e.map(e=>(!t||t.has(e.id))&&e.selected?(n=!0,{...e,selected:!1}):e);return[n,r]}function g(e){let n=e?.nodes?new Set(e.nodes.map(e=>e.id)):null,[r,i]=h(t.nodes,n);r&&(t.nodes=i);let a=e?.edges?new Set(e.edges.map(e=>e.id)):null,[o,s]=h(t.edges,a);o&&(t.edges=s)}function _(e){let n=t.multiselectionKeyPressed;t.nodes=t.nodes.map(t=>{let r=e.includes(t.id),i=n&&t.selected||r;return!!t.selected===i?t:{...t,selected:i}}),n||g({nodes:[]})}function v(e){let n=t.multiselectionKeyPressed;t.edges=t.edges.map(t=>{let r=e.includes(t.id),i=n&&t.selected||r;return!!t.selected===i?t:{...t,selected:i}}),n||g({edges:[]})}function y(e,n,r){let i=t.nodeLookup.get(e);i?(t.selectionRect=null,t.selectionRectMode=null,i.selected?(n||i.selected&&t.multiselectionKeyPressed)&&(g({nodes:[i.internals.userNode],edges:[]}),requestAnimationFrame(()=>r?.blur())):_([e])):t.onerror(`012`,xm.error012(e))}function b(e){let n=t.edgeLookup.get(e);n?(n.selectable||t.elementsSelectable&&n.selectable===void 0)&&(t.selectionRect=null,t.selectionRectMode=null,n.selected?n.selected&&t.multiselectionKeyPressed&&g({nodes:[],edges:[n]}):v([e])):t.onerror(`016`,xm.error016(e))}function x(e,n){let{nodeExtent:r,snapGrid:i,nodeOrigin:o,nodeLookup:s,nodesDraggable:c,onerror:l}=t,u=new Map,d=i?.[0]??5,f=i?.[1]??5,p=e.x*d*n,m=e.y*f*n;for(let e of s.values()){if(!(e.selected&&(e.draggable||c&&e.draggable===void 0)))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+m};i&&(t=sh(t,i));let{position:n,positionAbsolute:a}=Um({nodeId:e.id,nextPosition:t,nodeLookup:s,nodeExtent:r,nodeOrigin:o,onError:l});e.position=n,e.internals.positionAbsolute=a,u.set(e.id,e)}a(u)}function S(e){return _g({delta:e,panZoom:t.panZoom,transform:[t.viewport.x,t.viewport.y,t.viewport.zoom],translateExtent:t.translateExtent,width:t.width,height:t.height})}let C=e=>{t._connection={...e}};function w(){t._connection=Om}function ee(){t.resetStoreValues(),g()}return Object.assign(t,{setNodeTypes:n,setEdgeTypes:r,addEdge:i,updateNodePositions:a,updateNodeInternals:o,zoomIn:u,zoomOut:d,fitView:s,setCenter:c,setMinZoom:f,setMaxZoom:p,setTranslateExtent:m,unselectNodesAndEdges:g,addSelectedNodes:_,addSelectedEdges:v,handleNodeSelection:y,handleEdgeSelection:b,moveSelectedNodes:x,panBy:S,updateConnection:C,cancelConnection:w,reset:ee})}function tv(e,t){let{minZoom:n,maxZoom:r,initialViewport:i,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s,translateExtent:c,setPanZoomInstance:l,onDraggingChange:u,onTransformChange:d}=t,f=Xg({domNode:e,minZoom:n,maxZoom:r,translateExtent:c,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:u}),p=f.getViewport();return(i.x!==p.x||i.y!==p.y||i.zoom!==p.zoom)&&d([p.x,p.y,p.zoom]),l(f),f.update(t),{update(e){f.update(e)}}}var nv=H(`<div class="svelte-flow__zoom svelte-flow__container"><!></div>`);function rv(e,t){k(t,!0);let n=Y(t,`store`,15),r=j(()=>n().panActivationKeyPressed||t.panOnDrag),i=j(()=>n().panActivationKeyPressed||t.panOnScroll),{viewport:a}=n(),o=!1;In(()=>{!o&&n().viewportInitialized&&(t.oninit?.(),o=!0)});var s=nv();Fi(P(s),()=>t.children),O(s),Ri(s,(e,t)=>tv?.(e,t),()=>({viewport:n().viewport,minZoom:n().minZoom,maxZoom:n().maxZoom,initialViewport:a,onDraggingChange:e=>{n(n().dragging=e,!0)},setPanZoomInstance:e=>{n(n().panZoom=e,!0)},onPanZoomStart:t.onmovestart,onPanZoom:t.onmove,onPanZoomEnd:t.onmoveend,zoomOnScroll:t.zoomOnScroll,zoomOnDoubleClick:t.zoomOnDoubleClick,zoomOnPinch:t.zoomOnPinch,panOnScroll:z(i),panOnDrag:z(r),panOnScrollSpeed:t.panOnScrollSpeed,panOnScrollMode:t.panOnScrollMode,panActivationKeyPressed:n().panActivationKeyPressed,zoomActivationKeyPressed:n().zoomActivationKeyPressed,preventScrolling:typeof t.preventScrolling!=`boolean`||t.preventScrolling,noPanClassName:n().noPanClass,noWheelClassName:n().noWheelClass,userSelectionActive:!!n().selectionRect,translateExtent:n().translateExtent,lib:`svelte`,paneClickDistance:t.paneClickDistance,selectionOnDrag:t.selectionOnDrag,onTransformChange:e=>{n(n().viewport={x:e[0],y:e[1],zoom:e[2]},!0)},connectionInProgress:n().connection.inProgress})),U(e,s),A()}function iv(e,t){return n=>{n.target===t&&e?.(n)}}function av(e){return t=>{let n=e.has(t.id);return!!t.selected===n?t:{...t,selected:n}}}function ov(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var sv=H(`<div><!></div>`);function cv(e,t){k(t,!0);let n=Y(t,`store`,15),r=Y(t,`panOnDrag`,3,!0),i=Y(t,`paneClickDistance`,3,1),a=Y(t,`autoPanOnSelection`,3,!0),o,s=null,c=!1,l=new Set,u=new Set,d=j(()=>n().panActivationKeyPressed||r()),f=j(()=>n().selectionKeyPressed||!!n().selectionRect||t.selectionOnDrag&&z(d)!==!0),p=j(()=>n().elementsSelectable&&(z(f)||n().selectionRectMode===`user`)),m=!1,h=0,g={x:0,y:0},_=!1;function v(e){if(e.pointerType===`touch`&&z(d)!==!1&&!n().selectionKeyPressed||(s=o?.getBoundingClientRect(),!s))return;let r=e.target===o,i=!r&&!!e.target.closest(`.nokey`),a=t.selectionOnDrag&&r||n().selectionKeyPressed;if(i||!z(f)||!a||e.button!==0||!e.isPrimary)return;e.target?.setPointerCapture?.(e.pointerId),m=!1,_=!1;let{x:c,y:l}=kh(e,s),u=ch({x:c,y:l},[n().viewport.x,n().viewport.y,n().viewport.zoom]);n(n().selectionRect={width:0,height:0,startX:u.x,startY:u.y,x:c,y:l},!0),r||(e.stopPropagation(),e.preventDefault())}function y(e,t){if(n().selectionRect?.startX===void 0||n().selectionRect.startY===void 0)return;let r={x:n().selectionRect?.startX,y:n().selectionRect?.startY},i=lh(r,[n().viewport.x,n().viewport.y,n().viewport.zoom]),a={startX:r.x,startY:r.y,x:e<i.x?e:i.x,y:t<i.y?t:i.y,width:Math.abs(e-i.x),height:Math.abs(t-i.y)},o=l,s=u;l=new Set(zm(n().nodeLookup,a,[n().viewport.x,n().viewport.y,n().viewport.zoom],n().selectionMode===Dm.Partial,!0).map(e=>e.id));let c=n().defaultEdgeOptions.selectable??!0;u=new Set;for(let e of l){let t=n().connectionLookup.get(e);if(t)for(let{edgeId:e}of t.values()){let t=n().edgeLookup.get(e);t&&(t.selectable??c)&&u.add(e)}}ov(o,l)||n(n().nodes=n().nodes.map(av(l)),!0),ov(s,u)||n(n().edges=n().edges.map(av(u)),!0),n(n().selectionRectMode=`user`,!0),n(n().selectionRect=a,!0)}function b(){if(!a()||!s)return;let[e,t]=Ym(g,s,n().autoPanSpeed);n().panBy({x:e,y:t}).then(e=>{!m||!e||y(g.x,g.y),h=requestAnimationFrame(b)})}function x(){cancelAnimationFrame(h),h=0,_=!1}Ha(()=>{typeof window<`u`&&x()});function S(e){if(!z(f)||!s||!n().selectionRect)return;let r=kh(e,s);g={x:r.x,y:r.y};let a=lh({x:n().selectionRect.startX,y:n().selectionRect.startY},[n().viewport.x,n().viewport.y,n().viewport.zoom]);if(!m){let o=n().selectionKeyPressed?0:i();if(Math.hypot(r.x-a.x,r.y-a.y)<=o)return;n().unselectNodesAndEdges(),t.onselectionstart?.(e)}m=!0,_||=(b(),!0),y(r.x,r.y)}function C(e){z(p)?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!m&&e.target===o&&te?.(e),n(n().selectionRect=null,!0),m&&n(n().selectionRectMode=l.size>0?`nodes`:null,!0),m&&t.onselectionend?.(e),x()):e.target===o&&n().connection.inProgress&&(c=!0)}function w(e){e.target?.releasePointerCapture?.(e.pointerId),x()}let ee=e=>{Array.isArray(z(d))&&z(d).includes(2)?e.preventDefault():t.onpanecontextmenu?.({event:e})},T=e=>{m&&=(e.stopPropagation(),!1)};function te(e){m||n().connection.inProgress||c?(m=!1,c=!1):(t.onpaneclick?.({event:e}),n().unselectNodesAndEdges(),n(n().selectionRectMode=null,!0),n(n().selectionRect=null,!0))}var E=sv();let ne;var re=j(()=>z(p)?void 0:iv(te,o)),ie=j(()=>iv(ee,o));Fi(P(E),()=>t.children),O(E),Ma(E,e=>o=e,()=>o),R(e=>ne=Ji(E,1,`svelte-flow__pane svelte-flow__container`,null,ne,{draggable:e,dragging:n().dragging,selection:z(f)}),[()=>r()===!0||Array.isArray(r())&&r().includes(0)]),V(`click`,E,function(...e){z(re)?.apply(this,e)}),B(`pointerdown`,E,function(...e){(z(p)?v:void 0)?.apply(this,e)},!0),V(`pointermove`,E,function(...e){(z(p)?S:void 0)?.apply(this,e)}),V(`pointerup`,E,C),B(`pointercancel`,E,function(...e){(z(p)?w:void 0)?.apply(this,e)}),V(`contextmenu`,E,function(...e){z(ie)?.apply(this,e)}),B(`click`,E,function(...e){(z(p)?T:void 0)?.apply(this,e)},!0),U(e,E),A()}Zr([`click`,`pointermove`,`pointerup`,`contextmenu`]);var lv=H(`<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"><!></div>`);function uv(e,t){k(t,!0);var n=lv();let r;Fi(P(n),()=>t.children),O(n),R(()=>r=Xi(n,``,r,{transform:`translate(${t.store.viewport.x??``}px, ${t.store.viewport.y??``}px) scale(${t.store.viewport.zoom??``})`})),U(e,n),A()}function dv(e,t){let{store:n,onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o}=t,s=Tg({onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o,getStoreItems:()=>{let{snapGrid:e,viewport:t}=n;return{nodes:n.nodes,nodeLookup:n.nodeLookup,edges:n.edges,nodeExtent:n.nodeExtent,snapGrid:e||[0,0],snapToGrid:!!e,nodeOrigin:n.nodeOrigin,multiSelectionActive:n.multiselectionKeyPressed,domNode:n.domNode,transform:[t.x,t.y,t.zoom],autoPanOnNodeDrag:n.autoPanOnNodeDrag,nodesDraggable:n.nodesDraggable,selectNodesOnDrag:n.selectNodesOnDrag,nodeDragThreshold:n.nodeDragThreshold,unselectNodesAndEdges:n.unselectNodesAndEdges,updateNodePositions:n.updateNodePositions,onSelectionDrag:n.onselectiondrag,onSelectionDragStart:n.onselectiondragstart,onSelectionDragStop:n.onselectiondragstop,panBy:n.panBy}}});function c(e,t){t.disabled?s.destroy():s.update({domNode:e,noDragClassName:t.noDragClass,handleSelector:t.handleSelector,nodeId:t.nodeId,isSelectable:t.isSelectable,nodeClickDistance:t.nodeClickDistance})}return c(e,t),{update(t){c(e,t)},destroy(){s.destroy()}}}var fv=H(`<div aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-13pq11u"> </div>`),pv=H(`<div class="a11y-hidden svelte-13pq11u"> </div> <div class="a11y-hidden svelte-13pq11u"> </div> <!>`,1);function mv(e,t){k(t,!0);var n=pv(),r=F(n),i=I(r,!0),a=L(r,2),o=I(a,!0),s=L(a,2),c=e=>{var n=fv(),r=I(n,!0);R(()=>{q(n,`id`,`${_v}-${t.store.flowId}`),W(r,t.store.ariaLiveMessage)}),U(e,n)};G(s,e=>{t.store.disableKeyboardA11y||e(c)}),R(()=>{q(r,`id`,`${hv}-${t.store.flowId}`),W(i,t.store.disableKeyboardA11y?t.store.ariaLabelConfig[`node.a11yDescription.default`]:t.store.ariaLabelConfig[`node.a11yDescription.keyboardDisabled`]),q(a,`id`,`${gv}-${t.store.flowId}`),W(o,t.store.ariaLabelConfig[`edge.a11yDescription.default`])}),U(e,n),A()}var hv=`svelte-flow__node-desc`,gv=`svelte-flow__edge-desc`,_v=`svelte-flow__aria-live`,vv=H(`<div><!></div>`);function yv(e,t){k(t,!0);let n=Y(t,`store`,15),r=j(()=>_(t.node.data,()=>({}),!0)),i=j(()=>_(t.node.selected,!1)),a=j(()=>t.node.draggable),o=j(()=>t.node.selectable),s=j(()=>_(t.node.deletable,!0)),c=j(()=>t.node.connectable),l=j(()=>t.node.focusable),u=j(()=>_(t.node.hidden,!1)),d=j(()=>_(t.node.dragging,!1)),f=j(()=>_(t.node.style,``)),p=j(()=>t.node.class),m=j(()=>_(t.node.type,`default`)),h=j(()=>t.node.parentId),g=j(()=>t.node.sourcePosition),v=j(()=>t.node.targetPosition),y=j(()=>_(t.node.measured,()=>({width:0,height:0}),!0).width),b=j(()=>_(t.node.measured,()=>({width:0,height:0}),!0).height),x=j(()=>t.node.initialWidth),S=j(()=>t.node.initialHeight),C=j(()=>t.node.width),w=j(()=>t.node.height),ee=j(()=>t.node.dragHandle),T=j(()=>_(t.node.internals.z,0)),te=j(()=>t.node.internals.positionAbsolute.x),E=j(()=>t.node.internals.positionAbsolute.y),ne=j(()=>t.node.internals.userNode),{id:re}=t.node,ie=j(()=>z(a)??n().nodesDraggable),ae=j(()=>z(o)??n().elementsSelectable),oe=j(()=>z(c)??n().nodesConnectable),se=j(()=>_h(t.node)),ce=j(()=>!!t.node.internals.handleBounds),le=j(()=>z(se)&&z(ce)),ue=j(()=>z(l)??n().nodesFocusable);function de(e){return n().parentLookup.has(e)}let fe=j(()=>de(re)),pe=M(null),me=null,he=z(m),ge=z(g),_e=z(v),ve=j(()=>n().nodeTypes[z(m)]??d_),ye=j(()=>n().ariaLabelConfig);n_(re),i_({get value(){return z(oe)}});let be=j(()=>{let e=z(y)===void 0?z(C)??z(x):z(C),t=z(b)===void 0?z(w)??z(S):z(w);if(e!==void 0||t!==void 0||z(f)!==void 0)return`${z(f)};${e?`width:${S_(e)};`:``}${t?`height:${S_(t)};`:``}`});In(()=>{(z(m)!==he||z(g)!==ge||z(v)!==_e)&&z(pe)!==null&&requestAnimationFrame(()=>{z(pe)!==null&&n().updateNodeInternals(new Map([[re,{id:re,nodeElement:z(pe),force:!0}]]))}),he=z(m),ge=z(g),_e=z(v)}),In(()=>{t.resizeObserver&&(!z(le)||z(pe)!==me)&&(me&&t.resizeObserver.unobserve(me),z(pe)&&t.resizeObserver.observe(z(pe)),me=z(pe))}),Ha(()=>{me&&t.resizeObserver?.unobserve(me)});function xe(e){z(ae)&&(!n().selectNodesOnDrag||!z(ie)||n().nodeDragThreshold>0)&&n().handleNodeSelection(re),t.onnodeclick?.({node:z(ne),event:e})}function Se(e){if(!(Dh(e)||n().disableKeyboardA11y)){if(Cm.includes(e.key)&&z(ae)){let t=e.key===`Escape`;n().handleNodeSelection(re,t,z(pe))}else z(ie)&&t.node.selected&&Object.prototype.hasOwnProperty.call(C_,e.key)&&(e.preventDefault(),n(n().ariaLiveMessage=z(ye)[`node.a11yDescription.ariaLiveMessage`]({direction:e.key.replace(`Arrow`,``).toLowerCase(),x:~~t.node.internals.positionAbsolute.x,y:~~t.node.internals.positionAbsolute.y}),!0),n().moveSelectedNodes(C_[e.key],e.shiftKey?4:1))}}let Ce=()=>{if(n().disableKeyboardA11y||!n().autoPanOnNodeFocus||!z(pe)?.matches(`:focus-visible`))return;let{width:e,height:r,viewport:i}=n();zm(new Map([[re,t.node]]),{x:0,y:0,width:e,height:r},[i.x,i.y,i.zoom],!0).length>0||n().setCenter(t.node.position.x+(t.node.measured.width??0)/2,t.node.position.y+(t.node.measured.height??0)/2,{zoom:i.zoom})};var we=ci(),Te=F(we),Ee=e=>{var a=vv();va(a,()=>({"data-id":re,class:[`svelte-flow__node`,`svelte-flow__node-${z(m)}`,z(p)],style:z(be),onclick:xe,onpointerenter:t.onnodepointerenter?e=>t.onnodepointerenter({node:z(ne),event:e}):void 0,onpointerleave:t.onnodepointerleave?e=>t.onnodepointerleave({node:z(ne),event:e}):void 0,onpointermove:t.onnodepointermove?e=>t.onnodepointermove({node:z(ne),event:e}):void 0,oncontextmenu:t.onnodecontextmenu?e=>t.onnodecontextmenu({node:z(ne),event:e}):void 0,onkeydown:z(ue)?Se:void 0,onfocus:z(ue)?Ce:void 0,tabIndex:z(ue)?0:void 0,role:t.node.ariaRole??(z(ue)?`group`:void 0),"aria-label":t.node.ariaLabel,"aria-roledescription":`node`,"aria-describedby":n().disableKeyboardA11y?void 0:`${hv}-${n().flowId}`,...t.node.domAttributes,[aa]:{dragging:z(d),selected:z(i),draggable:z(ie),connectable:z(oe),selectable:z(ae),nopan:z(ie),parent:z(fe)},[oa]:{"z-index":z(T),transform:`translate(${z(te)??``}px, ${z(E)??``}px)`,visibility:z(se)?`visible`:`hidden`}})),Ii(P(a),()=>z(ve),(e,t)=>{t(e,{get data(){return z(r)},get id(){return re},get selected(){return z(i)},get selectable(){return z(ae)},get deletable(){return z(s)},get sourcePosition(){return z(g)},get targetPosition(){return z(v)},get zIndex(){return z(T)},get dragging(){return z(d)},get draggable(){return z(ie)},get dragHandle(){return z(ee)},get parentId(){return z(h)},get type(){return z(m)},get isConnectable(){return z(oe)},get positionAbsoluteX(){return z(te)},get positionAbsoluteY(){return z(E)},get width(){return z(C)},get height(){return z(w)}})}),O(a),Ri(a,(e,t)=>dv?.(e,t),()=>({nodeId:re,isSelectable:z(ae),disabled:!z(ie),handleSelector:z(ee),noDragClass:n().noDragClass,nodeClickDistance:t.nodeClickDistance,onNodeMouseDown:n().handleNodeSelection,onDrag:(e,n,r,i)=>{t.onnodedrag?.({event:e,targetNode:r,nodes:i})},onDragStart:(e,n,r,i)=>{t.onnodedragstart?.({event:e,targetNode:r,nodes:i})},onDragStop:(e,n,r,i)=>{t.onnodedragstop?.({event:e,targetNode:r,nodes:i})},store:n()})),Ma(a,e=>N(pe,e),()=>z(pe)),U(e,a)};G(Te,e=>{z(u)||e(Ee)}),U(e,we),A()}var bv=H(`<div class="svelte-flow__nodes"></div>`);function xv(e,t){k(t,!0);let n=Y(t,`store`,15),r=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{let t=new Map;e.forEach(e=>{let n=e.target.getAttribute(`data-id`);t.set(n,{id:n,nodeElement:e.target,force:!0})}),n().updateNodeInternals(t)});Ha(()=>{r?.disconnect()});var i=bv();K(i,21,()=>n().visible.nodes.values(),e=>e.id,(e,i)=>{yv(e,{get node(){return z(i)},get resizeObserver(){return r},get nodeClickDistance(){return t.nodeClickDistance},get onnodeclick(){return t.onnodeclick},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get onnodecontextmenu(){return t.onnodecontextmenu},get store(){return n()},set store(e){n(e)}})}),O(i),U(e,i),A()}var Sv=oi(`<svg class="svelte-flow__edge-wrapper"><g><!></g></svg>`);function Cv(e,t){k(t,!0);let n=j(()=>t.edge.id),r=j(()=>t.edge.source),i=j(()=>t.edge.target),a=j(()=>t.edge.sourceX),o=j(()=>t.edge.sourceY),s=j(()=>t.edge.targetX),c=j(()=>t.edge.targetY),l=j(()=>t.edge.sourcePosition),u=j(()=>t.edge.targetPosition),d=j(()=>_(t.edge.animated,!1)),f=j(()=>_(t.edge.selected,!1)),p=j(()=>t.edge.label),m=j(()=>t.edge.labelStyle),h=j(()=>_(t.edge.data,()=>({}),!0)),g=j(()=>t.edge.style),v=j(()=>t.edge.interactionWidth),y=j(()=>_(t.edge.type,`default`)),b=j(()=>t.edge.sourceHandle),x=j(()=>t.edge.targetHandle),S=j(()=>t.edge.markerStart),C=j(()=>t.edge.markerEnd),w=j(()=>t.edge.selectable),ee=j(()=>t.edge.focusable),T=j(()=>_(t.edge.deletable,!0)),te=j(()=>t.edge.hidden),E=j(()=>t.edge.zIndex),ne=j(()=>t.edge.class),re=j(()=>t.edge.ariaLabel);o_(z(n));let ie=null,ae=j(()=>z(w)??t.store.elementsSelectable),oe=j(()=>z(ee)??t.store.edgesFocusable),se=j(()=>t.store.edgeTypes[z(y)]??j_),ce=j(()=>z(S)?`url('#${$h(z(S),t.store.flowId)}')`:void 0),le=j(()=>z(C)?`url('#${$h(z(C),t.store.flowId)}')`:void 0);function ue(e){let r=t.store.edgeLookup.get(z(n));r&&(z(ae)&&t.store.handleEdgeSelection(z(n)),t.onedgeclick?.({event:e,edge:r}))}function de(e,r){let i=t.store.edgeLookup.get(z(n));i&&r({event:e,edge:i})}function fe(e){if(!t.store.disableKeyboardA11y&&Cm.includes(e.key)&&z(ae)){let{unselectNodesAndEdges:r,addSelectedEdges:i}=t.store;e.key===`Escape`?(ie?.blur(),r({edges:[t.edge]})):i([z(n)])}}var pe=ci(),me=F(pe),he=e=>{var _=Sv();let S;var C=P(_);va(C,()=>({class:[`svelte-flow__edge`,z(ne)],"data-id":z(n),onclick:ue,oncontextmenu:t.onedgecontextmenu?e=>{de(e,t.onedgecontextmenu)}:void 0,onpointerenter:t.onedgepointerenter?e=>{de(e,t.onedgepointerenter)}:void 0,onpointerleave:t.onedgepointerleave?e=>{de(e,t.onedgepointerleave)}:void 0,"aria-label":z(re)===null?void 0:z(re)?z(re):`Edge from ${z(r)} to ${z(i)}`,"aria-describedby":z(oe)?`${gv}-${t.store.flowId}`:void 0,role:t.edge.ariaRole??(z(oe)?`group`:`img`),"aria-roledescription":`edge`,onkeydown:z(oe)?fe:void 0,tabindex:z(oe)?0:void 0,...t.edge.domAttributes,[aa]:{animated:z(d),selected:z(f),selectable:z(ae)}})),Ii(P(C),()=>z(se),(e,t)=>{t(e,{get id(){return z(n)},get source(){return z(r)},get target(){return z(i)},get sourceX(){return z(a)},get sourceY(){return z(o)},get targetX(){return z(s)},get targetY(){return z(c)},get sourcePosition(){return z(l)},get targetPosition(){return z(u)},get animated(){return z(d)},get selected(){return z(f)},get label(){return z(p)},get labelStyle(){return z(m)},get data(){return z(h)},get style(){return z(g)},get interactionWidth(){return z(v)},get selectable(){return z(ae)},get deletable(){return z(T)},get type(){return z(y)},get sourceHandleId(){return z(b)},get targetHandleId(){return z(x)},get markerStart(){return z(ce)},get markerEnd(){return z(le)}})}),O(C),Ma(C,e=>ie=e,()=>ie),O(_),R(()=>S=Xi(_,``,S,{"z-index":z(E)})),U(e,_)};G(me,e=>{z(te)||e(he)}),U(e,pe),A()}Xe();var wv=oi(`<defs></defs>`);function Tv(e,t){k(t,!1);let n=Q_();Pa();var r=wv();K(r,5,()=>n.markers,e=>e.id,(e,t)=>{kv(e,Ba(()=>z(t)))}),O(r),U(e,r),A()}var Ev=oi(`<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4"></polyline>`),Dv=oi(`<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4"></polyline>`),Ov=oi(`<marker class="svelte-flow__arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0"><!></marker>`);function kv(e,t){k(t,!0);let n=Y(t,`width`,3,12.5),r=Y(t,`height`,3,12.5),i=Y(t,`markerUnits`,3,`strokeWidth`),a=Y(t,`orient`,3,`auto-start-reverse`),o=Y(t,`color`,3,`none`);var s=Ov(),c=P(s),l=e=>{var n=Ev();let r;R(()=>{q(n,`stroke-width`,t.strokeWidth),r=Xi(n,``,r,{stroke:o()})}),U(e,n)},u=e=>{var n=Dv();let r;R(()=>{q(n,`stroke-width`,t.strokeWidth),r=Xi(n,``,r,{stroke:o(),fill:o()})}),U(e,n)};G(c,e=>{t.type===Am.Arrow?e(l):t.type===Am.ArrowClosed&&e(u,1)}),O(s),R(()=>{q(s,`id`,t.id),q(s,`markerWidth`,`${n()}`),q(s,`markerHeight`,`${r()}`),q(s,`markerUnits`,i()),q(s,`orient`,a())}),U(e,s),A()}var Av=H(`<div class="svelte-flow__edges"><svg class="svelte-flow__marker"><!></svg> <!></div>`);function jv(e,t){k(t,!0);let n=Y(t,`store`,15);var r=Av(),i=P(r);Tv(P(i),{}),O(i),K(L(i,2),17,()=>n().visible.edges.values(),e=>e.id,(e,r)=>{Cv(e,{get edge(){return z(r)},get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return n()},set store(e){n(e)}})}),O(r),U(e,r),A()}var Mv=H(`<div class="svelte-flow__selection svelte-1vr3gfi"></div>`);function Nv(e,t){k(t,!0);let n=Y(t,`x`,3,0),r=Y(t,`y`,3,0),i=Y(t,`width`,3,0),a=Y(t,`height`,3,0),o=Y(t,`isVisible`,3,!0);var s=ci(),c=F(s),l=e=>{var t=Mv();let o;R((e,i)=>o=Xi(t,``,o,{width:e,height:i,transform:`translate(${n()}px, ${r()}px)`}),[()=>typeof i()==`string`?i():S_(i()),()=>typeof a()==`string`?a():S_(a())]),U(e,t)};G(c,e=>{o()&&e(l)}),U(e,s),A()}var Pv=H(`<div><!></div>`);function Fv(e,t){k(t,!0);let n=M(void 0);In(()=>{t.store.disableKeyboardA11y||z(n)?.focus({preventScroll:!0})});let r=j(()=>{if(t.store.selectionRectMode===`nodes`){t.store.nodes;let e=Rm(t.store.nodeLookup,{filter:e=>!!e.selected});if(e.width>0&&e.height>0)return e}return null});function i(e){let n=t.store.nodes.filter(e=>e.selected);t.onselectioncontextmenu?.({nodes:n,event:e})}function a(e){let n=t.store.nodes.filter(e=>e.selected);t.onselectionclick?.({nodes:n,event:e})}function o(e){Object.prototype.hasOwnProperty.call(C_,e.key)&&(e.preventDefault(),t.store.moveSelectedNodes(C_[e.key],e.shiftKey?4:1))}var s=ci(),c=F(s),l=e=>{var s=Pv();let c;Nv(P(s),{width:`100%`,height:`100%`,x:0,y:0}),O(s),Ri(s,(e,t)=>dv?.(e,t),()=>({disabled:!1,store:t.store,onDrag:(e,n,r,i)=>{t.onnodedrag?.({event:e,targetNode:null,nodes:i})},onDragStart:(e,n,r,i)=>{t.onnodedragstart?.({event:e,targetNode:null,nodes:i})},onDragStop:(e,n,r,i)=>{t.onnodedragstop?.({event:e,targetNode:null,nodes:i})}})),Ma(s,e=>N(n,e),()=>z(n)),R((e,n)=>{Ji(s,1,Hi([`svelte-flow__selection-wrapper`,t.store.noPanClass]),`svelte-sf2y5e`),q(s,`role`,t.store.disableKeyboardA11y?void 0:`button`),q(s,`tabindex`,t.store.disableKeyboardA11y?void 0:-1),c=Xi(s,``,c,{width:e,height:n,transform:`translate(${z(r).x??``}px, ${z(r).y??``}px)`})},[()=>S_(z(r).width),()=>S_(z(r).height)]),V(`contextmenu`,s,i),V(`click`,s,a),V(`keydown`,s,function(...e){(t.store.disableKeyboardA11y?void 0:o)?.apply(this,e)}),U(e,s)},u=j(()=>t.store.selectionRectMode===`nodes`&&z(r)&&ah(z(r).x)&&ah(z(r).y));G(c,e=>{z(u)&&e(l)}),U(e,s),A()}Zr([`contextmenu`,`click`,`keydown`]);function Iv(e){switch(e){case`none`:return 0;case`ctrl`:return 8;case`shift`:return 4;case`alt`:return 2;case`meta`:return 1}}function Lv(e,t){let{enabled:n=!0,trigger:r,type:i=`keydown`}=t;function a(t){let n=Array.isArray(r)?r:[r],i=[t.metaKey,t.altKey,t.shiftKey,t.ctrlKey].reduce((e,t,n)=>t?e|1<<n:e,0);for(let r of n){let n={preventDefault:!1,enabled:!0,...r},{modifier:a,key:o,code:s,callback:c,preventDefault:l,enabled:u}=n;if(!o&&!s&&console.warn("[svelte-put/shortcut] Trigger should have either `key` or `code`, a trigger missing both was detected! Check your configuration"),u&&(o||s)){if(s&&t.code!==s||o&&t.key!==o)continue;if(a===null||a===!1){if(i!==0)continue}else if(a!==void 0&&a?.[0]?.length>0){let e=Array.isArray(a)?a:[a],t=!1;for(let n of e)if((Array.isArray(n)?n:[n]).reduce((e,t)=>e|Iv(t),0)===i){t=!0;break}if(!t)continue}l&&t.preventDefault();let r={node:e,trigger:n,originalEvent:t};e.dispatchEvent(new CustomEvent(`shortcut`,{detail:r})),c?.(r)}}}let o;return n&&(o=Xr(e,i,a)),{update:t=>{let{enabled:s=!0,type:c=`keydown`}=t;n&&(!s||i!==c)?o?.():!n&&s&&(o=Xr(e,c,a)),n=s,i=c,r=t.trigger},destroy:()=>{o?.()}}}function Rv(){let e=j(Q_),t=t=>{let n=b_(t)?t:z(e).nodeLookup.get(t.id),r=n.parentId?vh(n.position,n.measured,n.parentId,z(e).nodeLookup,z(e).nodeOrigin):n.position;return $m({...n,position:r,width:n.measured?.width??n.width,height:n.measured?.height??n.height})};function n(t,n,r={replace:!1}){z(e).nodes=Nr(()=>z(e).nodes).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r?.replace&&b_(t)?t:{...e,...t}}return e})}function r(t,n,r={replace:!1}){z(e).edges=Nr(()=>z(e).edges).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r.replace&&x_(t)?t:{...e,...t}}return e})}let i=t=>z(e).nodeLookup.get(t);return{zoomIn:z(e).zoomIn,zoomOut:z(e).zoomOut,getInternalNode:i,getNode:e=>i(e)?.internals.userNode,getNodes:t=>t===void 0?z(e).nodes:zv(z(e).nodeLookup,t),getEdge:t=>z(e).edgeLookup.get(t),getEdges:t=>t===void 0?z(e).edges:zv(z(e).edgeLookup,t),setZoom:async(t,n)=>{let r=z(e).panZoom;return r?r.scaleTo(t,n):!1},getZoom:()=>z(e).viewport.zoom,setViewport:async(t,n)=>{let r=z(e).viewport;return z(e).panZoom?(await z(e).panZoom.setViewport({x:t.x??r.x,y:t.y??r.y,zoom:t.zoom??r.zoom},n),!0):!1},getViewport:()=>Qe(z(e).viewport),setCenter:async(t,n,r)=>z(e).setCenter(t,n,r),fitView:t=>z(e).fitView(t),fitBounds:async(t,n)=>{if(!z(e).panZoom)return!1;let r=ph(t,z(e).width,z(e).height,z(e).minZoom,z(e).maxZoom,n?.padding??.1);return await z(e).panZoom.setViewport(r,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},getIntersectingNodes:(n,r=!0,i)=>{let a=ih(n),o=a?n:t(n);return o?(i||z(e).nodes).filter(t=>{let i=z(e).nodeLookup.get(t.id);if(!i||!a&&t.id===n.id)return!1;let s=$m(i),c=rh(s,o);return r&&c>0||c>=s.width*s.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,n,r=!0)=>{let i=ih(e)?e:t(e);if(!i)return!1;let a=rh(i,n);return r&&a>0||a>=n.width*n.height||a>=i.width*i.height},deleteElements:async({nodes:t=[],edges:n=[]})=>{let{nodes:r,edges:i}=await Wm({nodesToRemove:t,edgesToRemove:n,nodes:z(e).nodes,edges:z(e).edges,onBeforeDelete:z(e).onbeforedelete});return r&&(z(e).nodes=Nr(()=>z(e).nodes).filter(e=>!r.some(({id:t})=>t===e.id))),i&&(z(e).edges=Nr(()=>z(e).edges).filter(e=>!i.some(({id:t})=>t===e.id))),(r.length>0||i.length>0)&&z(e).ondelete?.({nodes:r,edges:i}),{deletedNodes:r,deletedEdges:i}},screenToFlowPosition:(t,n={snapToGrid:!0})=>{if(!z(e).domNode)return t;let r=n.snapToGrid?z(e).snapGrid:!1,{x:i,y:a,zoom:o}=z(e).viewport,{x:s,y:c}=z(e).domNode.getBoundingClientRect();return ch({x:t.x-s,y:t.y-c},[i,a,o],r!==null,r||[1,1])},flowToScreenPosition:t=>{if(!z(e).domNode)return t;let{x:n,y:r,zoom:i}=z(e).viewport,{x:a,y:o}=z(e).domNode.getBoundingClientRect(),s=lh(t,[n,r,i]);return{x:s.x+a,y:s.y+o}},toObject:()=>structuredClone({nodes:[...z(e).nodes],edges:[...z(e).edges],viewport:{...z(e).viewport}}),updateNode:n,updateNodeData:(t,r,i)=>{let a=z(e).nodeLookup.get(t)?.internals.userNode;if(!a)return;let o=typeof r==`function`?r(a):r;n(t,e=>({...e,data:i?.replace?o:{...e.data,...o}}))},updateEdge:r,getNodesBounds:t=>Lm(t,{nodeLookup:z(e).nodeLookup,nodeOrigin:z(e).nodeOrigin}),getHandleConnections:({type:t,id:n,nodeId:r})=>Array.from(z(e).connectionLookup.get(`${r}-${t}-${n??null}`)?.values()??[])}}function zv(e,t){let n=[];for(let r of t){let t=e.get(r);if(t){let e=`internals`in t?t.internals?.userNode:t;n.push(e)}}return n}function Bv(e,t){k(t,!0);let n=Y(t,`store`,15),r=Y(t,`selectionKey`,3,`Shift`),i=Y(t,`multiSelectionKey`,19,()=>mh()?`Meta`:`Control`),a=Y(t,`deleteKey`,3,`Backspace`),o=Y(t,`panActivationKey`,3,` `),s=Y(t,`zoomActivationKey`,19,()=>mh()?`Meta`:`Control`),{deleteElements:c}=Rv();function l(e){return typeof e==`object`&&!!e}function u(e){return l(e)&&e.modifier||[]}function d(e){return e==null?``:l(e)?e.key:e}function f(e,t){return(Array.isArray(e)?e:[e]).map(e=>{let n=d(e);return{key:n,modifier:u(e),enabled:n!==null,callback:t}})}function p(){n(n().selectionRect=null,!0),n(n().selectionKeyPressed=!1,!0),n(n().multiselectionKeyPressed=!1,!0),n(n().deleteKeyPressed=!1,!0),n(n().panActivationKeyPressed=!1,!0),n(n().zoomActivationKeyPressed=!1,!0)}function m(){let e=n().nodes.filter(e=>e.selected),t=n().edges.filter(e=>e.selected);c({nodes:e,edges:t})}B(`blur`,gn,p),B(`contextmenu`,gn,p),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(r(),()=>n(n().selectionKeyPressed=!0,!0)),type:`keydown`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(r(),()=>n(n().selectionKeyPressed=!1,!0)),type:`keyup`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(i(),()=>{n(n().multiselectionKeyPressed=!0,!0)}),type:`keydown`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(i(),()=>n(n().multiselectionKeyPressed=!1,!0)),type:`keyup`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(a(),e=>{!(e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)&&!Dh(e.originalEvent)&&(n(n().deleteKeyPressed=!0,!0),m())}),type:`keydown`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(a(),()=>n(n().deleteKeyPressed=!1,!0)),type:`keyup`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(o(),()=>n(n().panActivationKeyPressed=!0,!0)),type:`keydown`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(o(),()=>n(n().panActivationKeyPressed=!1,!0)),type:`keyup`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(s(),()=>n(n().zoomActivationKeyPressed=!0,!0)),type:`keydown`})),Ri(gn,(e,t)=>Lv?.(e,t),()=>({trigger:f(s(),()=>n(n().zoomActivationKeyPressed=!1,!0)),type:`keyup`})),A()}var Vv=oi(`<path fill="none" class="svelte-flow__connection-path"></path>`),Hv=oi(`<svg class="svelte-flow__connectionline"><g><!></g></svg>`);function Uv(e,t){k(t,!0);let n=j(()=>{if(!t.store.connection.inProgress)return``;let e={sourceX:t.store.connection.from.x,sourceY:t.store.connection.from.y,sourcePosition:t.store.connection.fromPosition,targetX:t.store.connection.to.x,targetY:t.store.connection.to.y,targetPosition:t.store.connection.toPosition};switch(t.type){case km.Bezier:{let[t]=Ph(e);return t}case km.Straight:{let[t]=Vh(e);return t}case km.Step:case km.SmoothStep:{let[n]=qh({...e,borderRadius:t.type===km.Step?0:void 0});return n}}});var r=ci(),i=F(r),a=e=>{var r=Hv(),i=P(r),a=P(i),o=e=>{var n=ci();Ii(F(n),()=>t.LineComponent,(e,t)=>{t(e,{})}),U(e,n)},s=e=>{var r=Vv();R(()=>{q(r,`d`,z(n)),Xi(r,t.style)}),U(e,r)};G(a,e=>{t.LineComponent?e(o):e(s,-1)}),O(i),O(r),R(e=>{q(r,`width`,t.store.width),q(r,`height`,t.store.height),Xi(r,t.containerStyle),Ji(i,0,e)},[()=>Hi([`svelte-flow__connection`,Sh(t.store.connection.isValid)])]),U(e,r)};G(i,e=>{t.store.connection.inProgress&&e(a)}),U(e,r),A()}var Wv=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`style`,`class`,`children`]),Gv=H(`<div><!></div>`);function Kv(e,t){k(t,!0);let n=Y(t,`position`,3,`top-right`),r=J(t,Wv),i=j(()=>`${n()}`.split(`-`));var a=Gv();va(a,e=>({class:e,style:t.style,...r}),[()=>[`svelte-flow__panel`,t.class,...z(i)]]),Fi(P(a),()=>t.children??f),O(a),U(e,a),A()}var qv=H(`<a target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>`);function Jv(e,t){k(t,!0);let n=Y(t,`position`,3,`bottom-right`),r=`https://svelteflow.dev?utm_source=attribution`;var i=ci(),a=F(i),o=e=>{{let t=j(()=>`Please only hide this attribution when you are subscribed to Svelte Flow Pro: ${r}`);Kv(e,{get position(){return n()},class:`svelte-flow__attribution`,get"data-message"(){return z(t)},children:(e,t)=>{var n=qv();R(()=>q(n,`href`,r)),U(e,n)},$$slots:{default:!0}})}};G(a,e=>{t.proOptions?.hideAttribution||e(o)}),U(e,i),A()}var Yv=H(`<div><!></div>`);function Xv(e,t){k(t,!0);let n=Y(t,`domNode`,15),r=Y(t,`clientWidth`,15),i=Y(t,`clientHeight`,15),a=j(()=>t.rest.class),o=j(()=>y(t.rest,`id.class.nodeTypes.edgeTypes.colorMode.isValidConnection.onmove.onmovestart.onmoveend.onflowerror.ondelete.onbeforedelete.onbeforeconnect.onconnect.onconnectstart.onconnectend.onbeforereconnect.onreconnect.onreconnectstart.onreconnectend.onclickconnectstart.onclickconnectend.oninit.onselectionchange.onselectiondragstart.onselectiondrag.onselectiondragstop.onselectionstart.onselectionend.clickConnect.fitView.fitViewOptions.nodeOrigin.nodeDragThreshold.connectionDragThreshold.minZoom.maxZoom.initialViewport.connectionRadius.connectionMode.selectionMode.selectNodesOnDrag.snapGrid.defaultMarkerColor.translateExtent.nodeExtent.onlyRenderVisibleElements.autoPanOnConnect.autoPanOnNodeDrag.colorModeSSR.defaultEdgeOptions.elevateNodesOnSelect.elevateEdgesOnSelect.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.elementsSelectable.nodesFocusable.edgesFocusable.disableKeyboardA11y.noDragClass.noPanClass.noWheelClass.ariaLabelConfig.autoPanSpeed.panOnScrollSpeed.zIndexMode.autoPanOnSelection`.split(`.`)));function s(e){e.currentTarget.scrollTo({top:0,left:0,behavior:`auto`}),t.rest.onscroll&&t.rest.onscroll(e)}var c=Yv();va(c,(e,n)=>({class:[`svelte-flow`,`svelte-flow__container`,t.colorMode,z(a)],"data-testid":`svelte-flow__wrapper`,role:`application`,onscroll:s,...z(o),[oa]:{width:e,height:n}}),[()=>S_(t.width),()=>S_(t.height)],void 0,void 0,`svelte-mkap6j`),Fi(P(c),()=>t.children??f),O(c),Ma(c,e=>n(e),()=>n()),Aa(c,`clientHeight`,i),Aa(c,`clientWidth`,r),U(e,c),A()}var Zv=new Set(`$$slots.$$events.$$legacy.width.height.proOptions.selectionKey.deleteKey.panActivationKey.multiSelectionKey.zoomActivationKey.paneClickDistance.nodeClickDistance.onmovestart.onmoveend.onmove.oninit.onnodeclick.onnodecontextmenu.onnodedrag.onnodedragstart.onnodedragstop.onnodepointerenter.onnodepointermove.onnodepointerleave.onselectionclick.onselectioncontextmenu.onselectionstart.onselectionend.onedgeclick.onedgecontextmenu.onedgepointerenter.onedgepointerleave.onpaneclick.onpanecontextmenu.panOnScrollMode.preventScrolling.zoomOnScroll.zoomOnDoubleClick.zoomOnPinch.panOnScroll.panOnScrollSpeed.panOnDrag.selectionOnDrag.autoPanOnSelection.connectionLineComponent.connectionLineStyle.connectionLineContainerStyle.connectionLineType.attributionPosition.children.nodes.edges.viewport`.split(`.`)),Qv=H(`<div class="svelte-flow__viewport-back svelte-flow__container"></div> <!> <div class="svelte-flow__edge-labels svelte-flow__container"></div> <!> <!> <!> <div class="svelte-flow__viewport-front svelte-flow__container"></div>`,1),$v=H(`<!> <!>`,1),ey=H(`<!> <!> <!> <!> <!>`,1);function ty(e,t){k(t,!0);let n=Y(t,`paneClickDistance`,3,1),r=Y(t,`nodeClickDistance`,3,1),i=Y(t,`panOnScrollMode`,19,()=>Em.Free),a=Y(t,`preventScrolling`,3,!0),o=Y(t,`zoomOnScroll`,3,!0),s=Y(t,`zoomOnDoubleClick`,3,!0),c=Y(t,`zoomOnPinch`,3,!0),l=Y(t,`panOnScroll`,3,!1),u=Y(t,`panOnScrollSpeed`,3,.5),d=Y(t,`panOnDrag`,3,!0),p=Y(t,`selectionOnDrag`,3,!1),m=Y(t,`autoPanOnSelection`,3,!0),h=Y(t,`connectionLineType`,19,()=>km.Bezier),g=Y(t,`nodes`,31,()=>pn([])),_=Y(t,`edges`,31,()=>pn([])),v=Y(t,`viewport`,15,void 0),y=J(t,Zv),b=ev({props:y,width:t.width,height:t.height,get nodes(){return g()},set nodes(e){g(e)},get edges(){return _()},set edges(e){_(e)},get viewport(){return v()},set viewport(e){v(e)}}),x=it($_);x&&x.setStore&&x.setStore(b),at($_,{provider:!1,getStore(){return b}}),In(()=>{let e={nodes:b.selectedNodes,edges:b.selectedEdges};Nr(()=>t.onselectionchange)?.(e);for(let t of b.selectionChangeHandlers.values())t(e)}),Ha(()=>{x?.setStore(ev({width:0,height:0,nodes:[],edges:[],props:{}}))}),Xv(e,{get colorMode(){return b.colorMode},get width(){return t.width},get height(){return t.height},get rest(){return y},get domNode(){return b.domNode},set domNode(e){b.domNode=e},get clientWidth(){return b.width},set clientWidth(e){b.width=e},get clientHeight(){return b.height},set clientHeight(e){b.height=e},children:(e,g)=>{var _=ey(),v=F(_);Bv(v,{get selectionKey(){return t.selectionKey},get deleteKey(){return t.deleteKey},get panActivationKey(){return t.panActivationKey},get multiSelectionKey(){return t.multiSelectionKey},get zoomActivationKey(){return t.zoomActivationKey},get store(){return b},set store(e){b=e}});var y=L(v,2);rv(y,{get panOnScrollMode(){return i()},get preventScrolling(){return a()},get zoomOnScroll(){return o()},get zoomOnDoubleClick(){return s()},get zoomOnPinch(){return c()},get panOnScroll(){return l()},get panOnScrollSpeed(){return u()},get panOnDrag(){return d()},get paneClickDistance(){return n()},get selectionOnDrag(){return p()},get onmovestart(){return t.onmovestart},get onmove(){return t.onmove},get onmoveend(){return t.onmoveend},get oninit(){return t.oninit},get store(){return b},set store(e){b=e},children:(e,i)=>{cv(e,{get onpaneclick(){return t.onpaneclick},get onpanecontextmenu(){return t.onpanecontextmenu},get onselectionstart(){return t.onselectionstart},get onselectionend(){return t.onselectionend},get panOnDrag(){return d()},get paneClickDistance(){return n()},get selectionOnDrag(){return p()},get autoPanOnSelection(){return m()},get store(){return b},set store(e){b=e},children:(e,n)=>{var i=$v(),a=F(i);uv(a,{get store(){return b},set store(e){b=e},children:(e,n)=>{var i=Qv(),a=L(F(i),2);jv(a,{get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return b},set store(e){b=e}});var o=L(a,4);Uv(o,{get type(){return h()},get LineComponent(){return t.connectionLineComponent},get containerStyle(){return t.connectionLineContainerStyle},get style(){return t.connectionLineStyle},get store(){return b},set store(e){b=e}});var s=L(o,2);xv(s,{get nodeClickDistance(){return r()},get onnodeclick(){return t.onnodeclick},get onnodecontextmenu(){return t.onnodecontextmenu},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return b},set store(e){b=e}}),Fv(L(s,2),{get onselectionclick(){return t.onselectionclick},get onselectioncontextmenu(){return t.onselectioncontextmenu},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return b},set store(e){b=e}}),je(2),U(e,i)},$$slots:{default:!0}});var o=L(a,2);{let e=j(()=>!!(b.selectionRect&&b.selectionRectMode===`user`)),t=j(()=>b.selectionRect?.width),n=j(()=>b.selectionRect?.height),r=j(()=>b.selectionRect?.x),i=j(()=>b.selectionRect?.y);Nv(o,{get isVisible(){return z(e)},get width(){return z(t)},get height(){return z(n)},get x(){return z(r)},get y(){return z(i)}})}U(e,i)},$$slots:{default:!0}})},$$slots:{default:!0}});var x=L(y,2);Jv(x,{get proOptions(){return t.proOptions},get position(){return t.attributionPosition}});var S=L(x,2);mv(S,{get store(){return b}}),Fi(L(S,2),()=>t.children??f),U(e,_)},$$slots:{default:!0}}),A()}function ny(e,t){k(t,!0);let n=M(ev({props:{},nodes:[],edges:[]}));at($_,{provider:!0,getStore(){return z(n)},setStore:e=>{N(n,e)}}),Ha(()=>{z(n).reset()});var r=ci();Fi(F(r),()=>t.children??f),U(e,r),A()}var ry=new Set([`$$slots`,`$$events`,`$$legacy`,`target`,`children`]),iy=H(`<div><!></div>`);function ay(e,t){k(t,!0);let n=Y(t,`target`,3,`front`),r=J(t,ry);var i=iy();va(i,e=>({...r,[oa]:{display:e}}),[()=>y_().value?`none`:void 0]),Fi(P(i),()=>t.children??f),O(i),Ri(i,(e,t)=>v_?.(e,t),()=>`viewport-${n()}`),U(e,i),A()}var oy;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(oy||={});var sy=oi(`<circle></circle>`);function cy(e,t){var n=sy();R(()=>{q(n,`cx`,t.radius),q(n,`cy`,t.radius),q(n,`r`,t.radius),Ji(n,0,Hi([`svelte-flow__background-pattern`,`dots`,t.class]))}),U(e,n)}var ly=oi(`<path></path>`);function uy(e,t){k(t,!0);var n=ly();R(()=>{q(n,`stroke-width`,t.lineWidth),q(n,`d`,`M${t.dimensions[0]/2} 0 V${t.dimensions[1]} M0 ${t.dimensions[1]/2} H${t.dimensions[0]}`),Ji(n,0,Hi([`svelte-flow__background-pattern`,t.variant,t.class]))}),U(e,n),A()}var dy={[oy.Dots]:1,[oy.Lines]:1,[oy.Cross]:6},fy=oi(`<svg data-testid="svelte-flow__background"><pattern patternUnits="userSpaceOnUse"><!></pattern><rect x="0" y="0" width="100%" height="100%"></rect></svg>`);function py(e,t){k(t,!0);let n=Y(t,`variant`,19,()=>oy.Dots),r=Y(t,`gap`,3,20),i=Y(t,`lineWidth`,3,1),a=j(Q_),o=j(()=>n()===oy.Dots),s=j(()=>n()===oy.Cross),c=j(()=>Array.isArray(r())?r():[r(),r()]),l=j(()=>`background-pattern-${z(a).flowId}-${t.id??``}`),u=j(()=>[z(c)[0]*z(a).viewport.zoom||1,z(c)[1]*z(a).viewport.zoom||1]),d=j(()=>(t.size??dy[n()])*z(a).viewport.zoom),f=j(()=>z(s)?[z(d),z(d)]:z(u)),p=j(()=>z(o)?[z(d)/2,z(d)/2]:[z(f)[0]/2,z(f)[1]/2]);var m=fy();let h;var g=P(m),_=P(g),v=e=>{{let n=j(()=>z(d)/2);cy(e,{get radius(){return z(n)},get class(){return t.patternClass}})}},y=e=>{uy(e,{get dimensions(){return z(f)},get variant(){return n()},get lineWidth(){return i()},get class(){return t.patternClass}})};G(_,e=>{z(o)?e(v):e(y,-1)}),O(g);var b=L(g);O(m),R(()=>{Ji(m,0,Hi([`svelte-flow__background`,`svelte-flow__container`,t.class])),h=Xi(m,``,h,{"--xy-background-color-props":t.bgColor,"--xy-background-pattern-color-props":t.patternColor}),q(g,`id`,z(l)),q(g,`x`,z(a).viewport.x%z(u)[0]),q(g,`y`,z(a).viewport.y%z(u)[1]),q(g,`width`,z(u)[0]),q(g,`height`,z(u)[1]),q(g,`patternTransform`,`translate(-${z(p)[0]},-${z(p)[1]})`),q(b,`fill`,`url(#${z(l)})`)}),U(e,m),A()}function my(e){let t=j(Q_),n=j(()=>z(t).nodeLookup),r=j(()=>z(t).nodes),i=j(()=>(z(r),z(n).get(e)));return{get current(){return z(i)}}}var hy=oi(`<rect></rect>`);function gy(e,t){k(t,!0);let n=Y(t,`borderRadius`,3,5),r=Y(t,`strokeWidth`,3,2),i=j(()=>my(t.id)),a=j(()=>{if(!z(i).current)return{width:0,height:0,x:0,y:0};let{width:e,height:n}=gh(z(i).current);return{width:t.width??e,height:t.height??n,x:t.x??z(i).current.internals.positionAbsolute.x,y:t.y??z(i).current.internals.positionAbsolute.y}}),o=j(()=>z(a).width),s=j(()=>z(a).height),c=j(()=>z(a).x),l=j(()=>z(a).y);var u=ci(),d=F(u),f=e=>{let i=j(()=>t.nodeComponent);var a=ci();Ii(F(a),()=>z(i),(e,i)=>{i(e,{get id(){return t.id},get x(){return z(c)},get y(){return z(l)},get width(){return z(o)},get height(){return z(s)},get borderRadius(){return n()},get class(){return t.class},get color(){return t.color},get shapeRendering(){return t.shapeRendering},get strokeColor(){return t.strokeColor},get strokeWidth(){return r()},get selected(){return t.selected}})}),U(e,a)},p=e=>{var i=hy();let a,u;R(()=>{a=Ji(i,0,Hi([`svelte-flow__minimap-node`,t.class]),null,a,{selected:t.selected}),q(i,`x`,z(c)),q(i,`y`,z(l)),q(i,`rx`,n()),q(i,`ry`,n()),q(i,`width`,z(o)),q(i,`height`,z(s)),q(i,`shape-rendering`,t.shapeRendering),u=Xi(i,``,u,{fill:t.color,stroke:t.strokeColor,"stroke-width":r()})}),U(e,i)};G(d,e=>{t.nodeComponent?e(f):e(p,-1)}),U(e,u),A()}function _y(e,t){let n=Ig({domNode:e,panZoom:t.panZoom,getTransform:()=>{let{viewport:e}=t.store;return[e.x,e.y,e.zoom]},getViewScale:t.getViewScale});n.update({translateExtent:t.translateExtent,width:t.width,height:t.height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:t.pannable,zoomable:t.zoomable});function r(e){n.update({translateExtent:e.translateExtent,width:e.width,height:e.height,inversePan:e.inversePan,zoomStep:e.zoomStep,pannable:e.pannable,zoomable:e.zoomable})}return{update:r,destroy(){n.destroy()}}}var vy=e=>e instanceof Function?e:()=>e,yy=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`ariaLabel`,`nodeStrokeColor`,`nodeColor`,`nodeClass`,`nodeBorderRadius`,`nodeStrokeWidth`,`nodeComponent`,`bgColor`,`maskColor`,`maskStrokeColor`,`maskStrokeWidth`,`width`,`height`,`pannable`,`zoomable`,`inversePan`,`zoomStep`,`class`]),by=oi(`<title> </title>`),xy=oi(`<svg class="svelte-flow__minimap-svg" role="img"><!><!><path class="svelte-flow__minimap-mask" fill-rule="evenodd" pointer-events="none"></path></svg>`),Sy=H(`<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>`,1);function Cy(e,t){k(t,!0);let n=Y(t,`position`,3,`bottom-right`),r=Y(t,`nodeStrokeColor`,3,`transparent`),i=Y(t,`nodeClass`,3,``),a=Y(t,`nodeBorderRadius`,3,5),o=Y(t,`nodeStrokeWidth`,3,2),s=Y(t,`width`,3,200),c=Y(t,`height`,3,150),l=Y(t,`pannable`,3,!0),u=Y(t,`zoomable`,3,!0),d=J(t,yy),f=j(Q_),p=j(()=>z(f).ariaLabelConfig),m=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`,h=j(()=>`svelte-flow__minimap-desc-${z(f).flowId}`),g=j(()=>({x:-z(f).viewport.x/z(f).viewport.zoom,y:-z(f).viewport.y/z(f).viewport.zoom,width:z(f).width/z(f).viewport.zoom,height:z(f).height/z(f).viewport.zoom})),_=j(()=>z(f).nodes.some(e=>!e.hidden)),v=j(()=>z(_)?th(Rm(z(f).nodeLookup,{filter:e=>!e.hidden}),z(g)):z(g)),y=j(()=>z(v).width/s()),b=j(()=>z(v).height/c()),x=j(()=>Math.max(z(y),z(b))),S=j(()=>z(x)*s()),C=j(()=>z(x)*c()),w=j(()=>5*z(x)),ee=j(()=>z(v).x-(z(S)-z(v).width)/2-z(w)),T=j(()=>z(v).y-(z(C)-z(v).height)/2-z(w)),te=j(()=>z(S)+z(w)*2),E=j(()=>z(C)+z(w)*2),ne=()=>z(x);var re=Sy(),ie=F(re);{let e=j(()=>[`svelte-flow__minimap`,t.class]);Ti(ie,()=>({"--xy-minimap-background-color-props":t.bgColor})),Kv(ie.lastChild,Ba({get position(){return n()},get class(){return z(e)},"data-testid":`svelte-flow__minimap`},()=>d,{children:(e,n)=>{var d=ci(),_=F(d),v=e=>{var n=xy();let d;var _=P(n),v=e=>{var n=by(),r=I(n,!0);R(()=>{q(n,`id`,z(h)),W(r,t.ariaLabel??z(p)[`minimap.ariaLabel`])}),U(e,n)};G(_,e=>{(t.ariaLabel??z(p)[`minimap.ariaLabel`])&&e(v)});var y=L(_);K(y,17,()=>z(f).nodes,e=>e.id,(e,n)=>{let s=j(()=>z(f).nodeLookup.get(z(n).id));var c=ci(),l=F(c),u=e=>{{let c=j(()=>t.nodeColor===void 0?void 0:vy(t.nodeColor)(z(n))),l=j(()=>vy(r())(z(n))),u=j(()=>vy(i())(z(n)));gy(e,{get id(){return z(s).id},get selected(){return z(s).selected},get nodeComponent(){return t.nodeComponent},get color(){return z(c)},get borderRadius(){return a()},get strokeColor(){return z(l)},get strokeWidth(){return o()},get shapeRendering(){return m},get class(){return z(u)}})}},d=j(()=>z(s)&&_h(z(s))&&!z(s).hidden);G(l,e=>{z(d)&&e(u)}),U(e,c)});var b=L(y);O(n),Ri(n,(e,t)=>_y?.(e,t),()=>({store:z(f),panZoom:z(f).panZoom,getViewScale:ne,translateExtent:z(f).translateExtent,width:z(f).width,height:z(f).height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:l(),zoomable:u()})),R(()=>{q(n,`width`,s()),q(n,`height`,c()),q(n,`viewBox`,`${z(ee)??``} ${z(T)??``} ${z(te)??``} ${z(E)??``}`),q(n,`aria-labelledby`,z(h)),d=Xi(n,``,d,{"--xy-minimap-mask-background-color-props":t.maskColor,"--xy-minimap-mask-stroke-color-props":t.maskStrokeColor,"--xy-minimap-mask-stroke-width-props":t.maskStrokeWidth?t.maskStrokeWidth*z(x):void 0}),q(b,`d`,`M${z(ee)-z(w)},${z(T)-z(w)}h${z(te)+z(w)*2}v${z(E)+z(w)*2}h${-z(te)-z(w)*2}z
|
|
6
|
+
M${z(g).x??``},${z(g).y??``}h${z(g).width??``}v${z(g).height??``}h${-z(g).width}z`)}),U(e,n)};G(_,e=>{z(f).panZoom&&e(v)}),U(e,d)},$$slots:{default:!0}})),O(ie)}U(e,re),A()}var wy=new Set([`$$slots`,`$$events`,`$$legacy`,`nodeId`,`position`,`align`,`offset`,`isVisible`,`children`]),Ty=H(`<div><!></div>`);function Ey(e,t){k(t,!0);let n=Y(t,`position`,19,()=>jm.Top),r=Y(t,`align`,3,`center`),i=Y(t,`offset`,3,10),a=J(t,wy),o=Q_(),{getNodesBounds:s}=Rv(),c=t_(),l=j(()=>(o.nodes,(Array.isArray(t.nodeId)?t.nodeId:[t.nodeId??c]).reduce((e,t)=>{if(!t)throw Error(`Either pass a nodeId or use within a Custom Node component`);let n=o.nodeLookup.get(t);return n&&e.push(n),e},[]))),u=j(()=>{let e=s(z(l));return e?tg(e,o.viewport,n(),i(),r()):``}),d=j(()=>z(l).length===0?1:Math.max(...z(l).map(e=>(e.internals.z||5)+1))),p=j(()=>o.nodes.filter(e=>e.selected).length),m=j(()=>typeof t.isVisible==`boolean`?t.isVisible:z(l).length===1&&z(l)[0].selected&&z(p)===1);var h=ci(),g=F(h),_=e=>{var n=Ty();va(n,(e,t)=>({class:`svelte-flow__node-toolbar`,"data-id":e,...a,[oa]:{display:t,position:`absolute`,transform:z(u),"z-index":z(d)}}),[()=>z(l).reduce((e,t)=>`${e}${t.id} `,``).trim(),()=>y_().value?`none`:void 0]),Fi(P(n),()=>t.children??f),O(n),Ri(n,(e,t)=>v_?.(e,t),()=>`root`),U(e,n)};G(g,e=>{o.domNode&&z(m)&&z(l)&&e(_)}),U(e,h),A()}function Dy(){let e=j(Q_);return{get current(){return z(e).viewport},set current(t){z(e).viewport=t},update(t){z(e).viewport=t(z(e).viewport)},set(t){z(e).viewport=t}}}var Oy=new Set([`$$slots`,`$$events`,`$$legacy`]);function ky(e,t){let n=J(t,Oy),r={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`}],[`path`,{d:`M15 8V2`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`}],[`path`,{d:`M9 8V2`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Ay=new class{#e=M(!1);get open(){return z(this.#e)}set open(e){N(this.#e,e,!0)}#t=M(pn({}));#n=M(!1);#r=new Set;#i=!1;#a=``;#o=j(()=>[...Q.status?.messages??[]].reverse().map(e=>({...e,answered:z(this.#t)[e.id]??e.answered??null})).filter(e=>!z(this.#n)||e.kind===`question`&&!e.answered));get messages(){return z(this.#o)}set messages(e){N(this.#o,e)}#s=j(()=>this.messages.find(e=>e.kind===`question`&&e.choices?.length&&!e.answered));get question(){return z(this.#s)}set question(e){N(this.#s,e)}follow(){if(Q.status){for(let e of this.messages)this.#r.has(e.id)||(this.#r.add(e.id),this.#i&&(e.kind===`question`&&!e.answered?this.open=!0:e.from===`koppler`&&!e.answered?(this.open=!0,this.#a=e.id):$.show(`Agent: ${e.title}`,e.kind===`failure`?`warning`:`message`,{label:`Open`,run:()=>this.open=!0})));this.#i=!0,this.#a&&this.messages.find(e=>e.id===this.#a)?.answered&&(this.#a=``,this.question||(this.open=!1)),z(this.#n)&&!(Q.status.messages??[]).some(e=>!(e.kind===`question`&&!e.answered))&&N(this.#n,!1)}}async answer(e,t){let n=e.choices?.find(e=>e.id===t.choice),r=n?`${n.label}${t.text?`. ${t.text}`:``}`:t.text??``,i=await Js(`prompt`,{tag:`koppler-reply`,text:`Answer to your question "${e.title}"${e.run?` (run ${e.run})`:``}: ${r}`,data:{message:e.id,...t}});i?.ok?(z(this.#t)[e.id]={at:new Date().toISOString(),...t,via:`canvas`},(Q.status?.agent?.state??`none`)===`none`&&$.show(`Answer saved. The agent gets it when one connects.`)):$.show(i?.status===409?`That question was already answered.`:`Could not send the answer.`,`warning`)}async dismiss(e){let t=await Js(`message-dismiss`,{id:e.id});!t?.ok&&t?.status!==409?$.show(`Could not dismiss it.`,`warning`):z(this.#t)[e.id]={at:new Date().toISOString(),via:`dismissed`}}get waiting(){return[...Q.status?.waiting??[]].reverse().filter(e=>!z(this.#c).includes(e.key))}#c=M(pn([]));async drop(e){let t=await Js(`prompt-drop`,{key:e});t?.ok||t?.status===409?N(this.#c,[...z(this.#c),e],!0):$.show(`Could not drop it.`,`warning`)}async clear(){(await Js(`messages-clear`,{}))?.ok?(N(this.#n,!0),this.question&&$.show(`Cleared. The open question stays.`)):$.show(`Could not clear the messages.`,`warning`)}},jy=H(`<button class="how svelte-ssy1qy" type="button" aria-label="How to connect an agent" title="How to connect an agent" aria-haspopup="dialog"><!></button>`),My=H(`<button class="agent svelte-ssy1qy" type="button"><span class="dot svelte-ssy1qy" aria-hidden="true"></span><span class="words svelte-ssy1qy"> </span></button> <!> <div class="connect svelte-ssy1qy" popover="" role="dialog"><h2 class="svelte-ssy1qy">Connect an agent</h2> <p class="svelte-ssy1qy">Koppler starts and stops a confirmed run by itself. The agent is needed for what it cannot do alone: manual
|
|
7
|
+
checklists, notes, fixing a failed start, and anything a run leaves over.</p> <ol class="svelte-ssy1qy"><li class="svelte-ssy1qy">Open your agent session in this project</li> <li class="svelte-ssy1qy">Run this command there <!></li> <li class="svelte-ssy1qy">The dot turns green once it listens<small class="svelte-ssy1qy">Anything sent meanwhile waits for it.</small></li></ol></div>`,1);function Ny(e,t){let n=li();k(t,!0);let r={listening:[`Agent connected`,`An agent session is listening: notes, checklists and fix requests reach it right away.`],busy:[`Agent working`,`The connected agent is working on a request; the next one waits for it.`],question:[`Agent needs you`,`The agent asked something about your run. Click to answer.`],quiet:[`Agent quiet`,`It took a request and has neither finished it nor listened again since. If its session is done, run /koppler-run connect there; press ↻ for the steps.`],none:[`No agent listening`,`Runs work without one. Notes, checklists and fix requests wait until an agent connects; press ↻ to see how.`]},i=M(void 0),a=M(void 0),o=M(!1),s=j(()=>{let e=Date.parse(Q.status?.agent?.busy??``);return Number.isNaN(e)||!Q.status?0:Math.floor((Date.now()-e)/6e4)}),c=j(()=>Q.status?.agent?.state??`none`),l=j(()=>z(c)===`busy`&&z(s)*6e4>=6e5?`quiet`:z(c)),u=j(()=>Ay.question?`question`:z(l)),d=j(()=>r[z(u)]??r.none??[``,``]),f=j(()=>v(z(d),2)),p=j(()=>z(f)[0]),m=j(()=>z(f)[1]),h=j(()=>Q.status?.queued??0),g=j(()=>z(h)>0&&z(u)!==`listening`),_=j(()=>z(u)===`none`&&!z(h)?`off`:z(u)),y=j(()=>({listening:`Agent`,busy:z(s)?`Agent working, ${String(z(s))} min`:`Agent working`,quiet:`Agent quiet, ${String(z(s))} min`,none:z(h)?z(p):`No agent`}[z(u)]??z(p))+(z(g)?`, ${String(z(h))} waiting`:``)),b=j(()=>`${z(p)}. ${z(m)}${z(g)?` ${String(z(h))} ${z(h)===1?`request waits`:`requests wait`} for it; only the newest run or Stop is handed over.`:``}`),x=()=>{let e=z(i)?.getBoundingClientRect();e&&z(a)&&(z(a).style.top=`${String(e.bottom+6)}px`,z(a).style.right=`${String(Math.max(12,innerWidth-e.right))}px`)};In(()=>{(z(l)===`listening`||z(l)===`busy`)&&z(o)&&z(a)?.hidePopover()});var S=ci(),C=F(S),w=e=>{var t=My(),r=F(t),s=I(L(P(r)),!0);O(r);var c=L(r,2),u=e=>{var t=jy();X(P(t),{get of(){return ky},size:15}),O(t),Ma(t,e=>N(i,e),()=>z(i)),R(()=>{q(t,`aria-expanded`,z(o)),q(t,`popovertarget`,n)}),U(e,t)};G(c,e=>{(z(l)===`none`||z(l)===`quiet`)&&e(u)});var d=L(c,2),f=P(d),p=L(f,4),m=L(P(p),2);Lc(L(P(m)),{command:`/koppler-run connect`}),O(m),je(2),O(p),O(d),Ma(d,e=>N(a,e),()=>z(a)),R(()=>{q(r,`data-state`,z(_)),q(r,`title`,z(b)),q(r,`aria-expanded`,Ay.open),W(s,z(y)),q(d,`id`,n),q(d,`aria-labelledby`,`${n}-title`),q(f,`id`,`${n}-title`)}),V(`click`,r,()=>Ay.open=!Ay.open),B(`toggle`,d,e=>{N(o,e.newState===`open`),z(o)&&x()}),U(e,t)};G(C,e=>{Q.status&&e(w)}),U(e,S),A()}Zr([`click`]);var Py=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fy(e,t){let n=J(t,Py),r={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Iy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ly(e,t){let n=J(t,Iy),r={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Ry=new Set([`$$slots`,`$$events`,`$$legacy`]);function zy(e,t){let n=J(t,Ry),r={name:`hand`,size:24,node:[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var By=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vy(e,t){let n=J(t,By),r={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Hy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uy(e,t){let n=J(t,Hy),r={name:`minimize`,size:24,node:[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Wy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gy(e,t){let n=J(t,Wy),r={name:`mouse-pointer-2`,size:24,node:[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Ky=new Set([`$$slots`,`$$events`,`$$legacy`]);function qy(e,t){let n=J(t,Ky),r={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Jy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yy(e,t){let n=J(t,Jy),r={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Xy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zy(e,t){let n=J(t,Xy),r={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Qy=new Set([`$$slots`,`$$events`,`$$legacy`]);function $y(e,t){let n=J(t,Qy),r={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`}],[`path`,{d:`m18.586 13.414-5.172 5.172`}],[`path`,{d:`M6 12h12`}],[`circle`,{cx:`12`,cy:`20`,r:`2`}],[`circle`,{cx:`12`,cy:`4`,r:`2`}],[`circle`,{cx:`20`,cy:`12`,r:`2`}],[`circle`,{cx:`4`,cy:`12`,r:`2`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var eb=new Set([`$$slots`,`$$events`,`$$legacy`]);function tb(e,t){let n=J(t,eb),r={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var nb=new Set([`$$slots`,`$$events`,`$$legacy`]);function rb(e,t){let n=J(t,nb),r={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`}],[`circle`,{cx:`9`,cy:`5`,r:`1`}],[`circle`,{cx:`9`,cy:`19`,r:`1`}],[`circle`,{cx:`15`,cy:`12`,r:`1`}],[`circle`,{cx:`15`,cy:`5`,r:`1`}],[`circle`,{cx:`15`,cy:`19`,r:`1`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var ib=new Set([`$$slots`,`$$events`,`$$legacy`]);function ab(e,t){let n=J(t,ib),r={name:`logs`,size:24,node:[[`path`,{d:`M3 5h1`}],[`path`,{d:`M3 12h1`}],[`path`,{d:`M3 19h1`}],[`path`,{d:`M8 5h1`}],[`path`,{d:`M8 12h1`}],[`path`,{d:`M8 19h1`}],[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var ob=new Set([`$$slots`,`$$events`,`$$legacy`]);function sb(e,t){let n=J(t,ob),r={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var cb=H(`<span class="tag svelte-1ypd2at">current</span>`),lb=H(`<span class="tag svelte-1ypd2at">picked</span>`),ub=H(`<li role="option" class="svelte-1ypd2at"><span class="name svelte-1ypd2at"> </span> <!></li>`),db=H(`<li class="note svelte-1ypd2at" role="presentation"> </li>`),fb=H(`<input class="mono svelte-1ypd2at" role="combobox" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="current branch"/> <ul class="nodrag nopan nowheel svelte-1ypd2at" role="listbox" popover="manual"><!> <!></ul>`,1);function pb(e,t){let n=li();k(t,!0);let r=Y(t,`label`,3,`Branch`),i=M(void 0),a=M(void 0),o=M(!1),s=M(``),c=M(0),l=``,u=j(()=>z(s)?t.branches.filter(e=>e.toLowerCase().includes(z(s).toLowerCase())):t.branches),d=j(()=>z(u).slice(0,80)),f=(e,t)=>{let n=z(i)?.getBoundingClientRect();if(!n||!z(a))return;z(a).style.left=`${String(n.left)}px`,z(a).style.minWidth=`${String(Math.max(n.width,280))}px`,z(a).style.maxWidth=`${String(Math.max(280,Math.min(560,innerWidth-n.left-12)))}px`;let r=n.bottom+4;z(a).style.top=`${String(r+z(a).offsetHeight>innerHeight-8?Math.max(8,n.top-4-z(a).offsetHeight):r)}px`,t&&z(a).children[e]?.scrollIntoView({block:`nearest`})};In(()=>{z(o)&&f(z(c),z(d).length)});let p=()=>{!z(o)&&z(i)&&(l=z(i).value,N(s,``),N(c,Math.max(0,z(d).indexOf(t.value||t.current)),!0),N(o,!0),z(i).select(),z(a)?.showPopover())},m=()=>{z(o)&&(N(o,!1),z(a)?.hidePopover())},h=e=>{let n=e.trim();!n&&z(i)&&(z(i).value=t.current),n!==(t.value||t.current)&&t.onpick(n===t.current?``:n)},g=e=>{z(i)&&(z(i).value=e),h(e),m(),z(i)?.blur()},_=e=>{if(!z(o))e.key===`ArrowDown`&&p();else if((e.key===`ArrowDown`||e.key===`ArrowUp`)&&z(d).length)e.preventDefault(),N(c,(z(c)+(e.key===`ArrowDown`?1:-1)+z(d).length)%z(d).length);else if(e.key===`Enter`){e.preventDefault();let t=z(d)[z(c)];t?g(t):z(i)?.blur()}else e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),z(i)&&(z(i).value=l),m(),z(i)?.blur())};var v=fb(),y=F(v);ma(y),Ma(y,e=>N(i,e),()=>z(i));var b=L(y,2),x=P(b);K(x,18,()=>z(d),e=>e,(e,r,i)=>{var a=ub(),o=P(a),s=I(o,!0),l=L(o,2),u=e=>{U(e,cb())},d=e=>{U(e,lb())};G(l,e=>{r===t.current?e(u):r===t.value&&e(d,1)}),O(a),R(()=>{q(a,`id`,`${n}-${z(i)??``}`),q(a,`aria-selected`,z(i)===z(c)),q(a,`title`,r),W(s,r)}),B(`pointerenter`,a,()=>N(c,z(i),!0)),V(`click`,a,e=>{e.preventDefault(),g(r)}),U(e,a)});var S=L(x,2),C=e=>{var t=db(),n=I(t);R(()=>W(n,`${z(u).length-z(d).length} more, keep typing`)),U(e,t)},w=e=>{var n=db(),r=I(n,!0);R(()=>W(r,t.branches.length?`No branch matches. Enter keeps "${z(s)}".`:`No branches found. Run koppler sync.`)),U(e,n)};G(S,e=>{z(u).length>z(d).length?e(C):z(u).length||e(w,1)}),O(b),Ma(b,e=>N(a,e),()=>z(a)),R(e=>{q(y,`aria-label`,r()),q(y,`aria-expanded`,z(o)),q(y,`aria-controls`,`${n}-list`),q(y,`aria-activedescendant`,e),q(y,`title`,t.title),ha(y,t.value||t.current),q(b,`id`,`${n}-list`)},[()=>z(o)&&z(d).length?`${n}-${String(z(c))}`:void 0]),V(`click`,y,p),B(`blur`,y,e=>{h(e.currentTarget.value),m()}),V(`input`,y,e=>{p(),N(s,e.currentTarget.value.trim(),!0),N(c,0)}),V(`keydown`,y,_),V(`pointerdown`,b,e=>{e.preventDefault()}),U(e,v),A()}Zr([`click`,`input`,`keydown`,`pointerdown`]);var mb=H(`<label class="field svelte-1kkgx5y">Branch <!></label>`),hb=H(`<label class="svelte-1kkgx5y"><input type="radio"/> </label>`),gb=H(`<div class="field svelte-1kkgx5y" role="radiogroup"> <span class="seg svelte-1kkgx5y"></span></div>`),_b=H(`<div class="field svelte-1kkgx5y" role="group" aria-label="Who starts it">Started by <span class="seg svelte-1kkgx5y"></span></div>`),vb=H(`<option> </option>`),yb=H(`<label class="field svelte-1kkgx5y">Platform <span class="combo svelte-1kkgx5y"><select class="mono svelte-1kkgx5y"></select></span></label>`),bb=H(`<div class="field svelte-1kkgx5y">Tunnels <label class="toggle svelte-1kkgx5y"><input type="checkbox" role="switch"/><span class="track" aria-hidden="true"></span> </label></div>`),xb=H(`<button class="link svelte-1kkgx5y" type="button"> </button>`),Sb=H(`<div class="field svelte-1kkgx5y">Queues <label class="toggle svelte-1kkgx5y"><input type="checkbox" role="switch"/><span class="track" aria-hidden="true"></span> </label> <!></div>`),Cb=H(`<div class="row svelte-1kkgx5y"><!> <!> <!> <!></div>`),wb=H(`<label class="toggle svelte-1kkgx5y"><input type="checkbox" role="switch"/><span class="track" aria-hidden="true"></span> </label>`),Tb=H(`<div class="field svelte-1kkgx5y">Libraries <!></div>`),Eb=H(`<optgroup label="Call a local app"></optgroup>`),Db=H(`<optgroup label="Remove the cable to"></optgroup>`),Ob=H(`<label class="field svelte-1kkgx5y">Note for the agent <textarea rows="2" placeholder="e.g. run with the new pricing flag on" class="svelte-1kkgx5y"></textarea></label>`),kb=H(`<button class="note-toggle svelte-1kkgx5y" type="button">Add a note for the agent</button>`),Ab=H(`<label class="field svelte-1kkgx5y">Cables <span class="combo svelte-1kkgx5y"><select class="svelte-1kkgx5y"><option>Add or remove…</option><!><!></select></span></label> <!>`,1),jb=H(`<div class="body svelte-1kkgx5y"><!> <!> <!> <!> <!></div>`);function Mb(e,t){k(t,!0);let n=[[`set-aside`,`Set aside`,`Kept aside while it runs the other branch, back on Stop`],[`take-along`,`Take along`,`Carried to the other branch, and back on Stop`]],r=j(()=>Z.nodes.find(e=>e.id===t.id)?.data),i=j(()=>Z.app(t.id)),a=j(()=>z(i)?.current||`current branch`),o=j(()=>`${String(z(i)?.dirty??0)} uncommitted ${z(i)?.dirty===1?`change`:`changes`}`),s=j(()=>(z(i)?.runIn??[]).map(([e])=>e).filter(e=>Object.hasOwn(Qs,e))),c=j(()=>z(s).length>1),l=j(()=>z(r)?.run===`mock`),u=j(()=>Z.tunnelsOf(t.id)),d=j(()=>Z.queuesOf(t.id)),f=j(()=>z(d).filter(e=>Z.hiddenQueues[e])),p=j(()=>z(d).length>0&&!z(r)?.showQueues),m=j(()=>Z.localLibraries(t.id)),h=(e,n)=>{Z.set(t.id,{libraries:n?[...z(m),e]:z(m).filter(t=>t!==e)})},g=j(()=>!!z(i)?.platforms.length&&z(r)?.run===`cli`),_=M(pn({can:[],wired:[]})),y=M(!1),b=e=>{let n=e.currentTarget,[r,i]=[n.value[0],n.value.slice(1)];r===`+`?Z.connect(t.id,i):r===`-`&&Z.cut(t.id,i),n.value=``},x=e=>e.target.closest(`select, textarea, input:not([type="radio"], [type="checkbox"])`),S=e=>{let t=x(e);t===document.activeElement?e.stopPropagation():t&&e.preventDefault()},C=e=>{let t=x(e);t&&t!==document.activeElement&&(t.focus(),t instanceof HTMLSelectElement&&t.showPicker())},w=e=>{e.style.height=`auto`,e.style.height=`${String(e.scrollHeight+2)}px`};var ee=ci(),T=F(ee),te=e=>{var x=jb(),ee=P(x),T=e=>{var n=mb(),a=L(P(n));{let e=j(()=>z(i)?.current??``),n=j(()=>z(i)?.branches??[]),s=j(()=>z(i)?.dirty&&!Z.switchesOver(t.id)?`Runs with your ${z(o)}`:void 0);pb(a,{get value(){return z(r).branch},get current(){return z(e)},get branches(){return z(n)},get title(){return z(s)},onpick:e=>{Z.set(t.id,{branch:e})}})}O(n),U(e,n)};G(ee,e=>{z(l)||e(T)});var te=L(ee,2),E=e=>{var i=gb(),s=P(i),c=L(s);K(c,21,()=>n,([e,t,n])=>e,(e,n)=>{var i=j(()=>v(z(n),3));let a=()=>z(i)[0],o=()=>z(i)[1],s=()=>z(i)[2];var c=hb(),l=P(c);ma(l);var u=L(l,1,!0);O(c),R(()=>{q(c,`title`,s()),q(l,`name`,`changes-${t.id??``}`),ha(l,a()),ga(l,(z(r).changes??`set-aside`)===a()),W(u,o())}),V(`change`,l,()=>{Z.set(t.id,{changes:a()})}),U(e,c)}),O(c),O(i),R(()=>{q(i,`aria-label`,`Your ${z(o)??``} on ${z(a)??``}`),q(i,`title`,`Your ${z(o)??``} on ${z(a)??``}: set aside while it runs the other branch, or taken along. Back on Stop either way.`),W(s,`${z(o)??``} `)}),U(e,i)},ne=j(()=>Z.switchesOver(t.id));G(te,e=>{z(ne)&&e(E)});var re=L(te,2),ie=e=>{var n=Cb(),a=P(n),o=e=>{var n=_b(),i=L(P(n));K(i,20,()=>z(s),e=>e,(e,n)=>{var i=hb(),a=P(i);ma(a);var o=L(a,1,!0);O(i),R(()=>{q(a,`name`,`run-${t.id??``}`),ha(a,n),ga(a,z(r).run===n),W(o,Qs[n])}),V(`change`,a,()=>{Z.set(t.id,{run:n})}),U(e,i)}),O(i),O(n),R(e=>q(n,`title`,`Koppler: the agent starts it. Me: you start it yourself (IDE, terminal, anything); the agent only prepares it.${e??``}`),[()=>z(s).includes(`mock`)?` Mock: Koppler answers its mock responses from the stack in its place.`:``]),U(e,n)};G(a,e=>{z(c)&&e(o)});var l=L(a,2),m=e=>{var n=yb(),a=L(P(n)),o=P(a);K(o,21,()=>z(i)?.platforms??[],([e,t])=>e,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1];var a=vb(),o=I(a,!0),s={};R(()=>{W(o,i()),s!==(s=r())&&(a.value=(a.__value=s)??``)}),U(e,a)}),O(o);var s;ta(o),O(a),O(n),R(()=>{s!==(s=z(r).platform)&&(o.value=(o.__value=s)??``,ea(o,s))}),V(`change`,o,e=>{Z.set(t.id,{platform:e.currentTarget.value})}),U(e,n)};G(l,e=>{z(g)&&e(m)});var h=L(l,2),_=e=>{var n=bb(),i=L(P(n)),a=P(i);ma(a);var o=L(a,2,!0);O(i),O(n),R(()=>{q(i,`title`,z(r).hideTunnels?`Off: only the API runs; calls through its tunnels fail.`:`On: Koppler opens its tunnels. Turn off when you only need the API.`),q(a,`aria-label`,`Open ${z(r).name??``}'s tunnels`),ga(a,!z(r).hideTunnels),W(o,z(r).hideTunnels?`Off`:`On`)}),V(`change`,a,e=>{Z.set(t.id,{hideTunnels:!e.currentTarget.checked})}),U(e,n)};G(h,e=>{z(u).length&&e(_)});var y=L(h,2),b=e=>{var n=Sb(),i=L(P(n)),a=P(i);ma(a);var o=L(a,2,!0);O(i);var s=L(i,2),c=e=>{var t=xb(),n=I(t);R(()=>W(n,`Show ${z(f).length??``} hidden`)),V(`click`,t,()=>{Z.showQueues(z(d),!0)}),U(e,t)};G(s,e=>{z(f).length&&!z(p)&&e(c)}),O(n),R(()=>{q(i,`title`,z(p)?`Off: it is taken off its queues and keeps the deployed ones. A queue another app uses stays on the board for that app.`:`On: its queues show on the board, where each can be switched to a local copy.`),q(a,`aria-label`,`Show ${z(r).name??``}'s queues`),ga(a,!z(p)),W(o,z(p)?`Off`:`On`)}),V(`change`,a,e=>{Z.set(t.id,{showQueues:e.currentTarget.checked})}),U(e,n)};G(y,e=>{z(d).length&&e(b)}),O(n),U(e,n)};G(re,e=>{(z(c)||z(u).length||z(d).length)&&e(ie)});var ae=L(re,2),oe=e=>{var t=Tb();K(L(P(t)),17,()=>z(i).libraries,e=>e.name,(e,t)=>{let n=j(()=>z(m).includes(z(t).name));var i=wb(),a=P(i);ma(a);var o=L(a,2,!0);O(i),R(e=>{q(i,`title`,e),q(a,`aria-label`,`Use the local ${z(t).name??``}`),ga(a,z(n)),W(o,z(t).name)},[()=>z(n)?`On: ${z(r).name} uses your local copy in ${z(t).path.replace(/^\/Users\/[^/]+/,`~`)}`:`Off: ${z(r).name} uses the published ${z(t).name}`]),V(`change`,a,e=>{h(z(t).name,e.currentTarget.checked)}),U(e,i)}),O(t),U(e,t)};G(ae,e=>{z(i)?.libraries.length&&!z(l)&&e(oe)});var se=L(ae,2),ce=e=>{var n=Ab(),i=F(n),a=L(P(i)),o=P(a),s=P(o);s.value=s.__value=``;var c=L(s),l=e=>{var t=Eb();K(t,21,()=>z(_).can,e=>e.id,(e,t)=>{var n=vb(),r=I(n,!0),i={};R(()=>{W(r,z(t).name),i!==(i=`+${z(t).id??``}`)&&(n.value=n.__value=i)}),U(e,n)}),O(t),U(e,t)};G(c,e=>{z(_).can.length&&e(l)});var u=L(c),d=e=>{var t=Db();K(t,21,()=>z(_).wired,e=>e.id,(e,t)=>{var n=vb(),r=I(n,!0),i={};R(()=>{W(r,z(t).name),i!==(i=`-${z(t).id??``}`)&&(n.value=n.__value=i)}),U(e,n)}),O(t),U(e,t)};G(u,e=>{z(_).wired.length&&e(d)}),O(o),O(a),O(i);var f=L(i,2),p=e=>{var n=Ob(),i=L(P(n));vt(i),zi(i,()=>w),O(n),R(()=>ha(i,z(r).note)),V(`input`,i,e=>{w(e.currentTarget),Z.set(t.id,{note:e.currentTarget.value})}),B(`blur`,i,()=>N(y,!1)),U(e,n)},m=e=>{var t=kb();V(`click`,t,()=>N(y,!0)),U(e,t)};G(f,e=>{z(r).note||z(y)?e(p):e(m,-1)}),R(()=>q(o,`aria-label`,`Add or remove a cable from ${z(r).name??``}`)),B(`focus`,o,()=>N(_,Z.cablesOf(t.id),!0)),V(`pointerdown`,o,()=>N(_,Z.cablesOf(t.id),!0)),V(`change`,o,b),U(e,n)};G(se,e=>{z(l)||e(ce)}),O(x),B(`mousedown`,x,S,!0),V(`click`,x,C),U(e,x)};G(T,e=>{z(r)&&e(te)}),U(e,ee),A()}Zr([`click`,`change`,`pointerdown`,`input`]);var Nb=(e,t)=>document.elementsFromPoint(e,t).find(e=>e.classList.contains(`svelte-flow__node`))?.getAttribute(`data-id`)??void 0,Pb=new class{#e=M(null);get draft(){return z(this.#e)}set draft(e){N(this.#e,e)}#t=M(null);get grabbed(){return z(this.#t)}set grabbed(e){N(this.#t,e)}#n=M(null);get drop(){return z(this.#n)}set drop(e){N(this.#n,e)}endPoint(e,t){let n=Z.cables[e],r=n&&Z.boxes.get(n[t]);if(!r)return;let i=n[`${t}Side`],a=Ho(r,i),o=Z.ends.offset[`${String(e)}|${t}`]??0;return Lo[i][0]===0?{...a,x:a.x+o}:{...a,y:a.y+o}}nearestSide(e,t){let n=n=>Math.hypot(Ho(e,n).x-t.x,Ho(e,n).y-t.y);return Object.keys(Lo).reduce((e,t)=>n(t)<n(e)?t:e)}start(e,t){let n=Z.boxes.get(e);if(!n)return;let r=Ho(n,t),i=[],a=e=>Z.toFlow({x:e.clientX,y:e.clientY}),o=t=>{let n=Nb(t.clientX,t.clientY),o=n&&n!==e?Z.boxes.get(n):void 0;if(!n||!o)return;let s=a(t);return{id:n,side:Object.keys(Lo).find(e=>Math.hypot(Ho(o,e).x-s.x,Ho(o,e).y-s.y)<=16/Z.zoom())??this.nearestSide(o,i.at(-1)??r),at:o}},s=e=>Z.app(e),c=(e,t)=>!!s(e)?.calls.includes(t),l=t=>!s(e)?.outside&&!!s(t)&&!s(t)?.outside&&!!s(t)?.answers,u=t=>!c(e,t)&&c(t,e),d=e=>{let n=o(e),s=!!n&&l(n.id)&&!u(n.id);this.draft={a:r,side:t,b:n&&s?Ho(n.at,n.side):a(e),bSide:n&&s?n.side:null,points:[...i]},this.drop=n?{id:n.id,ok:s}:null},f=()=>{removeEventListener(`pointermove`,d),removeEventListener(`pointerdown`,m,!0),removeEventListener(`keydown`,h,!0),this.draft=this.drop=null},p=n=>{let r=o(n);if(f(),!r)return;let[a,c]=[s(e)?.name??e,s(r.id)?.name??r.id];if(!l(r.id)){let e=s(r.id)?.answers?`${a} doesn't call ${c}`:`${c} is a ${s(r.id)?.kindLabel??``} app: it calls others, nothing calls it.`;$.show(e,`warning`);return}if(u(r.id)){let t=Z.edges.some(t=>t.id===`${r.id}>${e}`);$.show(`In the code ${c} calls ${a}, not the other way round.${t?` That cable is already on the board.`:``}`,`warning`,t?void 0:{label:`Connect that way`,run:()=>{Z.connect(r.id,e)}});return}let d=cc(e,r.id,{fromSide:t,toSide:r.side,...i.length&&{points:i}});Z.edges=[...Z.edges.filter(e=>e.id!==d.id),d]},m=e=>{if(e.button===0){e.preventDefault(),e.stopPropagation();for(let e of[`mousedown`,`click`])addEventListener(e,e=>{e.stopPropagation()},{capture:!0,once:!0});Nb(e.clientX,e.clientY)?p(e):e.target.closest(`.svelte-flow__panel, button`)?f():(i.push(a(e)),d(e))}},h=e=>{e.key===`Escape`&&(e.preventDefault(),f())};addEventListener(`pointermove`,d),addEventListener(`pointerup`,e=>{let t=a(e),n=Math.hypot(t.x-r.x,t.y-r.y)>24/Z.zoom();Nb(e.clientX,e.clientY)||!n?p(e):(i.push(t),d(e),addEventListener(`pointerdown`,m,!0),addEventListener(`keydown`,h,!0))},{once:!0})}grabEnd(e,t,n){let r=Z.edges.find(e=>e.id===t);if(e.button!==0||!r||Z.live)return;e.preventDefault(),e.stopPropagation();let i=n===`from`?r.source:r.target,a=r.data[`${n}Side`],o=Lo[a][0]===0?`x`:`y`,s=Z.toFlow({x:e.clientX,y:e.clientY}),c=()=>Z.edges.flatMap((e,t)=>{let n=e.source===i&&e.data.fromSide===a?`from`:e.target===i&&e.data.toSide===a?`to`:null;return n?[{edge:e,index:t,end:n}]:[]}).sort((e,t)=>(e.edge.data[`${e.end}Slot`]??1/0)-(t.edge.data[`${t.end}Slot`]??1/0)||e.index-t.index),l=null,u=()=>{removeEventListener(`pointermove`,d),removeEventListener(`pointerup`,u),this.grabbed=null},d=e=>{let r=Z.toFlow({x:e.clientX,y:e.clientY}),d=r[o]-s[o],f=o===`x`?r.y-s.y:r.x-s.x;if(!l){if(Math.hypot(d,f)<6/Z.zoom())return;if(l=Math.abs(f)>Math.abs(d)?`wire`:`order`,l===`wire`){u(),this.start(i,a);return}this.grabbed={id:t,end:n}}let p=c(),m=p.find(e=>e.edge.id===t&&e.end===n);if(!m||p.length<2)return;let h=p.filter(e=>e!==m),g=h.filter(e=>(this.endPoint(e.index,e.end)?.[o]??0)<r[o]).length,_=[...h.slice(0,g),m,...h.slice(g)];if(_.every((e,t)=>p[t]===e))return;let v=new Map(_.map((e,t)=>[`${e.edge.id}|${e.end}`,t]));Z.edges=Z.edges.map(e=>{let t=v.get(`${e.id}|from`),n=v.get(`${e.id}|to`);return t===void 0&&n===void 0?e:{...e,data:{...e.data,...t!==void 0&&{fromSlot:t},...n!==void 0&&{toSlot:n}}}})};addEventListener(`pointermove`,d),addEventListener(`pointerup`,u)}},Fb=()=>{try{return JSON.parse(sessionStorage.getItem(`koppler-log-cleared`)??`{}`)??{}}catch{return{}}},Ib=e=>{let[t=``,n]=e.split(`@`);return[t,n]},Lb=new class{#e=M([]);get tabs(){return z(this.#e)}set tabs(e){N(this.#e,e)}#t=M(null);get active(){return z(this.#t)}set active(e){N(this.#t,e,!0)}#n=M(!1);get raw(){return z(this.#n)}set raw(e){N(this.#n,e,!0)}#r=M(Fb());get cleared(){return z(this.#r)}set cleared(e){N(this.#r,e)}#i=M({});get full(){return z(this.#i)}set full(e){N(this.#i,e)}#a={};open(e,t){let n=t?`${e}@${t}`:e;this.tabs.includes(n)||(this.tabs=[...this.tabs,n]),this.active=n,requestAnimationFrame(()=>{Z.show(e)})}past(e){return!!Ib(e)[1]}label(e){let[t,n]=Ib(e),r=n?Q.status?.runs?.find(e=>e.id===n)?.at:void 0,i=r?new Date(r).toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``;return n?`${Z.nameOf(t)}, run of ${i||n}`:Z.nameOf(t)}close(e){this.tabs=this.tabs.filter(t=>t!==e),this.active===e&&(this.active=this.tabs.at(-1)??null)}closeAll(){this.tabs=[],this.active=null}clear(){let e=this.active,t=e?Q.tail(e).trimEnd():``;if(e&&t){this.cleared={...this.cleared,[e]:t.slice(t.lastIndexOf(`
|
|
8
|
+
`)+1)};try{sessionStorage.setItem(`koppler-log-cleared`,JSON.stringify(this.cleared))}catch{}}}refresh(){let e=this.active;if(!e||Date.now()-(this.#a[e]??0)<2e3)return;this.#a[e]=Date.now();let[t,n]=Ib(e),r=`app=${encodeURIComponent(t)}${n?`&run=${encodeURIComponent(n)}`:``}`;fetch(`log?${r}`,{cache:`no-store`}).then(e=>e.ok?e.text():null).then(t=>{t!==null&&t!==this.full[e]&&(this.full={...this.full,[e]:t})}).catch(()=>void 0)}text(e){let t=this.full[e]??(this.past(e)?``:Q.tail(e)),n=this.cleared[e],r=n?t.lastIndexOf(n):-1;return r>=0?t.slice(r+(n?.length??0)).replace(/^\n/,``):t}},Rb=(e,t)=>(t.error===void 0?t.notes.length&&$.show(`Opened ${e}, changed to fit: ${t.notes.join(`; `)}`):$.show(`Cannot open ${e}. ${t.error}`,`warning`),t.error===void 0),zb=e=>Rb(e.name,Z.openBoard(e));async function Bb(e){if(!e)return;let t;try{t=JSON.parse(await e.text())}catch{$.show(`${e.name} is not a JSON file`,`warning`);return}let n=Z.importBoards(t,e.name);Rb(n.error===void 0?n.name:e.name,n)}async function Vb(e){let t=await Xs(`preset`,{url:e});if(t.error)return t.error;let n=Z.importBoards(t.presets,e);return n.error===void 0?(Rb(n.name,n),null):n.error}var Hb=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60]];function Ub(e){let t=(new Date(e).getTime()-Date.now())/1e3,n=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});for(let[e,r]of Hb)if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return`just now`}var Wb=pn({}),Gb=[[`starts`,`Starts`],[`restarts`,`Restarts`],[`stops`,`Stops and reverts`],[`keeps`,`Keeps running`]],Kb=()=>(Date.now().toString(36)+Math.random().toString(36).slice(2,8)).replace(/[^a-z0-9]/g,``),qb=Z.nameOf,Jb=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`,Yb=new class{#e=M(null);get review(){return z(this.#e)}set review(e){N(this.#e,e)}#t=M(pn({}));get onItsOwn(){return z(this.#t)}set onItsOwn(e){N(this.#t,e,!0)}#n=M(pn({}));get leftOut(){return z(this.#n)}set leftOut(e){N(this.#n,e,!0)}graph(e){let t=Q.status?.live,n=n=>!e||n===e||Object.hasOwn(t?.nodes??{},n),r=Z.nodes.filter(({id:e})=>!this.leftOut[e]).map(({id:e,data:t})=>{let n=Z.app(e);return{id:e,branch:t.run!==`mock`&&t.branch||null,run:t.run,...t.hideTunnels&&Z.tunnelsOf(e).length>0&&{tunnels:!1},...t.showQueues&&Z.queuesOf(e).length>0&&{queues:!0},...t.watch&&t.run===`cli`&&{watch:!0},...Z.switchesOver(e)&&{changes:t.changes??`set-aside`},...t.platform&&t.run===`cli`&&!!n?.platforms.length&&{platform:t.platform},...t.run!==`mock`&&t.note.trim()&&{note:t.note.trim()},...Z.localLibraries(e).length>0&&{libraries:Z.localLibraries(e)}}}),i=Z.edges.filter(({source:e,target:t})=>!this.leftOut[e]&&!this.leftOut[t]).map(({source:e,target:t})=>({from:e,to:t})),a=e?r.flatMap(r=>r.id===e?[r]:n(r.id)?[{...t?.nodes?.[r.id],id:r.id}]:[]):r,o=e?[...(Array.isArray(t?.edges)?t.edges:[]).filter(t=>t.from!==e&&n(t.to)),...i.filter(t=>t.from===e&&n(t.to))]:i,s=a.filter(e=>e.run!==`mock`).flatMap(({id:e})=>(Z.app(e)?.calls??[]).filter(t=>!o.some(n=>n.from===e&&n.to===t)).map(t=>({from:e,to:t}))),c=Object.fromEntries(e?Object.entries(t?.queues??{}).filter(([,e])=>e===`local`):Z.infra.flatMap(e=>e.type===`queue`&&e.data.local?[[e.data.queue,`local`]]:[]));return{env:Z.env,mode:`auto`,nodes:a,edges:o,deployed:s,...Object.keys(c).length&&{queues:c}}}#r(e){let t=Q.status,n=t?.running;return ws(t?.live??null,e,{name:qb,running:e=>n?.includes(e),strays:(n??[]).filter(e=>Z.apps.some(t=>t.id===e)&&!t?.live?.nodes?.[e]),startedOn:e=>t?.runningEnvs?.[e],queuesOf:e=>Z.queuesOf(e),current:e=>Z.app(e)?.current})}#i(){return Z.nodes.flatMap(({id:e})=>(Q.status?.secrets?.[e]?.[Z.env]??[]).filter(e=>!e.stored&&(!e.when||/^always\b/i.test(e.when.trim()))).map(t=>`${t.name} for ${qb(e)}`))}#a(e){let t=e.env.toUpperCase(),n=(e,t)=>Z.app(e)?.known.includes(t);return[`ENV ${t}`,`MODE ${e.mode===`manual`?`manual: give me a checklist, change nothing`:`auto: apply the changes and start everything`}`,...e.note?[`NOTE ${e.note}`]:[],...Object.keys(e.queues??{}).map(e=>`QUEUE ${Z.queueName(e)}: local, in the AWS emulator`),...e.nodes.flatMap(e=>{let t=Z.apps.find(t=>t.id===e.id)?.platforms.find(([t])=>t===e.platform);if(e.run===`mock`)return[`MOCK ${qb(e.id)}: Koppler answers its mock responses from the stack`];let n=[e.run===`ide`?`IDE`:`CLI`,e.run===`cli`?t?.[1].split(` `)[0]:void 0];return[`LOCAL ${qb(e.id)} [${n.filter(Boolean).join(`, `)}] on ${e.branch??`current branch`}`,...e.note?[` note: ${e.note}`]:[]]}),...e.edges.map(({from:e,to:t})=>{let r=Z.app(e)?.calls.includes(t),i=n(e,t)?``:r?` (found in its repo, not in the stack yet)`:` (NEW: not in the stack; find how the caller picks this address, record it in consumes, ask if unclear)`;return` ${qb(e)} → local ${qb(t)}${i}`}),...e.deployed.map(({from:e,to:n})=>` ${qb(e)} → ${t} ${qb(n)}`),...e.deployed.filter(({to:t})=>e.nodes.some(e=>e.id===t)).map(({from:e,to:n})=>`! ${qb(n)} is local but ${qb(e)} still calls ${t}`)].join(`
|
|
9
|
+
`)}async deliver(e,t,n){return(await Js(`prompt`,{...t,text:e}))?.ok?($.show(n),!0):(await navigator.clipboard.writeText(e).catch(()=>void 0),$.show(`No agent connection, so the request was copied to your clipboard`,`warning`),!1)}#o(e,t=()=>[]){return Gb.filter(([t])=>e[t].length).map(([n,r])=>({verb:n,label:r,items:e[n].map(e=>({name:qb(e.id),...(n===`starts`||n===`restarts`)&&{id:e.id},notes:[...e.why.length?[{text:e.why.join(`; `)}]:[],...n===`starts`||n===`restarts`?t(e.id):[]]}))}))}#s={};again(){this.#c=!0,this.start(this.#s)}#c=!1;start({note:e,manual:t=!1,restart:n}={}){this.#c||(this.leftOut={}),this.#c=!1,this.#s={manual:t,...e&&{note:e},...n&&{restart:n}};let r=this.graph(n),i={...r,nodes:r.nodes.map(e=>e.id===n?{...e,restart:!0}:e),mode:t?`manual`:`auto`,...e&&{note:e}};if(!i.nodes.length){$.show(`Add at least one app first`,`warning`);return}let a=this.#r(i),o=i.env.toUpperCase(),s=Z.envs[0]?.toUpperCase()??``,c=!!e||i.nodes.some(e=>`note`in e),l=this.#i(),u=Z.nodes.filter(e=>Z.borrowsTunnels(e.id)).map(e=>e.id),d=Z.plan,f=Z.nodes.filter(e=>e.data.hideTunnels&&Z.tunnelsOf(e.id).length),p={label:`What to do`,run:()=>{this.review=null,Wb.checklist?.open()}},m=e=>{let t=Z.nodes.find(t=>t.id===e),n=Z.app(e);if(!t||!n)return[];let r=!t.data.branch||t.data.branch===n.current,a=Jb(n.dirty,`change`).replace(/^(\d+) /,`$1 uncommitted `);return[...new Set([n.current,...n.branches]).size>1?[]:[{text:t.data.branch||n.current||`current branch`,kind:`host`}],...n.dirty&&r?[{text:`With your ${a}`,kind:`flag`}]:[],...(Q.status?.recipes?.[e]??[]).filter(({when:t})=>t?.always||t?.env===i.env||i.edges.some(n=>n.from===e&&n.to===t?.calls)).map(e=>{let t=e.here?`${e.here.ok?`works on my machine`:`failed here`}, last run ${e.here.at}`:`not run here yet`;return{text:`Remembered change: ${e.why} (${t})`,title:e.file}}),...t.data.run===`ide`?[{text:`You start it; the agent only prepares it`}]:[],...t.data.run===`mock`?[{text:`A mock: its responses from the stack answer in its place`}]:[],...t.data.note?[{text:`Note: ${t.data.note}`}]:[],...Z.localLibraries(e).length?[{text:`Uses your local ${Z.localLibraries(e).join(`, `)}`}]:[]]},h={};for(let{from:e,to:t}of i.deployed)h[t]=[...h[t]??[],e];let g=Q.status?.agent?.state??`none`;this.review={title:t?`Checklist for ${o}`:`Run on ${o}`,sub:t?`You get a checklist of these steps to do yourself. The agent changes nothing.`:c?`The agent does exactly this, with your note, and asks before anything else.`:`Koppler does this as soon as you send it; the agent only steps in for what it cannot do alone.`,notices:[...u.length?[{text:`The stack has no ${o} sign-in or tunnel for ${u.map(qb).join(`, `)}. Koppler will not use another environment's.`,kind:`prod`,act:p}]:[],...l.length&&Z.protected?[{text:`Store first, then send: ${l.join(`, `)}.`,kind:`prod`,act:p}]:[],...Z.protected?[{text:`${o}: your local code reads and writes real ${o} data.${d.length?` Running opens the ${o} ${d.length===1?`tunnel`:`tunnels`} listed below.`:``}`,kind:`prod`}]:[],...a.nothing?[{text:`Nothing to change: the board matches what is running.`}]:[],...Q.status?.live===void 0?[{text:`Koppler cannot see what is running from this page, so everything is listed as starting.`}]:[],...Q.status?.runs?.some(e=>e.state===`waiting`)?[{text:`An earlier run is still waiting for the agent. This one replaces it.`}]:[],...e?[{text:`Your note: ${e}`}]:[],...g===`none`&&(c||t)?[{text:`No agent is listening, so this waits until one is. Run /koppler-run connect in your agent session.`}]:[],...l.length&&!Z.protected?[{text:`Not stored yet, the agent will ask for it: ${l.join(`, `)}.`}]:[]],groups:[...this.#o(a,m),...Object.keys(h).length?[{verb:`calls`,label:`Calls ${Z.protected?o:`deployed ${o}`}`,items:Object.entries(h).map(([e,t])=>{let n=Z.app(e),r=n?.cloned&&!n.outside&&n.answers;return{name:qb(e),notes:[{text:`from ${t.map(qb).join(`, `)}`}],...r&&{act:{label:`Run locally`,title:`Run it locally too, and point ${t.map(qb).join(`, `)} at it`,run:()=>{Z.add(e);for(let n of t)Z.connect(n,e);this.again()}}}}})}]:[],...d.length?[{verb:`calls`,label:`Opens tunnels`,items:d.map(e=>{let t=e.apps.filter(e=>u.includes(e)),n=Q.status?.ports?.[String(e.port)]?` (already open)`:``;return{name:`${e.what} on ${e.bind}:${String(e.port)}${n}`,off:t.length>0,notes:[{text:e.host,kind:`host`},...t.length?[{text:`${s} host: the stack has no ${o} entry for ${t.map(qb).join(`, `)}`}]:[]]}})}]:[],...f.length?[{verb:`keeps`,label:`No tunnels`,items:f.map(e=>({name:e.data.name,notes:[{text:`Only its API runs; calls through its tunnels fail`}]}))}]:[]],ok:t?`Get the checklist`:a.nothing?`Run anyway`:Z.protected?`Run on ${o}`:`Run`,prod:Z.protected,blocked:u.length>0||Z.protected&&l.length>0,confirm:()=>{let e=Object.fromEntries(Gb.map(([e])=>[e,a[e]])),n=`Set up and run this stack using the koppler-run skill.
|
|
10
|
+
`+this.#a(i)+`
|
|
11
|
+
PLAN the user confirmed on the canvas (do exactly this; check it first with koppler plan):
|
|
12
|
+
`+Es(a,{name:qb}).map(e=>` ${e}`).join(`
|
|
13
|
+
`);Z.commit();let r=Z.saved();Ys(r);let o={...i,id:Kb(),plan:e,layout:r};this.deliver(n,{tag:`koppler`,data:o},c||t?`Sent. Waiting for the agent`:`Sent. Koppler is starting it`)}}}askFacts(e,t){let n=[`Find the missing facts for this environment in the stack, using the koppler-run skill.`,`ENV ${e.toUpperCase()}`,`MISSING:`,...t.map(e=>` ${e}`),`Read each app's repo (infrastructure files such as Terraform tfvars, workflow files) and the user's local tunnel aliases. Never read or print a secret value.`,`Propose the additions (apps.<id>.envs.<env>.prereqs, .secrets with fetch steps), wait for the user to confirm, then make them with koppler stack set; never write stack.json.`].join(`
|
|
14
|
+
`),r=(Q.status?.agent?.state??`none`)===`none`;return this.deliver(n,{tag:`koppler-facts`,data:{env:e,gaps:t}},r?`Saved. The agent gets it when one connects.`:`Sent to the agent`)}askFill(e,t,n){let r=[`Fill in this app's settings in the stack from its repo, using the koppler-run skill.`,`APP ${qb(e)} (${e})`,`EMPTY ${t.join(`, `)||`none`}`,`LOCKED ${n.join(`, `)||`none`} (never change these)`,`Read the app's repo (launch settings, package files, infrastructure, README) to find each fact; leave a field empty when it does not apply. Never read or print a secret value.`,`Propose what you would set, and why, wait for the user to confirm, then make each change with koppler stack set apps.`+e+`.<field>; never write stack.json.`].join(`
|
|
15
|
+
`),i=(Q.status?.agent?.state??`none`)===`none`;return this.deliver(r,{tag:`koppler-facts`,data:{env:Z.env,app:e,gaps:t}},i?`Saved. The agent gets it when one connects.`:`Sent to the agent`)}askToFix(e,t){let n=[`Fix this failed start, using the koppler-run skill.`,`ENV ${Z.env.toUpperCase()}`,`APP ${qb(e)} (${e})`,`FAILED ${t}`,`Find the cause, say what you would change, and ask before you start, stop or restart anything.`].join(`
|
|
16
|
+
`),r={env:Z.env,failures:[{connection:qb(e),result:`Failed to start`,detail:t,app:e}]},i=(Q.status?.agent?.state??`none`)===`none`;return this.deliver(n,{tag:`koppler-fix`,data:r},i?`Saved. The agent gets it when one connects.`:`Sent to the agent`)}async#l(e){let t=await Js(e);return t?.ok?t.status===204?{}:await t.json().catch(()=>null):null}get started(){return(Q.status?.running??[]).filter(e=>e!==`canvas`)}get left(){let e=[...Q.status?.runs??[]].reverse().find(e=>e.state===`done`||e.state===`failed`);return e&&e.kind!==`stop`?e.changes??[]:[]}stopApps(){let e=e=>Q.status?.apps?.[e]?.running?.some(e=>e.source===`ide`),t=this.started.map(t=>({name:Z.apps.some(e=>e.id===t)?qb(t):t.startsWith(`tunnel-`)?`Tunnel ${t.slice(7)}`:t,notes:e(t)?[{text:`Its log only; the app keeps running in your IDE`}]:[]}));this.review={title:`Stop apps, keep changes`,sub:`Koppler stops these now. Branches and code changes stay; Stop and revert undoes them later.`,notices:[],groups:[{verb:`stops`,label:`Stops`,items:t}],ok:`Stop apps`,prod:!0,blocked:!1,confirm:()=>{this.#l(`stop-apps`).then(e=>{let t=e?.stopped.length??0;e?$.show(`Stopped ${String(t)} ${t===1?`process`:`processes`}. Your changes stay until you revert.`):$.show(`Could not reach the canvas server.`,`warning`)})}}}alone(e){let t=Z.alone(e);this.start(),t&&this.review&&(this.review={...this.review,back:{label:`Back to ${t.name}`,run:()=>{zb(t)}}})}async stopApp(e){let t=await Xs(`stop-apps`,{app:e});`stopped`in t&&t.stopped.length?$.show(`Stopped ${qb(e)}. Its changes stay until you revert.`):$.show(`Could not stop ${qb(e)}.`,`warning`)}shutDown(){let e=[`listening`,`busy`].includes(Q.status?.agent?.state??`none`),t=Q.status?.start??`koppler canvas`;this.review={title:`Shut down Koppler`,sub:`This page stops updating until you start the canvas again.`,notices:this.started.length?[{text:`Keeps running: ${this.started.join(`, `)}. Stop and revert stops those.`}]:[],groups:[{verb:`stops`,label:`Stops`,items:[...e?[{name:`The agent listener`,notes:[{text:`The agent stops getting runs until it connects again`}]}]:[],{name:`The canvas server`,notes:[]}]}],ok:`Shut down`,prod:!0,blocked:!1,confirm:()=>{this.#l(`shutdown`).then(e=>{e?$.show(`Koppler is shut down. Start it again with ${t}.`,`message`,{label:`Copy command`,run:()=>void navigator.clipboard.writeText(t).catch(()=>void 0)}):$.show(`Could not reach the canvas server.`,`warning`)})}}}stop(){let{started:e,left:t}=this,n=e.filter(e=>!Z.app(e)),r=e.length>0;this.stopReview({title:r?`Stop and revert`:`Revert temporary changes`,sub:r?`Koppler stops what it started and undoes its temporary changes; the agent only gets what it cannot undo safely.`:`Nothing is running. Koppler undoes what the last run left behind.`,notices:[...n.length?[{text:`Also stops: ${n.join(`, `)}.`}]:[],{text:`Left alone: anything you started yourself or from your IDE, your AWS sign-ins and stored credentials.`}],stops:r,also:t.length?[{verb:`stops`,label:`Revert`,items:[...new Set(t.map(e=>e.app))].map(e=>({name:qb(e),notes:t.filter(t=>t.app===e).map(e=>({text:`${e.title}${e.file?` (${e.file})`:``}`}))}))}]:[],ok:r?`Stop and revert`:`Revert`,text:`Stop and revert this stack using the koppler-run skill: stop every process the agent started (apps, tunnels, background tasks; leave anything started from an IDE or by me) and revert every temporary code change (do-not-commit edits and added launch profiles). Report what was stopped and reverted.`,sent:`Stopping and reverting`})}stopReview({stops:e=!0,also:t=[],text:n,sent:r,data:i={},...a}){let o=this.#r({env:Z.env,nodes:{},edges:[]});this.review={...a,groups:[...e?this.#o(o).filter(e=>e.verb===`stops`):[],...t],prod:!0,blocked:!1,confirm:()=>{this.deliver(n,{tag:`koppler-stop`,data:{action:`stop`,id:Kb(),...i}},r)}}}get idle(){return!this.#r({env:Z.env,nodes:{},edges:[]}).stops.length&&!this.started.length}confirm(){let e=this.review;this.review=null,e?.confirm()}},Xb=H(`<button class="stop svelte-byllhq" type="button" title="Stop this app; its changes stay"><!></button> <button type="button" title="Restart this app; the rest keeps running" class="svelte-byllhq"><!></button>`,1),Zb=H(`<button type="button" title="Run alone: just this app and its tunnels, on a board of its own" class="svelte-byllhq"><!></button>`),Qb=H(`<button type="button" aria-label="Show log" title="Show log" class="svelte-byllhq"><!></button>`),$b=H(`<button type="button" class="svelte-byllhq"><!></button>`),ex=H(`<a class="tool svelte-byllhq" target="_blank" rel="noopener" title="Its requests, followed across your local apps"><!></a>`),tx=H(`<button type="button" title="Hot reload: the app takes your code changes as it runs. Shift-click to hot restart." class="svelte-byllhq"><!></button>`),nx=H(`<button type="button" title="A terminal in its clone, with the settings its run starts it with; never its secrets" class="svelte-byllhq"><!></button>`),rx=H(`<span role="toolbar" tabindex="-1"><!> <!> <!> <!> <!> <!> <!> <button type="button" title="Settings: every fact the stack has about it" class="svelte-byllhq"><!></button> <button class="remove svelte-byllhq" type="button" title="Take off the board"><!></button></span>`),ix=H(`<span class="live svelte-byllhq" role="img"></span>`),ax=H(`<span class="watch svelte-byllhq" role="img" aria-label="Auto-restart" title="Restarts when its files change"><!></span>`),ox=H(`<span class="svelte-byllhq"> </span>`),sx=H(`<span title="It is taken off its queues and keeps the deployed ones" class="svelte-byllhq">No queues</span>`),cx=H(`<span class="off svelte-byllhq" title="Only the API runs; calls through its tunnels fail">No tunnels</span>`),lx=H(`<p class="glance svelte-byllhq"><span class="svelte-byllhq"> </span> <!> <!> <!></p>`),ux=H(`<p class="where nodrag svelte-byllhq"> </p>`),dx=H(`<i class="svelte-byllhq"></i>`),fx=H(`<p class="why nodrag svelte-byllhq"> </p>`),px=H(`<span class="detail svelte-byllhq"> </span>`),mx=H(`<li class="step svelte-byllhq"><span class="mark svelte-byllhq" aria-hidden="true"><!></span> <span class="what svelte-byllhq"> </span> <!> <!></li>`),hx=H(`<ul class="steps nodrag nopan svelte-byllhq"></ul>`),gx=H(`<button class="progress nodrag svelte-byllhq" type="button"><span class="marks svelte-byllhq"></span> <span class="text svelte-byllhq"> </span> <span class="chev svelte-byllhq"> </span></button> <!> <!>`,1),_x=H(`<div class="acts nodrag svelte-byllhq"><button class="act fix svelte-byllhq" type="button"> </button></div>`),vx=H(`<button class="chip svelte-byllhq" type="button"> </button>`),yx=H(`<div class="calls nodrag nopan svelte-byllhq"><span class="calls-label svelte-byllhq"> </span> <!></div>`),bx=H(`<button title="Drag a cable to an app this one should call locally" tabindex="-1"></button>`),xx=H(`<!> <article><header class="svelte-byllhq"><span class="grip svelte-byllhq" aria-hidden="true" title="Drag to move"><!></span> <!> <span class="name svelte-byllhq"> </span> <!> <span class="kind svelte-byllhq"> </span></header> <!> <!> <!> <!> <!> <!> <!></article>`,1);function Sx(e,t){k(t,!0);let n=M(!1),r,i=()=>{clearTimeout(r),N(n,!0)},a=()=>{r=setTimeout(()=>N(n,!1),250)},o=j(()=>z(n)||t.selected),s=[`top`,`right`,`bottom`,`left`],c=Dy(),l=j(()=>c.current.zoom<$s),u=j(()=>z(l)||Z.live),d=M(0),f=M(0);In(()=>{!z(u)&&z(d)&&N(f,z(d),!0)});let p=j(()=>Z.app(t.id)),m=j(()=>z(p)?.current||`current branch`),h=j(()=>Z.tunnelsOf(t.id)),g=j(()=>Z.queuesOf(t.id)),_=j(()=>z(g).length>0&&!t.data.showQueues),y=j(()=>Z.deployedCalls(t.id)),b=e=>{let[n,...r]=e.split(` `);return r.length&&n===t.data.name.split(` `)[0]?r.join(` `):e},x=j(()=>!!z(p)?.platforms.length&&t.data.run===`cli`),S=j(()=>z(p)?.platforms.find(([e])=>e===t.data.platform)?.[1]),C=j(()=>t.data.run===`ide`?`Started by you`:t.data.run===`mock`?`Mock`:z(x)?z(S):void 0),w=j(()=>Q.up(t.id)),ee=j(()=>Q.where(t.id)),T=j(()=>Q.state(t.id)),te=async e=>{let n=await Xs(`reload`,{app:t.id,restart:e});`error`in n?$.show(n.error,`warning`):$.show(`${n.said}.`)},E=j(()=>Q.stateSaid(t.id)),ne=j(()=>Q.steps(t.id)),re=j(()=>z(ne).length?fc(z(ne)):[`todo`,``]),ie=j(()=>v(z(re),2)),ae=j(()=>z(ie)[0]),oe=j(()=>z(ie)[1]),se=j(()=>z(ne).find(e=>e.state===`failed`)),ce=M(!1),le=M(!1),ue=e=>Z.ends.onPort.some(n=>n.id===t.id&&n.side===e);var de=xx(),fe=F(de);{let e=j(()=>z(o)&&!t.dragging);Ey(fe,{get isVisible(){return z(e)},get position(){return jm.Top},align:`end`,offset:6,children:(e,n)=>{var r=rx();let o;var s=P(r),c=e=>{var n=Xb(),r=F(n);X(P(r),{get of(){return Mc},size:15,filled:!0}),O(r);var i=L(r,2);X(P(i),{get of(){return sb},size:15}),O(i),R(()=>{q(r,`aria-label`,`Stop ${t.data.name??``}`),q(i,`aria-label`,`Restart ${t.data.name??``}`)}),V(`click`,r,()=>void Yb.stopApp(t.id)),V(`click`,i,()=>{Yb.start({restart:t.id})}),U(e,n)},l=j(()=>Yb.started.includes(t.id)),u=e=>{var n=Zb();X(P(n),{get of(){return so},size:15,filled:!0}),O(n),R(()=>q(n,`aria-label`,`Run ${t.data.name??``} alone`)),V(`click`,n,()=>{Yb.alone(t.id)}),U(e,n)};G(s,e=>{z(l)?e(c):e(u,-1)});var d=L(s,2),f=e=>{var n=Qb();X(P(n),{get of(){return ab},size:15}),O(n),V(`click`,n,()=>{Lb.open(t.id)}),U(e,n)},m=j(()=>Q.hasLog(t.id));G(d,e=>{z(m)&&e(f)});var h=L(d,2);K(h,17,()=>Z.commandsOf(t.id),([e,t])=>e,(e,n)=>{var r=j(()=>v(z(n),2));let i=()=>z(r)[0],a=()=>z(r)[1],o=j(()=>({app:t.id,appName:t.data.name,key:i(),command:a()}));var s=$b();X(P(s),{get of(){return _c[a().icon??`terminal`]},size:15}),O(s),R(()=>{q(s,`aria-label`,`${a().label??``} on ${t.data.name??``}`),q(s,`title`,a().confirm?`${a().label}: ${a().confirm}`:a().label)}),V(`click`,s,()=>{a().confirm||a().args?.length?Wb.command?.open(z(o)):vc(z(o)).then(e=>{e&&$.show(e,`warning`)})}),U(e,s)});var g=L(h,2),_=e=>{var n=ex();X(P(n),{get of(){return $y},size:15}),O(n),R(e=>{q(n,`href`,`${Q.status.traces.view??``}?service=${e??``}`),q(n,`aria-label`,`Traces of ${t.data.name??``}`)},[()=>encodeURIComponent(t.id)]),U(e,n)},y=j(()=>Q.status?.traces?.state===`on`&&Q.sent(t.id));G(g,e=>{z(y)&&e(_)});var b=L(g,2),x=e=>{var n=tx();X(P(n),{get of(){return Zy},size:15}),O(n),R(()=>q(n,`aria-label`,`Hot reload ${t.data.name??``}`)),V(`click`,n,e=>void te(e.shiftKey)),U(e,n)};G(b,e=>{z(p)?.kind===`flutter`&&t.data.run===`cli`&&z(w)&&e(x)});var S=L(b,2),C=e=>{var n=nx();X(P(n),{get of(){return mo},size:15}),O(n),R(()=>q(n,`aria-label`,`Open a terminal for ${t.data.name??``}`)),V(`click`,n,()=>void yc(t.id)),U(e,n)};G(S,e=>{z(p)?.cloned&&!z(p).outside&&e(C)});var ee=L(S,2),T=e=>{var n=$b();X(P(n),{get of(){return lo},size:15}),O(n),R(()=>{q(n,`aria-pressed`,!!t.data.watch),q(n,`aria-label`,`Auto-restart for ${t.data.name??``}`),q(n,`title`,t.data.watch?`Auto-restart is on: Koppler starts it again whenever a file in its clone changes. Click to turn it off.`:`Auto-restart: start it again whenever a file in its clone changes`)}),V(`click`,n,()=>{Z.set(t.id,{watch:!t.data.watch})}),U(e,n)};G(ee,e=>{t.data.run===`cli`&&e(T)});var E=L(ee,2);Fc(P(E),{size:15}),O(E);var ne=L(E,2);X(P(ne),{get of(){return to},size:15}),O(ne),O(r),R(()=>{o=Ji(r,1,`tools nodrag svelte-byllhq`,null,o,{reading:Z.live}),q(r,`data-card`,t.id),q(r,`aria-label`,`${t.data.name??``} actions`),q(E,`aria-label`,`Settings for ${t.data.name??``}`),q(ne,`aria-label`,`Remove ${t.data.name??``}`)}),B(`pointerenter`,r,i),B(`pointerleave`,r,a),V(`click`,E,()=>void Wb.settings?.open({title:t.data.name,path:`apps.${t.id}`})),V(`click`,ne,()=>{Z.remove(t.id)}),U(e,r)},$$slots:{default:!0}})}var pe=L(fe,2);let me,he;var ge=P(pe),_e=P(ge);X(P(_e),{get of(){return rb},size:14}),O(_e);var ve=L(_e,2),ye=e=>{var n=ix();R(e=>{q(n,`data-on`,z(w)),q(n,`data-state`,z(T)?.state),q(n,`aria-label`,z(T)?uc[z(T).state]:z(w)?`Running`:`Not answering`),q(n,`title`,e)},[()=>z(E)||Q.about(t.id)]),U(e,n)};G(ve,e=>{(z(w)!==null||z(T))&&e(ye)});var be=L(ve,2),xe=I(be,!0),Se=L(be,2),Ce=e=>{var t=ax();X(P(t),{get of(){return lo},size:12}),O(t),U(e,t)};G(Se,e=>{t.data.watch&&t.data.run===`cli`&&e(Ce)});var we=I(L(Se,2),!0);O(ge);var Te=L(ge,2),Ee=e=>{var n=lx(),r=P(n),i=I(r,!0),a=L(r,2),o=e=>{var t=ox(),n=I(t,!0);R(()=>W(n,z(C))),U(e,t)};G(a,e=>{z(C)&&e(o)});var s=L(a,2),c=e=>{U(e,sx())};G(s,e=>{z(_)&&e(c)});var l=L(s,2),u=e=>{U(e,cx())};G(l,e=>{t.data.hideTunnels&&z(h).length&&e(u)}),O(n),R(()=>{q(r,`title`,`Branch: ${(t.data.branch||z(m))??``}`),W(i,t.data.branch||z(m))}),U(e,n)},D=e=>{Mb(e,{get id(){return t.id}})};G(Te,e=>{z(u)?e(Ee):e(D,-1)});var De=L(Te,2),Oe=e=>{var t=ux(),n=I(t,!0);R(()=>{q(t,`data-on`,z(w)??`other`),W(n,z(ee))}),U(e,t)},ke=e=>{var t=ux(),n=I(t,!0);R(()=>{q(t,`data-state`,z(T)?.state),W(n,z(E))}),U(e,t)};G(De,e=>{z(ee)?e(Oe):z(E)&&e(ke,1)});var Ae=L(De,2),je=e=>{var t=gx(),n=F(t),r=P(n);K(r,21,()=>z(ne),Ei,(e,t)=>{var n=dx();R(()=>{q(n,`data-state`,z(t).state),q(n,`title`,z(t).label)}),U(e,n)}),O(r);var i=L(r,2),a=I(i,!0),o=I(L(i,2),!0);O(n);var s=L(n,2),c=e=>{var t=fx(),n=I(t,!0);R(()=>W(n,z(se).detail)),U(e,t)};G(s,e=>{z(se)?.detail&&!z(ce)&&e(c)});var l=L(s,2),u=e=>{var t=hx();K(t,21,()=>z(ne),Ei,(e,t)=>{var n=mx(),r=P(n),i=P(r),a=e=>{X(e,{get of(){return tb},size:11})},o=e=>{U(e,si(`!`))};G(i,e=>{z(t).state===`done`?e(a):z(t).state===`failed`&&e(o,1)}),O(r);var s=L(r,2),c=I(s,!0),l=L(s,2),u=e=>{var n=px(),r=I(n,!0);R(()=>W(r,z(t).detail)),U(e,n)};G(l,e=>{z(t).detail&&e(u)});var d=L(l,2),f=e=>{Lc(e,{get command(){return z(t).copy}})};G(d,e=>{z(t).copy&&e(f)}),O(n),R(()=>{q(n,`data-state`,z(t).state),W(c,z(t).label)}),U(e,n)}),O(t),U(e,t)};G(l,e=>{z(ce)&&e(u)}),R(()=>{q(n,`data-tone`,z(ae)),q(n,`aria-expanded`,z(ce)),W(a,z(oe)),W(o,z(ce)?`Hide`:`Details`)}),V(`click`,n,()=>N(ce,!z(ce))),U(e,t)};G(Ae,e=>{z(ne).length&&e(je)});var Me=L(Ae,2),Ne=e=>{var n=_x(),r=P(n),i=I(r,!0);O(n),R(()=>{r.disabled=z(le),W(i,z(le)?`Sent to the agent`:`Ask the agent to fix`)}),V(`click`,r,async()=>{N(le,await Yb.askToFix(t.id,`${z(se).label}${z(se).detail?`: ${z(se).detail}`:``}`),!0)}),U(e,n)};G(Me,e=>{z(se)&&e(Ne)});var Pe=L(Me,2),Fe=e=>{var n=yx(),r=P(n),i=I(r);K(L(r,2),17,()=>z(y),e=>e.id,(e,n)=>{let r=j(()=>Z.cards.some(e=>e.id===z(n).id)),i=j(()=>z(r)||z(n).cloned);var a=vx(),o=I(a,!0);R((e,t)=>{a.disabled=!z(i),q(a,`title`,`${z(n).name??``} stays on deployed ${e??``}.${z(i)?` Click to ${z(r)?`wire it to your local copy`:`run it locally too and wire it`}.`:` It is not cloned on this Mac.`}`),W(o,t)},[()=>Z.env.toUpperCase(),()=>b(z(n).name)]),V(`click`,a,()=>{Z.callLocally(t.id,z(n).id)}),U(e,a)}),O(n),R(e=>W(i,`Calls ${e??``}`),[()=>Z.env.toUpperCase()]),U(e,n)};G(Pe,e=>{z(y).length&&e(Fe)});var Ie=L(Pe,2);l_(Ie,{type:`source`,get position(){return jm.Top},isConnectable:!1,class:`anchor`}),K(L(Ie,2),16,()=>s,e=>e,(e,n)=>{var r=bx();let i;R(e=>{i=Ji(r,1,`port ${n??``} nodrag nopan`,`svelte-byllhq`,i,{on:e}),q(r,`aria-label`,`Draw a cable from the ${n??``} of ${t.data.name??``}`)},[()=>ue(n)]),V(`pointerdown`,r,e=>{e.button===0&&(e.stopPropagation(),Pb.start(t.id,n))}),U(e,r)}),O(pe),R((e,n)=>{me=Ji(pe,1,`card kind-${t.data.kind??``}`,`svelte-byllhq`,me,{selected:t.selected,dimmed:e,short:z(u),far:z(l),reading:Z.live,"drop-ok":Pb.drop?.id===t.id&&Pb.drop.ok,"drop-bad":Pb.drop?.id===t.id&&!Pb.drop.ok,wiring:!!Pb.draft}),he=Xi(pe,``,he,{width:n}),q(be,`title`,t.data.name),W(xe,t.data.name),W(we,t.data.kindLabel)},[()=>Z.dimmed(t.id),()=>z(u)&&z(f)?`${String(z(f))}px`:void 0]),B(`pointerenter`,pe,i),B(`pointerleave`,pe,a),Aa(pe,`offsetWidth`,e=>N(d,e)),U(e,de),A()}Zr([`click`,`pointerdown`]);var Cx=oi(`<g class="cut nodrag svelte-1f6oz0q" role="button" tabindex="-1"><circle r="8" class="svelte-1f6oz0q"></circle><path d="M-3,-3 L3,3 M3,-3 L-3,3" class="svelte-1f6oz0q"></path></g>`),wx=oi(`<g role="presentation"><title> </title><path class="svelte-flow__edge-interaction hit svelte-1f6oz0q"></path><path class="under svelte-1f6oz0q"></path><path class="wire svelte-1f6oz0q"></path><path class="head svelte-1f6oz0q" d="M-10,-5 L0,0 L-10,5 L-7.5,0 Z"></path><!></g>`);function Tx(e,t){k(t,!0);let n=Dy(),r=j(()=>Math.max(1,1/n.current.zoom)),i=j(()=>t.data),a=j(()=>Z.edges.findIndex(e=>e.id===t.id)),o=j(()=>Pb.endPoint(z(a),`from`)),s=j(()=>Pb.endPoint(z(a),`to`)),c=j(()=>!z(o)||!z(s)||!z(i)?``:z(i).points?.length?Go(z(o),z(i).fromSide,z(s),z(i).toSide,z(i).points):Wo(z(o),z(i).fromSide,z(s),z(i).toSide)),l=j(()=>{if(!z(s)||!z(i))return``;let[e,t]=Lo[z(i).toSide];return`translate(${String(z(s).x+e*10)} ${String(z(s).y+t*10)}) rotate(${String(Math.atan2(-t,-e)*180/Math.PI)})`}),u=Z.nameOf,d=j(()=>{if(!z(c)||Z.hovered!==t.id&&!t.selected||Z.live)return``;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,z(c));let n=e.getPointAtLength(e.getTotalLength()/2);return`translate(${String(n.x)} ${String(n.y)}) scale(${String(z(r))})`});var f=ci(),p=F(f),m=e=>{var n=wx();let i;var a=P(n),o=I(a),s=L(a);let f;var p=L(s),m=L(p),h=L(m),g=L(h),_=e=>{var n=Cx();R((e,t)=>{q(n,`transform`,z(d)),q(n,`aria-label`,`Unplug ${e??``} from ${t??``}`)},[()=>u(t.source),()=>u(t.target)]),V(`click`,n,e=>{e.stopPropagation(),Z.cut(t.source,t.target)}),V(`keydown`,n,e=>{(e.key===`Enter`||e.key===` `)&&Z.cut(t.source,t.target)}),U(e,n)};G(g,e=>{z(d)&&e(_)}),O(n),R((e,t,a,u,d,g)=>{i=Ji(n,0,`svelte-1f6oz0q`,null,i,{idle:e,dimmed:t,lit:a,snapped:u}),W(o,`${d??``} calls local ${g??``}. Click to pick it; the × in its middle unplugs it.`),q(s,`d`,z(c)),f=Xi(s,``,f,{"stroke-width":`${16*z(r)}px`}),q(p,`d`,z(c)),q(m,`d`,z(c)),q(h,`transform`,z(l))},[()=>!Q.up(t.source)||!Q.up(t.target),()=>Z.dimmedLink(t.source,t.target),()=>Z.lit(t.source,t.target),()=>Z.snapped.includes(t.id),()=>u(t.source),()=>u(t.target)]),B(`pointerenter`,n,()=>Z.hovered=t.id),B(`pointerleave`,n,()=>Z.hovered=null),U(e,n)};G(p,e=>{z(c)&&e(m)}),U(e,f),A()}Zr([`click`,`keydown`]);var Ex=H(`<span class="dot svelte-1dgo2s3"></span>`),Dx=H(`<span><!> </span>`),Ox=H(`<button class="nodrag svelte-1dgo2s3" type="button"><!></button>`),kx=H(`<div><!></div>`),Ax=H(`<div><span class="head svelte-1dgo2s3"><!> <span class="name svelte-1dgo2s3"> </span> <!> <span class="acts svelte-1dgo2s3"></span></span> <!></div>`);function jx(e,t){k(t,!0);let n=Y(t,`detail`,3,``),r=Y(t,`detailWarn`,3,!1),i=Y(t,`dotTitle`,3,``),a=Y(t,`hasDot`,3,!1),o=Y(t,`title`,3,``),s=Y(t,`selected`,3,!1),c=Y(t,`active`,3,!1);var l=Ax();let u;var d=P(l),p=P(d),m=e=>{var n=Ex();R(()=>{q(n,`data-on`,t.dot??null),q(n,`title`,i())}),U(e,n)};G(p,e=>{a()&&e(m)});var h=L(p,2),g=I(h,!0),_=L(h,2),v=e=>{var i=Dx();let a;var o=P(i);Fi(o,()=>t.flag??f);var s=L(o,1,!0);O(i),R(()=>{a=Ji(i,1,`detail svelte-1dgo2s3`,null,a,{warn:r()}),W(s,n())}),U(e,i)};G(_,e=>{(t.flag||n())&&e(v)});var y=L(_,2);K(y,21,()=>t.actions,e=>e.label,(e,t)=>{var n=Ox(),r=P(n),i=e=>{Fc(e,{size:13})},a=e=>{X(e,{get of(){return z(t).icon},size:13})};G(r,e=>{z(t).icon===`cog`?e(i):e(a,-1)}),O(n),R(()=>{q(n,`aria-label`,z(t).label),q(n,`title`,z(t).title)}),V(`click`,n,()=>{z(t).run()}),U(e,n)}),O(y),O(d);var b=L(d,2),x=e=>{var n=kx();let r;Fi(P(n),()=>t.children),O(n),R(()=>r=Ji(n,1,`body svelte-1dgo2s3`,null,r,{"under-dot":a()})),U(e,n)};G(b,e=>{t.children&&e(x)}),O(l),R(e=>{u=Ji(l,1,`infra ${t.kind??``}`,`svelte-1dgo2s3`,u,{active:c(),selected:s(),dimmed:e}),q(l,`title`,o()),W(g,t.name)},[()=>Z.dimmed(t.id)]),U(e,l),A()}Zr([`click`]);function Mx(e,t){k(t,!0);{let n=j(()=>t.data.about.join(`
|
|
17
|
+
`)),r=j(()=>[{label:`Settings for ${t.data.name}`,title:`Settings: its addresses, and the apps it calls`,icon:`cog`,run:()=>void Wb.settings?.open({title:t.data.name,path:`apps.${t.id.slice(8)}`})},{label:`Hide ${t.data.name}`,title:`Take it off the board. Bring it back from the list of apps.`,icon:to,run:()=>{Z.showOutside(t.id.slice(8),!1)}}]);jx(e,{get id(){return t.id},kind:`outside`,get name(){return t.data.name},get title(){return z(n)},get selected(){return t.selected},get actions(){return z(r)},children:(e,n)=>{je();var r=si();R(()=>W(r,t.data.where)),U(e,r)},$$slots:{default:!0}})}A()}var Nx=new Set([`$$slots`,`$$events`,`$$legacy`]);function Px(e,t){let n=J(t,Nx),r={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}],[`path`,{d:`M12 9v4`}],[`path`,{d:`M12 17h.01`}]],aliases:[`alert-triangle`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Fx=H(`<span class="warn svelte-1jmpek8" role="img"><!></span>`),Ix=H(`<span role="radiogroup"><label class="svelte-1jmpek8"><input type="radio" class="svelte-1jmpek8"/>Deployed</label> <label class="svelte-1jmpek8"><input type="radio" class="svelte-1jmpek8"/>Local</label></span>`);function Lx(e,t){k(t,!0);let n=j(()=>Z.env.toUpperCase()),r=Dy(),i=j(()=>r.current.zoom<$s);{let r=e=>{var n=ci(),r=F(n),a=e=>{var n=Fx();X(P(n),{get of(){return Px},size:13}),O(n),R(e=>{q(n,`aria-label`,t.data.shares),q(n,`title`,e)},[()=>t.data.about.slice(1).join(`
|
|
18
|
+
`)]),U(e,n)};G(r,e=>{t.data.shares&&!z(i)&&e(a)}),U(e,n)},a=j(()=>t.data.about.join(`
|
|
19
|
+
`)),o=j(()=>[{label:`Settings for ${t.data.name}`,title:`Settings: the queue's name and its queue on each environment`,icon:`cog`,run:()=>void Wb.settings?.open({title:t.data.name,path:`queues.${t.data.queue}`})},{label:`Hide ${t.data.name}`,title:`Hide this queue: its apps use the deployed one. Bring it back from Queues on an app's card.`,icon:to,run:()=>{Z.showQueues([t.data.queue],!1)}}]);jx(e,{get id(){return t.id},kind:`queue`,get name(){return t.data.name},get detail(){return t.data.kind},get title(){return z(a)},get selected(){return t.selected},get active(){return t.data.local},get actions(){return z(o)},flag:r,children:(e,r)=>{var i=Ix();let a;var o=P(i),s=P(o);ma(s),je(),O(o);var c=L(o,2),l=P(c);ma(l),je(),O(c),O(i),R(()=>{a=Ji(i,1,`seg nodrag svelte-1jmpek8`,null,a,{local:t.data.local}),q(i,`aria-label`,`Which ${t.data.name??``} its apps use`),q(o,`title`,`The ${z(n)??``} queue`),q(s,`name`,`queue-${t.data.queue??``}`),ga(s,!t.data.local),q(c,`aria-disabled`,!t.data.can),q(c,`title`,t.data.can?`Koppler runs it on your Mac and points its apps at it`:`Koppler cannot run a ${t.data.kind} queue locally yet`),q(l,`name`,`queue-${t.data.queue??``}`),ga(l,t.data.local),l.disabled=!t.data.can}),V(`change`,s,()=>{Z.setQueue(t.data.queue,!1)}),V(`change`,l,()=>{Z.setQueue(t.data.queue,!0)}),U(e,i)},$$slots:{flag:!0,default:!0}})}A()}Zr([`change`]);var Rx=H(`<span class="host svelte-s23l4l"> </span>`);function zx(e,t){k(t,!0);let n=j(()=>Q.tunnel(t.data.local.split(`:`).at(-1)??``,t.data.apps)),r=j(()=>[...t.data.what.startsWith(`Database`)?[{label:`Query the ${t.data.what}`,title:`Open psql on it in a Terminal window, with the stored connection`,icon:ro,run:()=>void yc(t.data.apps[0]??``,!0)}]:[],{label:`Settings for the ${t.data.what} tunnel`,title:`Settings: the host, its port and how it is opened`,icon:`cog`,run:()=>void Wb.settings?.open({title:`${t.data.what} tunnel`,path:t.data.settings})},{label:`Run without this tunnel`,title:`Turn it off: the tunnel is not opened, so calls to it fail. Turn Tunnels back on on the app's card to bring it back.`,icon:to,run:()=>{Z.hideTunnel(t.id)}}]);{let i=j(()=>z(n)?`Tunnel is up`:z(n)===!1?`Nothing is listening on this port`:`Not running`),a=j(()=>[t.data.host,...t.data.about].join(`
|
|
20
|
+
`));jx(e,{get id(){return t.id},kind:`tunnel`,get name(){return t.data.what},get detail(){return t.data.local},get detailWarn(){return t.data.moved},hasDot:!0,get dot(){return z(n)},get dotTitle(){return z(i)},get title(){return z(a)},get selected(){return t.selected},get actions(){return z(r)},children:(e,n)=>{var r=Rx(),i=I(r,!0);R(()=>W(i,t.data.host)),U(e,r)},$$slots:{default:!0}})}A()}var Bx=new class{#e=M(!1);get canUndo(){return z(this.#e)}set canUndo(e){N(this.#e,e,!0)}#t=M(!1);get canRedo(){return z(this.#t)}set canRedo(e){N(this.#t,e,!0)}#n=[];#r=[];#i=``;#a=0;record(){if(Z.live)return;let e=Z.content();e!==this.#i&&(this.#i&&Date.now()-this.#a>700&&this.#n.push(this.#i),this.#i&&(this.#r=[]),this.#i=e,this.#a=Date.now(),this.canUndo=this.#n.length>0,this.canRedo=!1)}adopt(){Z.live||(this.#i=Z.content())}#o(e,t){let n=e.pop();n!==void 0&&(t.push(this.#i),this.#i=n,this.#a=0,Z.setContent(n),this.canUndo=this.#n.length>0,this.canRedo=this.#r.length>0)}undo(){this.#o(this.#n,this.#r)}redo(){this.#o(this.#r,this.#n)}},Vx={ok:!1,unsure:!0,text:`Cannot test`,detail:`Testing needs the Koppler canvas running (koppler canvas).`},Hx=new class{#e=M(pn({}));get results(){return z(this.#e)}set results(e){N(this.#e,e,!0)}#t=new Set;#n=new Map;async test({key:e,payload:t},n=!1){if(this.results[e]?.state===`busy`&&this.results[e].text!==`Starting`)return;let r=`node`in t?t.node:`to`in t?t.to:null;if(r&&Q.sent(r)&&Q.status?.running?.includes(r)&&!Q.up(r)){let i=`${Z.nameOf(r)} is starting. Koppler checks again once it answers.`;this.results[e]={state:`busy`,text:`Starting`,detail:i},this.#n.set(e,{target:r,payload:t}),n||$.show(i);return}this.results[e]={state:`busy`};let i=await Js(`cable-test`,{env:Z.env,...t,...n&&{auto:!0}}),a=i?.ok?await i.json().catch(()=>Vx):Vx;this.results[e]={state:a.unsure?`warn`:a.ok?`ok`:`bad`,text:a.text,detail:a.detail},!n&&(!a.ok||a.unsure)&&$.show(a.detail,`warning`)}forget(e){this.results=Object.fromEntries(Object.entries(this.results).filter(([t])=>!e.includes(t)))}follow(e){let t=Q.status?.running??[];for(let[e,{target:n,payload:r}]of this.#n)(!t.includes(n)||Q.up(n))&&(this.#n.delete(e),this.results[e]?.text===`Starting`&&this.test({key:e,payload:r},!0));for(let t of e)t.apps.every(e=>Q.sent(e)&&Q.up(e))?this.#t.has(t.key)||(this.#t.add(t.key),this.test(t,!0)):this.#t.delete(t.key)&&(this.results=Object.fromEntries(Object.entries(this.results).filter(([e])=>e!==t.key)))}},Ux=()=>{try{let e=localStorage.getItem(`koppler-theme`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}},Wx=new class{#e=M(pn(Ux()));get now(){return z(this.#e)}set now(e){N(this.#e,e,!0)}pick(e){this.now=e,e===`system`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e;try{e===`system`?localStorage.removeItem(`koppler-theme`):localStorage.setItem(`koppler-theme`,e)}catch{}}},Gx=H(`<div class="views svelte-ibqofz" role="radiogroup" aria-label="Board view" title="Edit (E): set up apps and cables. Live (L): what is running, large enough to read at a glance."><label class="svelte-ibqofz"><input type="radio" name="view" class="svelte-ibqofz"/>Edit</label> <label class="svelte-ibqofz"><input type="radio" name="view" class="svelte-ibqofz"/>Live</label></div>`),Kx=H(`<button class="tool svelte-ibqofz" type="button" role="radio"><!></button>`),qx=H(`<span class="sep svelte-ibqofz" aria-hidden="true"></span> <button class="clear svelte-ibqofz" title="Remove every card from this board. Undo brings them back.">Clear</button>`,1),Jx=H(`<div class="tools svelte-ibqofz" role="toolbar" aria-label="Board"><div class="switch svelte-ibqofz" role="radiogroup" aria-label="Dragging on the board"></div> <span class="sep svelte-ibqofz" aria-hidden="true"></span> <button class="tool svelte-ibqofz" type="button" aria-label="Undo" title="Undo (Ctrl+Z or Cmd+Z)"><!></button> <button class="tool svelte-ibqofz" type="button" aria-label="Redo" title="Redo (Shift+Ctrl+Z or Shift+Cmd+Z)"><!></button> <span class="sep svelte-ibqofz" aria-hidden="true"></span> <button title="Arrange cards by who calls whom, callers on top" class="svelte-ibqofz">Arrange</button> <button title="Zoom to fit all apps (F)" class="svelte-ibqofz">Fit</button> <span class="sep svelte-ibqofz" aria-hidden="true"></span> <div class="zoom svelte-ibqofz" role="group" aria-label="Zoom"><button aria-label="Zoom out" class="svelte-ibqofz"><!></button> <button class="percent svelte-ibqofz" title="Reset to 100%"> </button> <button aria-label="Zoom in" class="svelte-ibqofz"><!></button></div> <span class="sep svelte-ibqofz" aria-hidden="true"></span> <button class="tool svelte-ibqofz" type="button"><!></button> <!></div>`),Yx=oi(`<path></path>`),Xx=oi(`<g><path class="under svelte-ibqofz"></path><path class="wire svelte-ibqofz"></path><path class="head svelte-ibqofz" d="M-9,-4.5 L0,0 L-9,4.5 L-6.75,0 Z"></path><circle class="plug svelte-ibqofz" r="5"></circle></g>`),Zx=oi(`<svg class="links svelte-ibqofz" aria-hidden="true"><!><!></svg>`),Qx=oi(`<circle role="presentation" r="5"></circle>`),$x=oi(`<title class="svelte-ibqofz"> </title>`),eS=oi(`<circle r="8"><!></circle><circle class="light svelte-ibqofz" r="3.4"></circle>`,1),tS=oi(`<!><!>`,1),nS=oi(`<circle role="button" tabindex="0" class="socket tested press nodrag nopan svelte-ibqofz" r="7"><title class="svelte-ibqofz"> </title></circle><circle class="light svelte-ibqofz" r="3.4"></circle>`,1),rS=oi(`<path class="draft svelte-ibqofz"></path>`),iS=oi(`<svg role="group" aria-label="Cable ends"><!><!><!></svg>`),aS=H(`<!> <!> <!> <!> <!> <!>`,1),oS=H(`<li class="svelte-ibqofz"><button type="button" class="svelte-ibqofz"><span class="name svelte-ibqofz"> </span> <span class="meta svelte-ibqofz"> </span></button></li>`),sS=H(`<ul aria-label="Or open a board" class="svelte-ibqofz"></ul>`),cS=H(`<div class="empty svelte-ibqofz"><p class="svelte-ibqofz">Click the apps you want to run together.<br/>Connect them; the board is saved as you go.</p> <!></div>`),lS=H(`<div class="area svelte-ibqofz" role="presentation"><!> <!></div>`);function uS(e,t){k(t,!0);let n=Rv();Z.toFlow=e=>n.screenToFlowPosition(e,{snapToGrid:!1}),Z.zoom=()=>n.getZoom();let r=Dy(),i=0,a=null,o=j(()=>Z.panelCard?.id),s=e=>{let{x:t,y:r,zoom:a}=n.getViewport(),o=Z.panelCard?.id;if(!o){i&&n.setViewport({x:t+i,y:r,zoom:a}),i=0;return}if(i||e)return;let s=z(c)?.querySelector(`.svelte-flow__node[data-id="${CSS.escape(o)}"]`)?.getBoundingClientRect();!s||s.right<=Z.area().right||(n.setViewport({x:t-300,y:r,zoom:a}),i=300)};In(()=>{if(z(o)===void 0&&!i)return;let e=a;e?window.addEventListener(`pointerup`,t=>setTimeout(()=>{s(Math.hypot(t.clientX-e.x,t.clientY-e.y)>4)}),{once:!0}):setTimeout(()=>{s(!1)})});let c=M(void 0);Z.area=()=>z(c)?.getBoundingClientRect()??new DOMRect,Z.show=e=>{Z.pick(e);let t=n.getZoom();n.fitView({nodes:[{id:e}],minZoom:t,maxZoom:t,duration:200})};let l={padding:.15,duration:200,maxZoom:1},u={w:260,h:160},d=e=>()=>void n.setZoom(n.getZoom()*e,{duration:150}),f=j(()=>[...Z.team.map(e=>({preset:e,team:!0})),...Z.own.map(e=>({preset:e,team:!1}))].map((e,t)=>({...e,index:t,at:Z.recent.find(t=>t.name===e.preset.name)?.at??``})).sort((e,t)=>e.at===t.at?e.index-t.index:e.at>t.at?-1:1).slice(0,6)),p={x:0,y:0};In(()=>{Hx.follow(z(ae))});let m=j(()=>{let e=Pb.draft;return e?e.points.length?Go(e.a,e.side,e.b,e.bSide,e.points):Wo(e.a,e.side,e.b,e.bSide):``}),h=M(`select`),g=M(!1),_=j(()=>z(h)===`hand`||z(g)),y=e=>{e.code!==`Space`||e.target.closest(`input, select, textarea, button`)||N(g,e.type===`keydown`)},b=[[`select`,`Select (V): drag on the board to select an area`,Gy],[`hand`,`Hand (H): drag to move around. Or hold Space while dragging`,zy]],x={Shift:`shiftKey`,Meta:`metaKey`,Control:`ctrlKey`,Alt:`altKey`},S={Shift:!1,Meta:!1,Control:!1,Alt:!1},C=e=>{e.key in x&&(S[e.key]=e.type===`keydown`)},w=e=>{let t=Object.keys(x);if(!t.every(t=>!S[t]||e[x[t]])){for(let e of t)S[e]=!1;window.dispatchEvent(new Event(`blur`))}},ee=e=>{if(e.altKey||e.target.closest(`input, select, textarea`)||document.querySelector(`dialog[open], :popover-open`))return;let t=e.key.toLowerCase();if(e.metaKey||e.ctrlKey){if(t===`a`&&!Z.live){e.preventDefault(),Z.selectAll();return}if(t!==`z`)return;e.preventDefault(),e.shiftKey?Bx.redo():Bx.undo()}else t===`f`?fe():t===`p`||t===`escape`&&Z.present?de():t===`e`?Z.goEdit():t===`l`?Z.goLive():e.key===`v`||e.key===`V`?N(h,`select`):(e.key===`h`||e.key===`H`)&&N(h,`hand`)},T=Z.view?{initialViewport:Z.view}:Z.nodes.length?{fitView:!0,fitViewOptions:l}:{},te=!1;In(()=>{if(te||!Z.nodes.length||Z.boxes.size<Z.nodes.length)return;te=!0;let e=Z.area();[...z(c)?.querySelectorAll(`.svelte-flow__node`)??[]].some(t=>{let n=t.getBoundingClientRect();return n.right>e.left&&n.left<e.right&&n.bottom>e.top&&n.top<e.bottom})||fe(0)});let E=(e,t)=>{let n=t.x+t.w/2-(e.x+e.w/2),r=t.y+t.h/2-(e.y+e.h/2),i=Math.abs(n)*.6>Math.abs(r),[a,o]=i?n>0?[`right`,`left`]:[`left`,`right`]:r>0?[`bottom`,`top`]:[`top`,`bottom`],s=Ho(t,o),c=Ho(e,a),l=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));return i?c.y=l(s.y,e.y+12,e.y+e.h-12):c.x=l(s.x,e.x+12,e.x+e.w-12),{d:Wo(c,a,s,o),end:s}},ne=j(()=>Z.links.flatMap(({from:e,to:t,tunnel:n})=>{let r=Z.boxes.get(e),i=Z.infraBoxes.get(t);if(!r||!i)return[];let a={app:e,host:n.bind,port:n.port,original:n.original};return[{key:`${e}>${t}`,from:e,to:t,what:n.what,payload:a,...E(r,i),idle:!Q.up(e)}]})),re=Z.nameOf,ie=(e,t)=>e?.state===`busy`?e.detail?`${e.text??``}. ${e.detail}`:`Testing…`:e?.detail?`${e.text??``}. ${e.detail} Click to test again.`:`Not tested yet. Click to test that ${t}.`,ae=j(()=>[...Z.edges.map(({id:e,source:t,target:n})=>({key:e,apps:[t,n],payload:{from:t,to:n}})),...z(ne).map(({key:e,from:t,payload:n})=>({key:e,apps:[t],payload:n}))]),oe=j(()=>Z.flows.flatMap(({from:e,to:t,queue:n})=>{let r=e=>Z.boxes.get(e)??Z.infraBoxes.get(e),[i,a]=[r(e),r(t)];if(!i||!a)return[];let o=a.x+a.w/2-(i.x+i.w/2),s=a.y+a.h/2-(i.y+i.h/2),c=o>0?[`right`,`left`]:[`left`,`right`],l=Math.abs(o)*.6>Math.abs(s)?c:s>0?[`bottom`,`top`]:[`top`,`bottom`],u=Z.ledBy(e).includes(t)||Z.ledBy(t).includes(e),d=(e,t)=>Z.boxes.has(e)&&!!Z.ledBy(e).length&&Z.infraSide(e)===t;!u&&(d(e,l[0])||d(t,l[1]))&&(l=c);let[f,p]=[Ho(i,l[0]),Ho(a,l[1])],[m,h]=Lo[l[1]];return[{key:`${e}>${t}`,from:e,to:t,d:Wo(f,l[0],p,l[1]),start:f,head:`translate(${String(p.x+m*2)} ${String(p.y+h*2)}) rotate(${String(Math.atan2(-h,-m)*180/Math.PI)})`,kind:n?Z.queues[n]===`local`?`msg local`:`msg`:`ext`}]})),se=j(()=>new Map(Z.nodes.map((e,t)=>[e.id,(e.selected?Z.nodes.length:0)+t]))),ce=(e,t)=>{let n=z(se).get(t)??0;return[...Z.boxes].some(([r,i])=>r!==t&&(z(se).get(r)??0)>n&&e.x>i.x+1&&e.x<i.x+i.w-1&&e.y>i.y+1&&e.y<i.y+i.h-1)},le=()=>new Promise(requestAnimationFrame);In(()=>{Z.brief=r.current.zoom<.6||Z.live});let ue=!1,de=async()=>{if(Z.present=!Z.present,!ue){for(ue=!0,Z.entering=!0;Z.present!==!!document.fullscreenElement;){let e=Z.present;if(await(e?document.documentElement.requestFullscreen():document.exitFullscreen()).catch(()=>void 0),e!==!!document.fullscreenElement)break}Z.entering=!1,ue=!1}await le(),await le(),await fe()},fe=async(e=l.duration)=>{let t=(e,t)=>{let n=Math.min(...e.map(e=>e.x)),r=Math.min(...e.map(e=>e.y));return ph({x:n,y:r,width:Math.max(...e.map(e=>e.x+e.w))-n,height:Math.max(...e.map(e=>e.y+e.h))-r},z(c)?.clientWidth??0,z(c)?.clientHeight??0,.2,t,l.padding)},r=()=>[...Z.nodes.map(e=>({...e.position,...pe[e.id]??Z.boxes.get(e.id)??u})),...Z.infra.map(e=>({...e.position,...Z.infraBoxes.get(e.id)??u}))],i=()=>[...Z.boxes.values(),...Z.infraBoxes.values()];if(z(c)&&Z.nodes.length){for(let i=0;i<2;i++){let a=t(r(),l.maxZoom);if(a.zoom<.6)break;if(await n.setViewport(a,{duration:i?e:0}),await le(),await le(),t(r(),l.maxZoom).zoom>=.6)return}Z.brief||(await n.setViewport(t(r(),l.maxZoom),{duration:0}),await le(),await le()),await n.setViewport(t(i(),$s-.01),{duration:e})}},pe={};In(()=>{if(r.current.zoom<.6||Z.live)return;for(let[e,{w:t,h:n}]of Z.boxes)pe[e]={w:t,h:n};let e=Object.fromEntries([...Z.boxes].map(([e,t])=>[e,Math.round(t.h)]));Object.entries(e).some(([e,t])=>Z.fullHeights[e]!==t)&&Nr(()=>Z.fullHeights={...Z.fullHeights,...e})});let me=async()=>{!Z.live&&r.current.zoom<.6&&!Z.nodes.every(e=>pe[e.id])&&(await n.setZoom(1,{duration:0}),await le(),await le()),Z.arrange(e=>{let t=Z.boxes.get(e)??{w:260,h:160};return pe[e]??{w:t.w,h:Z.fullHeights[e]??t.h}}),requestAnimationFrame(()=>void fe())};In(()=>{let e=Z.opened;e&&Z.nodes.every(e=>e.measured?.width)&&(Z.opened=null,e===`arrange`?me():requestAnimationFrame(()=>void fe()))});var he=lS();B(`keydown`,gn,e=>{C(e),y(e),ee(e)}),B(`keyup`,gn,e=>{C(e),y(e)}),B(`blur`,gn,()=>N(g,!1)),B(`pointermove`,gn,w,!0),B(`pointerdown`,gn,e=>a={x:e.clientX,y:e.clientY},!0),B(`pointerup`,gn,()=>a=null,!0);var ge=P(he),_e=()=>Z.flowNodes(),ve=e=>{Z.fromFlow(e,`${String(r.current.zoom<.6)} ${String(Z.live)}`,Q.asked)&&Bx.adopt()};{let e=j(()=>({app:Sx,tunnel:zx,queue:Lx,outside:Mx})),t=j(()=>({cable:Tx})),a=j(()=>Z.live?null:[`Backspace`,`Delete`]),o=j(()=>!Z.live&&!z(_)),s=j(()=>!z(_)),c=j(()=>z(_)?!0:[1,2]),l=j(()=>!z(_));ty(ge,Ba({get nodes(){return _e()},set nodes(e){ve(e)},get nodeTypes(){return z(e)},get edgeTypes(){return z(t)},get connectionMode(){return Tm.Loose},get deleteKey(){return z(a)},get nodesDraggable(){return z(o)},get elementsSelectable(){return z(s)},nodeDragThreshold:4,nodeClickDistance:4,panOnScroll:!0,panOnScrollSpeed:1,get panOnDrag(){return z(c)},get selectionOnDrag(){return z(l)},get selectionMode(){return Dm.Partial},get colorMode(){return Wx.now},minZoom:.2,proOptions:{hideAttribution:!0}},()=>T,{onmoveend:(e,t)=>{Z.live||(Z.view={...t,x:t.x+i})},get edges(){return Z.edges},set edges(e){Z.edges=e},children:(e,t)=>{var i=aS(),a=F(i);py(a,{get variant(){return oy.Dots},gap:24,size:2.4,bgColor:`var(--paper)`,patternColor:`var(--dot)`});var o=L(a,2);Kv(o,{position:`top-left`,children:(e,t)=>{var n=Gx(),r=P(n),i=P(r);ma(i),je(),O(r);var a=L(r,2),o=P(a);ma(o),je(),O(a),O(n),R(()=>{ga(i,!Z.live),ga(o,Z.live)}),V(`change`,i,()=>{Z.goEdit()}),V(`change`,o,()=>{Z.goLive()}),U(e,n)},$$slots:{default:!0}});var s=L(o,2);Kv(s,{position:`bottom-right`,children:(e,t)=>{var i=Jx(),a=P(i);K(a,21,()=>b,([e,t,n])=>e,(e,t,n,r)=>{var i=j(()=>v(z(t),3));let a=()=>z(i)[0],o=()=>z(i)[1],s=()=>z(i)[2];var c=Kx();X(P(c),{get of(){return s()},size:15}),O(c),R(()=>{q(c,`aria-checked`,z(h)===a()),q(c,`aria-label`,o()),q(c,`title`,o())}),V(`click`,c,()=>N(h,a(),!0)),U(e,c)}),O(a);var o=L(a,4);X(P(o),{get of(){return Yy},size:15}),O(o);var s=L(o,2);X(P(s),{get of(){return qy},size:15}),O(s);var c=L(s,4),l=L(c,2),u=L(l,4),f=P(u),p=j(()=>d(1/1.2));X(P(f),{get of(){return Fy},size:13}),O(f);var m=L(f,2),g=I(m),_=L(m,2),y=j(()=>d(1.2));X(P(_),{get of(){return Ly},size:13}),O(_),O(u);var x=L(u,4),S=P(x);{let e=j(()=>Z.present?Uy:Vy);X(S,{get of(){return z(e)},size:15})}O(x);var C=L(x,2),w=e=>{var t=qx(),n=L(F(t),2);R(()=>n.disabled=!Z.nodes.length),V(`click`,n,()=>{let e=Z.nodes.length;Yb.review={title:`Clear ${Z.name??`this board`}?`,sub:`Takes ${e===1?`its app`:`all ${String(e)} apps`} and their cables off the board. Undo brings them back.`,notices:[],groups:[],ok:`Clear board`,prod:!0,blocked:!1,confirm:()=>{Z.clear()}}}),U(e,t)};G(C,e=>{Z.present||e(w)}),O(i),R(e=>{o.disabled=!Bx.canUndo,s.disabled=!Bx.canRedo,W(g,`${e??``}%`),q(x,`aria-label`,Z.present?`Stop presenting`:`Present`),q(x,`title`,Z.present?`Stop presenting (Esc)`:`Present: the board alone, full screen (P)`),q(x,`aria-pressed`,Z.present)},[()=>Math.round(r.current.zoom*100)]),V(`click`,o,()=>{Bx.undo()}),V(`click`,s,()=>{Bx.redo()}),V(`click`,c,()=>void me()),V(`click`,l,()=>void fe()),V(`click`,f,function(...e){z(p)?.apply(this,e)}),V(`click`,m,()=>void n.setZoom(1,{duration:200})),V(`click`,_,function(...e){z(y)?.apply(this,e)}),V(`click`,x,()=>void de()),U(e,i)},$$slots:{default:!0}});var c=L(s,2);Cy(c,{position:`bottom-right`,pannable:!0,zoomable:!0,width:168,height:112,ariaLabel:`Overview of the board`,nodeBorderRadius:8,nodeStrokeWidth:0,nodeColor:e=>e.type===`app`?`color-mix(in oklab, var(--cable) 60%, var(--panel))`:`var(--line)`,bgColor:`var(--panel)`,maskColor:`color-mix(in oklab, var(--desk) 72%, transparent)`,maskStrokeColor:`var(--line)`,maskStrokeWidth:1});var l=L(c,2);ay(l,{target:`back`,children:(e,t)=>{var n=Zx(),r=P(n);K(r,17,()=>z(ne),e=>e.key,(e,t)=>{var n=Yx();let r;R((e,i,a)=>{r=Ji(n,0,`link svelte-ibqofz`,null,r,{idle:z(t).idle,dimmed:e,lit:i,snapped:a}),q(n,`d`,z(t).d)},[()=>Z.dimmedLink(z(t).from,z(t).to),()=>Z.lit(z(t).from,z(t).to),()=>Z.snapped.includes(`${z(t).from}>${z(t).to}`)]),U(e,n)}),K(L(r),17,()=>z(oe),e=>e.key,(e,t,n,r)=>{var i=Xx();let a;var o=P(i),s=L(o),c=L(s),l=L(c);O(i),R((e,n,r)=>{a=Ji(i,0,`flow ${z(t).kind??``}`,`svelte-ibqofz`,a,{dimmed:e,lit:n,snapped:r}),q(o,`d`,z(t).d),q(s,`d`,z(t).d),q(c,`transform`,z(t).head),q(l,`cx`,z(t).start.x),q(l,`cy`,z(t).start.y)},[()=>Z.dimmedLink(z(t).from,z(t).to),()=>Z.lit(z(t).from,z(t).to),()=>Z.snapped.includes(`${z(t).from}>${z(t).to}`)]),U(e,i)}),O(n),U(e,n)},$$slots:{default:!0}}),ay(L(l,2),{target:`front`,style:`position: absolute; z-index: 1001`,children:(e,t)=>{var n=iS();let r;var i=P(n);K(i,19,()=>Z.edges,e=>e.id,(e,t,n)=>{let r=j(()=>Pb.endPoint(z(n),`from`)),i=j(()=>Pb.endPoint(z(n),`to`));var a=ci(),o=F(a),s=e=>{let n=j(()=>Q.sent(z(t).source)&&Q.sent(z(t).target)),a=j(()=>Hx.results[z(t).id]);var o=tS(),s=F(o),c=e=>{var n=Qx();let i;R((e,a)=>{i=Ji(n,0,`plug nodrag nopan svelte-ibqofz`,null,i,{cut:Z.hovered===z(t).id,idle:e,dimmed:a,grabbed:Pb.grabbed?.id===z(t).id&&Pb.grabbed.end===`from`}),q(n,`data-cable`,z(t).id),q(n,`cx`,z(r).x),q(n,`cy`,z(r).y)},[()=>!Q.up(z(t).source)||!Q.up(z(t).target),()=>Z.dimmedLink(z(t).source,z(t).target)]),V(`pointerdown`,n,e=>{Pb.grabEnd(e,z(t).id,`from`)}),U(e,n)},l=j(()=>!ce(z(r),z(t).source));G(s,e=>{z(l)&&e(c)});var u=L(s),d=e=>{var r=eS(),o=F(r);let s;var c=P(o),l=e=>{var n=$x(),r=I(n,!0);R(e=>W(r,e),[()=>ie(z(a),`local ${re(z(t).target)} answers`)]),U(e,n)};G(c,e=>{z(n)&&e(l)}),O(o);var u=L(o);R((e,r)=>{q(o,`role`,z(n)?`button`:`presentation`),q(o,`tabindex`,z(n)?0:void 0),q(o,`aria-label`,e),s=Ji(o,0,`socket nodrag nopan svelte-ibqofz`,null,s,{dimmed:r,tested:z(n),grabbed:Pb.grabbed?.id===z(t).id&&Pb.grabbed.end===`to`}),q(o,`data-cable`,z(t).id),q(o,`cx`,z(i).x),q(o,`cy`,z(i).y),q(u,`data-state`,z(n)?z(a)?.state??`idle`:void 0),q(u,`data-light`,z(t).id),q(u,`cx`,z(i).x),q(u,`cy`,z(i).y)},[()=>z(n)?`Test that local ${re(z(t).target)} answers ${re(z(t).source)}`:void 0,()=>Z.dimmedLink(z(t).source,z(t).target)]),V(`keydown`,o,e=>{!z(n)||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Hx.test({key:z(t).id,payload:{from:z(t).source,to:z(t).target}}))}),V(`pointerdown`,o,e=>{p={x:e.clientX,y:e.clientY},Pb.grabEnd(e,z(t).id,`to`)}),V(`click`,o,e=>{z(n)&&Math.hypot(e.clientX-p.x,e.clientY-p.y)<6&&Hx.test({key:z(t).id,payload:{from:z(t).source,to:z(t).target}})}),U(e,r)},f=j(()=>!ce(z(i),z(t).target));G(u,e=>{z(f)&&e(d)}),U(e,o)};G(o,e=>{z(r)&&z(i)&&e(s)}),U(e,a)});var a=L(i);K(a,17,()=>z(ne),e=>e.key,(e,t)=>{var n=ci(),r=F(n),i=e=>{let n=j(()=>Hx.results[z(t).key]);var r=nS(),i=F(r),a=I(P(i),!0);O(i);var o=L(i);R((e,r,s)=>{q(i,`aria-label`,`Test that ${e??``} reaches its ${r??``} through the tunnel`),q(i,`data-link`,z(t).key),q(i,`cx`,z(t).end.x),q(i,`cy`,z(t).end.y),W(a,s),q(o,`data-state`,z(n)?.state??`idle`),q(o,`data-light`,z(t).key),q(o,`cx`,z(t).end.x),q(o,`cy`,z(t).end.y)},[()=>re(z(t).from),()=>z(t).what.toLowerCase(),()=>ie(z(n),`${re(z(t).from)} reaches its ${z(t).what.toLowerCase()} through the tunnel`)]),V(`keydown`,i,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Hx.test(z(t)))}),V(`pointerdown`,i,e=>{e.stopPropagation()}),V(`click`,i,()=>void Hx.test(z(t))),U(e,r)},a=j(()=>Q.sent(z(t).from));G(r,e=>{z(a)&&e(i)}),U(e,n)});var o=L(a),s=e=>{var t=rS();R(()=>q(t,`d`,z(m))),U(e,t)};G(o,e=>{z(m)&&e(s)}),O(n),R(()=>r=Ji(n,0,`ends svelte-ibqofz`,null,r,{reordering:!!Pb.grabbed,still:Z.live})),U(e,n)},$$slots:{default:!0}}),U(e,i)},$$slots:{default:!0}}))}var ye=L(ge,2),be=e=>{var t=cS(),n=L(P(t),2),r=e=>{var t=sS();K(t,21,()=>z(f),({preset:e,team:t,at:n})=>`${t?`team`:`own`}:${e.name}`,(e,t)=>{let n=()=>z(t).preset,r=()=>z(t).team,i=()=>z(t).at;var a=oS(),o=P(a),s=P(o),c=I(s,!0),l=I(L(s,2));O(o),O(a),R(e=>{W(c,n().name),W(l,`${r()?`Team board`:`Your board`}${e??``}`)},[()=>i()?`, opened ${Ub(i())}`:``]),V(`click`,o,()=>{zb(n())}),U(e,a)}),O(t),U(e,t)};G(n,e=>{z(f).length&&!Z.live&&e(r)}),O(t),U(e,t)};G(ye,e=>{Z.nodes.length||e(be)}),O(he),Ma(he,e=>N(c,e),()=>z(c)),B(`dragover`,he,e=>{e.dataTransfer?.types.includes(`text/app`)&&e.preventDefault()}),B(`drop`,he,e=>{let t=e.dataTransfer?.getData(`text/app`);t&&!Z.live&&(e.preventDefault(),Z.add(t,{x:e.clientX,y:e.clientY}))}),V(`focusin`,he,e=>{let t=e.target.matches(`.svelte-flow__node`)?e.target.getAttribute(`data-id`):null;t&&!z(_)&&![...Z.nodes,...Z.infra].find(e=>e.id===t)?.selected&&Z.pick(t)}),U(e,he),A()}Zr([`focusin`,`change`,`click`,`pointerdown`,`keydown`]);var dS=new Set([`$$slots`,`$$events`,`$$legacy`]);function fS(e,t){let n=J(t,dS),r={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 16v-4`}],[`path`,{d:`M12 8h.01`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var pS=new Set([`$$slots`,`$$events`,`$$legacy`]);function mS(e,t){let n=J(t,pS),r={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var hS=new Set([`$$slots`,`$$events`,`$$legacy`]);function gS(e,t){let n=J(t,hS),r={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var _S=H(`<button class="i svelte-1ixstkt" type="button"><!></button>`),vS=H(`<p class="result svelte-1ixstkt"> </p>`),yS=H(`<form class="svelte-1ixstkt"><input type="password" placeholder="Paste the value, Enter to save" autocomplete="off" spellcheck="false" class="svelte-1ixstkt"/> <button class="go svelte-1ixstkt" type="submit">Save</button> <button type="button" aria-label="Cancel" class="svelte-1ixstkt"><!></button></form>`),bS=H(`<button type="button" class="svelte-1ixstkt">Test</button> <button type="button" class="svelte-1ixstkt">Remove</button>`,1),xS=H(`<button type="button" title="A command for your own terminal that fetches and stores it without showing it" class="svelte-1ixstkt"> </button>`),SS=H(`<p class="nohow svelte-1ixstkt"> </p>`),CS=H(`<div class="cmd svelte-1ixstkt"><p class="svelte-1ixstkt">This command comes from the stack file, so read it before you run it, in your own terminal. It should
|
|
21
|
+
fetch the value and store it without showing it.</p> <!></div>`),wS=H(`<div class="acts svelte-1ixstkt"><button type="button" class="svelte-1ixstkt"> </button> <!></div> <!> <!>`,1),TS=H(`<dt class="svelte-1ixstkt">When</dt> <dd class="svelte-1ixstkt"> </dd>`,1),ES=H(`<li> </li>`),DS=H(`<ol class="svelte-1ixstkt"></ol>`),OS=H(`<dt class="svelte-1ixstkt">Where</dt> <dd class="svelte-1ixstkt"><!></dd>`,1),kS=H(`<dl class="svelte-1ixstkt"><!> <!></dl>`),AS=H(`<div class="cred svelte-1ixstkt"><div class="head svelte-1ixstkt"><code class="svelte-1ixstkt"> </code> <!> <span class="state svelte-1ixstkt"> </span></div> <!> <!> <!></div>`),jS=H(`<section class="svelte-1ixstkt"><h3 class="svelte-1ixstkt"> </h3> <!></section>`),MS=H(`<p class="none svelte-1ixstkt"> </p>`),NS=H(`<button type="button" aria-label="Credentials" aria-haspopup="dialog"><!></button> <div class="pop svelte-1ixstkt" popover="" role="dialog" tabindex="-1" aria-label="Credentials" data-secret=""><!> <p class="lock svelte-1ixstkt"><!> Kept in your Mac's Keychain. Nobody sees them again.</p></div>`,1);function PS(e,t){let n=li();k(t,!0);let r={missing:`Missing`,stored:`Stored`,ok:`Works`,failed:`Does not work`},i=M(void 0),a=M(void 0),o=M(!1),s=new z_,c=j(()=>Z.env.toUpperCase()),l=(e,t)=>`${e}|${Z.env}|${t}`,u=(e,t)=>s.get(l(e,t))??{},d=(e,t,n)=>s.set(l(e,t),{...u(e,t),...n}),f=(e,t)=>{let n=u(e,t.name);return n.until&&n.until>Date.now()?!!n.stored:!!t.stored},p=j(()=>Z.cards.map(e=>({id:e.id,name:e.data.name,list:Q.status?.secrets?.[e.id]?.[Z.env]??[]})).filter(e=>e.list.length)),m=e=>!e.when||/^always\b/i.test(e.when.trim()),h=j(()=>z(p).flatMap(e=>e.list.filter(t=>!f(e.id,t)&&m(t))).length),g=(e,t)=>{let n=u(e,t.name);return f(e,t)?n.tested?n.ok?`ok`:`failed`:`stored`:`missing`},_=e=>e.split(/\s*(?:→|->|=>)\s*/).map(e=>e.trim()).filter(Boolean),v=()=>{let e=z(i)?.getBoundingClientRect();e&&z(a)&&(z(a).style.top=`${String(e.bottom+6)}px`,z(a).style.right=`${String(Math.max(12,innerWidth-e.right))}px`)},y=async(e,t,n)=>{e.preventDefault();let r=e.currentTarget.querySelector(`input`);if(!r?.value.trim())return;let i=await Xs(`secret`,{app:t,env:Z.env,name:n,value:r.value});r.value=``;let a=`error`in i?i.error:``;d(t,n,{form:!!a,tested:!1,ok:!a,message:a}),a||d(t,n,{stored:!0,until:Date.now()+8e3})},b=async(e,t)=>{d(e,t,{message:`Testing…`,tested:!1});let n=await Xs(`secret-test`,{app:e,env:Z.env,name:t});if(`error`in n){d(e,t,{message:n.error,ok:!1});return}let r=/^cannot test/.test(n.message??``),i=(n.message??``).replace(/^failed: /,``).replace(/^cannot test: /,`Cannot be tested: `);d(e,t,{tested:!r,ok:!!n.ok,message:n.ok?``:i.replace(/^./,e=>e.toUpperCase())})},x=async(e,t)=>{let n=await Xs(`secret-remove`,{app:e,env:Z.env,name:t}),r=`error`in n?n.error:``;d(e,t,{tested:!1,ok:!r,message:r}),r||d(e,t,{stored:!1,until:Date.now()+8e3})};var S=NS(),C=F(S);let w;X(P(C),{get of(){return mS},size:16}),O(C),Ma(C,e=>N(i,e),()=>z(i));var ee=L(C,2),T=P(ee);K(T,17,()=>z(p),e=>e.id,(e,t)=>{var n=jS(),i=P(n),a=I(i);K(L(i,2),17,()=>z(t).list,e=>e.name,(e,n)=>{let i=j(()=>u(z(t).id,z(n).name)),a=j(()=>f(z(t).id,z(n))),o=j(()=>g(z(t).id,z(n)));var s=AS(),l=P(s),p=P(l),h=I(p,!0),v=L(p,2),S=e=>{var r=_S();X(P(r),{get of(){return fS},size:14}),O(r),R(e=>{q(r,`aria-expanded`,!!z(i).info),q(r,`aria-label`,`When ${z(n).name??``} is needed and where to get it`),q(r,`title`,`${e??``}When it is needed and where to get it`)},[()=>m(z(n))?``:`Only needed in some setups. `]),V(`click`,r,()=>d(z(t).id,z(n).name,{info:!z(i).info})),U(e,r)};G(v,e=>{(z(n).when||z(n).fetchUi)&&e(S)});var C=L(v,2),w=I(C,!0);O(l);var ee=L(l,2),T=e=>{var t=vS(),n=I(t,!0);R(()=>{q(t,`data-ok`,z(i).ok),W(n,z(i).message)}),U(e,t)};G(ee,e=>{z(i).message&&e(T)});var te=L(ee,2),E=e=>{var r=yS(),i=P(r);_t(i,!0);var a=L(i,4);X(P(a),{get of(){return to},size:14}),O(a),O(r),R(()=>q(i,`aria-label`,`Value for ${z(n).name??``}`)),B(`submit`,r,e=>void y(e,z(t).id,z(n).name)),V(`keydown`,i,e=>{e.key===`Escape`&&(e.preventDefault(),d(z(t).id,z(n).name,{form:!1}))}),V(`click`,a,()=>d(z(t).id,z(n).name,{form:!1})),U(e,r)},ne=e=>{var r=wS(),o=F(r),s=P(o),l=I(s,!0),u=L(s,2),f=e=>{var r=bS(),i=F(r),a=L(i,2);V(`click`,i,()=>void b(z(t).id,z(n).name)),V(`click`,a,()=>void x(z(t).id,z(n).name)),U(e,r)},p=e=>{var r=xS(),a=I(r,!0);R(()=>{q(r,`aria-expanded`,!!z(i).command),W(a,z(i).command?`Hide fetch command`:`Show fetch command`)}),V(`click`,r,()=>d(z(t).id,z(n).name,{command:!z(i).command})),U(e,r)};G(u,e=>{z(a)?e(f):z(n).fetchCli&&e(p,1)}),O(o);var m=L(o,2),h=e=>{var n=SS(),r=I(n);R(()=>W(r,`The stack says nothing about where to get it on ${z(c)??``}. Ask whoever owns ${z(t).name??``}, or ask the agent to
|
|
22
|
+
find it in the repo and add the steps to the stack.`)),U(e,n)};G(m,e=>{!z(a)&&!z(n).fetchCli&&!z(n).fetchUi&&e(h)});var g=L(m,2),_=e=>{var t=CS();Lc(L(P(t),2),{get command(){return z(n).fetchCli}}),O(t),U(e,t)};G(g,e=>{z(i).command&&z(n).fetchCli&&!z(a)&&e(_)}),R(()=>W(l,z(a)?`Replace`:`Set`)),V(`click`,s,()=>d(z(t).id,z(n).name,{form:!0})),U(e,r)};G(te,e=>{z(i).form?e(E):e(ne,-1)});var re=L(te,2),ie=e=>{var t=kS(),r=P(t),i=e=>{var t=TS(),r=I(L(F(t),2),!0);R(()=>W(r,z(n).when)),U(e,t)};G(r,e=>{z(n).when&&e(i)});var a=L(r,2),o=e=>{var t=OS(),r=L(F(t),2),i=P(r),a=e=>{var t=DS();K(t,20,()=>_(z(n).fetchUi),e=>e,(e,t)=>{var n=ES(),r=I(n,!0);R(()=>W(r,t)),U(e,n)}),O(t),U(e,t)},o=j(()=>_(z(n).fetchUi).length>1),s=e=>{var t=si();R(()=>W(t,z(n).fetchUi)),U(e,t)};G(i,e=>{z(o)?e(a):e(s,-1)}),O(r),U(e,t)};G(a,e=>{z(n).fetchUi&&e(o)}),O(t),U(e,t)};G(re,e=>{z(i).info&&e(ie)}),O(s),R(()=>{q(p,`title`,z(n).name),W(h,z(n).name),q(C,`data-state`,z(o)),W(w,r[z(o)])}),U(e,s)}),O(n),R(()=>W(a,`${z(t).name??``} on ${z(c)??``}`)),U(e,n)},e=>{var t=MS(),n=I(t);R(()=>W(n,`No app on the board needs a stored credential on ${z(c)??``}.`)),U(e,t)});var te=L(T,2);X(P(te),{get of(){return gS},size:13}),je(),O(te),O(ee),Ma(ee,e=>N(a,e),()=>z(a)),R(e=>{w=Ji(C,1,`open svelte-1ixstkt`,null,w,{missing:z(h)>0}),q(C,`aria-expanded`,z(o)),q(C,`title`,e),q(C,`popovertarget`,n),q(ee,`id`,n)},[()=>z(h)?`${String(z(h))} ${z(h)===1?`credential is`:`credentials are`} missing for the apps on the board (${z(c)})`:`What the apps on the board need stored`]),B(`toggle`,ee,e=>{N(o,e.newState===`open`),z(o)&&v()}),U(e,S),A()}Zr([`click`,`keydown`]);var FS=H(`<li class="svelte-14dfga3"><span class="mark svelte-14dfga3">!</span><span class="what svelte-14dfga3"> </span></li>`),IS=H(`<li class="svelte-14dfga3"><span class="mark svelte-14dfga3"></span><span class="what svelte-14dfga3">Working out what is needed…</span></li>`),LS=H(`<li class="done svelte-14dfga3"><span class="mark svelte-14dfga3"><!></span><span class="what svelte-14dfga3">Nothing for you to do. Koppler does the rest.</span></li>`),RS=H(`<small class="for svelte-14dfga3"> </small>`),zS=H(`<small class="svelte-14dfga3"> </small>`),BS=H(`<!> <!>`,1),VS=H(`<!> <!> <!> <!>`,1),HS=H(`<li><span class="mark svelte-14dfga3"><!></span> <span class="what svelte-14dfga3"> <!> <!></span></li>`),US=H(`<button class="ok svelte-14dfga3" type="button"> </button>`),WS=H(`<dialog aria-labelledby="checklist-title" class="svelte-14dfga3"><h2 id="checklist-title" class="svelte-14dfga3"> </h2> <p class="sub svelte-14dfga3">In this order. Commands go in your own terminal, not in the agent: secrets must not reach it.</p> <ol class="svelte-14dfga3"><!></ol> <div class="actions svelte-14dfga3"><!> <button type="button" class="svelte-14dfga3">Check again</button> <button type="button" class="svelte-14dfga3">Done</button></div></dialog>`);function GS(e,t){k(t,!0);let n=M(void 0),r=M(null),i=M(``),a=M(!1),o=j(()=>Z.env.toUpperCase());async function s(){N(r,null),N(i,``),N(a,!1),z(n)?.showModal();let e=Z.cards.map(e=>e.id),t=Z.cards.filter(e=>e.data.hideTunnels).map(e=>e.id),o=await Xs(`needs`,{env:Z.env,apps:e,noTunnels:t});`error`in o?N(i,o.error,!0):N(r,o.steps??[])}let c=async()=>{let e=(z(r)??[]).filter(e=>e.gap&&!e.done).map(e=>e.title);N(a,await Yb.askFacts(Z.env,e),!0)};var l={open:s},u=WS(),d=P(u),f=I(d),p=L(d,4),m=P(p),h=e=>{var t=FS(),n=I(L(P(t)),!0);O(t),R(()=>W(n,z(i))),U(e,t)},g=e=>{U(e,IS())},_=e=>{var t=LS(),n=P(t);X(P(n),{get of(){return tb},size:13}),O(n),je(),O(t),U(e,t)},v=e=>{var t=ci();K(F(t),17,()=>z(r),Ei,(e,t,n)=>{var r=HS();let i;var a=P(r),o=P(a),s=e=>{X(e,{get of(){return tb},size:13})},c=e=>{var r=si();R(()=>W(r,z(t).gap?`!`:n+1)),U(e,r)};G(o,e=>{z(t).done?e(s):e(c,-1)}),O(a);var l=L(a,2),u=P(l,!0),d=L(u),f=e=>{var n=RS(),r=I(n);R(e=>W(r,`(${e??``})`),[()=>z(t).apps.join(`, `)]),U(e,n)};G(d,e=>{z(t).apps?.length&&e(f)});var p=L(d,2),m=e=>{var n=VS(),r=F(n),i=e=>{var n=zS(),r=I(n,!0);R(()=>W(r,z(t).why)),U(e,n)};G(r,e=>{z(t).why&&e(i)});var a=L(r,2),o=e=>{var n=BS(),r=F(n);Lc(r,{get command(){return z(t).command}});var i=L(r,2),a=e=>{var n=zS(),r=I(n);R(()=>W(r,`Where: ${z(t).where??``}`)),U(e,n)};G(i,e=>{z(t).where&&e(a)}),U(e,n)};G(a,e=>{z(t).command&&e(o)});var s=L(a,2),c=e=>{var n=zS(),r=I(n);R(()=>W(r,`Or: ${z(t).alt??``}`)),U(e,n)};G(s,e=>{z(t).alt&&e(c)});var l=L(s,2),u=e=>{var n=zS(),r=I(n,!0);R(()=>W(r,z(t).how)),U(e,n)};G(l,e=>{z(t).how&&!z(t).gap&&e(u)}),U(e,n)};G(p,e=>{z(t).done||e(m)}),O(l),O(r),R(()=>{i=Ji(r,1,`svelte-14dfga3`,null,i,{done:z(t).done,gap:z(t).gap&&!z(t).done}),W(u,z(t).title)}),U(e,r)}),U(e,t)};G(m,e=>{z(i)?e(h):z(r)?z(r).length?e(v,-1):e(_,2):e(g,1)}),O(p);var y=L(p,2),b=P(y),x=e=>{var t=US(),n=I(t,!0);R(()=>{t.disabled=z(a),W(n,z(a)?`Sent to the agent`:`Ask the agent to find them`)}),V(`click`,t,()=>void c()),U(e,t)},S=j(()=>z(r)?.some(e=>e.gap&&!e.done));G(b,e=>{z(S)&&e(x)});var C=L(b,2),w=L(C,2);return O(y),O(u),Ma(u,e=>N(n,e),()=>z(n)),R(()=>W(f,`Before this runs on ${z(o)??``}`)),V(`click`,C,()=>void s()),V(`click`,w,()=>z(n)?.close()),U(e,u),A(l)}Zr([`click`]);var KS=H(`"<strong> </strong>" in the repos means <strong> </strong>`,1),qS=H(`<strong> </strong> calls <strong> </strong>`,1),JS=H(`<strong> </strong> <code class="svelte-cao9th"> </code>`,1),YS=H(`<label class="svelte-cao9th"><input type="checkbox"/> <span><!> <small class="svelte-cao9th"> </small></span></label>`),XS=H(`<section class="svelte-cao9th"><h3 class="svelte-cao9th"> <span class="svelte-cao9th"> </span></h3> <p class="svelte-cao9th"> </p> <!></section>`),ZS=H(`<dialog aria-labelledby="findings-title" class="svelte-cao9th"><h2 id="findings-title" class="svelte-cao9th"> </h2> <p class="sub svelte-cao9th">Keep what looks right. It goes into the stack, so the canvas can show calls and Koppler can start and connect the
|
|
23
|
+
apps. Nothing else changes.</p> <div class="list svelte-cao9th"></div> <div class="acts svelte-cao9th"><button type="button" class="svelte-cao9th"> </button> <button class="go svelte-cao9th" type="button"> </button></div></dialog>`);function QS(e,t){k(t,!0);let n=[[`alias`,`Environment names`,`The repos name an environment differently from this stack.`],[`call`,`Who calls whom`,`Found by another app's address in the code. Becomes a cable you can plug.`],[`address`,`Deployed addresses`,`From each app's Terraform. Used to find the calls above, and what an app calls when the other one is not running here.`],[`url`,`Where each app runs on this Mac`,`From launch settings and config. The port Koppler starts it on.`]],r=M(void 0),i=M([]),a=M(!1),o=M(!1),s=new R_,c=(e=``)=>Z.nameOf(e),l=e=>!e.needs||s.has(e.needs),u=j(()=>z(i).filter(e=>s.has(e.id)&&l(e)).length);async function d({afterAdding:e=!1}={}){N(a,e,!0),$.show(`Looking through the repos…`);let t=await Xs(`discover`);if(`error`in t)$.show(t.error,`warning`),e&&setTimeout(()=>{location.reload()},1500);else if(!t.findings.length)e?location.reload():$.show(`Nothing new found in the repos.`);else{N(i,t.findings),s.clear();for(let e of z(i))s.add(e.id);$.hide(),z(r)?.showModal()}}let f=()=>z(r)?.close(),p=async()=>{let e=z(i).filter(e=>s.has(e.id)&&l(e)).map(e=>e.id);if(!e.length){f();return}N(o,!0);let t=await Xs(`discover-apply`,{ids:e});N(o,!1),`error`in t?$.show(t.error,`warning`):location.reload()};var m={open:d},h=ZS(),g=P(h),_=I(g,!0),y=L(g,4);K(y,21,()=>n,([e,t,n])=>e,(e,t)=>{var n=j(()=>v(z(t),3));let r=()=>z(n)[0],a=()=>z(n)[1],o=()=>z(n)[2],u=j(()=>z(i).filter(e=>e.kind===r()));var d=ci(),f=F(d),p=e=>{var t=XS(),n=P(t),i=P(n),d=I(L(i),!0);O(n);var f=L(n,2),p=I(f,!0);K(L(f,2),17,()=>z(u),e=>e.id,(e,t)=>{var n=YS(),i=P(n);ma(i);var a=L(i,2),o=P(a),u=e=>{var n=KS(),r=L(F(n)),i=I(r,!0),a=I(L(r,2),!0);R(e=>{W(i,z(t).value),W(a,e)},[()=>(z(t).env??``).toUpperCase()]),U(e,n)},d=e=>{var n=qS(),r=F(n),i=I(r,!0),a=I(L(r,2),!0);R((e,t)=>{W(i,e),W(a,t)},[()=>c(z(t).app),()=>c(z(t).to)]),U(e,n)},f=e=>{var n=JS(),r=F(n),i=I(r,!0),a=L(r),o=I(L(a),!0);R((e,n)=>{W(i,e),W(a,` on ${n??``}: `),W(o,z(t).value)},[()=>c(z(t).app),()=>(z(t).env??``).toUpperCase()]),U(e,n)},p=e=>{var n=JS(),r=F(n),i=I(r,!0),a=I(L(r,2),!0);R(e=>{W(i,e),W(a,z(t).value)},[()=>c(z(t).app)]),U(e,n)};G(o,e=>{r()===`alias`?e(u):r()===`call`?e(d,1):r()===`address`?e(f,2):e(p,-1)});var m=L(o,2),h=I(m,!0);O(a),O(n),R((e,n)=>{ga(i,e),i.disabled=n,q(m,`title`,z(t).why),W(h,r()===`alias`||r()===`call`?z(t).why:`from ${z(t).why??``}`)},[()=>s.has(z(t).id)&&l(z(t)),()=>!l(z(t))]),V(`change`,i,e=>{e.currentTarget.checked?s.add(z(t).id):s.delete(z(t).id)}),U(e,n)}),O(t),R(()=>{W(i,`${a()??``} `),W(d,z(u).length),W(p,o())}),U(e,t)};G(f,e=>{z(u).length&&e(p)}),U(e,d)}),O(y);var b=L(y,2),x=P(b),S=I(x,!0),C=L(x,2),w=I(C,!0);return O(b),O(h),Ma(h,e=>N(r,e),()=>z(r)),R(e=>{W(_,z(a)?`Here is what Koppler found`:`What the repos say`),W(S,z(a)?`Skip`:`Cancel`),C.disabled=z(o),W(w,e)},[()=>z(u)?`Add ${String(z(u))} to the stack`:`Add nothing`]),B(`close`,h,()=>{z(a)&&location.reload()}),V(`click`,x,f),V(`click`,C,p),U(e,h),A(m)}Zr([`change`,`click`]);var $S=Z.nameOf,eC=(e,t,n)=>`${String(e)} ${e===1?t:n}`,tC=e=>e.to?`${e.from} to ${e.to}`:e.from,nC=e=>`tunnel:${e.host}:${String(e.original)}`,rC=new class{#e=M(null);get flow(){return z(this.#e)}set flow(e){N(this.#e,e)}#t=M(!1);get asked(){return z(this.#t)}set asked(e){N(this.#t,e,!0)}#n=j(()=>Z.cards.map(e=>e.id).filter(e=>Q.sent(e)));get sent(){return z(this.#n)}set sent(e){N(this.#n,e)}starting(e){return Q.sent(e)&&!!Q.status?.running?.includes(e)&&Q.up(e)===!1}#r=j(()=>{let e=this.sent,t=[];for(let n of e){let e=Q.steps(n),r=e.find(e=>e.state===`failed`);Q.up(n)===!1&&this.starting(n)?t.push({level:`warn`,id:n,down:!0,text:`${$S(n)} is starting`}):Q.up(n)===!1?t.push({level:`bad`,id:n,down:!0,text:`${$S(n)} is not running`}):r?t.push({level:`bad`,id:n,text:`${$S(n)}: ${r.label.toLowerCase()} failed`}):e.some(e=>e.state===`user`)&&t.push({level:`warn`,id:n,text:`${$S(n)} is waiting on you`})}for(let n of Z.plan){let r=n.apps.find(t=>e.includes(t));r&&Q.status?.ports?.[String(n.port)]===!1&&t.push({level:`bad`,id:r,text:`${n.what} tunnel is closed`})}for(let[n,r]of Object.entries(Hx.results)){let[i=``,a=``]=n.replace(/^node:/,``).split(`>`);r.state===`bad`&&e.includes(i)&&!t.some(e=>e.down&&(e.id===i||e.id===a))&&t.push({level:`bad`,id:i,text:`${$S(i)}${a?` to ${$S(a)}`:``}: ${(r.text??``).toLowerCase()}`})}return t});get items(){return z(this.#r)}set items(e){N(this.#r,e)}jobs(){return[...Z.cards.filter(({id:e})=>Z.app(e)?.serves).map(({id:e})=>({kind:`app`,key:`node:${e}`,id:e,from:$S(e),payload:{node:e}})),...Z.edges.map(({id:e,source:t,target:n})=>({kind:`cable`,key:e,id:t,from:$S(t),to:`local ${$S(n)}`,payload:{from:t,to:n}})),...Z.links.map(({from:e,tunnel:t})=>({kind:`tunnel`,key:`${e}>${nC(t)}`,id:e,from:$S(e),to:t.what,payload:{app:e,host:t.bind,port:t.port,original:t.original}}))]}result(e){return Hx.results[e.key]??{state:`busy`}}get busy(){return!!this.flow?.some(e=>this.result(e).state===`busy`)}async check(){let e=this.jobs();this.flow=e,this.asked=!1;let t=e=>Object.values(e.payload).find(e=>typeof e==`string`&&Z.apps.some(t=>t.id===e)&&!Q.sent(e));Hx.forget(e.map(e=>e.key));for(let n of e){let e=t(n);e&&(Hx.results[n.key]={state:`warn`,text:`Not started`,detail:`${$S(e)} is on the board but has not been started yet. Press Run to start it.`})}await Promise.all(e.filter(e=>!t(e)).map(e=>Hx.test(e,!0)))}async askToFix(){let e=(this.flow??[]).filter(e=>this.result(e).state===`bad`).map(e=>({connection:tC(e),result:this.result(e).text??``,detail:this.result(e).detail??``,...e.payload}));if(!e.length)return;let t=[`Fix what the Koppler flow check found, using the koppler-run skill.`,`ENV ${Z.env.toUpperCase()}`,`FAILED:`,...e.map(e=>` ${e.connection}: ${e.result}. ${e.detail}`),`Find the cause of each, say what you would change, and ask before you start, stop or restart anything.`].join(`
|
|
24
|
+
`),n=(Q.status?.agent?.state??`none`)===`none`;this.asked=await Yb.deliver(t,{tag:`koppler-fix`,data:{env:Z.env,failures:e}},n?`Saved. The agent gets it when one connects.`:`Sent to the agent`)}#i=j(()=>{let e=Z.cards.map(e=>e.id),t=Q.status?.live,n=t?.env&&Object.keys(t.nodes??{}).length?t.env:null,r=n&&n!==Z.env?n.toUpperCase():null,i=r?[]:this.sent.filter(e=>Q.steps(e).some(e=>e.state===`failed`));if(i.length)return{state:`bad`,label:`${String(i.length)} failed: ${i.map($S).join(`, `)}`,title:`Its card says why. Ask the agent to fix it from the card, or run a Flow check.`};let a=r?[]:e.filter(e=>this.starting(e));if(a.length)return{state:`busy`,label:`Starting ${a.length===1?$S(a[0]??``):`${String(a.length)} apps`}`,title:`Koppler checks the connections again once it answers.`};let o=this.sent.length,s=!this.busy&&!r&&!o?(Q.status?.running??[]).filter(t=>Z.apps.some(e=>e.id===t)&&!e.includes(t)):[];if(s.length)return{state:`warn`,label:`${s.length===1?$S(s[0]??``):`${String(s.length)} apps`} running, not on this board`,title:`${s.map($S).join(`, `)} ${s.length===1?`runs`:`run`}, but this board does not show ${s.length===1?`it`:`them`}. Run starts this board and stops what is not on it; Stop stops everything.`};if(this.busy&&this.flow){let e=this.flow.filter(e=>this.result(e).state!==`busy`).length;return{state:`busy`,label:`Checking ${String(e)} of ${String(this.flow.length)}`,title:`Flow check in progress`}}if(r)return{state:`warn`,label:`Running on ${r}`,title:`What runs now is your ${r} board. This board is set to ${Z.env.toUpperCase()} and has not been run; Run switches over.`};if(!o)return{state:`idle`,label:`Nothing running`,title:`Nothing on the board is running. Run starts it.`};let c=this.flow?this.flow.filter(e=>this.result(e).state===`bad`).length:this.items.filter(e=>e.level===`bad`).length,l=this.flow?0:this.items.length-c,u=e.length-o,d=`Flow check: test every connection on the board`;return c?{state:`bad`,label:`${eC(c,`thing is`,`things are`)} off`,title:d}:u?{state:`warn`,label:`${String(u)} not started`,title:`${eC(u,`app on this board was`,`apps on this board were`)} not started yet. Run starts ${u===1?`it`:`them`}.`}:l?{state:`warn`,label:`${String(l)} waiting on you`,title:d}:{state:`ok`,label:`All running`,title:d}});get chip(){return z(this.#i)}set chip(e){N(this.#i,e)}},iC=H(`<p class="sum svelte-6gc4ih">Nothing is running</p> <p class="idle svelte-6gc4ih">Press Run to start the apps on your board. Flow check then tests every connection between them: apps, cables,
|
|
25
|
+
databases and caches.</p>`,1),aC=H(`<progress aria-label="Connections checked" class="svelte-6gc4ih"></progress>`),oC=H(`<button class="fail svelte-6gc4ih" type="button" title="Show it on the board"><span class="route svelte-6gc4ih"> </span> <span class="verdict svelte-6gc4ih"> </span> <span class="why svelte-6gc4ih"> </span></button>`),sC=H(`<button class="row svelte-6gc4ih" type="button"><span class="route"> </span> <span class="verdict svelte-6gc4ih"> </span></button>`),cC=H(`<details class="svelte-6gc4ih"><summary class="svelte-6gc4ih"> <span class="tally svelte-6gc4ih"> </span></summary> <!></details>`),lC=H(`<div class="fix svelte-6gc4ih"><p class="svelte-6gc4ih">The agent can find the cause of each failure and tell you what it would change. It asks before it starts,
|
|
26
|
+
stops or restarts anything.</p> <button class="go svelte-6gc4ih" type="button"> </button></div>`),uC=H(`<header class="svelte-6gc4ih"><p class="sum svelte-6gc4ih"> </p> <button type="button" class="svelte-6gc4ih">Check again</button></header> <!> <!> <!> <!>`,1),dC=H(`<button class="chip svelte-6gc4ih" type="button" aria-haspopup="dialog"><span class="dot svelte-6gc4ih" aria-hidden="true"></span><span class="words"> </span></button> <p class="sr svelte-6gc4ih" aria-live="polite"> </p> <div class="pop svelte-6gc4ih" popover="" role="dialog" tabindex="-1" aria-label="Flow check"><!></div>`,1);function fC(e,t){let n=li();k(t,!0);let r=[[`app`,`Apps`],[`cable`,`Cables between local apps`],[`tunnel`,`Databases and caches`]],i=M(void 0),a=M(void 0),o=M(!1),s=j(()=>rC.chip),c=j(()=>(rC.flow??[]).map(e=>({job:e,result:rC.result(e)}))),l=j(()=>z(c).filter(e=>e.result.state===`bad`)),u=j(()=>z(c).filter(e=>e.result.state!==`busy`).length),d=j(()=>z(c).filter(e=>e.result.state===`warn`).length),f=j(()=>rC.busy?`Checking, ${String(z(u))} of ${String(z(c).length)} done`:z(l).length?`${String(z(l).length)} of ${String(z(c).length)} connections ${z(l).length===1?`fails`:`fail`}`:z(d)?`Nothing fails, ${String(z(d))} not checked`:`All ${String(z(c).length)} connections work`),p=e=>{let t=z(c).filter(t=>t.job.kind===e),n=t.filter(e=>e.result.state===`bad`).length,r=t.filter(e=>e.result.state===`ok`).length,i=String(t.length);return t.some(e=>e.result.state===`busy`)?{text:`checking`,level:``}:n?{text:`${String(n)} of ${i} ${n===1?`fails`:`fail`}`,level:`bad`}:r<t.length?{text:`${String(r)} of ${i} work, ${String(t.length-r)} not checked`,level:`warn`}:{text:`${i} of ${i} work`,level:``}},m=e=>{z(a)?.hidePopover(),Z.show(e.id)},h=()=>{let e=z(i)?.getBoundingClientRect();e&&z(a)&&(z(a).style.top=`${String(e.bottom+6)}px`,z(a).style.left=`${String(Math.max(12,Math.min(e.left,innerWidth-492)))}px`)};var g=ci(),_=F(g),y=e=>{var t=dC(),d=F(t),g=I(L(P(d)),!0);O(d),Ma(d,e=>N(i,e),()=>z(i));var _=L(d,2),y=I(_),b=L(_,2),x=P(b),S=e=>{var t=iC();je(2),U(e,t)},C=e=>{var t=uC(),n=F(t),i=P(n),a=I(i,!0),o=L(i,2);O(n);var s=L(n,2),d=e=>{var t=aC();R(()=>{q(t,`max`,z(c).length),ha(t,z(u))}),U(e,t)};G(s,e=>{rC.busy&&e(d)});var h=L(s,2);K(h,17,()=>z(l),({job:e,result:t})=>e.key,(e,t)=>{let n=()=>z(t).job,r=()=>z(t).result;var i=oC(),a=P(i),o=I(a),s=L(a,2),c=I(s,!0),l=I(L(s,2),!0);O(i),R(()=>{W(o,`${n().from??``}${n().to?` → ${n().to}`:``}`),W(c,r().text),W(l,r().detail)}),V(`click`,i,()=>{m(n())}),U(e,i)});var g=L(h,2);K(g,17,()=>r,([e,t])=>e,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1],a=j(()=>z(c).filter(e=>e.job.kind===r()&&e.result.state!==`bad`)),o=j(()=>p(r()));var s=ci(),l=F(s),u=e=>{var t=cC(),n=P(t),r=P(n,!0),s=L(r),c=I(s,!0);O(n),K(L(n,2),17,()=>z(a),({job:e,result:t})=>e.key,(e,t)=>{let n=()=>z(t).job,r=()=>z(t).result;var i=sC(),a=P(i),o=I(a),s=I(L(a,2),!0);O(i),R(e=>{q(i,`data-level`,r().state),q(i,`title`,r().detail),W(o,`${n().from??``}${n().to?` → ${n().to}`:``}`),W(s,e)},[()=>(r().text??``).replace(/^Answers, /,``)]),V(`click`,i,()=>{m(n())}),U(e,i)}),O(t),R(()=>{t.open=z(o).level===`warn`,W(r,i()),q(s,`data-level`,z(o).level),W(c,z(o).text)}),U(e,t)},d=j(()=>z(c).some(e=>e.job.kind===r()));G(l,e=>{z(d)&&e(u)}),U(e,s)});var _=L(g,2),y=e=>{var t=lC(),n=L(P(t),2),r=I(n,!0);O(t),R(()=>{n.disabled=rC.asked,W(r,rC.asked?`Sent to the agent`:z(l).length===1?`Ask the agent to fix it`:`Ask the agent to fix these`)}),V(`click`,n,()=>void rC.askToFix()),U(e,t)};G(_,e=>{z(l).length&&!rC.busy&&e(y)}),R(()=>{W(a,z(f)),o.disabled=rC.busy}),V(`click`,o,()=>void rC.check()),U(e,t)};G(x,e=>{!rC.sent.length&&!rC.flow?e(S):e(C,-1)}),O(b),Ma(b,e=>N(a,e),()=>z(a)),R(()=>{q(d,`data-state`,z(s).state),q(d,`title`,z(s).title),q(d,`aria-expanded`,z(o)),q(d,`popovertarget`,n),W(g,z(s).label),W(y,`Board: ${z(s).label??``}`),q(b,`id`,n)}),B(`toggle`,b,e=>{N(o,e.newState===`open`),z(o)&&(h(),!rC.flow&&rC.sent.length&&rC.check())}),U(e,t)};G(_,e=>{Q.status&&e(y)}),U(e,g),A()}Zr([`click`]);var pC=new Set([`$$slots`,`$$events`,`$$legacy`]);function mC(e,t){let n=J(t,pC),r={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]],aliases:[`help-circle`,`circle-help`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var hC=H(`<button class="open svelte-zovg1u" type="button" popovertarget="help" aria-label="Shortcuts and legend" title="Shortcuts and legend (?)"><!></button> <div class="sheet svelte-zovg1u" id="help" popover="" aria-label="Shortcuts and legend"><h2 class="svelte-zovg1u">Shortcuts</h2> <dl class="svelte-zovg1u"><dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">F</kbd></dt> <dd class="svelte-zovg1u">Fit the whole board in view</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">P</kbd>, <kbd class="svelte-zovg1u">Esc</kbd> to stop</dt> <dd class="svelte-zovg1u">Present: the board alone, full screen</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">E</kbd> / <kbd class="svelte-zovg1u">L</kbd></dt> <dd class="svelte-zovg1u">Edit view / Live view</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">V</kbd> / <kbd class="svelte-zovg1u">H</kbd>, hold <kbd class="svelte-zovg1u">Space</kbd></dt> <dd class="svelte-zovg1u">Select / move around the board</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">Cmd</kbd> or <kbd class="svelte-zovg1u">Ctrl</kbd> + <kbd class="svelte-zovg1u">Z</kbd></dt> <dd class="svelte-zovg1u">Undo (add <kbd class="svelte-zovg1u">Shift</kbd> to redo)</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">Cmd</kbd> or <kbd class="svelte-zovg1u">Ctrl</kbd> + <kbd class="svelte-zovg1u">A</kbd></dt> <dd class="svelte-zovg1u">Select every card</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">Tab</kbd>, then arrow keys</dt> <dd class="svelte-zovg1u">Move to a card, then move it</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">Delete</kbd></dt> <dd class="svelte-zovg1u">Remove the selected cards</dd> <dt class="svelte-zovg1u"><kbd class="svelte-zovg1u">?</kbd></dt> <dd class="svelte-zovg1u">This sheet</dd></dl> <h2 class="svelte-zovg1u">On the board</h2> <dl class="svelte-zovg1u"><dt class="svelte-zovg1u"><span class="cable svelte-zovg1u"></span></dt> <dd class="svelte-zovg1u">A cable: the app at its start calls your local copy of the app at its end. Drag from the ring on a card's edge, or
|
|
27
|
+
use the card's Cables field.</dd> <dt class="svelte-zovg1u"><span class="card svelte-zovg1u"></span></dt> <dd class="svelte-zovg1u">A tunnel to a database or cache the app uses</dd> <dt class="svelte-zovg1u"><span class="cable queue svelte-zovg1u"></span></dt> <dd class="svelte-zovg1u">A queue between apps: dashed while it is the deployed one, solid once its switch runs it locally</dd> <dt class="svelte-zovg1u"><span class="card outside svelte-zovg1u"></span></dt> <dd class="svelte-zovg1u">An outside system, such as a payment provider: it never runs here</dd> <dt class="svelte-zovg1u"><span class="protected svelte-zovg1u">Protected</span></dt> <dd class="svelte-zovg1u">A protected environment (production, usually): red marks only the frame. Red on the board always means something
|
|
28
|
+
failed.</dd> <dt class="svelte-zovg1u"><span class="calls svelte-zovg1u">Calls QA</span></dt> <dd class="svelte-zovg1u">Apps this one still calls in the deployed environment. Click one to run it locally too.</dd> <dt class="svelte-zovg1u">Zoomed out</dt> <dd class="svelte-zovg1u">Cards show only their state; zoom in to change them</dd></dl></div>`,1);function gC(e){let t=M(void 0),n=e=>{e.key!==`?`||e.target.closest(`input, select, textarea`)||z(t)?.togglePopover()};var r=hC();B(`keydown`,gn,n);var i=F(r);X(P(i),{get of(){return mC},size:16}),O(i),Ma(L(i,2),e=>N(t,e),()=>z(t)),U(e,r)}var _C=H(`<p class="svelte-146fxte"> </p>`),vC=H(`<h4 class="svelte-146fxte"> </h4>`),yC=H(`<li> </li>`),bC=H(`<ul class="svelte-146fxte"></ul>`),xC=H(`<!> <!> <!>`,1),SC=H(`<span class="svelte-146fxte"> </span>`),CC=H(`<button class="choice svelte-146fxte" type="button"><strong> </strong><!></button>`),wC=H(`<div class="choices svelte-146fxte"></div>`),TC=H(`<!> <form class="svelte-146fxte"><textarea rows="1" placeholder="Or answer in your own words" aria-label="Your answer" class="svelte-146fxte"></textarea> <button type="submit" class="svelte-146fxte">Send</button></form> <button class="dismiss svelte-146fxte" type="button" title="Close this question without answering; the agent is not told">Dismiss</button>`,1),EC=H(`<p class="answered svelte-146fxte"> </p>`),DC=H(`<article><div class="meta svelte-146fxte"><span class="kind svelte-146fxte"> </span><time> </time></div> <h3 class="svelte-146fxte"> </h3> <!> <!> <!> <!></article>`);function OC(e,t){k(t,!0);let n={question:`Question`,result:`Done`,failure:`Failed`,info:`Update`},r=e=>e.kind===`question`&&!e.answered,i=(e=``)=>{let t=new Date(e),n=t.toDateString()===new Date().toDateString();return t.toLocaleString([],n?{hour:`2-digit`,minute:`2-digit`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},a=e=>{let t=e.answered;if(!t)return``;let n=e.choices?.find(e=>e.id===t.choice)?.label??t.choice;return`${t.via===`replaced`?`Closed: a newer run replaced it`:t.via===`dismissed`?`Dismissed`:t.via===`chat`?`Answered in the chat`:n?`You chose: ${n}`:`You answered: ${t.text??``}`}, ${i(t.at)}.`},o=(e,t)=>{e.preventDefault();let n=e.currentTarget.querySelector(`textarea`)?.value.trim();n&&Ay.answer(t,{text:n})};var s=DC();let c;var l=P(s),u=P(l),d=I(u,!0),f=I(L(u),!0);O(l);var p=L(l,2),m=I(p,!0),h=L(p,2),g=e=>{var n=_C(),r=I(n,!0);R(()=>W(r,t.one.summary)),U(e,n)};G(h,e=>{t.one.summary&&e(g)});var _=L(h,2);K(_,17,()=>t.one.sections??[],Ei,(e,t)=>{var n=xC(),r=F(n),i=e=>{var n=vC(),r=I(n,!0);R(()=>W(r,z(t).title)),U(e,n)};G(r,e=>{z(t).title&&e(i)});var a=L(r,2);K(a,16,()=>z(t).commands??[],e=>e,(e,t)=>{Lc(e,{get command(){return t}})});var o=L(a,2),s=e=>{var n=bC();K(n,21,()=>z(t).items,Ei,(e,t)=>{var n=yC(),r=I(n,!0);R(()=>W(r,z(t))),U(e,n)}),O(n),U(e,n)};G(o,e=>{z(t).items?.length&&e(s)}),U(e,n)});var v=L(_,2),y=e=>{var n=TC(),r=F(n),i=e=>{var n=wC();K(n,21,()=>t.one.choices,e=>e.id,(e,n)=>{var r=CC(),i=P(r),a=I(i,!0),o=L(i),s=e=>{var t=SC(),r=I(t,!0);R(()=>W(r,z(n).detail)),U(e,t)};G(o,e=>{z(n).detail&&e(s)}),O(r),R(()=>W(a,z(n).label)),V(`click`,r,()=>void Ay.answer(t.one,{choice:z(n).id})),U(e,r)}),O(n),U(e,n)};G(r,e=>{t.one.choices?.length&&e(i)});var a=L(r,2),s=L(a,2);B(`submit`,a,e=>{o(e,t.one)}),V(`click`,s,()=>void Ay.dismiss(t.one)),U(e,n)},b=j(()=>r(t.one));G(v,e=>{z(b)&&e(y)});var x=L(v,2),S=e=>{var n=EC(),r=I(n,!0);R(e=>W(r,e),[()=>a(t.one)]),U(e,n)};G(x,e=>{t.one.answered&&e(S)}),O(s),R((e,r)=>{q(s,`data-kind`,t.one.kind),s.inert=t.past,c=Ji(s,1,`svelte-146fxte`,null,c,{waits:e,past:t.past}),W(d,n[t.one.kind]??`Update`),W(f,r),W(m,t.one.title)},[()=>r(t.one),()=>i(t.one.at)]),U(e,s),A()}Zr([`click`]);var kC=H(`<button type="button" class="svelte-1ekufpr">Clear</button>`),AC=H(`<li class="svelte-1ekufpr"><span class="what svelte-1ekufpr"> <small class="svelte-1ekufpr"> </small></span> <button type="button" class="svelte-1ekufpr">Drop</button></li>`),jC=H(`<section class="waiting svelte-1ekufpr" aria-labelledby="waiting-title"><h3 id="waiting-title" class="svelte-1ekufpr"> </h3> <p class="svelte-1ekufpr">Sent while no agent was connected. Of several runs and Stops only the newest is acted on. One gets them when
|
|
29
|
+
you run this in your agent session:</p> <!> <ul class="svelte-1ekufpr"></ul></section>`),MC=H(`<p class="none svelte-1ekufpr">The agent has said nothing yet.</p>`),NC=H(`<p class="none svelte-1ekufpr">Nothing yet. When the agent needs a decision about your run, or finishes one, it shows up here.</p>`),PC=H(`<p class="none svelte-1ekufpr">Nothing since the canvas started.</p>`),FC=H(`<details class="svelte-1ekufpr"><summary class="svelte-1ekufpr"> </summary> <!></details>`),IC=H(`<!> <!>`,1),LC=H(`<div class="panel svelte-1ekufpr" role="dialog" tabindex="-1" aria-label="Messages from the agent"><header class="svelte-1ekufpr"><h2 class="svelte-1ekufpr">Agent</h2> <span class="sub svelte-1ekufpr"> </span> <!> <button class="close svelte-1ekufpr" type="button" aria-label="Close"><!></button></header> <div class="list svelte-1ekufpr"><!> <!></div></div>`);function RC(e,t){k(t,!0);let n=M(void 0),r=j(()=>Ay.messages),i=e=>e.kind===`question`&&!e.answered,a=e=>e.from===`koppler`&&!!e.answered,o=e=>!a(e)&&(!Q.status?.startedAt||(e.at??``)>=Q.status.startedAt||i(e)),s=j(()=>z(r).filter(o)),c=j(()=>z(r).filter(e=>!o(e))),l=e=>!i(e)&&(z(r)[0]!==e||e.answered?.via===`dismissed`||e.answered?.via===`replaced`);In(()=>{Ay.open&&(z(n)?.querySelector(`.choice`)??z(n)?.querySelector(`.close`))?.focus()});var u=ci(),d=F(u),f=e=>{var t=LC(),a=P(t),o=L(P(a),2),u=I(o,!0),d=L(o,2),f=e=>{var t=kC();V(`click`,t,()=>void Ay.clear()),U(e,t)},p=j(()=>z(r).some(e=>!i(e)));G(d,e=>{z(p)&&e(f)});var m=L(d,2);X(P(m),{get of(){return to},size:14}),O(m),O(a);var h=L(a,2),g=P(h),_=e=>{var t=jC(),n=P(t),r=I(n),i=L(n,4);Lc(i,{command:`/koppler-run connect`});var a=L(i,2);K(a,21,()=>Ay.waiting,e=>e.key,(e,t)=>{var n=AC(),r=P(n),i=P(r,!0),a=I(L(i),!0);O(r);var o=L(r,2);O(n),R(e=>{W(i,z(t).what),W(a,e),q(o,`aria-label`,`Drop: ${z(t).what??``}`)},[()=>Ub(z(t).at)]),V(`click`,o,()=>void Ay.drop(z(t).key)),U(e,n)}),O(a),O(t),R(()=>W(r,`Waiting for an agent (${Ay.waiting.length??``})`)),U(e,t)};G(g,e=>{Ay.waiting.length&&e(_)});var v=L(g,2),y=e=>{U(e,MC())},b=e=>{U(e,NC())},x=e=>{var t=IC(),n=F(t);K(n,17,()=>z(s),e=>e.id,(e,t)=>{{let n=j(()=>l(z(t)));OC(e,{get one(){return z(t)},get past(){return z(n)}})}},e=>{U(e,PC())});var r=L(n,2),i=e=>{var t=FC(),n=P(t),r=I(n);K(L(n,2),17,()=>z(c),e=>e.id,(e,t)=>{{let n=j(()=>l(z(t)));OC(e,{get one(){return z(t)},get past(){return z(n)}})}}),O(t),R(()=>W(r,`Earlier (${z(c).length??``})`)),U(e,t)};G(r,e=>{z(c).length&&e(i)}),U(e,t)};G(v,e=>{!z(r).length&&Ay.waiting.length?e(y):z(r).length?e(x,-1):e(b,1)}),O(h),O(t),Ma(t,e=>N(n,e),()=>z(n)),R(()=>W(u,Ay.question?`Waiting for your answer`:``)),V(`keydown`,t,e=>{e.key===`Escape`&&(Ay.open=!1)}),V(`click`,m,()=>Ay.open=!1),U(e,t)};G(d,e=>{Ay.open&&e(f)}),U(e,u),A()}Zr([`keydown`,`click`]);var zC=new Set([`$$slots`,`$$events`,`$$legacy`]);function BC(e,t){let n=J(t,zC),r={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 6v6l4 2`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var VC=new Set([`$$slots`,`$$events`,`$$legacy`]);function HC(e,t){let n=J(t,VC),r={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var UC=new Set([`$$slots`,`$$events`,`$$legacy`]);function WC(e,t){let n=J(t,UC),r={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var GC=H(`<small class="svelte-i7whuv"> </small>`),KC=H(`<div class="run svelte-i7whuv"><div class="head note svelte-i7whuv"><span class="what svelte-i7whuv"> <!></span> <time class="svelte-i7whuv"> </time></div></div>`),qC=H(`<span class="changes svelte-i7whuv" title="Code changes Koppler made in your repos"> </span>`),JC=H(`<p class="reason svelte-i7whuv"> </p>`),YC=H(`<span> <!></span>`),XC=H(`<li class="svelte-i7whuv"><span class="verb svelte-i7whuv"> </span> <span class="apps svelte-i7whuv"></span></li>`),ZC=H(`<span class="del svelte-i7whuv"><b aria-hidden="true" class="svelte-i7whuv">-</b><span class="sr svelte-i7whuv">removed: </span> </span>`),QC=H(`<span class="add svelte-i7whuv"><b aria-hidden="true" class="svelte-i7whuv">+</b><span class="sr svelte-i7whuv">added: </span> </span>`),$C=H(`<span class="svelte-i7whuv">No lines recorded.</span>`),ew=H(`<figure class="svelte-i7whuv"><figcaption class="svelte-i7whuv"><code class="svelte-i7whuv"> </code> <span class="svelte-i7whuv"> </span></figcaption> <pre class="svelte-i7whuv"><!><!><!></pre></figure>`),tw=H(`<h4 class="svelte-i7whuv"> </h4> <!>`,1),nw=H(`<div class="diffs svelte-i7whuv"><h3 class="svelte-i7whuv">Code changes in your repos</h3> <!></div>`),rw=H(`<button type="button" class="svelte-i7whuv"> </button>`),iw=H(`<div class="logs svelte-i7whuv"><h3 class="svelte-i7whuv">Logs</h3> <!> <button class="pin svelte-i7whuv" type="button"><!> </button></div>`),aw=H(`<button class="back svelte-i7whuv" type="button">Put this board back</button>`),ow=H(`<ul class="plan svelte-i7whuv"></ul> <!> <!> <!>`,1),sw=H(`<div class="run svelte-i7whuv"><button class="head svelte-i7whuv" type="button"><span class="what svelte-i7whuv"> <!></span> <!> <span class="state svelte-i7whuv"> </span> <time class="svelte-i7whuv"> </time></button> <!> <!></div>`);function cw(e,t){k(t,!0);let n=[[`starts`,`Starts`],[`restarts`,`Restarts`],[`stops`,`Stops and reverts`],[`keeps`,`Keeps running`]],r={waiting:`Waiting for the agent`,applying:`Being applied`,done:`Done`,failed:`Failed`,replaced:`Replaced by a newer run`},i={"stop-apps":`Apps stopped, changes kept`,"stop-all":`Everything stopped, changes kept`,"canvas-closed":`Canvas closed`},a=Z.nameOf,o=j(()=>{let e=new Date(t.run.at??``),n=e.toDateString()===new Date().toDateString();return e.toLocaleString([],n?{hour:`2-digit`,minute:`2-digit`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}),s=j(()=>[...new Set((t.run.changes??[]).map(e=>e.app))]);var c=ci(),l=F(c),u=e=>{let n=j(()=>(t.run.stopped??[]).map(a).join(`, `));var r=KC(),s=P(r),c=P(s),l=P(c,!0),u=L(l),d=e=>{var t=GC(),r=I(t,!0);R(()=>{q(t,`title`,z(n)),W(r,z(n))}),U(e,t)};G(u,e=>{z(n)&&e(d)}),O(c);var f=I(L(c,2),!0);O(s),O(r),R(()=>{W(l,i[t.run.note]??`Stopped`),W(f,z(o))}),U(e,r)},d=e=>{let i=j(()=>Object.keys(t.run.nodes??{}).map(a).join(`, `));var c=sw(),l=P(c),u=P(l),d=P(u,!0),f=L(d),p=e=>{var t=GC(),n=I(t,!0);R(()=>{q(t,`title`,z(i)),W(n,z(i))}),U(e,t)};G(f,e=>{z(i)&&e(p)}),O(u);var m=L(u,2),h=e=>{var n=qC(),r=I(n);R(()=>W(r,`${t.run.changes.length??``} ${t.run.changes.length===1?`change`:`changes`}`)),U(e,n)};G(m,e=>{t.run.changes?.length&&e(h)});var g=L(m,2),_=I(g,!0),y=I(L(g,2),!0);O(l);var b=L(l,2),x=e=>{var n=JC(),r=I(n,!0);R(()=>W(r,t.run.reason)),U(e,n)};G(b,e=>{t.run.reason&&e(x)});var S=L(b,2),C=e=>{var r=ow(),o=F(r);K(o,21,()=>n,([e,t])=>e,(e,n)=>{var r=j(()=>v(z(n),2));let i=()=>z(r)[0],o=()=>z(r)[1];var s=ci(),c=F(s),l=e=>{var n=XC(),r=P(n),s=I(r,!0),c=L(r,2);K(c,21,()=>t.run.plan[i()],e=>e.id,(e,t)=>{var n=YC(),r=P(n,!0),i=L(r),o=e=>{var n=GC(),r=I(n,!0);R(e=>W(r,e),[()=>z(t).why.join(`; `)]),U(e,n)};G(i,e=>{z(t).why?.length&&e(o)}),O(n),R(e=>W(r,e),[()=>a(z(t).id)]),U(e,n)}),O(c),O(n),R(()=>{q(r,`data-verb`,i()),W(s,o())}),U(e,n)};G(c,e=>{t.run.plan?.[i()]?.length&&e(l)}),U(e,s)}),O(o);var c=L(o,2),l=e=>{var n=nw();K(L(P(n),2),16,()=>z(s),e=>e,(e,n)=>{var r=tw(),i=F(r),o=I(i,!0);K(L(i,2),17,()=>t.run.changes.filter(e=>e.app===n),e=>e.title+(e.file??``),(e,t)=>{var n=ew(),r=P(n),i=P(r),a=I(i,!0),o=I(L(i,2));O(r);var s=L(r,2),c=P(s);K(c,17,()=>z(t).removed??[],Ei,(e,t)=>{var n=ZC(),r=L(P(n),2,!0);O(n),R(()=>W(r,z(t))),U(e,n)});var l=L(c);K(l,17,()=>z(t).added??[],Ei,(e,t)=>{var n=QC(),r=L(P(n),2,!0);O(n),R(()=>W(r,z(t))),U(e,n)});var u=L(l),d=e=>{U(e,$C())};G(u,e=>{!z(t).removed?.length&&!z(t).added?.length&&e(d)}),O(s),O(n),R(()=>{W(a,z(t).file||z(t).title),W(o,`${(z(t).file?z(t).title:``)??``}${z(t).fresh?``:` (from an earlier run)`}`)}),U(e,n)}),R(e=>W(o,e),[()=>a(n)]),U(e,r)}),O(n),U(e,n)};G(c,e=>{t.run.changes?.length&&e(l)});var u=L(c,2),d=e=>{let n=j(()=>t.run.id);var r=iw(),i=L(P(r),2);K(i,16,()=>t.run.logs,e=>e,(e,t)=>{var r=rw(),i=I(r,!0);R(e=>W(i,e),[()=>a(t)]),V(`click`,r,()=>{Lb.open(t,z(n))}),U(e,r)});var o=L(i,2),s=P(o);{let e=j(()=>t.run.pinned?WC:HC);X(s,{get of(){return z(e)},size:13})}var c=L(s,1,!0);O(o),O(r),R(()=>{q(o,`aria-pressed`,!!t.run.pinned),q(o,`title`,t.run.pinned?`Kept for good. Unpin to let them go with the oldest runs.`:`Keep these logs: the newest 20 runs keep theirs, older ones are let go.`),W(c,t.run.pinned?`Unpin`:`Pin`)}),V(`click`,o,()=>void Xs(`run-pin`,{id:z(n),on:!t.run.pinned})),U(e,r)};G(u,e=>{t.run.logs?.length&&t.run.id&&e(d)});var f=L(u,2),p=e=>{var n=aw();V(`click`,n,function(...e){t.back?.apply(this,e)}),U(e,n)};G(f,e=>{z(i)&&e(p)}),U(e,r)};G(S,e=>{t.open&&e(C)}),O(c),R(e=>{q(l,`aria-expanded`,t.open),W(d,e),q(g,`data-state`,t.run.state),W(_,r[t.run.state??``]??t.run.state),W(y,z(o))},[()=>t.run.kind===`stop`?`Stop and revert`:`${(t.run.env??``).toUpperCase()}, ${t.run.mode??`auto`}`]),V(`click`,l,function(...e){t.toggle?.apply(this,e)}),U(e,c)};G(l,e=>{t.run.note?e(u):e(d,-1)}),U(e,c),A()}Zr([`click`]);var lw=H(`<p class="none svelte-16dstxb">No runs yet. Each run and Stop shows up here with how it ended.</p>`),uw=H(`<p class="none svelte-16dstxb">No runs since the canvas started.</p>`),dw=H(`<details class="svelte-16dstxb"><summary class="svelte-16dstxb"> </summary> <!></details>`),fw=H(`<!> <!>`,1),pw=H(`<button type="button" aria-label="History" aria-haspopup="dialog"><!></button> <div class="pop svelte-16dstxb" popover="" role="dialog" tabindex="-1" aria-label="History"><!></div>`,1);function mw(e,t){let n=li();k(t,!0);let r=M(void 0),i=M(void 0),a=M(!1),o=M(null),s=j(()=>!!Q.status?.runs?.some(e=>e.state===`waiting`)),c=j(()=>[...Q.status?.runs??[],...Q.status?.notes??[]].sort((e,t)=>(t.at??``).localeCompare(e.at??``))),l=e=>!Q.status?.startedAt||(e.at??``)>=Q.status.startedAt||e.state===`waiting`||e.state===`applying`,u=j(()=>z(c).filter(l)),d=j(()=>z(c).filter(e=>!l(e))),f=(e=``)=>{let t=new Date(e),n=t.toDateString()===new Date().toDateString();return t.toLocaleString([],n?{hour:`2-digit`,minute:`2-digit`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=()=>{let e=z(r)?.getBoundingClientRect();e&&z(i)&&(z(i).style.top=`${String(e.bottom+6)}px`,z(i).style.right=`${String(Math.max(12,innerWidth-e.right))}px`)},m=e=>{z(i)?.hidePopover(),zb({name:`Run from ${f(e.at)}`,version:1,nodes:e.nodes??{},edges:e.edges??[]})};var h=pw(),g=F(h);let _;X(P(g),{get of(){return BC},size:16}),O(g),Ma(g,e=>N(r,e),()=>z(r));var v=L(g,2),y=P(v),b=e=>{U(e,lw())},x=e=>{var t=fw(),n=F(t);K(n,17,()=>z(u),e=>e.id??e.at,(e,t)=>{{let n=j(()=>z(o)===z(t).id);cw(e,{get run(){return z(t)},get open(){return z(n)},toggle:()=>N(o,z(o)===z(t).id?null:z(t).id??null,!0),back:()=>{m(z(t))}})}},e=>{U(e,uw())});var r=L(n,2),i=e=>{var t=dw(),n=P(t),r=I(n);K(L(n,2),17,()=>z(d),e=>e.id??e.at,(e,t)=>{{let n=j(()=>z(o)===z(t).id);cw(e,{get run(){return z(t)},get open(){return z(n)},toggle:()=>N(o,z(o)===z(t).id?null:z(t).id??null,!0),back:()=>{m(z(t))}})}}),O(t),R(()=>W(r,`Earlier (${z(d).length??``})`)),U(e,t)};G(r,e=>{z(d).length&&e(i)}),U(e,t)};G(y,e=>{z(c).length?e(x,-1):e(b)}),O(v),Ma(v,e=>N(i,e),()=>z(i)),R(()=>{_=Ji(g,1,`open svelte-16dstxb`,null,_,{waiting:z(s)}),q(g,`aria-expanded`,z(a)),q(g,`title`,z(s)?`A run is waiting for the agent`:`Every run and Stop, and how it ended`),q(g,`popovertarget`,n),q(v,`id`,n)}),B(`toggle`,v,e=>{N(a,e.newState===`open`),z(a)&&p()}),U(e,h),A()}var hw=H(`<button class="open svelte-1la1tzd" type="button"><!></button>`);function gw(e,t){k(t,!0);let n=j(()=>Q.status?.traces?.state??`off`),r=async()=>{if(z(n)===`on`){window.open(Q.status?.traces?.view??``,`_blank`,`noopener`);return}if(z(n)===`starting`)return;let e=await Xs(`traces`,{on:!0});`error`in e?$.show(e.error,`warning`):$.show(`Collecting traces. Apps started from now on send theirs; restart the running ones to include them.`)};var i=hw();X(P(i),{get of(){return $y},size:16}),O(i),R(()=>{q(i,`data-state`,z(n)),q(i,`aria-label`,z(n)===`on`?`Open traces`:z(n)===`starting`?`Traces are starting`:`Collect traces`),q(i,`title`,z(n)===`on`?`Follow one request across your local apps, to where it failed`:z(n)===`starting`?`Starting the trace collector (Jaeger in Docker)`:`Collect traces from the apps Koppler starts (Jaeger in Docker)`)}),V(`click`,i,()=>void r()),U(e,i),A()}Zr([`click`]);var _w={verbose:`debug`,trace:`debug`,debug:`debug`,dbg:`debug`,information:`info`,info:`info`,inf:`info`,warning:`warn`,warn:`warn`,wrn:`warn`,error:`error`,err:`error`,fatal:`error`,critical:`error`,crit:`error`},vw=e=>e==null?``:typeof e==`string`?e:JSON.stringify(e),yw=e=>_w[vw(e).toLowerCase()]??`info`;function bw(e){let t=/T?(\d{2}:\d{2}:\d{2})/.exec(vw(e))?.[1];if(!t)return``;let n=new Date(vw(e));return Number.isNaN(n.getTime())?t:n.toTimeString().slice(0,8)}var xw=(e,t)=>vw(e).replace(/\{[@$]?([\w.]+)(?:[,:][^}]*)?\}/g,(e,n)=>n in t?vw(t[n]):e);function Sw(e){if(!e.startsWith(`{`)||!e.endsWith(`}`))return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;if(`@t`in n||`@m`in n||`@mt`in n)return{time:bw(n[`@t`]),level:yw(n[`@l`]??`Information`),text:vw(n[`@m`]??xw(n[`@mt`],n)),detail:vw(n[`@x`])};if(`Timestamp`in n||`MessageTemplate`in n||`RenderedMessage`in n){let e=n.Properties??{};return{time:bw(n.Timestamp),level:yw(n.Level),text:vw(n.RenderedMessage??xw(n.MessageTemplate,e)),detail:vw(n.Exception)}}return null}var Cw=/\\?\^?\[\[?\d+m|\x1b\[[0-9;]*m/g,ww=[[/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)\s+(INF|ERR|WRN|DBG)\s+(.*)$/,e=>({time:bw(e[1]),level:yw(e[2]),text:e[3]??``,detail:``})],[/^\[(\d{2}:\d{2}:\d{2})\s+(\w+)\]\s*(.*)$/,e=>({time:e[1]??``,level:yw(e[2]),text:e[3]??``,detail:``})],[/^\d{4}-\d{2}-\d{2} (\d{2}:\d{2}:\d{2}) \$ (.*)$/,e=>({time:e[1]??``,level:`start`,text:e[2]??``,detail:``})],[/^flutter: (.*)$/s,e=>({time:``,level:/(^|\s)(Exception|Error)\b|\[31m/.test(e[1]??``)?`error`:`info`,text:(e[1]??``).replace(Cw,``),detail:``})],[/^(.*?\.cs)\((\d+),\d+\): (warning|error) (\w+): (.*?)(?: \[[^\]]+\])?$/,e=>({time:``,level:e[3]===`error`?`error`:`warn`,build:!0,text:`${e[4]??``} ${(e[1]??``).split(`/`).slice(-2).join(`/`)}:${e[2]??``} ${e[5]??``}`,detail:``})],[/^koppler: (.*)$/s,e=>({time:``,level:`koppler`,text:e[1]??``,detail:``})]];function Tw(e){let t=e.trim(),n=Sw(t);if(n)return n;for(let[e,n]of ww){let r=e.exec(t);if(r)return n(r)}return{time:``,level:/\b(error|exception|fail(ed|ure)?|unhandled)\b/i.test(t)?`error`:/\bwarn(ing)?\b/i.test(t)?`warn`:`info`,text:t,detail:``}}var Ew=/^flutter: (#\d+\s|<asynchronous suspension>|\s*-- \S)/,Dw=(e,t)=>Ew.test(e)&&t.level===`error`||/^\s+(at |---|\.\.\.)/.test(e)||/^\s{2,}\S/.test(e);function Ow(e){let t=[];for(let n of(e??``).split(`
|
|
30
|
+
`)){if(!n.trim())continue;let e=t.at(-1);if(e&&Dw(n,e)){e.detail+=(e.detail?`
|
|
31
|
+
`:``)+n.replace(/^flutter: /,``).trim();continue}let r=Tw(n);r.build&&r.level===`warn`&&e?.group===`build`&&e.items?(e.items.push(r.text),e.text=`${String(e.items.length)} build warnings`):r.build&&r.level===`warn`?t.push({time:``,level:`warn`,group:`build`,items:[r.text],text:`1 build warning`,detail:``}):t.push(r)}return t}var kw=H(`<span><button type="button" role="tab" class="svelte-1feoaw6"><span class="live svelte-1feoaw6" aria-hidden="true"></span> </button> <button class="x svelte-1feoaw6" type="button"><!></button></span>`),Aw=H(`<p class="empty svelte-1feoaw6"> </p>`),jw=H(`<details class="m svelte-1feoaw6"><summary class="svelte-1feoaw6"> </summary><span class="x svelte-1feoaw6"> </span></details>`),Mw=H(`<span class="x svelte-1feoaw6"> </span>`),Nw=H(`<span class="m svelte-1feoaw6"> </span> <!>`,1),Pw=H(`<div class="row svelte-1feoaw6"><span class="t svelte-1feoaw6"> </span><span class="l svelte-1feoaw6"> </span> <!></div>`),Fw=H(`<section aria-label="App log"><div class="grip svelte-1feoaw6" role="separator" aria-orientation="horizontal" aria-label="Resize the log" tabindex="0" title="Drag to resize. Double-click to switch between big and small."></div> <header class="svelte-1feoaw6"><div class="tabs svelte-1feoaw6" role="tablist"></div> <span class="meta svelte-1feoaw6"> </span> <button type="button" title="Hide what is in this log so far; new lines keep coming. The log file is not touched." class="svelte-1feoaw6">Clear</button> <button type="button" title="Show the log exactly as the app wrote it" class="svelte-1feoaw6">Raw</button> <button type="button" class="svelte-1feoaw6"> </button> <button type="button" class="svelte-1feoaw6">Close all</button></header> <div role="log"><!></div></section>`);function Iw(e,t){k(t,!0);let n={debug:`DEBUG`,warn:`WARN`,error:`ERROR`,koppler:`KOPPLER`,start:`START`},r=j(()=>Lb.active),i=j(()=>z(r)?Lb.text(z(r)):``),a=j(()=>{let e={};return(Lb.raw?[]:Ow(z(i))).map(t=>{let n=`${t.time} ${t.text}`,r=e[n]=(e[n]??0)+1;return{...t,key:`${n}#${String(r)}`}})}),o=M(void 0),s=M(void 0),c=`koppler-logs-height`,l=M(pn((()=>{try{return Number(localStorage.getItem(c))||0}catch{return 0}})())),u=M(!1),d=()=>z(s)?.parentElement?.getBoundingClientRect().height??0,f=e=>{if(d()){N(l,Math.min(Math.max(e,120),d()-60)/d());try{localStorage.setItem(c,String(z(l)))}catch{}}},p=()=>z(s)?.getBoundingClientRect().height??0,m=j(()=>z(l)>.6),h=()=>{f(d()*(z(m)?.38:.85))},g=e=>{e.preventDefault();let t=e.clientY,n=p();N(u,!0);let r=e=>{f(n+t-e.clientY)};addEventListener(`pointermove`,r),addEventListener(`pointerup`,()=>{removeEventListener(`pointermove`,r),N(u,!1)},{once:!0})},_=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),f(p()+(e.key===`ArrowUp`?40:-40)))},v=null;In(()=>{Q.status&&Lb.refresh()}),Rn(()=>{if(!z(o))return;let e=v!==z(r)||!z(i)||z(o).scrollHeight-z(o).scrollTop-z(o).clientHeight<24;v=z(r);let t=z(o);e&&requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})});var y=ci(),b=F(y),x=e=>{var t=Fw();let c,d;var f=P(t),p=L(f,2),v=P(p);K(v,20,()=>Lb.tabs,e=>e,(e,t)=>{let n=j(()=>Lb.past(t)?null:Q.up(t));var i=kw();let a;var o=P(i),s=P(o),c=L(s,1,!0);O(o);var l=L(o,2);X(P(l),{get of(){return to},size:14}),O(l),O(i),R((e,u)=>{a=Ji(i,1,`tab svelte-1feoaw6`,null,a,{on:t===z(r)}),q(o,`aria-selected`,t===z(r)),q(s,`data-on`,z(n)),W(c,e),q(l,`aria-label`,`Close ${u??``} log`)},[()=>Lb.label(t),()=>Lb.label(t)]),V(`click`,o,()=>{Lb.active=t}),V(`click`,l,()=>{Lb.close(t)}),U(e,i)}),O(v);var y=L(v,2),b=I(y,!0),x=L(y,2),S=L(x,2),C=L(S,2),w=I(C,!0),ee=L(C,2);O(p);var T=L(p,2);let te;var E=P(T),ne=e=>{var t=Aw(),n=I(t,!0);R(()=>W(n,Lb.cleared[z(r)]?`Cleared. New lines show up here.`:`No output captured for this app. Apps started from an IDE keep their output there.`)),U(e,t)},re=e=>{var t=si();R(()=>W(t,z(i))),U(e,t)},ie=e=>{var t=ci();K(F(t),17,()=>z(a),e=>e.key,(e,t)=>{var r=Pw(),i=P(r),a=I(i,!0),o=L(i),s=I(o,!0),c=L(o,2),l=e=>{var n=jw(),r=P(n),i=I(r,!0),a=I(L(r),!0);O(n),R(e=>{W(i,z(t).text),W(a,e)},[()=>z(t).items.join(`
|
|
32
|
+
`)]),U(e,n)},u=e=>{var n=Nw(),r=F(n),i=I(r,!0),a=L(r,2),o=e=>{var n=Mw(),r=I(n,!0);R(()=>W(r,z(t).detail)),U(e,n)};G(a,e=>{z(t).detail&&e(o)}),R(()=>W(i,z(t).text)),U(e,n)};G(c,e=>{z(t).items?e(l):e(u,-1)}),O(r),R(()=>{q(r,`data-level`,z(t).level),W(a,z(t).time),W(s,n[z(t).level]??``)}),U(e,r)}),U(e,t)};G(E,e=>{z(i)?Lb.raw?e(re,1):e(ie,-1):e(ne)}),O(T),Ma(T,e=>N(o,e),()=>z(o)),O(t),Ma(t,e=>N(s,e),()=>z(s)),R((e,n,r)=>{c=Ji(t,1,`logs svelte-1feoaw6`,null,c,{dragging:z(u)}),d=Xi(t,``,d,{height:e}),W(b,n),q(S,`aria-pressed`,Lb.raw),W(w,z(m)?`Shrink`:`Expand`),te=Ji(T,1,`body svelte-1feoaw6`,null,te,{raw:Lb.raw,"no-time":r})},[()=>z(l)?`${String(z(l)*100)}%`:void 0,()=>(Lb.past(z(r))?z(i):Q.tail(z(r)))?``:`no log yet`,()=>!z(a).some(e=>e.time)]),V(`pointerdown`,f,g),V(`dblclick`,f,h),V(`keydown`,f,_),V(`click`,x,()=>{Lb.clear()}),V(`click`,S,()=>Lb.raw=!Lb.raw),V(`click`,C,h),V(`click`,ee,()=>{Lb.closeAll()}),U(e,t)};G(b,e=>{z(r)&&e(x)}),U(e,y),A()}Zr([`pointerdown`,`dblclick`,`keydown`,`click`]);var Lw=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rw(e,t){let n=J(t,Lw),r={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var zw=H(`<button type="button" role="menuitem"> <span class="svelte-1i03v8q"> </span></button>`),Bw=H(`<button type="button" aria-haspopup="menu"><!></button> <div class="menu svelte-1i03v8q" popover="" role="menu" tabindex="-1"></div>`,1);function Vw(e,t){let n=li();k(t,!0);let r=M(void 0),i=M(void 0),a=M(!1),o=()=>[...z(i)?.querySelectorAll(`button:not(:disabled)`)??[]],s=()=>{let e=z(r)?.getBoundingClientRect();e&&z(i)&&(z(i).style.top=`${String(e.bottom+6)}px`,z(i).style.right=`${String(innerWidth-e.right)}px`,o()[0]?.focus())},c=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=o();t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()};var l=Bw(),u=F(l);X(P(u),{get of(){return Rw},size:12}),O(u),Ma(u,e=>N(r,e),()=>z(r));var d=L(u,2);K(d,21,()=>t.items,e=>e.label,(e,t)=>{var n=zw();let r;var a=P(n,!0),o=I(L(a),!0);O(n),R(()=>{n.disabled=z(t).off,r=Ji(n,1,`svelte-1i03v8q`,null,r,{danger:z(t).danger}),W(a,z(t).label),W(o,z(t).about)}),V(`click`,n,()=>{z(i)?.hidePopover(),z(t).run()}),U(e,n)}),O(d),Ma(d,e=>N(i,e),()=>z(i)),R(()=>{Ji(u,1,`more ${t.tone??``}`,`svelte-1i03v8q`),q(u,`aria-label`,t.label),q(u,`aria-expanded`,z(a)),q(u,`popovertarget`,n),q(d,`id`,n),q(d,`aria-label`,t.label)}),V(`keydown`,d,c),B(`toggle`,d,e=>{N(a,e.newState===`open`),z(a)&&s()}),U(e,l),A()}Zr([`keydown`,`click`]);var Hw=new Set([`$$slots`,`$$events`,`$$legacy`]);function Uw(e,t){let n=J(t,Hw),r={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}],[`path`,{d:`m3 17 2 2 4-4`}],[`path`,{d:`m3 7 2 2 4-4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Ww=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gw(e,t){let n=J(t,Ww),r={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 9h18`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Kw=new Set([`$$slots`,`$$events`,`$$legacy`]);function qw(e,t){let n=J(t,Kw),r={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Jw=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yw(e,t){let n=J(t,Jw),r={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Xw=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zw(e,t){let n=J(t,Xw),r={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Qw=H(`<button class="text svelte-r1euo8" type="button">Copy</button> <button class="text svelte-r1euo8" type="button">Clear</button>`,1),$w=H(`<span class="warn svelte-r1euo8">Other open tabs and copied links stop working.</span> <button class="text svelte-r1euo8" type="button">Cancel</button> <button class="text go svelte-r1euo8" type="button">Get it</button>`,1),eT=H(`<span class="svelte-r1euo8">Address</span> <button class="text svelte-r1euo8" type="button" title="Give the canvas a new address, so a link that was copied or shared no longer opens it">New address</button>`,1),tT=H(`<button type="button" role="radio" class="svelte-r1euo8"><!></button>`),nT=H(`<button class="open svelte-r1euo8" type="button" popovertarget="settings" aria-label="Settings" title="Settings"><!></button> <div class="pop svelte-r1euo8" id="settings" popover="" aria-label="Settings"><div class="row log svelte-r1euo8"><label class="toggle svelte-r1euo8"><input type="checkbox" role="switch"/><span class="track svelte-r1euo8" aria-hidden="true"></span>Debug log</label> <!></div> <div class="row address svelte-r1euo8"><!></div> <div class="row svelte-r1euo8" role="radiogroup" aria-label="Theme"><span class="svelte-r1euo8">Theme</span> <!></div></div>`,1);function rT(e,t){k(t,!0);let n=M(!1),r=async()=>{let e=await Xs(`new-address`,{port:location.port});`error`in e?($.show(`No new address: ${e.error}`,`warning`),N(n,!1)):location.replace(e.path+location.hash)},i=async()=>{let e=await gc.read();e?await navigator.clipboard.writeText(e).then(()=>!0,()=>!1)?$.show(`Last 300 entries copied`):$.show(`Copy is blocked here: the log is debug.jsonl in Koppler's run folder`,`warning`):$.show(`The debug log is empty. Turn it on, then do what went wrong.`)},a=[[`system`,`Like your system`,qw],[`light`,`Light`,Zw],[`dark`,`Dark`,Yw]];var o=nT(),s=F(o);X(P(s),{get of(){return Pc},size:16}),O(s);var c=L(s,2),l=P(c),u=P(l),d=P(u);ma(d),je(2),O(u);var f=L(u,2),p=e=>{var t=Qw(),n=F(t),r=L(n,2);V(`click`,n,i),V(`click`,r,()=>{gc.clear(),$.show(`Debug log cleared`)}),U(e,t)};G(f,e=>{gc.on&&e(p)}),O(l);var m=L(l,2),h=P(m),g=e=>{var t=$w(),i=L(F(t),2),a=L(i,2);V(`click`,i,()=>N(n,!1)),V(`click`,a,()=>void r()),U(e,t)},_=e=>{var t=eT();V(`click`,L(F(t),2),()=>N(n,!0)),U(e,t)};G(h,e=>{z(n)?e(g):e(_,-1)}),O(m);var y=L(m,2);K(L(P(y),2),17,()=>a,([e,t,n])=>e,(e,t)=>{var n=j(()=>v(z(t),3));let r=()=>z(n)[0],i=()=>z(n)[1],a=()=>z(n)[2];var o=tT();X(P(o),{get of(){return a()},size:14}),O(o),R(()=>{q(o,`aria-checked`,Wx.now===r()),q(o,`aria-label`,i()),q(o,`title`,i())}),V(`click`,o,()=>{Wx.pick(r())}),U(e,o)}),O(y),O(c),R(()=>{q(u,`title`,gc.forced?`Always on while Koppler runs from its source folder, so every problem can be traced.`:`Keeps every click, change and message on this canvas, so a problem can be traced. Nothing you type is kept.`),d.disabled=gc.forced}),Ta(d,()=>gc.on,e=>gc.on=e),U(e,o),A()}Zr([`click`]);var iT=H(`<button class="needs svelte-1qvf60f" type="button" title="This stack needs something on this Mac" aria-label="This stack needs something on this Mac"><!></button>`),aT=H(`<nav aria-label="Side pane, folded"><button type="button" title="Board and environment" class="svelte-1qvf60f"><!> <span class="env svelte-1qvf60f"> </span></button> <button type="button" title="Apps: on the board, and the rest of the stack" class="svelte-1qvf60f"><!> <span class="svelte-1qvf60f"> </span></button> <div class="foot svelte-1qvf60f"><!> <!></div></nav>`);function oT(e,t){k(t,!0);let n=j(()=>(Q.status?.checks??[]).some(e=>e.state!==`ok`));var r=aT();let i;var a=P(r),o=P(a);X(o,{get of(){return Gw},size:16});var s=I(L(o,2),!0);O(a);var c=L(a,2),l=P(c);X(l,{get of(){return Uw},size:16});var u=I(L(l,2));O(c);var d=L(c,2),f=P(d),p=e=>{var n=iT();X(P(n),{get of(){return Px},size:15}),O(n),V(`click`,n,()=>{t.open()}),U(e,n)};G(f,e=>{z(n)&&e(p)}),rT(L(f,2),{}),O(d),O(r),R((e,t)=>{i=Ji(r,1,`svelte-1qvf60f`,null,i,{protected:Z.protected}),q(a,`aria-label`,`Board and environment: ${e??``}`),W(s,t),q(c,`aria-label`,`Apps: ${Z.cards.length??``} of ${Z.apps.length??``} on the board`),W(u,`${Z.cards.length??``}/${Z.apps.length??``}`)},[()=>Z.env.toUpperCase(),()=>Z.env.toUpperCase()]),V(`click`,a,()=>{t.open(`board`)}),V(`click`,c,()=>{t.open()}),U(e,r),A()}Zr([`click`]);var sT=H(`<span class="row svelte-1vz4hzd"><span class="who svelte-1vz4hzd"> </span> <input type="checkbox" class="svelte-1vz4hzd"/> <input type="checkbox" class="svelte-1vz4hzd"/></span>`),cT=H(`<dialog aria-labelledby="outside-title" class="svelte-1vz4hzd"><button class="x svelte-1vz4hzd" type="button" aria-label="Close"><!></button> <h2 id="outside-title" class="svelte-1vz4hzd">Add an outside system</h2> <p class="sub svelte-1vz4hzd">A service that never runs on this Mac, such as a payment provider or a SaaS API: your apps call it, or it calls them
|
|
33
|
+
(a webhook).</p> <form class="svelte-1vz4hzd"><label class="svelte-1vz4hzd">Name <input required="" maxlength="80" placeholder="Stripe" class="svelte-1vz4hzd"/></label> <label class="svelte-1vz4hzd"><span>Address <span class="opt svelte-1vz4hzd">optional</span></span> <input type="url" placeholder="https://api.stripe.com" class="svelte-1vz4hzd"/></label> <label class="svelte-1vz4hzd"><span>What it is <span class="opt svelte-1vz4hzd">optional</span></span> <input maxlength="200" placeholder="Payment provider" class="svelte-1vz4hzd"/></label> <fieldset class="svelte-1vz4hzd"><legend class="svelte-1vz4hzd">Your apps</legend> <div class="callers svelte-1vz4hzd"><span class="head svelte-1vz4hzd" aria-hidden="true"><span class="svelte-1vz4hzd"></span><span class="svelte-1vz4hzd">Calls it</span><span class="svelte-1vz4hzd">Gets its calls</span></span> <!></div></fieldset> <p class="error svelte-1vz4hzd" role="alert"> </p> <div class="acts svelte-1vz4hzd"><button type="button" class="svelte-1vz4hzd">Cancel</button> <button class="go svelte-1vz4hzd" type="submit"> </button></div></form></dialog>`);function lT(e,t){k(t,!0);let n=M(void 0),r=M(``),i=M(``),a=M(``),o=M(pn({})),s=M(pn({})),c=M(``),l=M(!1),u=j(()=>Z.apps.filter(e=>!e.outside)),d=e=>z(u).filter(t=>e[t.id]).map(e=>e.id);function f(){N(r,``),N(i,``),N(a,``),N(o,{},!0),N(s,{},!0),N(c,``),z(n)?.showModal()}let p=async e=>{e.preventDefault();let t=d(z(o)),u=d(z(s));if(!t.length&&!u.length){N(c,`Pick the apps that call ${z(r).trim()||`it`}, or that it calls: its card shows next to them.`);return}N(l,!0);let f=await Xs(`apps-outside`,{name:z(r),url:z(i),why:z(a),calledBy:t,sendsTo:u});N(l,!1),`error`in f?N(c,f.error,!0):(z(n)?.close(),location.reload())};var m={open:f},h=cT(),g=P(h);X(P(g),{get of(){return to},size:14}),O(g);var _=L(g,6),v=P(_),y=L(P(v));ma(y),O(v);var b=L(v,2),x=L(P(b),2);ma(x),O(b);var S=L(b,2),C=L(P(S),2);ma(C),O(S);var w=L(S,2),ee=L(P(w),2);K(L(P(ee),2),17,()=>z(u),e=>e.id,(e,t)=>{var n=sT(),r=P(n),i=I(r,!0),a=L(r,2);ma(a);var l=L(a,2);ma(l),O(n),R(()=>{W(i,z(t).name),q(a,`aria-label`,`${z(t).name??``} calls it`),ga(a,!!z(o)[z(t).id]),q(l,`aria-label`,`${z(t).name??``} gets its calls`),ga(l,!!z(s)[z(t).id])}),V(`change`,a,e=>{z(o)[z(t).id]=e.currentTarget.checked,N(c,``)}),V(`change`,l,e=>{z(s)[z(t).id]=e.currentTarget.checked,N(c,``)}),U(e,n)}),O(ee),O(w);var T=L(w,2),te=I(T,!0),E=L(T,2),ne=P(E),re=L(ne,2),ie=I(re,!0);return O(E),O(_),O(h),Ma(h,e=>N(n,e),()=>z(n)),R(()=>{W(te,z(c)),re.disabled=z(l),W(ie,z(l)?`Adding…`:`Add`)}),V(`click`,g,()=>z(n)?.close()),B(`submit`,_,p),Sa(y,()=>z(r),e=>N(r,e)),Sa(x,()=>z(i),e=>N(i,e)),Sa(C,()=>z(a),e=>N(a,e)),V(`click`,ne,()=>z(n)?.close()),U(e,h),A(m)}Zr([`click`,`change`]);var uT=H(`<aside aria-labelledby="card-panel-title"><header class="svelte-c90ff7"><h2 id="card-panel-title" class="svelte-c90ff7"> </h2> <span class="kind svelte-c90ff7"> </span> <button class="x svelte-c90ff7" type="button" aria-label="Close" title="Close: deselects the card"><!></button></header> <!></aside>`);function dT(e,t){k(t,!0);let n=j(()=>Z.panelCard);var r=ci(),i=F(r),a=e=>{var t=uT();let r;var i=P(t),a=P(i),o=I(a,!0),s=L(a,2),c=I(s,!0),l=L(s,2);X(P(l),{get of(){return to},size:14}),O(l),O(i),wi(L(i,2),()=>z(n).id,e=>{Mb(e,{get id(){return z(n).id}})}),O(t),R(()=>{Ji(t,1,`kind-${z(n).data.kind??``}`,`svelte-c90ff7`),r=Xi(t,``,r,{width:`300px`}),q(a,`title`,z(n).data.name),W(o,z(n).data.name),W(c,z(n).data.kindLabel)}),V(`click`,l,()=>{Z.pick(``)}),U(e,t)};G(i,e=>{z(n)&&e(a)}),U(e,r),A()}Zr([`click`]);var fT=new Set([`$$slots`,`$$events`,`$$legacy`]);function pT(e,t){let n=J(t,fT),r={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var mT=new Set([`$$slots`,`$$events`,`$$legacy`]);function hT(e,t){let n=J(t,mT),r={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`}],[`path`,{d:`m14 7 3 3`}],[`path`,{d:`M5 6v4`}],[`path`,{d:`M19 14v4`}],[`path`,{d:`M10 2v2`}],[`path`,{d:`M7 8H3`}],[`path`,{d:`M21 16h-4`}],[`path`,{d:`M11 3H9`}]],aliases:[`wand-2`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var gT=[`postgres`,`mysql`,`redis`],_T=/^[A-Za-z0-9_][\w.-]*$/,vT=new Set([`__proto__`,`prototype`,`constructor`]);function yT(e){let t=[],n=/\.?([A-Za-z0-9_][\w-]*)|\[(\d+)\]|\["([^"\]]+)"\]/y,r=0;for(;r<e.length;){n.lastIndex=r;let i=n.exec(e);if(!i||r===0&&e.startsWith(`.`))return{error:`${e} is not a path such as apps.orders.url`};let[,a,o,s]=i;o===void 0?t.push(a??s):t.push(Number(o)),r=n.lastIndex}let i=t.find(e=>typeof e==`string`&&(vT.has(e)||!_T.test(e)));return i===void 0?t.length?t:{error:`give a path, such as apps.orders.url`}:{error:`${String(i)} cannot be part of a path`}}var bT=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function xT(e,t){let n=e;for(let e of t){if(typeof e==`number`?!Array.isArray(n):!bT(n)||!Object.hasOwn(n,e))return;n=n[e]}return n}function ST(e,t,n){let[r,...i]=t;if(r===void 0)return n;if(typeof r==`number`){let t=Array.isArray(e)?[...e]:[];if(r>t.length)throw Error(`there is no item ${String(r)} in this list`);return!i.length&&n===void 0?t.splice(r,1):t[r]=ST(t[r],i,n),t}if(Array.isArray(e))throw Error(`${r} is not a place in a list`);let a=bT(e)?e:{};return!i.length&&n===void 0?Object.fromEntries(Object.entries(a).filter(([e])=>e!==r)):{...a,[r]:ST(a[r],i,n)}}var CT=new Set([`$$slots`,`$$events`,`$$legacy`]);function wT(e,t){let n=J(t,CT),r={name:`lock-open`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`}]],aliases:[`unlock`]};$a(e,Ba(()=>n,{get icon(){return r}}))}var TT=H(`<label class="svelte-s22te4"><input type="checkbox" class="svelte-s22te4"/> <span class="svelte-s22te4"> </span></label>`),ET=H(`<div class="checks svelte-s22te4" role="group"></div>`),DT=H(`<span class="none svelte-s22te4"> </span>`);function OT(e,t){k(t,!0);let n=Y(t,`disabled`,3,!1),r=j(()=>[...t.options,...t.picked.filter(e=>!t.options.some(t=>t.value===e)).map(e=>({value:e,label:e}))]);var i=ci(),a=F(i),o=e=>{var i=ET();K(i,21,()=>z(r),e=>e.value,(e,r)=>{var i=TT(),a=P(i);ma(a);var o=I(L(a,2),!0);O(i),R(e=>{a.disabled=n(),ga(a,e),W(o,z(r).label)},[()=>t.picked.includes(z(r).value)]),V(`change`,a,e=>{t.ontoggle(z(r).value,e.currentTarget.checked)}),U(e,i)}),O(i),R(()=>q(i,`aria-label`,t.label)),U(e,i)},s=e=>{var n=DT(),r=I(n,!0);R(()=>W(r,t.none)),U(e,n)};G(a,e=>{z(r).length?e(o):e(s,-1)}),U(e,i),A()}Zr([`change`]);var kT=new Set([`$$slots`,`$$events`,`$$legacy`]);function AT(e,t){let n=J(t,kT),r={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var jT=H(`<button type="button" title="Move earlier" class="svelte-1iop5lw"><!></button>`),MT=H(`<span class="tag svelte-1iop5lw"> </span>`),NT=H(`<button type="button" title="Remove" class="svelte-1iop5lw"><!></button>`),PT=H(`<li><!> <span class="word svelte-1iop5lw"> </span> <!> <!></li>`),FT=H(`<li class="new svelte-1iop5lw"><input class="svelte-1iop5lw"/></li>`),IT=H(`<ul class="chips svelte-1iop5lw"><!> <!></ul>`);function LT(e,t){k(t,!0);let n=Y(t,`ordered`,3,!1),r=Y(t,`disabled`,3,!1),i=Y(t,`placeholder`,3,`Add one`),a=Y(t,`first`,3,``),o=M(``),s=()=>{let e=z(o).trim();N(o,``),e&&!t.value.includes(e)&&t.onchange([...t.value,e])},c=e=>{let n=[...t.value];[n[e-1],n[e]]=[n[e]??``,n[e-1]??``],t.onchange(n)};var l=IT(),u=P(l);K(u,18,()=>t.value,e=>e,(e,i,o)=>{var s=PT();let l;var u=P(s),d=e=>{var t=jT();X(P(t),{get of(){return AT},size:10}),O(t),R(()=>q(t,`aria-label`,`Move ${i??``} earlier`)),V(`click`,t,()=>{c(z(o))}),U(e,t)};G(u,e=>{n()&&z(o)>0&&!r()&&e(d)});var f=L(u,2),p=I(f,!0),m=L(f,2),h=e=>{var t=MT(),n=I(t,!0);R(()=>W(n,a())),U(e,t)};G(m,e=>{n()&&z(o)===0&&a()&&e(h)});var g=L(m,2),_=e=>{var n=NT();X(P(n),{get of(){return to},size:10}),O(n),R(()=>q(n,`aria-label`,`Remove ${i??``}`)),V(`click`,n,()=>{t.onchange(t.value.filter(e=>e!==i))}),U(e,n)};G(g,e=>{r()||e(_)}),O(s),R(()=>{l=Ji(s,1,`svelte-1iop5lw`,null,l,{first:n()&&z(o)===0}),W(p,i)}),U(e,s)});var d=L(u,2),f=e=>{var n=FT(),r=P(n);ma(r),O(n),R(e=>{q(r,`aria-label`,`Add to ${t.label??``}`),q(r,`placeholder`,i()),q(r,`size`,e)},[()=>Math.max(i().length,z(o).length)+1]),V(`keydown`,r,e=>{(e.key===`Enter`||e.key===`,`)&&(e.preventDefault(),s())}),B(`blur`,r,s),Sa(r,()=>z(o),e=>N(o,e)),U(e,n)};G(d,e=>{r()||e(f)}),O(l),R(()=>q(l,`aria-label`,t.label)),U(e,l),A()}Zr([`click`,`keydown`]);var RT=new Set([`$$slots`,`$$events`,`$$legacy`]);function zT(e,t){let n=J(t,RT),r={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}],[`path`,{d:`M10 4v4`}],[`path`,{d:`M2 8h20`}],[`path`,{d:`M6 4v4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var BT=new Set([`$$slots`,`$$events`,`$$legacy`]);function VT(e,t){let n=J(t,BT),r={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`}],[`path`,{d:`M12 22V12`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var HT=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,UT=`</title><path d="`,WT=`"/></svg>`,GT={title:`.NET`,slug:`dotnet`,get svg(){return HT+`.NET`+UT+this.path+WT},path:`M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z`,source:`https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/logo/dotnet-logo.svg`,hex:`512BD4`,guidelines:`https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/dotnet-styleGuide-2024.pdf`,license:{type:`CC0-1.0`,url:`https://spdx.org/licenses/CC0-1.0`}},KT={title:`Docker`,slug:`docker`,get svg(){return HT+`Docker`+UT+this.path+WT},path:`M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z`,source:`https://www.docker.com/company/newsroom/media-resources`,hex:`2496ED`},qT={title:`Flutter`,slug:`flutter`,get svg(){return HT+`Flutter`+UT+this.path+WT},path:`M14.314 0L2.3 12 6 15.7 21.684.013h-7.357zm.014 11.072L7.857 17.53l6.47 6.47H21.7l-6.46-6.468 6.46-6.46h-7.37z`,source:`https://flutter.dev/brand`,hex:`02569B`,guidelines:`https://flutter.dev/brand`},JT={title:`Go`,slug:`go`,get svg(){return HT+`Go`+UT+this.path+WT},path:`M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z`,source:`https://blog.golang.org/go-brand`,hex:`00ADD8`,guidelines:`https://blog.golang.org/go-brand`},YT={title:`Node.js`,slug:`nodedotjs`,get svg(){return HT+`Node.js`+UT+this.path+WT},path:`M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z`,source:`https://nodejs.org/en/about/branding`,hex:`5FA04E`,guidelines:`https://nodejs.org/en/about/branding`},XT={title:`OpenJDK`,slug:`openjdk`,get svg(){return HT+`OpenJDK`+UT+this.path+WT},path:`M11.915 0 11.7.215C9.515 2.4 7.47 6.39 6.046 10.483c-1.064 1.024-3.633 2.81-3.711 3.551-.093.87 1.746 2.611 1.55 3.235-.198.625-1.304 1.408-1.014 1.939.1.188.823.011 1.277-.491a13.389 13.389 0 0 0-.017 2.14c.076.906.27 1.668.643 2.232.372.563.956.911 1.667.911.397 0 .727-.114 1.024-.264.298-.149.571-.33.91-.5.68-.34 1.634-.666 3.53-.604 1.903.062 2.872.39 3.559.704.687.314 1.15.664 1.925.664.767 0 1.395-.336 1.807-.9.412-.563.631-1.33.72-2.24.06-.623.055-1.32 0-2.066.454.45 1.117.604 1.213.424.29-.53-.816-1.314-1.013-1.937-.198-.624 1.642-2.366 1.549-3.236-.08-.748-2.707-2.568-3.748-3.586C16.428 6.374 14.308 2.394 12.13.215zm.175 6.038a2.95 2.95 0 0 1 2.943 2.942 2.95 2.95 0 0 1-2.943 2.943A2.95 2.95 0 0 1 9.148 8.98a2.95 2.95 0 0 1 2.942-2.942zM8.685 7.983a3.515 3.515 0 0 0-.145.997c0 1.951 1.6 3.55 3.55 3.55 1.95 0 3.55-1.598 3.55-3.55 0-.329-.046-.648-.132-.951.334.095.64.208.915.336a42.699 42.699 0 0 1 2.042 5.829c.678 2.545 1.01 4.92.846 6.607-.082.844-.29 1.51-.606 1.94-.315.431-.713.651-1.315.651-.593 0-.932-.27-1.673-.61-.741-.338-1.825-.694-3.792-.758-1.974-.064-3.073.293-3.821.669-.375.188-.659.373-.911.5s-.466.2-.752.2c-.53 0-.876-.209-1.16-.64-.285-.43-.474-1.101-.545-1.948-.141-1.693.176-4.069.823-6.614a43.155 43.155 0 0 1 1.934-5.783c.348-.167.749-.31 1.192-.425zm-3.382 4.362a.216.216 0 0 1 .13.031c-.166.56-.323 1.116-.463 1.665a33.849 33.849 0 0 0-.547 2.555 3.9 3.9 0 0 0-.2-.39c-.58-1.012-.914-1.642-1.16-2.08.315-.24 1.679-1.755 2.24-1.781zm13.394.01c.562.027 1.926 1.543 2.24 1.783-.246.438-.58 1.068-1.16 2.08a4.428 4.428 0 0 0-.163.309 32.354 32.354 0 0 0-.562-2.49 40.579 40.579 0 0 0-.482-1.652.216.216 0 0 1 .127-.03z`,source:`https://hg.openjdk.java.net/duke/duke/file/ca00f100dafc/vector/Agent.svg`,hex:`000000`,license:{type:`BSD-3-Clause`,url:`https://spdx.org/licenses/BSD-3-Clause`}},ZT={title:`PHP`,slug:`php`,get svg(){return HT+`PHP`+UT+this.path+WT},path:`M7.01 10.207h-.944l-.515 2.648h.838c.556 0 .97-.105 1.242-.314.272-.21.455-.559.55-1.049.092-.47.05-.802-.124-.995-.175-.193-.523-.29-1.047-.29zM12 5.688C5.373 5.688 0 8.514 0 12s5.373 6.313 12 6.313S24 15.486 24 12c0-3.486-5.373-6.312-12-6.312zm-3.26 7.451c-.261.25-.575.438-.917.551-.336.108-.765.164-1.285.164H5.357l-.327 1.681H3.652l1.23-6.326h2.65c.797 0 1.378.209 1.744.628.366.418.476 1.002.33 1.752a2.836 2.836 0 0 1-.305.847c-.143.255-.33.49-.561.703zm4.024.715l.543-2.799c.063-.318.039-.536-.068-.651-.107-.116-.336-.174-.687-.174H11.46l-.704 3.625H9.388l1.23-6.327h1.367l-.327 1.682h1.218c.767 0 1.295.134 1.586.401s.378.7.263 1.299l-.572 2.944h-1.389zm7.597-2.265a2.782 2.782 0 0 1-.305.847c-.143.255-.33.49-.561.703a2.44 2.44 0 0 1-.917.551c-.336.108-.765.164-1.286.164h-1.18l-.327 1.682h-1.378l1.23-6.326h2.649c.797 0 1.378.209 1.744.628.366.417.477 1.001.331 1.751zM17.766 10.207h-.943l-.516 2.648h.838c.557 0 .971-.105 1.242-.314.272-.21.455-.559.551-1.049.092-.47.049-.802-.125-.995s-.524-.29-1.047-.29z`,source:`https://php.net/download-logos.php`,hex:`777BB4`,license:{type:`CC-BY-SA-4.0`,url:`https://spdx.org/licenses/CC-BY-SA-4.0`}},QT={title:`Python`,slug:`python`,get svg(){return HT+`Python`+UT+this.path+WT},path:`M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z`,source:`https://www.python.org/community/logos/`,hex:`3776AB`,guidelines:`https://www.python.org/community/logos/`},$T={title:`React`,slug:`react`,get svg(){return HT+`React`+UT+this.path+WT},path:`M14.23 12.004a2.236 2.236 0 0 1-2.235 2.236 2.236 2.236 0 0 1-2.236-2.236 2.236 2.236 0 0 1 2.235-2.236 2.236 2.236 0 0 1 2.236 2.236zm2.648-10.69c-1.346 0-3.107.96-4.888 2.622-1.78-1.653-3.542-2.602-4.887-2.602-.41 0-.783.093-1.106.278-1.375.793-1.683 3.264-.973 6.365C1.98 8.917 0 10.42 0 12.004c0 1.59 1.99 3.097 5.043 4.03-.704 3.113-.39 5.588.988 6.38.32.187.69.275 1.102.275 1.345 0 3.107-.96 4.888-2.624 1.78 1.654 3.542 2.603 4.887 2.603.41 0 .783-.09 1.106-.275 1.374-.792 1.683-3.263.973-6.365C22.02 15.096 24 13.59 24 12.004c0-1.59-1.99-3.097-5.043-4.032.704-3.11.39-5.587-.988-6.38-.318-.184-.688-.277-1.092-.278zm-.005 1.09v.006c.225 0 .406.044.558.127.666.382.955 1.835.73 3.704-.054.46-.142.945-.25 1.44-.96-.236-2.006-.417-3.107-.534-.66-.905-1.345-1.727-2.035-2.447 1.592-1.48 3.087-2.292 4.105-2.295zm-9.77.02c1.012 0 2.514.808 4.11 2.28-.686.72-1.37 1.537-2.02 2.442-1.107.117-2.154.298-3.113.538-.112-.49-.195-.964-.254-1.42-.23-1.868.054-3.32.714-3.707.19-.09.4-.127.563-.132zm4.882 3.05c.455.468.91.992 1.36 1.564-.44-.02-.89-.034-1.345-.034-.46 0-.915.01-1.36.034.44-.572.895-1.096 1.345-1.565zM12 8.1c.74 0 1.477.034 2.202.093.406.582.802 1.203 1.183 1.86.372.64.71 1.29 1.018 1.946-.308.655-.646 1.31-1.013 1.95-.38.66-.773 1.288-1.18 1.87-.728.063-1.466.098-2.21.098-.74 0-1.477-.035-2.202-.093-.406-.582-.802-1.204-1.183-1.86-.372-.64-.71-1.29-1.018-1.946.303-.657.646-1.313 1.013-1.954.38-.66.773-1.286 1.18-1.868.728-.064 1.466-.098 2.21-.098zm-3.635.254c-.24.377-.48.763-.704 1.16-.225.39-.435.782-.635 1.174-.265-.656-.49-1.31-.676-1.947.64-.15 1.315-.283 2.015-.386zm7.26 0c.695.103 1.365.23 2.006.387-.18.632-.405 1.282-.66 1.933-.2-.39-.41-.783-.64-1.174-.225-.392-.465-.774-.705-1.146zm3.063.675c.484.15.944.317 1.375.498 1.732.74 2.852 1.708 2.852 2.476-.005.768-1.125 1.74-2.857 2.475-.42.18-.88.342-1.355.493-.28-.958-.646-1.956-1.1-2.98.45-1.017.81-2.01 1.085-2.964zm-13.395.004c.278.96.645 1.957 1.1 2.98-.45 1.017-.812 2.01-1.086 2.964-.484-.15-.944-.318-1.37-.5-1.732-.737-2.852-1.706-2.852-2.474 0-.768 1.12-1.742 2.852-2.476.42-.18.88-.342 1.356-.494zm11.678 4.28c.265.657.49 1.312.676 1.948-.64.157-1.316.29-2.016.39.24-.375.48-.762.705-1.158.225-.39.435-.788.636-1.18zm-9.945.02c.2.392.41.783.64 1.175.23.39.465.772.705 1.143-.695-.102-1.365-.23-2.006-.386.18-.63.406-1.282.66-1.933zM17.92 16.32c.112.493.2.968.254 1.423.23 1.868-.054 3.32-.714 3.708-.147.09-.338.128-.563.128-1.012 0-2.514-.807-4.11-2.28.686-.72 1.37-1.536 2.02-2.44 1.107-.118 2.154-.3 3.113-.54zm-11.83.01c.96.234 2.006.415 3.107.532.66.905 1.345 1.727 2.035 2.446-1.595 1.483-3.092 2.295-4.11 2.295-.22-.005-.406-.05-.553-.132-.666-.38-.955-1.834-.73-3.703.054-.46.142-.944.25-1.438zm4.56.64c.44.02.89.034 1.345.034.46 0 .915-.01 1.36-.034-.44.572-.895 1.095-1.345 1.565-.455-.47-.91-.993-1.36-1.565z`,source:`https://github.com/facebook/create-react-app/blob/282c03f9525fdf8061ffa1ec50dce89296d916bd/test/fixtures/relative-paths/src/logo.svg`,hex:`61DAFB`},eE={title:`Ruby`,slug:`ruby`,get svg(){return HT+`Ruby`+UT+this.path+WT},path:`M20.156.083c3.033.525 3.893 2.598 3.829 4.77L24 4.822 22.635 22.71 4.89 23.926h.016C3.433 23.864.15 23.729 0 19.139l1.645-3 2.819 6.586.503 1.172 2.805-9.144-.03.007.016-.03 9.255 2.956-1.396-5.431-.99-3.9 8.82-.569-.615-.51L16.5 2.114 20.159.073l-.003.01zM0 19.089zM5.13 5.073c3.561-3.533 8.157-5.621 9.922-3.84 1.762 1.777-.105 6.105-3.673 9.636-3.563 3.532-8.103 5.734-9.864 3.957-1.766-1.777.045-6.217 3.612-9.75l.003-.003z`,source:`https://www.ruby-lang.org/en/about/logo/`,hex:`CC342D`,license:{type:`CC-BY-SA-2.5`,url:`https://spdx.org/licenses/CC-BY-SA-2.5`}},tE={title:`Rust`,slug:`rust`,get svg(){return HT+`Rust`+UT+this.path+WT},path:`M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z`,source:`https://www.rust-lang.org`,hex:`000000`,guidelines:`https://www.rust-lang.org/policies/media-guide`,license:{type:`CC-BY-SA-4.0`,url:`https://spdx.org/licenses/CC-BY-SA-4.0`}},nE=`M4.9855 0c-.2941.0031-.5335.2466-.534.5482L4.446 5.456c0 .1451.06.2835.159.3891a.5322.5322 0 0 0 .3806.1562h3.4282l8.197 17.6805a.5365.5365 0 0 0 .4885.3181h5.811c.2969 0 .5426-.2448.5426-.5482V18.544c0-.3035-.2392-.5482-.5425-.5482h-2.0138L12.7394.3153C12.647.124 12.4564 0 12.2452 0h-7.254Zm.5397 1.0907h6.3678l8.16 17.6804a.5365.5365 0 0 0 .4885.3181h1.8178v3.8173H17.437L9.2402 5.226a.536.536 0 0 0-.4885-.318H5.5223Zm2.0137 8.2366c-.2098.0011-.3937.1193-.4857.3096L.6002 23.2133a.5506.5506 0 0 0 .0313.5282.5334.5334 0 0 0 .4544.25h6.169a.5468.5468 0 0 0 .497-.3096l3.38-7.166a.5405.5405 0 0 0-.0029-.4686L8.036 9.637a.5468.5468 0 0 0-.4942-.3096Zm.0057 1.8036 2.488 5.1522-3.1214 6.6206H1.9465Z`,rE={dotnet:{logo:GT.path},flutter:{logo:qT.path},node:{logo:YT.path},lambda:{logo:nE},sam:{logo:nE},web:{icon:zT},reactnative:{logo:$T.path},go:{logo:JT.path},rust:{logo:tE.path},java:{logo:XT.path},python:{logo:QT.path},ruby:{logo:eE.path},php:{logo:ZT.path},compose:{logo:KT.path}},iE=e=>(Object.hasOwn(rE,e)?rE[e]:void 0)??{icon:VT},aE=oi(`<title> </title>`),oE=oi(`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><!><path></path></svg>`);function sE(e,t){k(t,!0);let n=j(()=>iE(t.kind));var r=ci(),i=F(r),a=e=>{var r=oE();let i;var a=P(r),o=e=>{var n=aE(),r=I(n,!0);R(()=>W(r,t.label)),U(e,n)};G(a,e=>{t.label&&e(o)});var s=L(a);O(r),R(()=>{q(r,`role`,t.label?`img`:void 0),q(r,`aria-label`,t.label||void 0),q(r,`aria-hidden`,t.label?void 0:`true`),i=Ji(r,0,`svelte-7vspaq`,null,i,{wordmark:t.kind===`dotnet`}),q(s,`d`,z(n).logo)}),U(e,r)},o=e=>{X(e,{get of(){return z(n).icon},size:16,get label(){return t.label}})};G(i,e=>{z(n).logo?e(a):z(n).icon&&e(o,1)}),U(e,r),A()}var cE=H(`<!> <span class="label svelte-npi4py"> </span>`,1),lE=H(`<span class="label unset svelte-npi4py">Choose a kind…</span>`),uE=H(`<button type="button" role="option" class="svelte-npi4py"><!> <span class="label svelte-npi4py"> </span></button>`),dE=H(`<div class="list svelte-npi4py" role="listbox" aria-label="Kind"></div>`),fE=H(`<div class="pick svelte-npi4py" role="presentation"><button class="now svelte-npi4py" type="button" aria-haspopup="listbox"><!> <span class="chev svelte-npi4py"><!></span></button> <!></div>`);function pE(e,t){k(t,!0);let n=Y(t,`disabled`,3,!1),r=M(!1),i=M(void 0),a=j(()=>t.value&&!t.options.some(e=>e.value===t.value)?[...t.options,{value:t.value,label:t.value}]:t.options),o=j(()=>z(a).find(e=>e.value===t.value)),s=e=>{let t=[...z(i)?.querySelectorAll(`[role="option"]`)??[]],n=t.indexOf(document.activeElement);t[Math.max(0,Math.min(t.length-1,n+e))]?.focus()},c=async()=>{N(r,!0),await Promise.resolve(),requestAnimationFrame(()=>{(z(i)?.querySelector(`[aria-selected="true"]`)??z(i)?.querySelector(`[role="option"]`))?.focus()})},l=(e=!0)=>{N(r,!1),e&&z(i)?.querySelector(`.now`)?.focus()};var u=fE();B(`pointerdown`,gn,e=>{z(r)&&!z(i)?.contains(e.target)&&l(!1)});var d=P(u),f=P(d),p=e=>{var t=cE(),n=F(t);sE(n,{get kind(){return z(o).value},label:``});var r=I(L(n,2),!0);R(()=>W(r,z(o).label)),U(e,t)},m=e=>{U(e,lE())};G(f,e=>{z(o)?e(p):e(m,-1)});var h=L(f,2);X(P(h),{get of(){return Rw},size:10}),O(h),O(d);var g=L(d,2),_=e=>{var n=dE();K(n,21,()=>z(a),e=>e.value,(e,n)=>{var r=uE(),i=P(r);sE(i,{get kind(){return z(n).value},label:``});var a=I(L(i,2),!0);O(r),R(()=>{q(r,`aria-selected`,z(n).value===t.value),W(a,z(n).label)}),V(`click`,r,()=>{t.onpick(z(n).value),l()}),U(e,r)}),O(n),U(e,n)};G(g,e=>{z(r)&&e(_)}),O(u),Ma(u,e=>N(i,e),()=>z(i)),R(()=>{q(d,`id`,t.id),d.disabled=n(),q(d,`aria-expanded`,z(r))}),V(`keydown`,u,e=>{z(r)&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),l()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(e.key===`ArrowDown`?1:-1)))}),V(`click`,d,()=>{z(r)?l():c()}),U(e,u),A()}Zr([`keydown`,`click`]);var mE=H(`<option class="svelte-1uxsjsg"> </option>`),hE=H(`<datalist class="svelte-1uxsjsg"></datalist>`),gE=H(`<input class="svelte-1uxsjsg"/> <!>`,1),_E=H(`<input class="svelte-1uxsjsg"/>`),vE=H(`<option class="svelte-1uxsjsg">Other…</option>`),yE=H(`<select class="svelte-1uxsjsg"><!><!><!></select>`);function bE(e,t){let n=li();k(t,!0);let r=Y(t,`other`,3,!1),i=Y(t,`required`,3,!1),a=Y(t,`disabled`,3,!1),o=Y(t,`placeholder`,3,``),s=`\0other`,c=M(!1),l=j(()=>t.value&&!t.options.some(e=>e.value===t.value)?[...t.options,{value:t.value,label:t.value}]:t.options);var u=ci(),d=F(u),f=e=>{var r=gE(),i=F(r);ma(i);var s=L(i,2),l=e=>{var r=hE();K(r,21,()=>t.options,e=>e.value,(e,t)=>{var n=mE(),r=I(n,!0),i={};R(()=>{W(r,z(t).label===z(t).value?``:z(t).label),i!==(i=z(t).value)&&(n.value=(n.__value=i)??``)}),U(e,n)}),O(r),R(()=>q(r,`id`,n)),U(e,r)};G(s,e=>{t.options.length&&e(l)}),R(()=>{q(i,`id`,t.id),i.disabled=a(),q(i,`aria-label`,t.label),q(i,`list`,t.options.length?n:void 0),q(i,`placeholder`,o()||(t.options.length?`Type to find one`:``)),ha(i,t.value)}),V(`change`,i,e=>{let n=e.currentTarget.value.trim();!n&&t.options.length<=30&&N(c,!1),t.onpick(n||void 0)}),U(e,r)},p=e=>{var n=_E();ma(n),R(()=>{q(n,`id`,t.id),n.disabled=a(),q(n,`aria-label`,t.label),q(n,`placeholder`,o()),ha(n,t.value)}),V(`change`,n,e=>{t.onpick(e.currentTarget.value.trim()||void 0)}),U(e,n)},m=e=>{var n=yE(),o=P(n),u=e=>{var t=mE(),n=I(t,!0);t.value=t.__value=``,R(()=>W(n,i()?`Choose…`:`Not set`)),U(e,t)};G(o,e=>{(!i()||!t.value)&&e(u)});var d=L(o);K(d,17,()=>z(l),e=>e.value,(e,t)=>{var n=mE(),r=I(n,!0),i={};R(()=>{W(r,z(t).label),i!==(i=z(t).value)&&(n.value=(n.__value=i)??``)}),U(e,n)});var f=L(d),p=e=>{var t=vE();t.value=t.__value=s,U(e,t)};G(f,e=>{r()&&e(p)}),O(n);var m;ta(n),R(()=>{q(n,`id`,t.id),n.disabled=a(),q(n,`aria-label`,t.label),m!==(m=t.value)&&(n.value=(n.__value=m)??``,ea(n,m))}),V(`change`,n,e=>{let n=e.currentTarget.value;n===s?N(c,!0):t.onpick(n||void 0)}),U(e,n)};G(d,e=>{t.options.length>30||z(c)&&r()?e(f):!t.options.length&&r()?e(p,1):e(m,-1)}),U(e,u),A()}Zr([`change`]);var xE=new Set([`$$slots`,`$$events`,`$$legacy`]);function SE(e,t){let n=J(t,xE),r={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`}],[`path`,{d:`M4 7h16`}],[`path`,{d:`m16 21 4-4-4-4`}],[`path`,{d:`M20 17H4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var CE=new Set([`$$slots`,`$$events`,`$$legacy`]);function wE(e,t){let n=J(t,CE),r={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var TE=new Set([`$$slots`,`$$events`,`$$legacy`]);function EE(e,t){let n=J(t,TE),r={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`}],[`path`,{d:`M20.054 15.987H3.946`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var DE=new Set([`$$slots`,`$$events`,`$$legacy`]);function OE(e,t){let n=J(t,DE),r={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`}],[`path`,{d:`M15 12H3`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var kE=new Set([`$$slots`,`$$events`,`$$legacy`]);function AE(e,t){let n=J(t,kE),r={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`}],[`path`,{d:`M12 22V12`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`}],[`path`,{d:`m7.5 4.27 9 5.15`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var jE=new Set([`$$slots`,`$$events`,`$$legacy`]);function ME(e,t){let n=J(t,jE),r={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}],[`path`,{d:`m9 12 2 2 4-4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var NE=e=>[e.type??[]].flat();function PE(e,t){if(e.enum)return`choice`;if(e.anyOf)return(t===void 0||typeof t==`string`)&&e.anyOf.some(e=>NE(e).includes(`string`))?`text`:`json`;let n=NE(e);return n.includes(`string`)?`text`:n.includes(`integer`)||n.includes(`number`)?`number`:n.includes(`boolean`)?`switch`:n.includes(`array`)?e.items?`list`:`json`:n.includes(`object`)?e.properties?`group`:typeof e.additionalProperties==`object`?`table`:`json`:`json`}function FE(e){if(typeof e!=`object`)return{};let t=NE(e);return t.includes(`array`)?[]:t.includes(`string`)||e.anyOf?``:t.includes(`object`)||!t.length?{}:``}var IE=e=>!!e?.required?.length,LE=/^[A-Za-z0-9_][\w-]*$/,RE=(e,t)=>typeof t==`number`?`${e}[${String(t)}]`:LE.test(t)?e?`${e}.${t}`:t:`${e}["${t}"]`,zE={prereqs:`Needs first`,once:`Runs to completion`,after:`Starts after`,commands:`Commands on its card`,mock:`Mock responses`,browserConsole:`Browser console on its card`,exitCode:`Exit code`,consumes:`Calls`,publishes:`Sends to queues`,reads:`Reads from queues`,envs:`Per environment`,localChanges:`Code changes for local runs`,signIns:`Sign-ins`,envAliases:`Other names for environments`,how:`Finds it by`,env:`Setting`,sso:`AWS profile`,signIn:`Sign-in`,hosts:`Host name`,tunnel:`Host`,connectsAs:`Dials it as`,cmd:`Command`,what:`What it is`,found:`Seen in`,deployed:`Deployed address`,fetch:`How to get it`,cli:`Command`,ui:`By hand`,devCerts:`HTTPS certificate`,nuget:`Private package feed`,defineFile:`Dart define file`};function BE(e,t){if(typeof e==`string`&&e)return e;if(typeof e!=`object`||!e)return t;let n=e;if(typeof n.path==`string`&&n.path)return`${typeof n.method==`string`?n.method:`Any`} ${n.path}`;let r=[`what`,`name`,`tunnel`,`sso`,`signIn`,`hosts`,`env`,`file`].map(e=>n[e]).find(e=>typeof e==`string`&&e);return typeof r==`string`?r:t}var VE={envs:`Environments`,protected:`Protected`,presets:`Team boards`,checks:`Checks on this Mac`};function HE(e,t=!1){if(t&&Object.hasOwn(VE,e))return VE[e]??e;if(Object.hasOwn(zE,e))return zE[e]??e;let n=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase().replace(/\b(url|sso|id|ios|aws|cors|sam)\b/g,e=>e===`ios`?`iOS`:e.toUpperCase());return n.charAt(0).toUpperCase()+n.slice(1)}var UE=(e,t)=>e.some(e=>t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)),WE=[`name`,`kind`,`slug`],GE={dotnet:[`project`,`launchSettings`,`baseProfile`],node:[`script`],web:[`script`],flutter:[`flutter`,`mobile`],lambda:[`lambda`,`sam`]},KE=[...new Set(Object.values(GE).flat())],qE=[{name:`Runs here`,keys:[`start`,`url`,`ready`,`once`,`after`,`commands`,`mock`,`project`,`launchSettings`,`baseProfile`,`script`,`flutter`,`mobile`,`lambda`,`sam`,`localChanges`]},{name:`Deployed`,keys:[`deployedUrl`,`cors`,`outside`]},{name:`Calls`,keys:[`consumes`,`publishes`,`reads`]},{name:`Needs first`,keys:[`prereqs`]},{name:`Secrets`,keys:[`secrets`]},{name:`Environments`,keys:[`envs`],view:`envs`}],JE=[{name:`Deployed`,keys:[`outside`,`deployedUrl`]},{name:`Calls`,keys:[`consumes`]},{name:`Environments`,keys:[`envs`],view:`envs`}],YE=[`name`],XE=[{name:`Environments`,keys:[`envs`,`protected`,`envAliases`]},{name:`Apps`,keys:[`apps`],view:`apps`},{name:`Queues`,keys:[`queues`]},{name:`Sign-ins`,keys:[`signIns`]},{name:`Checks`,keys:[`checks`]},{name:`Kinds`,keys:[`kinds`]},{name:`Team boards`,keys:[`presets`]}],ZE=[`deployedUrl`,`start`,`prereqs`,`secrets`];function QE(e){let t=new Map;for(let n of e){let e=n.indexOf(`: `);e>0&&t.set(n.slice(0,e),n.slice(e+2))}return t}var $E=(e,t)=>!t||e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`);function eD(e){return e===void 0?`not set`:typeof e==`string`?e:Array.isArray(e)?e.length?e.map((e,t)=>BE(e,`#${String(t+1)}`)).join(`, `):`none`:typeof e==`object`&&e?Object.keys(e).join(`, `)||`empty`:JSON.stringify(e)}function tD(e,t){let n=e=>typeof e==`object`&&!!e;if(!n(e)||!n(t)||Array.isArray(e)!==Array.isArray(t))return JSON.stringify(e)===JSON.stringify(t)?0:1;let r=e,i=t;return[...new Set([...Object.keys(r),...Object.keys(i)])].reduce((e,t)=>e+tD(r[t],i[t]),0)}var nD=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},rD=e=>typeof e==`string`||typeof e==`number`?String(e):``,iD={tunnel:SE,cloud:wE,laptop:EE,signIn:OE,shield:ME,box:AE,key:mS,other:mC},aD=[{id:`tunnel`,label:`Tunnel`,about:`A database or service reached through a tunnel`,icon:iD.tunnel,fields:[`tunnel`,`port`,`env`,`what`,`connectsAs`,`cmd`,`note`],start:{},say:e=>{let t=[rD(e.tunnel),rD(e.port)].filter(Boolean).join(`:`),n=rD(e.what),r=rD(e.env);return`${n&&t?`${n}, `:n}${t}${r?` as ${r}`:``}`}},{id:`sso`,label:`AWS sign-in`,about:`An AWS profile to be signed in with`,icon:iD.cloud,fields:[`sso`,`account`,`note`],start:{},say:e=>`${rD(e.sso)}${e.account?`, account ${rD(e.account)}`:``}`},{id:`hosts`,label:`Hosts entry`,about:`A name that has to lead to this Mac`,icon:iD.laptop,fields:[`hosts`,`note`],start:{},say:e=>e.hosts?`${rD(e.hosts)} leads to this Mac`:``},{id:`signIn`,label:`Stack sign-in`,about:`A sign-in this stack defines`,icon:iD.signIn,fields:[`signIn`,`note`],start:{},say:(e,t)=>{let n=rD(e.signIn),r=rD(nD(nD(t.signIns)[n]).what);return r&&r!==n?`${n}, ${r}`:n}},{id:`devCerts`,label:`HTTPS certificate`,about:`It serves https here, so its certificate must be trusted`,icon:iD.shield,fields:[`note`],own:[`devCerts`],start:{devCerts:!0},say:e=>rD(e.note)||`The local certificate must be trusted`},{id:`nuget`,label:`Private package feed`,about:`It downloads company packages while it builds`,icon:iD.box,fields:[`note`],own:[`nuget`],start:{nuget:!0},say:e=>rD(e.note)||`Packages come from a private feed`}],oD=(e,t)=>aD.find(n=>t?n.id===t:e[n.id]!==void 0&&e[n.id]!==!1),sD=[{value:`env`,label:`A setting`},{value:`env-file`,label:`A line in a settings file`},{value:`edit`,label:`An edit to its code`},{value:`secret`,label:`A key in its Lambda secret`},{value:`unknown`,label:`Not known yet`}],cD={env:[`how`,`env`,`path`,`value`,`deployed`,`note`],"env-file":[`how`,`file`,`key`,`path`,`value`,`deployed`,`note`],edit:[`how`,`file`,`key`,`value`,`deployed`,`note`],secret:[`how`,`key`,`path`,`deployed`,`note`],unknown:[`how`,`found`,`deployed`,`note`]},lD=e=>{let t=[e.env??[]].flat().map(rD).filter(Boolean).join(`, `),n=rD(e.file);return e.how===`env`?t?`found by the setting ${t}`:`found by a setting, not named yet`:e.how===`env-file`?`found by ${rD(e.key)||`a line`} in ${n||`a settings file`}`:e.how===`edit`?`found by an edit to ${n||`its code`}`:e.how===`secret`?`found by ${rD(e.key)||`a key`} in its secret`:`how it finds it is not known yet`},uD=/(?:^|\.)(prereqs|secrets|localChanges)\[\d+\]$|(?:^|\.)(consumes)(?:\.[\w-]+|\["[^"]+"\])$|(?:^|\.)(ready)$/,dD=/(?:^|\.)(prereqs|secrets|localChanges|consumes)$/;function fD(e,t,n,r){let i=uD.exec(e),a=i?.[1]??i?.[2]??i?.[3];if(!a)return;let o=nD(t),s=nD(n);if(a===`prereqs`){let e=oD(o,r);if(!e)return{label:`Something else`,say:eD(t),icon:iD.other,fields:Object.keys(o)};let{label:n,icon:i,fields:a,own:c}=e;return{label:n,icon:i,fields:a,say:e.say(o,s),...c&&{own:c}}}if(a===`secrets`){let e=rD(o.type),t=rD(o.when);return{label:rD(o.env)||rD(o.file)||`Secret`,say:[e&&HE(e),t&&`needed ${t}`].filter(Boolean).join(`, `),icon:iD.key,fields:[`env`,`type`,`file`,`when`,`fetch`,`note`]}}if(a===`localChanges`)return{label:rD(o.file)||`Change`,say:``,fields:[`file`,`find`,`replace`],inline:{file:`In`,find:`find`,replace:`and put`}};if(a===`ready`)return{label:`Ready`,say:``,fields:[`path`,`status`,`timeout`],inline:{path:`when GET`,status:`answers`,timeout:`within`}};let c=/(?:\.([\w-]+)|\["([^"]+)"\])$/.exec(e)?.slice(1).find(Boolean)??``,l=nD(nD(s.apps)[c]),u=rD(o.how);return{label:rD(l.name)||c,say:lD(o),kind:rD(l.kind)||`other`,fields:(Object.hasOwn(cD,u)?cD[u]:void 0)??cD.unknown??[]}}var pD={path:`/health`,status:`200`,timeout:`30 s`,file:`src/config.ts`,find:`the text as it is`,replace:`the text for local runs`};function mD(e){if(typeof e!=`string`||!e)return{};if(!/^[a-z][a-z0-9+.-]*:\/\//i.test(e))return{warn:`Start it with http:// or https://`};try{let t=new URL(e);return[`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname)&&t.port?{note:`Answers on port ${t.port} of this Mac`}:{}}catch{return{warn:`Not an address a browser could open`}}}function hD(e,t,n,r){if(e===`envs`)return`ordered`;if(e===`protected`)return`envs`;if(/(?:^|\.)(publishes|reads)$/.test(e))return`queues`;if(/^apps\.[a-z0-9-]+\.after$/.test(e))return`apps`;if(r)return/(?:^|\.)kind$/.test(e)?`kind`:`pick`;if(/(?:^|\.)(url|deployedUrl|deployed)$/.test(e))return`address`;let i=e=>NE(e).includes(`array`)&&NE(e.items??{}).includes(`string`);if(i(t)||Array.isArray(n)&&t.anyOf?.some(i))return`chips`}var gD={prereqs:`Nothing has to be in place before it runs.`,secrets:`It needs no secrets.`,localChanges:`No code is changed for a local run.`,consumes:`No calls are recorded yet, which is not the same as calling nothing.`},_D=H(`<button class="words svelte-gtai80" type="button"> </button>`),vD=H(`<button class="icon svelte-gtai80" type="button" title="Remove"><!></button>`),yD=H(`<span><!> <button type="button"><!></button></span>`),bD=H(`<!> <!>`,1),xD=H(`<span class="none svelte-gtai80"> </span>`),SD=H(`<option class="svelte-gtai80"> </option>`),CD=H(`<select class="svelte-gtai80"><option class="svelte-gtai80"> </option><!></select>`),wD=H(`<input placeholder="New key" class="svelte-gtai80"/>`),TD=H(`<!> <!> <span class="add svelte-gtai80"><!> <button type="button" class="svelte-gtai80">Add</button></span>`,1),ED=H(`<div class="draft svelte-gtai80" role="group"><!> <span class="add svelte-gtai80"><button type="button" class="go svelte-gtai80">Keep</button> <button type="button" class="svelte-gtai80">Cancel</button></span></div>`),DD=H(`<button type="button" class="svelte-gtai80"><span class="glyph svelte-gtai80"><!></span> <span class="what svelte-gtai80"> </span> <span class="about svelte-gtai80"> </span></button>`),OD=H(`<div class="types svelte-gtai80" role="group" aria-label="What does it need?"><!> <span class="add svelte-gtai80"><button type="button" class="svelte-gtai80">Cancel</button></span></div>`),kD=H(`<span class="add svelte-gtai80"><button type="button" class="svelte-gtai80"> </button></span>`),AD=H(`<!> <!> <!>`,1),jD=H(`<span class="error svelte-gtai80" role="alert"> </span>`),MD=H(`<span class="name svelte-gtai80"> </span>`),ND=H(`<span class="part svelte-gtai80"><span class="word svelte-gtai80"> </span> <!></span>`),PD=H(`<div><!> <fieldset class="parts svelte-gtai80"><legend class="sr svelte-gtai80"> </legend> <!></fieldset> <!> <!></div>`),FD=H(`<span class="about svelte-gtai80"> </span>`),ID=H(`<fieldset class="top svelte-gtai80"><legend class="sr svelte-gtai80"> </legend> <span class="row svelte-gtai80"><span class="name svelte-gtai80">Everything</span><!></span> <!> <!></fieldset>`),LD=H(`<span class="glyph svelte-gtai80"><!></span>`),RD=H(`<span class="name svelte-gtai80"><span class="what svelte-gtai80"> </span><span class="say svelte-gtai80"> </span></span>`),zD=H(`<span class="unset svelte-gtai80">Not set</span>`),BD=H(`<span class="name svelte-gtai80"> </span> <!>`,1),VD=H(`<details><summary class="svelte-gtai80"><span class="chev svelte-gtai80"><!></span> <!> <!> <!></summary> <fieldset class="svelte-gtai80"><legend class="sr svelte-gtai80"> </legend> <!> <!></fieldset></details>`),HD=H(`<input type="checkbox" role="switch" class="svelte-gtai80"/>`),UD=H(`<select class="svelte-gtai80"><option class="svelte-gtai80">Not set</option><!></select>`),WD=H(`<input inputmode="numeric" class="svelte-gtai80"/>`),GD=H(`<input class="svelte-gtai80"/>`),KD=H(`<textarea rows="3" class="svelte-gtai80"></textarea>`),qD=H(`<textarea class="mono svelte-gtai80"></textarea>`),JD=H(`<span class="note warn svelte-gtai80"> </span>`),YD=H(`<span class="note svelte-gtai80"> </span>`),XD=H(`<div><label> </label> <!> <!> <!> <!></div>`);function ZD(e,t){let n=li();k(t,!0);let r=e=>{var n=yD();let r;var i=P(n),o=e=>{var n=_D(),r=I(n,!0);R(()=>W(r,t.drop)),V(`click`,n,()=>void h(void 0)),U(e,n)},s=e=>{var t=vD();X(P(t),{get of(){return to},size:11}),O(t),R(()=>q(t,`aria-label`,`Remove ${z(C)??``}`)),V(`click`,t,()=>void h(void 0)),U(e,t)};G(i,e=>{t.drop&&!z(f)?e(o):t.value!==void 0&&!a()&&!z(f)&&e(s,1)});var c=L(i,2);let l;var u=P(c);{let e=j(()=>z(f)?gS:wT);X(u,{get of(){return z(e)},size:12})}O(c),O(n),R(()=>{r=Ji(n,1,`acts svelte-gtai80`,null,r,{fresh:t.ctx.fresh}),l=Ji(c,1,`icon lock svelte-gtai80`,null,l,{on:z(f)}),q(c,`aria-pressed`,z(f)),q(c,`aria-label`,`${z(f)?`Unlock`:`Lock`} ${z(C)??``}`),q(c,`title`,z(f)?`Locked: nothing changes it. Click to unlock`:`Lock: keep it as it is, for you and the agent`)}),V(`click`,c,()=>{t.ctx.lock(t.path,!z(f))}),U(e,n)},i=e=>{var n=bD(),r=F(n),i=e=>{var n=bD(),r=F(n);K(r,16,()=>z(x),e=>e,(e,n)=>{{let r=j(()=>RE(t.path,n)),i=j(()=>HE(n,t.path===``)),a=j(()=>t.schema.properties?.[n]??{}),s=j(()=>!!t.schema.required?.includes(n)),c=j(()=>o()+1);ZD(e,{get path(){return z(r)},get name(){return z(i)},get schema(){return z(a)},get value(){return z(g)[n]},get ctx(){return t.ctx},get required(){return z(s)},get depth(){return z(c)}})}}),K(L(r,2),16,()=>z(b),e=>e,(e,n)=>{{let r=j(()=>RE(t.path,n)),i=j(()=>HE(n)),a=j(()=>t.schema.properties?.[n]??{}),s=j(()=>o()+1);ZD(e,{get path(){return z(r)},get name(){return z(i)},get schema(){return z(a)},get value(){return z(g)[n]},get ctx(){return t.ctx},get depth(){return z(s)}})}}),U(e,n)},a=e=>{var n=TD(),r=F(n);K(r,16,()=>Object.keys(z(g)),e=>e,(e,n)=>{{let r=j(()=>RE(t.path,n)),i=j(()=>o()+1);ZD(e,{get path(){return z(r)},get name(){return n},get schema(){return t.schema.additionalProperties},get value(){return z(g)[n]},get ctx(){return t.ctx},get depth(){return z(i)}})}});var i=L(r,2),a=e=>{var t=xD(),n=I(t,!0);R(()=>W(n,gD[z(E)])),U(e,t)},s=j(()=>z(E)&&!Object.keys(z(g)).length);G(i,e=>{z(s)&&e(a)});var c=L(i,2),l=P(c),u=e=>{var n=CD(),r=P(n),i=I(r,!0);r.value=r.__value=``,K(L(r),16,()=>z(ee),e=>e,(e,n)=>{var r=SD(),i=I(r,!0),a={};R(e=>{W(i,e),a!==(a=n)&&(r.value=(r.__value=a)??``)},[()=>fD(RE(t.path,n),{},t.ctx.stack())?.label??n]),U(e,r)}),O(n),ta(n),R(()=>{q(n,`aria-label`,`Add to ${t.name??``}`),W(i,z(E)&&me[z(E)]||`Add…`)}),na(n,()=>z(oe),e=>N(oe,e)),U(e,n)},d=j(()=>t.ctx.keys(t.path)),f=e=>{var n=wD();ma(n),R(()=>q(n,`aria-label`,`New key in ${t.name??``}`)),Sa(n,()=>z(oe),e=>N(oe,e)),U(e,n)};G(l,e=>{z(d)?e(u):e(f,-1)});var p=L(l,2);O(c),R(e=>p.disabled=e,[()=>!z(oe).trim()]),V(`click`,p,()=>void pe()),U(e,n)},s=e=>{var n=AD(),r=F(n);wi(r,()=>z(_).length,e=>{var n=ci();K(F(n),17,()=>z(_),Ei,(e,n,r)=>{{let i=j(()=>RE(t.path,r)),a=j(()=>BE(z(n),`${t.name} ${String(r+1)}`)),s=j(()=>t.schema.items??{}),c=j(()=>o()+1);ZD(e,{get path(){return z(i)},get name(){return z(a)},get schema(){return z(s)},get value(){return z(n)},get ctx(){return t.ctx},get depth(){return z(c)}})}}),U(e,n)});var i=L(r,2),a=e=>{var t=xD(),n=I(t,!0);R(()=>W(n,gD[z(E)])),U(e,t)};G(i,e=>{z(E)&&!z(_).length&&!z(se)&&!z(le)&&e(a)});var s=L(i,2),c=e=>{var n=ED(),r=P(n);{let e=j(()=>RE(t.path,z(_).length)),n=j(()=>t.schema.items??{}),i=j(()=>o()+1);ZD(r,{get path(){return z(e)},name:`New`,get schema(){return z(n)},get value(){return z(se)},get ctx(){return z(de)},get as(){return z(ce)},required:!0,open:!0,get depth(){return z(i)}})}var i=L(r,2),a=P(i),s=L(a,2);O(i),O(n),R(()=>q(n,`aria-label`,`New in ${t.name??``}`)),V(`click`,a,async()=>{N(p,await t.ctx.save(RE(t.path,z(_).length),z(se))??``,!0),z(p)||N(se,null)}),V(`click`,s,()=>N(se,null)),U(e,n)},l=e=>{var t=OD(),n=P(t);K(n,17,()=>aD,e=>e.id,(e,t)=>{let n=j(()=>z(t).id===`signIn`&&!z(ae));var r=DD(),i=P(r);X(P(i),{get of(){return z(t).icon},size:15}),O(i);var a=L(i,2),o=I(a,!0),s=I(L(a,2),!0);O(r),R(()=>{r.disabled=z(n),W(o,z(t).label),W(s,z(n)?`This stack defines none yet`:z(t).about)}),V(`click`,r,()=>fe(z(t))),U(e,r)});var r=I(L(n,2));O(t),V(`click`,r,()=>N(le,!1)),U(e,t)},u=e=>{var t=kD(),n=P(t),r=I(n,!0);O(t),R(()=>W(r,z(E)&&me[z(E)]||`Add`)),V(`click`,n,()=>void pe()),U(e,t)};G(s,e=>{z(se)?e(c):z(le)?e(l,1):e(u,-1)}),U(e,n)};G(r,e=>{z(c)===`group`?e(i):z(c)===`table`?e(a,1):e(s,-1)});var l=L(r,2),u=e=>{var t=jD(),n=I(t,!0);R(()=>W(n,z(m))),U(e,t)};G(l,e=>{z(m)&&e(u)}),U(e,n)},a=Y(t,`required`,3,!1),o=Y(t,`depth`,3,0),s=Y(t,`bare`,3,!1),c=j(()=>PE(t.schema,t.value)),l=j(()=>z(c)===`group`||z(c)===`table`||z(c)===`list`),u=j(()=>z(l)?null:t.ctx.options(t.path)),d=j(()=>hD(t.path,t.schema,t.value,z(u))),f=j(()=>t.ctx.locked(t.path)),p=M(``),m=j(()=>z(p)||t.ctx.problem?.(t.path)||``),h=async e=>{N(p,await t.ctx.save(t.path,e)??``,!0)},g=j(()=>typeof t.value==`object`&&t.value!==null&&!Array.isArray(t.value)?t.value:{}),_=j(()=>Array.isArray(t.value)?t.value:[]),v=j(()=>fD(t.path,t.value,t.ctx.stack(),t.as)),y=j(()=>z(v)?[...z(v).fields,...z(v).own??[]]:Object.keys(t.schema.properties??{})),b=j(()=>Object.keys(z(g)).filter(e=>!z(y).includes(e))),x=j(()=>z(v)?z(v).fields:Object.keys(t.schema.properties??{})),S=j(()=>z(v)?.inline&&!z(b).length?z(v).inline:void 0),C=j(()=>z(v)?[z(v).label,z(v).say].filter(Boolean).join(`: `):t.name),w=e=>e===void 0?``:JSON.stringify(e,null,2),ee=j(()=>(t.ctx.keys(t.path)??[]).filter(e=>!Object.hasOwn(z(g),e))),T=j(()=>t.schema.description??``),te=j(()=>z(d)===`address`?mD(t.value):{}),E=j(()=>dD.exec(t.path)?.[1]),ne=e=>typeof e==`string`?e:``,re=j(()=>z(_).filter(e=>typeof e==`string`)),ie=j(()=>t.ctx.stack()),ae=j(()=>Object.keys(t.ctx.stack()?.signIns??{}).length),oe=M(``),se=M(null),ce=M(void 0),le=M(!1),ue=M(pn(Nr(()=>t.open??(!z(v)&&t.value!==void 0&&o()<2)))),de=j(()=>({...t.ctx,save:(e,n)=>{let r=yT(e.slice(RE(t.path,z(_).length).length).replace(/^\./,``));return`error`in r||N(se,ST(z(se),r,n),!0),Promise.resolve(null)},locked:()=>!1,fresh:!0})),fe=e=>{N(le,!1),N(ce,e?.id,!0),N(se,{...e?.start},!0)},pe=async()=>{if(z(c)===`list`){z(E)===`prereqs`?N(le,!0):z(E)||IE(t.schema.items)?fe():N(p,await t.ctx.save(RE(t.path,z(_).length),FE(t.schema.items))??``,!0);return}let e=z(oe).trim();e&&(N(p,await t.ctx.save(RE(t.path,e),FE(t.schema.additionalProperties))??``,!0),z(p)||N(oe,``))},me={prereqs:`Add a need`,secrets:`Add a secret`,localChanges:`Add a change`,consumes:`Add an app it calls…`};var he=ci(),ge=F(he),_e=e=>{var n=PD();let i;var a=P(n),c=e=>{var n=MD(),r=I(n,!0);R(()=>{q(n,`title`,z(T)),W(r,t.name)}),U(e,n)};G(a,e=>{o()<=1&&e(c)});var l=L(a,2),u=P(l),d=I(u,!0);K(L(u,2),16,()=>z(x),e=>e,(e,n)=>{var r=ND(),i=P(r),a=I(i,!0),s=L(i,2);{let e=j(()=>RE(t.path,n)),r=j(()=>HE(n)),i=j(()=>t.schema.properties?.[n]??{}),a=j(()=>o()+1);ZD(s,{get path(){return z(e)},get name(){return z(r)},get schema(){return z(i)},get value(){return z(g)[n]},get ctx(){return t.ctx},bare:!0,get depth(){return z(a)}})}O(r),R(()=>{q(r,`data-key`,n),W(a,z(S)[n])}),U(e,r)}),O(l);var p=L(l,2);r(p);var h=L(p,2),_=e=>{var t=jD(),n=I(t,!0);R(()=>W(n,z(m))),U(e,t)};G(h,e=>{z(m)&&e(_)}),O(n),R(()=>{i=Ji(n,1,`field line svelte-gtai80`,null,i,{locked:z(f),wide:o()>1||s()}),l.disabled=z(f),W(d,z(C))}),U(e,n)},ve=e=>{var n=ID(),a=P(n),o=I(a,!0),s=L(a,2),c=L(P(s));r(c),O(s);var l=L(s,2),u=e=>{var t=FD(),n=I(t,!0);R(()=>W(n,z(T))),U(e,t)};G(l,e=>{z(T)&&e(u)});var d=L(l,2);i(d),O(n),R(()=>{n.disabled=z(f),W(o,t.name)}),U(e,n)},ye=e=>{var n=VD();let a;var o=P(n),s=P(o);X(P(s),{get of(){return pT},size:10}),O(s);var c=L(s,2),l=e=>{sE(e,{get kind(){return z(v).kind},label:``})},u=e=>{var t=LD();X(P(t),{get of(){return z(v).icon},size:15}),O(t),U(e,t)};G(c,e=>{z(v)?.kind?e(l):z(v)?.icon&&e(u,1)});var d=L(c,2),p=e=>{var t=RD(),n=P(t),r=I(n,!0),i=I(L(n),!0);O(t),R(()=>{W(r,z(v).label),W(i,z(v).say)}),U(e,t)},m=e=>{var n=BD(),r=F(n),i=I(r,!0),a=L(r,2),o=e=>{U(e,zD())};G(a,e=>{t.value===void 0&&e(o)}),R(()=>W(i,t.name)),U(e,n)};G(d,e=>{z(v)?e(p):e(m,-1)});var h=L(d,2);r(h),O(o);var g=L(o,2),_=P(g),y=I(_,!0),b=L(_,2),x=e=>{var t=FD(),n=I(t,!0);R(()=>W(n,z(T))),U(e,t)};G(b,e=>{z(T)&&!z(v)&&e(x)});var S=L(b,2);i(S),O(g),O(n),R(()=>{a=Ji(n,1,`nest svelte-gtai80`,null,a,{rowed:!!z(v)}),q(o,`title`,z(T)),g.disabled=z(f),W(y,z(C))}),Na(`open`,`toggle`,n,e=>N(ue,e),()=>z(ue)),U(e,n)},be=e=>{var i=XD();let o;var l=P(i);let p;var _=I(l,!0),v=L(l,2),y=e=>{{let r=j(()=>ne(t.value));pE(e,{get id(){return n},get value(){return z(r)},get options(){return z(u).options},get disabled(){return z(f)},onpick:e=>void h(e)})}},b=e=>{{let r=j(()=>ne(t.value)),i=j(()=>!!z(u).other),o=j(()=>s()?pD[t.path.split(`.`).at(-1)??``]??t.name:z(T));bE(e,{get id(){return n},get value(){return z(r)},get options(){return z(u).options},get other(){return z(i)},get required(){return a()},get disabled(){return z(f)},get placeholder(){return z(o)},onpick:e=>void h(e)})}},x=e=>{{let n=j(()=>z(d)===`ordered`),r=j(()=>z(d)===`ordered`?`runs by default`:``);LT(e,{get value(){return z(re)},get label(){return t.name},get ordered(){return z(n)},get first(){return z(r)},get disabled(){return z(f)},onchange:e=>void h(e.length||a()||z(d)===`ordered`?e:void 0)})}},S=e=>{let n=j(()=>z(ie)?.envs??[]);{let r=j(()=>z(n).map(e=>({value:e,label:e.toUpperCase()}))),i=j(()=>t.value===void 0?z(n).slice(1):z(re));OT(e,{get options(){return z(r)},get picked(){return z(i)},get label(){return t.name},get disabled(){return z(f)},none:`The stack has no environments yet.`,ontoggle:(e,r)=>{let i=t.value===void 0?z(n).slice(1):z(re);h(z(n).filter(t=>t===e?r:i.includes(t)))}})}},C=e=>{let n=j(()=>t.path.split(`.`)[1]);{let r=j(()=>Object.entries(z(ie)?.apps??{}).filter(([e,t])=>e!==z(n)&&!t.outside).map(([e,t])=>({value:e,label:t.name??e})));OT(e,{get options(){return z(r)},get picked(){return z(re)},get label(){return t.name},get disabled(){return z(f)},none:`The stack has no other apps.`,ontoggle:(e,t)=>{let n=t?[...z(re),e]:z(re).filter(t=>t!==e);h(n.length?n:void 0)}})}},ee=e=>{{let n=j(()=>Object.entries(z(ie)?.queues??{}).map(([e,t])=>({value:e,label:t.name??e}))),r=j(()=>Object.keys(z(g)));OT(e,{get options(){return z(n)},get picked(){return z(r)},get label(){return t.name},get disabled(){return z(f)},none:`The stack has no queues yet: add them in the stack's settings.`,ontoggle:(e,t)=>{let{[e]:n,...r}=z(g);h(t?{...z(g),[e]:n??{}}:Object.keys(r).length?r:void 0)}})}},E=e=>{var r=HD();ma(r),R(()=>{q(r,`id`,n),r.disabled=z(f),ga(r,t.value===!0)}),V(`change`,r,e=>void h(e.currentTarget.checked)),U(e,r)},ae=e=>{var r=UD(),i=P(r);i.value=i.__value=``,K(L(i),16,()=>t.schema.enum??[],e=>e,(e,t)=>{var n=SD(),r=I(n,!0),i={};R(e=>{W(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>String(t)]),U(e,n)}),O(r);var a;ta(r),R(()=>{q(r,`id`,n),r.disabled=z(f),a!==(a=t.value??``)&&(r.value=(r.__value=a)??``,ea(r,a))}),V(`change`,r,e=>void h(e.currentTarget.value||void 0)),U(e,r)},oe=e=>{var r=WD();ma(r),R(e=>{q(r,`id`,n),r.disabled=z(f),q(r,`placeholder`,e),ha(r,typeof t.value==`number`||typeof t.value==`string`?t.value:``)},[()=>s()?pD[t.path.split(`.`).at(-1)??``]??t.name:z(T)]),V(`change`,r,e=>{let t=e.currentTarget.value.trim();h(t===``?void 0:Number.isFinite(Number(t))?Number(t):t)}),U(e,r)},se=e=>{var r=GD();ma(r),R(e=>{q(r,`id`,n),r.disabled=z(f),q(r,`inputmode`,z(d)===`address`?`url`:void 0),q(r,`spellcheck`,z(d)!==`address`&&void 0),q(r,`aria-invalid`,z(te).warn?!0:void 0),q(r,`placeholder`,e),ha(r,typeof t.value==`string`?t.value:``)},[()=>s()?pD[t.path.split(`.`).at(-1)??``]??t.name:z(T)]),V(`change`,r,e=>void h(e.currentTarget.value===``?void 0:e.currentTarget.value)),U(e,r)},ce=j(()=>z(c)===`text`&&!(typeof t.value==`string`&&(t.value.length>60||t.value.includes(`
|
|
34
|
+
`))&&!s())),le=e=>{var r=KD();vt(r),R(()=>{q(r,`id`,n),r.disabled=z(f),q(r,`placeholder`,z(T)),ha(r,typeof t.value==`string`?t.value:``)}),V(`change`,r,e=>void h(e.currentTarget.value===``?void 0:e.currentTarget.value)),U(e,r)},ue=e=>{var r=qD();vt(r),R((e,t)=>{q(r,`id`,n),q(r,`rows`,e),r.disabled=z(f),q(r,`placeholder`,z(T)||`JSON`),ha(r,t)},[()=>Math.min(10,w(t.value).split(`
|
|
35
|
+
`).length+1),()=>w(t.value)]),V(`change`,r,e=>{let t=e.currentTarget.value.trim();if(!t)h(void 0);else try{h(JSON.parse(t))}catch{h(t)}}),U(e,r)};G(v,e=>{z(d)===`kind`&&z(u)?e(y):z(d)===`pick`&&z(u)?e(b,1):z(d)===`ordered`||z(d)===`chips`?e(x,2):z(d)===`envs`?e(S,3):z(d)===`apps`?e(C,4):z(d)===`queues`?e(ee,5):z(c)===`switch`?e(E,6):z(c)===`choice`?e(ae,7):z(c)===`number`?e(oe,8):z(ce)?e(se,9):z(c)===`text`?e(le,10):e(ue,-1)});var de=L(v,2),fe=e=>{r(e)};G(de,e=>{s()||e(fe)});var pe=L(de,2),me=e=>{var t=JD(),n=I(t,!0);R(()=>W(n,z(te).warn)),U(e,t)},he=e=>{var t=YD(),n=I(t,!0);R(()=>W(n,z(te).note)),U(e,t)};G(pe,e=>{z(te).warn?e(me):z(te).note&&e(he,1)});var ge=L(pe,2),_e=e=>{var t=jD(),n=I(t,!0);R(()=>W(n,z(m))),U(e,t)};G(ge,e=>{z(m)&&e(_e)}),O(i),R(()=>{o=Ji(i,1,`field svelte-gtai80`,null,o,{locked:z(f),bare:s()}),p=Ji(l,1,`name svelte-gtai80`,null,p,{sr:s()}),q(l,`for`,n),q(l,`title`,z(T)),W(_,t.name)}),U(e,i)};G(ge,e=>{z(S)?e(_e):z(l)&&!z(d)&&o()===0?e(ve,1):z(l)&&!z(d)?e(ye,2):e(be,-1)}),U(e,he),A()}Zr([`click`,`change`]);var QD=H(`<p class="none svelte-orrnu3"> </p>`),$D=H(`<div class="same svelte-orrnu3"><span class="name svelte-orrnu3"> </span> <span class="from svelte-orrnu3"> </span> <button type="button" class="svelte-orrnu3"> </button></div>`),eO=H(`<option> </option>`),tO=H(`<select class="svelte-orrnu3"><option>Its own value for another field…</option><!></select>`),nO=H(`<section class="env svelte-orrnu3"><h3 class="svelte-orrnu3"> </h3> <!> <!></section>`),rO=H(`<!> <!>`,1);function iO(e,t){k(t,!0);let n=j(()=>v(t.envs)),r=j(()=>_(z(n)[0],`qa`)),i=j(()=>z(n).slice(1)),a=e=>t.app.envs?.[e]??{},o=j(()=>typeof t.schema.properties?.envs?.additionalProperties==`object`?t.schema.properties.envs.additionalProperties:{}),s=e=>z(o).properties?.[e]??t.schema.properties?.[e]??{},c=e=>[...new Set([...ZE,...Object.keys(a(e))])],l=new Set([`name`,`kind`,`slug`,`outside`,`envs`]),u=e=>Object.keys(t.schema.properties??{}).filter(t=>!l.has(t)&&!c(e).includes(t)),d=e=>{let n=t.app[e];return n===void 0?FE(s(e)):JSON.parse(JSON.stringify(n))},f=(e,n)=>RE(RE(RE(t.path,`envs`),e),n);var p=rO(),m=F(p),h=e=>{var t=QD(),n=I(t);R(e=>W(n,`The stack has one environment, ${e??``}: there is nothing to differ from.`),[()=>z(r).toUpperCase()]),U(e,t)};G(m,e=>{z(i).length||e(h)}),K(L(m,2),16,()=>z(i),e=>e,(e,n)=>{let i=j(()=>z(r).toUpperCase()),o=j(()=>n.toUpperCase());var l=nO(),p=P(l),m=I(p),h=L(p,2);K(h,16,()=>c(n),e=>e,(e,r)=>{var c=ci(),l=F(c),u=e=>{{let o=j(()=>f(n,r)),c=j(()=>HE(r)),l=j(()=>s(r)),u=j(()=>a(n)[r]);ZD(e,{get path(){return z(o)},get name(){return z(c)},get schema(){return z(l)},get value(){return z(u)},get ctx(){return t.ctx},depth:1,get drop(){return`Use ${z(i)??``}'s`}})}},p=j(()=>a(n)[r]!==void 0),m=e=>{var a=$D(),s=P(a),c=I(s,!0),l=L(s,2),u=I(l),p=L(l,2),m=I(p);O(a),R((e,t,n)=>{W(c,e),q(l,`title`,t),W(u,`Same as ${z(i)??``}: ${n??``}`),W(m,`Change for ${z(o)??``}`)},[()=>HE(r),()=>eD(t.app[r]),()=>eD(t.app[r])]),V(`click`,p,()=>void t.ctx.save(f(n,r),d(r))),U(e,a)};G(l,e=>{z(p)?e(u):e(m,-1)}),U(e,c)});var g=L(h,2),_=e=>{var r=tO(),i=P(r);i.value=i.__value=``,K(L(i),16,()=>u(n),e=>e,(e,t)=>{var n=eO(),r=I(n,!0),i={};R(e=>{W(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>HE(t)]),U(e,n)}),O(r),r.value=r.__value=``,R(()=>q(r,`aria-label`,`Give ${z(o)??``} its own value for another field`)),V(`change`,r,e=>{let r=e.currentTarget.value;e.currentTarget.value=``,r&&t.ctx.save(f(n,r),d(r))}),U(e,r)},v=j(()=>u(n).length);G(g,e=>{z(v)&&e(_)}),O(l),R(()=>{q(l,`aria-label`,`What ${z(o)??``} uses`),W(m,`${z(o)??``} uses`)}),U(e,l)}),U(e,p),A()}Zr([`click`,`change`]);var aO=H(`<button type="button" class="ask svelte-6g11qq" title="It reads the repo, says what it would set, and asks you first. Locked fields stay as they are."><!> </button>`),oO=H(`<div class="head svelte-6g11qq"></div>`),sO=H(`<span class="badge svelte-6g11qq"> </span>`),cO=H(`<button type="button" role="tab"> <!></button>`),lO=H(`<div class="tabs svelte-6g11qq" role="tablist"></div>`),uO=H(`<li class="svelte-6g11qq"><!> <span class="name svelte-6g11qq"> </span> <span class="kind svelte-6g11qq"> </span> <button type="button" class="svelte-6g11qq">Settings</button></li>`),dO=H(`<ul class="apps svelte-6g11qq"></ul>`),fO=H(`<details class="others svelte-6g11qq"><summary class="svelte-6g11qq"><span class="chev svelte-6g11qq"><!></span>Fields for other kinds of app</summary> <!></details>`),pO=H(`<!> <!>`,1),mO=H(`<span class="say svelte-6g11qq" role="alert"> </span> <button type="button" class="svelte-6g11qq">Keep editing</button> <button type="button" class="bad svelte-6g11qq">Discard and close</button>`,1),hO=H(`<span class="say svelte-6g11qq" role="status"><!></span> <button type="button" class="svelte-6g11qq">Discard</button> <button type="button" class="go svelte-6g11qq"> </button>`,1),gO=H(`<!> <!> <div class="body svelte-6g11qq" role="tabpanel"><!></div> <footer><!></footer>`,1),_O=H(`<dialog aria-labelledby="settings-title" class="svelte-6g11qq"><header class="svelte-6g11qq"><h2 id="settings-title" class="svelte-6g11qq"> </h2> <!> <button class="x svelte-6g11qq" type="button" aria-label="Close"><!></button></header> <!></dialog>`);function vO(e,t){k(t,!0);let n=M(void 0),r=M(``),i=M(``),a=M(null),o=M(null),s=M(null),c=M(pn([])),l=M(pn(new Map)),u=M(0),d=M(!1),f=M(!1),p=M(!1),m=!1,h=M(!1),g={awsProfiles:[],files:[],profiles:{},scripts:{}},_=M(pn(g)),y=e=>{let t=yT(e);return`error`in t?[]:t},b=(e,t)=>{let n=e;for(let e of t?y(t):[])n=typeof e==`number`?n.items??{}:n.properties?.[e]??(typeof n.additionalProperties==`object`?n.additionalProperties:{});return n},x=j(()=>z(s)?b(z(s),z(i)):{}),S=j(()=>z(i)?xT(z(o),y(z(i))):z(o)),C=j(()=>/^apps\.[a-z0-9-]+$/.test(z(i))?z(i).slice(5):null),w=j(()=>!!z(C)&&!!z(S)?.outside),ee=j(()=>z(C)?WE:z(i)?[]:YE),T=j(()=>{let e=z(C)?z(w)?JE:qE:z(i)?[]:XE,t=new Set([...z(ee),...e.flatMap(e=>e.keys)]),n=[...Object.keys(z(x).properties??{}),...Object.keys(z(S)??{})].filter(e=>!t.has(e)),r=[...new Set(n)],a=z(i)?fD(z(i),z(S),z(o)):void 0;return a?[{name:`Settings`,keys:[...new Set([...a.fields,...Object.keys(z(S)??{})])]}]:e.length?r.length?[...e,{name:`Other`,keys:r}]:e:[{name:`Settings`,keys:r}]}),te=j(()=>z(T)[Math.min(z(u),z(T).length-1)]),E=j(()=>tD(z(a),z(o))),ne=e=>[...z(l).keys()].filter(t=>e.some(e=>$E(t,RE(z(i),e)))).length;async function re(e){N(r,e.title,!0),N(i,e.path,!0),m=!1,N(h,!1),N(p,!1),N(f,!1),N(u,0),N(l,new Map,!0),N(c,Q.status?.locks??[],!0);let t=/^apps\.([a-z0-9-]+)$/.exec(e.path)?.[1]??``,[d,v,y]=await Promise.all([z(s)?Promise.resolve(z(s)):fetch(`data/stack-schema.json`).then(e=>e.json()),fetch(`data/registry.json`).then(e=>e.json()),fetch(`data/choices.json?app=${t}`).then(e=>e.json()).catch(()=>g)]);N(_,{...g,...y},!0),N(s,d);let{source:b,found:x,...S}=v;N(a,S),N(o,JSON.parse(JSON.stringify(S))),z(n)?.showModal()}let ie=e=>e.map(e=>({value:e,label:e})),ae=(e,t=!0)=>({options:ie(e),other:t}),oe=e=>z(_).files.filter(t=>e.test(t)),se={save:(e,t)=>(N(o,ST(z(o),y(e),t)),N(p,!1),z(l).has(e)&&N(l,new Map([...z(l)].filter(([t])=>t!==e)),!0),Promise.resolve(null)),locked:e=>UE(z(c),e),lock:(e,t)=>{Xs(`stack-lock`,{path:e,on:t}).then(n=>{`error`in n||N(c,t?[...z(c),e]:z(c).filter(t=>t!==e),!0)})},keys:e=>/(^|\.)consumes$/.test(e)?Z.apps.map(e=>e.id).filter(t=>!e.startsWith(`apps.${t}.`)):/(^|\.)(envs|sam\.envs)$/.test(e)?Z.envs:/(^|\.)(publishes|reads)$/.test(e)?Object.keys(xT(z(o),[`queues`])??{}):null,problem:e=>z(l).get(e),options:e=>{let t=/(?:^|\.)([A-Za-z]+)$/.exec(e)?.[1]??``,n=z(o)??{},r=z(S)??{};if(t===`kind`&&/^apps\.[a-z0-9-]+\.kind$/.test(e))return{options:[...Object.entries(ns).map(([e,t])=>({value:e,label:t.label,kind:e})),...Object.entries(n.kinds??{}).filter(([e])=>!Object.hasOwn(ns,e)).map(([e,t])=>({value:e,label:t.label??e,kind:e}))]};if(t===`sso`)return ae(z(_).awsProfiles);if(t===`signIn`)return ae(Object.keys(n.signIns??{}),!1);if(t===`how`&&/consumes/.test(e))return{options:sD};if(t===`type`&&/secrets\[\d+\]\.type$/.test(e))return{options:gT.map(e=>({value:e,label:HE(e)})),other:!0};if(!z(C))return null;if(t===`project`&&!/lambda\.project$/.test(e)){let e=oe(/\.(cs|fs|vb)proj$/);return ae([...new Set(e.map(e=>e.split(`/`).slice(0,-1).join(`/`)||`.`)),...e])}if(t===`launchSettings`)return ae(Object.keys(z(_).profiles));if(t===`baseProfile`){let e=typeof r.launchSettings==`string`?r.launchSettings:``,t=z(_).profiles[e]??[...new Set(Object.values(z(_).profiles).flat())];return ae(t)}return t===`script`?ae(z(_).scripts[`package.json`]??Object.values(z(_).scripts)[0]??[]):t===`defineFile`?ae(oe(/\.(json|env)$/).filter(e=>!/(^|\/)package(-lock)?\.json$/.test(e))):t===`template`?ae(oe(/\.ya?ml$/)):t===`file`?ae(z(_).files):null},stack:()=>z(o)},ce=async()=>{N(d,!0);let e=await Xs(`stack-save`,{stack:z(o)});if(N(d,!1),`error`in e){let t=e.problems??[];N(l,t.length?QE(t):new Map([[``,e.error]]),!0);let n=z(T).findIndex(e=>ne(e.keys));n>=0&&N(u,n,!0)}else N(a,JSON.parse(JSON.stringify(z(o)))),N(l,new Map,!0),N(p,!0),m=!0},le=()=>{N(o,JSON.parse(JSON.stringify(z(a)))),N(l,new Map,!0)},ue=()=>{z(E)&&!z(f)?N(f,!0):(z(n)?.close(),m&&Z.reload())};var de={open:re},fe=_O(),pe=P(fe),me=P(pe),he=I(me,!0),ge=L(me,2),_e=e=>{var t=aO(),n=P(t);X(n,{get of(){return hT},size:14});var r=L(n,1,!0);O(t),R(()=>{t.disabled=z(h),W(r,z(h)?`Asked the agent`:`Ask the agent to fill in`)}),V(`click`,t,async()=>{N(h,await Yb.askFill(z(C),Object.keys(z(x).properties??{}).filter(e=>z(S)?.[e]===void 0&&e!==`outside`),z(c).filter(e=>e.startsWith(`apps.${z(C)}.`))),!0)}),U(e,t)};G(ge,e=>{z(C)&&!z(w)&&e(_e)});var ve=L(ge,2);X(P(ve),{get of(){return to},size:14}),O(ve),O(pe);var ye=L(pe,2),be=e=>{var t=gO(),n=F(t),a=e=>{var t=oO();K(t,20,()=>z(ee),e=>e,(e,t)=>{{let n=j(()=>RE(z(i),t)),r=j(()=>HE(t,!z(i))),a=j(()=>z(x).properties?.[t]??{}),o=j(()=>z(S)?.[t]),s=j(()=>!!z(x).required?.includes(t));ZD(e,{get path(){return z(n)},get name(){return z(r)},get schema(){return z(a)},get value(){return z(o)},get ctx(){return se},get required(){return z(s)},depth:1})}}),O(t),U(e,t)};G(n,e=>{z(ee).length&&e(a)});var o=L(n,2),s=e=>{var t=lO();K(t,23,()=>z(T),e=>e.name,(e,t,n)=>{let r=j(()=>ne(z(t).keys));var i=cO();let a;var o=P(i,!0),s=L(o),c=e=>{var t=sO(),n=I(t,!0);R(()=>{q(t,`aria-label`,`${z(r)??``} to fix`),W(n,z(r))}),U(e,t)};G(s,e=>{z(r)&&e(c)}),O(i),R(()=>{q(i,`aria-selected`,z(te)===z(t)),a=Ji(i,1,`svelte-6g11qq`,null,a,{wrong:z(r)>0}),W(o,z(t).name)}),V(`click`,i,()=>N(u,z(n),!0)),U(e,i)}),O(t),R(()=>q(t,`aria-label`,`${z(r)??``} settings`)),U(e,t)};G(o,e=>{z(T).length>1&&e(s)});var c=L(o,2),m=P(c),h=e=>{iO(e,{get path(){return z(i)},get app(){return z(S)},get schema(){return z(x)},get envs(){return Z.envs},get ctx(){return se}})},g=e=>{var t=dO();K(t,21,()=>Object.entries(z(S)?.apps??{}),([e,t])=>e,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1];var a=uO(),o=P(a);{let e=j(()=>i().kind??`other`);sE(o,{get kind(){return z(e)},label:``})}var s=L(o,2),c=I(s,!0),l=L(s,2),u=I(l,!0),d=L(l,2);O(a),R(e=>{W(c,i().name??r()),W(u,e),d.disabled=z(E)>0,q(d,`title`,z(E)?`Save or discard your changes first`:void 0)},[()=>(Object.hasOwn(ns,i().kind??``)?ns[i().kind??``]?.label:null)??i().kind??``]),V(`click`,d,()=>void re({title:i().name??r(),path:`apps.${r()}`})),U(e,a)}),O(t),U(e,t)},_=e=>{let t=j(()=>typeof z(S)?.kind==`string`?z(S).kind:``),n=j(()=>GE[z(t)]??[]),r=j(()=>z(te).keys.filter(e=>KE.includes(e)&&!z(n).includes(e)&&z(S)?.[e]===void 0));var a=pO(),o=F(a);K(o,16,()=>z(te).keys.filter(e=>!z(r).includes(e)),e=>e,(e,t)=>{{let n=j(()=>RE(z(i),t)),r=j(()=>HE(t,!z(i))),a=j(()=>z(x).properties?.[t]??{}),o=j(()=>z(S)?.[t]),s=j(()=>!!z(x).required?.includes(t)),c=j(()=>z(te).keys.length===1?0:1);ZD(e,{get path(){return z(n)},get name(){return z(r)},get schema(){return z(a)},get value(){return z(o)},get ctx(){return se},get required(){return z(s)},get depth(){return z(c)}})}});var s=L(o,2),c=e=>{var t=fO(),n=P(t),a=P(n);X(P(a),{get of(){return pT},size:10}),O(a),je(),O(n),K(L(n,2),16,()=>z(r),e=>e,(e,t)=>{{let n=j(()=>RE(z(i),t)),r=j(()=>HE(t)),a=j(()=>z(x).properties?.[t]??{}),o=j(()=>z(S)?.[t]);ZD(e,{get path(){return z(n)},get name(){return z(r)},get schema(){return z(a)},get value(){return z(o)},get ctx(){return se},depth:1})}}),O(t),U(e,t)};G(s,e=>{z(r).length&&e(c)}),U(e,a)};G(m,e=>{z(te)?.view===`envs`&&z(C)&&z(S)?e(h):z(te)?.view===`apps`?e(g,1):z(te)&&e(_,2)}),O(c);var y=L(c,2);let b;var w=P(y),ie=e=>{var t=mO(),n=F(t),r=I(n),i=L(n,2),a=L(i,2);R(()=>W(r,`Close without saving ${z(E)??``} ${z(E)===1?`change`:`changes`}?`)),V(`click`,i,()=>N(f,!1)),V(`click`,a,()=>{le(),ue()}),U(e,t)},ae=e=>{var t=hO(),n=F(t),r=P(n),i=e=>{var t=si();R(e=>W(t,e),[()=>z(l).get(``)??`${String(z(l).size)} to fix before it can be saved`]),U(e,t)},a=e=>{var t=si();R(()=>W(t,`${z(E)??``} ${z(E)===1?`change`:`changes`}, not saved yet`)),U(e,t)},o=e=>{U(e,si(`Saved`))},s=e=>{U(e,si(`No changes`))};G(r,e=>{z(l).size?e(i):z(E)?e(a,1):z(p)?e(o,2):e(s,-1)}),O(n);var c=L(n,2),u=L(c,2),f=I(u,!0);R(()=>{c.disabled=!z(E)||z(d),u.disabled=!z(E)||z(d),W(f,z(d)?`Saving…`:`Save`)}),V(`click`,c,le),V(`click`,u,()=>void ce()),U(e,t)};G(w,e=>{z(f)&&z(E)?e(ie):e(ae,-1)}),O(y),R(()=>{q(c,`aria-label`,z(te)?.name),b=Ji(y,1,`svelte-6g11qq`,null,b,{dirty:z(E)>0})}),U(e,t)};return G(ye,e=>{z(s)&&z(o)&&e(be)}),O(fe),Ma(fe,e=>N(n,e),()=>z(n)),R(()=>W(he,z(r))),B(`cancel`,fe,e=>{e.preventDefault(),ue()}),V(`click`,fe,e=>{e.target===z(n)&&ue()}),V(`click`,ve,ue),U(e,fe),A(de)}Zr([`click`]);var yO=H(`<span> </span>`),bO=H(`<option> </option>`),xO=H(`<select class="svelte-1psun92"><option>Kind?</option><!></select>`),SO=H(`<div><input type="checkbox" class="svelte-1psun92"/> <span class="who svelte-1psun92"><input class="name svelte-1psun92" maxlength="80" spellcheck="false"/> <span class="slug svelte-1psun92"> </span></span> <!></div>`),CO=H(`<details open="" class="svelte-1psun92"><summary class="svelte-1psun92"><span class="folder svelte-1psun92"> </span> <span class="n svelte-1psun92"> </span> <button class="link svelte-1psun92" type="button"> </button></summary> <!></details>`),wO=H(`<p class="none svelte-1psun92"> </p>`),TO=H(`<dialog aria-labelledby="repos-title" class="svelte-1psun92"><button class="x svelte-1psun92" type="button" aria-label="Close"><!></button> <h2 id="repos-title" class="svelte-1psun92"> </h2> <p class="sub svelte-1psun92"><!></p> <input type="search" placeholder="Find a repo" aria-label="Find a repo" autocomplete="off" class="svelte-1psun92"/> <div class="list svelte-1psun92"></div> <p class="error svelte-1psun92" role="alert"> </p> <div class="acts svelte-1psun92"><span class="count svelte-1psun92"> </span> <button type="button" class="svelte-1psun92">Cancel</button> <button class="go svelte-1psun92" type="button"> </button></div></dialog>`);function EO(e,t){k(t,!0);let n=M(void 0),r=M(null),i=M(``),a=M(``),o=M(!1),s=new z_,c=j(()=>(z(r)?.repos??[]).filter(e=>!e.inStack)),l=j(()=>z(c).filter(e=>`${e.name} ${e.slug} ${e.folder}`.toLowerCase().includes(z(i).trim().toLowerCase()))),u=j(()=>[...new Set(z(l).map(e=>e.folder))]),d=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;async function f(){s.clear(),N(i,``),N(a,``),N(r,await Zs()),z(n)?.showModal()}let p=(e,t,n={})=>{N(a,``),t?s.set(e.slug,{name:e.name,kind:e.kind??``,...s.get(e.slug),...n}):s.delete(e.slug)},m=e=>{let t=z(c).filter(t=>t.folder===e),n=t.every(e=>s.has(e.slug));for(let e of t)p(e,!n)},h=async()=>{let e=z(c).find(e=>s.has(e.slug)&&!s.get(e.slug)?.kind);if(e){N(a,`Choose what kind of app ${e.name} is.`);return}N(o,!0);let t=await Xs(`apps`,{apps:[...s].map(([e,{name:t,kind:n}])=>({slug:e,name:t.trim()||e,kind:n}))});N(o,!1),`error`in t?N(a,t.error,!0):(z(n)?.close(),Wb.findings?Wb.findings.open({afterAdding:!0}):location.reload())};var g={open:f},_=TO(),y=P(_);X(P(y),{get of(){return to},size:14}),O(y);var b=L(y,2),x=I(b),S=L(b,2),C=P(S),w=e=>{var t=si();R(e=>W(t,`Tick every repo you might want to run in ${Z.stack??``}: this is the full list you will choose from. Which ones run
|
|
36
|
+
together is decided later on the board. Koppler found ${z(c).length??``} on this Mac, under ${e??``}.`),[()=>z(r).roots.join(`, `)]),U(e,t)},ee=e=>{U(e,si(`No scan of your repos yet. Run koppler init.`))};G(C,e=>{z(r)?e(w):e(ee,-1)}),O(S);var T=L(S,2);ma(T);var te=L(T,2);K(te,20,()=>z(u),e=>e,(e,t)=>{let n=j(()=>z(l).filter(e=>e.folder===t)),r=j(()=>z(n).filter(e=>s.has(e.slug)).length);var i=CO(),a=P(i),o=P(a),c=I(o,!0),u=L(o,2),f=I(u),h=L(u,2),g=I(h,!0);O(a),K(L(a,2),17,()=>z(n),e=>e.slug,(e,t)=>{let n=j(()=>s.get(z(t).slug));var r=SO();let i;var a=P(r);ma(a);var o=L(a,2),c=P(o);ma(c);var l=L(c,2),u=I(l,!0);O(o);var d=L(o,2),f=e=>{var n=yO(),r=I(n,!0);R(e=>{Ji(n,1,`kind kind-${z(t).kind??``}`,`svelte-1psun92`),W(r,e)},[()=>hs({kind:z(t).kind}).label]),U(e,n)},m=e=>{var r=xO(),i=P(r);i.value=i.__value=``,K(L(i),17,()=>Object.entries(ns),([e,{label:t}])=>e,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1].label;var a=bO(),o=I(a,!0),s={};R(()=>{W(o,i()),s!==(s=r())&&(a.value=(a.__value=s)??``)}),U(e,a)}),O(r);var a;ta(r),R(()=>{q(r,`aria-label`,`Kind of app for ${z(t).name??``}`),a!==(a=z(n)?.kind??``)&&(r.value=(r.__value=a)??``,ea(r,a))}),V(`change`,r,e=>{p(z(t),!0,{kind:e.currentTarget.value})}),U(e,r)};G(d,e=>{z(t).kind?e(f):e(m,-1)}),O(r),R(()=>{i=Ji(r,1,`pick svelte-1psun92`,null,i,{on:!!z(n)}),q(a,`aria-label`,`Add ${z(t).name??``}`),ga(a,!!z(n)),q(c,`aria-label`,`Name of ${z(t).slug??``} in the stack`),ha(c,z(n)?.name??z(t).name),q(l,`title`,z(t).path),W(u,z(t).slug)}),V(`change`,a,e=>{p(z(t),e.currentTarget.checked)}),V(`input`,c,e=>{z(n)&&p(z(t),!0,{name:e.currentTarget.value})}),U(e,r)}),O(i),R((e,n,r)=>{W(c,t),W(f,`${e??``}${n??``}`),W(g,r)},[()=>d(z(n).length,`repo`),()=>z(r)?`, ${String(z(r))} picked`:``,()=>z(r)===z(n).length?`Clear these`:`Pick all ${String(z(n).length)}`]),V(`click`,h,()=>{m(t)}),U(e,i)},e=>{var t=wO(),n=I(t,!0);R(()=>W(n,z(c).length?`No repo matches.`:`Every clone found is already in the stack.`)),U(e,t)}),O(te);var E=L(te,2),ne=I(E,!0),re=L(E,2),ie=P(re),ae=I(ie,!0),oe=L(ie,2),se=L(oe,2),ce=I(se,!0);return O(re),O(_),Ma(_,e=>N(n,e),()=>z(n)),R((e,t)=>{W(x,`${Z.apps.length?`Add repos to`:`Add your repos to`} ${Z.stack??``}`),W(ne,z(a)),W(ae,e),se.disabled=!s.size||z(o),W(ce,t)},[()=>s.size?`${String(s.size)} picked`:`Nothing picked yet`,()=>z(o)?`Adding…`:s.size?`Add ${d(s.size,`app`)}`:`Add apps`]),B(`cancel`,_,e=>{s.size&&e.preventDefault()}),V(`click`,y,()=>z(n)?.close()),Sa(T,()=>z(i),e=>N(i,e)),V(`click`,oe,()=>z(n)?.close()),V(`click`,se,h),U(e,_),A(g)}Zr([`click`,`change`,`input`]);var DO=H(`<button type="button" class="cable svelte-yroiop"> </button>`),OO=H(`<span class="alone svelte-yroiop" role="group"><span>Not cabled to any app here, so nothing local calls it and it calls only deployed apps.</span> <span class="picks svelte-yroiop"><!> <!> <button type="button" class="svelte-yroiop">Run it on its own</button> <button type="button" title="Leave it out of this run; its card stays on the board" class="svelte-yroiop">Don't run it</button></span></span>`),kO=H(`<label class="branch svelte-yroiop">Branch <!></label>`),AO=H(`<label class="svelte-yroiop"> <select class="svelte-yroiop"><option>Set aside until Stop</option><option>Take along</option></select></label>`),jO=H(`<option> </option>`),MO=H(`<label class="svelte-yroiop">Started by <select class="svelte-yroiop"></select></label>`),NO=H(`<label class="check svelte-yroiop"><input type="checkbox" role="switch" class="svelte-yroiop"/> Tunnels</label>`),PO=H(`<!> <span class="controls svelte-yroiop"><!> <!> <!> <!></span>`,1);function FO(e,t){k(t,!0);let n=j(()=>Z.app(t.id)),r=j(()=>Z.cards.find(e=>e.id===t.id)?.data),i=j(()=>Z.uncabled(t.id)?Z.cablesOf(t.id).can:[]),a=j(()=>Z.uncabled(t.id)?Z.cards.flatMap(e=>e.id!==t.id&&Z.cablesOf(e.id).can.some(e=>e.id===t.id)?Z.apps.filter(t=>t.id===e.id):[]):[]),o=(e,t)=>{Z.connect(e,t),Yb.again()},s=e=>{Z.set(t.id,e),Yb.again()};var c=ci(),l=F(c),u=e=>{var c=PO(),l=F(c),u=e=>{var r=OO(),s=L(P(r),2),c=P(s);K(c,17,()=>z(a).slice(0,3),e=>e.id,(e,n)=>{var r=DO(),i=I(r);R(()=>W(i,`${z(n).name??``} calls it`)),V(`click`,r,()=>{o(z(n).id,t.id)}),U(e,r)});var l=L(c,2);K(l,17,()=>z(i).slice(0,3),e=>e.id,(e,n)=>{var r=DO(),i=I(r);R(()=>W(i,`It calls ${z(n).name??``}`)),V(`click`,r,()=>{o(t.id,z(n).id)}),U(e,r)});var u=L(l,2),d=L(u,2);O(s),O(r),R(()=>q(r,`aria-label`,`${z(n).name??``} is not cabled`)),V(`click`,u,()=>{Yb.onItsOwn[t.id]=!0}),V(`click`,d,()=>{Yb.leftOut[t.id]=!0,Yb.again()}),U(e,r)};G(l,e=>{(z(i).length||z(a).length)&&!Yb.onItsOwn[t.id]&&e(u)});var d=L(l,2),f=P(d),p=e=>{var t=kO();pb(L(P(t)),{get value(){return z(r).branch},get current(){return z(n).current},get branches(){return z(n).branches},onpick:e=>{s({branch:e})}}),O(t),U(e,t)};G(f,e=>{z(n).branches.length&&z(r).run!==`mock`&&e(p)});var m=L(f,2),h=e=>{var t=AO(),i=P(t),a=L(i),o=P(a);o.value=o.__value=`set-aside`;var c=L(o);c.value=c.__value=`take-along`,O(a);var l;ta(a),O(t),R(()=>{W(i,`${z(n).dirty??``} uncommitted on ${z(n).current??``} `),l!==(l=z(r).changes??`set-aside`)&&(a.value=(a.__value=l)??``,ea(a,l))}),V(`change`,a,e=>{s({changes:e.currentTarget.value===`take-along`?`take-along`:`set-aside`})}),U(e,t)},g=j(()=>Z.switchesOver(t.id));G(m,e=>{z(g)&&e(h)});var _=L(m,2),y=e=>{var t=MO(),i=L(P(t));K(i,21,()=>z(n).runIn,([e])=>e,(e,t)=>{var n=j(()=>v(z(t),1));let r=()=>z(n)[0];var i=jO(),a=I(i,!0),o={};R(()=>{W(a,Qs[r()]??r()),o!==(o=r())&&(i.value=(i.__value=o)??``)}),U(e,i)}),O(i);var a;ta(i),O(t),R(()=>{a!==(a=z(r).run)&&(i.value=(i.__value=a)??``,ea(i,a))}),V(`change`,i,e=>{s({run:e.currentTarget.value})}),U(e,t)};G(_,e=>{z(n).runIn.length>1&&e(y)});var b=L(_,2),x=e=>{var t=NO(),n=P(t);ma(n),je(),O(t),R(()=>ga(n,!z(r).hideTunnels)),V(`change`,n,e=>{s({hideTunnels:!e.currentTarget.checked})}),U(e,t)},S=j(()=>Z.tunnelsOf(t.id).length);G(b,e=>{z(S)&&e(x)}),O(d),U(e,c)};G(l,e=>{z(n)&&z(r)&&e(u)}),U(e,c),A()}Zr([`click`,`change`]);var IO=H(`<button class="mini svelte-pzq2er" type="button"> </button>`),LO=H(`<p> <!></p>`),RO=H(`<small> </small>`),zO=H(`<span> <!> <!> <!></span>`),BO=H(`<ul class="lines svelte-pzq2er"><li class="svelte-pzq2er"><span class="verb svelte-pzq2er"> </span> <span class="apps svelte-pzq2er"></span></li></ul>`),VO=H(`<button class="back svelte-pzq2er" type="button"> </button>`),HO=H(`<h2 id="review-title" class="svelte-pzq2er"> </h2> <p class="sub svelte-pzq2er"> </p> <div class="body svelte-pzq2er"><!> <!></div> <div class="actions svelte-pzq2er"><!> <button type="button" class="svelte-pzq2er">Cancel</button> <button type="button"> </button></div>`,1),UO=H(`<dialog aria-labelledby="review-title" class="svelte-pzq2er"><!></dialog>`);function WO(e,t){k(t,!0);let n=M(void 0),r=j(()=>Yb.review);In(()=>{z(r)&&!z(n)?.open?z(n)?.showModal():!z(r)&&z(n)?.open&&z(n).close()});var i=UO(),a=P(i),o=e=>{var t=HO(),n=F(t),i=I(n,!0),a=L(n,2),o=I(a,!0),s=L(a,2),c=P(s);K(c,17,()=>z(r).notices,Ei,(e,t)=>{var n=LO();let r;var i=P(n),a=L(i),o=e=>{var n=IO(),r=I(n,!0);R(()=>W(r,z(t).act.label)),V(`click`,n,function(...e){z(t).act.run?.apply(this,e)}),U(e,n)};G(a,e=>{z(t).act&&e(o)}),O(n),R(()=>{r=Ji(n,1,`notice svelte-pzq2er`,null,r,{prod:z(t).kind===`prod`}),W(i,`${z(t).text??``} `)}),U(e,n)}),K(L(c,2),17,()=>z(r).groups,Ei,(e,t)=>{var n=BO(),r=P(n),i=P(r),a=I(i,!0),o=L(i,2);K(o,21,()=>z(t).items,Ei,(e,t,n,r)=>{var i=zO();let a;var o=P(i),s=L(o),c=e=>{var n=IO(),r=I(n,!0);R(()=>{q(n,`title`,z(t).act.title),W(r,z(t).act.label)}),V(`click`,n,function(...e){z(t).act.run?.apply(this,e)}),U(e,n)};G(s,e=>{z(t).act&&e(c)});var l=L(s,2);K(l,17,()=>z(t).notes,Ei,(e,t,n,r)=>{var i=RO(),a=I(i,!0);R(()=>{Ji(i,1,Hi(z(t).kind),`svelte-pzq2er`),q(i,`title`,z(t).title),W(a,z(t).text)}),U(e,i)});var u=L(l,2),d=e=>{FO(e,{get id(){return z(t).id}})};G(u,e=>{z(t).id&&e(d)}),O(i),R(()=>{a=Ji(i,1,`svelte-pzq2er`,null,a,{off:z(t).off}),W(o,`${z(t).name??``} `)}),U(e,i)}),O(o),O(r),O(n),R(()=>{q(i,`data-verb`,z(t).verb),W(a,z(t).label)}),U(e,n)}),O(s);var l=L(s,2),u=P(l),d=e=>{var t=VO(),n=I(t,!0);R(()=>W(n,z(r).back.label)),V(`click`,t,()=>{let{back:e}=z(r);Yb.review=null,e?.run()}),U(e,t)};G(u,e=>{z(r).back&&e(d)});var f=L(u,2),p=L(f,2);let m;var h=I(p,!0);O(l),R(()=>{W(i,z(r).title),W(o,z(r).sub),m=Ji(p,1,`ok svelte-pzq2er`,null,m,{prod:z(r).prod}),p.disabled=z(r).blocked,W(h,z(r).ok)}),V(`click`,f,()=>{Yb.review=null}),V(`click`,p,()=>{Yb.confirm()}),U(e,t)};G(a,e=>{z(r)&&e(o)}),O(i),Ma(i,e=>N(n,e),()=>z(n)),B(`close`,i,()=>{z(n)?.open||(Yb.review=null)}),U(e,i),A()}Zr([`click`]);var GO=new class{#e=M(null);get switching(){return z(this.#e)}set switching(e){N(this.#e,e,!0)}useStack(e){Yb.idle?this.#n(e.dir):Yb.stopReview({title:`Switch to ${e.name}`,sub:`${Z.stack} still has something running. It is stopped and reverted first, then Koppler switches.`,notices:[{text:`Your boards and history for ${Z.stack} are kept and come back when you switch back.`}],ok:`Stop, revert and switch`,text:`Stop and revert this stack using the koppler-run skill (stop every process the agent started, revert every temporary code change), then switch Koppler to the stack "${e.name}": koppler history done <this run's id>, then koppler use "${e.dir}". Report what was stopped and reverted.`,sent:`Sent. Koppler switches once everything is stopped`,data:{switchTo:e.dir}})}async#t(e){let t=await Xs(e);return`error`in t?($.show(t.error,`warning`),null):t}async updateStack(){let e=await this.#t(`stack-update`);e?.updated?location.reload():e&&$.show(e.message??`Already up to date.`)}shareChanges(){let e=Q.status?.linked;if(!e)return;let t=[{verb:`keeps`,label:`Changes`,items:e.changes.map(e=>({name:e.replace(/^./,e=>e.toUpperCase()),notes:[]}))}];Yb.review={title:`Changes not in the shared stack yet`,sub:`What Koppler learned here, kept in your copy of ${Z.stack}. The shared stack on GitHub stays as it is until a pull request is merged.`,notices:[...e.pr?[{text:`A pull request is already open: ${e.pr}. Opening another replaces nothing; close the old one if you open a new one.`}]:[],{text:`Opening a pull request pushes a new branch to the shared repo with your GitHub account, for your team to review. No secret values are in it.`}],groups:t,ok:`Open pull request`,prod:!1,blocked:!1,confirm:()=>{$.show(`Opening the pull request…`),this.#t(`stack-pr`).then(e=>{e&&$.show(`Pull request opened`,`message`,{label:`View`,run:()=>window.open(e.url,`_blank`,`noopener`)})})},back:{label:`Discard my changes instead`,run:()=>{Yb.review={title:`Discard your changes`,sub:`Your copy of ${Z.stack} goes back to the shared stack as last fetched. What Koppler learned here is lost.`,notices:[],groups:t,ok:`Discard`,prod:!0,blocked:!1,confirm:()=>{this.#t(`stack-discard`).then(e=>{e&&location.reload()})}}}}}}addStack(e){Yb.idle?e():Yb.stopReview({title:`Start a new stack`,sub:`${Z.stack} still has something running. It is stopped and reverted first; then choose Add a stack again.`,notices:[{text:`Your boards and history for ${Z.stack} are kept and come back when you switch back.`}],ok:`Stop and revert`,text:`Stop and revert this stack using the koppler-run skill (stop every process the agent started, revert every temporary code change), so the user can start a new stack. Report what was stopped and reverted.`,sent:`Stopping and reverting`})}async#n(e){this.switching=e;let t=await Xs(`stack`,{use:e});t.error?(this.switching=null,$.show(t.error,`warning`)):location.reload()}},KO=H(`<button class="x svelte-8d6d0q" type="button" aria-label="Close"><!></button>`),qO=H(`<!> <h2 id="setup-title" class="svelte-8d6d0q">Set up Koppler</h2> <p class="sub svelte-8d6d0q">Koppler runs the apps you pick on this Mac and connects them to each other. Everything else keeps calling the
|
|
37
|
+
deployed environment.</p> <ol class="concept svelte-8d6d0q" aria-label="How it fits together"><li class="svelte-8d6d0q"><strong>Stack</strong><span class="svelte-8d6d0q">Every app you might run. Added once.</span></li> <li class="svelte-8d6d0q"><strong>Board</strong><span class="svelte-8d6d0q">The few you run now, wired together. Saved as you go; keep as many as you like.</span></li></ol> <div class="choices svelte-8d6d0q"><button type="button" class="svelte-8d6d0q"><strong class="svelte-8d6d0q">Use a shared stack</strong> <span class="svelte-8d6d0q"> </span></button> <button type="button" class="svelte-8d6d0q"><strong class="svelte-8d6d0q">Start a new stack</strong><span class="svelte-8d6d0q">Name it, then pick your repos.</span></button></div>`,1),JO=H(`<div class="stack svelte-8d6d0q"><span class="svelte-8d6d0q"><strong> </strong> <span class="about svelte-8d6d0q"> </span> <small class="svelte-8d6d0q"> </small></span> <button type="button" class="svelte-8d6d0q">Use</button></div>`),YO=H(`<button class="back svelte-8d6d0q" type="button">Back</button> <h2 id="setup-title" class="svelte-8d6d0q">Use a shared stack</h2> <p class="sub svelte-8d6d0q"> </p> <!> <form class="link svelte-8d6d0q"><input type="text" inputmode="url" placeholder="Link to a stack.json on GitHub" aria-label="Link to a shared stack on GitHub" autocomplete="off" spellcheck="false" class="svelte-8d6d0q"/> <button class="go svelte-8d6d0q" type="submit">Use</button></form>`,1),XO=H(`<small class="svelte-8d6d0q">default</small>`),ZO=H(`<span class="tag svelte-8d6d0q"> <!> <button type="button" class="svelte-8d6d0q"><!></button></span>`),QO=H(`<button class="back svelte-8d6d0q" type="button">Back</button> <h2 id="setup-title" class="svelte-8d6d0q">Start a new stack</h2> <p class="sub svelte-8d6d0q">It stays private on this Mac until you choose to share it.</p> <form class="new svelte-8d6d0q"><label class="svelte-8d6d0q">Name <input maxlength="60" placeholder="e.g. Orders platform" autocomplete="off" spellcheck="false" class="svelte-8d6d0q"/></label> <label class="svelte-8d6d0q">Environments <span class="tags svelte-8d6d0q"><!> <input autocomplete="off" spellcheck="false" autocapitalize="off" maxlength="16" class="svelte-8d6d0q"/></span> <small class="svelte-8d6d0q">Where your apps are deployed, e.g. qa and prod. The first one is the default.</small></label> <button class="go svelte-8d6d0q" type="submit">Create and add repos</button></form>`,1),$O=H(`<dialog aria-labelledby="setup-title" class="svelte-8d6d0q"><!> <p class="error svelte-8d6d0q" role="alert"> </p></dialog>`);function ek(e,t){k(t,!0);let n=M(void 0),r=M(`start`),i=M(``),a=M(!1),o=M(``),s=M(``),c=M(``),l=M(pn([])),u=j(()=>Z.known);function d(e=`start`){f(e),N(o,N(s,N(c,``),!0),!0),N(l,[],!0),z(n)?.showModal()}let f=e=>{N(r,e,!0),N(i,``)},p=async e=>{N(a,!0),N(i,``);let t=await Xs(`stack`,e);N(a,!1),`error`in t?N(i,t.error,!0):location.reload()},m=e=>{for(let t of e.split(/[\s,]+/).filter(Boolean)){let e=t.toLowerCase();if(!/^[a-z0-9-]{1,16}$/.test(e))return N(i,`"${t}" will not work as a name: use lowercase letters, digits and dashes, e.g. qa.`),!1;if(z(l).length>=8)return N(i,`Eight environments is the most a stack can have.`),!1;z(l).includes(e)||N(l,[...z(l),e],!0)}return N(i,``),N(c,``),!0},h=e=>{[`Enter`,`,`,` `,`Tab`].includes(e.key)&&z(c).trim()?(e.preventDefault(),m(z(c))):e.key===`Backspace`&&!z(c)&&z(l).length&&N(l,z(l).slice(0,-1),!0)},g=e=>{e.preventDefault(),(!z(c).trim()||m(z(c)))&&p({name:z(s),envs:z(l)})};var _={open:d},v=$O(),y=P(v),b=e=>{var t=qO(),r=F(t),i=e=>{var t=KO();X(P(t),{get of(){return to},size:14}),O(t),V(`click`,t,()=>z(n)?.close()),U(e,t)};G(r,e=>{Z.setup||e(i)});var a=L(r,8),o=P(a),s=I(L(P(o),2),!0);O(o);var c=L(o,2);O(a),R(e=>W(s,e),[()=>z(u).length?`${String(z(u).length)} found on this Mac, or one from a link on GitHub.`:`From a link on GitHub, set up by your team.`]),V(`click`,o,()=>{f(`join`)}),V(`click`,c,()=>{f(`new`)}),U(e,t)},x=e=>{var t=YO(),n=F(t),r=L(n,4),i=I(r,!0),s=L(r,2);K(s,17,()=>z(u),e=>e.dir,(e,t)=>{var n=JO(),r=P(n),i=P(r),o=I(i,!0),s=L(i,2),c=I(s),l=L(s,2),u=I(l,!0);O(r);var d=L(r,2);O(n),R(e=>{W(o,z(t).name),W(c,`${z(t).linked?`from GitHub`:z(t).shared?`shared`:`private`}, ${z(t).apps??``}
|
|
38
|
+
${z(t).apps===1?`app`:`apps`}, ${e??``}`),q(l,`title`,z(t).path),W(u,z(t).path),d.disabled=z(a),q(d,`aria-label`,`Use ${z(t).name??``}`)},[()=>z(t).envs.join(` / `)]),V(`click`,d,()=>void p({use:z(t).dir})),U(e,n)});var c=L(s,2),l=P(c);ma(l);var d=L(l,2);O(c),R(e=>{W(i,z(u).length?`Found on this Mac, or paste a link to one on GitHub. Koppler never changes the original.`:`Paste a link to its stack.json on GitHub. Koppler keeps a copy here and never changes the original.`),d.disabled=e},[()=>z(a)||!z(o).trim()]),V(`click`,n,()=>{f(`start`)}),B(`submit`,c,e=>{e.preventDefault(),z(o).trim()&&p({link:z(o).trim()})}),Sa(l,()=>z(o),e=>N(o,e)),U(e,t)},S=e=>{var t=QO(),n=F(t),r=L(n,6),i=P(r),o=L(P(i));ma(o),O(i);var u=L(i,2),d=L(P(u)),p=P(d);K(p,18,()=>z(l),e=>e,(e,t,n)=>{var r=ZO(),i=P(r,!0),a=L(i),o=e=>{U(e,XO())};G(a,e=>{z(n)===0&&z(l).length>1&&e(o)});var s=L(a,2);X(P(s),{get of(){return to},size:14}),O(s),O(r),R(()=>{W(i,t),q(s,`aria-label`,`Remove ${t??``}`)}),V(`click`,s,()=>N(l,z(l).filter(e=>e!==t),!0)),U(e,r)});var _=L(p,2);ma(_),O(d),je(2),O(u);var v=L(u,2);O(r),R(()=>{q(_,`placeholder`,z(l).length?`Add another`:`Type one, e.g. qa, and press Enter`),v.disabled=z(a)}),V(`click`,n,()=>{f(`start`)}),B(`submit`,r,g),Sa(o,()=>z(s),e=>N(s,e)),V(`keydown`,_,h),B(`blur`,_,()=>{z(c).trim()&&m(z(c))}),Sa(_,()=>z(c),e=>N(c,e)),U(e,t)};G(y,e=>{z(r)===`start`?e(b):z(r)===`join`?e(x,1):e(S,-1)});var C=I(L(y,2),!0);return O(v),Ma(v,e=>N(n,e),()=>z(n)),R(()=>W(C,z(i))),B(`cancel`,v,e=>{z(r)===`start`?Z.setup&&e.preventDefault():(e.preventDefault(),f(`start`))}),U(e,v),A(_)}Zr([`click`,`keydown`]);var tk=new Set([`$$slots`,`$$events`,`$$legacy`]);function nk(e,t){let n=J(t,tk),r={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var rk=H(`<p class="svelte-ujai35"> </p>`),ik=H(`<button class="act svelte-ujai35" type="button">Reload</button>`),ak=H(`<button class="act svelte-ujai35" type="button" title="Propose it as a team board of the stack: a pull request on the stack's repo">Share with team</button> <button class="act svelte-ujai35" type="button" title="Delete"><!></button>`,1),ok=H(`<div class="row svelte-ujai35"><button type="button" class="svelte-ujai35"><span class="name svelte-ujai35"> </span><span class="meta svelte-ujai35"> </span></button> <!> <!></div>`),sk=H(`<!> <!>`,1),ck=H(`<p class="none svelte-ujai35">No boards yet. A board is kept as soon as it has an app.</p>`),lk=H(`<form class="svelte-ujai35"><input type="text" aria-label="Name of this board" maxlength="80" class="svelte-ujai35"/> <button type="submit" class="svelte-ujai35">Rename</button></form>`),uk=H(`<button type="submit" class="svelte-ujai35">Open</button>`),dk=H(`<button type="button" class="svelte-ujai35">Open a file…</button>`),fk=H(`<div class="row gone svelte-ujai35"><span class="name svelte-ujai35"> </span><span class="meta svelte-ujai35"> </span> <button class="act svelte-ujai35" type="button">Restore</button></div>`),pk=H(`<details class="svelte-ujai35"><summary class="svelte-ujai35"> </summary> <!></details>`),mk=H(`<button type="button" aria-haspopup="dialog"><span class="name svelte-ujai35"> </span></button> <div class="menu svelte-ujai35" popover="" role="dialog" tabindex="-1" aria-label="Boards"><!> <!> <div class="strip svelte-ujai35"><div class="acts svelte-ujai35"><button type="button" class="svelte-ujai35">New board</button> <button type="button" class="svelte-ujai35">Duplicate</button></div> <!> <form class="svelte-ujai35"><input type="text" aria-label="Open a board from a link" placeholder="Paste a GitHub link to a board file" class="svelte-ujai35"/> <!></form> <input type="file" accept=".json,application/json" hidden=""/> <p role="status"> </p></div> <!></div>`,1);function hk(e,t){let n=li();k(t,!0);let r=`Or drop a board .json file anywhere on the page.`,i=M(void 0),a=M(void 0),o=M(void 0),s=M(!1),c=M(``),l=M(``),u=M(pn({text:r,warn:!1})),d=M(!1),f=j(()=>Z.own.some(e=>e.name===Z.name)),p=async(e,t)=>{let n=await Vb(e);$.show(n?`Cannot reload ${t}. ${n}`:`Reloaded ${t} from ${e}.`,n?`warning`:`message`)},m=j(()=>!z(f)&&Z.team.some(e=>e.name===Z.name)),h=j(()=>Z.name??(Z.scratch&&Z.nodes[0]?`${Z.nodes[0].data.name} alone`:`New board`)),g=()=>[...z(a)?.querySelectorAll(`.row > button:first-child`)??[]],_=()=>z(a)?.hidePopover(),y=()=>{let e=z(i)?.getBoundingClientRect();e&&z(a)&&(z(a).style.top=`${String(e.bottom+4)}px`,z(a).style.left=`${String(e.left)}px`,z(a).style.width=`${String(Math.max(e.width,Math.min(400,innerWidth-e.left-12)))}px`,(z(a).querySelector(`[aria-current="true"]`)??g()[0])?.focus())},b=e=>{e.newState===`open`&&(N(c,Z.name??``,!0),N(l,``),N(u,{text:r,warn:!1},!0))},x=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`||e.target.matches(`input`))return;e.preventDefault();let t=g();t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},S=e=>{_(),e.name!==Z.name&&zb(e)},C=e=>{let t=Object.keys(e.nodes).length;return`${String(t)} ${t===1?`app`:`apps`}`},w=e=>{e.preventDefault();let t=Z.rename(z(c));t?N(u,{text:t,warn:!0},!0):_()},ee=async e=>{_();let t=Z.forTeam(e),n=await Xs(`board-share`,{preset:t,check:!0});if(`error`in n){$.show(`Could not share ${e.name}: ${n.error}`,`warning`);return}let r=Z.team.some(t=>t.name===e.name);Yb.review={title:`Share ${e.name} with the team`,sub:n.repo?`Opens a pull request on ${n.repo} that ${r?`updates this team board`:`adds this board to the team boards`}. Your team gets it once the pull request is merged; nothing on this Mac changes.`:`This stack is not on GitHub, so the board is ${r?`updated`:`added`} among the team boards in its file here. Commit the stack so your team gets it.`,notices:[],groups:[{verb:`keeps`,label:r?`Updates`:`Adds`,items:[{name:e.name,notes:[]}]}],ok:n.repo?`Open pull request`:`Add to team boards`,prod:!1,blocked:!1,confirm:()=>{n.repo&&$.show(`Opening the pull request…`),Xs(`board-share`,{preset:t}).then(n=>{if(`error`in n)$.show(`Could not share ${e.name}: ${n.error}`,`warning`);else if(n.url)$.show(`Pull request opened for ${e.name}`,`message`,{label:`View`,run:()=>window.open(n.url,`_blank`,`noopener`)});else{let n=Z.team.findIndex(t=>t.name===e.name);Z.keptForTeam(n<0?Z.team.length:n,t),$.show(`${e.name} is a team board now. Commit the stack's repo, so your team gets it.`)}})}}},T=e=>{_();let t=e.edges.length,n=Z.name===e.name;Yb.review={title:`Delete board "${e.name}"?`,sub:`${C(e)} and ${String(t)} ${t===1?`cable`:`cables`}, with their branches and notes.${n?` It is the board on screen, so the screen empties.`:``}`,notices:[{text:`It moves to Recently deleted at the bottom of the board menu, where you can restore it.`}],groups:[],ok:`Delete board`,prod:!0,blocked:!1,confirm:()=>{Z.deleteBoard(e.name),$.show(`Deleted ${e.name}`)}}},te=async e=>{if(e.preventDefault(),!z(l).trim()||z(d))return;N(d,!0),N(u,{text:`Opening…`,warn:!1},!0);let t=await Vb(z(l).trim());N(d,!1),t?N(u,{text:t,warn:!0},!0):_()};var E=mk(),ne=F(E);let re;var ie=I(P(ne),!0);O(ne),Ma(ne,e=>N(i,e),()=>z(i));var ae=L(ne,2),oe=P(ae);K(oe,17,()=>[[`Team boards`,Z.team],[`Your boards`,Z.own]],([e,t])=>e,(e,t)=>{var n=j(()=>v(z(t),2));let r=()=>z(n)[0],i=()=>z(n)[1];var a=sk(),o=F(a),s=e=>{var t=rk(),n=I(t,!0);R(()=>W(n,r())),U(e,t)};G(o,e=>{i().length&&e(s)}),K(L(o,2),17,i,e=>e.name,(e,t)=>{var n=ok(),r=P(n),a=P(r),o=I(a,!0),s=I(L(a),!0);O(r);var c=L(r,2),l=e=>{let n=j(()=>z(t).source);var r=ik();R(()=>{q(r,`aria-label`,`Reload ${z(t).name??``}`),q(r,`title`,`Read it again from ${z(n)??``}`)}),V(`click`,r,()=>void p(z(n),z(t).name)),U(e,r)},u=j(()=>i()===Z.own&&typeof z(t).source==`string`&&/^(https?:|\/)/.test(z(t).source));G(c,e=>{z(u)&&e(l)});var d=L(c,2),f=e=>{var n=ak(),r=F(n),i=L(r,2);X(P(i),{get of(){return to},size:14}),O(i),R(()=>{q(r,`aria-label`,`Share ${z(t).name??``} with the team`),q(i,`aria-label`,`Delete ${z(t).name??``}`)}),V(`click`,r,()=>void ee(z(t))),V(`click`,i,()=>{T(z(t))}),U(e,n)};G(d,e=>{i()===Z.own&&e(f)}),O(n),R(e=>{q(r,`aria-current`,z(t).name===Z.name),q(r,`title`,typeof z(t).source==`string`?`Opened from ${z(t).source}`:void 0),W(o,z(t).name),W(s,e)},[()=>C(z(t))]),V(`click`,r,()=>{S(z(t))}),U(e,n)}),U(e,a)});var se=L(oe,2),ce=e=>{U(e,ck())};G(se,e=>{!Z.team.length&&!Z.own.length&&e(ce)});var le=L(se,2),ue=P(le),de=P(ue),fe=L(de,2);O(ue);var pe=L(ue,2),me=e=>{var t=lk(),n=P(t);ma(n);var r=L(n,2);O(t),R(e=>r.disabled=e,[()=>z(c).trim()===Z.name]),B(`submit`,t,w),Sa(n,()=>z(c),e=>N(c,e)),U(e,t)};G(pe,e=>{z(f)&&e(me)});var he=L(pe,2),ge=P(he);ma(ge);var _e=L(ge,2),ve=e=>{var t=uk();R(()=>t.disabled=z(d)),U(e,t)},ye=j(()=>z(l).trim()),be=e=>{var t=dk();V(`click`,t,()=>z(o)?.click()),U(e,t)};G(_e,e=>{z(ye)?e(ve):e(be,-1)}),O(he);var xe=L(he,2);Ma(xe,e=>N(o,e),()=>z(o));var Se=L(xe,2);let Ce;var we=I(Se,!0);O(le);var Te=L(le,2),Ee=e=>{var t=pk(),n=P(t),r=I(n);K(L(n,2),17,()=>Z.trash,e=>e.name+e.deleted,(e,t)=>{var n=fk(),r=P(n),i=I(r,!0),a=L(r),o=I(a,!0),s=L(a,2);O(n),R(e=>{q(r,`title`,z(t).name),W(i,z(t).name),W(o,e),q(s,`aria-label`,`Restore ${z(t).name??``}`)},[()=>Ub(z(t).deleted)]),V(`click`,s,()=>{Z.restore(z(t))}),U(e,n)}),O(t),R(()=>W(r,`Recently deleted (${Z.trash.length??``})`)),U(e,t)};G(Te,e=>{Z.trash.length&&e(Ee)}),O(ae),Ma(ae,e=>N(a,e),()=>z(a)),R(()=>{re=Ji(ne,1,`picker svelte-ujai35`,null,re,{chosen:!!Z.name}),q(ne,`aria-label`,`Board: ${z(h)??``}`),q(ne,`aria-expanded`,z(s)),q(ne,`title`,z(f)?`Your board, saved on this Mac as you change it`:z(m)?`Team board, from the stack. Changing it makes a copy of your own.`:`Saved as soon as it has an app`),q(ne,`popovertarget`,n),W(ie,z(h)),q(ae,`id`,n),fe.disabled=!Z.nodes.length,Ce=Ji(Se,1,`hint svelte-ujai35`,null,Ce,{warn:z(u).warn}),W(we,z(u).text)}),V(`keydown`,ae,x),B(`beforetoggle`,ae,b),B(`toggle`,ae,e=>{N(s,e.newState===`open`),z(s)&&y()}),V(`click`,de,()=>{_(),Z.newBoard()}),V(`click`,fe,()=>{_(),Z.duplicate()}),B(`submit`,he,te),Sa(ge,()=>z(l),e=>N(l,e)),V(`change`,xe,()=>{_(),Bb(z(o)?.files?.[0]),z(o)&&(z(o).value=``)}),U(e,E),A()}Zr([`keydown`,`click`,`change`]);var gk=H(`<li class="svelte-3tqys6"><strong> </strong> <small class="svelte-3tqys6"> </small> <!></li>`),_k=H(`<small class="svelte-3tqys6"> </small>`),vk=H(`<div class="gap svelte-3tqys6"><strong> </strong> <!> <button type="button" class="svelte-3tqys6"> </button></div>`),yk=H(`<button class="all svelte-3tqys6" type="button"> </button>`),bk=H(`<li class="gaps svelte-3tqys6"><h3 class="svelte-3tqys6"> </h3> <p class="svelte-3tqys6">Koppler never uses another environment's sign-ins, tunnels or secret steps instead.</p> <!> <!></li>`),xk=H(`<button class="open svelte-3tqys6" type="button" aria-haspopup="dialog"> </button> <div class="pop svelte-3tqys6" popover="" role="dialog" tabindex="-1"><h2 class="svelte-3tqys6">What this stack needs on this Mac</h2> <ul class="svelte-3tqys6"><!> <!></ul></div>`,1);function Sk(e,t){let n=li();k(t,!0);let r=M(void 0),i=M(void 0),a=M(pn([])),o=j(()=>(Q.status?.checks??[]).filter(e=>e.state!==`ok`)),s=j(()=>z(o).filter(e=>e.state!==`gap`)),c=j(()=>z(o).filter(e=>e.state===`gap`)),l=j(()=>[...new Set(z(c).map(e=>e.env??``))]),u=(e,t,n)=>`${String(e)} ${e===1?t:n}`,d=j(()=>{let e=z(s).filter(e=>e.state===`missing`).length,t=z(s).length-e;return[e&&`${String(e)} missing on this Mac`,t&&`${u(t,`check waits`,`checks wait`)} for your approval`,z(c).length&&`${String(z(c).length)} ${z(l).map(e=>e.toUpperCase()).join(` and `)} ${z(c).length===1?`fact`:`facts`} missing from the stack`].filter(Boolean).join(`, `)}),f=e=>e.state===`pending`?`koppler doctor --approve`:/^(brew|npm|xcode-select|nvm|pip|curl) /.test(e.detail??``)?e.detail??null:null,p=e=>e.for?.length?`needed by ${e.for.join(`, `)}`:``,m=e=>e.state===`pending`?`A check written into this stack. It is a command, so it runs only after you have seen it. In your own terminal:`:f(e)?`Missing${p(e)?`, ${p(e)}`:``}. Install it with:`:`${e.detail??``}${p(e)?` (${p(e)})`:``}`,h=Z.nameOf,g=e=>[...new Set(z(c).filter(t=>t.env===e).map(e=>e.app??``))],_=(e,t)=>z(c).filter(n=>n.env===e&&(!t||n.app===t)),v=e=>(e.detail??``).replace(`for ${h(e.app??``)}'s `,`for its `).replace(` for ${h(e.app??``)}`,``),y=async(e,t)=>{await Yb.askFacts(e,_(e,t).map(e=>e.detail??``))&&N(a,[...z(a),`${e}|${t??``}`],!0)},b=()=>{let e=z(r)?.getBoundingClientRect();e&&z(i)&&(z(i).style.left=`${String(Math.max(12,e.left))}px`,z(i).style.bottom=`${String(innerHeight-e.top+6)}px`)};var x=ci(),S=F(x),C=e=>{var t=xk(),o=F(t),c=I(o,!0);Ma(o,e=>N(r,e),()=>z(r));var u=L(o,2),p=P(u),x=L(p,2),S=P(x);K(S,17,()=>z(s),e=>e.name,(e,t)=>{let n=j(()=>f(z(t)));var r=gk(),i=P(r),a=I(i,!0),o=L(i,2),s=I(o,!0),c=L(o,2),l=e=>{Lc(e,{get command(){return z(n)}})};G(c,e=>{z(n)&&e(l)}),O(r),R(e=>{W(a,z(t).name),W(s,e)},[()=>m(z(t))]),U(e,r)}),K(L(S,2),16,()=>z(l),e=>e,(e,t)=>{var n=bk(),r=P(n),i=I(r),o=L(r,4);K(o,16,()=>g(t),e=>e,(e,n)=>{var r=vk(),i=P(r),o=I(i,!0),s=L(i,2);K(s,17,()=>_(t,n),e=>e.detail,(e,t)=>{var n=_k(),r=I(n,!0);R(e=>W(r,e),[()=>v(z(t))]),U(e,n)});var c=L(s,2),l=I(c,!0);O(r),R((e,t,n)=>{W(o,e),c.disabled=t,W(l,n)},[()=>h(n),()=>z(a).includes(`${t}|${n}`),()=>z(a).includes(`${t}|${n}`)?`Sent to the agent`:`Ask the agent to find it`]),V(`click`,c,()=>void y(t,n)),U(e,r)});var s=L(o,2),c=e=>{var n=yk(),r=I(n,!0);R((e,t)=>{n.disabled=e,W(r,t)},[()=>z(a).includes(`${t}|`),()=>z(a).includes(`${t}|`)?`Sent to the agent`:`Ask the agent to find all ${String(g(t).length)}`]),V(`click`,n,()=>void y(t)),U(e,n)},l=j(()=>g(t).length>1);G(s,e=>{z(l)&&e(c)}),O(n),R(e=>W(i,`Missing from the stack for ${e??``}`),[()=>t.toUpperCase()]),U(e,n)}),O(x),O(u),Ma(u,e=>N(i,e),()=>z(i)),R(()=>{q(o,`popovertarget`,n),W(c,z(d)),q(u,`id`,n),q(u,`aria-labelledby`,`${n}-title`),q(p,`id`,`${n}-title`)}),B(`toggle`,u,e=>{e.newState===`open`&&b()}),U(e,t)};G(S,e=>{z(o).length&&e(C)}),U(e,x),A()}Zr([`click`]);var Ck=H(`<button class="do svelte-159ihlv" type="button">Connect</button>`),wk=H(`<div class="note svelte-159ihlv" role="note"><span> </span> <button class="x svelte-159ihlv" type="button" aria-label="Dismiss this note"><!></button> <!></div>`),Tk=H(`<div class="notes svelte-159ihlv" role="group" aria-label="About this board"></div>`);function Ek(e,t){k(t,!0);let n=Z.nameOf,r=j(()=>Fs(Z.plan,n).filter(e=>!e.includes(` share one `)).map(e=>({key:`ports:${e}`,text:e}))),i=j(()=>Z.cards.flatMap(({id:e})=>Z.deployedCalls(e).filter(e=>Z.cards.some(t=>t.id===e.id)).map(t=>({key:`unwired:${e}>${t.id}`,text:`${t.name} is on your board, but ${n(e)} still calls the ${Z.env.toUpperCase()} one.`,cable:{from:e,to:t.id}})))),a=j(()=>[...z(r),...z(i)].filter(e=>!Z.dismissed.includes(e.key)));var o=ci(),s=F(o),c=e=>{var t=Tk();K(t,21,()=>z(a),e=>e.key,(e,t)=>{let n=j(()=>z(t).cable);var r=wk(),i=P(r),a=I(i,!0),o=L(i,2);X(P(o),{get of(){return to},size:14}),O(o);var s=L(o,2),c=e=>{var t=Ck();V(`click`,t,()=>{Z.connect(z(n).from,z(n).to)}),U(e,t)};G(s,e=>{z(n)&&e(c)}),O(r),R(()=>W(a,z(t).text)),V(`click`,o,()=>{Z.dismissed=[...Z.dismissed,z(t).key]}),U(e,r)}),O(t),U(e,t)};G(s,e=>{z(a).length&&!Z.live&&e(c)}),U(e,o),A()}Zr([`click`]);var Dk=H(`<label class="svelte-1vh52u"><input type="radio" name="env" class="svelte-1vh52u"/> </label>`),Ok=H(`<span class="count svelte-1vh52u"> </span>`),kk=H(`<span class="live svelte-1vh52u" role="img"> </span>`),Ak=H(`<button class="main svelte-1vh52u" type="button" title="Show its card"><span class="name svelte-1vh52u"> </span></button> <!> <button class="act remove svelte-1vh52u" type="button" title="Remove from the board"><!></button>`,1),jk=H(`<button class="main svelte-1vh52u" type="button"><span class="name svelte-1vh52u"> </span></button> <span class="state svelte-1vh52u">outside</span> <button class="act drop svelte-1vh52u" type="button" title="Remove from the stack (the repo stays on your Mac)"><!></button>`,1),Mk=H(`<button class="main svelte-1vh52u" type="button"><span class="name svelte-1vh52u"> </span></button> <span class="state svelte-1vh52u">not cloned</span> <button class="act drop svelte-1vh52u" type="button" title="Remove from the stack (the repo stays on your Mac)"><!></button>`,1),Nk=H(`<button class="main svelte-1vh52u" type="button" draggable="true"><span class="name svelte-1vh52u"> </span></button> <button class="act drop svelte-1vh52u" type="button" title="Remove from the stack (the repo stays on your Mac)"><!></button> <button class="act alone svelte-1vh52u" type="button" title="Run alone: just this app and its tunnels, on a board of its own"><!></button> <button class="act add svelte-1vh52u" type="button" title="Add to the board"><!></button>`,1),Pk=H(`<div role="listitem"><!> <!></div>`),Fk=H(`<p class="empty svelte-1vh52u"> </p>`),Ik=H(`<p class="unsaved svelte-1vh52u" role="alert">Not saved: the canvas server is not answering. Changes stay on this page.</p>`),Lk=H(`<div class="warn svelte-1vh52u">The canvas server runs older code, so some buttons fail until it restarts. Run this in your terminal: <!></div>`),Rk=H(`<div class="clone svelte-1vh52u" role="note" aria-label="Not cloned"><p class="svelte-1vh52u"> </p> <span class="acts svelte-1vh52u"><button class="do svelte-1vh52u" type="button"> </button> <button type="button" class="svelte-1vh52u"> </button></span></div>`),zk=H(`<aside aria-label="Board and apps"><div class="head svelte-1vh52u"><!> <div class="seg svelte-1vh52u" role="radiogroup" aria-label="Environment"></div></div> <section aria-labelledby="apps-title" class="svelte-1vh52u"><h2 id="apps-title" class="svelte-1vh52u">Apps <!> <button class="sort svelte-1vh52u" type="button"><!> </button></h2> <input class="search svelte-1vh52u" type="search" placeholder="Find or filter: a name, .net, lambda" aria-label="Find an app by name or kind" autocomplete="off" spellcheck="false"/> <div class="apps svelte-1vh52u" role="list"></div> <div class="adds svelte-1vh52u"><button class="add-repos svelte-1vh52u" type="button">Add repos…</button> <button class="add-repos svelte-1vh52u" type="button">Add outside system…</button></div> <p class="note svelte-1vh52u" role="status"> </p> <!></section> <footer class="svelte-1vh52u"><!> <!> <!> <!> <!></footer></aside>`);function Bk(e,t){k(t,!0);let n=[],r=M(pn((()=>{try{return localStorage.getItem(`koppler-sort`)===`added`?`added`:`name`}catch{return`name`}})())),i=M(``),a=M(``),o=j(()=>[...Z.cards.map(e=>e.id),...Z.infra.filter(e=>e.type===`outside`).map(e=>e.id.slice(8))]),s=e=>{let t=z(i).trim().toLowerCase(),n=e=>e.toLowerCase().replace(/^\./,``);return!t||e.name.toLowerCase().includes(t)||n(e.kindLabel).startsWith(n(t))},c=j(()=>{let e=e=>z(o).includes(e.id)?z(o).indexOf(e.id):Z.apps.indexOf(e),t=(t,n)=>z(r)===`name`?t.name.localeCompare(n.name):e(t)-e(n),n=e=>+!z(o).includes(e.id);return Z.apps.filter(s).sort((e,r)=>n(e)-n(r)||t(e,r))}),l=j(()=>z(c).find(e=>!z(o).includes(e.id))),u=j(()=>z(r)===`name`?`Sorted by name. Click to sort by when each was added.`:`Sorted by when each was added. Click to sort by name.`),d=()=>{N(r,z(r)===`name`?`added`:`name`,!0);try{localStorage.setItem(`koppler-sort`,z(r))}catch{}},f=j(()=>Z.roots.map(e=>e.replace(/^\/Users\/[^/]+/,`~`)).join(`, `)),p=j(()=>Z.apps.filter(e=>!e.cloned&&!e.outside)),m=j(()=>z(p).length>3?`${z(p).slice(0,2).map(e=>e.name).join(`, `)} and ${String(z(p).length-2)} more`:new Intl.ListFormat(`en`,{type:`conjunction`}).format(z(p).map(e=>e.name))),h=M(!1),g=async()=>{let e=z(p).map(b).join(`
|
|
39
|
+
`);try{await navigator.clipboard.writeText(e),N(h,!0),setTimeout(()=>N(h,!1),2e3)}catch{N(a,`Copy is blocked here: ${e}`)}},_=M(!1),v=async()=>{N(_,!0);let e=await Xs(`rescan`);N(_,!1),`error`in e?$.show(e.error,`warning`):location.reload()},y=e=>{Yb.review={title:`Remove ${e.name} from the stack?`,sub:`The repo stays on your Mac. Other apps stop listing it as something they call.`,notices:[],groups:[],ok:`Remove from stack`,prod:!0,blocked:!1,confirm:()=>{Xs(`apps-remove`,{id:e.id}).then(e=>{`error`in e?$.show(e.error,`warning`):location.reload()})}}},b=e=>`git clone git@github.com:${e.slug}.git`,x=async e=>{try{await navigator.clipboard.writeText(b(e)),N(a,`Clone command for ${e.name} copied.`)}catch{N(a,`Copy is blocked here: ${b(e)}`)}};var S=zk();let C;var w=P(S),ee=P(w);hk(ee,{});var T=L(ee,2);K(T,20,()=>Z.envs,e=>e,(e,t)=>{var r=Dk(),i=P(r);ma(i);var a,o=L(i,1,!0);O(r),R(e=>{a!==(a=t)&&(i.value=(i.__value=a)??``),W(o,e)},[()=>t.toUpperCase()]),wa(n,[],i,()=>Z.env,e=>Z.env=e),U(e,r)}),O(T),O(w);var te=L(w,2),E=P(te),ne=L(P(E)),re=e=>{var t=Ok(),n=I(t);R(()=>W(n,`${z(o).length??``} of ${Z.apps.length??``} on the board`)),U(e,t)};G(ne,e=>{Z.apps.length&&e(re)});var ie=L(ne,2),ae=P(ie);X(ae,{get of(){return nk},size:11});var oe=L(ae);O(ie),O(E);var se=L(E,2);ma(se);var ce=L(se,2);K(ce,21,()=>z(c),e=>e.id,(e,t,n,r)=>{let i=j(()=>z(o).includes(z(t).id)),a=j(()=>!!z(t).outside||!z(t).cloned);var s=Pk();let u;var d=P(s);sE(d,{get kind(){return z(t).kind},get label(){return z(t).kindLabel}});var p=L(d,2),m=e=>{let n=j(()=>Q.up(z(t).id));var r=Ak(),i=F(r),a=I(P(i),!0);O(i);var o=L(i,2),s=e=>{var t=kk(),r=I(t,!0);R(()=>{q(t,`data-on`,z(n)),q(t,`aria-label`,z(n)?`Running`:`Not answering`),W(r,z(n)?``:`!`)}),U(e,t)};G(o,e=>{z(n)!==null&&e(s)});var c=L(o,2);X(P(c),{get of(){return to},size:11}),O(c),R(()=>{W(a,z(t).name),q(c,`aria-label`,`Remove ${z(t).name??``} from the board`)}),V(`click`,i,()=>{Z.show(z(t).outside?`outside:${z(t).id}`:z(t).id)}),V(`click`,c,()=>{z(t).outside?Z.showOutside(z(t).id,!1):Z.remove(z(t).id)}),U(e,r)},h=e=>{var n=jk(),r=F(n),i=I(P(r),!0);O(r);var a=L(r,4);X(P(a),{get of(){return go},size:12}),O(a),R(()=>{q(r,`title`,`Does not run on this Mac: ${z(t).outside??``}. Click to put its card on the board; it never runs.`),W(i,z(t).name),q(a,`aria-label`,`Remove ${z(t).name??``} from the stack`)}),V(`click`,r,()=>{Z.showOutside(z(t).id,!0)}),V(`click`,a,()=>{y(z(t))}),U(e,n)},g=e=>{var n=Mk(),r=F(n),i=I(P(r),!0);O(r);var a=L(r,4);X(P(a),{get of(){return go},size:12}),O(a),R(()=>{q(r,`title`,`Not cloned under ${z(f)??``}. Click to copy the clone command.`),W(i,z(t).name),q(a,`aria-label`,`Remove ${z(t).name??``} from the stack`)}),V(`click`,r,()=>x(z(t))),V(`click`,a,()=>{y(z(t))}),U(e,n)},_=e=>{var n=Nk(),r=F(n),i=I(P(r),!0);O(r);var a=L(r,2);X(P(a),{get of(){return go},size:12}),O(a);var o=L(a,2);X(P(o),{get of(){return so},size:12,filled:!0}),O(o);var s=L(o,2);X(P(s),{get of(){return Ly},size:12}),O(s),R(()=>{q(r,`title`,`Add ${z(t).name??``} to the board: click, or drag it there`),W(i,z(t).name),q(a,`aria-label`,`Remove ${z(t).name??``} from the stack`),q(o,`aria-label`,`Run ${z(t).name??``} alone`),q(s,`aria-label`,`Add ${z(t).name??``} to the board`)}),B(`dragstart`,r,e=>{e.dataTransfer?.setData(`text/app`,z(t).id)}),V(`click`,r,()=>{Z.add(z(t).id)}),V(`click`,a,()=>{y(z(t))}),V(`click`,o,()=>{Yb.alone(z(t).id)}),V(`click`,s,()=>{Z.add(z(t).id)}),U(e,n)};G(p,e=>{z(i)?e(m):z(t).outside?e(h,1):z(t).cloned?e(_,-1):e(g,2)}),O(s),R(()=>u=Ji(s,1,`app svelte-1vh52u`,null,u,{on:z(i),missing:z(a),"first-off":z(t)===z(l)&&z(t)!==z(c)[0]})),U(e,s)},e=>{var t=Fk(),n=I(t,!0);R(()=>W(n,Z.apps.length?`No app matches.`:`No apps in this stack yet.`)),U(e,t)}),O(ce);var le=L(ce,2),ue=P(le),de=L(ue,2);O(le);var fe=L(le,2),pe=I(fe,!0);Ek(L(fe,2),{}),O(te);var me=L(te,2),he=P(me),ge=e=>{U(e,Ik())};G(he,e=>{Z.unsaved&&e(ge)});var _e=L(he,2),ve=e=>{var t=Lk();Lc(L(P(t)),{get command(){return Q.status.restart},label:`Copy restart command`}),O(t),U(e,t)};G(_e,e=>{Q.status?.restart&&e(ve)});var ye=L(_e,2),be=e=>{var t=Rk(),n=P(t),r=I(n),i=L(n,2),a=P(i),o=I(a,!0),s=L(a,2),c=I(s,!0);O(i),O(t),R(()=>{W(r,`${z(m)??``}
|
|
40
|
+
${z(p).length===1?`is`:`are`} not cloned on this Mac, so ${z(p).length===1?`it`:`they`} cannot
|
|
41
|
+
run here. Koppler looks for clones in ${z(f)??``}.`),W(o,z(h)?`Copied`:z(p).length===1?`Copy clone command`:`Copy clone commands`),s.disabled=z(_),W(c,z(_)?`Looking…`:`Look again`)}),V(`click`,a,()=>void g()),V(`click`,s,()=>void v()),U(e,t)};G(ye,e=>{z(p).length&&e(be)});var xe=L(ye,2);Sk(xe,{}),rT(L(xe,2),{}),O(me),O(S),R(()=>{C=Ji(S,1,`svelte-1vh52u`,null,C,{protected:Z.protected}),q(ie,`title`,z(u)),q(ie,`aria-label`,z(u)),W(oe,` ${z(r)===`name`?`Az`:`Added`}`),W(pe,z(a))}),V(`click`,ie,d),Sa(se,()=>z(i),e=>N(i,e)),V(`click`,ue,()=>void Wb.repos?.open()),V(`click`,de,()=>Wb.outside?.open()),U(e,S),A()}Zr([`click`]);var Vk=H(`<button type="button" role="menuitemradio" class="svelte-njiuyh"><span class="check svelte-njiuyh" aria-hidden="true"></span> <span class="name svelte-njiuyh"> </span> <span class="meta svelte-njiuyh"> </span></button>`),Hk=H(`<span class="meta svelte-njiuyh"> </span>`),Uk=H(`<button type="button" role="menuitem" class="svelte-njiuyh"><span class="ico svelte-njiuyh" aria-hidden="true"> </span> <span class="name svelte-njiuyh"> </span> <!></button>`),Wk=H(`<span class="slash svelte-njiuyh" aria-hidden="true">/</span> <button class="picker svelte-njiuyh" type="button" aria-haspopup="menu"><span class="name svelte-njiuyh"> </span></button> <div class="menu svelte-njiuyh" popover="" role="menu" tabindex="-1" aria-label="Stacks"><!> <div class="more svelte-njiuyh"></div></div>`,1);function Gk(e,t){let n=li();k(t,!0);let r=M(void 0),i=M(void 0),a=M(!1),o=j(()=>Q.status?.stacks??[]),s=j(()=>Q.status?.linked),c=j(()=>[...z(s)?[{icon:`↻`,label:`Check for updates from GitHub`,count:0,run:()=>void GO.updateStack()}]:[],...z(s)?.changes.length?[{icon:`●`,label:`Changes not shared yet`,count:z(s).changes.length,run:()=>{GO.shareChanges()}}]:[],...Z.apps.length?[{icon:`⌕`,label:`Look through the repos again`,count:0,run:()=>void Wb.findings?.open()}]:[],{icon:`+`,label:`Add a stack: new, or from GitHub`,count:0,run:()=>{GO.addStack(()=>Wb.setup?.open())}}]),l=()=>[...z(i)?.querySelectorAll(`button:not(:disabled)`)??[]],u=()=>{let e=z(r)?.getBoundingClientRect();e&&z(i)&&(z(i).style.top=`${String(e.bottom+4)}px`,z(i).style.left=`${String(e.left)}px`,l()[0]?.focus())},d=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=l();t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()};var f=Wk(),p=L(F(f),2),m=I(P(p),!0);O(p),Ma(p,e=>N(r,e),()=>z(r));var h=L(p,2),g=P(h);K(g,17,()=>z(o),e=>e.dir,(e,t)=>{let n=j(()=>z(t).dir===Z.dir),r=j(()=>z(n)?Z.apps.length:z(t).apps);var a=Vk(),o=L(P(a),2),s=I(o,!0),c=I(L(o,2));O(a),R(()=>{q(a,`aria-checked`,z(n)),a.disabled=z(n),q(a,`title`,z(t).path),W(s,z(t).name),W(c,`${z(t).linked?`from GitHub`:z(t).shared?`shared`:`private`}, ${z(r)??``}
|
|
42
|
+
${z(r)===1?`app`:`apps`}`)}),V(`click`,a,()=>{z(i)?.hidePopover(),GO.useStack(z(t))}),U(e,a)});var _=L(g,2);K(_,21,()=>z(c),e=>e.label,(e,t)=>{var n=Uk(),r=P(n),a=I(r,!0),o=L(r,2),s=I(o,!0),c=L(o,2),l=e=>{var n=Hk(),r=I(n,!0);R(()=>W(r,z(t).count)),U(e,n)};G(c,e=>{z(t).count&&e(l)}),O(n),R(()=>{W(a,z(t).icon),W(s,z(t).label)}),V(`click`,n,()=>{z(i)?.hidePopover(),z(t).run()}),U(e,n)}),O(_),O(h),Ma(h,e=>N(i,e),()=>z(i)),R(()=>{q(p,`aria-expanded`,z(a)),q(p,`title`,`${Z.stack??``}: switch to another stack`),q(p,`popovertarget`,n),W(m,Z.stack),q(h,`id`,n)}),V(`keydown`,h,d),B(`toggle`,h,e=>{N(a,e.newState===`open`),z(a)&&u()}),U(e,f),A()}Zr([`keydown`,`click`]);var Kk=H(`<button class="action svelte-ieajqw" type="button"> </button>`),qk=H(`<div><span class="text svelte-ieajqw"> </span> <!> <!> <button class="close svelte-ieajqw" type="button" aria-label="Dismiss"><!></button></div>`);function Jk(e,t){k(t,!0);let n=M(!1),r=async e=>{await navigator.clipboard.writeText(e).catch(()=>void 0),N(n,!0),setTimeout(()=>N(n,!1),1500)};var i=ci(),a=F(i),o=e=>{let t=j(()=>$.now);var i=qk();let a;var o=P(i),s=I(o,!0),c=L(o,2),l=e=>{var n=Kk(),r=I(n,!0);R(()=>W(r,z(t).action.label)),V(`click`,n,()=>{z(t).action.run(),$.hide()}),U(e,n)};G(c,e=>{z(t).action&&e(l)});var u=L(c,2),d=e=>{var i=Kk(),a=I(i,!0);R(()=>W(a,z(n)?`Copied`:`Copy`)),V(`click`,i,()=>r(z(t).text)),U(e,i)};G(u,e=>{z(t).warning&&e(d)});var f=L(u,2);X(P(f),{get of(){return to},size:14}),O(f),O(i),R(()=>{a=Ji(i,1,`toast svelte-ieajqw`,null,a,{warning:z(t).warning}),q(i,`role`,z(t).warning?`alert`:`status`),W(s,z(t).text)}),V(`click`,f,()=>{$.hide()}),U(e,i)};G(a,e=>{$.now&&e(o)}),U(e,i),A()}Zr([`click`]);var Yk=H(`<!> <button class="side-toggle gear svelte-1jciobo" type="button" aria-label="Stack settings" title="Stack settings: its environments, apps, queues, sign-ins and team boards"><!></button> <span> </span>`,1),Xk=H(`<!><!>`,1),Zk=H(`<!><!><!>`,1),Qk=H(`<span class="split svelte-1jciobo"><button class="stop svelte-1jciobo" type="button" aria-label="Stop"><!> <span class="words">Stop</span></button> <!></span> <span class="split svelte-1jciobo"><button class="run svelte-1jciobo" type="button">Run</button> <!></span>`,1),$k=H(`<div class="dropping svelte-1jciobo">Drop to open this board</div>`),eA=H(`<div class="banner svelte-1jciobo" role="alert"> </div>`),tA=H(`<div class="loading svelte-1jciobo" role="status"><p class="svelte-1jciobo"><span class="dot svelte-1jciobo" aria-hidden="true"></span><span class="what svelte-1jciobo"> </span></p></div>`),nA=H(`<!> <div class="stage svelte-1jciobo"><div class="work svelte-1jciobo"><div class="board svelte-1jciobo"><!> <!></div> <!></div> <!></div>`,1),rA=H(`<div class="empty svelte-1jciobo"><p class="svelte-1jciobo">No stack yet. Run this in your terminal, then open the canvas again.</p> <!></div>`),iA=H(`<header><button class="side-toggle svelte-1jciobo" type="button"><!></button> <span class="title svelte-1jciobo">Koppler</span> <!> <span class="spacer svelte-1jciobo"></span> <!> <!> <!> <!></header> <!> <!> <!> <!> <!> <!> <!> <!> <!> <dialog class="noting svelte-1jciobo" aria-labelledby="noting-title"><form method="dialog" class="svelte-1jciobo"><label id="noting-title" for="run-note" class="svelte-1jciobo">Note for the agent</label> <textarea id="run-note" rows="3" required="" placeholder="e.g. log in as the test account, or turn on the new checkout" class="svelte-1jciobo"></textarea> <div class="noting-acts svelte-1jciobo"><button type="button" class="svelte-1jciobo">Cancel</button> <button class="go svelte-1jciobo" type="submit">Review and send</button></div></form></dialog> <!> <div class="work svelte-1jciobo"><!> <main class="svelte-1jciobo"><!></main> <!></div>`,1);function aA(e,t){k(t,!0);let n=M(!1),r=e=>!!e.dataTransfer?.types.includes(`Files`),i=e=>{r(e)&&N(n,!0)},a=e=>{r(e)&&e.preventDefault()},o=e=>{e.relatedTarget||N(n,!1)},s=e=>{r(e)&&(e.preventDefault(),N(n,!1),Bb(e.dataTransfer?.files[0]))},c=M(void 0),l=M(``);In(()=>{Ay.follow()});let u=j(()=>GO.switching??(Q.status?.loading&&Q.status.loading!==Z.dir?Q.status.loading:null)),d=j(()=>Q.status?.stacks?.find(e=>e.dir===z(u))?.name??`the stack`);In(()=>{let e=Q.status?.stack;if(e&&Z.dir&&e!==Z.dir){try{if(Number(sessionStorage.getItem(`koppler-stack-reload`))>Date.now()-1e4)return;sessionStorage.setItem(`koppler-stack-reload`,String(Date.now()))}catch{return}location.reload()}});let f=qs().then(e=>{if(e){if(Z.open(e),Q.watch(),location.hash.startsWith(`#board=`)){let e=decodeURIComponent(location.hash.slice(7)).toLowerCase(),t=[...Z.own,...Z.team].find(t=>t.name.toLowerCase()===e);history.replaceState(null,``,location.pathname+location.search),t&&t.name!==Z.name&&Z.openBoard(t)}Z.setup?Wb.setup?.open():(!Z.apps.length||location.hash===`#pick`)&&(history.replaceState(null,``,location.pathname+location.search),Wb.repos?.open())}return!!e}),p=``,m=``,h,g=(e=!1)=>{clearTimeout(h),Z.commit();let t=Z.saved(),n=JSON.stringify(t);n!==p&&n!==m&&(m=n,Ys(t,e).then(e=>{m=``,Z.unsaved=!e,e?p=n:h=setTimeout(g,2e3)}))},_=j(()=>JSON.stringify([Z.env,Z.queues,Z.hiddenQueues,Z.hiddenOutside,Z.pinned,Z.cards.map(e=>[e.id,e.data.hideTunnels,e.data.showQueues])]));In(()=>{z(_)&&Z.stack&&Nr(()=>{Z.syncInfra()})}),In(()=>{Z.settle()});let y={};In(()=>{let e=Q.status?.boardEdits??[];Z.stack&&!Z.live&&Nr(()=>{for(let t of e.filter(e=>!y[e.id])){y[t.id]=!0;let e=Z.nameOf;if(t.preset){let e=Z.importBoards(t.preset,typeof t.preset.source==`string`?t.preset.source:t.board);$.show(e.error===void 0?`Opened ${t.board} from the terminal.`:`Cannot open ${t.board}. ${e.error}`,e.error===void 0?`message`:`warning`)}else Z.edit(t.board,t.edit,t.create)&&$.show(t.create?`The agent made a board, ${t.board}.`:`The agent changed ${t.board}: ${Gs(t.edit,e)}.`);Xs(`board-edit-done`,{id:t.id})}})}),In(()=>{Z.stack&&Bx.record()});let b;In(()=>{let e=Q.status?.refresh;e!==void 0&&(b!==void 0&&e!==b&&Nr(()=>Z.reload()),b=e)}),In(()=>{if(Z.changes.length&&Z.stack)return Nr(()=>{Z.commit(),p?h=setTimeout(g,400):p=JSON.stringify(Z.saved())}),()=>{clearTimeout(h)}});let x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&Z.nodes.length&&!Yb.review&&(e.preventDefault(),Yb.start())},S=M(pn((()=>{try{return localStorage.getItem(`koppler-side`)!==`hidden`}catch{return!0}})())),C=!1;In(()=>{let e=matchMedia(`(max-width: 1100px)`),t=()=>{Nr(()=>{e.matches&&z(S)?(e=>{var t=v(e,2);C=t[0],N(S,t[1],!0)})([!0,!1]):!e.matches&&!z(S)&&C&&(e=>{var t=v(e,2);C=t[0],N(S,t[1],!0)})([!1,!0])})};return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}});let w=M(void 0),ee=()=>{z(w)&&(z(w).classList.remove(`compact`),z(w).classList.toggle(`compact`,z(w).scrollWidth>z(w).clientWidth+1))};In(()=>{if(!z(w))return;let e=new ResizeObserver(ee);return e.observe(z(w)),()=>{e.disconnect()}}),In(()=>{let e=`${Z.stack}${Q.status?.running?.join()??``}`;requestAnimationFrame(()=>{e&&ee()})});let T=()=>{C=!1,N(S,!z(S));try{localStorage.setItem(`koppler-side`,z(S)?`open`:`hidden`)}catch{}};In(()=>{let e=e=>{e.target instanceof Element&&e.target.closest(`.svelte-flow`)||e.preventDefault()},t=t=>{t.ctrlKey&&e(t)};return window.addEventListener(`wheel`,t,{passive:!1}),window.addEventListener(`gesturestart`,e),()=>{window.removeEventListener(`wheel`,t),window.removeEventListener(`gesturestart`,e)}});let te=async e=>{T(),e&&(await Ar(),document.querySelector(`aside button[aria-label^="Board:"]`)?.focus())};var E=iA();B(`fullscreenchange`,_n,()=>{!document.fullscreenElement&&!Z.entering&&(Z.present=!1)}),B(`keydown`,gn,x),B(`pagehide`,gn,()=>{g(!0)}),B(`dragenter`,gn,i),B(`dragover`,gn,a),B(`dragleave`,gn,o),B(`drop`,gn,s);var ne=F(E);let re;var ie=P(ne);X(P(ie),{get of(){return Ac},size:16}),O(ie);var ae=L(ie,4),oe=e=>{var t=Yk(),n=F(t);Gk(n,{});var r=L(n,2);Fc(P(r),{size:16}),O(r);var i=L(r,2);let a;var o=I(i,!0);R(e=>{a=Ji(i,1,`env svelte-1jciobo`,null,a,{prod:Z.protected}),W(o,e)},[()=>Z.env.toUpperCase()]),V(`click`,r,()=>void Wb.settings?.open({title:`${Z.stack} settings`,path:``})),U(e,t)};G(ae,e=>{Z.stack&&e(oe)});var se=L(ae,4),ce=e=>{var t=Xk(),n=F(t);fC(n,{}),Ny(L(n),{}),U(e,t)};G(se,e=>{Z.stack&&e(ce)});var le=L(se,2),ue=e=>{var t=Zk(),n=F(t);mw(n,{});var r=L(n);gw(r,{}),PS(L(r),{}),U(e,t)};G(le,e=>{Z.stack&&e(ue)});var de=L(le,2);gC(de,{});var fe=L(de,2),pe=e=>{var t=Qk(),n=F(t),r=P(n);X(P(r),{get of(){return Mc},size:12,filled:!0}),je(2),O(r);var i=L(r,2);{let e=j(()=>[{label:`Stop apps, keep changes`,about:Yb.started.length?`Stops every app, API and tunnel; branches and code changes stay until you revert`:`Nothing is running`,off:!Yb.started.length,run:()=>{Yb.stopApps()}},{label:`Revert temporary changes`,about:Yb.left.length?`Undoes what the last run left: branches back, temporary edits gone`:`Nothing to revert`,off:!Yb.left.length,run:()=>{Yb.stop()}},{label:`Shut down Koppler`,about:`Stops the agent listener and this canvas server; apps and tunnels keep running`,danger:!0,run:()=>{Yb.shutDown()}}]);Vw(i,{label:`More ways to stop`,tone:`stop`,get items(){return z(e)}})}O(n);var a=L(n,2),o=P(a),s=L(o,2),l=e=>{Vw(e,{label:`More ways to run`,tone:`run`,items:[{label:`Run with a note for the agent…`,about:`Tell the agent something for this run, like a test account or a flag`,run:()=>{z(c)?.showModal()}},{label:`Get a checklist instead`,about:`The agent changes nothing and lists the steps for you to do yourself`,run:()=>{Yb.start({manual:!0})}}]})};G(s,e=>{Z.nodes.length&&e(l)}),O(a),R(()=>{n.inert=!!z(u),r.disabled=!Yb.started.length,q(r,`title`,Yb.started.length?`Stop what the agent started and revert all temporary code changes`:`Nothing is running`),a.inert=!!z(u),o.disabled=!Z.nodes.length,q(o,`title`,Z.nodes.length?`Review what will run, then send it (Cmd or Ctrl + Enter)`:`Add an app to the board first`)}),V(`click`,r,()=>{Yb.stop()}),V(`click`,o,()=>{Yb.start()}),U(e,t)};G(fe,e=>{Z.stack&&e(pe)}),O(ne),Ma(ne,e=>N(w,e),()=>z(w));var me=L(ne,2),he=e=>{U(e,$k())};G(me,e=>{z(n)&&e(he)});var ge=L(me,2);WO(ge,{});var _e=L(ge,2);Ma(ek(_e,{}),e=>Wb.setup=e,()=>Wb?.setup);var ve=L(_e,2);Ma(EO(ve,{}),e=>Wb.repos=e,()=>Wb?.repos);var ye=L(ve,2);Ma(lT(ye,{}),e=>Wb.outside=e,()=>Wb?.outside);var be=L(ye,2);Ma(vO(be,{}),e=>Wb.settings=e,()=>Wb?.settings);var xe=L(be,2);Ma(QS(xe,{}),e=>Wb.findings=e,()=>Wb?.findings);var Se=L(xe,2);Ma(GS(Se,{}),e=>Wb.checklist=e,()=>Wb?.checklist);var Ce=L(Se,2);Ma(Oc(Ce,{}),e=>Wb.command=e,()=>Wb?.command);var we=L(Ce,2),Te=P(we),Ee=L(P(Te),2);vt(Ee);var D=L(Ee,2),De=P(D);je(2),O(D),O(Te),O(we),Ma(we,e=>N(c,e),()=>z(c));var Oe=L(we,2),ke=e=>{var t=eA(),n=I(t);R((e,t)=>W(n,`${e??``}: local code runs against real ${t??``} data and secrets.`),[()=>Z.env.toUpperCase(),()=>Z.env.toUpperCase()]),U(e,t)};G(Oe,e=>{Z.protected&&e(ke)});var Ae=L(Oe,2),Me=P(Ae),Ne=e=>{var t=tA(),n=P(t),r=I(L(P(n)));O(n),O(t),R(()=>W(r,`Loading ${z(d)??``}...`)),U(e,t)};G(Me,e=>{z(u)&&e(Ne)});var Pe=L(Me,2);Si(P(Pe),()=>f,null,(e,t)=>{var n=ci(),r=F(n),i=e=>{var t=nA(),n=F(t),r=e=>{},i=e=>{Bk(e,{})},a=e=>{oT(e,{open:te})};G(n,e=>{Z.present?e(r):z(S)?e(i,1):e(a,-1)});var o=L(n,2),s=P(o),c=P(s),l=P(c);ny(l,{children:(e,t)=>{uS(e,{})},$$slots:{default:!0}}),Jk(L(l,2),{}),O(c);var u=L(c,2),d=e=>{dT(e,{})};G(u,e=>{Z.present||e(d)}),O(s);var f=L(s,2),p=e=>{Iw(e,{})};G(f,e=>{Z.present||e(p)}),O(o),U(e,t)},a=e=>{var t=rA();Lc(L(P(t),2),{command:`koppler init`}),O(t),U(e,t)};G(r,e=>{z(t)?e(i):e(a,-1)}),U(e,n)}),O(Pe);var Fe=L(Pe,2),Ie=e=>{RC(e,{})};G(Fe,e=>{Z.present||e(Ie)}),O(Ae),R(()=>{q(ne,`hidden`,Z.present),re=Ji(ne,1,`svelte-1jciobo`,null,re,{protected:Z.protected}),q(ie,`aria-expanded`,z(S)),q(ie,`aria-label`,z(S)?`Hide the side pane`:`Show the side pane`),q(ie,`title`,z(S)?`Hide the side pane`:`Show the side pane`),Pe.inert=!!z(u)}),V(`click`,ie,T),B(`close`,we,()=>N(l,``)),B(`submit`,Te,()=>{Yb.start({note:z(l).trim()})}),Sa(Ee,()=>z(l),e=>N(l,e)),V(`click`,De,()=>z(c)?.close()),U(e,E),A()}Zr([`click`]),gc.watch();var oA=document.getElementById(`app`);oA&&mi(aA,{target:oA});
|