@vheins/local-memory-mcp 0.9.0 → 0.9.2
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/{chunk-XSGHXB35.js → chunk-PRSVP6TS.js} +3 -3
- package/dist/dashboard/public/assets/{index-Cbts6Uv0.css → index-CNE1bKgp.css} +1 -1
- package/dist/dashboard/public/assets/index-CWCaRdJn.js +86 -0
- package/dist/dashboard/public/index.html +2 -2
- package/dist/dashboard/server.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/package.json +1 -1
- package/dist/dashboard/public/assets/index-ZEQxhvIi.js +0 -86
|
@@ -0,0 +1,86 @@
|
|
|
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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var 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 e()}function m(e){for(var t=0;t<e.length;t++)e[t]()}function h(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function g(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var _=1<<24,v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,D=1<<20,ee=1<<25,te=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`legacy props`),O=Symbol(``),se=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ce=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function le(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function ue(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function de(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function fe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function pe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function me(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function he(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function ge(e){throw Error(`https://svelte.dev/e/lifecycle_legacy_only`)}function _e(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ve(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ye(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function be(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function xe(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Se={},Ce=Symbol(),we=`http://www.w3.org/1999/xhtml`,Te=`http://www.w3.org/2000/svg`;function Ee(){console.warn(`https://svelte.dev/e/derived_inert`)}function De(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Oe(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function ke(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var k=!1;function Ae(e){k=e}var A;function je(e){if(e===null)throw De(),Se;return A=e}function Me(){return je(Sn(A))}function j(e){if(k){if(Sn(A)!==null)throw De(),Se;A=e}}function Ne(e=1){if(k){for(var t=e,n=A;t--;)n=Sn(n);A=n}}function Pe(e=!0){for(var t=0,n=A;;){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=Sn(n);e&&n.remove(),n=i}}function Fe(e){if(!e||e.nodeType!==8)throw De(),Se;return e.data}function Ie(e){return e===this.v}function Le(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Re(e){return!Le(e,this.v)}var ze=!1,Be=!1;function Ve(){Be=!0}var He=null;function Ue(e){He=e}function We(e,t=!1,n){He={p:He,i:!1,c:null,e:null,s:e,x:null,r:hr,l:Be&&!t?{s:null,u:null,$:[]}:null}}function Ge(e){var t=He,n=t.e;if(n!==null){t.e=null;for(var r of n)zn(r)}return e!==void 0&&(t.x=e),t.i=!0,He=t.p,e??{}}function Ke(){return!Be||He!==null&&He.l===null}var qe=[];function Je(){var e=qe;qe=[],m(e)}function Ye(e){if(qe.length===0&&!St){var t=qe;queueMicrotask(()=>{t===qe&&Je()})}qe.push(e)}function Xe(){for(;qe.length>0;)Je()}function Ze(e){var t=hr;if(t===null)return fr.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;Qe(e,t)}function Qe(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var $e=~(y|b|v);function et(e,t){e.f=e.f&$e|t}function tt(e){e.f&512||e.deps===null?et(e,v):et(e,b)}function nt(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=te,nt(t.deps))}function rt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),nt(e.deps),et(e,v)}function it(e,t,n){if(e==null)return t(void 0),n&&n(void 0),f;let r=U(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}var at=[];function ot(e,t){return{subscribe:M(e,t).subscribe}}function M(e,t=f){let n=null,r=new Set;function i(t){if(Le(e,t)&&(e=t,n)){let t=!at.length;for(let t of r)t[1](),at.push(t,e);if(t){for(let e=0;e<at.length;e+=2)at[e][0](at[e+1]);at.length=0}}}function a(t){i(t(e))}function o(o,s=f){let c=[o,s];return r.add(c),r.size===1&&(n=t(i,a)||f),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:o}}function st(e,t,n){let r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw Error(`derived() expects stores as input, got a falsy value`);let a=t.length<2;return ot(n,(e,n)=>{let o=!1,s=[],c=0,l=f,u=()=>{if(c)return;l();let i=t(r?s[0]:s,e,n);a?e(i):l=typeof i==`function`?i:f},d=i.map((e,t)=>it(e,e=>{s[t]=e,c&=~(1<<t),o&&u()},()=>{c|=1<<t}));return o=!0,u(),function(){m(d),l(),o=!1}})}function N(e){let t;return it(e,e=>t=e)(),t}var ct=!1,lt=!1,ut=Symbol();function P(e,t,n){let r=n[t]??={store:null,source:F(void 0),unsubscribe:f};if(r.store!==e&&!(ut in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=f;else{var i=!0;r.unsubscribe=it(e,e=>{i?r.source.v=e:I(r.source,e)}),i=!1}return e&&ut in n?N(e):H(r.source)}function dt(e,t,n){let r=n[t];return r&&r.store!==e&&(r.unsubscribe(),r.unsubscribe=f),e}function ft(e,t){return mt(e,t),t}function pt(){let e={};function t(){Ln(()=>{for(var t in e)e[t].unsubscribe();i(e,ut,{enumerable:!1,value:!0})})}return[e,t]}function mt(e,t){ct=!0;try{e.set(t)}finally{ct=!1}}function ht(e,t,n){return mt(e,n),t}function gt(e){var t=lt;try{return lt=!1,[e(),lt]}finally{lt=t}}var _t=new Set,vt=null,yt=null,bt=null,xt=null,St=!1,Ct=!1,wt=null,Tt=null,Et=0,Dt=1,Ot=class e{id=Dt++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Set;#r=new Map;#i=new Map;#a=null;#o=[];#s=[];#c=new Set;#l=new Set;#u=new Map;#d=new Set;is_fork=!1;#f=!1;#p=new Set;#m(){return this.is_fork||this.#i.size>0}#h(){for(let n of this.#p)for(let r of n.#i.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#u.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}skip_effect(e){this.#u.has(e)||this.#u.set(e,{d:[],m:[]}),this.#d.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#u.get(e);if(n){this.#u.delete(e);for(var r of n.d)et(r,y),t(r);for(r of n.m)et(r,b),t(r)}this.#d.add(e)}#g(){if(Et++>1e3&&(_t.delete(this),At()),!this.#m()){for(let e of this.#c)this.#l.delete(e),et(e,y),this.schedule(e);for(let e of this.#l)et(e,b),this.schedule(e)}let t=this.#o;this.#o=[],this.apply();var n=wt=[],r=[],i=Tt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Lt(e),t}if(vt=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(wt=null,Tt=null,this.#m()||this.#h()){this.#v(r),this.#v(n);for(let[e,t]of this.#u)It(e,t)}else{this.#r.size===0&&_t.delete(this),this.#c.clear(),this.#l.clear();for(let e of this.#e)e(this);this.#e.clear(),yt=this,Mt(r),Mt(n),yt=null,this.#a?.resolve()}var o=vt;if(this.#o.length>0){let e=o??=this;e.#o.push(...this.#o.filter(t=>!e.#o.includes(t)))}o!==null&&(_t.add(o),o.#g()),ze&&!_t.has(this)&&this.#y()}#_(e,t,n){e.f^=v;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#u.has(r))&&r.fn!==null){a?r.f^=v:i&4?t.push(r):ze&&i&16777224?n.push(r):Or(r)&&(i&16&&this.#l.add(r),Nr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(e){for(var t=0;t<e.length;t+=1)rt(e[t],this.#c,this.#l)}capture(e,t,n=!1){e.v!==Ce&&!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(){vt=this}deactivate(){vt=null,bt=null}flush(){try{Ct=!0,vt=this,this.#g()}finally{Et=0,xt=null,wt=null,Tt=null,Ct=!1,vt=null,bt=null,nn.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear(),this.#n.clear(),_t.delete(this)}register_created_effect(e){this.#s.push(e)}#y(){for(let l of _t){var e=l.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(l.current.has(r)){var n=l.current.get(r)[0];if(e&&i!==n)l.current.set(r,[i,a]);else continue}t.push(r)}var r=[...l.current.keys()].filter(e=>!this.current.has(e));if(r.length===0)e&&l.discard();else if(t.length>0){if(e)for(let e of this.#d)l.unskip_effect(e,e=>{e.f&4194320?l.schedule(e):l.#v([e])});l.activate();var i=new Set,a=new Map;for(var o of t)Nt(o,r,i,a);a=new Map;var s=[...l.current.keys()].filter(e=>this.current.has(e)?this.current.get(e)[0]!==e:!0);for(let e of this.#s)!(e.f&155648)&&Pt(e,s,a)&&(e.f&4194320?(et(e,y),l.schedule(e)):l.#c.add(e));if(l.#o.length>0){l.apply();for(var c of l.#o)l.#_(c,[],[]);l.#o=[]}l.deactivate()}}for(let e of _t)e.#p.has(this)&&(e.#p.delete(this),e.#p.size===0&&!e.#m()&&(e.activate(),e.#g()))}increment(e,t){let n=this.#r.get(t)??0;if(this.#r.set(t,n+1),e){let e=this.#i.get(t)??0;this.#i.set(t,e+1)}}decrement(e,t,n){let r=this.#r.get(t)??0;if(r===1?this.#r.delete(t):this.#r.set(t,r-1),e){let e=this.#i.get(t)??0;e===1?this.#i.delete(t):this.#i.set(t,e-1)}this.#f||n||(this.#f=!0,Ye(()=>{this.#f=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#c.add(t);for(let e of t)this.#l.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}on_fork_commit(e){this.#n.add(e)}run_fork_commit_callbacks(){for(let e of this.#n)e(this);this.#n.clear()}settled(){return(this.#a??=h()).promise}static ensure(){if(vt===null){let t=vt=new e;Ct||(_t.add(vt),St||Ye(()=>{vt===t&&t.flush()}))}return vt}apply(){if(!ze||!this.is_fork&&_t.size===1){bt=null;return}bt=new Map;for(let[e,[t]]of this.current)bt.set(e,t);for(let n of _t)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id<this.id)for(let[r,[,i]]of n.current)i||(e||=this.current.has(r),t||=!this.current.has(r));if(e&&t)this.#p.add(n);else for(let[e,t]of n.previous)bt.has(e)||bt.set(e,t)}}schedule(e){if(xt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(wt!==null&&t===hr&&(ze||(fr===null||!(fr.f&2))&&!ct))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#o.push(t)}};function kt(e){var t=St;St=!0;try{var n;for(e&&(vt!==null&&!vt.is_fork&&vt.flush(),n=e());;){if(Xe(),vt===null)return n;vt.flush()}}finally{St=t}}function At(){try{he()}catch(e){Qe(e,xt)}}var jt=null;function Mt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Or(r)&&(jt=new Set,Nr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&er(r),jt?.size>0)){nn.clear();for(let e of jt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)jt.has(n)&&(jt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Nr(n)}}jt.clear()}}jt=null}}function Nt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Nt(i,t,n,r):e&4194320&&!(e&2048)&&Pt(i,t,r)&&(et(i,y),Ft(i))}}function Pt(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&Pt(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function Ft(e){vt.schedule(e)}function It(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),et(e,v);for(var n=e.first;n!==null;)It(n,t),n=n.next}}function Lt(e){et(e,v);for(var t=e.first;t!==null;)Lt(t),t=t.next}function Rt(e){let t=0,n=an(0),r;return()=>{In()&&(H(n),Gn(()=>(t===0&&(r=U(()=>e(()=>un(n)))),t+=1,()=>{Ye(()=>{--t,t===0&&(r?.(),r=void 0,un(n))})})))}}var zt=T|E;function Bt(e,t,n,r){new Vt(e,t,n,r)}var Vt=class{parent;is_pending=!1;transform_error;#e;#t=k?A: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=Rt(()=>(this.#m=an(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=hr;t.b=this,t.f|=128,n(e)},this.parent=hr.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Kn(()=>{if(k){let e=this.#t;Me();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},zt),k&&(this.#e=A)}#g(){try{this.#a=Jn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Jn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Jn(()=>e(this.#e)),Ye(()=>{var e=this.#c=document.createDocumentFragment(),t=bn();e.append(t),this.#a=this.#x(()=>Jn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,tr(this.#o,()=>{this.#o=null}),this.#b(vt))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Jn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ar(this.#a,e);let t=this.#n.pending;this.#o=Jn(()=>t(this.#e))}else this.#b(vt)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){rt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=hr,n=fr,r=He;gr(this.#i),mr(this.#i),Ue(this.#i.ctx);try{return Ot.ensure(),e()}catch(e){return Ze(e),null}finally{gr(t),mr(n),Ue(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&tr(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Ye(()=>{this.#d=!1,this.#m&&cn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),H(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;vt?.is_fork?(this.#a&&vt.skip_effect(this.#a),this.#o&&vt.skip_effect(this.#o),this.#s&&vt.skip_effect(this.#s),vt.on_fork_commit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Qn(this.#a),null),this.#o&&=(Qn(this.#o),null),this.#s&&=(Qn(this.#s),null),k&&(je(this.#t),Ne(),je(Pe()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){ke();return}r=!0,i&&xe(),this.#s!==null&&tr(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){Qe(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Jn(()=>{var t=hr;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return Qe(e,this.#i.parent),null}}))};Ye(()=>{var t;try{t=this.transform_error(e)}catch(e){Qe(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>Qe(e,this.#i&&this.#i.parent)):o(t)})}};function Ht(e,t,n,r){let i=Ke()?Kt:Yt;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=hr,s=Ut(),c=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function l(e){s();try{r(e)}catch(e){o.f&16384||Qe(e,o)}Wt()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=Gt();function d(){Promise.all(n.map(e=>qt(e))).then(e=>l([...t.map(i),...e])).catch(e=>Qe(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),Wt()}):d()}function Ut(){var e=hr,t=fr,n=He,r=vt;return function(i=!0){gr(e),mr(t),Ue(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Wt(e=!0){gr(null),mr(null),Ue(null),e&&vt?.deactivate()}function Gt(){var e=hr,t=e.b,n=vt,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(i=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,i)}}function Kt(e){var t=2|y;return hr!==null&&(hr.f|=E),{ctx:He,deps:null,effects:null,equals:Ie,f:t,fn:e,reactions:null,rv:0,v:Ce,wv:0,parent:hr,ac:null}}function qt(e,t,n){let r=hr;r===null&&ue();var i=void 0,a=an(Ce),o=!fr,s=new Map;return Wn(()=>{var t=hr,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(Wt)}catch(e){n.reject(e),Wt()}var c=vt;if(o){if(t.f&32768)var l=Gt();if(r.b.is_rendered())s.get(c)?.reject(se),s.delete(c);else{for(let e of s.values())e.reject(se);s.clear()}s.set(c,n)}let u=(e,n=void 0)=>{if(l&&l(n===se),!(n===se||t.f&16384)){if(c.activate(),n)a.f|=ie,cn(a,n);else{a.f&8388608&&(a.f^=ie),cn(a,e);for(let[e,t]of s){if(s.delete(e),e===c)break;t.reject(se)}}c.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),Ln(()=>{for(let e of s.values())e.reject(se)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function Jt(e){let t=Kt(e);return ze||vr(t),t}function Yt(e){let t=Kt(e);return t.equals=Re,t}function Xt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Qn(t[n])}}function Zt(e){var t,n=hr,r=e.parent;if(!ur&&r!==null&&r.f&24576)return Ee(),e.v;gr(r);try{e.f&=~te,Xt(e),t=Ar(e)}finally{gr(n)}return t}function Qt(e){var t=Zt(e);if(!e.equals(t)&&(e.wv=Dr(),(!vt?.is_fork||e.deps===null)&&(vt===null?e.v=t:vt.capture(e,t,!0),e.deps===null))){et(e,v);return}ur||(bt===null?tt(e):(In()||vt?.is_fork)&&bt.set(e,t))}function $t(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(se),t.teardown=f,t.ac=null,Mr(t,0),Xn(t))}function en(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&Nr(t)}var tn=new Set,nn=new Map,rn=!1;function an(e,t){return{f:0,v:e,reactions:null,equals:Ie,rv:0,wv:0}}function on(e,t){let n=an(e,t);return vr(n),n}function F(e,t=!1,n=!0){let r=an(e);return t||(r.equals=Re),Be&&n&&He!==null&&He.l!==null&&(He.l.s??=[]).push(r),r}function sn(e,t){return I(e,U(()=>H(e))),t}function I(e,t,r=!1){return fr!==null&&(!pr||fr.f&131072)&&Ke()&&fr.f&4325394&&(_r===null||!n.call(_r,e))&&be(),cn(e,r?fn(t):t,Tt)}function cn(e,t,n=null){if(!e.equals(t)){nn.set(e,ur?t:e.v);var r=Ot.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Zt(t),bt===null&&tt(t)}e.wv=Dr(),dn(e,y,n),Ke()&&hr!==null&&hr.f&1024&&!(hr.f&96)&&(xr===null?Sr([e]):xr.push(e)),!r.is_fork&&tn.size>0&&!rn&&ln()}return t}function ln(){rn=!1;for(let e of tn)e.f&1024&&et(e,b),Or(e)&&Nr(e);tn.clear()}function un(e){I(e,e.v+1)}function dn(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ke(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===hr)){var l=(c&y)===0;if(l&&et(s,t),c&2){var u=s;bt?.delete(u),c&65536||(c&512&&(s.f|=te),dn(u,b,n))}else if(l){var d=s;c&16&&jt!==null&&jt.add(d),n===null?Ft(d):n.push(d)}}}}function fn(t){if(typeof t!=`object`||!t||ae in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=on(0),u=null,d=Tr,f=e=>{if(Tr===d)return e();var t=fr,n=Tr;mr(null),Er(d);var r=e();return mr(t),Er(n),r};return i&&r.set(`length`,on(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ve();var i=r.get(t);return i===void 0?f(()=>{var e=on(n.value,u);return r.set(t,e),e}):I(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>on(Ce,u));r.set(t,e),un(o)}}else I(n,Ce),un(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>on(fn(s?e[n]:Ce),u)),r.set(n,o)),o!==void 0){var c=H(o);return c===Ce?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=H(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==Ce)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==Ce||Reflect.has(e,t);return(n!==void 0||hr!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>on(i?fn(e[t]):Ce,u)),r.set(t,n)),H(n)===Ce)?!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(()=>on(Ce,u)),r.set(d+``,p)):I(p,Ce)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>on(void 0,u)),I(c,fn(n)),r.set(t,c));else{l=c.v!==Ce;var m=f(()=>fn(n));I(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&&I(g,_+1)}un(o)}return!0},ownKeys(e){H(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==Ce});for(var[n,i]of r)i.v!==Ce&&!(n in e)&&t.push(n);return t},setPrototypeOf(){ye()}})}function pn(e){try{if(typeof e==`object`&&e&&ae in e)return e[ae]}catch{}return e}function mn(e,t){return Object.is(pn(e),pn(t))}var hn,gn,_n,vn;function yn(){if(hn===void 0){hn=window,gn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;_n=a(t,`firstChild`).get,vn=a(t,`nextSibling`).get,u(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),u(n)&&(n.__t=void 0)}}function bn(e=``){return document.createTextNode(e)}function xn(e){return _n.call(e)}function Sn(e){return vn.call(e)}function L(e,t){if(!k)return xn(e);var n=xn(A);if(n===null)n=A.appendChild(bn());else if(t&&n.nodeType!==3){var r=bn();return n?.before(r),je(r),r}return t&&En(n),je(n),n}function R(e,t=!1){if(!k){var n=xn(e);return n instanceof Comment&&n.data===``?Sn(n):n}if(t){if(A?.nodeType!==3){var r=bn();return A?.before(r),je(r),r}En(A)}return A}function z(e,t=1,n=!1){let r=k?A:e;for(var i;t--;)i=r,r=Sn(r);if(!k)return r;if(n){if(r?.nodeType!==3){var a=bn();return r===null?i?.after(a):r.before(a),je(a),a}En(r)}return je(r),r}function Cn(e){e.textContent=``}function wn(){return!ze||jt!==null?!1:(hr.f&C)!==0}function Tn(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function En(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 Dn(e,t){if(t){let t=document.body;e.autofocus=!0,Ye(()=>{document.activeElement===t&&e.focus()})}}function On(e){k&&xn(e)!==null&&Cn(e)}var kn=!1;function An(){kn||(kn=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function jn(e){var t=fr,n=hr;mr(null),gr(null);try{return e()}finally{mr(t),gr(n)}}function Mn(e,t,n,r=n){e.addEventListener(t,()=>jn(n));let i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),An()}function Nn(e){hr===null&&(fr===null&&me(e),pe()),ur&&fe(e)}function Pn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Fn(e,t){var n=hr;n!==null&&n.f&8192&&(e|=x);var r={ctx:He,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};vt?.register_created_effect(r);var i=r;if(e&4)wt===null?Ot.ensure().schedule(r):wt.push(r);else if(t!==null){try{Nr(r)}catch(e){throw Qn(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|=T))}if(i!==null&&(i.parent=n,n!==null&&Pn(i,n),fr!==null&&fr.f&2&&!(e&64))){var a=fr;(a.effects??=[]).push(i)}return r}function In(){return fr!==null&&!pr}function Ln(e){let t=Fn(8,null);return et(t,v),t.teardown=e,t}function Rn(e){Nn(`$effect`);var t=hr.f;if(!fr&&t&32&&!(t&32768)){var n=He;(n.e??=[]).push(e)}else return zn(e)}function zn(e){return Fn(4|D,e)}function Bn(e){return Nn(`$effect.pre`),Fn(8|D,e)}function Vn(e){Ot.ensure();let t=Fn(64|E,e);return(e={})=>new Promise(n=>{e.outro?tr(t,()=>{Qn(t),n(void 0)}):(Qn(t),n(void 0))})}function Hn(e){return Fn(4,e)}function B(e,t){var n=He,r={effect:null,ran:!1,deps:e};n.l.$.push(r),r.effect=Gn(()=>{if(e(),!r.ran){r.ran=!0;var n=hr;try{gr(n.parent),U(t)}finally{gr(n)}}})}function Un(){var e=He;Gn(()=>{for(var t of e.l.$){t.deps();var n=t.effect;n.f&1024&&n.deps!==null&&et(n,b),Or(n)&&Nr(n),t.ran=!1}})}function Wn(e){return Fn(re|E,e)}function Gn(e,t=0){return Fn(8|t,e)}function V(e,t=[],n=[],r=[]){Ht(r,t,n,t=>{Fn(8,()=>e(...t.map(H)))})}function Kn(e,t=0){return Fn(16|t,e)}function qn(e,t=0){return Fn(_|t,e)}function Jn(e){return Fn(32|E,e)}function Yn(e){var t=e.teardown;if(t!==null){let e=ur,n=fr;dr(!0),mr(null);try{t.call(null)}finally{dr(e),mr(n)}}}function Xn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&jn(()=>{e.abort(se)});var r=n.next;n.f&64?n.parent=null:Qn(n,t),n=r}}function Zn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Qn(t),t=n}}function Qn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&($n(e.nodes.start,e.nodes.end),n=!0),et(e,w),Xn(e,t&&!n),Mr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Yn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&er(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function $n(e,t){for(;e!==null;){var n=e===t?null:Sn(e);e.remove(),e=n}}function er(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 tr(e,t,n=!0){var r=[];nr(e,r,!0);var i=()=>{n&&Qn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function nr(e,t,n){if(!(e.f&8192)){e.f^=x;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;nr(i,t,o?n:!1)}i=a}}}function rr(e){ir(e,!0)}function ir(e,t){if(e.f&8192){e.f^=x,e.f&1024||(et(e,y),Ot.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;ir(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 ar(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Sn(n);t.append(n),n=i}}var or=null;function sr(e){var t=or;try{if(or=new Set,U(e),t!==null)for(var n of or)t.add(n);return or}finally{or=t}}function cr(e){for(var t of sr(e))cn(t,t.v)}var lr=!1,ur=!1;function dr(e){ur=e}var fr=null,pr=!1;function mr(e){fr=e}var hr=null;function gr(e){hr=e}var _r=null;function vr(e){fr!==null&&(!ze||fr.f&2)&&(_r===null?_r=[e]:_r.push(e))}var yr=null,br=0,xr=null;function Sr(e){xr=e}var Cr=1,wr=0,Tr=wr;function Er(e){Tr=e}function Dr(){return++Cr}function Or(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~te),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Or(a)&&Qt(a),a.wv>e.wv)return!0}t&512&&bt===null&&et(e,v)}return!1}function kr(e,t,r=!0){var i=e.reactions;if(i!==null&&!(!ze&&_r!==null&&n.call(_r,e)))for(var a=0;a<i.length;a++){var o=i[a];o.f&2?kr(o,t,!1):t===o&&(r?et(o,y):o.f&1024&&et(o,b),Ft(o))}}function Ar(e){var t=yr,n=br,r=xr,i=fr,a=_r,o=He,s=pr,c=Tr,l=e.f;yr=null,br=0,xr=null,fr=l&96?null:e,_r=null,Ue(e.ctx),pr=!1,Tr=++wr,e.ac!==null&&(jn(()=>{e.ac.abort(se)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=C;var f=e.deps,p=vt?.is_fork;if(yr!==null){var m;if(p||Mr(e,br),f!==null&&br>0)for(f.length=br+yr.length,m=0;m<yr.length;m++)f[br+m]=yr[m];else e.deps=f=yr;if(In()&&e.f&512)for(m=br;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&br<f.length&&(Mr(e,br),f.length=br);if(Ke()&&xr!==null&&!pr&&f!==null&&!(e.f&6146))for(m=0;m<xr.length;m++)kr(xr[m],e);if(i!==null&&i!==e){if(wr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=wr;if(t!==null)for(let e of t)e.rv=wr;xr!==null&&(r===null?r=xr:r.push(...xr))}return e.f&8388608&&(e.f^=ie),d}catch(e){return Ze(e)}finally{e.f^=ne,yr=t,br=n,xr=r,fr=i,_r=a,Ue(o),pr=s,Tr=c}}function jr(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&&(yr===null||!n.call(yr,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~te),s.v!==Ce&&tt(s),$t(s),Mr(s,0)}}function Mr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)jr(e,n[r])}function Nr(e){var t=e.f;if(!(t&16384)){et(e,v);var n=hr,r=lr;hr=e,lr=!0;try{t&16777232?Zn(e):Xn(e),Yn(e);var i=Ar(e);e.teardown=typeof i==`function`?i:null,e.wv=Cr}finally{lr=r,hr=n}}}async function Pr(){if(ze)return new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),kt()}function H(e){var t=(e.f&2)!=0;if(or?.add(e),fr!==null&&!pr&&!(hr!==null&&hr.f&16384)&&(_r===null||!n.call(_r,e))){var r=fr.deps;if(fr.f&2097152)e.rv<wr&&(e.rv=wr,yr===null&&r!==null&&r[br]===e?br++:yr===null?yr=[e]:yr.push(e));else{(fr.deps??=[]).push(e);var i=e.reactions;i===null?e.reactions=[fr]:n.call(i,fr)||i.push(fr)}}if(ur&&nn.has(e))return nn.get(e);if(t){var a=e;if(ur){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Ir(a))&&(o=Zt(a)),nn.set(a,o),o}var s=(a.f&512)==0&&!pr&&fr!==null&&(lr||(fr.f&512)!=0),c=(a.f&C)===0;Or(a)&&(s&&(a.f|=512),Qt(a)),s&&!c&&(en(a),Fr(a))}if(bt?.has(e))return bt.get(e);if(e.f&8388608)throw e.v;return e.v}function Fr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(en(t),Fr(t))}function Ir(e){if(e.v===Ce)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(nn.has(t)||t.f&2&&Ir(t))return!0;return!1}function U(e){var t=pr;try{return pr=!0,e()}finally{pr=t}}function W(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(ae in e)Lr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&ae in n&&Lr(n)}}}function Lr(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{Lr(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 Rr(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var zr=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function Br(e){return zr.includes(e)}var Vr=`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(`.`),Hr={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 Ur(e){return e=e.toLowerCase(),Hr[e]??e}[...Vr];var Wr=[`touchstart`,`touchmove`];function Gr(e){return Wr.includes(e)}var Kr=[`textarea`,`script`,`style`,`title`];function qr(e){return Kr.includes(e)}var Jr=Symbol(`events`),Yr=new Set,Xr=new Set;function Zr(e,t,n,r={}){function i(e){if(r.capture||ti.call(t,e),!e.cancelBubble)return jn(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Ye(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function G(e,t,n,r,i){var a={capture:r,passive:i},o=Zr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ln(()=>{t.removeEventListener(e,o,a)})}function Qr(e,t,n){(t[Jr]??={})[e]=n}function $r(e){for(var t=0;t<e.length;t++)Yr.add(e[t]);for(var n of Xr)n(e)}var ei=null;function ti(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;ei=e;var s=0,c=ei===e&&e[Jr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[Jr]=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=fr,f=hr;mr(null),gr(null);try{for(var p,m=[];o!==null;){var h=o.assignedSlot||o.parentNode||o.host||null;try{var g=o[Jr]?.[r];g!=null&&(!o.disabled||e.target===o)&&g.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble||h===t||h===null)break;o=h}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Jr]=t,delete e.currentTarget,mr(d),gr(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=Tn(`template`);return t.innerHTML=ri(e.replaceAll(`<!>`,`<!---->`)),t.content}function ai(e,t){var n=hr;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(k)return ai(A,null),A;i===void 0&&(i=ii(a?e:`<!>`+e),n||(i=xn(i)));var t=r||gn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=xn(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)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(k)return ai(A,null),A;if(!o){var e=xn(ii(a));if(i)for(o=document.createDocumentFragment();xn(e);)o.appendChild(xn(e));else o=xn(e)}var t=o.cloneNode(!0);if(i){var n=xn(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(!k){var t=bn(e+``);return ai(t,t),t}var n=A;return n.nodeType===3?En(n):(n.before(n=bn()),je(n)),ai(n,n),n}function li(){if(k)return ai(A,null),A;var e=document.createDocumentFragment(),t=document.createComment(``),n=bn();return e.append(t,n),ai(t,n),e}function q(e,t){if(k){var n=hr;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=A),Me();return}e!==null&&e.before(t)}var ui=!0;function di(e){ui=e}function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function fi(e,t){return mi(e,t)}var pi=new Map;function mi(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){yn();var l=void 0,u=Vn(()=>{var u=n??t.appendChild(bn());Bt(u,{pending:()=>{}},t=>{We({});var n=He;if(o&&(n.c=o),a&&(i.$$events=a),k&&ai(t,null),ui=s,l=e(t,i)||{},ui=!0,k&&(hr.nodes.end=A,A===null||A.nodeType!==8||A.data!==`]`))throw De(),Se;Ge()},c);var d=new Set,f=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!d.has(r)){d.add(r);var i=Gr(r);for(let e of[t,document]){var a=pi.get(e);a===void 0&&(a=new Map,pi.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 f(r(Yr)),Xr.add(f),()=>{for(var e of d)for(let n of[t,document]){var r=pi.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,ti),r.delete(e),r.size===0&&pi.delete(n)):r.set(e,i)}Xr.delete(f),u!==n&&u.parentNode?.removeChild(u)}});return hi.set(l,u),l}var hi=new WeakMap,gi=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)rr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(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&&(Qn(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();ar(r,t),t.append(bn()),this.#n.set(e,{effect:r,fragment:t})}else Qn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),tr(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)||(Qn(n.effect),this.#n.delete(e))};ensure(e,t){var n=vt,r=wn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=bn();i.append(a),this.#n.set(e,{effect:Jn(()=>t(a)),fragment:i})}else this.#t.set(e,Jn(()=>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 k&&(this.anchor=A),this.#a(n)}};function Y(e,t,n=!1){var r;k&&(r=A,Me());var i=new gi(e),a=n?T:0;function o(e,t){if(k){var n=Fe(r);if(e!==parseInt(n.substring(1))){var a=Pe();je(a),i.anchor=a,Ae(!1),i.ensure(e,t),Ae(!0);return}}i.ensure(e,t)}Kn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function _i(e,t){return t}function vi(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];tr(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;yi(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;if(l){var u=n,d=u.parentNode;Cn(d),d.append(u),e.items.clear()}yi(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function yi(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|=ee,ar(a,document.createDocumentFragment())):Qn(t[i],n)}}var bi;function X(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=k?je(xn(u)):u.appendChild(bn())}k&&Me();var d=null,f=Yt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Si(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ee,wi(d,null,c)):rr(d):tr(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Kn(()=>{p=H(f);var e=p.length;let t=!1;k&&Fe(c)===`[!`!=(e===0)&&(c=Pe(),je(c),Ae(!1),t=!0);for(var r=new Set,u=vt,v=wn(),y=0;y<e;y+=1){k&&A.nodeType===8&&A.data===`]`&&(c=A,t=!0,Ae(!1));var b=p[y],x=a(b,y),S=h?null:l.get(x);S?(S.v&&cn(S.v,b),S.i&&cn(S.i,y),v&&u.unskip_effect(S.e)):(S=Ci(l,h?c:bi??=bn(),b,x,y,o,n,i),h||(S.e.f|=ee),l.set(x,S)),r.add(x)}if(e===0&&s&&!d&&(h?d=Jn(()=>s(c)):(d=Jn(()=>s(bi??=bn())),d.f|=ee)),e>r.size&&de(``,``,``),k&&e>0&&je(Pe()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&Ae(!0),H(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,k&&(c=A)}function xi(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Si(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=xi(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&&(rr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432)if(_.f^=ee,_===l)wi(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Ti(e,d,_),Ti(e,_,y),wi(_,y,n),d=_,p=[],m=[],l=xi(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)wi(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Ti(e,S.prev,C.next),Ti(e,d,S),Ti(e,C,b),l=b,d=C,--v,p=[],m=[]}else u.delete(_),wi(_,l,n),Ti(e,_.prev,_.next),Ti(e,_,d===null?e.effect.first:d.next),Ti(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=xi(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=xi(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(yi(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=xi(l.next);var T=w.length;if(T>0){var E=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()}vi(e,w,E)}}o&&Ye(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Ci(e,t,n,r,i,a,o,s){var c=o&1?o&16?an(n):F(n,!1,!1):null,l=o&2?an(i):null;return{v:c,i:l,e:Jn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function wi(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=Sn(r);if(a.before(r),r===i)return;r=o}}function Ti(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}var Ei=()=>performance.now(),Di={tick:e=>requestAnimationFrame(e),now:()=>Ei(),tasks:new Set};function Oi(){let e=Di.now();Di.tasks.forEach(t=>{t.c(e)||(Di.tasks.delete(t),t.f())}),Di.tasks.size!==0&&Di.tick(Oi)}function ki(e){let t;return Di.tasks.size===0&&Di.tick(Oi),{promise:new Promise(n=>{Di.tasks.add(t={c:e,f:n})}),abort(){Di.tasks.delete(t)}}}function Ai(e,t){jn(()=>{e.dispatchEvent(new CustomEvent(t))})}function ji(e){if(e===`float`)return`cssFloat`;if(e===`offset`)return`cssOffset`;if(e.startsWith(`--`))return e;let t=e.split(`-`);return t.length===1?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join(``)}function Mi(e){let t={},n=e.split(`;`);for(let e of n){let[n,r]=e.split(`:`);if(!n||r===void 0)break;let i=ji(n.trim());t[i]=r.trim()}return t}var Ni=e=>e;function Pi(e,t,n,r){var i=(e&1)!=0,a=(e&2)!=0,o=i&&a,s=(e&4)!=0,c=o?`both`:i?`in`:`out`,l,u=t.inert,d=t.style.overflow,f,p;function m(){return jn(()=>l??=n()(t,r?.()??{},{direction:c}))}var h={is_global:s,in(){if(t.inert=u,!i){p?.abort(),p?.reset?.();return}a||f?.abort(),f=Fi(t,m(),p,1,()=>{Ai(t,`introend`),f?.abort(),f=l=void 0,t.style.overflow=d})},out(e){if(!a){e?.(),l=void 0;return}t.inert=!0,p=Fi(t,m(),f,0,()=>{Ai(t,`outroend`),e?.()})},stop:()=>{f?.abort(),p?.abort()}},g=hr;if((g.nodes.t??=[]).push(h),i&&ui){var _=s;if(!_){for(var v=g.parent;v&&v.f&65536;)for(;(v=v.parent)&&!(v.f&16););_=!v||(v.f&32768)!=0}_&&Hn(()=>{U(()=>h.in())})}}function Fi(e,t,n,r,i){var a=r===1;if(d(t)){var o,s=!1;return Ye(()=>{s||(o=Fi(e,t({direction:a?`in`:`out`}),n,r,i))}),{abort:()=>{s=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(n?.deactivate(),!t?.duration&&!t?.delay)return Ai(e,a?`introstart`:`outrostart`),i(),{abort:f,deactivate:f,reset:f,t:()=>r};let{delay:c=0,css:l,tick:u,easing:p=Ni}=t;var m=[];if(a&&n===void 0&&(u&&u(0,1),l)){var h=Mi(l(0,1));m.push(h,h)}var g=()=>1-r,_=e.animate(m,{duration:c,fill:`forwards`});return _.onfinish=()=>{_.cancel(),Ai(e,a?`introstart`:`outrostart`);var o=n?.t()??1-r;n?.abort();var s=r-o,c=t.duration*Math.abs(s),d=[];if(c>0){var f=!1;if(l)for(var m=Math.ceil(c/(1e3/60)),h=0;h<=m;h+=1){var v=o+s*p(h/m),y=Mi(l(v,1-v));d.push(y),f||=y.overflow===`hidden`}f&&(e.style.overflow=`hidden`),g=()=>{var e=_.currentTime;return o+s*p(e/c)},u&&ki(()=>{if(_.playState!==`running`)return!1;var e=g();return u(e,1-e),!0})}_=e.animate(d,{duration:c,fill:`forwards`}),_.onfinish=()=>{g=()=>r,u?.(r,1-r),i()}},{abort:()=>{_&&(_.cancel(),_.effect=null,_.onfinish=f)},deactivate:()=>{i=f},reset:()=>{r===0&&u?.(1,0)},t:()=>g()}}function Ii(e,t,n,r,i,a){let o=k;k&&Me();var s=null;k&&A.nodeType===1&&(s=A,Me());var c=k?A:e,l=new gi(c,!1);Kn(()=>{let e=t()||null;var a=i?i():n||e===`svg`?Te:void 0;if(e===null){l.ensure(null,null),di(!0);return}return l.ensure(e,t=>{if(e){if(s=k?s:Tn(e,a),ai(s,s),r){k&&qr(e)&&s.append(document.createComment(``));var n=k?xn(s):s.appendChild(bn());k&&(n===null?Ae(!1):je(n)),r(s,n)}hr.nodes.end=s,t.before(s)}k&&je(t)}),di(!0),()=>{e&&di(!1)}},T),Ln(()=>{di(!0)}),o&&(Ae(!0),je(c))}function Li(e,t){var n=void 0,r;qn(()=>{n!==(n=t())&&(r&&=(Qn(r),null),n&&(r=Jn(()=>{Hn(()=>n(e))})))})}function Ri(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=Ri(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function zi(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ri(e))&&(r&&(r+=` `),r+=t);return r}function Bi(e){return typeof e==`object`?zi(e):e??``}var Vi=[...`
|
|
2
|
+
\r\f\xA0\v`];function Hi(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||Vi.includes(r[o-1]))&&(s===r.length||Vi.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Ui(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 Wi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Gi(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Wi)),i&&c.push(...Object.keys(i).map(Wi));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=Wi(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+=Ui(r)),i&&(n+=Ui(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ki(e,t,n,r,i,a){var o=e.__className;if(k||o!==n||o===void 0){var s=Hi(n,r,a);(!k||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e.__className=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 qi(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 Ji(e,t,n,r){var i=e.__style;if(k||i!==t){var a=Gi(t,r);(!k||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e.__style=t}else r&&(Array.isArray(r)?(qi(e,n?.[0],r[0]),qi(e,n?.[1],r[1],`important`)):qi(e,n,r));return r}function Yi(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return Oe();for(var i of t.options)i.selected=n.includes(Qi(i));return}for(i of t.options)if(mn(Qi(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function Xi(e){var t=new MutationObserver(()=>{Yi(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),Ln(()=>{t.disconnect()})}function Zi(e,t,n=t){var r=new WeakSet,i=!0;Mn(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),Qi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&Qi(o)}n(a),e.__value=a,vt!==null&&r.add(vt)}),Hn(()=>{var a=t();if(e===document.activeElement){var o=ze?yt:vt;if(r.has(o))return}if(Yi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=Qi(s),n(a))}e.__value=a,i=!1}),Xi(e)}function Qi(e){return`__value`in e?e.__value:e.value}var $i=Symbol(`class`),ea=Symbol(`style`),ta=Symbol(`is custom element`),na=Symbol(`is html`),ra=ce?`link`:`LINK`,ia=ce?`input`:`INPUT`,aa=ce?`option`:`OPTION`,oa=ce?`select`:`SELECT`,sa=ce?`progress`:`PROGRESS`;function ca(e){if(k){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;fa(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;fa(e,`checked`,null),e.checked=r}}};e.__on_r=n,Ye(n),An()}}function la(e,t){var n=ha(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==sa)||(e.value=t??``)}function ua(e,t){var n=ha(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function da(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function fa(e,t,n,r){var i=ha(e);k&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===ra)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[O]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&_a(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function pa(e,t,n,r,i=!1,a=!1){if(k&&i&&e.nodeName===ia){var o=e;(o.type===`checkbox`?`defaultChecked`:`defaultValue`)in n||ca(o)}var s=ha(e),c=s[ta],l=!s[na];let u=k&&c;u&&Ae(!1);var d=t||{},f=e.nodeName===aa;for(var p in t)p in n||(n[p]=null);n.class?n.class=Bi(n.class):(r||n[$i])&&(n.class=null),n[ea]&&(n.style??=null);var m=_a(e);for(let i in n){let o=n[i];if(f&&i===`value`&&o==null){e.value=e.__value=``,d[i]=o;continue}if(i===`class`){Ki(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,o,r,t?.[$i],n[$i]),d[i]=o,d[$i]=n[$i];continue}if(i===`style`){Ji(e,o,t?.[ea],n[ea]),d[i]=o,d[ea]=n[ea];continue}var h=d[i];if(!(o===h&&!(o===void 0&&e.hasAttribute(i)))){d[i]=o;var g=i[0]+i[1];if(g!==`$$`)if(g===`on`){let t={},n=`$$`+i,r=i.slice(2);var _=Br(r);if(Rr(r)&&(r=r.slice(0,-7),t.capture=!0),!_&&h){if(o!=null)continue;e.removeEventListener(r,d[n],t),d[n]=null}if(_)Qr(r,e,o),$r([r]);else if(o!=null){function a(e){d[i].call(this,e)}d[n]=Zr(r,e,a,t)}}else if(i===`style`)fa(e,i,o);else if(i===`autofocus`)Dn(e,!!o);else if(!c&&(i===`__value`||i===`value`&&o!=null))e.value=e.__value=o;else if(i===`selected`&&f)da(e,o);else{var v=i;l||(v=Ur(v));var y=v===`defaultValue`||v===`defaultChecked`;if(o==null&&!c&&!y)if(s[i]=null,v===`value`||v===`checked`){let n=e,r=t===void 0;if(v===`value`){let e=n.defaultValue;n.removeAttribute(v),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(v),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i);else y||m.includes(v)&&(c||typeof o!=`string`)?(e[v]=o,v in s&&(s[v]=Ce)):typeof o!=`function`&&fa(e,v,o,a)}}}return u&&Ae(!0),d}function ma(e,t,n=[],r=[],i=[],a,o=!1,s=!1){Ht(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===oa,l=!1;if(qn(()=>{var u=t(...n.map(H)),d=pa(e,r,u,a,o,s);l&&c&&`value`in u&&Yi(e,u.value);for(let e of Object.getOwnPropertySymbols(i))u[e]||Qn(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var f=u[t];t.description===`@attach`&&(!r||f!==r[t])&&(i[t]&&Qn(i[t]),i[t]=Jn(()=>Li(e,()=>f))),d[t]=f}r=d}),c){var u=e;Hn(()=>{Yi(u,r.value,!0),Xi(u)})}l=!0})}function ha(e){return e.__attributes??={[ta]:e.nodeName.includes(`-`),[na]:e.namespaceURI===we}}var ga=new Map;function _a(e){var t=e.getAttribute(`is`)||e.nodeName,n=ga.get(t);if(n)return n;ga.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&n.push(s);i=l(i)}return n}function Z(e,t,n=t){var r=new WeakSet;Mn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=va(e)?ya(a):a,n(a),vt!==null&&r.add(vt),await Pr(),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))}}}),(k&&e.defaultValue!==e.value||U(t)==null&&e.value)&&(n(va(e)?ya(e.value):e.value),vt!==null&&r.add(vt)),Gn(()=>{var n=t();if(e===document.activeElement){var i=ze?yt:vt;if(r.has(i))return}va(e)&&n===ya(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function va(e){var t=e.type;return t===`number`||t===`range`}function ya(e){return e===``?null:+e}function ba(e,t,n){var r=a(e,t);r&&r.set&&(e[t]=n,Ln(()=>{e[t]=null}))}function xa(e,t){return e===t||e?.[ae]===t}function Sa(e={},t,n,r){var i=He.r,a=hr;return Hn(()=>{var o,s;return Gn(()=>{o=s,s=r?.()||[],U(()=>{e!==n(...s)&&(t(e,...s),o&&xa(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&&xa(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ca(e){return function(...t){return t[0].stopPropagation(),e?.apply(this,t)}}function wa(e){return function(...t){return t[0].preventDefault(),e?.apply(this,t)}}function Ta(e=!1){let t=He,n=t.l.u;if(!n)return;let r=()=>W(t.s);if(e){let e=0,n={},i=Kt(()=>{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=()=>H(i)}n.b.length&&Bn(()=>{Ea(t,r),m(n.b)}),Rn(()=>{let e=U(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&Rn(()=>{Ea(t,r),m(n.a)})}function Ea(e,t){if(e.l.s)for(let t of e.l.s)H(t);t()}function Da(t,n){var r=t.$$events?.[n.type];for(var i of e(r)?r.slice():r==null?[]:[r])i.call(this,n)}function Q(e,t,n,r){var i=!Be||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=()=>(l&&(l=!1,c=s?U(r):r),c);let d;if(o){var f=ae in e||oe in e;d=a(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,m=!1;o?[p,m]=gt(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&_e(t),d(p)));var h=i?()=>{var n=e[t];return n===void 0?u():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return h;if(d){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||m)&&d(t?h():e),e):h()})}var _=!1,v=(n&1?Kt:Yt)(()=>(_=!1,h()));o&&H(v);var y=hr;return(function(e,t){if(arguments.length>0){let n=t?H(v):i&&o?fn(e):e;return I(v,n),_=!0,c!==void 0&&(c=n),e}return ur&&_||y.f&16384?v.v:H(v)})}function Oa(e){He===null&&le(`onMount`),Be&&He.l!==null?Na(He).m.push(e):Rn(()=>{let t=U(e);if(typeof t==`function`)return t})}function ka(e){He===null&&le(`onDestroy`),Oa(()=>()=>U(e))}function Aa(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function ja(){let t=He;return t===null&&le(`createEventDispatcher`),(n,r,i)=>{let a=t.s.$$events?.[n];if(a){let o=e(a)?a.slice():[a],s=Aa(n,r,i);for(let e of o)e.call(t.x,s);return!s.defaultPrevented}return!0}}function Ma(e){He===null&&le(`afterUpdate`),He.l===null&&ge(`afterUpdate`),Na(He).a.push(e)}function Na(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`),Ve();var Pa=M(`light`),Fa=M(`dashboard`),Ia=M([]),La=M(null),Ra=M(!1),za=M([]),Ba=M(``),Va=M(null),Ha=M(null),Ua=M([]),Wa=M(0),Ga=M(1),Ka=M(25),qa=M(``),Ja=M(``),Ya=M(null),Xa=M(null),Za=M(`updated_at`),Qa=M(`desc`),$a=M(new Set),eo=M(``),to=M([]),no=M(0),ro=M(1),io=M(25),ao=M(null),oo=st([Ia,za,Ba],([e,t,n])=>{let r=n?e.filter(e=>e.repo.toLowerCase().includes(n.toLowerCase())):e;return{pinned:r.filter(e=>t.includes(e.repo)).sort((e,n)=>t.indexOf(e.repo)-t.indexOf(n.repo)),unpinned:r.filter(e=>!t.includes(e.repo))}}),so=st([Wa,Ka],([e,t])=>Math.max(1,Math.ceil(e/t)));function co(){let e=localStorage.getItem(`theme`)||`light`;Pa.set(e),document.documentElement.classList.toggle(`dark`,e===`dark`),Ra.set(localStorage.getItem(`repoSidebarCollapsed`)===`1`);try{let e=localStorage.getItem(`pinnedRepos`);za.set(e?JSON.parse(e):[])}catch{za.set([])}let t=localStorage.getItem(`activeTab`);t&&Fa.set(t),Pa.subscribe(e=>{localStorage.setItem(`theme`,e),document.documentElement.classList.toggle(`dark`,e===`dark`)}),Ra.subscribe(e=>{localStorage.setItem(`repoSidebarCollapsed`,e?`1`:`0`)}),za.subscribe(e=>{localStorage.setItem(`pinnedRepos`,JSON.stringify(e))}),Fa.subscribe(e=>{localStorage.setItem(`activeTab`,e)})}async function lo(e,t){let n=await fetch(e,t);if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||e.errors?.[0]?.detail||`HTTP ${n.status}`)}return uo(await n.json())}function uo(e){if(!e||typeof e!=`object`||!(`data`in e))return e;let{data:t,meta:n}=e,r=e=>{let t=e.attributes||{};return e.type===`status`&&t.success===void 0&&(t.success=!0),e.id===`system`?t:{id:e.id,...t}};if(Array.isArray(t)){let e=t.map(r),i={};n&&(i.pagination=n);let a=t[0]?.type;if(a===`repository`)return{repos:e};if(a===`recent-action`)return{...i,actions:e};if(a===`memory`)return{...i,memories:e};if(a===`task`)return{...i,tasks:e};let o=a?`${a}s`:`data`;return i[o]=e,i}if(t.type===`capability`){let e=t.attributes,n=e=>e.map(e=>({data:{id:e.id,...e.attributes||{}}}));return{tools:n(e.tools||[]),prompts:n(e.prompts||[]),resources:n(e.resources||[])}}return r(t)}var fo={health:()=>lo(`/api/health`),repos:()=>lo(`/api/repos`),stats:e=>lo(`/api/stats${e?`?repo=${encodeURIComponent(e)}`:``}`),recentActions:(e,t,n)=>{let r=`/api/recent-actions?page=${t}&pageSize=${n}`;return e&&(r+=`&repo=${encodeURIComponent(e)}`),lo(r)},memories:e=>{let t=new URLSearchParams({repo:e.repo});return e.type&&t.set(`type`,e.type),e.search&&t.set(`search`,e.search),e.minImportance!=null&&t.set(`minImportance`,String(e.minImportance)),e.maxImportance!=null&&t.set(`maxImportance`,String(e.maxImportance)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.page&&t.set(`page`,String(e.page)),e.pageSize&&t.set(`pageSize`,String(e.pageSize)),lo(`/api/memories?${t}`)},memoryById:e=>lo(`/api/memories/${e}`),createMemory:e=>lo(`/api/memories`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),updateMemory:(e,t)=>lo(`/api/memories/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),deleteMemory:e=>lo(`/api/memories/${e}`,{method:`DELETE`}),bulkImportMemories:(e,t)=>lo(`/api/memories/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({repo:e,items:t})}),bulkMemoryAction:(e,t,n)=>lo(`/api/memories/action`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e,ids:t,updates:n})}),tasks:e=>{let t=new URLSearchParams({repo:e.repo});return e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.page&&t.set(`page`,String(e.page)),e.pageSize&&t.set(`pageSize`,String(e.pageSize)),lo(`/api/tasks?${t}`)},taskById:e=>lo(`/api/tasks/${e}`),taskByCode:(e,t)=>lo(`/api/tasks/by-code?repo=${encodeURIComponent(e)}&task_code=${encodeURIComponent(t)}`),taskTimeStats:e=>lo(`/api/tasks/stats/time?repo=${encodeURIComponent(e)}`),updateTask:(e,t)=>lo(`/api/tasks/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),createTask:e=>lo(`/api/tasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),deleteTask:e=>lo(`/api/tasks/${e}`,{method:`DELETE`}),bulkImportTasks:(e,t)=>lo(`/api/tasks/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({repo:e,items:t})}),updateTaskComment:(e,t)=>lo(`/api/tasks/comments/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({comment:t})}),deleteTaskComment:e=>lo(`/api/tasks/comments/${e}`,{method:`DELETE`}),standards:e=>{let t=new URLSearchParams;return e.repo&&t.set(`repo`,e.repo),e.query&&t.set(`query`,e.query),e.language&&t.set(`language`,e.language),e.stack&&t.set(`stack`,e.stack),e.tags&&t.set(`tags`,e.tags),e.is_global!==void 0&&t.set(`is_global`,String(e.is_global)),e.page&&t.set(`page`,String(e.page)),e.pageSize&&t.set(`pageSize`,String(e.pageSize)),lo(`/api/standards?${t}`)},standardById:e=>lo(`/api/standards/${e}`),createStandard:e=>lo(`/api/standards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),updateStandard:(e,t)=>lo(`/api/standards/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),deleteStandard:e=>lo(`/api/standards/${e}`,{method:`DELETE`}),export:e=>lo(`/api/export?repo=${encodeURIComponent(e)}`),capabilities:()=>lo(`/api/capabilities`),callTool:(e,t)=>lo(`/api/tools/${encodeURIComponent(e)}/call`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})},po=[{id:`dashboard`,label:`Dashboard`,icon:`layout-dashboard`},{id:`activity`,label:`Activity`,icon:`activity`},{id:`memories`,label:`Memories`,icon:`brain`},{id:`tasks`,label:`Tasks`,icon:`clipboard-list`},{id:`standards`,label:`Standards`,icon:`check`},{id:`handoffs`,label:`Handoffs`,icon:`git-branch`},{id:`reference`,label:`Reference`,icon:`book-open`}];function mo(e){let{subscribe:t,set:n,update:r}=M({mobileMenuOpen:!1,selectedMemory:null,selectedTask:null,drawerOpen:!1,selectedReference:null,referenceDrawerOpen:!1,memoryDrawerOpen:!1,memoryDrawerItem:null,bulkImportOpen:!1,bulkImportTarget:`memories`,addTaskModalOpen:!1,newTask:{task_code:``,title:``,phase:``,description:``,status:`pending`,priority:3},capabilities:null,referenceSearch:``,referenceFilter:`all`});async function i(){try{let e=await fo.repos();if(Ia.set(e.repos||[]),e.repos?.length>0){let t=localStorage.getItem(`selectedRepo`),n=e.repos.find(e=>e.repo===t)?t:e.repos[0].repo;La.set(n),localStorage.setItem(`selectedRepo`,n)}}catch(e){console.error(`Failed to load repos:`,e)}}async function a(){try{let e=await fo.health();ao.set(e)}catch{ao.set(null)}}async function o(){let e=N(La);if(e){try{let t=await fo.stats(e);Va.set(t)}catch(e){console.error(`Failed to load stats:`,e)}try{let t=await fo.taskTimeStats(e);Ha.set(t)}catch(e){console.error(`Failed to load task time stats:`,e)}}}async function s(e,t=!1){let n=N(La);if(!n)return;let r=e??N(ro);try{let e=await fo.recentActions(n,r,N(io));t?to.update(t=>[...t,...e.actions||[]]):to.set(e.actions||[]),ro.set(e.pagination?.page??r),no.set(e.pagination?.totalItems??0)}catch(e){console.error(`Failed to load recent actions:`,e)}}async function c(){N(La)&&await Promise.all([o(),s()])}async function l(t){La.set(t),await c(),e.memoryList?.refresh(),e.kanbanBoard?.loadTasks(t),r(e=>({...e,mobileMenuOpen:!1}))}async function u(){await a(),await c();let t=N(Fa),n=N(La);t===`memories`&&e.memoryList?.refresh(),t===`tasks`&&n&&e.kanbanBoard?.loadTasks(n)}async function d(n){Fa.set(n);let i=N(La);if(n===`memories`)setTimeout(()=>e.memoryList?.refresh(),50);else if(n===`tasks`&&i)setTimeout(()=>e.kanbanBoard?.loadTasks(i),50);else if(n===`reference`&&!N({subscribe:t}).capabilities)try{let e=await fo.capabilities();r(t=>({...t,capabilities:e}))}catch(e){console.error(`Failed to load capabilities:`,e)}}function f(e){r(t=>({...t,bulkImportTarget:e,bulkImportOpen:!0}))}function p(e,t){r(n=>({...n,selectedReference:{type:e,data:t},referenceDrawerOpen:!0}))}function m(e){r(t=>({...t,memoryDrawerItem:e,memoryDrawerOpen:!0}))}function h(){r(e=>({...e,memoryDrawerItem:null,memoryDrawerOpen:!0}))}function g(){e.memoryList?.refresh()}function _(){e.memoryList?.refresh()}async function v(e){r(t=>({...t,selectedTask:e,selectedMemory:null,drawerOpen:!0}));try{let n=await fo.taskById(e.id);N({subscribe:t}).selectedTask?.id===n.id&&r(e=>({...e,selectedTask:n}))}catch(e){console.error(`Failed to fetch full task details:`,e)}}function y(){r(e=>({...e,drawerOpen:!1})),setTimeout(()=>{r(e=>({...e,selectedMemory:null,selectedTask:null}))},300)}function b(t){r(e=>({...e,selectedTask:t}));let n=N(La);n&&e.kanbanBoard?.loadTasks(n)}async function x(){let n=N(La),{newTask:i}=N({subscribe:t});if(!(!n||!i.task_code||!i.title))try{await fo.createTask({...i,repo:n}),r(e=>({...e,addTaskModalOpen:!1,newTask:{task_code:``,title:``,phase:``,description:``,status:`pending`,priority:3}})),e.kanbanBoard?.loadTasks(n)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;alert(`Failed to create task: `+t)}}function S(e){let t=e.target?.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.key===`Escape`&&y(),(e.key===`r`||e.key===`R`)&&u())}function C(){r(e=>({...e,mobileMenuOpen:!e.mobileMenuOpen}))}function w(e){r(t=>({...t,referenceSearch:e}))}function T(e){r(t=>({...t,referenceFilter:e}))}function E(e){r(t=>({...t,referenceDrawerOpen:e}))}function D(e){r(t=>({...t,memoryDrawerOpen:e}))}function ee(e){r(t=>({...t,addTaskModalOpen:e}))}function te(e){r(t=>({...t,bulkImportOpen:e}))}return{subscribe:t,set:n,update:r,TABS:po,sidebarCollapsed:st(Ra,e=>e),filteredTools:st({subscribe:t},e=>(e.capabilities?.tools||[]).filter(t=>(e.referenceFilter===`all`||e.referenceFilter===`tools`)&&(!e.referenceSearch||t.data.name.toLowerCase().includes(e.referenceSearch.toLowerCase())||(t.data.description||``).toLowerCase().includes(e.referenceSearch.toLowerCase())))),filteredPrompts:st({subscribe:t},e=>(e.capabilities?.prompts||[]).filter(t=>(e.referenceFilter===`all`||e.referenceFilter===`prompts`)&&(!e.referenceSearch||t.data.name.toLowerCase().includes(e.referenceSearch.toLowerCase())||(t.data.description||``).toLowerCase().includes(e.referenceSearch.toLowerCase())))),filteredResources:st({subscribe:t},e=>(e.capabilities?.resources||[]).filter(t=>(e.referenceFilter===`all`||e.referenceFilter===`resources`)&&(!e.referenceSearch||t.data.name.toLowerCase().includes(e.referenceSearch.toLowerCase())||(t.data.description||``).toLowerCase().includes(e.referenceSearch.toLowerCase())))),loadRepos:i,loadHealth:a,loadData:c,loadStats:o,loadRecentActions:s,onRepoSelect:l,onRefresh:u,onTabChange:d,openBulkImport:f,openReferenceDrawer:p,openMemoryDrawer:m,openNewMemoryDrawer:h,handleMemorySaved:g,handleMemoryDeleted:_,openTaskDrawer:v,closeDrawer:y,handleTaskUpdated:b,createTask:x,onKeyDown:S,toggleMobileMenu:C,setReferenceSearch:w,setReferenceFilter:T,toggleReferenceDrawer:E,toggleMemoryDrawer:D,toggleAddTaskModal:ee,toggleBulkImport:te,refs:e}}function ho(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var go=ho();function _o(e){go=e}var vo={exec:()=>null};function yo(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(xo.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var bo=(()=>{try{return!0}catch{return!1}})(),xo={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},So=/^(?:[ \t]*(?:\n|$))+/,Co=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,To=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Eo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Do=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Oo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ko=yo(Oo).replace(/bull/g,Do).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Ao=yo(Oo).replace(/bull/g,Do).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Mo=/^[^\n]+/,No=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Po=yo(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,No).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fo=yo(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Do).getRegex(),Io=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Lo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ro=yo(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Lo).replace(`tag`,Io).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),zo=yo(jo).replace(`hr`,To).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Io).getRegex(),Bo={blockquote:yo(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,zo).getRegex(),code:Co,def:Po,fences:wo,heading:Eo,hr:To,html:Ro,lheading:ko,list:Fo,newline:So,paragraph:zo,table:vo,text:Mo},Vo=yo(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,To).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Io).getRegex(),Ho={...Bo,lheading:Ao,table:Vo,paragraph:yo(jo).replace(`hr`,To).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Vo).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Io).getRegex()},Uo={...Bo,html:yo(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Lo).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:yo(jo).replace(`hr`,To).replace(`heading`,` *#{1,6} *[^
|
|
3
|
+
]`).replace(`lheading`,ko).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Wo=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Go=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ko=/^( {2,}|\\)\n(?!\s*$)/,qo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jo=/[\p{P}\p{S}]/u,Yo=/[\s\p{P}\p{S}]/u,Xo=/[^\s\p{P}\p{S}]/u,Zo=yo(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Yo).getRegex(),Qo=/(?!~)[\p{P}\p{S}]/u,$o=/(?!~)[\s\p{P}\p{S}]/u,es=/(?:[^\s\p{P}\p{S}]|~)/u,ts=yo(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,bo?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ns=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,rs=yo(ns,`u`).replace(/punct/g,Jo).getRegex(),is=yo(ns,`u`).replace(/punct/g,Qo).getRegex(),as=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,os=yo(as,`gu`).replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,Yo).replace(/punct/g,Jo).getRegex(),ss=yo(as,`gu`).replace(/notPunctSpace/g,es).replace(/punctSpace/g,$o).replace(/punct/g,Qo).getRegex(),cs=yo(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,Yo).replace(/punct/g,Jo).getRegex(),ls=yo(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Jo).getRegex(),us=yo(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Xo).replace(/punctSpace/g,Yo).replace(/punct/g,Jo).getRegex(),ds=yo(/\\(punct)/,`gu`).replace(/punct/g,Jo).getRegex(),fs=yo(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ps=yo(Lo).replace(`(?:-->|$)`,`-->`).getRegex(),ms=yo(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,ps).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gs=yo(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,hs).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_s=yo(/^!?\[(label)\]\[(ref)\]/).replace(`label`,hs).replace(`ref`,No).getRegex(),vs=yo(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,No).getRegex(),ys=yo(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,_s).replace(`nolink`,vs).getRegex(),bs=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xs={_backpedal:vo,anyPunctuation:ds,autolink:fs,blockSkip:ts,br:Ko,code:Go,del:vo,delLDelim:vo,delRDelim:vo,emStrongLDelim:rs,emStrongRDelimAst:os,emStrongRDelimUnd:cs,escape:Wo,link:gs,nolink:vs,punctuation:Zo,reflink:_s,reflinkSearch:ys,tag:ms,text:qo,url:vo},Ss={...xs,link:yo(/^!?\[(label)\]\((.*?)\)/).replace(`label`,hs).getRegex(),reflink:yo(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,hs).getRegex()},Cs={...xs,emStrongRDelimAst:ss,emStrongLDelim:is,delLDelim:ls,delRDelim:us,url:yo(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,bs).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:yo(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,bs).getRegex()},ws={...Cs,br:yo(Ko).replace(`{2,}`,`*`).getRegex(),text:yo(Cs.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ts={normal:Bo,gfm:Ho,pedantic:Uo},Es={normal:xs,gfm:Cs,breaks:ws,pedantic:Ss},Ds={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Os=e=>Ds[e];function ks(e,t){if(t){if(xo.escapeTest.test(e))return e.replace(xo.escapeReplace,Os)}else if(xo.escapeTestNoEncode.test(e))return e.replace(xo.escapeReplaceNoEncode,Os);return e}function As(e){try{e=encodeURI(e).replace(xo.percentDecode,`%`)}catch{return null}return e}function js(e,t){let n=e.replace(xo.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(xo.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(xo.slashPipe,`|`);return n}function Ms(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Ns(e){let t=e.split(`
|
|
4
|
+
`),n=t.length-1;for(;n>=0&&!t[n].trim();)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
5
|
+
`)}function Ps(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Fs(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Is(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Ls(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
6
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
7
|
+
`)}var Rs=class{options;rules;lexer;constructor(e){this.options=e||go}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Ns(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ls(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Ms(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Ms(t[0],`
|
|
8
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Ms(t[0],`
|
|
9
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Ms(t[0],`
|
|
10
|
+
`).split(`
|
|
11
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
12
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
14
|
+
${s}`:s,r=r?`${r}
|
|
15
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
16
|
+
`+e.join(`
|
|
17
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
18
|
+
`+e.join(`
|
|
19
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Fs(t[2].split(`
|
|
21
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
22
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
23
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
24
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
25
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
26
|
+
`+l}u=!l.trim(),r+=p+`
|
|
27
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Ns(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Ms(t[0],`
|
|
28
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=js(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
29
|
+
`):[],a={type:`table`,raw:Ms(t[0],`
|
|
30
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(js(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Ms(t[0],`
|
|
31
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
32
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Ms(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ps(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Is(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Is(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},zs=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||go,this.options.tokenizer=this.options.tokenizer||new Rs,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:xo,block:Ts.normal,inline:Es.normal};this.options.pedantic?(t.block=Ts.pedantic,t.inline=Es.pedantic):this.options.gfm&&(t.block=Ts.gfm,this.options.breaks?t.inline=Es.breaks:t.inline=Es.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ts,inline:Es}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(xo.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(xo.tabCharGlobal,` `).replace(xo.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
34
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
35
|
+
`)?``:`
|
|
36
|
+
`)+r.raw,n.text+=`
|
|
37
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
38
|
+
`)?``:`
|
|
39
|
+
`)+r.raw,n.text+=`
|
|
40
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+r.raw,a.text+=`
|
|
43
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+r.raw,n.text+=`
|
|
46
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Bs=class{options;parser;constructor(e){this.options=e||go}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(xo.notSpaceStart)?.[0],i=e.replace(xo.endingNewline,``)+`
|
|
47
|
+
`;return r?`<pre><code class="language-`+ks(r)+`">`+(n?i:ks(i,!0))+`</code></pre>
|
|
48
|
+
`:`<pre><code>`+(n?i:ks(i,!0))+`</code></pre>
|
|
49
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
50
|
+
${this.parser.parse(e)}</blockquote>
|
|
51
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
52
|
+
`}hr(e){return`<hr>
|
|
53
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
54
|
+
`+r+`</`+i+`>
|
|
55
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
56
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
57
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
58
|
+
<thead>
|
|
59
|
+
`+t+`</thead>
|
|
60
|
+
`+r+`</table>
|
|
61
|
+
`}tablerow({text:e}){return`<tr>
|
|
62
|
+
${e}</tr>
|
|
63
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
64
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ks(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=As(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+ks(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=As(e);if(i===null)return ks(n);e=i;let a=`<img src="${e}" alt="${ks(n)}"`;return t&&(a+=` title="${ks(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:ks(e.text)}},Vs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Hs=class e{options;renderer;textRenderer;constructor(e){this.options=e||go,this.options.renderer=this.options.renderer||new Bs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vs}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Us=class{options;block;constructor(e){this.options=e||go}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?zs.lex:zs.lexInline}provideParser(e=this.block){return e?Hs.parse:Hs.parseInline}},Ws=new class{defaults=ho();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Hs;Renderer=Bs;TextRenderer=Vs;Lexer=zs;Tokenizer=Rs;Hooks=Us;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Bs(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Rs(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Us;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Us.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Us.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return zs.lex(e,t??this.defaults)}parser(e,t){return Hs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?zs.lex:zs.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Hs.parse:Hs.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?zs.lex:zs.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Hs.parse:Hs.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+ks(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Gs(e,t){return Ws.parse(e,t)}Gs.options=Gs.setOptions=function(e){return Ws.setOptions(e),Gs.defaults=Ws.defaults,_o(Gs.defaults),Gs},Gs.getDefaults=ho,Gs.defaults=go,Gs.use=function(...e){return Ws.use(...e),Gs.defaults=Ws.defaults,_o(Gs.defaults),Gs},Gs.walkTokens=function(e,t){return Ws.walkTokens(e,t)},Gs.parseInline=Ws.parseInline,Gs.Parser=Hs,Gs.parser=Hs.parse,Gs.Renderer=Bs,Gs.TextRenderer=Vs,Gs.Lexer=zs,Gs.lexer=zs.lex,Gs.Tokenizer=Rs,Gs.Hooks=Us,Gs.parse=Gs,Gs.options,Gs.setOptions,Gs.use,Gs.walkTokens,Gs.parseInline,Hs.parse,zs.lex;var{entries:Ks,setPrototypeOf:qs,isFrozen:Js,getPrototypeOf:Ys,getOwnPropertyDescriptor:Xs}=Object,{freeze:Zs,seal:Qs,create:$s}=Object,{apply:ec,construct:tc}=typeof Reflect<`u`&&Reflect;Zs||=function(e){return e},Qs||=function(e){return e},ec||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},tc||=function(e){return new e(...[...arguments].slice(1))};var nc=Sc(Array.prototype.forEach),rc=Sc(Array.prototype.lastIndexOf),ic=Sc(Array.prototype.pop),ac=Sc(Array.prototype.push),oc=Sc(Array.prototype.splice),sc=Array.isArray,cc=Sc(String.prototype.toLowerCase),lc=Sc(String.prototype.toString),uc=Sc(String.prototype.match),dc=Sc(String.prototype.replace),fc=Sc(String.prototype.indexOf),pc=Sc(String.prototype.trim),mc=Sc(Number.prototype.toString),hc=Sc(Boolean.prototype.toString),gc=typeof BigInt>`u`?null:Sc(BigInt.prototype.toString),_c=typeof Symbol>`u`?null:Sc(Symbol.prototype.toString),vc=Sc(Object.prototype.hasOwnProperty),yc=Sc(Object.prototype.toString),bc=Sc(RegExp.prototype.test),xc=Cc(TypeError);function Sc(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ec(e,t,n)}}function Cc(e){return function(){return tc(e,[...arguments])}}function wc(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cc;if(qs&&qs(e,null),!sc(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Js(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Tc(e){for(let t=0;t<e.length;t++)vc(e,t)||(e[t]=null);return e}function Ec(e){let t=$s(null);for(let[n,r]of Ks(e))vc(e,n)&&(sc(r)?t[n]=Tc(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Ec(r):t[n]=r);return t}function Dc(e){switch(typeof e){case`string`:return e;case`number`:return mc(e);case`boolean`:return hc(e);case`bigint`:return gc?gc(e):`0`;case`symbol`:return _c?_c(e):`Symbol()`;case`undefined`:return yc(e);case`function`:case`object`:{if(e===null)return yc(e);let t=e,n=Oc(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:yc(e)}return yc(e)}default:return yc(e)}}function Oc(e,t){for(;e!==null;){let n=Xs(e,t);if(n){if(n.get)return Sc(n.get);if(typeof n.value==`function`)return Sc(n.value)}e=Ys(e)}function n(){return null}return n}function kc(e){try{return bc(e,``),!0}catch{return!1}}var Ac=Zs(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),jc=Zs(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Mc=Zs([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Nc=Zs([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Pc=Zs(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Fc=Zs([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ic=Zs([`#text`]),Lc=Zs(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Rc=Zs(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),zc=Zs(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Bc=Zs([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Vc=Qs(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Hc=Qs(/<%[\w\W]*|[\w\W]*%>/gm),Uc=Qs(/\$\{[\w\W]*/gm),Wc=Qs(/^data-[\-\w.\u00B7-\uFFFF]+$/),Gc=Qs(/^aria-[\-\w]+$/),Kc=Qs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qc=Qs(/^(?:\w+script|data):/i),Jc=Qs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yc=Qs(/^html$/i),Xc=Qs(/^[a-z][.\w]*(-[.\w]+)+$/i),Zc=Object.freeze({__proto__:null,ARIA_ATTR:Gc,ATTR_WHITESPACE:Jc,CUSTOM_ELEMENT:Xc,DATA_ATTR:Wc,DOCTYPE_NAME:Yc,ERB_EXPR:Hc,IS_ALLOWED_URI:Kc,IS_SCRIPT_OR_DATA:qc,MUSTACHE_EXPR:Vc,TMPLIT_EXPR:Uc}),Qc={element:1,text:3,progressingInstruction:7,comment:8,document:9},$c=function(){return typeof window>`u`?null:window},el=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},tl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$c(),t=e=>nl(e);if(t.version=`3.4.1`,t.removed=[],!e||!e.document||e.document.nodeType!==Qc.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=Oc(m,`cloneNode`),g=Oc(m,`remove`),_=Oc(m,`nextSibling`),v=Oc(m,`childNodes`),y=Oc(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=tl();t.isSupported=typeof Ks==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:te,TMPLIT_EXPR:ne,DATA_ATTR:re,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:O}=Zc,{IS_ALLOWED_URI:se}=Zc,ce=null,le=wc({},[...Ac,...jc,...Mc,...Pc,...Ic]),ue=null,de=wc({},[...Lc,...Rc,...zc,...Bc]),fe=Object.seal($s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),pe=null,me=null,he=Object.seal($s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ge=!0,_e=!0,ve=!1,ye=!0,be=!1,xe=!0,Se=!1,Ce=!1,we=!1,Te=!1,Ee=!1,De=!1,Oe=!0,ke=!1,k=`user-content-`,Ae=!0,A=!1,je={},Me=null,j=wc({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Ne=null,Pe=wc({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Fe=null,Ie=wc({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Le=`http://www.w3.org/1998/Math/MathML`,Re=`http://www.w3.org/2000/svg`,ze=`http://www.w3.org/1999/xhtml`,Be=ze,Ve=!1,He=null,Ue=wc({},[Le,Re,ze],lc),We=wc({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ge=wc({},[`annotation-xml`]),Ke=wc({},[`title`,`style`,`font`,`a`,`script`]),qe=null,Je=[`application/xhtml+xml`,`text/html`],Ye=null,Xe=null,Ze=n.createElement(`form`),Qe=function(e){return e instanceof RegExp||e instanceof Function},$e=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xe&&Xe===e)return;(!e||typeof e!=`object`)&&(e={}),e=Ec(e),qe=Je.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ye=qe===`application/xhtml+xml`?lc:cc,ce=vc(e,`ALLOWED_TAGS`)&&sc(e.ALLOWED_TAGS)?wc({},e.ALLOWED_TAGS,Ye):le,ue=vc(e,`ALLOWED_ATTR`)&&sc(e.ALLOWED_ATTR)?wc({},e.ALLOWED_ATTR,Ye):de,He=vc(e,`ALLOWED_NAMESPACES`)&&sc(e.ALLOWED_NAMESPACES)?wc({},e.ALLOWED_NAMESPACES,lc):Ue,Fe=vc(e,`ADD_URI_SAFE_ATTR`)&&sc(e.ADD_URI_SAFE_ATTR)?wc(Ec(Ie),e.ADD_URI_SAFE_ATTR,Ye):Ie,Ne=vc(e,`ADD_DATA_URI_TAGS`)&&sc(e.ADD_DATA_URI_TAGS)?wc(Ec(Pe),e.ADD_DATA_URI_TAGS,Ye):Pe,Me=vc(e,`FORBID_CONTENTS`)&&sc(e.FORBID_CONTENTS)?wc({},e.FORBID_CONTENTS,Ye):j,pe=vc(e,`FORBID_TAGS`)&&sc(e.FORBID_TAGS)?wc({},e.FORBID_TAGS,Ye):Ec({}),me=vc(e,`FORBID_ATTR`)&&sc(e.FORBID_ATTR)?wc({},e.FORBID_ATTR,Ye):Ec({}),je=vc(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Ec(e.USE_PROFILES):e.USE_PROFILES:!1,ge=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,ve=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,be=e.SAFE_FOR_TEMPLATES||!1,xe=e.SAFE_FOR_XML!==!1,Se=e.WHOLE_DOCUMENT||!1,Te=e.RETURN_DOM||!1,Ee=e.RETURN_DOM_FRAGMENT||!1,De=e.RETURN_TRUSTED_TYPE||!1,we=e.FORCE_BODY||!1,Oe=e.SANITIZE_DOM!==!1,ke=e.SANITIZE_NAMED_PROPS||!1,Ae=e.KEEP_CONTENT!==!1,A=e.IN_PLACE||!1,se=kc(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Kc,Be=typeof e.NAMESPACE==`string`?e.NAMESPACE:ze,We=vc(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Ec(e.MATHML_TEXT_INTEGRATION_POINTS):wc({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ge=vc(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Ec(e.HTML_INTEGRATION_POINTS):wc({},[`annotation-xml`]);let t=vc(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Ec(e.CUSTOM_ELEMENT_HANDLING):$s(null);if(fe=$s(null),vc(t,`tagNameCheck`)&&Qe(t.tagNameCheck)&&(fe.tagNameCheck=t.tagNameCheck),vc(t,`attributeNameCheck`)&&Qe(t.attributeNameCheck)&&(fe.attributeNameCheck=t.attributeNameCheck),vc(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(fe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),be&&(_e=!1),Ee&&(Te=!0),je&&(ce=wc({},Ic),ue=$s(null),je.html===!0&&(wc(ce,Ac),wc(ue,Lc)),je.svg===!0&&(wc(ce,jc),wc(ue,Rc),wc(ue,Bc)),je.svgFilters===!0&&(wc(ce,Mc),wc(ue,Rc),wc(ue,Bc)),je.mathMl===!0&&(wc(ce,Pc),wc(ue,zc),wc(ue,Bc))),he.tagCheck=null,he.attributeCheck=null,vc(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?he.tagCheck=e.ADD_TAGS:sc(e.ADD_TAGS)&&(ce===le&&(ce=Ec(ce)),wc(ce,e.ADD_TAGS,Ye))),vc(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?he.attributeCheck=e.ADD_ATTR:sc(e.ADD_ATTR)&&(ue===de&&(ue=Ec(ue)),wc(ue,e.ADD_ATTR,Ye))),vc(e,`ADD_URI_SAFE_ATTR`)&&sc(e.ADD_URI_SAFE_ATTR)&&wc(Fe,e.ADD_URI_SAFE_ATTR,Ye),vc(e,`FORBID_CONTENTS`)&&sc(e.FORBID_CONTENTS)&&(Me===j&&(Me=Ec(Me)),wc(Me,e.FORBID_CONTENTS,Ye)),vc(e,`ADD_FORBID_CONTENTS`)&&sc(e.ADD_FORBID_CONTENTS)&&(Me===j&&(Me=Ec(Me)),wc(Me,e.ADD_FORBID_CONTENTS,Ye)),Ae&&(ce[`#text`]=!0),Se&&wc(ce,[`html`,`head`,`body`]),ce.table&&(wc(ce,[`tbody`]),delete pe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw xc(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw xc(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=el(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));Zs&&Zs(e),Xe=e},et=wc({},[...jc,...Mc,...Nc]),tt=wc({},[...Pc,...Fc]),nt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Be,tagName:`template`});let n=cc(e.tagName),r=cc(t.tagName);return He[e.namespaceURI]?e.namespaceURI===Re?t.namespaceURI===ze?n===`svg`:t.namespaceURI===Le?n===`svg`&&(r===`annotation-xml`||We[r]):!!et[n]:e.namespaceURI===Le?t.namespaceURI===ze?n===`math`:t.namespaceURI===Re?n===`math`&&Ge[r]:!!tt[n]:e.namespaceURI===ze?t.namespaceURI===Re&&!Ge[r]||t.namespaceURI===Le&&!We[r]?!1:!tt[n]&&(Ke[n]||!et[n]):!!(qe===`application/xhtml+xml`&&He[e.namespaceURI]):!1},rt=function(e){ac(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},it=function(e,n){try{ac(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ac(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Te||Ee)try{rt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},at=function(e){let t=null,r=null;if(we)e=`<remove></remove>`+e;else{let t=uc(e,/^[\r\n\t ]+/);r=t&&t[0]}qe===`application/xhtml+xml`&&Be===ze&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Be===ze)try{t=new f().parseFromString(i,qe)}catch{}if(!t||!t.documentElement){t=S.createDocument(Be,`template`,null);try{t.documentElement.innerHTML=Ve?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Be===ze?T.call(t,Se?`html`:`body`)[0]:Se?t.documentElement:a},ot=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},M=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},st=function(e){return typeof s==`function`&&e instanceof s};function N(e,n,r){nc(e,e=>{e.call(t,n,r,Xe)})}let ct=function(e){let n=null;if(N(D.beforeSanitizeElements,e,null),M(e))return rt(e),!0;let r=Ye(e.nodeName);if(N(D.uponSanitizeElement,e,{tagName:r,allowedTags:ce}),xe&&e.hasChildNodes()&&!st(e.firstElementChild)&&bc(/<[/\w!]/g,e.innerHTML)&&bc(/<[/\w!]/g,e.textContent)||xe&&e.namespaceURI===ze&&r===`style`&&st(e.firstElementChild)||e.nodeType===Qc.progressingInstruction||xe&&e.nodeType===Qc.comment&&bc(/<[/\w]/g,e.data))return rt(e),!0;if(pe[r]||!(he.tagCheck instanceof Function&&he.tagCheck(r))&&!ce[r]){if(!pe[r]&&P(r)&&(fe.tagNameCheck instanceof RegExp&&bc(fe.tagNameCheck,r)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(r)))return!1;if(Ae&&!Me[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);t.insertBefore(r,_(e))}}}return rt(e),!0}return e instanceof c&&!nt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&bc(/<\/no(script|embed|frames)/i,e.innerHTML)?(rt(e),!0):(be&&e.nodeType===Qc.text&&(n=e.textContent,nc([ee,te,ne],e=>{n=dc(n,e,` `)}),e.textContent!==n&&(ac(t.removed,{element:e.cloneNode()}),e.textContent=n)),N(D.afterSanitizeElements,e,null),!1)},lt=function(e,t,r){if(me[t]||Oe&&(t===`id`||t===`name`)&&(r in n||r in Ze))return!1;if(!(_e&&!me[t]&&bc(re,t))&&!(ge&&bc(ie,t))&&!(he.attributeCheck instanceof Function&&he.attributeCheck(t,e))){if(!ue[t]||me[t]){if(!(P(e)&&(fe.tagNameCheck instanceof RegExp&&bc(fe.tagNameCheck,e)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(e))&&(fe.attributeNameCheck instanceof RegExp&&bc(fe.attributeNameCheck,t)||fe.attributeNameCheck instanceof Function&&fe.attributeNameCheck(t,e))||t===`is`&&fe.allowCustomizedBuiltInElements&&(fe.tagNameCheck instanceof RegExp&&bc(fe.tagNameCheck,r)||fe.tagNameCheck instanceof Function&&fe.tagNameCheck(r))))return!1}else if(!Fe[t]&&!bc(se,dc(r,oe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&fc(r,`data:`)===0&&Ne[e])&&!(ve&&!bc(ae,dc(r,oe,``)))&&r)return!1}return!0},ut=wc({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),P=function(e){return!ut[cc(e)]&&bc(O,e)},dt=function(e){N(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||M(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:ue,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=Ye(a),l=s,u=a===`value`?l:pc(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,N(D.uponSanitizeAttribute,e,r),u=r.attrValue,ke&&(c===`id`||c===`name`)&&fc(u,k)!==0&&(it(a,e),u=k+u),xe&&bc(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){it(a,e);continue}if(c===`attributename`&&uc(u,`href`)){it(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){it(a,e);continue}if(!ye&&bc(/\/>/i,u)){it(a,e);continue}be&&nc([ee,te,ne],e=>{u=dc(u,e,` `)});let d=Ye(e.nodeName);if(!lt(d,c,u)){it(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),M(e)?rt(e):ic(t.removed)}catch{it(a,e)}}N(D.afterSanitizeAttributes,e,null)},ft=function(e){let t=null,n=ot(e);for(N(D.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)N(D.uponSanitizeShadowNode,t,null),ct(t),dt(t),t.content instanceof a&&ft(t.content);N(D.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Ve=!e,Ve&&(e=`<!-->`),typeof e!=`string`&&!st(e)&&(e=Dc(e),typeof e!=`string`))throw xc(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(Ce||$e(n),t.removed=[],typeof e==`string`&&(A=!1),A){let t=e.nodeName;if(typeof t==`string`){let e=Ye(t);if(!ce[e]||pe[e])throw xc(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=at(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Qc.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!Te&&!be&&!Se&&e.indexOf(`<`)===-1)return b&&De?b.createHTML(e):e;if(i=at(e),!i)return Te?null:De?x:``}i&&we&&rt(i.firstChild);let u=ot(A?e:i);for(;c=u.nextNode();)ct(c),dt(c),c.content instanceof a&&ft(c.content);if(A)return e;if(Te){if(be){i.normalize();let e=i.innerHTML;nc([ee,te,ne],t=>{e=dc(e,t,` `)}),i.innerHTML=e}if(Ee)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(ue.shadowroot||ue.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=Se?i.outerHTML:i.innerHTML;return Se&&ce[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&bc(Yc,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
66
|
+
`+d),be&&nc([ee,te,ne],e=>{d=dc(d,e,` `)}),b&&De?b.createHTML(d):d},t.setConfig=function(){$e(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ce=!0},t.clearConfig=function(){Xe=null,Ce=!1},t.isValidAttribute=function(e,t,n){return Xe||$e({}),lt(Ye(e),Ye(t),n)},t.addHook=function(e,t){typeof t==`function`&&ac(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=rc(D[e],t);return n===-1?void 0:oc(D[e],n,1)[0]}return ic(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=tl()},t}var rl=nl();function il(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/1e3);return n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:t.toLocaleDateString()}function al(e){return e.split(/[/ \-_.]/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()||``).join(``).slice(0,2)||`RP`}function ol(e){return{backlog:`status-backlog`,pending:`status-pending`,in_progress:`status-inprogress`,completed:`status-completed`,blocked:`status-blocked`,canceled:`status-canceled`}[e]||`status-default`}function sl(e){return{backlog:`Backlog`,pending:`To Do`,in_progress:`In Progress`,completed:`Completed`,blocked:`Blocked`,canceled:`Canceled`}[e]||e}function cl(e){return{1:`Low`,2:`Normal`,3:`Medium`,4:`High`,5:`Critical`}[e]||String(e)}function ll(e){try{let t=Gs.parse(e||``);return rl.sanitize(t)}catch(t){return console.error(`Markdown render error:`,t),e||``}}function ul(e,t){let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}function dl(e,t){if(!e.length)return;let n=Object.keys(e[0]),r=[n.join(`,`),...e.map(e=>n.map(t=>JSON.stringify(e[t]??``)).join(`,`))].join(`
|
|
67
|
+
`),i=new Blob([r],{type:`text/csv`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=t,o.click(),URL.revokeObjectURL(a)}function fl(e,t){let n;return((...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)})}async function pl(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(e){return console.error(`Failed to copy text: `,e),!1}}function ml(e){let t=null;function n(t){La.set(t),localStorage.setItem(`selectedRepo`,t),e&&e(t)}function r(e,t){t.preventDefault(),t.stopPropagation(),za.update(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function i(){Ra.update(e=>!e)}function a(e,n){t=e,n.dataTransfer&&(n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,e)),n.currentTarget.classList.add(`opacity-50`)}function o(e,n){!t||t===e||(n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=`move`))}function s(e,n){n.preventDefault();let r=t||n.dataTransfer?.getData(`text/plain`);!r||r===e||(za.update(t=>{let n=t.filter(e=>e!==r),i=n.indexOf(e);return n.splice(i,0,r),n}),t=null)}function c(e){t=null,e.currentTarget.classList.remove(`opacity-50`),document.querySelectorAll(`.repo-item.drag-over`).forEach(e=>e.classList.remove(`drag-over`))}return{selectRepo:n,togglePin:r,toggleCollapse:i,onDragStart:a,onDragOver:o,onDrop:s,onDragEnd:c,getRepoInitials:al}}var hl=si(`<circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><path d="M12 17h.01"></path>`,1),gl=si(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><!></svg>`);function $(e,t){let n=Q(t,`name`,8),r=Q(t,`size`,8,16),i=Q(t,`strokeWidth`,8,1.75),a=Q(t,`className`,8,``),o={brain:[{tag:`path`,attrs:{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`}},{tag:`path`,attrs:{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`}},{tag:`path`,attrs:{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`}},{tag:`path`,attrs:{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`}},{tag:`path`,attrs:{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`}},{tag:`path`,attrs:{d:`M3.477 10.896a4 4 0 0 1 .585-.396`}},{tag:`path`,attrs:{d:`M19.938 10.5a4 4 0 0 1 .585.396`}},{tag:`path`,attrs:{d:`M6 18a4 4 0 0 1-1.967-.516`}},{tag:`path`,attrs:{d:`M19.967 17.484A4 4 0 0 1 18 18`}}],"layout-dashboard":[{tag:`rect`,attrs:{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`}},{tag:`rect`,attrs:{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`}},{tag:`rect`,attrs:{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`}},{tag:`rect`,attrs:{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`}}],database:[{tag:`ellipse`,attrs:{cx:`12`,cy:`5`,rx:`9`,ry:`3`}},{tag:`path`,attrs:{d:`M3 5V19A9 3 0 0 0 21 19V5`}},{tag:`path`,attrs:{d:`M3 12A9 3 0 0 0 21 12`}}],"clipboard-list":[{tag:`rect`,attrs:{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}},{tag:`path`,attrs:{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}},{tag:`path`,attrs:{d:`M12 11h4`}},{tag:`path`,attrs:{d:`M12 16h4`}},{tag:`path`,attrs:{d:`M8 11h.01`}},{tag:`path`,attrs:{d:`M8 16h.01`}}],"book-open":[{tag:`path`,attrs:{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`}},{tag:`path`,attrs:{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`}}],"refresh-cw":[{tag:`path`,attrs:{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}},{tag:`path`,attrs:{d:`M21 3v5h-5`}},{tag:`path`,attrs:{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}},{tag:`path`,attrs:{d:`M8 16H3v5`}}],sun:[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`4`}},{tag:`path`,attrs:{d:`M12 2v2`}},{tag:`path`,attrs:{d:`M12 20v2`}},{tag:`path`,attrs:{d:`m4.93 4.93 1.41 1.41`}},{tag:`path`,attrs:{d:`m17.66 17.66 1.41 1.41`}},{tag:`path`,attrs:{d:`M2 12h2`}},{tag:`path`,attrs:{d:`M20 12h2`}},{tag:`path`,attrs:{d:`m6.34 17.66-1.41 1.41`}},{tag:`path`,attrs:{d:`m19.07 4.93-1.41 1.41`}}],moon:[{tag:`path`,attrs:{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`}}],menu:[{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`12`,y2:`12`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`6`,y2:`6`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`18`,y2:`18`}}],"chevron-left":[{tag:`path`,attrs:{d:`m15 18-6-6 6-6`}}],"chevron-right":[{tag:`path`,attrs:{d:`m9 18 6-6-6-6`}}],"chevron-down":[{tag:`path`,attrs:{d:`m6 9 6 6 6-6`}}],"chevron-up":[{tag:`path`,attrs:{d:`m18 15-6-6-6 6`}}],link:[{tag:`path`,attrs:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}},{tag:`path`,attrs:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}}],x:[{tag:`path`,attrs:{d:`M18 6 6 18`}},{tag:`path`,attrs:{d:`m6 6 12 12`}}],plus:[{tag:`path`,attrs:{d:`M5 12h14`}},{tag:`path`,attrs:{d:`M12 5v14`}}],search:[{tag:`circle`,attrs:{cx:`11`,cy:`11`,r:`8`}},{tag:`path`,attrs:{d:`m21 21-4.3-4.3`}}],pin:[{tag:`path`,attrs:{d:`M12.586 2.586a2 2 0 0 1 2.828 0l2 2a2 2 0 0 1 0 2.828l-1.793 1.793-.914 4.57a1 1 0 0 1-.271.51l-1.414 1.414a1 1 0 0 1-1.414 0l-2.122-2.121-4.172 4.171a1 1 0 1 1-1.414-1.414l4.171-4.172-2.12-2.12a1 1 0 0 1 0-1.415l1.413-1.414a1 1 0 0 1 .51-.27l4.57-.915 1.792-1.793Z`}}],star:[{tag:`polygon`,attrs:{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`}}],edit:[{tag:`path`,attrs:{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}},{tag:`path`,attrs:{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4Z`}}],trash:[{tag:`path`,attrs:{d:`M3 6h18`}},{tag:`path`,attrs:{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`}},{tag:`path`,attrs:{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`}}],copy:[{tag:`rect`,attrs:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attrs:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],"external-link":[{tag:`path`,attrs:{d:`M15 3h6v6`}},{tag:`path`,attrs:{d:`M10 14 21 3`}},{tag:`path`,attrs:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}}],filter:[{tag:`polygon`,attrs:{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`}}],sliders:[{tag:`line`,attrs:{x1:`4`,x2:`4`,y1:`21`,y2:`14`}},{tag:`line`,attrs:{x1:`4`,x2:`4`,y1:`6`,y2:`3`}},{tag:`line`,attrs:{x1:`12`,x2:`12`,y1:`21`,y2:`12`}},{tag:`line`,attrs:{x1:`12`,x2:`12`,y1:`6`,y2:`3`}},{tag:`line`,attrs:{x1:`20`,x2:`20`,y1:`21`,y2:`16`}},{tag:`line`,attrs:{x1:`20`,x2:`20`,y1:`10`,y2:`3`}},{tag:`line`,attrs:{x1:`1`,x2:`7`,y1:`14`,y2:`14`}},{tag:`line`,attrs:{x1:`9`,x2:`15`,y1:`12`,y2:`12`}},{tag:`line`,attrs:{x1:`17`,x2:`23`,y1:`16`,y2:`16`}}],"circle-dot":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`1`}}],"circle-check":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`m9 12 2 2 4-4`}}],"circle-x":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`m15 9-6 6`}},{tag:`path`,attrs:{d:`m9 9 6 6`}}],"circle-pause":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`line`,attrs:{x1:`10`,x2:`10`,y1:`15`,y2:`9`}},{tag:`line`,attrs:{x1:`14`,x2:`14`,y1:`15`,y2:`9`}}],"circle-pause-alt":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`M10 9v6`}},{tag:`path`,attrs:{d:`M14 9v6`}}],"triangle-alert":[{tag:`path`,attrs:{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-3Z`}},{tag:`path`,attrs:{d:`M12 9v4`}},{tag:`path`,attrs:{d:`M12 17h.01`}}],check:[{tag:`path`,attrs:{d:`M20 6 9 17l-5-5`}}],info:[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`M12 16v-4`}},{tag:`path`,attrs:{d:`M12 8h.01`}}],zap:[{tag:`path`,attrs:{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`}}],activity:[{tag:`path`,attrs:{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}}],memory:[{tag:`path`,attrs:{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`}},{tag:`path`,attrs:{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`}}],"git-branch":[{tag:`line`,attrs:{x1:`6`,x2:`6`,y1:`3`,y2:`15`}},{tag:`circle`,attrs:{cx:`18`,cy:`6`,r:`3`}},{tag:`circle`,attrs:{cx:`6`,cy:`18`,r:`3`}},{tag:`path`,attrs:{d:`M18 9a9 9 0 0 1-9 9`}}],tag:[{tag:`path`,attrs:{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`}},{tag:`circle`,attrs:{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}}],user:[{tag:`path`,attrs:{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}},{tag:`circle`,attrs:{cx:`12`,cy:`7`,r:`4`}}],bot:[{tag:`path`,attrs:{d:`M12 8V4H8`}},{tag:`rect`,attrs:{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}},{tag:`path`,attrs:{d:`M2 14h2`}},{tag:`path`,attrs:{d:`M20 14h2`}},{tag:`path`,attrs:{d:`M15 13v2`}},{tag:`path`,attrs:{d:`M9 13v2`}}],code:[{tag:`polyline`,attrs:{points:`16 18 22 12 16 6`}},{tag:`polyline`,attrs:{points:`8 6 2 12 8 18`}}],terminal:[{tag:`polyline`,attrs:{points:`4 17 10 11 4 5`}},{tag:`line`,attrs:{x1:`12`,x2:`20`,y1:`19`,y2:`19`}}],"file-text":[{tag:`path`,attrs:{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`}},{tag:`path`,attrs:{d:`M14 2v4a2 2 0 0 0 2 2h4`}},{tag:`path`,attrs:{d:`M10 9H8`}},{tag:`path`,attrs:{d:`M16 13H8`}},{tag:`path`,attrs:{d:`M16 17H8`}}],layers:[{tag:`path`,attrs:{d:`m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z`}},{tag:`path`,attrs:{d:`m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65`}},{tag:`path`,attrs:{d:`m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65`}}],cpu:[{tag:`rect`,attrs:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}},{tag:`rect`,attrs:{x:`9`,y:`9`,width:`6`,height:`6`}},{tag:`path`,attrs:{d:`M15 2v2`}},{tag:`path`,attrs:{d:`M15 20v2`}},{tag:`path`,attrs:{d:`M2 15h2`}},{tag:`path`,attrs:{d:`M2 9h2`}},{tag:`path`,attrs:{d:`M20 15h2`}},{tag:`path`,attrs:{d:`M20 9h2`}},{tag:`path`,attrs:{d:`M9 2v2`}},{tag:`path`,attrs:{d:`M9 20v2`}}],clock:[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`polyline`,attrs:{points:`12 6 12 12 16 14`}}],calendar:[{tag:`rect`,attrs:{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,ry:`2`}},{tag:`line`,attrs:{x1:`16`,x2:`16`,y1:`2`,y2:`6`}},{tag:`line`,attrs:{x1:`8`,x2:`8`,y1:`2`,y2:`6`}},{tag:`line`,attrs:{x1:`3`,x2:`21`,y1:`10`,y2:`10`}}],"arrow-up":[{tag:`path`,attrs:{d:`m5 12 7-7 7 7`}},{tag:`path`,attrs:{d:`M12 19V5`}}],"arrow-down":[{tag:`path`,attrs:{d:`M12 5v14`}},{tag:`path`,attrs:{d:`m19 12-7 7-7-7`}}],"arrow-right":[{tag:`path`,attrs:{d:`M5 12h14`}},{tag:`path`,attrs:{d:`m12 5 7 7-7 7`}}],"trending-up":[{tag:`polyline`,attrs:{points:`22 7 13.5 15.5 8.5 10.5 2 17`}},{tag:`polyline`,attrs:{points:`16 7 22 7 22 13`}}],"bar-chart":[{tag:`line`,attrs:{x1:`12`,x2:`12`,y1:`20`,y2:`10`}},{tag:`line`,attrs:{x1:`18`,x2:`18`,y1:`20`,y2:`4`}},{tag:`line`,attrs:{x1:`6`,x2:`6`,y1:`20`,y2:`16`}}],list:[{tag:`line`,attrs:{x1:`8`,x2:`21`,y1:`6`,y2:`6`}},{tag:`line`,attrs:{x1:`8`,x2:`21`,y1:`12`,y2:`12`}},{tag:`line`,attrs:{x1:`8`,x2:`21`,y1:`18`,y2:`18`}},{tag:`line`,attrs:{x1:`3`,x2:`3.01`,y1:`6`,y2:`6`}},{tag:`line`,attrs:{x1:`3`,x2:`3.01`,y1:`12`,y2:`12`}},{tag:`line`,attrs:{x1:`3`,x2:`3.01`,y1:`18`,y2:`18`}}],tool:[{tag:`path`,attrs:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`}}],columns:[{tag:`rect`,attrs:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}},{tag:`line`,attrs:{x1:`12`,x2:`12`,y1:`3`,y2:`21`}}],sparkle:[{tag:`path`,attrs:{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`}}],settings:[{tag:`path`,attrs:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],wifi:[{tag:`path`,attrs:{d:`M5 12.55a11 11 0 0 1 14.08 0`}},{tag:`path`,attrs:{d:`M1.42 9a16 16 0 0 1 21.16 0`}},{tag:`path`,attrs:{d:`M8.53 16.11a6 6 0 0 1 6.95 0`}},{tag:`line`,attrs:{x1:`12`,x2:`12.01`,y1:`20`,y2:`20`}}],hash:[{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`9`,y2:`9`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`15`,y2:`15`}},{tag:`line`,attrs:{x1:`10`,x2:`8`,y1:`3`,y2:`21`}},{tag:`line`,attrs:{x1:`16`,x2:`14`,y1:`3`,y2:`21`}}],inbox:[{tag:`polyline`,attrs:{points:`22 12 16 12 14 15 10 15 8 12 2 12`}},{tag:`path`,attrs:{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`}}],archive:[{tag:`rect`,attrs:{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}},{tag:`path`,attrs:{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}},{tag:`path`,attrs:{d:`M10 12h4`}}]};var s=gl(),c=L(s),l=e=>{var t=li();X(R(t),3,()=>(W(n()),U(()=>o[n()])),(e,t)=>`${e.tag}-${t}`,(e,t)=>{var n=li();Ii(R(n),()=>H(t).tag,!0,(e,n)=>{ma(e,()=>({...H(t).attrs}))}),q(e,n)}),q(e,t)},u=e=>{var t=hl();Ne(2),q(e,t)};Y(c,e=>{W(n()),U(()=>o[n()])?e(l):e(u,-1)}),j(s),V(()=>{fa(s,`width`,r()),fa(s,`height`,r()),fa(s,`stroke-width`,i()),Ki(s,0,Bi(a()))}),q(e,s)}var _l=K(`<div class="flex items-center gap-2"><div class="brand-icon svelte-vbr9x3"><!></div> <div><div class="font-bold text-sm" style="color:var(--color-text);letter-spacing:-0.02em;">Memory MCP</div> <div class="section-label" style="font-size:0.6rem;margin-top:0;">Dashboard</div></div></div>`),vl=K(`<div class="brand-icon svelte-vbr9x3" style="margin:auto;"><!></div>`),yl=K(`<div class="p-3" style="border-bottom: 1px solid var(--color-border);"><div class="search-wrapper svelte-vbr9x3"><span class="search-icon svelte-vbr9x3"><!></span> <input class="form-input search-input svelte-vbr9x3" type="text" placeholder="Search repos…"/></div></div>`),bl=K(`<div class="repo-active-indicator"></div>`),xl=K(`<span class="task-badge active svelte-vbr9x3"><!> </span>`),Sl=K(`<span class="task-badge todo svelte-vbr9x3"><!> </span>`),Cl=K(`<span class="task-badge blocked svelte-vbr9x3"><!> </span>`),wl=K(`<span class="task-badge backlog svelte-vbr9x3"><!> </span>`),Tl=K(`<div class="task-badges svelte-vbr9x3"><!> <!> <!> <!></div>`),El=K(`<div role="button" tabindex="0" draggable="true"><!> <div class="repo-avatar"> <span class="pin-star svelte-vbr9x3">★</span></div> <div class="min-w-0 flex-1"><div class="truncate font-semibold" style="font-size:0.82rem;color:var(--color-text);"> </div> <div class="truncate flex items-center gap-1" style="font-size:0.68rem;color:var(--color-text-muted);margin-bottom:2px;"><!> </div> <!></div> <button class="pin-btn svelte-vbr9x3" title="Unpin" aria-label="Unpin repository"><!></button></div>`),Dl=K(`<div class="group-label svelte-vbr9x3"><!> Pinned</div> <!>`,1),Ol=K(`<div class="group-label svelte-vbr9x3" style="margin-top:6px;"><!> All</div>`),kl=K(`<div class="repo-active-indicator"></div>`),Al=K(`<span class="task-badge active svelte-vbr9x3"><!> </span>`),jl=K(`<span class="task-badge todo svelte-vbr9x3"><!> </span>`),Ml=K(`<span class="task-badge blocked svelte-vbr9x3"><!> </span>`),Nl=K(`<span class="task-badge backlog svelte-vbr9x3"><!> </span>`),Pl=K(`<div class="task-badges svelte-vbr9x3"><!> <!> <!> <!></div>`),Fl=K(`<div role="button" tabindex="0"><!> <div class="repo-avatar"> </div> <div class="min-w-0 flex-1"><div class="truncate font-semibold" style="font-size:0.82rem;color:var(--color-text);"> </div> <div class="truncate flex items-center gap-1" style="font-size:0.68rem;color:var(--color-text-muted);margin-bottom:2px;"><!> </div> <!></div> <button class="pin-btn svelte-vbr9x3" title="Pin" aria-label="Pin repository"><!></button></div>`),Il=K(`<!> <!>`,1),Ll=K(`<div style="text-align:center;padding:24px 16px;color:var(--color-text-muted);"><!> <div style="font-size:0.82rem;margin-top:8px;">No repositories found</div></div>`),Rl=K(`<div class="flex items-center justify-between px-2 py-1 mb-1"><span class="section-label">Repositories</span> <span class="repo-count-chip svelte-vbr9x3"> </span></div> <!> <!> <!>`,1),zl=K(`<div class="repo-active-indicator"></div>`),Bl=K(`<div role="button" tabindex="0"><!> <div class="repo-avatar" style="margin:auto;"> </div></div>`),Vl=K(`<aside style="border-right: 1px solid var(--color-border);"><div class="sidebar-header svelte-vbr9x3" style="border-bottom: 1px solid var(--color-border);"><!> <button class="btn btn-ghost btn-icon btn-sm collapse-btn svelte-vbr9x3"><span><!></span></button></div> <!> <div class="overflow-y-auto flex-1 p-2" style="scrollbar-width: thin;"><!></div></aside>`);function Hl(e,t){We(t,!1);let n=()=>P(Ra,`$isRepoSidebarCollapsed`,s),r=()=>P(Ba,`$repoSearchQuery`,s),i=()=>P(Ia,`$availableRepos`,s),a=()=>P(oo,`$orderedRepos`,s),o=()=>P(La,`$currentRepo`,s),[s,c]=pt(),l=F(),u=ml(Q(t,`onRepoSelect`,8,()=>{})());B(()=>n(),()=>{I(l,n())}),Un(),Ta();var d=Vl();let f;var p=L(d),m=L(p),h=e=>{var t=_l(),n=L(t);$(L(n),{name:`brain`,size:14,strokeWidth:1.75}),j(n),Ne(2),j(t),q(e,t)},g=e=>{var t=vl();$(L(t),{name:`brain`,size:14,strokeWidth:1.75}),j(t),q(e,t)};Y(m,e=>{H(l)?e(g,-1):e(h)});var _=z(m,2),v=L(_);$(L(v),{name:`chevron-left`,size:14,strokeWidth:2}),j(v),j(_),j(p);var y=z(p,2),b=e=>{var t=yl(),n=L(t),i=L(n);$(L(i),{name:`search`,size:13,strokeWidth:2}),j(i);var a=z(i,2);ca(a),j(n),j(t),Z(a,r,e=>ft(Ba,e)),q(e,t)};Y(y,e=>{H(l)||e(b)});var x=z(y,2),S=L(x),C=e=>{var t=Rl(),n=R(t),r=z(L(n),2),s=L(r,!0);j(r),j(n);var c=z(n,2),l=e=>{var t=Dl(),n=R(t);$(L(n),{name:`star`,size:10,strokeWidth:2}),Ne(),j(n),X(z(n,2),1,()=>(a(),U(()=>a().pinned)),e=>e.repo,(e,t)=>{var n=El();let r;var i=L(n),a=e=>{q(e,bl())};Y(i,e=>{o(),H(t),U(()=>o()===H(t).repo)&&e(a)});var s=z(i,2),c=L(s);Ne(),j(s);var l=z(s,2),d=L(l),f=L(d,!0);j(d);var p=z(d,2),m=L(p);$(m,{name:`database`,size:9,strokeWidth:2});var h=z(m);j(p);var g=z(p,2),_=e=>{var n=Tl(),r=L(n),i=e=>{var n=xl(),r=L(n);$(r,{name:`zap`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).inProgressCount))??``}`)),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).inProgressCount)&&e(i)});var a=z(r,2),o=e=>{var n=Sl(),r=L(n);$(r,{name:`circle-dot`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).pendingCount))??``}`)),q(e,n)};Y(a,e=>{H(t),U(()=>H(t).pendingCount)&&e(o)});var s=z(a,2),c=e=>{var n=Cl(),r=L(n);$(r,{name:`triangle-alert`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).blockedCount))??``}`)),q(e,n)};Y(s,e=>{H(t),U(()=>H(t).blockedCount)&&e(c)});var l=z(s,2),u=e=>{var n=wl(),r=L(n);$(r,{name:`archive`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).backlogCount))??``}`)),q(e,n)};Y(l,e=>{H(t),U(()=>H(t).backlogCount)&&e(u)}),j(n),q(e,n)};Y(g,e=>{H(t),U(()=>(H(t).inProgressCount||0)+(H(t).pendingCount||0)+(H(t).blockedCount||0)+(H(t).backlogCount||0)>0)&&e(_)}),j(l);var v=z(l,2);$(L(v),{name:`pin`,size:12,strokeWidth:1.75}),j(v),j(n),V(e=>{r=Ki(n,1,`repo-item svelte-vbr9x3`,null,r,{active:o()===H(t).repo}),fa(n,`title`,`${(H(t),U(()=>H(t).repo))??``} • ${(H(t),U(()=>H(t).memoryCount))??``} memories`),J(c,`${e??``} `),J(f,(H(t),U(()=>H(t).repo))),J(h,` ${(H(t),U(()=>H(t).memoryCount))??``} memories`)},[()=>(H(t),U(()=>u.getRepoInitials(H(t).repo)))]),G(`click`,v,e=>u.togglePin(H(t).repo,e)),G(`click`,n,()=>u.selectRepo(H(t).repo)),G(`keydown`,n,e=>(e.key===`Enter`||e.key===` `)&&u.selectRepo(H(t).repo)),G(`dragstart`,n,e=>u.onDragStart(H(t).repo,e)),G(`dragover`,n,e=>u.onDragOver(H(t).repo,e)),G(`drop`,n,e=>u.onDrop(H(t).repo,e)),G(`dragend`,n,function(...e){u.onDragEnd?.apply(this,e)}),q(e,n)}),q(e,t)};Y(c,e=>{a(),U(()=>a().pinned.length>0)&&e(l)});var d=z(c,2),f=e=>{var t=Il(),n=R(t),r=e=>{var t=Ol();$(L(t),{name:`layers`,size:10,strokeWidth:2}),Ne(),j(t),q(e,t)};Y(n,e=>{a(),U(()=>a().pinned.length>0)&&e(r)}),X(z(n,2),1,()=>(a(),U(()=>a().unpinned)),e=>e.repo,(e,t)=>{var n=Fl();let r;var i=L(n),a=e=>{q(e,kl())};Y(i,e=>{o(),H(t),U(()=>o()===H(t).repo)&&e(a)});var s=z(i,2),c=L(s,!0);j(s);var l=z(s,2),d=L(l),f=L(d,!0);j(d);var p=z(d,2),m=L(p);$(m,{name:`database`,size:9,strokeWidth:2});var h=z(m);j(p);var g=z(p,2),_=e=>{var n=Pl(),r=L(n),i=e=>{var n=Al(),r=L(n);$(r,{name:`zap`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).inProgressCount))??``}`)),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).inProgressCount)&&e(i)});var a=z(r,2),o=e=>{var n=jl(),r=L(n);$(r,{name:`circle-dot`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).pendingCount))??``}`)),q(e,n)};Y(a,e=>{H(t),U(()=>H(t).pendingCount)&&e(o)});var s=z(a,2),c=e=>{var n=Ml(),r=L(n);$(r,{name:`triangle-alert`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).blockedCount))??``}`)),q(e,n)};Y(s,e=>{H(t),U(()=>H(t).blockedCount)&&e(c)});var l=z(s,2),u=e=>{var n=Nl(),r=L(n);$(r,{name:`archive`,size:8,strokeWidth:2});var i=z(r);j(n),V(()=>J(i,` ${(H(t),U(()=>H(t).backlogCount))??``}`)),q(e,n)};Y(l,e=>{H(t),U(()=>H(t).backlogCount)&&e(u)}),j(n),q(e,n)};Y(g,e=>{H(t),U(()=>(H(t).inProgressCount||0)+(H(t).pendingCount||0)+(H(t).blockedCount||0)+(H(t).backlogCount||0)>0)&&e(_)}),j(l);var v=z(l,2);$(L(v),{name:`pin`,size:12,strokeWidth:1.75}),j(v),j(n),V(e=>{r=Ki(n,1,`repo-item svelte-vbr9x3`,null,r,{active:o()===H(t).repo}),fa(n,`title`,`${(H(t),U(()=>H(t).repo))??``} • ${(H(t),U(()=>H(t).memoryCount))??``} memories`),J(c,e),J(f,(H(t),U(()=>H(t).repo))),J(h,` ${(H(t),U(()=>H(t).memoryCount))??``} memories`)},[()=>(H(t),U(()=>u.getRepoInitials(H(t).repo)))]),G(`click`,v,e=>u.togglePin(H(t).repo,e)),G(`click`,n,()=>u.selectRepo(H(t).repo)),G(`keydown`,n,e=>(e.key===`Enter`||e.key===` `)&&u.selectRepo(H(t).repo)),q(e,n)}),q(e,t)};Y(d,e=>{a(),U(()=>a().unpinned.length>0)&&e(f)});var p=z(d,2),m=e=>{var t=Ll();$(L(t),{name:`inbox`,size:24,strokeWidth:1.5}),Ne(2),j(t),q(e,t)};Y(p,e=>{i(),U(()=>i().length===0)&&e(m)}),V(()=>J(s,(i(),U(()=>i().length)))),q(e,t)},w=e=>{var t=li();X(R(t),1,i,e=>e.repo,(e,t)=>{var n=Bl();let r;var i=L(n),a=e=>{q(e,zl())};Y(i,e=>{o(),H(t),U(()=>o()===H(t).repo)&&e(a)});var s=z(i,2),c=L(s,!0);j(s),j(n),V(e=>{r=Ki(n,1,`repo-item collapsed`,null,r,{active:o()===H(t).repo}),fa(n,`title`,(H(t),U(()=>H(t).repo))),J(c,e)},[()=>(H(t),U(()=>u.getRepoInitials(H(t).repo)))]),G(`click`,n,()=>u.selectRepo(H(t).repo)),G(`keydown`,n,e=>(e.key===`Enter`||e.key===` `)&&u.selectRepo(H(t).repo)),q(e,n)}),q(e,t)};Y(S,e=>{H(l)?e(w,-1):e(C)}),j(x),j(d),V(()=>{f=Ki(d,1,`sidebar glass-strong flex flex-col`,null,f,{collapsed:H(l)}),fa(_,`title`,H(l)?`Expand sidebar`:`Collapse sidebar`),fa(_,`aria-label`,H(l)?`Expand`:`Collapse`),Ji(v,`transition: transform 0.3s ease; display:inline-flex; transform: rotate(${H(l)?`180deg`:`0deg`})`)}),G(`click`,_,function(...e){u.toggleCollapse?.apply(this,e)}),q(e,d),Ge(),c()}var Ul=`https://github.com/vheins/local-memory-mcp`,Wl=`https://www.npmjs.com/package/@vheins/local-memory-mcp`;function Gl(e){let t=M(30),n=M(!1),r=M(null),i=M(!0),a;function o(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`k`:String(e)}async function s(){try{let e=await fetch(`https://api.npmjs.org/downloads/point/last-month/@vheins/local-memory-mcp`);if(e.ok){let t=await e.json();r.set(t.downloads??null)}}catch{r.set(null)}finally{i.set(!1)}}function c(){Pa.update(e=>e===`dark`?`light`:`dark`)}function l(){clearInterval(a),t.set(30),a=setInterval(()=>{t.update(t=>t<=1?(e(),30):t-1)},1e3)}async function u(){n.set(!0),e(),l(),setTimeout(()=>n.set(!1),800)}function d(){clearInterval(a)}return{countdownSeconds:t,refreshing:n,npmDownloads:r,npmLoading:i,formatDownloads:o,fetchNpmDownloads:s,toggleTheme:c,startCountdown:l,manualRefresh:u,getRepoInitials:al,destroy:d}}var Kl=K(`<div class="flex items-center gap-1 svelte-2va9hf" style="font-size:0.65rem;color:var(--color-text-muted);"><!> <span class="svelte-2va9hf"> </span></div>`),ql=K(`<div class="current-repo svelte-2va9hf"><div style="width:30px;height:30px;border-radius:8px;background:linear-gradient(135deg,#0ea5e9,#6366f1);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:11px;color:white;flex-shrink:0;box-shadow:0 4px 10px rgba(14,165,233,0.28);" class="svelte-2va9hf"> </div> <div class="svelte-2va9hf"><div class="font-semibold current-repo-name svelte-2va9hf"> </div> <!></div></div>`),Jl=K(`<div style="font-size:0.85rem;color:var(--color-text-muted);" class="flex items-center gap-2 svelte-2va9hf"><!> <span class="svelte-2va9hf">Select a repository</span></div>`),Yl=K(`<span class="ext-link-label npm-dl-skeleton svelte-2va9hf"></span>`),Xl=K(`<span class="ext-link-label npm-dl-badge svelte-2va9hf"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="svelte-2va9hf"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3" class="svelte-2va9hf"></path></svg> </span>`),Zl=K(`<span class="ext-link-label svelte-2va9hf">npm</span>`),Ql=K(`<div class="top-status svelte-2va9hf"><div class="status-dot status-dot-online svelte-2va9hf"></div> <span style="font-size:0.72rem;font-weight:600;color:var(--color-text-muted);" class="svelte-2va9hf">Online</span> <span style="font-size:0.65rem;color:var(--color-text-muted);background:rgba(100,116,139,0.1);padding:1px 6px;border-radius:9999px;border:1px solid rgba(100,116,139,0.15);" class="svelte-2va9hf"> </span></div>`),$l=K(`<span class="db-path-label flex items-center gap-1 svelte-2va9hf" style="font-size:0.65rem;color:var(--color-text-muted);max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"><!> </span>`),eu=K(`<header class="top-bar glass-strong svelte-2va9hf" style="border-bottom: 1px solid var(--color-border); z-index: 30;"><div class="top-bar-inner svelte-2va9hf"><div class="flex items-center gap-3 svelte-2va9hf"><button class="btn btn-ghost btn-icon svelte-2va9hf" aria-label="Toggle menu" style="display:none;" id="mobileMenuBtn"><!></button> <!></div> <div class="top-actions svelte-2va9hf"><div class="ext-links-group svelte-2va9hf"><a target="_blank" rel="noopener noreferrer" class="ext-link-btn svelte-2va9hf" title="View on GitHub" aria-label="GitHub repository" id="githubLink"><svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" class="svelte-2va9hf"><path d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" class="svelte-2va9hf"></path></svg> <span class="ext-link-label svelte-2va9hf">GitHub</span></a> <div class="ext-link-divider svelte-2va9hf"></div> <a target="_blank" rel="noopener noreferrer" class="ext-link-btn ext-link-star svelte-2va9hf" title="Star on GitHub" aria-label="Star on GitHub" id="githubStarBtn"><svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" class="svelte-2va9hf"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" class="svelte-2va9hf"></path></svg> <span class="ext-link-label svelte-2va9hf">Star</span></a> <div class="ext-link-divider svelte-2va9hf"></div> <a target="_blank" rel="noopener noreferrer" class="ext-link-btn ext-link-npm svelte-2va9hf" title="View on npm" aria-label="npm package" id="npmLink"><svg width="18" height="11" viewBox="0 0 18 7" fill="currentColor" aria-hidden="true" class="svelte-2va9hf"><path d="M0 0h18v6H9V7H5V6H0V0zm1 5h2V1h1v4h1V1h1v5h4V1h1v4h1V1h1v4h1V1h2v5H1V5z" class="svelte-2va9hf"></path></svg> <!></a></div> <div class="top-separator svelte-2va9hf"></div> <!> <div class="refresh-group svelte-2va9hf"><div class="countdown-bar svelte-2va9hf"><div class="countdown-track svelte-2va9hf"><div class="countdown-fill svelte-2va9hf"></div></div> <span class="countdown-label svelte-2va9hf"> </span></div> <button title="Refresh now" aria-label="Refresh"><span><!></span></button></div> <button class="btn btn-ghost btn-icon btn-sm svelte-2va9hf" title="Toggle theme" aria-label="Toggle theme"><!></button> <!></div></div></header>`);function tu(e,t){We(t,!1);let n=()=>P(_,`$countdownSeconds`,u),r=()=>P(Ia,`$availableRepos`,u),i=()=>P(La,`$currentRepo`,u),a=()=>P(b,`$npmLoading`,u),o=()=>P(y,`$npmDownloads`,u),s=()=>P(ao,`$healthData`,u),c=()=>P(v,`$refreshing`,u),l=()=>P(Pa,`$theme`,u),[u,d]=pt(),f=F(),p=F(),m=F(),h=Q(t,`onRefresh`,8,()=>{}),g=Q(t,`onToggleMobileMenu`,8,()=>{}),{countdownSeconds:_,refreshing:v,npmDownloads:y,npmLoading:b,formatDownloads:x,fetchNpmDownloads:S,toggleTheme:C,startCountdown:w,manualRefresh:T,getRepoInitials:E,destroy:D}=Gl(h());Oa(()=>{w(),S()}),ka(()=>D()),B(()=>n(),()=>{I(f,n()/30*100)}),B(()=>n(),()=>{I(p,n()<=5?`#ef4444`:n()<=10?`#f97316`:`#0ea5e9`)}),B(()=>(r(),i()),()=>{I(m,r().find(e=>e.repo===i()))}),Un(),Ta();var ee=eu(),te=L(ee),ne=L(te),re=L(ne);$(L(re),{name:`menu`,size:18,strokeWidth:2}),j(re);var ie=z(re,2),ae=e=>{var t=ql(),n=L(t),r=L(n,!0);j(n);var a=z(n,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=e=>{var t=Kl(),n=L(t);$(n,{name:`database`,size:10,strokeWidth:2});var r=z(n,2),i=L(r);j(r),j(t),V(()=>J(i,`${(H(m),U(()=>H(m).memoryCount||0))??``} memories`)),q(e,t)};Y(c,e=>{H(m)&&e(l)}),j(a),j(t),V(e=>{J(r,e),J(s,i())},[()=>(i(),U(()=>E(i())))]),q(e,t)},oe=e=>{var t=Jl();$(L(t),{name:`brain`,size:14,strokeWidth:1.75}),Ne(2),j(t),q(e,t)};Y(ie,e=>{i()?e(ae):e(oe,-1)}),j(ne);var O=z(ne,2),se=L(O),ce=L(se),le=z(ce,4),ue=z(le,4),de=z(L(ue),2),fe=e=>{q(e,Yl())},pe=e=>{var t=Xl(),n=z(L(t));j(t),V(e=>J(n,` ${e??``}/mo`),[()=>(o(),U(()=>x(o())))]),q(e,t)},me=e=>{q(e,Zl())};Y(de,e=>{a()?e(fe):o()===null?e(me,-1):e(pe,1)}),j(ue),j(se);var he=z(se,4),ge=e=>{var t=Ql(),n=z(L(t),4),r=L(n);j(n),j(t),V(()=>J(r,`v${(s(),U(()=>s().version))??``}`)),q(e,t)};Y(he,e=>{s()&&e(ge)});var _e=z(he,2),ve=L(_e),ye=L(ve),be=L(ye);j(ye);var xe=z(ye,2),Se=L(xe);j(xe),j(ve);var Ce=z(ve,2);let we;var Te=L(Ce);let Ee;$(L(Te),{name:`refresh-cw`,size:14,strokeWidth:2.5}),j(Te),j(Ce),j(_e);var De=z(_e,2),Oe=L(De),ke=e=>{$(e,{name:`sun`,size:16,strokeWidth:1.75})},k=e=>{$(e,{name:`moon`,size:16,strokeWidth:1.75})};Y(Oe,e=>{l()===`dark`?e(ke):e(k,-1)}),j(De);var Ae=z(De,2),A=e=>{var t=$l(),n=L(t);$(n,{name:`database`,size:10,strokeWidth:2});var r=z(n);j(t),V(e=>{fa(t,`title`,(s(),U(()=>s().dbPath))),J(r,` ${e??``}`)},[()=>(s(),U(()=>s().dbPath.split(/[/\\]/).pop()))]),q(e,t)};Y(Ae,e=>{s(),U(()=>s()?.dbPath)&&e(A)}),j(O),j(te),j(ee),V(()=>{fa(ce,`href`,Ul),fa(le,`href`,`https://github.com/vheins/local-memory-mcp/stargazers`),fa(ue,`href`,Wl),Ji(be,`width:${H(f)??``}%;background:${H(p)??``};`),Ji(xe,`color:${n()<=5?`#ef4444`:`var(--color-text-muted)`};`),J(Se,`${n()??``}s`),we=Ki(Ce,1,`btn btn-ghost btn-icon btn-sm svelte-2va9hf`,null,we,{refreshing:c()}),Ee=Ki(Te,1,`svelte-2va9hf`,null,Ee,{"animate-spin":c()})}),G(`click`,re,function(...e){g()?.apply(this,e)}),G(`click`,Ce,T),G(`click`,De,C),q(e,ee),Ge(),d()}var nu={1:`#94a3b8`,2:`#3b82f6`,3:`#f59e0b`,4:`#f97316`,5:`#ef4444`},ru={backlog:`archive`,pending:`circle-dot`,in_progress:`zap`,completed:`circle-check`,blocked:`circle-x`,canceled:`circle-pause-alt`},iu={backlog:`#64748b`,pending:`#0ea5e9`,in_progress:`#a855f7`,completed:`#10b981`,blocked:`#ef4444`,canceled:`#f59e0b`};function au(e){return e?e.replace(/<[^>]*>/g,``).replace(/!\[.*?\]\(.*?\)/g,``).replace(/\[([^\]]+)\]\(.*?\)/g,`$1`).replace(/```[\s\S]*?```/g,``).replace(/`([^`]+)`/g,`$1`).replace(/[#*~_-]/g,``).replace(/\s+/g,` `).trim():``}var ou=K(`<span class="task-code-text svelte-1797zcc"> </span>`),su=K(`<span class="phase-chip svelte-1797zcc"> </span>`),cu=K(`<div class="task-desc svelte-1797zcc"> </div>`),lu=K(`<span class="h-badge parent svelte-1797zcc"><!> </span>`),uu=K(`<span class="h-badge depends svelte-1797zcc"><!> </span>`),du=K(`<div class="hierarchy-row svelte-1797zcc"><!> <!></div>`),fu=K(`<div class="agent-row svelte-1797zcc"><div class="agent-avatar svelte-1797zcc"><!></div> <span class="agent-name svelte-1797zcc"> </span></div>`),pu=K(`<span></span>`),mu=K(`<div class="token-row svelte-1797zcc"><span class="token-badge svelte-1797zcc"><!> </span></div>`),hu=K(`<div class="task-card animate-fade-in svelte-1797zcc" role="button" tabindex="0"><div class="priority-bar svelte-1797zcc"></div> <div class="card-header svelte-1797zcc"><div class="code-row svelte-1797zcc"><span class="status-icon-dot svelte-1797zcc"><!></span> <!></div> <!></div> <div class="task-title svelte-1797zcc"> </div> <!> <!> <div class="card-footer svelte-1797zcc"><!> <div class="time-row svelte-1797zcc"><!> <span> </span></div></div> <!></div>`);function gu(e,t){We(t,!1);let n=F(),r=F(),i=F(),a=F(),o=Q(t,`task`,8);B(()=>(W(o()),nu),()=>{I(n,o()?nu[o().priority]:`#94a3b8`)}),B(()=>(W(o()),ru),()=>{I(r,o()?ru[o().status]:`circle-dot`)}),B(()=>(W(o()),iu),()=>{I(i,o()?iu[o().status]:`#94a3b8`)}),B(()=>(W(o()),au),()=>{I(a,o()?au(o().description??void 0):``)}),Un(),Ta();var s=hu(),c=L(s),l=z(c,2),u=L(l),d=L(u);$(L(d),{get name(){return H(r)},size:11,strokeWidth:2.5}),j(d);var f=z(d,2),p=e=>{var t=ou(),n=L(t,!0);j(t),V(()=>J(n,(W(o()),U(()=>o().task_code)))),q(e,t)};Y(f,e=>{o()&&e(p)}),j(u);var m=z(u,2),h=e=>{var t=su(),n=L(t,!0);j(t),V(()=>J(n,(W(o()),U(()=>o().phase)))),q(e,t)};Y(m,e=>{W(o()),U(()=>o().phase)&&e(h)}),j(l);var g=z(l,2),_=L(g,!0);j(g);var v=z(g,2),y=e=>{var t=cu(),n=L(t,!0);j(t),V(()=>J(n,H(a))),q(e,t)};Y(v,e=>{H(a)&&e(y)});var b=z(v,2),x=e=>{var t=du(),n=L(t),r=e=>{var t=lu(),n=L(t);$(n,{name:`chevron-up`,size:9,strokeWidth:2.5});var r=z(n);j(t),V(()=>{fa(t,`title`,`Parent: ${(W(o()),U(()=>o().parent_code))??``}`),J(r,` ${(W(o()),U(()=>o().parent_code))??``}`)}),q(e,t)};Y(n,e=>{W(o()),U(()=>o().parent_code)&&e(r)});var i=z(n,2),a=e=>{var t=uu(),n=L(t);$(n,{name:`link`,size:9,strokeWidth:2.5});var r=z(n);j(t),V(()=>{fa(t,`title`,`Depends on: ${(W(o()),U(()=>o().depends_on_code))??``}`),J(r,` ${(W(o()),U(()=>o().depends_on_code))??``}`)}),q(e,t)};Y(i,e=>{W(o()),U(()=>o().depends_on_code)&&e(a)}),j(t),q(e,t)};Y(b,e=>{W(o()),U(()=>o().parent_code||o().depends_on_code)&&e(x)});var S=z(b,2),C=L(S),w=e=>{var t=fu(),n=L(t);$(L(n),{name:`bot`,size:9,strokeWidth:2}),j(n);var r=z(n,2),i=L(r,!0);j(r),j(t),V(()=>J(i,(W(o()),U(()=>o().agent)))),q(e,t)},T=e=>{q(e,pu())};Y(C,e=>{W(o()),U(()=>o().agent)?e(w):e(T,-1)});var E=z(C,2),D=L(E);$(D,{name:`clock`,size:10,strokeWidth:2});var ee=z(D,2),te=L(ee,!0);j(ee),j(E),j(S);var ne=z(S,2),re=e=>{var t=mu(),n=L(t),r=L(n);$(r,{name:`cpu`,size:9,strokeWidth:2});var i=z(r);j(n),j(t),V(e=>J(i,` ~${e??``} tokens`),[()=>(W(o()),U(()=>o().est_tokens>=1e3?(o().est_tokens/1e3).toFixed(1)+`k`:o().est_tokens))]),q(e,t)};Y(ne,e=>{W(o()),U(()=>o().est_tokens&&o().est_tokens>0)&&e(re)}),j(s),V(e=>{Ji(c,`background:${H(n)??``};`),Ji(d,`color:${H(i)??``};`),J(_,(W(o()),U(()=>o()?.title||`Untitled Task`))),J(te,e)},[()=>(W(o()),W(il),U(()=>o()?il(o().updated_at):``))]),G(`click`,s,function(e){Da.call(this,t,e)}),G(`keydown`,s,function(e){Da.call(this,t,e)}),q(e,s),Ge()}var _u=[{status:`backlog`,label:`Backlog`,bg:`rgba(100,116,139,0.07)`,border:`rgba(100,116,139,0.18)`,icon:`archive`,color:`#64748b`},{status:`pending`,label:`To Do`,bg:`rgba(14,165,233,0.06)`,border:`rgba(14,165,233,0.18)`,icon:`circle-dot`,color:`#0ea5e9`},{status:`in_progress`,label:`In Progress`,bg:`rgba(168,85,247,0.07)`,border:`rgba(168,85,247,0.18)`,icon:`zap`,color:`#a855f7`},{status:`blocked`,label:`Blocked`,bg:`rgba(239,68,68,0.07)`,border:`rgba(239,68,68,0.18)`,icon:`alert-circle`,color:`#ef4444`},{status:`completed`,label:`Completed`,bg:`rgba(16,185,129,0.06)`,border:`rgba(16,185,129,0.18)`,icon:`circle-check`,color:`#10b981`},{status:`canceled`,label:`Canceled`,bg:`rgba(148,163,184,0.07)`,border:`rgba(148,163,184,0.18)`,icon:`x-circle`,color:`#94a3b8`}];function vu(){let e={},t={};_u.forEach(n=>{e[n.status]={page:1,pageSize:20,hasMore:!0,totalItems:0,totalPages:0},t[n.status]=[]});let{subscribe:n,update:r}=M({loadingCols:new Set,pagination:e,columnTasks:t,draggedTask:null,sourceCol:null,dragOverCol:null});async function i(e,t,i){let a=N({subscribe:n});if(a.loadingCols.has(t))return;r(e=>{let n=new Set(e.loadingCols);return n.add(t),{...e,loadingCols:n}});let o=a.pagination[t];try{let n=await fo.tasks({repo:e,status:t,search:i,page:o.page,pageSize:o.pageSize});r(e=>{let r=o.page===1?n.tasks||[]:[...e.columnTasks[t]||[],...n.tasks||[]],i=n.pagination?.totalItems??r.length,a=n.pagination?.totalPages??Math.ceil(i/o.pageSize);return{...e,columnTasks:{...e.columnTasks,[t]:r},pagination:{...e.pagination,[t]:{...o,totalItems:i,totalPages:a,hasMore:r.length<i}}}})}catch(e){console.error(`Failed to load ${t}:`,e)}finally{r(e=>{let n=new Set(e.loadingCols);return n.delete(t),{...e,loadingCols:n}})}}async function a(e,t){e&&(r(e=>{let t={...e.pagination},n={...e.columnTasks};return _u.forEach(e=>{t[e.status]={page:1,pageSize:20,hasMore:!0,totalItems:0,totalPages:0},n[e.status]=[]}),{...e,pagination:t,columnTasks:n}}),await Promise.all(_u.map(n=>i(e,n.status,t))))}async function o(e){let t=N(La),n=N(eo);t&&(r(t=>({...t,pagination:{...t.pagination,[e]:{...t.pagination[e],page:t.pagination[e].page+1}}})),await i(t,e,n))}function s(e,t,n){e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id)),r(e=>({...e,draggedTask:t,sourceCol:n}))}function c(e,t){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`);let i=N({subscribe:n});!i.draggedTask||i.sourceCol===t||r(e=>({...e,dragOverCol:t}))}function l(e){r(t=>t.dragOverCol===e?{...t,dragOverCol:null}:t)}async function u(e){let t=N(La),i=N(eo),{draggedTask:o,sourceCol:s}=N({subscribe:n});if(r(e=>({...e,dragOverCol:null,draggedTask:null,sourceCol:null})),!(!o||!s||s===e)){r(t=>{let n={...t.columnTasks};return n[s]=n[s].filter(e=>e.id!==o.id),n[e]=[{...o,status:e},...n[e]||[]],{...t,columnTasks:n}});try{await fo.updateTask(o.id,{status:e})}catch(e){let n=e instanceof Error?e.message:`Unknown error`;console.error(`Failed to move task:`,n),t&&a(t,i)}}}async function d(e){let t=N(La);if(t)try{let n=await fo.export(t),r=`${t.replace(/\//g,`_`)}_tasks_export`;e===`json`?ul(n.tasks||[],r+`.json`):dl(n.tasks||[],r+`.csv`)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;alert(`Export failed: `+t)}}return Oa(()=>{let e=!0,t=La.subscribe(e=>{let t=N(eo);e&&a(e,t)}),n,r=eo.subscribe(t=>{if(e)return;let r=N(La);r&&(clearTimeout(n),n=setTimeout(()=>{a(r,t)},150))});return e=!1,()=>{t(),r(),clearTimeout(n)}}),{subscribe:n,loadTasks:a,loadMore:o,handleDragStart:s,handleDragOver:c,handleDragLeave:l,handleDrop:u,handleExport:d}}var yu=K(`<div class="skeleton" style="height:80px;border-radius:12px;"></div> <div class="skeleton" style="height:60px;border-radius:12px;"></div>`,1),bu=K(`<div class="empty-col svelte-173w724"><span><!></span> <div style="font-size:0.75rem;color:var(--color-text-muted);margin-top:6px;">No tasks</div></div>`),xu=K(`<div draggable="true" style="cursor: grab;"><!></div>`),Su=K(`<span class="animate-spin"><!></span>`),Cu=K(`<button class="btn btn-ghost btn-sm w-full" style="margin-top:4px;justify-content:center;"><!> </button>`),wu=K(`<!> <!>`,1),Tu=K(`<div><div class="flex items-center gap-2 mb-3"><span><!></span> <span style="font-size:0.78rem;font-weight:700;color:var(--color-text);"> </span> <span class="col-count svelte-173w724"> </span></div> <div class="flex flex-col" style="gap:8px;overflow-y:auto;max-height:calc(100vh - 340px);padding-right:2px;"><!></div></div>`),Eu=K(`<div><div class="flex items-center justify-between mb-4"><div class="search-wrap svelte-173w724"><span class="search-icon-inner svelte-173w724"><!></span> <input class="form-input" style="padding-left:32px;width:220px;font-size:0.8rem;" type="text" placeholder="Search tasks…"/></div> <div class="flex gap-2"><div class="flex gap-1 mr-1"><button class="btn btn-ghost btn-sm" title="Export JSON"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> JSON</button> <button class="btn btn-ghost btn-sm" title="Export CSV"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> CSV</button></div> <div style="width:1px;height:24px;background:var(--color-border);margin:0 4px;"></div> <button class="btn btn-ghost btn-sm" title="Bulk Import"><!> Import</button> <button class="btn btn-accent btn-sm"><!> Add Task</button></div></div> <div class="kanban-board" style="padding-bottom:16px;"></div></div>`);function Du(e,t){We(t,!1);let n=()=>P(eo,`$taskSearch`,i),r=()=>P(u,`$kanbanState`,i),[i,a]=pt(),o=Q(t,`onTaskClick`,8,()=>{}),s=Q(t,`onAddTask`,8,()=>{}),c=Q(t,`onBulkImport`,8,()=>{}),l=vu(),u={subscribe:l.subscribe};function d(e){l.loadTasks(e,n())}var f={loadTasks:d};Ta();var p=Eu(),m=L(p),h=L(m),g=L(h);$(L(g),{name:`search`,size:13,strokeWidth:2}),j(g);var _=z(g,2);ca(_),j(h);var v=z(h,2),y=L(v),b=L(y),x=z(b,2);j(y);var S=z(y,4);$(L(S),{name:`upload`,size:14,strokeWidth:2.5}),Ne(),j(S);var C=z(S,2);$(L(C),{name:`plus`,size:14,strokeWidth:2.5}),Ne(),j(C),j(v),j(m);var w=z(m,2);X(w,5,()=>_u,e=>e.status,(e,t)=>{var n=Tu(),i=L(n),a=L(i);$(L(a),{get name(){return H(t),U(()=>H(t).icon)},size:13,strokeWidth:2}),j(a);var s=z(a,2),c=L(s,!0);j(s);var u=z(s,2),d=L(u,!0);j(u),j(i);var f=z(i,2),p=L(f),m=e=>{var n=li(),i=R(n),a=e=>{var t=yu();Ne(2),q(e,t)},o=Jt(()=>(r(),H(t),U(()=>r().loadingCols.has(H(t).status)))),s=e=>{var n=bu(),r=L(n);$(L(r),{get name(){return H(t),U(()=>H(t).icon)},size:22,strokeWidth:1.25}),j(r),Ne(2),j(n),V(()=>Ji(r,`color:${(H(t),U(()=>H(t).color))??``};opacity:0.5;`)),q(e,n)};Y(i,e=>{H(o)?e(a):e(s,-1)}),q(e,n)},h=e=>{var n=wu(),i=R(n);X(i,1,()=>(r(),H(t),U(()=>r().columnTasks[H(t).status])),e=>e.id,(e,n)=>{var r=xu();gu(L(r),{get task(){return H(n)},$$events:{click:()=>o()(H(n))}}),j(r),G(`dragstart`,r,e=>l.handleDragStart(e,H(n),H(t).status)),q(e,r)});var a=z(i,2),s=e=>{var n=Cu(),i=L(n),a=e=>{var t=Su();$(L(t),{name:`refresh-cw`,size:12,strokeWidth:2}),j(t),q(e,t)},o=Jt(()=>(r(),H(t),U(()=>r().loadingCols.has(H(t).status)))),s=e=>{$(e,{name:`chevron-down`,size:12,strokeWidth:2})};Y(i,e=>{H(o)?e(a):e(s,-1)});var c=z(i);j(n),V((e,t)=>{n.disabled=e,J(c,` ${t??``}`)},[()=>(r(),H(t),U(()=>r().loadingCols.has(H(t).status))),()=>(r(),H(t),U(()=>r().loadingCols.has(H(t).status)?`Loading…`:`Load more`))]),G(`click`,n,()=>l.loadMore(H(t).status)),q(e,n)};Y(a,e=>{r(),H(t),U(()=>r().pagination[H(t).status]?.hasMore)&&e(s)}),q(e,n)};Y(p,e=>{r(),H(t),U(()=>(r().columnTasks[H(t).status]||[]).length===0)?e(m):e(h,-1)}),j(f),j(n),V(()=>{Ki(n,1,`kanban-col ${(r(),H(t),U(()=>r().dragOverCol===H(t).status?`drag-over`:``))??``}`,`svelte-173w724`),Ji(n,`background:${(H(t),U(()=>H(t).bg))??``};border:1px solid ${(H(t),U(()=>H(t).border))??``};padding:12px;border-radius:16px;transition: border-color 0.2s;`),Ji(a,`color:${(H(t),U(()=>H(t).color))??``};display:flex;flex-shrink:0;`),J(c,(H(t),U(()=>H(t).label))),Ji(u,`margin-left:auto;background:${(H(t),U(()=>H(t).bg))??``};color:${(H(t),U(()=>H(t).color))??``};border:1px solid ${(H(t),U(()=>H(t).border))??``};`),J(d,(r(),H(t),U(()=>r().pagination[H(t).status]?.totalItems||0)))}),G(`dragover`,n,e=>l.handleDragOver(e,H(t).status)),G(`dragleave`,n,()=>l.handleDragLeave(H(t).status)),G(`drop`,n,()=>l.handleDrop(H(t).status)),q(e,n)}),j(w),j(p),Z(_,n,e=>ft(eo,e)),G(`click`,b,()=>l.handleExport(`json`)),G(`click`,x,()=>l.handleExport(`csv`)),G(`click`,S,function(...e){c()?.apply(this,e)}),G(`click`,C,function(...e){s()?.apply(this,e)}),q(e,p),ba(t,`loadTasks`,d);var T=Ge(f);return a(),T}var Ou=M([]);function ku(){let e=st(Va,e=>e||null),t=st(Va,e=>e?.taskStats??null),n=st(Va,e=>[{label:`Total`,val:e?.total??0,icon:`brain`,color:`#6366f1`,glow:`rgba(99,102,241,0.12)`},{label:`Facts`,val:e?.byType?.code_fact??0,icon:`code`,color:`#10b981`,glow:`rgba(16,185,129,0.12)`},{label:`Decisions`,val:e?.byType?.decision??0,icon:`gavel`,color:`#f59e0b`,glow:`rgba(245,158,11,0.12)`},{label:`Archive`,val:e?.byType?.task_archive??0,icon:`archive`,color:`#0ea5e9`,glow:`rgba(14,165,233,0.12)`}]),r=st(Va,e=>e?.byType?Object.entries(e.byType).map(([e,t])=>({label:e.replace(`_`,` `),count:t,color:i(e)})):[]);function i(e){return{code_fact:`#10b981`,decision:`#f59e0b`,mistake:`#ef4444`,pattern:`#a855f7`,task_archive:`#0ea5e9`}[e]||`#94a3b8`}let a=st(Ou,e=>e);async function o(e){if(e)try{let t=await fo.tasks({repo:e,status:`in_progress,pending`,pageSize:5});Ou.set(t.tasks||[])}catch(e){console.error(`Failed to load active tasks for widget:`,e)}}return{memoryStats:e,taskStats:t,summaryItems:n,byTypeStats:r,activeTasks:a,refreshActiveTasks:o}}var Au=K(`<div class="stat-card svelte-1imzu92"><div class="svelte-1imzu92"><!></div> <div class="svelte-1imzu92"> </div> <div style="font-size:0.6rem;font-weight:700;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.06em;margin-top:2px;" class="svelte-1imzu92"> </div></div>`),ju=K(`<div class="flex items-center gap-2 glassy-badge svelte-1imzu92"><div class="indicator-dot svelte-1imzu92"></div> <span class="count svelte-1imzu92"> </span> <span class="label svelte-1imzu92"> </span></div>`),Mu=K(`<div style="margin-top:4px;" class="svelte-1imzu92"><div class="stat-label svelte-1imzu92" style="font-size:0.6rem;margin-bottom:6px;">By Type</div> <div style="display:flex;flex-wrap:wrap;gap:8px;" class="svelte-1imzu92"></div></div>`),Nu=K(`<div style="display:grid;grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));gap:10px;margin-bottom:12px;" class="svelte-1imzu92"></div> <!>`,1);function Pu(e,t){We(t,!1);let n=()=>P(o,`$summaryItems`,i),r=()=>P(s,`$byTypeStats`,i),[i,a]=pt(),{summaryItems:o,byTypeStats:s}=ku();Ta();var c=Nu(),l=R(c);X(l,5,n,e=>e.label,(e,t)=>{var n=Au(),r=L(n);$(L(r),{get name(){return H(t).icon},size:14,strokeWidth:1.75}),j(r);var i=z(r,2),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(n),V(()=>{Ji(n,`text-align:center;background:${H(t).glow??``};border:1px solid ${H(t).glow??``};padding:10px 8px;`),Ji(r,`display:flex;justify-content:center;margin-bottom:2px;color:${H(t).color??``};opacity:0.8;`),Ji(i,`font-size:1.25rem;font-weight:900;color:${H(t).color??``};line-height:1;letter-spacing:-0.03em;`),J(a,H(t).val),J(s,H(t).label)}),q(e,n)}),j(l);var u=z(l,2),d=e=>{var t=Mu(),n=z(L(t),2);X(n,5,r,e=>e.label,(e,t)=>{var n=ju(),r=z(L(n),2),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),V(()=>{Ji(n,`--badge-color: ${H(t).color??``};`),J(i,H(t).count),J(o,H(t).label)}),q(e,n)}),j(n),j(t),q(e,t)};Y(u,e=>{r().length>0&&e(d)}),q(e,c),Ge(),a()}var Fu=K(`<div class="stat-card"><div><!></div> <div> </div> <div style="font-size:0.6rem;font-weight:700;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.06em;margin-top:2px;"> </div></div>`),Iu=K(`<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;background:rgba(255,255,255,0.02);border-radius:8px;border:1px solid var(--color-border);"><div style="flex:1;min-width:0;"><div style="font-size:0.75rem;font-weight:700;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"> </div> <div style="font-size:0.6rem;color:var(--color-text-muted);font-family:monospace;margin-top:1px;"> </div></div> <div> </div></div>`),Lu=K(`<div style="display:flex;flex-direction:column;gap:6px;" class="animate-fade-in"></div>`),Ru=K(`<div style="margin-top:16px; padding-top:12px; border-top:1px dashed var(--color-border);"><button class="flex items-center justify-between w-full" style="background:none; border:none; padding:0; cursor:pointer; margin-bottom:10px;"><div style="font-size:0.65rem;font-weight:700;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.05em;display:flex;align-items:center;gap:6px;"><!> Active Priorities</div> <div><!></div></button> <!></div>`),zu=K(`<div style="display:grid;grid-template-columns:repeat(auto-fit, minmax(120px, 1fr));gap:10px;width:100%;"></div> <!>`,1);function Bu(e,t){We(t,!1);let n=()=>P(La,`$currentRepo`,a),r=()=>P(c,`$taskStats`,a),i=()=>P(l,`$activeTasks`,a),[a,o]=pt(),s=F(),{taskStats:c,activeTasks:l,refreshActiveTasks:u}=ku(),d=F(!0);B(()=>n(),()=>{n()&&u(n())}),B(()=>r(),()=>{I(s,[{label:`Total`,val:r()?.total??0,icon:`layers`,color:`#6366f1`,glow:`rgba(99,102,241,0.12)`},{label:`Backlog`,val:r()?.backlog??0,icon:`inbox`,color:`#64748b`,glow:`rgba(100,116,139,0.12)`},{label:`To Do`,val:r()?.pending??0,icon:`circle-dot`,color:`#0ea5e9`,glow:`rgba(14,165,233,0.12)`},{label:`Active`,val:r()?.in_progress??0,icon:`zap`,color:`#a855f7`,glow:`rgba(168,85,247,0.12)`},{label:`Done`,val:r()?.completed??0,icon:`circle-check`,color:`#10b981`,glow:`rgba(16,185,129,0.12)`}])}),Un(),Ta();var f=li(),p=R(f),m=e=>{var t=zu(),n=R(t);X(n,5,()=>H(s),e=>e.label,(e,t)=>{var n=Fu(),r=L(n);$(L(r),{get name(){return H(t),U(()=>H(t).icon)},size:14,strokeWidth:1.75}),j(r);var i=z(r,2),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(n),V(()=>{Ji(n,`text-align:center;background:${(H(t),U(()=>H(t).glow))??``};border:1px solid ${(H(t),U(()=>H(t).glow))??``};padding:10px 8px;`),Ji(r,`display:flex;justify-content:center;margin-bottom:2px;color:${(H(t),U(()=>H(t).color))??``};opacity:0.8;`),Ji(i,`font-size:1.25rem;font-weight:900;color:${(H(t),U(()=>H(t).color))??``};line-height:1;letter-spacing:-0.03em;`),J(a,(H(t),U(()=>H(t).val))),J(s,(H(t),U(()=>H(t).label)))}),q(e,n)}),j(n);var r=z(n,2),a=e=>{var t=Ru(),n=L(t),r=L(n);$(L(r),{name:`clock-arrow-up`,size:12,strokeWidth:2}),Ne(),j(r);var a=z(r,2);$(L(a),{name:`chevron-down`,size:12,strokeWidth:2.5}),j(a),j(n);var o=z(n,2),s=e=>{var t=Lu();X(t,5,i,e=>e.id,(e,t)=>{var n=Iu(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o);j(o),j(r);var c=z(r,2),l=L(c,!0);j(c),j(n),V(()=>{J(a,(H(t),U(()=>H(t).title))),J(s,`${(H(t),U(()=>H(t).task_code))??``} • ${(H(t),U(()=>H(t).phase))??``}`),Ji(c,`font-size:0.55rem;font-weight:800;padding:2px 8px;border-radius:99px;text-transform:uppercase;letter-spacing:0.03em;white-space:nowrap;background:${(H(t),U(()=>H(t).status===`in_progress`?`rgba(168,85,247,0.1)`:`rgba(14,165,233,0.1)`))??``};color:${(H(t),U(()=>H(t).status===`in_progress`?`#a855f7`:`#0ea5e9`))??``};border:1px solid currentColor;`),J(l,(H(t),U(()=>H(t).status===`in_progress`?`Active`:`To Do`)))}),q(e,n)}),j(t),q(e,t)};Y(o,e=>{H(d)&&e(s)}),j(t),V(()=>Ji(a,`color:var(--color-text-muted); transition: transform 0.2s ease; transform: rotate(${H(d)?`0deg`:`-90deg`})`)),G(`click`,n,()=>I(d,!H(d))),q(e,t)};Y(r,e=>{i(),U(()=>i().length>0)&&e(a)}),q(e,t)};Y(p,e=>{r()&&e(m)}),q(e,f),Ge(),o()}function Vu(e){return e+.5|0}var Hu=(e,t,n)=>Math.max(Math.min(e,n),t);function Uu(e){return Hu(Vu(e*2.55),0,255)}function Wu(e){return Hu(Vu(e*255),0,255)}function Gu(e){return Hu(Vu(e/2.55)/100,0,1)}function Ku(e){return Hu(Vu(e*100),0,100)}var qu={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ju=[...`0123456789ABCDEF`],Yu=e=>Ju[e&15],Xu=e=>Ju[(e&240)>>4]+Ju[e&15],Zu=e=>(e&240)>>4==(e&15),Qu=e=>Zu(e.r)&&Zu(e.g)&&Zu(e.b)&&Zu(e.a);function $u(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&qu[e[1]]*17,g:255&qu[e[2]]*17,b:255&qu[e[3]]*17,a:t===5?qu[e[4]]*17:255}:(t===7||t===9)&&(n={r:qu[e[1]]<<4|qu[e[2]],g:qu[e[3]]<<4|qu[e[4]],b:qu[e[5]]<<4|qu[e[6]],a:t===9?qu[e[7]]<<4|qu[e[8]]:255})),n}var ed=(e,t)=>e<255?t(e):``;function td(e){var t=Qu(e)?Yu:Xu;return e?`#`+t(e.r)+t(e.g)+t(e.b)+ed(e.a,t):void 0}var nd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function rd(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function id(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function ad(e,t,n){let r=rd(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function od(e,t,n,r,i){return e===i?(t-n)/r+(t<n?6:0):t===i?(n-e)/r+2:(e-t)/r+4}function sd(e){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c,l;return i!==a&&(l=i-a,c=o>.5?l/(2-i-a):l/(i+a),s=od(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function cd(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(Wu)}function ld(e,t,n){return cd(rd,e,t,n)}function ud(e,t,n){return cd(ad,e,t,n)}function dd(e,t,n){return cd(id,e,t,n)}function fd(e){return(e%360+360)%360}function pd(e){let t=nd.exec(e),n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Uu(+t[5]):Wu(+t[5]));let i=fd(+t[2]),a=t[3]/100,o=t[4]/100;return r=t[1]===`hwb`?ud(i,a,o):t[1]===`hsv`?dd(i,a,o):ld(i,a,o),{r:r[0],g:r[1],b:r[2],a:n}}function md(e,t){var n=sd(e);n[0]=fd(n[0]+t),n=ld(n),e.r=n[0],e.g=n[1],e.b=n[2]}function hd(e){if(!e)return;let t=sd(e),n=t[0],r=Ku(t[1]),i=Ku(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${Gu(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var gd={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`},_d={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function vd(){let e={},t=Object.keys(_d),n=Object.keys(gd),r,i,a,o,s;for(r=0;r<t.length;r++){for(o=s=t[r],i=0;i<n.length;i++)a=n[i],s=s.replace(a,gd[a]);a=parseInt(_d[o],16),e[s]=[a>>16&255,a>>8&255,a&255]}return e}var yd;function bd(e){yd||(yd=vd(),yd.transparent=[0,0,0,0]);let t=yd[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var xd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Sd(e){let t=xd.exec(e),n=255,r,i,a;if(t){if(t[7]!==r){let e=+t[7];n=t[8]?Uu(e):Hu(e*255,0,255)}return r=+t[1],i=+t[3],a=+t[5],r=255&(t[2]?Uu(r):Hu(r,0,255)),i=255&(t[4]?Uu(i):Hu(i,0,255)),a=255&(t[6]?Uu(a):Hu(a,0,255)),{r,g:i,b:a,a:n}}}function Cd(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Gu(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var wd=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,Td=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function Ed(e,t,n){let r=Td(Gu(e.r)),i=Td(Gu(e.g)),a=Td(Gu(e.b));return{r:Wu(wd(r+n*(Td(Gu(t.r))-r))),g:Wu(wd(i+n*(Td(Gu(t.g))-i))),b:Wu(wd(a+n*(Td(Gu(t.b))-a))),a:e.a+n*(t.a-e.a)}}function Dd(e,t,n){if(e){let r=sd(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=ld(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function Od(e,t){return e&&Object.assign(t||{},e)}function kd(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Wu(e[3]))):(t=Od(e,{r:0,g:0,b:0,a:1}),t.a=Wu(t.a)),t}function Ad(e){return e.charAt(0)===`r`?Sd(e):pd(e)}var jd=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,r;n===`object`?r=kd(t):n===`string`&&(r=$u(t)||bd(t)||Ad(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Od(this._rgb);return e&&(e.a=Gu(e.a)),e}set rgb(e){this._rgb=kd(e)}rgbString(){return this._valid?Cd(this._rgb):void 0}hexString(){return this._valid?td(this._rgb):void 0}hslString(){return this._valid?hd(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=Ed(this._rgb,e._rgb,t)),this}clone(){return new e(this.rgb)}alpha(e){return this._rgb.a=Wu(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb;return e.r=e.g=e.b=Vu(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Dd(this._rgb,2,e),this}darken(e){return Dd(this._rgb,2,-e),this}saturate(e){return Dd(this._rgb,1,e),this}desaturate(e){return Dd(this._rgb,1,-e),this}rotate(e){return md(this._rgb,e),this}};function Md(){}var Nd=(()=>{let e=0;return()=>e++})();function Pd(e){return e==null}function Fd(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function Id(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function Ld(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function Rd(e,t){return Ld(e)?e:t}function zd(e,t){return e===void 0?t:e}var Bd=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function Vd(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function Hd(e,t,n,r){let i,a,o;if(Fd(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;i<a;i++)t.call(n,e[i],i);else if(Id(e))for(o=Object.keys(e),a=o.length,i=0;i<a;i++)t.call(n,e[o[i]],o[i])}function Ud(e,t){let n,r,i,a;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(i=e[n],a=t[n],i.datasetIndex!==a.datasetIndex||i.index!==a.index)return!1;return!0}function Wd(e){if(Fd(e))return e.map(Wd);if(Id(e)){let t=Object.create(null),n=Object.keys(e),r=n.length,i=0;for(;i<r;++i)t[n[i]]=Wd(e[n[i]]);return t}return e}function Gd(e){return[`__proto__`,`prototype`,`constructor`].indexOf(e)===-1}function Kd(e,t,n,r){if(!Gd(e))return;let i=t[e],a=n[e];Id(i)&&Id(a)?qd(i,a,r):t[e]=Wd(a)}function qd(e,t,n){let r=Fd(t)?t:[t],i=r.length;if(!Id(e))return e;n||={};let a=n.merger||Kd,o;for(let t=0;t<i;++t){if(o=r[t],!Id(o))continue;let i=Object.keys(o);for(let t=0,r=i.length;t<r;++t)a(i[t],e,o,n)}return e}function Jd(e,t){return qd(e,t,{merger:Yd})}function Yd(e,t,n){if(!Gd(e))return;let r=t[e],i=n[e];Id(r)&&Id(i)?Jd(r,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Wd(i))}var Xd={"":e=>e,x:e=>e.x,y:e=>e.y};function Zd(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function Qd(e){let t=Zd(e);return e=>{for(let n of t){if(n===``)break;e&&=e[n]}return e}}function $d(e,t){return(Xd[t]||(Xd[t]=Qd(t)))(e)}function ef(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tf=e=>e!==void 0,nf=e=>typeof e==`function`,rf=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function af(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var of=Math.PI,sf=2*of;sf+of;var cf=1/0,lf=of/180,uf=of/2,df=of/4,ff=of*2/3,pf=Math.log10,mf=Math.sign;function hf(e,t,n){return Math.abs(e-t)<n}function gf(e){let t=Math.round(e);e=hf(e,t,e/1e3)?t:e;let n=10**Math.floor(pf(e)),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function _f(e){let t=[],n=Math.sqrt(e),r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((e,t)=>e-t).pop(),t}function vf(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function yf(e){return!vf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function bf(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function xf(e,t,n){let r,i,a;for(r=0,i=e.length;r<i;r++)a=e[r][n],isNaN(a)||(t.min=Math.min(t.min,a),t.max=Math.max(t.max,a))}function Sf(e){return of/180*e}function Cf(e){return 180/of*e}function wf(e){if(!Ld(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Tf(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r),a=Math.atan2(r,n);return a<-.5*of&&(a+=sf),{angle:a,distance:i}}function Ef(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Df(e){return(e%sf+sf)%sf}function Of(e,t,n,r){let i=Df(e),a=Df(t),o=Df(n),s=Df(a-i),c=Df(o-i),l=Df(i-a),u=Df(i-o);return i===a||i===o||r&&a===o||s>c&&l<u}function kf(e,t,n){return Math.max(t,Math.min(n,e))}function Af(e){return kf(e,-32768,32767)}function jf(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function Mf(e,t,n){n||=(n=>e[n]<t);let r=e.length-1,i=0,a;for(;r-i>1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var Nf=(e,t,n,r)=>Mf(e,n,r?r=>{let i=e[r][t];return i<n||i===n&&e[r+1][t]===n}:r=>e[r][t]<n),Pf=(e,t,n)=>Mf(e,n,r=>e[r][t]>=n);function Ff(e,t,n){let r=0,i=e.length;for(;r<i&&e[r]<t;)r++;for(;i>r&&e[i-1]>n;)i--;return r>0||i<e.length?e.slice(r,i):e}var If=[`push`,`pop`,`shift`,`splice`,`unshift`];function Lf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,`_chartjs`,{configurable:!0,enumerable:!1,value:{listeners:[t]}}),If.forEach(t=>{let n=`_onData`+ef(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function Rf(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(If.forEach(t=>{delete e[t]}),delete e._chartjs)}function zf(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var Bf=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function Vf(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,Bf.call(window,()=>{r=!1,e.apply(t,n)}))}}function Hf(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var Uf=e=>e===`start`?`left`:e===`end`?`right`:`center`,Wf=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,Gf=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t,Kf=e=>e===0||e===1,qf=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*sf/n)),Jf=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*sf/n)+1,Yf={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*uf)+1,easeOutSine:e=>Math.sin(e*uf),easeInOutSine:e=>-.5*(Math.cos(of*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>Kf(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Kf(e)?e:qf(e,.075,.3),easeOutElastic:e=>Kf(e)?e:Jf(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return Kf(e)?e:e<.5?.5*qf(e*2,t,n):.5+.5*Jf(e*2-1,t,n)},easeInBack(e){let t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){let t=1.70158;return--e*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Yf.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?Yf.easeInBounce(e*2)*.5:Yf.easeOutBounce(e*2-1)*.5+.5};function Xf(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function Zf(e){return Xf(e)?e:new jd(e)}function Qf(e){return Xf(e)?e:new jd(e).saturate(.5).darken(.1).hexString()}var $f=[`x`,`y`,`borderWidth`,`radius`,`tension`],ep=[`color`,`borderColor`,`backgroundColor`];function tp(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:ep},numbers:{type:`number`,properties:$f}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:e=>e|0}}}})}function np(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var rp=new Map;function ip(e,t){t||={};let n=e+JSON.stringify(t),r=rp.get(n);return r||(r=new Intl.NumberFormat(e,t),rp.set(n,r)),r}function ap(e,t,n){return ip(t,n).format(e)}var op={values(e){return Fd(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=sp(e,n)}let o=pf(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),ap(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(pf(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?op.numeric.call(this,e,t,n):``}};function sp(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var cp={formatters:op};function lp(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:cp.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var up=Object.create(null),dp=Object.create(null);function fp(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;t<r;++t){let r=n[t];e=e[r]||(e[r]=Object.create(null))}return e}function pp(e,t,n){return typeof t==`string`?qd(fp(e,t),n):qd(fp(e,``),t)}var mp=new class{constructor(e,t){this.animation=void 0,this.backgroundColor=`rgba(0,0,0,0.1)`,this.borderColor=`rgba(0,0,0,0.1)`,this.color=`#666`,this.datasets={},this.devicePixelRatio=e=>e.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>Qf(t.backgroundColor),this.hoverBorderColor=(e,t)=>Qf(t.borderColor),this.hoverColor=(e,t)=>Qf(t.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return pp(this,e,t)}get(e){return fp(this,e)}describe(e,t){return pp(dp,e,t)}override(e,t){return pp(up,e,t)}route(e,t,n,r){let i=fp(this,e),a=fp(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return Id(e)?Object.assign({},t,e):zd(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[tp,np,lp]);function hp(e){return!e||Pd(e.size)||Pd(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function gp(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function _p(e,t,n,r){r||={};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;c<s;c++)if(d=n[c],d!=null&&!Fd(d))o=gp(e,i,a,o,d);else if(Fd(d))for(l=0,u=d.length;l<u;l++)f=d[l],f!=null&&!Fd(f)&&(o=gp(e,i,a,o,f));e.restore();let p=a.length/2;if(p>n.length){for(c=0;c<p;c++)delete i[a[c]];a.splice(0,p)}return o}function vp(e,t,n){let r=e.currentDevicePixelRatio,i=n===0?0:Math.max(n/2,.5);return Math.round((t-i)*r)/r+i}function yp(e,t){!t&&!e||(t||=e.getContext(`2d`),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function bp(e,t,n,r){xp(e,t,n,r,null)}function xp(e,t,n,r,i){let a,o,s,c,l,u,d,f,p=t.pointStyle,m=t.rotation,h=t.radius,g=(m||0)*lf;if(p&&typeof p==`object`&&(a=p.toString(),a===`[object HTMLImageElement]`||a===`[object HTMLCanvasElement]`)){e.save(),e.translate(n,r),e.rotate(g),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),e.restore();return}if(!(isNaN(h)||h<=0)){switch(e.beginPath(),p){default:i?e.ellipse(n,r,i/2,h,0,0,sf):e.arc(n,r,h,0,sf),e.closePath();break;case`triangle`:u=i?i/2:h,e.moveTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=ff,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=ff,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),e.closePath();break;case`rectRounded`:l=h*.516,c=h-l,o=Math.cos(g+df)*c,d=Math.cos(g+df)*(i?i/2-l:c),s=Math.sin(g+df)*c,f=Math.sin(g+df)*(i?i/2-l:c),e.arc(n-d,r-s,l,g-of,g-uf),e.arc(n+f,r-o,l,g-uf,g),e.arc(n+d,r+s,l,g,g+uf),e.arc(n-f,r+o,l,g+uf,g+of),e.closePath();break;case`rect`:if(!m){c=Math.SQRT1_2*h,u=i?i/2:c,e.rect(n-u,r-c,2*u,2*c);break}g+=df;case`rectRot`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+f,r-o),e.lineTo(n+d,r+s),e.lineTo(n-f,r+o),e.closePath();break;case`crossRot`:g+=df;case`cross`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`star`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o),g+=df,d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`line`:o=i?i/2:Math.cos(g)*h,s=Math.sin(g)*h,e.moveTo(n-o,r-s),e.lineTo(n+o,r+s);break;case`dash`:e.moveTo(n,r),e.lineTo(n+Math.cos(g)*(i?i/2:h),r+Math.sin(g)*h);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function Sp(e,t,n){return n||=.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Cp(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function wp(e){e.restore()}function Tp(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),Pd(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Ep(e,t,n,r,i){if(i.strikethrough||i.underline){let a=e.measureText(r),o=t-a.actualBoundingBoxLeft,s=t+a.actualBoundingBoxRight,c=n-a.actualBoundingBoxAscent,l=n+a.actualBoundingBoxDescent,u=i.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(o,u),e.lineTo(s,u),e.stroke()}}function Dp(e,t){let n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Op(e,t,n,r,i,a={}){let o=Fd(t)?t:[t],s=a.strokeWidth>0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,Tp(e,a),c=0;c<o.length;++c)l=o[c],a.backdrop&&Dp(e,a.backdrop),s&&(a.strokeColor&&(e.strokeStyle=a.strokeColor),Pd(a.strokeWidth)||(e.lineWidth=a.strokeWidth),e.strokeText(l,n,r,a.maxWidth)),e.fillText(l,n,r,a.maxWidth),Ep(e,n,r,l,a),r+=Number(i.lineHeight);e.restore()}function kp(e,t){let{x:n,y:r,w:i,h:a,radius:o}=t;e.arc(n+o.topLeft,r+o.topLeft,o.topLeft,1.5*of,of,!0),e.lineTo(n,r+a-o.bottomLeft),e.arc(n+o.bottomLeft,r+a-o.bottomLeft,o.bottomLeft,of,uf,!0),e.lineTo(n+i-o.bottomRight,r+a),e.arc(n+i-o.bottomRight,r+a-o.bottomRight,o.bottomRight,uf,0,!0),e.lineTo(n+i,r+o.topRight),e.arc(n+i-o.topRight,r+o.topRight,o.topRight,0,-uf,!0),e.lineTo(n+o.topLeft,r)}var Ap=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,jp=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Mp(e,t){let n=(``+e).match(Ap);if(!n||n[1]===`normal`)return t*1.2;switch(e=+n[2],n[3]){case`px`:return e;case`%`:e/=100;break}return t*e}var Np=e=>+e||0;function Pp(e,t){let n={},r=Id(t),i=r?Object.keys(t):t,a=Id(e)?r?n=>zd(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=Np(a(e));return n}function Fp(e){return Pp(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function Ip(e){return Pp(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function Lp(e){let t=Fp(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Rp(e,t){e||={},t||=mp.font;let n=zd(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=zd(e.style,t.style);r&&!(``+r).match(jp)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:zd(e.family,t.family),lineHeight:Mp(zd(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:zd(e.weight,t.weight),string:``};return i.string=hp(i),i}function zp(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;a<o;++a)if(s=e[a],s!==void 0&&(t!==void 0&&typeof s==`function`&&(s=s(t),i=!1),n!==void 0&&Fd(s)&&(s=s[n%s.length],i=!1),s!==void 0))return r&&!i&&(r.cacheable=!1),s}function Bp(e,t,n){let{min:r,max:i}=e,a=Bd(t,(i-r)/2),o=(e,t)=>n&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function Vp(e,t){return Object.assign(Object.create(e),t)}function Hp(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=im(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>Hp([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return qp(n,r,()=>rm(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return am(e).includes(t)},ownKeys(e){return am(e)},set(e,t,n){let r=e._storage||=i();return e[t]=r[t]=n,delete e._keys,!0}})}function Up(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Wp(e,r),setContext:t=>Up(e,t,n,r),override:i=>Up(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return qp(e,t,()=>Jp(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function Wp(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:nf(n)?n:()=>n,isIndexable:nf(r)?r:()=>r}}var Gp=(e,t)=>e?e+ef(t):t,Kp=(e,t)=>Id(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function qp(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function Jp(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return nf(s)&&o.isScriptable(t)&&(s=Yp(t,s,e,n)),Fd(s)&&s.length&&(s=Xp(t,s,e,o.isIndexable)),Kp(t,s)&&(s=Up(s,i,a&&a[t],o)),s}function Yp(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),Kp(e,c)&&(c=em(i._scopes,i,e,c)),c}function Xp(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(Id(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=em(r,i,e,c);t.push(Up(n,a,o&&o[e],s))}}return t}function Zp(e,t,n){return nf(e)?e(t,n):e}var Qp=(e,t)=>e===!0?t:typeof e==`string`?$d(t,e):void 0;function $p(e,t,n,r,i){for(let a of t){let t=Qp(n,a);if(t){e.add(t);let a=Zp(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function em(e,t,n,r){let i=t._rootScopes,a=Zp(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=tm(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=tm(s,o,a,c,r),c===null)?!1:Hp(Array.from(s),[``],i,a,()=>nm(t,n,r))}function tm(e,t,n,r,i){for(;n;)n=$p(e,t,n,r,i);return n}function nm(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return Fd(i)&&Id(n)?n:i||{}}function rm(e,t,n,r){let i;for(let a of t)if(i=im(Gp(a,e),n),i!==void 0)return Kp(e,i)?em(n,r,e,i):i}function im(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function am(e){let t=e._keys;return t||=e._keys=om(e._scopes),t}function om(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}function sm(){return typeof window<`u`&&typeof document<`u`}function cm(e){let t=e.parentNode;return t&&t.toString()===`[object ShadowRoot]`&&(t=t.host),t}function lm(e,t,n){let r;return typeof e==`string`?(r=parseInt(e,10),e.indexOf(`%`)!==-1&&(r=r/100*t.parentNode[n])):r=e,r}var um=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function dm(e,t){return um(e).getPropertyValue(t)}var fm=[`top`,`right`,`bottom`,`left`];function pm(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=fm[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var mm=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function hm(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(mm(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function gm(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=um(n),a=i.boxSizing===`border-box`,o=pm(i,`padding`),s=pm(i,`border`,`width`),{x:c,y:l,box:u}=hm(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function _m(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&cm(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=um(a),s=pm(o,`border`,`width`),c=pm(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=lm(o.maxWidth,a,`clientWidth`),i=lm(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||cf,maxHeight:i||cf}}var vm=e=>Math.round(e*10)/10;function ym(e,t,n,r){let i=um(e),a=pm(i,`margin`),o=lm(i.maxWidth,e,`clientWidth`)||cf,s=lm(i.maxHeight,e,`clientHeight`)||cf,c=_m(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=pm(i,`border`,`width`),t=pm(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=vm(Math.min(l,o,c.maxWidth)),u=vm(Math.min(u,s,c.maxHeight)),l&&!u&&(u=vm(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=vm(Math.floor(u*r))),{width:l,height:u}}function bm(e,t,n){let r=t||1,i=vm(e.height*r),a=vm(e.width*r);e.height=vm(e.height),e.width=vm(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var xm=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};sm()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function Sm(e,t){let n=dm(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}var Cm=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},wm=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Tm(e,t,n){return e?Cm(t,n):wm()}function Em(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function Dm(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function Om(e,t,n){return e.options.clip?e[n]:t[n]}function km(e,t){let{xScale:n,yScale:r}=e;return n&&r?{left:Om(n,t,`left`),right:Om(n,t,`right`),top:Om(r,t,`top`),bottom:Om(r,t,`bottom`)}:t}function Am(e,t){let n=t._clip;if(n.disabled)return!1;let r=km(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}var jm=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,Bf.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Mm=`transparent`,Nm={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=Zf(e||Mm),i=r.valid&&Zf(t||Mm);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Pm=class{constructor(e,t,n,r){let i=t[n];r=zp([e.to,r,i,e.from]);let a=zp([e.from,i,r]);this._active=!0,this._fn=e.fn||Nm[e.type||typeof a],this._easing=Yf[e.easing]||Yf.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=zp([e.to,t,r,e.from]),this._from=zp([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t<n),!this._active){this._target[r]=o,this._notify(!0);return}if(t<0){this._target[r]=i;return}s=t/n%2,s=a&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}},Fm=class{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!Id(e))return;let t=Object.keys(mp.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let i=e[r];if(!Id(i))return;let a={};for(let e of t)a[e]=i[e];(Fd(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=Lm(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Im(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Pm(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return jm.add(this._chart,n),!0}};function Im(e,t){let n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){let i=e[r[t]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function Lm(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Rm(e,t){let n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,a=n.max===void 0?t:0;return{start:r?a:i,end:r?i:a}}function zm(e,t,n){if(n===!1)return!1;let r=Rm(e,n),i=Rm(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function Bm(e){let t,n,r,i;return Id(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function Vm(e,t){let n=[],r=e._getSortedDatasetMetas(t),i,a;for(i=0,a=r.length;i<a;++i)n.push(r[i].index);return n}function Hm(e,t,n,r={}){let i=e.keys,a=r.mode===`single`,o,s,c,l;if(t===null)return;let u=!1;for(o=0,s=i.length;o<s;++o){if(c=+i[o],c===n){if(u=!0,r.all)continue;break}l=e.values[c],Ld(l)&&(a||t===0||mf(t)===mf(l))&&(t+=l)}return!u&&!r.all?0:t}function Um(e,t){let{iScale:n,vScale:r}=t,i=n.axis===`x`?`x`:`y`,a=r.axis===`x`?`x`:`y`,o=Object.keys(e),s=Array(o.length),c,l,u;for(c=0,l=o.length;c<l;++c)u=o[c],s[c]={[i]:u,[a]:e[u]};return s}function Wm(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Gm(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Km(e){let{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:-1/0,max:i?n:1/0}}function qm(e,t,n){let r=e[t]||(e[t]={});return r[n]||(r[n]={})}function Jm(e,t,n,r){for(let i of t.getMatchingVisibleMetas(r).reverse()){let t=e[i.index];if(n&&t>0||!n&&t<0)return i.index}return null}function Ym(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=Gm(a,o,r),d=t.length,f;for(let e=0;e<d;++e){let n=t[e],{[c]:a,[l]:d}=n,p=n._stacks||={};f=p[l]=qm(i,u,a),f[s]=d,f._top=Jm(f,o,!0,r.type),f._bottom=Jm(f,o,!1,r.type);let m=f._visualValues||={};m[s]=d}}function Xm(e,t){let n=e.scales;return Object.keys(n).filter(e=>n[e].axis===t).shift()}function Zm(e,t){return Vp(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function Qm(e,t,n){return Vp(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function $m(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var eh=e=>e===`reset`||e===`none`,th=(e,t)=>t?e:Object.assign({},e),nh=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Vm(n,!0),values:null},rh=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Wm(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(e){this.index!==e&&$m(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=zd(n.xAxisID,Xm(e,`x`)),a=t.yAxisID=zd(n.yAxisID,Xm(e,`y`)),o=t.rAxisID=zd(n.rAxisID,Xm(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&Rf(this._data,this),e._stacked&&$m(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(Id(t)){let e=this._cachedMeta;this._data=Um(t,e)}else if(n!==t){if(n){Rf(n,this);let e=this._cachedMeta;$m(e),e._parsed=[]}t&&Object.isExtensible(t)&&Lf(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=Wm(t.vScale,t),t.stack!==n.stack&&(r=!0,$m(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(Ym(this,t._parsed),t._stacked=Wm(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=Fd(r[e])?this.parseArrayData(n,r,e,t):Id(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]<c[o];for(l=0;l<t;++l)n._parsed[l+e]=u=d[l],s&&(i()&&(s=!1),c=u);n._sorted=s}a&&Ym(this,d)}parsePrimitiveData(e,t,n,r){let{iScale:i,vScale:a}=e,o=i.axis,s=a.axis,c=i.getLabels(),l=i===a,u=Array(r),d,f,p;for(d=0,f=r;d<f;++d)p=d+n,u[d]={[o]:l||i.parse(c[p],p),[s]:a.parse(t[p],p)};return u}parseArrayData(e,t,n,r){let{xScale:i,yScale:a}=e,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={x:i.parse(u[0],l),y:a.parse(u[1],l)};return o}parseObjectData(e,t,n,r){let{xScale:i,yScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=Array(r),l,u,d,f;for(l=0,u=r;l<u;++l)d=l+n,f=t[d],c[l]={x:i.parse($d(f,o),d),y:a.parse($d(f,s),d)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){let r=this.chart,i=this._cachedMeta,a=t[e.axis];return Hm({keys:Vm(r,!0),values:t._stacks[e.axis]._visualValues},a,i.index,{mode:n})}updateRangeFromParsed(e,t,n,r){let i=n[t.axis],a=i===null?NaN:i,o=r&&n._stacks[t.axis];r&&o&&(r.values=o,a=Hm(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,t){let n=this._cachedMeta,r=n._parsed,i=n._sorted&&e===n.iScale,a=r.length,o=this._getOtherScale(e),s=nh(t,n,this.chart),c={min:1/0,max:-1/0},{min:l,max:u}=Km(o),d,f;function p(){f=r[d];let t=f[o.axis];return!Ld(f[e.axis])||l>t||u<t}for(d=0;d<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,s),i));++d);if(i){for(d=a-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r<i;++r)a=t[r][e.axis],Ld(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){let t=this._cachedMeta,n=t.iScale,r=t.vScale,i=this.getParsed(e);return{label:n?``+n.getLabelForValue(i[n.axis]):``,value:r?``+r.getLabelForValue(i[r.axis]):``}}_update(e){let t=this._cachedMeta;this.update(e||`default`),t._clip=Bm(zd(this.options.clip,zm(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){let e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],i=t.chartArea,a=[],o=this._drawStart||0,s=this._drawCount||r.length-o,c=this.options.drawActiveElementsOnTop,l;for(n.dataset&&n.dataset.draw(e,i,o,s),l=o;l<o+s;++l){let t=r[l];t.hidden||(t.active&&c?a.push(t):t.draw(e,i))}for(l=0;l<a.length;++l)a[l].draw(e,i)}getStyle(e,t){let n=t?`active`:`default`;return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){let r=this.getDataset(),i;if(e>=0&&e<this._cachedMeta.data.length){let t=this._cachedMeta.data[e];i=t.$context||=Qm(this.getContext(),e,t),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||=Zm(this.chart.getContext(),this.index),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!t,i.mode=n,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t=`default`,n){let r=t===`active`,i=this._cachedDataOpts,a=e+`-`+t,o=i[a],s=this.enableOptionSharing&&tf(n);if(o)return th(o,s);let c=this.chart.config,l=c.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,`hover`,e,``]:[e,``],d=c.getOptionScopes(this.getDataset(),l),f=Object.keys(mp.elements[e]),p=c.resolveNamedOptions(d,f,()=>this.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze(th(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Fm(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||eh(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){eh(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!eh(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,t,n=!0){let r=this._cachedMeta,i=r.data,a=e+t,o,s=e=>{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;o<a;++o)i[o]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(i,e,t,`reset`)}updateElements(e,t,n,r){}_removeElements(e,t){let n=this._cachedMeta;if(this._parsing){let r=n._parsed.splice(e,t);n._stacked&&$m(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync([`_insertElements`,this.getDataset().data.length-e,e])}_onDataPop(){this._sync([`_removeElements`,this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync([`_removeElements`,0,1])}_onDataSplice(e,t){t&&this._sync([`_removeElements`,e,t]);let n=arguments.length-2;n&&this._sync([`_insertElements`,e,n])}_onDataUnshift(){this._sync([`_insertElements`,0,arguments.length])}};function ih(e,t){if(!e._cache.$bar){let n=e.getMatchingVisibleMetas(t),r=[];for(let t=0,i=n.length;t<i;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=zf(r.sort((e,t)=>e-t))}return e._cache.$bar}function ah(e){let t=e.iScale,n=ih(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(tf(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i<a;++i)o=t.getPixelForValue(n[i]),c();for(s=void 0,i=0,a=t.ticks.length;i<a;++i)o=t.getPixelForTick(i),c();return r}function oh(e,t,n,r){let i=n.barThickness,a,o;return Pd(i)?(a=t.min*n.categoryPercentage,o=n.barPercentage):(a=i*r,o=1),{chunk:a/r,ratio:o,start:t.pixels[e]-a/2}}function sh(e,t,n,r){let i=t.pixels,a=i[e],o=e>0?i[e-1]:null,s=e<i.length-1?i[e+1]:null,c=n.categoryPercentage;o===null&&(o=a-(s===null?t.end-t.start:s-a)),s===null&&(s=a+a-o);let l=a-(a-Math.min(o,s))/2*c;return{chunk:Math.abs(s-o)/2*c/r,ratio:n.barPercentage,start:l}}function ch(e,t,n,r){let i=n.parse(e[0],r),a=n.parse(e[1],r),o=Math.min(i,a),s=Math.max(i,a),c=o,l=s;Math.abs(o)>Math.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function lh(e,t,n,r){return Fd(e)?ch(e,t,n,r):t[n.axis]=n.parse(e,r),t}function uh(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l<u;++l)f=t[l],d={},d[i.axis]=s||i.parse(o[l],l),c.push(lh(f,d,a,l));return c}function dh(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function fh(e,t,n){return e===0?(t.isHorizontal()?1:-1)*(t.min>=n?1:-1):mf(e)}function ph(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.base<e.y,n=`bottom`,r=`top`),t?(i=`end`,a=`start`):(i=`start`,a=`end`),{start:n,end:r,reverse:t,top:i,bottom:a}}function mh(e,t,n,r){let i=t.borderSkipped,a={};if(!i){e.borderSkipped=a;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:s,reverse:c,top:l,bottom:u}=ph(e);i===`middle`&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=l:(n._bottom||0)===r?i=u:(a[hh(u,o,s,c)]=!0,i=l)),a[hh(i,o,s,c)]=!0,e.borderSkipped=a}function hh(e,t,n,r){return r?(e=gh(e,t,n),e=_h(e,n,t)):e=_h(e,t,n),e}function gh(e,t,n){return e===t?n:e===n?t:e}function _h(e,t,n){return e===`start`?t:e===`end`?n:e}function vh(e,{inflateAmount:t},n){e.inflateAmount=t===`auto`?n===1?.33:0:t}var yh=class extends rh{static id=`bar`;static defaults={datasetElementType:!1,dataElementType:`bar`,categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:`number`,properties:[`x`,`y`,`base`,`width`,`height`]}}};static overrides={scales:{_index_:{type:`category`,offset:!0,grid:{offset:!0}},_value_:{type:`linear`,beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return uh(e,t,n,r)}parseArrayData(e,t,n,r){return uh(e,t,n,r)}parseObjectData(e,t,n,r){let{iScale:i,vScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=i.axis===`x`?o:s,l=a.axis===`x`?o:s,u=[],d,f,p,m;for(d=n,f=n+r;d<f;++d)m=t[d],p={},p[i.axis]=i.parse($d(m,c),d),u.push(lh($d(m,l),p,a,d));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);let i=n._custom;i&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let{iScale:t,vScale:n}=this._cachedMeta,r=this.getParsed(e),i=r._custom,a=dh(i)?`[`+i.start+`, `+i.end+`]`:``+n.getLabelForValue(r[n.axis]);return{label:``+t.getLabelForValue(r[t.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){let t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{index:a,_cachedMeta:{vScale:o}}=this,s=o.getBasePixel(),c=o.isHorizontal(),l=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){let t=this.getParsed(f),n=i||Pd(t[o.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,l),m=(t._stacks||{})[o.axis],h={horizontal:c,base:n.base,enableBorderRadius:!m||dh(t._custom)||a===m._top||a===m._bottom,x:c?n.head:p.center,y:c?p.center:n.head,height:c?p.size:Math.abs(n.size),width:c?Math.abs(n.size):p.size};d&&(h.options=u||this.resolveDataElementOptions(f,e[f].active?`active`:r));let g=h.options||e[f].options;mh(h,g,m,a),vh(h,g,l.ratio),this.updateElement(e[f],f,h,r)}}_getStacks(e,t){let{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(Pd(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[zd(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i<a;++i)r.push(n.getPixelForValue(this.getParsed(i)[n.axis],i));let o=e.barThickness;return{min:o||ah(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:o?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){let{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:i,minBarLength:a}}=this,o=i||0,s=this.getParsed(e),c=s._custom,l=dh(c),u=s[t.axis],d=0,f=n?this.applyStack(t,s,n):u,p,m;f!==u&&(d=f-u,f=u),l&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&mf(u)!==mf(c.barEnd)&&(d=0),d+=u);let h=!Pd(i)&&!l?i:d,g=t.getPixelForValue(h);if(p=this.chart.getDataVisibility(e)?t.getPixelForValue(d+f):g,m=p-g,Math.abs(m)<a){m=fh(m,t,o)*a,u===o&&(g-=m/2);let e=t.getPixelForDecimal(0),i=t.getPixelForDecimal(1);g=Math.max(Math.min(g,Math.max(e,i)),Math.min(e,i)),p=g+m,n&&!l&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(p)-t.getValueForPixel(g))}if(g===t.getPixelForValue(o)){let e=mf(m)*t.getLineWidthForValue(o)/2;g+=e,m-=e}return{size:m,base:g,head:p,center:p+m/2}}_calculateBarIndexPixels(e,t){let n=t.scale,r=this.options,i=r.skipNull,a=zd(r.maxBarThickness,1/0),o,s,c=this._getAxisCount();if(t.grouped){let n=i?this._getStackCount(e):t.stackCount,l=r.barThickness===`flex`?sh(e,t,r,n*c):oh(e,t,r,n*c),u=this.chart.options.indexAxis===`x`?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(zd(u,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+d;o=l.start+l.chunk*f+l.chunk/2,s=Math.min(a,l.chunk*l.ratio)}else o=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(a,t.min*t.ratio);return{base:o-s/2,head:o+s/2,center:o,size:s}}draw(){let e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length,i=0;for(;i<r;++i)this.getParsed(i)[t.axis]!==null&&!n[i].hidden&&n[i].draw(this._ctx)}};function bh(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var xh={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return bh()}parse(){return bh()}format(){return bh()}add(){return bh()}diff(){return bh()}startOf(){return bh()}endOf(){return bh()}}};function Sh(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?Pf:Nf;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!Pd(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!Pd(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Ch(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e<n;++e){let{index:n,data:s}=a[e],{lo:c,hi:l}=Sh(a[e],t,o,i);for(let e=c;e<=l;++e){let t=s[e];t.skip||r(t,n,e)}}}function wh(e){let t=e.indexOf(`x`)!==-1,n=e.indexOf(`y`)!==-1;return function(e,r){let i=t?Math.abs(e.x-r.x):0,a=n?Math.abs(e.y-r.y):0;return Math.sqrt(i**2+a**2)}}function Th(e,t,n,r,i){let a=[];return!i&&!e.isPointInArea(t)||Ch(e,n,t,function(n,o,s){!i&&!Sp(n,e.chartArea,0)||n.inRange(t.x,t.y,r)&&a.push({element:n,datasetIndex:o,index:s})},!0),a}function Eh(e,t,n,r){let i=[];function a(e,n,a){let{startAngle:o,endAngle:s}=e.getProps([`startAngle`,`endAngle`],r),{angle:c}=Tf(e,{x:t.x,y:t.y});Of(c,o,s)&&i.push({element:e,datasetIndex:n,index:a})}return Ch(e,n,t,a),i}function Dh(e,t,n,r,i,a){let o=[],s=wh(n),c=1/0;function l(n,l,u){let d=n.inRange(t.x,t.y,i);if(r&&!d)return;let f=n.getCenterPoint(i);if(!(a||e.isPointInArea(f))&&!d)return;let p=s(t,f);p<c?(o=[{element:n,datasetIndex:l,index:u}],c=p):p===c&&o.push({element:n,datasetIndex:l,index:u})}return Ch(e,n,t,l),o}function Oh(e,t,n,r,i,a){return!a&&!e.isPointInArea(t)?[]:n===`r`&&!r?Eh(e,t,n,i):Dh(e,t,n,r,i,a)}function kh(e,t,n,r,i){let a=[],o=n===`x`?`inXRange`:`inYRange`,s=!1;return Ch(e,n,t,(e,r,c)=>{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Ah={evaluateInteractionItems:Ch,modes:{index(e,t,n,r){let i=gm(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?Th(e,i,a,r,o):Oh(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=gm(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?Th(e,i,a,r,o):Oh(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point(e,t,n,r){return Th(e,gm(t,e),n.axis||`xy`,r,n.includeInvisible||!1)},nearest(e,t,n,r){let i=gm(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1;return Oh(e,i,a,n.intersect,r,o)},x(e,t,n,r){return kh(e,gm(t,e),`x`,n.intersect,r)},y(e,t,n,r){return kh(e,gm(t,e),`y`,n.intersect,r)}}},jh=[`left`,`top`,`right`,`bottom`];function Mh(e,t){return e.filter(e=>e.pos===t)}function Nh(e,t){return e.filter(e=>jh.indexOf(e.pos)===-1&&e.box.axis===t)}function Ph(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function Fh(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:a,options:{stack:o,stackWeight:s=1}}=i,t.push({index:n,box:i,pos:a,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&a+o,stackWeight:s});return t}function Ih(e){let t={};for(let n of e){let{stack:e,pos:r,stackWeight:i}=n;if(!e||!jh.includes(r))continue;let a=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function Lh(e,t){let n=Ih(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t,a,o,s;for(a=0,o=e.length;a<o;++a){s=e[a];let{fullSize:o}=s.box,c=n[s.stack],l=c&&s.stackWeight/c.weight;s.horizontal?(s.width=l?l*r:o&&t.availableWidth,s.height=i):(s.width=r,s.height=l?l*i:o&&t.availableHeight)}return n}function Rh(e){let t=Fh(e),n=Ph(t.filter(e=>e.box.fullSize),!0),r=Ph(Mh(t,`left`),!0),i=Ph(Mh(t,`right`)),a=Ph(Mh(t,`top`),!0),o=Ph(Mh(t,`bottom`)),s=Nh(t,`x`),c=Nh(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Mh(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function zh(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Bh(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Vh(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!Id(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&Bh(o,a.getPadding());let s=Math.max(0,t.outerWidth-zh(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-zh(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function Hh(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function Uh(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function Wh(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a<o;++a){s=e[a],c=s.box,c.update(s.width||t.w,s.height||t.h,Uh(s.horizontal,t));let{same:o,other:d}=Vh(t,n,s,r);l|=o&&i.length,u||=d,c.fullSize||i.push(s)}return l&&Wh(i,t,n,r)||u}function Gh(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function Kh(e,t,n,r){let i=n.padding,{x:a,y:o}=t;for(let s of e){let e=s.box,c=r[s.stack]||{count:1,placed:0,weight:1},l=s.stackWeight/c.weight||1;if(s.horizontal){let r=t.w*l,a=c.size||e.height;tf(c.start)&&(o=c.start),e.fullSize?Gh(e,i.left,o,n.outerWidth-i.right-i.left,a):Gh(e,t.left+c.placed,o,r,a),c.start=o,c.placed+=r,o=e.bottom}else{let r=t.h*l,o=c.size||e.width;tf(c.start)&&(a=c.start),e.fullSize?Gh(e,a,i.top,o,n.outerHeight-i.bottom-i.top):Gh(e,a,t.top+c.placed,o,r),c.start=a,c.placed+=r,a=e.right}}t.x=a,t.y=o}var qh={addBox(e,t){e.boxes||=[],t.fullSize=t.fullSize||!1,t.position=t.position||`top`,t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;let i=Lp(e.options.layout.padding),a=Math.max(t-i.width,0),o=Math.max(n-i.height,0),s=Rh(e.boxes),c=s.vertical,l=s.horizontal;Hd(e.boxes,e=>{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);Bh(f,Lp(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Lh(c.concat(l),d);Wh(s.fullSize,p,d,m),Wh(c,p,d,m),Wh(l,p,d,m)&&Wh(c,p,d,m),Hh(p),Kh(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Kh(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Hd(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},Jh=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},Yh=class extends Jh{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},Xh=`$chartjs`,Zh={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},Qh=e=>e===null||e===``;function $h(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[Xh]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,Qh(i)){let t=Sm(e,`width`);t!==void 0&&(e.width=t)}if(Qh(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=Sm(e,`height`);t!==void 0&&(e.height=t)}return e}var eg=xm?{passive:!0}:!1;function tg(e,t,n){e&&e.addEventListener(t,n,eg)}function ng(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,eg)}function rg(e,t){let n=Zh[e.type]||e.type,{x:r,y:i}=gm(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function ig(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function ag(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ig(n.addedNodes,r),t&&=!ig(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function og(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ig(n.removedNodes,r),t&&=!ig(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var sg=new Map,cg=0;function lg(){let e=window.devicePixelRatio;e!==cg&&(cg=e,sg.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function ug(e,t){sg.size||window.addEventListener(`resize`,lg),sg.set(e,t)}function dg(e){sg.delete(e),sg.size||window.removeEventListener(`resize`,lg)}function fg(e,t,n){let r=e.canvas,i=r&&cm(r);if(!i)return;let a=Vf((e,t)=>{let r=i.clientWidth;n(e,t),r<i.clientWidth&&n()},window),o=new ResizeObserver(e=>{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),ug(e,a),o}function pg(e,t,n){n&&n.disconnect(),t===`resize`&&dg(e)}function mg(e,t,n){let r=e.canvas,i=Vf(t=>{e.ctx!==null&&n(rg(t,e))},e);return tg(r,t,i),i}var hg=class extends Jh{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?($h(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[Xh])return!1;let n=t[Xh].initial;[`height`,`width`].forEach(e=>{let r=n[e];Pd(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[Xh],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:ag,detach:og,resize:fg}[t]||mg)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:pg,detach:pg,resize:pg}[t]||ng)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return ym(e,t,n,r)}isAttached(e){let t=e&&cm(e);return!!(t&&t.isConnected)}};function gg(e){return!sm()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?Yh:hg}var _g=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return yf(this.x)&&yf(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function vg(e,t){let n=e.options.ticks,r=yg(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?xg(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Sg(t,l,a,o/i),l;let u=bg(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Cg(t,l,u,Pd(r)?0:s-r,s),e=0,n=o-1;e<n;e++)Cg(t,l,u,a[e],a[e+1]);return Cg(t,l,u,c,Pd(r)?t.length:c+r),l}return Cg(t,l,u),l}function yg(e){let t=e.options.offset,n=e._tickSize(),r=e._length/n+ +!t,i=e._maxLength/n;return Math.floor(Math.min(r,i))}function bg(e,t,n){let r=wg(e),i=t.length/n;if(!r)return Math.max(i,1);let a=_f(r);for(let e=0,t=a.length-1;e<t;e++){let t=a[e];if(t>i)return t}return Math.max(i,1)}function xg(e){let t=[],n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function Sg(e,t,n,r){let i=0,a=n[0],o;for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}function Cg(e,t,n,r,i){let a=zd(r,0),o=Math.min(zd(i,e.length),e.length),s=0,c,l,u;for(n=Math.ceil(n),i&&(c=i-r,n=c/Math.floor(c/n)),u=a;u<0;)s++,u=Math.round(a+s*n);for(l=Math.max(a,0);l<o;l++)l===u&&(t.push(e[l]),s++,u=Math.round(a+s*n))}function wg(e){let t=e.length,n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}var Tg=e=>e===`left`?`right`:e===`right`?`left`:e,Eg=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Dg=(e,t)=>Math.min(t||e,e);function Og(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;a<i;a+=r)n.push(e[Math.floor(a)]);return n}function kg(e,t,n){let r=e.ticks.length,i=Math.min(t,r-1),a=e._startPixel,o=e._endPixel,s=1e-6,c=e.getPixelForTick(i),l;if(!(n&&(l=r===1?Math.max(c-a,o-c):t===0?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(i-1))/2,c+=i<t?l:-l,c<a-s||c>o+s)))return c}function Ag(e,t){Hd(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;i<r;++i)delete e.data[n[i]];n.splice(0,r)}})}function jg(e){return e.drawTicks?e.tickLength:0}function Mg(e,t){if(!e.display)return 0;let n=Rp(e.font,t),r=Lp(e.padding);return(Fd(e.text)?e.text.length:1)*n.lineHeight+r.height}function Ng(e,t){return Vp(e,{scale:t,type:`scale`})}function Pg(e,t,n){return Vp(e,{tick:n,index:t,type:`tick`})}function Fg(e,t,n){let r=Uf(e);return(n&&t!==`right`||!n&&t===`right`)&&(r=Tg(r)),r}function Ig(e,t,n,r){let{top:i,left:a,bottom:o,right:s,chart:c}=e,{chartArea:l,scales:u}=c,d=0,f,p,m,h=o-i,g=s-a;if(e.isHorizontal()){if(p=Wf(r,a,s),Id(n)){let e=Object.keys(n)[0],r=n[e];m=u[e].getPixelForValue(r)+h-t}else m=n===`center`?(l.bottom+l.top)/2+h-t:Eg(e,n,t);f=s-a}else{if(Id(n)){let e=Object.keys(n)[0],r=n[e];p=u[e].getPixelForValue(r)-g+t}else p=n===`center`?(l.left+l.right)/2-g+t:Eg(e,n,t);m=Wf(r,o,i),d=n===`left`?-uf:uf}return{titleX:p,titleY:m,maxWidth:f,rotation:d}}var Lg=class e extends _g{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=Rd(e,1/0),t=Rd(t,-1/0),n=Rd(n,1/0),r=Rd(r,-1/0),{min:Rd(e,n),max:Rd(t,r),minDefined:Ld(e),maxDefined:Ld(t)}}getMinMax(e){let{min:t,max:n,minDefined:r,maxDefined:i}=this.getUserBounds(),a;if(r&&i)return{min:t,max:n};let o=this.getMatchingVisibleMetas();for(let s=0,c=o.length;s<c;++s)a=o[s].controller.getMinMax(this,e),r||(t=Math.min(t,a.min)),i||(n=Math.max(n,a.max));return t=i&&t>n?n:t,n=r&&t>n?t:n,{min:Rd(t,Rd(n,t)),max:Rd(n,Rd(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Vd(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||=(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Bp(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o<this.ticks.length;this._convertTicksToLabels(s?Og(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source===`auto`)&&(this.ticks=vg(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Vd(this.options.afterUpdate,[this])}beforeSetDimensions(){Vd(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Vd(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),Vd(this.options[e],[this])}beforeDataLimits(){this._callHooks(`beforeDataLimits`)}determineDataLimits(){}afterDataLimits(){this._callHooks(`afterDataLimits`)}beforeBuildTicks(){this._callHooks(`beforeBuildTicks`)}buildTicks(){return[]}afterBuildTicks(){this._callHooks(`afterBuildTicks`)}beforeTickToLabelConversion(){Vd(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t=this.options.ticks,n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],i.label=Vd(t.callback,[i.value,n,e],this)}afterTickToLabelConversion(){Vd(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Vd(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=Dg(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,i=t.maxRotation,a=r,o,s,c;if(!this._isVisible()||!t.display||r>=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=kf(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-jg(e.grid)-t.padding-Mg(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=Cf(Math.min(Math.asin(kf((l.highest.height+6)/o,-1,1)),Math.asin(kf(s/c,-1,1))-Math.asin(kf(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){Vd(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Vd(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=Mg(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=jg(i)+a):(e.height=this.maxHeight,e.width=jg(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=Sf(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Vd(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)Pd(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=Og(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:r,_longestTextCache:i}=this,a=[],o=[],s=Math.floor(t/Dg(t,n)),c=0,l=0,u,d,f,p,m,h,g,_,v,y,b;for(u=0;u<t;u+=s){if(p=e[u].label,m=this._resolveTickFontOptions(u),r.font=h=m.string,g=i[h]=i[h]||{data:{},gc:[]},_=m.lineHeight,v=y=0,!Pd(p)&&!Fd(p))v=gp(r,g.data,g.gc,v,p),y=_;else if(Fd(p))for(d=0,f=p.length;d<f;++d)b=p[d],!Pd(b)&&!Fd(b)&&(v=gp(r,g.data,g.gc,v,b),y+=_);a.push(v),o.push(y),c=Math.max(v,c),l=Math.max(y,l)}Ag(i,t);let x=a.indexOf(c),S=o.indexOf(l),C=e=>({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return Af(this._alignToPixels?vp(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||=Pg(this.getContext(),e,n)}return this.$context||=Ng(this.chart.getContext(),this)}_tickSize(){let e=this.options.ticks,t=Sf(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),i=this._getLabelSizes(),a=e.autoSkipPadding||0,o=i?i.widest.width+a:0,s=i?i.highest.height+a:0;return this.isHorizontal()?s*n>o*r?o/n:s/r:s*r<o*n?s/n:o/r}_isVisible(){let e=this.options.display;return e===`auto`?this.getMatchingVisibleMetas().length>0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+ +!!s,u=jg(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return vp(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(Id(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(Id(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=zd(r.ticks.maxTicksLimit,l),te=Math.max(1,Math.ceil(l/ee));for(_=0;_<l;_+=te){let e=this.getContext(_),t=i.setContext(e),r=o.setContext(e),a=t.lineWidth,l=t.color,u=r.dash||[],f=r.dashOffset,p=t.tickWidth,m=t.tickColor,h=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=kg(this,_,s),v!==void 0&&(y=vp(n,v,a),c?b=S=w=E=y:x=C=T=D=y,d.push({tx1:b,ty1:x,tx2:S,ty2:C,x1:w,y1:T,x2:E,y2:D,width:a,color:l,borderDash:u,borderDashOffset:f,tickWidth:p,tickColor:m,tickBorderDash:h,tickBorderDashOffset:g}))}return this._ticksLength=l,this._borderValue=g,d}_computeLabelItems(e){let t=this.axis,n=this.options,{position:r,ticks:i}=n,a=this.isHorizontal(),o=this.ticks,{align:s,crossAlign:c,padding:l,mirror:u}=i,d=jg(n.grid),f=d+l,p=u?-l:f,m=-Sf(this.labelRotation),h=[],g,_,v,y,b,x,S,C,w,T,E,D,ee=`middle`;if(r===`top`)x=this.bottom-p,S=this._getXAxisLabelAlignment();else if(r===`bottom`)x=this.top+p,S=this._getXAxisLabelAlignment();else if(r===`left`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(r===`right`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(t===`x`){if(r===`center`)x=(e.top+e.bottom)/2+f;else if(Id(r)){let e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)+f}S=this._getXAxisLabelAlignment()}else if(t===`y`){if(r===`center`)b=(e.left+e.right)/2-f;else if(Id(r)){let e=Object.keys(r)[0],t=r[e];b=this.chart.scales[e].getPixelForValue(t)}S=this._getYAxisLabelAlignment(d).textAlign}t===`y`&&(s===`start`?ee=`top`:s===`end`&&(ee=`bottom`));let te=this._getLabelSizes();for(g=0,_=o.length;g<_;++g){v=o[g],y=v.label;let e=i.setContext(this.getContext(g));C=this.getPixelForTick(g)+i.labelOffset,w=this._resolveTickFontOptions(g),T=w.lineHeight,E=Fd(y)?y.length:1;let t=E/2,n=e.color,s=e.textStrokeColor,l=e.textStrokeWidth,d=S;a?(b=C,S===`inner`&&(d=g===_-1?this.options.reverse?`left`:`right`:g===0?this.options.reverse?`right`:`left`:`center`),D=r===`top`?c===`near`||m!==0?-E*T+T/2:c===`center`?-te.highest.height/2-t*T+T:-te.highest.height+T/2:c===`near`||m!==0?T/2:c===`center`?te.highest.height/2-t*T:te.highest.height-E*T,u&&(D*=-1),m!==0&&!e.showLabelBackdrop&&(b+=T/2*Math.sin(m))):(x=C,D=(1-E)*T/2);let f;if(e.showLabelBackdrop){let t=Lp(e.backdropPadding),n=te.heights[g],r=te.widths[g],i=D-t.top,a=0-t.left;switch(ee){case`middle`:i-=n/2;break;case`bottom`:i-=n;break}switch(S){case`center`:a-=r/2;break;case`right`:a-=r;break;case`inner`:g===_-1?a-=r:g>0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-Sf(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i<a;++i){let e=r[i];t.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:t,options:{border:n,grid:r}}=this,i=n.setContext(this.getContext()),a=n.display?i.width:0;if(!a)return;let o=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue,c,l,u,d;this.isHorizontal()?(c=vp(e,this.left,a)-a/2,l=vp(e,this.right,o)+o/2,u=d=s):(u=vp(e,this.top,a)-a/2,d=vp(e,this.bottom,o)+o/2,c=l=s),t.save(),t.lineWidth=i.width,t.strokeStyle=i.color,t.beginPath(),t.moveTo(c,u),t.lineTo(l,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let t=this.ctx,n=this._computeLabelArea();n&&Cp(t,n);let r=this.getLabelItems(e);for(let e of r){let n=e.options,r=e.font,i=e.label,a=e.textOffset;Op(t,i,0,a,r,n)}n&&wp(t)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;let i=Rp(n.font),a=Lp(n.padding),o=n.align,s=i.lineHeight/2;t===`bottom`||t===`center`||Id(t)?(s+=a.bottom,Fd(n.text)&&(s+=i.lineHeight*(n.text.length-1))):s+=a.top;let{titleX:c,titleY:l,maxWidth:u,rotation:d}=Ig(this,s,t,o);Op(e,n.text,0,0,i,{color:n.color,maxWidth:u,rotation:d,textAlign:Fg(o,t,r),textBaseline:`middle`,translation:[c,l]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,r=zd(t.grid&&t.grid.z,-1),i=zd(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:e=>{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i<a;++i){let a=t[i];a[n]===this.id&&(!e||a.type===e)&&r.push(a)}return r}_resolveTickFontOptions(e){return Rp(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},Rg=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;Vg(t)&&(n=this.register(t));let r=this.items,i=e.id,a=this.scope+`.`+i;if(!i)throw Error(`class does not have id: `+e);return i in r?a:(r[i]=e,zg(e,a,n),this.override&&mp.override(e.id,e.overrides),a)}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in mp[r]&&(delete mp[r][n],this.override&&delete up[n])}};function zg(e,t,n){let r=qd(Object.create(null),[n?mp.get(n):{},mp.get(t),e.defaults]);mp.set(t,r),e.defaultRoutes&&Bg(t,e.defaultRoutes),e.descriptors&&mp.describe(t,e.descriptors)}function Bg(e,t){Object.keys(t).forEach(n=>{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);mp.route(a,i,c,s)})}function Vg(e){return`id`in e&&`defaults`in e}var Hg=new class{constructor(){this.controllers=new Rg(rh,`datasets`,!0),this.elements=new Rg(_g,`elements`),this.plugins=new Rg(Object,`plugins`),this.scales=new Rg(Lg,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):Hd(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=ef(e);Vd(n[`before`+r],[],n),t[e](n),Vd(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let r=t.get(e);if(r===void 0)throw Error(`"`+e+`" is not a registered `+n+`.`);return r}},Ug=class{constructor(){this._init=void 0}notify(e,t,n,r){if(t===`beforeInit`&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,`install`)),this._init===void 0)return;let i=r?this._descriptors(e).filter(r):this._descriptors(e),a=this._notify(i,e,t,n);return t===`afterDestroy`&&(this._notify(i,e,`stop`),this._notify(this._init,e,`uninstall`),this._init=void 0),a}_notify(e,t,n,r){r||={};for(let i of e){let e=i.plugin,a=e[n];if(Vd(a,[t,r,i.options],e)===!1&&r.cancelable)return!1}return!0}invalidate(){Pd(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,r=zd(n.options&&n.options.plugins,{}),i=Wg(n);return r===!1&&!t?[]:Kg(e,i,r,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function Wg(e){let t={},n=[],r=Object.keys(Hg.plugins.items);for(let e=0;e<r.length;e++)n.push(Hg.getPlugin(r[e]));let i=e.plugins||[];for(let e=0;e<i.length;e++){let r=i[e];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function Gg(e,t){return!t&&e===!1?null:e===!0?{}:e}function Kg(e,{plugins:t,localIds:n},r,i){let a=[],o=e.getContext();for(let s of t){let t=s.id,c=Gg(r[t],i);c!==null&&a.push({plugin:s,options:qg(e.config,{plugin:s,local:n[t]},c,o)})}return a}function qg(e,{plugin:t,local:n},r,i){let a=e.pluginScopeKeys(t),o=e.getOptionScopes(r,a);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,i,[``],{scriptable:!1,indexable:!1,allKeys:!0})}function Jg(e,t){let n=mp.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||`x`}function Yg(e,t){let n=e;return e===`_index_`?n=t:e===`_value_`&&(n=t===`x`?`y`:`x`),n}function Xg(e,t){return e===t?`_index_`:`_value_`}function Zg(e){if(e===`x`||e===`y`||e===`r`)return e}function Qg(e){if(e===`top`||e===`bottom`)return`x`;if(e===`left`||e===`right`)return`y`}function $g(e,...t){if(Zg(e))return e;for(let n of t){let t=n.axis||Qg(n.position)||e.length>1&&Zg(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function e_(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function t_(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return e_(e,`x`,n[0])||e_(e,`y`,n[0])}return{}}function n_(e,t){let n=up[e.type]||{scales:{}},r=t.scales||{},i=Jg(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!Id(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=$g(t,o,t_(t,e),mp.scales[o.type]),c=Xg(s,i),l=n.scales||{};a[t]=Jd(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||Jg(i,t),s=(up[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=Yg(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Jd(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Jd(t,[mp.scales[t.type],mp.scale])}),a}function r_(e){let t=e.options||={};t.plugins=zd(t.plugins,{}),t.scales=n_(e,t)}function i_(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function a_(e){return e||={},e.data=i_(e.data),r_(e),e}var o_=new Map,s_=new Set;function c_(e,t){let n=o_.get(e);return n||(n=t(),o_.set(e,n),s_.add(n)),n}var l_=(e,t,n)=>{let r=$d(t,n);r!==void 0&&e.add(r)},u_=class{constructor(e){this._config=a_(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=i_(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),r_(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return c_(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return c_(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return c_(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return c_(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>l_(s,e,t))),t.forEach(e=>l_(s,r,e)),t.forEach(e=>l_(s,up[i]||{},e)),t.forEach(e=>l_(s,mp,e)),t.forEach(e=>l_(s,dp,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),s_.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,up[t]||{},mp.datasets[t]||{},{type:t},mp,dp]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=d_(this._resolverCache,e,r),s=a;if(p_(a,t)){i.$shared=!1,n=nf(n)?n():n;let t=this.createResolver(e,n,o);s=Up(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=d_(this._resolverCache,e,n);return Id(t)?Up(i,t,void 0,r):i}};function d_(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:Hp(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var f_=e=>Id(e)&&Object.getOwnPropertyNames(e).some(t=>nf(e[t]));function p_(e,t){let{isScriptable:n,isIndexable:r}=Wp(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(nf(o)||f_(o))||a&&Fd(o))return!0}return!1}var m_=`4.5.1`,h_=[`top`,`bottom`,`left`,`right`,`chartArea`];function g_(e,t){return e===`top`||e===`bottom`||h_.indexOf(e)===-1&&t===`x`}function __(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function v_(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),Vd(n&&n.onComplete,[e],t)}function y_(e){let t=e.chart,n=t.options.animation;Vd(n&&n.onProgress,[e],t)}function b_(e){return sm()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var x_={},S_=e=>{let t=b_(e);return Object.values(x_).filter(e=>e.canvas===t).pop()};function C_(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function w_(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var T_=class{static defaults=mp;static instances=x_;static overrides=up;static registry=Hg;static version=m_;static getChart=S_;static register(...e){Hg.add(...e),E_()}static unregister(...e){Hg.remove(...e),E_()}constructor(e,t){let n=this.config=new u_(t),r=b_(e),i=S_(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(gg(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=Nd(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ug,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Hf(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],x_[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}jm.listen(this,`complete`,v_),jm.listen(this,`progress`,y_),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return Pd(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Hg}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():bm(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return yp(this.canvas,this.ctx),this}stop(){return jm.stop(this),this}resize(e,t){jm.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,bm(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),Vd(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){Hd(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=$g(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),Hd(i,t=>{let i=t.options,a=i.id,o=$g(a,i),s=zd(i.type,t.dtype);(i.position===void 0||g_(i.position,o)!==g_(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(Hg.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),Hd(r,(e,t)=>{e||delete n[t]}),Hd(n,e=>{qh.configure(this,e,e.options),qh.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(__(`order`,`index`))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){let r=t[n],i=this.getDatasetMeta(n),a=r.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(n),i=this.getDatasetMeta(n)),i.type=a,i.indexAxis=r.indexAxis||Jg(a,this.options),i.order=r.order||0,i.index=n,i.label=``+r.label,i.visible=this.isDatasetVisible(n),i.controller)i.controller.updateIndex(n),i.controller.linkScales();else{let t=Hg.getController(a),{datasetElementType:r,dataElementType:o}=mp.datasets[a];Object.assign(t,{dataElementType:Hg.getElement(o),datasetElementType:r&&Hg.getElement(r)}),i.controller=new t(this,n),e.push(i.controller)}}return this._updateMetasets(),e}_resetElements(){Hd(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e<t;e++){let{controller:t}=this.getDatasetMeta(e),n=!r&&i.indexOf(t)===-1;t.buildOrUpdateElements(n),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),r||Hd(i,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(__(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Hd(this.scales,e=>{qh.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!rf(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)C_(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;e<t;e++)if(!rf(r,n(e)))return;return Array.from(r).map(e=>e.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;qh.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],Hd(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,nf(e)?e({datasetIndex:t}):e);this.notifyPlugins(`afterDatasetsUpdate`,{mode:e})}}_updateDataset(e,t){let n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};this.notifyPlugins(`beforeDatasetUpdate`,r)!==!1&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins(`afterDatasetUpdate`,r))}render(){this.notifyPlugins(`beforeRender`,{cancelable:!0})!==!1&&(jm.has(this)?this.attached&&!jm.running(this)&&jm.start(this):(this.draw(),v_({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins(`beforeDraw`,{cancelable:!0})===!1)return;let t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins(`afterDraw`)}_getSortedDatasetMetas(e){let t=this._sortedMetasets,n=[],r,i;for(r=0,i=t.length;r<i;++r){let i=t[r];(!e||i.visible)&&n.push(i)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins(`beforeDatasetsDraw`,{cancelable:!0})===!1)return;let e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=Am(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&Cp(t,r),e.controller.draw(),r&&wp(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return Sp(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Ah.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=Vp(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);tf(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),jm.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins(`beforeDestroy`);let{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),yp(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete x_[this.id],this.notifyPlugins(`afterDestroy`)}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};Hd(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){Hd(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},Hd(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o<s;++o){a=e[o];let t=a&&this.getDatasetMeta(a.datasetIndex).controller;t&&t[r+`HoverStyle`](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let t=this._active||[],n=e.map(({datasetIndex:e,index:t})=>{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});Ud(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=af(e),c=w_(e,this._lastEvent,n,s);n&&(this._lastEvent=null,Vd(i.onHover,[e,o,this],this),s&&Vd(i.onClick,[e,o,this],this));let l=!Ud(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function E_(){return Hd(T_.instances,e=>e._plugins.invalidate())}function D_(e,t){let{x:n,y:r,base:i,width:a,height:o}=e.getProps([`x`,`y`,`base`,`width`,`height`],t),s,c,l,u,d;return e.horizontal?(d=o/2,s=Math.min(n,i),c=Math.max(n,i),l=r-d,u=r+d):(d=a/2,s=n-d,c=n+d,l=Math.min(r,i),u=Math.max(r,i)),{left:s,top:l,right:c,bottom:u}}function O_(e,t,n,r){return e?0:kf(t,n,r)}function k_(e,t,n){let r=e.options.borderWidth,i=e.borderSkipped,a=Fp(r);return{t:O_(i.top,a.top,0,n),r:O_(i.right,a.right,0,t),b:O_(i.bottom,a.bottom,0,n),l:O_(i.left,a.left,0,t)}}function A_(e,t,n){let{enableBorderRadius:r}=e.getProps([`enableBorderRadius`]),i=e.options.borderRadius,a=Ip(i),o=Math.min(t,n),s=e.borderSkipped,c=r||Id(i);return{topLeft:O_(!c||s.top||s.left,a.topLeft,0,o),topRight:O_(!c||s.top||s.right,a.topRight,0,o),bottomLeft:O_(!c||s.bottom||s.left,a.bottomLeft,0,o),bottomRight:O_(!c||s.bottom||s.right,a.bottomRight,0,o)}}function j_(e){let t=D_(e),n=t.right-t.left,r=t.bottom-t.top,i=k_(e,n/2,r/2),a=A_(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:a},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,a.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(i.b,i.r))}}}}function M_(e,t,n,r){let i=t===null,a=n===null,o=e&&!(i&&a)&&D_(e,r);return o&&(i||jf(t,o.left,o.right))&&(a||jf(n,o.top,o.bottom))}function N_(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function P_(e,t){e.rect(t.x,t.y,t.w,t.h)}function F_(e,t,n={}){let r=e.x===n.x?0:-t,i=e.y===n.y?0:-t,a=(e.x+e.w===n.x+n.w?0:t)-r,o=(e.y+e.h===n.y+n.h?0:t)-i;return{x:e.x+r,y:e.y+i,w:e.w+a,h:e.h+o,radius:e.radius}}var I_=class extends _g{static id=`bar`;static defaults={borderSkipped:`start`,borderWidth:0,borderRadius:0,inflateAmount:`auto`,pointStyle:void 0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:i,outer:a}=j_(this),o=N_(a.radius)?kp:P_;e.save(),(a.w!==i.w||a.h!==i.h)&&(e.beginPath(),o(e,F_(a,t,i)),e.clip(),o(e,F_(i,-t,a)),e.fillStyle=n,e.fill(`evenodd`)),e.beginPath(),o(e,F_(i,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return M_(this,e,t,n)}inXRange(e,t){return M_(this,e,null,t)}inYRange(e,t){return M_(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:r,horizontal:i}=this.getProps([`x`,`y`,`base`,`horizontal`],e);return{x:i?(t+r)/2:t,y:i?n:(n+r)/2}}getRange(e){return e===`x`?this.width/2:this.height/2}},L_=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},R_=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,z_=class extends _g{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=Vd(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=Rp(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=L_(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=B_(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=Tm(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=Wf(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=Wf(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=Wf(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=Wf(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;Cp(e,this),this._draw(),wp(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=mp.color,s=Tm(e.rtl,this.left,this.width),c=Rp(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=L_(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=zd(n.lineWidth,1);if(r.fillStyle=zd(n.fillStyle,o),r.lineCap=zd(n.lineCap,`butt`),r.lineDashOffset=zd(n.lineDashOffset,0),r.lineJoin=zd(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=zd(n.strokeStyle,o),r.setLineDash(zd(n.lineDash,[])),a.usePointStyle)xp(r,{radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},s.xPlus(e,p/2),t+d,a.pointStyleWidth&&p);else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=Ip(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?kp(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){Op(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:Wf(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:Wf(i,this.top+y+l,this.bottom-t[0].height),line:0},Em(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||=a.textAlign),x=p+d+m,S=f.x,C=f.y;if(s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=Wf(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=Wf(i,this.top+y+l,this.bottom-t[f.line].height)),g(s.x(S),C,o),S=Gf(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=U_(o,e)+l}else f.y+=b}),Dm(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=Rp(t.font),r=Lp(t.padding);if(!t.display)return;let i=Tm(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=Wf(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+Wf(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=Wf(o,u,u+d);a.textAlign=i.textAlign(Uf(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,Op(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=Rp(e.font),n=Lp(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(jf(e,this.left,this.right)&&jf(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;n<i.length;++n)if(r=i[n],jf(e,r.left,r.left+r.width)&&jf(t,r.top,r.top+r.height))return this.legendItems[n]}return null}handleEvent(e){let t=this.options;if(!W_(e.type,t))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type===`mousemove`||e.type===`mouseout`){let r=this._hoveredItem,i=R_(r,n);r&&!i&&Vd(t.onLeave,[e,r,this],this),this._hoveredItem=n,n&&!i&&Vd(t.onHover,[e,n,this],this)}else n&&Vd(t.onClick,[e,n,this],this)}};function B_(e,t,n,r,i){return{itemWidth:V_(r,e,t,n),itemHeight:H_(i,r,t.lineHeight)}}function V_(e,t,n,r){let i=e.text;return i&&typeof i!=`string`&&(i=i.reduce((e,t)=>e.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function H_(e,t,n){let r=e;return typeof t.text!=`string`&&(r=U_(t,n)),r}function U_(e,t){return t*(e.text?e.text.length:0)}function W_(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var G_={id:`legend`,_element:z_,start(e,t,n){let r=e.legend=new z_({ctx:e.ctx,options:n,chart:e});qh.configure(e,r,n),qh.addBox(e,r)},stop(e){qh.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;qh.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=Lp(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},K_={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;t<n;++t){let n=e[t].element;if(n&&n.hasValue()){let e=n.tooltipPosition();r.add(e.x),i+=e.y,++a}}return a===0||r.size===0?!1:{x:[...r].reduce((e,t)=>e+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a<o;++a){let n=e[a].element;if(n&&n.hasValue()){let e=Ef(t,n.getCenterPoint());e<i&&(i=e,s=n)}}if(s){let e=s.tooltipPosition();n=e.x,r=e.y}return{x:n,y:r}}};function q_(e,t){return t&&(Fd(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function J_(e){return(typeof e==`string`||e instanceof String)&&e.indexOf(`
|
|
68
|
+
`)>-1?e.split(`
|
|
69
|
+
`):e}function Y_(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function X_(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=Rp(t.bodyFont),l=Rp(t.titleFont),u=Rp(t.footerFont),d=a.length,f=i.length,p=r.length,m=Lp(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,Hd(e.title,y),n.font=c.string,Hd(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,Hd(r,e=>{Hd(e.before,y),Hd(e.lines,y),Hd(e.after,y)}),v=0,n.font=u.string,Hd(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Z_(e,t){let{y:n,height:r}=t;return n<r/2?`top`:n>e.height-r/2?`bottom`:`center`}function Q_(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function $_(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),Q_(l,e,t,n)&&(l=`center`),l}function ev(e,t,n){let r=n.yAlign||t.yAlign||Z_(e,n);return{xAlign:n.xAlign||t.xAlign||$_(e,t,n,r),yAlign:r}}function tv(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function nv(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function rv(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ip(o),m=tv(t,s),h=nv(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:kf(m,0,r.width-t.width),y:kf(h,0,r.height-t.height)}}function iv(e,t,n){let r=Lp(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function av(e){return q_([],J_(e))}function ov(e,t,n){return Vp(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function sv(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var cv={beforeTitle:Md,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return``},afterTitle:Md,beforeBody:Md,beforeLabel:Md,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let t=e.dataset.label||``;t&&(t+=`: `);let n=e.formattedValue;return Pd(n)||(t+=n),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Md,afterBody:Md,beforeFooter:Md,footer:Md,afterFooter:Md};function lv(e,t,n,r){let i=e[t].call(n,r);return i===void 0?cv[t].call(n,r):i}var uv=class extends _g{static positioners=K_;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,i=new Fm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||=ov(this.chart.getContext(),this,this._tooltipItems)}getTitle(e,t){let{callbacks:n}=t,r=lv(n,`beforeTitle`,this,e),i=lv(n,`title`,this,e),a=lv(n,`afterTitle`,this,e),o=[];return o=q_(o,J_(r)),o=q_(o,J_(i)),o=q_(o,J_(a)),o}getBeforeBody(e,t){return av(lv(t.callbacks,`beforeBody`,this,e))}getBody(e,t){let{callbacks:n}=t,r=[];return Hd(e,e=>{let t={before:[],lines:[],after:[]},i=sv(n,e);q_(t.before,J_(lv(i,`beforeLabel`,this,e))),q_(t.lines,lv(i,`label`,this,e)),q_(t.after,J_(lv(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return av(lv(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=lv(n,`beforeFooter`,this,e),i=lv(n,`footer`,this,e),a=lv(n,`afterFooter`,this,e),o=[];return o=q_(o,J_(r)),o=q_(o,J_(i)),o=q_(o,J_(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;s<c;++s)o.push(Y_(this.chart,t[s]));return e.filter&&(o=o.filter((t,r,i)=>e.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),Hd(o,t=>{let n=sv(e.callbacks,t);r.push(lv(n,`labelColor`,this,t)),i.push(lv(n,`labelPointStyle`,this,t)),a.push(lv(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=K_[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=X_(this,n),o=Object.assign({},e,t),s=ev(this.chart,n,o),c=rv(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=Ip(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Tm(n.rtl,this.x,this.width);for(e.x=iv(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=Rp(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;s<i;++s)t.fillText(r[s],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,s+1===i&&(e.y+=n.titleMarginBottom-o)}}_drawColorBox(e,t,n,r,i){let a=this.labelColors[n],o=this.labelPointStyles[n],{boxHeight:s,boxWidth:c}=i,l=Rp(i.bodyFont),u=iv(this,`left`,i),d=r.x(u),f=s<l.lineHeight?(l.lineHeight-s)/2:0,p=t.y+f;if(i.usePointStyle){let t={radius:Math.min(c,s)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},n=r.leftForLtr(d,c)+c/2,l=p+s/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,bp(e,t,n,l),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,bp(e,t,n,l)}else{e.lineWidth=Id(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(d,c),n=r.leftForLtr(r.xPlus(d,1),c-2),o=Ip(a.borderRadius);Object.values(o).some(e=>e!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,kp(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),kp(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=Rp(n.bodyFont),d=u.lineHeight,f=0,p=Tm(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=iv(this,h,n),t.fillStyle=n.bodyColor,Hd(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y<x;++y){for(g=r[y],_=this.labelTextColors[y],t.fillStyle=_,Hd(g.before,m),v=g.lines,o&&v.length&&(this._drawColorBox(t,e,y,p,n),d=Math.max(u.lineHeight,s)),b=0,S=v.length;b<S;++b)m(v[b]),d=u.lineHeight;Hd(g.after,m)}f=0,d=u.lineHeight,Hd(this.afterBody,m),e.y-=i}drawFooter(e,t,n){let r=this.footer,i=r.length,a,o;if(i){let s=Tm(n.rtl,this.x,this.width);for(e.x=iv(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline=`middle`,a=Rp(n.footerFont),t.fillStyle=n.footerColor,t.font=a.string,o=0;o<i;++o)t.fillText(r[o],s.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){let{xAlign:i,yAlign:a}=this,{x:o,y:s}=e,{width:c,height:l}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ip(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,s),a===`top`&&this.drawCaret(e,t,n,r),t.lineTo(o+c-d,s),t.quadraticCurveTo(o+c,s,o+c,s+d),a===`center`&&i===`right`&&this.drawCaret(e,t,n,r),t.lineTo(o+c,s+l-p),t.quadraticCurveTo(o+c,s+l,o+c-p,s+l),a===`bottom`&&this.drawCaret(e,t,n,r),t.lineTo(o+f,s+l),t.quadraticCurveTo(o,s+l,o,s+l-f),a===`center`&&i===`left`&&this.drawCaret(e,t,n,r),t.lineTo(o,s+u),t.quadraticCurveTo(o,s,o+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=K_[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=X_(this,e),o=Object.assign({},n,this._size),s=ev(t,e,o),c=rv(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=Lp(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),Em(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),Dm(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!Ud(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!Ud(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=K_[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},dv={id:`tooltip`,_element:uv,positioners:K_,afterInit(e,t,n){n&&(e.tooltip=new uv({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:cv},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]},fv=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function pv(e,t,n,r){let i=e.indexOf(t);return i===-1?fv(e,t,n,r):i===e.lastIndexOf(t)?i:n}var mv=(e,t)=>e===null?null:kf(Math.round(e),0,t);function hv(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var gv=class extends Lg{static id=`category`;static defaults={ticks:{callback:hv}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(Pd(e))return null;let n=this.getLabels();return t=isFinite(t)&&n[t]===e?t:pv(n,e,zd(t,e),this._addedLabels),mv(t,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:n,max:r}=this.getMinMax(!0);this.options.bounds===`ticks`&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){let e=this.min,t=this.max,n=this.options.offset,r=[],i=this.getLabels();i=e===0&&t===i.length-1?i:i.slice(e,t+1),this._valueRange=Math.max(i.length-+!n,1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return hv.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!=`number`&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function _v(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!Pd(a),_=!Pd(o),v=!Pd(c),y=(h-m)/(u+1),b=gf((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=gf(w*b/p/f)*f),Pd(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&bf((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=hf(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(wf(b),wf(S));x=10**(Pd(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),S<a&&E++,hf(Math.round((S+E*b)*x)/x,a,vv(a,y,e))&&E++):S<a&&E++);E<w;++E){let e=Math.round((S+E*b)*x)/x;if(_&&e>o)break;n.push({value:e})}return _&&d&&C!==o?n.length&&hf(n[n.length-1].value,o,vv(o,y,e))?n[n.length-1].value=o:n.push({value:o}):(!_||C===o)&&n.push({value:C}),n}function vv(e,t,{horizontal:n,minRotation:r}){let i=Sf(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var yv=class extends Lg{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return Pd(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=mf(r),t=mf(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=_v({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&xf(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return ap(e,this.chart.options.locale,this.options.ticks.format)}},bv=class extends yv{static id=`linear`;static defaults={ticks:{callback:cp.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=Ld(e)?e:0,this.max=Ld(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=Sf(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},xv=e=>Math.floor(pf(e)),Sv=(e,t)=>10**(xv(e)+t);function Cv(e){return e/10**xv(e)==1}function wv(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Tv(e,t){let n=xv(t-e);for(;wv(e,t,n)>10;)n++;for(;wv(e,t,n)<10;)n--;return Math.min(n,xv(e))}function Ev(e,{min:t,max:n}){t=Rd(e.min,t);let r=[],i=xv(t),a=Tv(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=Rd(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f<n;)r.push({value:f,major:Cv(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=Rd(e.max,f);return r.push({value:p,major:Cv(p),significand:d}),r}(class extends Lg{static id=`logarithmic`;static defaults={ticks:{callback:cp.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=yv.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return Ld(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=Ld(e)?Math.max(0,e):null,this.max=Ld(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Ld(this._userMin)&&(this.min=e===Sv(this.min,0)?Sv(this.min,-1):Sv(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(Sv(n,-1)),a(Sv(r,1)))),n<=0&&i(Sv(r,-1)),r<=0&&a(Sv(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Ev({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&xf(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:ap(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=pf(e),this._valueRange=pf(this.max)-pf(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(pf(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}});function Dv(e){let t=e.ticks;if(t.display&&e.display){let e=Lp(t.backdropPadding);return zd(t.font&&t.font.size,mp.font.size)+e.height}return 0}function Ov(e,t,n){return n=Fd(n)?n:[n],{w:_p(e,t.string,n),h:n.length*t.lineHeight}}function kv(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function Av(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?of/a:0;for(let c=0;c<a;c++){let a=o.setContext(e.getPointLabelContext(c));i[c]=a.padding;let l=e.getPointPosition(c,e.drawingArea+i[c],s),u=Rp(a.font),d=Ov(e.ctx,u,e._pointLabels[c]);r[c]=d;let f=Df(e.getIndexAngle(c)+s),p=Math.round(Cf(f));jv(n,t,f,kv(p,l.x,d.w,0,180),kv(p,l.y,d.h,90,270))}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=Pv(e,r,i)}function jv(e,t,n,r,i){let a=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n)),s=0,c=0;r.start<t.l?(s=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-s)):r.end>t.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.start<t.t?(c=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-c)):i.end>t.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function Mv(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(Cf(Df(c.angle+uf))),u=Lv(c.y,s.h,l),d=Fv(l),f=Iv(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function Nv(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(Sp({x:n,y:r},t)||Sp({x:n,y:a},t)||Sp({x:i,y:r},t)||Sp({x:i,y:a},t))}function Pv(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:Dv(a)/2,additionalAngle:o?of/i:0},l;for(let a=0;a<i;a++){c.padding=n[a],c.size=t[a];let i=Mv(e,a,c);r.push(i),s===`auto`&&(i.visible=Nv(i,l),i.visible&&(l=i))}return r}function Fv(e){return e===0||e===180?`center`:e<180?`left`:`right`}function Iv(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function Lv(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function Rv(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!Pd(s)){let n=Ip(t.borderRadius),c=Lp(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),kp(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function zv(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));Rv(n,a,t);let o=Rp(a.font),{x:s,y:c,textAlign:l}=t;Op(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function Bv(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,sf);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a<r;a++)n=e.getPointPosition(a,t),i.lineTo(n.x,n.y)}}function Vv(e,t,n,r,i){let a=e.ctx,o=t.circular,{color:s,lineWidth:c}=t;!o&&!r||!s||!c||n<0||(a.save(),a.strokeStyle=s,a.lineWidth=c,a.setLineDash(i.dash||[]),a.lineDashOffset=i.dashOffset,a.beginPath(),Bv(e,n,o,r),a.closePath(),a.stroke(),a.restore())}function Hv(e,t,n){return Vp(e,{label:n,index:t,type:`pointLabel`})}(class extends yv{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:cp.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=Lp(Dv(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=Ld(e)&&!isNaN(e)?e:0,this.max=Ld(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Dv(this.options))}generateTickLabels(e){yv.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let n=Vd(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?Av(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=sf/(this._pointLabels.length||1),n=this.options.startAngle||0;return Df(e*t+Sf(n))}getDistanceFromCenterForValue(e){if(Pd(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(Pd(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return Hv(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let r=this.getIndexAngle(e)-uf+n;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:r,bottom:i}=this._pointLabelItems[e];return{left:t,top:n,right:r,bottom:i}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),Bv(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:r,border:i}=t,a=this._pointLabels.length,o,s,c;if(t.pointLabels.display&&zv(this,a),r.display&&this.ticks.forEach((e,t)=>{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);Vv(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=Rp(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=Lp(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}Op(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}});var Uv={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Wv=Object.keys(Uv);function Gv(e,t){return e-t}function Kv(e,t){if(Pd(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),Ld(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(yf(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function qv(e,t,n,r){let i=Wv.length;for(let a=Wv.indexOf(e);a<i-1;++a){let e=Uv[Wv[a]],i=e.steps?e.steps:2**53-1;if(e.common&&Math.ceil((n-t)/(i*e.size))<=r)return Wv[a]}return Wv[i-1]}function Jv(e,t,n,r,i){for(let a=Wv.length-1;a>=Wv.indexOf(n);a--){let n=Wv[a];if(Uv[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return Wv[n?Wv.indexOf(n):0]}function Yv(e){for(let t=Wv.indexOf(e)+1,n=Wv.length;t<n;++t)if(Uv[Wv[t]].common)return Wv[t]}function Xv(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:r,hi:i}=Mf(n,t),a=n[r]>=t?n[r]:n[i];e[a]=!0}}function Zv(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function Qv(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o<a;++o)s=t[o],i[s]=o,r.push({value:s,major:!1});return a===0||!n?r:Zv(e,r,i,n)}var $v=class extends Lg{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let n=e.time||={},r=this._adapter=new xh._date(e.adapters.date);r.init(t),Jd(n.displayFormats,r.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:Kv(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,n=e.time.unit||`day`,{min:r,max:i,minDefined:a,maxDefined:o}=this.getUserBounds();function s(e){!a&&!isNaN(e.min)&&(r=Math.min(r,e.min)),!o&&!isNaN(e.max)&&(i=Math.max(i,e.max))}(!a||!o)&&(s(this._getLabelBounds()),(e.bounds!==`ticks`||e.ticks.source!==`labels`)&&s(this.getMinMax(!1))),r=Ld(r)&&!isNaN(r)?r:+t.startOf(Date.now(),n),i=Ld(i)&&!isNaN(i)?i:+t.endOf(Date.now(),n)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,n=-1/0;return e.length&&(t=e[0],n=e[e.length-1]),{min:t,max:n}}buildTicks(){let e=this.options,t=e.time,n=e.ticks,r=n.source===`labels`?this.getLabelTimestamps():this._generate();e.bounds===`ticks`&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let i=this.min,a=this.max,o=Ff(r,i,a);return this._unit=t.unit||(n.autoSkip?qv(t.minUnit,this.min,this.max,this._getLabelCapacity(i)):Jv(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:Yv(this._unit),this.initOffsets(r),e.reverse&&o.reverse(),Qv(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=kf(t,0,a),n=kf(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||qv(i.minUnit,t,n,this._getLabelCapacity(t)),o=zd(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=yf(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+e.add(d,o,a),f++)Xv(l,d,p);return(d===n||r.bounds===`ticks`||f===1)&&Xv(l,d,p),Object.keys(l).sort(Gv).map(e=>+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return Vd(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],r.label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+n)*t.factor)}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,n=this.ctx.measureText(e).width,r=Sf(this.isHorizontal()?t.maxRotation:t.minRotation),i=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:n*i+o*a,h:n*a+o*i}}_getLabelCapacity(e){let t=this.options.time,n=t.displayFormats,r=n[t.unit]||n.millisecond,i=this._tickFormatFunction(e,0,Qv(this,[e],this._majorUnit),r),a=this._getLabelSize(i),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t<n;++t)e=e.concat(r[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],t,n;if(e.length)return e;let r=this.getLabels();for(t=0,n=r.length;t<n;++t)e.push(Kv(this,r[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return zf(e.sort(Gv))}};function ey(e,t,n){let r=0,i=e.length-1,a,o,s,c;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=Nf(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=Nf(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}(class extends $v{static id=`timeseries`;static defaults=$v.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=ey(t,this.min),this._tableRange=ey(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a<o;++a)c=e[a],c>=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;a<o;++a)l=r[a+1],s=r[a-1],c=r[a],Math.round((l+s)/2)!==c&&i.push({time:c,pos:a/(o-1)});return i}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(t)||n.length===1)&&n.push(t),n.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(ey(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return ey(this._table,n*this._tableRange+this._minPos,!0)}});function ty(){let e=[{id:`daily`,label:`Today`},{id:`weekly`,label:`This Week`},{id:`monthly`,label:`This Month`},{id:`overall`,label:`Overall`}],t=M(`daily`),n=st([st(Ha,e=>e),t],([e,t])=>e&&e[t]||null),r=st(n,e=>e?.history||[]),i=st(r,e=>Math.max(5,...e.map(e=>Math.max(e.created||0,e.completed||0))));function a(e){return e?e<60?`${Math.round(e)}m`:`${Math.floor(e/60)}h ${Math.round(e%60)}m`:`0m`}function o(e){return e?e<1e3?e.toString():`${(e/1e3).toFixed(1)}k`:`0`}return{periods:e,activePeriod:t,periodData:n,history:r,maxVal:i,setActivePeriod:e=>t.set(e),formatDuration:a,formatTokens:o}}var ny=K(`<button style="padding:4px 10px;font-size:0.65rem;"> </button>`),ry=K(`<div class="flex items-center justify-between mb-4"><div style="font-size:0.65rem;font-weight:700;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.1em;">Trend Line</div> <div class="flex gap-3"><div class="flex items-center gap-1.5"><div style="width:8px;height:8px;border-radius:2px;background:#10b981;"></div> <span style="font-size:0.6rem;font-weight:600;color:var(--color-text-muted);">Added</span></div> <div class="flex items-center gap-1.5"><div style="width:8px;height:8px;border-radius:2px;background:#6366f1;"></div> <span style="font-size:0.6rem;font-weight:600;color:var(--color-text-muted);">Done</span></div></div></div> <div style="height:120px;position:relative;width:100%;"><canvas></canvas></div>`,1),iy=K(`<div class="compact-empty svelte-9j0inj">No trend data for this period</div>`),ay=K(`<div class="glass card animate-fade-in"><div class="flex items-center justify-between mb-4"><div><div style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:var(--color-primary);">Performance</div> <div style="font-size:0.75rem;color:var(--color-text-muted);">Execution throughput</div></div> <div class="flex gap-1" style="background:rgba(241,245,249,0.5);padding:3px;border-radius:10px;"></div></div> <div class="metrics-grid svelte-9j0inj"><div style="background:rgba(99,102,241,0.08);border:1px solid rgba(99,102,241,0.1);border-radius:12px;padding:12px;"><div style="font-size:0.6rem;color:#6366f1;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px;">Done</div> <div style="font-size:1.5rem;font-weight:900;color:var(--color-text);line-height:1;letter-spacing:-0.03em;"> </div></div> <div style="background:rgba(16,185,129,0.08);border:1px solid rgba(16,185,129,0.1);border-radius:12px;padding:12px;"><div style="font-size:0.6rem;color:#10b981;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px;">Added</div> <div style="font-size:1.5rem;font-weight:900;color:var(--color-text);line-height:1;letter-spacing:-0.03em;"> </div></div> <div style="background:rgba(56,189,248,0.08);border:1px solid rgba(56,189,248,0.1);border-radius:12px;padding:12px;"><div style="font-size:0.6rem;color:#0ea5e9;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px;">Tokens</div> <div style="font-size:1.5rem;font-weight:900;color:var(--color-text);line-height:1;letter-spacing:-0.03em;"> </div></div> <div style="background:rgba(245,158,11,0.08);border:1px solid rgba(245,158,11,0.1);border-radius:12px;padding:12px;"><div style="font-size:0.6rem;color:#f59e0b;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px;">Velocity</div> <div style="font-size:1.5rem;font-weight:900;color:var(--color-text);line-height:1;letter-spacing:-0.03em;"> </div></div></div> <div class="pt-4 border-t border-dashed" style="border-color:var(--color-border);"><!></div></div>`);function oy(e,t){We(t,!1);let n=()=>P(l,`$history`,a),r=()=>P(s,`$activePeriod`,a),i=()=>P(c,`$periodData`,a),[a,o]=pt();T_.register(yh,I_,gv,bv,dv,G_);let{activePeriod:s,periodData:c,history:l,setActivePeriod:u,periods:d,formatTokens:f,formatDuration:p}=ty(),m=F(),h=F();function g(){H(m)&&I(h,new T_(H(m),{type:`bar`,data:{labels:[],datasets:[{label:`Created`,data:[],backgroundColor:`#10b981`,borderRadius:4,borderSkipped:!1,barPercentage:.6,categoryPercentage:.8},{label:`Completed`,data:[],backgroundColor:`#6366f1`,borderRadius:4,borderSkipped:!1,barPercentage:.6,categoryPercentage:.8}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:`rgba(15, 23, 42, 0.95)`,titleFont:{size:12,weight:`bold`},bodyFont:{size:11},padding:10,cornerRadius:8,displayColors:!0,borderColor:`rgba(255, 255, 255, 0.1)`,borderWidth:1}},scales:{x:{grid:{display:!1},ticks:{color:`#94a3b8`,font:{size:10,family:`monospace`},callback(e,t){let n=this.getLabelForValue(t);return n.includes(`:00`)?n.split(`:`)[0]:n.replace(`2026-`,``).replace(`2025-`,``)}}},y:{beginAtZero:!0,grid:{color:`rgba(148, 163, 184, 0.05)`},ticks:{color:`#94a3b8`,font:{size:9},stepSize:1,precision:0}}}}}))}function _(e){H(h)&&(sn(h,H(h).data.labels=e.map(e=>e.label)),sn(h,H(h).data.datasets[0].data=e.map(e=>e.created)),sn(h,H(h).data.datasets[1].data=e.map(e=>e.completed)),H(h).update(`none`))}Oa(()=>{H(m)&&g()}),ka(()=>{H(h)&&H(h).destroy()}),B(()=>(H(m),H(h),n()),()=>{H(m)&&!H(h)&&(g(),n()?.length&&_(n()))}),B(()=>(H(h),n()),()=>{H(h)&&n()&&_(n())}),Un(),Ta();var v=ay(),y=L(v),b=z(L(y),2);X(b,5,()=>d,e=>e.id,(e,t)=>{var n=ny();let i;var a=L(n,!0);j(n),V(()=>{i=Ki(n,1,`tab-btn`,null,i,{active:r()===H(t).id}),J(a,(H(t),U(()=>H(t).label)))}),G(`click`,n,()=>u(H(t).id)),q(e,n)}),j(b),j(y);var x=z(y,2),S=L(x),C=z(L(S),2),w=L(C,!0);j(C),j(S);var T=z(S,2),E=z(L(T),2),D=L(E,!0);j(E),j(T);var ee=z(T,2),te=z(L(ee),2),ne=L(te,!0);j(te),j(ee);var re=z(ee,2),ie=z(L(re),2),ae=L(ie,!0);j(ie),j(re),j(x);var oe=z(x,2),O=L(oe),se=e=>{var t=ry(),n=z(R(t),2);Sa(L(n),e=>I(m,e),()=>H(m)),j(n),q(e,t)},ce=e=>{q(e,iy())};Y(O,e=>{i(),U(()=>i()?.history&&i().history.length>0)?e(se):e(ce,-1)}),j(oe),j(v),V((e,t)=>{J(w,(i(),U(()=>i()?.completed??`—`))),J(D,(i(),U(()=>i()?.added??`—`))),J(ne,e),J(ae,t)},[()=>(i(),U(()=>i()?.tokens?f(i().tokens):`—`)),()=>(i(),U(()=>i()?.avgDuration?p(i().avgDuration):`—`))]),q(e,v),Ge(),o()}function sy(){let e=!1;async function t(t=N(La)){if(!t){Ua.set([]);return}e=!0;try{let e=await fo.memories({repo:t,type:N(Ja)||void 0,search:N(qa)||void 0,minImportance:N(Ya)||void 0,maxImportance:N(Xa)||void 0,sortBy:N(Za),sortOrder:N(Qa),page:N(Ga),pageSize:N(Ka)});Ua.set(e.memories||[]),Wa.set(e.pagination?.totalItems||0)}catch(e){console.error(`Failed to load memories:`,e)}finally{e=!1}}let n=fl(()=>{Ga.set(1),t()},300);function r(){n()}function i(){Ga.set(1),t()}function a(e){let n=N(so);e<1||e>n||(Ga.set(e),t())}function o(e){N(Za)===e?Qa.update(e=>e===`desc`?`asc`:`desc`):(Za.set(e),Qa.set(`desc`)),t()}function s(e){$a.update(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function c(){$a.update(e=>{let t=N(Ua);return e.size===t.length?new Set:new Set(t.map(e=>e.id))})}async function l(e,t=N(La)){if(t)try{let n=await fo.export(t),r=`${t.replace(`/`,`_`)}_export`;e===`json`?ul(n,r+`.json`):dl(n.memories||[],r+`.csv`)}catch(e){console.error(`Export failed:`,e)}}async function u(e,n){if(n&&n.stopPropagation(),confirm(`Delete memory "${e.title}"?`))try{await fo.deleteMemory(e.id),t()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;alert(`Failed to delete: `+t)}}async function d(){let e=N($a);if(e.size!==0&&confirm(`Are you sure you want to delete ${e.size} memories?`))try{await fo.bulkMemoryAction(`delete`,Array.from(e)),$a.set(new Set),t()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;alert(`Failed to delete: `+t)}}async function f(){let e=N($a);if(e.size!==0)try{await fo.bulkMemoryAction(`archive`,Array.from(e)),$a.set(new Set),t()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;alert(`Failed to archive: `+t)}}return{get loading(){return e},loadMemories:t,onSearchInput:r,onFilterChange:i,goToPage:a,toggleSort:o,toggleSelect:s,toggleSelectAll:c,handleExport:l,handleDeleteRow:u,handleBulkDelete:d,handleBulkArchive:f}}var cy=[`code_fact`,`decision`,`mistake`,`pattern`,`task_archive`],ly={code_fact:`Code Fact`,decision:`Decision`,mistake:`Mistake`,pattern:`Pattern`,task_archive:`Task Archive`},uy={1:`#64748b`,2:`#3b82f6`,3:`#f59e0b`,4:`#f97316`,5:`#ef4444`},dy={1:`rgba(100,116,139,0.12)`,2:`rgba(59,130,246,0.12)`,3:`rgba(245,158,11,0.12)`,4:`rgba(249,115,22,0.12)`,5:`rgba(239,68,68,0.12)`},fy=K(`<option> </option>`),py=K(`<option> </option>`),my=K(`<option> </option>`),hy=K(`<tr><td colspan="7" class="mem-td svelte-83aj9g"><div class="skeleton" style="height:20px;border-radius:6px;"></div></td></tr>`),gy=K(`<tr><td colspan="7" class="mem-td svelte-83aj9g" style="padding:40px;text-align:center;color:var(--color-text-muted);"><div style="font-size:2rem;margin-bottom:8px;">🔍</div> No memories found</td></tr>`),_y=K(`<span style="font-size:0.6rem;background:rgba(99,102,241,0.1);color:#6366f1;padding:1px 5px;border-radius:9999px;"> </span>`),vy=K(`<div style="margin-top:3px;display:flex;gap:4px;flex-wrap:wrap;"></div>`),yy=K(`<tr><td class="mem-td svelte-83aj9g"><input type="checkbox"/></td><td class="mem-td svelte-83aj9g" style="max-width:300px;"><div class="truncate font-semibold" style="font-size:0.82rem;color:var(--color-text);"> </div> <!></td><td class="mem-td svelte-83aj9g"><span> </span></td><td class="mem-td svelte-83aj9g" style="text-align:center;"><span> </span></td><td class="mem-td svelte-83aj9g" style="font-size:0.75rem;color:var(--color-text-muted);white-space:nowrap;"> </td><td class="mem-td svelte-83aj9g" style="text-align:center;font-size:0.75rem;font-weight:600;color:var(--color-text-muted);"> </td><td class="mem-td row-actions svelte-83aj9g"><button class="row-action-btn edit-btn svelte-83aj9g" title="Edit / View" aria-label="Edit memory"><!></button> <button class="row-action-btn delete-btn svelte-83aj9g" title="Delete" aria-label="Delete memory"><!></button></td></tr>`),by=K(`<button> </button>`),xy=K(`<div class="flex items-center justify-between mt-3"><span style="font-size:0.75rem;color:var(--color-text-muted);"> </span> <div class="flex gap-1"><button class="btn btn-ghost btn-sm">«</button> <button class="btn btn-ghost btn-sm">‹</button> <!> <button class="btn btn-ghost btn-sm">›</button> <button class="btn btn-ghost btn-sm">»</button></div></div>`),Sy=K(`<div class="bulk-actions-bar svelte-83aj9g"><span><b> </b> selected</span> <div style="width:12px;"></div> <button class="btn btn-sm" style="background:rgba(120,120,120,0.2);color:inherit;">Cancel</button> <button class="btn btn-sm" style="background:#52525b;color:white;border:none;">Archive</button> <button class="btn btn-sm btn-accent" style="background:#ef4444;color:white;border:none;">Delete</button></div>`),Cy=K(`<div><div class="flex items-center gap-2 mb-3" style="flex-wrap:wrap;"><div style="position:relative;flex:1;min-width:160px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--color-text-muted);"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg> <input class="form-input" style="padding-left:32px;font-size:0.8rem;" type="text" placeholder="Search memories..."/></div> <select class="form-select" style="width:140px;font-size:0.8rem;"><option>All Types</option><!></select> <select class="form-select" style="width:100px;font-size:0.8rem;"><option>Min Imp.</option><!></select> <select class="form-select" style="width:100px;font-size:0.8rem;"></select> <div class="flex gap-1"><button class="btn btn-ghost btn-sm" title="Export JSON"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> JSON</button> <button class="btn btn-ghost btn-sm" title="Export CSV"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> CSV</button> <div style="width:1px;height:14px;background:var(--color-border);margin:auto 4px;"></div> <button class="btn btn-ghost btn-sm" title="Bulk Import"><!> Import</button></div> <button class="btn btn-accent btn-sm" id="newMemoryBtn" style="margin-left:auto;"><!> New Memory</button></div> <div style="font-size:0.72rem;color:var(--color-text-muted);margin-bottom:8px;"> </div> <div class="mem-table-wrap svelte-83aj9g"><table class="mem-table svelte-83aj9g"><thead><tr class="mem-thead-row svelte-83aj9g"><th class="mem-th svelte-83aj9g" style="width:36px;"><input type="checkbox" aria-label="Select all"/></th><th class="mem-th sortable svelte-83aj9g"> </th><th class="mem-th svelte-83aj9g">Type</th><th class="mem-th svelte-83aj9g" style="text-align:center;cursor:pointer;"> </th><th class="mem-th sortable svelte-83aj9g"> </th><th class="mem-th svelte-83aj9g" style="text-align:center;">Hits</th><th class="mem-th svelte-83aj9g" style="width:80px;"></th></tr></thead><tbody><!></tbody></table></div> <!> <!></div>`);function wy(e,t){We(t,!1);let n=()=>P(Ua,`$memories`,p),r=()=>P($a,`$selectedMemoryIds`,p),i=()=>P(qa,`$memoriesSearch`,p),a=()=>P(Ja,`$memoriesTypeFilter`,p),o=()=>P(Ya,`$memoriesImportanceMin`,p),s=()=>P(Ka,`$memoriesPageSize`,p),c=()=>P(Wa,`$memoriesTotal`,p),l=()=>P(Za,`$memoriesSortBy`,p),u=()=>P(Qa,`$memoriesSortOrder`,p),d=()=>P(so,`$memoriesTotalPages`,p),f=()=>P(Ga,`$memoriesPage`,p),[p,m]=pt(),h=F(),g=Q(t,`onMemoryClick`,8,()=>{}),_=Q(t,`onNewMemory`,8,()=>{}),v=Q(t,`onBulkImport`,8,()=>{}),y=sy();function b(){y.loadMemories()}B(()=>(n(),r()),()=>{I(h,n().length>0&&r().size===n().length)}),Un();var x={refresh:b};Ta();var S=Cy(),C=L(S),w=L(C),T=z(L(w),2);ca(T),j(w);var E=z(w,2),D=L(E);D.value=D.__value=``,X(z(D),1,()=>cy,e=>e,(e,t)=>{var n=fy(),r=L(n,!0);j(n);var i={};V(()=>{J(r,(W(ly),H(t),U(()=>ly[H(t)]))),i!==(i=H(t))&&(n.value=(n.__value=H(t))??``)}),q(e,n)}),j(E);var ee=z(E,2),te=L(ee);te.value=(te.__value=null,``),X(z(te),0,()=>[1,2,3,4,5],e=>e,(e,t)=>{var n=py(),r=L(n,!0);j(n);var i={};V(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),j(ee);var ne=z(ee,2);X(ne,4,()=>[10,25,50,100],e=>e,(e,t)=>{var n=my(),r=L(n);j(n);var i={};V(()=>{J(r,`${t??``} / page`),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),j(ne);var re=z(ne,2),ie=L(re),ae=z(ie,2),oe=z(ae,4);$(L(oe),{name:`upload`,size:13,strokeWidth:2}),Ne(),j(oe),j(re);var O=z(re,2);$(L(O),{name:`plus`,size:13,strokeWidth:2.5}),Ne(),j(O),j(C);var se=z(C,2),ce=L(se);j(se);var le=z(se,2),ue=L(le),de=L(ue),fe=L(de),pe=L(fe),me=L(pe);ca(me),j(pe);var he=z(pe),ge=L(he);j(he);var _e=z(he,2),ve=L(_e);j(_e);var ye=z(_e),be=L(ye);j(ye),Ne(2),j(fe),j(de);var xe=z(de),Se=L(xe),Ce=e=>{var t=li();X(R(t),0,()=>({length:5}),_i,(e,t,n)=>{var r=hy();fa(r,`data-index`,n),V(()=>fa(r,`data-dummy`,t)),q(e,r)}),q(e,t)},we=e=>{q(e,gy())},Te=e=>{var i=li();X(R(i),1,n,e=>e.id,(e,n)=>{var i=yy();let a;var o=L(i),s=L(o);ca(s),j(o);var c=z(o),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=e=>{var t=vy();X(t,5,()=>(H(n),U(()=>H(n).tags.slice(0,3))),e=>e,(e,t)=>{var n=_y(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(t),q(e,t)};Y(d,e=>{H(n),U(()=>H(n).tags?.length)&&e(f)}),j(c);var p=z(c),m=L(p),h=L(m,!0);j(m),j(p);var _=z(p),v=L(_),b=L(v,!0);j(v),j(_);var x=z(_),S=L(x,!0);j(x);var C=z(x),w=L(C,!0);j(C);var T=z(C),E=L(T);$(L(E),{name:`edit-2`,size:13,strokeWidth:2}),j(E);var D=z(E,2);$(L(D),{name:`trash-2`,size:13,strokeWidth:2}),j(D),j(T),j(i),V((e,t,r)=>{a=Ki(i,1,`mem-row svelte-83aj9g`,null,a,e),ua(s,t),J(u,(H(n),U(()=>H(n).title))),Ki(m,1,`type-chip type-${(H(n),U(()=>H(n).type))??``}`,`svelte-83aj9g`),J(h,(W(ly),H(n),U(()=>ly[H(n).type]||H(n).type))),Ji(v,`display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;font-size:0.75rem;font-weight:700;background:${(W(dy),H(n),U(()=>dy[H(n).importance]||dy[1]))??``};color:${(W(uy),H(n),U(()=>uy[H(n).importance]||uy[1]))??``};`),J(b,(H(n),U(()=>H(n).importance))),J(S,r),J(w,(H(n),U(()=>H(n).hit_count??0)))},[()=>({selected:r().has(H(n).id)}),()=>(r(),H(n),U(()=>r().has(H(n).id))),()=>(W(il),H(n),U(()=>il(H(n).updated_at)))]),G(`change`,s,()=>y.toggleSelect(H(n).id)),G(`click`,o,Ca(function(e){Da.call(this,t,e)})),G(`click`,E,()=>g()(H(n))),G(`click`,D,e=>y.handleDeleteRow(H(n),e)),G(`click`,T,Ca(function(e){Da.call(this,t,e)})),G(`click`,i,()=>g()(H(n))),q(e,i)}),q(e,i)};Y(Se,e=>{U(()=>y.loading)?e(Ce):(n(),U(()=>n().length===0)?e(we,1):e(Te,-1))}),j(xe),j(ue),j(le);var Ee=z(le,2),De=e=>{var t=xy(),n=L(t),r=L(n);j(n);var i=z(n,2),a=L(i),o=z(a,2),s=z(o,2);X(s,1,()=>(d(),f(),U(()=>Array.from({length:Math.min(5,d())},(e,t)=>Math.max(1,Math.min(f()-2,d()-4))+t))),e=>e,(e,t)=>{var n=by();let r;var i=L(n,!0);j(n),V(()=>{r=Ki(n,1,`btn btn-sm`,null,r,{"btn-primary":H(t)===f(),"btn-ghost":H(t)!==f()}),J(i,H(t))}),G(`click`,n,()=>y.goToPage(H(t))),q(e,n)});var c=z(s,2),l=z(c,2);j(i),j(t),V(()=>{J(r,`Page ${f()??``} of ${d()??``}`),a.disabled=f()<=1,o.disabled=f()<=1,c.disabled=f()>=d(),l.disabled=f()>=d()}),G(`click`,a,()=>y.goToPage(1)),G(`click`,o,()=>y.goToPage(f()-1)),G(`click`,c,()=>y.goToPage(f()+1)),G(`click`,l,()=>y.goToPage(d())),q(e,t)};Y(Ee,e=>{d()>1&&e(De)});var Oe=z(Ee,2),ke=e=>{var t=Sy(),n=L(t),i=L(n),a=L(i,!0);j(i),Ne(),j(n);var o=z(n,4),s=z(o,2),c=z(s,2);j(t),V(()=>J(a,(r(),U(()=>r().size)))),G(`click`,o,()=>$a.set(new Set)),G(`click`,s,()=>y.handleBulkArchive()),G(`click`,c,()=>y.handleBulkDelete()),q(e,t)};Y(Oe,e=>{r(),U(()=>r().size>0)&&e(ke)}),j(S),V(()=>{J(ce,`${c()??``} memories
|
|
70
|
+
${(r(),U(()=>r().size>0?`· ${r().size} selected`:``))??``}`),ua(me,H(h)),J(ge,`Title ${l()===`title`?u()===`desc`?`↓`:`↑`:``}`),J(ve,`Imp. ${l()===`importance`?u()===`desc`?`↓`:`↑`:``}`),J(be,`Updated ${l()===`updated_at`?u()===`desc`?`↓`:`↑`:``}`)}),Z(T,i,e=>ft(qa,e)),G(`input`,T,()=>y.onSearchInput()),Zi(E,a,e=>ft(Ja,e)),G(`change`,E,()=>y.onFilterChange()),Zi(ee,o,e=>ft(Ya,e)),G(`change`,ee,()=>y.onFilterChange()),Zi(ne,s,e=>ft(Ka,e)),G(`change`,ne,()=>{Ga.set(1),y.loadMemories()}),G(`click`,ie,()=>y.handleExport(`json`)),G(`click`,ae,()=>y.handleExport(`csv`)),G(`click`,oe,function(...e){v()?.apply(this,e)}),G(`click`,O,function(...e){_()?.apply(this,e)}),G(`change`,me,()=>y.toggleSelectAll()),G(`click`,he,()=>y.toggleSort(`title`)),G(`click`,_e,()=>y.toggleSort(`importance`)),G(`click`,ye,()=>y.toggleSort(`updated_at`)),q(e,S),ba(t,`refresh`,b);var k=Ge(x);return m(),k}function Ty(e){let t=M({expandedResponses:new Set,isLoadingMore:!1,hasReachedStart:!1}),{subscribe:n,update:r}=t,i={search:{icon:`search`,label:`Search`,gradient:`linear-gradient(135deg,#3b82f6,#2563eb)`,color:`#3b82f6`,bgAlpha:`rgba(59,130,246,0.12)`},read:{icon:`book-open`,label:`Read`,gradient:`linear-gradient(135deg,#10b981,#059669)`,color:`#10b981`,bgAlpha:`rgba(16,185,129,0.12)`},write:{icon:`edit`,label:`Created`,gradient:`linear-gradient(135deg,#6366f1,#4f46e5)`,color:`#6366f1`,bgAlpha:`rgba(99,102,241,0.12)`},update:{icon:`refresh-cw`,label:`Updated`,gradient:`linear-gradient(135deg,#f59e0b,#d97706)`,color:`#f59e0b`,bgAlpha:`rgba(245,158,11,0.12)`},delete:{icon:`trash`,label:`Deleted`,gradient:`linear-gradient(135deg,#ef4444,#dc2626)`,color:`#ef4444`,bgAlpha:`rgba(239,68,68,0.12)`},list:{icon:`list`,label:`List`,gradient:`linear-gradient(135deg,#64748b,#475569)`,color:`#64748b`,bgAlpha:`rgba(100,116,139,0.12)`}};function a(e){return i[e]??{icon:`activity`,label:e,gradient:`linear-gradient(135deg,#64748b,#475569)`,color:`#64748b`,bgAlpha:`rgba(100,116,139,0.12)`}}function o(e){if(e.action===`search`)return{main:e.query?`"${e.query}"`:`Query`,sub:e.result_count==null?`Searching memories...`:`${e.result_count} result${e.result_count===1?``:`s`} found`};if(e.task_id){let t={write:`Created`,update:`Updated`,delete:`Deleted`};return{main:e.task_title||e.task_code||e.task_id.substring(0,8),sub:e.task_code?`${t[e.action]||e.action} Task · ${e.task_code}`:(t[e.action]||e.action)+` Task`}}let t={write:`Stored`,update:`Updated`,delete:`Deleted`,read:`Read`},n=e.memory_type?`[${e.memory_type}]`:``;return{main:e.memory_title||(e.memory_id?e.memory_id.substring(0,8)+`…`:`—`),sub:[t[e.action]||e.action,n].filter(Boolean).join(` `)}}function s(e){if(!e)return{text:``,isLong:!1};try{let t=typeof e==`string`?JSON.parse(e):e;if(t.content&&Array.isArray(t.content)){let e=t.content.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
71
|
+
`);return{text:e,isLong:e.length>400||e.split(`
|
|
72
|
+
`).length>8}}else if(Array.isArray(t)){if(t.length===0)return{text:`No items found.`,isLong:!1};{let e=t[0],n=e.task_code||e.id?.startsWith(`TASK-`),r=e.title||e.content,i=n?`task`:r?`memory`:`item`,a=`Found ${t.length} ${i}${t.length>1?`s`:``}:\n`+t.slice(0,5).map(e=>`- ${e.title||e.task_code||e.name||e.id||`Untitled`}`).join(`
|
|
73
|
+
`)+(t.length>5?`\n... and ${t.length-5} more`:``);return{text:a,isLong:a.length>400||a.split(`
|
|
74
|
+
`).length>8}}}else if(t.tasks&&Array.isArray(t.tasks)){let e=`Found ${t.tasks.length} tasks:\n`+t.tasks.slice(0,5).map(e=>`- [${e.task_code}] ${e.title}`).join(`
|
|
75
|
+
`)+(t.tasks.length>5?`\n... and ${t.tasks.length-5} more`:``);return{text:e,isLong:e.length>400||e.split(`
|
|
76
|
+
`).length>8}}else if(t.results&&Array.isArray(t.results)){let e=`Found ${t.results.length} results:\n`+t.results.slice(0,5).map(e=>`- ${e.title||e.content?.substring(0,40)+`...`}`).join(`
|
|
77
|
+
`)+(t.results.length>5?`\n... and ${t.results.length-5} more`:``);return{text:e,isLong:e.length>400||e.split(`
|
|
78
|
+
`).length>8}}else if(typeof t==`object`&&t){let e=Object.keys(t),n=``;return n=e.length>5?`{ ${e.slice(0,4).map(e=>`${e}: …`).join(`, `)}, +${e.length-4} more }`:JSON.stringify(t,null,2),{text:n,isLong:n.length>400||n.split(`
|
|
79
|
+
`).length>8}}else{let e=String(t);return{text:e,isLong:e.length>400||e.split(`
|
|
80
|
+
`).length>8}}}catch{return{text:e,isLong:e.length>400||e.split(`
|
|
81
|
+
`).length>8}}}let c=st(to,e=>{let t=[];return[...e].reverse().forEach(e=>{let n=new Date(e.created_at),r=new Date,i=new Date;i.setDate(r.getDate()-1);let a=n.toLocaleDateString(void 0,{month:`long`,day:`numeric`,year:`numeric`});n.toDateString()===r.toDateString()?a=`Today`:n.toDateString()===i.toDateString()&&(a=`Yesterday`);let o=t[t.length-1];o&&o.date===a?o.items.push(e):t.push({date:a,items:[e]})}),t});function l(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function u(e){r(t=>{let n=new Set(t.expandedResponses);return n.has(e)?n.delete(e):n.add(e),{...t,expandedResponses:n}})}function d(e,t=`smooth`){e&&e.scrollTo({top:e.scrollHeight,behavior:t})}async function f(n,i){let a=N(t);if(!i||a.isLoadingMore||a.hasReachedStart)return;let o=N(to),s=N(no),c=N(ro);if(i.scrollTop<50&&o.length<s){r(e=>({...e,isLoadingMore:!0}));let t=i.scrollHeight;await e(c+1,!0),i&&setTimeout(()=>{i.scrollTop=i.scrollHeight-t},0);let n=N(to);r(e=>({...e,isLoadingMore:!1,hasReachedStart:n.length>=s}))}}return{subscribe:n,state:t,groupedActions:c,recentActions:to,recentActionsPage:ro,getConfig:a,getLabel:o,parseResponse:s,formatTime:l,renderMarkdown:ll,toggleExpand:u,scrollToBottom:d,handleScroll:f}}var Ey=K(`<h1> </h1>`),Dy=K(`<h2> </h2>`),Oy=K(`<h3> </h3>`),ky=K(`<h4> </h4>`),Ay=K(`<h5> </h5>`),jy=K(`<h6> </h6>`),My=K(`<strong> </strong>`),Ny=K(`<em> </em>`),Py=K(`<code class="svelte-d5v60e"> </code>`),Fy=K(`<a> </a>`),Iy=K(`<p class="svelte-d5v60e"></p>`),Ly=K(`<li></li>`),Ry=K(`<ol></ol>`),zy=K(`<li></li>`),By=K(`<ul></ul>`),Vy=K(`<pre class="svelte-d5v60e"><code class="svelte-d5v60e"> </code></pre>`),Hy=K(`<th class="svelte-d5v60e"> </th>`),Uy=K(`<td class="svelte-d5v60e"> </td>`),Wy=K(`<tr></tr>`),Gy=K(`<table class="svelte-d5v60e"><thead><tr></tr></thead><tbody></tbody></table>`),Ky=K(`<br/>`),qy=K(`<hr/>`),Jy=K(`<blockquote class="svelte-d5v60e"> </blockquote>`),Yy=K(`<div class="markdown-body svelte-d5v60e"></div>`);function Xy(e,t){We(t,!1);let n=F(),r=Q(t,`content`,8,``);function i(e){return e.type===`link`}function a(e){return e.type===`strong`}function o(e){return e.type===`em`}function s(e){return e.type===`codespan`}function c(e){return e.type===`list`}function l(e){return e.type===`code`}function u(e){return e.type===`table`}B(()=>W(r()),()=>{I(n,Gs.lexer(r()))}),Un(),Ta();var d=Yy();X(d,7,()=>H(n),(e,t)=>`${e.type}-${t}`,(e,t)=>{var n=li(),r=R(n),d=e=>{var n=li(),r=R(n),i=e=>{var n=Ey(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},a=e=>{var n=Dy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},o=e=>{var n=Oy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},s=e=>{var n=ky(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},c=e=>{var n=Ay(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},l=e=>{var n=jy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).depth===1)?e(i):(H(t),U(()=>H(t).depth===2)?e(a,1):(H(t),U(()=>H(t).depth===3)?e(o,2):(H(t),U(()=>H(t).depth===4)?e(s,3):(H(t),U(()=>H(t).depth===5)?e(c,4):e(l,-1)))))}),q(e,n)},f=e=>{var n=Iy();X(n,7,()=>(H(t),U(()=>H(t).tokens||[])),(e,t)=>`${e.type}-${t}`,(e,t)=>{var n=li(),r=R(n),c=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).text)))),q(e,n)},l=e=>{var n=My(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},u=Jt(()=>(H(t),U(()=>a(H(t))))),d=e=>{var n=Ny(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},f=Jt(()=>(H(t),U(()=>o(H(t))))),p=e=>{var n=Py(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},m=Jt(()=>(H(t),U(()=>s(H(t))))),h=e=>{var n=Fy(),r=L(n,!0);j(n),V(()=>{fa(n,`href`,(H(t),U(()=>H(t).href))),fa(n,`title`,(H(t),U(()=>H(t).title))),J(r,(H(t),U(()=>H(t).text)))}),q(e,n)},g=Jt(()=>(H(t),U(()=>i(H(t))))),_=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).raw)))),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).type===`text`)?e(c):H(u)?e(l,1):H(f)?e(d,2):H(m)?e(p,3):H(g)?e(h,4):e(_,-1)}),q(e,n)}),j(n),q(e,n)},p=e=>{var n=li(),r=R(n),i=e=>{var n=Ry();X(n,7,()=>(H(t),U(()=>H(t).items)),(e,t)=>`ordered-${t}`,(e,t)=>{var n=Ly();X(n,7,()=>(H(t),U(()=>H(t).tokens||[])),(e,t)=>`${e.type}-${t}`,(e,t)=>{var n=li(),r=R(n),i=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).text)))),q(e,n)},a=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).raw)))),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).type===`text`)?e(i):e(a,-1)}),q(e,n)}),j(n),q(e,n)}),j(n),V(()=>fa(n,`start`,(H(t),U(()=>typeof H(t).start==`number`?H(t).start:void 0)))),q(e,n)},a=e=>{var n=By();X(n,7,()=>(H(t),U(()=>H(t).items)),(e,t)=>`unordered-${t}`,(e,t)=>{var n=zy();X(n,7,()=>(H(t),U(()=>H(t).tokens||[])),(e,t)=>`${e.type}-${t}`,(e,t)=>{var n=li(),r=R(n),i=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).text)))),q(e,n)},a=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).raw)))),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).type===`text`)?e(i):e(a,-1)}),q(e,n)}),j(n),q(e,n)}),j(n),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).ordered)?e(i):e(a,-1)}),q(e,n)},m=Jt(()=>(H(t),U(()=>c(H(t))))),h=e=>{var n=Vy(),r=L(n),i=L(r,!0);j(r),j(n),V(()=>J(i,(H(t),U(()=>H(t).text)))),q(e,n)},g=Jt(()=>(H(t),U(()=>l(H(t))))),_=e=>{var n=Gy(),r=L(n),i=L(r);X(i,7,()=>(H(t),U(()=>H(t).header)),(e,t)=>`${e.text}-${t}`,(e,t)=>{var n=Hy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)}),j(i),j(r);var a=z(r);X(a,7,()=>(H(t),U(()=>H(t).rows)),(e,t)=>`row-${t}`,(e,t)=>{var n=Wy();X(n,7,()=>H(t),(e,t)=>`${e.text}-${t}`,(e,t)=>{var n=Uy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)}),j(n),q(e,n)}),j(a),j(n),q(e,n)},v=Jt(()=>(H(t),U(()=>u(H(t))))),y=e=>{q(e,Ky())},b=e=>{q(e,qy())},x=e=>{var n=Jy(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).text)))),q(e,n)},S=e=>{var n=ci();V(()=>J(n,(H(t),U(()=>H(t).raw)))),q(e,n)};Y(r,e=>{H(t),U(()=>H(t).type===`heading`)?e(d):(H(t),U(()=>H(t).type===`paragraph`)?e(f,1):H(m)?e(p,2):H(g)?e(h,3):H(v)?e(_,4):(H(t),U(()=>H(t).type===`space`)?e(y,5):(H(t),U(()=>H(t).type===`hr`)?e(b,6):(H(t),U(()=>H(t).type===`blockquote`)?e(x,7):e(S,-1)))))}),q(e,n)}),j(d),q(e,d),Ge()}var Zy=K(`<div class="load-more-spinner svelte-h6z84x"><!> <span>Loading older history...</span></div>`),Qy=K(`<div style="text-align:center;padding:80px 20px;color:var(--color-text-muted);"><!> <div style="font-size:1rem;margin-top:16px;font-weight:600;">No activity found</div> <div style="font-size:0.875rem;opacity:0.7;">Events will appear here as they happen.</div></div>`),$y=K(`<div class="action-sub svelte-h6z84x"> </div>`),eb=K(`<button class="read-more-btn svelte-h6z84x"> </button>`),tb=K(`<div class="bubble-row bubble-row-left animate-slide-in-left svelte-h6z84x"><div class="chat-avatar mcp-avatar svelte-h6z84x"><!></div> <div class="bubble-wrap svelte-h6z84x"><div class="tail tail-left svelte-h6z84x"></div> <div class="chat-bubble chat-bubble-mcp svelte-h6z84x" style="--bubble-bg-light: #ffffff; --bubble-bg-dark: #202c33;"><div class="mcp-sender svelte-h6z84x">MCP Node</div> <div class="markdown-body"><!></div> <!> <div class="bubble-meta svelte-h6z84x"><span class="bubble-time svelte-h6z84x"> </span></div></div></div></div>`),nb=K(`<div class="bubble-row bubble-row-right animate-slide-in-right svelte-h6z84x"><div class="bubble-wrap svelte-h6z84x"><div class="chat-bubble chat-bubble-action svelte-h6z84x" style="--bubble-bg-light: #dcf8c6; --bubble-bg-dark: #056162;"><div class="action-badge svelte-h6z84x"><!> <span> </span></div> <div class="action-main svelte-h6z84x"> </div> <!> <div class="bubble-meta svelte-h6z84x"><span class="bubble-time svelte-h6z84x"> </span> <span class="bubble-status svelte-h6z84x"><!></span></div></div> <div class="tail tail-right svelte-h6z84x"></div></div> <div class="chat-avatar agent-avatar svelte-h6z84x"><!></div></div> <!>`,1),rb=K(`<div class="date-header svelte-h6z84x"><span class="svelte-h6z84x"> </span></div> <!>`,1),ib=K(`<div class="chat-container-viewport svelte-h6z84x"><div class="chat-container svelte-h6z84x"><!> <!></div></div>`);function ab(e,t){We(t,!1);let n=()=>P(d,`$recentActionsPage`,o),r=()=>P(f,`$handlerState`,o),i=()=>P(u,`$recentActions`,o),a=()=>P(l,`$groupedActions`,o),[o,s]=pt(),c=Ty(Q(t,`onLoadPage`,8,async()=>{})()),{groupedActions:l,recentActions:u,recentActionsPage:d}=c,f=c,p=F(void 0),m;Ma(()=>{n()<=1&&!r().isLoadingMore&&i().length>0&&c.scrollToBottom(H(p),`instant`)}),Oa(()=>(Pr().then(()=>{c.scrollToBottom(H(p),`instant`),H(p)&&(m=e=>c.handleScroll(e,H(p)),H(p).addEventListener(`scroll`,m))}),()=>{H(p)&&m&&H(p).removeEventListener(`scroll`,m)})),Ta();var h=ib(),g=L(h),_=L(g),v=e=>{var t=Zy();$(L(t),{name:`refresh-cw`,size:14,className:`animate-spin`}),Ne(2),j(t),q(e,t)};Y(_,e=>{r(),U(()=>r().isLoadingMore)&&e(v)});var y=z(_,2),b=e=>{var t=Qy();$(L(t),{name:`activity`,size:48,strokeWidth:1}),Ne(4),j(t),q(e,t)},x=e=>{var t=li();X(R(t),1,a,e=>e.date,(e,t)=>{var n=rb(),i=R(n),a=L(i),o=L(a,!0);j(a),j(i),X(z(i,2),1,()=>(H(t),U(()=>H(t).items)),e=>e.id,(e,t)=>{let n=Yt(()=>(H(t),U(()=>c.getLabel(H(t))))),i=Yt(()=>(H(t),U(()=>c.getConfig(H(t).action))));var a=nb(),o=R(a),s=L(o),l=L(s),u=L(l),d=L(u);$(d,{get name(){return W(H(i)),U(()=>H(i).icon)},size:10,strokeWidth:2.5});var f=z(d,2),p=L(f,!0);j(f),j(u);var m=z(u,2),h=L(m,!0);j(m);var g=z(m,2),_=e=>{var t=$y(),r=L(t,!0);j(t),V(()=>J(r,(W(H(n)),U(()=>H(n).sub)))),q(e,t)};Y(g,e=>{W(H(n)),U(()=>H(n).sub)&&e(_)});var v=z(g,2),y=L(v),b=L(y,!0);j(y);var x=z(y,2);$(L(x),{name:`check-check`,size:12,strokeWidth:2}),j(x),j(v),j(l),Ne(2),j(s);var S=z(s,2);$(L(S),{name:`bot`,size:14,strokeWidth:2}),j(S),j(o);var C=z(o,2),w=e=>{let n=Yt(()=>(H(t),U(()=>c.parseResponse(H(t).response)))),i=Yt(()=>(r(),H(t),U(()=>r().expandedResponses.has(H(t).id))));var a=tb(),o=L(a);$(L(o),{name:`cpu`,size:14,strokeWidth:2}),j(o);var s=z(o,2),l=z(L(s),2),u=z(L(l),2);Xy(L(u),{get content(){return W(H(n)),U(()=>H(n).text)}}),j(u);var d=z(u,2),f=e=>{var n=eb(),r=L(n,!0);j(n),V(()=>J(r,H(i)?`Show less`:`Read more`)),G(`click`,n,()=>c.toggleExpand(H(t).id)),q(e,n)};Y(d,e=>{W(H(n)),U(()=>H(n).isLong)&&e(f)});var p=z(d,2),m=L(p),h=L(m,!0);j(m),j(p),j(l),j(s),j(a),V(e=>{Ji(u,`font-size:0.82rem; ${(W(H(i)),W(H(n)),U(()=>!H(i)&&H(n).isLong?`max-height: 200px; overflow: hidden; mask-image: linear-gradient(to bottom, black 70%, transparent 100%);`:``))??``}`),J(h,e)},[()=>(H(t),U(()=>c.formatTime(H(t).created_at)))]),q(e,a)};Y(C,e=>{H(t),U(()=>H(t).response)&&e(w)}),V(e=>{Ji(u,`color:${(W(H(i)),U(()=>H(i).color))??``};background:${(W(H(i)),U(()=>H(i).bgAlpha))??``};`),J(p,(W(H(i)),U(()=>H(i).label))),J(h,(W(H(n)),U(()=>H(n).main))),J(b,e)},[()=>(H(t),U(()=>c.formatTime(H(t).created_at)))]),q(e,a)}),V(()=>J(o,(H(t),U(()=>H(t).date)))),q(e,n)}),q(e,t)};Y(y,e=>{i(),U(()=>i().length===0)?e(b):e(x,-1)}),j(g),j(h),Sa(h,e=>I(p,e),()=>H(p)),q(e,h),Ge(),s()}var ob={backlog:[{next:`pending`,label:`Move to To Do`,color:`#0ea5e9`}],pending:[{next:`in_progress`,label:`Start Progress`,color:`#a855f7`}],in_progress:[{next:`completed`,label:`Mark Complete`,color:`#10b981`},{next:`blocked`,label:`Mark Blocked`,color:`#ef4444`}],blocked:[{next:`in_progress`,label:`Resume Progress`,color:`#a855f7`}],completed:[],canceled:[]};function sb(){let{subscribe:e,update:t}=M({memory:null,task:null,editingTitle:!1,editingDescription:!1,editTitle:``,editDescription:``,newComment:``,postingComment:!1,editingCommentId:null,editCommentText:``,savingComment:!1,contentCopied:!1,descCopied:!1}),n=st({subscribe:e},e=>e.task?`task`:e.memory?`memory`:null);async function r(e){await pl(e)&&(t(e=>({...e,contentCopied:!0})),setTimeout(()=>t(e=>({...e,contentCopied:!1})),2e3))}async function i(e){await pl(e)&&(t(e=>({...e,descCopied:!0})),setTimeout(()=>t(e=>({...e,descCopied:!1})),2e3))}async function a(n,r,i){let a=N({subscribe:e});if(a.task)try{await fo.updateTask(a.task.id,{[n]:r});let e={...a.task,[n]:r};t(t=>({...t,task:e})),i(e)}catch(e){throw console.error(`Failed to update task field ${String(n)}:`,e),e}}async function o(n){let r=N({subscribe:e}).editTitle.trim();r&&(await a(`title`,r,n),t(e=>({...e,editingTitle:!1})))}async function s(n){await a(`description`,N({subscribe:e}).editDescription,n),t(e=>({...e,editingDescription:!1}))}async function c(e,t){await a(`status`,e,t)}async function l(n){let r=N({subscribe:e});if(!(!r.task||!r.newComment.trim())){t(e=>({...e,postingComment:!0}));try{await fo.updateTask(r.task.id,{comment:r.newComment.trim()});let e=await fo.taskById(r.task.id);e&&(t(t=>({...t,task:e,newComment:``})),n(e))}catch(e){console.error(`Failed to post comment:`,e)}finally{t(e=>({...e,postingComment:!1}))}}}async function u(n){let r=N({subscribe:e});if(!(!r.editingCommentId||!r.editCommentText.trim())){t(e=>({...e,savingComment:!0}));try{if(await fo.updateTaskComment(r.editingCommentId,r.editCommentText.trim()),r.task){let e=await fo.taskById(r.task.id);e&&(t(t=>({...t,task:e})),n(e))}t(e=>({...e,editingCommentId:null,editCommentText:``}))}catch(e){console.error(`Failed to update comment:`,e)}finally{t(e=>({...e,savingComment:!1}))}}}async function d(n,r){let i=N({subscribe:e});if(confirm(`Delete this comment?`))try{if(await fo.deleteTaskComment(n),i.task){let e=await fo.taskById(i.task.id);e&&(t(t=>({...t,task:e})),r(e))}}catch(e){console.error(`Failed to delete comment:`,e)}}async function f(t,n){let r=N({subscribe:e});if(r.task&&confirm(`Are you sure you want to delete this task?`))try{await fo.deleteTask(r.task.id),t(r.task.id),n()}catch(e){alert(`Error deleting task: `+(e instanceof Error?e.message:String(e)))}}return{subscribe:e,mode:n,setMemory:e=>t(t=>({...t,memory:e,task:null})),setTask:e=>{t(e?t=>({...t,task:e,memory:null,editTitle:e.title,editDescription:e.description||``,editingTitle:!1,editingDescription:!1,newComment:``,editingCommentId:null}):e=>({...e,task:null}))},toggleEditTitle:e=>t(t=>({...t,editingTitle:e})),toggleEditDescription:e=>t(t=>({...t,editingDescription:e})),setEditTitle:e=>t(t=>({...t,editTitle:e})),setEditDescription:e=>t(t=>({...t,editDescription:e})),setNewComment:e=>t(t=>({...t,newComment:e})),startEditComment:e=>t(t=>({...t,editingCommentId:e.id,editCommentText:e.comment})),cancelEditComment:()=>t(e=>({...e,editingCommentId:null,editCommentText:``})),setEditCommentText:e=>t(t=>({...t,editCommentText:e})),handleCopyContent:r,handleCopyDesc:i,saveTitle:o,saveDescription:s,advanceStatus:c,postComment:l,saveEditComment:u,deleteComment:d,deleteTask:f,handleCommentKeydown:(e,t)=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&l(t)},reset:()=>{t(e=>({...e,memory:null,task:null,editingTitle:!1,editingDescription:!1,editTitle:``,editDescription:``,newComment:``,editingCommentId:null,editCommentText:``,postingComment:!1,savingComment:!1,contentCopied:!1,descCopied:!1}))},handleTitleKeydown:(e,n)=>{e.key===`Enter`&&o(n),e.key===`Escape`&&t(e=>({...e,editingTitle:!1}))}}}var cb=K(`<div><span style="margin-bottom:8px;display:inline-flex;"> </span> <div class="drawer-title svelte-9n99wb"> </div></div>`),lb=K(`<div style="display:flex;gap:6px;align-items:center;"><input class="form-input" style="font-size:0.95rem;font-weight:700;flex:1;"/> <button class="btn btn-accent" style="padding:4px 10px;font-size:0.75rem;">Save</button> <button class="btn btn-ghost" style="padding:4px 10px;font-size:0.75rem;">✕</button></div>`),ub=K(`<button class="drawer-title editable-title svelte-9n99wb" title="Click to edit title" style="text-align: left; background: none; border: none; padding: 0; width: 100%; cursor: pointer;"> <span class="edit-hint svelte-9n99wb">✏️</span></button>`),db=K(`<div style="flex:1;min-width:0;"><div style="display:flex;align-items:center;gap:8px;margin-bottom:6px;"><span> </span> <span style="font-size:0.7rem;font-weight:700;color:var(--color-text-muted);"> </span></div> <!></div>`),fb=K(`<div class="meta-cell svelte-9n99wb"><div class="meta-label svelte-9n99wb"> </div> <div class="meta-value svelte-9n99wb"> </div></div>`),pb=K(`<span class="tag-chip svelte-9n99wb"> </span>`),mb=K(`<div style="margin-bottom:16px;"><div class="section-label svelte-9n99wb">Tags</div> <div style="display:flex;flex-wrap:wrap;gap:6px;"></div></div>`),hb=K(`<div style="margin-top:16px;"><div class="section-label svelte-9n99wb">Metadata</div> <pre class="json-pre svelte-9n99wb"> </pre></div>`),gb=K(`<div class="meta-grid svelte-9n99wb" style="margin-bottom:16px;"></div> <!> <div><div class="section-label svelte-9n99wb" style="display:flex; justify-content:space-between; align-items:center;"><span>Content</span> <button class="btn btn-ghost btn-icon" title="Copy to clipboard" style="width:20px; height:20px; padding:0; border:none; background:transparent;"><!></button></div> <div class="markdown-body md-card svelte-9n99wb"><!></div></div> <!>`,1),_b=K(`<button class="btn"> </button>`),vb=K(`<div style="margin-bottom:16px;display:flex;flex-wrap:wrap;gap:8px;"></div>`),yb=K(`<button class="btn btn-ghost" style="color: #ef4444;"><svg style="margin-right:4px;" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg> Delete Task</button>`),bb=K(`<div class="meta-cell svelte-9n99wb"><div class="meta-label svelte-9n99wb"> </div> <div class="meta-value svelte-9n99wb"> </div></div>`),xb=K(`<button class="btn btn-ghost" style="padding:1px 6px;font-size:0.68rem;border-radius:4px;">Edit</button>`),Sb=K(`<textarea class="form-textarea" rows="8" style="font-size:0.82rem;font-family:'JetBrains Mono',monospace;"></textarea> <div style="display:flex;gap:6px;margin-top:6px;"><button class="btn btn-accent" style="font-size:0.78rem;">Save</button> <button class="btn btn-ghost" style="font-size:0.78rem;">Cancel</button></div>`,1),Cb=K(`<div class="markdown-body md-card svelte-9n99wb"><!></div>`),wb=K(`<div style="color:var(--color-text-muted);font-size:0.82rem;font-style:italic;">No description yet. Click Edit to add one.</div>`),Tb=K(`<span style="font-size:0.65rem;color:var(--color-text-muted);"> </span>`),Eb=K(`<button class="btn btn-ghost" style="padding:1px 5px;font-size:0.65rem;" title="Edit comment">✏️</button> <button class="btn btn-ghost" style="padding:1px 5px;font-size:0.65rem;color:#ef4444;" title="Delete comment">🗑</button>`,1),Db=K(`<textarea class="form-textarea" rows="3" style="font-size:0.8rem;margin-bottom:6px;"></textarea> <div style="display:flex;gap:6px;"><button class="btn btn-accent" style="font-size:0.75rem;"> </button> <button class="btn btn-ghost" style="font-size:0.75rem;">Cancel</button></div>`,1),Ob=K(`<div class="markdown-body" style="font-size:0.78rem;color:var(--color-text);line-height:1.5;"><!></div>`),kb=K(`<div class="comment-card svelte-9n99wb"><div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;"><div style="display:flex;align-items:center;gap:6px;"><div class="comment-avatar svelte-9n99wb"> </div> <span style="font-size:0.72rem;font-weight:600;color:var(--color-text);"> </span> <!></div> <div style="display:flex;align-items:center;gap:8px;"><span style="font-size:0.65rem;color:var(--color-text-muted);"> </span> <!></div></div> <!></div>`),Ab=K(`<div style="display:flex;flex-direction:column;gap:8px;margin-bottom:12px;"></div>`),jb=K(`<!> <div style="margin-bottom:16px;"><div class="section-label svelte-9n99wb">Status</div> <div style="display:flex; justify-content:space-between; align-items:center;"><span style="font-size:0.85rem; padding: 4px 10px;"> </span> <!></div></div> <div class="meta-grid svelte-9n99wb" style="margin-bottom:16px;"></div> <div style="margin-bottom:16px;"><div class="section-label svelte-9n99wb" style="display:flex;align-items:center;gap:6px;width:100%;"><span style="flex:1;">Description</span> <button class="btn btn-ghost btn-icon" title="Copy to clipboard" style="width:20px; height:20px; padding:0; border:none; background:transparent; margin-right:4px;"><!></button> <!></div> <!></div> <div><div class="section-label svelte-9n99wb"> </div> <div class="comment-compose svelte-9n99wb" style="margin-bottom:16px;"><textarea class="form-textarea" placeholder="Add a comment or status note…" rows="2" style="font-size:0.82rem;resize:vertical;"></textarea> <div style="display:flex;justify-content:space-between;align-items:center;margin-top:6px;"><span style="font-size:0.65rem;color:var(--color-text-muted);">Ctrl+Enter to submit</span> <button class="btn btn-accent" style="font-size:0.78rem;"> </button></div></div> <!></div>`,1),Mb=K(`<div class="drawer-overlay" role="button" tabindex="0" aria-label="Close drawer"></div> <div class="drawer-panel animate-fade-in" role="dialog" aria-modal="true" tabindex="-1"><div class="drawer-header svelte-9n99wb"><!> <button class="btn btn-ghost btn-icon" aria-label="Close" style="flex-shrink:0;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6 6 18M6 6l12 12"></path></svg></button></div> <div class="drawer-body svelte-9n99wb"><!> <!></div></div>`,1);function Nb(e,t){We(t,!1);let n=()=>P(p,`$mode`,i),r=()=>P(f,`$handler`,i),[i,a]=pt(),o=Q(t,`memory`,8,null),s=Q(t,`task`,8,null),c=Q(t,`open`,8,!1),l=Q(t,`onClose`,8,()=>{}),u=Q(t,`onTaskUpdated`,8,()=>{}),d=Q(t,`onTaskDeleted`,8,()=>{}),f=sb(),{mode:p}=f;function m(e){e.key===`Escape`&&l()()}B(()=>(W(c()),W(o()),W(s())),()=>{c()?(f.setMemory(o()),f.setTask(s())):f.reset()}),Un(),Ta();var h=li(),g=R(h),_=e=>{var i=Mb(),a=R(i),o=z(a,2),s=L(o),c=L(s),p=e=>{var t=cb(),n=L(t),i=L(n,!0);j(n);var a=z(n,2),o=L(a,!0);j(a),j(t),V(()=>{Ki(n,1,`type-chip type-${(r(),U(()=>r().memory.type))??``}`,`svelte-9n99wb`),J(i,(r(),U(()=>r().memory.type))),J(o,(r(),U(()=>r().memory.title||`Untitled Memory`)))}),q(e,t)},h=e=>{var t=db(),n=L(t),i=L(n),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(n);var c=z(n,2),l=e=>{var t=lb(),n=L(t);ca(n);var i=z(n,2),a=z(i,2);j(t),Z(n,()=>r().editTitle,e=>ht(f,U(r).editTitle=e,U(r))),G(`keydown`,n,e=>f.handleTitleKeydown(e,u())),G(`click`,i,()=>f.saveTitle(u())),G(`click`,a,()=>f.toggleEditTitle(!1)),q(e,t)},d=e=>{var t=ub(),n=L(t);Ne(),j(t),V(()=>J(n,`${(r(),U(()=>r().task?.title??``))??``} `)),G(`click`,t,()=>f.toggleEditTitle(!0)),q(e,t)};Y(c,e=>{r(),U(()=>r().editingTitle)?e(l):e(d,-1)}),j(t),V((e,t)=>{Ki(i,1,`status-chip ${e??``}`,`svelte-9n99wb`),J(a,t),J(s,(r(),U(()=>r().task.task_code||`NEW-TASK`)))},[()=>(W(ol),r(),U(()=>ol(r().task.status||`pending`))),()=>(W(sl),r(),U(()=>sl(r().task.status||``)))]),q(e,t)};Y(c,e=>{n(),r(),U(()=>n()===`memory`&&r().memory)?e(p):(n(),r(),U(()=>n()===`task`&&r().task)&&e(h,1))});var g=z(c,2);j(s);var _=z(s,2),v=L(_),y=e=>{var t=gb(),n=R(t);X(n,5,()=>(r(),W(il),U(()=>[{label:`Importance`,val:r().memory?.importance||0},{label:`Hit Count`,val:r().memory?.hit_count??0},{label:`Created`,val:il(r().memory?.created_at)},{label:`Updated`,val:il(r().memory?.updated_at)}])),e=>e.label,(e,t)=>{var n=fb(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),V(()=>{J(i,(H(t),U(()=>H(t).label))),J(o,(H(t),U(()=>H(t).val)))}),q(e,n)}),j(n);var i=z(n,2),a=e=>{var t=mb(),n=z(L(t),2);X(n,5,()=>(r(),U(()=>r().memory.tags)),e=>e,(e,t)=>{var n=pb(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(n),j(t),q(e,t)};Y(i,e=>{r(),U(()=>r().memory.tags?.length)&&e(a)});var o=z(i,2),s=L(o),c=z(L(s),2),l=L(c);{let e=Yt(()=>(r(),U(()=>r().contentCopied?`check`:`copy`))),t=Yt(()=>(r(),U(()=>r().contentCopied?`text-success`:``)));$(l,{get name(){return H(e)},size:12,strokeWidth:2,get className(){return H(t)}})}j(c),j(s);var u=z(s,2),d=L(u);{let e=Yt(()=>(r(),U(()=>r().memory?.content||``)));Xy(d,{get content(){return H(e)}})}j(u),j(o);var p=z(o,2),m=e=>{var t=hb(),n=z(L(t),2),i=L(n,!0);j(n),j(t),V(e=>J(i,e),[()=>(r(),U(()=>JSON.stringify(r().memory.metadata,null,2)))]),q(e,t)},h=Jt(()=>(r(),U(()=>r().memory.metadata&&Object.keys(r().memory.metadata).length>0)));Y(p,e=>{H(h)&&e(m)}),G(`click`,c,()=>f.handleCopyContent(r().memory?.content||``)),q(e,t)};Y(v,e=>{n(),r(),U(()=>n()===`memory`&&r().memory)&&e(y)});var b=z(v,2),x=e=>{var t=jb(),n=R(t),i=e=>{var t=vb();X(t,5,()=>(W(ob),r(),U(()=>ob[r().task.status])),e=>e.next,(e,t)=>{var n=_b(),r=L(n,!0);j(n),V(()=>{Ji(n,`background:${(H(t),U(()=>H(t).color))??``};color:#fff;border:none;padding:6px 14px;font-size:0.78rem;font-weight:700;border-radius:8px;cursor:pointer;`),J(r,(H(t),U(()=>H(t).label)))}),G(`click`,n,()=>f.advanceStatus(H(t).next,u())),q(e,n)}),j(t),q(e,t)};Y(n,e=>{W(ob),r(),U(()=>ob[r().task.status]?.length)&&e(i)});var a=z(n,2),o=z(L(a),2),s=L(o),c=L(s,!0);j(s);var p=z(s,2),m=e=>{var t=yb();G(`click`,t,()=>f.deleteTask(d(),l())),q(e,t)};Y(p,e=>{r(),U(()=>r().task?.status!==`completed`)&&e(m)}),j(o),j(a);var h=z(a,2);X(h,5,()=>(W(cl),r(),W(il),U(()=>[{label:`Priority`,val:cl(r().task?.priority||1)},{label:`Phase`,val:r().task?.phase||`—`},{label:`Agent`,val:r().task?.agent||`—`},{label:`Updated`,val:il(r().task?.updated_at)},{label:`Parent`,val:r().task?.parent_code||`—`},{label:`Depends On`,val:r().task?.depends_on_code||`—`}])),e=>e.label,(e,t)=>{var n=bb(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),V(()=>{J(i,(H(t),U(()=>H(t).label))),J(o,(H(t),U(()=>H(t).val)))}),q(e,n)}),j(h);var g=z(h,2),_=L(g),v=z(L(_),2),y=L(v);{let e=Yt(()=>(r(),U(()=>r().descCopied?`check`:`copy`))),t=Yt(()=>(r(),U(()=>r().descCopied?`text-success`:``)));$(y,{get name(){return H(e)},size:12,strokeWidth:2,get className(){return H(t)}})}j(v);var b=z(v,2),x=e=>{var t=xb();G(`click`,t,()=>f.toggleEditDescription(!0)),q(e,t)};Y(b,e=>{r(),U(()=>!r().editingDescription)&&e(x)}),j(_);var S=z(_,2),C=e=>{var t=Sb(),n=R(t);On(n);var i=z(n,2),a=L(i),o=z(a,2);j(i),Z(n,()=>r().editDescription,e=>ht(f,U(r).editDescription=e,U(r))),G(`click`,a,()=>f.saveDescription(u())),G(`click`,o,()=>f.toggleEditDescription(!1)),q(e,t)},w=e=>{var t=Cb(),n=L(t);{let e=Yt(()=>(r(),U(()=>r().task.description||``)));Xy(n,{get content(){return H(e)}})}j(t),q(e,t)},T=e=>{q(e,wb())};Y(S,e=>{r(),U(()=>r().editingDescription)?e(C):(r(),U(()=>r().task?.description)?e(w,1):e(T,-1))}),j(g);var E=z(g,2),D=L(E),ee=L(D);j(D);var te=z(D,2),ne=L(te);On(ne);var re=z(ne,2),ie=z(L(re),2),ae=L(ie,!0);j(ie),j(re),j(te);var oe=z(te,2),O=e=>{var t=Ab();X(t,5,()=>(r(),U(()=>r().task.comments)),e=>e.id,(e,t)=>{var n=kb(),i=L(n),a=L(i),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c);var d=z(c,2),p=e=>{var n=Tb(),r=L(n);j(n),V((e,t)=>J(r,`${e??``} → ${t??``}`),[()=>(W(sl),H(t),U(()=>sl(H(t).previous_status))),()=>(W(sl),H(t),U(()=>sl(H(t).next_status)))]),q(e,n)};Y(d,e=>{H(t),U(()=>H(t).previous_status&&H(t).next_status)&&e(p)}),j(a);var m=z(a,2),h=L(m),g=L(h,!0);j(h);var _=z(h,2),v=e=>{var n=Eb(),r=R(n),i=z(r,2);G(`click`,r,()=>f.startEditComment(H(t))),G(`click`,i,()=>f.deleteComment(H(t).id,u())),q(e,n)};Y(_,e=>{H(t),U(()=>H(t).id)&&e(v)}),j(m),j(i);var y=z(i,2),b=e=>{var t=Db(),n=R(t);On(n);var i=z(n,2),a=L(i),o=L(a,!0);j(a);var s=z(a,2);j(i),V(()=>{a.disabled=(r(),U(()=>r().savingComment)),J(o,(r(),U(()=>r().savingComment?`Saving…`:`Save`)))}),Z(n,()=>r().editCommentText,e=>ht(f,U(r).editCommentText=e,U(r))),G(`click`,a,()=>f.saveEditComment(u())),G(`click`,s,function(...e){f.cancelEditComment?.apply(this,e)}),q(e,t)},x=e=>{var n=Ob();Xy(L(n),{get content(){return H(t),U(()=>H(t).comment)}}),j(n),q(e,n)};Y(y,e=>{r(),H(t),U(()=>r().editingCommentId===H(t).id)?e(b):e(x,-1)}),j(n),V((e,n)=>{J(s,e),J(l,(H(t),U(()=>H(t).agent||`Unknown`))),J(g,n)},[()=>(H(t),U(()=>(H(t).agent||`U`).charAt(0).toUpperCase())),()=>(W(il),H(t),U(()=>il(H(t).created_at)))]),q(e,n)}),j(t),q(e,t)};Y(oe,e=>{r(),U(()=>r().task?.comments?.length)&&e(O)}),j(E),V((e,t,n)=>{Ki(s,1,`status-chip ${e??``}`,`svelte-9n99wb`),J(c,t),J(ee,`Activity (${(r(),U(()=>r().task?.comments?.length??0))??``})`),ie.disabled=n,J(ae,(r(),U(()=>r().postingComment?`Posting…`:`Post Comment`)))},[()=>(W(ol),r(),U(()=>ol(r().task?.status||`pending`))),()=>(W(sl),r(),U(()=>sl(r().task?.status||``))),()=>(r(),U(()=>r().postingComment||!r().newComment.trim()))]),G(`click`,v,()=>f.handleCopyDesc(r().task?.description||``)),Z(ne,()=>r().newComment,e=>ht(f,U(r).newComment=e,U(r))),G(`keydown`,ne,e=>f.handleCommentKeydown(e,u())),G(`click`,ie,()=>f.postComment(u())),q(e,t)};Y(b,e=>{n(),r(),U(()=>n()===`task`&&r().task)&&e(x)}),j(_),j(o),G(`click`,a,function(...e){l()?.apply(this,e)}),G(`keydown`,a,m),G(`click`,g,function(...e){l()?.apply(this,e)}),G(`click`,o,Ca(function(e){Da.call(this,t,e)})),G(`keydown`,o,m),q(e,i)};Y(g,e=>{c()&&n()&&e(_)}),q(e,h),Ge(),a()}function Pb(){let e=M({item:null,toolArgs:{},toolRunning:!1,toolResult:null,toolError:null,copied:!1}),{subscribe:t,update:n}=e,r=st(e,e=>e.item?.type?e.item.type.charAt(0).toUpperCase()+e.item.type.slice(1):``);function i(t,r){N(e).item!==t&&n(e=>{let n={};return t&&t.type===`tool`&&t.data?.inputSchema?.properties?.repo&&r&&(n.repo=r),{...e,item:t,toolArgs:n,toolResult:null,toolError:null,toolRunning:!1}})}function a(e,t){n(n=>({...n,toolArgs:{...n.toolArgs,[e]:t}}))}async function o(){let t=N(e),r=t.item;if(!(!r||r.type!==`tool`)){n(e=>({...e,toolRunning:!0,toolResult:null,toolError:null}));try{let e={};if(r.data.inputSchema?.properties){for(let[n,r]of Object.entries(t.toolArgs))if(!(r===void 0||r===``))try{e[n]=JSON.parse(r)}catch{e[n]=r}}let i=await fo.callTool(r.data.name,e);n(e=>({...e,toolResult:JSON.stringify(i,null,2)}))}catch(e){let t=e instanceof Error?e.message:String(e);n(e=>({...e,toolError:t}))}finally{n(e=>({...e,toolRunning:!1}))}}}async function s(e){await pl(e)&&(n(e=>({...e,copied:!0})),setTimeout(()=>n(e=>({...e,copied:!1})),2e3))}function c(e,t){e.target===e.currentTarget&&t()}function l(e){e.stopPropagation()}function u(){n(e=>({...e,item:null,toolArgs:{},toolRunning:!1,toolResult:null,toolError:null,copied:!1}))}return{subscribe:t,typeLabel:r,setItem:i,setToolArg:a,runTool:o,copyToClipboardWrapper:s,handleOverlayClick:c,handlePanelClick:l,reset:u}}var Fb=K(`<div class="drawer-section svelte-17ad9lv"><div class="section-label svelte-17ad9lv">Description</div> <div class="markdown-body md-card svelte-17ad9lv"><!></div></div>`),Ib=K(`<span style="font-size: 0.6rem; color: #ef4444; font-weight: bold; background: rgba(239, 68, 68, 0.1); padding: 2px 4px; border-radius: 4px;">REQ</span>`),Lb=K(`<div style="font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 6px; line-height: 1.2;"> </div>`),Rb=K(`<div style="border: 1px solid var(--color-border); border-radius: 4px; padding: 8px 10px; margin-bottom: 6px; background: rgba(0,0,0,0.01);"><div style="display:flex; justify-content:space-between; align-items:center; margin-bottom: 4px;"><span style="color: var(--color-text); font-family: monospace; font-size: 0.8rem; font-weight: 600;"> </span> <div style="display:flex; gap: 8px; align-items: center;"><span style="font-size: 0.7rem; color: var(--color-text-muted);"> </span> <!></div></div> <!> <input type="text" class="form-input" style="font-size:0.8rem; padding: 4px 8px; border-radius: 4px; min-height: 28px;"/></div>`),zb=K(`<div class="section-label svelte-17ad9lv">Playground (Input Parameters)</div> <!>`,1),Bb=K(`<div class="section-label svelte-17ad9lv">Playground</div> <div style="font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 8px;">No arguments required.</div>`,1),Vb=K(`<div style="margin-top: 12px; border: 1px solid #fecaca; background: #fef2f2; color: #ef4444; padding: 12px; border-radius: 8px; font-size: 0.85rem;"><strong>Error:</strong> </div>`),Hb=K(`<div style="margin-top: 12px;" class="drawer-section svelte-17ad9lv"><div class="section-label svelte-17ad9lv" style="display:flex; justify-content:space-between; align-items:center;"><span>Response</span> <button class="btn btn-ghost btn-icon" title="Copy to clipboard" style="width:24px; height:24px; padding:0; border:none; background:transparent;"><!></button></div> <div class="md-card markdown-body svelte-17ad9lv" style="padding: 1px 16px;"><!></div></div>`),Ub=K(`<div class="drawer-section svelte-17ad9lv"><!> <div style="margin-top: 8px;"><button class="btn btn-accent" style="width:100%"> </button></div> <!> <!></div>`),Wb=K(`<span style="font-size: 0.7rem; color: #ef4444; font-weight: bold;">REQUIRED</span>`),Gb=K(`<div style="font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 6px;"> </div>`),Kb=K(`<div style="border: 1px solid var(--color-border); border-radius: 8px; padding: 12px; margin-bottom: 8px; background: rgba(0,0,0,0.02);"><div style="display:flex; justify-content:space-between; align-items:flex-start; margin-bottom: 4px;"><strong style="color: var(--color-text); font-family: monospace;"> </strong> <!></div> <!></div>`),qb=K(`<div style="font-size: 0.85rem; color: var(--color-text-muted); font-style: italic;">No arguments.</div>`),Jb=K(`<div class="drawer-section svelte-17ad9lv"><div class="section-label svelte-17ad9lv">Arguments</div> <!> <!></div>`),Yb=K(`<div class="md-card svelte-17ad9lv" style="margin-bottom: 8px;"><div style="font-size: 0.7rem; font-weight: bold; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 8px;"> </div> <div class="markdown-body"><!></div></div>`),Xb=K(`<div class="drawer-section svelte-17ad9lv"><div class="section-label svelte-17ad9lv">Template</div> <!></div>`),Zb=K(`<div style="font-size: 0.85rem; margin-bottom: 8px;"><span style="color: var(--color-text-muted);">URI:</span> <code style="font-size: 0.8rem; background: var(--color-bg); padding: 2px 4px; border-radius: 4px; border: 1px solid var(--color-border);"> </code></div>`),Qb=K(`<div style="font-size: 0.85rem;"><span style="color: var(--color-text-muted);">MIME Type:</span> <span> </span></div>`),$b=K(`<div class="drawer-section svelte-17ad9lv"><div class="section-label svelte-17ad9lv">Details</div> <!> <!></div>`),ex=K(`<div class="drawer-overlay" role="button" tabindex="0" aria-label="Close drawer" style="z-index: 100;"></div> <div class="drawer-panel animate-fade-in" role="dialog" aria-modal="true" tabindex="-1" style="z-index: 101;"><div class="drawer-header svelte-17ad9lv"><div style="flex:1; min-width:0; padding-right:16px;"><span class="type-chip svelte-17ad9lv" style="margin-bottom:8px;display:inline-flex;"> </span> <div class="drawer-title svelte-17ad9lv"> </div></div> <button class="btn btn-ghost btn-icon" aria-label="Close" style="flex-shrink:0;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6 6 18M6 6l12 12"></path></svg></button></div> <div class="drawer-body svelte-17ad9lv"><!> <!> <!> <!> <!></div></div>`,1);function tx(e,t){We(t,!1);let n=()=>P(La,`$currentRepo`,a),r=()=>P(u,`$handler`,a),i=()=>P(d,`$typeLabel`,a),[a,o]=pt(),s=Q(t,`item`,8,null),c=Q(t,`open`,8,!1),l=Q(t,`onClose`,8,()=>{}),u=Pb(),d=u.typeLabel;function f(e){e.key===`Escape`&&l()()}B(()=>(W(c()),W(s()),n()),()=>{c()?u.setItem(s(),n()):u.reset()}),Un(),Ta();var p=li(),m=R(p),h=e=>{var t=ex(),n=R(t),a=z(n,2),o=L(a),s=L(o),c=L(s),d=L(c,!0);j(c);var p=z(c,2),m=L(p,!0);j(p),j(s);var h=z(s,2);j(o);var _=z(o,2),v=L(_),y=e=>{var t=Fb(),n=z(L(t),2);Xy(L(n),{get content(){return r(),U(()=>r().item.data.description)}}),j(n),j(t),q(e,t)};Y(v,e=>{r(),U(()=>r().item.data.description)&&e(y)});var b=z(v,2),x=e=>{var t=Ub(),n=L(t),i=e=>{var t=zb();X(z(R(t),2),1,()=>(r(),U(()=>Object.entries(r().item.data.inputSchema.properties))),([e,t])=>e,(e,t)=>{var n=Jt(()=>g(H(t),2));let i=()=>H(n)[0],a=()=>H(n)[1];var o=Rb(),s=L(o),c=L(s),l=L(c,!0);j(c);var d=z(c,2),f=L(d),p=L(f,!0);j(f);var m=z(f,2),h=e=>{q(e,Ib())},_=Jt(()=>(r(),i(),U(()=>r().item.data.inputSchema.required?.includes(i()))));Y(m,e=>{H(_)&&e(h)}),j(d),j(s);var v=z(s,2),y=e=>{var t=Lb(),n=L(t,!0);j(t),V(()=>J(n,(a(),U(()=>a().description)))),q(e,t)};Y(v,e=>{a(),U(()=>a().description)&&e(y)});var b=z(v,2);ca(b),j(o),V(()=>{J(l,i()),J(p,(a(),U(()=>a().type))),fa(b,`placeholder`,`Value for ${i()}`),la(b,(r(),i(),U(()=>r().toolArgs[i()]||``)))}),G(`input`,b,e=>u.setToolArg(i(),e.currentTarget.value)),q(e,o)}),q(e,t)},a=Jt(()=>(r(),U(()=>r().item.data.inputSchema?.properties&&Object.keys(r().item.data.inputSchema.properties).length>0))),o=e=>{var t=Bb();Ne(2),q(e,t)};Y(n,e=>{H(a)?e(i):e(o,-1)});var s=z(n,2),c=L(s),l=L(c,!0);j(c),j(s);var d=z(s,2),f=e=>{var t=Vb(),n=z(L(t));j(t),V(()=>J(n,` ${(r(),U(()=>r().toolError))??``}`)),q(e,t)};Y(d,e=>{r(),U(()=>r().toolError)&&e(f)});var p=z(d,2),m=e=>{var t=Hb(),n=L(t),i=z(L(n),2),a=L(i);{let e=Yt(()=>(r(),U(()=>r().copied?`check`:`copy`))),t=Yt(()=>(r(),U(()=>r().copied?`text-success`:``)));$(a,{get name(){return H(e)},size:14,strokeWidth:2,get className(){return H(t)}})}j(i),j(n);var o=z(n,2),s=L(o);{let e=Yt(()=>(r(),U(()=>"```json\n"+r().toolResult+"\n```")));Xy(s,{get content(){return H(e)}})}j(o),j(t),G(`click`,i,()=>u.copyToClipboardWrapper(r().toolResult||``)),q(e,t)};Y(p,e=>{r(),U(()=>r().toolResult)&&e(m)}),j(t),V(()=>{c.disabled=(r(),U(()=>r().toolRunning)),J(l,(r(),U(()=>r().toolRunning?`Running...`:`Submit`)))}),G(`click`,c,()=>u.runTool()),q(e,t)};Y(b,e=>{r(),U(()=>r().item.type===`tool`)&&e(x)});var S=z(b,2),C=e=>{var t=Jb(),n=z(L(t),2);X(n,1,()=>(r(),U(()=>r().item.data.arguments)),e=>e.name,(e,t)=>{var n=Kb(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=e=>{q(e,Wb())};Y(o,e=>{H(t),U(()=>H(t).required)&&e(s)}),j(r);var c=z(r,2),l=e=>{var n=Gb(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).description)))),q(e,n)};Y(c,e=>{H(t),U(()=>H(t).description)&&e(l)}),j(n),V(()=>J(a,(H(t),U(()=>H(t).name)))),q(e,n)});var i=z(n,2),a=e=>{q(e,qb())};Y(i,e=>{r(),U(()=>r().item.data.arguments.length===0)&&e(a)}),j(t),q(e,t)};Y(S,e=>{r(),U(()=>r().item.type===`prompt`&&r().item.data.arguments)&&e(C)});var w=z(S,2),T=e=>{var t=Xb();X(z(L(t),2),3,()=>(r(),U(()=>r().item.data.messages)),(e,t)=>`${e.role}-${t}`,(e,t)=>{var n=Yb(),r=L(n),i=L(r);j(r);var a=z(r,2),o=L(a);{let e=Yt(()=>(H(t),U(()=>typeof H(t).content==`string`?H(t).content:H(t).content.text)));Xy(o,{get content(){return H(e)}})}j(a),j(n),V(()=>J(i,`Role: ${(H(t),U(()=>H(t).role))??``}`)),q(e,n)}),j(t),q(e,t)};Y(w,e=>{r(),U(()=>r().item.type===`prompt`&&r().item.data.messages&&r().item.data.messages.length>0)&&e(T)});var E=z(w,2),D=e=>{var t=$b(),n=z(L(t),2),i=e=>{var t=Zb(),n=z(L(t),2),i=L(n,!0);j(n),j(t),V(()=>J(i,(r(),U(()=>r().item.data.uri)))),q(e,t)};Y(n,e=>{r(),U(()=>r().item?.data?.uri)&&e(i)});var a=z(n,2),o=e=>{var t=Qb(),n=z(L(t),2),i=L(n,!0);j(n),j(t),V(()=>J(i,(r(),U(()=>r().item.data.mimeType)))),q(e,t)};Y(a,e=>{r(),U(()=>r().item.data.mimeType)&&e(o)}),j(t),q(e,t)};Y(E,e=>{r(),U(()=>r().item.type===`resource`)&&e(D)}),j(_),j(a),V(()=>{J(d,i()),J(m,(r(),U(()=>r().item.data.name)))}),G(`click`,n,e=>u.handleOverlayClick(e,l())),G(`keydown`,n,f),G(`click`,h,function(...e){l()?.apply(this,e)}),G(`click`,a,function(...e){u.handlePanelClick?.apply(this,e)}),G(`keydown`,a,f),q(e,t)};Y(m,e=>{W(c()),r(),U(()=>c()&&r().item)&&e(h)}),q(e,p),Ge(),o()}function nx(e){let t=M({title:``,type:`code_fact`,content:``,importance:3,tags:``,agent:``,model:``}),n=M(!1),r=M(!1),i=M(!1),a=M(``),o=M(!1),s=null;function c(e){s=e,e?(t.set({title:e.title,type:e.type,content:e.content,importance:e.importance,tags:(e.tags||[]).join(`, `),agent:e.agent||``,model:e.model||``}),n.set(!1)):(t.set({title:``,type:`code_fact`,content:``,importance:3,tags:``,agent:``,model:``}),n.set(!0)),o.set(!1),a.set(``),r.set(!1),i.set(!1)}function l(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}async function u(){let n=N(t);if(!n.title.trim()||!n.content.trim()){a.set(`Title and Content are required.`);return}r.set(!0),a.set(``);try{let t=N(La),r={title:n.title.trim(),type:n.type,content:n.content.trim(),importance:Number(n.importance),tags:l(n.tags),agent:n.agent.trim()||void 0,model:n.model.trim()||void 0,repo:t,scope:{repo:t||``}},i;if(s)await fo.updateMemory(s.id,r),i={...s,...r,updated_at:new Date().toISOString()};else{let e=await fo.createMemory(r);i={...r,id:e.id,hit_count:0,recall_count:0,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}e.onSaved(i),e.onClose()}catch(e){a.set(e instanceof Error?e.message:`Failed to save memory.`)}finally{r.set(!1)}}async function d(){if(s&&confirm(`Permanently delete this memory? This cannot be undone.`)){i.set(!0),a.set(``);try{await fo.deleteMemory(s.id),e.onDeleted(s.id),e.onClose()}catch(e){a.set(e instanceof Error?e.message:`Failed to delete memory.`)}finally{i.set(!1)}}}return{form:t,editing:n,saving:r,deleting:i,error:a,previewMode:o,reset:c,save:u,deleteMemory:d,startEditing:()=>{n.set(!0),o.set(!1)},cancelEdit:()=>{s?(c(s),n.set(!1)):e.onClose()},togglePreview:()=>o.update(e=>!e)}}var rx=K(`<div class="modal-mode-label svelte-intd6h"> </div> <input class="form-input modal-title-input svelte-intd6h" placeholder="Memory title…"/>`,1),ix=K(`<div class="modal-mode-label svelte-intd6h">View Memory</div> <div class="modal-title-text svelte-intd6h"> </div>`,1),ax=K(`<button class="btn btn-ghost btn-sm" title="Edit memory"><!> Edit</button> <button class="btn btn-ghost btn-sm danger-btn svelte-intd6h" title="Delete memory"><!> </button>`,1),ox=K(`<div class="mem-error svelte-intd6h"><!> </div>`),sx=K(`<div class="meta-cell svelte-intd6h"><div class="meta-label svelte-intd6h"> </div> <div class="meta-value svelte-intd6h"> </div></div>`),cx=K(`<span class="tag-chip svelte-intd6h"> </span>`),lx=K(`<div class="section-block svelte-intd6h"><div class="field-label svelte-intd6h">Tags</div> <div class="tags-row svelte-intd6h"></div></div>`),ux=K(`<div class="section-block svelte-intd6h"><div class="field-label svelte-intd6h">Metadata</div> <pre class="json-pre svelte-intd6h"> </pre></div>`),dx=K(`<div style="margin-bottom:14px;"><span> </span></div> <div class="meta-grid svelte-intd6h"></div> <!> <div class="section-block svelte-intd6h"><div class="field-label svelte-intd6h">Content</div> <div class="markdown-body md-card svelte-intd6h"><!></div></div> <!>`,1),fx=K(`<option> </option>`),px=K(`<span> </span>`),mx=K(`<span style="color:var(--color-text-muted);font-style:italic;">Nothing to preview yet…</span>`),hx=K(`<div class="markdown-body md-card svelte-intd6h" style="min-height:160px;"><!></div>`),gx=K(`<textarea id="mem_content" class="form-textarea content-textarea svelte-intd6h" rows="8" placeholder="Write memory content in Markdown…"></textarea>`),_x=K(`<div class="field-grid-2 svelte-intd6h"><div class="field-group svelte-intd6h"><label for="mem_type" class="field-label svelte-intd6h">Type <span class="required svelte-intd6h">*</span></label> <select id="mem_type" class="form-select"></select></div> <div class="field-group svelte-intd6h"><label for="mem_importance" class="field-label svelte-intd6h">Importance <span class="importance-badge svelte-intd6h"> </span></label> <input id="mem_importance" type="range" min="1" max="5" step="1" class="importance-slider svelte-intd6h"/> <div class="importance-ticks svelte-intd6h"></div></div></div> <div class="field-group svelte-intd6h"><label for="mem_tags" class="field-label svelte-intd6h">Tags <span class="field-hint svelte-intd6h">(comma separated)</span></label> <input id="mem_tags" class="form-input" placeholder="react, typescript, architecture…"/></div> <div class="field-grid-2 svelte-intd6h"><div class="field-group svelte-intd6h"><label for="mem_agent" class="field-label svelte-intd6h">Agent</label> <input id="mem_agent" class="form-input" placeholder="e.g. claude-opus"/></div> <div class="field-group svelte-intd6h"><label for="mem_model" class="field-label svelte-intd6h">Model</label> <input id="mem_model" class="form-input" placeholder="e.g. claude-3-opus"/></div></div> <div class="field-group svelte-intd6h"><div class="content-label-row svelte-intd6h"><label for="mem_content" class="field-label svelte-intd6h" style="margin-bottom:0;">Content <span class="required svelte-intd6h">*</span> <span class="field-hint svelte-intd6h">(Markdown supported)</span></label> <button type="button" class="btn btn-ghost btn-sm preview-btn svelte-intd6h"><!> </button></div> <!></div>`,1),vx=K(`<div class="modal-footer svelte-intd6h"><button class="btn btn-ghost">Cancel</button> <button class="btn btn-primary modal-save-btn svelte-intd6h"><!> </button></div>`),yx=K(`<div class="modal-backdrop svelte-intd6h" role="button" tabindex="-1" aria-label="Close"></div> <div class="modal-panel animate-fade-in svelte-intd6h" role="dialog" aria-modal="true" tabindex="-1"><div class="modal-header svelte-intd6h"><div class="modal-header-icon svelte-intd6h"><!></div> <div style="flex:1;min-width:0;"><!></div> <div class="modal-header-actions svelte-intd6h"><!> <button class="modal-close-btn svelte-intd6h" aria-label="Close"><!></button></div></div> <div class="modal-body svelte-intd6h"><!> <!></div> <!></div>`,1);function bx(e,t){We(t,!1);let n=()=>P(y,`$editing`,c),r=()=>P(v,`$form`,c),i=()=>P(x,`$deleting`,c),a=()=>P(S,`$error`,c),o=()=>P(C,`$previewMode`,c),s=()=>P(b,`$saving`,c),[c,l]=pt(),u=F(),d=F(),f=Q(t,`memory`,8,null),p=Q(t,`open`,8,!1),m=Q(t,`onClose`,8,()=>{}),h=Q(t,`onSaved`,8,()=>{}),g=Q(t,`onDeleted`,8,()=>{}),_=nx({onSaved:h(),onDeleted:g(),onClose:m()}),{form:v,editing:y,saving:b,deleting:x,error:S,previewMode:C}=_;function w(e){e.key===`Escape`&&m()()}B(()=>W(f()),()=>{I(u,f()===null)}),B(()=>(H(u),n()),()=>{I(d,H(u)||n())}),B(()=>(W(p()),W(f())),()=>{p()&&_.reset(f())}),Un(),Ta();var T=li();G(`keydown`,hn,w);var E=R(T),D=e=>{var t=yx(),c=R(t),l=z(c,2),p=L(l),h=L(p);$(L(h),{name:`brain`,size:14,strokeWidth:2.2}),j(h);var g=z(h,2),y=L(g),b=e=>{var t=rx(),n=R(t),i=L(n,!0);j(n);var a=z(n,2);ca(a),V(()=>J(i,H(u)?`New Memory`:`Edit Memory`)),Z(a,()=>r().title,e=>(ht(v,U(r).title=e,U(r)),cr(()=>{}))),q(e,t)},x=e=>{var t=ix(),n=z(R(t),2),r=L(n,!0);j(n),V(()=>J(r,(W(f()),U(()=>f().title)))),q(e,t)};Y(y,e=>{H(d)?e(b):f()&&e(x,1)}),j(g);var S=z(g,2),C=L(S),w=e=>{var t=ax(),n=R(t);$(L(n),{name:`edit`,size:13,strokeWidth:2}),Ne(),j(n);var r=z(n,2),a=L(r);$(a,{name:`trash-2`,size:13,strokeWidth:2});var o=z(a);j(r),V(()=>{r.disabled=i(),J(o,` ${i()?`Deleting…`:`Delete`}`)}),G(`click`,n,function(...e){_.startEditing?.apply(this,e)}),G(`click`,r,function(...e){_.deleteMemory?.apply(this,e)}),q(e,t)};Y(C,e=>{f()&&!n()&&e(w)});var T=z(C,2);$(L(T),{name:`x`,size:14,strokeWidth:2.5}),j(T),j(S),j(p);var E=z(p,2),D=L(E),ee=e=>{var t=ox(),n=L(t);$(n,{name:`circle-alert`,size:13,strokeWidth:2});var r=z(n);j(t),V(()=>J(r,` ${a()??``}`)),q(e,t)};Y(D,e=>{a()&&e(ee)});var te=z(D,2),ne=e=>{var t=dx(),n=R(t),r=L(n),i=L(r,!0);j(r),j(n);var a=z(n,2);X(a,5,()=>(W(f()),W(il),U(()=>[{label:`Importance`,val:f().importance},{label:`Hit Count`,val:f().hit_count??0},{label:`Created`,val:il(f().created_at)},{label:`Updated`,val:il(f().updated_at)}])),e=>e.label,(e,t)=>{var n=sx(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),V(()=>{J(i,(H(t),U(()=>H(t).label))),J(o,(H(t),U(()=>H(t).val)))}),q(e,n)}),j(a);var o=z(a,2),s=e=>{var t=lx(),n=z(L(t),2);X(n,5,()=>(W(f()),U(()=>f().tags)),e=>e,(e,t)=>{var n=cx(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(n),j(t),q(e,t)};Y(o,e=>{W(f()),U(()=>f().tags?.length)&&e(s)});var c=z(o,2),l=z(L(c),2);Xy(L(l),{get content(){return W(f()),U(()=>f().content)}}),j(l),j(c);var u=z(c,2),d=e=>{var t=ux(),n=z(L(t),2),r=L(n,!0);j(n),j(t),V(e=>J(r,e),[()=>(W(f()),U(()=>JSON.stringify(f().metadata,null,2)))]),q(e,t)},p=Jt(()=>(W(f()),U(()=>f().metadata&&Object.keys(f().metadata).length>0)));Y(u,e=>{H(p)&&e(d)}),V(()=>{Ki(r,1,`type-chip type-${(W(f()),U(()=>f().type))??``}`,`svelte-intd6h`),J(i,(W(ly),W(f()),U(()=>ly[f().type]||f().type)))}),q(e,t)},re=e=>{var t=_x(),n=R(t),i=L(n),a=z(L(i),2);X(a,5,()=>cy,e=>e,(e,t)=>{var n=fx(),r=L(n,!0);j(n);var i={};V(()=>{J(r,(W(ly),H(t),U(()=>ly[H(t)]))),i!==(i=H(t))&&(n.value=(n.__value=H(t))??``)}),q(e,n)}),j(a),j(i);var s=z(i,2),c=L(s),l=z(L(c)),u=L(l,!0);j(l),j(c);var d=z(c,2);ca(d);var f=z(d,2);X(f,4,()=>[1,2,3,4,5],e=>e,(e,t)=>{var n=px();let i;var a=L(n,!0);j(n),V(()=>{i=Ki(n,1,`svelte-intd6h`,null,i,{active:r().importance>=t}),J(a,t)}),q(e,n)}),j(f),j(s),j(n);var p=z(n,2),m=z(L(p),2);ca(m),j(p);var h=z(p,2),g=L(h),y=z(L(g),2);ca(y),j(g);var b=z(g,2),x=z(L(b),2);ca(x),j(b),j(h);var S=z(h,2),C=L(S),w=z(L(C),2),T=L(w);{let e=Yt(()=>o()?`edit`:`eye`);$(T,{get name(){return H(e)},size:12,strokeWidth:2})}var E=z(T);j(w),j(C);var D=z(C,2),ee=e=>{var t=hx(),n=L(t),i=e=>{Xy(e,{get content(){return r(),U(()=>r().content)}})},a=Jt(()=>(r(),U(()=>r().content.trim()))),o=e=>{q(e,mx())};Y(n,e=>{H(a)?e(i):e(o,-1)}),j(t),q(e,t)},te=e=>{var t=gx();On(t),Z(t,()=>r().content,e=>(ht(v,U(r).content=e,U(r)),cr(()=>{}))),q(e,t)};Y(D,e=>{o()?e(ee):e(te,-1)}),j(S),V(()=>{Ji(l,`background:${(W(dy),r(),U(()=>dy[r().importance]))??``};color:${(W(uy),r(),U(()=>uy[r().importance]))??``};`),J(u,(r(),U(()=>r().importance))),Ji(d,`accent-color:${(W(uy),r(),U(()=>uy[r().importance]))??``};`),J(E,` ${o()?`Edit`:`Preview`}`)}),Zi(a,()=>r().type,e=>(ht(v,U(r).type=e,U(r)),cr(()=>{}))),Z(d,()=>r().importance,e=>(ht(v,U(r).importance=e,U(r)),cr(()=>{}))),Z(m,()=>r().tags,e=>(ht(v,U(r).tags=e,U(r)),cr(()=>{}))),Z(y,()=>r().agent,e=>(ht(v,U(r).agent=e,U(r)),cr(()=>{}))),Z(x,()=>r().model,e=>(ht(v,U(r).model=e,U(r)),cr(()=>{}))),G(`click`,w,function(...e){_.togglePreview?.apply(this,e)}),q(e,t)};Y(te,e=>{f()&&!n()?e(ne):e(re,-1)}),j(E);var ie=z(E,2),ae=e=>{var t=vx(),n=L(t),i=z(n,2),a=L(i);{let e=Yt(()=>s()?`loader`:`save`);$(a,{get name(){return H(e)},size:13,strokeWidth:2})}var o=z(a);j(i),j(t),V(e=>{i.disabled=e,J(o,` ${s()?`Saving…`:H(u)?`Create Memory`:`Save Changes`}`)},[()=>(s(),r(),U(()=>s()||!r().title.trim()||!r().content.trim()))]),G(`click`,n,function(...e){_.cancelEdit?.apply(this,e)}),G(`click`,i,function(...e){_.save?.apply(this,e)}),q(e,t)};Y(ie,e=>{H(d)&&e(ae)}),j(l),G(`click`,c,function(...e){m()?.apply(this,e)}),G(`keydown`,c,e=>e.key===`Escape`&&m()()),G(`click`,T,function(...e){m()?.apply(this,e)}),q(e,t)};Y(E,e=>{p()&&e(D)}),q(e,T),Ge(),l()}var xx=e=>e;function Sx(e){let t=e-1;return t*t*t+1}function Cx(e,{delay:t=0,duration:n=400,easing:r=xx}={}){let i=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:r,css:e=>`opacity: ${e*i}`}}function wx(e,{delay:t=0,duration:n=400,easing:r=Sx,start:i=0,opacity:a=0}={}){let o=getComputedStyle(e),s=+o.opacity,c=o.transform===`none`?``:o.transform,l=1-i,u=s*(1-a);return{delay:t,duration:n,easing:r,css:(e,t)=>`
|
|
82
|
+
transform: ${c} scale(${1-l*t});
|
|
83
|
+
opacity: ${s-u*t}
|
|
84
|
+
`}}var Tx={memories:`title,type,content,importance
|
|
85
|
+
Example Memory,fact,This is an example memory content,3`,tasks:`task_code,title,phase,description,status,priority
|
|
86
|
+
TSK-001,Example Task,Phase 1,Example task description,backlog,3`};function Ex(e){let t=M(null),n=M([]),r=M([]),i=M(``),a=M(``),o=M(!1),s=M(!1);function c(){t.set(null),n.set([]),r.set([]),i.set(``),a.set(``),o.set(!1)}function l(){s.set(!1),c(),e.onClose&&e.onClose()}function u(){s.set(!0)}function d(e){let t=e.split(/\r?\n/).filter(e=>e.trim()!==``);if(t.length===0)return{headers:[],rows:[]};let n=e=>{let t=[],n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];a===`"`&&e[i+1]===`"`?(n+=`"`,i++):a===`"`?r=!r:a===`,`&&!r?(t.push(n.trim()),n=``):n+=a}return t.push(n.trim()),t},r=n(t[0]).filter(e=>e!==``);return{headers:r,rows:t.slice(1).map(n).map(e=>{let t={};return r.forEach((n,r)=>{let i=n.toLowerCase().replace(/[^a-z0-9_]/g,`_`);t[i]=e[r]}),t})}}function f(e){if(a.set(``),!e.name.endsWith(`.csv`)){a.set(`Please select a valid .csv file.`);return}t.set(e),i.set(e.name);let o=new FileReader;o.onload=e=>{let t=e.target?.result,i=d(t);r.set(i.headers),n.set(i.rows),i.rows.length===0&&a.set(`CSV file appears to be empty or missing headers.`)},o.readAsText(e)}function p(e){let t=e.target.files?.[0];t&&f(t)}function m(e){e.preventDefault();let t=e.dataTransfer?.files?.[0];t&&f(t)}function h(){let t=Tx[e.importTarget],n=new Blob([t],{type:`text/csv;charset=utf-8;`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.setAttribute(`href`,r),i.setAttribute(`download`,`example_${e.importTarget}.csv`),i.style.visibility=`hidden`,document.body.appendChild(i),i.click(),document.body.removeChild(i)}async function g(){let t=[];if(n.subscribe(e=>t=e)(),a.set(``),t.length===0){a.set(`No data to import.`);return}o.set(!0);try{let n=0;n=e.importTarget===`memories`?(await fo.bulkImportMemories(e.repo,t)).count:(await fo.bulkImportTasks(e.repo,t)).count,alert(`Imported ${n} ${e.importTarget} successfully.`),e.onSuccess&&e.onSuccess(),l()}catch(e){a.set(e instanceof Error?e.message:`Import failed`)}finally{o.set(!1)}}return{file:t,csvData:n,headers:r,fileName:i,errorMsg:a,isSubmitting:o,isOpen:s,open:u,close:l,handleFileSelect:p,handleFileDrop:m,downloadExample:h,handleImport:g,setFile:e=>t.set(e),setCsvData:e=>n.set(e)}}var Dx=K(`<div class="drop-zone svelte-lenod"><div class="drop-zone-content svelte-lenod"><div style="color: var(--color-text-muted)" class="svelte-lenod"><!></div> <p class="svelte-lenod">Drag and drop your <strong class="svelte-lenod">.csv</strong> file here</p> <span class="text-xs text-slate-500 mb-4 svelte-lenod">or click to browse from your computer</span> <label class="btn btn-primary btn-md cursor-pointer svelte-lenod">Select CSV File <input type="file" accept=".csv" class="hidden svelte-lenod"/></label></div></div> <div class="mt-6 flex flex-col items-center svelte-lenod"><p class="text-[0.8rem] text-slate-400 mb-2 svelte-lenod">Need a starting point?</p> <button class="btn btn-ghost btn-sm svelte-lenod"><!> </button></div>`,1),Ox=K(`<th class="svelte-lenod"> </th>`),kx=K(`<td class="svelte-lenod"> </td>`),Ax=K(`<tr class="svelte-lenod"></tr>`),jx=K(`<div class="file-info flex items-center justify-between p-3 bg-blue-500/5 border border-blue-500/20 rounded-lg mb-4 svelte-lenod"><div class="flex items-center gap-3 svelte-lenod"><div style="color: #0ea5e9; display: flex;" class="svelte-lenod"><!></div> <div class="svelte-lenod"><div class="text-sm font-semibold svelte-lenod"> </div> <div class="text-[0.7rem] text-slate-400 svelte-lenod"> </div></div></div> <button class="btn btn-ghost btn-sm text-red-500 svelte-lenod">Change File</button></div> <div class="preview-container svelte-lenod"><div class="preview-header svelte-lenod"><span class="svelte-lenod">Data Preview (First 5 rows)</span></div> <div class="table-wrapper svelte-lenod"><table class="svelte-lenod"><thead class="svelte-lenod"><tr class="svelte-lenod"></tr></thead><tbody class="svelte-lenod"></tbody></table></div></div>`,1),Mx=K(`<div class="error-msg flex items-center gap-2 svelte-lenod"><!> <span class="svelte-lenod"> </span></div>`),Nx=K(`<div class="spinner svelte-lenod"></div> Importing...`,1),Px=K(`<!> Start Import`,1),Fx=K(`<div class="modal-backdrop svelte-lenod"><div class="modal-content svelte-lenod"><div class="modal-header svelte-lenod"><div class="flex items-center gap-2 svelte-lenod"><div class="header-icon svelte-lenod" style="color: #0ea5e9"><!></div> <h3 class="svelte-lenod"> </h3></div> <button class="btn btn-ghost btn-sm close-btn svelte-lenod"><!></button></div> <div class="modal-body svelte-lenod"><div class="p-6 svelte-lenod"><!> <!></div></div> <div class="modal-footer svelte-lenod"><button class="btn btn-ghost svelte-lenod">Cancel</button> <button class="btn btn-primary svelte-lenod"><!></button></div></div></div>`);function Ix(e,t){We(t,!1);let n=()=>P(H(d),`$file`,l),r=()=>P(H(f),`$csvData`,l),i=()=>P(H(p),`$headers`,l),a=()=>P(H(m),`$fileName`,l),o=()=>P(H(h),`$errorMsg`,l),s=()=>P(H(g),`$isSubmitting`,l),c=()=>P(H(_),`$composableIsOpen`,l),[l,u]=pt(),d=F(),f=F(),p=F(),m=F(),h=F(),g=F(),_=F(),v=F(),y=F(),b=F(),x=F(),S=F(),C=F(),w=F(),T=F(),E=F(),D=F(),ee=F(),te=F(),ne=F(),re=Q(t,`repo`,8),ie=Q(t,`importTarget`,8,`memories`),ae=Q(t,`isOpen`,12,!1),oe=ja(),O=F();function se(e){I(O,Ex({repo:re(),importTarget:e,onSuccess:()=>oe(`success`),onClose:()=>{ae(!1),oe(`close`)}}))}se(ie()),B(()=>W(ie()),()=>{ie()&&se(ie())}),B(()=>(H(O),W(ae())),()=>{H(O).isOpen.set(ae())}),B(()=>H(O),()=>{dt(I(d,H(O).file),`$file`,l)}),B(()=>H(O),()=>{dt(I(f,H(O).csvData),`$csvData`,l)}),B(()=>H(O),()=>{dt(I(p,H(O).headers),`$headers`,l)}),B(()=>H(O),()=>{dt(I(m,H(O).fileName),`$fileName`,l)}),B(()=>H(O),()=>{dt(I(h,H(O).errorMsg),`$errorMsg`,l)}),B(()=>H(O),()=>{dt(I(g,H(O).isSubmitting),`$isSubmitting`,l)}),B(()=>H(O),()=>{dt(I(_,H(O).isOpen),`$composableIsOpen`,l)}),B(()=>H(O),()=>{I(v,H(O).close)}),B(()=>H(O),()=>{I(y,H(O).handleFileSelect)}),B(()=>H(O),()=>{I(b,H(O).handleFileDrop)}),B(()=>H(O),()=>{I(x,H(O).downloadExample)}),B(()=>H(O),()=>{I(S,H(O).handleImport)}),B(()=>H(O),()=>{I(C,H(O).setFile)}),B(()=>H(O),()=>{I(w,H(O).setCsvData)}),B(()=>n(),()=>{I(T,n())}),B(()=>r(),()=>{I(E,r())}),B(()=>i(),()=>{I(D,i())}),B(()=>a(),()=>{I(ee,a())}),B(()=>o(),()=>{I(te,o())}),B(()=>s(),()=>{I(ne,s())}),Un(),Ta();var ce=li(),le=R(ce),ue=e=>{var n=Fx(),r=L(n),i=L(r),a=L(i),o=L(a);$(L(o),{name:`upload-cloud`,size:18}),j(o);var s=z(o,2),c=L(s);j(s),j(a);var l=z(a,2);$(L(l),{name:`x`,size:18,strokeWidth:2}),j(l),j(i);var u=z(i,2),d=L(u),f=L(d),p=e=>{var n=Dx(),r=R(n),i=L(r),a=L(i);$(L(a),{name:`file-up`,size:48,strokeWidth:1}),j(a);var o=z(a,6),s=z(L(o));j(o),j(i),j(r);var c=z(r,2),l=z(L(c),2),u=L(l);$(u,{name:`download`,size:14,className:`mr-2`});var d=z(u);j(l),j(c),V(()=>J(d,` Download Example ${ie()===`memories`?`Memories`:`Tasks`} CSV`)),G(`change`,s,function(...e){H(y)?.apply(this,e)}),G(`dragover`,r,wa(function(e){Da.call(this,t,e)})),G(`drop`,r,function(...e){H(b)?.apply(this,e)}),G(`click`,l,function(...e){H(x)?.apply(this,e)}),q(e,n)},m=e=>{var t=jx(),n=R(t),r=L(n),i=L(r);$(L(i),{name:`file-type-2`,size:24}),j(i);var a=z(i,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c);j(c),j(a),j(r);var u=z(r,2);j(n);var d=z(n,2),f=z(L(d),2),p=L(f),m=L(p),h=L(m);X(h,5,()=>H(D),e=>e,(e,t)=>{var n=Ox(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(h),j(m);var g=z(m);X(g,7,()=>(H(E),U(()=>H(E).slice(0,5))),(e,t)=>`${t}-${JSON.stringify(e)}`,(e,t)=>{var n=Ax();X(n,5,()=>H(D),e=>e,(e,n)=>{var r=kx(),i=L(r,!0);j(r),V(e=>J(i,e),[()=>(H(t),H(n),U(()=>H(t)[H(n).toLowerCase().replace(/[^a-z0-9_]/g,`_`)]||``))]),q(e,r)}),j(n),q(e,n)}),j(g),j(p),j(f),j(d),V(()=>{J(s,H(ee)),J(l,`${(H(E),U(()=>H(E).length))??``} rows found`)}),G(`click`,u,()=>{H(C)(null),H(w)([])}),q(e,t)};Y(f,e=>{H(T)?e(m,-1):e(p)});var h=z(f,2),g=e=>{var t=Mx(),n=L(t);$(n,{name:`alert-circle`,size:16});var r=z(n,2),i=L(r,!0);j(r),j(t),V(()=>J(i,H(te))),q(e,t)};Y(h,e=>{H(te)&&e(g)}),j(d),j(u);var _=z(u,2),re=L(_),ae=z(re,2),oe=L(ae),O=e=>{var t=Nx();Ne(),q(e,t)},se=e=>{var t=Px();$(R(t),{name:`check`,size:16,className:`mr-2`}),Ne(),q(e,t)};Y(oe,e=>{H(ne)?e(O):e(se,-1)}),j(ae),j(_),j(r),j(n),V(()=>{J(c,`Bulk Import ${ie()===`memories`?`Memories`:`Tasks`}`),re.disabled=H(ne),ae.disabled=(H(ne),H(E),U(()=>H(ne)||H(E).length===0))}),G(`click`,l,function(...e){H(v)?.apply(this,e)}),G(`click`,re,function(...e){H(v)?.apply(this,e)}),G(`click`,ae,function(...e){H(S)?.apply(this,e)}),Pi(3,r,()=>wx,()=>({duration:200,start:.95})),G(`click`,r,Ca(function(e){Da.call(this,t,e)})),Pi(3,n,()=>Cx,()=>({duration:200})),G(`click`,n,function(...e){H(v)?.apply(this,e)}),q(e,n)};Y(le,e=>{c()&&e(ue)}),q(e,ce),Ge(),u()}var Lx=K(`<option> </option>`),Rx=K(`<option> </option>`),zx=K(`<div class="modal-backdrop svelte-l0ytfo" role="button" tabindex="-1" aria-label="Close modal"></div> <div class="modal-panel animate-fade-in svelte-l0ytfo" role="dialog" aria-modal="true" aria-labelledby="modal-title" tabindex="-1"><div class="modal-header svelte-l0ytfo"><div class="modal-header-icon svelte-l0ytfo"><!></div> <div><div id="modal-title" class="modal-title svelte-l0ytfo">New Task</div> <div class="modal-subtitle svelte-l0ytfo">Add a task to the current repository</div></div> <button class="modal-close-btn svelte-l0ytfo" aria-label="Close"><!></button></div> <div class="modal-body svelte-l0ytfo"><div class="field-grid-2 svelte-l0ytfo"><div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_code">Task Code <span class="required svelte-l0ytfo">*</span></label> <input id="new_task_code" class="form-input" placeholder="TASK-001"/></div> <div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_phase">Phase</label> <input id="new_task_phase" class="form-input" placeholder="Implementation"/></div></div> <div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_title">Title <span class="required svelte-l0ytfo">*</span> <span class="field-hint svelte-l0ytfo"> </span></label> <input id="new_task_title" class="form-input" placeholder="Short, descriptive task title" maxlength="80"/></div> <div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_description">Description</label> <textarea id="new_task_description" class="form-textarea modal-textarea svelte-l0ytfo" placeholder="What needs to be done? Include context, acceptance criteria, etc." rows="4"></textarea></div> <div class="field-grid-2 svelte-l0ytfo"><div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_status">Status</label> <select id="new_task_status" class="form-select"></select></div> <div class="field-group svelte-l0ytfo"><label class="field-label svelte-l0ytfo" for="new_task_priority">Priority</label> <select id="new_task_priority" class="form-select"></select></div></div></div> <div class="modal-footer svelte-l0ytfo"><button class="btn btn-ghost">Cancel</button> <button class="btn btn-primary modal-save-btn svelte-l0ytfo"><!> Create Task</button></div></div>`,1);function Bx(e,t){We(t,!1);let n=Q(t,`open`,8,!1),r=Q(t,`newTask`,12),i=Q(t,`onClose`,8,()=>{}),a=Q(t,`onSave`,8,()=>{});function o(e){e.key===`Escape`&&i()()}Ta();var s=li();G(`keydown`,hn,o);var c=R(s),l=e=>{var t=zx(),n=R(t),o=z(n,2),s=L(o),c=L(s);$(L(c),{name:`clipboard-list`,size:14,strokeWidth:2.2}),j(c);var l=z(c,4);$(L(l),{name:`x`,size:14,strokeWidth:2.5}),j(l),j(s);var u=z(s,2),d=L(u),f=L(d),p=z(L(f),2);ca(p),j(f);var m=z(f,2),h=z(L(m),2);ca(h),j(m),j(d);var g=z(d,2),_=L(g),v=z(L(_),3),y=L(v);j(v),j(_);var b=z(_,2);ca(b),j(g);var x=z(g,2),S=z(L(x),2);On(S),j(x);var C=z(x,2),w=L(C),T=z(L(w),2);X(T,4,()=>[`backlog`,`pending`,`in_progress`],e=>e,(e,t)=>{var n=Lx(),r=L(n,!0);j(n);var i={};V(e=>{J(r,e),i!==(i=t)&&(n.value=(n.__value=t)??``)},[()=>(W(sl),U(()=>sl(t)))]),q(e,n)}),j(T),j(w);var E=z(w,2),D=z(L(E),2);X(D,4,()=>[1,2,3,4,5],e=>e,(e,t)=>{var n=Rx(),r=L(n,!0);j(n);var i={};V(e=>{J(r,e),i!==(i=t)&&(n.value=(n.__value=t)??``)},[()=>(W(cl),U(()=>cl(t)))]),q(e,n)}),j(D),j(E),j(C),j(u);var ee=z(u,2),te=L(ee),ne=z(te,2);$(L(ne),{name:`plus`,size:13,strokeWidth:2.5}),Ne(),j(ne),j(ee),j(o),V(()=>{J(y,`${(W(r()),U(()=>(r().title??``).length))??``}/80`),ne.disabled=(W(r()),U(()=>!r().task_code||!r().title))}),G(`click`,n,function(...e){i()?.apply(this,e)}),G(`keydown`,n,e=>e.key===`Escape`&&i()()),G(`click`,l,function(...e){i()?.apply(this,e)}),Z(p,()=>r().task_code,e=>(r(r().task_code=e,!0),cr(()=>{}))),Z(h,()=>r().phase,e=>(r(r().phase=e,!0),cr(()=>{}))),Z(b,()=>r().title,e=>(r(r().title=e,!0),cr(()=>{}))),Z(S,()=>r().description,e=>(r(r().description=e,!0),cr(()=>{}))),Zi(T,()=>r().status,e=>(r(r().status=e,!0),cr(()=>{}))),Zi(D,()=>r().priority,e=>(r(r().priority=e,!0),cr(()=>{}))),G(`click`,te,function(...e){i()?.apply(this,e)}),G(`click`,ne,function(...e){a()?.apply(this,e)}),q(e,t)};Y(c,e=>{n()&&e(l)}),q(e,s),Ge()}var Vx=K(`<span class="ref-total-badge svelte-w0wd5z"> </span>`),Hx=K(`<button class="ref-clear-btn svelte-w0wd5z"><!></button>`),Ux=K(`<button><!> <span> </span> <span class="ref-cat-count svelte-w0wd5z"> </span></button>`),Wx=K(`<div style="padding:40px;text-align:center;"><div class="skeleton" style="height:60px;border-radius:12px;margin-bottom:10px;"></div> <div class="skeleton" style="height:60px;border-radius:12px;margin-bottom:10px;"></div> <div class="skeleton" style="height:60px;border-radius:12px;"></div></div>`),Gx=K(`<div class="ref-card-desc svelte-w0wd5z"> </div>`),Kx=K(`<code class="ref-param-tag svelte-w0wd5z"> </code>`),qx=K(`<code class="ref-param-tag ref-param-more svelte-w0wd5z"> </code>`),Jx=K(`<div class="ref-params svelte-w0wd5z"><!> <!></div>`),Yx=K(`<div class="ref-card ref-card-tool animate-fade-in svelte-w0wd5z" role="button" tabindex="0"><div class="ref-card-top svelte-w0wd5z"><span class="ref-type-badge ref-type-tool svelte-w0wd5z"><!> Tool</span></div> <div class="ref-card-name svelte-w0wd5z"> </div> <!> <!></div>`),Xx=K(`<div class="ref-section-header svelte-w0wd5z"><!> <span>Tools</span> <span class="ref-section-count svelte-w0wd5z"> </span></div> <div class="ref-grid svelte-w0wd5z"></div>`,1),Zx=K(`<div class="ref-card-desc svelte-w0wd5z"> </div>`),Qx=K(`<div class="ref-card ref-card-prompt animate-fade-in svelte-w0wd5z" role="button" tabindex="0"><div class="ref-card-top svelte-w0wd5z"><span class="ref-type-badge ref-type-prompt svelte-w0wd5z"><!> Prompt</span></div> <div class="ref-card-name svelte-w0wd5z"> </div> <!></div>`),$x=K(`<div class="ref-section-header svelte-w0wd5z"><!> <span>Prompts</span> <span class="ref-section-count svelte-w0wd5z"> </span></div> <div class="ref-grid svelte-w0wd5z"></div>`,1),eS=K(`<div class="ref-card-desc svelte-w0wd5z"> </div>`),tS=K(`<div class="ref-params svelte-w0wd5z"><code class="ref-param-tag svelte-w0wd5z" style="background:var(--color-bg);border:1px solid var(--color-border);"> </code></div>`),nS=K(`<div class="ref-card ref-card-resource animate-fade-in svelte-w0wd5z" role="button" tabindex="0"><div class="ref-card-top svelte-w0wd5z"><span class="ref-type-badge ref-type-resource svelte-w0wd5z"><!> Resource</span></div> <div class="ref-card-name svelte-w0wd5z"> </div> <!> <!></div>`),rS=K(`<div class="ref-section-header svelte-w0wd5z"><!> <span>Resources</span> <span class="ref-section-count svelte-w0wd5z"> </span></div> <div class="ref-grid svelte-w0wd5z"></div>`,1),iS=K(`<div style="text-align:center;padding:48px 16px;color:var(--color-text-muted);"><!> <div style="font-size:0.82rem;margin-top:10px;"> </div></div>`),aS=K(`<!> <!> <!> <!>`,1),oS=K(`<div class="animate-fade-in"><div class="glass card" style="margin-bottom:16px;padding:14px 18px;"><div class="ref-header svelte-w0wd5z"><div class="flex items-center gap-2"><!> <span style="font-size:0.9rem;font-weight:800;color:var(--color-text);letter-spacing:-0.02em;">MCP Reference</span> <!></div> <div class="ref-search-wrap svelte-w0wd5z"><span class="ref-search-icon svelte-w0wd5z"><!></span> <input class="form-input ref-search-input svelte-w0wd5z" type="text" placeholder="Search tools & prompts…"/> <!></div></div></div> <div class="ref-body svelte-w0wd5z"><div class="glass ref-sidebar svelte-w0wd5z"><div class="ref-sidebar-label svelte-w0wd5z">Category</div> <!></div> <div class="ref-main svelte-w0wd5z"><!></div></div></div>`);function sS(e,t){We(t,!1);let n=()=>P(p(),`$appState`,o),r=()=>P(m(),`$filteredTools`,o),i=()=>P(h(),`$filteredPrompts`,o),a=()=>P(_(),`$filteredResources`,o),[o,s]=pt(),c=F(),l=F(),u=F(),d=F(),f=Q(t,`handler`,8),p=Q(t,`appState`,8),m=Q(t,`filteredTools`,8),h=Q(t,`filteredPrompts`,8),_=Q(t,`filteredResources`,8);function v(e){return[{id:`all`,icon:`layers`,label:`All`,count:(e.capabilities?.tools?.length||0)+(e.capabilities?.prompts?.length||0)+(e.capabilities?.resources?.length||0)},{id:`tools`,icon:`tool`,label:`Tools`,count:e.capabilities?.tools?.length||0},{id:`prompts`,icon:`sparkle`,label:`Prompts`,count:e.capabilities?.prompts?.length||0},{id:`resources`,icon:`database`,label:`Resources`,count:e.capabilities?.resources?.length||0}]}function y(e,t,n){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f().openReferenceDrawer(t,n))}B(()=>n(),()=>{I(c,n())}),B(()=>r(),()=>{I(l,r())}),B(()=>i(),()=>{I(u,i())}),B(()=>a(),()=>{I(d,a())}),Un(),Ta();var b=oS(),x=L(b),S=L(x),C=L(S),w=L(C);$(w,{name:`book-open`,size:15,strokeWidth:1.75});var T=z(w,4),E=e=>{var t=Vx(),n=L(t);j(t),V(()=>J(n,`${(H(c),U(()=>(H(c).capabilities.tools?.length||0)+(H(c).capabilities.prompts?.length||0)))??``} items`)),q(e,t)};Y(T,e=>{H(c),U(()=>H(c).capabilities)&&e(E)}),j(C);var D=z(C,2),ee=L(D);$(L(ee),{name:`search`,size:12,strokeWidth:2}),j(ee);var te=z(ee,2);ca(te);var ne=z(te,2),re=e=>{var t=Hx();$(L(t),{name:`x`,size:11,strokeWidth:2.5}),j(t),G(`click`,t,()=>f().setReferenceSearch(``)),q(e,t)};Y(ne,e=>{H(c),U(()=>H(c).referenceSearch)&&e(re)}),j(D),j(S),j(x);var ie=z(x,2),ae=L(ie);X(z(L(ae),2),1,()=>(H(c),U(()=>v(H(c)))),e=>e.id,(e,t)=>{var n=Ux();let r;var i=L(n);$(i,{get name(){return H(t),U(()=>H(t).icon)},size:13,strokeWidth:1.75});var a=z(i,2),o=L(a,!0);j(a);var s=z(a,2),l=L(s,!0);j(s),j(n),V(()=>{r=Ki(n,1,`ref-cat-btn svelte-w0wd5z`,null,r,{active:H(c).referenceFilter===H(t).id}),J(o,(H(t),U(()=>H(t).label))),J(l,(H(t),U(()=>H(t).count)))}),G(`click`,n,()=>f().setReferenceFilter(H(t).id)),q(e,n)}),j(ae);var oe=z(ae,2),O=L(oe),se=e=>{q(e,Wx())},ce=e=>{var t=aS(),n=R(t),r=e=>{var t=Xx(),n=R(t),r=L(n);$(r,{name:`tool`,size:13,strokeWidth:1.75});var i=z(r,4),a=L(i,!0);j(i),j(n);var o=z(n,2);X(o,5,()=>H(l),e=>e.data.name,(e,t)=>{var n=Yx(),r=L(n),i=L(r);$(L(i),{name:`tool`,size:10,strokeWidth:2}),Ne(),j(i),j(r);var a=z(r,2),o=L(a,!0);j(a);var s=z(a,2),c=e=>{var n=Gx(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).data.description)))),q(e,n)};Y(s,e=>{H(t),U(()=>H(t)?.data?.description)&&e(c)});var l=z(s,2),u=e=>{var n=Jx(),r=L(n);X(r,1,()=>(H(t),U(()=>Object.entries(H(t).data.inputSchema.properties).slice(0,4))),([e])=>e,(e,t)=>{var n=Jt(()=>g(H(t),1));let r=()=>H(n)[0];var i=Kx(),a=L(i,!0);j(i),V(()=>J(a,r())),q(e,i)});var i=z(r,2),a=e=>{var n=qx(),r=L(n);j(n),V(e=>J(r,`+${e??``}`),[()=>(H(t),U(()=>Object.keys(H(t).data.inputSchema.properties).length-4))]),q(e,n)},o=Jt(()=>(H(t),U(()=>Object.keys(H(t).data.inputSchema.properties).length>4)));Y(i,e=>{H(o)&&e(a)}),j(n),q(e,n)};Y(l,e=>{H(t),U(()=>H(t)?.data?.inputSchema?.properties)&&e(u)}),j(n),V(()=>J(o,(H(t),U(()=>H(t)?.data?.name||`Unknown Tool`)))),G(`click`,n,()=>f().openReferenceDrawer(`tool`,H(t).data)),G(`keydown`,n,e=>y(e,`tool`,H(t).data)),q(e,n)}),j(o),V(()=>J(a,(H(l),U(()=>H(l).length)))),q(e,t)};Y(n,e=>{H(l),U(()=>H(l).length>0)&&e(r)});var i=z(n,2),a=e=>{var t=$x(),n=R(t),r=L(n);$(r,{name:`sparkle`,size:13,strokeWidth:1.75});var i=z(r,4),a=L(i,!0);j(i),j(n);var o=z(n,2);X(o,5,()=>H(u),e=>e.data.name,(e,t)=>{var n=Qx(),r=L(n),i=L(r);$(L(i),{name:`sparkle`,size:10,strokeWidth:2}),Ne(),j(i),j(r);var a=z(r,2),o=L(a,!0);j(a);var s=z(a,2),c=e=>{var n=Zx(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).data.description)))),q(e,n)};Y(s,e=>{H(t),U(()=>H(t)?.data?.description)&&e(c)}),j(n),V(()=>J(o,(H(t),U(()=>H(t)?.data?.name||`Unknown Prompt`)))),G(`click`,n,()=>f().openReferenceDrawer(`prompt`,H(t).data)),G(`keydown`,n,e=>y(e,`prompt`,H(t).data)),q(e,n)}),j(o),V(()=>{Ji(n,`margin-top:${(H(l),U(()=>H(l).length>0?`20px`:`0`))??``}`),J(a,(H(u),U(()=>H(u).length)))}),q(e,t)};Y(i,e=>{H(u),U(()=>H(u).length>0)&&e(a)});var o=z(i,2),s=e=>{var t=rS(),n=R(t),r=L(n);$(r,{name:`database`,size:13,strokeWidth:1.75});var i=z(r,4),a=L(i,!0);j(i),j(n);var o=z(n,2);X(o,5,()=>H(d),e=>e.data.uri||e.data.name,(e,t)=>{var n=nS(),r=L(n),i=L(r);$(L(i),{name:`database`,size:10,strokeWidth:2}),Ne(),j(i),j(r);var a=z(r,2),o=L(a,!0);j(a);var s=z(a,2),c=e=>{var n=eS(),r=L(n,!0);j(n),V(()=>J(r,(H(t),U(()=>H(t).data.description)))),q(e,n)};Y(s,e=>{H(t),U(()=>H(t)?.data?.description)&&e(c)});var l=z(s,2),u=e=>{var n=tS(),r=L(n),i=L(r,!0);j(r),j(n),V(()=>J(i,(H(t),U(()=>H(t).data.uri)))),q(e,n)};Y(l,e=>{H(t),U(()=>H(t)?.data?.uri)&&e(u)}),j(n),V(()=>J(o,(H(t),U(()=>H(t)?.data?.name||`Unknown Resource`)))),G(`click`,n,()=>f().openReferenceDrawer(`resource`,H(t).data)),G(`keydown`,n,e=>y(e,`resource`,H(t).data)),q(e,n)}),j(o),V(()=>{Ji(n,`margin-top:${(H(l),H(u),U(()=>H(l).length>0||H(u).length>0?`20px`:`0`))??``}`),J(a,(H(d),U(()=>H(d).length)))}),q(e,t)};Y(o,e=>{H(d),U(()=>H(d).length>0)&&e(s)});var p=z(o,2),m=e=>{var t=iS(),n=L(t);$(n,{name:`search`,size:28,strokeWidth:1.25});var r=z(n,2),i=L(r);j(r),j(t),V(()=>J(i,`No results for "${(H(c),U(()=>H(c).referenceSearch))??``}"`)),q(e,t)};Y(p,e=>{H(l),H(u),H(d),U(()=>H(l).length===0&&H(u).length===0&&H(d).length===0)&&e(m)}),q(e,t)};Y(O,e=>{H(c),U(()=>!H(c).capabilities)?e(se):e(ce,-1)}),j(oe),j(ie),j(b),Z(te,()=>n().referenceSearch,e=>ht(p(),U(n).referenceSearch=e,U(n))),q(e,b),Ge(),s()}var cS=K(`<div class="fab-backdrop svelte-10ega5z" role="button" tabindex="-1" aria-label="Close menu"></div>`),lS=K(`<!> <div><div class="fab-actions svelte-10ega5z"><div class="fab-action-item svelte-10ega5z"><span class="fab-action-label svelte-10ega5z">New Task</span> <button class="fab-action-btn task svelte-10ega5z" title="Create new task" aria-label="Create new task"><!></button></div> <div class="fab-action-item svelte-10ega5z"><span class="fab-action-label svelte-10ega5z">New Memory</span> <button class="fab-action-btn memory svelte-10ega5z" title="Create new memory" aria-label="Create new memory"><!></button></div></div> <button class="fab-main svelte-10ega5z"><span><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="svelte-10ega5z"><line x1="12" y1="5" x2="12" y2="19" class="svelte-10ega5z"></line><line x1="5" y1="12" x2="19" y2="12" class="svelte-10ega5z"></line></svg></span></button></div>`,1);function uS(e,t){We(t,!1);let n=()=>P(La,`$currentRepo`,r),[r,i]=pt(),a=Q(t,`onNewMemory`,8,()=>{}),o=Q(t,`onNewTask`,8,()=>{}),s=F(!1);function c(){I(s,!H(s))}function l(){I(s,!1),a()()}function u(){I(s,!1),o()()}function d(e){e.key===`Escape`&&I(s,!1)}Ta();var f=li();G(`keydown`,hn,d);var p=R(f),m=e=>{var t=lS(),n=R(t),r=e=>{var t=cS();G(`click`,t,()=>I(s,!1)),G(`keydown`,t,e=>e.key===`Escape`&&I(s,!1)),q(e,t)};Y(n,e=>{H(s)&&e(r)});var i=z(n,2);let a;var o=L(i),d=L(o),f=z(L(d),2);$(L(f),{name:`clipboard-list`,size:16,strokeWidth:2}),j(f),j(d);var p=z(d,2),m=z(L(p),2);$(L(m),{name:`brain`,size:16,strokeWidth:2}),j(m),j(p),j(o);var h=z(o,2),g=L(h);let _;j(h),j(i),V(()=>{a=Ki(i,1,`fab-container svelte-10ega5z`,null,a,{open:H(s)}),Ji(d,`transition-delay: ${H(s)?`0.05s`:`0s`}`),Ji(p,`transition-delay: ${H(s)?`0.1s`:`0s`}`),fa(h,`title`,H(s)?`Close`:`Quick create`),fa(h,`aria-label`,H(s)?`Close quick create menu`:`Open quick create menu`),fa(h,`aria-expanded`,H(s)),_=Ki(g,1,`fab-icon svelte-10ega5z`,null,_,{rotated:H(s)})}),G(`click`,f,u),G(`click`,m,l),G(`click`,h,c),q(e,t)};Y(p,e=>{n()&&e(m)}),q(e,f),Ge(),i()}var dS=K(`<div class="error-banner svelte-owkwhr"> </div>`),fS=K(`<div class="glass card panel-card create-panel svelte-owkwhr"><div class="panel-heading svelte-owkwhr"><div><div class="section-label">New Standard</div> <div class="toolbar-subtitle svelte-owkwhr">Save one atomic coding standard for this repo or globally.</div></div></div> <div class="form-grid svelte-owkwhr"><label class="svelte-owkwhr"><span class="svelte-owkwhr">Name</span> <input class="form-input" placeholder="Error handling standard"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Parent ID</span> <input class="form-input" placeholder="Optional parent standard UUID"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Context</span> <input class="form-input" placeholder="testing, security, routing"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Version</span> <input class="form-input" placeholder="1.0.0"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Language</span> <input class="form-input" placeholder="typescript, python"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Stack</span> <input class="form-input" placeholder="svelte, vite, express"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Tags</span> <input class="form-input" placeholder="frontend, linting"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Metadata JSON</span> <input class="form-input" placeholder="JSON metadata"/></label></div> <label class="content-label svelte-owkwhr"><span class="svelte-owkwhr">Content</span> <textarea class="form-textarea content-input svelte-owkwhr" placeholder="Write the implementation rule in concise Markdown..."></textarea></label> <button class="btn btn-primary"><!> </button></div>`),pS=K(`<button class="btn btn-ghost btn-sm">Add first standard</button>`),mS=K(`<div class="muted-state svelte-owkwhr">Loading standards...</div>`),hS=K(`<div class="empty-state svelte-owkwhr"><!> <div class="empty-title svelte-owkwhr">No standards found</div> <div class="empty-copy svelte-owkwhr">Adjust the filters or create a standard for this repository.</div></div>`),gS=K(`<span class="mini-chip svelte-owkwhr"> </span>`),_S=K(`<div class="tag-row svelte-owkwhr"></div>`),vS=K(`<span class="mini-chip svelte-owkwhr"> </span>`),yS=K(`<div class="tag-row svelte-owkwhr"></div>`),bS=K(`<button><div class="row-title svelte-owkwhr"><!> <span> </span></div> <div class="row-meta svelte-owkwhr"><span> </span> <span> </span> <span> </span> <span>child</span></div> <!></button>`),xS=K(`<div class="standard-children svelte-owkwhr"></div>`),SS=K(`<div class="standard-group svelte-owkwhr"><button><div class="row-title svelte-owkwhr"> </div> <div class="row-meta svelte-owkwhr"><span> </span> <span> </span> <span> </span> <span> </span></div> <!></button> <!></div>`),CS=K(`<div class="standard-list svelte-owkwhr"></div>`),wS=K(`<div class="muted-state svelte-owkwhr">Loading standard detail...</div>`),TS=K(`<div class="form-grid svelte-owkwhr"><label class="svelte-owkwhr"><span class="svelte-owkwhr">Name</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Parent ID</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Context</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Version</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Language</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Stack</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Tags</span> <input class="form-input"/></label> <label class="svelte-owkwhr"><span class="svelte-owkwhr">Metadata JSON</span> <input class="form-input"/></label></div> <label class="content-label svelte-owkwhr"><span class="svelte-owkwhr">Content</span> <textarea class="form-textarea content-input svelte-owkwhr"></textarea></label> <div class="editor-actions svelte-owkwhr"><button class="btn btn-primary"><!> </button> <button class="btn btn-ghost">Cancel</button></div>`,1),ES=K(`<div class="markdown-body md-card"><!></div>`),DS=K(`<div class="detail-heading svelte-owkwhr"><div><div class="detail-title svelte-owkwhr"> </div> <div class="row-meta svelte-owkwhr"><span> </span> <span> </span> <span> </span> <span> </span></div></div> <div class="detail-actions svelte-owkwhr"><span class="scope-pill svelte-owkwhr"> </span> <button class="btn btn-ghost btn-sm"><!> Edit</button> <button class="btn btn-ghost btn-sm danger-text svelte-owkwhr"><!> </button></div></div> <!>`,1),OS=K(`<div class="empty-state detail-empty svelte-owkwhr"><!> <div class="empty-title svelte-owkwhr">Select a standard</div> <div class="empty-copy svelte-owkwhr">The full Markdown content and scope metadata appear here.</div></div>`),kS=K(`<div class="feature-shell animate-fade-in svelte-owkwhr"><div class="feature-toolbar glass card svelte-owkwhr"><div class="toolbar-title svelte-owkwhr"><!> <div><div class="section-label">Coding Standards</div> <div class="toolbar-subtitle svelte-owkwhr"> </div></div></div> <button class="btn btn-primary toolbar-action svelte-owkwhr"><!> </button> <div class="toolbar-controls svelte-owkwhr"><input class="form-input" placeholder="Search standards..."/> <input class="form-input" placeholder="Language"/> <input class="form-input" placeholder="Stack tags, comma separated"/> <select class="form-select"><option>Repo + global</option><option>Global only</option><option>All standards</option></select></div></div> <!> <!> <div><div class="glass card panel-card list-panel svelte-owkwhr"><div class="panel-heading svelte-owkwhr"><div class="section-label">Standards</div> <!></div> <!></div> <div class="glass card panel-card detail-panel svelte-owkwhr"><!></div></div></div>`);function AS(e,t){We(t,!1);let n=Q(t,`repo`,8,``),r=F([]),i=F([]),a=F(!1),o=F(!1),s=F(!1),c=F(!1),l=F(``),u=F(``),d=F(``),f=F(``),p=F(`repo`),m=F(null),h=F(!1),g=F(!1),_=F({name:``,parent_id:``,context:`general`,version:`1.0.0`,language:``,stack:``,tags:``,metadata:`{"source":"dashboard"}`,content:``}),v=F({name:``,parent_id:``,context:`general`,version:`1.0.0`,language:``,stack:``,tags:``,metadata:`{"source":"dashboard"}`,content:``});function y(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)&&Object.keys(t).length>0?t:null}catch{return null}}function b(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function x(e){return JSON.stringify(e,null,2)}function S(e){let t=new Map,n=new Set(e.map(e=>e.id));for(let r of e){let e=r.parent_id;if(!e||!n.has(e))continue;let i=t.get(e)||[];i.push(r),t.set(e,i)}return e.filter(e=>!e.parent_id||!n.has(e.parent_id)).map(e=>({standard:e,children:(t.get(e.id)||[]).sort((e,t)=>e.title.localeCompare(t.title))}))}async function C(e){I(o,!0),I(g,!1);try{let t=await fo.standardById(e);I(m,t),t&&I(v,{name:t.title,parent_id:t.parent_id||``,context:t.context,version:t.version,language:t.language||``,stack:t.stack.join(`, `),tags:t.tags.join(`, `),metadata:x(t.metadata),content:t.content})}catch(e){I(l,e instanceof Error?e.message:String(e))}finally{I(o,!1)}}function w(){H(m)&&(I(v,{name:H(m).title,parent_id:H(m).parent_id||``,context:H(m).context,version:H(m).version,language:H(m).language||``,stack:H(m).stack.join(`, `),tags:H(m).tags.join(`, `),metadata:x(H(m).metadata),content:H(m).content}),I(g,!0))}function T(){I(g,!1)}async function E(){if(n()){I(a,!0),I(l,``);try{I(r,(await fo.standards({query:H(u)||void 0,language:H(d)||void 0,stack:H(f)||void 0,repo:H(p)===`repo`?n():void 0,is_global:H(p)===`global`?!0:void 0,page:1,pageSize:100})).standards||[]),(!H(m)||!H(r).some(e=>e.id===H(m)?.id))&&I(m,H(r)[0]||null),H(m)?.id&&await C(H(m).id)}catch(e){I(l,e instanceof Error?e.message:String(e))}finally{I(a,!1)}}}async function D(){let e=y(H(_).metadata);if(!(!H(_).name.trim()||!H(_).content.trim()||b(H(_).tags).length===0||!e)){I(s,!0),I(l,``);try{let t=H(p)===`global`,r=await fo.createStandard({title:H(_).name.trim(),content:H(_).content.trim(),parent_id:H(_).parent_id.trim()||void 0,context:H(_).context.trim()||`general`,version:H(_).version.trim()||`1.0.0`,language:H(_).language.trim()||void 0,stack:b(H(_).stack),tags:b(H(_).tags),metadata:e,repo:t?void 0:n(),is_global:t});I(_,{name:``,parent_id:``,context:`general`,version:`1.0.0`,language:``,stack:``,tags:``,metadata:`{"source":"dashboard"}`,content:``}),I(h,!1),await E(),I(m,r||H(m))}catch(e){I(l,e instanceof Error?e.message:String(e))}finally{I(s,!1)}}}async function ee(){if(!H(m))return;let e=y(H(v).metadata);if(!(!H(v).name.trim()||!H(v).content.trim()||b(H(v).tags).length===0||!e)){I(s,!0),I(l,``);try{await fo.updateStandard(H(m).id,{title:H(v).name.trim(),content:H(v).content.trim(),parent_id:H(v).parent_id.trim()||null,context:H(v).context.trim()||`general`,version:H(v).version.trim()||`1.0.0`,language:H(v).language.trim()||void 0,stack:b(H(v).stack),tags:b(H(v).tags),metadata:e,repo:H(m).is_global?void 0:H(m).repo||n(),is_global:H(m).is_global}),I(g,!1),await C(H(m).id),await E()}catch(e){I(l,e instanceof Error?e.message:String(e))}finally{I(s,!1)}}}async function te(){if(H(m)&&confirm(`Delete coding standard "${H(m).title}"?`)){I(c,!0),I(l,``);try{await fo.deleteStandard(H(m).id),I(g,!1),I(m,null),await E()}catch(e){I(l,e instanceof Error?e.message:String(e))}finally{I(c,!1)}}}Oa(()=>{E()}),B(()=>W(n()),()=>{n()&&E()}),B(()=>H(r),()=>{I(i,S(H(r)))}),Un(),Ta();var ne=kS(),re=L(ne),ie=L(re),ae=L(ie);$(ae,{name:`check`,size:16,strokeWidth:2});var oe=z(ae,2),O=z(L(oe),2),se=L(O);j(O),j(oe),j(ie);var ce=z(ie,2),le=L(ce);{let e=Yt(()=>H(h)?`chevron-left`:`plus`);$(le,{get name(){return H(e)},size:14,strokeWidth:2})}var ue=z(le);j(ce);var de=z(ce,2),fe=L(de);ca(fe);var pe=z(fe,2);ca(pe);var me=z(pe,2);ca(me);var he=z(me,2),ge=L(he);ge.value=ge.__value=`repo`;var _e=z(ge);_e.value=_e.__value=`global`;var ve=z(_e);ve.value=ve.__value=`all`,j(he),j(de),j(re);var ye=z(re,2),be=e=>{var t=dS(),n=L(t,!0);j(t),V(()=>J(n,H(l))),q(e,t)};Y(ye,e=>{H(l)&&e(be)});var xe=z(ye,2),Se=e=>{var t=fS(),n=z(L(t),2),r=L(n),i=z(L(r),2);ca(i),j(r);var a=z(r,2),o=z(L(a),2);ca(o),j(a);var c=z(a,2),l=z(L(c),2);ca(l),j(c);var u=z(c,2),d=z(L(u),2);ca(d),j(u);var f=z(u,2),p=z(L(f),2);ca(p),j(f);var m=z(f,2),h=z(L(m),2);ca(h),j(m);var g=z(m,2),v=z(L(g),2);ca(v),j(g);var x=z(g,2),S=z(L(x),2);ca(S),j(x),j(n);var C=z(n,2),w=z(L(C),2);On(w),j(C);var T=z(C,2),E=L(T);$(E,{name:`check`,size:14,strokeWidth:2});var ee=z(E);j(T),j(t),V(e=>{T.disabled=e,J(ee,` ${H(s)?`Saving...`:`Save Standard`}`)},[()=>(H(s),H(_),U(()=>H(s)||!H(_).name.trim()||!H(_).content.trim()||b(H(_).tags).length===0||!y(H(_).metadata)))]),Z(i,()=>H(_).name,e=>sn(_,H(_).name=e)),Z(o,()=>H(_).parent_id,e=>sn(_,H(_).parent_id=e)),Z(l,()=>H(_).context,e=>sn(_,H(_).context=e)),Z(d,()=>H(_).version,e=>sn(_,H(_).version=e)),Z(p,()=>H(_).language,e=>sn(_,H(_).language=e)),Z(h,()=>H(_).stack,e=>sn(_,H(_).stack=e)),Z(v,()=>H(_).tags,e=>sn(_,H(_).tags=e)),Z(S,()=>H(_).metadata,e=>sn(_,H(_).metadata=e)),Z(w,()=>H(_).content,e=>sn(_,H(_).content=e)),G(`click`,T,D),q(e,t)};Y(xe,e=>{H(h)&&e(Se)});var Ce=z(xe,2);let we;var Te=L(Ce),Ee=L(Te),De=z(L(Ee),2),Oe=e=>{var t=pS();G(`click`,t,()=>I(h,!0)),q(e,t)};Y(De,e=>{H(r),U(()=>H(r).length===0)&&e(Oe)}),j(Ee);var ke=z(Ee,2),k=e=>{q(e,mS())},Ae=e=>{var t=hS();$(L(t),{name:`check`,size:22,strokeWidth:1.75}),Ne(4),j(t),q(e,t)},A=e=>{var t=CS();X(t,5,()=>H(i),e=>e.standard.id,(e,t)=>{var r=SS(),i=L(r);let a;var o=L(i),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d,!0);j(d);var p=z(d,2),h=L(p,!0);j(p);var g=z(p,2),_=L(g,!0);j(g),j(c);var v=z(c,2),y=e=>{var n=_S();X(n,5,()=>(H(t),U(()=>[...new Set([...H(t).standard.stack,...H(t).standard.tags])].slice(0,6))),_i,(e,t)=>{var n=gS(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(n),q(e,n)};Y(v,e=>{H(t),U(()=>H(t).standard.stack.length||H(t).standard.tags.length)&&e(y)}),j(i);var b=z(i,2),x=e=>{var r=xS();X(r,5,()=>(H(t),U(()=>H(t).children)),e=>e.id,(e,t)=>{var r=bS();let i;var a=L(r),o=L(a);$(o,{name:`corner-down-right`,size:13,strokeWidth:2});var s=z(o,2),c=L(s,!0);j(s),j(a);var l=z(a,2),u=L(l),d=L(u,!0);j(u);var f=z(u,2),p=L(f,!0);j(f);var h=z(f,2),g=L(h,!0);j(h),Ne(2),j(l);var _=z(l,2),v=e=>{var n=yS();X(n,5,()=>(H(t),U(()=>[...new Set([...H(t).stack,...H(t).tags])].slice(0,6))),_i,(e,t)=>{var n=vS(),r=L(n,!0);j(n),V(()=>J(r,H(t))),q(e,n)}),j(n),q(e,n)};Y(_,e=>{H(t),U(()=>H(t).stack.length||H(t).tags.length)&&e(v)}),j(r),V(()=>{i=Ki(r,1,`standard-row standard-row-child svelte-owkwhr`,null,i,{selected:H(m)?.id===H(t).id}),J(c,(H(t),U(()=>H(t).title))),J(d,(H(t),U(()=>H(t).context))),J(p,(H(t),U(()=>H(t).language||`any language`))),J(g,(H(t),W(n()),U(()=>H(t).is_global?`global`:H(t).repo||n())))}),G(`click`,r,()=>C(H(t).id)),q(e,r)}),j(r),q(e,r)};Y(b,e=>{H(t),U(()=>H(t).children.length>0)&&e(x)}),j(r),V(()=>{a=Ki(i,1,`standard-row standard-row-root svelte-owkwhr`,null,a,{selected:H(m)?.id===H(t).standard.id}),J(s,(H(t),U(()=>H(t).standard.title))),J(u,(H(t),U(()=>H(t).standard.context))),J(f,(H(t),U(()=>H(t).standard.language||`any language`))),J(h,(H(t),W(n()),U(()=>H(t).standard.is_global?`global`:H(t).standard.repo||n()))),J(_,(H(t),U(()=>H(t).children.length>0?`${H(t).children.length} child`:`root`)))}),G(`click`,i,()=>C(H(t).standard.id)),q(e,r)}),j(t),q(e,t)};Y(ke,e=>{H(a)?e(k):(H(r),U(()=>H(r).length===0)?e(Ae,1):e(A,-1))}),j(Te);var je=z(Te,2),Me=L(je),Pe=e=>{q(e,wS())},Fe=e=>{var t=DS(),n=R(t),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),l=L(o),u=L(l,!0);j(l);var d=z(l,2),f=L(d);j(d);var p=z(d,2),h=L(p,!0);j(p);var _=z(p,2),b=L(_,!0);j(_),j(o),j(r);var x=z(r,2),S=L(x),C=L(S,!0);j(S);var E=z(S,2);$(L(E),{name:`pencil`,size:14,strokeWidth:2}),Ne(),j(E);var D=z(E,2),ne=L(D);$(ne,{name:`trash`,size:14,strokeWidth:2});var re=z(ne);j(D),j(x),j(n);var ie=z(n,2),ae=e=>{var t=TS(),n=R(t),r=L(n),i=z(L(r),2);ca(i),j(r);var a=z(r,2),o=z(L(a),2);ca(o),j(a);var c=z(a,2),l=z(L(c),2);ca(l),j(c);var u=z(c,2),d=z(L(u),2);ca(d),j(u);var f=z(u,2),p=z(L(f),2);ca(p),j(f);var m=z(f,2),h=z(L(m),2);ca(h),j(m);var g=z(m,2),_=z(L(g),2);ca(_),j(g);var b=z(g,2),x=z(L(b),2);ca(x),j(b),j(n);var S=z(n,2),C=z(L(S),2);On(C),j(S);var w=z(S,2),E=L(w),D=L(E);$(D,{name:`check`,size:14,strokeWidth:2});var te=z(D);j(E);var ne=z(E,2);j(w),V(e=>{E.disabled=e,J(te,` ${H(s)?`Saving...`:`Save Changes`}`),ne.disabled=H(s)},[()=>(H(s),H(v),U(()=>H(s)||!y(H(v).metadata)))]),Z(i,()=>H(v).name,e=>sn(v,H(v).name=e)),Z(o,()=>H(v).parent_id,e=>sn(v,H(v).parent_id=e)),Z(l,()=>H(v).context,e=>sn(v,H(v).context=e)),Z(d,()=>H(v).version,e=>sn(v,H(v).version=e)),Z(p,()=>H(v).language,e=>sn(v,H(v).language=e)),Z(h,()=>H(v).stack,e=>sn(v,H(v).stack=e)),Z(_,()=>H(v).tags,e=>sn(v,H(v).tags=e)),Z(x,()=>H(v).metadata,e=>sn(v,H(v).metadata=e)),Z(C,()=>H(v).content,e=>sn(v,H(v).content=e)),G(`click`,E,ee),G(`click`,ne,T),q(e,t)},oe=e=>{var t=ES();Xy(L(t),{get content(){return H(m),U(()=>H(m).content)}}),j(t),q(e,t)};Y(ie,e=>{H(g)?e(ae):e(oe,-1)}),V(e=>{J(a,(H(m),U(()=>H(m).title))),J(u,(H(m),U(()=>H(m).context))),J(f,`v${(H(m),U(()=>H(m).version))??``}`),J(h,(H(m),U(()=>H(m).parent_id?`child of ${H(m).parent_id}`:`root`))),J(b,e),J(C,(H(m),U(()=>H(m).is_global?`Global`:`Repo`))),D.disabled=H(c),J(re,` ${H(c)?`Deleting...`:`Delete`}`)},[()=>(W(il),H(m),U(()=>il(H(m).updated_at)))]),G(`click`,E,w),G(`click`,D,te),q(e,t)},Ie=e=>{var t=OS();$(L(t),{name:`book-open`,size:22,strokeWidth:1.75}),Ne(4),j(t),q(e,t)};Y(Me,e=>{H(o)?e(Pe):H(m)?e(Fe,1):e(Ie,-1)}),j(je),j(Ce),j(ne),V(()=>{J(se,`${(H(r),U(()=>H(r).length))??``} matching standards`),J(ue,` ${H(h)?`Close Form`:`New Standard`}`),we=Ki(Ce,1,`feature-grid svelte-owkwhr`,null,we,{"with-create":H(h)})}),G(`click`,ce,()=>I(h,!H(h))),Z(fe,()=>H(u),e=>I(u,e)),G(`input`,fe,()=>E()),Z(pe,()=>H(d),e=>I(d,e)),G(`input`,pe,()=>E()),Z(me,()=>H(f),e=>I(f,e)),G(`input`,me,()=>E()),Zi(he,()=>H(p),e=>I(p,e)),G(`change`,he,()=>E()),q(e,ne),Ge()}var jS=K(`<div class="error-banner svelte-1ik2acm"> </div>`),MS=K(`<div class="glass card panel-card action-panel svelte-1ik2acm"><div class="section-label">Create Handoff</div> <div class="form-stack svelte-1ik2acm"><label class="svelte-1ik2acm"><span class="svelte-1ik2acm">From agent</span><input class="form-input" placeholder="agent-a"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">To agent</span><input class="form-input" placeholder="agent-b (optional)"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Task code</span><input class="form-input" placeholder="TASK-123 (optional)"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Summary</span><textarea class="form-textarea summary-input svelte-1ik2acm" placeholder="What should the next agent know?"></textarea></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Context JSON</span><textarea class="form-textarea json-input svelte-1ik2acm"></textarea></label> <button class="btn btn-primary"><!> </button></div></div>`),NS=K(`<div class="claim-result svelte-1ik2acm"><div class="row-title svelte-1ik2acm"> </div> <div class="row-meta svelte-1ik2acm"><span> </span> <span> </span> <span> </span></div></div>`),PS=K(`<div class="glass card panel-card action-panel svelte-1ik2acm"><div class="section-label">Claim Task</div> <div class="form-stack svelte-1ik2acm"><label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Task code</span><input class="form-input" placeholder="TASK-123"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Agent</span><input class="form-input" placeholder="agent-name"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Role</span><input class="form-input" placeholder="worker"/></label> <label class="svelte-1ik2acm"><span class="svelte-1ik2acm">Metadata JSON</span><textarea class="form-textarea json-input svelte-1ik2acm" placeholder="Metadata JSON object"></textarea></label> <button class="btn btn-accent"><!> </button></div> <!></div>`),FS=K(`<div class="action-grid svelte-1ik2acm"><!> <!></div>`),IS=K(`<button class="btn btn-ghost btn-sm">Create handoff</button>`),LS=K(`<div class="muted-state svelte-1ik2acm">Loading handoffs...</div>`),RS=K(`<div class="empty-state svelte-1ik2acm"><!> <div class="empty-title svelte-1ik2acm">No handoffs found</div> <div class="empty-copy svelte-1ik2acm">Create a handoff when work needs context transfer between agents.</div></div>`),zS=K(`<span> </span>`),BS=K(`<button><div class="handoff-top svelte-1ik2acm"><span> </span> <span class="row-date svelte-1ik2acm"> </span></div> <div class="row-title svelte-1ik2acm"> </div> <div class="row-meta svelte-1ik2acm"><span> </span> <!></div></button>`),VS=K(`<div class="handoff-list svelte-1ik2acm"></div>`),HS=K(`<div class="linked-task svelte-1ik2acm"> </div>`),US=K(`<div class="detail-title svelte-1ik2acm"> </div> <div class="detail-grid svelte-1ik2acm"><div class="svelte-1ik2acm"><span class="svelte-1ik2acm">From</span><strong class="svelte-1ik2acm"> </strong></div> <div class="svelte-1ik2acm"><span class="svelte-1ik2acm">To</span><strong class="svelte-1ik2acm"> </strong></div> <div class="svelte-1ik2acm"><span class="svelte-1ik2acm">Status</span><strong class="svelte-1ik2acm"> </strong></div> <div class="svelte-1ik2acm"><span class="svelte-1ik2acm">Created</span><strong class="svelte-1ik2acm"> </strong></div></div> <div class="status-actions svelte-1ik2acm"><button class="btn btn-ghost btn-sm">Accept</button> <button class="btn btn-ghost btn-sm">Expire</button> <button class="btn btn-ghost btn-sm">Reject</button></div> <!>`,1),WS=K(`<div class="empty-state detail-empty svelte-1ik2acm"><!> <div class="empty-title svelte-1ik2acm">Select a handoff</div> <div class="empty-copy svelte-1ik2acm">Details for the selected handoff appear here.</div></div>`),GS=K(`<div class="feature-shell animate-fade-in svelte-1ik2acm"><div class="feature-toolbar glass card svelte-1ik2acm"><div class="toolbar-title svelte-1ik2acm"><!> <div><div class="section-label">Handoffs & Claims</div> <div class="toolbar-subtitle svelte-1ik2acm"> </div></div></div> <div class="toolbar-actions svelte-1ik2acm"><button class="btn btn-primary svelte-1ik2acm"><!> </button> <button class="btn btn-accent svelte-1ik2acm"><!> </button></div> <div class="toolbar-controls svelte-1ik2acm"><select class="form-select"><option>All statuses</option><option>Pending</option><option>Accepted</option><option>Rejected</option><option>Expired</option></select> <input class="form-input" placeholder="To agent filter"/> <button class="btn btn-ghost"><!> Refresh</button></div></div> <!> <!> <div class="feature-grid svelte-1ik2acm"><div class="glass card panel-card list-panel svelte-1ik2acm"><div class="panel-heading svelte-1ik2acm"><div class="section-label">Handoff Queue</div> <!></div> <!></div> <div class="glass card panel-card detail-panel svelte-1ik2acm"><!></div></div></div>`);function KS(e,t){We(t,!1);let n=Q(t,`repo`,8,``),r=F([]),i=F(!1),a=F(!1),o=F(!1),s=F(!1),c=F(``),l=F(`pending`),u=F(``),d=F(null),f=F(null),p=F(!1),m=F(!1),h=F({from_agent:``,to_agent:``,task_code:``,summary:``,context:``}),g=F({task_code:``,agent:``,role:`worker`,metadata:``});function _(e){return e?.structuredContent??null}function v(e){if(!e.trim())return{};let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`JSON must be an object.`);return t}function y(){return!!H(h).from_agent.trim()&&!!H(h).summary.trim()&&(!!H(h).to_agent.trim()||!!H(h).task_code.trim()||!!H(h).context.trim())}function b(e,t){let r=Object.fromEntries(e.map((e,n)=>[e,t[n]]));return{id:String(r.id||``),repo:n(),from_agent:String(r.from_agent||``),to_agent:r.to_agent?String(r.to_agent):null,task_id:r.task_id?String(r.task_id):null,summary:String(r.summary||``),context:{},status:String(r.status||`pending`),created_at:String(r.created_at||``),updated_at:String(r.created_at||``),expires_at:null}}async function x(){if(n()){I(i,!0),I(c,``);try{let e={repo:n(),status:H(l)||void 0,limit:50,structured:!0};H(u).trim()&&(e.to_agent=H(u).trim());let t=_(await fo.callTool(`handoff-list`,e)),i=t?.handoffs?.columns||[];I(r,(t?.handoffs?.rows||[]).map(e=>b(i,e))),H(d)&&!H(r).some(e=>e.id===H(d)?.id)&&I(d,null)}catch(e){I(c,e instanceof Error?e.message:String(e))}finally{I(i,!1)}}}async function S(){if(!(!H(h).from_agent.trim()||!H(h).summary.trim())){I(a,!0),I(c,``);try{let e=_(await fo.callTool(`handoff-create`,{repo:n(),from_agent:H(h).from_agent.trim(),to_agent:H(h).to_agent.trim()||void 0,task_code:H(h).task_code.trim()||void 0,summary:H(h).summary.trim(),context:v(H(h).context),structured:!0}));I(h,{from_agent:``,to_agent:``,task_code:``,summary:``,context:``}),I(p,!1),await x(),I(d,e||H(r)[0]||null)}catch(e){I(c,e instanceof Error?e.message:String(e))}finally{I(a,!1)}}}async function C(){if(!(!H(g).task_code.trim()||!H(g).agent.trim())){I(o,!0),I(c,``);try{I(f,_(await fo.callTool(`task-claim`,{repo:n(),task_code:H(g).task_code.trim(),agent:H(g).agent.trim(),role:H(g).role.trim()||`worker`,metadata:v(H(g).metadata),structured:!0}))),I(g,{task_code:``,agent:H(g).agent,role:H(g).role,metadata:``}),I(m,!1)}catch(e){I(c,e instanceof Error?e.message:String(e))}finally{I(o,!1)}}}async function w(e){if(H(d)){I(s,!0),I(c,``);try{await fo.callTool(`handoff-update`,{id:H(d).id,status:e,structured:!0}),await x(),I(d,H(r).find(e=>e.id===H(d)?.id)||null)}catch(e){I(c,e instanceof Error?e.message:String(e))}finally{I(s,!1)}}}Oa(()=>{x()}),B(()=>W(n()),()=>{n()&&x()}),Un(),Ta();var T=GS(),E=L(T),D=L(E),ee=L(D);$(ee,{name:`git-branch`,size:16,strokeWidth:2});var te=z(ee,2),ne=z(L(te),2),re=L(ne);j(ne),j(te),j(D);var ie=z(D,2),ae=L(ie),oe=L(ae);$(oe,{name:`git-branch`,size:14,strokeWidth:2});var O=z(oe);j(ae);var se=z(ae,2),ce=L(se);$(ce,{name:`check`,size:14,strokeWidth:2});var le=z(ce);j(se),j(ie);var ue=z(ie,2),de=L(ue),fe=L(de);fe.value=fe.__value=``;var pe=z(fe);pe.value=pe.__value=`pending`;var me=z(pe);me.value=me.__value=`accepted`;var he=z(me);he.value=he.__value=`rejected`;var ge=z(he);ge.value=ge.__value=`expired`,j(de);var _e=z(de,2);ca(_e);var ve=z(_e,2);$(L(ve),{name:`refresh-cw`,size:14,strokeWidth:2}),Ne(),j(ve),j(ue),j(E);var ye=z(E,2),be=e=>{var t=jS(),n=L(t,!0);j(t),V(()=>J(n,H(c))),q(e,t)};Y(ye,e=>{H(c)&&e(be)});var xe=z(ye,2),Se=e=>{var t=FS(),n=L(t),r=e=>{var t=MS(),n=z(L(t),2),r=L(n),i=z(L(r));ca(i),j(r);var o=z(r,2),s=z(L(o));ca(s),j(o);var c=z(o,2),l=z(L(c));ca(l),j(c);var u=z(c,2),d=z(L(u));On(d),j(u);var f=z(u,2),p=z(L(f));On(p),fa(p,`placeholder`,`{"next_steps":["..."],"blockers":[],"remaining_work":"..."}`),j(f);var m=z(f,2),g=L(m);$(g,{name:`git-branch`,size:14,strokeWidth:2});var _=z(g);j(m),j(n),j(t),V(e=>{m.disabled=e,J(_,` ${H(a)?`Creating...`:`Create Handoff`}`)},[()=>(H(a),U(()=>H(a)||!y()))]),Z(i,()=>H(h).from_agent,e=>sn(h,H(h).from_agent=e)),Z(s,()=>H(h).to_agent,e=>sn(h,H(h).to_agent=e)),Z(l,()=>H(h).task_code,e=>sn(h,H(h).task_code=e)),Z(d,()=>H(h).summary,e=>sn(h,H(h).summary=e)),Z(p,()=>H(h).context,e=>sn(h,H(h).context=e)),G(`click`,m,S),q(e,t)};Y(n,e=>{H(p)&&e(r)});var i=z(n,2),s=e=>{var t=PS(),n=z(L(t),2),r=L(n),i=z(L(r));ca(i),j(r);var a=z(r,2),s=z(L(a));ca(s),j(a);var c=z(a,2),l=z(L(c));ca(l),j(c);var u=z(c,2),d=z(L(u));On(d),j(u);var p=z(u,2),m=L(p);$(m,{name:`check`,size:14,strokeWidth:2});var h=z(m);j(p),j(n);var _=z(n,2),v=e=>{var t=NS(),n=L(t),r=L(n);j(n);var i=z(n,2),a=L(i),o=L(a,!0);j(a);var s=z(a,2),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(i),j(t),V(e=>{J(r,`Claimed ${(H(f),U(()=>H(f).task_code||H(f).task_id))??``}`),J(o,(H(f),U(()=>H(f).agent))),J(c,(H(f),U(()=>H(f).role))),J(u,e)},[()=>(W(il),H(f),U(()=>il(H(f).claimed_at)))]),q(e,t)};Y(_,e=>{H(f)&&e(v)}),j(t),V(e=>{p.disabled=e,J(h,` ${H(o)?`Claiming...`:`Claim Task`}`)},[()=>(H(o),H(g),U(()=>H(o)||!H(g).task_code.trim()||!H(g).agent.trim()))]),Z(i,()=>H(g).task_code,e=>sn(g,H(g).task_code=e)),Z(s,()=>H(g).agent,e=>sn(g,H(g).agent=e)),Z(l,()=>H(g).role,e=>sn(g,H(g).role=e)),Z(d,()=>H(g).metadata,e=>sn(g,H(g).metadata=e)),G(`click`,p,C),q(e,t)};Y(i,e=>{H(m)&&e(s)}),j(t),q(e,t)};Y(xe,e=>{(H(p)||H(m))&&e(Se)});var Ce=z(xe,2),we=L(Ce),Te=L(we),Ee=z(L(Te),2),De=e=>{var t=IS();G(`click`,t,()=>I(p,!0)),q(e,t)};Y(Ee,e=>{H(r),U(()=>H(r).length===0)&&e(De)}),j(Te);var Oe=z(Te,2),ke=e=>{q(e,LS())},k=e=>{var t=RS();$(L(t),{name:`git-branch`,size:22,strokeWidth:1.75}),Ne(4),j(t),q(e,t)},Ae=e=>{var t=VS();X(t,5,()=>H(r),e=>e.id,(e,t)=>{var n=BS();let r;var i=L(n),a=L(i),o=L(a,!0);j(a);var s=z(a,2),c=L(s,!0);j(s),j(i);var l=z(i,2),u=L(l,!0);j(l);var f=z(l,2),p=L(f),m=L(p);j(p);var h=z(p,2),g=e=>{var n=zS(),r=L(n,!0);j(n),V(e=>J(r,e),[()=>(H(t),U(()=>H(t).task_id.slice(0,8)))]),q(e,n)};Y(h,e=>{H(t),U(()=>H(t).task_id)&&e(g)}),j(f),j(n),V(e=>{r=Ki(n,1,`handoff-row svelte-1ik2acm`,null,r,{selected:H(d)?.id===H(t).id}),Ki(a,1,`status-pill status-${(H(t),U(()=>H(t).status))??``}`,`svelte-1ik2acm`),J(o,(H(t),U(()=>H(t).status))),J(c,e),J(u,(H(t),U(()=>H(t).summary))),J(m,`${(H(t),U(()=>H(t).from_agent))??``} -> ${(H(t),U(()=>H(t).to_agent||`unassigned`))??``}`)},[()=>(W(il),H(t),U(()=>il(H(t).created_at)))]),G(`click`,n,()=>I(d,H(t))),q(e,n)}),j(t),q(e,t)};Y(Oe,e=>{H(i)?e(ke):(H(r),U(()=>H(r).length===0)?e(k,1):e(Ae,-1))}),j(we);var A=z(we,2),je=L(A),Me=e=>{var t=US(),n=R(t),r=L(n,!0);j(n);var i=z(n,2),a=L(i),o=z(L(a)),c=L(o,!0);j(o),j(a);var l=z(a,2),u=z(L(l)),f=L(u,!0);j(u),j(l);var p=z(l,2),m=z(L(p)),h=L(m,!0);j(m),j(p);var g=z(p,2),_=z(L(g)),v=L(_,!0);j(_),j(g),j(i);var y=z(i,2),b=L(y),x=z(b,2),S=z(x,2);j(y);var C=z(y,2),T=e=>{var t=HS(),n=L(t);j(t),V(()=>J(n,`Task ID: ${(H(d),U(()=>H(d).task_id))??``}`)),q(e,t)};Y(C,e=>{H(d),U(()=>H(d).task_id)&&e(T)}),V(e=>{J(r,(H(d),U(()=>H(d).summary))),J(c,(H(d),U(()=>H(d).from_agent))),J(f,(H(d),U(()=>H(d).to_agent||`unassigned`))),J(h,(H(d),U(()=>H(d).status))),J(v,e),b.disabled=(H(s),H(d),U(()=>H(s)||H(d).status===`accepted`)),x.disabled=(H(s),H(d),U(()=>H(s)||H(d).status===`expired`)),S.disabled=(H(s),H(d),U(()=>H(s)||H(d).status===`rejected`))},[()=>(W(il),H(d),U(()=>il(H(d).created_at)))]),G(`click`,b,()=>w(`accepted`)),G(`click`,x,()=>w(`expired`)),G(`click`,S,()=>w(`rejected`)),q(e,t)},Pe=e=>{var t=WS();$(L(t),{name:`book-open`,size:22,strokeWidth:1.75}),Ne(4),j(t),q(e,t)};Y(je,e=>{H(d)?e(Me):e(Pe,-1)}),j(A),j(Ce),j(T),V(()=>{J(re,`${(H(r),U(()=>H(r).length))??``} handoffs in view`),J(O,` ${H(p)?`Close Handoff`:`New Handoff`}`),J(le,` ${H(m)?`Close Claim`:`Claim Task`}`)}),G(`click`,ae,()=>I(p,!H(p))),G(`click`,se,()=>I(m,!H(m))),Zi(de,()=>H(l),e=>I(l,e)),G(`change`,de,()=>x()),Z(_e,()=>H(u),e=>I(u,e)),G(`input`,_e,()=>x()),G(`click`,ve,x),q(e,T),Ge()}var qS=K(`<div class="drawer-overlay" style="z-index:38;" role="button" tabindex="0" aria-label="Close menu"></div> <div class="mobile-sidebar-shell"><!></div>`,1),JS=K(`<div style="text-align:center;padding:80px 20px;" class="animate-fade-in"><div style="display:inline-flex;width:72px;height:72px;border-radius:20px;background:linear-gradient(135deg,rgba(14,165,233,0.15),rgba(99,102,241,0.15));border:1px solid rgba(14,165,233,0.2);align-items:center;justify-content:center;margin-bottom:20px;" class="animate-float"><!></div> <div style="font-size:1.25rem;font-weight:800;color:var(--color-text);margin-bottom:8px;letter-spacing:-0.02em;">No Repository Selected</div> <div style="color:var(--color-text-muted);font-size:0.875rem;">Select a repository from the sidebar to get started.</div></div>`),YS=K(`<button><!> <span> </span></button>`),XS=K(`<div style="display:grid;grid-template-columns:1fr;gap:12px;align-items:start;" class="dashboard-grid svelte-1m88iwd"><div style="display:flex;flex-direction:column;gap:12px;"><div class="glass card hover-glow" style="padding:16px;"><div class="section-label" style="margin-bottom:10px;">Memory Overview</div> <!></div> <div class="glass card hover-glow" style="padding:16px;"><div class="section-label" style="margin-bottom:10px;">Task Overview</div> <!></div> <!></div></div>`),ZS=K(`<div class="glass card animate-fade-in" style="height:calc(100vh - 180px);display:flex;flex-direction:column;padding:0;overflow:hidden;border-radius:24px;"><div style="padding:16px 20px;border-bottom:1px solid var(--color-border);display:flex;align-items:center;justify-content:space-between;background:rgba(255,255,255,0.05);"><div class="flex items-center gap-3"><div style="width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,var(--color-primary),var(--color-accent));display:flex;align-items:center;justify-content:center;color:white;box-shadow:0 4px 12px var(--glow-primary);"><!></div> <div><div style="font-size:0.95rem;font-weight:800;color:var(--color-text);letter-spacing:-0.01em;">Recent Activity</div> <div style="font-size:0.68rem;color:var(--color-text-muted);font-weight:600;"> </div></div></div></div> <div style="flex:1;overflow-y:auto;padding:24px 32px;background:rgba(0,0,0,0.02);"><!></div></div>`),QS=K(`<div class="glass card hover-glow animate-fade-in"><div class="flex items-center gap-2" style="margin-bottom:16px;"><!> <div class="section-label">Memory Explorer</div></div> <!></div>`),$S=K(`<div class="animate-fade-in"><div class="glass card hover-glow" style="margin-bottom:20px;"><div class="flex items-center gap-2" style="margin-bottom:16px;"><!> <div class="stat-label">Task Overview</div></div> <!></div></div>`),eC=K(`<div class="tabs-wrap"><div class="tab-nav" style="display:inline-flex;"></div></div> <!> <!> <!> <!> <!> <!> <!>`,1),tC=K(`<div class="app-layout"><!> <div><!> <!> <div id="dashboardShell" class="dashboard-shell"><!></div></div></div> <!> <!> <!> <!> <!> <!>`,1);function nC(e,t){We(t,!1);let n=()=>P(Fa,`$activeTab`,s),r=()=>P(g,`$sidebarCollapsed`,s),i=()=>P(f,`$appState`,s),a=()=>P(La,`$currentRepo`,s),o=()=>P(no,`$recentActionsTotalItems`,s),[s,c]=pt(),l=F(),u=F(),d=mo({get kanbanBoard(){return H(l)},get memoryList(){return H(u)}}),f={subscribe:d.subscribe,set:d.set,update:d.update},{filteredTools:p,filteredPrompts:m,filteredResources:h,sidebarCollapsed:g,TABS:_}=d;Oa(async()=>{if(co(),await d.loadRepos(),await d.loadHealth(),await d.loadData(),n()===`reference`&&!N(d).capabilities)try{let e=await fo.capabilities();d.update(t=>({...t,capabilities:e}))}catch(e){console.error(`Failed to load capabilities:`,e)}}),Ta();var v=tC();G(`keydown`,hn,function(...e){d.onKeyDown?.apply(this,e)});var y=R(v),b=L(y);Hl(b,{get onRepoSelect(){return d.onRepoSelect}});var x=z(b,2);let S;var C=L(x);tu(C,{get onRefresh(){return d.onRefresh},get onToggleMobileMenu(){return d.toggleMobileMenu}});var w=z(C,2),T=e=>{var t=qS(),n=R(t),r=z(n,2);Hl(L(r),{get onRepoSelect(){return d.onRepoSelect}}),j(r),G(`click`,n,()=>d.toggleMobileMenu()),G(`keydown`,n,e=>e.key===`Escape`&&d.toggleMobileMenu()),q(e,t)};Y(w,e=>{i().mobileMenuOpen&&e(T)});var E=z(w,2),D=L(E),ee=e=>{var t=JS(),n=L(t);$(L(n),{name:`brain`,size:32,strokeWidth:1.5,className:``}),j(n),Ne(4),j(t),q(e,t)},te=e=>{var t=eC(),r=R(t),i=L(r);X(i,5,()=>_,e=>e.id,(e,t)=>{var r=YS();let i;var a=L(r);$(a,{get name(){return H(t).icon},size:14,strokeWidth:1.75});var o=z(a,2),s=L(o,!0);j(o),j(r),V(()=>{i=Ki(r,1,`tab-btn`,null,i,{active:n()===H(t).id}),fa(r,`id`,`tab-${H(t).id??``}`),J(s,H(t).label)}),G(`click`,r,()=>d.onTabChange(H(t).id)),q(e,r)}),j(i),j(r);var s=z(r,2),c=e=>{var t=XS(),n=L(t),r=L(n);Pu(z(L(r),2),{}),j(r);var i=z(r,2);Bu(z(L(i),2),{}),j(i),oy(z(i,2),{}),j(n),j(t),q(e,t)};Y(s,e=>{n()===`dashboard`&&e(c)});var g=z(s,2),v=e=>{var t=ZS(),n=L(t),r=L(n),i=L(r);$(L(i),{name:`activity`,size:18,strokeWidth:2.2}),j(i);var a=z(i,2),s=z(L(a),2),c=L(s);j(s),j(a),j(r),j(n);var l=z(n,2);ab(L(l),{get onLoadPage(){return d.loadRecentActions}}),j(l),j(t),V(()=>J(c,`${o()??``} events tracked`)),q(e,t)};Y(g,e=>{n()===`activity`&&e(v)});var y=z(g,2),b=e=>{var t=QS(),n=L(t);$(L(n),{name:`brain`,size:14,strokeWidth:1.75}),Ne(2),j(n),Sa(wy(z(n,2),{get onMemoryClick(){return d.openMemoryDrawer},get onNewMemory(){return d.openNewMemoryDrawer},onBulkImport:()=>d.openBulkImport(`memories`),$$legacy:!0}),e=>I(u,e),()=>H(u)),j(t),q(e,t)};Y(y,e=>{n()===`memories`&&e(b)});var x=z(y,2),S=e=>{var t=$S(),n=L(t),r=L(n);$(L(r),{name:`columns`,size:14,strokeWidth:1.75}),Ne(2),j(r),Sa(Du(z(r,2),{get onTaskClick(){return d.openTaskDrawer},onAddTask:()=>d.toggleAddTaskModal(!0),onBulkImport:()=>d.openBulkImport(`tasks`),$$legacy:!0}),e=>I(l,e),()=>H(l)),j(n),j(t),q(e,t)};Y(x,e=>{n()===`tasks`&&e(S)});var C=z(x,2),w=e=>{AS(e,{get repo(){return a()}})};Y(C,e=>{n()===`standards`&&e(w)});var T=z(C,2),E=e=>{KS(e,{get repo(){return a()}})};Y(T,e=>{n()===`handoffs`&&e(E)});var D=z(T,2),ee=e=>{sS(e,{get handler(){return d},get appState(){return f},get filteredTools(){return p},get filteredPrompts(){return m},get filteredResources(){return h}})};Y(D,e=>{n()===`reference`&&e(ee)}),q(e,t)};Y(D,e=>{a()?e(te,-1):e(ee)}),j(E),j(x),j(y);var ne=z(y,2);Nb(ne,{get memory(){return i().selectedMemory},get task(){return i().selectedTask},get open(){return i().drawerOpen},get onClose(){return d.closeDrawer},get onTaskUpdated(){return d.handleTaskUpdated},onTaskDeleted:()=>{a()&&H(l)?.loadTasks(a())}});var re=z(ne,2);tx(re,{get item(){return i().selectedReference},get open(){return i().referenceDrawerOpen},onClose:()=>d.toggleReferenceDrawer(!1)});var ie=z(re,2);bx(ie,{get memory(){return i().memoryDrawerItem},get open(){return i().memoryDrawerOpen},onClose:()=>d.toggleMemoryDrawer(!1),get onSaved(){return d.handleMemorySaved},get onDeleted(){return d.handleMemoryDeleted}});var ae=z(ie,2);Bx(ae,{get open(){return i().addTaskModalOpen},get newTask(){return i().newTask},onClose:()=>d.toggleAddTaskModal(!1),get onSave(){return d.createTask}});var oe=z(ae,2);{let e=Yt(()=>a()||``);Ix(oe,{get repo(){return H(e)},get importTarget(){return i().bulkImportTarget},get isOpen(){return i().bulkImportOpen},$$events:{close:()=>d.toggleBulkImport(!1),success:()=>{i().bulkImportTarget===`memories`&&H(u)?.refresh(),i().bulkImportTarget===`tasks`&&a()&&H(l)?.loadTasks(a())}}})}uS(z(oe,2),{get onNewMemory(){return d.openNewMemoryDrawer},onNewTask:()=>d.toggleAddTaskModal(!0)}),V(()=>S=Ki(x,1,`main-content`,null,S,{"sidebar-collapsed":r()})),q(e,v),Ge(),c()}fi(nC,{target:document.getElementById(`app`)});
|