koppler 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.built +1 -1
- package/dist/cli/running.js +5 -3
- package/dist/cli/running.js.map +1 -1
- package/dist/core/stack.js +16 -2
- package/dist/core/stack.js.map +1 -1
- package/dist/core/terraform.js +78 -7
- package/dist/core/terraform.js.map +1 -1
- package/dist/engine/deployed.js +71 -8
- package/dist/engine/deployed.js.map +1 -1
- package/dist/page/assets/index-cGqfl7Ue.js +43 -0
- package/dist/page/assets/index-e6-Jk1nK.css +1 -0
- package/dist/page/index.html +2 -2
- package/dist/server/routes.js +0 -18
- package/dist/server/routes.js.map +1 -1
- package/dist/server/sanitize.js +12 -0
- package/dist/server/sanitize.js.map +1 -1
- package/package.json +1 -1
- package/skills/koppler-run/VERSION +1 -1
- package/skills/koppler-run/references/research.md +13 -0
- package/skills/koppler-run/references/stack.md +4 -3
- package/dist/page/assets/index-B0cSsUor.js +0 -43
- package/dist/page/assets/index-DxC9KFhp.css +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
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,T=16384,ee=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 De=!1;function Oe(e){De=e}var ke;function Ae(e){if(e===null)throw we(),ye;return ke=e}function je(){return Ae(Tn(ke))}function D(e){if(De){if(Tn(ke)!==null)throw we(),ye;ke=e}}function Me(e=1){if(De){for(var t=e,n=ke;t--;)n=Tn(n);ke=n}}function Ne(e=!0){for(var t=0,n=ke;;){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=Tn(n);e&&n.remove(),n=i}}function Pe(e){if(!e||e.nodeType!==8)throw we(),ye;return e.data}function Fe(e){return e===this.v}function Ie(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Le(e){return!Ie(e,this.v)}function Re(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function ze(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Be(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ve(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function He(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ue(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function We(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ge(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Ke(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function qe(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Je(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ye(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Xe=!1;function Ze(){Xe=!0}var Qe=[];function $e(e,t=!1,n=!1){return et(e,new Map,``,Qe,null,n)}function et(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]=et(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]=et(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 et(t.toJSON(),n,r,i,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}function tt(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return t?.c??null}function nt(e,t){return e===null&&Re(t),e.c??=new Map(tt(e)||void 0)}var rt=null;function it(e){rt=e}function at(e){return nt(rt,`getContext`).get(e)}function ot(e,t){return nt(rt,`setContext`).set(e,t),t}function st(e){return nt(rt,`hasContext`).has(e)}function O(e,t=!1,n){rt={p:rt,i:!1,c:null,e:null,s:e,x:null,r:dr,l:Xe&&!t?{s:null,u:null,$:[]}:null}}function k(e){var t=rt,n=t.e;if(n!==null){t.e=null;for(var r of n)Rn(r)}return e!==void 0&&(t.x=e),t.i=!0,rt=t.p,ct(e)}function ct(e={}){return i(e,le,{value:!0}),e}function lt(){return!Xe||rt!==null&&rt.l===null}var ut=[];function dt(){var e=ut;ut=[],h(e)}function ft(e){if(ut.length===0&&!Ht){var t=ut;queueMicrotask(()=>{t===ut&&dt()})}ut.push(e)}function pt(){for(;ut.length>0;)dt()}var mt=~(S|C|x);function ht(e,t){e.f=e.f&mt|t}function gt(e){e.f&512||e.deps===null?ht(e,x):ht(e,C)}function _t(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ht(e,x)}function vt(e,t){if(t){let t=document.body;e.autofocus=!0,ft(()=>{document.activeElement===t&&e.focus()})}}function yt(e){De&&wn(e)!==null&&En(e)}var bt=!1;function xt(){bt||(bt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ge]?.()})},{capture:!0}))}function St(e){var t=cr,n=dr;ur(null),fr(null);try{return e()}finally{ur(t),fr(n)}}function Ct(e,t,n,r=n){e.addEventListener(t,()=>St(n));let i=e[ge];e[ge]=i?()=>{i(),r(!0)}:()=>r(!0),xt()}function wt(e,t,n,r){let i=lt()?Ot:jt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=dr,c=Tt(),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){jn(e,s)}Et()}}var d=Dt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>At(e))).then(u).catch(e=>jn(e,s)).finally(d)}l?l.then(()=>{s.f&16384?d():(c(),f(),Et())}):f()}function Tt(){var e=dr,t=cr,n=rt,r=Rt;return function(i=!0){fr(e),ur(t),it(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Et(e=!0){fr(null),ur(null),it(null),e&&Rt?.deactivate()}function Dt(){var e=dr,t=e.b,n=Rt,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 Ot(e){var t=2|S;return dr!==null&&(dr.f|=ne),{ctx:rt,deps:null,effects:null,equals:Fe,f:t,fn:e,reactions:null,rv:0,v:be,wv:0,parent:dr,ac:null}}var kt=Symbol(`obsolete`);function At(e,t,n){let r=dr;r===null&&ze();var i=void 0,a=on(be),o=!cr,s=new Set;return Un(()=>{var t=dr,n=g();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==_e&&n.reject(e)}).finally(Et)}catch(e){n.reject(e),Et()}var c=Rt;if(o){if(t.f&32768)var l=Dt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(kt);else for(let e of s.values())e.reject(kt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==kt&&(c.activate(),t?(a.f|=se,un(a,t)):(a.f&8388608&&(a.f^=se),un(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),In(()=>{for(let e of s)e.reject(kt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function A(e){let t=Ot(e);return mr(t),t}function jt(e){let t=Ot(e);return t.equals=Le,t}function Mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Zn(t[n])}}function Nt(e){var t,n=dr,r=e.parent;if(!or&&r!==null&&e.v!==be&&r.f&24576)return Ce(),e.v;fr(r);try{Mt(e),t=Er(e)}finally{fr(n)}return t}function Pt(e){var t=Nt(e);!e.equals(t)&&(e.wv=Cr(),(!Rt?.is_fork||e.deps===null)&&(Rt===null?e.v=t:(Rt.capture(e,t,!0),zt?.capture(e,t,!0)),e.deps===null))?ht(e,x):or||(Bt===null?gt(e):(Fn()||Rt?.is_fork)&&Bt.set(e,t))}function Ft(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&St(()=>{t.ac.abort(_e),t.ac=null}),t.fn!==null&&(t.teardown=f),kr(t,0),Yn(t))}function It(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Ar(t)}var Lt=null,Rt=null,zt=null,Bt=null,Vt=null,Ht=!1,Ut=!1,Wt=null,Gt=null,Kt=0,qt=1,Jt=class e{id=qt++;#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(){Lt===null?Lt=this:(Lt.#n=this,this.#t=Lt),Lt=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)ht(r,S),t(r);for(r of n.m)ht(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),ht(e,S),this.schedule(e);for(let e of this.#d)ht(e,C),this.schedule(e);this.apply();for(var t=Wt=[],n=[],r=Gt=[];this.#c.length>0;){Kt++>1e3&&(this.#S(),Xt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw tn(e),this.#h()||this.discard(),t}}if(Rt=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Wt=null,Gt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)en(e,t);r.length>0&&Rt.#_();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(),zt=this,Qt(n),Qt(t),zt=null,this.#s?.resolve();var o=Rt;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&&(rn.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):wr(r)&&(i&16&&this.#d.add(r),Ar(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),ht(i,S),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),Rt=this,this.#_()}#x(e){for(var t=0;t<e.length;t+=1)_t(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]),Bt?.set(e,t)),this.is_fork||(e.v=t)}activate(){Rt=this}deactivate(){Rt=null,Bt=null}flush(){try{Ut=!0,Rt=this,this.#_()}finally{Kt=0,Vt=null,Wt=null,Gt=null,Ut=!1,Rt=null,Bt=null,rn.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(kt);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,ft(()=>{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(Rt===null){let t=Rt=new e;!Ut&&!Ht&&ft(()=>{t.#e||t.flush()})}return Rt}apply(){Bt=null}schedule(e){Vt=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?Lt=e:t.#t=e,this.linked=!1}}};function Yt(e){var t=Ht,n=zt;zt=null,Ht=!0;try{var r;for(e&&(Yt(),r=e());;){if(pt(),Rt===null)return r;Rt.flush()}}finally{Ht=t,zt=n}}function Xt(){try{We()}catch(e){jn(e,Vt)}}var Zt=null;function Qt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&wr(r)&&(Zt=new Set,Ar(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&$n(r),Zt?.size>0)){rn.clear();for(let e of Zt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Zt.has(n)&&(Zt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Ar(n)}}Zt.clear()}}Zt=null}}function $t(e){Rt.schedule(e)}function en(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ht(e,x);for(var n=e.first;n!==null;)en(n,t),n=n.next}}function tn(e){ht(e,x);for(var t=e.first;t!==null;)tn(t),t=t.next}var nn=new Set,rn=new Map,an=!1;function on(e,t){return{f:0,v:e,reactions:null,equals:Fe,rv:0,wv:0}}function j(e,t){let n=on(e,t);return mr(n),n}function sn(e,t=!1,n=!0){let r=on(e);return t||(r.equals=Le),Xe&&n&&rt!==null&&rt.l!==null&&(rt.l.s??=[]).push(r),r}function M(e,t,n=!1){return cr!==null&&(!lr||cr.f&131072)&<()&&cr.f&4325394&&(pr===null||!pr.has(e))&&Je(),un(e,n?mn(t):t,Gt)}var cn=null,ln=0;function un(e,t,n=null){if(!e.equals(t)){or?rn.set(e,t):rn.has(e)||rn.set(e,e.v);var r=Jt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Nt(t),Bt===null&>(t)}e.wv=Cr(),cn=null,ln=0,pn(e,S,n),cn=null,lt()&&dr!==null&&dr.f&1024&&!(dr.f&96)&&(_r===null?vr([e]):_r.push(e)),!r.is_fork&&nn.size>0&&!an&&dn()}return t}function dn(){an=!1;for(let e of nn){e.f&1024&&ht(e,C);let t;try{t=wr(e)}catch{t=!0}t&&Ar(e)}nn.clear()}function fn(e){M(e,e.v+1)}function pn(e,t,n){var r=e.reactions;if(r!==null){var i=lt(),a=r.length;if(ln+=a,ln>1e5&&cn===null&&(cn=new Set),cn!==null){if(cn.has(e))return;cn.add(e)}for(var o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==dr){var l=(c&S)===0;if(l&&ht(s,t),c&131072)nn.add(s);else if(c&2){var u=s;Bt?.delete(u),pn(u,C,n)}else if(l){var d=s;c&16&&Zt!==null&&Zt.add(d),n===null?$t(d):n.push(d)}}}}}function mn(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=j(0),u=null,d=xr,f=e=>{if(xr===d)return e();var t=cr,n=xr;ur(null),Sr(d);var r=e();return ur(t),Sr(n),r};return i&&r.set(`length`,j(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Ke();var i=r.get(t);return i===void 0?f(()=>{var e=j(n.value,u);return r.set(t,e),e}):M(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>j(be,u));r.set(t,e),fn(o)}}else M(n,be),fn(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(()=>j(mn(s?e[n]:be),u)),r.set(n,o)),o!==void 0){var c=R(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=R(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||dr!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>j(i?mn(e[t]):be,u)),r.set(t,n)),R(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(()=>j(be,u)),r.set(d+``,p)):M(p,be)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>j(void 0,u)),M(c,mn(n)),r.set(t,c));else{l=c.v!==be;var m=f(()=>mn(n));M(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&&M(g,_+1)}fn(o)}return!0},ownKeys(e){R(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(){qe()}})}function hn(e){try{if(typeof e==`object`&&e&&ce in e)return e[ce]}catch{}return e}function gn(e,t){return Object.is(hn(e),hn(t))}var _n,vn,yn,bn,xn;function Sn(){if(_n===void 0){_n=window,vn=document,yn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;bn=a(t,`firstChild`).get,xn=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 Cn(e=``){return document.createTextNode(e)}function wn(e){return bn.call(e)}function Tn(e){return xn.call(e)}function N(e,t){if(!De)return wn(e);var n=wn(ke);if(n===null)n=ke.appendChild(Cn());else if(t&&n.nodeType!==3){var r=Cn();return n?.before(r),Ae(r),r}return t&&kn(n),Ae(n),n}function P(e,t=!1){if(!De){var n=wn(e);return n instanceof Comment&&n.data===``?Tn(n):n}if(t){if(ke?.nodeType!==3){var r=Cn();return ke?.before(r),Ae(r),r}kn(ke)}return ke}function F(e,t=!1){if(!De)return wn(e);var n=N(e,t);return D(e),n}function I(e,t=1,n=!1){let r=De?ke:e;for(var i;t--;)i=r,r=Tn(r);if(!De)return r;if(n){if(r?.nodeType!==3){var a=Cn();return r===null?i?.after(a):r.before(a),Ae(a),a}kn(r)}return Ae(r),r}function En(e){e.textContent=``}function Dn(){return!1}function On(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 kn(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 An(e){var t=dr;if(t===null)return cr.f|=se,e;if(!(t.f&32768)&&!(t.f&4))throw e;jn(e,t)}function jn(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 Mn(e){dr===null&&(cr===null&&Ue(e),He()),or&&Ve(e)}function Nn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Pn(e,t){var n=dr;n!==null&&n.f&8192&&(e|=w);var r={ctx:rt,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};Rt?.register_created_effect(r);var i=r;if(e&4)Wt===null?Jt.ensure().schedule(r):Wt.push(r);else if(t!==null){try{Ar(r)}catch(e){throw Zn(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&&Nn(i,n),cr!==null&&cr.f&2&&!(e&64))){var a=cr;(a.effects??=[]).push(i)}return r}function Fn(){return cr!==null&&!lr}function In(e){let t=Pn(8,null);return ht(t,x),t.teardown=e,t}function Ln(e){Mn(`$effect`);var t=dr.f;if(!cr&&t&32&&rt!==null&&!rt.i){var n=rt;(n.e??=[]).push(e)}else return Rn(e)}function Rn(e){return Pn(4|re,e)}function zn(e){return Mn(`$effect.pre`),Pn(8|re,e)}function Bn(e){Jt.ensure();let t=Pn(64|ne,e);return()=>{Zn(t)}}function Vn(e){Jt.ensure();let t=Pn(64|ne,e);return(e={})=>new Promise(n=>{e.outro?er(t,()=>{Zn(t),n(void 0)}):(Zn(t),n(void 0))})}function Hn(e){return Pn(4,e)}function Un(e){return Pn(oe|ne,e)}function Wn(e,t=0){return Pn(8|t,e)}function L(e,t=[],n=[],r=[]){wt(r,t,n,t=>{Pn(8,()=>{e(...t.map(R))})})}function Gn(e,t=0){return Pn(16|t,e)}function Kn(e,t=0){return Pn(b|t,e)}function qn(e){return Pn(32|ne,e)}function Jn(e){var t=e.teardown;if(t!==null){let n=or,r=cr;sr(!0),ur(null);try{t.call(null)}catch(t){jn(t,e.parent)}finally{sr(n),ur(r)}}}function Yn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&St(()=>{e.abort(_e)});var r=n.next;n.f&64?n.parent=null:Zn(n,t),n=r}}function Xn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Zn(t),t=n}}function Zn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Qn(e.nodes.start,e.nodes.end),n=!0),e.f|=te,Yn(e,t&&!n),kr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Jn(e),e.f^=te,e.f|=T;var i=e.parent;i!==null&&i.first!==null&&$n(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Qn(e,t){for(;e!==null;){var n=e===t?null:Tn(e);e.remove(),e=n}}function $n(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 er(e,t,n=!0){var r=[];e.f|=256,tr(e,r,!0);var i=()=>{n&&Zn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function tr(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);tr(i,t,o?n:!1)}i=a}}}function nr(e){e.f&=-257,rr(e,!0)}function rr(e,t){if(!(e.f&256)&&e.f&8192){e.f^=w,e.f&1024||(ht(e,S),Jt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);rr(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 ir(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Tn(n);t.append(n),n=i}}var ar=null,or=!1;function sr(e){or=e}var cr=null,lr=!1;function ur(e){cr=e}var dr=null;function fr(e){dr=e}var pr=null;function mr(e){cr!==null&&(cr.f&2097152||cr.f&2)&&(pr??=new Set).add(e)}var hr=null,gr=0,_r=null;function vr(e){_r=e}var yr=1,br=0,xr=br;function Sr(e){xr=e}function Cr(){return++yr}function wr(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(wr(a)&&Pt(a),a.wv>e.wv)return!0}t&512&&Bt===null&&ht(e,x)}return!1}function Tr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(pr!==null&&pr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Tr(a,t,!1):t===a&&(n?ht(a,S):a.f&1024&&ht(a,C),$t(a))}}function Er(e){var t=hr,n=gr,r=_r,i=cr,a=pr,o=rt,s=lr,c=xr,l=e.f;hr=null,gr=0,_r=null,cr=l&96?null:e,pr=null,it(e.ctx),lr=!1,xr=++br,e.ac!==null&&(St(()=>{e.ac.abort(_e)}),e.ac=null);try{e.f|=ae;var u=e.fn,d=u();e.f|=ee;var f=Dr(e);if(lt()&&_r!==null&&!lr&&f!==null&&!(e.f&6146))for(var p=0;p<_r.length;p++)Tr(_r[p],e);if(i!==null&&i!==e){if(br++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=br;if(t!==null)for(let e of t)e.rv=br;_r!==null&&(r===null?r=_r:r.push(..._r))}return e.f&8388608&&(e.f^=se),d}catch(t){return Dr(e),An(t)}finally{e.f^=ae,hr=t,gr=n,_r=r,cr=i,pr=a,it(o),lr=s,xr=c}}function Dr(e){var t=e.deps,n=Rt?.is_fork;if(hr!==null){var r;if(n||kr(e,gr),t!==null&&gr>0)for(t.length=gr+hr.length,r=0;r<hr.length;r++)t[gr+r]=hr[r];else e.deps=t=hr;if(Fn()&&e.f&512)for(r=gr;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&gr<t.length&&(kr(e,gr),t.length=gr);return t}function Or(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&&(hr===null||!n.call(hr,r))){var s=r;s.f&512&&(s.f^=512),s.v!==be&>(s),s.ac!==null&&St(()=>{s.ac.abort(_e),s.ac=null,ht(s,S)}),Ft(s),kr(s,0)}}function kr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Or(e,n[r])}function Ar(e){var t=e.f;if(!(t&16384)){ht(e,x);var n=dr;dr=e;try{t&16777232?Xn(e):Yn(e),Jn(e);var r=Er(e);e.teardown=typeof r==`function`?r:null,e.wv=yr}finally{dr=n}}}async function jr(){await Promise.resolve(),Yt()}function R(e){var t=!!(e.f&2);if(ar?.add(e),cr!==null&&!lr&&!(dr!==null&&dr.f&16384)&&(pr===null||!pr.has(e))){var r=cr.deps;if(cr.f&2097152)e.rv<br&&(e.rv=br,hr===null&&r!==null&&r[gr]===e?gr++:hr===null?hr=[e]:hr.push(e));else{cr.deps??=[],n.call(cr.deps,e)||cr.deps.push(e);var i=e.reactions;i===null?e.reactions=[cr]:n.call(i,cr)||i.push(cr)}}if(or&&rn.has(e))return rn.get(e);if(t){var a=e;if(or){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Nr(a))&&(o=Nt(a)),rn.set(a,o),o}var s=!(a.f&512)&&!lr&&cr!==null&&!!(cr.f&512),c=(a.f&ee)===0;wr(a)&&(s&&(a.f|=512),Pt(a)),s&&!c&&(It(a),Mr(a))}if(Bt?.has(e))return Bt.get(e);if(e.f&8388608)throw e.v;return e.v}function Mr(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)&&(It(r),Mr(r))}}function Nr(e){if(e.v===be)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(rn.has(t)||t.f&2&&Nr(t))return!0;return!1}function Pr(e){var t=lr;try{return lr=!0,e()}finally{lr=t}}function Fr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(ce in e)Ir(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&ce in n&&Ir(n)}}}function Ir(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{Ir(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 Lr(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var Rr=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function zr(e){return Rr.includes(e)}var Br=`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(`.`),Vr={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 Hr(e){return e=e.toLowerCase(),Vr[e]??e}[...Br];var Ur=[`touchstart`,`touchmove`];function Wr(e){return Ur.includes(e)}var Gr=[`textarea`,`script`,`style`,`title`];function Kr(e){return Gr.includes(e)}var qr=Symbol(`events`),Jr=new Set,Yr=new Set;function Xr(e,t,n,r={}){function i(e){if(r.capture||ti.call(t,e),!e.cancelBubble)return St(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,ft(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Zr(e,t,n,r={}){var i=Xr(t,e,n,r);return()=>{i.__removed=!0,e.removeEventListener(t,i,r)}}function z(e,t,n,r,i){var a={capture:r,passive:i},o=Xr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&In(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function B(e,t,n){(t[qr]??={})[e]=n}function Qr(e){for(var t=0;t<e.length;t++)Jr.add(e[t]);for(var n of Yr)n(e)}var $r=null,ei=!1;function ti(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;$r=e,ei||(ei=!0,setTimeout(()=>{ei=!1,$r=null}));var s=0,c=$r===e&&e[qr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[qr]=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=cr,f=dr;ur(null),fr(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[qr]?.[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[qr]=t,delete e.currentTarget,ur(d),fr(f)}}}var ni=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ri(e){return ni?.createHTML(e)??e}function ii(e){var t=On(`template`);return t.innerHTML=ri(e.replaceAll(`<!>`,`<!---->`)),t.content}function ai(e,t){var n=dr;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function V(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(De)return ai(ke,null),ke;i===void 0&&(i=ii(a?e:`<!>`+e),n||(i=wn(i)));var t=r||yn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=wn(t),s=t.lastChild;ai(o,s)}else ai(t,t);return t}}function oi(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=!!(t&1),a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(De)return ai(ke,null),ke;if(!o){var e=wn(ii(a));if(i)for(o=document.createDocumentFragment();wn(e);)o.appendChild(wn(e));else o=wn(e)}var t=o.cloneNode(!0);if(i){var n=wn(t),r=t.lastChild;ai(n,r)}else ai(t,t);return t}}function si(e,t){return oi(e,t,`svg`)}function ci(e=``){if(!De){var t=Cn(e+``);return ai(t,t),t}var n=ke;return n.nodeType===3?kn(n):(n.before(n=Cn()),Ae(n)),ai(n,n),n}function li(){if(De)return ai(ke,null),ke;var e=document.createDocumentFragment(),t=document.createComment(``),n=Cn();return e.append(t,n),ai(t,n),e}function H(e,t){if(De){var n=dr;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=ke),je()}else e!==null&&e.before(t)}function ui(){if(De&&ke&&ke.nodeType===8&&ke.textContent?.startsWith(`$`)){let e=ke.textContent.substring(1);return je(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function di(e){let t=0,n=on(0),r;return()=>{Fn()&&(R(n),Wn(()=>(t===0&&(r=Pr(()=>e(()=>fn(n)))),t+=1,()=>{ft(()=>{--t,t===0&&(r?.(),r=void 0,fn(n))})})))}}var fi=E|ne;function pi(e,t,n,r){new mi(e,t,n,r)}var mi=class{parent;is_pending=!1;transform_error;#e;#t=De?ke: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=di(()=>(this.#m=on(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=dr;t.b=this,t.f|=128,n(e)},this.parent=dr.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Gn(()=>{if(De){let e=Pe(this.#t);je();let t=e===`[!`;if(e.startsWith(`[?`)){let t=JSON.parse(e.slice(2));this.#_(t)}else t?this.#b():this.#g()}else this.#x()},fi),De&&(this.#e=ke)}#g(){try{this.#a=qn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);ft(r),t&&(this.#s=qn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{this.#y()||(t?Ee():(t=!0,n&&Ye(),this.#s!==null&&er(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){jn(e,this.#i&&this.#i.parent)}}}}#y(){return(this.#i.f&(T|te))!==0}#b(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=qn(()=>e(this.#e)),ft(()=>{if(!this.#y()){var e=this.#c=document.createDocumentFragment(),t=Cn(),n=!1;e.append(t),this.#a=this.#C(()=>{try{return qn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){jn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#S(Rt)):this.#u===0&&(this.#e.before(e),this.#c=null,er(this.#o,()=>{this.#o=null}),this.#S(Rt))}}))}#x(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=qn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ir(this.#a,e);let t=this.#n.pending;this.#o=qn(()=>t(this.#e))}else this.#S(Rt)}catch(e){this.error(e)}}#S(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){_t(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=dr,n=cr,r=rt;fr(this.#i),ur(this.#i),it(this.#i.ctx);try{return Jt.ensure(),e()}finally{fr(t),ur(n),it(r)}}#w(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#S(t),this.#o&&er(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,ft(()=>{this.#d=!1,this.#m&&un(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),R(this.#m)}error(e){if(e===ye||!this.#n.onerror&&!this.#n.failed)throw e;Rt?.is_fork?(this.#a&&Rt.skip_effect(this.#a),this.#o&&Rt.skip_effect(this.#o),this.#s&&Rt.skip_effect(this.#s),Rt.oncommit(()=>{this.#y()||this.#T(e)})):this.#T(e)}#T(e){this.#a&&=(Zn(this.#a),null),this.#o&&=(Zn(this.#o),null),this.#s&&=(Zn(this.#s),null),De&&(Ae(this.#t),Me(),Ae(Ne()));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 qn(()=>{var r=dr;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return jn(e,this.#i.parent),null}}))};ft(()=>{if(!this.#y()){var t;try{t=this.transform_error(e)}catch(e){jn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>jn(e,this.#i&&this.#i.parent)):n(t)}})}};function U(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[he]??=e.nodeValue)&&(e[he]=n,e.nodeValue=`${n}`)}function hi(e,t){return _i(e,t)}var gi=new Map;function _i(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){Sn();var l=void 0,u=Vn(()=>{var s=n??t.appendChild(Cn());pi(s,{pending:()=>{}},t=>{O({});var n=rt;if(o&&(n.c=o),a&&(i.$$events=a),De&&ai(t,null),l=e(t,i)||ct(),De&&(dr.nodes.end=ke,ke===null||ke.nodeType!==8||ke.data!==`]`))throw we(),ye;k()},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=Wr(r);for(let e of[t,document]){var a=gi.get(e);a===void 0&&(a=new Map,gi.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,ti,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(Jr)),Yr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=gi.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,ti),r.delete(e),r.size===0&&gi.delete(n)):r.set(e,i)}Yr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return vi.set(l,u),l}var vi=new WeakMap,yi=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)nr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(nr(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&&(Zn(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();ir(r,t),t.append(Cn()),this.#n.set(e,{effect:r,fragment:t})}else Zn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),er(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)||(Zn(n.effect),this.#n.delete(e))};ensure(e,t){var n=Rt,r=Dn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=Cn();i.append(a),this.#n.set(e,{effect:qn(()=>t(a)),fragment:i})}else this.#t.set(e,qn(()=>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 De&&(this.anchor=ke),this.#a(n)}},bi=0,xi=1,Si=2;function Ci(e,t,n,r,i){De&&je();var a=lt(),o=be,s=a?on(o):sn(o,!1,!1),c=a?on(o):sn(o,!1,!1),l=new yi(e);Gn(()=>{var a=Rt,o=t(),u=!1;let d=De&&p(o)===(e.data===`[!`);if(d&&(Ae(Ne()),Oe(!1)),p(o)){var f=Tt(),m=!1;let e=e=>{if(!u){m=!0,f(!1),Rt===a&&a.deactivate(),Jt.ensure();try{e()}finally{Et(!1),Ht||Yt()}}};o.then(t=>{e(()=>{un(s,t),l.ensure(xi,r&&(e=>r(e,s)))})},t=>{e(()=>{if(un(c,t),l.ensure(Si,i&&(e=>i(e,c))),!i)throw c.v})}),De?l.ensure(bi,n):ft(()=>{m||e(()=>{l.ensure(bi,n)})})}else un(s,o),l.ensure(xi,r&&(e=>r(e,s)));return d&&Oe(!0),()=>{u=!0}})}function W(e,t,n=!1){var r;De&&(r=ke,je());var i=new yi(e),a=n?E:0;function o(e,t){if(De){var n=Pe(r);if(e!==parseInt(n.substring(1))){var a=Ne();Ae(a),i.anchor=a,Oe(!1),i.ensure(e,t),Oe(!0);return}}i.ensure(e,t)}Gn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var wi=Symbol(`NaN`);function Ti(e,t,n){De&&je();var r=new yi(e),i=!lt();Gn(()=>{var e=t();e!==e&&(e=wi),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function Ei(e,t){De&&Ae(wn(e)),Wn(()=>{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 Di(e,t){return t}function Oi(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];er(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;ki(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;En(d),d.append(u),e.items.clear()}ki(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function ki(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,ir(a,document.createDocumentFragment())):Zn(t[i],n)}}var Ai;function G(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=De?Ae(wn(u)):u.appendChild(Cn())}De&&je();var d=null,f=jt(()=>{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=R(f);_.fallback=d,Mi(_,t,c,n,a),d!==null&&(t.length===0?d.f&33554432?(d.f^=ie,Pi(d,null,c)):nr(d):er(d,()=>{d=null}))}}function g(e){_.pending.delete(e)}var _={effect:Gn(()=>{var e=R(f),t=e.length;let r=!1;De&&Pe(c)===`[!`!=(t===0)&&(c=Ne(),Ae(c),Oe(!1),r=!0);for(var u=new Set,_=Rt,v=Dn(),y=0;y<t;y+=1){De&&ke.nodeType===8&&ke.data===`]`&&(c=ke,r=!0,Oe(!1));var b=e[y],x=a(b,y),S=m?null:l.get(x);S?(S.v&&un(S.v,b),S.i&&un(S.i,y),v&&_.unskip_effect(S.e)):(S=Ni(l,m?c:Ai??=Cn(),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=qn(()=>s(c)):(d=qn(()=>s(Ai??=Cn())),d.f|=ie)),t>u.size&&Be(``,``,``),De&&t>0&&Ae(Ne()),!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&&Oe(!0),R(f)}),flags:n,items:l,pending:p,outrogroups:null,fallback:d};m=!1,De&&(c=ke)}function ji(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Mi(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=ji(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&&(nr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ie,_===l)Pi(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Fi(e,d,_),Fi(e,_,y),Pi(_,y,n),d=_,p=[],m=[],l=ji(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)Pi(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Fi(e,S.prev,C.next),Fi(e,d,S),Fi(e,C,b),l=b,d=C,--v,p=[],m=[]}else u.delete(_),Pi(_,l,n),Fi(e,_.prev,_.next),Fi(e,_,d===null?e.effect.first:d.next),Fi(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=ji(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=ji(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(ki(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=ji(l.next);var T=w.length;if(T>0){var ee=i&4&&s===0?n:null;if(o){for(v=0;v<T;v+=1)w[v].nodes?.a?.measure();for(v=0;v<T;v+=1)w[v].nodes?.a?.fix()}Oi(e,w,ee)}}o&&ft(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Ni(e,t,n,r,i,a,o,s){var c=o&1?o&16?on(n):sn(n,!1,!1):null,l=o&2?on(i):null;return{v:c,i:l,e:qn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Pi(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=Tn(r);if(a.before(r),r===i)return;r=o}}function Fi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ii(e,t,...n){var r=new yi(e);Gn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},E)}function Li(e,t,n){var r;De&&(r=ke,je());var i=new yi(e);Gn(()=>{var e=t()??null;if(De&&Pe(r)===`[`!=(e!==null)){var a=Ne();Ae(a),i.anchor=a,Oe(!1),i.ensure(e,e&&(t=>n(t,e))),Oe(!0)}else i.ensure(e,e&&(t=>n(t,e)))},E)}function Ri(e,t,n,r,i,a){let o=De;De&&je();var s=null;De&&ke.nodeType===1&&(s=ke,je());var c=De?ke:e,l=new yi(c,!1);Gn(()=>{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=De;if(s=De?s:On(e,a),ai(s,s),r){var i=null;De&&Kr(e)&&s.append(i=document.createComment(``));var o=De?wn(s):s.appendChild(Cn());De&&(o===null?Oe(!1):Ae(o)),r(s,o),i?.remove()}dr.nodes.end=s,n||t.before(s)}De&&Ae(t)}),()=>{}},E),In(()=>{}),o&&(Oe(!0),Ae(c))}function zi(e,t,n){Hn(()=>{var r=Pr(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Wn(()=>{var e=n();Fr(e),i&&Ie(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function Bi(e,t){var n=void 0,r;Kn(()=>{n!==(n=t())&&(r&&=(Zn(r),null),n&&(r=qn(()=>{Hn(()=>n(e))})))})}function Vi(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=Vi(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Hi(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Vi(e))&&(r&&(r+=` `),r+=t);return r}function Ui(e){return typeof e==`object`?Hi(e):e??``}var Wi=[...`
|
|
2
|
+
\r\f\xA0\v`];function Gi(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||Wi.includes(r[o-1]))&&(s===r.length||Wi.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Ki(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 qi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Ji(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(qi)),i&&c.push(...Object.keys(i).map(qi));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=qi(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+=Ki(r)),i&&(n+=Ki(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function K(e,t,n,r,i,a){var o=e[pe];if(De||o!==n||o===void 0){var s=Gi(n,r,a);(!De||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(De||i!==t){var a=Ji(t,r);(!De||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):gn(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(gn(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`]}),In(()=>{t.disconnect()})}function na(e,t,n=t){var r=new WeakSet,i=!0;Ct(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,Rt!==null&&r.add(Rt)}),Hn(()=>{var a=t();if(e===document.activeElement){var o=Rt;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(De){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,ft(n),xt()}}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);De&&(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){De&&i&&e.nodeName===ua&&(`defaultValue`in n||`defaultChecked`in n||ma(e));var o=ya(e),s=o[sa],c=!o[ca];let l=De&&s;l&&Oe(!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=Ui(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`)K(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=zr(r);if(Lr(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)B(r,e,l),Qr([r]);else if(l!=null){function a(e){u[i].call(this,e)}u[n]=Xr(r,e,a,t)}}else if(i===`style`)q(e,i,l);else if(i===`autofocus`)vt(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=Hr(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&&Oe(!0)}return u}function va(e,t,n=[],r=[],i=[],a,o=!1,s=!1){wt(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===fa,l=!1;if(Kn(()=>{var u=t(...n.map(R)),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]||Zn(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var p=u[t];t.description===`@attach`&&(!r||p!==r[t])&&(i[t]&&Zn(i[t]),i[t]=qn(()=>Bi(e,()=>p))),d[t]=p}r=d}),c){var u=e;Hn(()=>{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;Ct(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Da(e)?Oa(a):a,n(a),Rt!==null&&r.add(Rt),await jr(),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))}}}),(De&&e.defaultValue!==e.value||Pr(t)==null&&e.value)&&(n(Da(e)?Oa(e.value):e.value),Rt!==null&&r.add(Rt)),Wn(()=>{var n=t();if(e===document.activeElement){var i=Rt;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),Ct(n,`change`,()=>{var e=n.__value;a&&(e=Ea(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Wn(()=>{var e=r();De&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=gn(n.__value,e)}),In(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Ca.has(o)||(Ca.add(o),ft(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Ca.delete(o)})),ft(()=>{if(s){var e=a?Ea(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Ta(e,t,n=t){Ct(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(De&&e.defaultChecked!==e.checked||Pr(t)==null)&&n(e.checked),Wn(()=>{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]));Hn(()=>(Pr(()=>n(e[t])),r))}function ja(e,t){return e===t||e?.[ce]===t}function Ma(e=ct(),t,n,r){var i=rt.r,a=dr;return Hn(()=>{var o,s;return Wn(()=>{o=s,s=r?.()||[],Pr(()=>{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?Wn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&In(()=>{n.removeEventListener(t,a)})}function Pa(e=!1){let t=rt,n=t.l.u;if(!n)return;let r=()=>Fr(t.s);if(e){let e=0,n={},i=Ot(()=>{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=()=>R(i)}n.b.length&&zn(()=>{Fa(t,r),h(n.b)}),Ln(()=>{let e=Pr(()=>n.m.map(m));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&Ln(()=>{Fa(t,r),h(n.a)})}function Fa(e,t){if(e.l.s)for(let t of e.l.s)R(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=!Xe||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=Ot(r),R(u)):(l&&(l=!1,c=s?Pr(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&&Ge(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?Ot:jt)(()=>(v=!1,g()));o&&R(y);var b=dr;return(function(e,t){if(arguments.length>0){let n=t?R(y):i&&o?mn(e):e;return M(y,n),v=!0,c!==void 0&&(c=n),e}return or&&v||b.f&16384?y.v:R(y)})}function Va(e){rt===null&&Re(`onMount`),Xe&&rt.l!==null?Ua(rt).m.push(e):Ln(()=>{let t=Pr(e);if(typeof t==`function`)return t})}function Ha(e){rt===null&&Re(`onDestroy`),Va(()=>()=>Pr(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=li(),a=P(i);{let e=A(()=>r()?`currentColor`:`none`),i=A(()=>t.label?`img`:void 0),o=A(()=>t.label?void 0:`true`);Li(a,()=>t.of,(r,a)=>{a(r,{get size(){return n()},strokeWidth:1.5,absoluteStrokeWidth:!0,get fill(){return R(e)},get role(){return R(i)},get"aria-label"(){return t.label},get"aria-hidden"(){return R(o)}})})}H(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=()=>at(Ya),Za=new Set([`$$slots`,`$$events`,`$$legacy`,`color`,`size`,`width`,`height`,`strokeWidth`,`absoluteStrokeWidth`,`nonScalingStroke`,`iconNode`,`icon`,`class`,`children`]),Qa=si(`<svg><!><!></svg>`);function $a(e,t){O(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=A(()=>!!t.children||Ja(p)),h=A(()=>qa(d(),{color:r(),width:a(),height:o(),strokeWidth:s(),absoluteStrokeWidth:c(),nonScalingStroke:l(),className:Ga(`lucide-icon`,n.class),hasA11yProp:R(m),attributes:p})),g=A(()=>v(R(h),3)),y=A(()=>R(g)[1]),b=A(()=>_(R(g)[2],()=>[],!0)),x=A(()=>({...R(y),class:[...R(y).class.split(` `),t.class]}));var S=Qa();va(S,()=>({...R(x)}));var C=N(S);G(C,17,()=>R(b),Di,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1];var a=li();Ri(P(a),r,!0,(e,t)=>{va(e,()=>({...i()}))}),H(e,a)}),Ii(I(C),()=>t.children??f),D(S),H(e,S),k()}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}}))}async function yo(e){try{let t=await fetch(`data/${e}.json`);return t.ok?await t.json():null}catch{return null}}async function bo(){let[e,t,n]=await Promise.all([yo(`registry`),yo(`local`),yo(`state`)]);return e?{stack:e,clones:t?.apps??{},roots:t?.roots??[],saved:n}:null}async function xo(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 So=async(e,t=!1)=>!!(await xo(`state`,e,t))?.ok;async function Co(e,t={}){let n=await xo(e,t);return n?await n.json().catch(()=>({error:`The canvas server answered ${String(n.status)}.`})):{error:`Could not reach the canvas server.`}}var wo=()=>yo(`repos`),To=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Eo=/\{\{\s*([a-z0-9-]+)\.([A-Za-z]\w*)\s*\}\}/g,Do=/^\{\{\s*([a-z0-9-]+)\.([A-Za-z]\w*)\s*\}\}$/,Oo=e=>typeof e==`string`&&!e.includes(`{{`)||typeof e==`number`||typeof e==`boolean`;function ko(e){let t=(r,i,a)=>{let o=`${r}.${i}`,s=Object.hasOwn(e,r)?e[r]:void 0;if(!To(s)||a.includes(o))return;if(Object.hasOwn(s,i)){let e=n(s[i],[...a,o]);return Oo(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=Do.exec(e);return n?t(n[1]??``,n[2]??``,r)??e:e.replace(Eo,(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)):To(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t,r)])):e};return n}function Ao(e){return!To(e)||!To(e.apps)?e:ko(e.apps)(e,[])}var jo=80,Mo=90,No=(e,t)=>e[t];function Po(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=No(i,e.from)<=No(i,e.to),a=t?e.to:e.from,o=t?e.from:e.to;if(i[o]!==i[a]){for(let t=No(i,o)+1;t<No(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 Fo=e=>{let t={};for(let n of e)n.forEach((e,n)=>t[e]=n);return t};function Io(e,t,n){let r=Fo(e),i=0;return t.forEach(([e,a],o)=>{for(let[s,c]of t.slice(o+1))n[e]===n[s]&&(No(r,e)-No(r,s))*(No(r,a)-No(r,c))<0&&i++}),i}function Lo(e,t){let{rows:n,links:r,row:i}=Po(e,t),a={};for(let[e,t]of r)(a[e]??=[]).push(t),(a[t]??=[]).push(e);let o=n.map(e=>[...e]),s=Io(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=Fo(n),o=n=>{let o=(a[n]??[]).filter(n=>i[n]===e+(t?-1:1));return o.length?o.reduce((e,t)=>e+No(r,t),0)/o.length:No(r,n)};n[e]?.sort((e,t)=>o(e)-o(t))}let l=Io(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 Ro(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(No(d,t),No(d,e)+1);for(let e of s){let t=(o[e]??[]).map(e=>No(d,e));t.length&&(d[e]=Math.max(No(d,e),Math.min(...t)-1))}return d}function zo(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,No(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+No(c,t),0)/i.length:No(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-No(c,t))),c[t]=i}}}for(let e of Object.keys(c))n[e]=No(c,e)-a(e)}function Bo(e,t,n,r=`down`,i=!1,{pad:a,tight:o=!1,anchor:s}={pad:0}){let c=Ro(e,t),l=[];for(let t of e)(l[No(c,t)]??=[]).push(t);let u=l.filter(Boolean);if(Lo(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?jo*f:Mo*.6*f,_=p?Mo*f:jo*1.6*f,v=e=>e.reduce((e,t)=>e+No(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+=No(d,n)[m]+g;S+=Math.max(...e.map(e=>No(d,e)[h]))+_}zo(u,t,b,e=>No(d,e)[m],g,e=>s?.(e)??No(d,e)[m]/2);let C=Math.min(...Object.values(b)),w={};for(let t of e){let e=Math.round(No(b,t)-C+a+40);w[t]=p?{x:e,y:No(x,t)}:{x:No(x,t),y:e}}return w}function Vo(e,t,n,r,i={}){let a=t=>{let n=No(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 Ho(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 Uo={top:[0,-1],right:[1,0],bottom:[0,1],left:[-1,0]},Wo={top:`bottom`,bottom:`top`,left:`right`,right:`left`},Go=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),Ko=(e,t,n)=>t?{x:e.x+Uo[t][0]*n,y:e.y+Uo[t][1]*n}:e,qo=({x:e,y:t})=>`${String(e)},${String(t)}`,Jo=({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 Yo(e,t,n,r){let i=Go(Math.hypot(n.x-e.x,n.y-e.y)*.4,30,140);return[e,Ko(e,t,i),Ko(n,r,i),n]}function Xo(e,t,n,r){let[,i,a]=Yo(e,t,n,r);return`M${qo(e)} C${qo(i)} ${qo(a)} ${qo(n)}`}function Zo(e,t,n,r,i){let a=Ko(e,t,40),o=[a,...i,Ko(n,r,40)],s=`M${qo(e)} L${qo(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${qo(l)} ${qo(u)} ${qo(a)}`}return`${s} L${qo(n)}`}var Qo=e=>e===`left`||e===`right`,$o=e=>[[`from`,e.from,e.fromSide,e.to],[`to`,e.to,e.toSide,e.from]];function es(e){let t=new Map;return e.forEach((e,n)=>{for(let[r,i,a,o]of $o(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 ts=(e,t)=>t>1?Math.min(26,(e-48)/(t-1)):0,ns=e=>e.every(t=>t.other===e[0]?.other)&&e.every(({cable:e,end:t,side:n})=>(t===`from`?e.toSide:e.fromSide)===Wo[n])?e[0]?.other:void 0;function rs(e,t){for(let n of es(e).values()){let[{id:e,side:r}={id:``,side:`top`}]=n,i=Qo(r)?`y`:`x`,a=e=>i===`x`?e.w:e.h,o=e=>e[i]+a(e)/2,s=t(e),c=ns(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(ts(a(s),n.length),ts(a(t(c)),n.length));r-e>=u*(n.length-1)+32&&(l=Math.round((e+r)/2-o(s)))}let u=Jo(s,r),[d,f]=Uo[r],p=({cable:e,end:n,other:r})=>{let a=Jo(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 is(e,{cardOf:t,coveredBelow:n}){let r={},i=[];for(let a of es(e).values()){let[{id:e,side:o}={id:``,side:`top`}]=a,s=t(e);if(!s)continue;let c=Qo(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(ns(a)??``);e&&(g=Math.min(g,ts(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);_=Go(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 as=[[`cli`,`Koppler`],[`ide`,`Your IDE`]],os={tool:`docker`,fix:`Install a Docker runtime (Docker Desktop or Colima)`},ss={tool:`npm`,fix:`Comes with Node`},cs={dotnet:{label:`.NET`,runIn:as,serves:!0,needs:[{tool:`dotnet`,fix:`Install the .NET SDK the repo targets`}]},flutter:{label:`Flutter`,runIn:as,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:as,serves:!0,needs:[ss]},web:{label:`Web`,runIn:as,serves:!1,browser:!0,needs:[ss]},lambda:{label:`Lambda`,runIn:as,serves:!0,needs:[os,{tool:`aws`,fix:`brew install awscli`}]},sam:{label:`AWS SAM`,runIn:as,serves:!0,needs:[os,{tool:`sam`,fix:`brew install aws-sam-cli (or: uv tool install aws-sam-cli)`}]},other:{label:`Other`,runIn:as,serves:!0}},ls=(e,t)=>e.read(t)??``,us=(e,t)=>t.map(t=>ls(e,t)).join(`
|
|
3
|
+
`).toLowerCase(),ds=(e,t)=>t?` ${e}${String(t)}`:``,fs=e=>us(e,[`pyproject.toml`,`requirements.txt`,`Pipfile`]);function ps(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 ms=e=>/spring-boot|springframework\.boot/.test(us(e,[`pom.xml`,`build.gradle`,`build.gradle.kts`])),hs=e=>[`compose.yaml`,`compose.yml`,`docker-compose.yml`,`docker-compose.yaml`].find(t=>e.has(t)),gs={reactnative:{label:`React Native`,color:[`#087EA4`,`#58C4DC`],serves:!1,platforms:[[`ios`,`iOS simulator`],[`android`,`Android emulator`]],detect:e=>/"(expo|react-native)"\s*:/.test(ls(e,`package.json`)),start:(e,{platform:t=`ios`})=>/"expo"\s*:/.test(ls(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=>ms(e)?8080:null,start:e=>e.has(`pom.xml`)?ms(e)?`${e.has(`mvnw`)?`./mvnw`:`mvn`} spring-boot:run`:null:`${e.has(`gradlew`)?`./gradlew`:`gradle`} ${ms(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=fs(e);return e.has(`manage.py`)||/fastapi|uvicorn/.test(t)?8e3:t.includes(`flask`)?5e3:null},start:(e,{port:t})=>{let n=ps(e),r=fs(e);if(e.has(`manage.py`))return`${n}python manage.py runserver${ds(``,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${ds(`--port `,t)}`:null}return r.includes(`flask`)?`${n}flask run${ds(`--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${ds(`-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${ds(`--port=`,t)}`:null},compose:{label:`Docker Compose`,color:[`#1D63ED`,`#7AA7FF`],detect:e=>!!hs(e),port:e=>Number(/["'\s-](\d{2,5}):\d{2,5}["'\s]/.exec(ls(e,hs(e)??``))?.[1])||null,start:()=>`docker compose up`,stop:`docker compose down`}};for(let[e,t]of Object.entries(gs))cs[e]={label:t.label,runIn:as,serves:t.serves!==!1,...t.platforms&&{platforms:t.platforms},...t.color&&{color:t.color}};Object.keys(cs);var _s={kinds:cs,recipes:gs,custom:[]},vs=new WeakMap;function ys(e){let t=e?.kinds;if(typeof t!=`object`||!t)return _s;let n=vs.get(t);if(n)return n;let r={kinds:{...cs},recipes:{...gs},custom:[]};for(let[e,n]of Object.entries(t)){if(!/^[a-z0-9-]{1,32}$/.test(e)||Object.hasOwn(cs,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:as,serves:t.serves!==!1,custom:!0},r.custom.push(e)}return vs.set(t,r),r}var bs=e=>ys(e).kinds;function xs(e,t){let n=e?.kind,r=bs(t);return n!==void 0&&Object.hasOwn(r,n)&&r[n]||{label:n??`App`,runIn:as,serves:!0}}var Ss=e=>typeof e==`string`?e:``,Cs=e=>({branch:e?.branch||``,run:e?.run||`cli`,...e?.platform&&{platform:e.platform},...Ss(e?.note)&&{note:Ss(e?.note)},...e?.tunnels===!1&&{tunnels:!1},...e?.queues===!0&&{queues:!0},...Ss(e?.changes)&&{changes:Ss(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}}),ws=e=>e?.run===`mock`?{branch:``,run:`mock`,...e.restart===!0&&{restart:!0}}:Cs(e);function Ts(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,ws(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 Es=(e,t)=>e.edges.filter(e=>e.from===t).map(e=>e.to).sort(),Ds=e=>e.toUpperCase(),Os=e=>({ide:`your IDE`,cli:`the command line`,mock:`a mock`})[e];function ks(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 ${Ds(r.from)} to ${Ds(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 ${Os(a.run)} to ${Os(o.run)}`),(a.platform??``)!==(o.platform??``)&&o.run===`cli`&&c.push(`its device changes to ${String(o.platform)}`);let l=Es(t,e),u=Es(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 As(e,t,n={}){let r=Ts(e),i=Ts(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&&Es(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=ks(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 js=[[`starts`,`START`],[`restarts`,`RESTART`],[`stops`,`STOP AND REVERT`],[`keeps`,`KEEP RUNNING`]];function Ms(e,t={}){let n=e=>t.name?.(e)??e,r=e=>n(e.id)+(e.why.length>0?` (${e.why.join(`; `)})`:``),i=js.filter(([t])=>e[t].length>0).map(([t,n])=>`${n}: ${e[t].map(r).join(`, `)}`);return i.length>0?i:[`NOTHING TO CHANGE`]}var Ns=[`sqs`,`kafka`];function Ps(e,t){let n=e?.apps?.[t];return[...new Set([...Object.keys(n?.publishes??{}),...Object.keys(n?.reads??{})])]}function Fs(e){let t=e?.envs??[],n=e?.protected;return Array.isArray(n)?t.filter(e=>n.includes(e)):t.slice(1)}var Is=(e,t)=>Fs(e).includes(t),Ls=[[`valkey`,`Cache (Valkey)`],[`redis`,`Cache (Redis)`],[`aurora`,`Database (Aurora)`],[`postgres`,`Database (Postgres)`],[`mysql`,`Database (MySQL)`],[`mongo`,`Database (MongoDB)`],[`db`,`Database`],[`rds`,`Database`]];function Rs(e){if(e.what)return e.what;let t=(e.tunnel??``).toLowerCase(),n=t.split(/[.-]/);return Ls.find(([e])=>n.includes(e)||e.length>3&&t.includes(e))?.[1]??`Tunnel`}function zs(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:Rs(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 Bs(e,t=[]){let n=zs(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 Vs(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 Hs=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Us={0:e=>({...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([e,t])=>[e,{run:`cli`,...t}]))})};function Ws(e){if(!Hs(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(!Hs(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,Hs(t)?t:{}])),edges:Array.isArray(r)?r:[]};for(let e=a;e<1;e++)o={...Us[e]?.(o)??o,version:e+1};return{preset:o,migratedFrom:a<1?a:null}}function Gs(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 Ks=e=>Hs(e)&&typeof e.from==`string`&&typeof e.to==`string`;function qs(e,t){let n=Ws(e);if(n.error!==void 0)return{error:n.error};let r=n.preset,i=[],a=e=>t.name?.(e)??e;(!Hs(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,Gs(e,r.nodes[e]??{},t,a(e),i)])),d=[],f=0;for(let e of r.edges.filter(Ks)){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 Js=e=>Hs(e)&&typeof e.x==`number`&&typeof e.y==`number`,Ys=e=>t=>e.from===t.from&&e.to===t.to;function Xs(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=Hs(e.layout)?e.layout:void 0,o=r(Hs(a?.nodes)?a.nodes:{}),s=Object.values(o).filter(Js),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(Ks).filter(e=>!n.has(e.from)&&!n.has(e.to)&&!(t.uncable??[]).some(Ys(e)));for(let e of t.cable??[])l.some(Ys(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(Hs(a.sides)?a.sides:{}).filter(([e])=>u.has(e)));return{...e,nodes:i,edges:l,layout:{...a,nodes:o,sides:d}}}function Zs(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(`; `)}var 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=j(``);get stack(){return R(this.#e)}set stack(e){M(this.#e,e,!0)}#t=j(``);get dir(){return R(this.#t)}set dir(e){M(this.#t,e,!0)}#n=j(!1);get setup(){return R(this.#n)}set setup(e){M(this.#n,e,!0)}#r=j([]);get known(){return R(this.#r)}set known(e){M(this.#r,e)}#i=j(``);get env(){return R(this.#i)}set env(e){M(this.#i,e,!0)}#a=j([]);get nodes(){return R(this.#a)}set nodes(e){M(this.#a,e)}#o=[];#s=A(()=>{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 R(this.#s)}set cards(e){M(this.#s,e)}#c=j([]);get edges(){return R(this.#c)}set edges(e){M(this.#c,e)}#l=j(null);get hovered(){return R(this.#l)}set hovered(e){M(this.#l,e)}#u=j([]);#d=A(()=>R(this.#u).includes(this.env));get protected(){return R(this.#d)}set protected(e){M(this.#d,e)}toFlow=e=>e;zoom=()=>1;#f=A(()=>this.edges.map(e=>({from:e.source,to:e.target,...e.data})));get cables(){return R(this.#f)}set cables(e){M(this.#f,e)}#p=j([]);get infra(){return R(this.#p)}set infra(e){M(this.#p,e)}#m=j({});get queues(){return R(this.#m)}set queues(e){M(this.#m,e)}#h=j({});get hiddenQueues(){return R(this.#h)}set hiddenQueues(e){M(this.#h,e)}#g=j({});get hiddenOutside(){return R(this.#g)}set hiddenOutside(e){M(this.#g,e)}#_=j({});get hiddenLogs(){return R(this.#_)}set hiddenLogs(e){M(this.#_,e)}#v=j({});get logAliases(){return R(this.#v)}set logAliases(e){M(this.#v,e)}#y=j([]);get pinned(){return R(this.#y)}set pinned(e){M(this.#y,e)}pin(e){this.pinned.includes(e)||(this.pinned=[...this.pinned,e])}unpin(e){this.pinned=this.pinned.filter(t=>t!==e)}#b=A(()=>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 R(this.#b)}set infraBoxes(e){M(this.#b,e)}#x=j(!1);get present(){return R(this.#x)}set present(e){M(this.#x,e,!0)}entering=!1;#S=j(!1);get brief(){return R(this.#S)}set brief(e){M(this.#S,e,!0)}#C=A(()=>{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 R(this.#C)}set panelCard(e){M(this.#C,e)}#w=j({});get fullHeights(){return R(this.#w)}set fullHeights(e){M(this.#w,e)}#T=A(()=>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]})));#E(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=R(this.#T).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 Ho(this.brief?t:[],this.brief?n:[])}#D=Ho([],[]);#O=null;#k=()=>[...this.nodes,...this.infra].map(({id:e,position:t,measured:n})=>`${e} ${String(t.x)} ${String(t.y)} ${String(n?.height??0)}`).join(`|`);#A=A(()=>{let e=this.#k();return[...this.nodes,...this.infra].some(e=>e.dragging)||this.brief&&this.#O===e||(this.#O=null,this.#D=this.#E()),this.#D});get squeezed(){return R(this.#A)}set squeezed(e){M(this.#A,e)}shown=(e,t=``)=>({x:e.x,y:this.squeezed.show(e.y+(R(this.#T).get(t)??0))});stored=(e,t=``)=>({x:e.x,y:this.squeezed.back(e.y)-(R(this.#T).get(t)??0)});dropped(e,t){let n=R(this.#T).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.#E((t,n)=>t===e?r:n.y).back(t.y)-n;return{x:t.x,y:r}}#j=A(()=>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 R(this.#j)}set boxes(e){M(this.#j,e)}#M=j();#N=j([]);get unplaced(){return R(this.#N)}set unplaced(e){M(this.#N,e)}#P=[];#F(e){return this.nodes.some(t=>t.id===e&&t.data.run===`mock`)}tunnelsOf(e){if(this.#F(e))return[];let t=R(this.#M)?.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=R(this.#M)?.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)}]`}#I=A(()=>Bs(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:Rs(t),connectsAs:t.connectsAs}))),this.cards.flatMap(({id:e})=>{let t=Number(new URL(R(this.#M)?.apps[e]?.url??`http://none`).port);return t?[t]:[]})));get plan(){return R(this.#I)}set plan(e){M(this.#I,e)}ledBy(e){return[...this.plan.filter(t=>t.apps[0]===e).map(tc),...this.boardQueues.filter(t=>this.#H(t)===e).map(e=>`queue:${e.id}`)]}#L=A(()=>new Set(this.cards.map(e=>e.id)));#R=A(()=>new Set(this.cards.filter(e=>e.data.showQueues).map(e=>e.id)));commandsOf(e){return Object.entries(R(this.#M)?.apps[e]?.commands??{}).filter(([,e])=>(e.show??`both`)!==`cli`)}#z(e){return!!R(this.#M)?.apps[e]?.outside}#B=A(()=>{let e=R(this.#M)?.apps??{};return Object.entries(R(this.#M)?.queues??{}).flatMap(([t,n])=>{let r=n=>Object.keys(e).filter(r=>Object.hasOwn(e[r]?.[n]??{},t)&&(R(this.#R).has(r)||this.#z(r))),[i,a]=[r(`publishes`),r(`reads`)];return!this.hiddenQueues[t]&&[...i,...a].some(e=>R(this.#R).has(e))?[{id:t,queue:n,pubs:i,reads:a,upstream:!1}]:[]})});get boardQueues(){return R(this.#B)}set boardQueues(e){M(this.#B,e)}#V=A(()=>{let e=[...this.boardQueues],t=t=>e.some(e=>e.id===t),n=Object.entries(R(this.#M)?.queues??{});for(let r=!0;r;){r=!1;for(let[i,a]of n)!t(i)&&!this.hiddenQueues[i]&&Object.keys(a.feeds??{}).some(t)&&(e.push({id:i,queue:a,pubs:[],reads:[],upstream:!0}),r=!0)}return e});get shownQueues(){return R(this.#V)}set shownQueues(e){M(this.#V,e)}ownedBy(e){let t=t=>[...t.pubs,...t.reads].filter(e=>R(this.#L).has(e)||this.#z(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)))}#H(e){return[...e.pubs,...e.reads].find(e=>R(this.#L).has(e))}queueName(e){return R(this.#M)?.queues?.[e]?.name??e}switchesOver(e){if(this.#F(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=R(this.#M)?.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.#F(e)?[]:Ps(R(this.#M),e).filter(e=>R(this.#M)?.queues?.[e])}#U=A(()=>{let e=e=>this.#z(e)?`outside:${e}`:e;return[...this.shownQueues.flatMap(({id:t,queue:n,pubs:r,reads:i})=>[...r.map(n=>({from:e(n),to:`queue:${t}`,queue:t})),...i.map(n=>{let r=this.#X(n,t);return{from:`queue:${t}`,to:e(n),queue:t,...r&&{via:r}}}),...Object.entries(n.feeds??{}).filter(([e])=>this.shownQueues.some(t=>t.id===e)).map(([e,n])=>({from:`queue:${t}`,to:`queue:${e}`,queue:t,via:n.via}))]),...this.cards.flatMap(({id:e})=>Object.keys(R(this.#M)?.apps[e]?.consumes??{}).filter(e=>this.#z(e)).map(t=>({from:e,to:`outside:${t}`}))),...Object.entries(R(this.#M)?.apps??{}).flatMap(([e,t])=>this.#z(e)?Object.keys(t.consumes??{}).filter(e=>this.cards.some(t=>t.id===e)).map(t=>({from:`outside:${e}`,to:t})):[])]});get flows(){return R(this.#U)}set flows(e){M(this.#U,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.#F(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])])}#W=A(()=>this.plan.flatMap(e=>e.apps.map(t=>({from:t,to:tc(e),tunnel:e}))));get links(){return R(this.#W)}set links(e){M(this.#W,e)}#G=A(()=>{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 R(this.#G)}set focus(e){M(this.#G,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);#K(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)}}#q=A(()=>is(this.cables,{cardOf:e=>this.boxes.get(e),coveredBelow:e=>this.#K(e)}));get ends(){return R(this.#q)}set ends(e){M(this.#q,e)}#J(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,u=s.y-nc.gap;return t.map(e=>{if(!o.has(e.id))return e;let t=this.infraBoxes.get(e.id)??nc;if(this.#Z(e.id)){u-=t.h;let n={...e,position:{x:s.x+s.w/2-t.w/2,y:u}};return u-=nc.gap,n}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})}#Y(e,t){let n=t;for(let{id:t,position:r,measured:i}of e){let e=Math.max(i?.height??0,this.brief?this.fullHeights[t]??0:0),a=i?.width;if(!e||!a)continue;let o=new Set(this.ownedBy(t)),s=new Set(this.ledBy(t)),c=n.filter(e=>{let t=this.infraBoxes.get(e.id)?.w??nc.w;return s.has(e.id)&&e.position.y>=r.y&&e.position.x<r.x+a&&r.x<e.position.x+t}).sort((e,t)=>e.position.y-t.position.y),l=r.y+e,u=-1/0,d={};for(let e of c){let t=o.has(e.id)?l+nc.gap/2:-1/0,n=e.position.y>=Math.max(u,t)?e.position.y:Math.max(u+nc.gap/2,t);n!==e.position.y&&(d[e.id]=n),u=n+(this.infraBoxes.get(e.id)?.h??nc.h)}Object.keys(d).length&&(n=n.map(e=>{let t=d[e.id];return t===void 0?e:{...e,position:{x:e.position.x,y:t}}}))}return n}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=>R(this.#M)?.apps[e]?.name??e,o=[],s=this.shownQueues.map(r=>{let s=`queue:${r.id}`,c=t.get(s),l=this.#H(r);!c&&!e[s]&&l&&n.push(l),!c&&!e[s]&&r.upstream&&o.push(s);let u=!r.upstream&&Ns.includes(r.queue.type),d=u&&this.queues[r.id]===`local`,f=r.reads.filter(e=>R(this.#L).has(e)&&!this.#X(e,r.id)).map(a),p=!d&&f.length?f.join(` and `):``;return{...c,id:s,type:`queue`,deletable:!1,position:c?.position??e[s]??{x:0,y:0},data:{queue:r.id,name:r.queue.name,kind:r.queue.type.toUpperCase(),can:u,local:d,upstream:r.upstream,shares:p?`Your local ${p} reads the ${i} queue`:``,about:[r.queue.envs?.[this.env]?.queue??r.queue.queue??r.id,r.upstream?`Stays deployed on ${i}: it feeds ${this.#Q(r.queue.feeds)}.`:``,p?`It takes messages the deployed ${i} reader would get. Switch to Local to give your run its own copy.`:``].filter(Boolean)}}}),c=[...new Set([...this.flows.flatMap(e=>[e.from,e.to]),...this.pinned.filter(e=>this.#z(e)).map(e=>`outside:${e}`)])].filter(e=>e.startsWith(`outside:`)&&!this.hiddenOutside[e.slice(8)]).map(n=>{let r=R(this.#M)?.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)}}}),l=[...r,...s,...c];for(let e of n)l=this.#J(e,l);l=this.#$(o,l),this.#P=[...new Set([...this.#P,...o])];for(let n of c.filter(n=>!t.has(n.id)&&!e[n.id])){let e=this.#te(n.id,l);l=l.map(t=>t.id===n.id?{...t,position:e}:t)}this.infra=l,this.unplaced=[...new Set([...this.unplaced,...n])]}#X(e,t){let n=R(this.#M)?.apps[e]?.reads?.[t]?.via;return typeof n==`string`?n:void 0}#Z(e){return e.startsWith(`queue:`)&&this.shownQueues.some(t=>t.upstream&&Object.hasOwn(t.queue.feeds??{},e.slice(6)))}#Q(e){return Object.keys(e??{}).map(e=>this.queueName(e)).join(` and `)}#$(e,t){let n=t,r=e;for(let t of e){let e=this.#ee(t,n,r);e&&(n=n.map(n=>n.id===t?{...n,position:e}:n)),r=r.filter(e=>e!==t)}return n}#ee(e,t,n){let r=this.infraBoxes.get(e)??nc,i=this.flows.filter(t=>t.from===e).map(e=>t.find(t=>t.id===e.to&&(t.position.x||t.position.y))).find(Boolean);if(!i)return;let a=e=>({...e.position,...this.infraBoxes.get(e.id)??nc}),o=[...this.nodes.map(e=>({...e.position,...this.boxes.get(e.id)??{w:260,h:200}})),...t.filter(e=>!n.includes(e.id)&&(e.position.x||e.position.y)).map(a)],s=e=>o.every(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=i.position.y-r.h-60,l=i.position.x+a(i).w/2-r.w/2,u=[0,-1,1,-2,2].map(e=>({x:l+e*(r.w+24),y:c}));return u.find(s)??u[0]}#te(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&&!this.#P.length||!e(this.nodes)||!e(this.infra))return;let t=this.infra;for(let e of this.unplaced)t=this.#J(e,t);t=this.#$(this.#P,t),this.#P=[],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.#ne.set(e.id,t),{...e,position:t}})}#ne=new Map;#re={};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.#ie(e.id,e.position,i):this.#ae(e.id,e.position,i)}:e;if(t?.dragging&&!n.dragging)return{...n,position:this.dropped(n.id,n.position)};let a=t&&(this.#ne.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=[],u=a.filter(e=>e.type!==`app`),d=a.filter(e=>e.type===`app`);for(let{id:e,measured:r}of d){let i=this.#re[e],a=r?.height;a&&(this.#re[e]={brief:t,height:a}),a&&a!==i?.height&&l.push(e);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 d.filter(n=>n.id!==e&&t(this.boxes.get(n.id))))u=this.followed(n.id,{x:0,y:o},u);d=d.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 d){let n=c[e];n&&(u=this.pushed(e,t.y+n.bottom,n.by,u));let r=s.get(e);r&&(r.x!==t.x||r.y!==t.y)&&(u=this.followed(e,{x:t.x-r.x,y:t.y-r.y},u))}return u=this.#Y(d.filter(e=>l.includes(e.id)),u),this.nodes=d,this.infra=u,this.brief&&e.some(e=>e.dragging||r.get(e.id)?.dragging)&&(this.#O=this.#k()),Object.keys(c).length>0}#ie(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=Jo(n,i),o=this.ends.offset[`${String(e)}|${t}`]??0;return{side:i,at:Uo[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=Uo[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}}#ae(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)}}#oe=j([]);get snapped(){return R(this.#oe)}set snapped(e){M(this.#oe,e)}#se=j();get view(){return R(this.#se)}set view(e){M(this.#se,e)}#ce=j(!1);get unsaved(){return R(this.#ce)}set unsaved(e){M(this.#ce,e,!0)}#le={};#ue=j(!1);get live(){return R(this.#ue)}set live(e){M(this.#ue,e,!0)}#de=``;#fe={};goLive(){this.live||=(this.commit(),this.#fe=this.saved(),this.#de=this.content(),!0)}goEdit(){this.live&&=(this.setContent(this.#de),!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}))}#pe=j(null);get name(){return R(this.#pe)}set name(e){M(this.#pe,e,!0)}#me=j([]);get own(){return R(this.#me)}set own(e){M(this.#me,e)}get team(){return R(this.#M)?.presets??[]}#he=j(null);get opened(){return R(this.#he)}set opened(e){M(this.#he,e,!0)}#ge(){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}}}#_e(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}}}#ve(){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]]))}}#ye(){let e=e=>{let t={...this.own.find(t=>t.name===e),...this.#_e(e),layout:this.#ve()},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&&qs(t,this.#ge()).preset;if(t&&r&&n(this.#_e(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}#be=j([]);get trash(){return R(this.#be)}set trash(e){M(this.#be,e)}#xe=j([]);get recent(){return R(this.#xe)}set recent(e){M(this.#xe,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.#ye();let e=this.nodes[0]?.data.name??`Untitled`,t=this.uniqueName(`${this.name??e} copy`);this.own=[...this.own,{...this.#_e(t),layout:this.#ve()}],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=>Ws(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=qs(a,this.#ge());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=[...R(this.#M)?.presets??[]];n[e]=t,R(this.#M)&&M(this.#M,{...R(this.#M),presets:n})}asShared(e){let{name:t,nodes:n,edges:r}=e;return JSON.stringify({name:t,version:Ws(e).preset?.version??1,nodes:n,edges:r},null,2)}#Se=j([]);get dismissed(){return R(this.#Se)}set dismissed(e){M(this.#Se,e)}#Ce=j(!1);get scratch(){return R(this.#Ce)}set scratch(e){M(this.#Ce,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.hiddenLogs={},this.logAliases={},this.pinned=[]}openBoard(e){if(!Object.keys(e.nodes).length)return this.newBoard(),this.name=e.name,{notes:[]};let t=qs(e,this.#ge());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.hiddenLogs={},this.logAliases={},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.#Oe(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 Uo,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,Vo(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=[]}#we=j([]);get apps(){return R(this.#we)}set apps(e){M(this.#we,e)}#Te=A(()=>new Map(this.apps.map(e=>[e.id,e])));app=e=>R(this.#Te).get(e);nameOf=e=>R(this.#Te).get(e)?.name??e;#Ee=j([]);get envs(){return R(this.#Ee)}set envs(e){M(this.#Ee,e)}#De=j([]);get roots(){return R(this.#De)}set roots(e){M(this.#De,e)}area=()=>new DOMRect;show=()=>void 0;#Oe(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 So(this.saved());let e=await bo();e&&this.open(e)}open({stack:e,clones:t,roots:n,saved:r}){let i=Ao(e);M(this.#M,i),M(this.#u,i.envs.filter(e=>Is(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:xs(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:xs(n,i).serves||Object.entries(i.apps).some(([t,n])=>t!==e&&(n.consumes?.[e]??i.found?.[t]?.[e])),serves:!!n.url,runIn:[...xs(n,i).runIn,...n.mock?.length?[[`mock`,`Mock`]]:[]],platforms:xs(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.#Oe(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.#le=r??{},this.name=typeof r?.preset==`string`?r.preset:null,this.own=Array.isArray(r?.presets)?r.presets:[],this.#ke=this.own.map(e=>e.name),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.hiddenLogs=r?.hiddenLogs??{},this.logAliases=r?.logAliases??{},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.#ye()}get changes(){return[R(this.#M),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.hiddenLogs,this.logAliases,this.pinned]}#ke=[];saved(){if(this.#ke=[...new Set([...this.#ke,...this.own.map(e=>e.name)])],this.live)return{...this.#fe,env:this.env};let e=this.#le.nodes??{};return{mode:`auto`,...this.#le,preset:this.name,presets:this.own,seen:this.#ke,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,hiddenLogs:Object.keys(this.hiddenLogs).length?this.hiddenLogs:void 0,logAliases:Object.keys(this.logAliases).length?this.logAliases: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.#Ae(this.#Oe(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.#Ae(this.#Oe(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)}#Ae(e){this.infra=this.infra.map(lc),this.edges=this.edges.map(lc),this.nodes=[...this.nodes.map(lc),{...e,selected:!0}]}logName(e){return this.logAliases[e]??this.nameOf(e)}aliasLog(e,t){let{[e]:n,...r}=this.logAliases,i=t.trim().slice(0,24);this.logAliases=i&&i!==this.nameOf(e)?{...r,[e]:i}:r}showLog(e,t){let{[e]:n,...r}=this.hiddenLogs;this.hiddenLogs=t?r:{...r,[e]:!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,Vo(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={...Xs(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}#je={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.#je.key?this.#je.version+1:0;for(let i=0;i<ec.length;i++,r++){let[i,a]=ec[r%ec.length]??ec[0];if(this.#Me(e,i,a),t()!==n)break}this.#je={key:t(),version:r}}#Me(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=Bo([...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,...Vo(d,n,t,e,f)}));rs(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.#J(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=j(null);get status(){return R(this.#e)}set status(e){M(this.#e,e)}#t=j(!1);get asked(){return R(this.#t)}set asked(e){M(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)=>xo(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=j(!1);#t=[];#n;get forced(){return!!Q.status?.dev}get on(){return R(this.#e)||this.forced}set on(e){M(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{M(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=j(null);get now(){return R(this.#e)}set now(e){M(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 Co(`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)}var yc=V(`<p class="ask svelte-gr1w3a"> </p>`),bc=V(`<span class="opt svelte-gr1w3a">optional</span>`),xc=V(`<option> </option>`),Sc=V(`<select class="svelte-gr1w3a"></select>`),Cc=V(`<input class="svelte-gr1w3a"/>`),wc=V(`<label class="svelte-gr1w3a"><span> <!></span> <!></label>`),Tc=V(`<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),Ec=V(`<dialog aria-labelledby="command-title" class="svelte-gr1w3a"><!></dialog>`);function Dc(e,t){O(t,!0);let n=j(void 0),r=j(null),i=j(mn({})),a=j(``),o=j(!1);function s(e){M(r,e),M(i,Object.fromEntries((e.command.args??[]).map(e=>[e.name,e.choices?.[0]??``])),!0),M(a,``),R(n)?.showModal()}let c=async e=>{e.preventDefault(),R(r)&&(M(o,!0),M(a,await vc(R(r),R(i))??``,!0),M(o,!1),R(a)||R(n)?.close())};var l={open:s},u=Ec(),d=N(u),f=e=>{let t=A(()=>R(r));var s=Tc(),l=P(s);X(N(l),{get of(){return to},size:14}),D(l);var u=I(l,2),d=F(u),f=I(u,2),p=e=>{var n=yc(),r=F(n,!0);L(()=>U(r,R(t).command.confirm)),H(e,n)};W(f,e=>{R(t).command.confirm&&e(p)});var m=I(f,2),h=N(m);G(h,17,()=>R(t).command.args??[],e=>e.name,(e,t)=>{var n=wc(),r=N(n),a=N(r,!0),o=I(a),s=e=>{H(e,bc())};W(o,e=>{R(t).required||e(s)}),D(r);var c=I(r,2),l=e=>{var n=Sc();G(n,20,()=>R(t).choices??[],e=>e,(e,t)=>{var n=xc(),r=F(n,!0),i={};L(()=>{U(r,t),i!==(i=t)&&(n.value=(n.__value=i)??``)}),H(e,n)}),D(n),ta(n),na(n,()=>R(i)[R(t).name],e=>R(i)[R(t).name]=e),H(e,n)},u=e=>{var n=Cc();ma(n),L(()=>{n.required=!!R(t).required,q(n,`inputmode`,R(t).type===`number`?`decimal`:void 0),q(n,`pattern`,R(t).type===`number`?`-?\\d+(\\.\\d+)?`:void 0)}),Sa(n,()=>R(i)[R(t).name],e=>R(i)[R(t).name]=e),H(e,n)};W(c,e=>{R(t).type===`choice`?e(l):e(u,-1)}),D(n),L(()=>U(a,R(t).label??R(t).name)),H(e,n)});var g=I(h,2),_=F(g,!0),v=I(g,2),y=N(v),b=I(y,2);let x;var S=F(b,!0);D(v),D(m),L(()=>{U(d,`${R(t).command.label??``} on ${R(t).appName??``}`),U(_,R(a)),x=K(b,1,`go svelte-gr1w3a`,null,x,{danger:!!R(t).command.confirm}),b.disabled=R(o),U(S,R(t).command.label)}),B(`click`,l,()=>R(n)?.close()),z(`submit`,m,c),B(`click`,y,()=>R(n)?.close()),H(e,s)};return W(d,e=>{R(r)&&e(f)}),D(u),Ma(u,e=>M(n,e),()=>R(n)),H(e,u),k(l)}Qr([`click`]);var Oc=new Set([`$$slots`,`$$events`,`$$legacy`]);function kc(e,t){let n=J(t,Oc),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 Ac=new Set([`$$slots`,`$$events`,`$$legacy`]);function jc(e,t){let n=J(t,Ac),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 Mc=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nc(e,t){let n=J(t,Mc),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 Pc(e,t){let n=Y(t,`size`,3,14);X(e,{get of(){return Nc},get size(){return n()}})}var Fc=V(`<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 Ic(e,t){O(t,!0);let n=j(!1),r=async()=>{await navigator.clipboard.writeText(t.command).then(()=>!0,()=>!1)?(M(n,!0),setTimeout(()=>M(n,!1),1500)):$.show(`Copy is blocked here. Select the command and copy it.`,`warning`)};var i=Fc(),a=N(i),o=F(a,!0),s=I(a,2),c=F(s,!0);D(i),L(()=>{U(o,t.command),q(s,`aria-label`,t.label),U(c,R(n)?`Copied`:`Copy`)}),B(`click`,s,r),H(e,i),k()}Qr([`click`]);var Lc={value:()=>{}};function Rc(){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 zc(n)}function zc(e){this._=e}function Bc(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}})}zc.prototype=Rc.prototype={constructor:zc,on:function(e,t){var n=this._,r=Bc(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Vc(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]=Hc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Hc(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 zc(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 Vc(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Hc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Lc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Uc={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 Wc(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Uc.hasOwnProperty(t)?{space:Uc[t],local:e}:e}function Gc(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 Kc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qc(e){var t=Wc(e);return(t.local?Kc:Gc)(t)}function Jc(){}function Yc(e){return e==null?Jc:function(){return this.querySelector(e)}}function Xc(e){typeof e!=`function`&&(e=Yc(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 Ru(r,this._parents)}function Zc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qc(){return[]}function $c(e){return e==null?Qc:function(){return this.querySelectorAll(e)}}function el(e){return function(){return Zc(e.apply(this,arguments))}}function tl(e){e=typeof e==`function`?el(e):$c(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 Ru(r,i)}function nl(e){return function(){return this.matches(e)}}function rl(e){return function(t){return t.matches(e)}}var il=Array.prototype.find;function al(e){return function(){return il.call(this.children,e)}}function ol(){return this.firstElementChild}function sl(e){return this.select(e==null?ol:al(typeof e==`function`?e:rl(e)))}var cl=Array.prototype.filter;function ll(){return Array.from(this.children)}function ul(e){return function(){return cl.call(this.children,e)}}function dl(e){return this.selectAll(e==null?ll:ul(typeof e==`function`?e:rl(e)))}function fl(e){typeof e!=`function`&&(e=nl(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 Ru(r,this._parents)}function pl(e){return Array(e.length)}function ml(){return new Ru(this._enter||this._groups.map(pl),this._parents)}function hl(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}hl.prototype={constructor:hl,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 gl(e){return function(){return e}}function _l(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 hl(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function vl(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 hl(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function yl(e){return e.__data__}function bl(e,t){if(!arguments.length)return Array.from(this,yl);var n=t?vl:_l,r=this._parents,i=this._groups;typeof e!=`function`&&(e=gl(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=xl(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 Ru(o,r),o._enter=s,o._exit=c,o}function xl(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Sl(){return new Ru(this._exit||this._groups.map(pl),this._parents)}function Cl(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 wl(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 Ru(s,this._parents)}function Tl(){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 El(e){e||=Dl;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 Ru(i,this._parents).order()}function Dl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ol(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kl(){return Array.from(this)}function Al(){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 jl(){let e=0;for(let t of this)++e;return e}function Ml(){return!this.node()}function Nl(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 Pl(e){return function(){this.removeAttribute(e)}}function Fl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Il(e,t){return function(){this.setAttribute(e,t)}}function Ll(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Rl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zl(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 Bl(e,t){var n=Wc(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?Fl:Pl:typeof t==`function`?n.local?zl:Rl:n.local?Ll:Il)(n,t))}function Vl(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hl(e){return function(){this.style.removeProperty(e)}}function Ul(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Wl(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Gl(e,t,n){return arguments.length>1?this.each((t==null?Hl:typeof t==`function`?Wl:Ul)(e,t,n??``)):Kl(this.node(),e)}function Kl(e,t){return e.style.getPropertyValue(t)||Vl(e).getComputedStyle(e,null).getPropertyValue(t)}function ql(e){return function(){delete this[e]}}function Jl(e,t){return function(){this[e]=t}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Xl(e,t){return arguments.length>1?this.each((t==null?ql:typeof t==`function`?Yl:Jl)(e,t)):this.node()[e]}function Zl(e){return e.trim().split(/^|\s+/)}function Ql(e){return e.classList||new $l(e)}function $l(e){this._node=e,this._names=Zl(e.getAttribute(`class`)||``)}$l.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 eu(e,t){for(var n=Ql(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function tu(e,t){for(var n=Ql(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function nu(e){return function(){eu(this,e)}}function ru(e){return function(){tu(this,e)}}function iu(e,t){return function(){(t.apply(this,arguments)?eu:tu)(this,e)}}function au(e,t){var n=Zl(e+``);if(arguments.length<2){for(var r=Ql(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?iu:t?nu:ru)(n,t))}function ou(){this.textContent=``}function su(e){return function(){this.textContent=e}}function cu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function lu(e){return arguments.length?this.each(e==null?ou:(typeof e==`function`?cu:su)(e)):this.node().textContent}function uu(){this.innerHTML=``}function du(e){return function(){this.innerHTML=e}}function fu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function pu(e){return arguments.length?this.each(e==null?uu:(typeof e==`function`?fu:du)(e)):this.node().innerHTML}function mu(){this.nextSibling&&this.parentNode.appendChild(this)}function hu(){return this.each(mu)}function gu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _u(){return this.each(gu)}function vu(e){var t=typeof e==`function`?e:qc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yu(){return null}function bu(e,t){var n=typeof e==`function`?e:qc(e),r=t==null?yu:typeof t==`function`?t:Yc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function Su(){return this.each(xu)}function Cu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function wu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tu(e){return this.select(e?wu:Cu)}function Eu(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Du(e){return function(t){e.call(this,t,this.__data__)}}function Ou(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 ku(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 Au(e,t,n){return function(){var r=this.__on,i,a=Du(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 ju(e,t,n){var r=Ou(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?Au:ku,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function Mu(e,t,n){var r=Vl(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 Nu(e,t){return function(){return Mu(this,e,t)}}function Pu(e,t){return function(){return Mu(this,e,t.apply(this,arguments))}}function Fu(e,t){return this.each((typeof t==`function`?Pu:Nu)(e,t))}function*Iu(){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 Lu=[null];function Ru(e,t){this._groups=e,this._parents=t}function zu(){return new Ru([[document.documentElement]],Lu)}function Bu(){return this}Ru.prototype=zu.prototype={constructor:Ru,select:Xc,selectAll:tl,selectChild:sl,selectChildren:dl,filter:fl,data:bl,enter:ml,exit:Sl,join:Cl,merge:wl,selection:Bu,order:Tl,sort:El,call:Ol,nodes:kl,node:Al,size:jl,empty:Ml,each:Nl,attr:Bl,style:Gl,property:Xl,classed:au,text:lu,html:pu,raise:hu,lower:_u,append:vu,insert:bu,remove:Su,clone:Tu,datum:Eu,on:ju,dispatch:Fu,[Symbol.iterator]:Iu};function Vu(e){return typeof e==`string`?new Ru([[document.querySelector(e)]],[document.documentElement]):new Ru([[e]],Lu)}function Hu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Uu(e,t){if(e=Hu(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 Wu={passive:!1},Gu={capture:!0,passive:!1};function Ku(e){e.stopImmediatePropagation()}function qu(e){e.preventDefault(),e.stopImmediatePropagation()}function Ju(e){var t=e.document.documentElement,n=Vu(e).on(`dragstart.drag`,qu,Gu);`onselectstart`in t?n.on(`selectstart.drag`,qu,Gu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Yu(e,t){var n=e.document.documentElement,r=Vu(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,qu,Gu),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 Xu=e=>()=>e;function Zu(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}})}Zu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Qu(e){return!e.ctrlKey&&!e.button}function $u(){return this.parentNode}function ed(e,t){return t??{x:e.x,y:e.y}}function td(){return navigator.maxTouchPoints||`ontouchstart`in this}function nd(){var e=Qu,t=$u,n=ed,r=td,i={},a=Rc(`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`,_,Wu).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&&(Vu(n.view).on(`mousemove.drag`,m,Gu).on(`mouseup.drag`,h,Gu),Ju(n.view),Ku(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(qu(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Vu(e.view).on(`mousemove.drag mouseup.drag`,null),Yu(e.view,l),qu(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]))&&(Ku(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])&&(qu(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])&&(Ku(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=Uu(l||r,t),p,m,h;if((h=n.call(e,new Zu(`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=Uu(l||a,t),_=o}u.call(r,e,new Zu(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:Xu(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Xu(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Xu(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Xu(!!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 rd(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function id(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ad(){}var od=.7,sd=1/od,cd=`\\s*([+-]?\\d+)\\s*`,ld=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,ud=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,dd=/^#([0-9a-f]{3,8})$/,fd=RegExp(`^rgb\\(${cd},${cd},${cd}\\)$`),pd=RegExp(`^rgb\\(${ud},${ud},${ud}\\)$`),md=RegExp(`^rgba\\(${cd},${cd},${cd},${ld}\\)$`),hd=RegExp(`^rgba\\(${ud},${ud},${ud},${ld}\\)$`),gd=RegExp(`^hsl\\(${ld},${ud},${ud}\\)$`),_d=RegExp(`^hsla\\(${ld},${ud},${ud},${ld}\\)$`),vd={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};rd(ad,Cd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yd,formatHex:yd,formatHex8:bd,formatHsl:xd,formatRgb:Sd,toString:Sd});function yd(){return this.rgb().formatHex()}function bd(){return this.rgb().formatHex8()}function xd(){return Id(this).formatHsl()}function Sd(){return this.rgb().formatRgb()}function Cd(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=dd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wd(t):n===3?new Od(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Td(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Td(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=fd.exec(e))?new Od(t[1],t[2],t[3],1):(t=pd.exec(e))?new Od(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=md.exec(e))?Td(t[1],t[2],t[3],t[4]):(t=hd.exec(e))?Td(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gd.exec(e))?Fd(t[1],t[2]/100,t[3]/100,1):(t=_d.exec(e))?Fd(t[1],t[2]/100,t[3]/100,t[4]):vd.hasOwnProperty(e)?wd(vd[e]):e===`transparent`?new Od(NaN,NaN,NaN,0):null}function wd(e){return new Od(e>>16&255,e>>8&255,e&255,1)}function Td(e,t,n,r){return r<=0&&(e=t=n=NaN),new Od(e,t,n,r)}function Ed(e){return e instanceof ad||(e=Cd(e)),e?(e=e.rgb(),new Od(e.r,e.g,e.b,e.opacity)):new Od}function Dd(e,t,n,r){return arguments.length===1?Ed(e):new Od(e,t,n,r??1)}function Od(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rd(Od,Dd,id(ad,{brighter(e){return e=e==null?sd:sd**+e,new Od(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?od:od**+e,new Od(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Od(Nd(this.r),Nd(this.g),Nd(this.b),Md(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:kd,formatHex:kd,formatHex8:Ad,formatRgb:jd,toString:jd}));function kd(){return`#${Pd(this.r)}${Pd(this.g)}${Pd(this.b)}`}function Ad(){return`#${Pd(this.r)}${Pd(this.g)}${Pd(this.b)}${Pd((isNaN(this.opacity)?1:this.opacity)*255)}`}function jd(){let e=Md(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Nd(this.r)}, ${Nd(this.g)}, ${Nd(this.b)}${e===1?`)`:`, ${e})`}`}function Md(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Nd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pd(e){return e=Nd(e),(e<16?`0`:``)+e.toString(16)}function Fd(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rd(e,t,n,r)}function Id(e){if(e instanceof Rd)return new Rd(e.h,e.s,e.l,e.opacity);if(e instanceof ad||(e=Cd(e)),!e)return new Rd;if(e instanceof Rd)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 Rd(o,s,c,e.opacity)}function Ld(e,t,n,r){return arguments.length===1?Id(e):new Rd(e,t,n,r??1)}function Rd(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rd(Rd,Ld,id(ad,{brighter(e){return e=e==null?sd:sd**+e,new Rd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?od:od**+e,new Rd(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 Od(Vd(e>=240?e-240:e+120,i,r),Vd(e,i,r),Vd(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rd(zd(this.h),Bd(this.s),Bd(this.l),Md(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=Md(this.opacity);return`${e===1?`hsl(`:`hsla(`}${zd(this.h)}, ${Bd(this.s)*100}%, ${Bd(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function zd(e){return e=(e||0)%360,e<0?e+360:e}function Bd(e){return Math.max(0,Math.min(1,e||0))}function Vd(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 Hd=e=>()=>e;function Ud(e,t){return function(n){return e+n*t}}function Wd(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Gd(e){return(e=+e)==1?Kd:function(t,n){return n-t?Wd(t,n,e):Hd(isNaN(t)?n:t)}}function Kd(e,t){var n=t-e;return n?Ud(e,n):Hd(isNaN(e)?t:e)}var qd=(function e(t){var n=Gd(t);function r(e,t){var r=n((e=Dd(e)).r,(t=Dd(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Kd(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 Jd(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 Yd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Xd(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]=of(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 Zd(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Qd(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function $d(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]=of(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var ef=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tf=new RegExp(ef.source,`g`);function nf(e){return function(){return e}}function rf(e){return function(t){return e(t)+``}}function af(e,t){var n=ef.lastIndex=tf.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=ef.exec(e))&&(i=tf.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:Qd(r,i)})),n=tf.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?rf(c[0].x):nf(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 of(e,t){var n=typeof t,r;return t==null||n===`boolean`?Hd(t):(n===`number`?Qd:n===`string`?(r=Cd(t))?(t=r,qd):af:t instanceof Cd?qd:t instanceof Date?Zd:Yd(t)?Jd:Array.isArray(t)?Xd:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?$d:Qd)(e,t)}var sf=180/Math.PI,cf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lf(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)*sf,skewX:Math.atan(c)*sf,scaleX:o,scaleY:s}}var uf;function df(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?cf:lf(t.a,t.b,t.c,t.d,t.e,t.f)}function ff(e){return e==null||(uf||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),uf.setAttribute(`transform`,e),!(e=uf.transform.baseVal.consolidate()))?cf:(e=e.matrix,lf(e.a,e.b,e.c,e.d,e.e,e.f))}function pf(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:Qd(e,i)},{i:c-2,x:Qd(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:Qd(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:Qd(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:Qd(e,n)},{i:s-2,x:Qd(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 mf=pf(df,`px, `,`px)`,`deg)`),hf=pf(ff,`, `,`)`,`)`),gf=1e-12;function _f(e){return((e=Math.exp(e))+1/e)/2}function vf(e){return((e=Math.exp(e))-1/e)/2}function yf(e){return((e=Math.exp(2*e))-1)/(e+1)}var bf=(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<gf)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=_f(y),c=s/(n*g)*(i*yf(t*r+y)-vf(y));return[a+c*d,o+c*f,s*i/_f(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),xf=0,Sf=0,Cf=0,wf=1e3,Tf,Ef,Df=0,Of=0,kf=0,Af=typeof performance==`object`&&performance.now?performance:Date,jf=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mf(){return Of||=(jf(Nf),Af.now()+kf)}function Nf(){Of=0}function Pf(){this._call=this._time=this._next=null}Pf.prototype=Ff.prototype={constructor:Pf,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Mf():+n)+(t==null?0:+t),!this._next&&Ef!==this&&(Ef?Ef._next=this:Tf=this,Ef=this),this._call=e,this._time=n,Bf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bf())}};function Ff(e,t,n){var r=new Pf;return r.restart(e,t,n),r}function If(){Mf(),++xf;for(var e=Tf,t;e;)(t=Of-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xf}function Lf(){Of=(Df=Af.now())+kf,xf=Sf=0;try{If()}finally{xf=0,zf(),Of=0}}function Rf(){var e=Af.now(),t=e-Df;t>wf&&(kf-=t,Df=e)}function zf(){for(var e,t=Tf,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:Tf=n);Ef=e,Bf(r)}function Bf(e){xf||(Sf&&=clearTimeout(Sf),e-Of>24?(e<1/0&&(Sf=setTimeout(Lf,e-Af.now()-kf)),Cf&&=clearInterval(Cf)):(Cf||=(Df=Af.now(),setInterval(Rf,wf)),xf=1,jf(Lf)))}function Vf(e,t,n){var r=new Pf;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Hf=Rc(`start`,`end`,`cancel`,`interrupt`),Uf=[];function Wf(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Jf(e,n,{name:t,index:r,group:i,on:Hf,tween:Uf,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Gf(e,t){var n=qf(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Kf(e,t){var n=qf(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function qf(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Jf(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Ff(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 Vf(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(Vf(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 Yf(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 Xf(e){return this.each(function(){Yf(this,e)})}function Zf(e,t){var n,r;return function(){var i=Kf(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 Qf(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Kf(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 $f(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=qf(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?Zf:Qf)(n,e,t))}function ep(e,t,n){var r=e._id;return e.each(function(){var e=Kf(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return qf(e,r).value[t]}}function tp(e,t){var n;return(typeof t==`number`?Qd:t instanceof Cd?qd:(n=Cd(t))?(t=n,qd):af)(e,t)}function np(e){return function(){this.removeAttribute(e)}}function rp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ip(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 ap(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 op(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 sp(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 cp(e,t){var n=Wc(e),r=n===`transform`?hf:tp;return this.attrTween(e,typeof t==`function`?(n.local?sp:op)(n,r,ep(this,`attr.`+e,t)):t==null?(n.local?rp:np)(n):(n.local?ap:ip)(n,r,t))}function lp(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function up(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function dp(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 fp(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&lp(e,i)),n}return i._value=t,i}function pp(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=Wc(e);return this.tween(n,(r.local?dp:fp)(r,t))}function mp(e,t){return function(){Gf(this,e).delay=+t.apply(this,arguments)}}function hp(e,t){return t=+t,function(){Gf(this,e).delay=t}}function gp(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?mp:hp)(t,e)):qf(this.node(),t).delay}function _p(e,t){return function(){Kf(this,e).duration=+t.apply(this,arguments)}}function vp(e,t){return t=+t,function(){Kf(this,e).duration=t}}function yp(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_p:vp)(t,e)):qf(this.node(),t).duration}function bp(e,t){if(typeof t!=`function`)throw Error();return function(){Kf(this,e).ease=t}}function xp(e){var t=this._id;return arguments.length?this.each(bp(t,e)):qf(this.node(),t).ease}function Sp(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Kf(this,e).ease=n}}function Cp(e){if(typeof e!=`function`)throw Error();return this.each(Sp(this._id,e))}function wp(e){typeof e!=`function`&&(e=nl(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 $p(r,this._parents,this._name,this._id)}function Tp(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 $p(o,this._parents,this._name,this._id)}function Ep(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 Dp(e,t,n){var r,i,a=Ep(t)?Gf:Kf;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Op(e,t){var n=this._id;return arguments.length<2?qf(this.node(),n).on.on(e):this.each(Dp(n,e,t))}function kp(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ap(){return this.on(`end.remove`,kp(this._id))}function jp(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Yc(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,Wf(l[f],t,n,f,l,qf(u,n)));return new $p(a,this._parents,t,n)}function Mp(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=$c(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=qf(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Wf(p,t,n,h,f,m);a.push(f),o.push(u)}return new $p(a,o,t,n)}var Np=zu.prototype.constructor;function Pp(){return new Np(this._groups,this._parents)}function Fp(e,t){var n,r,i;return function(){var a=Kl(this,e),o=(this.style.removeProperty(e),Kl(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function Ip(e){return function(){this.style.removeProperty(e)}}function Lp(e,t,n){var r,i=n+``,a;return function(){var o=Kl(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Rp(e,t,n){var r,i,a;return function(){var o=Kl(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Kl(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function zp(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Kf(this,e),l=c.on,u=c.value[a]==null?s||=Ip(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Bp(e,t,n){var r=(e+=``)==`transform`?mf:tp;return t==null?this.styleTween(e,Fp(e,r)).on(`end.style.`+e,Ip(e)):typeof t==`function`?this.styleTween(e,Rp(e,r,ep(this,`style.`+e,t))).each(zp(this._id,e)):this.styleTween(e,Lp(e,r,t),n).on(`end.style.`+e,null)}function Vp(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Hp(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Vp(e,a,n)),r}return a._value=t,a}function Up(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,Hp(e,t,n??``))}function Wp(e){return function(){this.textContent=e}}function Gp(e){return function(){var t=e(this);this.textContent=t??``}}function Kp(e){return this.tween(`text`,typeof e==`function`?Gp(ep(this,`text`,e)):Wp(e==null?``:e+``))}function qp(e){return function(t){this.textContent=e.call(this,t)}}function Jp(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&qp(r)),t}return r._value=e,r}function Yp(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,Jp(e))}function Xp(){for(var e=this._name,t=this._id,n=em(),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=qf(c,t);Wf(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new $p(r,this._parents,e,n)}function Zp(){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=Kf(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 Qp=0;function $p(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function em(){return++Qp}var tm=zu.prototype;$p.prototype={constructor:$p,select:jp,selectAll:Mp,selectChild:tm.selectChild,selectChildren:tm.selectChildren,filter:wp,merge:Tp,selection:Pp,transition:Xp,call:tm.call,nodes:tm.nodes,node:tm.node,size:tm.size,empty:tm.empty,each:tm.each,on:Op,attr:cp,attrTween:pp,style:Bp,styleTween:Up,text:Kp,textTween:Yp,remove:Ap,tween:$f,delay:gp,duration:yp,ease:xp,easeVarying:Cp,end:Zp,[Symbol.iterator]:tm[Symbol.iterator]};function nm(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rm={time:null,delay:0,duration:250,ease:nm};function im(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function am(e){var t,n;e instanceof $p?(t=e._id,e=e._name):(t=em(),(n=rm).time=Mf(),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])&&Wf(c,e,t,l,o,n||im(c,t));return new $p(r,this._parents,e,t)}zu.prototype.interrupt=Xf,zu.prototype.transition=am;var om=e=>()=>e;function sm(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 cm(e,t,n){this.k=e,this.x=t,this.y=n}cm.prototype={constructor:cm,scale:function(e){return e===1?this:new cm(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new cm(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 lm=new cm(1,0,0);um.prototype=cm.prototype;function um(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lm;return e.__zoom}function dm(e){e.stopImmediatePropagation()}function fm(e){e.preventDefault(),e.stopImmediatePropagation()}function pm(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function mm(){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 hm(){return this.__zoom||lm}function gm(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _m(){return navigator.maxTouchPoints||`ontouchstart`in this}function vm(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 ym(){var e=pm,t=mm,n=vm,r=gm,i=_m,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=bf,l=Rc(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,hm).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,ee).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`,hm),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(lm.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 cm(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 cm(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 cm(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=Vu(this.that).datum();l.call(e,this.that,new sm(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=Uu(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)],Yf(this),s.start();fm(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 T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Vu(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Uu(t,i),l=t.clientX,u=t.clientY;Ju(t.view),dm(t),a.mouse=[c,this.__zoom.invert(c)],Yf(this),a.start();function d(e){if(fm(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]=Uu(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Yu(e.view,a.moved),fm(e),a.event(e).end()}}function ee(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Uu(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);fm(r),s>0?Vu(this).transition().duration(s).call(x,d,c,r):Vu(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(dm(t),s=0;s<i;++s)c=r[s],l=Uu(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)),Yf(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(fm(e),s=0;s<a;++s)c=i[s],l=Uu(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(dm(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=Uu(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Vu(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:om(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:om(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:om(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:om([[+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 bm={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.`},xm=[[-1/0,-1/0],[1/0,1/0]],Sm=[`Enter`,` `,`Escape`],Cm={"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`},wm;(function(e){e.Strict=`strict`,e.Loose=`loose`})(wm||={});var Tm;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Tm||={});var Em;(function(e){e.Partial=`partial`,e.Full=`full`})(Em||={});var Dm={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Om;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Om||={});var km;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(km||={});var Am;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Am||={});var jm={[Am.Left]:Am.Right,[Am.Right]:Am.Left,[Am.Top]:Am.Bottom,[Am.Bottom]:Am.Top},Mm=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Nm=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Pm=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Fm=(e,t=[0,0])=>{let{width:n,height:r}=hh(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Im=(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):Pm(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,Ym(e,$m(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Zm(r):{x:0,y:0,width:0,height:0}},Lm=(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=Ym(n,$m(e)),r=!0)}),r?Zm(n):{x:0,y:0,width:0,height:0}},Rm=(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=th(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},zm=(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 Bm(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}=hh(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 Vm({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=fh(Lm(Bm(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 Hm({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`,bm.error005());else{let{width:e,height:t}=hh(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&mh(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=mh(d)?Gm(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,bm.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 Um({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=zm(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 Wm=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Gm=(e={x:0,y:0},t,n)=>({x:Wm(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Wm(e.y,t[0][1],t[1][1]-(n?.height??0))});function Km(e,t,n){let{width:r,height:i}=hh(n),{x:a,y:o}=n.internals.positionAbsolute;return Gm(e,[[a,o],[a+r,o+i]],t)}var qm=(e,t,n)=>e<t?Wm(Math.abs(e-t),1,t)/t:e>n?-Wm(Math.abs(e-n),1,t)/t:0,Jm=(e,t,n=15,r=40)=>[qm(e.x,r,t.width-r)*n,qm(e.y,r,t.height-r)*n],Ym=(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)}),Xm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Zm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qm=(e,t=[0,0])=>{let{x:n,y:r}=Pm(e)?e.internals.positionAbsolute:Fm(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}},$m=(e,t=[0,0])=>{let{x:n,y:r}=Pm(e)?e.internals.positionAbsolute:Fm(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)}},eh=(e,t)=>Zm(Ym(Xm(e),Xm(t))),th=(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)},nh=(e,t)=>th(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),rh=e=>ih(e.width)&&ih(e.height)&&ih(e.x)&&ih(e.y),ih=e=>!isNaN(e)&&isFinite(e),ah=(e,t)=>(e,t)=>{},oh=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),sh=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?oh(s,o):s},ch=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lh(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 uh(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=lh(e,n),i=lh(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=lh(e.top??e.y??0,n),i=lh(e.bottom??e.y??0,n),a=lh(e.left??e.x??0,t),o=lh(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 dh(e,t,n,r,i,a){let{x:o,y:s}=ch(e,[t,n,r]),{x:c,y:l}=ch({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 fh=(e,t,n,r,i,a)=>{let o=uh(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Wm(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=dh(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}},ph=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function mh(e){return e!=null&&e!==`parent`}function hh(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function gh(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function _h(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 vh(e){return{...Cm,...e||{}}}function yh(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 bh(e,t,n){if(!n)return;let r=[];e.forEach((e,n)=>{t?.has(n)||r.push(e)}),r.length&&n(r)}function xh(e){return e===null?null:e?`valid`:`invalid`}function Sh(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Oh(e),s=sh({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?oh(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Ch=e=>({width:e.offsetWidth,height:e.offsetHeight}),wh=e=>e?.getRootNode?.()||window?.document,Th=[`INPUT`,`SELECT`,`TEXTAREA`];function Eh(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Th.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Dh=e=>`clientX`in e,Oh=(e,t)=>{let n=Dh(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)}},kh=(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,...Ch(t)}})};function Ah({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 jh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mh({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Am.Left:return[t-jh(t-r,a),n];case Am.Right:return[t+jh(r-t,a),n];case Am.Top:return[t,n-jh(n-i,a)];case Am.Bottom:return[t,n+jh(i-n,a)]}}function Nh({sourceX:e,sourceY:t,sourcePosition:n=Am.Bottom,targetX:r,targetY:i,targetPosition:a=Am.Top,curvature:o=.25}){let[s,c]=Mh({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Mh({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Ah({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 Ph({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 Fh({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 Ih({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Ym($m(e),$m(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),nh({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Zm(a))>0}var Lh=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Rh=(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)),zh=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,bm.error006()),t;let r=n.getEdgeId||Lh,i;return i=Mm(e)?{...e}:{...e,id:r(e)},Rh(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Bh({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Ph({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Vh={[Am.Left]:{x:-1,y:0},[Am.Right]:{x:1,y:0},[Am.Top]:{x:0,y:-1},[Am.Bottom]:{x:0,y:1}},Hh=({source:e,sourcePosition:t=Am.Bottom,target:n})=>t===Am.Left||t===Am.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},Uh=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Wh({source:e,sourcePosition:t=Am.Bottom,target:n,targetPosition:r=Am.Top,center:i,offset:a,stepPosition:o}){let s=Vh[t],c=Vh[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=Hh({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]=Ph({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 Gh(e,t,n,r){let i=Math.min(Uh(e,t)/2,Uh(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 Kh({sourceX:e,sourceY:t,sourcePosition:n=Am.Bottom,targetX:r,targetY:i,targetPosition:a=Am.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Wh({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+=Gh(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 qh(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Jh(e){let{sourceNode:t,targetNode:n}=e;if(!qh(t)||!qh(n))return null;let r=t.internals.handleBounds||Yh(t.handles),i=n.internals.handleBounds||Yh(n.handles),a=Zh(r?.source??[],e.sourceHandle),o=Zh(e.connectionMode===wm.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,bm.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Am.Bottom,c=o?.position||Am.Top,l=Xh(t,a,s),u=Xh(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Yh(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 Xh(e,t,n=Am.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??hh(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Am.Top:return{x:i+o/2,y:a};case Am.Right:return{x:i+o,y:a+s/2};case Am.Bottom:return{x:i+o/2,y:a+s};case Am.Left:return{x:i,y:a+s/2}}}function Zh(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Qh(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function $h(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=Qh(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 eg(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 Am.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 Am.Bottom:o[1]=(e.y+e.height)*t.zoom+t.y+r,s[1]=0;break;case Am.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 tg=1e3,ng=10,rg={nodeOrigin:[0,0],nodeExtent:xm,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},ig={...rg,checkEquality:!0};function ag(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function og(e,t,n){let r=ag(rg,n);for(let n of e.values())if(n.parentId)dg(n,e,t,r);else{let e=Gm(Fm(n,r.nodeOrigin),mh(n.extent)?n.extent:r.nodeExtent,hh(n));n.internals.positionAbsolute=e}}function sg(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 cg(e){return e===`manual`}function lg(e,t,n,r={}){let i=ag(ig,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!cg(i.zIndexMode)?tg: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=Gm(Fm(u,i.nodeOrigin),mh(u.extent)?u.extent:i.nodeExtent,hh(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:sg(u,e),z:fg(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&&dg(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function ug(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 dg(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=ag(rg,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}ug(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*ng),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=pg(e,u,o,s,a&&!cg(c)?tg: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 fg(e,t,n){let r=ih(e.zIndex)?e.zIndex:0;return cg(n)?r:r+(e.selected?t:0)}function pg(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=hh(e),l=Fm(e,n),u=mh(e.extent)?Gm(l,e.extent,c):l,d=Gm({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Km(d,c,t));let f=fg(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function mg(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=eh(a.get(n.parentId)?.expandedRect??Qm(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=hh(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 hg(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=Ch(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=mh(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Km(h,s,n))}else m&&(h=Gm(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:kh(`source`,r.nodeElement,p,d,e.id),target:kh(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&dg(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:Qm(g,i)}))}}if(f.length>0){let e=mg(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function gg({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 _g(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 vg(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}`;_g(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),_g(`target`,s,c,e,i,o),t.set(r.id,r)}}function yg(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:yg(n,t):!1}function bg(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 xg(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!yg(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 Sg({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 Cg({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=oh(a,t);return{x:o.x-a.x,y:o.y-a.y}}function wg({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=Vu(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?Xm(Lm(s)):null,x=v&&l?Cg({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)}:oh(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}=Hm({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]=Sg({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]=Jm(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=Sh(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=xg(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Sg({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=nd().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=Sh(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Oh(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Sh(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=Oh(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=Oh(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]=Sg({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||!bg(t,`.${g}`,v))&&(!_||bg(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Tg(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())nh(i,Qm(e))>0&&r.push(e);return r}var Eg=250;function Dg(e,t,n,r){let i=[],a=1/0,o=Tg(e,n,t+Eg);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}=Xh(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 Og(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,...Xh(o,c,c.position,!0)}:c}function kg(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Ag(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var jg=()=>!0;function Mg(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:_=jg,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=wh(e.target),ee=0,te,{x:E,y:ne}=Oh(e),re=kg(a,w),ie=s?.getBoundingClientRect(),ae=!1;if(!ie||!re)return;let oe=Og(i,re,r,c,t);if(!oe)return;let se=Oh(e,ie),ce=!1,le=null,ue=!1,de=null;function fe(){if(!u||!ie)return;let[e,t]=Jm(se,ie,S);f({x:e,y:t}),ee=requestAnimationFrame(fe)}let pe={...oe,nodeId:i,type:re,position:oe.position},me=c.get(i),he={inProgress:!0,isValid:null,from:Xh(me,pe,Am.Left,!0),fromHandle:pe,fromPosition:pe.position,fromNode:me,to:se,toHandle:null,toPosition:jm[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}=Oh(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=Oh(e,ie),te=Dg(sh(se,a,!1,[1,1]),n,c,pe),ce||=(fe(),!0);let s=Ng(e,{handle:te,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});de=s.handleDomNode,le=s.connection,ue=Ag(!!te,s.isValid);let u=c.get(i),f=u?Xh(u,pe,Am.Left,!0):he.from,p={...he,from:f,isValid:ue,to:s.toHandle&&ue?ch({x:s.toHandle.x,y:s.toHandle.y},a):se,toHandle:s.toHandle,toPosition:ue&&s.toHandle?s.toHandle.position:jm[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(ee),ce=!1,ue=!1,le=null,de=null,T.removeEventListener(`mousemove`,_e),T.removeEventListener(`mouseup`,ve),T.removeEventListener(`touchmove`,_e),T.removeEventListener(`touchend`,ve)}}T.addEventListener(`mousemove`,_e),T.addEventListener(`mouseup`,ve),T.addEventListener(`touchmove`,_e),T.addEventListener(`touchend`,ve)}function Ng(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=jg,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}=Oh(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=kg(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===wm.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Og(t,e,a,u,n,!0)}return _}var Pg={onPointerDown:Mg,isValid:Ng};function Fg({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Vu(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&&ph()?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=ym().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:Uu}}var Ig=e=>({x:e.x,y:e.y,zoom:e.k}),Lg=({x:e,y:t,zoom:n})=>lm.translate(e,t).scale(n),Rg=(e,t)=>e.target.closest(`.${t}`),zg=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bg=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Vg=(e,t=0,n=Bg,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Hg=e=>{let t=e.ctrlKey&&ph()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ug({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Rg(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=Uu(u),t=d*2**Hg(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Tm.Vertical?0:u.deltaX*f,m=i===Tm.Horizontal?0:u.deltaY*f;!ph()&&u.shiftKey&&i!==Tm.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Ig(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 Wg({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Rg(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Gg({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Ig(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 Kg({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&zg(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Ig(a.transform))}}function qg({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&zg(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Ig(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Jg({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`&&(Rg(f,`${u}-flow__node`)||Rg(f,`${u}-flow__edge`)||Rg(f,`${u}-flow__selection`)||Rg(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||Rg(f,c)&&h||Rg(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 Yg({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=ym().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=Vu(e).call(f);y({x:i.x,y:i.y,zoom:Wm(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(Hg);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?of:bf).transform(Vg(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:T,connectionInProgress:ee,paneClickDistance:te,selectionOnDrag:E}){r&&!l.isZoomingOrPanning&&v();let ne=i&&!C&&!r;f.clickDistance(E?1/0:!ih(te)||te<0?0:te);let re=ne?Ug({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Wg({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,re,{passive:!1});let ie=Gg({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,ie);let ae=Kg({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,ae);let oe=qg({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,oe);let se=Jg({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:ee});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=Lg(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=Lg(e);return await g(n,t),n}function x(e){if(p){let t=Lg(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?um(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`?of:bf).scaleTo(Vg(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?of:bf).scaleBy(Vg(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function ee(e){f?.translateExtent(e)}function te(e){let t=!ih(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:ee,syncViewport:x,setClickDistance:te}}var Xg;(function(e){e.Line=`line`,e.Handle=`handle`})(Xg||={});var Zg=ah(`Svelte Flow`,`https://svelteflow.dev/`);function Qg(e,t,n={}){return zh(e,t,{...n,onError:n.onError??Zg})}function $g(){let e={};return[t=>{if(t&&!st(e))throw Error(t);return at(e)},t=>ot(e,t)]}var[e_,t_]=$g(),[n_,r_]=$g(),[i_,a_]=$g(),o_=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`type`,`position`,`style`,`class`,`isConnectable`,`isConnectableStart`,`isConnectableEnd`,`isValidConnection`,`onconnect`,`ondisconnect`,`children`]),s_=V(`<div><!></div>`);function c_(e,t){O(t,!0);let n=Y(t,`id`,3,null),r=Y(t,`type`,3,`source`),i=Y(t,`position`,19,()=>Am.Top),a=Y(t,`isConnectableStart`,3,!0),o=Y(t,`isConnectableEnd`,3,!0),s=J(t,o_),c=e_(`Handle must be used within a Custom Node component`),l=n_(`Handle must be used within a Custom Node component`),u=A(()=>r()===`target`),d=A(()=>t.isConnectable===void 0?l.value:t.isConnectable),p=Z_(),m=A(()=>p.ariaLabelConfig),h=null;zn(()=>{if(t.onconnect||t.ondisconnect){p.edges;let e=p.connectionLookup.get(`${c}-${r()}${n()?`-${n()}`:``}`);if(h&&!yh(e,h)){let n=e??new Map;bh(h,n,t.ondisconnect),bh(n,h,t.onconnect)}h=new Map(e)}});let g=A(()=>{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===wm.Strict?e?.type!==r():c!==e?.nodeId||n()!==e?.id,o&&i]}),_=A(()=>v(R(g),5)),y=A(()=>R(_)[0]),b=A(()=>R(_)[1]),x=A(()=>R(_)[2]),S=A(()=>R(_)[3]),C=A(()=>R(_)[4]);function w(e){let t=p.onbeforeconnect?p.onbeforeconnect(e):e;t&&(p.addEdge(t),p.onconnect?.(e))}function T(e){let r=Dh(e);e.currentTarget&&(r&&e.button===0||!r)&&Pg.onPointerDown(e,{handleId:n(),nodeId:c,isTarget:R(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 ee(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=wh(e.target),o=t.isValidConnection??p.isValidConnection,{connectionMode:s,clickConnectStartHandle:l,flowId:u,nodeLookup:d}=p,{connection:f,isValid:m}=Pg.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($e(p.connection));delete h.inProgress,h.toPosition=h.toHandle?h.toHandle.position:null,p.onclickconnectend?.(e,h),p.clickConnectStartHandle=null}var te=s_(),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:T,ontouchstart:T,onclick:p.clickConnect?ee:void 0,onkeypress:E,style:t.style,role:`button`,"aria-label":R(m)[`handle.ariaLabel`],tabindex:`-1`,...s,[aa]:{valid:R(C),connectingto:R(x),connectingfrom:R(b),source:!R(u),target:R(u),connectablestart:a(),connectableend:o(),connectable:R(d),connectionindicator:R(d)&&(!R(y)||R(S))&&(R(y)||p.clickConnectStartHandle?o():a())}})),Ii(N(te),()=>t.children??f),D(te),H(e,te),k()}var l_=V(`<!> <!>`,1);function u_(e,t){O(t,!0);let n=Y(t,`targetPosition`,19,()=>Am.Top),r=Y(t,`sourcePosition`,19,()=>Am.Bottom);var i=l_(),a=P(i);c_(a,{type:`target`,get position(){return n()}});var o=I(a);c_(I(o),{type:`source`,get position(){return r()}}),L(()=>U(o,` ${t.data?.label??``} `)),H(e,i),k()}var d_=V(` <!>`,1);function f_(e,t){O(t,!0);let n=Y(t,`data`,19,()=>({label:`Node`})),r=Y(t,`sourcePosition`,19,()=>Am.Bottom);Me();var i=d_(),a=P(i);c_(I(a),{type:`source`,get position(){return r()}}),L(()=>U(a,`${n()?.label??``} `)),H(e,i),k()}var p_=V(` <!>`,1);function m_(e,t){O(t,!0);let n=Y(t,`data`,19,()=>({label:`Node`})),r=Y(t,`targetPosition`,19,()=>Am.Top);Me();var i=p_(),a=P(i);c_(I(a),{type:`target`,get position(){return r()}}),L(()=>U(a,`${n()?.label??``} `)),H(e,i),k()}function h_(e,t){}function g_(e,t,n){if(!n||!t)return;let r=n===`root`?t:t.querySelector(`.svelte-flow__${n}`);r&&r.appendChild(e)}function __(e,t){let n=A(Z_),r=A(()=>R(n).domNode),i;return R(r)?g_(e,R(r),t):i=Bn(()=>{Ln(()=>{g_(e,R(r),t),i?.()})}),{async update(t){g_(e,R(r),t)},destroy(){e.parentNode&&e.parentNode.removeChild(e),i?.()}}}function v_(){let e=j(typeof window>`u`);if(R(e)){let t=Bn(()=>{Ln(()=>{M(e,!1),t?.()})})}return{get value(){return R(e)}}}var y_=e=>Nm(e),b_=e=>Mm(e);function x_(e){return e===void 0?void 0:`${e}px`}var S_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},C_=new Set([`$$slots`,`$$events`,`$$legacy`,`x`,`y`,`width`,`height`,`selectEdgeOnClick`,`transparent`,`class`,`children`]),w_=V(`<div><!></div>`);function T_(e,t){O(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,C_),s=Z_(),c=i_(`EdgeLabel must be used within a Custom Edge component`),l=A(()=>s.visible.edges.get(c)?.zIndex);var u=w_(),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":R(l)}}),[()=>v_().value?`none`:void 0,()=>x_(t.width),()=>x_(t.height)],void 0,void 0,`svelte-1wg91mu`),Ii(N(u),()=>t.children??f),D(u),zi(u,(e,t)=>__?.(e,t),()=>`edge-labels`),H(e,u),k()}var E_=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`path`,`label`,`labelX`,`labelY`,`labelStyle`,`markerStart`,`markerEnd`,`style`,`interactionWidth`,`class`]),D_=si(`<path></path>`),O_=si(`<path fill="none"></path><!><!>`,1);function k_(e,t){let n=Y(t,`interactionWidth`,3,20),r=J(t,E_);var i=O_(),a=P(i),o=I(a),s=e=>{var i=D_();va(i,()=>({d:t.path,"stroke-opacity":0,"stroke-width":n(),fill:`none`,class:`svelte-flow__edge-interaction`,...r})),H(e,i)};W(o,e=>{n()>0&&e(s)});var c=I(o),l=e=>{T_(e,{get x(){return t.labelX},get y(){return t.labelY},get style(){return t.labelStyle},selectEdgeOnClick:!0,children:(e,n)=>{Me();var r=ci();L(()=>U(r,t.label)),H(e,r)},$$slots:{default:!0}})};W(c,e=>{t.label&&e(l)}),L(()=>{q(a,`id`,t.id),q(a,`d`,t.path),K(a,0,Ui([`svelte-flow__edge-path`,t.class])),q(a,`marker-start`,t.markerStart),q(a,`marker-end`,t.markerEnd),Xi(a,t.style)}),H(e,i)}function A_(e,t){O(t,!0);let n=A(()=>Nh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,curvature:t.pathOptions?.curvature})),r=A(()=>v(R(n),3)),i=A(()=>R(r)[0]),a=A(()=>R(r)[1]),o=A(()=>R(r)[2]);k_(e,{get id(){return t.id},get path(){return R(i)},get labelX(){return R(a)},get labelY(){return R(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}}),k()}function j_(e,t){O(t,!0);let n=A(()=>Kh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition})),r=A(()=>v(R(n),3)),i=A(()=>R(r)[0]),a=A(()=>R(r)[1]),o=A(()=>R(r)[2]);k_(e,{get path(){return R(i)},get labelX(){return R(a)},get labelY(){return R(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}}),k()}function M_(e,t){O(t,!0);let n=A(()=>Bh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY})),r=A(()=>v(R(n),3)),i=A(()=>R(r)[0]),a=A(()=>R(r)[1]),o=A(()=>R(r)[2]);k_(e,{get path(){return R(i)},get labelX(){return R(a)},get labelY(){return R(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}}),k()}function N_(e,t){O(t,!0);let n=A(()=>Kh({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,borderRadius:0})),r=A(()=>v(R(n),3)),i=A(()=>R(r)[0]),a=A(()=>R(r)[1]),o=A(()=>R(r)[2]);k_(e,{get path(){return R(i)},get labelX(){return R(a)},get labelY(){return R(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}}),k()}var P_=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],F_=[`difference`,`intersection`,`symmetricDifference`,`union`],I_=!1,L_=class e extends Set{#e=new Map;#t=j(0);#n=j(0);#r=xr||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}I_||this.#a()}#i(e){return xr===this.#r?j(e):on(e)}#a(){I_=!0;var t=e.prototype,n=Set.prototype;for(let e of P_)t[e]=function(...t){return R(this.#t),n[e].apply(this,t)};for(let r of F_)t[r]=function(...t){R(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 R(this.#t),!1;r=this.#i(!0),n.set(e,r)}return R(r),t}add(e){return super.has(e)||(super.add(e),M(this.#n,super.size),fn(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),M(r,!1)),t&&(M(this.#n,super.size),fn(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())M(t,!1);e.clear(),M(this.#n,0),fn(this.#t)}}keys(){return this.values()}values(){return R(this.#t),super.values()}entries(){return R(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return R(this.#n)}},R_=class extends Map{#e=new Map;#t=j(0);#n=j(0);#r=xr||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return xr===this.#r?j(e):on(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 R(this.#t),!1}return R(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{R(this.#t);return}}return R(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),M(this.#n,super.size),fn(o);else if(i!==t){fn(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&fn(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),M(n,-1)),r&&(M(this.#n,super.size),fn(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;M(this.#n,0);for(var t of e.values())M(t,-1);fn(this.#t),e.clear()}}#a(){R(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)R(n)}keys(){return R(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return R(this.#n),super.size}},z_=class{#e;#t;constructor(e,t){this.#e=e,this.#t=di(t)}get current(){return this.#t(),this.#e()}},B_=/\(.+\)/,V_=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),H_=class extends z_{constructor(e,t){let n=B_.test(e)||e.split(/[\s,]+/).some(e=>V_.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>Zr(r,`change`,e))}};function U_(e,t,n,r){let i=new Map;return Rm(e,{x:0,y:0,width:n,height:r},t,!0).forEach(e=>{i.set(e.id,e)}),i}function W_(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(Ih({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=Jh({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:Fh({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 G_=ah(`Svelte Flow`,`https://svelteflow.dev/`),K_={input:f_,output:m_,default:u_,group:h_},q_={straight:M_,smoothstep:j_,default:A_,step:N_};function J_(e,t,n,r,i,a){return t&&!n&&r&&i?fh(Lm(a,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),r,i,.5,2,.1):n??{x:0,y:0,zoom:1}}function Y_(e){class t{#e=A(()=>e.props.id??`1`);get flowId(){return R(this.#e)}set flowId(e){M(this.#e,e)}#t=j(null);get domNode(){return R(this.#t)}set domNode(e){M(this.#t,e)}#n=j(null);get panZoom(){return R(this.#n)}set panZoom(e){M(this.#n,e)}#r=j(e.width??0);get width(){return R(this.#r)}set width(e){M(this.#r,e)}#i=j(e.height??0);get height(){return R(this.#i)}set height(e){M(this.#i,e)}#a=j(e.props.zIndexMode??`basic`);get zIndexMode(){return R(this.#a)}set zIndexMode(e){M(this.#a,e)}#o=A(()=>{let{nodesInitialized:t}=lg(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 R(this.#o)}set nodesInitialized(e){M(this.#o,e)}#s=A(()=>this.panZoom!==null);get viewportInitialized(){return R(this.#s)}set viewportInitialized(e){M(this.#s,e)}#c=A(()=>(vg(this.connectionLookup,this.edgeLookup,e.edges),e.edges));get _edges(){return R(this.#c)}set _edges(e){M(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=A(()=>{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 R(this.#l)}set selectedNodes(e){M(this.#l,e)}_prevSelectedEdges=[];_prevSelectedEdgeIds=new Set;#u=A(()=>{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 R(this.#u)}set selectedEdges(e){M(this.#u,e)}selectionChangeHandlers=new Map;nodeLookup=new Map;parentLookup=new Map;connectionLookup=new Map;edgeLookup=new Map;_prevVisibleEdges=new Map;#d=A(()=>{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=U_(i,r,t,n),d=W_({...f,onlyRenderVisible:!0,visibleNodes:u,transform:r,width:t,height:n})}else u=this.nodeLookup,d=W_(f);return this._prevVisibleEdges=d,{nodes:u,edges:d}});get visible(){return R(this.#d)}set visible(e){M(this.#d,e)}#f=A(()=>e.props.nodesDraggable??!0);get nodesDraggable(){return R(this.#f)}set nodesDraggable(e){M(this.#f,e)}#p=A(()=>e.props.nodesConnectable??!0);get nodesConnectable(){return R(this.#p)}set nodesConnectable(e){M(this.#p,e)}#m=A(()=>e.props.elementsSelectable??!0);get elementsSelectable(){return R(this.#m)}set elementsSelectable(e){M(this.#m,e)}#h=A(()=>e.props.nodesFocusable??!0);get nodesFocusable(){return R(this.#h)}set nodesFocusable(e){M(this.#h,e)}#g=A(()=>e.props.edgesFocusable??!0);get edgesFocusable(){return R(this.#g)}set edgesFocusable(e){M(this.#g,e)}#_=A(()=>e.props.disableKeyboardA11y??!1);get disableKeyboardA11y(){return R(this.#_)}set disableKeyboardA11y(e){M(this.#_,e)}#v=A(()=>e.props.minZoom??.5);get minZoom(){return R(this.#v)}set minZoom(e){M(this.#v,e)}#y=A(()=>e.props.maxZoom??2);get maxZoom(){return R(this.#y)}set maxZoom(e){M(this.#y,e)}#b=A(()=>e.props.nodeOrigin??[0,0]);get nodeOrigin(){return R(this.#b)}set nodeOrigin(e){M(this.#b,e)}#x=A(()=>e.props.nodeExtent??xm);get nodeExtent(){return R(this.#x)}set nodeExtent(e){M(this.#x,e)}#S=A(()=>e.props.translateExtent??xm);get translateExtent(){return R(this.#S)}set translateExtent(e){M(this.#S,e)}#C=A(()=>e.props.defaultEdgeOptions??{});get defaultEdgeOptions(){return R(this.#C)}set defaultEdgeOptions(e){M(this.#C,e)}#w=A(()=>e.props.nodeDragThreshold??1);get nodeDragThreshold(){return R(this.#w)}set nodeDragThreshold(e){M(this.#w,e)}#T=A(()=>e.props.autoPanOnNodeDrag??!0);get autoPanOnNodeDrag(){return R(this.#T)}set autoPanOnNodeDrag(e){M(this.#T,e)}#E=A(()=>e.props.autoPanOnConnect??!0);get autoPanOnConnect(){return R(this.#E)}set autoPanOnConnect(e){M(this.#E,e)}#D=A(()=>e.props.autoPanOnNodeFocus??!0);get autoPanOnNodeFocus(){return R(this.#D)}set autoPanOnNodeFocus(e){M(this.#D,e)}#O=A(()=>e.props.autoPanSpeed??15);get autoPanSpeed(){return R(this.#O)}set autoPanSpeed(e){M(this.#O,e)}#k=A(()=>e.props.connectionDragThreshold??1);get connectionDragThreshold(){return R(this.#k)}set connectionDragThreshold(e){M(this.#k,e)}fitViewQueued=e.props.fitView??!1;fitViewOptions=e.props.fitViewOptions;fitViewResolver=null;#A=A(()=>e.props.snapGrid??null);get snapGrid(){return R(this.#A)}set snapGrid(e){M(this.#A,e)}#j=j(!1);get dragging(){return R(this.#j)}set dragging(e){M(this.#j,e)}#M=j(null);get selectionRect(){return R(this.#M)}set selectionRect(e){M(this.#M,e)}#N=j(!1);get selectionKeyPressed(){return R(this.#N)}set selectionKeyPressed(e){M(this.#N,e)}#P=j(!1);get multiselectionKeyPressed(){return R(this.#P)}set multiselectionKeyPressed(e){M(this.#P,e)}#F=j(!1);get deleteKeyPressed(){return R(this.#F)}set deleteKeyPressed(e){M(this.#F,e)}#I=j(!1);get panActivationKeyPressed(){return R(this.#I)}set panActivationKeyPressed(e){M(this.#I,e)}#L=j(!1);get zoomActivationKeyPressed(){return R(this.#L)}set zoomActivationKeyPressed(e){M(this.#L,e)}#R=j(null);get selectionRectMode(){return R(this.#R)}set selectionRectMode(e){M(this.#R,e)}#z=j(``);get ariaLiveMessage(){return R(this.#z)}set ariaLiveMessage(e){M(this.#z,e)}#B=A(()=>e.props.selectionMode??Em.Partial);get selectionMode(){return R(this.#B)}set selectionMode(e){M(this.#B,e)}#V=A(()=>({...K_,...e.props.nodeTypes}));get nodeTypes(){return R(this.#V)}set nodeTypes(e){M(this.#V,e)}#H=A(()=>({...q_,...e.props.edgeTypes}));get edgeTypes(){return R(this.#H)}set edgeTypes(e){M(this.#H,e)}#U=A(()=>e.props.noPanClass??`nopan`);get noPanClass(){return R(this.#U)}set noPanClass(e){M(this.#U,e)}#W=A(()=>e.props.noDragClass??`nodrag`);get noDragClass(){return R(this.#W)}set noDragClass(e){M(this.#W,e)}#G=A(()=>e.props.noWheelClass??`nowheel`);get noWheelClass(){return R(this.#G)}set noWheelClass(e){M(this.#G,e)}#K=A(()=>vh(e.props.ariaLabelConfig));get ariaLabelConfig(){return R(this.#K)}set ariaLabelConfig(e){M(this.#K,e)}#q=j(J_(this.nodesInitialized,e.props.fitView,e.props.initialViewport,this.width,this.height,this.nodeLookup));get _viewport(){return R(this.#q)}set _viewport(e){M(this.#q,e)}get viewport(){return e.viewport??this._viewport}set viewport(t){e.viewport&&=t,this._viewport=t}#J=j(Dm);get _connection(){return R(this.#J)}set _connection(e){M(this.#J,e)}#Y=A(()=>this._connection.inProgress?{...this._connection,to:sh(this._connection.to,[this.viewport.x,this.viewport.y,this.viewport.zoom])}:this._connection);get connection(){return R(this.#Y)}set connection(e){M(this.#Y,e)}#X=A(()=>e.props.connectionMode??wm.Strict);get connectionMode(){return R(this.#X)}set connectionMode(e){M(this.#X,e)}#Z=A(()=>e.props.connectionRadius??20);get connectionRadius(){return R(this.#Z)}set connectionRadius(e){M(this.#Z,e)}#Q=A(()=>e.props.isValidConnection??(()=>!0));get isValidConnection(){return R(this.#Q)}set isValidConnection(e){M(this.#Q,e)}#$=A(()=>e.props.selectNodesOnDrag??!0);get selectNodesOnDrag(){return R(this.#$)}set selectNodesOnDrag(e){M(this.#$,e)}#ee=A(()=>e.props.defaultMarkerColor===void 0?`#b1b1b7`:e.props.defaultMarkerColor);get defaultMarkerColor(){return R(this.#ee)}set defaultMarkerColor(e){M(this.#ee,e)}#te=A(()=>$h(e.edges,{defaultColor:this.defaultMarkerColor,id:this.flowId,defaultMarkerStart:this.defaultEdgeOptions.markerStart,defaultMarkerEnd:this.defaultEdgeOptions.markerEnd}));get markers(){return R(this.#te)}set markers(e){M(this.#te,e)}#ne=A(()=>e.props.onlyRenderVisibleElements??!1);get onlyRenderVisibleElements(){return R(this.#ne)}set onlyRenderVisibleElements(e){M(this.#ne,e)}#re=A(()=>e.props.onflowerror??G_);get onerror(){return R(this.#re)}set onerror(e){M(this.#re,e)}#ie=A(()=>e.props.ondelete);get ondelete(){return R(this.#ie)}set ondelete(e){M(this.#ie,e)}#ae=A(()=>e.props.onbeforedelete);get onbeforedelete(){return R(this.#ae)}set onbeforedelete(e){M(this.#ae,e)}#oe=A(()=>e.props.onbeforeconnect);get onbeforeconnect(){return R(this.#oe)}set onbeforeconnect(e){M(this.#oe,e)}#se=A(()=>e.props.onconnect);get onconnect(){return R(this.#se)}set onconnect(e){M(this.#se,e)}#ce=A(()=>e.props.onconnectstart);get onconnectstart(){return R(this.#ce)}set onconnectstart(e){M(this.#ce,e)}#le=A(()=>e.props.onconnectend);get onconnectend(){return R(this.#le)}set onconnectend(e){M(this.#le,e)}#ue=A(()=>e.props.onbeforereconnect);get onbeforereconnect(){return R(this.#ue)}set onbeforereconnect(e){M(this.#ue,e)}#de=A(()=>e.props.onreconnect);get onreconnect(){return R(this.#de)}set onreconnect(e){M(this.#de,e)}#fe=A(()=>e.props.onreconnectstart);get onreconnectstart(){return R(this.#fe)}set onreconnectstart(e){M(this.#fe,e)}#pe=A(()=>e.props.onreconnectend);get onreconnectend(){return R(this.#pe)}set onreconnectend(e){M(this.#pe,e)}#me=A(()=>e.props.clickConnect??!0);get clickConnect(){return R(this.#me)}set clickConnect(e){M(this.#me,e)}#he=A(()=>e.props.onclickconnectstart);get onclickconnectstart(){return R(this.#he)}set onclickconnectstart(e){M(this.#he,e)}#ge=A(()=>e.props.onclickconnectend);get onclickconnectend(){return R(this.#ge)}set onclickconnectend(e){M(this.#ge,e)}#_e=j(null);get clickConnectStartHandle(){return R(this.#_e)}set clickConnectStartHandle(e){M(this.#_e,e)}#ve=A(()=>e.props.onselectiondrag);get onselectiondrag(){return R(this.#ve)}set onselectiondrag(e){M(this.#ve,e)}#ye=A(()=>e.props.onselectiondragstart);get onselectiondragstart(){return R(this.#ye)}set onselectiondragstart(e){M(this.#ye,e)}#be=A(()=>e.props.onselectiondragstop);get onselectiondragstop(){return R(this.#be)}set onselectiondragstop(e){M(this.#be,e)}resolveFitView=async()=>{this.panZoom&&(await Vm({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 H_(`(prefers-color-scheme: dark)`,e.props.colorModeSSR===`dark`);#xe=A(()=>e.props.colorMode===`system`?this._prefersDark.current?`dark`:`light`:e.props.colorMode??`light`);get colorMode(){return R(this.#xe)}set colorMode(e){M(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=Dm,this.clickConnectStartHandle=null,this.viewport=e.props.initialViewport??{x:0,y:0,zoom:1},this.ariaLiveMessage=``}}return new t}var X_=bm.error001(`svelte`);function Z_(){let e=at(Q_);if(!e)throw Error(X_);return e.getStore()}var Q_=Symbol();function $_(e){let t=Y_(e);function n(e){t.nodeTypes={...K_,...e}}function r(e){t.edgeTypes={...q_,...e}}function i(e){t.edges=Qg(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:Xh(e,t.connection.fromHandle,Am.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}=hg(e,t.nodeLookup,t.parentLookup,t.domNode,t.nodeOrigin,t.nodeExtent,t.zIndexMode);if(!r)return;og(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`,bm.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`,bm.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=oh(t,i));let{position:n,positionAbsolute:a}=Hm({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 gg({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=Dm}function T(){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:T})}function ev(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=Yg({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 tv=V(`<div class="svelte-flow__zoom svelte-flow__container"><!></div>`);function nv(e,t){O(t,!0);let n=Y(t,`store`,15),r=A(()=>n().panActivationKeyPressed||t.panOnDrag),i=A(()=>n().panActivationKeyPressed||t.panOnScroll),{viewport:a}=n(),o=!1;Ln(()=>{!o&&n().viewportInitialized&&(t.oninit?.(),o=!0)});var s=tv();Ii(N(s),()=>t.children),D(s),zi(s,(e,t)=>ev?.(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:R(i),panOnDrag:R(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})),H(e,s),k()}function rv(e,t){return n=>{n.target===t&&e?.(n)}}function iv(e){return t=>{let n=e.has(t.id);return!!t.selected===n?t:{...t,selected:n}}}function av(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}var ov=V(`<div><!></div>`);function sv(e,t){O(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=A(()=>n().panActivationKeyPressed||r()),f=A(()=>n().selectionKeyPressed||!!n().selectionRect||t.selectionOnDrag&&R(d)!==!0),p=A(()=>n().elementsSelectable&&(R(f)||n().selectionRectMode===`user`)),m=!1,h=0,g={x:0,y:0},_=!1;function v(e){if(e.pointerType===`touch`&&R(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||!R(f)||!a||e.button!==0||!e.isPrimary)return;e.target?.setPointerCapture?.(e.pointerId),m=!1,_=!1;let{x:c,y:l}=Oh(e,s),u=sh({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=ch(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(Rm(n().nodeLookup,a,[n().viewport.x,n().viewport.y,n().viewport.zoom],n().selectionMode===Em.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)}}av(o,l)||n(n().nodes=n().nodes.map(iv(l)),!0),av(s,u)||n(n().edges=n().edges.map(iv(u)),!0),n(n().selectionRectMode=`user`,!0),n(n().selectionRect=a,!0)}function b(){if(!a()||!s)return;let[e,t]=Jm(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(!R(f)||!s||!n().selectionRect)return;let r=Oh(e,s);g={x:r.x,y:r.y};let a=ch({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){R(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 T=e=>{Array.isArray(R(d))&&R(d).includes(2)?e.preventDefault():t.onpanecontextmenu?.({event:e})},ee=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=ov();let ne;var re=A(()=>R(p)?void 0:rv(te,o)),ie=A(()=>rv(T,o));Ii(N(E),()=>t.children),D(E),Ma(E,e=>o=e,()=>o),L(e=>ne=K(E,1,`svelte-flow__pane svelte-flow__container`,null,ne,{draggable:e,dragging:n().dragging,selection:R(f)}),[()=>r()===!0||Array.isArray(r())&&r().includes(0)]),B(`click`,E,function(...e){R(re)?.apply(this,e)}),z(`pointerdown`,E,function(...e){(R(p)?v:void 0)?.apply(this,e)},!0),B(`pointermove`,E,function(...e){(R(p)?S:void 0)?.apply(this,e)}),B(`pointerup`,E,C),z(`pointercancel`,E,function(...e){(R(p)?w:void 0)?.apply(this,e)}),B(`contextmenu`,E,function(...e){R(ie)?.apply(this,e)}),z(`click`,E,function(...e){(R(p)?ee:void 0)?.apply(this,e)},!0),H(e,E),k()}Qr([`click`,`pointermove`,`pointerup`,`contextmenu`]);var cv=V(`<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"><!></div>`);function lv(e,t){O(t,!0);var n=cv();let r;Ii(N(n),()=>t.children),D(n),L(()=>r=Xi(n,``,r,{transform:`translate(${t.store.viewport.x??``}px, ${t.store.viewport.y??``}px) scale(${t.store.viewport.zoom??``})`})),H(e,n),k()}function uv(e,t){let{store:n,onDrag:r,onDragStart:i,onDragStop:a,onNodeMouseDown:o}=t,s=wg({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 dv=V(`<div aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-13pq11u"> </div>`),fv=V(`<div class="a11y-hidden svelte-13pq11u"> </div> <div class="a11y-hidden svelte-13pq11u"> </div> <!>`,1);function pv(e,t){O(t,!0);var n=fv(),r=P(n),i=F(r,!0),a=I(r,2),o=F(a,!0),s=I(a,2),c=e=>{var n=dv(),r=F(n,!0);L(()=>{q(n,`id`,`${gv}-${t.store.flowId}`),U(r,t.store.ariaLiveMessage)}),H(e,n)};W(s,e=>{t.store.disableKeyboardA11y||e(c)}),L(()=>{q(r,`id`,`${mv}-${t.store.flowId}`),U(i,t.store.disableKeyboardA11y?t.store.ariaLabelConfig[`node.a11yDescription.default`]:t.store.ariaLabelConfig[`node.a11yDescription.keyboardDisabled`]),q(a,`id`,`${hv}-${t.store.flowId}`),U(o,t.store.ariaLabelConfig[`edge.a11yDescription.default`])}),H(e,n),k()}var mv=`svelte-flow__node-desc`,hv=`svelte-flow__edge-desc`,gv=`svelte-flow__aria-live`,_v=V(`<div><!></div>`);function vv(e,t){O(t,!0);let n=Y(t,`store`,15),r=A(()=>_(t.node.data,()=>({}),!0)),i=A(()=>_(t.node.selected,!1)),a=A(()=>t.node.draggable),o=A(()=>t.node.selectable),s=A(()=>_(t.node.deletable,!0)),c=A(()=>t.node.connectable),l=A(()=>t.node.focusable),u=A(()=>_(t.node.hidden,!1)),d=A(()=>_(t.node.dragging,!1)),f=A(()=>_(t.node.style,``)),p=A(()=>t.node.class),m=A(()=>_(t.node.type,`default`)),h=A(()=>t.node.parentId),g=A(()=>t.node.sourcePosition),v=A(()=>t.node.targetPosition),y=A(()=>_(t.node.measured,()=>({width:0,height:0}),!0).width),b=A(()=>_(t.node.measured,()=>({width:0,height:0}),!0).height),x=A(()=>t.node.initialWidth),S=A(()=>t.node.initialHeight),C=A(()=>t.node.width),w=A(()=>t.node.height),T=A(()=>t.node.dragHandle),ee=A(()=>_(t.node.internals.z,0)),te=A(()=>t.node.internals.positionAbsolute.x),E=A(()=>t.node.internals.positionAbsolute.y),ne=A(()=>t.node.internals.userNode),{id:re}=t.node,ie=A(()=>R(a)??n().nodesDraggable),ae=A(()=>R(o)??n().elementsSelectable),oe=A(()=>R(c)??n().nodesConnectable),se=A(()=>gh(t.node)),ce=A(()=>!!t.node.internals.handleBounds),le=A(()=>R(se)&&R(ce)),ue=A(()=>R(l)??n().nodesFocusable);function de(e){return n().parentLookup.has(e)}let fe=A(()=>de(re)),pe=j(null),me=null,he=R(m),ge=R(g),_e=R(v),ve=A(()=>n().nodeTypes[R(m)]??u_),ye=A(()=>n().ariaLabelConfig);t_(re),r_({get value(){return R(oe)}});let be=A(()=>{let e=R(y)===void 0?R(C)??R(x):R(C),t=R(b)===void 0?R(w)??R(S):R(w);if(e!==void 0||t!==void 0||R(f)!==void 0)return`${R(f)};${e?`width:${x_(e)};`:``}${t?`height:${x_(t)};`:``}`});Ln(()=>{(R(m)!==he||R(g)!==ge||R(v)!==_e)&&R(pe)!==null&&requestAnimationFrame(()=>{R(pe)!==null&&n().updateNodeInternals(new Map([[re,{id:re,nodeElement:R(pe),force:!0}]]))}),he=R(m),ge=R(g),_e=R(v)}),Ln(()=>{t.resizeObserver&&(!R(le)||R(pe)!==me)&&(me&&t.resizeObserver.unobserve(me),R(pe)&&t.resizeObserver.observe(R(pe)),me=R(pe))}),Ha(()=>{me&&t.resizeObserver?.unobserve(me)});function xe(e){R(ae)&&(!n().selectNodesOnDrag||!R(ie)||n().nodeDragThreshold>0)&&n().handleNodeSelection(re),t.onnodeclick?.({node:R(ne),event:e})}function Se(e){if(!(Eh(e)||n().disableKeyboardA11y)){if(Sm.includes(e.key)&&R(ae)){let t=e.key===`Escape`;n().handleNodeSelection(re,t,R(pe))}else R(ie)&&t.node.selected&&Object.prototype.hasOwnProperty.call(S_,e.key)&&(e.preventDefault(),n(n().ariaLiveMessage=R(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(S_[e.key],e.shiftKey?4:1))}}let Ce=()=>{if(n().disableKeyboardA11y||!n().autoPanOnNodeFocus||!R(pe)?.matches(`:focus-visible`))return;let{width:e,height:r,viewport:i}=n();Rm(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=li(),Te=P(we),Ee=e=>{var a=_v();va(a,()=>({"data-id":re,class:[`svelte-flow__node`,`svelte-flow__node-${R(m)}`,R(p)],style:R(be),onclick:xe,onpointerenter:t.onnodepointerenter?e=>t.onnodepointerenter({node:R(ne),event:e}):void 0,onpointerleave:t.onnodepointerleave?e=>t.onnodepointerleave({node:R(ne),event:e}):void 0,onpointermove:t.onnodepointermove?e=>t.onnodepointermove({node:R(ne),event:e}):void 0,oncontextmenu:t.onnodecontextmenu?e=>t.onnodecontextmenu({node:R(ne),event:e}):void 0,onkeydown:R(ue)?Se:void 0,onfocus:R(ue)?Ce:void 0,tabIndex:R(ue)?0:void 0,role:t.node.ariaRole??(R(ue)?`group`:void 0),"aria-label":t.node.ariaLabel,"aria-roledescription":`node`,"aria-describedby":n().disableKeyboardA11y?void 0:`${mv}-${n().flowId}`,...t.node.domAttributes,[aa]:{dragging:R(d),selected:R(i),draggable:R(ie),connectable:R(oe),selectable:R(ae),nopan:R(ie),parent:R(fe)},[oa]:{"z-index":R(ee),transform:`translate(${R(te)??``}px, ${R(E)??``}px)`,visibility:R(se)?`visible`:`hidden`}})),Li(N(a),()=>R(ve),(e,t)=>{t(e,{get data(){return R(r)},get id(){return re},get selected(){return R(i)},get selectable(){return R(ae)},get deletable(){return R(s)},get sourcePosition(){return R(g)},get targetPosition(){return R(v)},get zIndex(){return R(ee)},get dragging(){return R(d)},get draggable(){return R(ie)},get dragHandle(){return R(T)},get parentId(){return R(h)},get type(){return R(m)},get isConnectable(){return R(oe)},get positionAbsoluteX(){return R(te)},get positionAbsoluteY(){return R(E)},get width(){return R(C)},get height(){return R(w)}})}),D(a),zi(a,(e,t)=>uv?.(e,t),()=>({nodeId:re,isSelectable:R(ae),disabled:!R(ie),handleSelector:R(T),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=>M(pe,e),()=>R(pe)),H(e,a)};W(Te,e=>{R(u)||e(Ee)}),H(e,we),k()}var yv=V(`<div class="svelte-flow__nodes"></div>`);function bv(e,t){O(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=yv();G(i,21,()=>n().visible.nodes.values(),e=>e.id,(e,i)=>{vv(e,{get node(){return R(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)}})}),D(i),H(e,i),k()}var xv=si(`<svg class="svelte-flow__edge-wrapper"><g><!></g></svg>`);function Sv(e,t){O(t,!0);let n=A(()=>t.edge.id),r=A(()=>t.edge.source),i=A(()=>t.edge.target),a=A(()=>t.edge.sourceX),o=A(()=>t.edge.sourceY),s=A(()=>t.edge.targetX),c=A(()=>t.edge.targetY),l=A(()=>t.edge.sourcePosition),u=A(()=>t.edge.targetPosition),d=A(()=>_(t.edge.animated,!1)),f=A(()=>_(t.edge.selected,!1)),p=A(()=>t.edge.label),m=A(()=>t.edge.labelStyle),h=A(()=>_(t.edge.data,()=>({}),!0)),g=A(()=>t.edge.style),v=A(()=>t.edge.interactionWidth),y=A(()=>_(t.edge.type,`default`)),b=A(()=>t.edge.sourceHandle),x=A(()=>t.edge.targetHandle),S=A(()=>t.edge.markerStart),C=A(()=>t.edge.markerEnd),w=A(()=>t.edge.selectable),T=A(()=>t.edge.focusable),ee=A(()=>_(t.edge.deletable,!0)),te=A(()=>t.edge.hidden),E=A(()=>t.edge.zIndex),ne=A(()=>t.edge.class),re=A(()=>t.edge.ariaLabel);a_(R(n));let ie=null,ae=A(()=>R(w)??t.store.elementsSelectable),oe=A(()=>R(T)??t.store.edgesFocusable),se=A(()=>t.store.edgeTypes[R(y)]??A_),ce=A(()=>R(S)?`url('#${Qh(R(S),t.store.flowId)}')`:void 0),le=A(()=>R(C)?`url('#${Qh(R(C),t.store.flowId)}')`:void 0);function ue(e){let r=t.store.edgeLookup.get(R(n));r&&(R(ae)&&t.store.handleEdgeSelection(R(n)),t.onedgeclick?.({event:e,edge:r}))}function de(e,r){let i=t.store.edgeLookup.get(R(n));i&&r({event:e,edge:i})}function fe(e){if(!t.store.disableKeyboardA11y&&Sm.includes(e.key)&&R(ae)){let{unselectNodesAndEdges:r,addSelectedEdges:i}=t.store;e.key===`Escape`?(ie?.blur(),r({edges:[t.edge]})):i([R(n)])}}var pe=li(),me=P(pe),he=e=>{var _=xv();let S;var C=N(_);va(C,()=>({class:[`svelte-flow__edge`,R(ne)],"data-id":R(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":R(re)===null?void 0:R(re)?R(re):`Edge from ${R(r)} to ${R(i)}`,"aria-describedby":R(oe)?`${hv}-${t.store.flowId}`:void 0,role:t.edge.ariaRole??(R(oe)?`group`:`img`),"aria-roledescription":`edge`,onkeydown:R(oe)?fe:void 0,tabindex:R(oe)?0:void 0,...t.edge.domAttributes,[aa]:{animated:R(d),selected:R(f),selectable:R(ae)}})),Li(N(C),()=>R(se),(e,t)=>{t(e,{get id(){return R(n)},get source(){return R(r)},get target(){return R(i)},get sourceX(){return R(a)},get sourceY(){return R(o)},get targetX(){return R(s)},get targetY(){return R(c)},get sourcePosition(){return R(l)},get targetPosition(){return R(u)},get animated(){return R(d)},get selected(){return R(f)},get label(){return R(p)},get labelStyle(){return R(m)},get data(){return R(h)},get style(){return R(g)},get interactionWidth(){return R(v)},get selectable(){return R(ae)},get deletable(){return R(ee)},get type(){return R(y)},get sourceHandleId(){return R(b)},get targetHandleId(){return R(x)},get markerStart(){return R(ce)},get markerEnd(){return R(le)}})}),D(C),Ma(C,e=>ie=e,()=>ie),D(_),L(()=>S=Xi(_,``,S,{"z-index":R(E)})),H(e,_)};W(me,e=>{R(te)||e(he)}),H(e,pe),k()}Ze();var Cv=si(`<defs></defs>`);function wv(e,t){O(t,!1);let n=Z_();Pa();var r=Cv();G(r,5,()=>n.markers,e=>e.id,(e,t)=>{Ov(e,Ba(()=>R(t)))}),D(r),H(e,r),k()}var Tv=si(`<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4"></polyline>`),Ev=si(`<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4"></polyline>`),Dv=si(`<marker class="svelte-flow__arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0"><!></marker>`);function Ov(e,t){O(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=Dv(),c=N(s),l=e=>{var n=Tv();let r;L(()=>{q(n,`stroke-width`,t.strokeWidth),r=Xi(n,``,r,{stroke:o()})}),H(e,n)},u=e=>{var n=Ev();let r;L(()=>{q(n,`stroke-width`,t.strokeWidth),r=Xi(n,``,r,{stroke:o(),fill:o()})}),H(e,n)};W(c,e=>{t.type===km.Arrow?e(l):t.type===km.ArrowClosed&&e(u,1)}),D(s),L(()=>{q(s,`id`,t.id),q(s,`markerWidth`,`${n()}`),q(s,`markerHeight`,`${r()}`),q(s,`markerUnits`,i()),q(s,`orient`,a())}),H(e,s),k()}var kv=V(`<div class="svelte-flow__edges"><svg class="svelte-flow__marker"><!></svg> <!></div>`);function Av(e,t){O(t,!0);let n=Y(t,`store`,15);var r=kv(),i=N(r);wv(N(i),{}),D(i),G(I(i,2),17,()=>n().visible.edges.values(),e=>e.id,(e,r)=>{Sv(e,{get edge(){return R(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)}})}),D(r),H(e,r),k()}var jv=V(`<div class="svelte-flow__selection svelte-1vr3gfi"></div>`);function Mv(e,t){O(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=li(),c=P(s),l=e=>{var t=jv();let o;L((e,i)=>o=Xi(t,``,o,{width:e,height:i,transform:`translate(${n()}px, ${r()}px)`}),[()=>typeof i()==`string`?i():x_(i()),()=>typeof a()==`string`?a():x_(a())]),H(e,t)};W(c,e=>{o()&&e(l)}),H(e,s),k()}var Nv=V(`<div><!></div>`);function Pv(e,t){O(t,!0);let n=j(void 0);Ln(()=>{t.store.disableKeyboardA11y||R(n)?.focus({preventScroll:!0})});let r=A(()=>{if(t.store.selectionRectMode===`nodes`){t.store.nodes;let e=Lm(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(S_,e.key)&&(e.preventDefault(),t.store.moveSelectedNodes(S_[e.key],e.shiftKey?4:1))}var s=li(),c=P(s),l=e=>{var s=Nv();let c;Mv(N(s),{width:`100%`,height:`100%`,x:0,y:0}),D(s),zi(s,(e,t)=>uv?.(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=>M(n,e),()=>R(n)),L((e,n)=>{K(s,1,Ui([`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(${R(r).x??``}px, ${R(r).y??``}px)`})},[()=>x_(R(r).width),()=>x_(R(r).height)]),B(`contextmenu`,s,i),B(`click`,s,a),B(`keydown`,s,function(...e){(t.store.disableKeyboardA11y?void 0:o)?.apply(this,e)}),H(e,s)},u=A(()=>t.store.selectionRectMode===`nodes`&&R(r)&&ih(R(r).x)&&ih(R(r).y));W(c,e=>{R(u)&&e(l)}),H(e,s),k()}Qr([`contextmenu`,`click`,`keydown`]);function Fv(e){switch(e){case`none`:return 0;case`ctrl`:return 8;case`shift`:return 4;case`alt`:return 2;case`meta`:return 1}}function Iv(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|Fv(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=Zr(e,i,a)),{update:t=>{let{enabled:s=!0,type:c=`keydown`}=t;n&&(!s||i!==c)?o?.():!n&&s&&(o=Zr(e,c,a)),n=s,i=c,r=t.trigger},destroy:()=>{o?.()}}}function Lv(){let e=A(Z_),t=t=>{let n=y_(t)?t:R(e).nodeLookup.get(t.id),r=n.parentId?_h(n.position,n.measured,n.parentId,R(e).nodeLookup,R(e).nodeOrigin):n.position;return Qm({...n,position:r,width:n.measured?.width??n.width,height:n.measured?.height??n.height})};function n(t,n,r={replace:!1}){R(e).nodes=Pr(()=>R(e).nodes).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r?.replace&&y_(t)?t:{...e,...t}}return e})}function r(t,n,r={replace:!1}){R(e).edges=Pr(()=>R(e).edges).map(e=>{if(e.id===t){let t=typeof n==`function`?n(e):n;return r.replace&&b_(t)?t:{...e,...t}}return e})}let i=t=>R(e).nodeLookup.get(t);return{zoomIn:R(e).zoomIn,zoomOut:R(e).zoomOut,getInternalNode:i,getNode:e=>i(e)?.internals.userNode,getNodes:t=>t===void 0?R(e).nodes:Rv(R(e).nodeLookup,t),getEdge:t=>R(e).edgeLookup.get(t),getEdges:t=>t===void 0?R(e).edges:Rv(R(e).edgeLookup,t),setZoom:async(t,n)=>{let r=R(e).panZoom;return r?r.scaleTo(t,n):!1},getZoom:()=>R(e).viewport.zoom,setViewport:async(t,n)=>{let r=R(e).viewport;return R(e).panZoom?(await R(e).panZoom.setViewport({x:t.x??r.x,y:t.y??r.y,zoom:t.zoom??r.zoom},n),!0):!1},getViewport:()=>$e(R(e).viewport),setCenter:async(t,n,r)=>R(e).setCenter(t,n,r),fitView:t=>R(e).fitView(t),fitBounds:async(t,n)=>{if(!R(e).panZoom)return!1;let r=fh(t,R(e).width,R(e).height,R(e).minZoom,R(e).maxZoom,n?.padding??.1);return await R(e).panZoom.setViewport(r,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},getIntersectingNodes:(n,r=!0,i)=>{let a=rh(n),o=a?n:t(n);return o?(i||R(e).nodes).filter(t=>{let i=R(e).nodeLookup.get(t.id);if(!i||!a&&t.id===n.id)return!1;let s=Qm(i),c=nh(s,o);return r&&c>0||c>=s.width*s.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,n,r=!0)=>{let i=rh(e)?e:t(e);if(!i)return!1;let a=nh(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 Um({nodesToRemove:t,edgesToRemove:n,nodes:R(e).nodes,edges:R(e).edges,onBeforeDelete:R(e).onbeforedelete});return r&&(R(e).nodes=Pr(()=>R(e).nodes).filter(e=>!r.some(({id:t})=>t===e.id))),i&&(R(e).edges=Pr(()=>R(e).edges).filter(e=>!i.some(({id:t})=>t===e.id))),(r.length>0||i.length>0)&&R(e).ondelete?.({nodes:r,edges:i}),{deletedNodes:r,deletedEdges:i}},screenToFlowPosition:(t,n={snapToGrid:!0})=>{if(!R(e).domNode)return t;let r=n.snapToGrid?R(e).snapGrid:!1,{x:i,y:a,zoom:o}=R(e).viewport,{x:s,y:c}=R(e).domNode.getBoundingClientRect();return sh({x:t.x-s,y:t.y-c},[i,a,o],r!==null,r||[1,1])},flowToScreenPosition:t=>{if(!R(e).domNode)return t;let{x:n,y:r,zoom:i}=R(e).viewport,{x:a,y:o}=R(e).domNode.getBoundingClientRect(),s=ch(t,[n,r,i]);return{x:s.x+a,y:s.y+o}},toObject:()=>structuredClone({nodes:[...R(e).nodes],edges:[...R(e).edges],viewport:{...R(e).viewport}}),updateNode:n,updateNodeData:(t,r,i)=>{let a=R(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=>Im(t,{nodeLookup:R(e).nodeLookup,nodeOrigin:R(e).nodeOrigin}),getHandleConnections:({type:t,id:n,nodeId:r})=>Array.from(R(e).connectionLookup.get(`${r}-${t}-${n??null}`)?.values()??[])}}function Rv(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 zv(e,t){O(t,!0);let n=Y(t,`store`,15),r=Y(t,`selectionKey`,3,`Shift`),i=Y(t,`multiSelectionKey`,19,()=>ph()?`Meta`:`Control`),a=Y(t,`deleteKey`,3,`Backspace`),o=Y(t,`panActivationKey`,3,` `),s=Y(t,`zoomActivationKey`,19,()=>ph()?`Meta`:`Control`),{deleteElements:c}=Lv();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})}z(`blur`,_n,p),z(`contextmenu`,_n,p),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(r(),()=>n(n().selectionKeyPressed=!0,!0)),type:`keydown`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(r(),()=>n(n().selectionKeyPressed=!1,!0)),type:`keyup`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(i(),()=>{n(n().multiselectionKeyPressed=!0,!0)}),type:`keydown`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(i(),()=>n(n().multiselectionKeyPressed=!1,!0)),type:`keyup`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(a(),e=>{!(e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)&&!Eh(e.originalEvent)&&(n(n().deleteKeyPressed=!0,!0),m())}),type:`keydown`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(a(),()=>n(n().deleteKeyPressed=!1,!0)),type:`keyup`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(o(),()=>n(n().panActivationKeyPressed=!0,!0)),type:`keydown`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(o(),()=>n(n().panActivationKeyPressed=!1,!0)),type:`keyup`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(s(),()=>n(n().zoomActivationKeyPressed=!0,!0)),type:`keydown`})),zi(_n,(e,t)=>Iv?.(e,t),()=>({trigger:f(s(),()=>n(n().zoomActivationKeyPressed=!1,!0)),type:`keyup`})),k()}var Bv=si(`<path fill="none" class="svelte-flow__connection-path"></path>`),Vv=si(`<svg class="svelte-flow__connectionline"><g><!></g></svg>`);function Hv(e,t){O(t,!0);let n=A(()=>{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 Om.Bezier:{let[t]=Nh(e);return t}case Om.Straight:{let[t]=Bh(e);return t}case Om.Step:case Om.SmoothStep:{let[n]=Kh({...e,borderRadius:t.type===Om.Step?0:void 0});return n}}});var r=li(),i=P(r),a=e=>{var r=Vv(),i=N(r),a=N(i),o=e=>{var n=li();Li(P(n),()=>t.LineComponent,(e,t)=>{t(e,{})}),H(e,n)},s=e=>{var r=Bv();L(()=>{q(r,`d`,R(n)),Xi(r,t.style)}),H(e,r)};W(a,e=>{t.LineComponent?e(o):e(s,-1)}),D(i),D(r),L(e=>{q(r,`width`,t.store.width),q(r,`height`,t.store.height),Xi(r,t.containerStyle),K(i,0,e)},[()=>Ui([`svelte-flow__connection`,xh(t.store.connection.isValid)])]),H(e,r)};W(i,e=>{t.store.connection.inProgress&&e(a)}),H(e,r),k()}var Uv=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`style`,`class`,`children`]),Wv=V(`<div><!></div>`);function Gv(e,t){O(t,!0);let n=Y(t,`position`,3,`top-right`),r=J(t,Uv),i=A(()=>`${n()}`.split(`-`));var a=Wv();va(a,e=>({class:e,style:t.style,...r}),[()=>[`svelte-flow__panel`,t.class,...R(i)]]),Ii(N(a),()=>t.children??f),D(a),H(e,a),k()}var Kv=V(`<a target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>`);function qv(e,t){O(t,!0);let n=Y(t,`position`,3,`bottom-right`),r=`https://svelteflow.dev?utm_source=attribution`;var i=li(),a=P(i),o=e=>{{let t=A(()=>`Please only hide this attribution when you are subscribed to Svelte Flow Pro: ${r}`);Gv(e,{get position(){return n()},class:`svelte-flow__attribution`,get"data-message"(){return R(t)},children:(e,t)=>{var n=Kv();L(()=>q(n,`href`,r)),H(e,n)},$$slots:{default:!0}})}};W(a,e=>{t.proOptions?.hideAttribution||e(o)}),H(e,i),k()}var Jv=V(`<div><!></div>`);function Yv(e,t){O(t,!0);let n=Y(t,`domNode`,15),r=Y(t,`clientWidth`,15),i=Y(t,`clientHeight`,15),a=A(()=>t.rest.class),o=A(()=>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=Jv();va(c,(e,n)=>({class:[`svelte-flow`,`svelte-flow__container`,t.colorMode,R(a)],"data-testid":`svelte-flow__wrapper`,role:`application`,onscroll:s,...R(o),[oa]:{width:e,height:n}}),[()=>x_(t.width),()=>x_(t.height)],void 0,void 0,`svelte-mkap6j`),Ii(N(c),()=>t.children??f),D(c),Ma(c,e=>n(e),()=>n()),Aa(c,`clientHeight`,i),Aa(c,`clientWidth`,r),H(e,c),k()}var Xv=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(`.`)),Zv=V(`<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),Qv=V(`<!> <!>`,1),$v=V(`<!> <!> <!> <!> <!>`,1);function ey(e,t){O(t,!0);let n=Y(t,`paneClickDistance`,3,1),r=Y(t,`nodeClickDistance`,3,1),i=Y(t,`panOnScrollMode`,19,()=>Tm.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,()=>Om.Bezier),g=Y(t,`nodes`,31,()=>mn([])),_=Y(t,`edges`,31,()=>mn([])),v=Y(t,`viewport`,15,void 0),y=J(t,Xv),b=$_({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=at(Q_);x&&x.setStore&&x.setStore(b),ot(Q_,{provider:!1,getStore(){return b}}),Ln(()=>{let e={nodes:b.selectedNodes,edges:b.selectedEdges};Pr(()=>t.onselectionchange)?.(e);for(let t of b.selectionChangeHandlers.values())t(e)}),Ha(()=>{x?.setStore($_({width:0,height:0,nodes:[],edges:[],props:{}}))}),Yv(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 _=$v(),v=P(_);zv(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=I(v,2);nv(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)=>{sv(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=Qv(),a=P(i);lv(a,{get store(){return b},set store(e){b=e},children:(e,n)=>{var i=Zv(),a=I(P(i),2);Av(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=I(a,4);Hv(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=I(o,2);bv(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}}),Pv(I(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}}),Me(2),H(e,i)},$$slots:{default:!0}});var o=I(a,2);{let e=A(()=>!!(b.selectionRect&&b.selectionRectMode===`user`)),t=A(()=>b.selectionRect?.width),n=A(()=>b.selectionRect?.height),r=A(()=>b.selectionRect?.x),i=A(()=>b.selectionRect?.y);Mv(o,{get isVisible(){return R(e)},get width(){return R(t)},get height(){return R(n)},get x(){return R(r)},get y(){return R(i)}})}H(e,i)},$$slots:{default:!0}})},$$slots:{default:!0}});var x=I(y,2);qv(x,{get proOptions(){return t.proOptions},get position(){return t.attributionPosition}});var S=I(x,2);pv(S,{get store(){return b}}),Ii(I(S,2),()=>t.children??f),H(e,_)},$$slots:{default:!0}}),k()}function ty(e,t){O(t,!0);let n=j($_({props:{},nodes:[],edges:[]}));ot(Q_,{provider:!0,getStore(){return R(n)},setStore:e=>{M(n,e)}}),Ha(()=>{R(n).reset()});var r=li();Ii(P(r),()=>t.children??f),H(e,r),k()}var ny=new Set([`$$slots`,`$$events`,`$$legacy`,`target`,`children`]),ry=V(`<div><!></div>`);function iy(e,t){O(t,!0);let n=Y(t,`target`,3,`front`),r=J(t,ny);var i=ry();va(i,e=>({...r,[oa]:{display:e}}),[()=>v_().value?`none`:void 0]),Ii(N(i),()=>t.children??f),D(i),zi(i,(e,t)=>__?.(e,t),()=>`viewport-${n()}`),H(e,i),k()}var ay;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(ay||={});var oy=si(`<circle></circle>`);function sy(e,t){var n=oy();L(()=>{q(n,`cx`,t.radius),q(n,`cy`,t.radius),q(n,`r`,t.radius),K(n,0,Ui([`svelte-flow__background-pattern`,`dots`,t.class]))}),H(e,n)}var cy=si(`<path></path>`);function ly(e,t){O(t,!0);var n=cy();L(()=>{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]}`),K(n,0,Ui([`svelte-flow__background-pattern`,t.variant,t.class]))}),H(e,n),k()}var uy={[ay.Dots]:1,[ay.Lines]:1,[ay.Cross]:6},dy=si(`<svg data-testid="svelte-flow__background"><pattern patternUnits="userSpaceOnUse"><!></pattern><rect x="0" y="0" width="100%" height="100%"></rect></svg>`);function fy(e,t){O(t,!0);let n=Y(t,`variant`,19,()=>ay.Dots),r=Y(t,`gap`,3,20),i=Y(t,`lineWidth`,3,1),a=A(Z_),o=A(()=>n()===ay.Dots),s=A(()=>n()===ay.Cross),c=A(()=>Array.isArray(r())?r():[r(),r()]),l=A(()=>`background-pattern-${R(a).flowId}-${t.id??``}`),u=A(()=>[R(c)[0]*R(a).viewport.zoom||1,R(c)[1]*R(a).viewport.zoom||1]),d=A(()=>(t.size??uy[n()])*R(a).viewport.zoom),f=A(()=>R(s)?[R(d),R(d)]:R(u)),p=A(()=>R(o)?[R(d)/2,R(d)/2]:[R(f)[0]/2,R(f)[1]/2]);var m=dy();let h;var g=N(m),_=N(g),v=e=>{{let n=A(()=>R(d)/2);sy(e,{get radius(){return R(n)},get class(){return t.patternClass}})}},y=e=>{ly(e,{get dimensions(){return R(f)},get variant(){return n()},get lineWidth(){return i()},get class(){return t.patternClass}})};W(_,e=>{R(o)?e(v):e(y,-1)}),D(g);var b=I(g);D(m),L(()=>{K(m,0,Ui([`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`,R(l)),q(g,`x`,R(a).viewport.x%R(u)[0]),q(g,`y`,R(a).viewport.y%R(u)[1]),q(g,`width`,R(u)[0]),q(g,`height`,R(u)[1]),q(g,`patternTransform`,`translate(-${R(p)[0]},-${R(p)[1]})`),q(b,`fill`,`url(#${R(l)})`)}),H(e,m),k()}function py(e){let t=A(Z_),n=A(()=>R(t).nodeLookup),r=A(()=>R(t).nodes),i=A(()=>(R(r),R(n).get(e)));return{get current(){return R(i)}}}var my=si(`<rect></rect>`);function hy(e,t){O(t,!0);let n=Y(t,`borderRadius`,3,5),r=Y(t,`strokeWidth`,3,2),i=A(()=>py(t.id)),a=A(()=>{if(!R(i).current)return{width:0,height:0,x:0,y:0};let{width:e,height:n}=hh(R(i).current);return{width:t.width??e,height:t.height??n,x:t.x??R(i).current.internals.positionAbsolute.x,y:t.y??R(i).current.internals.positionAbsolute.y}}),o=A(()=>R(a).width),s=A(()=>R(a).height),c=A(()=>R(a).x),l=A(()=>R(a).y);var u=li(),d=P(u),f=e=>{let i=A(()=>t.nodeComponent);var a=li();Li(P(a),()=>R(i),(e,i)=>{i(e,{get id(){return t.id},get x(){return R(c)},get y(){return R(l)},get width(){return R(o)},get height(){return R(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}})}),H(e,a)},p=e=>{var i=my();let a,u;L(()=>{a=K(i,0,Ui([`svelte-flow__minimap-node`,t.class]),null,a,{selected:t.selected}),q(i,`x`,R(c)),q(i,`y`,R(l)),q(i,`rx`,n()),q(i,`ry`,n()),q(i,`width`,R(o)),q(i,`height`,R(s)),q(i,`shape-rendering`,t.shapeRendering),u=Xi(i,``,u,{fill:t.color,stroke:t.strokeColor,"stroke-width":r()})}),H(e,i)};W(d,e=>{t.nodeComponent?e(f):e(p,-1)}),H(e,u),k()}function gy(e,t){let n=Fg({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 _y=e=>e instanceof Function?e:()=>e,vy=new Set([`$$slots`,`$$events`,`$$legacy`,`position`,`ariaLabel`,`nodeStrokeColor`,`nodeColor`,`nodeClass`,`nodeBorderRadius`,`nodeStrokeWidth`,`nodeComponent`,`bgColor`,`maskColor`,`maskStrokeColor`,`maskStrokeWidth`,`width`,`height`,`pannable`,`zoomable`,`inversePan`,`zoomStep`,`class`]),yy=si(`<title> </title>`),by=si(`<svg class="svelte-flow__minimap-svg" role="img"><!><!><path class="svelte-flow__minimap-mask" fill-rule="evenodd" pointer-events="none"></path></svg>`),xy=V(`<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>`,1);function Sy(e,t){O(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,vy),f=A(Z_),p=A(()=>R(f).ariaLabelConfig),m=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`,h=A(()=>`svelte-flow__minimap-desc-${R(f).flowId}`),g=A(()=>({x:-R(f).viewport.x/R(f).viewport.zoom,y:-R(f).viewport.y/R(f).viewport.zoom,width:R(f).width/R(f).viewport.zoom,height:R(f).height/R(f).viewport.zoom})),_=A(()=>R(f).nodes.some(e=>!e.hidden)),v=A(()=>R(_)?eh(Lm(R(f).nodeLookup,{filter:e=>!e.hidden}),R(g)):R(g)),y=A(()=>R(v).width/s()),b=A(()=>R(v).height/c()),x=A(()=>Math.max(R(y),R(b))),S=A(()=>R(x)*s()),C=A(()=>R(x)*c()),w=A(()=>5*R(x)),T=A(()=>R(v).x-(R(S)-R(v).width)/2-R(w)),ee=A(()=>R(v).y-(R(C)-R(v).height)/2-R(w)),te=A(()=>R(S)+R(w)*2),E=A(()=>R(C)+R(w)*2),ne=()=>R(x);var re=xy(),ie=P(re);{let e=A(()=>[`svelte-flow__minimap`,t.class]);Ei(ie,()=>({"--xy-minimap-background-color-props":t.bgColor})),Gv(ie.lastChild,Ba({get position(){return n()},get class(){return R(e)},"data-testid":`svelte-flow__minimap`},()=>d,{children:(e,n)=>{var d=li(),_=P(d),v=e=>{var n=by();let d;var _=N(n),v=e=>{var n=yy(),r=F(n,!0);L(()=>{q(n,`id`,R(h)),U(r,t.ariaLabel??R(p)[`minimap.ariaLabel`])}),H(e,n)};W(_,e=>{(t.ariaLabel??R(p)[`minimap.ariaLabel`])&&e(v)});var y=I(_);G(y,17,()=>R(f).nodes,e=>e.id,(e,n)=>{let s=A(()=>R(f).nodeLookup.get(R(n).id));var c=li(),l=P(c),u=e=>{{let c=A(()=>t.nodeColor===void 0?void 0:_y(t.nodeColor)(R(n))),l=A(()=>_y(r())(R(n))),u=A(()=>_y(i())(R(n)));hy(e,{get id(){return R(s).id},get selected(){return R(s).selected},get nodeComponent(){return t.nodeComponent},get color(){return R(c)},get borderRadius(){return a()},get strokeColor(){return R(l)},get strokeWidth(){return o()},get shapeRendering(){return m},get class(){return R(u)}})}},d=A(()=>R(s)&&gh(R(s))&&!R(s).hidden);W(l,e=>{R(d)&&e(u)}),H(e,c)});var b=I(y);D(n),zi(n,(e,t)=>gy?.(e,t),()=>({store:R(f),panZoom:R(f).panZoom,getViewScale:ne,translateExtent:R(f).translateExtent,width:R(f).width,height:R(f).height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:l(),zoomable:u()})),L(()=>{q(n,`width`,s()),q(n,`height`,c()),q(n,`viewBox`,`${R(T)??``} ${R(ee)??``} ${R(te)??``} ${R(E)??``}`),q(n,`aria-labelledby`,R(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*R(x):void 0}),q(b,`d`,`M${R(T)-R(w)},${R(ee)-R(w)}h${R(te)+R(w)*2}v${R(E)+R(w)*2}h${-R(te)-R(w)*2}z
|
|
6
|
+
M${R(g).x??``},${R(g).y??``}h${R(g).width??``}v${R(g).height??``}h${-R(g).width}z`)}),H(e,n)};W(_,e=>{R(f).panZoom&&e(v)}),H(e,d)},$$slots:{default:!0}})),D(ie)}H(e,re),k()}var Cy=new Set([`$$slots`,`$$events`,`$$legacy`,`nodeId`,`position`,`align`,`offset`,`isVisible`,`children`]),wy=V(`<div><!></div>`);function Ty(e,t){O(t,!0);let n=Y(t,`position`,19,()=>Am.Top),r=Y(t,`align`,3,`center`),i=Y(t,`offset`,3,10),a=J(t,Cy),o=Z_(),{getNodesBounds:s}=Lv(),c=e_(),l=A(()=>(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=A(()=>{let e=s(R(l));return e?eg(e,o.viewport,n(),i(),r()):``}),d=A(()=>R(l).length===0?1:Math.max(...R(l).map(e=>(e.internals.z||5)+1))),p=A(()=>o.nodes.filter(e=>e.selected).length),m=A(()=>typeof t.isVisible==`boolean`?t.isVisible:R(l).length===1&&R(l)[0].selected&&R(p)===1);var h=li(),g=P(h),_=e=>{var n=wy();va(n,(e,t)=>({class:`svelte-flow__node-toolbar`,"data-id":e,...a,[oa]:{display:t,position:`absolute`,transform:R(u),"z-index":R(d)}}),[()=>R(l).reduce((e,t)=>`${e}${t.id} `,``).trim(),()=>v_().value?`none`:void 0]),Ii(N(n),()=>t.children??f),D(n),zi(n,(e,t)=>__?.(e,t),()=>`root`),H(e,n)};W(g,e=>{o.domNode&&R(m)&&R(l)&&e(_)}),H(e,h),k()}function Ey(){let e=A(Z_);return{get current(){return R(e).viewport},set current(t){R(e).viewport=t},update(t){R(e).viewport=t(R(e).viewport)},set(t){R(e).viewport=t}}}var Dy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Oy(e,t){let n=J(t,Dy),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 ky=new class{#e=j(!1);get open(){return R(this.#e)}set open(e){M(this.#e,e,!0)}#t=j(mn({}));#n=j(!1);#r=new Set;#i=!1;#a=``;#o=A(()=>[...Q.status?.messages??[]].reverse().map(e=>({...e,answered:R(this.#t)[e.id]??e.answered??null})).filter(e=>!R(this.#n)||e.kind===`question`&&!e.answered));get messages(){return R(this.#o)}set messages(e){M(this.#o,e)}#s=A(()=>this.messages.find(e=>e.kind===`question`&&e.choices?.length&&!e.answered));get question(){return R(this.#s)}set question(e){M(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)),R(this.#n)&&!(Q.status.messages??[]).some(e=>!(e.kind===`question`&&!e.answered))&&M(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 xo(`prompt`,{tag:`koppler-reply`,text:`Answer to your question "${e.title}"${e.run?` (run ${e.run})`:``}: ${r}`,data:{message:e.id,...t}});i?.ok?(R(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 xo(`message-dismiss`,{id:e.id});!t?.ok&&t?.status!==409?$.show(`Could not dismiss it.`,`warning`):R(this.#t)[e.id]={at:new Date().toISOString(),via:`dismissed`}}get waiting(){return[...Q.status?.waiting??[]].reverse().filter(e=>!R(this.#c).includes(e.key))}#c=j(mn([]));async drop(e){let t=await xo(`prompt-drop`,{key:e});t?.ok||t?.status===409?M(this.#c,[...R(this.#c),e],!0):$.show(`Could not drop it.`,`warning`)}async clear(){(await xo(`messages-clear`,{}))?.ok?(M(this.#n,!0),this.question&&$.show(`Cleared. The open question stays.`)):$.show(`Could not clear the messages.`,`warning`)}},Ay=V(`<button class="how svelte-ssy1qy" type="button" aria-label="How to connect an agent" title="How to connect an agent" aria-haspopup="dialog"><!></button>`),jy=V(`<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 My(e,t){let n=ui();O(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=j(void 0),a=j(void 0),o=j(!1),s=A(()=>{let e=Date.parse(Q.status?.agent?.busy??``);return Number.isNaN(e)||!Q.status?0:Math.floor((Date.now()-e)/6e4)}),c=A(()=>Q.status?.agent?.state??`none`),l=A(()=>R(c)===`busy`&&R(s)*6e4>=6e5?`quiet`:R(c)),u=A(()=>ky.question?`question`:R(l)),d=A(()=>r[R(u)]??r.none??[``,``]),f=A(()=>v(R(d),2)),p=A(()=>R(f)[0]),m=A(()=>R(f)[1]),h=A(()=>Q.status?.queued??0),g=A(()=>R(h)>0&&R(u)!==`listening`),_=A(()=>R(u)===`none`&&!R(h)?`off`:R(u)),y=A(()=>R(l)===`none`?void 0:Q.status?.agent?.who),b=A(()=>R(y)&&(R(y).agent||R(y).cwd)?` ${[R(y).agent&&`${R(y).agent}${R(y).agentSession?` session ${R(y).agentSession}`:``}`,R(y).cwd&&`in ${R(y).cwd.replace(/^\/Users\/[^/]+/,`~`)}`].filter(Boolean).join(`, `)}.`:``),x=A(()=>({listening:R(y)?.name?`Agent: ${R(y).name}`:`Agent`,busy:R(s)?`Agent working, ${String(R(s))} min`:`Agent working`,quiet:`Agent quiet, ${String(R(s))} min`,none:R(h)?R(p):`No agent`}[R(u)]??R(p))+(R(g)?`, ${String(R(h))} waiting`:``)),S=A(()=>`${R(p)}${R(y)?.name?`: ${R(y).name}`:``}.${R(b)} ${R(m)}${R(g)?` ${String(R(h))} ${R(h)===1?`request waits`:`requests wait`} for it; only the newest run or Stop is handed over.`:``}`),C=()=>{let e=R(i)?.getBoundingClientRect();e&&R(a)&&(R(a).style.top=`${String(e.bottom+6)}px`,R(a).style.right=`${String(Math.max(12,innerWidth-e.right))}px`)};Ln(()=>{(R(l)===`listening`||R(l)===`busy`)&&R(o)&&R(a)?.hidePopover()});var w=li(),T=P(w),ee=e=>{var t=jy(),r=P(t),s=F(I(N(r)),!0);D(r);var c=I(r,2),u=e=>{var t=Ay();X(N(t),{get of(){return Oy},size:15}),D(t),Ma(t,e=>M(i,e),()=>R(i)),L(()=>{q(t,`aria-expanded`,R(o)),q(t,`popovertarget`,n)}),H(e,t)};W(c,e=>{(R(l)===`none`||R(l)===`quiet`)&&e(u)});var d=I(c,2),f=N(d),p=I(f,4),m=I(N(p),2);Ic(I(N(m)),{command:`/koppler-run connect`}),D(m),Me(2),D(p),D(d),Ma(d,e=>M(a,e),()=>R(a)),L(()=>{q(r,`data-state`,R(_)),q(r,`title`,R(S)),q(r,`aria-expanded`,ky.open),U(s,R(x)),q(d,`id`,n),q(d,`aria-labelledby`,`${n}-title`),q(f,`id`,`${n}-title`)}),B(`click`,r,()=>ky.open=!ky.open),z(`toggle`,d,e=>{M(o,e.newState===`open`),R(o)&&C()}),H(e,t)};W(T,e=>{Q.status&&e(ee)}),H(e,w),k()}Qr([`click`]);var Ny=new Set([`$$slots`,`$$events`,`$$legacy`]);function Py(e,t){let n=J(t,Ny),r={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Fy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Iy(e,t){let n=J(t,Fy),r={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var Ly=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ry(e,t){let n=J(t,Ly),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 zy=new Set([`$$slots`,`$$events`,`$$legacy`]);function By(e,t){let n=J(t,zy),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 Vy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hy(e,t){let n=J(t,Vy),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 Uy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wy(e,t){let n=J(t,Uy),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 Gy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ky(e,t){let n=J(t,Gy),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 qy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jy(e,t){let n=J(t,qy),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 Yy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xy(e,t){let n=J(t,Yy),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 Zy=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qy(e,t){let n=J(t,Zy),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 $y=new Set([`$$slots`,`$$events`,`$$legacy`]);function eb(e,t){let n=J(t,$y),r={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var tb=new Set([`$$slots`,`$$events`,`$$legacy`]);function nb(e,t){let n=J(t,tb),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 rb=new Set([`$$slots`,`$$events`,`$$legacy`]);function ib(e,t){let n=J(t,rb),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 ab=new Set([`$$slots`,`$$events`,`$$legacy`]);function ob(e,t){let n=J(t,ab),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 sb=V(`<span class="tag svelte-1ypd2at">current</span>`),cb=V(`<span class="tag svelte-1ypd2at">picked</span>`),lb=V(`<li role="option" class="svelte-1ypd2at"><span class="name svelte-1ypd2at"> </span> <!></li>`),ub=V(`<li class="note svelte-1ypd2at" role="presentation"> </li>`),db=V(`<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 fb(e,t){let n=ui();O(t,!0);let r=Y(t,`label`,3,`Branch`),i=j(void 0),a=j(void 0),o=j(!1),s=j(``),c=j(0),l=``,u=A(()=>R(s)?t.branches.filter(e=>e.toLowerCase().includes(R(s).toLowerCase())):t.branches),d=A(()=>R(u).slice(0,80)),f=(e,t)=>{let n=R(i)?.getBoundingClientRect();if(!n||!R(a))return;R(a).style.left=`${String(n.left)}px`,R(a).style.minWidth=`${String(Math.max(n.width,280))}px`,R(a).style.maxWidth=`${String(Math.max(280,Math.min(560,innerWidth-n.left-12)))}px`;let r=n.bottom+4;R(a).style.top=`${String(r+R(a).offsetHeight>innerHeight-8?Math.max(8,n.top-4-R(a).offsetHeight):r)}px`,t&&R(a).children[e]?.scrollIntoView({block:`nearest`})};Ln(()=>{R(o)&&f(R(c),R(d).length)});let p=()=>{!R(o)&&R(i)&&(l=R(i).value,M(s,``),M(c,Math.max(0,R(d).indexOf(t.value||t.current)),!0),M(o,!0),R(i).select(),R(a)?.showPopover())},m=()=>{R(o)&&(M(o,!1),R(a)?.hidePopover())},h=e=>{let n=e.trim();!n&&R(i)&&(R(i).value=t.current),n!==(t.value||t.current)&&t.onpick(n===t.current?``:n)},g=e=>{R(i)&&(R(i).value=e),h(e),m(),R(i)?.blur()},_=e=>{if(!R(o))e.key===`ArrowDown`&&p();else if((e.key===`ArrowDown`||e.key===`ArrowUp`)&&R(d).length)e.preventDefault(),M(c,(R(c)+(e.key===`ArrowDown`?1:-1)+R(d).length)%R(d).length);else if(e.key===`Enter`){e.preventDefault();let t=R(d)[R(c)];t?g(t):R(i)?.blur()}else e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),R(i)&&(R(i).value=l),m(),R(i)?.blur())};var v=db(),y=P(v);ma(y),Ma(y,e=>M(i,e),()=>R(i));var b=I(y,2),x=N(b);G(x,18,()=>R(d),e=>e,(e,r,i)=>{var a=lb(),o=N(a),s=F(o,!0),l=I(o,2),u=e=>{H(e,sb())},d=e=>{H(e,cb())};W(l,e=>{r===t.current?e(u):r===t.value&&e(d,1)}),D(a),L(()=>{q(a,`id`,`${n}-${R(i)??``}`),q(a,`aria-selected`,R(i)===R(c)),q(a,`title`,r),U(s,r)}),z(`pointerenter`,a,()=>M(c,R(i),!0)),B(`click`,a,e=>{e.preventDefault(),g(r)}),H(e,a)});var S=I(x,2),C=e=>{var t=ub(),n=F(t);L(()=>U(n,`${R(u).length-R(d).length} more, keep typing`)),H(e,t)},w=e=>{var n=ub(),r=F(n,!0);L(()=>U(r,t.branches.length?`No branch matches. Enter keeps "${R(s)}".`:`No branches found. Run koppler sync.`)),H(e,n)};W(S,e=>{R(u).length>R(d).length?e(C):R(u).length||e(w,1)}),D(b),Ma(b,e=>M(a,e),()=>R(a)),L(e=>{q(y,`aria-label`,r()),q(y,`aria-expanded`,R(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`)},[()=>R(o)&&R(d).length?`${n}-${String(R(c))}`:void 0]),B(`click`,y,p),z(`blur`,y,e=>{h(e.currentTarget.value),m()}),B(`input`,y,e=>{p(),M(s,e.currentTarget.value.trim(),!0),M(c,0)}),B(`keydown`,y,_),B(`pointerdown`,b,e=>{e.preventDefault()}),H(e,v),k()}Qr([`click`,`input`,`keydown`,`pointerdown`]);var pb=V(`<label class="field svelte-1kkgx5y">Branch <!></label>`),mb=V(`<label class="svelte-1kkgx5y"><input type="radio"/> </label>`),hb=V(`<div class="field svelte-1kkgx5y" role="radiogroup"> <span class="seg svelte-1kkgx5y"></span></div>`),gb=V(`<div class="field svelte-1kkgx5y" role="group" aria-label="Who starts it">Started by <span class="seg svelte-1kkgx5y"></span></div>`),_b=V(`<option> </option>`),vb=V(`<label class="field svelte-1kkgx5y">Platform <span class="combo svelte-1kkgx5y"><select class="mono svelte-1kkgx5y"></select></span></label>`),yb=V(`<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>`),bb=V(`<button class="link svelte-1kkgx5y" type="button"> </button>`),xb=V(`<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>`),Sb=V(`<div class="row svelte-1kkgx5y"><!> <!> <!> <!></div>`),Cb=V(`<label class="toggle svelte-1kkgx5y"><input type="checkbox" role="switch"/><span class="track" aria-hidden="true"></span> </label>`),wb=V(`<div class="field svelte-1kkgx5y">Libraries <!></div>`),Tb=V(`<optgroup label="Call a local app"></optgroup>`),Eb=V(`<optgroup label="Remove the cable to"></optgroup>`),Db=V(`<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>`),Ob=V(`<button class="note-toggle svelte-1kkgx5y" type="button">Add a note for the agent</button>`),kb=V(`<label class="field svelte-1kkgx5y">Cables <span class="combo svelte-1kkgx5y"><select class="svelte-1kkgx5y"><option>Add or remove…</option><!><!></select></span></label> <!>`,1),Ab=V(`<div class="body svelte-1kkgx5y"><!> <!> <!> <!> <!></div>`);function jb(e,t){O(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=A(()=>Z.nodes.find(e=>e.id===t.id)?.data),i=A(()=>Z.app(t.id)),a=A(()=>R(i)?.current||`current branch`),o=A(()=>`${String(R(i)?.dirty??0)} uncommitted ${R(i)?.dirty===1?`change`:`changes`}`),s=A(()=>(R(i)?.runIn??[]).map(([e])=>e).filter(e=>Object.hasOwn(Qs,e))),c=A(()=>R(s).length>1),l=A(()=>R(r)?.run===`mock`),u=A(()=>Z.tunnelsOf(t.id)),d=A(()=>Z.queuesOf(t.id)),f=A(()=>R(d).filter(e=>Z.hiddenQueues[e])),p=A(()=>R(d).length>0&&!R(r)?.showQueues),m=A(()=>Z.localLibraries(t.id)),h=(e,n)=>{Z.set(t.id,{libraries:n?[...R(m),e]:R(m).filter(t=>t!==e)})},g=A(()=>!!R(i)?.platforms.length&&R(r)?.run===`cli`),_=j(mn({can:[],wired:[]})),y=j(!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 T=li(),ee=P(T),te=e=>{var x=Ab(),T=N(x),ee=e=>{var n=pb(),a=I(N(n));{let e=A(()=>R(i)?.current??``),n=A(()=>R(i)?.branches??[]),s=A(()=>R(i)?.dirty&&!Z.switchesOver(t.id)?`Runs with your ${R(o)}`:void 0);fb(a,{get value(){return R(r).branch},get current(){return R(e)},get branches(){return R(n)},get title(){return R(s)},onpick:e=>{Z.set(t.id,{branch:e})}})}D(n),H(e,n)};W(T,e=>{R(l)||e(ee)});var te=I(T,2),E=e=>{var i=hb(),s=N(i),c=I(s);G(c,21,()=>n,([e,t,n])=>e,(e,n)=>{var i=A(()=>v(R(n),3));let a=()=>R(i)[0],o=()=>R(i)[1],s=()=>R(i)[2];var c=mb(),l=N(c);ma(l);var u=I(l,1,!0);D(c),L(()=>{q(c,`title`,s()),q(l,`name`,`changes-${t.id??``}`),ha(l,a()),ga(l,(R(r).changes??`set-aside`)===a()),U(u,o())}),B(`change`,l,()=>{Z.set(t.id,{changes:a()})}),H(e,c)}),D(c),D(i),L(()=>{q(i,`aria-label`,`Your ${R(o)??``} on ${R(a)??``}`),q(i,`title`,`Your ${R(o)??``} on ${R(a)??``}: set aside while it runs the other branch, or taken along. Back on Stop either way.`),U(s,`${R(o)??``} `)}),H(e,i)},ne=A(()=>Z.switchesOver(t.id));W(te,e=>{R(ne)&&e(E)});var re=I(te,2),ie=e=>{var n=Sb(),a=N(n),o=e=>{var n=gb(),i=I(N(n));G(i,20,()=>R(s),e=>e,(e,n)=>{var i=mb(),a=N(i);ma(a);var o=I(a,1,!0);D(i),L(()=>{q(a,`name`,`run-${t.id??``}`),ha(a,n),ga(a,R(r).run===n),U(o,Qs[n])}),B(`change`,a,()=>{Z.set(t.id,{run:n})}),H(e,i)}),D(i),D(n),L(e=>q(n,`title`,`Koppler: the agent starts it. Me: you start it yourself (IDE, terminal, anything); the agent only prepares it.${e??``}`),[()=>R(s).includes(`mock`)?` Mock: Koppler answers its mock responses from the stack in its place.`:``]),H(e,n)};W(a,e=>{R(c)&&e(o)});var l=I(a,2),m=e=>{var n=vb(),a=I(N(n)),o=N(a);G(o,21,()=>R(i)?.platforms??[],([e,t])=>e,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1];var a=_b(),o=F(a,!0),s={};L(()=>{U(o,i()),s!==(s=r())&&(a.value=(a.__value=s)??``)}),H(e,a)}),D(o);var s;ta(o),D(a),D(n),L(()=>{s!==(s=R(r).platform)&&(o.value=(o.__value=s)??``,ea(o,s))}),B(`change`,o,e=>{Z.set(t.id,{platform:e.currentTarget.value})}),H(e,n)};W(l,e=>{R(g)&&e(m)});var h=I(l,2),_=e=>{var n=yb(),i=I(N(n)),a=N(i);ma(a);var o=I(a,2,!0);D(i),D(n),L(()=>{q(i,`title`,R(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 ${R(r).name??``}'s tunnels`),ga(a,!R(r).hideTunnels),U(o,R(r).hideTunnels?`Off`:`On`)}),B(`change`,a,e=>{Z.set(t.id,{hideTunnels:!e.currentTarget.checked})}),H(e,n)};W(h,e=>{R(u).length&&e(_)});var y=I(h,2),b=e=>{var n=xb(),i=I(N(n)),a=N(i);ma(a);var o=I(a,2,!0);D(i);var s=I(i,2),c=e=>{var t=bb(),n=F(t);L(()=>U(n,`Show ${R(f).length??``} hidden`)),B(`click`,t,()=>{Z.showQueues(R(d),!0)}),H(e,t)};W(s,e=>{R(f).length&&!R(p)&&e(c)}),D(n),L(()=>{q(i,`title`,R(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 ${R(r).name??``}'s queues`),ga(a,!R(p)),U(o,R(p)?`Off`:`On`)}),B(`change`,a,e=>{Z.set(t.id,{showQueues:e.currentTarget.checked})}),H(e,n)};W(y,e=>{R(d).length&&e(b)}),D(n),H(e,n)};W(re,e=>{(R(c)||R(u).length||R(d).length)&&e(ie)});var ae=I(re,2),oe=e=>{var t=wb();G(I(N(t)),17,()=>R(i).libraries,e=>e.name,(e,t)=>{let n=A(()=>R(m).includes(R(t).name));var i=Cb(),a=N(i);ma(a);var o=I(a,2,!0);D(i),L(e=>{q(i,`title`,e),q(a,`aria-label`,`Use the local ${R(t).name??``}`),ga(a,R(n)),U(o,R(t).name)},[()=>R(n)?`On: ${R(r).name} uses your local copy in ${R(t).path.replace(/^\/Users\/[^/]+/,`~`)}`:`Off: ${R(r).name} uses the published ${R(t).name}`]),B(`change`,a,e=>{h(R(t).name,e.currentTarget.checked)}),H(e,i)}),D(t),H(e,t)};W(ae,e=>{R(i)?.libraries.length&&!R(l)&&e(oe)});var se=I(ae,2),ce=e=>{var n=kb(),i=P(n),a=I(N(i)),o=N(a),s=N(o);s.value=s.__value=``;var c=I(s),l=e=>{var t=Tb();G(t,21,()=>R(_).can,e=>e.id,(e,t)=>{var n=_b(),r=F(n,!0),i={};L(()=>{U(r,R(t).name),i!==(i=`+${R(t).id??``}`)&&(n.value=n.__value=i)}),H(e,n)}),D(t),H(e,t)};W(c,e=>{R(_).can.length&&e(l)});var u=I(c),d=e=>{var t=Eb();G(t,21,()=>R(_).wired,e=>e.id,(e,t)=>{var n=_b(),r=F(n,!0),i={};L(()=>{U(r,R(t).name),i!==(i=`-${R(t).id??``}`)&&(n.value=n.__value=i)}),H(e,n)}),D(t),H(e,t)};W(u,e=>{R(_).wired.length&&e(d)}),D(o),D(a),D(i);var f=I(i,2),p=e=>{var n=Db(),i=I(N(n));yt(i),Bi(i,()=>w),D(n),L(()=>ha(i,R(r).note)),B(`input`,i,e=>{w(e.currentTarget),Z.set(t.id,{note:e.currentTarget.value})}),z(`blur`,i,()=>M(y,!1)),H(e,n)},m=e=>{var t=Ob();B(`click`,t,()=>M(y,!0)),H(e,t)};W(f,e=>{R(r).note||R(y)?e(p):e(m,-1)}),L(()=>q(o,`aria-label`,`Add or remove a cable from ${R(r).name??``}`)),z(`focus`,o,()=>M(_,Z.cablesOf(t.id),!0)),B(`pointerdown`,o,()=>M(_,Z.cablesOf(t.id),!0)),B(`change`,o,b),H(e,n)};W(se,e=>{R(l)||e(ce)}),D(x),z(`mousedown`,x,S,!0),B(`click`,x,C),H(e,x)};W(ee,e=>{R(r)&&e(te)}),H(e,T),k()}Qr([`click`,`change`,`pointerdown`,`input`]);var Mb=(e,t)=>document.elementsFromPoint(e,t).find(e=>e.classList.contains(`svelte-flow__node`))?.getAttribute(`data-id`)??void 0,Nb=new class{#e=j(null);get draft(){return R(this.#e)}set draft(e){M(this.#e,e)}#t=j(null);get grabbed(){return R(this.#t)}set grabbed(e){M(this.#t,e)}#n=j(null);get drop(){return R(this.#n)}set drop(e){M(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=Jo(r,i),o=Z.ends.offset[`${String(e)}|${t}`]??0;return Uo[i][0]===0?{...a,x:a.x+o}:{...a,y:a.y+o}}nearestSide(e,t){let n=n=>Math.hypot(Jo(e,n).x-t.x,Jo(e,n).y-t.y);return Object.keys(Uo).reduce((e,t)=>n(t)<n(e)?t:e)}start(e,t){let n=Z.boxes.get(e);if(!n)return;let r=Jo(n,t),i=[],a=e=>Z.toFlow({x:e.clientX,y:e.clientY}),o=t=>{let n=Mb(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(Uo).find(e=>Math.hypot(Jo(o,e).x-s.x,Jo(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?Jo(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});Mb(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();Mb(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=Uo[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)}},Pb=(e,t,n)=>{try{let r=localStorage.getItem(e);return t.includes(r)?r:n}catch{return n}},Fb=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},Ib=()=>{try{return JSON.parse(sessionStorage.getItem(`koppler-log-cleared`)??`{}`)??{}}catch{return{}}},Lb=e=>{let[t=``,n]=e.split(`@`);return[t,n]},Rb=new class{#e=j([]);get tabs(){return R(this.#e)}set tabs(e){M(this.#e,e)}#t=j(null);get active(){return R(this.#t)}set active(e){M(this.#t,e,!0)}#n=j(!1);get raw(){return R(this.#n)}set raw(e){M(this.#n,e,!0)}#r=j(Ib());get cleared(){return R(this.#r)}set cleared(e){M(this.#r,e)}#i=j({});get full(){return R(this.#i)}set full(e){M(this.#i,e)}#a={};#o=j([]);get all(){return R(this.#o)}set all(e){M(this.#o,e)}#s=j(mn(Pb(`koppler-log-since`,[`run`,`hour`,`lines`],`run`)));get since(){return R(this.#s)}set since(e){M(this.#s,e,!0)}#c=j(mn(Pb(`koppler-log-names`,[`every`,`change`],`every`)));get names(){return R(this.#c)}set names(e){M(this.#c,e,!0)}setSince(e){this.since=e,Fb(`koppler-log-since`,e),this.reload()}reload(){this.#a[`*`]=0,this.refresh()}setNames(e){this.names=e,Fb(`koppler-log-names`,e)}allApps(){return Z.nodes.map(e=>e.id).filter(e=>!Z.hiddenLogs[e])}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 e!==`*`&&!!Lb(e)[1]}label(e){if(e===`*`)return`All apps`;let[t,n]=Lb(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;if(this.#a[e]=Date.now(),e===`*`){let e=this.since===`lines`?`since=all&lines=2000`:`since=${this.since}`,t=this.allApps().map(encodeURIComponent).join(`,`);fetch(`log-all?apps=${t}&${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(e=>{e&&(this.all=e)}).catch(()=>void 0);return}let[t,n]=Lb(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}},zb=(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),Bb=e=>zb(e.name,Z.openBoard(e));async function Vb(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);zb(n.error===void 0?n.name:e.name,n)}async function Hb(e){let t=await Co(`preset`,{url:e});if(t.error)return t.error;let n=Z.importBoards(t.presets,e);return n.error===void 0?(zb(n.name,n),null):n.error}var Ub=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60]];function Wb(e){let t=(new Date(e).getTime()-Date.now())/1e3,n=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});for(let[e,r]of Ub)if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return`just now`}var Gb=mn({}),Kb=[[`starts`,`Starts`],[`restarts`,`Restarts`],[`stops`,`Stops and reverts`],[`keeps`,`Keeps running`]],qb=()=>(Date.now().toString(36)+Math.random().toString(36).slice(2,8)).replace(/[^a-z0-9]/g,``),Jb=Z.nameOf,Yb=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`,Xb=new class{#e=j(null);get review(){return R(this.#e)}set review(e){M(this.#e,e)}#t=j(mn({}));get onItsOwn(){return R(this.#t)}set onItsOwn(e){M(this.#t,e,!0)}#n=j(mn({}));get leftOut(){return R(this.#n)}set leftOut(e){M(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 As(t?.live??null,e,{name:Jb,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 ${Jb(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 ${Jb(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 ${Jb(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` ${Jb(e)} → local ${Jb(t)}${i}`}),...e.deployed.map(({from:e,to:n})=>` ${Jb(e)} → ${t} ${Jb(n)}`),...e.deployed.filter(({to:t})=>e.nodes.some(e=>e.id===t)).map(({from:e,to:n})=>`! ${Jb(n)} is local but ${Jb(e)} still calls ${t}`)].join(`
|
|
9
|
+
`)}async deliver(e,t,n){return(await xo(`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 Kb.filter(([t])=>e[t].length).map(([n,r])=>({verb:n,label:r,items:e[n].map(e=>({name:Jb(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,Gb.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=Yb(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(Jb).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:Jb(e),notes:[{text:`from ${t.map(Jb).join(`, `)}`}],...r&&{act:{label:`Run locally`,title:`Run it locally too, and point ${t.map(Jb).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(Jb).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(Kb.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
|
+
`+Ms(a,{name:Jb}).map(e=>` ${e}`).join(`
|
|
13
|
+
`);Z.commit();let r=Z.saved();So(r);let o={...i,id:qb(),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 ${Jb(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 ${Jb(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:Jb(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 xo(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)?Jb(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:()=>{Bb(t)}}})}async stopApp(e){let t=await Co(`stop-apps`,{app:e});`stopped`in t&&t.stopped.length?$.show(`Stopped ${Jb(e)}. Its changes stay until you revert.`):$.show(`Could not stop ${Jb(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:Jb(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:qb(),...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()}},Zb=V(`<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),Qb=V(`<button type="button" title="Run alone: just this app and its tunnels, on a board of its own" class="svelte-byllhq"><!></button>`),$b=V(`<button type="button" aria-label="Show log" title="Show log" class="svelte-byllhq"><!></button>`),ex=V(`<button type="button" class="svelte-byllhq"><!></button>`),tx=V(`<a class="tool svelte-byllhq" target="_blank" rel="noopener" title="Its requests, followed across your local apps"><!></a>`),nx=V(`<button type="button" title="Hot reload: the app takes your code changes as it runs. Shift-click to hot restart." class="svelte-byllhq"><!></button>`),rx=V(`<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=V(`<span class="live svelte-byllhq" role="img"></span>`),ax=V(`<span class="watch svelte-byllhq" role="img" aria-label="Auto-restart" title="Restarts when its files change"><!></span>`),ox=V(`<span class="svelte-byllhq"> </span>`),sx=V(`<span title="It is taken off its queues and keeps the deployed ones" class="svelte-byllhq">No queues</span>`),cx=V(`<span class="off svelte-byllhq" title="Only the API runs; calls through its tunnels fail">No tunnels</span>`),lx=V(`<p class="glance svelte-byllhq"><span class="svelte-byllhq"> </span> <!> <!> <!></p>`),ux=V(`<p class="where nodrag svelte-byllhq"> </p>`),dx=V(`<i class="svelte-byllhq"></i>`),fx=V(`<p class="why nodrag svelte-byllhq"> </p>`),px=V(`<span class="detail svelte-byllhq"> </span>`),mx=V(`<li class="step svelte-byllhq"><span class="mark svelte-byllhq" aria-hidden="true"><!></span> <span class="what svelte-byllhq"> </span> <!> <!></li>`),hx=V(`<ul class="steps nodrag nopan svelte-byllhq"></ul>`),gx=V(`<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=V(`<div class="acts nodrag svelte-byllhq"><button class="act fix svelte-byllhq" type="button"> </button></div>`),vx=V(`<button class="chip svelte-byllhq" type="button"> </button>`),yx=V(`<div class="calls nodrag nopan svelte-byllhq"><span class="calls-label svelte-byllhq"> </span> <!></div>`),bx=V(`<button title="Drag a cable to an app this one should call locally" tabindex="-1"></button>`),xx=V(`<!> <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){O(t,!0);let n=j(!1),r,i=()=>{clearTimeout(r),M(n,!0)},a=()=>{r=setTimeout(()=>M(n,!1),250)},o=A(()=>R(n)||t.selected),s=[`top`,`right`,`bottom`,`left`],c=Ey(),l=A(()=>c.current.zoom<$s),u=A(()=>R(l)||Z.live),d=j(0),f=j(0);Ln(()=>{!R(u)&&R(d)&&M(f,R(d),!0)});let p=A(()=>Z.app(t.id)),m=A(()=>R(p)?.current||`current branch`),h=A(()=>Z.tunnelsOf(t.id)),g=A(()=>Z.queuesOf(t.id)),_=A(()=>R(g).length>0&&!t.data.showQueues),y=A(()=>Z.deployedCalls(t.id)),b=e=>{let[n,...r]=e.split(` `);return r.length&&n===t.data.name.split(` `)[0]?r.join(` `):e},x=A(()=>!!R(p)?.platforms.length&&t.data.run===`cli`),S=A(()=>R(p)?.platforms.find(([e])=>e===t.data.platform)?.[1]),C=A(()=>t.data.run===`ide`?`Started by you`:t.data.run===`mock`?`Mock`:R(x)?R(S):void 0),w=A(()=>Q.up(t.id)),T=A(()=>Q.where(t.id)),ee=A(()=>Q.state(t.id)),te=async e=>{let n=await Co(`reload`,{app:t.id,restart:e});`error`in n?$.show(n.error,`warning`):$.show(`${n.said}.`)},E=A(()=>Q.stateSaid(t.id)),ne=A(()=>Q.steps(t.id)),re=A(()=>R(ne).length?fc(R(ne)):[`todo`,``]),ie=A(()=>v(R(re),2)),ae=A(()=>R(ie)[0]),oe=A(()=>R(ie)[1]),se=A(()=>R(ne).find(e=>e.state===`failed`)),ce=j(!1),le=j(!1),ue=e=>Z.ends.onPort.some(n=>n.id===t.id&&n.side===e);var de=xx(),fe=P(de);{let e=A(()=>R(o)&&!t.dragging);Ty(fe,{get isVisible(){return R(e)},get position(){return Am.Top},align:`end`,offset:6,children:(e,n)=>{var r=rx();let o;var s=N(r),c=e=>{var n=Zb(),r=P(n);X(N(r),{get of(){return jc},size:15,filled:!0}),D(r);var i=I(r,2);X(N(i),{get of(){return ob},size:15}),D(i),L(()=>{q(r,`aria-label`,`Stop ${t.data.name??``}`),q(i,`aria-label`,`Restart ${t.data.name??``}`)}),B(`click`,r,()=>void Xb.stopApp(t.id)),B(`click`,i,()=>{Xb.start({restart:t.id})}),H(e,n)},l=A(()=>Xb.started.includes(t.id)),u=e=>{var n=Qb();X(N(n),{get of(){return so},size:15,filled:!0}),D(n),L(()=>q(n,`aria-label`,`Run ${t.data.name??``} alone`)),B(`click`,n,()=>{Xb.alone(t.id)}),H(e,n)};W(s,e=>{R(l)?e(c):e(u,-1)});var d=I(s,2),f=e=>{var n=$b();X(N(n),{get of(){return ib},size:15}),D(n),B(`click`,n,()=>{Rb.open(t.id)}),H(e,n)},m=A(()=>Q.hasLog(t.id));W(d,e=>{R(m)&&e(f)});var h=I(d,2);G(h,17,()=>Z.commandsOf(t.id),([e,t])=>e,(e,n)=>{var r=A(()=>v(R(n),2));let i=()=>R(r)[0],a=()=>R(r)[1],o=A(()=>({app:t.id,appName:t.data.name,key:i(),command:a()}));var s=ex();X(N(s),{get of(){return _c[a().icon??`terminal`]},size:15}),D(s),L(()=>{q(s,`aria-label`,`${a().label??``} on ${t.data.name??``}`),q(s,`title`,a().confirm?`${a().label}: ${a().confirm}`:a().label)}),B(`click`,s,()=>{a().confirm||a().args?.length?Gb.command?.open(R(o)):vc(R(o)).then(e=>{e&&$.show(e,`warning`)})}),H(e,s)});var g=I(h,2),_=e=>{var n=tx();X(N(n),{get of(){return Qy},size:15}),D(n),L(e=>{q(n,`href`,`${Q.status.traces.view??``}?service=${e??``}`),q(n,`aria-label`,`Traces of ${t.data.name??``}`)},[()=>encodeURIComponent(t.id)]),H(e,n)},y=A(()=>Q.status?.traces?.state===`on`&&Q.sent(t.id));W(g,e=>{R(y)&&e(_)});var b=I(g,2),x=e=>{var n=nx();X(N(n),{get of(){return Xy},size:15}),D(n),L(()=>q(n,`aria-label`,`Hot reload ${t.data.name??``}`)),B(`click`,n,e=>void te(e.shiftKey)),H(e,n)};W(b,e=>{R(p)?.kind===`flutter`&&t.data.run===`cli`&&R(w)&&e(x)});var S=I(b,2),C=e=>{var n=ex();X(N(n),{get of(){return lo},size:15}),D(n),L(()=>{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`)}),B(`click`,n,()=>{Z.set(t.id,{watch:!t.data.watch})}),H(e,n)};W(S,e=>{t.data.run===`cli`&&e(C)});var T=I(S,2);Pc(N(T),{size:15}),D(T);var ee=I(T,2);X(N(ee),{get of(){return to},size:15}),D(ee),D(r),L(()=>{o=K(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(T,`aria-label`,`Settings for ${t.data.name??``}`),q(ee,`aria-label`,`Remove ${t.data.name??``}`)}),z(`pointerenter`,r,i),z(`pointerleave`,r,a),B(`click`,T,()=>void Gb.settings?.open({title:t.data.name,path:`apps.${t.id}`})),B(`click`,ee,()=>{Z.remove(t.id)}),H(e,r)},$$slots:{default:!0}})}var pe=I(fe,2);let me,he;var ge=N(pe),_e=N(ge);X(N(_e),{get of(){return nb},size:14}),D(_e);var ve=I(_e,2),ye=e=>{var n=ix();L(e=>{q(n,`data-on`,R(w)),q(n,`data-state`,R(ee)?.state),q(n,`aria-label`,R(ee)?uc[R(ee).state]:R(w)?`Running`:`Not answering`),q(n,`title`,e)},[()=>R(E)||Q.about(t.id)]),H(e,n)};W(ve,e=>{(R(w)!==null||R(ee))&&e(ye)});var be=I(ve,2),xe=F(be,!0),Se=I(be,2),Ce=e=>{var t=ax();X(N(t),{get of(){return lo},size:12}),D(t),H(e,t)};W(Se,e=>{t.data.watch&&t.data.run===`cli`&&e(Ce)});var we=F(I(Se,2),!0);D(ge);var Te=I(ge,2),Ee=e=>{var n=lx(),r=N(n),i=F(r,!0),a=I(r,2),o=e=>{var t=ox(),n=F(t,!0);L(()=>U(n,R(C))),H(e,t)};W(a,e=>{R(C)&&e(o)});var s=I(a,2),c=e=>{H(e,sx())};W(s,e=>{R(_)&&e(c)});var l=I(s,2),u=e=>{H(e,cx())};W(l,e=>{t.data.hideTunnels&&R(h).length&&e(u)}),D(n),L(()=>{q(r,`title`,`Branch: ${(t.data.branch||R(m))??``}`),U(i,t.data.branch||R(m))}),H(e,n)},De=e=>{jb(e,{get id(){return t.id}})};W(Te,e=>{R(u)?e(Ee):e(De,-1)});var Oe=I(Te,2),ke=e=>{var t=ux(),n=F(t,!0);L(()=>{q(t,`data-on`,R(w)??`other`),U(n,R(T))}),H(e,t)},Ae=e=>{var t=ux(),n=F(t,!0);L(()=>{q(t,`data-state`,R(ee)?.state),U(n,R(E))}),H(e,t)};W(Oe,e=>{R(T)?e(ke):R(E)&&e(Ae,1)});var je=I(Oe,2),Me=e=>{var t=gx(),n=P(t),r=N(n);G(r,21,()=>R(ne),Di,(e,t)=>{var n=dx();L(()=>{q(n,`data-state`,R(t).state),q(n,`title`,R(t).label)}),H(e,n)}),D(r);var i=I(r,2),a=F(i,!0),o=F(I(i,2),!0);D(n);var s=I(n,2),c=e=>{var t=fx(),n=F(t,!0);L(()=>U(n,R(se).detail)),H(e,t)};W(s,e=>{R(se)?.detail&&!R(ce)&&e(c)});var l=I(s,2),u=e=>{var t=hx();G(t,21,()=>R(ne),Di,(e,t)=>{var n=mx(),r=N(n),i=N(r),a=e=>{X(e,{get of(){return eb},size:11})},o=e=>{H(e,ci(`!`))};W(i,e=>{R(t).state===`done`?e(a):R(t).state===`failed`&&e(o,1)}),D(r);var s=I(r,2),c=F(s,!0),l=I(s,2),u=e=>{var n=px(),r=F(n,!0);L(()=>U(r,R(t).detail)),H(e,n)};W(l,e=>{R(t).detail&&e(u)});var d=I(l,2),f=e=>{Ic(e,{get command(){return R(t).copy}})};W(d,e=>{R(t).copy&&e(f)}),D(n),L(()=>{q(n,`data-state`,R(t).state),U(c,R(t).label)}),H(e,n)}),D(t),H(e,t)};W(l,e=>{R(ce)&&e(u)}),L(()=>{q(n,`data-tone`,R(ae)),q(n,`aria-expanded`,R(ce)),U(a,R(oe)),U(o,R(ce)?`Hide`:`Details`)}),B(`click`,n,()=>M(ce,!R(ce))),H(e,t)};W(je,e=>{R(ne).length&&e(Me)});var Ne=I(je,2),Pe=e=>{var n=_x(),r=N(n),i=F(r,!0);D(n),L(()=>{r.disabled=R(le),U(i,R(le)?`Sent to the agent`:`Ask the agent to fix`)}),B(`click`,r,async()=>{M(le,await Xb.askToFix(t.id,`${R(se).label}${R(se).detail?`: ${R(se).detail}`:``}`),!0)}),H(e,n)};W(Ne,e=>{R(se)&&e(Pe)});var Fe=I(Ne,2),Ie=e=>{var n=yx(),r=N(n),i=F(r);G(I(r,2),17,()=>R(y),e=>e.id,(e,n)=>{let r=A(()=>Z.cards.some(e=>e.id===R(n).id)),i=A(()=>R(r)||R(n).cloned);var a=vx(),o=F(a,!0);L((e,t)=>{a.disabled=!R(i),q(a,`title`,`${R(n).name??``} stays on deployed ${e??``}.${R(i)?` Click to ${R(r)?`wire it to your local copy`:`run it locally too and wire it`}.`:` It is not cloned on this Mac.`}`),U(o,t)},[()=>Z.env.toUpperCase(),()=>b(R(n).name)]),B(`click`,a,()=>{Z.callLocally(t.id,R(n).id)}),H(e,a)}),D(n),L(e=>U(i,`Calls ${e??``}`),[()=>Z.env.toUpperCase()]),H(e,n)};W(Fe,e=>{R(y).length&&e(Ie)});var Le=I(Fe,2);c_(Le,{type:`source`,get position(){return Am.Top},isConnectable:!1,class:`anchor`}),G(I(Le,2),16,()=>s,e=>e,(e,n)=>{var r=bx();let i;L(e=>{i=K(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)]),B(`pointerdown`,r,e=>{e.button===0&&(e.stopPropagation(),Nb.start(t.id,n))}),H(e,r)}),D(pe),L((e,n)=>{me=K(pe,1,`card kind-${t.data.kind??``}`,`svelte-byllhq`,me,{selected:t.selected,dimmed:e,short:R(u),far:R(l),reading:Z.live,"drop-ok":Nb.drop?.id===t.id&&Nb.drop.ok,"drop-bad":Nb.drop?.id===t.id&&!Nb.drop.ok,wiring:!!Nb.draft}),he=Xi(pe,``,he,{width:n}),q(be,`title`,t.data.name),U(xe,t.data.name),U(we,t.data.kindLabel)},[()=>Z.dimmed(t.id),()=>R(u)&&R(f)?`${String(R(f))}px`:void 0]),z(`pointerenter`,pe,i),z(`pointerleave`,pe,a),Aa(pe,`offsetWidth`,e=>M(d,e)),H(e,de),k()}Qr([`click`,`pointerdown`]);var Cx=si(`<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=si(`<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){O(t,!0);let n=Ey(),r=A(()=>Math.max(1,1/n.current.zoom)),i=A(()=>t.data),a=A(()=>Z.edges.findIndex(e=>e.id===t.id)),o=A(()=>Nb.endPoint(R(a),`from`)),s=A(()=>Nb.endPoint(R(a),`to`)),c=A(()=>!R(o)||!R(s)||!R(i)?``:R(i).points?.length?Zo(R(o),R(i).fromSide,R(s),R(i).toSide,R(i).points):Xo(R(o),R(i).fromSide,R(s),R(i).toSide)),l=A(()=>{if(!R(s)||!R(i))return``;let[e,t]=Uo[R(i).toSide];return`translate(${String(R(s).x+e*10)} ${String(R(s).y+t*10)}) rotate(${String(Math.atan2(-t,-e)*180/Math.PI)})`}),u=Z.nameOf,d=A(()=>{if(!R(c)||Z.hovered!==t.id&&!t.selected||Z.live)return``;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,R(c));let n=e.getPointAtLength(e.getTotalLength()/2);return`translate(${String(n.x)} ${String(n.y)}) scale(${String(R(r))})`});var f=li(),p=P(f),m=e=>{var n=wx();let i;var a=N(n),o=F(a),s=I(a);let f;var p=I(s),m=I(p),h=I(m),g=I(h),_=e=>{var n=Cx();L((e,t)=>{q(n,`transform`,R(d)),q(n,`aria-label`,`Unplug ${e??``} from ${t??``}`)},[()=>u(t.source),()=>u(t.target)]),B(`click`,n,e=>{e.stopPropagation(),Z.cut(t.source,t.target)}),B(`keydown`,n,e=>{(e.key===`Enter`||e.key===` `)&&Z.cut(t.source,t.target)}),H(e,n)};W(g,e=>{R(d)&&e(_)}),D(n),L((e,t,a,u,d,g)=>{i=K(n,0,`svelte-1f6oz0q`,null,i,{idle:e,dimmed:t,lit:a,snapped:u}),U(o,`${d??``} calls local ${g??``}. Click to pick it; the × in its middle unplugs it.`),q(s,`d`,R(c)),f=Xi(s,``,f,{"stroke-width":`${16*R(r)}px`}),q(p,`d`,R(c)),q(m,`d`,R(c)),q(h,`transform`,R(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)]),z(`pointerenter`,n,()=>Z.hovered=t.id),z(`pointerleave`,n,()=>Z.hovered=null),H(e,n)};W(p,e=>{R(c)&&e(m)}),H(e,f),k()}Qr([`click`,`keydown`]);var Ex=V(`<span class="dot svelte-1dgo2s3"></span>`),Dx=V(`<span><!> </span>`),Ox=V(`<button class="nodrag svelte-1dgo2s3" type="button"><!></button>`),kx=V(`<div><!></div>`),Ax=V(`<div><span class="head svelte-1dgo2s3"><!> <span class="name svelte-1dgo2s3"> </span> <!> <span class="acts svelte-1dgo2s3"></span></span> <!></div>`);function jx(e,t){O(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=N(l),p=N(d),m=e=>{var n=Ex();L(()=>{q(n,`data-on`,t.dot??null),q(n,`title`,i())}),H(e,n)};W(p,e=>{a()&&e(m)});var h=I(p,2),g=F(h,!0),_=I(h,2),v=e=>{var i=Dx();let a;var o=N(i);Ii(o,()=>t.flag??f);var s=I(o,1,!0);D(i),L(()=>{a=K(i,1,`detail svelte-1dgo2s3`,null,a,{warn:r()}),U(s,n())}),H(e,i)};W(_,e=>{(t.flag||n())&&e(v)});var y=I(_,2);G(y,21,()=>t.actions,e=>e.label,(e,t)=>{var n=Ox(),r=N(n),i=e=>{Pc(e,{size:13})},a=e=>{X(e,{get of(){return R(t).icon},size:13})};W(r,e=>{R(t).icon===`cog`?e(i):e(a,-1)}),D(n),L(()=>{q(n,`aria-label`,R(t).label),q(n,`title`,R(t).title)}),B(`click`,n,()=>{R(t).run()}),H(e,n)}),D(y),D(d);var b=I(d,2),x=e=>{var n=kx();let r;Ii(N(n),()=>t.children),D(n),L(()=>r=K(n,1,`body svelte-1dgo2s3`,null,r,{"under-dot":a()})),H(e,n)};W(b,e=>{t.children&&e(x)}),D(l),L(e=>{u=K(l,1,`infra ${t.kind??``}`,`svelte-1dgo2s3`,u,{active:c(),selected:s(),dimmed:e}),q(l,`title`,o()),U(g,t.name)},[()=>Z.dimmed(t.id)]),H(e,l),k()}Qr([`click`]);function Mx(e,t){O(t,!0);{let n=A(()=>t.data.about.join(`
|
|
17
|
+
`)),r=A(()=>[{label:`Settings for ${t.data.name}`,title:`Settings: its addresses, and the apps it calls`,icon:`cog`,run:()=>void Gb.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 R(n)},get selected(){return t.selected},get actions(){return R(r)},children:(e,n)=>{Me();var r=ci();L(()=>U(r,t.data.where)),H(e,r)},$$slots:{default:!0}})}k()}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=V(`<span class="warn svelte-1jmpek8" role="img"><!></span>`),Ix=V(`<span class="stays svelte-1jmpek8">Stays deployed</span>`),Lx=V(`<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 Rx(e,t){O(t,!0);let n=A(()=>Z.env.toUpperCase()),r=Ey(),i=A(()=>r.current.zoom<$s);{let r=e=>{var n=li(),r=P(n),a=e=>{var n=Fx();X(N(n),{get of(){return Px},size:13}),D(n),L(e=>{q(n,`aria-label`,t.data.shares),q(n,`title`,e)},[()=>t.data.about.slice(1).join(`
|
|
18
|
+
`)]),H(e,n)};W(r,e=>{t.data.shares&&!R(i)&&e(a)}),H(e,n)},a=A(()=>t.data.about.join(`
|
|
19
|
+
`)),o=A(()=>[{label:`Settings for ${t.data.name}`,title:`Settings: the queue's name and its queue on each environment`,icon:`cog`,run:()=>void Gb.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 R(a)},get selected(){return t.selected},get active(){return t.data.local},get actions(){return R(o)},flag:r,children:(e,r)=>{var i=li(),a=P(i),o=e=>{H(e,Ix())},s=e=>{var r=Lx();let i;var a=N(r),o=N(a);ma(o),Me(),D(a);var s=I(a,2),c=N(s);ma(c),Me(),D(s),D(r),L(()=>{i=K(r,1,`seg nodrag svelte-1jmpek8`,null,i,{local:t.data.local}),q(r,`aria-label`,`Which ${t.data.name??``} its apps use`),q(a,`title`,`The ${R(n)??``} queue`),q(o,`name`,`queue-${t.data.queue??``}`),ga(o,!t.data.local),q(s,`aria-disabled`,!t.data.can),q(s,`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(c,`name`,`queue-${t.data.queue??``}`),ga(c,t.data.local),c.disabled=!t.data.can}),B(`change`,o,()=>{Z.setQueue(t.data.queue,!1)}),B(`change`,c,()=>{Z.setQueue(t.data.queue,!0)}),H(e,r)};W(a,e=>{t.data.upstream?e(o):e(s,-1)}),H(e,i)},$$slots:{flag:!0,default:!0}})}k()}Qr([`change`]);var zx=V(`<span class="host svelte-s23l4l"> </span>`);function Bx(e,t){O(t,!0);let n=A(()=>t.data.local.split(`:`).at(-1)??``),r=A(()=>Q.tunnel(R(n),t.data.apps)),i=async()=>{let e=await Co(`restart-tunnel`,{port:Number(R(n))});`error`in e?$.show(e.error,`warning`):$.show(`The ${t.data.what} tunnel started again.`)},a=A(()=>[...R(r)===void 0?[]:[{label:`Restart the ${t.data.what} tunnel`,title:`Close the tunnel and open it again, for when calls through it hang or fail`,icon:ob,run:()=>void i()}],{label:`Settings for the ${t.data.what} tunnel`,title:`Settings: the host, its port and how it is opened`,icon:`cog`,run:()=>void Gb.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 n=A(()=>R(r)?`Tunnel is up`:R(r)===!1?`Nothing is listening on this port`:`Not running`),i=A(()=>[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 R(r)},get dotTitle(){return R(n)},get title(){return R(i)},get selected(){return t.selected},get actions(){return R(a)},children:(e,n)=>{var r=zx(),i=F(r,!0);L(()=>U(i,t.data.host)),H(e,r)},$$slots:{default:!0}})}k()}var Vx=new class{#e=j(!1);get canUndo(){return R(this.#e)}set canUndo(e){M(this.#e,e,!0)}#t=j(!1);get canRedo(){return R(this.#t)}set canRedo(e){M(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)}},Hx={ok:!1,unsure:!0,text:`Cannot test`,detail:`Testing needs the Koppler canvas running (koppler canvas).`},Ux=new class{#e=j(mn({}));get results(){return R(this.#e)}set results(e){M(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 xo(`cable-test`,{env:Z.env,...t,...n&&{auto:!0}}),a=i?.ok?await i.json().catch(()=>Hx):Hx;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)))}},Wx=()=>{try{let e=localStorage.getItem(`koppler-theme`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}},Gx=new class{#e=j(mn(Wx()));get now(){return R(this.#e)}set now(e){M(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{}}},Kx=V(`<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>`),qx=V(`<button class="tool svelte-ibqofz" type="button" role="radio"><!></button>`),Jx=V(`<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),Yx=V(`<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>`),Xx=si(`<path></path>`),Zx=si(`<text class="via svelte-ibqofz"> </text>`),Qx=si(`<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>`),$x=si(`<svg class="links svelte-ibqofz" aria-hidden="true"><!><!></svg>`),eS=si(`<circle role="presentation" r="5"></circle>`),tS=si(`<title class="svelte-ibqofz"> </title>`),nS=si(`<circle r="8"><!></circle><circle class="light svelte-ibqofz" r="3.4"></circle>`,1),rS=si(`<!><!>`,1),iS=si(`<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),aS=si(`<path class="draft svelte-ibqofz"></path>`),oS=si(`<svg role="group" aria-label="Cable ends"><!><!><!></svg>`),sS=V(`<!> <!> <!> <!> <!> <!>`,1),cS=V(`<li class="svelte-ibqofz"><button type="button" class="svelte-ibqofz"><span class="name svelte-ibqofz"> </span> <span class="meta svelte-ibqofz"> </span></button></li>`),lS=V(`<ul aria-label="Or open a board" class="svelte-ibqofz"></ul>`),uS=V(`<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>`),dS=V(`<div class="area svelte-ibqofz" role="presentation"><!> <!></div>`);function fS(e,t){O(t,!0);let n=Lv();Z.toFlow=e=>n.screenToFlowPosition(e,{snapToGrid:!1}),Z.zoom=()=>n.getZoom();let r=Ey(),i=0,a=null,o=A(()=>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=R(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)};Ln(()=>{if(R(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=j(void 0);Z.area=()=>R(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=A(()=>[...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};Ln(()=>{Ux.follow(R(ae))});let m=A(()=>{let e=Nb.draft;return e?e.points.length?Zo(e.a,e.side,e.b,e.bSide,e.points):Xo(e.a,e.side,e.b,e.bSide):``}),h=j(`select`),g=j(!1),_=A(()=>R(h)===`hand`||R(g)),y=e=>{e.code!==`Space`||e.target.closest(`input, select, textarea, button`)||M(g,e.type===`keydown`)},b=[[`select`,`Select (V): drag on the board to select an area`,Wy],[`hand`,`Hand (H): drag to move around. Or hold Space while dragging`,Ry]],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`))}},T=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?Vx.redo():Vx.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`?M(h,`select`):(e.key===`h`||e.key===`H`)&&M(h,`hand`)},ee=Z.view?{initialViewport:Z.view}:Z.nodes.length?{fitView:!0,fitViewOptions:l}:{},te=!1;Ln(()=>{if(te||!Z.nodes.length||Z.boxes.size<Z.nodes.length)return;te=!0;let e=Z.area();[...R(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=Jo(t,o),c=Jo(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:Xo(c,a,s,o),end:s}},ne=A(()=>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=A(()=>[...Z.edges.map(({id:e,source:t,target:n})=>({key:e,apps:[t,n],payload:{from:t,to:n}})),...R(ne).map(({key:e,from:t,payload:n})=>({key:e,apps:[t],payload:n}))]),oe=A(()=>Z.flows.flatMap(({from:e,to:t,queue:n,via:r})=>{let i=e=>Z.boxes.get(e)??Z.infraBoxes.get(e),[a,o]=[i(e),i(t)];if(!a||!o)return[];let s=o.x+o.w/2-(a.x+a.w/2),c=o.y+o.h/2-(a.y+a.h/2),l=s>0?[`right`,`left`]:[`left`,`right`],u=Math.abs(s)*.6>Math.abs(c)?l:c>0?[`bottom`,`top`]:[`top`,`bottom`],d=Z.ledBy(e).includes(t)||Z.ledBy(t).includes(e),f=(e,t)=>Z.boxes.has(e)&&!!Z.ledBy(e).length&&Z.infraSide(e)===t;!d&&(f(e,u[0])||f(t,u[1]))&&(u=l);let[p,m]=[Jo(a,u[0]),Jo(o,u[1])],[h,g]=Uo[u[1]];return[{key:`${e}>${t}`,from:e,to:t,d:Xo(p,u[0],m,u[1]),start:p,head:`translate(${String(m.x+h*2)} ${String(m.y+g*2)}) rotate(${String(Math.atan2(-g,-h)*180/Math.PI)})`,kind:n?Z.queues[n]===`local`?`msg local`:`msg`:`ext`,via:r,label:Uo[u[0]][0]===0?{x:(p.x+m.x)/2+8,y:(p.y+m.y)/2,anchor:`start`}:{x:(p.x+m.x)/2,y:(p.y+m.y)/2-9,anchor:`middle`}}]})),se=A(()=>new Map(Z.nodes.map((e,t)=>[e.id,(e.selected?Z.nodes.length:0)+t]))),ce=(e,t)=>{let n=R(se).get(t)??0;return[...Z.boxes].some(([r,i])=>r!==t&&(R(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);Ln(()=>{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 fh({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},R(c)?.clientWidth??0,R(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(R(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={};Ln(()=>{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)&&Pr(()=>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())};Ln(()=>{let e=Z.opened;e&&Z.nodes.every(e=>e.measured?.width)&&(Z.opened=null,e===`arrange`?me():requestAnimationFrame(()=>void fe()))});var he=dS();z(`keydown`,_n,e=>{C(e),y(e),T(e)}),z(`keyup`,_n,e=>{C(e),y(e)}),z(`blur`,_n,()=>M(g,!1)),z(`pointermove`,_n,w,!0),z(`pointerdown`,_n,e=>a={x:e.clientX,y:e.clientY},!0),z(`pointerup`,_n,()=>a=null,!0);var ge=N(he),_e=()=>Z.flowNodes(),ve=e=>{Z.fromFlow(e,`${String(r.current.zoom<.6)} ${String(Z.live)}`,Q.asked)&&Vx.adopt()};{let e=A(()=>({app:Sx,tunnel:Bx,queue:Rx,outside:Mx})),t=A(()=>({cable:Tx})),a=A(()=>Z.live?null:[`Backspace`,`Delete`]),o=A(()=>!Z.live&&!R(_)),s=A(()=>!R(_)),c=A(()=>R(_)?!0:[1,2]),l=A(()=>!R(_));ey(ge,Ba({get nodes(){return _e()},set nodes(e){ve(e)},get nodeTypes(){return R(e)},get edgeTypes(){return R(t)},get connectionMode(){return wm.Loose},get deleteKey(){return R(a)},get nodesDraggable(){return R(o)},get elementsSelectable(){return R(s)},nodeDragThreshold:4,nodeClickDistance:4,panOnScroll:!0,panOnScrollSpeed:1,get panOnDrag(){return R(c)},get selectionOnDrag(){return R(l)},get selectionMode(){return Em.Partial},get colorMode(){return Gx.now},minZoom:.2,proOptions:{hideAttribution:!0}},()=>ee,{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=sS(),a=P(i);fy(a,{get variant(){return ay.Dots},gap:24,size:2.4,bgColor:`var(--paper)`,patternColor:`var(--dot)`});var o=I(a,2);Gv(o,{position:`top-left`,children:(e,t)=>{var n=Kx(),r=N(n),i=N(r);ma(i),Me(),D(r);var a=I(r,2),o=N(a);ma(o),Me(),D(a),D(n),L(()=>{ga(i,!Z.live),ga(o,Z.live)}),B(`change`,i,()=>{Z.goEdit()}),B(`change`,o,()=>{Z.goLive()}),H(e,n)},$$slots:{default:!0}});var s=I(o,2);Gv(s,{position:`bottom-right`,children:(e,t)=>{var i=Yx(),a=N(i);G(a,21,()=>b,([e,t,n])=>e,(e,t,n,r)=>{var i=A(()=>v(R(t),3));let a=()=>R(i)[0],o=()=>R(i)[1],s=()=>R(i)[2];var c=qx();X(N(c),{get of(){return s()},size:15}),D(c),L(()=>{q(c,`aria-checked`,R(h)===a()),q(c,`aria-label`,o()),q(c,`title`,o())}),B(`click`,c,()=>M(h,a(),!0)),H(e,c)}),D(a);var o=I(a,4);X(N(o),{get of(){return Jy},size:15}),D(o);var s=I(o,2);X(N(s),{get of(){return Ky},size:15}),D(s);var c=I(s,4),l=I(c,2),u=I(l,4),f=N(u),p=A(()=>d(1/1.2));X(N(f),{get of(){return Py},size:13}),D(f);var m=I(f,2),g=F(m),_=I(m,2),y=A(()=>d(1.2));X(N(_),{get of(){return Iy},size:13}),D(_),D(u);var x=I(u,4),S=N(x);{let e=A(()=>Z.present?Hy:By);X(S,{get of(){return R(e)},size:15})}D(x);var C=I(x,2),w=e=>{var t=Jx(),n=I(P(t),2);L(()=>n.disabled=!Z.nodes.length),B(`click`,n,()=>{let e=Z.nodes.length;Xb.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()}}}),H(e,t)};W(C,e=>{Z.present||e(w)}),D(i),L(e=>{o.disabled=!Vx.canUndo,s.disabled=!Vx.canRedo,U(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)]),B(`click`,o,()=>{Vx.undo()}),B(`click`,s,()=>{Vx.redo()}),B(`click`,c,()=>void me()),B(`click`,l,()=>void fe()),B(`click`,f,function(...e){R(p)?.apply(this,e)}),B(`click`,m,()=>void n.setZoom(1,{duration:200})),B(`click`,_,function(...e){R(y)?.apply(this,e)}),B(`click`,x,()=>void de()),H(e,i)},$$slots:{default:!0}});var c=I(s,2);Sy(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=I(c,2);iy(l,{target:`back`,children:(e,t)=>{var n=$x(),r=N(n);G(r,17,()=>R(ne),e=>e.key,(e,t)=>{var n=Xx();let r;L((e,i,a)=>{r=K(n,0,`link svelte-ibqofz`,null,r,{idle:R(t).idle,dimmed:e,lit:i,snapped:a}),q(n,`d`,R(t).d)},[()=>Z.dimmedLink(R(t).from,R(t).to),()=>Z.lit(R(t).from,R(t).to),()=>Z.snapped.includes(`${R(t).from}>${R(t).to}`)]),H(e,n)}),G(I(r),17,()=>R(oe),e=>e.key,(e,t,n,r)=>{var i=Qx();let a;var o=N(i),s=I(o),c=I(s),l=I(c),u=I(l),d=e=>{var n=Zx(),r=F(n,!0);L(()=>{q(n,`x`,R(t).label.x),q(n,`y`,R(t).label.y),q(n,`text-anchor`,R(t).label.anchor),U(r,R(t).via)}),H(e,n)};W(u,e=>{R(t).via&&e(d)}),D(i),L((e,n,r)=>{a=K(i,0,`flow ${R(t).kind??``}`,`svelte-ibqofz`,a,{dimmed:e,lit:n,snapped:r}),q(o,`d`,R(t).d),q(s,`d`,R(t).d),q(c,`transform`,R(t).head),q(l,`cx`,R(t).start.x),q(l,`cy`,R(t).start.y)},[()=>Z.dimmedLink(R(t).from,R(t).to),()=>Z.lit(R(t).from,R(t).to),()=>Z.snapped.includes(`${R(t).from}>${R(t).to}`)]),H(e,i)}),D(n),H(e,n)},$$slots:{default:!0}}),iy(I(l,2),{target:`front`,style:`position: absolute; z-index: 1001`,children:(e,t)=>{var n=oS();let r;var i=N(n);G(i,19,()=>Z.edges,e=>e.id,(e,t,n)=>{let r=A(()=>Nb.endPoint(R(n),`from`)),i=A(()=>Nb.endPoint(R(n),`to`));var a=li(),o=P(a),s=e=>{let n=A(()=>Q.sent(R(t).source)&&Q.sent(R(t).target)),a=A(()=>Ux.results[R(t).id]);var o=rS(),s=P(o),c=e=>{var n=eS();let i;L((e,a)=>{i=K(n,0,`plug nodrag nopan svelte-ibqofz`,null,i,{cut:Z.hovered===R(t).id,idle:e,dimmed:a,grabbed:Nb.grabbed?.id===R(t).id&&Nb.grabbed.end===`from`}),q(n,`data-cable`,R(t).id),q(n,`cx`,R(r).x),q(n,`cy`,R(r).y)},[()=>!Q.up(R(t).source)||!Q.up(R(t).target),()=>Z.dimmedLink(R(t).source,R(t).target)]),B(`pointerdown`,n,e=>{Nb.grabEnd(e,R(t).id,`from`)}),H(e,n)},l=A(()=>!ce(R(r),R(t).source));W(s,e=>{R(l)&&e(c)});var u=I(s),d=e=>{var r=nS(),o=P(r);let s;var c=N(o),l=e=>{var n=tS(),r=F(n,!0);L(e=>U(r,e),[()=>ie(R(a),`local ${re(R(t).target)} answers`)]),H(e,n)};W(c,e=>{R(n)&&e(l)}),D(o);var u=I(o);L((e,r)=>{q(o,`role`,R(n)?`button`:`presentation`),q(o,`tabindex`,R(n)?0:void 0),q(o,`aria-label`,e),s=K(o,0,`socket nodrag nopan svelte-ibqofz`,null,s,{dimmed:r,tested:R(n),grabbed:Nb.grabbed?.id===R(t).id&&Nb.grabbed.end===`to`}),q(o,`data-cable`,R(t).id),q(o,`cx`,R(i).x),q(o,`cy`,R(i).y),q(u,`data-state`,R(n)?R(a)?.state??`idle`:void 0),q(u,`data-light`,R(t).id),q(u,`cx`,R(i).x),q(u,`cy`,R(i).y)},[()=>R(n)?`Test that local ${re(R(t).target)} answers ${re(R(t).source)}`:void 0,()=>Z.dimmedLink(R(t).source,R(t).target)]),B(`keydown`,o,e=>{!R(n)||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),Ux.test({key:R(t).id,payload:{from:R(t).source,to:R(t).target}}))}),B(`pointerdown`,o,e=>{p={x:e.clientX,y:e.clientY},Nb.grabEnd(e,R(t).id,`to`)}),B(`click`,o,e=>{R(n)&&Math.hypot(e.clientX-p.x,e.clientY-p.y)<6&&Ux.test({key:R(t).id,payload:{from:R(t).source,to:R(t).target}})}),H(e,r)},f=A(()=>!ce(R(i),R(t).target));W(u,e=>{R(f)&&e(d)}),H(e,o)};W(o,e=>{R(r)&&R(i)&&e(s)}),H(e,a)});var a=I(i);G(a,17,()=>R(ne),e=>e.key,(e,t)=>{var n=li(),r=P(n),i=e=>{let n=A(()=>Ux.results[R(t).key]);var r=iS(),i=P(r),a=F(N(i),!0);D(i);var o=I(i);L((e,r,s)=>{q(i,`aria-label`,`Test that ${e??``} reaches its ${r??``} through the tunnel`),q(i,`data-link`,R(t).key),q(i,`cx`,R(t).end.x),q(i,`cy`,R(t).end.y),U(a,s),q(o,`data-state`,R(n)?.state??`idle`),q(o,`data-light`,R(t).key),q(o,`cx`,R(t).end.x),q(o,`cy`,R(t).end.y)},[()=>re(R(t).from),()=>R(t).what.toLowerCase(),()=>ie(R(n),`${re(R(t).from)} reaches its ${R(t).what.toLowerCase()} through the tunnel`)]),B(`keydown`,i,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Ux.test(R(t)))}),B(`pointerdown`,i,e=>{e.stopPropagation()}),B(`click`,i,()=>void Ux.test(R(t))),H(e,r)},a=A(()=>Q.sent(R(t).from));W(r,e=>{R(a)&&e(i)}),H(e,n)});var o=I(a),s=e=>{var t=aS();L(()=>q(t,`d`,R(m))),H(e,t)};W(o,e=>{R(m)&&e(s)}),D(n),L(()=>r=K(n,0,`ends svelte-ibqofz`,null,r,{reordering:!!Nb.grabbed,still:Z.live})),H(e,n)},$$slots:{default:!0}}),H(e,i)},$$slots:{default:!0}}))}var ye=I(ge,2),be=e=>{var t=uS(),n=I(N(t),2),r=e=>{var t=lS();G(t,21,()=>R(f),({preset:e,team:t,at:n})=>`${t?`team`:`own`}:${e.name}`,(e,t)=>{let n=()=>R(t).preset,r=()=>R(t).team,i=()=>R(t).at;var a=cS(),o=N(a),s=N(o),c=F(s,!0),l=F(I(s,2));D(o),D(a),L(e=>{U(c,n().name),U(l,`${r()?`Team board`:`Your board`}${e??``}`)},[()=>i()?`, opened ${Wb(i())}`:``]),B(`click`,o,()=>{Bb(n())}),H(e,a)}),D(t),H(e,t)};W(n,e=>{R(f).length&&!Z.live&&e(r)}),D(t),H(e,t)};W(ye,e=>{Z.nodes.length||e(be)}),D(he),Ma(he,e=>M(c,e),()=>R(c)),z(`dragover`,he,e=>{e.dataTransfer?.types.includes(`text/app`)&&e.preventDefault()}),z(`drop`,he,e=>{let t=e.dataTransfer?.getData(`text/app`);t&&!Z.live&&(e.preventDefault(),Z.add(t,{x:e.clientX,y:e.clientY}))}),B(`focusin`,he,e=>{let t=e.target.matches(`.svelte-flow__node`)?e.target.getAttribute(`data-id`):null;t&&!R(_)&&![...Z.nodes,...Z.infra].find(e=>e.id===t)?.selected&&Z.pick(t)}),H(e,he),k()}Qr([`focusin`,`change`,`click`,`pointerdown`,`keydown`]);var pS=new Set([`$$slots`,`$$events`,`$$legacy`]);function mS(e,t){let n=J(t,pS),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 hS=new Set([`$$slots`,`$$events`,`$$legacy`]);function gS(e,t){let n=J(t,hS),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 _S=new Set([`$$slots`,`$$events`,`$$legacy`]);function vS(e,t){let n=J(t,_S),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 yS=V(`<button class="i svelte-1ixstkt" type="button"><!></button>`),bS=V(`<p class="result svelte-1ixstkt"> </p>`),xS=V(`<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>`),SS=V(`<button type="button" class="svelte-1ixstkt">Test</button> <button type="button" class="svelte-1ixstkt">Remove</button>`,1),CS=V(`<button type="button" title="A command for your own terminal that fetches and stores it without showing it" class="svelte-1ixstkt"> </button>`),wS=V(`<p class="nohow svelte-1ixstkt"> </p>`),TS=V(`<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>`),ES=V(`<div class="acts svelte-1ixstkt"><button type="button" class="svelte-1ixstkt"> </button> <!></div> <!> <!>`,1),DS=V(`<dt class="svelte-1ixstkt">When</dt> <dd class="svelte-1ixstkt"> </dd>`,1),OS=V(`<li> </li>`),kS=V(`<ol class="svelte-1ixstkt"></ol>`),AS=V(`<dt class="svelte-1ixstkt">Where</dt> <dd class="svelte-1ixstkt"><!></dd>`,1),jS=V(`<dl class="svelte-1ixstkt"><!> <!></dl>`),MS=V(`<div class="cred svelte-1ixstkt"><div class="head svelte-1ixstkt"><code class="svelte-1ixstkt"> </code> <!> <span class="state svelte-1ixstkt"> </span></div> <!> <!> <!></div>`),NS=V(`<section class="svelte-1ixstkt"><h3 class="svelte-1ixstkt"> </h3> <!></section>`),PS=V(`<p class="none svelte-1ixstkt"> </p>`),FS=V(`<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 IS(e,t){let n=ui();O(t,!0);let r={missing:`Missing`,stored:`Stored`,ok:`Works`,failed:`Does not work`},i=j(void 0),a=j(void 0),o=j(!1),s=new R_,c=A(()=>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=A(()=>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=A(()=>R(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=R(i)?.getBoundingClientRect();e&&R(a)&&(R(a).style.top=`${String(e.bottom+6)}px`,R(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 Co(`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 Co(`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 Co(`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=FS(),C=P(S);let w;X(N(C),{get of(){return gS},size:16}),D(C),Ma(C,e=>M(i,e),()=>R(i));var T=I(C,2),ee=N(T);G(ee,17,()=>R(p),e=>e.id,(e,t)=>{var n=NS(),i=N(n),a=F(i);G(I(i,2),17,()=>R(t).list,e=>e.name,(e,n)=>{let i=A(()=>u(R(t).id,R(n).name)),a=A(()=>f(R(t).id,R(n))),o=A(()=>g(R(t).id,R(n)));var s=MS(),l=N(s),p=N(l),h=F(p,!0),v=I(p,2),S=e=>{var r=yS();X(N(r),{get of(){return mS},size:14}),D(r),L(e=>{q(r,`aria-expanded`,!!R(i).info),q(r,`aria-label`,`When ${R(n).name??``} is needed and where to get it`),q(r,`title`,`${e??``}When it is needed and where to get it`)},[()=>m(R(n))?``:`Only needed in some setups. `]),B(`click`,r,()=>d(R(t).id,R(n).name,{info:!R(i).info})),H(e,r)};W(v,e=>{(R(n).when||R(n).fetchUi)&&e(S)});var C=I(v,2),w=F(C,!0);D(l);var T=I(l,2),ee=e=>{var t=bS(),n=F(t,!0);L(()=>{q(t,`data-ok`,R(i).ok),U(n,R(i).message)}),H(e,t)};W(T,e=>{R(i).message&&e(ee)});var te=I(T,2),E=e=>{var r=xS(),i=N(r);vt(i,!0);var a=I(i,4);X(N(a),{get of(){return to},size:14}),D(a),D(r),L(()=>q(i,`aria-label`,`Value for ${R(n).name??``}`)),z(`submit`,r,e=>void y(e,R(t).id,R(n).name)),B(`keydown`,i,e=>{e.key===`Escape`&&(e.preventDefault(),d(R(t).id,R(n).name,{form:!1}))}),B(`click`,a,()=>d(R(t).id,R(n).name,{form:!1})),H(e,r)},ne=e=>{var r=ES(),o=P(r),s=N(o),l=F(s,!0),u=I(s,2),f=e=>{var r=SS(),i=P(r),a=I(i,2);B(`click`,i,()=>void b(R(t).id,R(n).name)),B(`click`,a,()=>void x(R(t).id,R(n).name)),H(e,r)},p=e=>{var r=CS(),a=F(r,!0);L(()=>{q(r,`aria-expanded`,!!R(i).command),U(a,R(i).command?`Hide fetch command`:`Show fetch command`)}),B(`click`,r,()=>d(R(t).id,R(n).name,{command:!R(i).command})),H(e,r)};W(u,e=>{R(a)?e(f):R(n).fetchCli&&e(p,1)}),D(o);var m=I(o,2),h=e=>{var n=wS(),r=F(n);L(()=>U(r,`The stack says nothing about where to get it on ${R(c)??``}. Ask whoever owns ${R(t).name??``}, or ask the agent to
|
|
22
|
+
find it in the repo and add the steps to the stack.`)),H(e,n)};W(m,e=>{!R(a)&&!R(n).fetchCli&&!R(n).fetchUi&&e(h)});var g=I(m,2),_=e=>{var t=TS();Ic(I(N(t),2),{get command(){return R(n).fetchCli}}),D(t),H(e,t)};W(g,e=>{R(i).command&&R(n).fetchCli&&!R(a)&&e(_)}),L(()=>U(l,R(a)?`Replace`:`Set`)),B(`click`,s,()=>d(R(t).id,R(n).name,{form:!0})),H(e,r)};W(te,e=>{R(i).form?e(E):e(ne,-1)});var re=I(te,2),ie=e=>{var t=jS(),r=N(t),i=e=>{var t=DS(),r=F(I(P(t),2),!0);L(()=>U(r,R(n).when)),H(e,t)};W(r,e=>{R(n).when&&e(i)});var a=I(r,2),o=e=>{var t=AS(),r=I(P(t),2),i=N(r),a=e=>{var t=kS();G(t,20,()=>_(R(n).fetchUi),e=>e,(e,t)=>{var n=OS(),r=F(n,!0);L(()=>U(r,t)),H(e,n)}),D(t),H(e,t)},o=A(()=>_(R(n).fetchUi).length>1),s=e=>{var t=ci();L(()=>U(t,R(n).fetchUi)),H(e,t)};W(i,e=>{R(o)?e(a):e(s,-1)}),D(r),H(e,t)};W(a,e=>{R(n).fetchUi&&e(o)}),D(t),H(e,t)};W(re,e=>{R(i).info&&e(ie)}),D(s),L(()=>{q(p,`title`,R(n).name),U(h,R(n).name),q(C,`data-state`,R(o)),U(w,r[R(o)])}),H(e,s)}),D(n),L(()=>U(a,`${R(t).name??``} on ${R(c)??``}`)),H(e,n)},e=>{var t=PS(),n=F(t);L(()=>U(n,`No app on the board needs a stored credential on ${R(c)??``}.`)),H(e,t)});var te=I(ee,2);X(N(te),{get of(){return vS},size:13}),Me(),D(te),D(T),Ma(T,e=>M(a,e),()=>R(a)),L(e=>{w=K(C,1,`open svelte-1ixstkt`,null,w,{missing:R(h)>0}),q(C,`aria-expanded`,R(o)),q(C,`title`,e),q(C,`popovertarget`,n),q(T,`id`,n)},[()=>R(h)?`${String(R(h))} ${R(h)===1?`credential is`:`credentials are`} missing for the apps on the board (${R(c)})`:`What the apps on the board need stored`]),z(`toggle`,T,e=>{M(o,e.newState===`open`),R(o)&&v()}),H(e,S),k()}Qr([`click`,`keydown`]);var LS=V(`<li class="svelte-14dfga3"><span class="mark svelte-14dfga3">!</span><span class="what svelte-14dfga3"> </span></li>`),RS=V(`<li class="svelte-14dfga3"><span class="mark svelte-14dfga3"></span><span class="what svelte-14dfga3">Working out what is needed…</span></li>`),zS=V(`<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>`),BS=V(`<small class="for svelte-14dfga3"> </small>`),VS=V(`<small class="svelte-14dfga3"> </small>`),HS=V(`<!> <!>`,1),US=V(`<!> <!> <!> <!>`,1),WS=V(`<li><span class="mark svelte-14dfga3"><!></span> <span class="what svelte-14dfga3"> <!> <!></span></li>`),GS=V(`<button class="ok svelte-14dfga3" type="button"> </button>`),KS=V(`<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 qS(e,t){O(t,!0);let n=j(void 0),r=j(null),i=j(``),a=j(!1),o=A(()=>Z.env.toUpperCase());async function s(){M(r,null),M(i,``),M(a,!1),R(n)?.showModal();let e=Z.cards.map(e=>e.id),t=Z.cards.filter(e=>e.data.hideTunnels).map(e=>e.id),o=await Co(`needs`,{env:Z.env,apps:e,noTunnels:t});`error`in o?M(i,o.error,!0):M(r,o.steps??[])}let c=async()=>{let e=(R(r)??[]).filter(e=>e.gap&&!e.done).map(e=>e.title);M(a,await Xb.askFacts(Z.env,e),!0)};var l={open:s},u=KS(),d=N(u),f=F(d),p=I(d,4),m=N(p),h=e=>{var t=LS(),n=F(I(N(t)),!0);D(t),L(()=>U(n,R(i))),H(e,t)},g=e=>{H(e,RS())},_=e=>{var t=zS(),n=N(t);X(N(n),{get of(){return eb},size:13}),D(n),Me(),D(t),H(e,t)},v=e=>{var t=li();G(P(t),17,()=>R(r),Di,(e,t,n)=>{var r=WS();let i;var a=N(r),o=N(a),s=e=>{X(e,{get of(){return eb},size:13})},c=e=>{var r=ci();L(()=>U(r,R(t).gap?`!`:n+1)),H(e,r)};W(o,e=>{R(t).done?e(s):e(c,-1)}),D(a);var l=I(a,2),u=N(l,!0),d=I(u),f=e=>{var n=BS(),r=F(n);L(e=>U(r,`(${e??``})`),[()=>R(t).apps.join(`, `)]),H(e,n)};W(d,e=>{R(t).apps?.length&&e(f)});var p=I(d,2),m=e=>{var n=US(),r=P(n),i=e=>{var n=VS(),r=F(n,!0);L(()=>U(r,R(t).why)),H(e,n)};W(r,e=>{R(t).why&&e(i)});var a=I(r,2),o=e=>{var n=HS(),r=P(n);Ic(r,{get command(){return R(t).command}});var i=I(r,2),a=e=>{var n=VS(),r=F(n);L(()=>U(r,`Where: ${R(t).where??``}`)),H(e,n)};W(i,e=>{R(t).where&&e(a)}),H(e,n)};W(a,e=>{R(t).command&&e(o)});var s=I(a,2),c=e=>{var n=VS(),r=F(n);L(()=>U(r,`Or: ${R(t).alt??``}`)),H(e,n)};W(s,e=>{R(t).alt&&e(c)});var l=I(s,2),u=e=>{var n=VS(),r=F(n,!0);L(()=>U(r,R(t).how)),H(e,n)};W(l,e=>{R(t).how&&!R(t).gap&&e(u)}),H(e,n)};W(p,e=>{R(t).done||e(m)}),D(l),D(r),L(()=>{i=K(r,1,`svelte-14dfga3`,null,i,{done:R(t).done,gap:R(t).gap&&!R(t).done}),U(u,R(t).title)}),H(e,r)}),H(e,t)};W(m,e=>{R(i)?e(h):R(r)?R(r).length?e(v,-1):e(_,2):e(g,1)}),D(p);var y=I(p,2),b=N(y),x=e=>{var t=GS(),n=F(t,!0);L(()=>{t.disabled=R(a),U(n,R(a)?`Sent to the agent`:`Ask the agent to find them`)}),B(`click`,t,()=>void c()),H(e,t)},S=A(()=>R(r)?.some(e=>e.gap&&!e.done));W(b,e=>{R(S)&&e(x)});var C=I(b,2),w=I(C,2);return D(y),D(u),Ma(u,e=>M(n,e),()=>R(n)),L(()=>U(f,`Before this runs on ${R(o)??``}`)),B(`click`,C,()=>void s()),B(`click`,w,()=>R(n)?.close()),H(e,u),k(l)}Qr([`click`]);var JS=V(`"<strong> </strong>" in the repos means <strong> </strong>`,1),YS=V(`<strong> </strong> calls <strong> </strong>`,1),XS=V(`<strong> </strong> <code class="svelte-cao9th"> </code>`,1),ZS=V(`<label class="svelte-cao9th"><input type="checkbox"/> <span><!> <small class="svelte-cao9th"> </small></span></label>`),QS=V(`<section class="svelte-cao9th"><h3 class="svelte-cao9th"> <span class="svelte-cao9th"> </span></h3> <p class="svelte-cao9th"> </p> <!></section>`),$S=V(`<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 eC(e,t){O(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=j(void 0),i=j([]),a=j(!1),o=j(!1),s=new L_,c=(e=``)=>Z.nameOf(e),l=e=>!e.needs||s.has(e.needs),u=A(()=>R(i).filter(e=>s.has(e.id)&&l(e)).length);async function d({afterAdding:e=!1}={}){M(a,e,!0),$.show(`Looking through the repos…`);let t=await Co(`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{M(i,t.findings),s.clear();for(let e of R(i))s.add(e.id);$.hide(),R(r)?.showModal()}}let f=()=>R(r)?.close(),p=async()=>{let e=R(i).filter(e=>s.has(e.id)&&l(e)).map(e=>e.id);if(!e.length){f();return}M(o,!0);let t=await Co(`discover-apply`,{ids:e});M(o,!1),`error`in t?$.show(t.error,`warning`):location.reload()};var m={open:d},h=$S(),g=N(h),_=F(g,!0),y=I(g,4);G(y,21,()=>n,([e,t,n])=>e,(e,t)=>{var n=A(()=>v(R(t),3));let r=()=>R(n)[0],a=()=>R(n)[1],o=()=>R(n)[2],u=A(()=>R(i).filter(e=>e.kind===r()));var d=li(),f=P(d),p=e=>{var t=QS(),n=N(t),i=N(n),d=F(I(i),!0);D(n);var f=I(n,2),p=F(f,!0);G(I(f,2),17,()=>R(u),e=>e.id,(e,t)=>{var n=ZS(),i=N(n);ma(i);var a=I(i,2),o=N(a),u=e=>{var n=JS(),r=I(P(n)),i=F(r,!0),a=F(I(r,2),!0);L(e=>{U(i,R(t).value),U(a,e)},[()=>(R(t).env??``).toUpperCase()]),H(e,n)},d=e=>{var n=YS(),r=P(n),i=F(r,!0),a=F(I(r,2),!0);L((e,t)=>{U(i,e),U(a,t)},[()=>c(R(t).app),()=>c(R(t).to)]),H(e,n)},f=e=>{var n=XS(),r=P(n),i=F(r,!0),a=I(r),o=F(I(a),!0);L((e,n)=>{U(i,e),U(a,` on ${n??``}: `),U(o,R(t).value)},[()=>c(R(t).app),()=>(R(t).env??``).toUpperCase()]),H(e,n)},p=e=>{var n=XS(),r=P(n),i=F(r,!0),a=F(I(r,2),!0);L(e=>{U(i,e),U(a,R(t).value)},[()=>c(R(t).app)]),H(e,n)};W(o,e=>{r()===`alias`?e(u):r()===`call`?e(d,1):r()===`address`?e(f,2):e(p,-1)});var m=I(o,2),h=F(m,!0);D(a),D(n),L((e,n)=>{ga(i,e),i.disabled=n,q(m,`title`,R(t).why),U(h,r()===`alias`||r()===`call`?R(t).why:`from ${R(t).why??``}`)},[()=>s.has(R(t).id)&&l(R(t)),()=>!l(R(t))]),B(`change`,i,e=>{e.currentTarget.checked?s.add(R(t).id):s.delete(R(t).id)}),H(e,n)}),D(t),L(()=>{U(i,`${a()??``} `),U(d,R(u).length),U(p,o())}),H(e,t)};W(f,e=>{R(u).length&&e(p)}),H(e,d)}),D(y);var b=I(y,2),x=N(b),S=F(x,!0),C=I(x,2),w=F(C,!0);return D(b),D(h),Ma(h,e=>M(r,e),()=>R(r)),L(e=>{U(_,R(a)?`Here is what Koppler found`:`What the repos say`),U(S,R(a)?`Skip`:`Cancel`),C.disabled=R(o),U(w,e)},[()=>R(u)?`Add ${String(R(u))} to the stack`:`Add nothing`]),z(`close`,h,()=>{R(a)&&location.reload()}),B(`click`,x,f),B(`click`,C,p),H(e,h),k(m)}Qr([`change`,`click`]);var tC=Z.nameOf,nC=(e,t,n)=>`${String(e)} ${e===1?t:n}`,rC=e=>e.to?`${e.from} to ${e.to}`:e.from,iC=e=>`tunnel:${e.host}:${String(e.original)}`,aC=new class{#e=j(null);get flow(){return R(this.#e)}set flow(e){M(this.#e,e)}#t=j(!1);get asked(){return R(this.#t)}set asked(e){M(this.#t,e,!0)}#n=A(()=>Z.cards.map(e=>e.id).filter(e=>Q.sent(e)));get sent(){return R(this.#n)}set sent(e){M(this.#n,e)}starting(e){return Q.sent(e)&&!!Q.status?.running?.includes(e)&&Q.up(e)===!1}#r=A(()=>{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:`${tC(n)} is starting`}):Q.up(n)===!1?t.push({level:`bad`,id:n,down:!0,text:`${tC(n)} is not running`}):r?t.push({level:`bad`,id:n,text:`${tC(n)}: ${r.label.toLowerCase()} failed`}):e.some(e=>e.state===`user`)&&t.push({level:`warn`,id:n,text:`${tC(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(Ux.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:`${tC(i)}${a?` to ${tC(a)}`:``}: ${(r.text??``).toLowerCase()}`})}return t});get items(){return R(this.#r)}set items(e){M(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:tC(e),payload:{node:e}})),...Z.edges.map(({id:e,source:t,target:n})=>({kind:`cable`,key:e,id:t,from:tC(t),to:`local ${tC(n)}`,payload:{from:t,to:n}})),...Z.links.map(({from:e,tunnel:t})=>({kind:`tunnel`,key:`${e}>${iC(t)}`,id:e,from:tC(e),to:t.what,payload:{app:e,host:t.bind,port:t.port,original:t.original}}))]}result(e){return Ux.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));Ux.forget(e.map(e=>e.key));for(let n of e){let e=t(n);e&&(Ux.results[n.key]={state:`warn`,text:`Not started`,detail:`${tC(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=>Ux.test(e,!0)))}async askToFix(){let e=(this.flow??[]).filter(e=>this.result(e).state===`bad`).map(e=>({connection:rC(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 Xb.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=A(()=>{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(tC).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?tC(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?tC(s[0]??``):`${String(s.length)} apps`} running, not on this board`,title:`${s.map(tC).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:`${nC(c,`thing is`,`things are`)} off`,title:d}:u?{state:`warn`,label:`${String(u)} not started`,title:`${nC(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 R(this.#i)}set chip(e){M(this.#i,e)}},oC=V(`<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),sC=V(`<progress aria-label="Connections checked" class="svelte-6gc4ih"></progress>`),cC=V(`<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>`),lC=V(`<button class="row svelte-6gc4ih" type="button"><span class="route"> </span> <span class="verdict svelte-6gc4ih"> </span></button>`),uC=V(`<details class="svelte-6gc4ih"><summary class="svelte-6gc4ih"> <span class="tally svelte-6gc4ih"> </span></summary> <!></details>`),dC=V(`<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>`),fC=V(`<header class="svelte-6gc4ih"><p class="sum svelte-6gc4ih"> </p> <button type="button" class="svelte-6gc4ih">Check again</button></header> <!> <!> <!> <!>`,1),pC=V(`<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 mC(e,t){let n=ui();O(t,!0);let r=[[`app`,`Apps`],[`cable`,`Cables between local apps`],[`tunnel`,`Databases and caches`]],i=j(void 0),a=j(void 0),o=j(!1),s=A(()=>aC.chip),c=A(()=>(aC.flow??[]).map(e=>({job:e,result:aC.result(e)}))),l=A(()=>R(c).filter(e=>e.result.state===`bad`)),u=A(()=>R(c).filter(e=>e.result.state!==`busy`).length),d=A(()=>R(c).filter(e=>e.result.state===`warn`).length),f=A(()=>aC.busy?`Checking, ${String(R(u))} of ${String(R(c).length)} done`:R(l).length?`${String(R(l).length)} of ${String(R(c).length)} connections ${R(l).length===1?`fails`:`fail`}`:R(d)?`Nothing fails, ${String(R(d))} not checked`:`All ${String(R(c).length)} connections work`),p=e=>{let t=R(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=>{R(a)?.hidePopover(),Z.show(e.id)},h=()=>{let e=R(i)?.getBoundingClientRect();e&&R(a)&&(R(a).style.top=`${String(e.bottom+6)}px`,R(a).style.left=`${String(Math.max(12,Math.min(e.left,innerWidth-492)))}px`)};var g=li(),_=P(g),y=e=>{var t=pC(),d=P(t),g=F(I(N(d)),!0);D(d),Ma(d,e=>M(i,e),()=>R(i));var _=I(d,2),y=F(_),b=I(_,2),x=N(b),S=e=>{var t=oC();Me(2),H(e,t)},C=e=>{var t=fC(),n=P(t),i=N(n),a=F(i,!0),o=I(i,2);D(n);var s=I(n,2),d=e=>{var t=sC();L(()=>{q(t,`max`,R(c).length),ha(t,R(u))}),H(e,t)};W(s,e=>{aC.busy&&e(d)});var h=I(s,2);G(h,17,()=>R(l),({job:e,result:t})=>e.key,(e,t)=>{let n=()=>R(t).job,r=()=>R(t).result;var i=cC(),a=N(i),o=F(a),s=I(a,2),c=F(s,!0),l=F(I(s,2),!0);D(i),L(()=>{U(o,`${n().from??``}${n().to?` → ${n().to}`:``}`),U(c,r().text),U(l,r().detail)}),B(`click`,i,()=>{m(n())}),H(e,i)});var g=I(h,2);G(g,17,()=>r,([e,t])=>e,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1],a=A(()=>R(c).filter(e=>e.job.kind===r()&&e.result.state!==`bad`)),o=A(()=>p(r()));var s=li(),l=P(s),u=e=>{var t=uC(),n=N(t),r=N(n,!0),s=I(r),c=F(s,!0);D(n),G(I(n,2),17,()=>R(a),({job:e,result:t})=>e.key,(e,t)=>{let n=()=>R(t).job,r=()=>R(t).result;var i=lC(),a=N(i),o=F(a),s=F(I(a,2),!0);D(i),L(e=>{q(i,`data-level`,r().state),q(i,`title`,r().detail),U(o,`${n().from??``}${n().to?` → ${n().to}`:``}`),U(s,e)},[()=>(r().text??``).replace(/^Answers, /,``)]),B(`click`,i,()=>{m(n())}),H(e,i)}),D(t),L(()=>{t.open=R(o).level===`warn`,U(r,i()),q(s,`data-level`,R(o).level),U(c,R(o).text)}),H(e,t)},d=A(()=>R(c).some(e=>e.job.kind===r()));W(l,e=>{R(d)&&e(u)}),H(e,s)});var _=I(g,2),y=e=>{var t=dC(),n=I(N(t),2),r=F(n,!0);D(t),L(()=>{n.disabled=aC.asked,U(r,aC.asked?`Sent to the agent`:R(l).length===1?`Ask the agent to fix it`:`Ask the agent to fix these`)}),B(`click`,n,()=>void aC.askToFix()),H(e,t)};W(_,e=>{R(l).length&&!aC.busy&&e(y)}),L(()=>{U(a,R(f)),o.disabled=aC.busy}),B(`click`,o,()=>void aC.check()),H(e,t)};W(x,e=>{!aC.sent.length&&!aC.flow?e(S):e(C,-1)}),D(b),Ma(b,e=>M(a,e),()=>R(a)),L(()=>{q(d,`data-state`,R(s).state),q(d,`title`,R(s).title),q(d,`aria-expanded`,R(o)),q(d,`popovertarget`,n),U(g,R(s).label),U(y,`Board: ${R(s).label??``}`),q(b,`id`,n)}),z(`toggle`,b,e=>{M(o,e.newState===`open`),R(o)&&(h(),!aC.flow&&aC.sent.length&&aC.check())}),H(e,t)};W(_,e=>{Q.status&&e(y)}),H(e,g),k()}Qr([`click`]);var hC=new Set([`$$slots`,`$$events`,`$$legacy`]);function gC(e,t){let n=J(t,hC),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 _C=V(`<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 vC(e){let t=j(void 0),n=e=>{e.key!==`?`||e.target.closest(`input, select, textarea`)||R(t)?.togglePopover()};var r=_C();z(`keydown`,_n,n);var i=P(r);X(N(i),{get of(){return gC},size:16}),D(i),Ma(I(i,2),e=>M(t,e),()=>R(t)),H(e,r)}var yC=V(`<p class="svelte-146fxte"> </p>`),bC=V(`<h4 class="svelte-146fxte"> </h4>`),xC=V(`<li> </li>`),SC=V(`<ul class="svelte-146fxte"></ul>`),CC=V(`<!> <!> <!>`,1),wC=V(`<span class="svelte-146fxte"> </span>`),TC=V(`<button class="choice svelte-146fxte" type="button"><strong> </strong><!></button>`),EC=V(`<div class="choices svelte-146fxte"></div>`),DC=V(`<!> <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),OC=V(`<p class="answered svelte-146fxte"> </p>`),kC=V(`<article><div class="meta svelte-146fxte"><span class="kind svelte-146fxte"> </span><time> </time></div> <h3 class="svelte-146fxte"> </h3> <!> <!> <!> <!></article>`);function AC(e,t){O(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&&ky.answer(t,{text:n})};var s=kC();let c;var l=N(s),u=N(l),d=F(u,!0),f=F(I(u),!0);D(l);var p=I(l,2),m=F(p,!0),h=I(p,2),g=e=>{var n=yC(),r=F(n,!0);L(()=>U(r,t.one.summary)),H(e,n)};W(h,e=>{t.one.summary&&e(g)});var _=I(h,2);G(_,17,()=>t.one.sections??[],Di,(e,t)=>{var n=CC(),r=P(n),i=e=>{var n=bC(),r=F(n,!0);L(()=>U(r,R(t).title)),H(e,n)};W(r,e=>{R(t).title&&e(i)});var a=I(r,2);G(a,16,()=>R(t).commands??[],e=>e,(e,t)=>{Ic(e,{get command(){return t}})});var o=I(a,2),s=e=>{var n=SC();G(n,21,()=>R(t).items,Di,(e,t)=>{var n=xC(),r=F(n,!0);L(()=>U(r,R(t))),H(e,n)}),D(n),H(e,n)};W(o,e=>{R(t).items?.length&&e(s)}),H(e,n)});var v=I(_,2),y=e=>{var n=DC(),r=P(n),i=e=>{var n=EC();G(n,21,()=>t.one.choices,e=>e.id,(e,n)=>{var r=TC(),i=N(r),a=F(i,!0),o=I(i),s=e=>{var t=wC(),r=F(t,!0);L(()=>U(r,R(n).detail)),H(e,t)};W(o,e=>{R(n).detail&&e(s)}),D(r),L(()=>U(a,R(n).label)),B(`click`,r,()=>void ky.answer(t.one,{choice:R(n).id})),H(e,r)}),D(n),H(e,n)};W(r,e=>{t.one.choices?.length&&e(i)});var a=I(r,2),s=I(a,2);z(`submit`,a,e=>{o(e,t.one)}),B(`click`,s,()=>void ky.dismiss(t.one)),H(e,n)},b=A(()=>r(t.one));W(v,e=>{R(b)&&e(y)});var x=I(v,2),S=e=>{var n=OC(),r=F(n,!0);L(e=>U(r,e),[()=>a(t.one)]),H(e,n)};W(x,e=>{t.one.answered&&e(S)}),D(s),L((e,r)=>{q(s,`data-kind`,t.one.kind),s.inert=t.past,c=K(s,1,`svelte-146fxte`,null,c,{waits:e,past:t.past}),U(d,n[t.one.kind]??`Update`),U(f,r),U(m,t.one.title)},[()=>r(t.one),()=>i(t.one.at)]),H(e,s),k()}Qr([`click`]);var jC=V(`<button type="button" class="svelte-1ekufpr">Clear</button>`),MC=V(`<li class="svelte-1ekufpr"><span class="what svelte-1ekufpr"> <small class="svelte-1ekufpr"> </small></span> <button type="button" class="svelte-1ekufpr">Drop</button></li>`),NC=V(`<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>`),PC=V(`<p class="none svelte-1ekufpr">The agent has said nothing yet.</p>`),FC=V(`<p class="none svelte-1ekufpr">Nothing yet. When the agent needs a decision about your run, or finishes one, it shows up here.</p>`),IC=V(`<p class="none svelte-1ekufpr">Nothing since the canvas started.</p>`),LC=V(`<details class="svelte-1ekufpr"><summary class="svelte-1ekufpr"> </summary> <!></details>`),RC=V(`<!> <!>`,1),zC=V(`<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 BC(e,t){O(t,!0);let n=j(void 0),r=A(()=>ky.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=A(()=>R(r).filter(o)),c=A(()=>R(r).filter(e=>!o(e))),l=e=>!i(e)&&(R(r)[0]!==e||e.answered?.via===`dismissed`||e.answered?.via===`replaced`);Ln(()=>{ky.open&&(R(n)?.querySelector(`.choice`)??R(n)?.querySelector(`.close`))?.focus()});var u=li(),d=P(u),f=e=>{var t=zC(),a=N(t),o=I(N(a),2),u=F(o,!0),d=I(o,2),f=e=>{var t=jC();B(`click`,t,()=>void ky.clear()),H(e,t)},p=A(()=>R(r).some(e=>!i(e)));W(d,e=>{R(p)&&e(f)});var m=I(d,2);X(N(m),{get of(){return to},size:14}),D(m),D(a);var h=I(a,2),g=N(h),_=e=>{var t=NC(),n=N(t),r=F(n),i=I(n,4);Ic(i,{command:`/koppler-run connect`});var a=I(i,2);G(a,21,()=>ky.waiting,e=>e.key,(e,t)=>{var n=MC(),r=N(n),i=N(r,!0),a=F(I(i),!0);D(r);var o=I(r,2);D(n),L(e=>{U(i,R(t).what),U(a,e),q(o,`aria-label`,`Drop: ${R(t).what??``}`)},[()=>Wb(R(t).at)]),B(`click`,o,()=>void ky.drop(R(t).key)),H(e,n)}),D(a),D(t),L(()=>U(r,`Waiting for an agent (${ky.waiting.length??``})`)),H(e,t)};W(g,e=>{ky.waiting.length&&e(_)});var v=I(g,2),y=e=>{H(e,PC())},b=e=>{H(e,FC())},x=e=>{var t=RC(),n=P(t);G(n,17,()=>R(s),e=>e.id,(e,t)=>{{let n=A(()=>l(R(t)));AC(e,{get one(){return R(t)},get past(){return R(n)}})}},e=>{H(e,IC())});var r=I(n,2),i=e=>{var t=LC(),n=N(t),r=F(n);G(I(n,2),17,()=>R(c),e=>e.id,(e,t)=>{{let n=A(()=>l(R(t)));AC(e,{get one(){return R(t)},get past(){return R(n)}})}}),D(t),L(()=>U(r,`Earlier (${R(c).length??``})`)),H(e,t)};W(r,e=>{R(c).length&&e(i)}),H(e,t)};W(v,e=>{!R(r).length&&ky.waiting.length?e(y):R(r).length?e(x,-1):e(b,1)}),D(h),D(t),Ma(t,e=>M(n,e),()=>R(n)),L(()=>U(u,ky.question?`Waiting for your answer`:``)),B(`keydown`,t,e=>{e.key===`Escape`&&(ky.open=!1)}),B(`click`,m,()=>ky.open=!1),H(e,t)};W(d,e=>{ky.open&&e(f)}),H(e,u),k()}Qr([`keydown`,`click`]);var VC=new Set([`$$slots`,`$$events`,`$$legacy`]);function HC(e,t){let n=J(t,VC),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 UC=new Set([`$$slots`,`$$events`,`$$legacy`]);function WC(e,t){let n=J(t,UC),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 GC=new Set([`$$slots`,`$$events`,`$$legacy`]);function KC(e,t){let n=J(t,GC),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 qC=V(`<small class="svelte-i7whuv"> </small>`),JC=V(`<div class="run svelte-i7whuv"><div class="head note svelte-i7whuv"><span class="what svelte-i7whuv"> <!></span> <time class="svelte-i7whuv"> </time></div></div>`),YC=V(`<span class="changes svelte-i7whuv" title="Code changes Koppler made in your repos"> </span>`),XC=V(`<p class="reason svelte-i7whuv"> </p>`),ZC=V(`<span> <!></span>`),QC=V(`<li class="svelte-i7whuv"><span class="verb svelte-i7whuv"> </span> <span class="apps svelte-i7whuv"></span></li>`),$C=V(`<span class="del svelte-i7whuv"><b aria-hidden="true" class="svelte-i7whuv">-</b><span class="sr svelte-i7whuv">removed: </span> </span>`),ew=V(`<span class="add svelte-i7whuv"><b aria-hidden="true" class="svelte-i7whuv">+</b><span class="sr svelte-i7whuv">added: </span> </span>`),tw=V(`<span class="svelte-i7whuv">No lines recorded.</span>`),nw=V(`<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>`),rw=V(`<h4 class="svelte-i7whuv"> </h4> <!>`,1),iw=V(`<div class="diffs svelte-i7whuv"><h3 class="svelte-i7whuv">Code changes in your repos</h3> <!></div>`),aw=V(`<button type="button" class="svelte-i7whuv"> </button>`),ow=V(`<div class="logs svelte-i7whuv"><h3 class="svelte-i7whuv">Logs</h3> <!> <button class="pin svelte-i7whuv" type="button"><!> </button></div>`),sw=V(`<button class="back svelte-i7whuv" type="button">Put this board back</button>`),cw=V(`<ul class="plan svelte-i7whuv"></ul> <!> <!> <!>`,1),lw=V(`<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 uw(e,t){O(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=A(()=>{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=A(()=>[...new Set((t.run.changes??[]).map(e=>e.app))]);var c=li(),l=P(c),u=e=>{let n=A(()=>(t.run.stopped??[]).map(a).join(`, `));var r=JC(),s=N(r),c=N(s),l=N(c,!0),u=I(l),d=e=>{var t=qC(),r=F(t,!0);L(()=>{q(t,`title`,R(n)),U(r,R(n))}),H(e,t)};W(u,e=>{R(n)&&e(d)}),D(c);var f=F(I(c,2),!0);D(s),D(r),L(()=>{U(l,i[t.run.note]??`Stopped`),U(f,R(o))}),H(e,r)},d=e=>{let i=A(()=>Object.keys(t.run.nodes??{}).map(a).join(`, `));var c=lw(),l=N(c),u=N(l),d=N(u,!0),f=I(d),p=e=>{var t=qC(),n=F(t,!0);L(()=>{q(t,`title`,R(i)),U(n,R(i))}),H(e,t)};W(f,e=>{R(i)&&e(p)}),D(u);var m=I(u,2),h=e=>{var n=YC(),r=F(n);L(()=>U(r,`${t.run.changes.length??``} ${t.run.changes.length===1?`change`:`changes`}`)),H(e,n)};W(m,e=>{t.run.changes?.length&&e(h)});var g=I(m,2),_=F(g,!0),y=F(I(g,2),!0);D(l);var b=I(l,2),x=e=>{var n=XC(),r=F(n,!0);L(()=>U(r,t.run.reason)),H(e,n)};W(b,e=>{t.run.reason&&e(x)});var S=I(b,2),C=e=>{var r=cw(),o=P(r);G(o,21,()=>n,([e,t])=>e,(e,n)=>{var r=A(()=>v(R(n),2));let i=()=>R(r)[0],o=()=>R(r)[1];var s=li(),c=P(s),l=e=>{var n=QC(),r=N(n),s=F(r,!0),c=I(r,2);G(c,21,()=>t.run.plan[i()],e=>e.id,(e,t)=>{var n=ZC(),r=N(n,!0),i=I(r),o=e=>{var n=qC(),r=F(n,!0);L(e=>U(r,e),[()=>R(t).why.join(`; `)]),H(e,n)};W(i,e=>{R(t).why?.length&&e(o)}),D(n),L(e=>U(r,e),[()=>a(R(t).id)]),H(e,n)}),D(c),D(n),L(()=>{q(r,`data-verb`,i()),U(s,o())}),H(e,n)};W(c,e=>{t.run.plan?.[i()]?.length&&e(l)}),H(e,s)}),D(o);var c=I(o,2),l=e=>{var n=iw();G(I(N(n),2),16,()=>R(s),e=>e,(e,n)=>{var r=rw(),i=P(r),o=F(i,!0);G(I(i,2),17,()=>t.run.changes.filter(e=>e.app===n),e=>e.title+(e.file??``),(e,t)=>{var n=nw(),r=N(n),i=N(r),a=F(i,!0),o=F(I(i,2));D(r);var s=I(r,2),c=N(s);G(c,17,()=>R(t).removed??[],Di,(e,t)=>{var n=$C(),r=I(N(n),2,!0);D(n),L(()=>U(r,R(t))),H(e,n)});var l=I(c);G(l,17,()=>R(t).added??[],Di,(e,t)=>{var n=ew(),r=I(N(n),2,!0);D(n),L(()=>U(r,R(t))),H(e,n)});var u=I(l),d=e=>{H(e,tw())};W(u,e=>{!R(t).removed?.length&&!R(t).added?.length&&e(d)}),D(s),D(n),L(()=>{U(a,R(t).file||R(t).title),U(o,`${(R(t).file?R(t).title:``)??``}${R(t).fresh?``:` (from an earlier run)`}`)}),H(e,n)}),L(e=>U(o,e),[()=>a(n)]),H(e,r)}),D(n),H(e,n)};W(c,e=>{t.run.changes?.length&&e(l)});var u=I(c,2),d=e=>{let n=A(()=>t.run.id);var r=ow(),i=I(N(r),2);G(i,16,()=>t.run.logs,e=>e,(e,t)=>{var r=aw(),i=F(r,!0);L(e=>U(i,e),[()=>a(t)]),B(`click`,r,()=>{Rb.open(t,R(n))}),H(e,r)});var o=I(i,2),s=N(o);{let e=A(()=>t.run.pinned?KC:WC);X(s,{get of(){return R(e)},size:13})}var c=I(s,1,!0);D(o),D(r),L(()=>{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.`),U(c,t.run.pinned?`Unpin`:`Pin`)}),B(`click`,o,()=>void Co(`run-pin`,{id:R(n),on:!t.run.pinned})),H(e,r)};W(u,e=>{t.run.logs?.length&&t.run.id&&e(d)});var f=I(u,2),p=e=>{var n=sw();B(`click`,n,function(...e){t.back?.apply(this,e)}),H(e,n)};W(f,e=>{R(i)&&e(p)}),H(e,r)};W(S,e=>{t.open&&e(C)}),D(c),L(e=>{q(l,`aria-expanded`,t.open),U(d,e),q(g,`data-state`,t.run.state),U(_,r[t.run.state??``]??t.run.state),U(y,R(o))},[()=>t.run.kind===`stop`?`Stop and revert`:`${(t.run.env??``).toUpperCase()}, ${t.run.mode??`auto`}`]),B(`click`,l,function(...e){t.toggle?.apply(this,e)}),H(e,c)};W(l,e=>{t.run.note?e(u):e(d,-1)}),H(e,c),k()}Qr([`click`]);var dw=V(`<p class="none svelte-16dstxb">No runs yet. Each run and Stop shows up here with how it ended.</p>`),fw=V(`<p class="none svelte-16dstxb">No runs since the canvas started.</p>`),pw=V(`<details class="svelte-16dstxb"><summary class="svelte-16dstxb"> </summary> <!></details>`),mw=V(`<!> <!>`,1),hw=V(`<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 gw(e,t){let n=ui();O(t,!0);let r=j(void 0),i=j(void 0),a=j(!1),o=j(null),s=A(()=>!!Q.status?.runs?.some(e=>e.state===`waiting`)),c=A(()=>[...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=A(()=>R(c).filter(l)),d=A(()=>R(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=R(r)?.getBoundingClientRect();e&&R(i)&&(R(i).style.top=`${String(e.bottom+6)}px`,R(i).style.right=`${String(Math.max(12,innerWidth-e.right))}px`)},m=e=>{R(i)?.hidePopover(),Bb({name:`Run from ${f(e.at)}`,version:1,nodes:e.nodes??{},edges:e.edges??[]})};var h=hw(),g=P(h);let _;X(N(g),{get of(){return HC},size:16}),D(g),Ma(g,e=>M(r,e),()=>R(r));var v=I(g,2),y=N(v),b=e=>{H(e,dw())},x=e=>{var t=mw(),n=P(t);G(n,17,()=>R(u),e=>e.id??e.at,(e,t)=>{{let n=A(()=>R(o)===R(t).id);uw(e,{get run(){return R(t)},get open(){return R(n)},toggle:()=>M(o,R(o)===R(t).id?null:R(t).id??null,!0),back:()=>{m(R(t))}})}},e=>{H(e,fw())});var r=I(n,2),i=e=>{var t=pw(),n=N(t),r=F(n);G(I(n,2),17,()=>R(d),e=>e.id??e.at,(e,t)=>{{let n=A(()=>R(o)===R(t).id);uw(e,{get run(){return R(t)},get open(){return R(n)},toggle:()=>M(o,R(o)===R(t).id?null:R(t).id??null,!0),back:()=>{m(R(t))}})}}),D(t),L(()=>U(r,`Earlier (${R(d).length??``})`)),H(e,t)};W(r,e=>{R(d).length&&e(i)}),H(e,t)};W(y,e=>{R(c).length?e(x,-1):e(b)}),D(v),Ma(v,e=>M(i,e),()=>R(i)),L(()=>{_=K(g,1,`open svelte-16dstxb`,null,_,{waiting:R(s)}),q(g,`aria-expanded`,R(a)),q(g,`title`,R(s)?`A run is waiting for the agent`:`Every run and Stop, and how it ended`),q(g,`popovertarget`,n),q(v,`id`,n)}),z(`toggle`,v,e=>{M(a,e.newState===`open`),R(a)&&p()}),H(e,h),k()}var _w=V(`<button class="open svelte-1la1tzd" type="button"><!></button>`);function vw(e,t){O(t,!0);let n=A(()=>Q.status?.traces?.state??`off`),r=async()=>{if(R(n)===`on`){window.open(Q.status?.traces?.view??``,`_blank`,`noopener`);return}if(R(n)===`starting`)return;let e=await Co(`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=_w();X(N(i),{get of(){return Qy},size:16}),D(i),L(()=>{q(i,`data-state`,R(n)),q(i,`aria-label`,R(n)===`on`?`Open traces`:R(n)===`starting`?`Traces are starting`:`Collect traces`),q(i,`title`,R(n)===`on`?`Follow one request across your local apps, to where it failed`:R(n)===`starting`?`Starting the trace collector (Jaeger in Docker)`:`Collect traces from the apps Koppler starts (Jaeger in Docker)`)}),B(`click`,i,()=>void r()),H(e,i),k()}Qr([`click`]);var yw=new Set([`$$slots`,`$$events`,`$$legacy`]);function bw(e,t){let n=J(t,yw),r={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}],[`path`,{d:`m15 5 4 4`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var xw={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`},Sw=e=>e==null?``:typeof e==`string`?e:JSON.stringify(e),Cw=e=>xw[Sw(e).toLowerCase()]??`info`;function ww(e){let t=/T?(\d{2}:\d{2}:\d{2})/.exec(Sw(e))?.[1];if(!t)return``;let n=new Date(Sw(e));return Number.isNaN(n.getTime())?t:n.toTimeString().slice(0,8)}var Tw=(e,t)=>Sw(e).replace(/\{[@$]?([\w.]+)(?:[,:][^}]*)?\}/g,(e,n)=>n in t?Sw(t[n]):e);function Ew(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:ww(n[`@t`]),level:Cw(n[`@l`]??`Information`),text:Sw(n[`@m`]??Tw(n[`@mt`],n)),detail:Sw(n[`@x`])};if(`Timestamp`in n||`MessageTemplate`in n||`RenderedMessage`in n){let e=n.Properties??{};return{time:ww(n.Timestamp),level:Cw(n.Level),text:Sw(n.RenderedMessage??Tw(n.MessageTemplate,e)),detail:Sw(n.Exception)}}return null}var Dw=/\\?\^?\[\[?\d+m|\x1b\[[0-9;]*m/g,Ow=[[/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)\s+(INF|ERR|WRN|DBG)\s+(.*)$/,e=>({time:ww(e[1]),level:Cw(e[2]),text:e[3]??``,detail:``})],[/^\[(\d{2}:\d{2}:\d{2})\s+(\w+)\]\s*(.*)$/,e=>({time:e[1]??``,level:Cw(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(Dw,``),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 kw(e){let t=e.trim(),n=Ew(t);if(n)return n;for(let[e,n]of Ow){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 Aw=/^flutter: (#\d+\s|<asynchronous suspension>|\s*-- \S)/,jw=(e,t)=>Aw.test(e)&&t.level===`error`||/^\s+(at |---|\.\.\.)/.test(e)||/^\s{2,}\S/.test(e);function Mw(e,t,n,r){if(!t.trim())return;let i=e.at(-1);if(i&&r(i)&&jw(t,i)){i.detail+=(i.detail?`
|
|
30
|
+
`:``)+t.replace(/^flutter: /,``).trim();return}let a=kw(t);a.build&&a.level===`warn`&&i&&r(i)&&i.group===`build`&&i.items?(i.items.push(a.text),i.text=`${String(i.items.length)} build warnings`):a.build&&a.level===`warn`?e.push(n({time:``,level:`warn`,group:`build`,items:[a.text],text:`1 build warning`,detail:``})):e.push(n(a))}function Nw(e){let t=[];for(let{app:n,at:r,approx:i,line:a}of e)Mw(t,a,e=>({...e,app:n,at:r,approx:i}),e=>e.app===n);return t}function Pw(e){let t=[];for(let n of(e??``).split(`
|
|
31
|
+
`))Mw(t,n,e=>e,()=>!0);return t}var Fw=V(`<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>`),Iw=V(`<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>`,1),Lw=V(`<input maxlength="24"/>`),Rw=V(`<span><button type="button" class="svelte-1feoaw6"> </button><button type="button" class="rename svelte-1feoaw6" title="Give it a short name in this log"><!></button></span>`),zw=V(`<label class="svelte-1feoaw6"><input type="radio"/> </label>`),Bw=V(`<span class="opt-label svelte-1feoaw6" aria-hidden="true"> </span> <span class="seg svelte-1feoaw6" role="radiogroup"></span>`,1),Vw=V(`<div class="apps svelte-1feoaw6" role="group" aria-label="Apps in this log"><!> <span class="opts svelte-1feoaw6"></span></div>`),Hw=V(`<p class="empty svelte-1feoaw6"> </p>`),Uw=V(`<div><button type="button" class="n svelte-1feoaw6"> </button></div>`),Ww=V(`<button type="button"> </button>`),Gw=V(`<details class="m svelte-1feoaw6"><summary class="svelte-1feoaw6"> </summary><span class="x svelte-1feoaw6"> </span></details>`),Kw=V(`<span class="x svelte-1feoaw6"> </span>`),qw=V(`<span class="m svelte-1feoaw6"> </span> <!>`,1),Jw=V(`<!> <div class="row svelte-1feoaw6"><span> </span><span class="l svelte-1feoaw6"> </span> <!> <!></div>`,1),Yw=V(`<!> <!>`,1),Xw=V(`<div class="row svelte-1feoaw6"><span class="t svelte-1feoaw6"> </span><span class="l svelte-1feoaw6"> </span> <!></div>`),Zw=V(`<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"><span><button type="button" role="tab" class="svelte-1feoaw6"> </button></span> <!></div> <span class="meta svelte-1feoaw6"> </span> <!> <button type="button" class="svelte-1feoaw6"> </button> <button type="button" class="svelte-1feoaw6">Close all</button></header> <!> <div role="log"><!></div></section>`);function Qw(e,t){O(t,!0);let n={debug:`DEBUG`,warn:`WARN`,error:`ERROR`,koppler:`KOPPLER`,start:`START`},r=A(()=>Rb.active),i=A(()=>R(r)?Rb.text(R(r)):``),a=A(()=>{let e={};return(Rb.raw?[]:Pw(R(i))).map(t=>{let n=`${t.time} ${t.text}`,r=e[n]=(e[n]??0)+1;return{...t,key:`${n}#${String(r)}`}})}),o=[[`every`,`Every line`],[`change`,`App changes`]],s=[[`run`,`Since the run`],[`hour`,`Last hour`],[`lines`,`Last 2,000 lines`]],c=A(()=>[{label:`Name`,value:Rb.names,choices:o,set:e=>{Rb.setNames(e)}},{label:`Show`,value:Rb.since,choices:s,set:e=>{Rb.setSince(e)}}]),l=A(()=>R(r)===`*`),u=e=>`${new Date(e).toLocaleTimeString([],{hour12:!1})}.${String(e%1e3).padStart(3,`0`)}`,d=A(()=>Math.min(32,Math.max(4,...Z.nodes.map(e=>Z.logName(e.id).length)))),f=j(null),p=A(()=>Rb.names===`change`),m=A(()=>Object.fromEntries(Z.nodes.map(e=>[e.id,e.data.kind]))),h=A(()=>{if(!R(l))return[];let e={};return Nw(Rb.all.filter(e=>!Z.hiddenLogs[e.app])).map((t,n,r)=>{let i=`${t.app} ${String(t.at)} ${t.text}`,a=e[i]=(e[i]??0)+1,o=Rb.names===`every`||r[n-1]?.app!==t.app;return{...t,named:o,key:`${i}#${String(a)}`}})}),g=j(void 0),_=j(void 0),y=`koppler-logs-height`,b=j(mn((()=>{try{return Number(localStorage.getItem(y))||0}catch{return 0}})())),x=j(!1),S=()=>R(_)?.parentElement?.getBoundingClientRect().height??0,C=e=>{if(S()){M(b,Math.min(Math.max(e,120),S()-60)/S());try{localStorage.setItem(y,String(R(b)))}catch{}}},w=()=>R(_)?.getBoundingClientRect().height??0,T=A(()=>R(b)>.6),ee=()=>{C(S()*(R(T)?.38:.85))},te=e=>{e.preventDefault();let t=e.clientY,n=w();M(x,!0);let r=e=>{C(n+t-e.clientY)};addEventListener(`pointermove`,r),addEventListener(`pointerup`,()=>{removeEventListener(`pointermove`,r),M(x,!1)},{once:!0})},E=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),C(w()+(e.key===`ArrowUp`?40:-40)))},ne=null;Ln(()=>{Q.status&&Rb.refresh()}),Ln(()=>{Rb.reload()}),zn(()=>{if(!R(g))return;let e=R(l)?R(h).length:R(i),t=ne!==R(r)||!e||R(g).scrollHeight-R(g).scrollTop-R(g).clientHeight<24;ne=R(r);let n=R(g);t&&requestAnimationFrame(()=>{n.scrollTop=n.scrollHeight})});var re=li(),ie=P(re),ae=e=>{var t=Zw();let o,s;var y=N(t),S=I(y,2),C=N(S),w=N(C);let ne;var re=N(w),ie=F(re,!0);D(w),G(I(w,2),16,()=>Rb.tabs,e=>e,(e,t)=>{let n=A(()=>Rb.past(t)?null:Q.up(t));var i=Fw();let a;var o=N(i),s=N(o),c=I(s,1,!0);D(o);var l=I(o,2);X(N(l),{get of(){return to},size:14}),D(l),D(i),L((e,u)=>{a=K(i,1,`tab svelte-1feoaw6`,null,a,{on:t===R(r)}),q(o,`aria-selected`,t===R(r)),q(s,`data-on`,R(n)),U(c,e),q(l,`aria-label`,`Close ${u??``} log`)},[()=>Rb.label(t),()=>Rb.label(t)]),B(`click`,o,()=>{Rb.active=t}),B(`click`,l,()=>{Rb.close(t)}),H(e,i)}),D(C);var ae=I(C,2),oe=F(ae,!0),se=I(ae,2),ce=e=>{},le=e=>{var t=Iw(),n=P(t),r=I(n,2);L(()=>q(r,`aria-pressed`,Rb.raw)),B(`click`,n,()=>{Rb.clear()}),B(`click`,r,()=>Rb.raw=!Rb.raw),H(e,t)};W(se,e=>{R(l)?e(ce):e(le,-1)});var ue=I(se,2),de=F(ue,!0),fe=I(ue,2);D(S);var pe=I(S,2),me=e=>{var t=Vw(),n=N(t);G(n,17,()=>Z.nodes,e=>e.id,(e,t)=>{let n=A(()=>Z.logName(R(t).id));var r=li(),i=P(r),a=e=>{var r=Lw();ma(r),vt(r,!0),L((e,i)=>{K(r,1,`tag kind-${R(t).data.kind??``}`,`svelte-1feoaw6`),q(r,`aria-label`,`Name for ${e??``} in this log`),ha(r,R(n)),q(r,`size`,i)},[()=>Z.nameOf(R(t).id),()=>Math.max(4,R(n).length)]),B(`keydown`,r,e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&M(f,null)}),z(`blur`,r,e=>{R(f)===R(t).id&&Z.aliasLog(R(t).id,e.currentTarget.value),M(f,null)}),H(e,r)},o=e=>{var r=Rw();let i;var a=N(r),o=F(a,!0),s=I(a);X(N(s),{get of(){return bw},size:11}),D(s),D(r),L(e=>{i=K(r,1,`tag kind-${R(t).data.kind??``}`,`svelte-1feoaw6`,i,{off:Z.hiddenLogs[R(t).id]}),q(a,`aria-pressed`,!Z.hiddenLogs[R(t).id]),q(a,`title`,Z.hiddenLogs[R(t).id]?`Show ${R(n)} in this log`:`Leave ${R(n)} out of this log`),U(o,R(n)),q(s,`aria-label`,`Rename ${e??``} in this log`)},[()=>Z.nameOf(R(t).id)]),B(`click`,a,()=>{Z.showLog(R(t).id,!!Z.hiddenLogs[R(t).id])}),B(`click`,s,()=>{M(f,R(t).id,!0)}),H(e,r)};W(i,e=>{R(f)===R(t).id?e(a):e(o,-1)}),H(e,r)});var r=I(n,2);G(r,21,()=>R(c),e=>e.label,(e,t)=>{var n=Bw(),r=P(n),i=F(r,!0),a=I(r,2);G(a,21,()=>R(t).choices,([e,t])=>e,(e,n,r,i)=>{var a=A(()=>v(R(n),2));let o=()=>R(a)[0],s=()=>R(a)[1];var c=zw(),l=N(c);ma(l);var u=I(l,1,!0);D(c),L(()=>{q(l,`name`,`log-${R(t).label??``}`),ha(l,o()),ga(l,R(t).value===o()),U(u,s())}),B(`change`,l,()=>{R(t).set(o())}),H(e,c)}),D(a),L(()=>{U(i,R(t).label),q(a,`aria-label`,R(t).label)}),H(e,n)}),D(r),D(t),H(e,t)};W(pe,e=>{R(l)&&e(me)});var he=I(pe,2);let ge,_e;var ve=N(he),ye=e=>{var t=Yw(),r=P(t),i=e=>{var t=Hw(),n=F(t,!0);L(e=>U(n,e),[()=>Rb.allApps().length?`No lines yet from the apps on the board.`:`No apps on the board to show.`]),H(e,t)};W(r,e=>{R(h).length||e(i)}),G(I(r,2),17,()=>R(h),e=>e.key,(e,t)=>{var r=Jw(),i=P(r),a=e=>{var n=Uw(),r=N(n),i=F(r,!0);D(n),L((e,a)=>{K(n,1,`switch kind-${R(m)[R(t).app]??``}`,`svelte-1feoaw6`),q(r,`title`,`Leave ${e??``} out of this log`),U(i,a)},[()=>Z.logName(R(t).app),()=>Z.logName(R(t).app)]),B(`click`,r,()=>{Z.showLog(R(t).app,!1)}),H(e,n)};W(i,e=>{R(p)&&R(t).named&&e(a)});var o=I(i,2),s=N(o);let c;var l=F(s,!0),d=I(s),f=F(d,!0),h=I(d,2),g=e=>{},_=e=>{var n=Ww(),r=F(n,!0);L((e,i)=>{K(n,1,`n kind-${R(m)[R(t).app]??``}`,`svelte-1feoaw6`),q(n,`title`,`Leave ${e??``} out of this log`),U(r,i)},[()=>Z.logName(R(t).app),()=>Z.logName(R(t).app)]),B(`click`,n,()=>{Z.showLog(R(t).app,!1)}),H(e,n)};W(h,e=>{R(p)?e(g):R(t).named&&e(_,1)});var v=I(h,2),y=e=>{var n=Gw(),r=N(n),i=F(r,!0),a=F(I(r),!0);D(n),L(e=>{U(i,R(t).text),U(a,e)},[()=>R(t).items.join(`
|
|
32
|
+
`)]),H(e,n)},b=e=>{var n=qw(),r=P(n),i=F(r,!0),a=I(r,2),o=e=>{var n=Kw(),r=F(n,!0);L(()=>U(r,R(t).detail)),H(e,n)};W(a,e=>{R(t).detail&&e(o)}),L(()=>U(i,R(t).text)),H(e,n)};W(v,e=>{R(t).items?e(y):e(b,-1)}),D(o),L(e=>{q(o,`data-level`,R(t).level),c=K(s,1,`t svelte-1feoaw6`,null,c,{approx:R(t).approx}),q(s,`title`,R(t).approx?`Approximate: the time Koppler first read this line`:void 0),U(l,e),U(f,n[R(t).level]??``)},[()=>u(R(t).at)]),H(e,r)}),H(e,t)},be=e=>{var t=Hw(),n=F(t,!0);L(()=>U(n,Rb.cleared[R(r)]?`Cleared. New lines show up here.`:`No output captured for this app. Apps started from an IDE keep their output there.`)),H(e,t)},xe=e=>{var t=ci();L(()=>U(t,R(i))),H(e,t)},Se=e=>{var t=li();G(P(t),17,()=>R(a),e=>e.key,(e,t)=>{var r=Xw(),i=N(r),a=F(i,!0),o=I(i),s=F(o,!0),c=I(o,2),l=e=>{var n=Gw(),r=N(n),i=F(r,!0),a=F(I(r),!0);D(n),L(e=>{U(i,R(t).text),U(a,e)},[()=>R(t).items.join(`
|
|
33
|
+
`)]),H(e,n)},u=e=>{var n=qw(),r=P(n),i=F(r,!0),a=I(r,2),o=e=>{var n=Kw(),r=F(n,!0);L(()=>U(r,R(t).detail)),H(e,n)};W(a,e=>{R(t).detail&&e(o)}),L(()=>U(i,R(t).text)),H(e,n)};W(c,e=>{R(t).items?e(l):e(u,-1)}),D(r),L(()=>{q(r,`data-level`,R(t).level),U(a,R(t).time),U(s,n[R(t).level]??``)}),H(e,r)}),H(e,t)};W(ve,e=>{R(l)?e(ye):R(i)?Rb.raw?e(xe,2):e(Se,-1):e(be,1)}),D(he),Ma(he,e=>M(g,e),()=>R(g)),D(t),Ma(t,e=>M(_,e),()=>R(_)),L((e,n,r,i,a)=>{o=K(t,1,`logs svelte-1feoaw6`,null,o,{dragging:R(x)}),s=Xi(t,``,s,{height:e}),ne=K(w,1,`tab svelte-1feoaw6`,null,ne,{on:R(l)}),q(re,`aria-selected`,R(l)),U(ie,n),U(oe,r),U(de,R(T)?`Shrink`:`Expand`),ge=K(he,1,`body svelte-1feoaw6`,null,ge,{raw:Rb.raw&&!R(l),all:R(l),"by-change":R(l)&&R(p),"no-time":i}),_e=Xi(he,``,_e,{"--name":a})},[()=>R(b)?`${String(R(b)*100)}%`:void 0,()=>Rb.label(`*`),()=>R(l)||(Rb.past(R(r))?R(i):Q.tail(R(r)))?``:`no log yet`,()=>!R(l)&&!R(a).some(e=>e.time),()=>`${String(R(d))}ch`]),B(`pointerdown`,y,te),B(`dblclick`,y,ee),B(`keydown`,y,E),B(`click`,re,()=>{Rb.active=`*`}),B(`click`,ue,ee),B(`click`,fe,()=>{Rb.closeAll()}),H(e,t)};W(ie,e=>{R(r)&&e(ae)}),H(e,re),k()}Qr([`pointerdown`,`dblclick`,`keydown`,`click`,`change`]);var $w=V(`<button class="open svelte-1skvv7i" type="button" title="The log of every app on the board, in one stream"><!>Logs</button>`);function eT(e,t){O(t,!0);let n=A(()=>Rb.active===`*`);var r=$w();X(N(r),{get of(){return ib},size:15}),Me(),D(r),L(()=>q(r,`aria-pressed`,R(n))),B(`click`,r,()=>{Rb.active=R(n)?null:`*`}),H(e,r),k()}Qr([`click`]);var tT=V(`<div class="tip svelte-1k9t7z2" popover="manual" role="tooltip"> </div>`);function nT(e){let t=j(void 0),n=j(``),r=null,i,a=()=>{clearTimeout(i),r&&r.el.setAttribute(`title`,r.title),r=null,R(t)?.matches(`:popover-open`)&&R(t).hidePopover()},o=e=>{if(!R(t))return;R(t).showPopover();let n=e.getBoundingClientRect(),r=R(t).getBoundingClientRect(),i=n.bottom+6+r.height<=innerHeight,a=Math.min(Math.max(8,n.left+n.width/2-r.width/2),innerWidth-r.width-8);R(t).style.left=`${String(a)}px`,R(t).style.top=`${String(i?n.bottom+6:n.top-6-r.height)}px`},s=e=>{let t=e.target instanceof Element?e.target.closest(`[title]`):null;if(!t||t===r?.el)return;let s=t.getAttribute(`title`)??``;a(),s.trim()&&(r={el:t,title:s},t.removeAttribute(`title`),M(n,s,!0),i=setTimeout(()=>{o(t)},350))},c=e=>{r&&!r.el.contains(e.relatedTarget)&&a()};var l=tT();z(`pointerover`,vn,s),z(`pointerout`,vn,c),z(`pointerdown`,vn,a),z(`keydown`,vn,a),z(`scroll`,_n,a),z(`blur`,_n,a);var u=F(l,!0);Ma(l,e=>M(t,e),()=>R(t)),L(()=>U(u,R(n))),H(e,l)}var rT=new Set([`$$slots`,`$$events`,`$$legacy`]);function iT(e,t){let n=J(t,rT),r={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var aT=V(`<button type="button" role="menuitem"> <span class="svelte-1i03v8q"> </span></button>`),oT=V(`<button type="button" aria-haspopup="menu"><!></button> <div class="menu svelte-1i03v8q" popover="" role="menu" tabindex="-1"></div>`,1);function sT(e,t){let n=ui();O(t,!0);let r=j(void 0),i=j(void 0),a=j(!1),o=()=>[...R(i)?.querySelectorAll(`button:not(:disabled)`)??[]],s=()=>{let e=R(r)?.getBoundingClientRect();e&&R(i)&&(R(i).style.top=`${String(e.bottom+6)}px`,R(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=oT(),u=P(l);X(N(u),{get of(){return iT},size:12}),D(u),Ma(u,e=>M(r,e),()=>R(r));var d=I(u,2);G(d,21,()=>t.items,e=>e.label,(e,t)=>{var n=aT();let r;var a=N(n,!0),o=F(I(a),!0);D(n),L(()=>{n.disabled=R(t).off,r=K(n,1,`svelte-1i03v8q`,null,r,{danger:R(t).danger}),U(a,R(t).label),U(o,R(t).about)}),B(`click`,n,()=>{R(i)?.hidePopover(),R(t).run()}),H(e,n)}),D(d),Ma(d,e=>M(i,e),()=>R(i)),L(()=>{K(u,1,`more ${t.tone??``}`,`svelte-1i03v8q`),q(u,`aria-label`,t.label),q(u,`aria-expanded`,R(a)),q(u,`popovertarget`,n),q(d,`id`,n),q(d,`aria-label`,t.label)}),B(`keydown`,d,c),z(`toggle`,d,e=>{M(a,e.newState===`open`),R(a)&&s()}),H(e,l),k()}Qr([`keydown`,`click`]);var cT=new Set([`$$slots`,`$$events`,`$$legacy`]);function lT(e,t){let n=J(t,cT),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 uT=new Set([`$$slots`,`$$events`,`$$legacy`]);function dT(e,t){let n=J(t,uT),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 fT=new Set([`$$slots`,`$$events`,`$$legacy`]);function pT(e,t){let n=J(t,fT),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 mT=new Set([`$$slots`,`$$events`,`$$legacy`]);function hT(e,t){let n=J(t,mT),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 gT=new Set([`$$slots`,`$$events`,`$$legacy`]);function _T(e,t){let n=J(t,gT),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 vT=V(`<button class="text svelte-r1euo8" type="button">Copy</button> <button class="text svelte-r1euo8" type="button">Clear</button>`,1),yT=V(`<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),bT=V(`<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),xT=V(`<button type="button" role="radio" class="svelte-r1euo8"><!></button>`),ST=V(`<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 CT(e,t){O(t,!0);let n=j(!1),r=async()=>{let e=await Co(`new-address`,{port:location.port});`error`in e?($.show(`No new address: ${e.error}`,`warning`),M(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`,pT],[`light`,`Light`,_T],[`dark`,`Dark`,hT]];var o=ST(),s=P(o);X(N(s),{get of(){return Nc},size:16}),D(s);var c=I(s,2),l=N(c),u=N(l),d=N(u);ma(d),Me(2),D(u);var f=I(u,2),p=e=>{var t=vT(),n=P(t),r=I(n,2);B(`click`,n,i),B(`click`,r,()=>{gc.clear(),$.show(`Debug log cleared`)}),H(e,t)};W(f,e=>{gc.on&&e(p)}),D(l);var m=I(l,2),h=N(m),g=e=>{var t=yT(),i=I(P(t),2),a=I(i,2);B(`click`,i,()=>M(n,!1)),B(`click`,a,()=>void r()),H(e,t)},_=e=>{var t=bT();B(`click`,I(P(t),2),()=>M(n,!0)),H(e,t)};W(h,e=>{R(n)?e(g):e(_,-1)}),D(m);var y=I(m,2);G(I(N(y),2),17,()=>a,([e,t,n])=>e,(e,t)=>{var n=A(()=>v(R(t),3));let r=()=>R(n)[0],i=()=>R(n)[1],a=()=>R(n)[2];var o=xT();X(N(o),{get of(){return a()},size:14}),D(o),L(()=>{q(o,`aria-checked`,Gx.now===r()),q(o,`aria-label`,i()),q(o,`title`,i())}),B(`click`,o,()=>{Gx.pick(r())}),H(e,o)}),D(y),D(c),L(()=>{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),H(e,o),k()}Qr([`click`]);var wT=V(`<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>`),TT=V(`<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 ET(e,t){O(t,!0);let n=A(()=>(Q.status?.checks??[]).some(e=>e.state!==`ok`));var r=TT();let i;var a=N(r),o=N(a);X(o,{get of(){return dT},size:16});var s=F(I(o,2),!0);D(a);var c=I(a,2),l=N(c);X(l,{get of(){return lT},size:16});var u=F(I(l,2));D(c);var d=I(c,2),f=N(d),p=e=>{var n=wT();X(N(n),{get of(){return Px},size:15}),D(n),B(`click`,n,()=>{t.open()}),H(e,n)};W(f,e=>{R(n)&&e(p)}),CT(I(f,2),{}),D(d),D(r),L((e,t)=>{i=K(r,1,`svelte-1qvf60f`,null,i,{protected:Z.protected}),q(a,`aria-label`,`Board and environment: ${e??``}`),U(s,t),q(c,`aria-label`,`Apps: ${Z.cards.length??``} of ${Z.apps.length??``} on the board`),U(u,`${Z.cards.length??``}/${Z.apps.length??``}`)},[()=>Z.env.toUpperCase(),()=>Z.env.toUpperCase()]),B(`click`,a,()=>{t.open(`board`)}),B(`click`,c,()=>{t.open()}),H(e,r),k()}Qr([`click`]);var DT=V(`<span class="row svelte-1vz4hzd"><span class="who svelte-1vz4hzd"> </span> <input type="checkbox" class="svelte-1vz4hzd"/> <input type="checkbox" class="svelte-1vz4hzd"/></span>`),OT=V(`<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
|
|
34
|
+
(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 kT(e,t){O(t,!0);let n=j(void 0),r=j(``),i=j(``),a=j(``),o=j(mn({})),s=j(mn({})),c=j(``),l=j(!1),u=A(()=>Z.apps.filter(e=>!e.outside)),d=e=>R(u).filter(t=>e[t.id]).map(e=>e.id);function f(){M(r,``),M(i,``),M(a,``),M(o,{},!0),M(s,{},!0),M(c,``),R(n)?.showModal()}let p=async e=>{e.preventDefault();let t=d(R(o)),u=d(R(s));if(!t.length&&!u.length){M(c,`Pick the apps that call ${R(r).trim()||`it`}, or that it calls: its card shows next to them.`);return}M(l,!0);let f=await Co(`apps-outside`,{name:R(r),url:R(i),why:R(a),calledBy:t,sendsTo:u});M(l,!1),`error`in f?M(c,f.error,!0):(R(n)?.close(),location.reload())};var m={open:f},h=OT(),g=N(h);X(N(g),{get of(){return to},size:14}),D(g);var _=I(g,6),v=N(_),y=I(N(v));ma(y),D(v);var b=I(v,2),x=I(N(b),2);ma(x),D(b);var S=I(b,2),C=I(N(S),2);ma(C),D(S);var w=I(S,2),T=I(N(w),2);G(I(N(T),2),17,()=>R(u),e=>e.id,(e,t)=>{var n=DT(),r=N(n),i=F(r,!0),a=I(r,2);ma(a);var l=I(a,2);ma(l),D(n),L(()=>{U(i,R(t).name),q(a,`aria-label`,`${R(t).name??``} calls it`),ga(a,!!R(o)[R(t).id]),q(l,`aria-label`,`${R(t).name??``} gets its calls`),ga(l,!!R(s)[R(t).id])}),B(`change`,a,e=>{R(o)[R(t).id]=e.currentTarget.checked,M(c,``)}),B(`change`,l,e=>{R(s)[R(t).id]=e.currentTarget.checked,M(c,``)}),H(e,n)}),D(T),D(w);var ee=I(w,2),te=F(ee,!0),E=I(ee,2),ne=N(E),re=I(ne,2),ie=F(re,!0);return D(E),D(_),D(h),Ma(h,e=>M(n,e),()=>R(n)),L(()=>{U(te,R(c)),re.disabled=R(l),U(ie,R(l)?`Adding…`:`Add`)}),B(`click`,g,()=>R(n)?.close()),z(`submit`,_,p),Sa(y,()=>R(r),e=>M(r,e)),Sa(x,()=>R(i),e=>M(i,e)),Sa(C,()=>R(a),e=>M(a,e)),B(`click`,ne,()=>R(n)?.close()),H(e,h),k(m)}Qr([`click`,`change`]);var AT=V(`<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 jT(e,t){O(t,!0);let n=A(()=>Z.panelCard);var r=li(),i=P(r),a=e=>{var t=AT();let r;var i=N(t),a=N(i),o=F(a,!0),s=I(a,2),c=F(s,!0),l=I(s,2);X(N(l),{get of(){return to},size:14}),D(l),D(i),Ti(I(i,2),()=>R(n).id,e=>{jb(e,{get id(){return R(n).id}})}),D(t),L(()=>{K(t,1,`kind-${R(n).data.kind??``}`,`svelte-c90ff7`),r=Xi(t,``,r,{width:`300px`}),q(a,`title`,R(n).data.name),U(o,R(n).data.name),U(c,R(n).data.kindLabel)}),B(`click`,l,()=>{Z.pick(``)}),H(e,t)};W(i,e=>{R(n)&&e(a)}),H(e,r),k()}Qr([`click`]);var MT=new Set([`$$slots`,`$$events`,`$$legacy`]);function NT(e,t){let n=J(t,MT),r={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var PT=new Set([`$$slots`,`$$events`,`$$legacy`]);function FT(e,t){let n=J(t,PT),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 IT=[`postgres`,`mysql`,`redis`],LT=/^[A-Za-z0-9_][\w.-]*$/,RT=new Set([`__proto__`,`prototype`,`constructor`]);function zT(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`&&(RT.has(e)||!LT.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 VT(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 HT(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]=HT(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]:HT(a[r],i,n)}}var UT=new Set([`$$slots`,`$$events`,`$$legacy`]);function WT(e,t){let n=J(t,UT),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 GT=V(`<label class="svelte-s22te4"><input type="checkbox" class="svelte-s22te4"/> <span class="svelte-s22te4"> </span></label>`),KT=V(`<div class="checks svelte-s22te4" role="group"></div>`),qT=V(`<span class="none svelte-s22te4"> </span>`);function JT(e,t){O(t,!0);let n=Y(t,`disabled`,3,!1),r=A(()=>[...t.options,...t.picked.filter(e=>!t.options.some(t=>t.value===e)).map(e=>({value:e,label:e}))]);var i=li(),a=P(i),o=e=>{var i=KT();G(i,21,()=>R(r),e=>e.value,(e,r)=>{var i=GT(),a=N(i);ma(a);var o=F(I(a,2),!0);D(i),L(e=>{a.disabled=n(),ga(a,e),U(o,R(r).label)},[()=>t.picked.includes(R(r).value)]),B(`change`,a,e=>{t.ontoggle(R(r).value,e.currentTarget.checked)}),H(e,i)}),D(i),L(()=>q(i,`aria-label`,t.label)),H(e,i)},s=e=>{var n=qT(),r=F(n,!0);L(()=>U(r,t.none)),H(e,n)};W(a,e=>{R(r).length?e(o):e(s,-1)}),H(e,i),k()}Qr([`change`]);var YT=new Set([`$$slots`,`$$events`,`$$legacy`]);function XT(e,t){let n=J(t,YT),r={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`}]]};$a(e,Ba(()=>n,{get icon(){return r}}))}var ZT=V(`<button type="button" title="Move earlier" class="svelte-1iop5lw"><!></button>`),QT=V(`<span class="tag svelte-1iop5lw"> </span>`),$T=V(`<button type="button" title="Remove" class="svelte-1iop5lw"><!></button>`),eE=V(`<li><!> <span class="word svelte-1iop5lw"> </span> <!> <!></li>`),tE=V(`<li class="new svelte-1iop5lw"><input class="svelte-1iop5lw"/></li>`),nE=V(`<ul class="chips svelte-1iop5lw"><!> <!></ul>`);function rE(e,t){O(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=j(``),s=()=>{let e=R(o).trim();M(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=nE(),u=N(l);G(u,18,()=>t.value,e=>e,(e,i,o)=>{var s=eE();let l;var u=N(s),d=e=>{var t=ZT();X(N(t),{get of(){return XT},size:10}),D(t),L(()=>q(t,`aria-label`,`Move ${i??``} earlier`)),B(`click`,t,()=>{c(R(o))}),H(e,t)};W(u,e=>{n()&&R(o)>0&&!r()&&e(d)});var f=I(u,2),p=F(f,!0),m=I(f,2),h=e=>{var t=QT(),n=F(t,!0);L(()=>U(n,a())),H(e,t)};W(m,e=>{n()&&R(o)===0&&a()&&e(h)});var g=I(m,2),_=e=>{var n=$T();X(N(n),{get of(){return to},size:10}),D(n),L(()=>q(n,`aria-label`,`Remove ${i??``}`)),B(`click`,n,()=>{t.onchange(t.value.filter(e=>e!==i))}),H(e,n)};W(g,e=>{r()||e(_)}),D(s),L(()=>{l=K(s,1,`svelte-1iop5lw`,null,l,{first:n()&&R(o)===0}),U(p,i)}),H(e,s)});var d=I(u,2),f=e=>{var n=tE(),r=N(n);ma(r),D(n),L(e=>{q(r,`aria-label`,`Add to ${t.label??``}`),q(r,`placeholder`,i()),q(r,`size`,e)},[()=>Math.max(i().length,R(o).length)+1]),B(`keydown`,r,e=>{(e.key===`Enter`||e.key===`,`)&&(e.preventDefault(),s())}),z(`blur`,r,s),Sa(r,()=>R(o),e=>M(o,e)),H(e,n)};W(d,e=>{r()||e(f)}),D(l),L(()=>q(l,`aria-label`,t.label)),H(e,l),k()}Qr([`click`,`keydown`]);var iE=new Set([`$$slots`,`$$events`,`$$legacy`]);function aE(e,t){let n=J(t,iE),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 oE=new Set([`$$slots`,`$$events`,`$$legacy`]);function sE(e,t){let n=J(t,oE),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 cE=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,lE=`</title><path d="`,uE=`"/></svg>`,dE={title:`.NET`,slug:`dotnet`,get svg(){return cE+`.NET`+lE+this.path+uE},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`}},fE={title:`Docker`,slug:`docker`,get svg(){return cE+`Docker`+lE+this.path+uE},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`},pE={title:`Flutter`,slug:`flutter`,get svg(){return cE+`Flutter`+lE+this.path+uE},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`},mE={title:`Go`,slug:`go`,get svg(){return cE+`Go`+lE+this.path+uE},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`},hE={title:`Node.js`,slug:`nodedotjs`,get svg(){return cE+`Node.js`+lE+this.path+uE},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`},gE={title:`OpenJDK`,slug:`openjdk`,get svg(){return cE+`OpenJDK`+lE+this.path+uE},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`}},_E={title:`PHP`,slug:`php`,get svg(){return cE+`PHP`+lE+this.path+uE},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`}},vE={title:`Python`,slug:`python`,get svg(){return cE+`Python`+lE+this.path+uE},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/`},yE={title:`React`,slug:`react`,get svg(){return cE+`React`+lE+this.path+uE},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`},bE={title:`Ruby`,slug:`ruby`,get svg(){return cE+`Ruby`+lE+this.path+uE},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`}},xE={title:`Rust`,slug:`rust`,get svg(){return cE+`Rust`+lE+this.path+uE},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`}},SE=`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`,CE={dotnet:{logo:dE.path},flutter:{logo:pE.path},node:{logo:hE.path},lambda:{logo:SE},sam:{logo:SE},web:{icon:aE},reactnative:{logo:yE.path},go:{logo:mE.path},rust:{logo:xE.path},java:{logo:gE.path},python:{logo:vE.path},ruby:{logo:bE.path},php:{logo:_E.path},compose:{logo:fE.path}},wE=e=>(Object.hasOwn(CE,e)?CE[e]:void 0)??{icon:sE},TE=si(`<title> </title>`),EE=si(`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><!><path></path></svg>`);function DE(e,t){O(t,!0);let n=A(()=>wE(t.kind));var r=li(),i=P(r),a=e=>{var r=EE();let i;var a=N(r),o=e=>{var n=TE(),r=F(n,!0);L(()=>U(r,t.label)),H(e,n)};W(a,e=>{t.label&&e(o)});var s=I(a);D(r),L(()=>{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=K(r,0,`svelte-7vspaq`,null,i,{wordmark:t.kind===`dotnet`}),q(s,`d`,R(n).logo)}),H(e,r)},o=e=>{X(e,{get of(){return R(n).icon},size:16,get label(){return t.label}})};W(i,e=>{R(n).logo?e(a):R(n).icon&&e(o,1)}),H(e,r),k()}var OE=V(`<!> <span class="label svelte-npi4py"> </span>`,1),kE=V(`<span class="label unset svelte-npi4py">Choose a kind…</span>`),AE=V(`<button type="button" role="option" class="svelte-npi4py"><!> <span class="label svelte-npi4py"> </span></button>`),jE=V(`<div class="list svelte-npi4py" role="listbox" aria-label="Kind"></div>`),ME=V(`<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 NE(e,t){O(t,!0);let n=Y(t,`disabled`,3,!1),r=j(!1),i=j(void 0),a=A(()=>t.value&&!t.options.some(e=>e.value===t.value)?[...t.options,{value:t.value,label:t.value}]:t.options),o=A(()=>R(a).find(e=>e.value===t.value)),s=e=>{let t=[...R(i)?.querySelectorAll(`[role="option"]`)??[]],n=t.indexOf(document.activeElement);t[Math.max(0,Math.min(t.length-1,n+e))]?.focus()},c=async()=>{M(r,!0),await Promise.resolve(),requestAnimationFrame(()=>{(R(i)?.querySelector(`[aria-selected="true"]`)??R(i)?.querySelector(`[role="option"]`))?.focus()})},l=(e=!0)=>{M(r,!1),e&&R(i)?.querySelector(`.now`)?.focus()};var u=ME();z(`pointerdown`,_n,e=>{R(r)&&!R(i)?.contains(e.target)&&l(!1)});var d=N(u),f=N(d),p=e=>{var t=OE(),n=P(t);DE(n,{get kind(){return R(o).value},label:``});var r=F(I(n,2),!0);L(()=>U(r,R(o).label)),H(e,t)},m=e=>{H(e,kE())};W(f,e=>{R(o)?e(p):e(m,-1)});var h=I(f,2);X(N(h),{get of(){return iT},size:10}),D(h),D(d);var g=I(d,2),_=e=>{var n=jE();G(n,21,()=>R(a),e=>e.value,(e,n)=>{var r=AE(),i=N(r);DE(i,{get kind(){return R(n).value},label:``});var a=F(I(i,2),!0);D(r),L(()=>{q(r,`aria-selected`,R(n).value===t.value),U(a,R(n).label)}),B(`click`,r,()=>{t.onpick(R(n).value),l()}),H(e,r)}),D(n),H(e,n)};W(g,e=>{R(r)&&e(_)}),D(u),Ma(u,e=>M(i,e),()=>R(i)),L(()=>{q(d,`id`,t.id),d.disabled=n(),q(d,`aria-expanded`,R(r))}),B(`keydown`,u,e=>{R(r)&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),l()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(e.key===`ArrowDown`?1:-1)))}),B(`click`,d,()=>{R(r)?l():c()}),H(e,u),k()}Qr([`keydown`,`click`]);var PE=V(`<option class="svelte-1uxsjsg"> </option>`),FE=V(`<datalist class="svelte-1uxsjsg"></datalist>`),IE=V(`<input class="svelte-1uxsjsg"/> <!>`,1),LE=V(`<input class="svelte-1uxsjsg"/>`),RE=V(`<option class="svelte-1uxsjsg">Other…</option>`),zE=V(`<select class="svelte-1uxsjsg"><!><!><!></select>`);function BE(e,t){let n=ui();O(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=j(!1),l=A(()=>t.value&&!t.options.some(e=>e.value===t.value)?[...t.options,{value:t.value,label:t.value}]:t.options);var u=li(),d=P(u),f=e=>{var r=IE(),i=P(r);ma(i);var s=I(i,2),l=e=>{var r=FE();G(r,21,()=>t.options,e=>e.value,(e,t)=>{var n=PE(),r=F(n,!0),i={};L(()=>{U(r,R(t).label===R(t).value?``:R(t).label),i!==(i=R(t).value)&&(n.value=(n.__value=i)??``)}),H(e,n)}),D(r),L(()=>q(r,`id`,n)),H(e,r)};W(s,e=>{t.options.length&&e(l)}),L(()=>{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)}),B(`change`,i,e=>{let n=e.currentTarget.value.trim();!n&&t.options.length<=30&&M(c,!1),t.onpick(n||void 0)}),H(e,r)},p=e=>{var n=LE();ma(n),L(()=>{q(n,`id`,t.id),n.disabled=a(),q(n,`aria-label`,t.label),q(n,`placeholder`,o()),ha(n,t.value)}),B(`change`,n,e=>{t.onpick(e.currentTarget.value.trim()||void 0)}),H(e,n)},m=e=>{var n=zE(),o=N(n),u=e=>{var t=PE(),n=F(t,!0);t.value=t.__value=``,L(()=>U(n,i()?`Choose…`:`Not set`)),H(e,t)};W(o,e=>{(!i()||!t.value)&&e(u)});var d=I(o);G(d,17,()=>R(l),e=>e.value,(e,t)=>{var n=PE(),r=F(n,!0),i={};L(()=>{U(r,R(t).label),i!==(i=R(t).value)&&(n.value=(n.__value=i)??``)}),H(e,n)});var f=I(d),p=e=>{var t=RE();t.value=t.__value=s,H(e,t)};W(f,e=>{r()&&e(p)}),D(n);var m;ta(n),L(()=>{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))}),B(`change`,n,e=>{let n=e.currentTarget.value;n===s?M(c,!0):t.onpick(n||void 0)}),H(e,n)};W(d,e=>{t.options.length>30||R(c)&&r()?e(f):!t.options.length&&r()?e(p,1):e(m,-1)}),H(e,u),k()}Qr([`change`]);var VE=new Set([`$$slots`,`$$events`,`$$legacy`]);function HE(e,t){let n=J(t,VE),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 UE=new Set([`$$slots`,`$$events`,`$$legacy`]);function WE(e,t){let n=J(t,UE),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 GE=new Set([`$$slots`,`$$events`,`$$legacy`]);function KE(e,t){let n=J(t,GE),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 qE=new Set([`$$slots`,`$$events`,`$$legacy`]);function JE(e,t){let n=J(t,qE),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 YE=new Set([`$$slots`,`$$events`,`$$legacy`]);function XE(e,t){let n=J(t,YE),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 ZE=new Set([`$$slots`,`$$events`,`$$legacy`]);function QE(e,t){let n=J(t,ZE),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 $E=e=>[e.type??[]].flat();function eD(e,t){if(e.enum)return`choice`;if(e.anyOf)return(t===void 0||typeof t==`string`)&&e.anyOf.some(e=>$E(e).includes(`string`))?`text`:`json`;let n=$E(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 tD(e){if(typeof e!=`object`)return{};let t=$E(e);return t.includes(`array`)?[]:t.includes(`string`)||e.anyOf?``:t.includes(`object`)||!t.length?{}:``}var nD=e=>!!e?.required?.length,rD=/^[A-Za-z0-9_][\w-]*$/,iD=(e,t)=>typeof t==`number`?`${e}[${String(t)}]`:rD.test(t)?e?`${e}.${t}`:t:`${e}["${t}"]`,aD={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 oD(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 sD={envs:`Environments`,protected:`Protected`,presets:`Team boards`,checks:`Checks on this Mac`};function cD(e,t=!1){if(t&&Object.hasOwn(sD,e))return sD[e]??e;if(Object.hasOwn(aD,e))return aD[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 lD=(e,t)=>e.some(e=>t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)),uD=[`name`,`kind`,`slug`],dD={dotnet:[`project`,`launchSettings`,`baseProfile`],node:[`script`],web:[`script`],flutter:[`flutter`,`mobile`],lambda:[`lambda`,`sam`]},fD=[...new Set(Object.values(dD).flat())],pD=[{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`}],mD=[{name:`Deployed`,keys:[`outside`,`deployedUrl`]},{name:`Calls`,keys:[`consumes`]},{name:`Environments`,keys:[`envs`],view:`envs`}],hD=[`name`],gD=[{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`]}],_D=[`deployedUrl`,`start`,`prereqs`,`secrets`];function vD(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 yD=(e,t)=>!t||e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`);function bD(e){return e===void 0?`not set`:typeof e==`string`?e:Array.isArray(e)?e.length?e.map((e,t)=>oD(e,`#${String(t+1)}`)).join(`, `):`none`:typeof e==`object`&&e?Object.keys(e).join(`, `)||`empty`:JSON.stringify(e)}function xD(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+xD(r[t],i[t]),0)}var SD=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},CD=e=>typeof e==`string`||typeof e==`number`?String(e):``,wD={tunnel:HE,cloud:WE,laptop:KE,signIn:JE,shield:QE,box:XE,key:gS,other:gC},TD=[{id:`tunnel`,label:`Tunnel`,about:`A database or service reached through a tunnel`,icon:wD.tunnel,fields:[`tunnel`,`port`,`env`,`what`,`connectsAs`,`cmd`,`note`],start:{},say:e=>{let t=[CD(e.tunnel),CD(e.port)].filter(Boolean).join(`:`),n=CD(e.what),r=CD(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:wD.cloud,fields:[`sso`,`account`,`note`],start:{},say:e=>`${CD(e.sso)}${e.account?`, account ${CD(e.account)}`:``}`},{id:`hosts`,label:`Hosts entry`,about:`A name that has to lead to this Mac`,icon:wD.laptop,fields:[`hosts`,`note`],start:{},say:e=>e.hosts?`${CD(e.hosts)} leads to this Mac`:``},{id:`signIn`,label:`Stack sign-in`,about:`A sign-in this stack defines`,icon:wD.signIn,fields:[`signIn`,`note`],start:{},say:(e,t)=>{let n=CD(e.signIn),r=CD(SD(SD(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:wD.shield,fields:[`note`],own:[`devCerts`],start:{devCerts:!0},say:e=>CD(e.note)||`The local certificate must be trusted`},{id:`nuget`,label:`Private package feed`,about:`It downloads company packages while it builds`,icon:wD.box,fields:[`note`],own:[`nuget`],start:{nuget:!0},say:e=>CD(e.note)||`Packages come from a private feed`}],ED=(e,t)=>TD.find(n=>t?n.id===t:e[n.id]!==void 0&&e[n.id]!==!1),DD=[{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`}],OD={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`]},kD=e=>{let t=[e.env??[]].flat().map(CD).filter(Boolean).join(`, `),n=CD(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 ${CD(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 ${CD(e.key)||`a key`} in its secret`:`how it finds it is not known yet`},AD=/(?:^|\.)(prereqs|secrets|localChanges)\[\d+\]$|(?:^|\.)(consumes)(?:\.[\w-]+|\["[^"]+"\])$|(?:^|\.)(ready)$/,jD=/(?:^|\.)(prereqs|secrets|localChanges|consumes)$/;function MD(e,t,n,r){let i=AD.exec(e),a=i?.[1]??i?.[2]??i?.[3];if(!a)return;let o=SD(t),s=SD(n);if(a===`prereqs`){let e=ED(o,r);if(!e)return{label:`Something else`,say:bD(t),icon:wD.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=CD(o.type),t=CD(o.when);return{label:CD(o.env)||CD(o.file)||`Secret`,say:[e&&cD(e),t&&`needed ${t}`].filter(Boolean).join(`, `),icon:wD.key,fields:[`env`,`type`,`file`,`when`,`fetch`,`note`]}}if(a===`localChanges`)return{label:CD(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=SD(SD(s.apps)[c]),u=CD(o.how);return{label:CD(l.name)||c,say:kD(o),kind:CD(l.kind)||`other`,fields:(Object.hasOwn(OD,u)?OD[u]:void 0)??OD.unknown??[]}}var ND={path:`/health`,status:`200`,timeout:`30 s`,file:`src/config.ts`,find:`the text as it is`,replace:`the text for local runs`};function PD(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 FD(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=>$E(e).includes(`array`)&&$E(e.items??{}).includes(`string`);if(i(t)||Array.isArray(n)&&t.anyOf?.some(i))return`chips`}var ID={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.`},LD=V(`<button class="words svelte-gtai80" type="button"> </button>`),RD=V(`<button class="icon svelte-gtai80" type="button" title="Remove"><!></button>`),zD=V(`<span><!> <button type="button"><!></button></span>`),BD=V(`<!> <!>`,1),VD=V(`<span class="none svelte-gtai80"> </span>`),HD=V(`<option class="svelte-gtai80"> </option>`),UD=V(`<select class="svelte-gtai80"><option class="svelte-gtai80"> </option><!></select>`),WD=V(`<input placeholder="New key" class="svelte-gtai80"/>`),GD=V(`<!> <!> <span class="add svelte-gtai80"><!> <button type="button" class="svelte-gtai80">Add</button></span>`,1),KD=V(`<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>`),qD=V(`<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>`),JD=V(`<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>`),YD=V(`<span class="add svelte-gtai80"><button type="button" class="svelte-gtai80"> </button></span>`),XD=V(`<!> <!> <!>`,1),ZD=V(`<span class="error svelte-gtai80" role="alert"> </span>`),QD=V(`<span class="name svelte-gtai80"> </span>`),$D=V(`<span class="part svelte-gtai80"><span class="word svelte-gtai80"> </span> <!></span>`),eO=V(`<div><!> <fieldset class="parts svelte-gtai80"><legend class="sr svelte-gtai80"> </legend> <!></fieldset> <!> <!></div>`),tO=V(`<span class="about svelte-gtai80"> </span>`),nO=V(`<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>`),rO=V(`<span class="glyph svelte-gtai80"><!></span>`),iO=V(`<span class="name svelte-gtai80"><span class="what svelte-gtai80"> </span><span class="say svelte-gtai80"> </span></span>`),aO=V(`<span class="unset svelte-gtai80">Not set</span>`),oO=V(`<span class="name svelte-gtai80"> </span> <!>`,1),sO=V(`<details><summary class="svelte-gtai80"><span class="chev svelte-gtai80"><!></span> <!> <!> <!></summary> <fieldset class="svelte-gtai80"><legend class="sr svelte-gtai80"> </legend> <!> <!></fieldset></details>`),cO=V(`<input type="checkbox" role="switch" class="svelte-gtai80"/>`),lO=V(`<select class="svelte-gtai80"><option class="svelte-gtai80">Not set</option><!></select>`),uO=V(`<input inputmode="numeric" class="svelte-gtai80"/>`),dO=V(`<input class="svelte-gtai80"/>`),fO=V(`<textarea rows="3" class="svelte-gtai80"></textarea>`),pO=V(`<textarea class="mono svelte-gtai80"></textarea>`),mO=V(`<span class="note warn svelte-gtai80"> </span>`),hO=V(`<span class="note svelte-gtai80"> </span>`),gO=V(`<div><label> </label> <!> <!> <!> <!></div>`);function _O(e,t){let n=ui();O(t,!0);let r=e=>{var n=zD();let r;var i=N(n),o=e=>{var n=LD(),r=F(n,!0);L(()=>U(r,t.drop)),B(`click`,n,()=>void h(void 0)),H(e,n)},s=e=>{var t=RD();X(N(t),{get of(){return to},size:11}),D(t),L(()=>q(t,`aria-label`,`Remove ${R(C)??``}`)),B(`click`,t,()=>void h(void 0)),H(e,t)};W(i,e=>{t.drop&&!R(f)?e(o):t.value!==void 0&&!a()&&!R(f)&&e(s,1)});var c=I(i,2);let l;var u=N(c);{let e=A(()=>R(f)?vS:WT);X(u,{get of(){return R(e)},size:12})}D(c),D(n),L(()=>{r=K(n,1,`acts svelte-gtai80`,null,r,{fresh:t.ctx.fresh}),l=K(c,1,`icon lock svelte-gtai80`,null,l,{on:R(f)}),q(c,`aria-pressed`,R(f)),q(c,`aria-label`,`${R(f)?`Unlock`:`Lock`} ${R(C)??``}`),q(c,`title`,R(f)?`Locked: nothing changes it. Click to unlock`:`Lock: keep it as it is, for you and the agent`)}),B(`click`,c,()=>{t.ctx.lock(t.path,!R(f))}),H(e,n)},i=e=>{var n=BD(),r=P(n),i=e=>{var n=BD(),r=P(n);G(r,16,()=>R(x),e=>e,(e,n)=>{{let r=A(()=>iD(t.path,n)),i=A(()=>cD(n,t.path===``)),a=A(()=>t.schema.properties?.[n]??{}),s=A(()=>!!t.schema.required?.includes(n)),c=A(()=>o()+1);_O(e,{get path(){return R(r)},get name(){return R(i)},get schema(){return R(a)},get value(){return R(g)[n]},get ctx(){return t.ctx},get required(){return R(s)},get depth(){return R(c)}})}}),G(I(r,2),16,()=>R(b),e=>e,(e,n)=>{{let r=A(()=>iD(t.path,n)),i=A(()=>cD(n)),a=A(()=>t.schema.properties?.[n]??{}),s=A(()=>o()+1);_O(e,{get path(){return R(r)},get name(){return R(i)},get schema(){return R(a)},get value(){return R(g)[n]},get ctx(){return t.ctx},get depth(){return R(s)}})}}),H(e,n)},a=e=>{var n=GD(),r=P(n);G(r,16,()=>Object.keys(R(g)),e=>e,(e,n)=>{{let r=A(()=>iD(t.path,n)),i=A(()=>o()+1);_O(e,{get path(){return R(r)},get name(){return n},get schema(){return t.schema.additionalProperties},get value(){return R(g)[n]},get ctx(){return t.ctx},get depth(){return R(i)}})}});var i=I(r,2),a=e=>{var t=VD(),n=F(t,!0);L(()=>U(n,ID[R(E)])),H(e,t)},s=A(()=>R(E)&&!Object.keys(R(g)).length);W(i,e=>{R(s)&&e(a)});var c=I(i,2),l=N(c),u=e=>{var n=UD(),r=N(n),i=F(r,!0);r.value=r.__value=``,G(I(r),16,()=>R(T),e=>e,(e,n)=>{var r=HD(),i=F(r,!0),a={};L(e=>{U(i,e),a!==(a=n)&&(r.value=(r.__value=a)??``)},[()=>MD(iD(t.path,n),{},t.ctx.stack())?.label??n]),H(e,r)}),D(n),ta(n),L(()=>{q(n,`aria-label`,`Add to ${t.name??``}`),U(i,R(E)&&me[R(E)]||`Add…`)}),na(n,()=>R(oe),e=>M(oe,e)),H(e,n)},d=A(()=>t.ctx.keys(t.path)),f=e=>{var n=WD();ma(n),L(()=>q(n,`aria-label`,`New key in ${t.name??``}`)),Sa(n,()=>R(oe),e=>M(oe,e)),H(e,n)};W(l,e=>{R(d)?e(u):e(f,-1)});var p=I(l,2);D(c),L(e=>p.disabled=e,[()=>!R(oe).trim()]),B(`click`,p,()=>void pe()),H(e,n)},s=e=>{var n=XD(),r=P(n);Ti(r,()=>R(_).length,e=>{var n=li();G(P(n),17,()=>R(_),Di,(e,n,r)=>{{let i=A(()=>iD(t.path,r)),a=A(()=>oD(R(n),`${t.name} ${String(r+1)}`)),s=A(()=>t.schema.items??{}),c=A(()=>o()+1);_O(e,{get path(){return R(i)},get name(){return R(a)},get schema(){return R(s)},get value(){return R(n)},get ctx(){return t.ctx},get depth(){return R(c)}})}}),H(e,n)});var i=I(r,2),a=e=>{var t=VD(),n=F(t,!0);L(()=>U(n,ID[R(E)])),H(e,t)};W(i,e=>{R(E)&&!R(_).length&&!R(se)&&!R(le)&&e(a)});var s=I(i,2),c=e=>{var n=KD(),r=N(n);{let e=A(()=>iD(t.path,R(_).length)),n=A(()=>t.schema.items??{}),i=A(()=>o()+1);_O(r,{get path(){return R(e)},name:`New`,get schema(){return R(n)},get value(){return R(se)},get ctx(){return R(de)},get as(){return R(ce)},required:!0,open:!0,get depth(){return R(i)}})}var i=I(r,2),a=N(i),s=I(a,2);D(i),D(n),L(()=>q(n,`aria-label`,`New in ${t.name??``}`)),B(`click`,a,async()=>{M(p,await t.ctx.save(iD(t.path,R(_).length),R(se))??``,!0),R(p)||M(se,null)}),B(`click`,s,()=>M(se,null)),H(e,n)},l=e=>{var t=JD(),n=N(t);G(n,17,()=>TD,e=>e.id,(e,t)=>{let n=A(()=>R(t).id===`signIn`&&!R(ae));var r=qD(),i=N(r);X(N(i),{get of(){return R(t).icon},size:15}),D(i);var a=I(i,2),o=F(a,!0),s=F(I(a,2),!0);D(r),L(()=>{r.disabled=R(n),U(o,R(t).label),U(s,R(n)?`This stack defines none yet`:R(t).about)}),B(`click`,r,()=>fe(R(t))),H(e,r)});var r=F(I(n,2));D(t),B(`click`,r,()=>M(le,!1)),H(e,t)},u=e=>{var t=YD(),n=N(t),r=F(n,!0);D(t),L(()=>U(r,R(E)&&me[R(E)]||`Add`)),B(`click`,n,()=>void pe()),H(e,t)};W(s,e=>{R(se)?e(c):R(le)?e(l,1):e(u,-1)}),H(e,n)};W(r,e=>{R(c)===`group`?e(i):R(c)===`table`?e(a,1):e(s,-1)});var l=I(r,2),u=e=>{var t=ZD(),n=F(t,!0);L(()=>U(n,R(m))),H(e,t)};W(l,e=>{R(m)&&e(u)}),H(e,n)},a=Y(t,`required`,3,!1),o=Y(t,`depth`,3,0),s=Y(t,`bare`,3,!1),c=A(()=>eD(t.schema,t.value)),l=A(()=>R(c)===`group`||R(c)===`table`||R(c)===`list`),u=A(()=>R(l)?null:t.ctx.options(t.path)),d=A(()=>FD(t.path,t.schema,t.value,R(u))),f=A(()=>t.ctx.locked(t.path)),p=j(``),m=A(()=>R(p)||t.ctx.problem?.(t.path)||``),h=async e=>{M(p,await t.ctx.save(t.path,e)??``,!0)},g=A(()=>typeof t.value==`object`&&t.value!==null&&!Array.isArray(t.value)?t.value:{}),_=A(()=>Array.isArray(t.value)?t.value:[]),v=A(()=>MD(t.path,t.value,t.ctx.stack(),t.as)),y=A(()=>R(v)?[...R(v).fields,...R(v).own??[]]:Object.keys(t.schema.properties??{})),b=A(()=>Object.keys(R(g)).filter(e=>!R(y).includes(e))),x=A(()=>R(v)?R(v).fields:Object.keys(t.schema.properties??{})),S=A(()=>R(v)?.inline&&!R(b).length?R(v).inline:void 0),C=A(()=>R(v)?[R(v).label,R(v).say].filter(Boolean).join(`: `):t.name),w=e=>e===void 0?``:JSON.stringify(e,null,2),T=A(()=>(t.ctx.keys(t.path)??[]).filter(e=>!Object.hasOwn(R(g),e))),ee=A(()=>t.schema.description??``),te=A(()=>R(d)===`address`?PD(t.value):{}),E=A(()=>jD.exec(t.path)?.[1]),ne=e=>typeof e==`string`?e:``,re=A(()=>R(_).filter(e=>typeof e==`string`)),ie=A(()=>t.ctx.stack()),ae=A(()=>Object.keys(t.ctx.stack()?.signIns??{}).length),oe=j(``),se=j(null),ce=j(void 0),le=j(!1),ue=j(mn(Pr(()=>t.open??(!R(v)&&t.value!==void 0&&o()<2)))),de=A(()=>({...t.ctx,save:(e,n)=>{let r=zT(e.slice(iD(t.path,R(_).length).length).replace(/^\./,``));return`error`in r||M(se,HT(R(se),r,n),!0),Promise.resolve(null)},locked:()=>!1,fresh:!0})),fe=e=>{M(le,!1),M(ce,e?.id,!0),M(se,{...e?.start},!0)},pe=async()=>{if(R(c)===`list`){R(E)===`prereqs`?M(le,!0):R(E)||nD(t.schema.items)?fe():M(p,await t.ctx.save(iD(t.path,R(_).length),tD(t.schema.items))??``,!0);return}let e=R(oe).trim();e&&(M(p,await t.ctx.save(iD(t.path,e),tD(t.schema.additionalProperties))??``,!0),R(p)||M(oe,``))},me={prereqs:`Add a need`,secrets:`Add a secret`,localChanges:`Add a change`,consumes:`Add an app it calls…`};var he=li(),ge=P(he),_e=e=>{var n=eO();let i;var a=N(n),c=e=>{var n=QD(),r=F(n,!0);L(()=>{q(n,`title`,R(ee)),U(r,t.name)}),H(e,n)};W(a,e=>{o()<=1&&e(c)});var l=I(a,2),u=N(l),d=F(u,!0);G(I(u,2),16,()=>R(x),e=>e,(e,n)=>{var r=$D(),i=N(r),a=F(i,!0),s=I(i,2);{let e=A(()=>iD(t.path,n)),r=A(()=>cD(n)),i=A(()=>t.schema.properties?.[n]??{}),a=A(()=>o()+1);_O(s,{get path(){return R(e)},get name(){return R(r)},get schema(){return R(i)},get value(){return R(g)[n]},get ctx(){return t.ctx},bare:!0,get depth(){return R(a)}})}D(r),L(()=>{q(r,`data-key`,n),U(a,R(S)[n])}),H(e,r)}),D(l);var p=I(l,2);r(p);var h=I(p,2),_=e=>{var t=ZD(),n=F(t,!0);L(()=>U(n,R(m))),H(e,t)};W(h,e=>{R(m)&&e(_)}),D(n),L(()=>{i=K(n,1,`field line svelte-gtai80`,null,i,{locked:R(f),wide:o()>1||s()}),l.disabled=R(f),U(d,R(C))}),H(e,n)},ve=e=>{var n=nO(),a=N(n),o=F(a,!0),s=I(a,2),c=I(N(s));r(c),D(s);var l=I(s,2),u=e=>{var t=tO(),n=F(t,!0);L(()=>U(n,R(ee))),H(e,t)};W(l,e=>{R(ee)&&e(u)});var d=I(l,2);i(d),D(n),L(()=>{n.disabled=R(f),U(o,t.name)}),H(e,n)},ye=e=>{var n=sO();let a;var o=N(n),s=N(o);X(N(s),{get of(){return NT},size:10}),D(s);var c=I(s,2),l=e=>{DE(e,{get kind(){return R(v).kind},label:``})},u=e=>{var t=rO();X(N(t),{get of(){return R(v).icon},size:15}),D(t),H(e,t)};W(c,e=>{R(v)?.kind?e(l):R(v)?.icon&&e(u,1)});var d=I(c,2),p=e=>{var t=iO(),n=N(t),r=F(n,!0),i=F(I(n),!0);D(t),L(()=>{U(r,R(v).label),U(i,R(v).say)}),H(e,t)},m=e=>{var n=oO(),r=P(n),i=F(r,!0),a=I(r,2),o=e=>{H(e,aO())};W(a,e=>{t.value===void 0&&e(o)}),L(()=>U(i,t.name)),H(e,n)};W(d,e=>{R(v)?e(p):e(m,-1)});var h=I(d,2);r(h),D(o);var g=I(o,2),_=N(g),y=F(_,!0),b=I(_,2),x=e=>{var t=tO(),n=F(t,!0);L(()=>U(n,R(ee))),H(e,t)};W(b,e=>{R(ee)&&!R(v)&&e(x)});var S=I(b,2);i(S),D(g),D(n),L(()=>{a=K(n,1,`nest svelte-gtai80`,null,a,{rowed:!!R(v)}),q(o,`title`,R(ee)),g.disabled=R(f),U(y,R(C))}),Na(`open`,`toggle`,n,e=>M(ue,e),()=>R(ue)),H(e,n)},be=e=>{var i=gO();let o;var l=N(i);let p;var _=F(l,!0),v=I(l,2),y=e=>{{let r=A(()=>ne(t.value));NE(e,{get id(){return n},get value(){return R(r)},get options(){return R(u).options},get disabled(){return R(f)},onpick:e=>void h(e)})}},b=e=>{{let r=A(()=>ne(t.value)),i=A(()=>!!R(u).other),o=A(()=>s()?ND[t.path.split(`.`).at(-1)??``]??t.name:R(ee));BE(e,{get id(){return n},get value(){return R(r)},get options(){return R(u).options},get other(){return R(i)},get required(){return a()},get disabled(){return R(f)},get placeholder(){return R(o)},onpick:e=>void h(e)})}},x=e=>{{let n=A(()=>R(d)===`ordered`),r=A(()=>R(d)===`ordered`?`runs by default`:``);rE(e,{get value(){return R(re)},get label(){return t.name},get ordered(){return R(n)},get first(){return R(r)},get disabled(){return R(f)},onchange:e=>void h(e.length||a()||R(d)===`ordered`?e:void 0)})}},S=e=>{let n=A(()=>R(ie)?.envs??[]);{let r=A(()=>R(n).map(e=>({value:e,label:e.toUpperCase()}))),i=A(()=>t.value===void 0?R(n).slice(1):R(re));JT(e,{get options(){return R(r)},get picked(){return R(i)},get label(){return t.name},get disabled(){return R(f)},none:`The stack has no environments yet.`,ontoggle:(e,r)=>{let i=t.value===void 0?R(n).slice(1):R(re);h(R(n).filter(t=>t===e?r:i.includes(t)))}})}},C=e=>{let n=A(()=>t.path.split(`.`)[1]);{let r=A(()=>Object.entries(R(ie)?.apps??{}).filter(([e,t])=>e!==R(n)&&!t.outside).map(([e,t])=>({value:e,label:t.name??e})));JT(e,{get options(){return R(r)},get picked(){return R(re)},get label(){return t.name},get disabled(){return R(f)},none:`The stack has no other apps.`,ontoggle:(e,t)=>{let n=t?[...R(re),e]:R(re).filter(t=>t!==e);h(n.length?n:void 0)}})}},T=e=>{{let n=A(()=>Object.entries(R(ie)?.queues??{}).map(([e,t])=>({value:e,label:t.name??e}))),r=A(()=>Object.keys(R(g)));JT(e,{get options(){return R(n)},get picked(){return R(r)},get label(){return t.name},get disabled(){return R(f)},none:`The stack has no queues yet: add them in the stack's settings.`,ontoggle:(e,t)=>{let{[e]:n,...r}=R(g);h(t?{...R(g),[e]:n??{}}:Object.keys(r).length?r:void 0)}})}},E=e=>{var r=cO();ma(r),L(()=>{q(r,`id`,n),r.disabled=R(f),ga(r,t.value===!0)}),B(`change`,r,e=>void h(e.currentTarget.checked)),H(e,r)},ae=e=>{var r=lO(),i=N(r);i.value=i.__value=``,G(I(i),16,()=>t.schema.enum??[],e=>e,(e,t)=>{var n=HD(),r=F(n,!0),i={};L(e=>{U(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>String(t)]),H(e,n)}),D(r);var a;ta(r),L(()=>{q(r,`id`,n),r.disabled=R(f),a!==(a=t.value??``)&&(r.value=(r.__value=a)??``,ea(r,a))}),B(`change`,r,e=>void h(e.currentTarget.value||void 0)),H(e,r)},oe=e=>{var r=uO();ma(r),L(e=>{q(r,`id`,n),r.disabled=R(f),q(r,`placeholder`,e),ha(r,typeof t.value==`number`||typeof t.value==`string`?t.value:``)},[()=>s()?ND[t.path.split(`.`).at(-1)??``]??t.name:R(ee)]),B(`change`,r,e=>{let t=e.currentTarget.value.trim();h(t===``?void 0:Number.isFinite(Number(t))?Number(t):t)}),H(e,r)},se=e=>{var r=dO();ma(r),L(e=>{q(r,`id`,n),r.disabled=R(f),q(r,`inputmode`,R(d)===`address`?`url`:void 0),q(r,`spellcheck`,R(d)!==`address`&&void 0),q(r,`aria-invalid`,R(te).warn?!0:void 0),q(r,`placeholder`,e),ha(r,typeof t.value==`string`?t.value:``)},[()=>s()?ND[t.path.split(`.`).at(-1)??``]??t.name:R(ee)]),B(`change`,r,e=>void h(e.currentTarget.value===``?void 0:e.currentTarget.value)),H(e,r)},ce=A(()=>R(c)===`text`&&!(typeof t.value==`string`&&(t.value.length>60||t.value.includes(`
|
|
35
|
+
`))&&!s())),le=e=>{var r=fO();yt(r),L(()=>{q(r,`id`,n),r.disabled=R(f),q(r,`placeholder`,R(ee)),ha(r,typeof t.value==`string`?t.value:``)}),B(`change`,r,e=>void h(e.currentTarget.value===``?void 0:e.currentTarget.value)),H(e,r)},ue=e=>{var r=pO();yt(r),L((e,t)=>{q(r,`id`,n),q(r,`rows`,e),r.disabled=R(f),q(r,`placeholder`,R(ee)||`JSON`),ha(r,t)},[()=>Math.min(10,w(t.value).split(`
|
|
36
|
+
`).length+1),()=>w(t.value)]),B(`change`,r,e=>{let t=e.currentTarget.value.trim();if(!t)h(void 0);else try{h(JSON.parse(t))}catch{h(t)}}),H(e,r)};W(v,e=>{R(d)===`kind`&&R(u)?e(y):R(d)===`pick`&&R(u)?e(b,1):R(d)===`ordered`||R(d)===`chips`?e(x,2):R(d)===`envs`?e(S,3):R(d)===`apps`?e(C,4):R(d)===`queues`?e(T,5):R(c)===`switch`?e(E,6):R(c)===`choice`?e(ae,7):R(c)===`number`?e(oe,8):R(ce)?e(se,9):R(c)===`text`?e(le,10):e(ue,-1)});var de=I(v,2),fe=e=>{r(e)};W(de,e=>{s()||e(fe)});var pe=I(de,2),me=e=>{var t=mO(),n=F(t,!0);L(()=>U(n,R(te).warn)),H(e,t)},he=e=>{var t=hO(),n=F(t,!0);L(()=>U(n,R(te).note)),H(e,t)};W(pe,e=>{R(te).warn?e(me):R(te).note&&e(he,1)});var ge=I(pe,2),_e=e=>{var t=ZD(),n=F(t,!0);L(()=>U(n,R(m))),H(e,t)};W(ge,e=>{R(m)&&e(_e)}),D(i),L(()=>{o=K(i,1,`field svelte-gtai80`,null,o,{locked:R(f),bare:s()}),p=K(l,1,`name svelte-gtai80`,null,p,{sr:s()}),q(l,`for`,n),q(l,`title`,R(ee)),U(_,t.name)}),H(e,i)};W(ge,e=>{R(S)?e(_e):R(l)&&!R(d)&&o()===0?e(ve,1):R(l)&&!R(d)?e(ye,2):e(be,-1)}),H(e,he),k()}Qr([`click`,`change`]);var vO=V(`<p class="none svelte-orrnu3"> </p>`),yO=V(`<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>`),bO=V(`<option> </option>`),xO=V(`<select class="svelte-orrnu3"><option>Its own value for another field…</option><!></select>`),SO=V(`<section class="env svelte-orrnu3"><h3 class="svelte-orrnu3"> </h3> <!> <!></section>`),CO=V(`<!> <!>`,1);function wO(e,t){O(t,!0);let n=A(()=>v(t.envs)),r=A(()=>_(R(n)[0],`qa`)),i=A(()=>R(n).slice(1)),a=e=>t.app.envs?.[e]??{},o=A(()=>typeof t.schema.properties?.envs?.additionalProperties==`object`?t.schema.properties.envs.additionalProperties:{}),s=e=>R(o).properties?.[e]??t.schema.properties?.[e]??{},c=e=>[...new Set([..._D,...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?tD(s(e)):JSON.parse(JSON.stringify(n))},f=(e,n)=>iD(iD(iD(t.path,`envs`),e),n);var p=CO(),m=P(p),h=e=>{var t=vO(),n=F(t);L(e=>U(n,`The stack has one environment, ${e??``}: there is nothing to differ from.`),[()=>R(r).toUpperCase()]),H(e,t)};W(m,e=>{R(i).length||e(h)}),G(I(m,2),16,()=>R(i),e=>e,(e,n)=>{let i=A(()=>R(r).toUpperCase()),o=A(()=>n.toUpperCase());var l=SO(),p=N(l),m=F(p),h=I(p,2);G(h,16,()=>c(n),e=>e,(e,r)=>{var c=li(),l=P(c),u=e=>{{let o=A(()=>f(n,r)),c=A(()=>cD(r)),l=A(()=>s(r)),u=A(()=>a(n)[r]);_O(e,{get path(){return R(o)},get name(){return R(c)},get schema(){return R(l)},get value(){return R(u)},get ctx(){return t.ctx},depth:1,get drop(){return`Use ${R(i)??``}'s`}})}},p=A(()=>a(n)[r]!==void 0),m=e=>{var a=yO(),s=N(a),c=F(s,!0),l=I(s,2),u=F(l),p=I(l,2),m=F(p);D(a),L((e,t,n)=>{U(c,e),q(l,`title`,t),U(u,`Same as ${R(i)??``}: ${n??``}`),U(m,`Change for ${R(o)??``}`)},[()=>cD(r),()=>bD(t.app[r]),()=>bD(t.app[r])]),B(`click`,p,()=>void t.ctx.save(f(n,r),d(r))),H(e,a)};W(l,e=>{R(p)?e(u):e(m,-1)}),H(e,c)});var g=I(h,2),_=e=>{var r=xO(),i=N(r);i.value=i.__value=``,G(I(i),16,()=>u(n),e=>e,(e,t)=>{var n=bO(),r=F(n,!0),i={};L(e=>{U(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>cD(t)]),H(e,n)}),D(r),r.value=r.__value=``,L(()=>q(r,`aria-label`,`Give ${R(o)??``} its own value for another field`)),B(`change`,r,e=>{let r=e.currentTarget.value;e.currentTarget.value=``,r&&t.ctx.save(f(n,r),d(r))}),H(e,r)},v=A(()=>u(n).length);W(g,e=>{R(v)&&e(_)}),D(l),L(()=>{q(l,`aria-label`,`What ${R(o)??``} uses`),U(m,`${R(o)??``} uses`)}),H(e,l)}),H(e,p),k()}Qr([`click`,`change`]);var TO=V(`<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>`),EO=V(`<div class="head svelte-6g11qq"></div>`),DO=V(`<span class="badge svelte-6g11qq"> </span>`),OO=V(`<button type="button" role="tab"> <!></button>`),kO=V(`<div class="tabs svelte-6g11qq" role="tablist"></div>`),AO=V(`<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>`),jO=V(`<ul class="apps svelte-6g11qq"></ul>`),MO=V(`<details class="others svelte-6g11qq"><summary class="svelte-6g11qq"><span class="chev svelte-6g11qq"><!></span>Fields for other kinds of app</summary> <!></details>`),NO=V(`<!> <!>`,1),PO=V(`<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),FO=V(`<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),IO=V(`<!> <!> <div class="body svelte-6g11qq" role="tabpanel"><!></div> <footer><!></footer>`,1),LO=V(`<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 RO(e,t){O(t,!0);let n=j(void 0),r=j(``),i=j(``),a=j(null),o=j(null),s=j(null),c=j(mn([])),l=j(mn(new Map)),u=j(0),d=j(!1),f=j(!1),p=j(!1),m=!1,h=j(!1),g={awsProfiles:[],files:[],profiles:{},scripts:{}},_=j(mn(g)),y=e=>{let t=zT(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=A(()=>R(s)?b(R(s),R(i)):{}),S=A(()=>R(i)?VT(R(o),y(R(i))):R(o)),C=A(()=>/^apps\.[a-z0-9-]+$/.test(R(i))?R(i).slice(5):null),w=A(()=>!!R(C)&&!!R(S)?.outside),T=A(()=>R(C)?uD:R(i)?[]:hD),ee=A(()=>{let e=R(C)?R(w)?mD:pD:R(i)?[]:gD,t=new Set([...R(T),...e.flatMap(e=>e.keys)]),n=[...Object.keys(R(x).properties??{}),...Object.keys(R(S)??{})].filter(e=>!t.has(e)),r=[...new Set(n)],a=R(i)?MD(R(i),R(S),R(o)):void 0;return a?[{name:`Settings`,keys:[...new Set([...a.fields,...Object.keys(R(S)??{})])]}]:e.length?r.length?[...e,{name:`Other`,keys:r}]:e:[{name:`Settings`,keys:r}]}),te=A(()=>R(ee)[Math.min(R(u),R(ee).length-1)]),E=A(()=>xD(R(a),R(o))),ne=e=>[...R(l).keys()].filter(t=>e.some(e=>yD(t,iD(R(i),e)))).length;async function re(e){M(r,e.title,!0),M(i,e.path,!0),m=!1,M(h,!1),M(p,!1),M(f,!1),M(u,0),M(l,new Map,!0),M(c,Q.status?.locks??[],!0);let t=/^apps\.([a-z0-9-]+)$/.exec(e.path)?.[1]??``,[d,v,y]=await Promise.all([R(s)?Promise.resolve(R(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)]);M(_,{...g,...y},!0),M(s,d);let{source:b,found:x,...S}=v;M(a,S),M(o,JSON.parse(JSON.stringify(S))),R(n)?.showModal()}let ie=e=>e.map(e=>({value:e,label:e})),ae=(e,t=!0)=>({options:ie(e),other:t}),oe=e=>R(_).files.filter(t=>e.test(t)),se={save:(e,t)=>(M(o,HT(R(o),y(e),t)),M(p,!1),R(l).has(e)&&M(l,new Map([...R(l)].filter(([t])=>t!==e)),!0),Promise.resolve(null)),locked:e=>lD(R(c),e),lock:(e,t)=>{Co(`stack-lock`,{path:e,on:t}).then(n=>{`error`in n||M(c,t?[...R(c),e]:R(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(VT(R(o),[`queues`])??{}):null,problem:e=>R(l).get(e),options:e=>{let t=/(?:^|\.)([A-Za-z]+)$/.exec(e)?.[1]??``,n=R(o)??{},r=R(S)??{};if(t===`kind`&&/^apps\.[a-z0-9-]+\.kind$/.test(e))return{options:[...Object.entries(cs).map(([e,t])=>({value:e,label:t.label,kind:e})),...Object.entries(n.kinds??{}).filter(([e])=>!Object.hasOwn(cs,e)).map(([e,t])=>({value:e,label:t.label??e,kind:e}))]};if(t===`sso`)return ae(R(_).awsProfiles);if(t===`signIn`)return ae(Object.keys(n.signIns??{}),!1);if(t===`how`&&/consumes/.test(e))return{options:DD};if(t===`type`&&/secrets\[\d+\]\.type$/.test(e))return{options:IT.map(e=>({value:e,label:cD(e)})),other:!0};if(!R(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(R(_).profiles));if(t===`baseProfile`){let e=typeof r.launchSettings==`string`?r.launchSettings:``,t=R(_).profiles[e]??[...new Set(Object.values(R(_).profiles).flat())];return ae(t)}return t===`script`?ae(R(_).scripts[`package.json`]??Object.values(R(_).scripts)[0]??[]):t===`defineFile`?ae(oe(/\.(json|env)$/).filter(e=>!/(^|\/)package(-lock)?\.json$/.test(e))):t===`template`?ae(oe(/\.ya?ml$/)):t===`file`?ae(R(_).files):null},stack:()=>R(o)},ce=async()=>{M(d,!0);let e=await Co(`stack-save`,{stack:R(o)});if(M(d,!1),`error`in e){let t=e.problems??[];M(l,t.length?vD(t):new Map([[``,e.error]]),!0);let n=R(ee).findIndex(e=>ne(e.keys));n>=0&&M(u,n,!0)}else M(a,JSON.parse(JSON.stringify(R(o)))),M(l,new Map,!0),M(p,!0),m=!0},le=()=>{M(o,JSON.parse(JSON.stringify(R(a)))),M(l,new Map,!0)},ue=()=>{R(E)&&!R(f)?M(f,!0):(R(n)?.close(),m&&Z.reload())};var de={open:re},fe=LO(),pe=N(fe),me=N(pe),he=F(me,!0),ge=I(me,2),_e=e=>{var t=TO(),n=N(t);X(n,{get of(){return FT},size:14});var r=I(n,1,!0);D(t),L(()=>{t.disabled=R(h),U(r,R(h)?`Asked the agent`:`Ask the agent to fill in`)}),B(`click`,t,async()=>{M(h,await Xb.askFill(R(C),Object.keys(R(x).properties??{}).filter(e=>R(S)?.[e]===void 0&&e!==`outside`),R(c).filter(e=>e.startsWith(`apps.${R(C)}.`))),!0)}),H(e,t)};W(ge,e=>{R(C)&&!R(w)&&e(_e)});var ve=I(ge,2);X(N(ve),{get of(){return to},size:14}),D(ve),D(pe);var ye=I(pe,2),be=e=>{var t=IO(),n=P(t),a=e=>{var t=EO();G(t,20,()=>R(T),e=>e,(e,t)=>{{let n=A(()=>iD(R(i),t)),r=A(()=>cD(t,!R(i))),a=A(()=>R(x).properties?.[t]??{}),o=A(()=>R(S)?.[t]),s=A(()=>!!R(x).required?.includes(t));_O(e,{get path(){return R(n)},get name(){return R(r)},get schema(){return R(a)},get value(){return R(o)},get ctx(){return se},get required(){return R(s)},depth:1})}}),D(t),H(e,t)};W(n,e=>{R(T).length&&e(a)});var o=I(n,2),s=e=>{var t=kO();G(t,23,()=>R(ee),e=>e.name,(e,t,n)=>{let r=A(()=>ne(R(t).keys));var i=OO();let a;var o=N(i,!0),s=I(o),c=e=>{var t=DO(),n=F(t,!0);L(()=>{q(t,`aria-label`,`${R(r)??``} to fix`),U(n,R(r))}),H(e,t)};W(s,e=>{R(r)&&e(c)}),D(i),L(()=>{q(i,`aria-selected`,R(te)===R(t)),a=K(i,1,`svelte-6g11qq`,null,a,{wrong:R(r)>0}),U(o,R(t).name)}),B(`click`,i,()=>M(u,R(n),!0)),H(e,i)}),D(t),L(()=>q(t,`aria-label`,`${R(r)??``} settings`)),H(e,t)};W(o,e=>{R(ee).length>1&&e(s)});var c=I(o,2),m=N(c),h=e=>{wO(e,{get path(){return R(i)},get app(){return R(S)},get schema(){return R(x)},get envs(){return Z.envs},get ctx(){return se}})},g=e=>{var t=jO();G(t,21,()=>Object.entries(R(S)?.apps??{}),([e,t])=>e,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1];var a=AO(),o=N(a);{let e=A(()=>i().kind??`other`);DE(o,{get kind(){return R(e)},label:``})}var s=I(o,2),c=F(s,!0),l=I(s,2),u=F(l,!0),d=I(l,2);D(a),L(e=>{U(c,i().name??r()),U(u,e),d.disabled=R(E)>0,q(d,`title`,R(E)?`Save or discard your changes first`:void 0)},[()=>(Object.hasOwn(cs,i().kind??``)?cs[i().kind??``]?.label:null)??i().kind??``]),B(`click`,d,()=>void re({title:i().name??r(),path:`apps.${r()}`})),H(e,a)}),D(t),H(e,t)},_=e=>{let t=A(()=>typeof R(S)?.kind==`string`?R(S).kind:``),n=A(()=>dD[R(t)]??[]),r=A(()=>R(te).keys.filter(e=>fD.includes(e)&&!R(n).includes(e)&&R(S)?.[e]===void 0));var a=NO(),o=P(a);G(o,16,()=>R(te).keys.filter(e=>!R(r).includes(e)),e=>e,(e,t)=>{{let n=A(()=>iD(R(i),t)),r=A(()=>cD(t,!R(i))),a=A(()=>R(x).properties?.[t]??{}),o=A(()=>R(S)?.[t]),s=A(()=>!!R(x).required?.includes(t)),c=A(()=>R(te).keys.length===1?0:1);_O(e,{get path(){return R(n)},get name(){return R(r)},get schema(){return R(a)},get value(){return R(o)},get ctx(){return se},get required(){return R(s)},get depth(){return R(c)}})}});var s=I(o,2),c=e=>{var t=MO(),n=N(t),a=N(n);X(N(a),{get of(){return NT},size:10}),D(a),Me(),D(n),G(I(n,2),16,()=>R(r),e=>e,(e,t)=>{{let n=A(()=>iD(R(i),t)),r=A(()=>cD(t)),a=A(()=>R(x).properties?.[t]??{}),o=A(()=>R(S)?.[t]);_O(e,{get path(){return R(n)},get name(){return R(r)},get schema(){return R(a)},get value(){return R(o)},get ctx(){return se},depth:1})}}),D(t),H(e,t)};W(s,e=>{R(r).length&&e(c)}),H(e,a)};W(m,e=>{R(te)?.view===`envs`&&R(C)&&R(S)?e(h):R(te)?.view===`apps`?e(g,1):R(te)&&e(_,2)}),D(c);var y=I(c,2);let b;var w=N(y),ie=e=>{var t=PO(),n=P(t),r=F(n),i=I(n,2),a=I(i,2);L(()=>U(r,`Close without saving ${R(E)??``} ${R(E)===1?`change`:`changes`}?`)),B(`click`,i,()=>M(f,!1)),B(`click`,a,()=>{le(),ue()}),H(e,t)},ae=e=>{var t=FO(),n=P(t),r=N(n),i=e=>{var t=ci();L(e=>U(t,e),[()=>R(l).get(``)??`${String(R(l).size)} to fix before it can be saved`]),H(e,t)},a=e=>{var t=ci();L(()=>U(t,`${R(E)??``} ${R(E)===1?`change`:`changes`}, not saved yet`)),H(e,t)},o=e=>{H(e,ci(`Saved`))},s=e=>{H(e,ci(`No changes`))};W(r,e=>{R(l).size?e(i):R(E)?e(a,1):R(p)?e(o,2):e(s,-1)}),D(n);var c=I(n,2),u=I(c,2),f=F(u,!0);L(()=>{c.disabled=!R(E)||R(d),u.disabled=!R(E)||R(d),U(f,R(d)?`Saving…`:`Save`)}),B(`click`,c,le),B(`click`,u,()=>void ce()),H(e,t)};W(w,e=>{R(f)&&R(E)?e(ie):e(ae,-1)}),D(y),L(()=>{q(c,`aria-label`,R(te)?.name),b=K(y,1,`svelte-6g11qq`,null,b,{dirty:R(E)>0})}),H(e,t)};return W(ye,e=>{R(s)&&R(o)&&e(be)}),D(fe),Ma(fe,e=>M(n,e),()=>R(n)),L(()=>U(he,R(r))),z(`cancel`,fe,e=>{e.preventDefault(),ue()}),B(`click`,fe,e=>{e.target===R(n)&&ue()}),B(`click`,ve,ue),H(e,fe),k(de)}Qr([`click`]);var zO=V(`<span> </span>`),BO=V(`<option> </option>`),VO=V(`<select class="svelte-1psun92"><option>Kind?</option><!></select>`),HO=V(`<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>`),UO=V(`<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=V(`<p class="none svelte-1psun92"> </p>`),GO=V(`<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 KO(e,t){O(t,!0);let n=j(void 0),r=j(null),i=j(``),a=j(``),o=j(!1),s=new R_,c=A(()=>(R(r)?.repos??[]).filter(e=>!e.inStack)),l=A(()=>R(c).filter(e=>`${e.name} ${e.slug} ${e.folder}`.toLowerCase().includes(R(i).trim().toLowerCase()))),u=A(()=>[...new Set(R(l).map(e=>e.folder))]),d=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;async function f(){s.clear(),M(i,``),M(a,``),M(r,await wo()),R(n)?.showModal()}let p=(e,t,n={})=>{M(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=R(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=R(c).find(e=>s.has(e.slug)&&!s.get(e.slug)?.kind);if(e){M(a,`Choose what kind of app ${e.name} is.`);return}M(o,!0);let t=await Co(`apps`,{apps:[...s].map(([e,{name:t,kind:n}])=>({slug:e,name:t.trim()||e,kind:n}))});M(o,!1),`error`in t?M(a,t.error,!0):(R(n)?.close(),Gb.findings?Gb.findings.open({afterAdding:!0}):location.reload())};var g={open:f},_=GO(),y=N(_);X(N(y),{get of(){return to},size:14}),D(y);var b=I(y,2),x=F(b),S=I(b,2),C=N(S),w=e=>{var t=ci();L(e=>U(t,`Tick every repo you might want to run in ${Z.stack??``}: this is the full list you will choose from. Which ones run
|
|
37
|
+
together is decided later on the board. Koppler found ${R(c).length??``} on this Mac, under ${e??``}.`),[()=>R(r).roots.join(`, `)]),H(e,t)},T=e=>{H(e,ci(`No scan of your repos yet. Run koppler init.`))};W(C,e=>{R(r)?e(w):e(T,-1)}),D(S);var ee=I(S,2);ma(ee);var te=I(ee,2);G(te,20,()=>R(u),e=>e,(e,t)=>{let n=A(()=>R(l).filter(e=>e.folder===t)),r=A(()=>R(n).filter(e=>s.has(e.slug)).length);var i=UO(),a=N(i),o=N(a),c=F(o,!0),u=I(o,2),f=F(u),h=I(u,2),g=F(h,!0);D(a),G(I(a,2),17,()=>R(n),e=>e.slug,(e,t)=>{let n=A(()=>s.get(R(t).slug));var r=HO();let i;var a=N(r);ma(a);var o=I(a,2),c=N(o);ma(c);var l=I(c,2),u=F(l,!0);D(o);var d=I(o,2),f=e=>{var n=zO(),r=F(n,!0);L(e=>{K(n,1,`kind kind-${R(t).kind??``}`,`svelte-1psun92`),U(r,e)},[()=>xs({kind:R(t).kind}).label]),H(e,n)},m=e=>{var r=VO(),i=N(r);i.value=i.__value=``,G(I(i),17,()=>Object.entries(cs),([e,{label:t}])=>e,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1].label;var a=BO(),o=F(a,!0),s={};L(()=>{U(o,i()),s!==(s=r())&&(a.value=(a.__value=s)??``)}),H(e,a)}),D(r);var a;ta(r),L(()=>{q(r,`aria-label`,`Kind of app for ${R(t).name??``}`),a!==(a=R(n)?.kind??``)&&(r.value=(r.__value=a)??``,ea(r,a))}),B(`change`,r,e=>{p(R(t),!0,{kind:e.currentTarget.value})}),H(e,r)};W(d,e=>{R(t).kind?e(f):e(m,-1)}),D(r),L(()=>{i=K(r,1,`pick svelte-1psun92`,null,i,{on:!!R(n)}),q(a,`aria-label`,`Add ${R(t).name??``}`),ga(a,!!R(n)),q(c,`aria-label`,`Name of ${R(t).slug??``} in the stack`),ha(c,R(n)?.name??R(t).name),q(l,`title`,R(t).path),U(u,R(t).slug)}),B(`change`,a,e=>{p(R(t),e.currentTarget.checked)}),B(`input`,c,e=>{R(n)&&p(R(t),!0,{name:e.currentTarget.value})}),H(e,r)}),D(i),L((e,n,r)=>{U(c,t),U(f,`${e??``}${n??``}`),U(g,r)},[()=>d(R(n).length,`repo`),()=>R(r)?`, ${String(R(r))} picked`:``,()=>R(r)===R(n).length?`Clear these`:`Pick all ${String(R(n).length)}`]),B(`click`,h,()=>{m(t)}),H(e,i)},e=>{var t=WO(),n=F(t,!0);L(()=>U(n,R(c).length?`No repo matches.`:`Every clone found is already in the stack.`)),H(e,t)}),D(te);var E=I(te,2),ne=F(E,!0),re=I(E,2),ie=N(re),ae=F(ie,!0),oe=I(ie,2),se=I(oe,2),ce=F(se,!0);return D(re),D(_),Ma(_,e=>M(n,e),()=>R(n)),L((e,t)=>{U(x,`${Z.apps.length?`Add repos to`:`Add your repos to`} ${Z.stack??``}`),U(ne,R(a)),U(ae,e),se.disabled=!s.size||R(o),U(ce,t)},[()=>s.size?`${String(s.size)} picked`:`Nothing picked yet`,()=>R(o)?`Adding…`:s.size?`Add ${d(s.size,`app`)}`:`Add apps`]),z(`cancel`,_,e=>{s.size&&e.preventDefault()}),B(`click`,y,()=>R(n)?.close()),Sa(ee,()=>R(i),e=>M(i,e)),B(`click`,oe,()=>R(n)?.close()),B(`click`,se,h),H(e,_),k(g)}Qr([`click`,`change`,`input`]);var qO=V(`<button type="button" class="cable svelte-yroiop"> </button>`),JO=V(`<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>`),YO=V(`<label class="branch svelte-yroiop">Branch <!></label>`),XO=V(`<label class="svelte-yroiop"> <select class="svelte-yroiop"><option>Set aside until Stop</option><option>Take along</option></select></label>`),ZO=V(`<option> </option>`),QO=V(`<label class="svelte-yroiop">Started by <select class="svelte-yroiop"></select></label>`),$O=V(`<label class="check svelte-yroiop"><input type="checkbox" role="switch" class="svelte-yroiop"/> Tunnels</label>`),ek=V(`<!> <span class="controls svelte-yroiop"><!> <!> <!> <!></span>`,1);function tk(e,t){O(t,!0);let n=A(()=>Z.app(t.id)),r=A(()=>Z.cards.find(e=>e.id===t.id)?.data),i=A(()=>Z.uncabled(t.id)?Z.cablesOf(t.id).can:[]),a=A(()=>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),Xb.again()},s=e=>{Z.set(t.id,e),Xb.again()};var c=li(),l=P(c),u=e=>{var c=ek(),l=P(c),u=e=>{var r=JO(),s=I(N(r),2),c=N(s);G(c,17,()=>R(a).slice(0,3),e=>e.id,(e,n)=>{var r=qO(),i=F(r);L(()=>U(i,`${R(n).name??``} calls it`)),B(`click`,r,()=>{o(R(n).id,t.id)}),H(e,r)});var l=I(c,2);G(l,17,()=>R(i).slice(0,3),e=>e.id,(e,n)=>{var r=qO(),i=F(r);L(()=>U(i,`It calls ${R(n).name??``}`)),B(`click`,r,()=>{o(t.id,R(n).id)}),H(e,r)});var u=I(l,2),d=I(u,2);D(s),D(r),L(()=>q(r,`aria-label`,`${R(n).name??``} is not cabled`)),B(`click`,u,()=>{Xb.onItsOwn[t.id]=!0}),B(`click`,d,()=>{Xb.leftOut[t.id]=!0,Xb.again()}),H(e,r)};W(l,e=>{(R(i).length||R(a).length)&&!Xb.onItsOwn[t.id]&&e(u)});var d=I(l,2),f=N(d),p=e=>{var t=YO();fb(I(N(t)),{get value(){return R(r).branch},get current(){return R(n).current},get branches(){return R(n).branches},onpick:e=>{s({branch:e})}}),D(t),H(e,t)};W(f,e=>{R(n).branches.length&&R(r).run!==`mock`&&e(p)});var m=I(f,2),h=e=>{var t=XO(),i=N(t),a=I(i),o=N(a);o.value=o.__value=`set-aside`;var c=I(o);c.value=c.__value=`take-along`,D(a);var l;ta(a),D(t),L(()=>{U(i,`${R(n).dirty??``} uncommitted on ${R(n).current??``} `),l!==(l=R(r).changes??`set-aside`)&&(a.value=(a.__value=l)??``,ea(a,l))}),B(`change`,a,e=>{s({changes:e.currentTarget.value===`take-along`?`take-along`:`set-aside`})}),H(e,t)},g=A(()=>Z.switchesOver(t.id));W(m,e=>{R(g)&&e(h)});var _=I(m,2),y=e=>{var t=QO(),i=I(N(t));G(i,21,()=>R(n).runIn,([e])=>e,(e,t)=>{var n=A(()=>v(R(t),1));let r=()=>R(n)[0];var i=ZO(),a=F(i,!0),o={};L(()=>{U(a,Qs[r()]??r()),o!==(o=r())&&(i.value=(i.__value=o)??``)}),H(e,i)}),D(i);var a;ta(i),D(t),L(()=>{a!==(a=R(r).run)&&(i.value=(i.__value=a)??``,ea(i,a))}),B(`change`,i,e=>{s({run:e.currentTarget.value})}),H(e,t)};W(_,e=>{R(n).runIn.length>1&&e(y)});var b=I(_,2),x=e=>{var t=$O(),n=N(t);ma(n),Me(),D(t),L(()=>ga(n,!R(r).hideTunnels)),B(`change`,n,e=>{s({hideTunnels:!e.currentTarget.checked})}),H(e,t)},S=A(()=>Z.tunnelsOf(t.id).length);W(b,e=>{R(S)&&e(x)}),D(d),H(e,c)};W(l,e=>{R(n)&&R(r)&&e(u)}),H(e,c),k()}Qr([`click`,`change`]);var nk=V(`<button class="mini svelte-pzq2er" type="button"> </button>`),rk=V(`<p> <!></p>`),ik=V(`<small> </small>`),ak=V(`<span> <!> <!> <!></span>`),ok=V(`<ul class="lines svelte-pzq2er"><li class="svelte-pzq2er"><span class="verb svelte-pzq2er"> </span> <span class="apps svelte-pzq2er"></span></li></ul>`),sk=V(`<button class="back svelte-pzq2er" type="button"> </button>`),ck=V(`<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),lk=V(`<dialog aria-labelledby="review-title" class="svelte-pzq2er"><!></dialog>`);function uk(e,t){O(t,!0);let n=j(void 0),r=A(()=>Xb.review);Ln(()=>{R(r)&&!R(n)?.open?R(n)?.showModal():!R(r)&&R(n)?.open&&R(n).close()});var i=lk(),a=N(i),o=e=>{var t=ck(),n=P(t),i=F(n,!0),a=I(n,2),o=F(a,!0),s=I(a,2),c=N(s);G(c,17,()=>R(r).notices,Di,(e,t)=>{var n=rk();let r;var i=N(n),a=I(i),o=e=>{var n=nk(),r=F(n,!0);L(()=>U(r,R(t).act.label)),B(`click`,n,function(...e){R(t).act.run?.apply(this,e)}),H(e,n)};W(a,e=>{R(t).act&&e(o)}),D(n),L(()=>{r=K(n,1,`notice svelte-pzq2er`,null,r,{prod:R(t).kind===`prod`}),U(i,`${R(t).text??``} `)}),H(e,n)}),G(I(c,2),17,()=>R(r).groups,Di,(e,t)=>{var n=ok(),r=N(n),i=N(r),a=F(i,!0),o=I(i,2);G(o,21,()=>R(t).items,Di,(e,t,n,r)=>{var i=ak();let a;var o=N(i),s=I(o),c=e=>{var n=nk(),r=F(n,!0);L(()=>{q(n,`title`,R(t).act.title),U(r,R(t).act.label)}),B(`click`,n,function(...e){R(t).act.run?.apply(this,e)}),H(e,n)};W(s,e=>{R(t).act&&e(c)});var l=I(s,2);G(l,17,()=>R(t).notes,Di,(e,t,n,r)=>{var i=ik(),a=F(i,!0);L(()=>{K(i,1,Ui(R(t).kind),`svelte-pzq2er`),q(i,`title`,R(t).title),U(a,R(t).text)}),H(e,i)});var u=I(l,2),d=e=>{tk(e,{get id(){return R(t).id}})};W(u,e=>{R(t).id&&e(d)}),D(i),L(()=>{a=K(i,1,`svelte-pzq2er`,null,a,{off:R(t).off}),U(o,`${R(t).name??``} `)}),H(e,i)}),D(o),D(r),D(n),L(()=>{q(i,`data-verb`,R(t).verb),U(a,R(t).label)}),H(e,n)}),D(s);var l=I(s,2),u=N(l),d=e=>{var t=sk(),n=F(t,!0);L(()=>U(n,R(r).back.label)),B(`click`,t,()=>{let{back:e}=R(r);Xb.review=null,e?.run()}),H(e,t)};W(u,e=>{R(r).back&&e(d)});var f=I(u,2),p=I(f,2);let m;var h=F(p,!0);D(l),L(()=>{U(i,R(r).title),U(o,R(r).sub),m=K(p,1,`ok svelte-pzq2er`,null,m,{prod:R(r).prod}),p.disabled=R(r).blocked,U(h,R(r).ok)}),B(`click`,f,()=>{Xb.review=null}),B(`click`,p,()=>{Xb.confirm()}),H(e,t)};W(a,e=>{R(r)&&e(o)}),D(i),Ma(i,e=>M(n,e),()=>R(n)),z(`close`,i,()=>{R(n)?.open||(Xb.review=null)}),H(e,i),k()}Qr([`click`]);var dk=new class{#e=j(null);get switching(){return R(this.#e)}set switching(e){M(this.#e,e,!0)}useStack(e){Xb.idle?this.#n(e.dir):Xb.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 Co(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:[]}))}];Xb.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:()=>{Xb.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){Xb.idle?e():Xb.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 Co(`stack`,{use:e});t.error?(this.switching=null,$.show(t.error,`warning`)):location.reload()}},fk=V(`<button class="x svelte-8d6d0q" type="button" aria-label="Close"><!></button>`),pk=V(`<!> <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
|
|
38
|
+
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),mk=V(`<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>`),hk=V(`<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),gk=V(`<small class="svelte-8d6d0q">default</small>`),_k=V(`<span class="tag svelte-8d6d0q"> <!> <button type="button" class="svelte-8d6d0q"><!></button></span>`),vk=V(`<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),yk=V(`<dialog aria-labelledby="setup-title" class="svelte-8d6d0q"><!> <p class="error svelte-8d6d0q" role="alert"> </p></dialog>`);function bk(e,t){O(t,!0);let n=j(void 0),r=j(`start`),i=j(``),a=j(!1),o=j(``),s=j(``),c=j(``),l=j(mn([])),u=A(()=>Z.known);function d(e=`start`){f(e),M(o,M(s,M(c,``),!0),!0),M(l,[],!0),R(n)?.showModal()}let f=e=>{M(r,e,!0),M(i,``)},p=async e=>{M(a,!0),M(i,``);let t=await Co(`stack`,e);M(a,!1),`error`in t?M(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 M(i,`"${t}" will not work as a name: use lowercase letters, digits and dashes, e.g. qa.`),!1;if(R(l).length>=8)return M(i,`Eight environments is the most a stack can have.`),!1;R(l).includes(e)||M(l,[...R(l),e],!0)}return M(i,``),M(c,``),!0},h=e=>{[`Enter`,`,`,` `,`Tab`].includes(e.key)&&R(c).trim()?(e.preventDefault(),m(R(c))):e.key===`Backspace`&&!R(c)&&R(l).length&&M(l,R(l).slice(0,-1),!0)},g=e=>{e.preventDefault(),(!R(c).trim()||m(R(c)))&&p({name:R(s),envs:R(l)})};var _={open:d},v=yk(),y=N(v),b=e=>{var t=pk(),r=P(t),i=e=>{var t=fk();X(N(t),{get of(){return to},size:14}),D(t),B(`click`,t,()=>R(n)?.close()),H(e,t)};W(r,e=>{Z.setup||e(i)});var a=I(r,8),o=N(a),s=F(I(N(o),2),!0);D(o);var c=I(o,2);D(a),L(e=>U(s,e),[()=>R(u).length?`${String(R(u).length)} found on this Mac, or one from a link on GitHub.`:`From a link on GitHub, set up by your team.`]),B(`click`,o,()=>{f(`join`)}),B(`click`,c,()=>{f(`new`)}),H(e,t)},x=e=>{var t=hk(),n=P(t),r=I(n,4),i=F(r,!0),s=I(r,2);G(s,17,()=>R(u),e=>e.dir,(e,t)=>{var n=mk(),r=N(n),i=N(r),o=F(i,!0),s=I(i,2),c=F(s),l=I(s,2),u=F(l,!0);D(r);var d=I(r,2);D(n),L(e=>{U(o,R(t).name),U(c,`${R(t).linked?`from GitHub`:R(t).shared?`shared`:`private`}, ${R(t).apps??``}
|
|
39
|
+
${R(t).apps===1?`app`:`apps`}, ${e??``}`),q(l,`title`,R(t).path),U(u,R(t).path),d.disabled=R(a),q(d,`aria-label`,`Use ${R(t).name??``}`)},[()=>R(t).envs.join(` / `)]),B(`click`,d,()=>void p({use:R(t).dir})),H(e,n)});var c=I(s,2),l=N(c);ma(l);var d=I(l,2);D(c),L(e=>{U(i,R(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},[()=>R(a)||!R(o).trim()]),B(`click`,n,()=>{f(`start`)}),z(`submit`,c,e=>{e.preventDefault(),R(o).trim()&&p({link:R(o).trim()})}),Sa(l,()=>R(o),e=>M(o,e)),H(e,t)},S=e=>{var t=vk(),n=P(t),r=I(n,6),i=N(r),o=I(N(i));ma(o),D(i);var u=I(i,2),d=I(N(u)),p=N(d);G(p,18,()=>R(l),e=>e,(e,t,n)=>{var r=_k(),i=N(r,!0),a=I(i),o=e=>{H(e,gk())};W(a,e=>{R(n)===0&&R(l).length>1&&e(o)});var s=I(a,2);X(N(s),{get of(){return to},size:14}),D(s),D(r),L(()=>{U(i,t),q(s,`aria-label`,`Remove ${t??``}`)}),B(`click`,s,()=>M(l,R(l).filter(e=>e!==t),!0)),H(e,r)});var _=I(p,2);ma(_),D(d),Me(2),D(u);var v=I(u,2);D(r),L(()=>{q(_,`placeholder`,R(l).length?`Add another`:`Type one, e.g. qa, and press Enter`),v.disabled=R(a)}),B(`click`,n,()=>{f(`start`)}),z(`submit`,r,g),Sa(o,()=>R(s),e=>M(s,e)),B(`keydown`,_,h),z(`blur`,_,()=>{R(c).trim()&&m(R(c))}),Sa(_,()=>R(c),e=>M(c,e)),H(e,t)};W(y,e=>{R(r)===`start`?e(b):R(r)===`join`?e(x,1):e(S,-1)});var C=F(I(y,2),!0);return D(v),Ma(v,e=>M(n,e),()=>R(n)),L(()=>U(C,R(i))),z(`cancel`,v,e=>{R(r)===`start`?Z.setup&&e.preventDefault():(e.preventDefault(),f(`start`))}),H(e,v),k(_)}Qr([`click`,`keydown`]);var xk=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sk(e,t){let n=J(t,xk),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 Ck=V(`<p class="svelte-ujai35"> </p>`),wk=V(`<button class="act svelte-ujai35" type="button">Reload</button>`),Tk=V(`<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),Ek=V(`<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>`),Dk=V(`<!> <!>`,1),Ok=V(`<p class="none svelte-ujai35">No boards yet. A board is kept as soon as it has an app.</p>`),kk=V(`<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>`),Ak=V(`<button type="submit" class="svelte-ujai35">Open</button>`),jk=V(`<button type="button" class="svelte-ujai35">Open a file…</button>`),Mk=V(`<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>`),Nk=V(`<details class="svelte-ujai35"><summary class="svelte-ujai35"> </summary> <!></details>`),Pk=V(`<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 Fk(e,t){let n=ui();O(t,!0);let r=`Or drop a board .json file anywhere on the page.`,i=j(void 0),a=j(void 0),o=j(void 0),s=j(!1),c=j(``),l=j(``),u=j(mn({text:r,warn:!1})),d=j(!1),f=A(()=>Z.own.some(e=>e.name===Z.name)),p=async(e,t)=>{let n=await Hb(e);$.show(n?`Cannot reload ${t}. ${n}`:`Reloaded ${t} from ${e}.`,n?`warning`:`message`)},m=A(()=>!R(f)&&Z.team.some(e=>e.name===Z.name)),h=A(()=>Z.name??(Z.scratch&&Z.nodes[0]?`${Z.nodes[0].data.name} alone`:`New board`)),g=()=>[...R(a)?.querySelectorAll(`.row > button:first-child`)??[]],_=()=>R(a)?.hidePopover(),y=()=>{let e=R(i)?.getBoundingClientRect();e&&R(a)&&(R(a).style.top=`${String(e.bottom+4)}px`,R(a).style.left=`${String(e.left)}px`,R(a).style.width=`${String(Math.max(e.width,Math.min(400,innerWidth-e.left-12)))}px`,(R(a).querySelector(`[aria-current="true"]`)??g()[0])?.focus())},b=e=>{e.newState===`open`&&(M(c,Z.name??``,!0),M(l,``),M(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&&Bb(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(R(c));t?M(u,{text:t,warn:!0},!0):_()},T=async e=>{_();let t=Z.forTeam(e),n=await Co(`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);Xb.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…`),Co(`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.`)}})}}},ee=e=>{_();let t=e.edges.length,n=Z.name===e.name;Xb.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(),!R(l).trim()||R(d))return;M(d,!0),M(u,{text:`Opening…`,warn:!1},!0);let t=await Hb(R(l).trim());M(d,!1),t?M(u,{text:t,warn:!0},!0):_()};var E=Pk(),ne=P(E);let re;var ie=F(N(ne),!0);D(ne),Ma(ne,e=>M(i,e),()=>R(i));var ae=I(ne,2),oe=N(ae);G(oe,17,()=>[[`Team boards`,Z.team],[`Your boards`,Z.own]],([e,t])=>e,(e,t)=>{var n=A(()=>v(R(t),2));let r=()=>R(n)[0],i=()=>R(n)[1];var a=Dk(),o=P(a),s=e=>{var t=Ck(),n=F(t,!0);L(()=>U(n,r())),H(e,t)};W(o,e=>{i().length&&e(s)}),G(I(o,2),17,i,e=>e.name,(e,t)=>{var n=Ek(),r=N(n),a=N(r),o=F(a,!0),s=F(I(a),!0);D(r);var c=I(r,2),l=e=>{let n=A(()=>R(t).source);var r=wk();L(()=>{q(r,`aria-label`,`Reload ${R(t).name??``}`),q(r,`title`,`Read it again from ${R(n)??``}`)}),B(`click`,r,()=>void p(R(n),R(t).name)),H(e,r)},u=A(()=>i()===Z.own&&typeof R(t).source==`string`&&/^(https?:|\/)/.test(R(t).source));W(c,e=>{R(u)&&e(l)});var d=I(c,2),f=e=>{var n=Tk(),r=P(n),i=I(r,2);X(N(i),{get of(){return to},size:14}),D(i),L(()=>{q(r,`aria-label`,`Share ${R(t).name??``} with the team`),q(i,`aria-label`,`Delete ${R(t).name??``}`)}),B(`click`,r,()=>void T(R(t))),B(`click`,i,()=>{ee(R(t))}),H(e,n)};W(d,e=>{i()===Z.own&&e(f)}),D(n),L(e=>{q(r,`aria-current`,R(t).name===Z.name),q(r,`title`,typeof R(t).source==`string`?`Opened from ${R(t).source}`:void 0),U(o,R(t).name),U(s,e)},[()=>C(R(t))]),B(`click`,r,()=>{S(R(t))}),H(e,n)}),H(e,a)});var se=I(oe,2),ce=e=>{H(e,Ok())};W(se,e=>{!Z.team.length&&!Z.own.length&&e(ce)});var le=I(se,2),ue=N(le),de=N(ue),fe=I(de,2);D(ue);var pe=I(ue,2),me=e=>{var t=kk(),n=N(t);ma(n);var r=I(n,2);D(t),L(e=>r.disabled=e,[()=>R(c).trim()===Z.name]),z(`submit`,t,w),Sa(n,()=>R(c),e=>M(c,e)),H(e,t)};W(pe,e=>{R(f)&&e(me)});var he=I(pe,2),ge=N(he);ma(ge);var _e=I(ge,2),ve=e=>{var t=Ak();L(()=>t.disabled=R(d)),H(e,t)},ye=A(()=>R(l).trim()),be=e=>{var t=jk();B(`click`,t,()=>R(o)?.click()),H(e,t)};W(_e,e=>{R(ye)?e(ve):e(be,-1)}),D(he);var xe=I(he,2);Ma(xe,e=>M(o,e),()=>R(o));var Se=I(xe,2);let Ce;var we=F(Se,!0);D(le);var Te=I(le,2),Ee=e=>{var t=Nk(),n=N(t),r=F(n);G(I(n,2),17,()=>Z.trash,e=>e.name+e.deleted,(e,t)=>{var n=Mk(),r=N(n),i=F(r,!0),a=I(r),o=F(a,!0),s=I(a,2);D(n),L(e=>{q(r,`title`,R(t).name),U(i,R(t).name),U(o,e),q(s,`aria-label`,`Restore ${R(t).name??``}`)},[()=>Wb(R(t).deleted)]),B(`click`,s,()=>{Z.restore(R(t))}),H(e,n)}),D(t),L(()=>U(r,`Recently deleted (${Z.trash.length??``})`)),H(e,t)};W(Te,e=>{Z.trash.length&&e(Ee)}),D(ae),Ma(ae,e=>M(a,e),()=>R(a)),L(()=>{re=K(ne,1,`picker svelte-ujai35`,null,re,{chosen:!!Z.name}),q(ne,`aria-label`,`Board: ${R(h)??``}`),q(ne,`aria-expanded`,R(s)),q(ne,`title`,R(f)?`Your board, saved on this Mac as you change it`:R(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),U(ie,R(h)),q(ae,`id`,n),fe.disabled=!Z.nodes.length,Ce=K(Se,1,`hint svelte-ujai35`,null,Ce,{warn:R(u).warn}),U(we,R(u).text)}),B(`keydown`,ae,x),z(`beforetoggle`,ae,b),z(`toggle`,ae,e=>{M(s,e.newState===`open`),R(s)&&y()}),B(`click`,de,()=>{_(),Z.newBoard()}),B(`click`,fe,()=>{_(),Z.duplicate()}),z(`submit`,he,te),Sa(ge,()=>R(l),e=>M(l,e)),B(`change`,xe,()=>{_(),Vb(R(o)?.files?.[0]),R(o)&&(R(o).value=``)}),H(e,E),k()}Qr([`keydown`,`click`,`change`]);var Ik=V(`<li class="svelte-3tqys6"><strong> </strong> <small class="svelte-3tqys6"> </small> <!></li>`),Lk=V(`<small class="svelte-3tqys6"> </small>`),Rk=V(`<div class="gap svelte-3tqys6"><strong> </strong> <!> <button type="button" class="svelte-3tqys6"> </button></div>`),zk=V(`<button class="all svelte-3tqys6" type="button"> </button>`),Bk=V(`<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>`),Vk=V(`<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 Hk(e,t){let n=ui();O(t,!0);let r=j(void 0),i=j(void 0),a=j(mn([])),o=A(()=>(Q.status?.checks??[]).filter(e=>e.state!==`ok`)),s=A(()=>R(o).filter(e=>e.state!==`gap`)),c=A(()=>R(o).filter(e=>e.state===`gap`)),l=A(()=>[...new Set(R(c).map(e=>e.env??``))]),u=(e,t,n)=>`${String(e)} ${e===1?t:n}`,d=A(()=>{let e=R(s).filter(e=>e.state===`missing`).length,t=R(s).length-e;return[e&&`${String(e)} missing on this Mac`,t&&`${u(t,`check waits`,`checks wait`)} for your approval`,R(c).length&&`${String(R(c).length)} ${R(l).map(e=>e.toUpperCase()).join(` and `)} ${R(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(R(c).filter(t=>t.env===e).map(e=>e.app??``))],_=(e,t)=>R(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 Xb.askFacts(e,_(e,t).map(e=>e.detail??``))&&M(a,[...R(a),`${e}|${t??``}`],!0)},b=()=>{let e=R(r)?.getBoundingClientRect();e&&R(i)&&(R(i).style.left=`${String(Math.max(12,e.left))}px`,R(i).style.bottom=`${String(innerHeight-e.top+6)}px`)};var x=li(),S=P(x),C=e=>{var t=Vk(),o=P(t),c=F(o,!0);Ma(o,e=>M(r,e),()=>R(r));var u=I(o,2),p=N(u),x=I(p,2),S=N(x);G(S,17,()=>R(s),e=>e.name,(e,t)=>{let n=A(()=>f(R(t)));var r=Ik(),i=N(r),a=F(i,!0),o=I(i,2),s=F(o,!0),c=I(o,2),l=e=>{Ic(e,{get command(){return R(n)}})};W(c,e=>{R(n)&&e(l)}),D(r),L(e=>{U(a,R(t).name),U(s,e)},[()=>m(R(t))]),H(e,r)}),G(I(S,2),16,()=>R(l),e=>e,(e,t)=>{var n=Bk(),r=N(n),i=F(r),o=I(r,4);G(o,16,()=>g(t),e=>e,(e,n)=>{var r=Rk(),i=N(r),o=F(i,!0),s=I(i,2);G(s,17,()=>_(t,n),e=>e.detail,(e,t)=>{var n=Lk(),r=F(n,!0);L(e=>U(r,e),[()=>v(R(t))]),H(e,n)});var c=I(s,2),l=F(c,!0);D(r),L((e,t,n)=>{U(o,e),c.disabled=t,U(l,n)},[()=>h(n),()=>R(a).includes(`${t}|${n}`),()=>R(a).includes(`${t}|${n}`)?`Sent to the agent`:`Ask the agent to find it`]),B(`click`,c,()=>void y(t,n)),H(e,r)});var s=I(o,2),c=e=>{var n=zk(),r=F(n,!0);L((e,t)=>{n.disabled=e,U(r,t)},[()=>R(a).includes(`${t}|`),()=>R(a).includes(`${t}|`)?`Sent to the agent`:`Ask the agent to find all ${String(g(t).length)}`]),B(`click`,n,()=>void y(t)),H(e,n)},l=A(()=>g(t).length>1);W(s,e=>{R(l)&&e(c)}),D(n),L(e=>U(i,`Missing from the stack for ${e??``}`),[()=>t.toUpperCase()]),H(e,n)}),D(x),D(u),Ma(u,e=>M(i,e),()=>R(i)),L(()=>{q(o,`popovertarget`,n),U(c,R(d)),q(u,`id`,n),q(u,`aria-labelledby`,`${n}-title`),q(p,`id`,`${n}-title`)}),z(`toggle`,u,e=>{e.newState===`open`&&b()}),H(e,t)};W(S,e=>{R(o).length&&e(C)}),H(e,x),k()}Qr([`click`]);var Uk=V(`<button class="do svelte-159ihlv" type="button">Connect</button>`),Wk=V(`<div class="note svelte-159ihlv" role="note"><span> </span> <button class="x svelte-159ihlv" type="button" aria-label="Dismiss this note"><!></button> <!></div>`),Gk=V(`<div class="notes svelte-159ihlv" role="group" aria-label="About this board"></div>`);function Kk(e,t){O(t,!0);let n=Z.nameOf,r=A(()=>Vs(Z.plan,n).filter(e=>!e.includes(` share one `)).map(e=>({key:`ports:${e}`,text:e}))),i=A(()=>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=A(()=>[...R(r),...R(i)].filter(e=>!Z.dismissed.includes(e.key)));var o=li(),s=P(o),c=e=>{var t=Gk();G(t,21,()=>R(a),e=>e.key,(e,t)=>{let n=A(()=>R(t).cable);var r=Wk(),i=N(r),a=F(i,!0),o=I(i,2);X(N(o),{get of(){return to},size:14}),D(o);var s=I(o,2),c=e=>{var t=Uk();B(`click`,t,()=>{Z.connect(R(n).from,R(n).to)}),H(e,t)};W(s,e=>{R(n)&&e(c)}),D(r),L(()=>U(a,R(t).text)),B(`click`,o,()=>{Z.dismissed=[...Z.dismissed,R(t).key]}),H(e,r)}),D(t),H(e,t)};W(s,e=>{R(a).length&&!Z.live&&e(c)}),H(e,o),k()}Qr([`click`]);var qk=V(`<label class="svelte-1vh52u"><input type="radio" name="env" class="svelte-1vh52u"/> </label>`),Jk=V(`<span class="count svelte-1vh52u"> </span>`),Yk=V(`<span class="live svelte-1vh52u" role="img"> </span>`),Xk=V(`<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),Zk=V(`<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),Qk=V(`<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),$k=V(`<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),eA=V(`<div role="listitem"><!> <!></div>`),tA=V(`<p class="empty svelte-1vh52u"> </p>`),nA=V(`<p class="unsaved svelte-1vh52u" role="alert">Not saved: the canvas server is not answering. Changes stay on this page.</p>`),rA=V(`<div class="warn svelte-1vh52u">The canvas server runs older code, so some buttons fail until it restarts. Run this in your terminal: <!></div>`),iA=V(`<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>`),aA=V(`<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 oA(e,t){O(t,!0);let n=[],r=j(mn((()=>{try{return localStorage.getItem(`koppler-sort`)===`added`?`added`:`name`}catch{return`name`}})())),i=j(``),a=j(``),o=A(()=>[...Z.cards.map(e=>e.id),...Z.infra.filter(e=>e.type===`outside`).map(e=>e.id.slice(8))]),s=e=>{let t=R(i).trim().toLowerCase(),n=e=>e.toLowerCase().replace(/^\./,``);return!t||e.name.toLowerCase().includes(t)||n(e.kindLabel).startsWith(n(t))},c=A(()=>{let e=e=>R(o).includes(e.id)?R(o).indexOf(e.id):Z.apps.indexOf(e),t=(t,n)=>R(r)===`name`?t.name.localeCompare(n.name):e(t)-e(n),n=e=>+!R(o).includes(e.id);return Z.apps.filter(s).sort((e,r)=>n(e)-n(r)||t(e,r))}),l=A(()=>R(c).find(e=>!R(o).includes(e.id))),u=A(()=>R(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=()=>{M(r,R(r)===`name`?`added`:`name`,!0);try{localStorage.setItem(`koppler-sort`,R(r))}catch{}},f=A(()=>Z.roots.map(e=>e.replace(/^\/Users\/[^/]+/,`~`)).join(`, `)),p=A(()=>Z.apps.filter(e=>!e.cloned&&!e.outside)),m=A(()=>R(p).length>3?`${R(p).slice(0,2).map(e=>e.name).join(`, `)} and ${String(R(p).length-2)} more`:new Intl.ListFormat(`en`,{type:`conjunction`}).format(R(p).map(e=>e.name))),h=j(!1),g=async()=>{let e=R(p).map(b).join(`
|
|
40
|
+
`);try{await navigator.clipboard.writeText(e),M(h,!0),setTimeout(()=>M(h,!1),2e3)}catch{M(a,`Copy is blocked here: ${e}`)}},_=j(!1),v=async()=>{M(_,!0);let e=await Co(`rescan`);M(_,!1),`error`in e?$.show(e.error,`warning`):location.reload()},y=e=>{Xb.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:()=>{Co(`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)),M(a,`Clone command for ${e.name} copied.`)}catch{M(a,`Copy is blocked here: ${b(e)}`)}};var S=aA();let C;var w=N(S),T=N(w);Fk(T,{});var ee=I(T,2);G(ee,20,()=>Z.envs,e=>e,(e,t)=>{var r=qk(),i=N(r);ma(i);var a,o=I(i,1,!0);D(r),L(e=>{a!==(a=t)&&(i.value=(i.__value=a)??``),U(o,e)},[()=>t.toUpperCase()]),wa(n,[],i,()=>Z.env,e=>Z.env=e),H(e,r)}),D(ee),D(w);var te=I(w,2),E=N(te),ne=I(N(E)),re=e=>{var t=Jk(),n=F(t);L(()=>U(n,`${R(o).length??``} of ${Z.apps.length??``} on the board`)),H(e,t)};W(ne,e=>{Z.apps.length&&e(re)});var ie=I(ne,2),ae=N(ie);X(ae,{get of(){return Sk},size:11});var oe=I(ae);D(ie),D(E);var se=I(E,2);ma(se);var ce=I(se,2);G(ce,21,()=>R(c),e=>e.id,(e,t,n,r)=>{let i=A(()=>R(o).includes(R(t).id)),a=A(()=>!!R(t).outside||!R(t).cloned);var s=eA();let u;var d=N(s);DE(d,{get kind(){return R(t).kind},get label(){return R(t).kindLabel}});var p=I(d,2),m=e=>{let n=A(()=>Q.up(R(t).id));var r=Xk(),i=P(r),a=F(N(i),!0);D(i);var o=I(i,2),s=e=>{var t=Yk(),r=F(t,!0);L(()=>{q(t,`data-on`,R(n)),q(t,`aria-label`,R(n)?`Running`:`Not answering`),U(r,R(n)?``:`!`)}),H(e,t)};W(o,e=>{R(n)!==null&&e(s)});var c=I(o,2);X(N(c),{get of(){return to},size:11}),D(c),L(()=>{U(a,R(t).name),q(c,`aria-label`,`Remove ${R(t).name??``} from the board`)}),B(`click`,i,()=>{Z.show(R(t).outside?`outside:${R(t).id}`:R(t).id)}),B(`click`,c,()=>{R(t).outside?Z.showOutside(R(t).id,!1):Z.remove(R(t).id)}),H(e,r)},h=e=>{var n=Zk(),r=P(n),i=F(N(r),!0);D(r);var a=I(r,4);X(N(a),{get of(){return go},size:12}),D(a),L(()=>{q(r,`title`,`Does not run on this Mac: ${R(t).outside??``}. Click to put its card on the board; it never runs.`),U(i,R(t).name),q(a,`aria-label`,`Remove ${R(t).name??``} from the stack`)}),B(`click`,r,()=>{Z.showOutside(R(t).id,!0)}),B(`click`,a,()=>{y(R(t))}),H(e,n)},g=e=>{var n=Qk(),r=P(n),i=F(N(r),!0);D(r);var a=I(r,4);X(N(a),{get of(){return go},size:12}),D(a),L(()=>{q(r,`title`,`Not cloned under ${R(f)??``}. Click to copy the clone command.`),U(i,R(t).name),q(a,`aria-label`,`Remove ${R(t).name??``} from the stack`)}),B(`click`,r,()=>x(R(t))),B(`click`,a,()=>{y(R(t))}),H(e,n)},_=e=>{var n=$k(),r=P(n),i=F(N(r),!0);D(r);var a=I(r,2);X(N(a),{get of(){return go},size:12}),D(a);var o=I(a,2);X(N(o),{get of(){return so},size:12,filled:!0}),D(o);var s=I(o,2);X(N(s),{get of(){return Iy},size:12}),D(s),L(()=>{q(r,`title`,`Add ${R(t).name??``} to the board: click, or drag it there`),U(i,R(t).name),q(a,`aria-label`,`Remove ${R(t).name??``} from the stack`),q(o,`aria-label`,`Run ${R(t).name??``} alone`),q(s,`aria-label`,`Add ${R(t).name??``} to the board`)}),z(`dragstart`,r,e=>{e.dataTransfer?.setData(`text/app`,R(t).id)}),B(`click`,r,()=>{Z.add(R(t).id)}),B(`click`,a,()=>{y(R(t))}),B(`click`,o,()=>{Xb.alone(R(t).id)}),B(`click`,s,()=>{Z.add(R(t).id)}),H(e,n)};W(p,e=>{R(i)?e(m):R(t).outside?e(h,1):R(t).cloned?e(_,-1):e(g,2)}),D(s),L(()=>u=K(s,1,`app svelte-1vh52u`,null,u,{on:R(i),missing:R(a),"first-off":R(t)===R(l)&&R(t)!==R(c)[0]})),H(e,s)},e=>{var t=tA(),n=F(t,!0);L(()=>U(n,Z.apps.length?`No app matches.`:`No apps in this stack yet.`)),H(e,t)}),D(ce);var le=I(ce,2),ue=N(le),de=I(ue,2);D(le);var fe=I(le,2),pe=F(fe,!0);Kk(I(fe,2),{}),D(te);var me=I(te,2),he=N(me),ge=e=>{H(e,nA())};W(he,e=>{Z.unsaved&&e(ge)});var _e=I(he,2),ve=e=>{var t=rA();Ic(I(N(t)),{get command(){return Q.status.restart},label:`Copy restart command`}),D(t),H(e,t)};W(_e,e=>{Q.status?.restart&&e(ve)});var ye=I(_e,2),be=e=>{var t=iA(),n=N(t),r=F(n),i=I(n,2),a=N(i),o=F(a,!0),s=I(a,2),c=F(s,!0);D(i),D(t),L(()=>{U(r,`${R(m)??``}
|
|
41
|
+
${R(p).length===1?`is`:`are`} not cloned on this Mac, so ${R(p).length===1?`it`:`they`} cannot
|
|
42
|
+
run here. Koppler looks for clones in ${R(f)??``}.`),U(o,R(h)?`Copied`:R(p).length===1?`Copy clone command`:`Copy clone commands`),s.disabled=R(_),U(c,R(_)?`Looking…`:`Look again`)}),B(`click`,a,()=>void g()),B(`click`,s,()=>void v()),H(e,t)};W(ye,e=>{R(p).length&&e(be)});var xe=I(ye,2);Hk(xe,{}),CT(I(xe,2),{}),D(me),D(S),L(()=>{C=K(S,1,`svelte-1vh52u`,null,C,{protected:Z.protected}),q(ie,`title`,R(u)),q(ie,`aria-label`,R(u)),U(oe,` ${R(r)===`name`?`Az`:`Added`}`),U(pe,R(a))}),B(`click`,ie,d),Sa(se,()=>R(i),e=>M(i,e)),B(`click`,ue,()=>void Gb.repos?.open()),B(`click`,de,()=>Gb.outside?.open()),H(e,S),k()}Qr([`click`]);var sA=V(`<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>`),cA=V(`<span class="meta svelte-njiuyh"> </span>`),lA=V(`<button type="button" role="menuitem" class="svelte-njiuyh"><span class="ico svelte-njiuyh" aria-hidden="true"> </span> <span class="name svelte-njiuyh"> </span> <!></button>`),uA=V(`<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 dA(e,t){let n=ui();O(t,!0);let r=j(void 0),i=j(void 0),a=j(!1),o=A(()=>Q.status?.stacks??[]),s=A(()=>Q.status?.linked),c=A(()=>[...R(s)?[{icon:`↻`,label:`Check for updates from GitHub`,count:0,run:()=>void dk.updateStack()}]:[],...R(s)?.changes.length?[{icon:`●`,label:`Changes not shared yet`,count:R(s).changes.length,run:()=>{dk.shareChanges()}}]:[],...Z.apps.length?[{icon:`⌕`,label:`Look through the repos again`,count:0,run:()=>void Gb.findings?.open()}]:[],{icon:`+`,label:`Add a stack: new, or from GitHub`,count:0,run:()=>{dk.addStack(()=>Gb.setup?.open())}}]),l=()=>[...R(i)?.querySelectorAll(`button:not(:disabled)`)??[]],u=()=>{let e=R(r)?.getBoundingClientRect();e&&R(i)&&(R(i).style.top=`${String(e.bottom+4)}px`,R(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=uA(),p=I(P(f),2),m=F(N(p),!0);D(p),Ma(p,e=>M(r,e),()=>R(r));var h=I(p,2),g=N(h);G(g,17,()=>R(o),e=>e.dir,(e,t)=>{let n=A(()=>R(t).dir===Z.dir),r=A(()=>R(n)?Z.apps.length:R(t).apps);var a=sA(),o=I(N(a),2),s=F(o,!0),c=F(I(o,2));D(a),L(()=>{q(a,`aria-checked`,R(n)),a.disabled=R(n),q(a,`title`,R(t).path),U(s,R(t).name),U(c,`${R(t).linked?`from GitHub`:R(t).shared?`shared`:`private`}, ${R(r)??``}
|
|
43
|
+
${R(r)===1?`app`:`apps`}`)}),B(`click`,a,()=>{R(i)?.hidePopover(),dk.useStack(R(t))}),H(e,a)});var _=I(g,2);G(_,21,()=>R(c),e=>e.label,(e,t)=>{var n=lA(),r=N(n),a=F(r,!0),o=I(r,2),s=F(o,!0),c=I(o,2),l=e=>{var n=cA(),r=F(n,!0);L(()=>U(r,R(t).count)),H(e,n)};W(c,e=>{R(t).count&&e(l)}),D(n),L(()=>{U(a,R(t).icon),U(s,R(t).label)}),B(`click`,n,()=>{R(i)?.hidePopover(),R(t).run()}),H(e,n)}),D(_),D(h),Ma(h,e=>M(i,e),()=>R(i)),L(()=>{q(p,`aria-expanded`,R(a)),q(p,`title`,`${Z.stack??``}: switch to another stack`),q(p,`popovertarget`,n),U(m,Z.stack),q(h,`id`,n)}),B(`keydown`,h,d),z(`toggle`,h,e=>{M(a,e.newState===`open`),R(a)&&u()}),H(e,f),k()}Qr([`keydown`,`click`]);var fA=V(`<button class="action svelte-ieajqw" type="button"> </button>`),pA=V(`<div><span class="text svelte-ieajqw"> </span> <!> <!> <button class="close svelte-ieajqw" type="button" aria-label="Dismiss"><!></button></div>`);function mA(e,t){O(t,!0);let n=j(!1),r=async e=>{await navigator.clipboard.writeText(e).catch(()=>void 0),M(n,!0),setTimeout(()=>M(n,!1),1500)};var i=li(),a=P(i),o=e=>{let t=A(()=>$.now);var i=pA();let a;var o=N(i),s=F(o,!0),c=I(o,2),l=e=>{var n=fA(),r=F(n,!0);L(()=>U(r,R(t).action.label)),B(`click`,n,()=>{R(t).action.run(),$.hide()}),H(e,n)};W(c,e=>{R(t).action&&e(l)});var u=I(c,2),d=e=>{var i=fA(),a=F(i,!0);L(()=>U(a,R(n)?`Copied`:`Copy`)),B(`click`,i,()=>r(R(t).text)),H(e,i)};W(u,e=>{R(t).warning&&e(d)});var f=I(u,2);X(N(f),{get of(){return to},size:14}),D(f),D(i),L(()=>{a=K(i,1,`toast svelte-ieajqw`,null,a,{warning:R(t).warning}),q(i,`role`,R(t).warning?`alert`:`status`),U(s,R(t).text)}),B(`click`,f,()=>{$.hide()}),H(e,i)};W(a,e=>{$.now&&e(o)}),H(e,i),k()}Qr([`click`]);var hA=V(`<!> <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),gA=V(`<!><!><!>`,1),_A=V(`<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),vA=V(`<div class="dropping svelte-1jciobo">Drop to open this board</div>`),yA=V(`<div class="banner svelte-1jciobo" role="alert"> </div>`),bA=V(`<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>`),xA=V(`<!> <div class="stage svelte-1jciobo"><div class="work svelte-1jciobo"><div class="board svelte-1jciobo"><!> <!></div> <!></div> <!></div>`,1),SA=V(`<div class="empty svelte-1jciobo"><p class="svelte-1jciobo">No stack yet. Run this in your terminal, then open the canvas again.</p> <!></div>`),CA=V(`<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 wA(e,t){O(t,!0);let n=j(!1),r=e=>!!e.dataTransfer?.types.includes(`Files`),i=e=>{r(e)&&M(n,!0)},a=e=>{r(e)&&e.preventDefault()},o=e=>{e.relatedTarget||M(n,!1)},s=e=>{r(e)&&(e.preventDefault(),M(n,!1),Vb(e.dataTransfer?.files[0]))},c=j(void 0),l=j(``);Ln(()=>{ky.follow()});let u=A(()=>dk.switching??(Q.status?.loading&&Q.status.loading!==Z.dir?Q.status.loading:null)),d=A(()=>Q.status?.stacks?.find(e=>e.dir===R(u))?.name??`the stack`);Ln(()=>{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=bo().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?Gb.setup?.open():(!Z.apps.length||location.hash===`#pick`)&&(history.replaceState(null,``,location.pathname+location.search),Gb.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,So(t,e).then(e=>{m=``,Z.unsaved=!e,e?p=n:h=setTimeout(g,2e3)}))},_=A(()=>JSON.stringify([Z.env,Z.queues,Z.hiddenQueues,Z.hiddenOutside,Z.pinned,Z.cards.map(e=>[e.id,e.data.hideTunnels,e.data.showQueues])]));Ln(()=>{R(_)&&Z.stack&&Pr(()=>{Z.syncInfra()})}),Ln(()=>{Z.settle()});let y={};Ln(()=>{let e=Q.status?.boardEdits??[];Z.stack&&!Z.live&&Pr(()=>{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}: ${Zs(t.edit,e)}.`);Co(`board-edit-done`,{id:t.id})}})}),Ln(()=>{Z.stack&&Vx.record()});let b;Ln(()=>{let e=Q.status?.refresh;e!==void 0&&(b!==void 0&&e!==b&&Pr(()=>Z.reload()),b=e)}),Ln(()=>{if(Z.changes.length&&Z.stack)return Pr(()=>{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&&!Xb.review&&(e.preventDefault(),Xb.start())},S=j(mn((()=>{try{return localStorage.getItem(`koppler-side`)!==`hidden`}catch{return!0}})())),C=!1;Ln(()=>{let e=matchMedia(`(max-width: 1100px)`),t=()=>{Pr(()=>{e.matches&&R(S)?(e=>{var t=v(e,2);C=t[0],M(S,t[1],!0)})([!0,!1]):!e.matches&&!R(S)&&C&&(e=>{var t=v(e,2);C=t[0],M(S,t[1],!0)})([!1,!0])})};return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}});let w=j(void 0),T=()=>{R(w)&&(R(w).classList.remove(`compact`),R(w).classList.toggle(`compact`,R(w).scrollWidth>R(w).clientWidth+1))};Ln(()=>{if(!R(w))return;let e=new ResizeObserver(T);return e.observe(R(w)),()=>{e.disconnect()}}),Ln(()=>{let e=`${Z.stack}${Q.status?.running?.join()??``}`;requestAnimationFrame(()=>{e&&T()})});let ee=()=>{C=!1,M(S,!R(S));try{localStorage.setItem(`koppler-side`,R(S)?`open`:`hidden`)}catch{}};Ln(()=>{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=>{ee(),e&&(await jr(),document.querySelector(`aside button[aria-label^="Board:"]`)?.focus())};var E=CA();z(`fullscreenchange`,vn,()=>{!document.fullscreenElement&&!Z.entering&&(Z.present=!1)}),z(`keydown`,_n,x),z(`pagehide`,_n,()=>{g(!0)}),z(`dragenter`,_n,i),z(`dragover`,_n,a),z(`dragleave`,_n,o),z(`drop`,_n,s);var ne=P(E);let re;var ie=N(ne);X(N(ie),{get of(){return kc},size:16}),D(ie);var ae=I(ie,4),oe=e=>{var t=hA(),n=P(t);dA(n,{});var r=I(n,2);Pc(N(r),{size:16}),D(r);var i=I(r,2);let a;var o=F(i,!0);L(e=>{a=K(i,1,`env svelte-1jciobo`,null,a,{prod:Z.protected}),U(o,e)},[()=>Z.env.toUpperCase()]),B(`click`,r,()=>void Gb.settings?.open({title:`${Z.stack} settings`,path:``})),H(e,t)};W(ae,e=>{Z.stack&&e(oe)});var se=I(ae,4),ce=e=>{var t=gA(),n=P(t);mC(n,{});var r=I(n);My(r,{}),eT(I(r),{}),H(e,t)};W(se,e=>{Z.stack&&e(ce)});var le=I(se,2),ue=e=>{var t=gA(),n=P(t);gw(n,{});var r=I(n);vw(r,{}),IS(I(r),{}),H(e,t)};W(le,e=>{Z.stack&&e(ue)});var de=I(le,2);vC(de,{});var fe=I(de,2),pe=e=>{var t=_A(),n=P(t),r=N(n);X(N(r),{get of(){return jc},size:12,filled:!0}),Me(2),D(r);var i=I(r,2);{let e=A(()=>[{label:`Stop apps, keep changes`,about:Xb.started.length?`Stops every app, API and tunnel; branches and code changes stay until you revert`:`Nothing is running`,off:!Xb.started.length,run:()=>{Xb.stopApps()}},{label:`Revert temporary changes`,about:Xb.left.length?`Undoes what the last run left: branches back, temporary edits gone`:`Nothing to revert`,off:!Xb.left.length,run:()=>{Xb.stop()}},{label:`Shut down Koppler`,about:`Stops the agent listener and this canvas server; apps and tunnels keep running`,danger:!0,run:()=>{Xb.shutDown()}}]);sT(i,{label:`More ways to stop`,tone:`stop`,get items(){return R(e)}})}D(n);var a=I(n,2),o=N(a),s=I(o,2),l=e=>{sT(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:()=>{R(c)?.showModal()}},{label:`Get a checklist instead`,about:`The agent changes nothing and lists the steps for you to do yourself`,run:()=>{Xb.start({manual:!0})}}]})};W(s,e=>{Z.nodes.length&&e(l)}),D(a),L(()=>{n.inert=!!R(u),r.disabled=!Xb.started.length,q(r,`title`,Xb.started.length?`Stop what the agent started and revert all temporary code changes`:`Nothing is running`),a.inert=!!R(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`)}),B(`click`,r,()=>{Xb.stop()}),B(`click`,o,()=>{Xb.start()}),H(e,t)};W(fe,e=>{Z.stack&&e(pe)}),D(ne),Ma(ne,e=>M(w,e),()=>R(w));var me=I(ne,2),he=e=>{H(e,vA())};W(me,e=>{R(n)&&e(he)});var ge=I(me,2);uk(ge,{});var _e=I(ge,2);Ma(bk(_e,{}),e=>Gb.setup=e,()=>Gb?.setup);var ve=I(_e,2);Ma(KO(ve,{}),e=>Gb.repos=e,()=>Gb?.repos);var ye=I(ve,2);Ma(kT(ye,{}),e=>Gb.outside=e,()=>Gb?.outside);var be=I(ye,2);Ma(RO(be,{}),e=>Gb.settings=e,()=>Gb?.settings);var xe=I(be,2);Ma(eC(xe,{}),e=>Gb.findings=e,()=>Gb?.findings);var Se=I(xe,2);Ma(qS(Se,{}),e=>Gb.checklist=e,()=>Gb?.checklist);var Ce=I(Se,2);Ma(Dc(Ce,{}),e=>Gb.command=e,()=>Gb?.command);var we=I(Ce,2),Te=N(we),Ee=I(N(Te),2);yt(Ee);var De=I(Ee,2),Oe=N(De);Me(2),D(De),D(Te),D(we),Ma(we,e=>M(c,e),()=>R(c));var ke=I(we,2),Ae=e=>{var t=yA(),n=F(t);L((e,t)=>U(n,`${e??``}: local code runs against real ${t??``} data and secrets.`),[()=>Z.env.toUpperCase(),()=>Z.env.toUpperCase()]),H(e,t)};W(ke,e=>{Z.protected&&e(Ae)});var je=I(ke,2),Ne=N(je),Pe=e=>{var t=bA(),n=N(t),r=F(I(N(n)));D(n),D(t),L(()=>U(r,`Loading ${R(d)??``}...`)),H(e,t)};W(Ne,e=>{R(u)&&e(Pe)});var Fe=I(Ne,2);Ci(N(Fe),()=>f,null,(e,t)=>{var n=li(),r=P(n),i=e=>{var t=xA(),n=P(t),r=e=>{},i=e=>{oA(e,{})},a=e=>{ET(e,{open:te})};W(n,e=>{Z.present?e(r):R(S)?e(i,1):e(a,-1)});var o=I(n,2),s=N(o),c=N(s),l=N(c);ty(l,{children:(e,t)=>{fS(e,{})},$$slots:{default:!0}}),mA(I(l,2),{}),D(c);var u=I(c,2),d=e=>{jT(e,{})};W(u,e=>{Z.present||e(d)}),D(s);var f=I(s,2),p=e=>{Qw(e,{})};W(f,e=>{Z.present||e(p)}),D(o),H(e,t)},a=e=>{var t=SA();Ic(I(N(t),2),{command:`koppler init`}),D(t),H(e,t)};W(r,e=>{R(t)?e(i):e(a,-1)}),H(e,n)}),D(Fe);var Ie=I(Fe,2),Le=e=>{BC(e,{})};W(Ie,e=>{Z.present||e(Le)}),D(je),nT(I(je,2),{}),L(()=>{q(ne,`hidden`,Z.present),re=K(ne,1,`svelte-1jciobo`,null,re,{protected:Z.protected}),q(ie,`aria-expanded`,R(S)),q(ie,`aria-label`,R(S)?`Hide the side pane`:`Show the side pane`),q(ie,`title`,R(S)?`Hide the side pane`:`Show the side pane`),Fe.inert=!!R(u)}),B(`click`,ie,ee),z(`close`,we,()=>M(l,``)),z(`submit`,Te,()=>{Xb.start({note:R(l).trim()})}),Sa(Ee,()=>R(l),e=>M(l,e)),B(`click`,Oe,()=>R(c)?.close()),H(e,E),k()}Qr([`click`]),gc.watch();var TA=document.getElementById(`app`);TA&&hi(wA,{target:TA});
|