agent-issues 0.0.121 → 0.0.127
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/build-info.json +3 -0
- package/dist/cli.js +97746 -26
- package/kanban/dist/assets/index-CIAg6qj5.css +1 -0
- package/kanban/dist/assets/index-DaYQjJS7.js +920 -0
- package/kanban/dist/index.html +13 -0
- package/package.json +12 -11
- package/site/dist/assets/{index-Cx-fLU3e.js → index-BRvRYF7I.js} +195 -146
- package/site/dist/index.html +1 -1
- package/dist/agent-installer.d.ts +0 -49
- package/dist/agent-installer.js +0 -171
- package/dist/agent-installer.js.map +0 -1
- package/dist/auth-session.d.ts +0 -40
- package/dist/auth-session.js +0 -107
- package/dist/auth-session.js.map +0 -1
- package/dist/body-backfill.d.ts +0 -26
- package/dist/body-backfill.js +0 -219
- package/dist/body-backfill.js.map +0 -1
- package/dist/build-mode.d.ts +0 -1
- package/dist/build-mode.js +0 -1
- package/dist/build-mode.js.map +0 -1
- package/dist/cli/commands/auth.d.ts +0 -61
- package/dist/cli/commands/auth.js +0 -134
- package/dist/cli/commands/auth.js.map +0 -1
- package/dist/cli/commands/backfill.d.ts +0 -8
- package/dist/cli/commands/backfill.js +0 -36
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/comments.d.ts +0 -34
- package/dist/cli/commands/comments.js +0 -124
- package/dist/cli/commands/comments.js.map +0 -1
- package/dist/cli/commands/context.d.ts +0 -13
- package/dist/cli/commands/context.js +0 -156
- package/dist/cli/commands/context.js.map +0 -1
- package/dist/cli/commands/entities.d.ts +0 -91
- package/dist/cli/commands/entities.js +0 -420
- package/dist/cli/commands/entities.js.map +0 -1
- package/dist/cli/commands/export.d.ts +0 -20
- package/dist/cli/commands/export.js +0 -98
- package/dist/cli/commands/export.js.map +0 -1
- package/dist/cli/commands/fallback.d.ts +0 -6
- package/dist/cli/commands/fallback.js +0 -10
- package/dist/cli/commands/fallback.js.map +0 -1
- package/dist/cli/commands/handoff.d.ts +0 -1
- package/dist/cli/commands/handoff.js +0 -2
- package/dist/cli/commands/handoff.js.map +0 -1
- package/dist/cli/commands/installers.d.ts +0 -37
- package/dist/cli/commands/installers.js +0 -78
- package/dist/cli/commands/installers.js.map +0 -1
- package/dist/cli/commands/kanban.d.ts +0 -8
- package/dist/cli/commands/kanban.js +0 -83
- package/dist/cli/commands/kanban.js.map +0 -1
- package/dist/cli/commands/meta.d.ts +0 -14
- package/dist/cli/commands/meta.js +0 -33
- package/dist/cli/commands/meta.js.map +0 -1
- package/dist/cli/commands/plan-entries.d.ts +0 -30
- package/dist/cli/commands/plan-entries.js +0 -94
- package/dist/cli/commands/plan-entries.js.map +0 -1
- package/dist/cli/commands/site.d.ts +0 -29
- package/dist/cli/commands/site.js +0 -89
- package/dist/cli/commands/site.js.map +0 -1
- package/dist/cli/commands/sql.d.ts +0 -6
- package/dist/cli/commands/sql.js +0 -21
- package/dist/cli/commands/sql.js.map +0 -1
- package/dist/cli/commands/synchronize.d.ts +0 -12
- package/dist/cli/commands/synchronize.js +0 -31
- package/dist/cli/commands/synchronize.js.map +0 -1
- package/dist/cli/commands/tenants.d.ts +0 -29
- package/dist/cli/commands/tenants.js +0 -101
- package/dist/cli/commands/tenants.js.map +0 -1
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/index.js +0 -120
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/renderers.d.ts +0 -250
- package/dist/cli/renderers.js +0 -286
- package/dist/cli/renderers.js.map +0 -1
- package/dist/cli/shared.d.ts +0 -97
- package/dist/cli/shared.js +0 -192
- package/dist/cli/shared.js.map +0 -1
- package/dist/cli.d.ts +0 -11
- package/dist/cli.js.map +0 -1
- package/dist/context-cli.d.ts +0 -16
- package/dist/context-cli.js +0 -131
- package/dist/context-cli.js.map +0 -1
- package/dist/daemon/daemon-lifecycle.d.ts +0 -1
- package/dist/daemon/daemon-lifecycle.js +0 -2
- package/dist/daemon/daemon-lifecycle.js.map +0 -1
- package/dist/daemon/daemon-main.d.ts +0 -14
- package/dist/daemon/daemon-main.js +0 -30
- package/dist/daemon/daemon-main.js.map +0 -1
- package/dist/daemon/local-daemon-store.d.ts +0 -21
- package/dist/daemon/local-daemon-store.js +0 -31
- package/dist/daemon/local-daemon-store.js.map +0 -1
- package/dist/entity-projection.d.ts +0 -141
- package/dist/entity-projection.js +0 -147
- package/dist/entity-projection.js.map +0 -1
- package/dist/entra-device-login.d.ts +0 -12
- package/dist/entra-device-login.js +0 -40
- package/dist/entra-device-login.js.map +0 -1
- package/dist/export-files.d.ts +0 -24
- package/dist/export-files.js +0 -230
- package/dist/export-files.js.map +0 -1
- package/dist/export-markdown.d.ts +0 -24
- package/dist/export-markdown.js +0 -343
- package/dist/export-markdown.js.map +0 -1
- package/dist/help.d.ts +0 -112
- package/dist/help.js +0 -1430
- package/dist/help.js.map +0 -1
- package/dist/kanban/assets.d.ts +0 -3
- package/dist/kanban/assets.js +0 -37
- package/dist/kanban/assets.js.map +0 -1
- package/dist/kanban/index.d.ts +0 -1
- package/dist/kanban/index.js +0 -2
- package/dist/kanban/index.js.map +0 -1
- package/dist/kanban/server.d.ts +0 -28
- package/dist/kanban/server.js +0 -118
- package/dist/kanban/server.js.map +0 -1
- package/dist/mcp-installer.d.ts +0 -32
- package/dist/mcp-installer.js +0 -118
- package/dist/mcp-installer.js.map +0 -1
- package/dist/mcp-server/index.d.ts +0 -11
- package/dist/mcp-server/index.js +0 -504
- package/dist/mcp-server/index.js.map +0 -1
- package/dist/mcp-server/index.test.d.ts +0 -1
- package/dist/mcp-server/index.test.js +0 -746
- package/dist/mcp-server/index.test.js.map +0 -1
- package/dist/mcp-server/mcp-tool-audit.d.ts +0 -6
- package/dist/mcp-server/mcp-tool-audit.js +0 -47
- package/dist/mcp-server/mcp-tool-audit.js.map +0 -1
- package/dist/mcp-server/stdio.d.ts +0 -2
- package/dist/mcp-server/stdio.js +0 -7
- package/dist/mcp-server/stdio.js.map +0 -1
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -19
- package/dist/mcp.js.map +0 -1
- package/dist/open-storage-driver.d.ts +0 -55
- package/dist/open-storage-driver.js +0 -73
- package/dist/open-storage-driver.js.map +0 -1
- package/dist/open-synchronize-stores.d.ts +0 -24
- package/dist/open-synchronize-stores.js +0 -34
- package/dist/open-synchronize-stores.js.map +0 -1
- package/dist/project-identity.d.ts +0 -23
- package/dist/project-identity.js +0 -121
- package/dist/project-identity.js.map +0 -1
- package/dist/runtime-access-boundary.d.ts +0 -7
- package/dist/runtime-access-boundary.js +0 -182
- package/dist/runtime-access-boundary.js.map +0 -1
- package/dist/service-discovery.d.ts +0 -10
- package/dist/service-discovery.js +0 -64
- package/dist/service-discovery.js.map +0 -1
- package/dist/site/assets.d.ts +0 -4
- package/dist/site/assets.js +0 -46
- package/dist/site/assets.js.map +0 -1
- package/dist/site/cloud-events-relay.d.ts +0 -16
- package/dist/site/cloud-events-relay.js +0 -78
- package/dist/site/cloud-events-relay.js.map +0 -1
- package/dist/site/index.d.ts +0 -1
- package/dist/site/index.js +0 -2
- package/dist/site/index.js.map +0 -1
- package/dist/site/server.d.ts +0 -42
- package/dist/site/server.js +0 -632
- package/dist/site/server.js.map +0 -1
- package/dist/skill-installer.d.ts +0 -35
- package/dist/skill-installer.js +0 -180
- package/dist/skill-installer.js.map +0 -1
- package/dist/vitest-setup.d.ts +0 -1
- package/dist/vitest-setup.js +0 -7
- package/dist/vitest-setup.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();var pa=Object.defineProperty,ha=(n,e,t)=>e in n?pa(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ts=(n,e,t)=>(ha(n,typeof e!="symbol"?e+"":e,t),t),ga=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Cs=(n,e)=>{if(Object(e)!==e)throw TypeError('Cannot use the "in" operator on this value');return n.has(e)},Ot=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},cr=(n,e,t)=>(ga(n,e,"access private method"),t);function cn(n,e){return Object.is(n,e)}let V=null,bt=!1,Bt=1;const qt=Symbol("SIGNAL");function Xe(n){const e=V;return V=n,e}function fa(){return V}function ma(){return bt}const di={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function ss(n){if(bt)throw new Error(typeof ngDevMode<"u"&&ngDevMode?"Assertion error: signal read during notification phase":"");if(V===null)return;V.consumerOnSignalRead(n);const e=V.nextProducerIndex++;if(st(V),e<V.producerNode.length&&V.producerNode[e]!==n&&qs(V)){const t=V.producerNode[e];is(t,V.producerIndexOfThis[e])}V.producerNode[e]!==n&&(V.producerNode[e]=n,V.producerIndexOfThis[e]=qs(V)?pn(n,V,e):0),V.producerLastReadVersion[e]=n.version}function ba(){Bt++}function dn(n){if(!(!n.dirty&&n.lastCleanEpoch===Bt)){if(!n.producerMustRecompute(n)&&!Sa(n)){n.dirty=!1,n.lastCleanEpoch=Bt;return}n.producerRecomputeValue(n),n.dirty=!1,n.lastCleanEpoch=Bt}}function un(n){if(n.liveConsumerNode===void 0)return;const e=bt;bt=!0;try{for(const t of n.liveConsumerNode)t.dirty||va(t)}finally{bt=e}}function xa(){return V?.consumerAllowSignalWrites!==!1}function va(n){var e;n.dirty=!0,un(n),(e=n.consumerMarkedDirty)==null||e.call(n.wrapper??n)}function ya(n){return n&&(n.nextProducerIndex=0),Xe(n)}function wa(n,e){if(Xe(e),!(!n||n.producerNode===void 0||n.producerIndexOfThis===void 0||n.producerLastReadVersion===void 0)){if(qs(n))for(let t=n.nextProducerIndex;t<n.producerNode.length;t++)is(n.producerNode[t],n.producerIndexOfThis[t]);for(;n.producerNode.length>n.nextProducerIndex;)n.producerNode.pop(),n.producerLastReadVersion.pop(),n.producerIndexOfThis.pop()}}function Sa(n){st(n);for(let e=0;e<n.producerNode.length;e++){const t=n.producerNode[e],s=n.producerLastReadVersion[e];if(s!==t.version||(dn(t),s!==t.version))return!0}return!1}function pn(n,e,t){var s;if(ui(n),st(n),n.liveConsumerNode.length===0){(s=n.watched)==null||s.call(n.wrapper);for(let i=0;i<n.producerNode.length;i++)n.producerIndexOfThis[i]=pn(n.producerNode[i],n,i)}return n.liveConsumerIndexOfThis.push(t),n.liveConsumerNode.push(e)-1}function is(n,e){var t;if(ui(n),st(n),typeof ngDevMode<"u"&&ngDevMode&&e>=n.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${e} is out of bounds of ${n.liveConsumerNode.length} consumers)`);if(n.liveConsumerNode.length===1){(t=n.unwatched)==null||t.call(n.wrapper);for(let i=0;i<n.producerNode.length;i++)is(n.producerNode[i],n.producerIndexOfThis[i])}const s=n.liveConsumerNode.length-1;if(n.liveConsumerNode[e]=n.liveConsumerNode[s],n.liveConsumerIndexOfThis[e]=n.liveConsumerIndexOfThis[s],n.liveConsumerNode.length--,n.liveConsumerIndexOfThis.length--,e<n.liveConsumerNode.length){const i=n.liveConsumerIndexOfThis[e],r=n.liveConsumerNode[e];st(r),r.producerIndexOfThis[i]=e}}function qs(n){var e;return n.consumerIsAlwaysLive||(((e=n?.liveConsumerNode)==null?void 0:e.length)??0)>0}function st(n){n.producerNode??(n.producerNode=[]),n.producerIndexOfThis??(n.producerIndexOfThis=[]),n.producerLastReadVersion??(n.producerLastReadVersion=[])}function ui(n){n.liveConsumerNode??(n.liveConsumerNode=[]),n.liveConsumerIndexOfThis??(n.liveConsumerIndexOfThis=[])}function hn(n){if(dn(n),ss(n),n.value===Hs)throw n.error;return n.value}function ka(n){const e=Object.create($a);e.computation=n;const t=()=>hn(e);return t[qt]=e,t}const Rs=Symbol("UNSET"),Es=Symbol("COMPUTING"),Hs=Symbol("ERRORED"),$a={...di,value:Rs,dirty:!0,error:null,equal:cn,producerMustRecompute(n){return n.value===Rs||n.value===Es},producerRecomputeValue(n){if(n.value===Es)throw new Error("Detected cycle in computations.");const e=n.value;n.value=Es;const t=ya(n);let s,i=!1;try{s=n.computation.call(n.wrapper),i=e!==Rs&&e!==Hs&&n.equal.call(n.wrapper,e,s)}catch(r){s=Hs,n.error=r}finally{wa(n,t)}if(i){n.value=e;return}n.value=s,n.version++}};function Ia(){throw new Error}let Ta=Ia;function Ca(){Ta()}function Ra(n){const e=Object.create(Aa);e.value=n;const t=()=>(ss(e),e.value);return t[qt]=e,t}function Ea(){return ss(this),this.value}function _a(n,e){xa()||Ca(),n.equal.call(n.wrapper,n.value,e)||(n.value=e,Pa(n))}const Aa={...di,equal:cn,value:void 0};function Pa(n){n.version++,ba(),un(n)}const X=Symbol("node");var te;(n=>{var e,t,s,i;class r{constructor(l,u={}){Ot(this,t),Ts(this,e);const d=Ra(l)[qt];if(this[X]=d,d.wrapper=this,u){const g=u.equals;g&&(d.equal=g),d.watched=u[n.subtle.watched],d.unwatched=u[n.subtle.unwatched]}}get(){if(!(0,n.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return Ea.call(this[X])}set(l){if(!(0,n.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(ma())throw new Error("Writes to signals not permitted during Watcher callback");const u=this[X];_a(u,l)}}e=X,t=new WeakSet,n.isState=o=>typeof o=="object"&&Cs(t,o),n.State=r;class a{constructor(l,u){Ot(this,i),Ts(this,s);const d=ka(l)[qt];if(d.consumerAllowSignalWrites=!0,this[X]=d,d.wrapper=this,u){const g=u.equals;g&&(d.equal=g),d.watched=u[n.subtle.watched],d.unwatched=u[n.subtle.unwatched]}}get(){if(!(0,n.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return hn(this[X])}}s=X,i=new WeakSet,n.isComputed=o=>typeof o=="object"&&Cs(i,o),n.Computed=a,(o=>{var l,u,p,d;function g(R){let A,C=null;try{C=Xe(null),A=R()}finally{Xe(C)}return A}o.untrack=g;function v(R){var A;if(!(0,n.isComputed)(R)&&!(0,n.isWatcher)(R))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return((A=R[X].producerNode)==null?void 0:A.map(C=>C.wrapper))??[]}o.introspectSources=v;function y(R){var A;if(!(0,n.isComputed)(R)&&!(0,n.isState)(R))throw new TypeError("Called introspectSinks without a Signal argument");return((A=R[X].liveConsumerNode)==null?void 0:A.map(C=>C.wrapper))??[]}o.introspectSinks=y;function L(R){if(!(0,n.isComputed)(R)&&!(0,n.isState)(R))throw new TypeError("Called hasSinks without a Signal argument");const A=R[X].liveConsumerNode;return A?A.length>0:!1}o.hasSinks=L;function O(R){if(!(0,n.isComputed)(R)&&!(0,n.isWatcher)(R))throw new TypeError("Called hasSources without a Computed or Watcher argument");const A=R[X].producerNode;return A?A.length>0:!1}o.hasSources=O;class I{constructor(A){Ot(this,u),Ot(this,p),Ts(this,l);let C=Object.create(di);C.wrapper=this,C.consumerMarkedDirty=A,C.consumerIsAlwaysLive=!0,C.consumerAllowSignalWrites=!1,C.producerNode=[],this[X]=C}watch(...A){if(!(0,n.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");cr(this,p,d).call(this,A);const C=this[X];C.dirty=!1;const T=Xe(C);for(const z of A)ss(z[X]);Xe(T)}unwatch(...A){if(!(0,n.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");cr(this,p,d).call(this,A);const C=this[X];st(C);for(let T=C.producerNode.length-1;T>=0;T--)if(A.includes(C.producerNode[T].wrapper)){is(C.producerNode[T],C.producerIndexOfThis[T]);const z=C.producerNode.length-1;if(C.producerNode[T]=C.producerNode[z],C.producerIndexOfThis[T]=C.producerIndexOfThis[z],C.producerNode.length--,C.producerIndexOfThis.length--,C.nextProducerIndex--,T<C.producerNode.length){const m=C.producerIndexOfThis[T],M=C.producerNode[T];ui(M),M.liveConsumerIndexOfThis[m]=T}}}getPending(){if(!(0,n.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[X].producerNode.filter(C=>C.dirty).map(C=>C.wrapper)}}l=X,u=new WeakSet,p=new WeakSet,d=function(R){for(const A of R)if(!(0,n.isComputed)(A)&&!(0,n.isState)(A))throw new TypeError("Called watch/unwatch without a Computed or State argument")},n.isWatcher=R=>Cs(u,R),o.Watcher=I;function x(){var R;return(R=fa())==null?void 0:R.wrapper}o.currentComputed=x,o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(n.subtle||(n.subtle={}))})(te||(te={}));let _s=!1;const dr=new te.subtle.Watcher(()=>{_s||(_s=!0,queueMicrotask(()=>{_s=!1;for(const n of dr.getPending())n.get();dr.watch()}))}),La=Symbol("SignalWatcherBrand"),Da=new FinalizationRegistry(n=>{n.unwatch(...te.subtle.introspectSources(n))}),ur=new WeakMap;function rs(n){return n[La]===!0?(console.warn("SignalWatcher should not be applied to the same class more than once."),n):class extends n{constructor(){super(...arguments),this._$St=new Map,this._$So=new te.State(0),this._$Si=!1}_$Sl(){var e,t;const s=[],i=[];this._$St.forEach((a,o)=>{(a?.beforeUpdate?s:i).push(o)});const r=(e=this.h)===null||e===void 0?void 0:e.getPending().filter(a=>a!==this._$Su&&!this._$St.has(a));s.forEach(a=>a.get()),(t=this._$Su)===null||t===void 0||t.get(),r.forEach(a=>a.get()),i.forEach(a=>a.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(this.h!==void 0)return;this._$Su=new te.Computed(()=>{this._$So.get(),super.performUpdate()});const e=this.h=new te.subtle.Watcher(function(){const t=ur.get(this);t!==void 0&&(t._$Si===!1&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});ur.set(e,this),Da.register(this,e),e.watch(this._$Su),e.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(this.h===void 0)return;let e=!1;this.h.unwatch(...te.subtle.introspectSources(this.h).filter(t=>{var s;const i=((s=this._$St.get(t))===null||s===void 0?void 0:s.manualDispose)!==!0;return i&&this._$St.delete(t),e||(e=!i),i})),e||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(e,t){var s;this._$S_();const i=new te.Computed(()=>{e()});return this.h.watch(i),this._$St.set(i,t),(s=t?.beforeUpdate)!==null&&s!==void 0&&s?te.subtle.untrack(()=>i.get()):this.updateComplete.then(()=>te.subtle.untrack(()=>i.get())),()=>{this._$St.delete(i),this.h.unwatch(i),this.isConnected===!1&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{this.isConnected===!1&&this._$Sp()})}}}const pi={ATTRIBUTE:1,CHILD:2},hi=n=>(...e)=>({_$litDirective$:n,values:e});let gi=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const fi=globalThis,pr=n=>n,Ht=fi.trustedTypes,hr=Ht?Ht.createPolicy("lit-html",{createHTML:n=>n}):void 0,gn="$lit$",Ce=`lit$${Math.random().toFixed(9).slice(2)}$`,fn="?"+Ce,ja=`<${fn}>`,Me=document,vt=()=>Me.createComment(""),yt=n=>n===null||typeof n!="object"&&typeof n!="function",mi=Array.isArray,Oa=n=>mi(n)||typeof n?.[Symbol.iterator]=="function",As=`[
|
|
2
|
-
\f\r]`,ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),mr=/'/g,br=/"/g,mn=/^(?:script|style|textarea|title)$/i,bn=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),h=bn(1),Nt=bn(2),ve=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),xr=new WeakMap,Ne=Me.createTreeWalker(Me,129);function xn(n,e){if(!mi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return hr!==void 0?hr.createHTML(e):e}const Na=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",a=ct;for(let o=0;o<t;o++){const l=n[o];let u,p,d=-1,g=0;for(;g<l.length&&(a.lastIndex=g,p=a.exec(l),p!==null);)g=a.lastIndex,a===ct?p[1]==="!--"?a=gr:p[1]!==void 0?a=fr:p[2]!==void 0?(mn.test(p[2])&&(i=RegExp("</"+p[2],"g")),a=Pe):p[3]!==void 0&&(a=Pe):a===Pe?p[0]===">"?(a=i??ct,d=-1):p[1]===void 0?d=-2:(d=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?Pe:p[3]==='"'?br:mr):a===br||a===mr?a=Pe:a===gr||a===fr?a=ct:(a=Pe,i=void 0);const v=a===Pe&&n[o+1].startsWith("/>")?" ":"";r+=a===ct?l+ja:d>=0?(s.push(u),l.slice(0,d)+gn+l.slice(d)+Ce+v):l+Ce+(d===-2?o:v)}return[xn(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let Ks=class vn{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[u,p]=Na(e,t);if(this.el=vn.createElement(u,s),Ne.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=Ne.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(gn)){const g=p[a++],v=i.getAttribute(d).split(Ce),y=/([.?@])?(.*)/.exec(g);l.push({type:1,index:r,name:y[2],strings:v,ctor:y[1]==="."?Fa:y[1]==="?"?za:y[1]==="@"?Ba:as}),i.removeAttribute(d)}else d.startsWith(Ce)&&(l.push({type:6,index:r}),i.removeAttribute(d));if(mn.test(i.tagName)){const d=i.textContent.split(Ce),g=d.length-1;if(g>0){i.textContent=Ht?Ht.emptyScript:"";for(let v=0;v<g;v++)i.append(d[v],vt()),Ne.nextNode(),l.push({type:2,index:++r});i.append(d[g],vt())}}}else if(i.nodeType===8)if(i.data===fn)l.push({type:2,index:r});else{let d=-1;for(;(d=i.data.indexOf(Ce,d+1))!==-1;)l.push({type:7,index:r}),d+=Ce.length-1}r++}}static createElement(e,t){const s=Me.createElement("template");return s.innerHTML=e,s}};function it(n,e,t=n,s){if(e===ve)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=yt(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=it(n,i._$AS(n,e.values),i,s)),e}let Ma=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??Me).importNode(t,!0);Ne.currentNode=i;let r=Ne.nextNode(),a=0,o=0,l=s[0];for(;l!==void 0;){if(a===l.index){let u;l.type===2?u=new ns(r,r.nextSibling,this,e):l.type===1?u=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(u=new Ua(r,this,e)),this._$AV.push(u),l=s[++o]}a!==l?.index&&(r=Ne.nextNode(),a++)}return Ne.currentNode=Me,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},ns=class yn{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=it(this,e,t),yt(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==ve&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Oa(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&yt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Me.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=Ks.createElement(xn(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new Ma(i,this),a=r.u(this.options);r.p(t),this.T(a),this._$AH=r}}_$AC(e){let t=xr.get(e.strings);return t===void 0&&xr.set(e.strings,t=new Ks(e)),t}k(e){mi(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new yn(this.O(vt()),this.O(vt()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=pr(e).nextSibling;pr(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},as=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,i){const r=this.strings;let a=!1;if(r===void 0)e=it(this,e,t,0),a=!yt(e)||e!==this._$AH&&e!==ve,a&&(this._$AH=e);else{const o=e;let l,u;for(e=r[0],l=0;l<r.length-1;l++)u=it(this,o[s+l],t,l),u===ve&&(u=this._$AH[l]),a||=!yt(u)||u!==this._$AH[l],u===k?e=k:e!==k&&(e+=(u??"")+r[l+1]),this._$AH[l]=u}a&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fa=class extends as{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},za=class extends as{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ba=class extends as{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=it(this,e,t,0)??k)===ve)return;const s=this._$AH,i=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==k&&(s===k||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ua=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){it(this,e)}};const Ga={I:ns},qa=fi.litHtmlPolyfillSupport;qa?.(Ks,ns),(fi.litHtmlVersions??=[]).push("3.3.3");const Ha=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new ns(e.insertBefore(vt(),r),r,void 0,t??{})}return i._$AI(n),i};const{I:Ka}=Ga,vr=n=>n,yr=()=>document.createComment(""),dt=(n,e,t)=>{const s=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){const r=s.insertBefore(yr(),i),a=s.insertBefore(yr(),i);t=new Ka(r,a,n,n.options)}else{const r=t._$AB.nextSibling,a=t._$AM,o=a!==n;if(o){let l;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(l=n._$AU)!==a._$AU&&t._$AP(l)}if(r!==i||o){let l=t._$AA;for(;l!==r;){const u=vr(l).nextSibling;vr(s).insertBefore(l,i),l=u}}}return t},Le=(n,e,t=n)=>(n._$AI(e,t),n),Wa={},Va=(n,e=Wa)=>n._$AH=e,Qa=n=>n._$AH,Ps=n=>{n._$AR(),n._$AA.remove()};let Ls=!1;const wr=new te.subtle.Watcher(async()=>{Ls||(Ls=!0,queueMicrotask(()=>{Ls=!1;for(const n of wr.getPending())n.get();wr.watch()}))});te.State;te.Computed;const _=(n,e)=>new te.State(n,e),j=(n,e)=>new te.Computed(n,e);const Ut=globalThis,bi=Ut.ShadowRoot&&(Ut.ShadyCSS===void 0||Ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xi=Symbol(),Sr=new WeakMap;let wn=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==xi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(bi&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Sr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Sr.set(t,e))}return e}toString(){return this.cssText}};const Ya=n=>new wn(typeof n=="string"?n:n+"",void 0,xi),he=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new wn(t,n,xi)},Ja=(n,e)=>{if(bi)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=Ut.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},kr=bi?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ya(t)})(n):n;const{is:Za,defineProperty:Xa,getOwnPropertyDescriptor:eo,getOwnPropertyNames:to,getOwnPropertySymbols:so,getPrototypeOf:io}=Object,os=globalThis,$r=os.trustedTypes,ro=$r?$r.emptyScript:"",no=os.reactiveElementPolyfillSupport,xt=(n,e)=>n,Ws={toAttribute(n,e){switch(e){case Boolean:n=n?ro:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Sn=(n,e)=>!Za(n,e),Ir={attribute:!0,type:String,converter:Ws,reflect:!1,useDefault:!1,hasChanged:Sn};Symbol.metadata??=Symbol("metadata"),os.litPropertyMetadata??=new WeakMap;let Je=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ir){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Xa(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=eo(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);r?.call(this,a),this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ir}static _$Ei(){if(this.hasOwnProperty(xt("elementProperties")))return;const e=io(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xt("properties"))){const t=this.properties,s=[...to(t),...so(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(kr(i))}else e!==void 0&&t.push(kr(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ja(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:Ws).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),a=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Ws;this._$Em=i;const o=a.fromAttribute(t,r.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const a=this.constructor;if(i===!1&&(r=this[e]),s??=a.getPropertyOptions(e),!((s.hasChanged??Sn)(r,t)||s.useDefault&&s.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:r},a){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),r!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:a}=r,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,r,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Je.elementStyles=[],Je.shadowRootOptions={mode:"open"},Je[xt("elementProperties")]=new Map,Je[xt("finalized")]=new Map,no?.({ReactiveElement:Je}),(os.reactiveElementVersions??=[]).push("2.1.2");const vi=globalThis;class ce extends Je{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ve}}ce._$litElement$=!0,ce.finalized=!0,vi.litElementHydrateSupport?.({LitElement:ce});const ao=vi.litElementPolyfillSupport;ao?.({LitElement:ce});(vi.litElementVersions??=[]).push("4.2.2");const et=(n,e,t)=>{for(const s of e)if(s[0]===n)return(0,s[1])();return t?.()};const Y=hi(class extends gi{constructor(n){if(super(n),n.type!==pi.ATTRIBUTE||n.name!=="class"||n.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(e=>n[e]).join(" ")+" "}update(n,[e]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(e)}const t=n.element.classList;for(const s of this.st)s in e||(t.remove(s),this.st.delete(s));for(const s in e){const i=!!e[s];i===this.st.has(s)||this.nt?.has(s)||(i?(t.add(s),this.st.add(s)):(t.remove(s),this.st.delete(s)))}return ve}});function*Gt(n,e){if(n!==void 0){let t=0;for(const s of n)yield e(s,t++)}}const Tr=(n,e,t)=>{const s=new Map;for(let i=e;i<=t;i++)s.set(n[i],i);return s},D=hi(class extends gi{constructor(n){if(super(n),n.type!==pi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let s;t===void 0?t=e:e!==void 0&&(s=e);const i=[],r=[];let a=0;for(const o of n)i[a]=s?s(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,s]){const i=Qa(n),{values:r,keys:a}=this.dt(e,t,s);if(!Array.isArray(i))return this.ut=a,r;const o=this.ut??=[],l=[];let u,p,d=0,g=i.length-1,v=0,y=r.length-1;for(;d<=g&&v<=y;)if(i[d]===null)d++;else if(i[g]===null)g--;else if(o[d]===a[v])l[v]=Le(i[d],r[v]),d++,v++;else if(o[g]===a[y])l[y]=Le(i[g],r[y]),g--,y--;else if(o[d]===a[y])l[y]=Le(i[d],r[y]),dt(n,l[y+1],i[d]),d++,y--;else if(o[g]===a[v])l[v]=Le(i[g],r[v]),dt(n,i[d],i[g]),g--,v++;else if(u===void 0&&(u=Tr(a,v,y),p=Tr(o,d,g)),u.has(o[d]))if(u.has(o[g])){const L=p.get(a[v]),O=L!==void 0?i[L]:null;if(O===null){const I=dt(n,i[d]);Le(I,r[v]),l[v]=I}else l[v]=Le(O,r[v]),dt(n,i[d],O),i[L]=null;v++}else Ps(i[g]),g--;else Ps(i[d]),d++;for(;v<=y;){const L=dt(n,l[y+1]);Le(L,r[v]),l[v++]=L}for(;d<=g;){const L=i[d++];L!==null&&Ps(L)}return this.ut=a,Va(n,l),ve}});function w(n,e,t){return n?e(n):t?.(n)}const ls=he`
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();var pa=Object.defineProperty,ha=(n,e,t)=>e in n?pa(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ts=(n,e,t)=>(ha(n,typeof e!="symbol"?e+"":e,t),t),ga=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Cs=(n,e)=>{if(Object(e)!==e)throw TypeError('Cannot use the "in" operator on this value');return n.has(e)},Ot=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},lr=(n,e,t)=>(ga(n,e,"access private method"),t);function on(n,e){return Object.is(n,e)}let W=null,bt=!1,Bt=1;const qt=Symbol("SIGNAL");function Xe(n){const e=W;return W=n,e}function fa(){return W}function ma(){return bt}const ci={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function ss(n){if(bt)throw new Error(typeof ngDevMode<"u"&&ngDevMode?"Assertion error: signal read during notification phase":"");if(W===null)return;W.consumerOnSignalRead(n);const e=W.nextProducerIndex++;if(st(W),e<W.producerNode.length&&W.producerNode[e]!==n&&qs(W)){const t=W.producerNode[e];is(t,W.producerIndexOfThis[e])}W.producerNode[e]!==n&&(W.producerNode[e]=n,W.producerIndexOfThis[e]=qs(W)?dn(n,W,e):0),W.producerLastReadVersion[e]=n.version}function ba(){Bt++}function ln(n){if(!(!n.dirty&&n.lastCleanEpoch===Bt)){if(!n.producerMustRecompute(n)&&!Sa(n)){n.dirty=!1,n.lastCleanEpoch=Bt;return}n.producerRecomputeValue(n),n.dirty=!1,n.lastCleanEpoch=Bt}}function cn(n){if(n.liveConsumerNode===void 0)return;const e=bt;bt=!0;try{for(const t of n.liveConsumerNode)t.dirty||xa(t)}finally{bt=e}}function va(){return W?.consumerAllowSignalWrites!==!1}function xa(n){var e;n.dirty=!0,cn(n),(e=n.consumerMarkedDirty)==null||e.call(n.wrapper??n)}function ya(n){return n&&(n.nextProducerIndex=0),Xe(n)}function wa(n,e){if(Xe(e),!(!n||n.producerNode===void 0||n.producerIndexOfThis===void 0||n.producerLastReadVersion===void 0)){if(qs(n))for(let t=n.nextProducerIndex;t<n.producerNode.length;t++)is(n.producerNode[t],n.producerIndexOfThis[t]);for(;n.producerNode.length>n.nextProducerIndex;)n.producerNode.pop(),n.producerLastReadVersion.pop(),n.producerIndexOfThis.pop()}}function Sa(n){st(n);for(let e=0;e<n.producerNode.length;e++){const t=n.producerNode[e],s=n.producerLastReadVersion[e];if(s!==t.version||(ln(t),s!==t.version))return!0}return!1}function dn(n,e,t){var s;if(di(n),st(n),n.liveConsumerNode.length===0){(s=n.watched)==null||s.call(n.wrapper);for(let i=0;i<n.producerNode.length;i++)n.producerIndexOfThis[i]=dn(n.producerNode[i],n,i)}return n.liveConsumerIndexOfThis.push(t),n.liveConsumerNode.push(e)-1}function is(n,e){var t;if(di(n),st(n),typeof ngDevMode<"u"&&ngDevMode&&e>=n.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${e} is out of bounds of ${n.liveConsumerNode.length} consumers)`);if(n.liveConsumerNode.length===1){(t=n.unwatched)==null||t.call(n.wrapper);for(let i=0;i<n.producerNode.length;i++)is(n.producerNode[i],n.producerIndexOfThis[i])}const s=n.liveConsumerNode.length-1;if(n.liveConsumerNode[e]=n.liveConsumerNode[s],n.liveConsumerIndexOfThis[e]=n.liveConsumerIndexOfThis[s],n.liveConsumerNode.length--,n.liveConsumerIndexOfThis.length--,e<n.liveConsumerNode.length){const i=n.liveConsumerIndexOfThis[e],r=n.liveConsumerNode[e];st(r),r.producerIndexOfThis[i]=e}}function qs(n){var e;return n.consumerIsAlwaysLive||(((e=n?.liveConsumerNode)==null?void 0:e.length)??0)>0}function st(n){n.producerNode??(n.producerNode=[]),n.producerIndexOfThis??(n.producerIndexOfThis=[]),n.producerLastReadVersion??(n.producerLastReadVersion=[])}function di(n){n.liveConsumerNode??(n.liveConsumerNode=[]),n.liveConsumerIndexOfThis??(n.liveConsumerIndexOfThis=[])}function un(n){if(ln(n),ss(n),n.value===Hs)throw n.error;return n.value}function ka(n){const e=Object.create($a);e.computation=n;const t=()=>un(e);return t[qt]=e,t}const Rs=Symbol("UNSET"),Es=Symbol("COMPUTING"),Hs=Symbol("ERRORED"),$a={...ci,value:Rs,dirty:!0,error:null,equal:on,producerMustRecompute(n){return n.value===Rs||n.value===Es},producerRecomputeValue(n){if(n.value===Es)throw new Error("Detected cycle in computations.");const e=n.value;n.value=Es;const t=ya(n);let s,i=!1;try{s=n.computation.call(n.wrapper),i=e!==Rs&&e!==Hs&&n.equal.call(n.wrapper,e,s)}catch(r){s=Hs,n.error=r}finally{wa(n,t)}if(i){n.value=e;return}n.value=s,n.version++}};function Ia(){throw new Error}let Ta=Ia;function Ca(){Ta()}function Ra(n){const e=Object.create(Aa);e.value=n;const t=()=>(ss(e),e.value);return t[qt]=e,t}function Ea(){return ss(this),this.value}function _a(n,e){va()||Ca(),n.equal.call(n.wrapper,n.value,e)||(n.value=e,Pa(n))}const Aa={...ci,equal:on,value:void 0};function Pa(n){n.version++,ba(),cn(n)}const ee=Symbol("node");var se;(n=>{var e,t,s,i;class r{constructor(l,u={}){Ot(this,t),Ts(this,e);const d=Ra(l)[qt];if(this[ee]=d,d.wrapper=this,u){const g=u.equals;g&&(d.equal=g),d.watched=u[n.subtle.watched],d.unwatched=u[n.subtle.unwatched]}}get(){if(!(0,n.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return Ea.call(this[ee])}set(l){if(!(0,n.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(ma())throw new Error("Writes to signals not permitted during Watcher callback");const u=this[ee];_a(u,l)}}e=ee,t=new WeakSet,n.isState=o=>typeof o=="object"&&Cs(t,o),n.State=r;class a{constructor(l,u){Ot(this,i),Ts(this,s);const d=ka(l)[qt];if(d.consumerAllowSignalWrites=!0,this[ee]=d,d.wrapper=this,u){const g=u.equals;g&&(d.equal=g),d.watched=u[n.subtle.watched],d.unwatched=u[n.subtle.unwatched]}}get(){if(!(0,n.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return un(this[ee])}}s=ee,i=new WeakSet,n.isComputed=o=>typeof o=="object"&&Cs(i,o),n.Computed=a,(o=>{var l,u,p,d;function g(y){let R,T=null;try{T=Xe(null),R=y()}finally{Xe(T)}return R}o.untrack=g;function b(y){var R;if(!(0,n.isComputed)(y)&&!(0,n.isWatcher)(y))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return((R=y[ee].producerNode)==null?void 0:R.map(T=>T.wrapper))??[]}o.introspectSources=b;function x(y){var R;if(!(0,n.isComputed)(y)&&!(0,n.isState)(y))throw new TypeError("Called introspectSinks without a Signal argument");return((R=y[ee].liveConsumerNode)==null?void 0:R.map(T=>T.wrapper))??[]}o.introspectSinks=x;function E(y){if(!(0,n.isComputed)(y)&&!(0,n.isState)(y))throw new TypeError("Called hasSinks without a Signal argument");const R=y[ee].liveConsumerNode;return R?R.length>0:!1}o.hasSinks=E;function O(y){if(!(0,n.isComputed)(y)&&!(0,n.isWatcher)(y))throw new TypeError("Called hasSources without a Computed or Watcher argument");const R=y[ee].producerNode;return R?R.length>0:!1}o.hasSources=O;class I{constructor(R){Ot(this,u),Ot(this,p),Ts(this,l);let T=Object.create(ci);T.wrapper=this,T.consumerMarkedDirty=R,T.consumerIsAlwaysLive=!0,T.consumerAllowSignalWrites=!1,T.producerNode=[],this[ee]=T}watch(...R){if(!(0,n.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");lr(this,p,d).call(this,R);const T=this[ee];T.dirty=!1;const M=Xe(T);for(const X of R)ss(X[ee]);Xe(M)}unwatch(...R){if(!(0,n.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");lr(this,p,d).call(this,R);const T=this[ee];st(T);for(let M=T.producerNode.length-1;M>=0;M--)if(R.includes(T.producerNode[M].wrapper)){is(T.producerNode[M],T.producerIndexOfThis[M]);const X=T.producerNode.length-1;if(T.producerNode[M]=T.producerNode[X],T.producerIndexOfThis[M]=T.producerIndexOfThis[X],T.producerNode.length--,T.producerIndexOfThis.length--,T.nextProducerIndex--,M<T.producerNode.length){const m=T.producerIndexOfThis[M],P=T.producerNode[M];di(P),P.liveConsumerIndexOfThis[m]=M}}}getPending(){if(!(0,n.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[ee].producerNode.filter(T=>T.dirty).map(T=>T.wrapper)}}l=ee,u=new WeakSet,p=new WeakSet,d=function(y){for(const R of y)if(!(0,n.isComputed)(R)&&!(0,n.isState)(R))throw new TypeError("Called watch/unwatch without a Computed or State argument")},n.isWatcher=y=>Cs(u,y),o.Watcher=I;function _(){var y;return(y=fa())==null?void 0:y.wrapper}o.currentComputed=_,o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(n.subtle||(n.subtle={}))})(se||(se={}));let _s=!1;const cr=new se.subtle.Watcher(()=>{_s||(_s=!0,queueMicrotask(()=>{_s=!1;for(const n of cr.getPending())n.get();cr.watch()}))}),La=Symbol("SignalWatcherBrand"),Da=new FinalizationRegistry(n=>{n.unwatch(...se.subtle.introspectSources(n))}),dr=new WeakMap;function rs(n){return n[La]===!0?(console.warn("SignalWatcher should not be applied to the same class more than once."),n):class extends n{constructor(){super(...arguments),this._$St=new Map,this._$So=new se.State(0),this._$Si=!1}_$Sl(){var e,t;const s=[],i=[];this._$St.forEach((a,o)=>{(a?.beforeUpdate?s:i).push(o)});const r=(e=this.h)===null||e===void 0?void 0:e.getPending().filter(a=>a!==this._$Su&&!this._$St.has(a));s.forEach(a=>a.get()),(t=this._$Su)===null||t===void 0||t.get(),r.forEach(a=>a.get()),i.forEach(a=>a.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(this.h!==void 0)return;this._$Su=new se.Computed(()=>{this._$So.get(),super.performUpdate()});const e=this.h=new se.subtle.Watcher(function(){const t=dr.get(this);t!==void 0&&(t._$Si===!1&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});dr.set(e,this),Da.register(this,e),e.watch(this._$Su),e.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(this.h===void 0)return;let e=!1;this.h.unwatch(...se.subtle.introspectSources(this.h).filter(t=>{var s;const i=((s=this._$St.get(t))===null||s===void 0?void 0:s.manualDispose)!==!0;return i&&this._$St.delete(t),e||(e=!i),i})),e||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(e,t){var s;this._$S_();const i=new se.Computed(()=>{e()});return this.h.watch(i),this._$St.set(i,t),(s=t?.beforeUpdate)!==null&&s!==void 0&&s?se.subtle.untrack(()=>i.get()):this.updateComplete.then(()=>se.subtle.untrack(()=>i.get())),()=>{this._$St.delete(i),this.h.unwatch(i),this.isConnected===!1&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{this.isConnected===!1&&this._$Sp()})}}}const ui={ATTRIBUTE:1,CHILD:2},pi=n=>(...e)=>({_$litDirective$:n,values:e});let hi=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const gi=globalThis,ur=n=>n,Ht=gi.trustedTypes,pr=Ht?Ht.createPolicy("lit-html",{createHTML:n=>n}):void 0,pn="$lit$",Ce=`lit$${Math.random().toFixed(9).slice(2)}$`,hn="?"+Ce,ja=`<${hn}>`,Me=document,xt=()=>Me.createComment(""),yt=n=>n===null||typeof n!="object"&&typeof n!="function",fi=Array.isArray,Oa=n=>fi(n)||typeof n?.[Symbol.iterator]=="function",As=`[
|
|
2
|
+
\f\r]`,ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hr=/-->/g,gr=/>/g,Pe=RegExp(`>|${As}(?:([^\\s"'>=/]+)(${As}*=${As}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),fr=/'/g,mr=/"/g,gn=/^(?:script|style|textarea|title)$/i,fn=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),h=fn(1),Nt=fn(2),xe=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),br=new WeakMap,Ne=Me.createTreeWalker(Me,129);function mn(n,e){if(!fi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return pr!==void 0?pr.createHTML(e):e}const Na=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",a=ct;for(let o=0;o<t;o++){const l=n[o];let u,p,d=-1,g=0;for(;g<l.length&&(a.lastIndex=g,p=a.exec(l),p!==null);)g=a.lastIndex,a===ct?p[1]==="!--"?a=hr:p[1]!==void 0?a=gr:p[2]!==void 0?(gn.test(p[2])&&(i=RegExp("</"+p[2],"g")),a=Pe):p[3]!==void 0&&(a=Pe):a===Pe?p[0]===">"?(a=i??ct,d=-1):p[1]===void 0?d=-2:(d=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?Pe:p[3]==='"'?mr:fr):a===mr||a===fr?a=Pe:a===hr||a===gr?a=ct:(a=Pe,i=void 0);const b=a===Pe&&n[o+1].startsWith("/>")?" ":"";r+=a===ct?l+ja:d>=0?(s.push(u),l.slice(0,d)+pn+l.slice(d)+Ce+b):l+Ce+(d===-2?o:b)}return[mn(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let Ks=class bn{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[u,p]=Na(e,t);if(this.el=bn.createElement(u,s),Ne.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=Ne.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(pn)){const g=p[a++],b=i.getAttribute(d).split(Ce),x=/([.?@])?(.*)/.exec(g);l.push({type:1,index:r,name:x[2],strings:b,ctor:x[1]==="."?Fa:x[1]==="?"?za:x[1]==="@"?Ba:as}),i.removeAttribute(d)}else d.startsWith(Ce)&&(l.push({type:6,index:r}),i.removeAttribute(d));if(gn.test(i.tagName)){const d=i.textContent.split(Ce),g=d.length-1;if(g>0){i.textContent=Ht?Ht.emptyScript:"";for(let b=0;b<g;b++)i.append(d[b],xt()),Ne.nextNode(),l.push({type:2,index:++r});i.append(d[g],xt())}}}else if(i.nodeType===8)if(i.data===hn)l.push({type:2,index:r});else{let d=-1;for(;(d=i.data.indexOf(Ce,d+1))!==-1;)l.push({type:7,index:r}),d+=Ce.length-1}r++}}static createElement(e,t){const s=Me.createElement("template");return s.innerHTML=e,s}};function it(n,e,t=n,s){if(e===xe)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=yt(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=it(n,i._$AS(n,e.values),i,s)),e}let Ma=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??Me).importNode(t,!0);Ne.currentNode=i;let r=Ne.nextNode(),a=0,o=0,l=s[0];for(;l!==void 0;){if(a===l.index){let u;l.type===2?u=new ns(r,r.nextSibling,this,e):l.type===1?u=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(u=new Ua(r,this,e)),this._$AV.push(u),l=s[++o]}a!==l?.index&&(r=Ne.nextNode(),a++)}return Ne.currentNode=Me,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},ns=class vn{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=it(this,e,t),yt(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==xe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Oa(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&yt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Me.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=Ks.createElement(mn(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new Ma(i,this),a=r.u(this.options);r.p(t),this.T(a),this._$AH=r}}_$AC(e){let t=br.get(e.strings);return t===void 0&&br.set(e.strings,t=new Ks(e)),t}k(e){fi(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new vn(this.O(xt()),this.O(xt()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=ur(e).nextSibling;ur(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},as=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,i){const r=this.strings;let a=!1;if(r===void 0)e=it(this,e,t,0),a=!yt(e)||e!==this._$AH&&e!==xe,a&&(this._$AH=e);else{const o=e;let l,u;for(e=r[0],l=0;l<r.length-1;l++)u=it(this,o[s+l],t,l),u===xe&&(u=this._$AH[l]),a||=!yt(u)||u!==this._$AH[l],u===k?e=k:e!==k&&(e+=(u??"")+r[l+1]),this._$AH[l]=u}a&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fa=class extends as{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},za=class extends as{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ba=class extends as{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=it(this,e,t,0)??k)===xe)return;const s=this._$AH,i=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==k&&(s===k||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ua=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){it(this,e)}};const Ga={I:ns},qa=gi.litHtmlPolyfillSupport;qa?.(Ks,ns),(gi.litHtmlVersions??=[]).push("3.3.3");const Ha=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new ns(e.insertBefore(xt(),r),r,void 0,t??{})}return i._$AI(n),i};const{I:Ka}=Ga,vr=n=>n,xr=()=>document.createComment(""),dt=(n,e,t)=>{const s=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){const r=s.insertBefore(xr(),i),a=s.insertBefore(xr(),i);t=new Ka(r,a,n,n.options)}else{const r=t._$AB.nextSibling,a=t._$AM,o=a!==n;if(o){let l;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(l=n._$AU)!==a._$AU&&t._$AP(l)}if(r!==i||o){let l=t._$AA;for(;l!==r;){const u=vr(l).nextSibling;vr(s).insertBefore(l,i),l=u}}}return t},Le=(n,e,t=n)=>(n._$AI(e,t),n),Wa={},Va=(n,e=Wa)=>n._$AH=e,Qa=n=>n._$AH,Ps=n=>{n._$AR(),n._$AA.remove()};let Ls=!1;const yr=new se.subtle.Watcher(async()=>{Ls||(Ls=!0,queueMicrotask(()=>{Ls=!1;for(const n of yr.getPending())n.get();yr.watch()}))});se.State;se.Computed;const A=(n,e)=>new se.State(n,e),j=(n,e)=>new se.Computed(n,e);const Ut=globalThis,mi=Ut.ShadowRoot&&(Ut.ShadyCSS===void 0||Ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bi=Symbol(),wr=new WeakMap;let xn=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==bi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(mi&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=wr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&wr.set(t,e))}return e}toString(){return this.cssText}};const Ya=n=>new xn(typeof n=="string"?n:n+"",void 0,bi),ge=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new xn(t,n,bi)},Ja=(n,e)=>{if(mi)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=Ut.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},Sr=mi?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ya(t)})(n):n;const{is:Za,defineProperty:Xa,getOwnPropertyDescriptor:eo,getOwnPropertyNames:to,getOwnPropertySymbols:so,getPrototypeOf:io}=Object,os=globalThis,kr=os.trustedTypes,ro=kr?kr.emptyScript:"",no=os.reactiveElementPolyfillSupport,vt=(n,e)=>n,Ws={toAttribute(n,e){switch(e){case Boolean:n=n?ro:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},yn=(n,e)=>!Za(n,e),$r={attribute:!0,type:String,converter:Ws,reflect:!1,useDefault:!1,hasChanged:yn};Symbol.metadata??=Symbol("metadata"),os.litPropertyMetadata??=new WeakMap;let Je=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$r){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Xa(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=eo(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);r?.call(this,a),this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$r}static _$Ei(){if(this.hasOwnProperty(vt("elementProperties")))return;const e=io(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vt("properties"))){const t=this.properties,s=[...to(t),...so(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(Sr(i))}else e!==void 0&&t.push(Sr(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ja(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:Ws).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),a=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Ws;this._$Em=i;const o=a.fromAttribute(t,r.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const a=this.constructor;if(i===!1&&(r=this[e]),s??=a.getPropertyOptions(e),!((s.hasChanged??yn)(r,t)||s.useDefault&&s.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:r},a){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),r!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:a}=r,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,r,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Je.elementStyles=[],Je.shadowRootOptions={mode:"open"},Je[vt("elementProperties")]=new Map,Je[vt("finalized")]=new Map,no?.({ReactiveElement:Je}),(os.reactiveElementVersions??=[]).push("2.1.2");const vi=globalThis;class de extends Je{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xe}}de._$litElement$=!0,de.finalized=!0,vi.litElementHydrateSupport?.({LitElement:de});const ao=vi.litElementPolyfillSupport;ao?.({LitElement:de});(vi.litElementVersions??=[]).push("4.2.2");const et=(n,e,t)=>{for(const s of e)if(s[0]===n)return(0,s[1])();return t?.()};const Q=pi(class extends hi{constructor(n){if(super(n),n.type!==ui.ATTRIBUTE||n.name!=="class"||n.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(e=>n[e]).join(" ")+" "}update(n,[e]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(e)}const t=n.element.classList;for(const s of this.st)s in e||(t.remove(s),this.st.delete(s));for(const s in e){const i=!!e[s];i===this.st.has(s)||this.nt?.has(s)||(i?(t.add(s),this.st.add(s)):(t.remove(s),this.st.delete(s)))}return xe}});function*Gt(n,e){if(n!==void 0){let t=0;for(const s of n)yield e(s,t++)}}const Ir=(n,e,t)=>{const s=new Map;for(let i=e;i<=t;i++)s.set(n[i],i);return s},D=pi(class extends hi{constructor(n){if(super(n),n.type!==ui.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let s;t===void 0?t=e:e!==void 0&&(s=e);const i=[],r=[];let a=0;for(const o of n)i[a]=s?s(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,s]){const i=Qa(n),{values:r,keys:a}=this.dt(e,t,s);if(!Array.isArray(i))return this.ut=a,r;const o=this.ut??=[],l=[];let u,p,d=0,g=i.length-1,b=0,x=r.length-1;for(;d<=g&&b<=x;)if(i[d]===null)d++;else if(i[g]===null)g--;else if(o[d]===a[b])l[b]=Le(i[d],r[b]),d++,b++;else if(o[g]===a[x])l[x]=Le(i[g],r[x]),g--,x--;else if(o[d]===a[x])l[x]=Le(i[d],r[x]),dt(n,l[x+1],i[d]),d++,x--;else if(o[g]===a[b])l[b]=Le(i[g],r[b]),dt(n,i[d],i[g]),g--,b++;else if(u===void 0&&(u=Ir(a,b,x),p=Ir(o,d,g)),u.has(o[d]))if(u.has(o[g])){const E=p.get(a[b]),O=E!==void 0?i[E]:null;if(O===null){const I=dt(n,i[d]);Le(I,r[b]),l[b]=I}else l[b]=Le(O,r[b]),dt(n,i[d],O),i[E]=null;b++}else Ps(i[g]),g--;else Ps(i[d]),d++;for(;b<=x;){const E=dt(n,l[x+1]);Le(E,r[b]),l[b++]=E}for(;d<=g;){const E=i[d++];E!==null&&Ps(E)}return this.ut=a,Va(n,l),xe}});function w(n,e,t){return n?e(n):t?.(n)}const ls=ge`
|
|
4
4
|
button,
|
|
5
5
|
input,
|
|
6
6
|
select,
|
|
@@ -58,7 +58,7 @@ h3 {
|
|
|
58
58
|
font-weight: 600;
|
|
59
59
|
line-height: 1.35;
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`,xi=ge`
|
|
62
62
|
input,
|
|
63
63
|
select {
|
|
64
64
|
width: 100%;
|
|
@@ -199,7 +199,7 @@ select:focus,
|
|
|
199
199
|
background: var(--danger-bg);
|
|
200
200
|
color: var(--danger);
|
|
201
201
|
}
|
|
202
|
-
`,Qt=class Qt extends
|
|
202
|
+
`,Qt=class Qt extends de{constructor(){super(...arguments),this.context=null,this.emptyMessage="No context has been defined yet.",this.targetTerm=null}focusTargetTerm(){const e=[...this.renderRoot.querySelectorAll(".term")];for(const s of e)s.classList.remove("is-context-term-target");const t=e.find(s=>s.dataset.term===this.targetTerm);t&&(t.offsetWidth,t.classList.add("is-context-term-target"),t.focus({preventScroll:!0}),typeof t.scrollIntoView=="function"&&t.scrollIntoView({behavior:"smooth",block:"center"}))}updated(){this.focusTargetTerm()}renderTerm(e){return h`
|
|
203
203
|
<div
|
|
204
204
|
class="term"
|
|
205
205
|
data-term=${e.term}
|
|
@@ -225,7 +225,7 @@ select:focus,
|
|
|
225
225
|
${w(t.length>0,()=>h`<div class="terms">${D(t,i=>i.term,i=>this.renderTerm(i))}</div>`,()=>h`<p class="empty">No glossary terms have been defined yet.</p>`)}
|
|
226
226
|
`,()=>h`<p class="empty">${this.emptyMessage}</p>`)}
|
|
227
227
|
</div>
|
|
228
|
-
`}};Qt.properties={context:{attribute:!1},emptyMessage:{attribute:!1},targetTerm:{attribute:!1}},Qt.styles=[ls,
|
|
228
|
+
`}};Qt.properties={context:{attribute:!1},emptyMessage:{attribute:!1},targetTerm:{attribute:!1}},Qt.styles=[ls,ge`
|
|
229
229
|
:host {
|
|
230
230
|
display: block;
|
|
231
231
|
}
|
|
@@ -315,7 +315,7 @@ select:focus,
|
|
|
315
315
|
margin: 0;
|
|
316
316
|
color: var(--muted);
|
|
317
317
|
}
|
|
318
|
-
`];let Vs=Qt;customElements.define("agent-issues-context-view",Vs);const
|
|
318
|
+
`];let Vs=Qt;customElements.define("agent-issues-context-view",Vs);const Tr={"context-term":"T",context:"C",entity:"R","issue-comment":"M","plan-entry":"P"},oo=[{label:"Records",value:"entity"},{label:"Context",value:"context"},{label:"Terms",value:"context-term"},{label:"Plan entries",value:"plan-entry"},{label:"Comments",value:"issue-comment"}],Cr=20,Ri=class Ri extends rs(de){constructor(){super(...arguments),this.store=null,this.activeResultIndex=0,this.syntaxHelpOpen=!1,this.onInput=e=>{this.activeResultIndex=0,this.store?.setGlobalSearchQuery(e.target.value)},this.onScopeToggle=e=>{this.activeResultIndex=0,this.store?.setGlobalSearchScope(e.target.checked?"all-projects":"current-project")},this.onSourceTypeToggle=e=>{this.activeResultIndex=0;const t=e.currentTarget.dataset.sourceType,s=this.store?.globalSearchSourceTypes.get()??[],i=s.includes(t)?s.filter(r=>r!==t):[...s,t];this.store?.setGlobalSearchSourceTypes(i)},this.onToggleSyntaxHelp=()=>{this.syntaxHelpOpen=!this.syntaxHelpOpen,this.requestUpdate()},this.onResultClick=e=>{const t=Number(e.currentTarget.dataset.resultIndex),s=this.results[t];s&&this.openResult(s.navigationTarget)},this.onRecentClick=e=>{const t=Number(e.currentTarget.dataset.recentIndex),s=this.recents[t];s&&this.openResult(s.target)},this.onRetry=()=>{this.dispatchEvent(new CustomEvent("global-search-retry",{bubbles:!0,composed:!0}))},this.onBackdropPointerDown=e=>{e.target===e.currentTarget&&this.close()},this.onKeyDown=e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.close();return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(this.results.length===0)return;e.preventDefault();const r=e.key==="ArrowDown"?1:-1;this.activeResultIndex=(this.activeResultIndex+r+this.results.length)%this.results.length,this.requestUpdate();return}if(e.key==="Enter"){const r=this.results[this.activeResultIndex];if(!r)return;e.preventDefault(),this.openResult(r.navigationTarget);return}if(e.key!=="Tab")return;const t=[...this.renderRoot.querySelectorAll("button, input, select, [tabindex]:not([tabindex='-1'])")].filter(r=>!r.hasAttribute("disabled")),s=t[0],i=t.at(-1);!s||!i||(e.shiftKey&&this.shadowRoot?.activeElement===s?(e.preventDefault(),i.focus()):!e.shiftKey&&this.shadowRoot?.activeElement===i&&(e.preventDefault(),s.focus()))},this.onWindowKeyDown=e=>{e.key==="Escape"&&(e.preventDefault(),this.close())}}focusInput(){this.renderRoot.querySelector("input")?.focus()}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onWindowKeyDown)}disconnectedCallback(){window.removeEventListener("keydown",this.onWindowKeyDown),super.disconnectedCallback()}get results(){const e=this.store?.globalSearchResponse.get();return e?.state==="available"?e.results:this.store?.globalSearchResults.get()??[]}get recents(){return this.store?.globalSearchRecentRecords.get()??[]}openResult(e){this.dispatchEvent(new CustomEvent("global-search-open-target",{bubbles:!0,composed:!0,detail:e}))}close(){this.dispatchEvent(new CustomEvent("global-search-close",{bubbles:!0,composed:!0}))}renderSnippet(e){const t=e.snippet;if(!t)return"";const s=[];let i=0;for(const r of t.highlights)s.push(t.text.slice(i,r.start)),s.push(h`<mark>${t.text.slice(r.start,r.end)}</mark>`),i=r.end;return s.push(t.text.slice(i)),s}renderResult(e,t){const s=t===this.activeResultIndex;return h`
|
|
319
319
|
<button
|
|
320
320
|
aria-selected=${w(s,()=>"true",()=>"false")}
|
|
321
321
|
class="result"
|
|
@@ -324,7 +324,7 @@ select:focus,
|
|
|
324
324
|
type="button"
|
|
325
325
|
@click=${this.onResultClick}
|
|
326
326
|
>
|
|
327
|
-
<span aria-hidden="true" class="result-icon">${
|
|
327
|
+
<span aria-hidden="true" class="result-icon">${Tr[e.identity.sourceType]}</span>
|
|
328
328
|
<span class="result-content">
|
|
329
329
|
<span class="result-heading">${e.title}</span>
|
|
330
330
|
<span class="result-meta">${e.identity.shortReference} · ${e.match.field}${w(e.statusOrRole,()=>h` · ${e.statusOrRole}`,()=>"")}</span>
|
|
@@ -339,7 +339,7 @@ select:focus,
|
|
|
339
339
|
type="button"
|
|
340
340
|
@click=${this.onRecentClick}
|
|
341
341
|
>
|
|
342
|
-
<span aria-hidden="true" class="result-icon">${
|
|
342
|
+
<span aria-hidden="true" class="result-icon">${Tr[e.sourceType]}</span>
|
|
343
343
|
<span class="recent-title">${e.title}</span>
|
|
344
344
|
</button>
|
|
345
345
|
`}renderSourceTypeOption(e){const t=this.store?.globalSearchSourceTypes.get().includes(e.value)??!1;return h`
|
|
@@ -414,8 +414,8 @@ select:focus,
|
|
|
414
414
|
${this.results.length} result${w(this.results.length===1,()=>"",()=>"s")}
|
|
415
415
|
</div>
|
|
416
416
|
<div aria-label="Search results" class="results" role="listbox">
|
|
417
|
-
${Gt(this.results.slice(0,
|
|
418
|
-
${w(this.results.length>
|
|
417
|
+
${Gt(this.results.slice(0,Cr),(e,t)=>this.renderResult(e,t))}
|
|
418
|
+
${w(this.results.length>Cr,()=>h`<p class="result-state">Refine the query to narrow the results.</p>`,()=>"")}
|
|
419
419
|
${this.renderResultState()}
|
|
420
420
|
${w(!this.store?.globalSearchQuery.get().trim()&&this.recents.length>0,()=>h`
|
|
421
421
|
<section class="recents" aria-label="Recently opened">
|
|
@@ -426,7 +426,7 @@ select:focus,
|
|
|
426
426
|
</div>
|
|
427
427
|
</div>
|
|
428
428
|
</div>
|
|
429
|
-
`}};
|
|
429
|
+
`}};Ri.styles=ge`
|
|
430
430
|
:host {
|
|
431
431
|
position: fixed;
|
|
432
432
|
z-index: 50;
|
|
@@ -713,14 +713,14 @@ select:focus,
|
|
|
713
713
|
background: var(--warning-soft);
|
|
714
714
|
color: inherit;
|
|
715
715
|
}
|
|
716
|
-
`;let Qs=
|
|
717
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function po(n,e){return lo(n)||co(n,e)||ho(n,e)||uo()}function ho(n,e){if(n){if(typeof n=="string")return Er(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Er(n,e):void 0}}const kn=Object.entries,_r=Object.setPrototypeOf,go=Object.isFrozen,fo=Object.getPrototypeOf,mo=Object.getOwnPropertyDescriptor;let J=Object.freeze,Z=Object.seal,Ze=Object.create,$n=typeof Reflect<"u"&&Reflect,Zs=$n.apply,Xs=$n.construct;J||(J=function(e){return e});Z||(Z=function(e){return e});Zs||(Zs=function(e,t){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return e.apply(t,i)});Xs||(Xs=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];return new e(...s)});const je=Q(Array.prototype.forEach),bo=Q(Array.prototype.lastIndexOf),Ar=Q(Array.prototype.pop),ut=Q(Array.prototype.push),xo=Q(Array.prototype.splice),tt=Array.isArray,ft=Q(String.prototype.toLowerCase),Ds=Q(String.prototype.toString),Pr=Q(String.prototype.match),pt=Q(String.prototype.replace),Lr=Q(String.prototype.indexOf),vo=Q(String.prototype.trim),yo=Q(Number.prototype.toString),wo=Q(Boolean.prototype.toString),Dr=typeof BigInt>"u"?null:Q(BigInt.prototype.toString),jr=typeof Symbol>"u"?null:Q(Symbol.prototype.toString),ae=Q(Object.prototype.hasOwnProperty),ht=Q(Object.prototype.toString),ee=Q(RegExp.prototype.test),De=So(TypeError);function Q(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];return Zs(n,e,s)}}function So(n){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Xs(n,t)}}function F(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ft;if(_r&&_r(n,null),!tt(e))return n;let s=e.length;for(;s--;){let i=e[s];if(typeof i=="string"){const r=t(i);r!==i&&(go(e)||(e[s]=r),i=r)}n[i]=!0}return n}function ko(n){for(let e=0;e<n.length;e++)ae(n,e)||(n[e]=null);return n}function le(n){const e=Ze(null);for(const s of kn(n)){var t=po(s,2);const i=t[0],r=t[1];ae(n,i)&&(tt(r)?e[i]=ko(r):r&&typeof r=="object"&&r.constructor===Object?e[i]=le(r):e[i]=r)}return e}function $o(n){switch(typeof n){case"string":return n;case"number":return yo(n);case"boolean":return wo(n);case"bigint":return Dr?Dr(n):"0";case"symbol":return jr?jr(n):"Symbol()";case"undefined":return ht(n);case"function":case"object":{if(n===null)return ht(n);const e=n,t=de(e,"toString");if(typeof t=="function"){const s=t(e);return typeof s=="string"?s:ht(s)}return ht(n)}default:return ht(n)}}function de(n,e){for(;n!==null;){const s=mo(n,e);if(s){if(s.get)return Q(s.get);if(typeof s.value=="function")return Q(s.value)}n=fo(n)}function t(){return null}return t}function Io(n){try{return ee(n,""),!0}catch{return!1}}const Or=J(["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"]),js=J(["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"]),Os=J(["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"]),To=J(["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"]),Ns=J(["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"]),Co=J(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Nr=J(["#text"]),Mr=J(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ms=J(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fr=J(["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"]),Mt=J(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ro=Z(/{{[\w\W]*|^[\w\W]*}}/g),Eo=Z(/<%[\w\W]*|^[\w\W]*%>/g),_o=Z(/\${[\w\W]*/g),Ao=Z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Po=Z(/^aria-[\-\w]+$/),zr=Z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lo=Z(/^(?:\w+script|data):/i),Do=Z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jo=Z(/^html$/i),Oo=Z(/^[a-z][.\w]*(-[.\w]+)+$/i),Br=Z(/<[/\w!]/g),Ur=Z(/<[/\w]/g),No=Z(/<\/no(script|embed|frames)/i),Mo=Z(/\/>/i),oe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},In=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Fo=J(F({},In)),zo=(function(){const n={};return je(In,e=>{n[e]=Z(new RegExp("</"+e+"(?=[\\t\\n\\f\\r />])","i"))}),J(n)})(),Bo=function(){return typeof window>"u"?null:window},Uo=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(s=t.getAttribute(i));const r="dompurify"+(s?"#"+s:"");try{return e.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Gr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ie=function(e,t,s,i){return ae(e,t)&&tt(e[t])?F(i.base?le(i.base):{},e[t],i.transform):s},Fs=function(e,t,s){const i=ae(e,t)?e[t]:void 0;return i&&typeof i=="object"?le(i):s()};function Tn(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bo();const e=S=>Tn(S);if(e.version="3.4.14",e.removed=[],!n||!n.document||n.document.nodeType!==oe.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const s=t,i=s.currentScript;n.DocumentFragment;const r=n.HTMLTemplateElement,a=n.Node,o=n.Element,l=n.NodeFilter,u=n.NamedNodeMap;u===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const p=n.DOMParser,d=n.trustedTypes,g=o.prototype,v=de(g,"cloneNode"),y=de(g,"remove"),L=de(g,"nextSibling"),O=de(g,"childNodes"),I=de(g,"parentNode"),x=de(g,"shadowRoot"),R=de(g,"attributes"),A=a&&a.prototype?de(a.prototype,"nodeType"):null,C=a&&a.prototype?de(a.prototype,"nodeName"):null,T=a&&a.prototype?de(a.prototype,"ownerDocument"):null,z=function(c){return A?A(c):c.nodeType},m=function(c){return C?C(c):c.nodeName};if(typeof r=="function"){const S=t.createElement("template");S.content&&S.content.ownerDocument&&(t=S.content.ownerDocument)}let M,ge="",we,Ai=!1,nt=0;const Pi=function(){if(nt>0)throw De('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ue=function(c){Pi(),nt++;try{return M.createHTML(c)}finally{nt--}},Mn=function(c){Pi(),nt++;try{return M.createScriptURL(c)}finally{nt--}},Fn=function(){return Ai||(we=Uo(d,i),Ai=!0),we},kt=t,ds=kt.implementation,Li=kt.createNodeIterator,zn=kt.createDocumentFragment,Bn=kt.getElementsByTagName,Un=s.importNode;let G=Gr();e.isSupported=typeof kn=="function"&&typeof I=="function"&&ds&&ds.createHTMLDocument!==void 0;const Gn=Ro,qn=Eo,Hn=_o,Kn=Ao,Wn=Po,Vn=Lo,Di=Do,Qn=Oo;let ji=zr,q=null;const us=F({},[...Or,...js,...Os,...Ns,...Nr]);let H=null;const ps=F({},[...Mr,...Ms,...Fr,...Mt]);let fe=Object.seal(Ze(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}})),at=null,Oi=null;const Se=Object.seal(Ze(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ni=!0,hs=!0,Mi=!1,Fi=!0,ke=!1,Ee=!0,_e=!1,gs=!1,$t=null,It=null,fs=!1,Ge=!1,Tt=!1,Ct=!1,zi=!0,Bi=!1;const Ui="user-content-";let ms=!0,bs=!1,qe={},He=null;const Gi=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let qi=null;const Hi=F({},["audio","video","img","source","image","track"]);let Ki=null;const Wi=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let Ke=me,xs=!1,vs=null;const Yn=F({},[Rt,Et,me],Ds),Vi=J(["mi","mo","mn","ms","mtext"]);let ys=F({},Vi);const Qi=J(["annotation-xml"]);let ws=F({},Qi);const Jn=F({},["title","style","font","a","script"]);let ot=null;const Zn=["application/xhtml+xml","text/html"],Xn="text/html";let W=null,We=null;const ea=t.createElement("form"),Yi=function(c){return c instanceof RegExp||c instanceof Function},Ss=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(We&&We===c)return;(!c||typeof c!="object")&&(c={}),c=le(c),ot=Zn.indexOf(c.PARSER_MEDIA_TYPE)===-1?Xn:c.PARSER_MEDIA_TYPE,W=ot==="application/xhtml+xml"?Ds:ft,q=Ie(c,"ALLOWED_TAGS",us,{transform:W}),H=Ie(c,"ALLOWED_ATTR",ps,{transform:W}),vs=Ie(c,"ALLOWED_NAMESPACES",Yn,{transform:Ds}),Ki=Ie(c,"ADD_URI_SAFE_ATTR",Wi,{transform:W,base:Wi}),qi=Ie(c,"ADD_DATA_URI_TAGS",Hi,{transform:W,base:Hi}),He=Ie(c,"FORBID_CONTENTS",Gi,{transform:W}),at=Ie(c,"FORBID_TAGS",le({}),{transform:W}),Oi=Ie(c,"FORBID_ATTR",le({}),{transform:W}),qe=ae(c,"USE_PROFILES")?c.USE_PROFILES&&typeof c.USE_PROFILES=="object"?le(c.USE_PROFILES):c.USE_PROFILES:!1,Ni=c.ALLOW_ARIA_ATTR!==!1,hs=c.ALLOW_DATA_ATTR!==!1,Mi=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Fi=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ke=c.SAFE_FOR_TEMPLATES||!1,Ee=c.SAFE_FOR_XML!==!1,_e=c.WHOLE_DOCUMENT||!1,Ge=c.RETURN_DOM||!1,Tt=c.RETURN_DOM_FRAGMENT||!1,Ct=c.RETURN_TRUSTED_TYPE||!1,fs=c.FORCE_BODY||!1,zi=c.SANITIZE_DOM!==!1,Bi=c.SANITIZE_NAMED_PROPS||!1,ms=c.KEEP_CONTENT!==!1,bs=c.IN_PLACE||!1,ji=Io(c.ALLOWED_URI_REGEXP)?c.ALLOWED_URI_REGEXP:zr,Ke=typeof c.NAMESPACE=="string"?c.NAMESPACE:me,ys=Fs(c,"MATHML_TEXT_INTEGRATION_POINTS",()=>F({},Vi)),ws=Fs(c,"HTML_INTEGRATION_POINTS",()=>F({},Qi));const f=Fs(c,"CUSTOM_ELEMENT_HANDLING",()=>Ze(null));if(fe=Ze(null),ae(f,"tagNameCheck")&&Yi(f.tagNameCheck)&&(fe.tagNameCheck=f.tagNameCheck),ae(f,"attributeNameCheck")&&Yi(f.attributeNameCheck)&&(fe.attributeNameCheck=f.attributeNameCheck),ae(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(fe.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),Z(fe),ke&&(hs=!1),Tt&&(Ge=!0),qe&&(q=F({},Nr),H=Ze(null),qe.html===!0&&(F(q,Or),F(H,Mr)),qe.svg===!0&&(F(q,js),F(H,Ms),F(H,Mt)),qe.svgFilters===!0&&(F(q,Os),F(H,Ms),F(H,Mt)),qe.mathMl===!0&&(F(q,Ns),F(H,Fr),F(H,Mt))),Se.tagCheck=null,Se.attributeCheck=null,ae(c,"ADD_TAGS")&&(typeof c.ADD_TAGS=="function"?Se.tagCheck=c.ADD_TAGS:tt(c.ADD_TAGS)&&(q===us&&(q=le(q)),F(q,c.ADD_TAGS,W))),ae(c,"ADD_ATTR")&&(typeof c.ADD_ATTR=="function"?Se.attributeCheck=c.ADD_ATTR:tt(c.ADD_ATTR)&&(H===ps&&(H=le(H)),F(H,c.ADD_ATTR,W))),ae(c,"ADD_FORBID_CONTENTS")&&tt(c.ADD_FORBID_CONTENTS)&&(He===Gi&&(He=le(He)),F(He,c.ADD_FORBID_CONTENTS,W)),ms&&(q["#text"]=!0),_e&&F(q,["html","head","body"]),q.table&&(F(q,["tbody"]),delete at.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw De('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw De('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const b=M;M=c.TRUSTED_TYPES_POLICY;try{ge=Ue("")}catch($){throw M=b,$}}else c.TRUSTED_TYPES_POLICY===null?(M=void 0,ge=""):(M===void 0&&(M=Fn()),M&&typeof ge=="string"&&(ge=Ue("")));J&&J(c),We=c},Ji=F({},[...js,...Os,...To]),Zi=F({},[...Ns,...Co]),ta=function(c,f,b){return f.namespaceURI===me?c==="svg":f.namespaceURI===Rt?c==="svg"&&(b==="annotation-xml"||ys[b]):!!Ji[c]},sa=function(c,f,b){return f.namespaceURI===me?c==="math":f.namespaceURI===Et?c==="math"&&ws[b]:!!Zi[c]},ia=function(c,f,b){return f.namespaceURI===Et&&!ws[b]||f.namespaceURI===Rt&&!ys[b]?!1:!Zi[c]&&(Jn[c]||!Ji[c])},ra=function(c){let f=I(c);(!f||!f.tagName)&&(f={namespaceURI:Ke,tagName:"template"});const b=ft(c.tagName),$=ft(f.tagName);return vs[c.namespaceURI]?c.namespaceURI===Et?ta(b,f,$):c.namespaceURI===Rt?sa(b,f,$):c.namespaceURI===me?ia(b,f,$):!!(ot==="application/xhtml+xml"&&vs[c.namespaceURI]):!1},$e=function(c){ut(e.removed,{element:c});try{I(c).removeChild(c)}catch{if(y(c),!I(c))throw De("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Xi=function(c,f,b){try{c.removeAttributeNode(f)}catch{try{c.removeAttribute(b)}catch{}}},_t=function(c){At(c);const f=O(c);if(f){const $=[];je(f,E=>{ut($,E)}),je($,E=>{try{y(E)}catch{}})}const b=R(c);if(b)for(let $=b.length-1;$>=0;--$){const E=b[$],P=E&&E.name;typeof P=="string"&&Xi(c,E,P)}},Ae=function(c,f,b){if(!b)try{b=f.getAttributeNode(c)}catch{b=null}ut(e.removed,{attribute:b||null,from:f});try{b?f.removeAttributeNode(b):f.removeAttribute(c)}catch{try{f.removeAttribute(c)}catch{}}if(c==="is")if(Ge||Tt)try{$e(f)}catch{}else try{f.setAttribute(c,"")}catch{}},na=function(c){const f=R(c);if(f)for(let b=f.length-1;b>=0;--b){const $=f[b],E=$&&$.name;typeof E!="string"||H[W(E)]||Xi(c,$,E)}},At=function(c){const f=[c];for(;f.length>0;){const b=f.pop();z(b)===oe.element&&na(b);const E=O(b);if(E)for(let P=E.length-1;P>=0;--P)f.push(E[P])}},er=function(c,f){return Ee?c==="patchsrc"?!0:c==="for"&&f!=="label"&&f!=="output":!1},aa=function(c){if(!Ee)return;const f=[c];for(;f.length>0;){const b=f.pop(),$=z(b);if($===oe.processingInstruction||$===oe.comment&&ee(Ur,b.data)){try{y(b)}catch{}continue}if($===oe.element){const P=b,U=W(m(b));try{P.hasAttribute&&P.hasAttribute("patchsrc")&&P.removeAttribute("patchsrc"),P.hasAttribute&&P.hasAttribute("for")&&er("for",U)&&P.removeAttribute("for")}catch{}}const E=O(b);if(E)for(let P=E.length-1;P>=0;--P)f.push(E[P])}},tr=function(c){let f=null,b=null;if(fs)c="<remove></remove>"+c;else{const P=Pr(c,/^[\r\n\t ]+/);b=P&&P[0]}ot==="application/xhtml+xml"&&Ke===me&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");const $=M?Ue(c):c;if(Ke===me)try{f=new p().parseFromString($,ot)}catch{}if(!f||!f.documentElement){f=ds.createDocument(Ke,"template",null);try{f.documentElement.innerHTML=xs?ge:$}catch{}}const E=f.body||f.documentElement;return c&&b&&E.insertBefore(t.createTextNode(b),E.childNodes[0]||null),Ke===me?Bn.call(f,_e?"html":"body")[0]:_e?f.documentElement:E},sr=function(c){const f=T?T(c):c.ownerDocument;return Li.call(f||c,c,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Pt=function(c){return c=pt(c,Gn," "),c=pt(c,qn," "),c=pt(c,Hn," "),c},ks=function(c){var f;c.normalize();const b=T?T(c):c.ownerDocument,$=Li.call(b||c,c,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let E=$.nextNode();for(;E;)E.data=Pt(E.data),E=$.nextNode();const P=(f=c.querySelectorAll)===null||f===void 0?void 0:f.call(c,"template");P&&je(P,U=>{Ve(U.content)&&ks(U.content)})},Lt=function(c){const f=C?C(c):null;return typeof f!="string"||W(f)!=="form"?!1:typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||c.attributes!==R(c)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function"||c.nodeType!==A(c)||c.childNodes!==O(c)},Ve=function(c){if(!A||typeof c!="object"||c===null)return!1;try{return A(c)===oe.documentFragment}catch{return!1}},lt=function(c){if(!A||typeof c!="object"||c===null)return!1;try{return typeof A(c)=="number"}catch{return!1}};function be(S,c,f){S.length!==0&&je(S,b=>{b.call(e,c,f,We)})}const oa=function(c,f){return!!(Ee&&c.hasChildNodes()&&!lt(c.firstElementChild)&&ee(Br,c.textContent)&&ee(Br,c.innerHTML)||Ee&&c.namespaceURI===me&&Fo[f]&&(lt(c.firstElementChild)||typeof c.textContent=="string"&&ee(zo[f],c.textContent))||c.nodeType===oe.processingInstruction||Ee&&c.nodeType===oe.comment&&ee(Ur,c.data))},Dt=function(c,f){if(c instanceof RegExp)return ee(c,f);if(c instanceof Function){for(var b=arguments.length,$=new Array(b>2?b-2:0),E=2;E<b;E++)$[E-2]=arguments[E];return!!c(f,...$)}return!1},la=function(c,f,b){if(!at[f]&&or(f)&&Dt(fe.tagNameCheck,f))return!1;if(ms&&!He[f]){const $=I(c),E=O(c);if(E&&$){const P=E.length;for(let U=P-1;U>=0;--U){const K=c===b?v(E[U],!0):E[U];$.insertBefore(K,L(c))}}}return $e(c),!0},ir=function(c,f,b,$){return c.length===0?f:f===b||f===$?le(f):f},rr=function(c,f){return c===f||I(c)!==null?!1:(bs&&At(c),!0)},nr=function(c,f){if(be(G.beforeSanitizeElements,c,null),rr(c,f))return!0;if(Lt(c))return $e(c),!0;const b=W(m(c));if(q=ir(G.uponSanitizeElement,q,us,$t),be(G.uponSanitizeElement,c,{tagName:b,allowedTags:q}),rr(c,f))return!0;if(oa(c,b))return $e(c),!0;if(at[b]||!(Se.tagCheck instanceof Function&&Se.tagCheck(b))&&!q[b]){const E=la(c,b,f);return E===!1&&be(G.afterSanitizeElements,c,null),E}if(z(c)===oe.element&&!ra(c)||(b==="noscript"||b==="noembed"||b==="noframes")&&ee(No,c.innerHTML))return $e(c),!0;if(ke&&c.nodeType===oe.text){const E=Pt(c.textContent);c.textContent!==E&&(ut(e.removed,{element:c.cloneNode()}),c.textContent=E)}return be(G.afterSanitizeElements,c,null),!1},ar=function(c,f,b){if(Oi[f]||er(f,c)||zi&&(f==="id"||f==="name")&&(b in t||b in ea))return!1;const $=H[f]||Se.attributeCheck instanceof Function&&Se.attributeCheck(f,c);return hs&&ee(Kn,f)||Ni&&ee(Wn,f)?!0:$?Ki[f]||ee(ji,pt(b,Di,""))||(f==="src"||f==="xlink:href"||f==="href")&&c!=="script"&&Lr(b,"data:")===0&&qi[c]||Mi&&!ee(Vn,pt(b,Di,""))?!0:!b:or(c)&&Dt(fe.tagNameCheck,c)&&Dt(fe.attributeNameCheck,f,c)||f==="is"&&fe.allowCustomizedBuiltInElements&&Dt(fe.tagNameCheck,b)},ca=F({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),or=function(c){return!ca[ft(c)]&&ee(Qn,c)},da=function(c,f,b,$){if(M&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!b)switch(d.getAttributeType(c,f)){case"TrustedHTML":return Ue($);case"TrustedScriptURL":return Mn($)}return $},ua=function(c,f,b,$){try{b?c.setAttributeNS(b,f,$):c.setAttribute(f,$),Lt(c)?$e(c):Ar(e.removed)}catch{Ae(f,c)}},lr=function(c){be(G.beforeSanitizeAttributes,c,null);const f=c.attributes;if(!f||Lt(c))return;H=ir(G.uponSanitizeAttribute,H,ps,It);const b={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let $=f.length;const E=W(c.nodeName);for(;$--;){const P=f[$],U=P.name,K=P.namespaceURI,re=P.value,ne=W(U),Is=re;let ie=U==="value"?Is:vo(Is);if(b.attrName=ne,b.attrValue=ie,b.keepAttr=!0,b.forceKeepAttr=void 0,be(G.uponSanitizeAttribute,c,b),ie=b.attrValue,Bi&&(ne==="id"||ne==="name")&&Lr(ie,Ui)!==0&&(Ae(U,c,P),ie=Ui+ie),Ee&&ee(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ie)){Ae(U,c,P);continue}if(ne==="attributename"&&Pr(ie,"href")){Ae(U,c,P);continue}if(!b.forceKeepAttr){if(!b.keepAttr){Ae(U,c,P);continue}if(!Fi&&ee(Mo,ie)){Ae(U,c,P);continue}if(ke&&(ie=Pt(ie)),!ar(E,ne,ie)){Ae(U,c,P);continue}ie=da(E,ne,K,ie),ie!==Is&&ua(c,U,K,ie)}}be(G.afterSanitizeAttributes,c,null)},jt=function(c){let f=null;const b=sr(c);for(be(G.beforeSanitizeShadowDOM,c,null);f=b.nextNode();)if(be(G.uponSanitizeShadowNode,f,null),nr(f,c),lr(f),Ve(f.content)&&jt(f.content),z(f)===oe.element){const $=x(f);Ve($)&&($s($),jt($))}be(G.afterSanitizeShadowDOM,c,null)},$s=function(c){const f=[{node:c,shadow:null}];for(;f.length>0;){const b=f.pop();if(b.shadow){jt(b.shadow);continue}const $=b.node,P=z($)===oe.element,U=O($);if(U)for(let K=U.length-1;K>=0;--K)f.push({node:U[K],shadow:null});if(P){const K=C?C($):null;if(typeof K=="string"&&W(K)==="template"){const re=$.content;Ve(re)&&f.push({node:re,shadow:null})}}if(P){const K=x($);Ve(K)&&f.push({node:null,shadow:K},{node:K,shadow:null})}}};return e.sanitize=function(S){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,b=null,$=null,E=null;if(xs=!S,xs&&(S="<!-->"),typeof S!="string"&&!lt(S)&&(S=$o(S),typeof S!="string"))throw De("dirty is not a string, aborting");if(!e.isSupported)return S;gs?(q=$t,H=It):Ss(c),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(q=le(q)),G.uponSanitizeAttribute.length>0&&(H=le(H)),e.removed=[];const P=bs&&typeof S!="string"&<(S);if(P){aa(S);const re=m(S);if(typeof re=="string"){const ne=W(re);if(!q[ne]||at[ne])throw _t(S),De("root node is forbidden and cannot be sanitized in-place")}if(Lt(S))throw _t(S),De("root node is clobbered and cannot be sanitized in-place");try{$s(S)}catch(ne){throw _t(S),ne}}else if(lt(S))f=tr("<!---->"),b=f.ownerDocument.importNode(S,!0),b.nodeType===oe.element&&b.nodeName==="BODY"||b.nodeName==="HTML"?f=b:f.appendChild(b),$s(b);else{if(!Ge&&!ke&&!_e&&S.indexOf("<")===-1)return M&&Ct?Ue(S):S;if(f=tr(S),!f)return Ge?null:Ct?ge:""}f&&fs&&$e(f.firstChild);const U=P?S:f;try{const re=sr(U);for(;$=re.nextNode();)nr($,U),lr($),Ve($.content)&&jt($.content)}catch(re){throw P&&(_t(S),je(e.removed,ne=>{ne.element&&At(ne.element)})),re}if(P)return je(e.removed,re=>{re.element&&At(re.element)}),ke&&ks(S),S;if(Ge){if(ke&&ks(f),Tt)for(E=zn.call(f.ownerDocument);f.firstChild;)E.appendChild(f.firstChild);else E=f;return(H.shadowroot||H.shadowrootmode)&&(E=Un.call(s,E,!0)),E}let K=_e?f.outerHTML:f.innerHTML;return _e&&q["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&ee(jo,f.ownerDocument.doctype.name)&&(K="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
|
|
718
|
-
`+
|
|
719
|
-
]`).replace("lheading",
|
|
720
|
-
`),t=e.length-1;for(;t>=0&&
|
|
721
|
-
`)}function jl(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Ol(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function
|
|
716
|
+
`;let Qs=Ri;customElements.define("agent-issues-global-search-overlay",Qs);class Ys extends hi{constructor(e){if(super(e),this.it=k,e.type!==ui.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===xe)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ys.directiveName="unsafeHTML",Ys.resultType=1;const wn=pi(Ys);function Rr(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,s=Array(e);t<e;t++)s[t]=n[t];return s}function lo(n){if(Array.isArray(n))return n}function co(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var s,i,r,a,o=[],l=!0,u=!1;try{if(r=(t=t.call(n)).next,e!==0)for(;!(l=(s=r.call(t)).done)&&(o.push(s.value),o.length!==e);l=!0);}catch(p){u=!0,i=p}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function uo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
717
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function po(n,e){return lo(n)||co(n,e)||ho(n,e)||uo()}function ho(n,e){if(n){if(typeof n=="string")return Rr(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Rr(n,e):void 0}}const Sn=Object.entries,Er=Object.setPrototypeOf,go=Object.isFrozen,fo=Object.getPrototypeOf,mo=Object.getOwnPropertyDescriptor;let Y=Object.freeze,Z=Object.seal,Ze=Object.create,kn=typeof Reflect<"u"&&Reflect,Js=kn.apply,Zs=kn.construct;Y||(Y=function(e){return e});Z||(Z=function(e){return e});Js||(Js=function(e,t){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return e.apply(t,i)});Zs||(Zs=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];return new e(...s)});const je=V(Array.prototype.forEach),bo=V(Array.prototype.lastIndexOf),_r=V(Array.prototype.pop),ut=V(Array.prototype.push),vo=V(Array.prototype.splice),tt=Array.isArray,ft=V(String.prototype.toLowerCase),Ds=V(String.prototype.toString),Ar=V(String.prototype.match),pt=V(String.prototype.replace),Pr=V(String.prototype.indexOf),xo=V(String.prototype.trim),yo=V(Number.prototype.toString),wo=V(Boolean.prototype.toString),Lr=typeof BigInt>"u"?null:V(BigInt.prototype.toString),Dr=typeof Symbol>"u"?null:V(Symbol.prototype.toString),oe=V(Object.prototype.hasOwnProperty),ht=V(Object.prototype.toString),te=V(RegExp.prototype.test),De=So(TypeError);function V(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];return Js(n,e,s)}}function So(n){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Zs(n,t)}}function F(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ft;if(Er&&Er(n,null),!tt(e))return n;let s=e.length;for(;s--;){let i=e[s];if(typeof i=="string"){const r=t(i);r!==i&&(go(e)||(e[s]=r),i=r)}n[i]=!0}return n}function ko(n){for(let e=0;e<n.length;e++)oe(n,e)||(n[e]=null);return n}function ce(n){const e=Ze(null);for(const s of Sn(n)){var t=po(s,2);const i=t[0],r=t[1];oe(n,i)&&(tt(r)?e[i]=ko(r):r&&typeof r=="object"&&r.constructor===Object?e[i]=ce(r):e[i]=r)}return e}function $o(n){switch(typeof n){case"string":return n;case"number":return yo(n);case"boolean":return wo(n);case"bigint":return Lr?Lr(n):"0";case"symbol":return Dr?Dr(n):"Symbol()";case"undefined":return ht(n);case"function":case"object":{if(n===null)return ht(n);const e=n,t=ue(e,"toString");if(typeof t=="function"){const s=t(e);return typeof s=="string"?s:ht(s)}return ht(n)}default:return ht(n)}}function ue(n,e){for(;n!==null;){const s=mo(n,e);if(s){if(s.get)return V(s.get);if(typeof s.value=="function")return V(s.value)}n=fo(n)}function t(){return null}return t}function Io(n){try{return te(n,""),!0}catch{return!1}}const jr=Y(["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"]),js=Y(["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"]),Os=Y(["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"]),To=Y(["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"]),Ns=Y(["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"]),Co=Y(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Or=Y(["#text"]),Nr=Y(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ms=Y(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Mr=Y(["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"]),Mt=Y(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ro=Z(/{{[\w\W]*|^[\w\W]*}}/g),Eo=Z(/<%[\w\W]*|^[\w\W]*%>/g),_o=Z(/\${[\w\W]*/g),Ao=Z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Po=Z(/^aria-[\-\w]+$/),Fr=Z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lo=Z(/^(?:\w+script|data):/i),Do=Z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jo=Z(/^html$/i),Oo=Z(/^[a-z][.\w]*(-[.\w]+)+$/i),zr=Z(/<[/\w!]/g),Br=Z(/<[/\w]/g),No=Z(/<\/no(script|embed|frames)/i),Mo=Z(/\/>/i),le={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$n=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Fo=Y(F({},$n)),zo=(function(){const n={};return je($n,e=>{n[e]=Z(new RegExp("</"+e+"(?=[\\t\\n\\f\\r />])","i"))}),Y(n)})(),Bo=function(){return typeof window>"u"?null:window},Uo=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(s=t.getAttribute(i));const r="dompurify"+(s?"#"+s:"");try{return e.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Ur=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ie=function(e,t,s,i){return oe(e,t)&&tt(e[t])?F(i.base?ce(i.base):{},e[t],i.transform):s},Fs=function(e,t,s){const i=oe(e,t)?e[t]:void 0;return i&&typeof i=="object"?ce(i):s()};function In(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bo();const e=S=>In(S);if(e.version="3.4.14",e.removed=[],!n||!n.document||n.document.nodeType!==le.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const s=t,i=s.currentScript;n.DocumentFragment;const r=n.HTMLTemplateElement,a=n.Node,o=n.Element,l=n.NodeFilter,u=n.NamedNodeMap;u===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const p=n.DOMParser,d=n.trustedTypes,g=o.prototype,b=ue(g,"cloneNode"),x=ue(g,"remove"),E=ue(g,"nextSibling"),O=ue(g,"childNodes"),I=ue(g,"parentNode"),_=ue(g,"shadowRoot"),y=ue(g,"attributes"),R=a&&a.prototype?ue(a.prototype,"nodeType"):null,T=a&&a.prototype?ue(a.prototype,"nodeName"):null,M=a&&a.prototype?ue(a.prototype,"ownerDocument"):null,X=function(c){return R?R(c):c.nodeType},m=function(c){return T?T(c):c.nodeName};if(typeof r=="function"){const S=t.createElement("template");S.content&&S.content.ownerDocument&&(t=S.content.ownerDocument)}let P,J="",we,_i=!1,nt=0;const Ai=function(){if(nt>0)throw De('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ue=function(c){Ai(),nt++;try{return P.createHTML(c)}finally{nt--}},Mn=function(c){Ai(),nt++;try{return P.createScriptURL(c)}finally{nt--}},Fn=function(){return _i||(we=Uo(d,i),_i=!0),we},kt=t,ds=kt.implementation,Pi=kt.createNodeIterator,zn=kt.createDocumentFragment,Bn=kt.getElementsByTagName,Un=s.importNode;let U=Ur();e.isSupported=typeof Sn=="function"&&typeof I=="function"&&ds&&ds.createHTMLDocument!==void 0;const Gn=Ro,qn=Eo,Hn=_o,Kn=Ao,Wn=Po,Vn=Lo,Li=Do,Qn=Oo;let Di=Fr,G=null;const us=F({},[...jr,...js,...Os,...Ns,...Or]);let q=null;const ps=F({},[...Nr,...Ms,...Mr,...Mt]);let fe=Object.seal(Ze(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}})),at=null,ji=null;const Se=Object.seal(Ze(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Oi=!0,hs=!0,Ni=!1,Mi=!0,ke=!1,Ee=!0,_e=!1,gs=!1,$t=null,It=null,fs=!1,Ge=!1,Tt=!1,Ct=!1,Fi=!0,zi=!1;const Bi="user-content-";let ms=!0,bs=!1,qe={},He=null;const Ui=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Gi=null;const qi=F({},["audio","video","img","source","image","track"]);let Hi=null;const Ki=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let Ke=me,vs=!1,xs=null;const Yn=F({},[Rt,Et,me],Ds),Wi=Y(["mi","mo","mn","ms","mtext"]);let ys=F({},Wi);const Vi=Y(["annotation-xml"]);let ws=F({},Vi);const Jn=F({},["title","style","font","a","script"]);let ot=null;const Zn=["application/xhtml+xml","text/html"],Xn="text/html";let K=null,We=null;const ea=t.createElement("form"),Qi=function(c){return c instanceof RegExp||c instanceof Function},Ss=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(We&&We===c)return;(!c||typeof c!="object")&&(c={}),c=ce(c),ot=Zn.indexOf(c.PARSER_MEDIA_TYPE)===-1?Xn:c.PARSER_MEDIA_TYPE,K=ot==="application/xhtml+xml"?Ds:ft,G=Ie(c,"ALLOWED_TAGS",us,{transform:K}),q=Ie(c,"ALLOWED_ATTR",ps,{transform:K}),xs=Ie(c,"ALLOWED_NAMESPACES",Yn,{transform:Ds}),Hi=Ie(c,"ADD_URI_SAFE_ATTR",Ki,{transform:K,base:Ki}),Gi=Ie(c,"ADD_DATA_URI_TAGS",qi,{transform:K,base:qi}),He=Ie(c,"FORBID_CONTENTS",Ui,{transform:K}),at=Ie(c,"FORBID_TAGS",ce({}),{transform:K}),ji=Ie(c,"FORBID_ATTR",ce({}),{transform:K}),qe=oe(c,"USE_PROFILES")?c.USE_PROFILES&&typeof c.USE_PROFILES=="object"?ce(c.USE_PROFILES):c.USE_PROFILES:!1,Oi=c.ALLOW_ARIA_ATTR!==!1,hs=c.ALLOW_DATA_ATTR!==!1,Ni=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Mi=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ke=c.SAFE_FOR_TEMPLATES||!1,Ee=c.SAFE_FOR_XML!==!1,_e=c.WHOLE_DOCUMENT||!1,Ge=c.RETURN_DOM||!1,Tt=c.RETURN_DOM_FRAGMENT||!1,Ct=c.RETURN_TRUSTED_TYPE||!1,fs=c.FORCE_BODY||!1,Fi=c.SANITIZE_DOM!==!1,zi=c.SANITIZE_NAMED_PROPS||!1,ms=c.KEEP_CONTENT!==!1,bs=c.IN_PLACE||!1,Di=Io(c.ALLOWED_URI_REGEXP)?c.ALLOWED_URI_REGEXP:Fr,Ke=typeof c.NAMESPACE=="string"?c.NAMESPACE:me,ys=Fs(c,"MATHML_TEXT_INTEGRATION_POINTS",()=>F({},Wi)),ws=Fs(c,"HTML_INTEGRATION_POINTS",()=>F({},Vi));const f=Fs(c,"CUSTOM_ELEMENT_HANDLING",()=>Ze(null));if(fe=Ze(null),oe(f,"tagNameCheck")&&Qi(f.tagNameCheck)&&(fe.tagNameCheck=f.tagNameCheck),oe(f,"attributeNameCheck")&&Qi(f.attributeNameCheck)&&(fe.attributeNameCheck=f.attributeNameCheck),oe(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(fe.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),Z(fe),ke&&(hs=!1),Tt&&(Ge=!0),qe&&(G=F({},Or),q=Ze(null),qe.html===!0&&(F(G,jr),F(q,Nr)),qe.svg===!0&&(F(G,js),F(q,Ms),F(q,Mt)),qe.svgFilters===!0&&(F(G,Os),F(q,Ms),F(q,Mt)),qe.mathMl===!0&&(F(G,Ns),F(q,Mr),F(q,Mt))),Se.tagCheck=null,Se.attributeCheck=null,oe(c,"ADD_TAGS")&&(typeof c.ADD_TAGS=="function"?Se.tagCheck=c.ADD_TAGS:tt(c.ADD_TAGS)&&(G===us&&(G=ce(G)),F(G,c.ADD_TAGS,K))),oe(c,"ADD_ATTR")&&(typeof c.ADD_ATTR=="function"?Se.attributeCheck=c.ADD_ATTR:tt(c.ADD_ATTR)&&(q===ps&&(q=ce(q)),F(q,c.ADD_ATTR,K))),oe(c,"ADD_FORBID_CONTENTS")&&tt(c.ADD_FORBID_CONTENTS)&&(He===Ui&&(He=ce(He)),F(He,c.ADD_FORBID_CONTENTS,K)),ms&&(G["#text"]=!0),_e&&F(G,["html","head","body"]),G.table&&(F(G,["tbody"]),delete at.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw De('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw De('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const v=P;P=c.TRUSTED_TYPES_POLICY;try{J=Ue("")}catch($){throw P=v,$}}else c.TRUSTED_TYPES_POLICY===null?(P=void 0,J=""):(P===void 0&&(P=Fn()),P&&typeof J=="string"&&(J=Ue("")));Y&&Y(c),We=c},Yi=F({},[...js,...Os,...To]),Ji=F({},[...Ns,...Co]),ta=function(c,f,v){return f.namespaceURI===me?c==="svg":f.namespaceURI===Rt?c==="svg"&&(v==="annotation-xml"||ys[v]):!!Yi[c]},sa=function(c,f,v){return f.namespaceURI===me?c==="math":f.namespaceURI===Et?c==="math"&&ws[v]:!!Ji[c]},ia=function(c,f,v){return f.namespaceURI===Et&&!ws[v]||f.namespaceURI===Rt&&!ys[v]?!1:!Ji[c]&&(Jn[c]||!Yi[c])},ra=function(c){let f=I(c);(!f||!f.tagName)&&(f={namespaceURI:Ke,tagName:"template"});const v=ft(c.tagName),$=ft(f.tagName);return xs[c.namespaceURI]?c.namespaceURI===Et?ta(v,f,$):c.namespaceURI===Rt?sa(v,f,$):c.namespaceURI===me?ia(v,f,$):!!(ot==="application/xhtml+xml"&&xs[c.namespaceURI]):!1},$e=function(c){ut(e.removed,{element:c});try{I(c).removeChild(c)}catch{if(x(c),!I(c))throw De("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Zi=function(c,f,v){try{c.removeAttributeNode(f)}catch{try{c.removeAttribute(v)}catch{}}},_t=function(c){At(c);const f=O(c);if(f){const $=[];je(f,C=>{ut($,C)}),je($,C=>{try{x(C)}catch{}})}const v=y(c);if(v)for(let $=v.length-1;$>=0;--$){const C=v[$],L=C&&C.name;typeof L=="string"&&Zi(c,C,L)}},Ae=function(c,f,v){if(!v)try{v=f.getAttributeNode(c)}catch{v=null}ut(e.removed,{attribute:v||null,from:f});try{v?f.removeAttributeNode(v):f.removeAttribute(c)}catch{try{f.removeAttribute(c)}catch{}}if(c==="is")if(Ge||Tt)try{$e(f)}catch{}else try{f.setAttribute(c,"")}catch{}},na=function(c){const f=y(c);if(f)for(let v=f.length-1;v>=0;--v){const $=f[v],C=$&&$.name;typeof C!="string"||q[K(C)]||Zi(c,$,C)}},At=function(c){const f=[c];for(;f.length>0;){const v=f.pop();X(v)===le.element&&na(v);const C=O(v);if(C)for(let L=C.length-1;L>=0;--L)f.push(C[L])}},Xi=function(c,f){return Ee?c==="patchsrc"?!0:c==="for"&&f!=="label"&&f!=="output":!1},aa=function(c){if(!Ee)return;const f=[c];for(;f.length>0;){const v=f.pop(),$=X(v);if($===le.processingInstruction||$===le.comment&&te(Br,v.data)){try{x(v)}catch{}continue}if($===le.element){const L=v,B=K(m(v));try{L.hasAttribute&&L.hasAttribute("patchsrc")&&L.removeAttribute("patchsrc"),L.hasAttribute&&L.hasAttribute("for")&&Xi("for",B)&&L.removeAttribute("for")}catch{}}const C=O(v);if(C)for(let L=C.length-1;L>=0;--L)f.push(C[L])}},er=function(c){let f=null,v=null;if(fs)c="<remove></remove>"+c;else{const L=Ar(c,/^[\r\n\t ]+/);v=L&&L[0]}ot==="application/xhtml+xml"&&Ke===me&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");const $=P?Ue(c):c;if(Ke===me)try{f=new p().parseFromString($,ot)}catch{}if(!f||!f.documentElement){f=ds.createDocument(Ke,"template",null);try{f.documentElement.innerHTML=vs?J:$}catch{}}const C=f.body||f.documentElement;return c&&v&&C.insertBefore(t.createTextNode(v),C.childNodes[0]||null),Ke===me?Bn.call(f,_e?"html":"body")[0]:_e?f.documentElement:C},tr=function(c){const f=M?M(c):c.ownerDocument;return Pi.call(f||c,c,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Pt=function(c){return c=pt(c,Gn," "),c=pt(c,qn," "),c=pt(c,Hn," "),c},ks=function(c){var f;c.normalize();const v=M?M(c):c.ownerDocument,$=Pi.call(v||c,c,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let C=$.nextNode();for(;C;)C.data=Pt(C.data),C=$.nextNode();const L=(f=c.querySelectorAll)===null||f===void 0?void 0:f.call(c,"template");L&&je(L,B=>{Ve(B.content)&&ks(B.content)})},Lt=function(c){const f=T?T(c):null;return typeof f!="string"||K(f)!=="form"?!1:typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||c.attributes!==y(c)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function"||c.nodeType!==R(c)||c.childNodes!==O(c)},Ve=function(c){if(!R||typeof c!="object"||c===null)return!1;try{return R(c)===le.documentFragment}catch{return!1}},lt=function(c){if(!R||typeof c!="object"||c===null)return!1;try{return typeof R(c)=="number"}catch{return!1}};function be(S,c,f){S.length!==0&&je(S,v=>{v.call(e,c,f,We)})}const oa=function(c,f){return!!(Ee&&c.hasChildNodes()&&!lt(c.firstElementChild)&&te(zr,c.textContent)&&te(zr,c.innerHTML)||Ee&&c.namespaceURI===me&&Fo[f]&&(lt(c.firstElementChild)||typeof c.textContent=="string"&&te(zo[f],c.textContent))||c.nodeType===le.processingInstruction||Ee&&c.nodeType===le.comment&&te(Br,c.data))},Dt=function(c,f){if(c instanceof RegExp)return te(c,f);if(c instanceof Function){for(var v=arguments.length,$=new Array(v>2?v-2:0),C=2;C<v;C++)$[C-2]=arguments[C];return!!c(f,...$)}return!1},la=function(c,f,v){if(!at[f]&&ar(f)&&Dt(fe.tagNameCheck,f))return!1;if(ms&&!He[f]){const $=I(c),C=O(c);if(C&&$){const L=C.length;for(let B=L-1;B>=0;--B){const H=c===v?b(C[B],!0):C[B];$.insertBefore(H,E(c))}}}return $e(c),!0},sr=function(c,f,v,$){return c.length===0?f:f===v||f===$?ce(f):f},ir=function(c,f){return c===f||I(c)!==null?!1:(bs&&At(c),!0)},rr=function(c,f){if(be(U.beforeSanitizeElements,c,null),ir(c,f))return!0;if(Lt(c))return $e(c),!0;const v=K(m(c));if(G=sr(U.uponSanitizeElement,G,us,$t),be(U.uponSanitizeElement,c,{tagName:v,allowedTags:G}),ir(c,f))return!0;if(oa(c,v))return $e(c),!0;if(at[v]||!(Se.tagCheck instanceof Function&&Se.tagCheck(v))&&!G[v]){const C=la(c,v,f);return C===!1&&be(U.afterSanitizeElements,c,null),C}if(X(c)===le.element&&!ra(c)||(v==="noscript"||v==="noembed"||v==="noframes")&&te(No,c.innerHTML))return $e(c),!0;if(ke&&c.nodeType===le.text){const C=Pt(c.textContent);c.textContent!==C&&(ut(e.removed,{element:c.cloneNode()}),c.textContent=C)}return be(U.afterSanitizeElements,c,null),!1},nr=function(c,f,v){if(ji[f]||Xi(f,c)||Fi&&(f==="id"||f==="name")&&(v in t||v in ea))return!1;const $=q[f]||Se.attributeCheck instanceof Function&&Se.attributeCheck(f,c);return hs&&te(Kn,f)||Oi&&te(Wn,f)?!0:$?Hi[f]||te(Di,pt(v,Li,""))||(f==="src"||f==="xlink:href"||f==="href")&&c!=="script"&&Pr(v,"data:")===0&&Gi[c]||Ni&&!te(Vn,pt(v,Li,""))?!0:!v:ar(c)&&Dt(fe.tagNameCheck,c)&&Dt(fe.attributeNameCheck,f,c)||f==="is"&&fe.allowCustomizedBuiltInElements&&Dt(fe.tagNameCheck,v)},ca=F({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ar=function(c){return!ca[ft(c)]&&te(Qn,c)},da=function(c,f,v,$){if(P&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!v)switch(d.getAttributeType(c,f)){case"TrustedHTML":return Ue($);case"TrustedScriptURL":return Mn($)}return $},ua=function(c,f,v,$){try{v?c.setAttributeNS(v,f,$):c.setAttribute(f,$),Lt(c)?$e(c):_r(e.removed)}catch{Ae(f,c)}},or=function(c){be(U.beforeSanitizeAttributes,c,null);const f=c.attributes;if(!f||Lt(c))return;q=sr(U.uponSanitizeAttribute,q,ps,It);const v={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let $=f.length;const C=K(c.nodeName);for(;$--;){const L=f[$],B=L.name,H=L.namespaceURI,ne=L.value,ae=K(B),Is=ne;let re=B==="value"?Is:xo(Is);if(v.attrName=ae,v.attrValue=re,v.keepAttr=!0,v.forceKeepAttr=void 0,be(U.uponSanitizeAttribute,c,v),re=v.attrValue,zi&&(ae==="id"||ae==="name")&&Pr(re,Bi)!==0&&(Ae(B,c,L),re=Bi+re),Ee&&te(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,re)){Ae(B,c,L);continue}if(ae==="attributename"&&Ar(re,"href")){Ae(B,c,L);continue}if(!v.forceKeepAttr){if(!v.keepAttr){Ae(B,c,L);continue}if(!Mi&&te(Mo,re)){Ae(B,c,L);continue}if(ke&&(re=Pt(re)),!nr(C,ae,re)){Ae(B,c,L);continue}re=da(C,ae,H,re),re!==Is&&ua(c,B,H,re)}}be(U.afterSanitizeAttributes,c,null)},jt=function(c){let f=null;const v=tr(c);for(be(U.beforeSanitizeShadowDOM,c,null);f=v.nextNode();)if(be(U.uponSanitizeShadowNode,f,null),rr(f,c),or(f),Ve(f.content)&&jt(f.content),X(f)===le.element){const $=_(f);Ve($)&&($s($),jt($))}be(U.afterSanitizeShadowDOM,c,null)},$s=function(c){const f=[{node:c,shadow:null}];for(;f.length>0;){const v=f.pop();if(v.shadow){jt(v.shadow);continue}const $=v.node,L=X($)===le.element,B=O($);if(B)for(let H=B.length-1;H>=0;--H)f.push({node:B[H],shadow:null});if(L){const H=T?T($):null;if(typeof H=="string"&&K(H)==="template"){const ne=$.content;Ve(ne)&&f.push({node:ne,shadow:null})}}if(L){const H=_($);Ve(H)&&f.push({node:null,shadow:H},{node:H,shadow:null})}}};return e.sanitize=function(S){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=null,v=null,$=null,C=null;if(vs=!S,vs&&(S="<!-->"),typeof S!="string"&&!lt(S)&&(S=$o(S),typeof S!="string"))throw De("dirty is not a string, aborting");if(!e.isSupported)return S;gs?(G=$t,q=It):Ss(c),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(G=ce(G)),U.uponSanitizeAttribute.length>0&&(q=ce(q)),e.removed=[];const L=bs&&typeof S!="string"&<(S);if(L){aa(S);const ne=m(S);if(typeof ne=="string"){const ae=K(ne);if(!G[ae]||at[ae])throw _t(S),De("root node is forbidden and cannot be sanitized in-place")}if(Lt(S))throw _t(S),De("root node is clobbered and cannot be sanitized in-place");try{$s(S)}catch(ae){throw _t(S),ae}}else if(lt(S))f=er("<!---->"),v=f.ownerDocument.importNode(S,!0),v.nodeType===le.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?f=v:f.appendChild(v),$s(v);else{if(!Ge&&!ke&&!_e&&S.indexOf("<")===-1)return P&&Ct?Ue(S):S;if(f=er(S),!f)return Ge?null:Ct?J:""}f&&fs&&$e(f.firstChild);const B=L?S:f;try{const ne=tr(B);for(;$=ne.nextNode();)rr($,B),or($),Ve($.content)&&jt($.content)}catch(ne){throw L&&(_t(S),je(e.removed,ae=>{ae.element&&At(ae.element)})),ne}if(L)return je(e.removed,ne=>{ne.element&&At(ne.element)}),ke&&ks(S),S;if(Ge){if(ke&&ks(f),Tt)for(C=zn.call(f.ownerDocument);f.firstChild;)C.appendChild(f.firstChild);else C=f;return(q.shadowroot||q.shadowrootmode)&&(C=Un.call(s,C,!0)),C}let H=_e?f.outerHTML:f.innerHTML;return _e&&G["!doctype"]&&f.ownerDocument&&f.ownerDocument.doctype&&f.ownerDocument.doctype.name&&te(jo,f.ownerDocument.doctype.name)&&(H="<!DOCTYPE "+f.ownerDocument.doctype.name+`>
|
|
718
|
+
`+H),ke&&(H=Pt(H)),P&&Ct?Ue(H):H},e.setConfig=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ss(S),gs=!0,$t=G,It=q},e.clearConfig=function(){We=null,gs=!1,$t=null,It=null,P=we,J=""},e.isValidAttribute=function(S,c,f){We||Ss({});const v=K(S),$=K(c);return nr(v,$,f)},e.addHook=function(S,c){typeof c=="function"&&oe(U,S)&&ut(U[S],c)},e.removeHook=function(S,c){if(oe(U,S)){if(c!==void 0){const f=bo(U[S],c);return f===-1?void 0:vo(U[S],f,1)[0]}return _r(U[S])}},e.removeHooks=function(S){oe(U,S)&&(U[S]=[])},e.removeAllHooks=function(){U=Ur()},e}var Tn=In();function yi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Be=yi();function Cn(n){Be=n}var Oe={exec:()=>null};function Qe(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function N(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let a=typeof r=="string"?r:r.source;return a=a.replace(ie.caret,"$1"),t=t.replace(i,a),s},getRegex:()=>new RegExp(t,e)};return s}var Go=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),ie={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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Qe(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Qe(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Qe(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Qe(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Qe(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Qe(n=>new RegExp(`^ {0,${n}}>`))},qo=/^(?:[ \t]*(?:\n|$))+/,Ho=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ko=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Wo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Rn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,En=N(Rn).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Vo=N(Rn).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Si=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Qo=/^[^\n]+/,ki=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yo=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ki).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jo=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,wi).getRegex(),cs="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",$i=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zo=N("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\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",$i).replace("tag",cs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_n=n=>N(Si).replace("hr",wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),Xo=_n(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),el=_n(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),tl=N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",el).getRegex(),Ii={blockquote:tl,code:Ho,def:Yo,fences:Ko,heading:Wo,hr:wt,html:Zo,lheading:En,list:Jo,newline:qo,paragraph:Xo,table:Oe,text:Qo},Gr=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),sl={...Ii,lheading:Vo,table:Gr,paragraph:N(Si).replace("hr",wt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex()},il={...Ii,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$i).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:Oe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(Si).replace("hr",wt).replace("heading",` *#{1,6} *[^
|
|
719
|
+
]`).replace("lheading",En).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,An=/^( {2,}|\\)\n(?!\s*$)/,al=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ye=/[\p{P}\p{S}]/u,rt=/[\s\p{P}\p{S}]/u,St=/[^\s\p{P}\p{S}]/u,ol=N(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,rt).getRegex(),ll=/[\p{Pi}\p{Ps}"']/u,Pn=/(?!~)[\p{P}\p{S}]/u,cl=/(?!~)[\s\p{P}\p{S}]/u,dl=/(?:[^\s\p{P}\p{S}]|~)/u,ul=N(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Go?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ln=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pl=N(Ln,"u").replace(/punct/g,ye).getRegex(),hl=N(Ln,"u").replace(/punct/g,Pn).getRegex(),gl=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,fl=N(gl,"u").replace(/openQuote/g,ll).replace(/punct/g,ye).getRegex(),Dn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ml=N(Dn,"gu").replace(/notPunctSpace/g,St).replace(/punctSpace/g,rt).replace(/punct/g,ye).getRegex(),bl=N(Dn,"gu").replace(/notPunctSpace/g,dl).replace(/punctSpace/g,cl).replace(/punct/g,Pn).getRegex(),vl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",xl=N(vl,"gu").replace(/notPunctSpace/g,St).replace(/punctSpace/g,rt).replace(/punct/g,ye).getRegex(),yl=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,St).replace(/punctSpace/g,rt).replace(/punct/g,ye).getRegex(),wl="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Sl=N(wl,"gu").replace(/notPunctSpace/g,St).replace(/punctSpace/g,rt).replace(/punct/g,ye).getRegex(),kl=N(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ye).getRegex(),$l="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Il=N($l,"gu").replace(/notPunctSpace/g,St).replace(/punctSpace/g,rt).replace(/punct/g,ye).getRegex(),Tl=N(/\\(punct)/,"gu").replace(/punct/g,ye).getRegex(),Cl=N(/^<(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(),Rl=N($i).replace("(?:-->|$)","-->").getRegex(),El=N("^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",Rl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,_l=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Kt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jn=N(/^!?\[(label)\]\[(ref)\]/).replace("label",Kt).replace("ref",ki).getRegex(),On=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",ki).getRegex(),Al=N("reflink|nolink(?!\\()","g").replace("reflink",jn).replace("nolink",On).getRegex(),qr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ti={_backpedal:Oe,anyPunctuation:Tl,autolink:Cl,blockSkip:ul,br:An,code:nl,del:Oe,delLDelim:Oe,delRDelim:Oe,emStrongLDelim:pl,emStrongRDelimAst:ml,emStrongRDelimUnd:yl,escape:rl,link:_l,nolink:On,punctuation:ol,reflink:jn,reflinkSearch:Al,tag:El,text:al,url:Oe},Pl={...Ti,emStrongLDelim:fl,emStrongRDelimAst:xl,emStrongRDelimUnd:Sl,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",Kt).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kt).getRegex()},Xs={...Ti,emStrongRDelimAst:bl,emStrongLDelim:hl,delLDelim:kl,delRDelim:Il,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",qr).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:N(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",qr).getRegex()},Ll={...Xs,br:N(An).replace("{2,}","*").getRegex(),text:N(Xs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ft={normal:Ii,gfm:sl,pedantic:il},gt={normal:Ti,gfm:Xs,breaks:Ll,pedantic:Pl},Dl={"&":"&","<":"<",">":">",'"':""","'":"'"},Hr=n=>Dl[n];function ve(n,e){if(e){if(ie.escapeTest.test(n))return n.replace(ie.escapeReplace,Hr)}else if(ie.escapeTestNoEncode.test(n))return n.replace(ie.escapeReplaceNoEncode,Hr);return n}function Kr(n){try{n=encodeURI(n).replace(ie.percentDecode,"%")}catch{return null}return n}function Wr(n,e){let t=n.replace(ie.findPipe,(r,a,o)=>{let l=!1,u=a;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),s=t.split(ie.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(ie.slashPipe,"|");return s}function Te(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function Vr(n){let e=n.split(`
|
|
720
|
+
`),t=e.length-1;for(;t>=0&&ie.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
721
|
+
`)}function jl(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Ol(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function Qr(n,e,t,s,i){let r=e.href,a=e.title||null,o=n[1].replace(i.other.outputLinkReplace,"$1"),l=n[0].charAt(0)==="!";s.state.inLink=!0;let u=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let d=s.inlineTokens(o),g=s.state.linkEmitted;if(s.state.linkEmitted=u,s.state.inLink=!1,!l){if(g){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:l?"image":"link",raw:t,href:r,title:a,text:o,tokens:d}}function Nl(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
722
722
|
`).map(r=>{let a=r.match(t.other.beginningSpace);if(a===null)return r;let[o]=a;return o.length>=i.length?r.slice(i.length):r}).join(`
|
|
723
|
-
`)}var Wt=class{options;rules;lexer;constructor(n){this.options=n||Be}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:
|
|
723
|
+
`)}var Wt=class{options;rules;lexer;constructor(n){this.options=n||Be}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:Vr(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=Nl(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=Te(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:Te(e[0],`
|
|
724
724
|
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Te(e[0],`
|
|
725
725
|
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Te(e[0],`
|
|
726
726
|
`).split(`
|
|
@@ -728,26 +728,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
728
728
|
`),p=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
729
729
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
730
730
|
${u}`:u,i=i?`${i}
|
|
731
|
-
${p}`:p;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=d,t.length===0)break;let g=r.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let
|
|
732
|
-
`),
|
|
733
|
-
`+
|
|
734
|
-
${
|
|
731
|
+
${p}`:p;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=d,t.length===0)break;let g=r.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let b=g,x=t.join(`
|
|
732
|
+
`),E=b.raw+`
|
|
733
|
+
`+x.replace(this.rules.other.blockquoteSetextReplace2,""),O=this.blockquote(E);r[r.length-1]=O,s=`${s}
|
|
734
|
+
${x}`,i=i.substring(0,i.length-b.text.length)+O.text;break}else if(g?.type==="list"){let b=g,x=b.raw+`
|
|
735
735
|
`+t.join(`
|
|
736
|
-
`),
|
|
736
|
+
`),E=this.list(x);r[r.length-1]=E,s=s.substring(0,s.length-g.raw.length)+E.raw,i=i.substring(0,i.length-b.raw.length)+E.raw,t=x.substring(r.at(-1).raw.length).split(`
|
|
737
737
|
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let r=this.rules.other.listItemRegex(t),a=!1;for(;n;){let l=!1,u="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;u=e[0],n=n.substring(u.length);let d=Ol(e[2].split(`
|
|
738
738
|
`,1)[0],e[1].length),g=n.split(`
|
|
739
|
-
`,1)[0],
|
|
740
|
-
`,n=n.substring(g.length+1),l=!0),!l){let
|
|
741
|
-
`,1)[0],
|
|
742
|
-
`+
|
|
743
|
-
`+g}
|
|
744
|
-
`,n=n.substring(
|
|
745
|
-
`),href:s,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=
|
|
739
|
+
`,1)[0],b=!d.trim(),x=0;if(this.options.pedantic?(x=2,p=d.trimStart()):b?x=e[1].length+1:(x=d.search(this.rules.other.nonSpaceChar),x=x>4?1:x,p=d.slice(x),x+=e[1].length),b&&this.rules.other.blankLine.test(g)&&(u+=g+`
|
|
740
|
+
`,n=n.substring(g.length+1),l=!0),!l){let E=this.rules.other.nextBulletRegex(x),O=this.rules.other.hrRegex(x),I=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),y=this.rules.other.htmlBeginRegex(x),R=this.rules.other.blockquoteBeginRegex(x);for(;n;){let T=n.split(`
|
|
741
|
+
`,1)[0],M;if(g=T,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),M=g):M=g.replace(this.rules.other.tabCharGlobal," "),I.test(g)||_.test(g)||y.test(g)||R.test(g)||E.test(g)||O.test(g))break;if(M.search(this.rules.other.nonSpaceChar)>=x||!g.trim())p+=`
|
|
742
|
+
`+M.slice(x);else{if(b||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(d)||_.test(d)||O.test(d))break;p+=`
|
|
743
|
+
`+g}b=!g.trim(),u+=T+`
|
|
744
|
+
`,n=n.substring(T.length+1),d=M.slice(x)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=u}let o=i.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let u=l.tokens.filter(d=>d.type==="space"),p=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=p}for(let l of i.items){let u=l.tokens[0];if(l.task&&(u?.type==="text"||u?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}else l.task&&(l.task=!1)}if(i.loose)for(let l of i.items){l.loose=!0;for(let u of l.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=Vr(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:Te(e[0],`
|
|
745
|
+
`),href:s,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Wr(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
746
746
|
`):[],r={type:"table",raw:Te(e[0],`
|
|
747
|
-
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<t.length;a++)r.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:r.align[a]});for(let a of i)r.rows.push(
|
|
747
|
+
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<t.length;a++)r.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:r.align[a]});for(let a of i)r.rows.push(Wr(a,r.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:r.align[l]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:Te(e[0],`
|
|
748
748
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
749
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=Te(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=jl(e[2],"()");if(r===-2)return;if(r>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),
|
|
750
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(
|
|
749
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=Te(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=jl(e[2],"()");if(r===-2)return;if(r>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Qr(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return Qr(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,a,o=i,l=0,u=s[0][0],p=t===u,d=u==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+i);(s=d.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(a=[...r].length,s[3]||s[4]){o+=a;continue}else if(s[5]||s[6]){if(i%3&&!((i+a)%3)){l+=a;continue}if(p)break}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let g=[...s[0]][0].length,b=n.slice(0,i+s.index+g+a);if(Math.min(i,a)%2){let E=b.slice(1,-1);return{type:"em",raw:b,text:E,tokens:this.lexer.inlineTokens(E)}}let x=b.slice(2,-2);return{type:"strong",raw:b,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,a,o=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(s=l.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(a=[...r].length,a!==i))continue;if(s[3]||s[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let u=[...s[0]][0].length,p=n.slice(0,i+s.index+u+a),d=p.slice(i,-i);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},pe=class ei{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Be,this.options.tokenizer=this.options.tokenizer||new Wt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:ie,block:Ft.normal,inline:gt.normal};this.options.pedantic?(t.block=Ft.pedantic,t.inline=gt.pedantic):this.options.gfm&&(t.block=Ft.gfm,this.options.breaks?t.inline=gt.breaks:t.inline=gt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ft,inline:gt}}static lex(e,t){return new ei(t).lex(e)}static lexInline(e,t){return new ei(t).inlineTokens(e)}lex(e){e=e.replace(ie.carriageReturn,`
|
|
750
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ie.tabCharGlobal," ").replace(ie.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(o=>(r=o.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 o=t.at(-1);r.raw.length===1&&o!==void 0?o.raw+=`
|
|
751
751
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
752
752
|
`)?"":`
|
|
753
753
|
`)+r.raw,o.text+=`
|
|
@@ -760,9 +760,9 @@ ${y}`,i=i.substring(0,i.length-v.text.length)+O.text;break}else if(g?.type==="li
|
|
|
760
760
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),s=a.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
761
761
|
`)?"":`
|
|
762
762
|
`)+r.raw,o.text+=`
|
|
763
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,l=u=>{let p=u.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,u.slice(p+1,-1)))return u;if(p>1&&u.charAt(0)!=="!"){let d=u.slice(1,p-1);if(this.linkInText(d))return"["+d.replace(o,l)+"]["+"a".repeat(u.length-p-2)+"]"}return"["+"a".repeat(u.length-2)+"]"};s=s.replace(o,l)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(o,l,u)=>{let p=u?u.length:0;return o.slice(0,p)+"["+"a".repeat(o.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let o;if(this.options.extensions?.inline?.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let u=t.at(-1);o.type==="text"&&u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,s,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,s,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},p),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),i=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Vt=class{options;parser;constructor(n){this.options=n||Be}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(
|
|
764
|
-
`;return s?'<pre><code class="language-'+
|
|
765
|
-
`:"<pre><code>"+(t?i:
|
|
763
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,l=u=>{let p=u.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,u.slice(p+1,-1)))return u;if(p>1&&u.charAt(0)!=="!"){let d=u.slice(1,p-1);if(this.linkInText(d))return"["+d.replace(o,l)+"]["+"a".repeat(u.length-p-2)+"]"}return"["+"a".repeat(u.length-2)+"]"};s=s.replace(o,l)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(o,l,u)=>{let p=u?u.length:0;return o.slice(0,p)+"["+"a".repeat(o.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let o;if(this.options.extensions?.inline?.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let u=t.at(-1);o.type==="text"&&u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,s,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,s,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let l=e;if(this.options.extensions?.startInline){let u=1/0,p=e.slice(1),d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},p),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),i=!0;let u=t.at(-1);u?.type==="text"?(u.raw+=o.raw,u.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Vt=class{options;parser;constructor(n){this.options=n||Be}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(ie.notSpaceStart)?.[0],i=n.replace(ie.endingNewline,"")+`
|
|
764
|
+
`;return s?'<pre><code class="language-'+ve(s)+'">'+(t?i:ve(i,!0))+`</code></pre>
|
|
765
|
+
`:"<pre><code>"+(t?i:ve(i,!0))+`</code></pre>
|
|
766
766
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
767
767
|
${this.parser.parse(n)}</blockquote>
|
|
768
768
|
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
@@ -778,18 +778,18 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
778
778
|
`}tablerow({text:n}){return`<tr>
|
|
779
779
|
${n}</tr>
|
|
780
780
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
781
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${
|
|
782
|
-
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+
|
|
781
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${ve(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),i=Kr(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+ve(e)+'"'),r+=">"+s+"</a>",r}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=Kr(n);if(i===null)return ve(t);n=i;let r=`<img src="${n}" alt="${ve(t)}"`;return e&&(r+=` title="${ve(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:ve(n.text)}},Ci=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},he=class ti{options;renderer;textRenderer;constructor(e){this.options=e||Be,this.options.renderer=this.options.renderer||new Vt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ci}static parse(e,t){return new ti(t).parse(e)}static parseInline(e,t){return new ti(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=i,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){t+=o||"";continue}}let r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let o=this.options.extensions.renderers[r.type].call({parser:this},r);if(o!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){s+=o||"";continue}}let a=r;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},mt=class{options;block;constructor(n){this.options=n||Be}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?pe.lex:pe.lexInline}provideParser(n=this.block){return n?he.parse:he.parseInline}},Ml=class{defaults=yi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=he;Renderer=Vt;TextRenderer=Ci;Lexer=pe;Tokenizer=Wt;Hooks=mt;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let a of r)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let a=i[r].flat(1/0);t=t.concat(this.walkTokens(a,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=r.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new Vt(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let a=r,o=t.renderer[a],l=i[a];i[a]=(...u)=>{let p=o.apply(i,u);return p===!1&&(p=l.apply(i,u)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Wt(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let a=r,o=t.tokenizer[a],l=i[a];i[a]=(...u)=>{let p=o.apply(i,u);return p===!1&&(p=l.apply(i,u)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new mt;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let a=r,o=t.hooks[a],l=i[a];mt.passThroughHooks.has(r)?i[a]=u=>{if(this.defaults.async&&mt.passThroughHooksRespectAsync.has(r))return(async()=>{let d=await o.call(i,u);return l.call(i,d)})();let p=o.call(i,u);return l.call(i,p)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(i,u);return d===!1&&(d=await l.apply(i,u)),d})();let p=o.apply(i,u);return p===!1&&(p=l.apply(i,u)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(a){let o=[];return o.push(r.call(this,a)),i&&(o=o.concat(i.call(this,a))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return pe.lex(n,e??this.defaults)}parser(n,e){return he.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(new 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 e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(n):n?pe.lex:pe.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser(n):n?he.parse:he.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(n):n?pe.lex:pe.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(n):n?he.parse:he.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return r(a)}}}onError(n,e){return t=>{if(t.message+=`
|
|
782
|
+
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+ve(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},Fe=new Ml;function z(n,e){return Fe.parse(n,e)}z.options=z.setOptions=function(n){return Fe.setOptions(n),z.defaults=Fe.defaults,Cn(z.defaults),z};z.getDefaults=yi;z.defaults=Be;function Fl(...n){return Fe.use(...n),z.defaults=Fe.defaults,Cn(z.defaults),z}z.use=Fl;z.walkTokens=function(n,e){return Fe.walkTokens(n,e)};z.parseInline=Fe.parseInline;z.Parser=he;z.parser=he.parse;z.Renderer=Vt;z.TextRenderer=Ci;z.Lexer=pe;z.lexer=pe.lex;z.Tokenizer=Wt;z.Hooks=mt;z.parse=z;z.options;z.setOptions;z.walkTokens;z.parseInline;he.parse;pe.lex;const Yt=class Yt extends de{constructor(){super(...arguments),this.active=!1,this.crossLink=!1,this.record=null,this.reference="",this.statusTone="neutral",this.onOpen=()=>{this.record&&this.dispatchEvent(new CustomEvent("record-open",{bubbles:!0,composed:!0,detail:{crossLink:this.crossLink,record:this.record}}))}}render(){const e=this.record;return e?h`
|
|
783
783
|
<button
|
|
784
784
|
aria-label=${`Open ${this.reference} ${e.title}`}
|
|
785
|
-
class=${
|
|
785
|
+
class=${Q({active:this.active,line:!0})}
|
|
786
786
|
@click=${this.onOpen}
|
|
787
787
|
>
|
|
788
788
|
<span class="idtag">${this.reference}</span>
|
|
789
789
|
<span class="line-title">${e.title}</span>
|
|
790
790
|
<span class=${`badge ${this.statusTone}`}>${e.status}</span>
|
|
791
791
|
</button>
|
|
792
|
-
`:h``}};Yt.properties={active:{type:Boolean},crossLink:{type:Boolean},record:{attribute:!1},reference:{type:String},statusTone:{type:String}},Yt.styles=
|
|
792
|
+
`:h``}};Yt.properties={active:{type:Boolean},crossLink:{type:Boolean},record:{attribute:!1},reference:{type:String},statusTone:{type:String}},Yt.styles=ge`
|
|
793
793
|
:host {
|
|
794
794
|
display: block;
|
|
795
795
|
}
|
|
@@ -826,7 +826,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
826
826
|
font-size: 11px;
|
|
827
827
|
font-weight: 600;
|
|
828
828
|
}
|
|
829
|
-
`;let
|
|
829
|
+
`;let si=Yt;const Jt=class Jt extends de{constructor(){super(...arguments),this.countText="",this.query="",this.status="all",this.statuses=[],this.title="Records",this.treeTab=null,this.treeView="list",this.onQueryInput=e=>{this.dispatchEvent(new CustomEvent("record-query-change",{bubbles:!0,composed:!0,detail:{query:e.target.value}}))},this.onStatusChange=e=>{this.dispatchEvent(new CustomEvent("record-status-change",{bubbles:!0,composed:!0,detail:{status:e.target.value}}))},this.onSetView=e=>{const t=e.currentTarget.dataset.view;!t||!this.treeTab||this.dispatchEvent(new CustomEvent("record-view-change",{bubbles:!0,composed:!0,detail:{tab:this.treeTab,view:t}}))}}render(){const e=this.title.toLowerCase();return h`
|
|
830
830
|
<div class="toolbar">
|
|
831
831
|
<label class="filter">
|
|
832
832
|
<span>Filter ${e}</span>
|
|
@@ -855,7 +855,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
855
855
|
>
|
|
856
856
|
<button
|
|
857
857
|
aria-pressed=${String(this.treeView==="list")}
|
|
858
|
-
class=${
|
|
858
|
+
class=${Q({active:this.treeView==="list","view-button":!0})}
|
|
859
859
|
data-view="list"
|
|
860
860
|
@click=${this.onSetView}
|
|
861
861
|
type="button"
|
|
@@ -864,7 +864,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
864
864
|
</button>
|
|
865
865
|
<button
|
|
866
866
|
aria-pressed=${String(this.treeView==="tree")}
|
|
867
|
-
class=${
|
|
867
|
+
class=${Q({active:this.treeView==="tree","view-button":!0})}
|
|
868
868
|
data-view="tree"
|
|
869
869
|
@click=${this.onSetView}
|
|
870
870
|
type="button"
|
|
@@ -875,7 +875,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
875
875
|
`,()=>h``)}
|
|
876
876
|
<span class="count">${this.countText}</span>
|
|
877
877
|
</div>
|
|
878
|
-
`}};Jt.properties={countText:{type:String},query:{type:String},status:{type:String},statuses:{attribute:!1},title:{type:String},treeTab:{type:String},treeView:{type:String}},Jt.styles=
|
|
878
|
+
`}};Jt.properties={countText:{type:String},query:{type:String},status:{type:String},statuses:{attribute:!1},title:{type:String},treeTab:{type:String},treeView:{type:String}},Jt.styles=ge`
|
|
879
879
|
:host {
|
|
880
880
|
display: block;
|
|
881
881
|
}
|
|
@@ -949,7 +949,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
949
949
|
padding-bottom: 0;
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
`;let
|
|
952
|
+
`;let ii=Jt;customElements.define("agent-issues-record-list-item",si);customElements.define("agent-issues-record-filter-toolbar",ii);const zl={adr:"var(--graph-adr)",debt:"var(--graph-debt)",initiative:"var(--graph-initiative)",issue:"var(--graph-issue)",prd:"var(--success)",project:"var(--graph-project)",story:"var(--graph-story)"},Yr={blocked:"var(--danger)",done:"var(--done)"},Ye=184,Jr=34,zs=244,Bs=28,Zr=56,Xr=58;function Bl(n,e){return n.length>e?`${n.slice(0,e-1)}…`:n}const Zt=class Zt extends de{constructor(){super(...arguments),this.graph=null,this.themeObserver=null}connectedCallback(){super.connectedCallback(),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.documentElement,{attributeFilter:["data-theme"],attributes:!0})}disconnectedCallback(){this.themeObserver?.disconnect(),this.themeObserver=null,super.disconnectedCallback()}onNodeClick(e){this.dispatchEvent(new CustomEvent("node-open",{bubbles:!0,composed:!0,detail:{id:e.id,kind:e.kind}}))}nodeColor(e){return zl[e.kind]??"var(--muted)"}nodeStroke(e){return e.kind==="issue"&&e.status&&Yr[e.status]?Yr[e.status]:this.nodeColor(e)}render(){const e=this.graph;if(!e||e.nodes.length===0)return k;const t=new Map;for(const p of e.nodes){const d=t.get(p.col)??[];d.push(p),t.set(p.col,d)}const s=[...t.keys()].sort((p,d)=>p-d),i=Math.max(...e.nodes.map(p=>p.col))+1,r=Math.max(...s.map(p=>t.get(p)?.length??0)),a=Bs*2+(i-1)*zs+Ye,o=Zr+r*Xr+24,l=new Map;for(const p of s)(t.get(p)??[]).forEach((g,b)=>{const x=Bs+p*zs,E=Zr+b*Xr;l.set(g.key,{cx:x+Ye/2,cy:E+Jr/2,x,y:E})});const u=e.columns.map((p,d)=>({col:d,title:p})).filter(p=>t.has(p.col));return h`
|
|
953
953
|
<svg
|
|
954
954
|
width=${a}
|
|
955
955
|
height=${o}
|
|
@@ -962,27 +962,27 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
962
962
|
y="28"
|
|
963
963
|
text-anchor="middle"
|
|
964
964
|
>${p.title}</text>`)}
|
|
965
|
-
${D(e.edges.filter(p=>l.has(p.from)&&l.has(p.to)),p=>`${p.from}->${p.to}`,p=>{const d=l.get(p.from),g=l.get(p.to),
|
|
965
|
+
${D(e.edges.filter(p=>l.has(p.from)&&l.has(p.to)),p=>`${p.from}->${p.to}`,p=>{const d=l.get(p.from),g=l.get(p.to),b=d.cx+Ye/2,x=d.cy,E=g.cx-Ye/2,O=g.cy;return Nt`
|
|
966
966
|
<path
|
|
967
967
|
class="ai-edge"
|
|
968
|
-
d=${`M${
|
|
968
|
+
d=${`M${b} ${x} C ${b+46} ${x}, ${E-46} ${O}, ${E} ${O}`}
|
|
969
969
|
fill="none"
|
|
970
970
|
stroke="var(--graph-edge)"
|
|
971
971
|
stroke-width="1.5"
|
|
972
972
|
/>
|
|
973
973
|
${w(p.label,()=>Nt`<text
|
|
974
974
|
class="ai-edge-label"
|
|
975
|
-
x=${(
|
|
976
|
-
y=${(
|
|
975
|
+
x=${(b+E)/2}
|
|
976
|
+
y=${(x+O)/2-5}
|
|
977
977
|
text-anchor="middle"
|
|
978
978
|
>${p.label}</text>`,()=>k)}
|
|
979
979
|
`})}
|
|
980
|
-
${D(e.nodes,p=>p.key,p=>{const d=l.get(p.key),g=this.nodeColor(p),
|
|
981
|
-
class=${
|
|
980
|
+
${D(e.nodes,p=>p.key,p=>{const d=l.get(p.key),g=this.nodeColor(p),b=this.nodeStroke(p),x=p.kind!=="project";return Nt`<g
|
|
981
|
+
class=${x?"ai-node":"ai-node ai-node-static"}
|
|
982
982
|
data-id=${p.id}
|
|
983
983
|
data-kind=${p.kind}
|
|
984
|
-
style=${`cursor:${
|
|
985
|
-
@click=${
|
|
984
|
+
style=${`cursor:${x?"pointer":"default"}`}
|
|
985
|
+
@click=${x?()=>this.onNodeClick(p):k}
|
|
986
986
|
>
|
|
987
987
|
<title>${p.fullLabel||p.label}</title>
|
|
988
988
|
<rect
|
|
@@ -990,10 +990,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
990
990
|
x=${d.x}
|
|
991
991
|
y=${d.y}
|
|
992
992
|
width=${Ye}
|
|
993
|
-
height=${
|
|
993
|
+
height=${Jr}
|
|
994
994
|
rx="9"
|
|
995
995
|
fill="var(--surface)"
|
|
996
|
-
stroke=${
|
|
996
|
+
stroke=${b}
|
|
997
997
|
stroke-width="1.5"
|
|
998
998
|
/>
|
|
999
999
|
<circle
|
|
@@ -1009,7 +1009,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1009
1009
|
>${Bl(p.label,21)}</text>
|
|
1010
1010
|
</g>`})}
|
|
1011
1011
|
</svg>
|
|
1012
|
-
`}};Zt.properties={graph:{attribute:!1}},Zt.styles=
|
|
1012
|
+
`}};Zt.properties={graph:{attribute:!1}},Zt.styles=ge`
|
|
1013
1013
|
:host {
|
|
1014
1014
|
display: block;
|
|
1015
1015
|
}
|
|
@@ -1039,7 +1039,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1039
1039
|
stroke-width: 3;
|
|
1040
1040
|
filter: drop-shadow(0 2px 6px var(--shadow));
|
|
1041
1041
|
}
|
|
1042
|
-
`;let
|
|
1042
|
+
`;let ri=Zt;customElements.define("agent-issues-relationship-graph",ri);const Ul=["initiatives","adrs","debt","graph","context"];function Gl(n){return typeof n=="string"&&Ul.includes(n)}const ze=["project","epic","initiative","plan","prd","adr","story","issue","debt"],ql={adr:{color:"var(--graph-adr)",label:"ADR"},debt:{color:"var(--graph-debt)",label:"Debt"},epic:{color:"var(--graph-epic)",label:"Epic"},initiative:{color:"var(--graph-initiative)",label:"Initiative"},issue:{color:"var(--graph-issue)",label:"Issue"},plan:{color:"var(--graph-adr)",label:"Plan"},prd:{color:"var(--success)",label:"PRD"},project:{color:"var(--graph-project)",label:"Project"},story:{color:"var(--graph-story)",label:"User story"}},Xt=class Xt extends de{constructor(){super(...arguments),this.kinds=[...ze],this.visibleKinds=new Set(ze),this.onToggleKind=e=>{const t=e.currentTarget.dataset.graphKind;t&&this.dispatchEvent(new CustomEvent("graph-kind-toggle",{bubbles:!0,composed:!0,detail:{kind:t}}))}}toAriaBoolean(e){return e?"true":"false"}render(){return h`
|
|
1043
1043
|
<div
|
|
1044
1044
|
aria-label="Filter graph records"
|
|
1045
1045
|
class="graph-kind-filters"
|
|
@@ -1048,7 +1048,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1048
1048
|
${D(this.kinds,e=>e,e=>{const t=ql[e],s=this.visibleKinds.has(e);return h`
|
|
1049
1049
|
<button
|
|
1050
1050
|
aria-pressed=${this.toAriaBoolean(s)}
|
|
1051
|
-
class=${
|
|
1051
|
+
class=${Q({active:s,"graph-kind-chip":!0})}
|
|
1052
1052
|
data-graph-kind=${e}
|
|
1053
1053
|
@click=${this.onToggleKind}
|
|
1054
1054
|
>
|
|
@@ -1060,7 +1060,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1060
1060
|
</button>
|
|
1061
1061
|
`})}
|
|
1062
1062
|
</div>
|
|
1063
|
-
`}};Xt.properties={kinds:{attribute:!1},visibleKinds:{attribute:!1}},Xt.styles=
|
|
1063
|
+
`}};Xt.properties={kinds:{attribute:!1},visibleKinds:{attribute:!1}},Xt.styles=ge`
|
|
1064
1064
|
:host {
|
|
1065
1065
|
display: contents;
|
|
1066
1066
|
}
|
|
@@ -1093,7 +1093,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1093
1093
|
height: 10px;
|
|
1094
1094
|
border-radius: 50%;
|
|
1095
1095
|
}
|
|
1096
|
-
`;let
|
|
1096
|
+
`;let ni=Xt;customElements.define("agent-issues-relationship-graph-filters",ni);function Hl(n){const e=z.parse(n,{async:!1});return Tn.sanitize(e)}const Us=["initiative","plan","prd","adr","story","issue","debt"],en=[["issues","Issues"],["plans","Plans"],["prds","PRDs"],["adrs","ADRs"],["graph","Graph"],["context","Context"],["userStories","User stories"],["debt","Debt"]],es=class es extends rs(de){constructor(){super(...arguments),this.store=null,this.initiativeId=null,this.cascade=!1,this.activeChildId=null,this.collapsedIssueIds=new Set,this.collapsedOverviewSectionIds=new Set,this.recordQuery="",this.recordStatus="all",this.issueRecordView="list",this.userStoryRecordView="list",this.visibleGraphKinds=new Set(Us),this.onSelectEntityClick=e=>{if(this.cascade){const t=e.currentTarget.dataset.id;t&&this.initiativeId&&this.store?.drillCascade(this.initiativeId,t);return}this.store?.selectEntityFromEvent(e)},this.onSetTab=e=>{const t=e.currentTarget.dataset.tab;t&&(this.recordQuery="",this.recordStatus="all",this.store?.setInitTab(t))},this.onRetryLoad=e=>{const t=e.currentTarget,s=t.dataset.initiativeId,i=t.dataset.tab;if(s){if(i){this.store?.retryInitiativeTab(s,i);return}this.store?.retryInitiativeDetail(s)}},this.onContextQueryInput=e=>{this.recordQuery=e.target.value,this.requestUpdate()},this.onRecordQueryChange=e=>{this.recordQuery=e.detail.query,this.requestUpdate()},this.onRecordStatusChange=e=>{this.recordStatus=e.detail.status,this.requestUpdate()},this.onRecordViewChange=e=>{const{tab:t,view:s}=e.detail;t==="issues"?this.issueRecordView=s:this.userStoryRecordView=s,this.requestUpdate()},this.onRecordOpen=e=>{const t=e.detail.record;if(this.cascade&&this.initiativeId){this.store?.drillCascade(this.initiativeId,t.id);return}this.store?.selectEntity(t.id)},this.onNodeOpen=e=>{const t=e.detail.id;t&&this.store?.selectEntity(t)},this.onToggleGraphKind=e=>{const t=e.detail.kind;if(!t)return;const s=new Set(this.visibleGraphKinds);s.has(t)?s.delete(t):s.add(t),this.visibleGraphKinds=s,this.requestUpdate()},this.onToggleIssueBranch=e=>{e.stopPropagation();const t=e.currentTarget.dataset.id;t&&(this.collapsedIssueIds.has(t)?this.collapsedIssueIds.delete(t):this.collapsedIssueIds.add(t),this.requestUpdate())},this.onToggleOverviewSection=e=>{const t=e.currentTarget.dataset.sectionId;t&&(this.collapsedOverviewSectionIds.has(t)?this.collapsedOverviewSectionIds.delete(t):this.collapsedOverviewSectionIds.add(t),this.requestUpdate())}}activeBundle(){const e=this.store;return e?e.bundleForInitiativeId(this.initiativeId??e.selectedInitiativeId.get()):null}getTabButtonId(e){return`initiative-tab-${e}`}getTabPanelId(e){return`initiative-panel-${e}`}renderBodySourceNotice(){return h`
|
|
1097
1097
|
<div class="ai-body-source ai-body-source-generated">
|
|
1098
1098
|
<span class="ai-body-source-badge">Generated fallback</span>
|
|
1099
1099
|
<span class="ai-body-source-copy">Generated from tracker metadata because no authored body was present.</span>
|
|
@@ -1146,7 +1146,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1146
1146
|
${w(!!i.count,()=>h`<span class="sec-count">${i.count}</span>`,()=>k)}
|
|
1147
1147
|
</span>
|
|
1148
1148
|
<span
|
|
1149
|
-
class=${
|
|
1149
|
+
class=${Q({collapsed:r,"sec-chevron":!0})}
|
|
1150
1150
|
aria-hidden="true"
|
|
1151
1151
|
>
|
|
1152
1152
|
>
|
|
@@ -1160,7 +1160,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1160
1160
|
.record=${e}
|
|
1161
1161
|
.reference=${t.shortRef(e)}
|
|
1162
1162
|
.statusTone=${t.badgeTone(e.status)}
|
|
1163
|
-
class=${
|
|
1163
|
+
class=${Q({"is-active-ref":e.id===this.activeChildId,line:!0,"record-row":!0})}
|
|
1164
1164
|
data-id=${e.id}
|
|
1165
1165
|
@record-open=${this.onRecordOpen}
|
|
1166
1166
|
></agent-issues-record-list-item>
|
|
@@ -1229,16 +1229,13 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1229
1229
|
</div>
|
|
1230
1230
|
`,()=>h`<div class="empty-children">No initiative context matches this filter.</div>`)}
|
|
1231
1231
|
</section>
|
|
1232
|
-
`}render(){const e=this.store;if(!e)return k;const t=this.activeBundle();if(!t)return k;const s=e.getContextForInitiative(t.initiative.id),i=e.initiativeStats(t),r=e.initTab.get(),a=e.initiativeDetails.get().get(t.initiative.id),o=e.initiativeTabs.get().get(`${t.initiative.id}:${r}`),l=(t.initiative.body??"").trim(),u=t.initiative.bodySource??"authored",p=this.visibleGraphKinds,d=p.size!==Us.length,g=e.buildInitiativeGraph(t),
|
|
1232
|
+
`}render(){const e=this.store;if(!e)return k;const t=this.activeBundle();if(!t)return k;const s=e.getContextForInitiative(t.initiative.id),i=e.initiativeStats(t),r=e.initTab.get(),a=e.initiativeDetails.get().get(t.initiative.id),o=e.initiativeTabs.get().get(`${t.initiative.id}:${r}`),l=(t.initiative.body??"").trim(),u=t.initiative.bodySource??"authored",p=this.visibleGraphKinds,d=p.size!==Us.length,g=e.buildInitiativeGraph(t),b=d?e.buildInitiativeGraph(t,p):g,x=e.isSummaryInitiative(t.initiative.id),E=e.projectSummaryInitiatives.get().find(m=>m.initiative.id===t.initiative.id),O=e.debtRecordSectionsFor(t.initiative.id),I=x&&r==="debt"?t.entities.filter(m=>m.kind==="debt"):[...new Map(O.flatMap(m=>m.records).map(m=>[m.id,m])).values()],_=t.entities.filter(m=>m.kind==="plan").sort((m,P)=>new Date(P.updatedAt).getTime()-new Date(m.updatedAt).getTime()||m.id.localeCompare(P.id)),y=x&&E?{adrs:E.adrCount??t.adrs.length,context:E.contextTermCount??s?.terms.length??0,debt:E.debtCount??I.length,issues:E.issueCount,plans:E.planCount??_.length,prds:E.prdCount??t.prds.length,userStories:E.userStoryCount}:{adrs:t.adrs.length,context:s?.terms.length??0,debt:I.length,graph:g.nodes.length,issues:t.issues.length,plans:_.length,prds:t.prds.length,userStories:t.userStories.length},R=[{label:"Overview",tab:"overview"},...en.filter(([m])=>m==="graph"?g.edges.length>0:m==="context"?s?.context.exists===!0:(y[m]??0)>0).map(([m,P])=>({label:P,recordCount:y[m],tab:m}))],T=x?[{label:"Overview",tab:"overview"},...en.map(([m,P])=>({label:P,recordCount:y[m],tab:m}))]:R,M=T.some(({tab:m})=>m===r)?r:"overview",X=M==="overview"?a?.loading===!0:o?.loading===!0;return h`
|
|
1233
1233
|
<div class="detail-inner">
|
|
1234
1234
|
<div class="ai-crumbs">${e.selectedTenantDisplayName.get()} · Initiatives</div>
|
|
1235
1235
|
<h1 class="d-title">
|
|
1236
1236
|
${t.initiative.title}
|
|
1237
1237
|
<span class=${`badge ${e.badgeTone(t.initiative.status)}`}>${t.initiative.status}</span>
|
|
1238
1238
|
</h1>
|
|
1239
|
-
<div class="d-sub">
|
|
1240
|
-
${Js(tn(s?.context.summary??"No initiative-specific context is available yet."))}
|
|
1241
|
-
</div>
|
|
1242
1239
|
|
|
1243
1240
|
<div class="kpis">
|
|
1244
1241
|
<div class="kpi">
|
|
@@ -1269,31 +1266,31 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1269
1266
|
class="subtabs"
|
|
1270
1267
|
role="tablist"
|
|
1271
1268
|
>
|
|
1272
|
-
${D(
|
|
1269
|
+
${D(T,({tab:m})=>m,({label:m,recordCount:P,tab:J})=>h`
|
|
1273
1270
|
<button
|
|
1274
|
-
aria-label=${
|
|
1275
|
-
aria-controls=${this.getTabPanelId(
|
|
1276
|
-
aria-selected=${String(
|
|
1277
|
-
class=${
|
|
1278
|
-
data-tab=${
|
|
1279
|
-
id=${this.getTabButtonId(
|
|
1271
|
+
aria-label=${J===M&&X?`${m}, loading`:P===void 0?m:`${m}: ${P} records`}
|
|
1272
|
+
aria-controls=${this.getTabPanelId(J)}
|
|
1273
|
+
aria-selected=${String(M===J)}
|
|
1274
|
+
class=${Q({active:M===J,subtab:!0})}
|
|
1275
|
+
data-tab=${J}
|
|
1276
|
+
id=${this.getTabButtonId(J)}
|
|
1280
1277
|
@click=${this.onSetTab}
|
|
1281
1278
|
role="tab"
|
|
1282
1279
|
>
|
|
1283
1280
|
<span class="subtab-label">
|
|
1284
|
-
<span class="subtab-label-text">${
|
|
1281
|
+
<span class="subtab-label-text">${m}</span>
|
|
1285
1282
|
</span>
|
|
1286
|
-
${w(
|
|
1283
|
+
${w(J===M&&X,()=>h`<span aria-hidden="true" class="subtab-spinner"></span>`,()=>w(P!==void 0,()=>h`<span aria-hidden="true" class="subtab-count">${P}</span>`,()=>k))}
|
|
1287
1284
|
</button>
|
|
1288
1285
|
`)}
|
|
1289
1286
|
</div>
|
|
1290
1287
|
|
|
1291
1288
|
<section
|
|
1292
|
-
aria-
|
|
1293
|
-
|
|
1289
|
+
aria-busy=${String(X)}
|
|
1290
|
+
aria-labelledby=${this.getTabButtonId(M)}
|
|
1291
|
+
id=${this.getTabPanelId(M)}
|
|
1294
1292
|
role="tabpanel"
|
|
1295
1293
|
>
|
|
1296
|
-
${w(r!=="overview"&&o?.loading===!0,()=>h`<div class="local-state" role="status">Loading ${r}...</div>`,()=>k)}
|
|
1297
1294
|
${w(r!=="overview"&&!!o?.error,()=>h`
|
|
1298
1295
|
<div class="local-state local-state-error" role="alert">
|
|
1299
1296
|
<span>Could not load ${r}.</span>
|
|
@@ -1306,8 +1303,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1306
1303
|
</button>
|
|
1307
1304
|
</div>
|
|
1308
1305
|
`,()=>k)}
|
|
1309
|
-
${et(
|
|
1310
|
-
${w(a?.loading===!0,()=>h`<div class="local-state" role="status">Loading initiative details...</div>`,()=>k)}
|
|
1306
|
+
${et(M,[["overview",()=>h`
|
|
1311
1307
|
${w(!!a?.error,()=>h`
|
|
1312
1308
|
<div class="local-state local-state-error" role="alert">
|
|
1313
1309
|
<span>Could not load initiative details.</span>
|
|
@@ -1322,17 +1318,17 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1322
1318
|
${w(l.length>0,()=>h`
|
|
1323
1319
|
<div class="initiative-body overview-body">
|
|
1324
1320
|
${w(u==="generated",()=>this.renderBodySourceNotice(),()=>k)}
|
|
1325
|
-
<div class="ai-body">${
|
|
1321
|
+
<div class="ai-body">${wn(Hl(l))}</div>
|
|
1326
1322
|
</div>
|
|
1327
1323
|
`,()=>k)}
|
|
1328
|
-
${D(
|
|
1324
|
+
${D(O,m=>m.key,m=>this.renderOverviewSection(m.key,m.title,h`
|
|
1329
1325
|
<div class="sec-body">
|
|
1330
|
-
${D(
|
|
1326
|
+
${D(m.records,P=>P.id,P=>this.renderLine(P))}
|
|
1331
1327
|
</div>
|
|
1332
|
-
`,{count:String(
|
|
1333
|
-
`],["issues",()=>this.renderRecordTab("Issues",t.issues,"No issues attached.",t,{treeContent:
|
|
1328
|
+
`,{count:String(m.records.length)}))}
|
|
1329
|
+
`],["issues",()=>this.renderRecordTab("Issues",t.issues,"No issues attached.",t,{treeContent:m=>this.renderIssueTreeTab(t,m),treeTab:"issues"})],["plans",()=>this.renderRecordTab("Plans",_,"No Plans attached.",t)],["prds",()=>this.renderRecordTab("PRDs",t.prds,"No PRDs attached.",t)],["adrs",()=>this.renderRecordTab("ADRs",t.adrs,"No ADRs recorded.",t)],["context",()=>h`
|
|
1334
1330
|
${this.renderContextTab(t)}
|
|
1335
|
-
`],["userStories",()=>this.renderRecordTab("User stories",t.userStories,"No user stories attached.",t,{treeContent:
|
|
1331
|
+
`],["userStories",()=>this.renderRecordTab("User stories",t.userStories,"No user stories attached.",t,{treeContent:m=>this.renderUserStoryTreeTab(t,m),treeTab:"userStories"})],["debt",()=>this.renderRecordTab("Debt",I,"No debt recorded.",t)],["graph",()=>h`
|
|
1336
1332
|
<div class="ai-graph-wrap">
|
|
1337
1333
|
<div class="graph-scroll-content">
|
|
1338
1334
|
<div class="ai-graph-legend">
|
|
@@ -1343,10 +1339,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1343
1339
|
></agent-issues-relationship-graph-filters>
|
|
1344
1340
|
<span class="ai-graph-hint">Click any node to open it</span>
|
|
1345
1341
|
</div>
|
|
1346
|
-
${w(
|
|
1342
|
+
${w(b.nodes.length>0,()=>h`
|
|
1347
1343
|
<div class="graph-host">
|
|
1348
1344
|
<agent-issues-relationship-graph
|
|
1349
|
-
.graph=${
|
|
1345
|
+
.graph=${b}
|
|
1350
1346
|
@node-open=${this.onNodeOpen}
|
|
1351
1347
|
></agent-issues-relationship-graph>
|
|
1352
1348
|
</div>
|
|
@@ -1356,7 +1352,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1356
1352
|
`]])}
|
|
1357
1353
|
</section>
|
|
1358
1354
|
</div>
|
|
1359
|
-
`}};es.properties={store:{attribute:!1},initiativeId:{attribute:!1},cascade:{attribute:!1},activeChildId:{attribute:!1}},es.styles=[ls,
|
|
1355
|
+
`}};es.properties={store:{attribute:!1},initiativeId:{attribute:!1},cascade:{attribute:!1},activeChildId:{attribute:!1}},es.styles=[ls,xi,ge`
|
|
1360
1356
|
:host {
|
|
1361
1357
|
display: block;
|
|
1362
1358
|
}
|
|
@@ -1376,29 +1372,6 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1376
1372
|
margin: 6px 0 0;
|
|
1377
1373
|
font-size: 24px;
|
|
1378
1374
|
}
|
|
1379
|
-
.d-sub {
|
|
1380
|
-
max-width: 70ch;
|
|
1381
|
-
margin: 10px 0 0;
|
|
1382
|
-
color: var(--muted);
|
|
1383
|
-
}
|
|
1384
|
-
.d-sub > :first-child {
|
|
1385
|
-
margin-top: 0;
|
|
1386
|
-
}
|
|
1387
|
-
.d-sub > :last-child {
|
|
1388
|
-
margin-bottom: 0;
|
|
1389
|
-
}
|
|
1390
|
-
.d-sub h1,
|
|
1391
|
-
.d-sub h2,
|
|
1392
|
-
.d-sub h3 {
|
|
1393
|
-
margin-bottom: 6px;
|
|
1394
|
-
font-size: 16px;
|
|
1395
|
-
line-height: 1.4;
|
|
1396
|
-
}
|
|
1397
|
-
.d-sub p,
|
|
1398
|
-
.d-sub ul,
|
|
1399
|
-
.d-sub ol {
|
|
1400
|
-
margin: 6px 0;
|
|
1401
|
-
}
|
|
1402
1375
|
.kpis {
|
|
1403
1376
|
display: grid;
|
|
1404
1377
|
grid-template-columns: repeat(4, 1fr);
|
|
@@ -1457,6 +1430,28 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1457
1430
|
.subtab-label {
|
|
1458
1431
|
display: inline-block;
|
|
1459
1432
|
}
|
|
1433
|
+
.subtab-spinner {
|
|
1434
|
+
box-sizing: border-box;
|
|
1435
|
+
position: absolute;
|
|
1436
|
+
top: 2px;
|
|
1437
|
+
right: 4px;
|
|
1438
|
+
width: 14px;
|
|
1439
|
+
height: 14px;
|
|
1440
|
+
border: 2px solid var(--border);
|
|
1441
|
+
border-top-color: var(--accent);
|
|
1442
|
+
border-radius: 50%;
|
|
1443
|
+
animation: tab-loading-spin 700ms linear infinite;
|
|
1444
|
+
}
|
|
1445
|
+
@keyframes tab-loading-spin {
|
|
1446
|
+
to {
|
|
1447
|
+
transform: rotate(360deg);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1451
|
+
.subtab-spinner {
|
|
1452
|
+
animation: none;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1460
1455
|
.subtab.active {
|
|
1461
1456
|
border-bottom-color: #fd8c73;
|
|
1462
1457
|
color: var(--text);
|
|
@@ -1927,7 +1922,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1927
1922
|
padding: 20px 16px 48px;
|
|
1928
1923
|
}
|
|
1929
1924
|
}
|
|
1930
|
-
`];let
|
|
1925
|
+
`];let ai=es;customElements.define("agent-issues-initiative-detail-view",ai);class Re{constructor(e,t,s){this.onLoadMoreIssueComments=()=>{this.store.loadMoreIssueComments(this.entity.id)},this.store=e,this.entity=t,this.host=s}usesTabs(){return!0}issueSeeds(e){return e.linkedRecords.filter(t=>t.kind==="issue")}additionalUserStories(e,t){return[]}entityTabs(){return[]}detailData(){const e=this.store.bundleForEntityId(this.entity.id),t=this.store.debtRecordSectionsFor(this.entity.id),s=this.store.linkedRecordSectionsFor(this.entity.id,{excludeRelatedIds:t.flatMap(I=>I.records.map(_=>_.id)),excludeRelationTypes:this.excludedRelationTypes()}),i=this.buildIssueGraph(e),r={bundle:e,debtSections:t,entity:this.entity,graphAvailable:i.edges.length>0,inheritedContext:e?this.store.getContextForInitiative(e.initiative.id):null,issueGraph:this.filterGraphByKind(i,this.host.visibleGraphKinds)},a=this.uniqueRecords(s.flatMap(I=>I.records)),o={bundle:e,entity:this.entity,issueTreeForStory:I=>e?this.store.issueTreeForStory(e,I):[],linkedRecords:a,parentIssue:this.parentIssue(r),prdStories:this.prdStories(r),recordsInIssueTree:I=>this.recordsInIssueTree(I)},l=this.issueSeeds(o),u=this.uniqueRecords([...l,...l.flatMap(I=>e?this.recordsInIssueTree(this.store.subIssueTreeForIssue(e,I.id)):[]),...a.filter(I=>I.kind==="issue")]),p=new Set(u.map(I=>I.id)),d=this.uniqueRecords([...a.filter(I=>I.kind==="userStory"),...this.additionalUserStories(o,p),...r.bundle?.fixLinks.filter(I=>p.has(I.issue.id)).map(I=>I.userStory)??[]]).filter(I=>I.id!==this.entity.id),g=a.filter(I=>I.kind==="plan"),b=a.filter(I=>I.kind==="prd"),x=this.uniqueRecords([...a.filter(I=>I.kind==="adr"),...e?.constrainsLinks.filter(I=>I.issue.id===this.entity.id).map(I=>I.adr)??[]]),E=this.uniqueRecords([...r.debtSections.flatMap(I=>I.records),...a.filter(I=>I.kind==="debt")]),O=a.filter(I=>!["issue","userStory","plan","prd","adr","debt"].includes(I.kind));return{adrRecords:x,bundle:e,crossLinkRecordIds:new Set(s.filter(I=>I.crossLink).flatMap(I=>I.records.map(_=>_.id))),debtRecords:E,debtSections:t,inheritedContext:r.inheritedContext,issueGraph:r.issueGraph,issueRecords:u,linkedSections:s,parentIssue:o.parentIssue,planRecords:g,prdRecords:b,relatedRecords:O,subIssueTree:this.entity.kind==="issue"&&e?this.store.subIssueTreeForIssue(e,this.entity.id):[],tabs:this.tabsFor(r,u,g,b,x,d,E,O),userStoryRecords:d}}renderDetail(){const e=this.detailData(),t=e.tabs.some(({tab:s})=>s===this.host.entityDetailTab)?this.host.entityDetailTab:"overview";return h`
|
|
1931
1926
|
${w(this.usesTabs(),()=>this.renderTabbedDetail(e,t),()=>this.renderUntabbedDetail(e))}
|
|
1932
1927
|
`}renderTabbedDetail(e,t){return h`
|
|
1933
1928
|
<div
|
|
@@ -1974,7 +1969,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1974
1969
|
${w(e.length>0,()=>h`
|
|
1975
1970
|
<section class="ai-sec ai-body">
|
|
1976
1971
|
${w(t==="generated",()=>this.host.renderBodySourceNotice(),()=>k)}
|
|
1977
|
-
${
|
|
1972
|
+
${sc(ic(e))}
|
|
1978
1973
|
</section>
|
|
1979
1974
|
`,()=>k)}
|
|
1980
1975
|
${w(s.length>0,()=>h`
|
|
@@ -1984,7 +1979,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
1984
1979
|
${w(i,()=>h`<button @click=${this.onLoadMoreIssueComments}>Load more comments</button>`,()=>k)}
|
|
1985
1980
|
</section>
|
|
1986
1981
|
`,()=>k)}
|
|
1987
|
-
`}}class
|
|
1982
|
+
`}}class Kl extends Re{constructor(){super(...arguments),this.label="Issue"}excludedRelationTypes(){return["decomposes"]}parentIssue(e){return e.bundle?this.store.parentIssueForIssue(e.bundle,this.entity.id):null}issueSeeds(e){return[e.entity,...e.parentIssue?[e.parentIssue]:[]]}}class Wl extends Re{constructor(){super(...arguments),this.label="ADR"}issueSeeds(e){const t=e.bundle?.constrainsLinks.filter(s=>s.adr.id===e.entity.id).map(s=>s.issue)??[];return[...super.issueSeeds(e),...t]}}class Vl extends Re{constructor(){super(...arguments),this.label="PRD"}excludedRelationTypes(){return["creates"]}prdStories(e){return e.bundle?.userStories.filter(t=>this.store.outgoingRelationsFor(this.entity.id).some(s=>s.type==="creates"&&s.toId===t.id))??[]}issueSeeds(e){const t=e.prdStories.flatMap(s=>e.recordsInIssueTree(e.issueTreeForStory(s.id)));return[...super.issueSeeds(e),...t]}additionalUserStories(e){return e.prdStories}}class Ql extends Re{constructor(){super(...arguments),this.label="User story"}issueSeeds(e){return[...super.issueSeeds(e),...e.recordsInIssueTree(e.issueTreeForStory(e.entity.id))]}}class Yl extends Re{constructor(){super(...arguments),this.label="Plan",this.onLoadMorePlanEntries=()=>{this.store.loadMorePlanEntries(this.entity.id)}}entityTabs(){return[{label:"Plan",tab:"plan"}]}renderCurrentPlanEntry(e,t,s){const i=t?tc(e,s):[];return h`
|
|
1988
1983
|
${w(i.length>0,()=>h`
|
|
1989
1984
|
<div class="ai-plan-decision-pair">
|
|
1990
1985
|
${D(i,r=>r.id,r=>h`
|
|
@@ -2029,7 +2024,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2029
2024
|
</details>
|
|
2030
2025
|
${w(i,()=>h`<button @click=${this.onLoadMorePlanEntries}>Load more entries</button>`,()=>k)}
|
|
2031
2026
|
</div>
|
|
2032
|
-
`}}class
|
|
2027
|
+
`}}class Jl extends Re{constructor(){super(...arguments),this.label="Debt"}}class Zl extends Re{constructor(){super(...arguments),this.label="Handoff"}}class Xl extends Re{constructor(){super(...arguments),this.label="Record"}usesTabs(){return!1}}function ec(n,e,t){switch(e.kind){case"issue":return new Kl(n,e,t);case"adr":return new Wl(n,e,t);case"prd":return new Vl(n,e,t);case"userStory":return new Ql(n,e,t);case"plan":return new Yl(n,e,t);case"debt":return new Jl(n,e,t);case"handoff":return new Zl(n,e,t);default:return new Xl(n,e,t)}}function tc(n,e){const t=new Map,s=new Set,i=r=>{if(s.has(r))return;s.add(r);const a=e.get(r);if(a){a.role==="question"&&!a.tombstone&&t.set(a.id,a);for(const o of a.supersededEntryIds)i(o)}};for(const r of n.supersededEntryIds)i(r);return[...t.values()].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.id.localeCompare(a.id))}function sc(n){return h`${wn(n)}`}function ic(n){const e=z.parse(n,{async:!1});return Tn.sanitize(e)}const ts=class ts extends rs(de){constructor(){super(...arguments),this.store=null,this.entityId=null,this.cascade=!1,this.activeChildId=null,this.collapsedIssueIds=new Set,this.entityDetailTab="overview",this.recordQuery="",this.recordStatus="all",this.issueRecordView="list",this.userStoryRecordView="list",this.visibleGraphKinds=new Set(ze),this.onBackClick=()=>{this.store?.closeEntity()},this.onRetryEntityDetail=e=>{const t=e.currentTarget.dataset.entityId;t&&this.store?.retryEntityDetail(t)},this.onSelectEntityClick=e=>{if(this.cascade){const t=e.currentTarget,s=t.dataset.id;if(!s)return;t.dataset.crossLink==="true"?this.store?.reRootCascade(s):this.entityId&&this.store?.drillCascade(this.entityId,s);return}this.store?.selectEntityFromEvent(e)},this.onToggleIssueBranch=e=>{e.stopPropagation();const t=e.currentTarget.dataset.id;t&&(this.collapsedIssueIds.has(t)?this.collapsedIssueIds.delete(t):this.collapsedIssueIds.add(t),this.requestUpdate())},this.onSetIssueTab=e=>{const t=e.currentTarget.dataset.tab;if(!t)return;this.entityDetailTab=t,this.recordQuery="",this.recordStatus="all";const s=this.entityId??this.store?.selectedId.get();s&&this.store?.requestEntityTab(s,t),this.requestUpdate()},this.onRecordQueryChange=e=>{this.recordQuery=e.detail.query,this.requestUpdate()},this.onContextQueryInput=e=>{this.recordQuery=e.target.value,this.requestUpdate()},this.onRecordStatusChange=e=>{this.recordStatus=e.detail.status,this.requestUpdate()},this.onRecordViewChange=e=>{const{tab:t,view:s}=e.detail;t==="issues"?this.issueRecordView=s:this.userStoryRecordView=s,this.requestUpdate()},this.onRecordOpen=e=>{const{crossLink:t,record:s}=e.detail;if(this.cascade){t?this.store?.reRootCascade(s.id):this.entityId&&this.store?.drillCascade(this.entityId,s.id);return}this.store?.selectEntity(s.id)},this.onNodeOpen=e=>{const t=e.detail.id;t&&this.store?.selectEntity(t)},this.onPlanEntryJump=e=>{const t=e.currentTarget.dataset.planEntryId;t&&this.focusPlanEntry(t,".ai-plan-history .ai-plan-entry")},this.onToggleGraphKind=e=>{const t=e.detail.kind;if(!t)return;const s=new Set(this.visibleGraphKinds);s.has(t)?s.delete(t):s.add(t),this.visibleGraphKinds=s,this.requestUpdate()}}focusPlanEntry(e,t=".ai-plan-entry"){const s=[...this.renderRoot.querySelectorAll(t)].find(r=>r.dataset.planEntryId===e);if(!s)return;const i=s.closest("details");i&&(i.open=!0),s.classList.remove("is-plan-entry-target"),s.offsetWidth,s.classList.add("is-plan-entry-target"),s.focus({preventScroll:!0}),typeof s.scrollIntoView=="function"&&s.scrollIntoView({behavior:"smooth",block:"center"})}focusIssueComment(e){const t=[...this.renderRoot.querySelectorAll(".ai-comment")].find(s=>s.dataset.commentId===e);t&&(t.classList.remove("is-comment-target"),t.offsetWidth,t.classList.add("is-comment-target"),t.focus({preventScroll:!0}),typeof t.scrollIntoView=="function"&&t.scrollIntoView({behavior:"smooth",block:"center"}))}focusNestedTarget(){for(const t of this.renderRoot.querySelectorAll(".is-comment-target, .is-plan-entry-target"))t.classList.remove("is-comment-target","is-plan-entry-target");const e=this.store?.selectedNestedTarget.get();if(e?.type==="plan-entry"){this.focusPlanEntry(e.id);return}e?.type==="issue-comment"&&this.focusIssueComment(e.id)}updated(){this.focusNestedTarget()}renderBodySourceNotice(){return h`
|
|
2033
2028
|
<div class="ai-body-source ai-body-source-generated">
|
|
2034
2029
|
<span class="ai-body-source-badge">Generated fallback</span>
|
|
2035
2030
|
<span class="ai-body-source-copy">Generated from tracker metadata because no authored body was present.</span>
|
|
@@ -2052,7 +2047,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2052
2047
|
.record=${e}
|
|
2053
2048
|
.reference=${s.shortRef(e)}
|
|
2054
2049
|
.statusTone=${s.badgeTone(e.status)}
|
|
2055
|
-
class=${
|
|
2050
|
+
class=${Q({"is-active-ref":e.id===this.activeChildId,line:!0,"record-row":!0})}
|
|
2056
2051
|
data-id=${e.id}
|
|
2057
2052
|
@record-open=${this.onRecordOpen}
|
|
2058
2053
|
></agent-issues-record-list-item>
|
|
@@ -2157,7 +2152,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2157
2152
|
aria-label=${a}
|
|
2158
2153
|
aria-controls=${this.getTabPanelId(r,e)}
|
|
2159
2154
|
aria-selected=${String(s)}
|
|
2160
|
-
class=${
|
|
2155
|
+
class=${Q({active:s,"ai-subtab":!0})}
|
|
2161
2156
|
data-tab=${e}
|
|
2162
2157
|
id=${this.getTabButtonId(r,e)}
|
|
2163
2158
|
@click=${this.onSetIssueTab}
|
|
@@ -2249,7 +2244,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2249
2244
|
</div>
|
|
2250
2245
|
`,()=>h`<div class="ai-empty">Loading record...</div>`)}
|
|
2251
2246
|
</div>
|
|
2252
|
-
`;e.selectedNestedTarget.get()?.type==="plan-entry"&&(this.entityDetailTab="plan");const r=e.bundleForEntityId(t),a=e.activeSection.get()==="adrs",o=a?"ADRs":r?.initiative.title??"Initiatives",l=a?"ADRs":r?.initiative.title??"Workspace",u=e.detailMetaFor(s.id),p=
|
|
2247
|
+
`;e.selectedNestedTarget.get()?.type==="plan-entry"&&(this.entityDetailTab="plan");const r=e.bundleForEntityId(t),a=e.activeSection.get()==="adrs",o=a?"ADRs":r?.initiative.title??"Initiatives",l=a?"ADRs":r?.initiative.title??"Workspace",u=e.detailMetaFor(s.id),p=ec(e,s,this);return h`
|
|
2253
2248
|
<div class="detail-inner">
|
|
2254
2249
|
${w(i?.loading===!0,()=>h`<p class="ai-load-state">Refreshing record...</p>`,()=>k)}
|
|
2255
2250
|
${w(i?.error,()=>h`
|
|
@@ -2289,7 +2284,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2289
2284
|
</div>
|
|
2290
2285
|
${p.renderDetail()}
|
|
2291
2286
|
</div>
|
|
2292
|
-
`}};ts.properties={store:{attribute:!1},entityId:{attribute:!1},cascade:{attribute:!1},activeChildId:{attribute:!1}},ts.styles=[ls,
|
|
2287
|
+
`}};ts.properties={store:{attribute:!1},entityId:{attribute:!1},cascade:{attribute:!1},activeChildId:{attribute:!1}},ts.styles=[ls,xi,ge`
|
|
2293
2288
|
:host {
|
|
2294
2289
|
display: block;
|
|
2295
2290
|
}
|
|
@@ -2949,7 +2944,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
2949
2944
|
align-items: flex-start;
|
|
2950
2945
|
}
|
|
2951
2946
|
}
|
|
2952
|
-
`];let li=ts;customElements.define("agent-issues-detail-view",li);const ic="0123456789ABCDEFGHJKMNPQRSTVWXYZ",rc=6,rn=5,nc="agent-issues-global-search-recents",ac=300*1e3,oc=[{key:"questions",title:"Questions"},{key:"decisions",title:"Decisions"},{key:"includedScope",title:"Included scope"},{key:"excludedScope",title:"Excluded scope"},{key:"constraints",title:"Constraints"},{key:"preferences",title:"Preferences"},{key:"considerations",title:"Considerations"}],lc={project:"PROJ",epic:"EPIC",version:"VER",initiative:"INIT",prd:"PRD",userStory:"US",adr:"ADR",issue:"ISS",debt:"DEBT",handoff:"HO"};function cc(n){if(n.shortReference)return n.shortReference;const e=lc[n.kind]??n.kind.slice(0,4).toUpperCase();let t=2166136261;for(let r=0;r<n.id.length;r+=1)t^=n.id.charCodeAt(r),t=Math.imul(t,16777619);let s=BigInt(t>>>0),i="";for(let r=0;r<rc;r+=1)i=ic[Number(s&31n)]+i,s>>=5n;return`${e}_${i}`}function dc(n){if(!n||typeof n!="object"||!("type"in n))return!1;const e=n;return e.type==="entity"?typeof e.entityId=="string":e.type==="plan-entry"?typeof e.planId=="string"&&typeof e.entryId=="string":e.type==="issue-comment"?typeof e.issueId=="string"&&typeof e.commentId=="string":(e.type==="context"||e.type==="context-term"&&typeof e.term=="string")&&(e.scopeRef===void 0||typeof e.scopeRef=="string")}function nn(n,e){const t=n.nodes.filter(a=>e.has(a.kind)),s=new Set(t.map(a=>a.key)),i=[...new Set(t.map(a=>a.col))].sort((a,o)=>a-o),r=new Map(i.map((a,o)=>[a,o]));return{columns:i.map(a=>n.columns[a]),edges:n.edges.filter(a=>s.has(a.from)&&s.has(a.to)),nodes:t.map(a=>({...a,col:r.get(a.col)}))}}function zt(n){return{...n,body:""}}function uc(n){return[...(n.incoming??[]).map(({entity:e,relationType:t})=>({createdAt:n.entity.createdAt,fromId:e.id,toId:n.entity.id,type:t})),...(n.outgoing??[]).map(({entity:e,relationType:t})=>({createdAt:n.entity.createdAt,fromId:n.entity.id,toId:e.id,type:t}))]}function pc(n){if(n.category==="relation")return new Set(["issues","plans","prds","adrs","context","userStories","debt","graph"]);if(n.category==="context")return new Set(["context"]);if(n.category==="plan-entry")return new Set(["plans"]);if(n.category!=="entity")return new Set;const e={adr:"adrs",debt:"debt",issue:"issues",plan:"plans",prd:"prds",userStory:"userStories"};return new Set([...(n.affectedEntityKinds??[]).flatMap(t=>e[t]?[e[t]]:[]),"graph"])}class hc{constructor(){this.config=_(null),this.snapshot=_(null),this.projectSummary=_(null),this.entityDetails=_(new Map),this.projectAdrsCache=_({data:null,error:null,loading:!1}),this.projectDebtCache=_({data:null,error:null,loading:!1}),this.projectContextCache=_({data:null,error:null,loading:!1}),this.projectGraphCache=_({data:null,error:null,loading:!1}),this.planEntryPages=_(new Map),this.issueCommentPages=_(new Map),this.initiativeDetails=_(new Map),this.initiativeTabs=_(new Map),this.projectDiscovery=_(null),this.search=_(""),this.globalSearchCapability=_(null),this.globalSearchQuery=_(""),this.globalSearchScope=_("current-project"),this.globalSearchSourceTypes=_(["entity","context","context-term","plan-entry","issue-comment"]),this.globalSearchResponse=_(null),this.globalSearchResults=_([]),this.globalSearchRecents=_([]),this.globalSearchProgress=_(!1),this.globalSearchOpen=_(!1),this.contextSearch=_(""),this.contextTab=_("all"),this.selectedContextInitiativeId=_(null),this.visibleProjectGraphKinds=_(new Set(ze)),this.initiativeStatusFilter=_("all"),this.adrStatusFilter=_("all"),this.debtLifecycleFilter=_("open"),this.debtCategoryFilter=_("all"),this.debtPriorityFilter=_("all"),this.kindFilter=_("all"),this.selectedTenant=_(null),this.selectedProjectId=_(null),this.selectedInitiativeId=_(null),this.selectedId=_(null),this.selectedNestedTarget=_(null),this.cascadePath=_([]),this.cascadeAvailableWidth=_(0),this.cascadeWindowStart=_(null),this.reRootTrail=_([]),this.railCollapsed=_(!1),this.masterCollapsedOverride=_(null),this.collapsedEpicIdsByProject=_(new Map),this.syncLabel=_("loading"),this.errorMessage=_(null),this.activeView=_("overview"),this.activePage=_("list"),this.activeRootTab=_("initiatives"),this.activeSection=_("initiatives"),this.initTab=_("overview"),this.globalSearchAbortController=null,this.globalSearchProgressTimer=null,this.globalSearchRequestTimer=null,this.localChangeCorrelations=new Map,this.tenantById=j(()=>new Map((this.config.get()?.availableTenants??[]).map(e=>[e.id,e]))),this.tenantOptions=j(()=>{const e=new Map(this.tenantById.get()),t=this.selectedTenant.get();return t&&!e.has(t)&&e.set(t,{displayName:this.formatTenantDisplayName(t),id:t}),[...e.values()].sort((s,i)=>s.displayName.localeCompare(i.displayName))}),this.selectedTenantDisplayName=j(()=>{const e=this.selectedTenant.get();return e?this.tenantById.get().get(e)?.displayName??this.formatTenantDisplayName(e):null}),this.selectedProjectDisplayName=j(()=>{const e=this.selectedProjectId.get();if(!e)return null;const t=this.projectDiscovery.get();return t?.kind!=="available"?e:t.projects.find(s=>s.project.id===e)?.project.title??e}),this.entityById=j(()=>{const e=this.snapshot.get(),t=e?.initiatives.flatMap(a=>[a.initiative,...a.prds,...a.userStories,...a.adrs,...a.issues])??[],s=[...this.entityDetails.get().values()].flatMap(a=>a.detail?[a.detail]:[]),i=s.map(a=>a.entity),r=s.flatMap(a=>[...(a.incoming??[]).map(({entity:o})=>zt(o)),...(a.outgoing??[]).map(({entity:o})=>zt(o))]);return new Map([...e?.entities??[],...e?.projectAdrs??[],...t,...r,...i].map(a=>[a.id,a]))}),this.globalSearchRecentRecords=j(()=>this.globalSearchRecents.get().flatMap(e=>{const t=this.snapshot.get();if(!t)return[];if(e.type==="entity"){const a=this.entityForId(e.entityId);return a?[{sourceType:"entity",target:e,title:a.title}]:[]}if(e.type==="plan-entry"){const a=t.planEntries?.find(o=>o.id===e.entryId&&o.planId===e.planId&&!o.tombstone);return a&&this.entityForId(e.planId)?[{sourceType:"plan-entry",target:e,title:a.body??"Plan entry"}]:[]}if(e.type==="issue-comment"){const a=t.issueComments[e.issueId]?.comments.find(o=>o.id===e.commentId&&!o.tombstone);return a&&this.entityForId(e.issueId)?[{sourceType:"issue-comment",target:e,title:a.body??"Comment"}]:[]}const s=[t.contexts.shared,...t.contexts.initiatives],i=e.scopeRef?s.find(a=>a.context.key===e.scopeRef||a.context.scopeEntityId===e.scopeRef):t.contexts.shared;if(!i?.context.exists)return[];if(e.type==="context")return[{sourceType:"context",target:e,title:i.context.title}];const r=i.terms.find(a=>a.term===e.term);return r?[{sourceType:"context-term",target:e,title:r.term}]:[]})),this.cascadeColumns=j(()=>this.cascadePath.get().map(e=>this.entityForId(e)).filter(e=>!!e)),this.masterCollapsed=j(()=>{const e=this.masterCollapsedOverride.get();return e!==null?e:!1}),this.cascadeColumnWidth=480,this.cascadeColumnGap=16,this.cascadeColumnWindow=j(()=>{const e=this.cascadeColumns.get(),t=this.cascadeCapacityForWidth(this.cascadeAvailableWidth.get());if(e.length<=t)return{breadcrumb:[],columns:e};const s=e.length-t,i=this.cascadeWindowStart.get(),r=Math.min(Math.max(i??s,0),e.length-1);return{breadcrumb:e.slice(0,r),columns:e.slice(r)}}),this.selectedEntity=j(()=>this.entityForId(this.selectedId.get())),this.selectedBundle=j(()=>this.bundleForEntityId(this.selectedId.get())),this.selectedInitiativeBundle=j(()=>this.bundleForInitiativeId(this.selectedInitiativeId.get())),this.activeInitiativeId=j(()=>this.selectedInitiativeId.get()??this.selectedBundle.get()?.initiative.id??null),this.sharedContext=j(()=>this.projectContextCache.get().data?.shared??this.snapshot.get()?.contexts.shared??null),this.initiativeContextById=j(()=>new Map((this.projectContextCache.get().data?.initiatives??this.snapshot.get()?.contexts.initiatives??[]).filter(e=>!!e.context.scopeEntityId).map(e=>[e.context.scopeEntityId??e.context.key,e]))),this.selectedContext=j(()=>{const e=this.selectedBundle.get();return e?this.initiativeContextById.get().get(e.initiative.id)??null:this.sharedContext.get()}),this.projectContextTerms=j(()=>{const e=this.projectContextCache.get().data?.terms;if(e)return e;const t=new Map;for(const s of[this.sharedContext.get(),...this.projectContextCache.get().data?.initiatives??this.snapshot.get()?.contexts.initiatives??[]])if(s)for(const i of s.terms){const r=i.term.toLowerCase(),a={avoid:[...i.avoid],contextKey:s.context.key,contextTitle:s.context.title,definition:i.definition,scopeEntityId:s.context.scopeEntityId,scopeKind:s.context.scopeKind,scopeLabel:s.context.scopeLabel,updatedAt:i.updatedAt},o=t.get(r);if(!o){t.set(r,{term:i.term,sources:[a],hasSharedSource:s.context.scopeKind==="default",hasDuplicates:!1,hasConflictingDefinitions:!1});continue}o.sources.push(a),o.hasDuplicates=o.sources.length>1,o.hasSharedSource=o.hasSharedSource||s.context.scopeKind==="default",o.hasConflictingDefinitions=an(o.sources),i.term.localeCompare(o.term)<0&&(o.term=i.term)}return[...t.values()].map(s=>({...s,sources:s.sources.sort(fc)})).sort((s,i)=>s.term.localeCompare(i.term))}),this.filteredProjectContextTerms=j(()=>{const e=this.contextSearch.get().trim().toLowerCase();return e?this.projectContextTerms.get().filter(t=>t.term.toLowerCase().includes(e)?!0:t.sources.some(s=>[s.scopeLabel,s.contextTitle,s.definition,...s.avoid].join(" ").toLowerCase().includes(e))):this.projectContextTerms.get()}),this.filteredInitiativeContextTerms=j(()=>{const e=this.selectedContextInitiativeId.get(),t=this.contextSearch.get().trim().toLowerCase();return this.projectContextTerms.get().map(s=>{const i=s.sources.filter(a=>a.scopeKind==="initiative"&&(!e||a.scopeEntityId===e));return i.length===0||!(!t||s.term.toLowerCase().includes(t)||i.some(a=>[a.scopeLabel,a.contextTitle,a.definition,...a.avoid].join(" ").toLowerCase().includes(t)))?null:{...s,sources:i,hasSharedSource:!1,hasDuplicates:i.length>1,hasConflictingDefinitions:an(i)}}).filter(s=>s!==null)}),this.filteredSharedContext=j(()=>{const e=this.sharedContext.get();if(!e)return null;const t=this.contextSearch.get().trim().toLowerCase();if(!t)return e;const s=[e.context.key,e.context.scopeLabel,e.context.summary,e.context.title].join(" ").toLowerCase().includes(t),i=e.terms.filter(r=>[r.term,r.definition,...r.avoid].join(" ").toLowerCase().includes(t));return!s&&i.length===0?null:{context:{...e.context,summary:s?e.context.summary:""},terms:i}}),this.projectContextDuplicateCount=j(()=>this.projectContextTerms.get().filter(e=>e.hasDuplicates).length),this.selectedIncoming=j(()=>this.incomingRelationsFor(this.selectedId.get())),this.selectedOutgoing=j(()=>this.outgoingRelationsFor(this.selectedId.get())),this.relatedEntities=j(()=>{const e=new Set;for(const t of[...this.selectedIncoming.get(),...this.selectedOutgoing.get()])e.add(t.fromId),e.add(t.toId);return e.delete(this.selectedId.get()??""),this.sortEntities([...e].map(t=>this.entityById.get().get(t)).filter(t=>!!t))}),this.localGraphEntities=j(()=>{const e=this.selectedEntity.get();return e?[e,...this.relatedEntities.get()]:[]}),this.localGraphRelations=j(()=>{const e=new Set(this.localGraphEntities.get().map(t=>t.id));return this.scopedRelations().filter(t=>e.has(t.fromId)&&e.has(t.toId))}),this.filteredEntities=j(()=>{const e=this.search.get().trim().toLowerCase(),t=this.kindFilter.get();return this.sortEntities((this.snapshot.get()?.entities??[]).filter(s=>t!=="all"&&s.kind!==t?!1:e?[s.id,s.kind,s.status,s.title].join(" ").toLowerCase().includes(e):!0))}),this.kindOptions=j(()=>["issue","all",...new Set((this.snapshot.get()?.entities??[]).map(e=>e.kind).filter(e=>e!=="issue"))]),this.rootTabCounts=j(()=>({adrs:(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="adr").length,initiatives:this.snapshot.get()?.initiatives.length??0})),this.allDebtRecords=j(()=>this.sortEntities(this.projectDebtCache.get().data?.records??(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="debt"))),this.debtRecords=j(()=>{const e=this.debtLifecycleFilter.get(),t=this.debtCategoryFilter.get(),s=this.debtPriorityFilter.get();return this.sortEntities(this.allDebtRecords.get().filter(i=>(e==="all"||i.status===e)&&(t==="all"||i.category===t)&&(s==="all"||i.priority===s)))}),this.projectInitiatives=j(()=>this.snapshot.get()?.initiatives??this.projectSummaryInitiatives.get().map(e=>({adrs:[],blockerLinks:[],constrainsLinks:[],entities:[zt(e.initiative)],fixLinks:[],initiative:zt(e.initiative),issues:[],prds:[],subIssueLinks:[],userStories:[]}))),this.projectSummaryEpicGroups=j(()=>{const e=this.projectSummary.get();return e?.kind==="available"?e.epics:[]}),this.projectSummaryInitiatives=j(()=>this.projectSummaryEpicGroups.get().flatMap(e=>e.initiatives)),this.epicInitiativeGroups=j(()=>{const e=this.snapshot.get();if(!e)return[];const t=new Map(e.initiatives.map(i=>[i.initiative.id,i])),s=new Map;for(const i of e.relations){if(i.type!=="contains"||!t.has(i.toId))continue;const r=s.get(i.fromId)??[];r.push(i.toId),s.set(i.fromId,r)}return this.sortEntities(e.entities.filter(i=>i.kind==="epic")).map(i=>{const r=(s.get(i.id)??[]).map(a=>t.get(a)).filter(a=>!!a);return{epic:i,initiatives:r,completedInitiativeCount:r.filter(a=>this.isDoneStatus(a.initiative.status)).length}}).filter(i=>i.initiatives.length>0)}),this.projectAdrs=j(()=>this.sortEntities(this.projectAdrsCache.get().data?.projectAdrs??this.snapshot.get()?.projectAdrs??(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="adr"))),this.adrRailEntries=j(()=>{const e=this.snapshot.get(),t=this.projectAdrs.get().map(r=>({adr:r,scope:"project",scopeLabel:"project decision"})),i=(this.projectAdrsCache.get().data?.initiativeAdrs??e?.initiatives??[]).flatMap(r=>this.sortEntities(r.adrs).map(a=>({adr:a,scope:"initiative",scopeLabel:`initiative ${r.initiative.title}`})));return[...t,...i]}),this.projectStoryCount=j(()=>this.projectSummaryInitiatives.get().reduce((e,t)=>e+t.userStoryCount,0)),this.projectIssueCount=j(()=>this.projectSummaryInitiatives.get().reduce((e,t)=>e+t.issueCount,0)),this.projectDescription=j(()=>this.sharedContext.get()?.context.summary??this.selectedTenantDisplayName.get()??""),this.orphanIds=j(()=>new Set((this.snapshot.get()?.orphans??[]).map(e=>e.id))),this.connected=!1,this.events=null,this.pollTimer=null,this.onHashChange=()=>{const e=this.applyRoute(this.readRoute());this.writeRoute(e,!0)},this.onPopState=async()=>{const e=this.readRoute();if(e.tenantId!==this.selectedTenant.get()||e.projectId!==this.selectedProjectId.get()){await this.navigateToRoute(e);return}this.applyRoute(e)},this.onBrowserNavigation=async()=>{await this.navigateToRoute(this.readRoute()),new URLSearchParams(new URL(window.location.href).hash.slice(1)).has("cascade")&&this.writeRoute(this.currentRoute(),!0)},this.setSearchFromEvent=e=>{this.search.set(e.target.value)},this.setKindFilterFromEvent=e=>{this.kindFilter.set(e.target.value)},this.setTenantFromEvent=e=>{const t=e.target.value;this.selectTenant(t)},this.selectEntityFromEvent=e=>{const t=e.currentTarget.dataset.id;t&&this.selectEntity(t)},this.openViewFromEvent=e=>{const t=e.currentTarget.dataset.view;t&&this.activeView.set(t)},this.selectInitiativeFromEvent=e=>{const t=e.currentTarget.dataset.id;t&&this.selectInitiative(t)}}entityForId(e){return e?this.entityById.get().get(e)??null:null}requestEntityTab(e,t){t==="plan"&&this.loadPlanEntryPage(e)}async loadMorePlanEntries(e){const t=this.planEntryPages.get().get(e)?.data?.nextBefore;t&&await this.loadPlanEntryPage(e,!1,t)}async loadMoreIssueComments(e){const t=this.issueCommentPages.get().get(e)?.data?.nextBefore;t&&await this.loadIssueCommentPage(e,!1,t)}openGlobalSearch(){this.globalSearchOpen.set(!0),this.globalSearchRecents.set(this.readGlobalSearchRecents()),this.reloadGlobalSearchCapability()}planEntriesFor(e){return this.planEntryPages.get().get(e)?.data?.entries??(this.snapshot.get()?.planEntries??[]).filter(t=>t.planId===e)}issueCommentsFor(e){return this.issueCommentPages.get().get(e)?.data?.comments??this.snapshot.get()?.issueComments[e]?.comments??[]}displayUser(e,t){const s=this.issueCommentPages.get().get(t)?.data?.users.find(i=>i.id===e)??this.snapshot.get()?.users.find(i=>i.id===e);return s?.displayName??s?.authenticationSubject??e}closeGlobalSearch(){this.globalSearchOpen.set(!1),this.setGlobalSearchQuery("")}setGlobalSearchQuery(e){if(this.globalSearchQuery.set(e),this.globalSearchResponse.set(null),this.globalSearchProgress.set(!1),this.cancelGlobalSearchRequest(),!e.trim()){this.globalSearchResults.set([]);return}this.globalSearchRequestTimer=window.setTimeout(()=>{this.requestGlobalSearch(e)},150)}setGlobalSearchScope(e){this.globalSearchScope.set(e),this.setGlobalSearchQuery(this.globalSearchQuery.get())}setGlobalSearchSourceTypes(e){this.globalSearchSourceTypes.set(e),this.setGlobalSearchQuery(this.globalSearchQuery.get())}async retryGlobalSearch(){const e=this.globalSearchQuery.get();e.trim()&&await this.requestGlobalSearch(e)}async reloadGlobalSearchCapability(){const e=this.selectedTenant.get();if(!e){this.globalSearchCapability.set(null);return}try{const t=await fetch(`/api/search/capability?${new URLSearchParams({tenant:e})}`,{cache:"no-store"});if(!t.ok)throw new Error("Global search capability request failed.");const s=await t.json();this.selectedTenant.get()===e&&this.globalSearchCapability.set(s)}catch{this.globalSearchCapability.set(null)}}async requestGlobalSearch(e){if(e!==this.globalSearchQuery.get())return;const t=this.selectedTenant.get(),s=this.selectedProjectId.get();if(!t||!s)return;const i=new AbortController;this.globalSearchAbortController=i,this.globalSearchProgressTimer=window.setTimeout(()=>{this.globalSearchAbortController===i&&this.globalSearchProgress.set(!0)},150);const r=new URLSearchParams({tenant:t,project:s,query:e,scope:this.globalSearchScope.get()});r.set("sourceTypes",this.globalSearchSourceTypes.get().join(","));try{const a=await fetch(`/api/search?${r}`,{cache:"no-store",signal:i.signal});if(!a.ok)throw new Error("Global search request failed.");const o=await a.json();this.globalSearchAbortController===i&&(this.globalSearchResponse.set(o),o.state==="available"&&this.globalSearchResults.set(o.results))}catch(a){if(a instanceof DOMException&&a.name==="AbortError")return;this.globalSearchAbortController===i&&this.globalSearchResponse.set({state:"operational-error"})}finally{this.globalSearchAbortController===i&&(this.globalSearchAbortController=null,this.clearGlobalSearchProgressTimer(),this.globalSearchProgress.set(!1))}}cancelGlobalSearchRequest(){this.globalSearchRequestTimer!==null&&(window.clearTimeout(this.globalSearchRequestTimer),this.globalSearchRequestTimer=null),this.globalSearchAbortController?.abort(),this.globalSearchAbortController=null,this.clearGlobalSearchProgressTimer()}clearGlobalSearchProgressTimer(){this.globalSearchProgressTimer!==null&&(window.clearTimeout(this.globalSearchProgressTimer),this.globalSearchProgressTimer=null)}cascadeCapacityForWidth(e){return e<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.floor(e/(this.cascadeColumnWidth+this.cascadeColumnGap)))}cascadeHopRelation(e,t){const s=this.snapshot.get()?.relations??[],i=s.find(a=>a.fromId===e&&a.toId===t);return i?i.type:s.find(a=>a.fromId===t&&a.toId===e)?.type??null}cascadePathForLeaf(e){const t=this.snapshot.get()?.relations??[],s=[e],i=new Set([e]);let r=e;for(;;){const p=t.find(d=>d.type==="decomposes"&&d.toId===r);if(!p||i.has(p.fromId))break;s.unshift(p.fromId),i.add(p.fromId),r=p.fromId}const a=s[0],l=this.sortEntities(t.filter(p=>p.type==="fixes"&&p.fromId===a).map(p=>this.entityForId(p.toId)).filter(p=>!!p))[0]?.id??null;return[...this.spineForStory(l,a),...s]}spineForStory(e,t){const s=this.snapshot.get()?.relations??[],i=e?s.find(o=>o.type==="creates"&&o.toId===e)?.fromId??null:null,r=i?s.find(o=>o.type==="owns"&&o.toId===i)?.fromId??null:s.find(o=>o.type==="tracks"&&o.toId===t)?.fromId??null,a=[];return r&&a.push(r),i&&a.push(i),e&&a.push(e),a}cascadeSeamFor(e,t){const s=this.cascadeHopRelation(e,t);if(s!=="fixes")return{relation:s,branch:null};const i=this.snapshot.get()?.relations??[],r=this.sortEntities(i.filter(a=>a.type==="fixes"&&a.fromId===t).map(a=>this.entityForId(a.toId)).filter(a=>!!a));return r.length<=1?{relation:s,branch:null}:{relation:s,branch:{options:r,selectedIndex:r.findIndex(a=>a.id===e)}}}selectCascadeBranch(e,t){const s=this.cascadePath.get(),i=s.indexOf(e);if(i===-1)return;const r=s.slice(i),a=this.spineForStory(t,e);this.cascadeWindowStart.set(null),this.cascadePath.set([...a,...r]),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}bundleForEntityId(e){return e?(this.snapshot.get()?.initiatives??[]).find(t=>[t.initiative,...t.entities,...t.prds,...t.userStories,...t.adrs,...t.issues].some(s=>s.id===e))??null:null}bundleForInitiativeId(e){if(!e)return null;const t=(this.snapshot.get()?.initiatives??[]).find(p=>p.initiative.id===e)??null;if(t)return t;const s=this.projectSummaryInitiatives.get().find(p=>p.initiative.id===e);if(!s)return null;const i=this.initiativeDetailForId(e),r=this.initiativeTabForId(e,this.initTab.get()),a=i?.initiative??{...s.initiative,body:""},o=r?.records??[],l=new Map([a,...o].map(p=>[p.id,p])),u=r?.relations??[];return{adrs:o.filter(p=>p.kind==="adr"),blockerLinks:u.filter(p=>p.type==="blocks").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{source:d,target:g}]:[]}),constrainsLinks:u.filter(p=>p.type==="constrains").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{adr:d,issue:g}]:[]}),entities:[a,...o],fixLinks:u.filter(p=>p.type==="fixes").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{issue:d,userStory:g}]:[]}),initiative:a,issues:o.filter(p=>p.kind==="issue"),prds:o.filter(p=>p.kind==="prd"),relations:u,subIssueLinks:u.filter(p=>p.type==="decomposes").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{parent:d,issue:g}]:[]}),userStories:o.filter(p=>p.kind==="userStory")}}initiativeDetailForId(e){return e?this.initiativeDetails.get().get(e)?.detail??null:null}initiativeTabForId(e,t){return e?this.initiativeTabs.get().get(this.initiativeTabCacheKey(e,t))?.data??null:null}isSummaryInitiative(e){return!this.snapshot.get()?.initiatives.some(t=>t.initiative.id===e)&&this.projectSummaryInitiatives.get().some(t=>t.initiative.id===e)}incomingRelationsFor(e){return e?this.scopedRelations().filter(t=>t.toId===e):[]}outgoingRelationsFor(e){return e?this.scopedRelations().filter(t=>t.fromId===e):[]}scopedRelations(){const e=new Map;for(const t of this.snapshot.get()?.relations??[])e.set(`${t.fromId}:${t.type}:${t.toId}`,t);for(const t of[...this.entityDetails.get().values()].flatMap(s=>s.detail?[s.detail]:[]))for(const s of uc(t))e.set(`${s.fromId}:${s.type}:${s.toId}`,s);return[...e.values()]}connect(){this.connected||(this.connected=!0,window.addEventListener("hashchange",this.onBrowserNavigation),window.addEventListener("popstate",this.onPopState),this.bootstrap())}disconnect(){this.connected&&(this.connected=!1,window.removeEventListener("hashchange",this.onBrowserNavigation),window.removeEventListener("popstate",this.onPopState),this.cancelGlobalSearchRequest(),this.events?.close(),this.events=null,this.pollTimer!==null&&(window.clearInterval(this.pollTimer),this.pollTimer=null))}applyLocalProjectChange(e){this.handleProjectChange(e),this.registerLocalChangeCorrelation(e.correlationId)}async mutateProject(e,t){const s=globalThis.crypto.randomUUID();this.registerLocalChangeCorrelation(s);try{const i=await fetch(this.buildTenantScopedPath("/api/project-mutation"),{body:JSON.stringify({correlationId:s,method:e,params:t}),cache:"no-store",headers:{"content-type":"application/json"},method:"POST"});if(!i.ok)throw new Error(`Project mutation ${e} failed.`);const r=await i.json();return this.applyLocalProjectChange(r.event),r.result}catch(i){throw this.localChangeCorrelations.delete(s),i}}registerLocalChangeCorrelation(e){if(!e)return;const t=Date.now();for(const[s,i]of this.localChangeCorrelations)i<t&&this.localChangeCorrelations.delete(s);this.localChangeCorrelations.set(e,t+ac)}openRootTab(e){this.activeRootTab.set(e)}selectSection(e){this.activeSection.set(e),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.selectedNestedTarget.set(null),this.initTab.set("overview"),this.contextSearch.set(""),this.contextTab.set("all"),this.selectedContextInitiativeId.set(null),this.activePage.set("list"),this.writeRoute(this.currentRoute()),e==="adrs"?this.loadProjectAdrs():e==="debt"?this.loadProjectDebt():e==="context"?this.loadProjectContext():e==="graph"&&this.loadProjectGraph()}setContextTab(e){this.contextTab.set(e)}setContextInitiativeFilter(e){this.selectedContextInitiativeId.set(e)}setMasterStatusFilter(e,t){if(e==="initiatives"){this.initiativeStatusFilter.set(t);return}this.adrStatusFilter.set(t)}setDebtFilter(e,t){if(e==="lifecycle"){this.debtLifecycleFilter.set(t);return}if(e==="category"){this.debtCategoryFilter.set(t);return}this.debtPriorityFilter.set(t)}setInitTab(e){this.initTab.set(e);const t=this.selectedInitiativeId.get();t&&e!=="overview"&&this.projectSummaryInitiatives.get().some(s=>s.initiative.id===t)&&this.loadInitiativeTab(t,e)}async retryInitiativeDetail(e){await this.loadInitiativeDetail(e,!0)}async retryInitiativeTab(e,t){await this.loadInitiativeTab(e,t,!0)}openSearchTarget(e){if(this.recordGlobalSearchRecent(e),e.type==="entity"){this.selectEntity(e.entityId);return}if(e.type==="plan-entry"){this.selectEntity(e.planId,{id:e.entryId,type:e.type});return}if(e.type==="issue-comment"){this.selectEntity(e.issueId,{id:e.commentId,type:e.type});return}(e.type==="context"||e.type==="context-term")&&(this.activeSection.set("context"),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.activePage.set("list"),this.contextTab.set(e.scopeRef?"initiatives":"global"),this.selectedContextInitiativeId.set(e.scopeRef??null),this.selectedNestedTarget.set(e.type==="context"?{id:null,scopeRef:e.scopeRef,type:e.type}:{id:e.term,scopeRef:e.scopeRef,type:e.type}),this.writeRoute(this.currentRoute()))}globalSearchRecentsStorageKey(){const e=this.selectedTenant.get(),t=this.selectedProjectId.get();return e&&t?`${nc}:${e}:${t}`:null}readGlobalSearchRecents(){const e=this.globalSearchRecentsStorageKey();if(!e)return[];try{const t=window.localStorage.getItem(e);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(dc).slice(0,rn):[]}catch{return[]}}recordGlobalSearchRecent(e){const t=this.globalSearchRecentsStorageKey();if(!t)return;const s=this.readGlobalSearchRecents(),i=JSON.stringify(e),r=[e,...s.filter(a=>JSON.stringify(a)!==i)].slice(0,rn);window.localStorage.setItem(t,JSON.stringify(r)),this.globalSearchRecents.set(r)}selectEntity(e,t=null){if(this.entityForId(e)?.kind==="initiative"){this.selectInitiative(e);return}this.cascadePath.set([]),this.selectedInitiativeId.set(null),this.selectedId.set(e),this.selectedNestedTarget.set(t),this.activePage.set("entity"),this.writeRoute(this.currentRoute()),this.loadEntityDetail(e),this.entityForId(e)?.kind==="issue"&&this.loadIssueCommentPage(e)}selectProjectGraphEntity(e,t){this.activeSection.set(t==="adr"?"adrs":"initiatives"),this.selectEntity(e)}openCascade(e){this.cascadeWindowStart.set(null),this.cascadePath.set([e]),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}toggleRail(){this.railCollapsed.set(!this.railCollapsed.get())}toggleMaster(){this.masterCollapsedOverride.set(!this.masterCollapsed.get())}isEpicExpanded(e){const t=this.selectedProjectId.get();return!t||!this.collapsedEpicIdsByProject.get().get(t)?.has(e)}toggleEpicExpanded(e){const t=this.selectedProjectId.get();if(!t)return;const s=new Map(this.collapsedEpicIdsByProject.get()),i=new Set(s.get(t));i.has(e)?i.delete(e):i.add(e),s.set(t,i),this.collapsedEpicIdsByProject.set(s)}clearMasterOverrideIfShallow(){this.cascadePath.get().length<2&&this.masterCollapsedOverride.set(null)}reRootCascade(e){const t=this.cascadePath.get();t.length>0&&this.reRootTrail.set([...this.reRootTrail.get(),t]),this.cascadeWindowStart.set(null),this.cascadePath.set(this.cascadePathForLeaf(e)),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}restoreReRoot(e){const t=this.reRootTrail.get(),s=t[e];s&&(this.reRootTrail.set(t.slice(0,e)),this.cascadeWindowStart.set(null),this.cascadePath.set(s),this.clearMasterOverrideIfShallow(),this.writeCascadeHash())}popReRoot(){const e=this.reRootTrail.get();e.length!==0&&this.restoreReRoot(e.length-1)}drillCascade(e,t){const s=this.cascadePath.get().indexOf(e);s!==-1&&(this.cascadeWindowStart.set(null),this.cascadePath.set([...this.cascadePath.get().slice(0,s+1),t]),this.writeCascadeHash())}restoreAncestor(e){const t=this.cascadePath.get().indexOf(e);t!==-1&&this.cascadeWindowStart.set(t)}truncateCascadeTo(e){const t=this.cascadePath.get(),s=t.indexOf(e);s===-1||s===t.length-1||(this.cascadeWindowStart.set(null),this.cascadePath.set(t.slice(0,s+1)),this.clearMasterOverrideIfShallow(),this.writeCascadeHash())}writeCascadeHash(){this.writeRoute(this.currentRoute())}selectInitiative(e){this.selectedId.set(null),this.selectedInitiativeId.set(e),this.selectedNestedTarget.set(null),this.activePage.set("initiative"),this.activeSection.set("initiatives"),this.activeView.set("overview"),this.initTab.set("overview"),this.cascadePath.set([]),this.clearMasterOverrideIfShallow(),this.writeRoute(this.currentRoute()),this.isSummaryInitiative(e)&&this.loadInitiativeDetail(e)}clearSelection(){this.cascadePath.set([]),this.clearMasterOverrideIfShallow(),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.selectedNestedTarget.set(null),this.activePage.set("list"),this.activeView.set("overview"),this.writeRoute(this.currentRoute())}async selectTenant(e){!e||e===this.selectedTenant.get()||(this.selectedTenant.set(e),this.selectedProjectId.set(null),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery())}async returnToProjectChooser(){!this.selectedTenant.get()||!this.selectedProjectId.get()||(this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery())}async selectProject(e){if(!(!this.selectedTenant.get()||!e||e===this.selectedProjectId.get())){this.selectedProjectId.set(e),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("connecting");try{await this.reloadProjectSummary(),this.connectEvents()}catch(s){this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.writeRoute(this.currentRoute(),!0),this.errorMessage.set(s instanceof Error?s.message:String(s)),this.syncLabel.set("project unavailable")}}}initiativeStats(e){const t=this.projectSummaryInitiatives.get().find(a=>a.initiative.id===e.initiative.id);if(t){const a=t.issueCount>0?Math.round(t.completedIssueCount/t.issueCount*100):0;return{adrs:e.adrs.length,done:t.completedIssueCount,issues:t.issueCount,pct:a,stories:t.userStoryCount}}const s=e.issues.length,i=e.issues.filter(a=>this.isDoneStatus(a.status)).length,r=s>0?Math.round(i/s*100):0;return{adrs:e.adrs.length,done:i,issues:s,pct:r,stories:e.userStories.length}}issuesForStory(e,t){const s=new Set(e.fixLinks.filter(i=>i.userStory.id===t).map(i=>i.issue.id));return this.sortEntities(e.issues.filter(i=>s.has(i.id)))}subIssuesForIssue(e,t){return this.sortEntities(e.subIssueLinks.filter(s=>s.parent.id===t).map(s=>s.issue))}parentIssueForIssue(e,t){return e.subIssueLinks.find(s=>s.issue.id===t)?.parent??null}issueTreeForStory(e,t){const s=new Map(e.subIssueLinks.map(l=>[l.issue.id,l.parent.id])),i=new Map;for(const l of e.subIssueLinks){const u=i.get(l.parent.id)??[];u.push(l.issue.id),i.set(l.parent.id,u)}const r=new Set,a=this.issuesForStory(e,t);for(const l of a){const u=[l.id];for(;u.length>0;){const d=u.shift();if(!(!d||r.has(d))){r.add(d);for(const g of i.get(d)??[])u.push(g)}}let p=l.id;for(;p;){if(r.has(p)){p=s.get(p)??null;continue}r.add(p),p=s.get(p)??null}}const o=[...r].filter(l=>{const u=s.get(l);return!u||!r.has(u)});return this.buildIssueTree(e,o,r)}issueTreeForDirectIssues(e){const t=new Set(e.userStories.flatMap(a=>this.issueTreeForStory(e,a.id).flatMap(o=>this.issueTreeNodeIds(o)))),s=new Set(e.issues.map(a=>a.id).filter(a=>!t.has(a))),i=new Map(e.subIssueLinks.map(a=>[a.issue.id,a.parent.id])),r=[...s].filter(a=>{const o=i.get(a);return!o||!s.has(o)});return this.buildIssueTree(e,r,s)}subIssueTreeForIssue(e,t){const s=new Set,i=this.subIssuesForIssue(e,t).map(r=>r.id);for(;i.length>0;){const r=i.shift();if(!(!r||s.has(r))){s.add(r);for(const a of this.subIssuesForIssue(e,r))i.push(a.id)}}return this.buildIssueTree(e,this.subIssuesForIssue(e,t).map(r=>r.id),s)}buildInitiativeGraph(e,t){const s=e.initiative,i=this.snapshot.get(),r=e.relations??i?.relations??[],a=e.relations?e.entities:i?.entities??[],o=[],l=[];new Map(e.issues.map(m=>[m.id,m]));const u=new Map,p=new Set(e.subIssueLinks.map(m=>m.issue.id)),d=new Map,g=this.sortEntities(e.entities.filter(m=>m.kind==="plan"));o.push({col:0,fullLabel:s.title,id:s.id,key:s.id,kind:"initiative",label:s.title});for(const m of g)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"plan",label:m.title,status:m.status}),l.push({from:s.id,to:m.id});for(const m of e.prds)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"prd",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.adrs)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"adr",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.userStories)o.push({col:2,fullLabel:m.title,id:m.id,key:m.id,kind:"story",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.subIssueLinks){const M=u.get(m.parent.id)??[];M.push(m.issue),u.set(m.parent.id,M)}for(const[m,M]of u)u.set(m,this.sortEntities(M));for(const m of e.fixLinks){const M=d.get(m.issue.id)??[];M.push(m.userStory.id),d.set(m.issue.id,M)}const v=this.sortEntities(e.issues.filter(m=>!p.has(m.id)));let y=0;const L=new Set,O=(m,M)=>{if(L.has(m.id)){y=Math.max(y,M);return}L.add(m.id),y=Math.max(y,M),o.push({col:3+M,fullLabel:m.title,id:m.id,key:m.id,kind:"issue",label:m.title,status:m.status});const ge=d.get(m.id)??[];if(ge.length>0)for(const we of ge)l.push({from:we,to:m.id});else M===0&&l.push({from:s.id,to:m.id});for(const we of u.get(m.id)??[])O(we,M+1),l.push({from:m.id,to:we.id})};for(const m of v)O(m,0);for(const m of this.sortEntities(e.issues))L.has(m.id)||O(m,0);const I=["Issues"];for(let m=1;m<=y;m+=1)I.push(m===1?"Sub-issues":"Nested sub-issues");const x=3+I.length,R=this.sortEntities(a.filter(m=>m.kind==="debt"&&r.some(M=>M.fromId===s.id&&M.toId===m.id&&M.type==="records")));for(const m of R)o.push({col:x,fullLabel:m.title,id:m.id,key:m.id,kind:"debt",label:m.title,status:m.status}),l.push({from:s.id,label:"records",to:m.id});const A=new Set(o.map(m=>m.id)),C=new Set(R.map(m=>m.id)),T=new Set(g.map(m=>m.id));for(const m of r)m.type==="informs"&&T.has(m.fromId)&&A.has(m.toId)&&l.push({from:m.fromId,label:"informs",to:m.toId}),m.type==="resolves"&&A.has(m.fromId)&&C.has(m.toId)&&l.push({from:m.fromId,label:"resolves",to:m.toId}),m.type==="relatesTo"&&C.has(m.fromId)&&A.has(m.toId)&&l.push({from:m.fromId,label:"relatesTo",to:m.toId});const z={columns:["Initiative","Plans, PRDs & ADRs","User stories",...I,"Debt records"],edges:l,nodes:o};return t?nn(z,t):z}buildProjectGraph(){const e=this.projectGraphCache.get().data;if(e)return this.buildScopedProjectGraph(e);const t=this.snapshot.get(),s=this.epicInitiativeGroups.get(),i="__project",r=new Map,a=this.selectedProjectId.get(),o=[{col:0,fullLabel:this.projectDescription.get(),id:"",key:i,kind:"project",label:this.selectedTenantDisplayName.get()??""}],l=[];a&&r.set(a,i);for(const d of t?.projectAdrs??[])o.push({col:1,fullLabel:d.title,id:d.id,key:d.id,kind:"adr",label:d.title,status:d.status}),r.set(d.id,d.id),l.push({from:i,to:d.id});for(const d of s){const{epic:g}=d;o.push({col:1,fullLabel:g.title,id:g.id,key:g.id,kind:"epic",label:g.title,status:g.status}),r.set(g.id,g.id),l.push({from:i,to:g.id});for(const v of d.initiatives){const y=v.initiative,L=new Map,O=new Map;o.push({col:2,fullLabel:`${y.title} — ${v.userStories.length} stories, ${v.issues.length} issues`,id:y.id,key:y.id,kind:"initiative",label:y.title,status:y.status}),r.set(y.id,y.id),l.push({from:g.id,to:y.id});const I=[...this.sortEntities(v.entities.filter(x=>x.kind==="plan")).map(x=>({entity:x,kind:"plan"})),...v.prds.map(x=>({entity:x,kind:"prd"})),...v.adrs.map(x=>({entity:x,kind:"adr"}))];for(const{entity:x,kind:R}of I){const A=`${y.id}:${x.id}`;o.push({col:3,fullLabel:x.title,id:x.id,key:A,kind:R,label:x.title,status:x.status}),r.set(x.id,A),l.push({from:y.id,to:A})}for(const x of this.sortEntities(v.userStories)){const R=`${y.id}:${x.id}`;L.set(x.id,R),r.set(x.id,R),o.push({col:4,fullLabel:x.title,id:x.id,key:R,kind:"story",label:x.title,status:x.status}),l.push({from:y.id,to:R})}for(const x of v.fixLinks){const R=O.get(x.issue.id)??[];R.push(x.userStory.id),O.set(x.issue.id,R)}for(const x of this.sortEntities(v.issues)){const R=`${y.id}:${x.id}`;r.set(x.id,R),o.push({col:5,fullLabel:x.title,id:x.id,key:R,kind:"issue",label:x.title,status:x.status});const A=(O.get(x.id)??[]).map(C=>L.get(C)).filter(C=>!!C);if(A.length>0)for(const C of A)l.push({from:C,to:R});else l.push({from:y.id,to:R})}}}const u=new Map,p=this.sortEntities((t?.entities??[]).filter(d=>d.kind==="debt"));for(const d of p){const g=(t?.relations??[]).find(y=>y.fromId!==d.id&&y.toId===d.id&&y.type==="records"),v=g?r.get(g.fromId):void 0;v&&(u.set(d.id,d.id),o.push({col:6,fullLabel:d.title,id:d.id,key:d.id,kind:"debt",label:d.title,status:d.status}),l.push({from:v,label:"records",to:d.id}))}for(const d of t?.relations??[]){if(d.type==="informs"){const g=r.get(d.fromId),v=r.get(d.toId);g&&v&&l.push({from:g,label:"informs",to:v})}if(d.type==="resolves"){const g=r.get(d.fromId),v=u.get(d.toId);g&&v&&l.push({from:g,label:"resolves",to:v})}if(d.type==="relatesTo"){const g=u.get(d.fromId),v=r.get(d.toId)??u.get(d.toId);g&&v&&l.push({from:g,label:"relatesTo",to:v})}}return nn({columns:["Project","Epics","Initiatives","Plans, PRDs & ADRs","User stories","Issues","Debt records"],edges:l,nodes:o},this.visibleProjectGraphKinds.get())}buildScopedProjectGraph(e){const t=this.sortEntities(e.records),s=[...new Set(t.map(l=>l.kind==="userStory"?"story":l.kind).filter(l=>ze.includes(l)))],i=new Map(s.map((l,u)=>[l,u])),r=new Set(t.map(l=>l.id)),a=t.flatMap(l=>{const u=l.kind==="userStory"?"story":l.kind,p=i.get(u);return p===void 0?[]:[{col:p,fullLabel:l.title,id:l.id,key:l.id,kind:u,label:l.title,status:l.status}]}),o=e.relations.filter(l=>r.has(l.fromId)&&r.has(l.toId)).map(l=>({from:l.fromId,label:l.type,to:l.toId}));return{columns:s.map(l=>l==="story"?"User stories":`${l.slice(0,1).toUpperCase()}${l.slice(1)}s`),edges:o,nodes:a}}toggleProjectGraphKind(e){const t=new Set(this.visibleProjectGraphKinds.get());t.has(e)?t.delete(e):t.add(e),this.visibleProjectGraphKinds.set(t)}isDoneStatus(e){return e==="done"||e==="complete"||e==="closed"}sortIssuesByExpectedCompletion(e,t){const s=new Map(e.map(g=>[g.id,g])),i=new Map(e.map((g,v)=>[g.id,v])),r=new Map(e.map(g=>[g.id,0])),a=new Map(e.map(g=>[g.id,[]])),o=new Set,l=(g,v)=>+!this.isDoneStatus(g.status)-+!this.isDoneStatus(v.status)||i.get(g.id)-i.get(v.id);for(const g of t.blockerLinks){if(!s.has(g.source.id)||!s.has(g.target.id)||!this.isDoneStatus(g.source.status)&&this.isDoneStatus(g.target.status))continue;const v=`${g.source.id}:${g.target.id}`;o.has(v)||(o.add(v),r.set(g.target.id,r.get(g.target.id)+1),a.get(g.source.id).push(g.target.id))}const u=e.filter(g=>r.get(g.id)===0),p=[],d=new Set;for(;u.length>0;){u.sort(l);const g=u.shift();if(!d.has(g.id)){d.add(g.id),p.push(g);for(const v of a.get(g.id)??[]){const y=r.get(v)-1;r.set(v,y),y===0&&u.push(s.get(v))}}}return[...p,...e.filter(g=>!d.has(g.id)).sort(l)]}issueStatusTone(e){return this.isDoneStatus(e)?"done":e==="blocked"||e==="paused"?"blocked":"open"}formatKindLabel(e){return e==="all"?"All work items":e==="userStory"?"User story":e==="prd"?"PRD":e==="adr"?"ADR":e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Unknown"}statusTone(e){return e==="blocked"||e==="paused"?"warn":e==="cancelled"?"danger":e==="archived"||e==="done"||e==="complete"||e==="closed"?"neutral":"success"}badgeTone(e){return e==="done"||e==="complete"||e==="closed"?"done":e==="blocked"||e==="cancelled"?"danger":e==="ready"||e==="in-progress"?"info":e==="paused"?"warn":e==="active"||e==="current"||e==="approved"?"success":"neutral"}compactPath(e){const t=e.split("/").filter(Boolean);return t.length<=3?e:`.../${t.slice(-3).join("/")}`}formatTimestamp(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}truncate(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-3)).trimEnd()}...`}shortRef(e){return cc(e)}buildOpenedText(e){const t=this.selectedBundle.get(),s=t?`inside ${t.initiative.id}`:"outside a visible initiative bundle";return`Opened ${this.formatTimestamp(e.createdAt)} and currently ${s}. Last updated ${this.formatTimestamp(e.updatedAt)}.`}buildSummaryBody(e){const t=this.selectedBundle.get(),s=this.selectedContext.get(),i=this.selectedIncoming.get(),r=this.selectedOutgoing.get(),a=this.orphanIds.get(),o=t?`It currently sits in ${t.initiative.id}, which includes ${t.prds.length} PRDs, ${t.userStories.length} stories, ${t.adrs.length} ADRs, and ${t.issues.length} issues.`:"It is not currently connected to a visible initiative bundle in this snapshot.",l=a.has(e.id)?"This record is marked as orphaned from the initiative structure.":"This record remains connected to the main initiative structure.",u=s?`${s.context.title} is currently ${s.context.exists?"stored":"using its default shell"} with ${s.terms.length} defined terms.`:"No context is currently available for this record.";return`${e.id} is a ${this.formatKindLabel(e.kind).toLowerCase()} with ${i.length} incoming links and ${r.length} outgoing links. ${o} ${u} ${l}`}buildRelationSentence(e){return`${e.fromId} ${e.type} ${e.toId}`}relationLabel(e,t){const s={blocks:"Blocked by",constrains:"Constrained by",decomposes:"Parent issue",creates:"Created by",fixes:"Fixed by",handsOff:"Incoming handoffs",owns:"Owned by",records:"Recorded by",resolves:"Resolved by",tracks:"Tracked by"},i={blocks:"Blocks",constrains:"Constrains",decomposes:"Sub-issues",creates:"Creates",fixes:"Fixes",relatesTo:"Related records",resolves:"Resolves debt",owns:"Owns",records:"Records",tracks:"Tracks"};return t?s[e]??`${e} (incoming)`:i[e]??e}detailMeta(e){return this.detailMetaFor(e.id)}detailMetaFor(e){const t=e?this.entityById.get().get(e)??null:null,s=this.bundleForEntityId(e),i=t?this.incomingRelationsFor(t.id).find(u=>u.type==="records")?.fromId:null,r=i?this.entityById.get().get(i)??null:null,a=t?.kind==="debt"?[["Category",t.category??"—"],["Priority",t.priority??"—"],["Lifecycle",t.status],["Owner",r?`${this.shortRef(r)} ${r.title}`:"—"]]:[],o=t?.kind==="debt"?[]:[["Status",t?.status??"—"]],l=t?.type?[["Type",t.type]]:[];return[["Initiative",s?`${this.shortRef(s.initiative)} ${s.initiative.title}`:"—"],...a,...o,...l,["Created",t?this.formatTimestamp(t.createdAt):"—"],["Updated",t?this.formatTimestamp(t.updatedAt):"—"]]}linkedRecordSections(e){return this.linkedRecordSectionsFor(this.selectedId.get(),e)}linkedRecordSectionsFor(e,t){const s=new Set(["owns","creates","fixes","decomposes","tracks","constrains"]),i=new Map,r=new Set(t?.excludeRelationTypes??[]),a=new Set(t?.excludeRelatedIds??[]),o=(l,u,p)=>{if(a.has(l))return;const d=this.entityById.get().get(l);if(!d)return;const g=i.get(u)??{crossLink:!s.has(p),records:[]};g.records.push(d),i.set(u,g)};for(const l of this.outgoingRelationsFor(e))r.has(l.type)||o(l.toId,this.relationLabel(l.type,!1),l.type);for(const l of this.incomingRelationsFor(e))r.has(l.type)||o(l.fromId,this.relationLabel(l.type,!0),l.type);return[...i.entries()].map(([l,u])=>({crossLink:u.crossLink,key:l,records:this.sortEntities(u.records),title:l}))}debtRecordSectionsFor(e){const t=e?this.entityById.get().get(e)??null:null;if(!t||!["project","epic","initiative","issue"].includes(t.kind))return[];const s=this.outgoingRelationsFor(t.id).filter(r=>r.type==="records").map(r=>this.entityById.get().get(r.toId)).filter(r=>r?.kind==="debt"),i=["epic","initiative","issue"].includes(t.kind)?this.outgoingRelationsFor(t.id).filter(r=>r.type==="resolves").map(r=>this.entityById.get().get(r.toId)).filter(r=>r?.kind==="debt"):[];return[...s.length>0?[{key:"owned-debt",records:this.sortEntities(s),title:"Owned debt"}]:[],...i.length>0?[{key:"resolved-debt",records:this.sortEntities(i),title:"Resolves debt"}]:[]]}planProjectionFor(e){const t=[...this.planEntriesFor(e)].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.reference.localeCompare(a.reference)),s=new Set(t.flatMap(r=>r.supersededEntryIds)),i=t.filter(r=>!r.tombstone&&!s.has(r.id));return{current:oc.map(r=>({key:r.key,title:r.title,entries:i.filter(a=>gc(a,r.key))})),history:t}}closeEntity(){const e=this.selectedBundle.get();if(this.selectedId.set(null),this.selectedNestedTarget.set(null),this.activeSection.get()!=="adrs"&&e){this.selectedInitiativeId.set(e.initiative.id),this.activePage.set("initiative"),this.writeRoute(this.currentRoute());return}this.activePage.set("list"),this.writeRoute(this.currentRoute())}getContextForInitiative(e){return this.initiativeTabForId(e,"context")?.context??this.initiativeContextById.get().get(e)??null}async bootstrap(){try{const e=await this.fetchJson("site-config.json");this.config.set(e);const t=this.readRoute(),s={...t,tenantId:t.tenantId??e.currentTenant};this.selectedTenant.set(s.tenantId),await this.reloadProjectDiscovery(),await this.navigateToRoute(s),this.writeRoute(this.currentRoute(),!0)}catch(e){this.errorMessage.set(e instanceof Error?e.message:String(e)),this.syncLabel.set("load failed")}}async reloadProjectSummary(){const e=this.selectedTenant.get(),t=this.selectedProjectId.get(),s=await this.fetchJson(this.buildTenantScopedPath("/api/project-summary"));if(!(this.selectedTenant.get()!==e||this.selectedProjectId.get()!==t)){if(s.kind==="unavailable")throw new Error("Selected project is unavailable.");this.projectSummary.set(s),this.snapshot.set(null),this.errorMessage.set(null),this.syncLabel.set("listening")}}refreshProjectSummaryInBackground(){this.reloadProjectSummary().catch(e=>{this.errorMessage.set(e instanceof Error?e.message:String(e)),this.syncLabel.set("refresh failed")})}async loadInitiativeDetail(e,t=!1){const s=this.initiativeDetails.get().get(e);if(s?.loading||!t&&s?.detail&&!s.stale)return;const i=this.selectedTenant.get(),r=this.selectedProjectId.get();this.setInitiativeDetailCache(e,{detail:s?.detail??null,error:null,loading:!0,stale:s?.stale});try{const a=await this.fetchJson(this.buildTenantScopedPath(`/api/initiative-detail?initiative=${encodeURIComponent(e)}`));if(this.selectedTenant.get()!==i||this.selectedProjectId.get()!==r)return;if(!("initiative"in a)){this.selectedInitiativeId.get()===e&&this.clearSelection();return}this.setInitiativeDetailCache(e,{detail:a,error:null,loading:!1})}catch(a){if(this.selectedTenant.get()===i&&this.selectedProjectId.get()===r){const o=this.initiativeDetails.get().get(e);this.setInitiativeDetailCache(e,{detail:o?.detail??s?.detail??null,error:a instanceof Error?a.message:String(a),loading:!1,stale:o?.stale??s?.stale})}}}async retryProjectAdrs(){await this.loadProjectAdrs(!0)}async loadProjectAdrs(e=!1){const t=this.projectAdrsCache.get();if(t.loading||!e&&t.data&&!t.stale)return;const s=this.selectedTenant.get(),i=this.selectedProjectId.get();this.projectAdrsCache.set({data:t.data,error:null,loading:!0,stale:t.stale});try{const r=await this.fetchJson(this.buildTenantScopedPath("/api/project-adrs"));this.selectedTenant.get()===s&&this.selectedProjectId.get()===i&&this.projectAdrsCache.set({data:r,error:null,loading:!1})}catch(r){if(this.selectedTenant.get()===s&&this.selectedProjectId.get()===i){const a=this.projectAdrsCache.get();this.projectAdrsCache.set({data:a.data,error:r instanceof Error?r.message:String(r),loading:!1,stale:a.stale??t.stale})}}}async retryProjectDebt(){await this.loadProjectDebt(!0)}async loadProjectDebt(e=!1){await this.loadProjectRecordData("/api/project-debt",this.projectDebtCache,e)}async retryProjectContext(){await this.loadProjectContext(!0)}async loadProjectContext(e=!1){const t=this.projectContextCache.get();if(t.loading||!e&&t.data&&!t.stale)return;const s=this.selectedTenant.get(),i=this.selectedProjectId.get();this.projectContextCache.set({data:t.data,error:null,loading:!0,stale:t.stale});try{const r=await this.fetchJson(this.buildTenantScopedPath("/api/project-context"));this.selectedTenant.get()===s&&this.selectedProjectId.get()===i&&this.projectContextCache.set({data:r,error:null,loading:!1})}catch(r){if(this.selectedTenant.get()===s&&this.selectedProjectId.get()===i){const a=this.projectContextCache.get();this.projectContextCache.set({data:a.data,error:r instanceof Error?r.message:String(r),loading:!1,stale:a.stale??t.stale})}}}async retryProjectGraph(){await this.loadProjectGraph(!0)}async loadProjectGraph(e=!1){await this.loadProjectRecordData("/api/project-graph",this.projectGraphCache,e)}async loadProjectRecordData(e,t,s){const i=t.get();if(i.loading||!s&&i.data&&!i.stale)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();t.set({data:i.data,error:null,loading:!0,stale:i.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(e));this.selectedTenant.get()===r&&this.selectedProjectId.get()===a&&t.set({data:o,error:null,loading:!1})}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=t.get();t.set({data:l.data,error:o instanceof Error?o.message:String(o),loading:!1,stale:l.stale??i.stale})}}}async loadPlanEntryPage(e,t=!1,s){const i=this.planEntryPages.get().get(e);if(i?.loading||!t&&i?.data&&!i.stale&&!s)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();this.setPlanEntryPageCache(e,{data:i?.data??null,error:null,loading:!0,stale:i?.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(`/api/plan-entries?plan=${encodeURIComponent(e)}${s?`&before=${encodeURIComponent(s)}`:""}`));if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=s?[...new Map([...i?.data?.entries??[],...o.entries].map(u=>[u.id,u])).values()]:o.entries;this.setPlanEntryPageCache(e,{data:{...o,entries:l},error:null,loading:!1})}}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=this.planEntryPages.get().get(e);this.setPlanEntryPageCache(e,{data:l?.data??i?.data??null,error:o instanceof Error?o.message:String(o),loading:!1,stale:l?.stale??i?.stale})}}}setPlanEntryPageCache(e,t){const s=new Map(this.planEntryPages.get());s.set(e,t),this.planEntryPages.set(s)}async loadIssueCommentPage(e,t=!1,s){const i=this.issueCommentPages.get().get(e);if(i?.loading||!t&&i?.data&&!i.stale&&!s)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();this.setIssueCommentPageCache(e,{data:i?.data??null,error:null,loading:!0,stale:i?.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(`/api/issue-comments?issue=${encodeURIComponent(e)}${s?`&before=${encodeURIComponent(s)}`:""}`));if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=s?[...new Map([...i?.data?.comments??[],...o.comments].map(p=>[p.id,p])).values()]:o.comments,u=s?[...new Map([...i?.data?.users??[],...o.users].map(p=>[p.id,p])).values()]:o.users;this.setIssueCommentPageCache(e,{data:{...o,comments:l,users:u},error:null,loading:!1})}}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=this.issueCommentPages.get().get(e);this.setIssueCommentPageCache(e,{data:l?.data??i?.data??null,error:o instanceof Error?o.message:String(o),loading:!1,stale:l?.stale??i?.stale})}}}setIssueCommentPageCache(e,t){const s=new Map(this.issueCommentPages.get());s.set(e,t),this.issueCommentPages.set(s)}entityDetailForId(e){return e?this.entityDetails.get().get(e)?.detail??null:null}async retryEntityDetail(e){await this.loadEntityDetail(e,!0)}async loadEntityDetail(e,t=!1){const s=this.entityDetails.get().get(e);if(s?.loading||!t&&s?.detail&&!s.stale)return;const i=this.selectedTenant.get(),r=this.selectedProjectId.get();this.setEntityDetailCache(e,{detail:s?.detail??null,error:null,loading:!0,stale:s?.stale});try{const a=await this.fetchJson(this.buildTenantScopedPath(`/api/entity-detail?entity=${encodeURIComponent(e)}`));if(this.selectedTenant.get()!==i||this.selectedProjectId.get()!==r)return;if(!("entity"in a)){this.selectedId.get()===e&&this.clearSelection();return}this.setEntityDetailCache(e,{detail:a,error:null,loading:!1}),a.entity.kind==="issue"&&this.loadIssueCommentPage(e)}catch(a){if(this.selectedTenant.get()===i&&this.selectedProjectId.get()===r){const o=this.entityDetails.get().get(e);this.setEntityDetailCache(e,{detail:o?.detail??s?.detail??null,error:a instanceof Error?a.message:String(a),loading:!1,stale:o?.stale??s?.stale})}}}setEntityDetailCache(e,t){const s=new Map(this.entityDetails.get());s.set(e,t),this.entityDetails.set(s)}setInitiativeDetailCache(e,t){const s=new Map(this.initiativeDetails.get());s.set(e,t),this.initiativeDetails.set(s)}async loadInitiativeTab(e,t,s=!1){const i=this.initiativeTabCacheKey(e,t),r=this.initiativeTabs.get().get(i);if(r?.loading||!s&&r?.data&&!r.stale)return;const a=this.selectedTenant.get(),o=this.selectedProjectId.get();this.setInitiativeTabCache(i,{data:r?.data??null,error:null,loading:!0,stale:r?.stale});try{const l=await this.fetchJson(this.buildTenantScopedPath(`/api/initiative-tab?initiative=${encodeURIComponent(e)}&tab=${t}`));if(this.selectedTenant.get()!==a||this.selectedProjectId.get()!==o)return;this.setInitiativeTabCache(i,{data:l,error:null,loading:!1})}catch(l){if(this.selectedTenant.get()===a&&this.selectedProjectId.get()===o){const u=this.initiativeTabs.get().get(i);this.setInitiativeTabCache(i,{data:u?.data??r?.data??null,error:l instanceof Error?l.message:String(l),loading:!1,stale:u?.stale??r?.stale})}}}initiativeTabCacheKey(e,t){return`${e}:${t}`}setInitiativeTabCache(e,t){const s=new Map(this.initiativeTabs.get());s.set(e,t),this.initiativeTabs.set(s)}async reloadProjectDiscovery(){try{this.projectDiscovery.set(await this.fetchJson(this.buildTenantScopedPath("/api/projects"))),this.errorMessage.set(null)}catch(e){this.projectDiscovery.set({kind:"unavailable"}),this.errorMessage.set(e instanceof Error?e.message:String(e))}}async navigateToRoute(e){const t=e.tenantId!==this.selectedTenant.get()||e.projectId!==this.selectedProjectId.get();if(this.selectedTenant.set(e.tenantId),this.selectedProjectId.set(e.projectId),t&&this.resetScopeDetail(),!e.projectId){this.snapshot.set(null),this.projectSummary.set(null),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery(),this.applyRoute(e);return}this.stopLiveUpdates(),this.syncLabel.set("connecting");try{await this.reloadProjectSummary(),this.connectEvents(),this.applyRoute(e)}catch(s){this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.writeRoute(this.currentRoute(),!0),this.errorMessage.set(s instanceof Error?s.message:String(s)),this.syncLabel.set("project unavailable")}}resetScopeDetail(){this.cancelGlobalSearchRequest(),this.globalSearchCapability.set(null),this.globalSearchQuery.set(""),this.globalSearchResponse.set(null),this.globalSearchProgress.set(!1),this.globalSearchOpen.set(!1),this.entityDetails.set(new Map),this.projectAdrsCache.set({data:null,error:null,loading:!1}),this.projectDebtCache.set({data:null,error:null,loading:!1}),this.projectContextCache.set({data:null,error:null,loading:!1}),this.projectGraphCache.set({data:null,error:null,loading:!1}),this.planEntryPages.set(new Map),this.issueCommentPages.set(new Map),this.initiativeDetails.set(new Map),this.initiativeTabs.set(new Map),this.selectedId.set(null),this.selectedInitiativeId.set(null),this.selectedNestedTarget.set(null),this.cascadePath.set([]),this.reRootTrail.set([]),this.activeSection.set("initiatives"),this.activePage.set("list"),this.activeView.set("overview"),this.initTab.set("overview"),this.initiativeStatusFilter.set("all"),this.adrStatusFilter.set("all"),this.clearMasterOverrideIfShallow()}connectEvents(){if(typeof EventSource!="function"){this.startPolling();return}this.events=new EventSource(this.buildTenantScopedPath("/events")),this.events.onmessage=e=>{this.handleProjectChangeEvent(e)},this.events.onerror=()=>{this.syncLabel.set("reconnecting"),this.startPolling()}}handleProjectChangeEvent(e){let t;try{t=JSON.parse(e.data)}catch{this.refreshProjectSummaryInBackground();return}if(t.correlationId){const s=this.localChangeCorrelations.get(t.correlationId);if(this.localChangeCorrelations.delete(t.correlationId),s!==void 0&&s>=Date.now())return}this.handleProjectChange(t)}handleProjectChange(e){if(e.projectId&&e.projectId!==this.selectedProjectId.get())return;if(!e.category||e.category==="bulk"||e.category==="unknown"){this.refreshProjectSummaryInBackground();return}const t=this.selectedId.get(),s=pc(e);let i=!1;if(e.category==="entity"){for(const a of e.affectedEntityIds??[]){const o=this.entityDetails.get().get(a);o&&(this.setEntityDetailCache(a,{...o,stale:!0}),i=!0)}if(t&&e.affectedEntityIds?.includes(t)&&(this.loadEntityDetail(t,!0),i=!0),e.affectedEntityKinds?.includes("adr")){const a=this.projectAdrsCache.get();a.data&&this.projectAdrsCache.set({...a,stale:!0}),this.activeSection.get()==="adrs"&&this.activePage.get()==="list"&&this.loadProjectAdrs(!0),i=!0}if(e.affectedEntityKinds?.includes("debt")){const a=this.projectDebtCache.get();a.data&&this.projectDebtCache.set({...a,stale:!0}),this.activeSection.get()==="debt"&&this.activePage.get()==="list"&&this.loadProjectDebt(!0),i=!0}const r=this.projectGraphCache.get();r.data&&this.projectGraphCache.set({...r,stale:!0}),this.activeSection.get()==="graph"&&this.activePage.get()==="list"&&(this.loadProjectGraph(!0),i=!0)}if(e.category==="issue-comment")for(const r of e.affectedEntityIds??[]){const a=this.issueCommentPages.get().get(r);a&&(this.setIssueCommentPageCache(r,{...a,stale:!0}),i=!0),t===r&&(this.loadIssueCommentPage(r,!0),i=!0)}if(e.category==="plan-entry")for(const r of e.affectedEntityIds??[]){const a=this.planEntryPages.get().get(r),o=a!==void 0||this.entityForId(r)?.kind==="plan";a&&(this.setPlanEntryPageCache(r,{...a,stale:!0}),i=!0),t===r&&o&&(this.loadPlanEntryPage(r,!0),i=!0);const l=this.entityDetails.get().get(r);l&&!o&&(this.setEntityDetailCache(r,{...l,stale:!0}),i=!0),t===r&&!o&&(this.loadEntityDetail(r,!0),i=!0)}if(e.category==="context"){const r=this.projectContextCache.get();r.data&&this.projectContextCache.set({...r,stale:!0}),this.activeSection.get()==="context"&&this.activePage.get()==="list"&&this.loadProjectContext(!0),i=!0}if(e.category==="relation"){for(const a of e.affectedEntityIds??[]){const o=this.entityDetails.get().get(a);o&&(this.setEntityDetailCache(a,{...o,stale:!0}),i=!0),t===a&&(this.loadEntityDetail(a,!0),i=!0)}const r=this.projectGraphCache.get();r.data&&this.projectGraphCache.set({...r,stale:!0}),this.activeSection.get()==="graph"&&this.activePage.get()==="list"&&this.loadProjectGraph(!0),i=!0}for(const r of e.affectedInitiativeIds??[]){if(e.affectedEntityIds?.includes(r)){const a=this.initiativeDetails.get().get(r);a&&(this.setInitiativeDetailCache(r,{...a,stale:!0}),i=!0),this.selectedInitiativeId.get()===r&&this.initTab.get()==="overview"&&(this.loadInitiativeDetail(r,!0),i=!0)}for(const[a,o]of this.initiativeTabs.get()){const l=a.slice(`${r}:`.length);a.startsWith(`${r}:`)&&s.has(l)&&(this.setInitiativeTabCache(a,{...o,stale:!0}),i=!0)}this.selectedInitiativeId.get()===r&&this.initTab.get()!=="overview"&&s.has(this.initTab.get())&&(this.loadInitiativeTab(r,this.initTab.get(),!0),i=!0)}if(i){e.affectsProjectSummary&&this.refreshProjectSummaryInBackground();return}this.refreshProjectSummaryInBackground()}startPolling(){this.pollTimer===null&&(this.pollTimer=window.setInterval(()=>{this.refreshProjectSummaryInBackground()},3e3))}async fetchJson(e){const t=e.includes("?")?"&":"?",s=await fetch(`${e}${t}ts=${Date.now()}`,{cache:"no-store"});if(!s.ok)throw new Error(`Request failed for ${e}`);return await s.json()}sortEntities(e){return[...e].sort((t,s)=>{const i=new Date(t.updatedAt).getTime(),r=new Date(s.updatedAt).getTime();return i!==r?r-i:t.id.localeCompare(s.id)})}buildIssueTree(e,t,s){const i=new Map(e.issues.map(l=>[l.id,l])),r=new Map;for(const l of e.subIssueLinks){if(!s.has(l.parent.id)||!s.has(l.issue.id))continue;const u=r.get(l.parent.id)??[];u.push(l.issue.id),r.set(l.parent.id,u)}const a=l=>{const u=i.get(l);if(!u)return null;const p=this.sortEntities((r.get(l)??[]).map(d=>i.get(d)).filter(d=>!!d));return{issue:u,children:p.map(d=>a(d.id)).filter(d=>d!==null)}};return this.sortEntities(t.map(l=>i.get(l)).filter(l=>!!l)).map(l=>a(l.id)).filter(l=>l!==null)}issueTreeNodeIds(e){return[e.issue.id,...e.children.flatMap(t=>this.issueTreeNodeIds(t))]}formatTenantDisplayName(e){return e.replace(/-[0-9a-f]{12}$/i,"").split(/[-_]+/).filter(t=>t.length>0).map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`).join(" ")}readTenantFromUrl(){return this.readRoute().tenantId}readProjectFromUrl(){return this.readRoute().projectId}currentRoute(){return{tenantId:this.selectedTenant.get(),projectId:this.selectedProjectId.get(),section:this.activeSection.get(),entityId:this.selectedId.get(),initiativeId:this.selectedInitiativeId.get(),target:this.selectedNestedTarget.get()}}readRoute(){const e=new URL(window.location.href),t=new URLSearchParams(e.hash.slice(1)),s=e.searchParams,i=t.get("tenant")??s.get("tenant"),r=t.get("project")??s.get("project"),a=t.get("section"),o=t.get("target"),l=t.get("target-id"),u=t.get("target-scope")??void 0,p=o==="context"?{id:null,scopeRef:u,type:"context"}:l&&o==="context-term"?{id:l,scopeRef:u,type:o}:l&&(o==="context-term"||o==="issue-comment"||o==="plan-entry")?{type:o,id:l}:null;return{tenantId:i,projectId:r,section:Gl(a)?a:"initiatives",entityId:t.get("entity"),initiativeId:t.get("initiative"),target:p}}normalizeRoute(e){const t=this.entityById.get();if(t.size===0)return e;const s=e.entityId&&(this.snapshot.get()===null||t.has(e.entityId))?e.entityId:null,i=e.initiativeId&&this.bundleForInitiativeId(e.initiativeId)?e.initiativeId:null;return{...e,entityId:s,initiativeId:i,target:this.normalizeNestedTarget(e.target,s)}}normalizeNestedTarget(e,t){if(!e)return null;if(e.type==="plan-entry")return(this.snapshot.get()?.planEntries??[]).find(r=>r.id===e.id&&r.planId===t&&!r.tombstone)?e:null;if(e.type==="issue-comment")return(t?this.snapshot.get()?.issueComments[t]?.comments.find(r=>r.id===e.id&&!r.tombstone):null)?e:null;const s=e.scopeRef?this.getContextForInitiative(e.scopeRef):this.sharedContext.get();return s?.context.exists&&(e.type==="context"||s.terms.some(i=>i.term===e.id))?e:null}applyRoute(e){const t=this.normalizeRoute(e);return this.selectedTenant.set(t.tenantId),this.selectedProjectId.set(t.projectId),this.activeSection.set(t.section),this.selectedId.set(t.entityId),this.selectedInitiativeId.set(t.initiativeId),this.selectedNestedTarget.set(t.target),(t.target?.type==="context"||t.target?.type==="context-term")&&(this.contextTab.set(t.target.scopeRef?"initiatives":"global"),this.selectedContextInitiativeId.set(t.target.scopeRef??null)),this.cascadePath.set([]),this.reRootTrail.set([]),this.clearMasterOverrideIfShallow(),this.activePage.set(t.entityId?"entity":t.initiativeId?"initiative":"list"),this.activeView.set("overview"),t.entityId?this.loadEntityDetail(t.entityId):t.initiativeId&&this.isSummaryInitiative(t.initiativeId)?this.loadInitiativeDetail(t.initiativeId):t.section==="adrs"?this.loadProjectAdrs():t.section==="debt"?this.loadProjectDebt():t.section==="context"?this.loadProjectContext():t.section==="graph"&&this.loadProjectGraph(),t}writeRoute(e,t=!1){const s=new URL(window.location.href),i=[],r=(a,o)=>{o&&i.push(`${a}=${encodeURIComponent(o)}`)};r("tenant",e.tenantId),r("project",e.projectId),r("section",e.section==="initiatives"?null:e.section),r("entity",e.entityId),r("initiative",e.initiativeId),r("target",e.target?.type??null),r("target-id",e.target?.id??null),r("target-scope",e.target?.scopeRef??null),s.searchParams.delete("tenant"),s.searchParams.delete("project"),s.hash=i.join("&"),window.history[t?"replaceState":"pushState"]({},"",s)}buildTenantScopedPath(e){const t=this.selectedTenant.get(),s=this.selectedProjectId.get();if(!t&&!s)return e;const i=e.includes("?")?"&":"?",r=new URLSearchParams;return t&&r.set("tenant",t),s&&r.set("project",s),r.size>0?`${e}${i}${r}`:e}stopLiveUpdates(){this.events?.close(),this.events=null,this.pollTimer!==null&&(window.clearInterval(this.pollTimer),this.pollTimer=null)}}function an(n){return new Set(n.map(t=>t.definition.trim().toLowerCase()).filter(t=>t.length>0)).size>1}function gc(n,e){switch(e){case"questions":return n.role==="question";case"decisions":return n.role==="decision";case"includedScope":return n.role==="scope"&&n.scopeDirection==="included";case"excludedScope":return n.role==="scope"&&n.scopeDirection==="excluded";case"constraints":return n.role==="constraint";case"preferences":return n.role==="preference";case"considerations":return n.role==="consideration"}}function fc(n,e){return n.scopeKind!==e.scopeKind?n.scopeKind==="default"?-1:1:n.scopeLabel!==e.scopeLabel?n.scopeLabel.localeCompare(e.scopeLabel):n.contextKey.localeCompare(e.contextKey)}const Gs="tenant-switcher-menu",on="agent-issues-theme",_i=class _i extends rs(ce){constructor(){super(...arguments),this.store=new hc,this.medium=!1,this.narrow=!1,this.mobileMasterOpen=!1,this.theme="light",this.globalSearchTrigger=null,this.onSelectTenant=e=>{const t=e.currentTarget.dataset.tenant;t&&this.store.selectTenant(t)},this.onSelectSection=e=>{const t=e.currentTarget.dataset.section;t&&(this.store.selectSection(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSelectInitiative=e=>{const t=e.currentTarget.dataset.initiative;t&&(this.store.selectInitiative(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSelectProject=e=>{const t=e.currentTarget.dataset.project;t&&this.store.selectProject(t)},this.onOpenProjectChooser=()=>{this.store.returnToProjectChooser()},this.onSelectEntity=e=>{const t=e.currentTarget.dataset.id;t&&(this.store.selectEntity(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSearchInput=e=>{this.store.search.set(e.target.value)},this.onOpenGlobalSearch=e=>{this.globalSearchTrigger=e.currentTarget,this.store.openGlobalSearch()},this.onCloseGlobalSearch=()=>{this.store.closeGlobalSearch(),this.globalSearchTrigger?.focus()},this.onOpenGlobalSearchTarget=e=>{this.store.openSearchTarget(e.detail),this.onCloseGlobalSearch()},this.onRetryGlobalSearch=()=>{this.store.retryGlobalSearch()},this.onRetryProjectSection=e=>{const t=e.currentTarget.dataset.section;t==="adrs"?this.store.retryProjectAdrs():t==="debt"?this.store.retryProjectDebt():t==="context"?this.store.retryProjectContext():t==="graph"&&this.store.retryProjectGraph()},this.onWindowKeyDown=e=>{const t=e.target;e.key.toLowerCase()!=="k"||!e.metaKey&&!e.ctrlKey||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t?.isContentEditable||(e.preventDefault(),this.globalSearchTrigger=document.activeElement instanceof HTMLElement?document.activeElement:this.shadowRoot?.querySelector("[data-global-search-trigger]")??null,this.store.openGlobalSearch())},this.onToggleRail=()=>{this.store.toggleRail()},this.onToggleMaster=()=>{this.store.toggleMaster()},this.onToggleMobileMaster=async()=>{this.mobileMasterOpen=!this.mobileMasterOpen,this.requestUpdate(),this.mobileMasterOpen&&(await this.updateComplete,this.shadowRoot?.querySelector(".master-search")?.focus())},this.onToggleTheme=()=>{const e=this.theme==="light"?"dark":"light";this.setTheme(e,!0)},this.onToggleEpic=e=>{const t=e.currentTarget.dataset.epicToggle;t&&this.store.toggleEpicExpanded(t)},this.onContextSearchInput=e=>{this.store.contextSearch.set(e.target.value)},this.onSetContextTab=e=>{const t=e.currentTarget.dataset.contextTab;t&&this.store.setContextTab(t)},this.onSetContextInitiativeFilter=e=>{const t=e.currentTarget.dataset.contextInitiative??"";this.store.setContextInitiativeFilter(t||null)},this.onSetMasterStatusFilter=e=>{const t=e.currentTarget,s=t.dataset.masterSection,i=t.dataset.masterStatus;s!=="initiatives"&&s!=="adrs"||!i||this.store.setMasterStatusFilter(s,i)},this.onSetDebtFilter=e=>{const t=e.currentTarget,s=t.dataset.debtFilter,i=t.dataset.debtValue;!s||!i||this.store.setDebtFilter(s,i)},this.onToggleProjectGraphKind=e=>{const t=e.detail.kind;t&&this.store.toggleProjectGraphKind(t)},this.onProjectNodeOpen=e=>{const{id:t,kind:s}=e.detail;if(t){if(s==="initiative"){this.store.selectInitiative(t);return}this.store.selectProjectGraphEntity(t,s)}},this.updateNarrowMode=()=>{const e=window.innerWidth<=900,t=!e&&window.innerWidth<=1200;this.narrow===e&&this.medium===t||(this.narrow=e,this.medium=t,e||(this.mobileMasterOpen=!1),this.requestUpdate())}}toAriaBoolean(e){return e?"true":"false"}formatStatusFilter(e){return e==="all"?"All":e.split("-").map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`).join(" ")}focusContextTarget(){for(const i of this.renderRoot.querySelectorAll(".is-context-target, .is-context-term-target"))i.classList.remove("is-context-target","is-context-term-target");const e=this.store.selectedNestedTarget.get();if(!e||e.type!=="context"&&e.type!=="context-term")return;const t=e.type==="context"?[...this.renderRoot.querySelectorAll(".ctx-context-summary")].find(i=>i.dataset.contextScope===(e.scopeRef??"shared")):[...this.renderRoot.querySelectorAll(".ctx-term")].find(i=>i.dataset.term===e.id);if(!t)return;const s=e.type==="context"?"is-context-target":"is-context-term-target";t.classList.remove(s),t.offsetWidth,t.classList.add(s),t.focus({preventScroll:!0}),typeof t.scrollIntoView=="function"&&t.scrollIntoView({behavior:"smooth",block:"center"})}updated(){this.focusContextTarget()}connectedCallback(){super.connectedCallback();const e=window.localStorage.getItem(on);this.setTheme(e==="dark"?"dark":"light"),this.updateNarrowMode(),window.addEventListener("resize",this.updateNarrowMode),window.addEventListener("keydown",this.onWindowKeyDown),this.store.connect()}disconnectedCallback(){window.removeEventListener("resize",this.updateNarrowMode),window.removeEventListener("keydown",this.onWindowKeyDown),this.store.disconnect(),super.disconnectedCallback()}setTheme(e,t=!1){this.theme=e,document.documentElement.dataset.theme=e,t&&window.localStorage.setItem(on,e),this.requestUpdate()}renderThemeToggle(e){const t=this.theme==="light"?"dark":"light",s=this.theme==="light"?"☾":"☼";return h`
|
|
2947
|
+
`];let oi=ts;customElements.define("agent-issues-detail-view",oi);const rc="0123456789ABCDEFGHJKMNPQRSTVWXYZ",nc=6,tn=5,ac="agent-issues-global-search-recents",oc=400,lc=300*1e3,cc=[{key:"questions",title:"Questions"},{key:"decisions",title:"Decisions"},{key:"includedScope",title:"Included scope"},{key:"excludedScope",title:"Excluded scope"},{key:"constraints",title:"Constraints"},{key:"preferences",title:"Preferences"},{key:"considerations",title:"Considerations"}],dc={project:"PROJ",epic:"EPIC",version:"VER",initiative:"INIT",prd:"PRD",userStory:"US",adr:"ADR",issue:"ISS",debt:"DEBT",handoff:"HO"};function uc(n){if(n.shortReference)return n.shortReference;const e=dc[n.kind]??n.kind.slice(0,4).toUpperCase();let t=2166136261;for(let r=0;r<n.id.length;r+=1)t^=n.id.charCodeAt(r),t=Math.imul(t,16777619);let s=BigInt(t>>>0),i="";for(let r=0;r<nc;r+=1)i=rc[Number(s&31n)]+i,s>>=5n;return`${e}_${i}`}const Nn=["overview","issues","plans","prds","adrs","context","userStories","debt","graph"],pc=Nn.filter(n=>n!=="overview");function hc(n){if(!n||typeof n!="object"||!("type"in n))return!1;const e=n;return e.type==="entity"?typeof e.entityId=="string":e.type==="plan-entry"?typeof e.planId=="string"&&typeof e.entryId=="string":e.type==="issue-comment"?typeof e.issueId=="string"&&typeof e.commentId=="string":(e.type==="context"||e.type==="context-term"&&typeof e.term=="string")&&(e.scopeRef===void 0||typeof e.scopeRef=="string")}function sn(n,e){const t=n.nodes.filter(a=>e.has(a.kind)),s=new Set(t.map(a=>a.key)),i=[...new Set(t.map(a=>a.col))].sort((a,o)=>a-o),r=new Map(i.map((a,o)=>[a,o]));return{columns:i.map(a=>n.columns[a]),edges:n.edges.filter(a=>s.has(a.from)&&s.has(a.to)),nodes:t.map(a=>({...a,col:r.get(a.col)}))}}function zt(n){return{...n,body:""}}function gc(n){return[...(n.incoming??[]).map(({entity:e,relationType:t})=>({createdAt:n.entity.createdAt,fromId:e.id,toId:n.entity.id,type:t})),...(n.outgoing??[]).map(({entity:e,relationType:t})=>({createdAt:n.entity.createdAt,fromId:n.entity.id,toId:e.id,type:t}))]}function fc(n){if(n.category==="relation")return new Set(["issues","plans","prds","adrs","context","userStories","debt","graph"]);if(n.category==="context")return new Set(["context"]);if(n.category==="plan-entry")return new Set(["plans"]);if(n.category!=="entity")return new Set;const e={adr:"adrs",debt:"debt",issue:"issues",plan:"plans",prd:"prds",userStory:"userStories"};return new Set([...(n.affectedEntityKinds??[]).flatMap(t=>e[t]?[e[t]]:[]),"graph"])}class mc{constructor(){this.config=A(null),this.snapshot=A(null),this.projectSummary=A(null),this.entityDetails=A(new Map),this.projectAdrsCache=A({data:null,error:null,loading:!1}),this.projectDebtCache=A({data:null,error:null,loading:!1}),this.projectContextCache=A({data:null,error:null,loading:!1}),this.projectGraphCache=A({data:null,error:null,loading:!1}),this.planEntryPages=A(new Map),this.issueCommentPages=A(new Map),this.initiativeDetails=A(new Map),this.initiativeTabs=A(new Map),this.projectDiscovery=A(null),this.search=A(""),this.globalSearchCapability=A(null),this.globalSearchQuery=A(""),this.globalSearchScope=A("current-project"),this.globalSearchSourceTypes=A(["entity","context","context-term","plan-entry","issue-comment"]),this.globalSearchResponse=A(null),this.globalSearchResults=A([]),this.globalSearchRecents=A([]),this.globalSearchProgress=A(!1),this.globalSearchOpen=A(!1),this.contextSearch=A(""),this.contextTab=A("all"),this.selectedContextInitiativeId=A(null),this.visibleProjectGraphKinds=A(new Set(ze)),this.initiativeStatusFilter=A("all"),this.adrStatusFilter=A("all"),this.debtLifecycleFilter=A("open"),this.debtCategoryFilter=A("all"),this.debtPriorityFilter=A("all"),this.kindFilter=A("all"),this.selectedTenant=A(null),this.selectedProjectId=A(null),this.selectedInitiativeId=A(null),this.selectedId=A(null),this.selectedNestedTarget=A(null),this.cascadePath=A([]),this.cascadeAvailableWidth=A(0),this.cascadeWindowStart=A(null),this.reRootTrail=A([]),this.railCollapsed=A(!1),this.masterCollapsedOverride=A(null),this.collapsedEpicIdsByProject=A(new Map),this.syncLabel=A("loading"),this.errorMessage=A(null),this.activeView=A("overview"),this.activePage=A("list"),this.activeRootTab=A("initiatives"),this.activeSection=A("initiatives"),this.initTab=A("overview"),this.globalSearchAbortController=null,this.globalSearchProgressTimer=null,this.globalSearchRequestTimer=null,this.initiativeTabPrefetchGeneration=0,this.initiativeTabPrefetchTimer=null,this.localChangeCorrelations=new Map,this.tenantById=j(()=>new Map((this.config.get()?.availableTenants??[]).map(e=>[e.id,e]))),this.tenantOptions=j(()=>{const e=new Map(this.tenantById.get()),t=this.selectedTenant.get();return t&&!e.has(t)&&e.set(t,{displayName:this.formatTenantDisplayName(t),id:t}),[...e.values()].sort((s,i)=>s.displayName.localeCompare(i.displayName))}),this.selectedTenantDisplayName=j(()=>{const e=this.selectedTenant.get();return e?this.tenantById.get().get(e)?.displayName??this.formatTenantDisplayName(e):null}),this.selectedProjectDisplayName=j(()=>{const e=this.selectedProjectId.get();if(!e)return null;const t=this.projectDiscovery.get();return t?.kind!=="available"?e:t.projects.find(s=>s.project.id===e)?.project.title??e}),this.entityById=j(()=>{const e=this.snapshot.get(),t=e?.initiatives.flatMap(a=>[a.initiative,...a.prds,...a.userStories,...a.adrs,...a.issues])??[],s=[...this.entityDetails.get().values()].flatMap(a=>a.detail?[a.detail]:[]),i=s.map(a=>a.entity),r=s.flatMap(a=>[...(a.incoming??[]).map(({entity:o})=>zt(o)),...(a.outgoing??[]).map(({entity:o})=>zt(o))]);return new Map([...e?.entities??[],...e?.projectAdrs??[],...t,...r,...i].map(a=>[a.id,a]))}),this.globalSearchRecentRecords=j(()=>this.globalSearchRecents.get().flatMap(e=>{const t=this.snapshot.get();if(!t)return[];if(e.type==="entity"){const a=this.entityForId(e.entityId);return a?[{sourceType:"entity",target:e,title:a.title}]:[]}if(e.type==="plan-entry"){const a=t.planEntries?.find(o=>o.id===e.entryId&&o.planId===e.planId&&!o.tombstone);return a&&this.entityForId(e.planId)?[{sourceType:"plan-entry",target:e,title:a.body??"Plan entry"}]:[]}if(e.type==="issue-comment"){const a=t.issueComments[e.issueId]?.comments.find(o=>o.id===e.commentId&&!o.tombstone);return a&&this.entityForId(e.issueId)?[{sourceType:"issue-comment",target:e,title:a.body??"Comment"}]:[]}const s=[t.contexts.shared,...t.contexts.initiatives],i=e.scopeRef?s.find(a=>a.context.key===e.scopeRef||a.context.scopeEntityId===e.scopeRef):t.contexts.shared;if(!i?.context.exists)return[];if(e.type==="context")return[{sourceType:"context",target:e,title:i.context.title}];const r=i.terms.find(a=>a.term===e.term);return r?[{sourceType:"context-term",target:e,title:r.term}]:[]})),this.cascadeColumns=j(()=>this.cascadePath.get().map(e=>this.entityForId(e)).filter(e=>!!e)),this.masterCollapsed=j(()=>{const e=this.masterCollapsedOverride.get();return e!==null?e:!1}),this.cascadeColumnWidth=480,this.cascadeColumnGap=16,this.cascadeColumnWindow=j(()=>{const e=this.cascadeColumns.get(),t=this.cascadeCapacityForWidth(this.cascadeAvailableWidth.get());if(e.length<=t)return{breadcrumb:[],columns:e};const s=e.length-t,i=this.cascadeWindowStart.get(),r=Math.min(Math.max(i??s,0),e.length-1);return{breadcrumb:e.slice(0,r),columns:e.slice(r)}}),this.selectedEntity=j(()=>this.entityForId(this.selectedId.get())),this.selectedBundle=j(()=>this.bundleForEntityId(this.selectedId.get())),this.selectedInitiativeBundle=j(()=>this.bundleForInitiativeId(this.selectedInitiativeId.get())),this.activeInitiativeId=j(()=>this.selectedInitiativeId.get()??this.selectedBundle.get()?.initiative.id??null),this.sharedContext=j(()=>this.projectContextCache.get().data?.shared??this.snapshot.get()?.contexts.shared??null),this.initiativeContextById=j(()=>new Map((this.projectContextCache.get().data?.initiatives??this.snapshot.get()?.contexts.initiatives??[]).filter(e=>!!e.context.scopeEntityId).map(e=>[e.context.scopeEntityId??e.context.key,e]))),this.selectedContext=j(()=>{const e=this.selectedBundle.get();return e?this.initiativeContextById.get().get(e.initiative.id)??null:this.sharedContext.get()}),this.projectContextTerms=j(()=>{const e=this.projectContextCache.get().data?.terms;if(e)return e;const t=new Map;for(const s of[this.sharedContext.get(),...this.projectContextCache.get().data?.initiatives??this.snapshot.get()?.contexts.initiatives??[]])if(s)for(const i of s.terms){const r=i.term.toLowerCase(),a={avoid:[...i.avoid],contextKey:s.context.key,contextTitle:s.context.title,definition:i.definition,scopeEntityId:s.context.scopeEntityId,scopeKind:s.context.scopeKind,scopeLabel:s.context.scopeLabel,updatedAt:i.updatedAt},o=t.get(r);if(!o){t.set(r,{term:i.term,sources:[a],hasSharedSource:s.context.scopeKind==="default",hasDuplicates:!1,hasConflictingDefinitions:!1});continue}o.sources.push(a),o.hasDuplicates=o.sources.length>1,o.hasSharedSource=o.hasSharedSource||s.context.scopeKind==="default",o.hasConflictingDefinitions=rn(o.sources),i.term.localeCompare(o.term)<0&&(o.term=i.term)}return[...t.values()].map(s=>({...s,sources:s.sources.sort(vc)})).sort((s,i)=>s.term.localeCompare(i.term))}),this.filteredProjectContextTerms=j(()=>{const e=this.contextSearch.get().trim().toLowerCase();return e?this.projectContextTerms.get().filter(t=>t.term.toLowerCase().includes(e)?!0:t.sources.some(s=>[s.scopeLabel,s.contextTitle,s.definition,...s.avoid].join(" ").toLowerCase().includes(e))):this.projectContextTerms.get()}),this.filteredInitiativeContextTerms=j(()=>{const e=this.selectedContextInitiativeId.get(),t=this.contextSearch.get().trim().toLowerCase();return this.projectContextTerms.get().map(s=>{const i=s.sources.filter(a=>a.scopeKind==="initiative"&&(!e||a.scopeEntityId===e));return i.length===0||!(!t||s.term.toLowerCase().includes(t)||i.some(a=>[a.scopeLabel,a.contextTitle,a.definition,...a.avoid].join(" ").toLowerCase().includes(t)))?null:{...s,sources:i,hasSharedSource:!1,hasDuplicates:i.length>1,hasConflictingDefinitions:rn(i)}}).filter(s=>s!==null)}),this.filteredSharedContext=j(()=>{const e=this.sharedContext.get();if(!e)return null;const t=this.contextSearch.get().trim().toLowerCase();if(!t)return e;const s=[e.context.key,e.context.scopeLabel,e.context.summary,e.context.title].join(" ").toLowerCase().includes(t),i=e.terms.filter(r=>[r.term,r.definition,...r.avoid].join(" ").toLowerCase().includes(t));return!s&&i.length===0?null:{context:{...e.context,summary:s?e.context.summary:""},terms:i}}),this.projectContextDuplicateCount=j(()=>this.projectContextTerms.get().filter(e=>e.hasDuplicates).length),this.selectedIncoming=j(()=>this.incomingRelationsFor(this.selectedId.get())),this.selectedOutgoing=j(()=>this.outgoingRelationsFor(this.selectedId.get())),this.relatedEntities=j(()=>{const e=new Set;for(const t of[...this.selectedIncoming.get(),...this.selectedOutgoing.get()])e.add(t.fromId),e.add(t.toId);return e.delete(this.selectedId.get()??""),this.sortEntities([...e].map(t=>this.entityById.get().get(t)).filter(t=>!!t))}),this.localGraphEntities=j(()=>{const e=this.selectedEntity.get();return e?[e,...this.relatedEntities.get()]:[]}),this.localGraphRelations=j(()=>{const e=new Set(this.localGraphEntities.get().map(t=>t.id));return this.scopedRelations().filter(t=>e.has(t.fromId)&&e.has(t.toId))}),this.filteredEntities=j(()=>{const e=this.search.get().trim().toLowerCase(),t=this.kindFilter.get();return this.sortEntities((this.snapshot.get()?.entities??[]).filter(s=>t!=="all"&&s.kind!==t?!1:e?[s.id,s.kind,s.status,s.title].join(" ").toLowerCase().includes(e):!0))}),this.kindOptions=j(()=>["issue","all",...new Set((this.snapshot.get()?.entities??[]).map(e=>e.kind).filter(e=>e!=="issue"))]),this.rootTabCounts=j(()=>({adrs:(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="adr").length,initiatives:this.snapshot.get()?.initiatives.length??0})),this.allDebtRecords=j(()=>this.sortEntities(this.projectDebtCache.get().data?.records??(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="debt"))),this.debtRecords=j(()=>{const e=this.debtLifecycleFilter.get(),t=this.debtCategoryFilter.get(),s=this.debtPriorityFilter.get();return this.sortEntities(this.allDebtRecords.get().filter(i=>(e==="all"||i.status===e)&&(t==="all"||i.category===t)&&(s==="all"||i.priority===s)))}),this.projectInitiatives=j(()=>this.snapshot.get()?.initiatives??this.projectSummaryInitiatives.get().map(e=>({adrs:[],blockerLinks:[],constrainsLinks:[],entities:[zt(e.initiative)],fixLinks:[],initiative:zt(e.initiative),issues:[],prds:[],subIssueLinks:[],userStories:[]}))),this.projectSummaryEpicGroups=j(()=>{const e=this.projectSummary.get();return e?.kind==="available"?e.epics:[]}),this.projectSummaryInitiatives=j(()=>this.projectSummaryEpicGroups.get().flatMap(e=>e.initiatives)),this.epicInitiativeGroups=j(()=>{const e=this.snapshot.get();if(!e)return[];const t=new Map(e.initiatives.map(i=>[i.initiative.id,i])),s=new Map;for(const i of e.relations){if(i.type!=="contains"||!t.has(i.toId))continue;const r=s.get(i.fromId)??[];r.push(i.toId),s.set(i.fromId,r)}return this.sortEntities(e.entities.filter(i=>i.kind==="epic")).map(i=>{const r=(s.get(i.id)??[]).map(a=>t.get(a)).filter(a=>!!a);return{epic:i,initiatives:r,completedInitiativeCount:r.filter(a=>this.isDoneStatus(a.initiative.status)).length}}).filter(i=>i.initiatives.length>0)}),this.projectAdrs=j(()=>this.sortEntities(this.projectAdrsCache.get().data?.projectAdrs??this.snapshot.get()?.projectAdrs??(this.snapshot.get()?.entities??[]).filter(e=>e.kind==="adr"))),this.adrRailEntries=j(()=>{const e=this.snapshot.get(),t=this.projectAdrs.get().map(r=>({adr:r,scope:"project",scopeLabel:"project decision"})),i=(this.projectAdrsCache.get().data?.initiativeAdrs??e?.initiatives??[]).flatMap(r=>this.sortEntities(r.adrs).map(a=>({adr:a,scope:"initiative",scopeLabel:`initiative ${r.initiative.title}`})));return[...t,...i]}),this.projectStoryCount=j(()=>this.projectSummaryInitiatives.get().reduce((e,t)=>e+t.userStoryCount,0)),this.projectIssueCount=j(()=>this.projectSummaryInitiatives.get().reduce((e,t)=>e+t.issueCount,0)),this.projectDescription=j(()=>this.sharedContext.get()?.context.summary??this.selectedTenantDisplayName.get()??""),this.orphanIds=j(()=>new Set((this.snapshot.get()?.orphans??[]).map(e=>e.id))),this.connected=!1,this.events=null,this.pollTimer=null,this.onHashChange=()=>{const e=this.applyRoute(this.readRoute());this.writeRoute(e,!0)},this.onPopState=async()=>{const e=this.readRoute();if(e.tenantId!==this.selectedTenant.get()||e.projectId!==this.selectedProjectId.get()){await this.navigateToRoute(e);return}this.applyRoute(e)},this.onBrowserNavigation=async()=>{await this.navigateToRoute(this.readRoute()),new URLSearchParams(new URL(window.location.href).hash.slice(1)).has("cascade")&&this.writeRoute(this.currentRoute(),!0)},this.setSearchFromEvent=e=>{this.search.set(e.target.value)},this.setKindFilterFromEvent=e=>{this.kindFilter.set(e.target.value)},this.setTenantFromEvent=e=>{const t=e.target.value;this.selectTenant(t)},this.selectEntityFromEvent=e=>{const t=e.currentTarget.dataset.id;t&&this.selectEntity(t)},this.openViewFromEvent=e=>{const t=e.currentTarget.dataset.view;t&&this.activeView.set(t)},this.selectInitiativeFromEvent=e=>{const t=e.currentTarget.dataset.id;t&&this.selectInitiative(t)}}entityForId(e){return e?this.entityById.get().get(e)??null:null}requestEntityTab(e,t){t==="plan"&&this.loadPlanEntryPage(e)}async loadMorePlanEntries(e){const t=this.planEntryPages.get().get(e)?.data?.nextBefore;t&&await this.loadPlanEntryPage(e,!1,t)}async loadMoreIssueComments(e){const t=this.issueCommentPages.get().get(e)?.data?.nextBefore;t&&await this.loadIssueCommentPage(e,!1,t)}openGlobalSearch(){this.globalSearchOpen.set(!0),this.globalSearchRecents.set(this.readGlobalSearchRecents()),this.reloadGlobalSearchCapability()}planEntriesFor(e){return this.planEntryPages.get().get(e)?.data?.entries??(this.snapshot.get()?.planEntries??[]).filter(t=>t.planId===e)}issueCommentsFor(e){return this.issueCommentPages.get().get(e)?.data?.comments??this.snapshot.get()?.issueComments[e]?.comments??[]}displayUser(e,t){const s=this.issueCommentPages.get().get(t)?.data?.users.find(i=>i.id===e)??this.snapshot.get()?.users.find(i=>i.id===e);return s?.displayName??s?.authenticationSubject??e}closeGlobalSearch(){this.globalSearchOpen.set(!1),this.setGlobalSearchQuery("")}setGlobalSearchQuery(e){if(this.globalSearchQuery.set(e),this.globalSearchResponse.set(null),this.globalSearchProgress.set(!1),this.cancelGlobalSearchRequest(),!e.trim()){this.globalSearchResults.set([]);return}this.globalSearchRequestTimer=window.setTimeout(()=>{this.requestGlobalSearch(e)},150)}setGlobalSearchScope(e){this.globalSearchScope.set(e),this.setGlobalSearchQuery(this.globalSearchQuery.get())}setGlobalSearchSourceTypes(e){this.globalSearchSourceTypes.set(e),this.setGlobalSearchQuery(this.globalSearchQuery.get())}async retryGlobalSearch(){const e=this.globalSearchQuery.get();e.trim()&&await this.requestGlobalSearch(e)}async reloadGlobalSearchCapability(){const e=this.selectedTenant.get();if(!e){this.globalSearchCapability.set(null);return}try{const t=await fetch(`/api/search/capability?${new URLSearchParams({tenant:e})}`,{cache:"no-store"});if(!t.ok)throw new Error("Global search capability request failed.");const s=await t.json();this.selectedTenant.get()===e&&this.globalSearchCapability.set(s)}catch{this.globalSearchCapability.set(null)}}async requestGlobalSearch(e){if(e!==this.globalSearchQuery.get())return;const t=this.selectedTenant.get(),s=this.selectedProjectId.get();if(!t||!s)return;const i=new AbortController;this.globalSearchAbortController=i,this.globalSearchProgressTimer=window.setTimeout(()=>{this.globalSearchAbortController===i&&this.globalSearchProgress.set(!0)},150);const r=new URLSearchParams({tenant:t,project:s,query:e,scope:this.globalSearchScope.get()});r.set("sourceTypes",this.globalSearchSourceTypes.get().join(","));try{const a=await fetch(`/api/search?${r}`,{cache:"no-store",signal:i.signal});if(!a.ok)throw new Error("Global search request failed.");const o=await a.json();this.globalSearchAbortController===i&&(this.globalSearchResponse.set(o),o.state==="available"&&this.globalSearchResults.set(o.results))}catch(a){if(a instanceof DOMException&&a.name==="AbortError")return;this.globalSearchAbortController===i&&this.globalSearchResponse.set({state:"operational-error"})}finally{this.globalSearchAbortController===i&&(this.globalSearchAbortController=null,this.clearGlobalSearchProgressTimer(),this.globalSearchProgress.set(!1))}}cancelGlobalSearchRequest(){this.globalSearchRequestTimer!==null&&(window.clearTimeout(this.globalSearchRequestTimer),this.globalSearchRequestTimer=null),this.globalSearchAbortController?.abort(),this.globalSearchAbortController=null,this.clearGlobalSearchProgressTimer()}clearGlobalSearchProgressTimer(){this.globalSearchProgressTimer!==null&&(window.clearTimeout(this.globalSearchProgressTimer),this.globalSearchProgressTimer=null)}cascadeCapacityForWidth(e){return e<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.floor(e/(this.cascadeColumnWidth+this.cascadeColumnGap)))}cascadeHopRelation(e,t){const s=this.snapshot.get()?.relations??[],i=s.find(a=>a.fromId===e&&a.toId===t);return i?i.type:s.find(a=>a.fromId===t&&a.toId===e)?.type??null}cascadePathForLeaf(e){const t=this.snapshot.get()?.relations??[],s=[e],i=new Set([e]);let r=e;for(;;){const p=t.find(d=>d.type==="decomposes"&&d.toId===r);if(!p||i.has(p.fromId))break;s.unshift(p.fromId),i.add(p.fromId),r=p.fromId}const a=s[0],l=this.sortEntities(t.filter(p=>p.type==="fixes"&&p.fromId===a).map(p=>this.entityForId(p.toId)).filter(p=>!!p))[0]?.id??null;return[...this.spineForStory(l,a),...s]}spineForStory(e,t){const s=this.snapshot.get()?.relations??[],i=e?s.find(o=>o.type==="creates"&&o.toId===e)?.fromId??null:null,r=i?s.find(o=>o.type==="owns"&&o.toId===i)?.fromId??null:s.find(o=>o.type==="tracks"&&o.toId===t)?.fromId??null,a=[];return r&&a.push(r),i&&a.push(i),e&&a.push(e),a}cascadeSeamFor(e,t){const s=this.cascadeHopRelation(e,t);if(s!=="fixes")return{relation:s,branch:null};const i=this.snapshot.get()?.relations??[],r=this.sortEntities(i.filter(a=>a.type==="fixes"&&a.fromId===t).map(a=>this.entityForId(a.toId)).filter(a=>!!a));return r.length<=1?{relation:s,branch:null}:{relation:s,branch:{options:r,selectedIndex:r.findIndex(a=>a.id===e)}}}selectCascadeBranch(e,t){const s=this.cascadePath.get(),i=s.indexOf(e);if(i===-1)return;const r=s.slice(i),a=this.spineForStory(t,e);this.cascadeWindowStart.set(null),this.cascadePath.set([...a,...r]),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}bundleForEntityId(e){return e?(this.snapshot.get()?.initiatives??[]).find(t=>[t.initiative,...t.entities,...t.prds,...t.userStories,...t.adrs,...t.issues].some(s=>s.id===e))??null:null}bundleForInitiativeId(e){if(!e)return null;const t=(this.snapshot.get()?.initiatives??[]).find(p=>p.initiative.id===e)??null;if(t)return t;const s=this.projectSummaryInitiatives.get().find(p=>p.initiative.id===e);if(!s)return null;const i=this.initiativeDetailForId(e),r=this.initiativeTabForId(e,this.initTab.get()),a=i?.initiative??{...s.initiative,body:""},o=r?.records??[],l=new Map([a,...o].map(p=>[p.id,p])),u=r?.relations??[];return{adrs:o.filter(p=>p.kind==="adr"),blockerLinks:u.filter(p=>p.type==="blocks").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{source:d,target:g}]:[]}),constrainsLinks:u.filter(p=>p.type==="constrains").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{adr:d,issue:g}]:[]}),entities:[a,...o],fixLinks:u.filter(p=>p.type==="fixes").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{issue:d,userStory:g}]:[]}),initiative:a,issues:o.filter(p=>p.kind==="issue"),prds:o.filter(p=>p.kind==="prd"),relations:u,subIssueLinks:u.filter(p=>p.type==="decomposes").flatMap(p=>{const d=l.get(p.fromId),g=l.get(p.toId);return d&&g?[{parent:d,issue:g}]:[]}),userStories:o.filter(p=>p.kind==="userStory")}}initiativeDetailForId(e){return e?this.initiativeDetails.get().get(e)?.detail??null:null}initiativeTabForId(e,t){return e?this.initiativeTabs.get().get(this.initiativeTabCacheKey(e,t))?.data??null:null}isSummaryInitiative(e){return!this.snapshot.get()?.initiatives.some(t=>t.initiative.id===e)&&this.projectSummaryInitiatives.get().some(t=>t.initiative.id===e)}incomingRelationsFor(e){return e?this.scopedRelations().filter(t=>t.toId===e):[]}outgoingRelationsFor(e){return e?this.scopedRelations().filter(t=>t.fromId===e):[]}scopedRelations(){const e=new Map;for(const t of this.snapshot.get()?.relations??[])e.set(`${t.fromId}:${t.type}:${t.toId}`,t);for(const t of[...this.entityDetails.get().values()].flatMap(s=>s.detail?[s.detail]:[]))for(const s of gc(t))e.set(`${s.fromId}:${s.type}:${s.toId}`,s);return[...e.values()]}connect(){this.connected||(this.connected=!0,this.applyRoute(this.readRoute(),!1),window.addEventListener("hashchange",this.onBrowserNavigation),window.addEventListener("popstate",this.onPopState),this.bootstrap())}disconnect(){this.connected&&(this.connected=!1,this.cancelInitiativeTabPrefetch(),window.removeEventListener("hashchange",this.onBrowserNavigation),window.removeEventListener("popstate",this.onPopState),this.cancelGlobalSearchRequest(),this.events?.close(),this.events=null,this.pollTimer!==null&&(window.clearInterval(this.pollTimer),this.pollTimer=null))}applyLocalProjectChange(e){this.handleProjectChange(e),this.registerLocalChangeCorrelation(e.correlationId)}async mutateProject(e,t){const s=globalThis.crypto.randomUUID();this.registerLocalChangeCorrelation(s);try{const i=await fetch(this.buildTenantScopedPath("/api/project-mutation"),{body:JSON.stringify({correlationId:s,method:e,params:t}),cache:"no-store",headers:{"content-type":"application/json"},method:"POST"});if(!i.ok)throw new Error(`Project mutation ${e} failed.`);const r=await i.json();return this.applyLocalProjectChange(r.event),r.result}catch(i){throw this.localChangeCorrelations.delete(s),i}}registerLocalChangeCorrelation(e){if(!e)return;const t=Date.now();for(const[s,i]of this.localChangeCorrelations)i<t&&this.localChangeCorrelations.delete(s);this.localChangeCorrelations.set(e,t+lc)}openRootTab(e){this.activeRootTab.set(e)}selectSection(e){this.activeSection.set(e),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.selectedNestedTarget.set(null),this.initTab.set("overview"),this.contextSearch.set(""),this.contextTab.set("all"),this.selectedContextInitiativeId.set(null),this.activePage.set("list"),this.writeRoute(this.currentRoute()),e==="adrs"?this.loadProjectAdrs():e==="debt"?this.loadProjectDebt():e==="context"?this.loadProjectContext():e==="graph"&&this.loadProjectGraph()}setContextTab(e){this.contextTab.set(e)}setContextInitiativeFilter(e){this.selectedContextInitiativeId.set(e)}setMasterStatusFilter(e,t){if(e==="initiatives"){this.initiativeStatusFilter.set(t);return}this.adrStatusFilter.set(t)}setDebtFilter(e,t){if(e==="lifecycle"){this.debtLifecycleFilter.set(t);return}if(e==="category"){this.debtCategoryFilter.set(t);return}this.debtPriorityFilter.set(t)}setInitTab(e){this.initTab.set(e),this.writeRoute(this.currentRoute());const t=this.selectedInitiativeId.get();t&&e!=="overview"&&this.projectSummaryInitiatives.get().some(s=>s.initiative.id===t)&&this.loadInitiativeTab(t,e)}async retryInitiativeDetail(e){await this.loadInitiativeDetail(e,!0)}async retryInitiativeTab(e,t){await this.loadInitiativeTab(e,t,!0)}openSearchTarget(e){if(this.recordGlobalSearchRecent(e),e.type==="entity"){this.selectEntity(e.entityId);return}if(e.type==="plan-entry"){this.selectEntity(e.planId,{id:e.entryId,type:e.type});return}if(e.type==="issue-comment"){this.selectEntity(e.issueId,{id:e.commentId,type:e.type});return}(e.type==="context"||e.type==="context-term")&&(this.activeSection.set("context"),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.activePage.set("list"),this.contextTab.set(e.scopeRef?"initiatives":"global"),this.selectedContextInitiativeId.set(e.scopeRef??null),this.selectedNestedTarget.set(e.type==="context"?{id:null,scopeRef:e.scopeRef,type:e.type}:{id:e.term,scopeRef:e.scopeRef,type:e.type}),this.writeRoute(this.currentRoute()))}globalSearchRecentsStorageKey(){const e=this.selectedTenant.get(),t=this.selectedProjectId.get();return e&&t?`${ac}:${e}:${t}`:null}readGlobalSearchRecents(){const e=this.globalSearchRecentsStorageKey();if(!e)return[];try{const t=window.localStorage.getItem(e);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(hc).slice(0,tn):[]}catch{return[]}}recordGlobalSearchRecent(e){const t=this.globalSearchRecentsStorageKey();if(!t)return;const s=this.readGlobalSearchRecents(),i=JSON.stringify(e),r=[e,...s.filter(a=>JSON.stringify(a)!==i)].slice(0,tn);window.localStorage.setItem(t,JSON.stringify(r)),this.globalSearchRecents.set(r)}selectEntity(e,t=null){if(this.entityForId(e)?.kind==="initiative"){this.selectInitiative(e);return}this.cascadePath.set([]),this.selectedInitiativeId.set(null),this.selectedId.set(e),this.selectedNestedTarget.set(t),this.activePage.set("entity"),this.writeRoute(this.currentRoute()),this.loadEntityDetail(e),this.entityForId(e)?.kind==="issue"&&this.loadIssueCommentPage(e)}selectProjectGraphEntity(e,t){this.activeSection.set(t==="adr"?"adrs":"initiatives"),this.selectEntity(e)}openCascade(e){this.cascadeWindowStart.set(null),this.cascadePath.set([e]),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}toggleRail(){this.railCollapsed.set(!this.railCollapsed.get())}toggleMaster(){this.masterCollapsedOverride.set(!this.masterCollapsed.get())}isEpicExpanded(e){const t=this.selectedProjectId.get();return!t||!this.collapsedEpicIdsByProject.get().get(t)?.has(e)}toggleEpicExpanded(e){const t=this.selectedProjectId.get();if(!t)return;const s=new Map(this.collapsedEpicIdsByProject.get()),i=new Set(s.get(t));i.has(e)?i.delete(e):i.add(e),s.set(t,i),this.collapsedEpicIdsByProject.set(s)}clearMasterOverrideIfShallow(){this.cascadePath.get().length<2&&this.masterCollapsedOverride.set(null)}reRootCascade(e){const t=this.cascadePath.get();t.length>0&&this.reRootTrail.set([...this.reRootTrail.get(),t]),this.cascadeWindowStart.set(null),this.cascadePath.set(this.cascadePathForLeaf(e)),this.clearMasterOverrideIfShallow(),this.writeCascadeHash()}restoreReRoot(e){const t=this.reRootTrail.get(),s=t[e];s&&(this.reRootTrail.set(t.slice(0,e)),this.cascadeWindowStart.set(null),this.cascadePath.set(s),this.clearMasterOverrideIfShallow(),this.writeCascadeHash())}popReRoot(){const e=this.reRootTrail.get();e.length!==0&&this.restoreReRoot(e.length-1)}drillCascade(e,t){const s=this.cascadePath.get().indexOf(e);s!==-1&&(this.cascadeWindowStart.set(null),this.cascadePath.set([...this.cascadePath.get().slice(0,s+1),t]),this.writeCascadeHash())}restoreAncestor(e){const t=this.cascadePath.get().indexOf(e);t!==-1&&this.cascadeWindowStart.set(t)}truncateCascadeTo(e){const t=this.cascadePath.get(),s=t.indexOf(e);s===-1||s===t.length-1||(this.cascadeWindowStart.set(null),this.cascadePath.set(t.slice(0,s+1)),this.clearMasterOverrideIfShallow(),this.writeCascadeHash())}writeCascadeHash(){this.writeRoute(this.currentRoute())}selectInitiative(e){this.cancelInitiativeTabPrefetch(),this.selectedId.set(null),this.selectedInitiativeId.set(e),this.selectedNestedTarget.set(null),this.activePage.set("initiative"),this.activeSection.set("initiatives"),this.activeView.set("overview"),this.initTab.set("overview"),this.cascadePath.set([]),this.clearMasterOverrideIfShallow(),this.writeRoute(this.currentRoute()),this.isSummaryInitiative(e)&&this.loadInitiativeRoute(e,"overview")}clearSelection(){this.cancelInitiativeTabPrefetch(),this.cascadePath.set([]),this.clearMasterOverrideIfShallow(),this.selectedInitiativeId.set(null),this.selectedId.set(null),this.selectedNestedTarget.set(null),this.activePage.set("list"),this.activeView.set("overview"),this.writeRoute(this.currentRoute())}async selectTenant(e){!e||e===this.selectedTenant.get()||(this.selectedTenant.set(e),this.selectedProjectId.set(null),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery())}async returnToProjectChooser(){!this.selectedTenant.get()||!this.selectedProjectId.get()||(this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery())}async selectProject(e){if(!(!this.selectedTenant.get()||!e||e===this.selectedProjectId.get())){this.selectedProjectId.set(e),this.resetScopeDetail(),this.writeRoute(this.currentRoute()),this.stopLiveUpdates(),this.syncLabel.set("connecting");try{await this.reloadProjectSummary(),this.connectEvents()}catch(s){this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.writeRoute(this.currentRoute(),!0),this.errorMessage.set(s instanceof Error?s.message:String(s)),this.syncLabel.set("project unavailable")}}}initiativeStats(e){const t=this.projectSummaryInitiatives.get().find(a=>a.initiative.id===e.initiative.id);if(t){const a=t.issueCount>0?Math.round(t.completedIssueCount/t.issueCount*100):0;return{adrs:t.adrCount??e.adrs.length,done:t.completedIssueCount,issues:t.issueCount,pct:a,stories:t.userStoryCount}}const s=e.issues.length,i=e.issues.filter(a=>this.isDoneStatus(a.status)).length,r=s>0?Math.round(i/s*100):0;return{adrs:e.adrs.length,done:i,issues:s,pct:r,stories:e.userStories.length}}issuesForStory(e,t){const s=new Set(e.fixLinks.filter(i=>i.userStory.id===t).map(i=>i.issue.id));return this.sortEntities(e.issues.filter(i=>s.has(i.id)))}subIssuesForIssue(e,t){return this.sortEntities(e.subIssueLinks.filter(s=>s.parent.id===t).map(s=>s.issue))}parentIssueForIssue(e,t){return e.subIssueLinks.find(s=>s.issue.id===t)?.parent??null}issueTreeForStory(e,t){const s=new Map(e.subIssueLinks.map(l=>[l.issue.id,l.parent.id])),i=new Map;for(const l of e.subIssueLinks){const u=i.get(l.parent.id)??[];u.push(l.issue.id),i.set(l.parent.id,u)}const r=new Set,a=this.issuesForStory(e,t);for(const l of a){const u=[l.id];for(;u.length>0;){const d=u.shift();if(!(!d||r.has(d))){r.add(d);for(const g of i.get(d)??[])u.push(g)}}let p=l.id;for(;p;){if(r.has(p)){p=s.get(p)??null;continue}r.add(p),p=s.get(p)??null}}const o=[...r].filter(l=>{const u=s.get(l);return!u||!r.has(u)});return this.buildIssueTree(e,o,r)}issueTreeForDirectIssues(e){const t=new Set(e.userStories.flatMap(a=>this.issueTreeForStory(e,a.id).flatMap(o=>this.issueTreeNodeIds(o)))),s=new Set(e.issues.map(a=>a.id).filter(a=>!t.has(a))),i=new Map(e.subIssueLinks.map(a=>[a.issue.id,a.parent.id])),r=[...s].filter(a=>{const o=i.get(a);return!o||!s.has(o)});return this.buildIssueTree(e,r,s)}subIssueTreeForIssue(e,t){const s=new Set,i=this.subIssuesForIssue(e,t).map(r=>r.id);for(;i.length>0;){const r=i.shift();if(!(!r||s.has(r))){s.add(r);for(const a of this.subIssuesForIssue(e,r))i.push(a.id)}}return this.buildIssueTree(e,this.subIssuesForIssue(e,t).map(r=>r.id),s)}buildInitiativeGraph(e,t){const s=e.initiative,i=this.snapshot.get(),r=e.relations??i?.relations??[],a=e.relations?e.entities:i?.entities??[],o=[],l=[];new Map(e.issues.map(m=>[m.id,m]));const u=new Map,p=new Set(e.subIssueLinks.map(m=>m.issue.id)),d=new Map,g=this.sortEntities(e.entities.filter(m=>m.kind==="plan"));o.push({col:0,fullLabel:s.title,id:s.id,key:s.id,kind:"initiative",label:s.title});for(const m of g)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"plan",label:m.title,status:m.status}),l.push({from:s.id,to:m.id});for(const m of e.prds)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"prd",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.adrs)o.push({col:1,fullLabel:m.title,id:m.id,key:m.id,kind:"adr",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.userStories)o.push({col:2,fullLabel:m.title,id:m.id,key:m.id,kind:"story",label:m.title}),l.push({from:s.id,to:m.id});for(const m of e.subIssueLinks){const P=u.get(m.parent.id)??[];P.push(m.issue),u.set(m.parent.id,P)}for(const[m,P]of u)u.set(m,this.sortEntities(P));for(const m of e.fixLinks){const P=d.get(m.issue.id)??[];P.push(m.userStory.id),d.set(m.issue.id,P)}const b=this.sortEntities(e.issues.filter(m=>!p.has(m.id)));let x=0;const E=new Set,O=(m,P)=>{if(E.has(m.id)){x=Math.max(x,P);return}E.add(m.id),x=Math.max(x,P),o.push({col:3+P,fullLabel:m.title,id:m.id,key:m.id,kind:"issue",label:m.title,status:m.status});const J=d.get(m.id)??[];if(J.length>0)for(const we of J)l.push({from:we,to:m.id});else P===0&&l.push({from:s.id,to:m.id});for(const we of u.get(m.id)??[])O(we,P+1),l.push({from:m.id,to:we.id})};for(const m of b)O(m,0);for(const m of this.sortEntities(e.issues))E.has(m.id)||O(m,0);const I=["Issues"];for(let m=1;m<=x;m+=1)I.push(m===1?"Sub-issues":"Nested sub-issues");const _=3+I.length,y=this.sortEntities(a.filter(m=>m.kind==="debt"&&r.some(P=>P.fromId===s.id&&P.toId===m.id&&P.type==="records")));for(const m of y)o.push({col:_,fullLabel:m.title,id:m.id,key:m.id,kind:"debt",label:m.title,status:m.status}),l.push({from:s.id,label:"records",to:m.id});const R=new Set(o.map(m=>m.id)),T=new Set(y.map(m=>m.id)),M=new Set(g.map(m=>m.id));for(const m of r)m.type==="informs"&&M.has(m.fromId)&&R.has(m.toId)&&l.push({from:m.fromId,label:"informs",to:m.toId}),m.type==="resolves"&&R.has(m.fromId)&&T.has(m.toId)&&l.push({from:m.fromId,label:"resolves",to:m.toId}),m.type==="relatesTo"&&T.has(m.fromId)&&R.has(m.toId)&&l.push({from:m.fromId,label:"relatesTo",to:m.toId});const X={columns:["Initiative","Plans, PRDs & ADRs","User stories",...I,"Debt records"],edges:l,nodes:o};return t?sn(X,t):X}buildProjectGraph(){const e=this.projectGraphCache.get().data;if(e)return this.buildScopedProjectGraph(e);const t=this.snapshot.get(),s=this.epicInitiativeGroups.get(),i="__project",r=new Map,a=this.selectedProjectId.get(),o=[{col:0,fullLabel:this.projectDescription.get(),id:"",key:i,kind:"project",label:this.selectedTenantDisplayName.get()??""}],l=[];a&&r.set(a,i);for(const d of t?.projectAdrs??[])o.push({col:1,fullLabel:d.title,id:d.id,key:d.id,kind:"adr",label:d.title,status:d.status}),r.set(d.id,d.id),l.push({from:i,to:d.id});for(const d of s){const{epic:g}=d;o.push({col:1,fullLabel:g.title,id:g.id,key:g.id,kind:"epic",label:g.title,status:g.status}),r.set(g.id,g.id),l.push({from:i,to:g.id});for(const b of d.initiatives){const x=b.initiative,E=new Map,O=new Map;o.push({col:2,fullLabel:`${x.title} — ${b.userStories.length} stories, ${b.issues.length} issues`,id:x.id,key:x.id,kind:"initiative",label:x.title,status:x.status}),r.set(x.id,x.id),l.push({from:g.id,to:x.id});const I=[...this.sortEntities(b.entities.filter(_=>_.kind==="plan")).map(_=>({entity:_,kind:"plan"})),...b.prds.map(_=>({entity:_,kind:"prd"})),...b.adrs.map(_=>({entity:_,kind:"adr"}))];for(const{entity:_,kind:y}of I){const R=`${x.id}:${_.id}`;o.push({col:3,fullLabel:_.title,id:_.id,key:R,kind:y,label:_.title,status:_.status}),r.set(_.id,R),l.push({from:x.id,to:R})}for(const _ of this.sortEntities(b.userStories)){const y=`${x.id}:${_.id}`;E.set(_.id,y),r.set(_.id,y),o.push({col:4,fullLabel:_.title,id:_.id,key:y,kind:"story",label:_.title,status:_.status}),l.push({from:x.id,to:y})}for(const _ of b.fixLinks){const y=O.get(_.issue.id)??[];y.push(_.userStory.id),O.set(_.issue.id,y)}for(const _ of this.sortEntities(b.issues)){const y=`${x.id}:${_.id}`;r.set(_.id,y),o.push({col:5,fullLabel:_.title,id:_.id,key:y,kind:"issue",label:_.title,status:_.status});const R=(O.get(_.id)??[]).map(T=>E.get(T)).filter(T=>!!T);if(R.length>0)for(const T of R)l.push({from:T,to:y});else l.push({from:x.id,to:y})}}}const u=new Map,p=this.sortEntities((t?.entities??[]).filter(d=>d.kind==="debt"));for(const d of p){const g=(t?.relations??[]).find(x=>x.fromId!==d.id&&x.toId===d.id&&x.type==="records"),b=g?r.get(g.fromId):void 0;b&&(u.set(d.id,d.id),o.push({col:6,fullLabel:d.title,id:d.id,key:d.id,kind:"debt",label:d.title,status:d.status}),l.push({from:b,label:"records",to:d.id}))}for(const d of t?.relations??[]){if(d.type==="informs"){const g=r.get(d.fromId),b=r.get(d.toId);g&&b&&l.push({from:g,label:"informs",to:b})}if(d.type==="resolves"){const g=r.get(d.fromId),b=u.get(d.toId);g&&b&&l.push({from:g,label:"resolves",to:b})}if(d.type==="relatesTo"){const g=u.get(d.fromId),b=r.get(d.toId)??u.get(d.toId);g&&b&&l.push({from:g,label:"relatesTo",to:b})}}return sn({columns:["Project","Epics","Initiatives","Plans, PRDs & ADRs","User stories","Issues","Debt records"],edges:l,nodes:o},this.visibleProjectGraphKinds.get())}buildScopedProjectGraph(e){const t=this.sortEntities(e.records),s=[...new Set(t.map(l=>l.kind==="userStory"?"story":l.kind).filter(l=>ze.includes(l)))],i=new Map(s.map((l,u)=>[l,u])),r=new Set(t.map(l=>l.id)),a=t.flatMap(l=>{const u=l.kind==="userStory"?"story":l.kind,p=i.get(u);return p===void 0?[]:[{col:p,fullLabel:l.title,id:l.id,key:l.id,kind:u,label:l.title,status:l.status}]}),o=e.relations.filter(l=>r.has(l.fromId)&&r.has(l.toId)).map(l=>({from:l.fromId,label:l.type,to:l.toId}));return{columns:s.map(l=>l==="story"?"User stories":`${l.slice(0,1).toUpperCase()}${l.slice(1)}s`),edges:o,nodes:a}}toggleProjectGraphKind(e){const t=new Set(this.visibleProjectGraphKinds.get());t.has(e)?t.delete(e):t.add(e),this.visibleProjectGraphKinds.set(t)}isDoneStatus(e){return e==="done"||e==="complete"||e==="closed"}sortIssuesByExpectedCompletion(e,t){const s=new Map(e.map(g=>[g.id,g])),i=new Map(e.map((g,b)=>[g.id,b])),r=new Map(e.map(g=>[g.id,0])),a=new Map(e.map(g=>[g.id,[]])),o=new Set,l=(g,b)=>+!this.isDoneStatus(g.status)-+!this.isDoneStatus(b.status)||i.get(g.id)-i.get(b.id);for(const g of t.blockerLinks){if(!s.has(g.source.id)||!s.has(g.target.id)||!this.isDoneStatus(g.source.status)&&this.isDoneStatus(g.target.status))continue;const b=`${g.source.id}:${g.target.id}`;o.has(b)||(o.add(b),r.set(g.target.id,r.get(g.target.id)+1),a.get(g.source.id).push(g.target.id))}const u=e.filter(g=>r.get(g.id)===0),p=[],d=new Set;for(;u.length>0;){u.sort(l);const g=u.shift();if(!d.has(g.id)){d.add(g.id),p.push(g);for(const b of a.get(g.id)??[]){const x=r.get(b)-1;r.set(b,x),x===0&&u.push(s.get(b))}}}return[...p,...e.filter(g=>!d.has(g.id)).sort(l)]}issueStatusTone(e){return this.isDoneStatus(e)?"done":e==="blocked"||e==="paused"?"blocked":"open"}formatKindLabel(e){return e==="all"?"All work items":e==="userStory"?"User story":e==="prd"?"PRD":e==="adr"?"ADR":e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Unknown"}statusTone(e){return e==="blocked"||e==="paused"?"warn":e==="cancelled"?"danger":e==="archived"||e==="done"||e==="complete"||e==="closed"?"neutral":"success"}badgeTone(e){return e==="done"||e==="complete"||e==="closed"?"done":e==="blocked"||e==="cancelled"?"danger":e==="ready"||e==="in-progress"?"info":e==="paused"?"warn":e==="active"||e==="current"||e==="approved"?"success":"neutral"}compactPath(e){const t=e.split("/").filter(Boolean);return t.length<=3?e:`.../${t.slice(-3).join("/")}`}formatTimestamp(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}truncate(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-3)).trimEnd()}...`}shortRef(e){return uc(e)}buildOpenedText(e){const t=this.selectedBundle.get(),s=t?`inside ${t.initiative.id}`:"outside a visible initiative bundle";return`Opened ${this.formatTimestamp(e.createdAt)} and currently ${s}. Last updated ${this.formatTimestamp(e.updatedAt)}.`}buildSummaryBody(e){const t=this.selectedBundle.get(),s=this.selectedContext.get(),i=this.selectedIncoming.get(),r=this.selectedOutgoing.get(),a=this.orphanIds.get(),o=t?`It currently sits in ${t.initiative.id}, which includes ${t.prds.length} PRDs, ${t.userStories.length} stories, ${t.adrs.length} ADRs, and ${t.issues.length} issues.`:"It is not currently connected to a visible initiative bundle in this snapshot.",l=a.has(e.id)?"This record is marked as orphaned from the initiative structure.":"This record remains connected to the main initiative structure.",u=s?`${s.context.title} is currently ${s.context.exists?"stored":"using its default shell"} with ${s.terms.length} defined terms.`:"No context is currently available for this record.";return`${e.id} is a ${this.formatKindLabel(e.kind).toLowerCase()} with ${i.length} incoming links and ${r.length} outgoing links. ${o} ${u} ${l}`}buildRelationSentence(e){return`${e.fromId} ${e.type} ${e.toId}`}relationLabel(e,t){const s={blocks:"Blocked by",constrains:"Constrained by",decomposes:"Parent issue",creates:"Created by",fixes:"Fixed by",handsOff:"Incoming handoffs",owns:"Owned by",records:"Recorded by",resolves:"Resolved by",tracks:"Tracked by"},i={blocks:"Blocks",constrains:"Constrains",decomposes:"Sub-issues",creates:"Creates",fixes:"Fixes",relatesTo:"Related records",resolves:"Resolves debt",owns:"Owns",records:"Records",tracks:"Tracks"};return t?s[e]??`${e} (incoming)`:i[e]??e}detailMeta(e){return this.detailMetaFor(e.id)}detailMetaFor(e){const t=e?this.entityById.get().get(e)??null:null,s=this.bundleForEntityId(e),i=t?this.incomingRelationsFor(t.id).find(u=>u.type==="records")?.fromId:null,r=i?this.entityById.get().get(i)??null:null,a=t?.kind==="debt"?[["Category",t.category??"—"],["Priority",t.priority??"—"],["Lifecycle",t.status],["Owner",r?`${this.shortRef(r)} ${r.title}`:"—"]]:[],o=t?.kind==="debt"?[]:[["Status",t?.status??"—"]],l=t?.type?[["Type",t.type]]:[];return[["Initiative",s?`${this.shortRef(s.initiative)} ${s.initiative.title}`:"—"],...a,...o,...l,["Created",t?this.formatTimestamp(t.createdAt):"—"],["Updated",t?this.formatTimestamp(t.updatedAt):"—"]]}linkedRecordSections(e){return this.linkedRecordSectionsFor(this.selectedId.get(),e)}linkedRecordSectionsFor(e,t){const s=new Set(["owns","creates","fixes","decomposes","tracks","constrains"]),i=new Map,r=new Set(t?.excludeRelationTypes??[]),a=new Set(t?.excludeRelatedIds??[]),o=(l,u,p)=>{if(a.has(l))return;const d=this.entityById.get().get(l);if(!d)return;const g=i.get(u)??{crossLink:!s.has(p),records:[]};g.records.push(d),i.set(u,g)};for(const l of this.outgoingRelationsFor(e))r.has(l.type)||o(l.toId,this.relationLabel(l.type,!1),l.type);for(const l of this.incomingRelationsFor(e))r.has(l.type)||o(l.fromId,this.relationLabel(l.type,!0),l.type);return[...i.entries()].map(([l,u])=>({crossLink:u.crossLink,key:l,records:this.sortEntities(u.records),title:l}))}debtRecordSectionsFor(e){const t=e?this.entityById.get().get(e)??null:null;if(!t||!["project","epic","initiative","issue"].includes(t.kind))return[];const s=this.outgoingRelationsFor(t.id).filter(r=>r.type==="records").map(r=>this.entityById.get().get(r.toId)).filter(r=>r?.kind==="debt"),i=["epic","initiative","issue"].includes(t.kind)?this.outgoingRelationsFor(t.id).filter(r=>r.type==="resolves").map(r=>this.entityById.get().get(r.toId)).filter(r=>r?.kind==="debt"):[];return[...s.length>0?[{key:"owned-debt",records:this.sortEntities(s),title:"Owned debt"}]:[],...i.length>0?[{key:"resolved-debt",records:this.sortEntities(i),title:"Resolves debt"}]:[]]}planProjectionFor(e){const t=[...this.planEntriesFor(e)].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.reference.localeCompare(a.reference)),s=new Set(t.flatMap(r=>r.supersededEntryIds)),i=t.filter(r=>!r.tombstone&&!s.has(r.id));return{current:cc.map(r=>({key:r.key,title:r.title,entries:i.filter(a=>bc(a,r.key))})),history:t}}closeEntity(){const e=this.selectedBundle.get();if(this.selectedId.set(null),this.selectedNestedTarget.set(null),this.activeSection.get()!=="adrs"&&e){this.selectedInitiativeId.set(e.initiative.id),this.activePage.set("initiative"),this.writeRoute(this.currentRoute());return}this.activePage.set("list"),this.writeRoute(this.currentRoute())}getContextForInitiative(e){return this.initiativeTabForId(e,"context")?.context??this.initiativeContextById.get().get(e)??null}async bootstrap(){try{const e=await this.fetchJson("site-config.json");this.config.set(e);const t=this.readRoute(),s={...t,tenantId:t.tenantId??e.currentTenant};this.selectedTenant.set(s.tenantId),await this.reloadProjectDiscovery(),await this.navigateToRoute(s),this.writeRoute(this.currentRoute(),!0)}catch(e){this.errorMessage.set(e instanceof Error?e.message:String(e)),this.syncLabel.set("load failed")}}async reloadProjectSummary(){const e=this.selectedTenant.get(),t=this.selectedProjectId.get(),s=await this.fetchJson(this.buildTenantScopedPath("/api/project-summary"));if(!(this.selectedTenant.get()!==e||this.selectedProjectId.get()!==t)){if(s.kind==="unavailable")throw new Error("Selected project is unavailable.");this.projectSummary.set(s),this.snapshot.set(null),this.errorMessage.set(null),this.syncLabel.set("listening")}}refreshProjectSummaryInBackground(){this.reloadProjectSummary().catch(e=>{this.errorMessage.set(e instanceof Error?e.message:String(e)),this.syncLabel.set("refresh failed")})}async loadInitiativeDetail(e,t=!1){const s=this.initiativeDetails.get().get(e);if(s?.loading||!t&&s?.detail&&!s.stale)return;const i=this.selectedTenant.get(),r=this.selectedProjectId.get();this.setInitiativeDetailCache(e,{detail:s?.detail??null,error:null,loading:!0,stale:s?.stale});try{const a=await this.fetchJson(this.buildTenantScopedPath(`/api/initiative-detail?initiative=${encodeURIComponent(e)}`));if(this.selectedTenant.get()!==i||this.selectedProjectId.get()!==r)return;if(!("initiative"in a)){this.selectedInitiativeId.get()===e&&this.clearSelection();return}this.setInitiativeDetailCache(e,{detail:a,error:null,loading:!1})}catch(a){if(this.selectedTenant.get()===i&&this.selectedProjectId.get()===r){const o=this.initiativeDetails.get().get(e);this.setInitiativeDetailCache(e,{detail:o?.detail??s?.detail??null,error:a instanceof Error?a.message:String(a),loading:!1,stale:o?.stale??s?.stale})}}}async loadInitiativeRoute(e,t){await this.loadInitiativeDetail(e),!(this.selectedInitiativeId.get()!==e||!this.initiativeDetailForId(e))&&(t!=="overview"&&this.initTab.get()===t&&await this.loadInitiativeTab(e,t),this.selectedInitiativeId.get()===e&&this.startInitiativeTabPrefetch(e))}async retryProjectAdrs(){await this.loadProjectAdrs(!0)}async loadProjectAdrs(e=!1){const t=this.projectAdrsCache.get();if(t.loading||!e&&t.data&&!t.stale)return;const s=this.selectedTenant.get(),i=this.selectedProjectId.get();this.projectAdrsCache.set({data:t.data,error:null,loading:!0,stale:t.stale});try{const r=await this.fetchJson(this.buildTenantScopedPath("/api/project-adrs"));this.selectedTenant.get()===s&&this.selectedProjectId.get()===i&&this.projectAdrsCache.set({data:r,error:null,loading:!1})}catch(r){if(this.selectedTenant.get()===s&&this.selectedProjectId.get()===i){const a=this.projectAdrsCache.get();this.projectAdrsCache.set({data:a.data,error:r instanceof Error?r.message:String(r),loading:!1,stale:a.stale??t.stale})}}}async retryProjectDebt(){await this.loadProjectDebt(!0)}async loadProjectDebt(e=!1){await this.loadProjectRecordData("/api/project-debt",this.projectDebtCache,e)}async retryProjectContext(){await this.loadProjectContext(!0)}async loadProjectContext(e=!1){const t=this.projectContextCache.get();if(t.loading||!e&&t.data&&!t.stale)return;const s=this.selectedTenant.get(),i=this.selectedProjectId.get();this.projectContextCache.set({data:t.data,error:null,loading:!0,stale:t.stale});try{const r=await this.fetchJson(this.buildTenantScopedPath("/api/project-context"));this.selectedTenant.get()===s&&this.selectedProjectId.get()===i&&this.projectContextCache.set({data:r,error:null,loading:!1})}catch(r){if(this.selectedTenant.get()===s&&this.selectedProjectId.get()===i){const a=this.projectContextCache.get();this.projectContextCache.set({data:a.data,error:r instanceof Error?r.message:String(r),loading:!1,stale:a.stale??t.stale})}}}async retryProjectGraph(){await this.loadProjectGraph(!0)}async loadProjectGraph(e=!1){await this.loadProjectRecordData("/api/project-graph",this.projectGraphCache,e)}async loadProjectRecordData(e,t,s){const i=t.get();if(i.loading||!s&&i.data&&!i.stale)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();t.set({data:i.data,error:null,loading:!0,stale:i.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(e));this.selectedTenant.get()===r&&this.selectedProjectId.get()===a&&t.set({data:o,error:null,loading:!1})}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=t.get();t.set({data:l.data,error:o instanceof Error?o.message:String(o),loading:!1,stale:l.stale??i.stale})}}}async loadPlanEntryPage(e,t=!1,s){const i=this.planEntryPages.get().get(e);if(i?.loading||!t&&i?.data&&!i.stale&&!s)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();this.setPlanEntryPageCache(e,{data:i?.data??null,error:null,loading:!0,stale:i?.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(`/api/plan-entries?plan=${encodeURIComponent(e)}${s?`&before=${encodeURIComponent(s)}`:""}`));if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=s?[...new Map([...i?.data?.entries??[],...o.entries].map(u=>[u.id,u])).values()]:o.entries;this.setPlanEntryPageCache(e,{data:{...o,entries:l},error:null,loading:!1})}}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=this.planEntryPages.get().get(e);this.setPlanEntryPageCache(e,{data:l?.data??i?.data??null,error:o instanceof Error?o.message:String(o),loading:!1,stale:l?.stale??i?.stale})}}}setPlanEntryPageCache(e,t){const s=new Map(this.planEntryPages.get());s.set(e,t),this.planEntryPages.set(s)}async loadIssueCommentPage(e,t=!1,s){const i=this.issueCommentPages.get().get(e);if(i?.loading||!t&&i?.data&&!i.stale&&!s)return;const r=this.selectedTenant.get(),a=this.selectedProjectId.get();this.setIssueCommentPageCache(e,{data:i?.data??null,error:null,loading:!0,stale:i?.stale});try{const o=await this.fetchJson(this.buildTenantScopedPath(`/api/issue-comments?issue=${encodeURIComponent(e)}${s?`&before=${encodeURIComponent(s)}`:""}`));if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=s?[...new Map([...i?.data?.comments??[],...o.comments].map(p=>[p.id,p])).values()]:o.comments,u=s?[...new Map([...i?.data?.users??[],...o.users].map(p=>[p.id,p])).values()]:o.users;this.setIssueCommentPageCache(e,{data:{...o,comments:l,users:u},error:null,loading:!1})}}catch(o){if(this.selectedTenant.get()===r&&this.selectedProjectId.get()===a){const l=this.issueCommentPages.get().get(e);this.setIssueCommentPageCache(e,{data:l?.data??i?.data??null,error:o instanceof Error?o.message:String(o),loading:!1,stale:l?.stale??i?.stale})}}}setIssueCommentPageCache(e,t){const s=new Map(this.issueCommentPages.get());s.set(e,t),this.issueCommentPages.set(s)}entityDetailForId(e){return e?this.entityDetails.get().get(e)?.detail??null:null}async retryEntityDetail(e){await this.loadEntityDetail(e,!0)}async loadEntityDetail(e,t=!1){const s=this.entityDetails.get().get(e);if(s?.loading||!t&&s?.detail&&!s.stale)return;const i=this.selectedTenant.get(),r=this.selectedProjectId.get();this.setEntityDetailCache(e,{detail:s?.detail??null,error:null,loading:!0,stale:s?.stale});try{const a=await this.fetchJson(this.buildTenantScopedPath(`/api/entity-detail?entity=${encodeURIComponent(e)}`));if(this.selectedTenant.get()!==i||this.selectedProjectId.get()!==r)return;if(!("entity"in a)){this.selectedId.get()===e&&this.clearSelection();return}this.setEntityDetailCache(e,{detail:a,error:null,loading:!1}),a.entity.kind==="issue"&&this.loadIssueCommentPage(e)}catch(a){if(this.selectedTenant.get()===i&&this.selectedProjectId.get()===r){const o=this.entityDetails.get().get(e);this.setEntityDetailCache(e,{detail:o?.detail??s?.detail??null,error:a instanceof Error?a.message:String(a),loading:!1,stale:o?.stale??s?.stale})}}}setEntityDetailCache(e,t){const s=new Map(this.entityDetails.get());s.set(e,t),this.entityDetails.set(s)}setInitiativeDetailCache(e,t){const s=new Map(this.initiativeDetails.get());s.set(e,t),this.initiativeDetails.set(s)}async loadInitiativeTab(e,t,s=!1){const i=this.initiativeTabCacheKey(e,t),r=this.initiativeTabs.get().get(i);if(r?.loading||!s&&r?.data&&!r.stale)return;const a=this.selectedTenant.get(),o=this.selectedProjectId.get();this.setInitiativeTabCache(i,{data:r?.data??null,error:null,loading:!0,stale:r?.stale});try{const l=await this.fetchJson(this.buildTenantScopedPath(`/api/initiative-tab?initiative=${encodeURIComponent(e)}&tab=${t}`));if(this.selectedTenant.get()!==a||this.selectedProjectId.get()!==o)return;this.setInitiativeTabCache(i,{data:l,error:null,loading:!1})}catch(l){if(this.selectedTenant.get()===a&&this.selectedProjectId.get()===o){const u=this.initiativeTabs.get().get(i);this.setInitiativeTabCache(i,{data:u?.data??r?.data??null,error:l instanceof Error?l.message:String(l),loading:!1,stale:u?.stale??r?.stale})}}}startInitiativeTabPrefetch(e){if(this.cancelInitiativeTabPrefetch(),!this.connected)return;const t=this.initiativeTabPrefetchGeneration,s=[...pc],i=()=>{t!==this.initiativeTabPrefetchGeneration||this.selectedInitiativeId.get()!==e||s.length===0||(this.initiativeTabPrefetchTimer=window.setTimeout(()=>{this.initiativeTabPrefetchTimer=null,r()},oc))},r=async()=>{if(t!==this.initiativeTabPrefetchGeneration||this.selectedInitiativeId.get()!==e)return;const a=s[0];if(!a)return;const o=this.initiativeTabs.get().get(this.initiativeTabCacheKey(e,a));if(o?.loading){i();return}s.shift(),(!o?.data||o.stale)&&await this.loadInitiativeTab(e,a),i()};i()}cancelInitiativeTabPrefetch(){this.initiativeTabPrefetchGeneration+=1,this.initiativeTabPrefetchTimer!==null&&(window.clearTimeout(this.initiativeTabPrefetchTimer),this.initiativeTabPrefetchTimer=null)}initiativeTabCacheKey(e,t){return`${e}:${t}`}setInitiativeTabCache(e,t){const s=new Map(this.initiativeTabs.get());s.set(e,t),this.initiativeTabs.set(s)}async reloadProjectDiscovery(){try{this.projectDiscovery.set(await this.fetchJson(this.buildTenantScopedPath("/api/projects"))),this.errorMessage.set(null)}catch(e){this.projectDiscovery.set({kind:"unavailable"}),this.errorMessage.set(e instanceof Error?e.message:String(e))}}async navigateToRoute(e){const t=e.tenantId!==this.selectedTenant.get()||e.projectId!==this.selectedProjectId.get();if(this.selectedTenant.set(e.tenantId),this.selectedProjectId.set(e.projectId),t&&this.resetScopeDetail(),!e.projectId){this.snapshot.set(null),this.projectSummary.set(null),this.syncLabel.set("choose a project"),await this.reloadProjectDiscovery(),this.applyRoute(e);return}this.stopLiveUpdates(),this.syncLabel.set("connecting");try{await this.reloadProjectSummary(),this.connectEvents(),this.applyRoute(e)}catch(s){this.selectedProjectId.set(null),this.snapshot.set(null),this.projectSummary.set(null),this.writeRoute(this.currentRoute(),!0),this.errorMessage.set(s instanceof Error?s.message:String(s)),this.syncLabel.set("project unavailable")}}resetScopeDetail(){this.cancelInitiativeTabPrefetch(),this.cancelGlobalSearchRequest(),this.globalSearchCapability.set(null),this.globalSearchQuery.set(""),this.globalSearchResponse.set(null),this.globalSearchProgress.set(!1),this.globalSearchOpen.set(!1),this.entityDetails.set(new Map),this.projectAdrsCache.set({data:null,error:null,loading:!1}),this.projectDebtCache.set({data:null,error:null,loading:!1}),this.projectContextCache.set({data:null,error:null,loading:!1}),this.projectGraphCache.set({data:null,error:null,loading:!1}),this.planEntryPages.set(new Map),this.issueCommentPages.set(new Map),this.initiativeDetails.set(new Map),this.initiativeTabs.set(new Map),this.selectedId.set(null),this.selectedInitiativeId.set(null),this.selectedNestedTarget.set(null),this.cascadePath.set([]),this.reRootTrail.set([]),this.activeSection.set("initiatives"),this.activePage.set("list"),this.activeView.set("overview"),this.initTab.set("overview"),this.initiativeStatusFilter.set("all"),this.adrStatusFilter.set("all"),this.clearMasterOverrideIfShallow()}connectEvents(){if(typeof EventSource!="function"){this.startPolling();return}this.events=new EventSource(this.buildTenantScopedPath("/events")),this.events.onmessage=e=>{this.handleProjectChangeEvent(e)},this.events.onerror=()=>{this.syncLabel.set("reconnecting"),this.startPolling()}}handleProjectChangeEvent(e){let t;try{t=JSON.parse(e.data)}catch{this.refreshProjectSummaryInBackground();return}if(t.correlationId){const s=this.localChangeCorrelations.get(t.correlationId);if(this.localChangeCorrelations.delete(t.correlationId),s!==void 0&&s>=Date.now())return}this.handleProjectChange(t)}handleProjectChange(e){if(e.projectId&&e.projectId!==this.selectedProjectId.get())return;if(!e.category||e.category==="bulk"||e.category==="unknown"){this.refreshProjectSummaryInBackground();return}const t=this.selectedId.get(),s=fc(e);let i=!1;if(e.category==="entity"){for(const a of e.affectedEntityIds??[]){const o=this.entityDetails.get().get(a);o&&(this.setEntityDetailCache(a,{...o,stale:!0}),i=!0)}if(t&&e.affectedEntityIds?.includes(t)&&(this.loadEntityDetail(t,!0),i=!0),e.affectedEntityKinds?.includes("adr")){const a=this.projectAdrsCache.get();a.data&&this.projectAdrsCache.set({...a,stale:!0}),this.activeSection.get()==="adrs"&&this.activePage.get()==="list"&&this.loadProjectAdrs(!0),i=!0}if(e.affectedEntityKinds?.includes("debt")){const a=this.projectDebtCache.get();a.data&&this.projectDebtCache.set({...a,stale:!0}),this.activeSection.get()==="debt"&&this.activePage.get()==="list"&&this.loadProjectDebt(!0),i=!0}const r=this.projectGraphCache.get();r.data&&this.projectGraphCache.set({...r,stale:!0}),this.activeSection.get()==="graph"&&this.activePage.get()==="list"&&(this.loadProjectGraph(!0),i=!0)}if(e.category==="issue-comment")for(const r of e.affectedEntityIds??[]){const a=this.issueCommentPages.get().get(r);a&&(this.setIssueCommentPageCache(r,{...a,stale:!0}),i=!0),t===r&&(this.loadIssueCommentPage(r,!0),i=!0)}if(e.category==="plan-entry")for(const r of e.affectedEntityIds??[]){const a=this.planEntryPages.get().get(r),o=a!==void 0||this.entityForId(r)?.kind==="plan";a&&(this.setPlanEntryPageCache(r,{...a,stale:!0}),i=!0),t===r&&o&&(this.loadPlanEntryPage(r,!0),i=!0);const l=this.entityDetails.get().get(r);l&&!o&&(this.setEntityDetailCache(r,{...l,stale:!0}),i=!0),t===r&&!o&&(this.loadEntityDetail(r,!0),i=!0)}if(e.category==="context"){const r=this.projectContextCache.get();r.data&&this.projectContextCache.set({...r,stale:!0}),this.activeSection.get()==="context"&&this.activePage.get()==="list"&&this.loadProjectContext(!0),i=!0}if(e.category==="relation"){for(const a of e.affectedEntityIds??[]){const o=this.entityDetails.get().get(a);o&&(this.setEntityDetailCache(a,{...o,stale:!0}),i=!0),t===a&&(this.loadEntityDetail(a,!0),i=!0)}const r=this.projectGraphCache.get();r.data&&this.projectGraphCache.set({...r,stale:!0}),this.activeSection.get()==="graph"&&this.activePage.get()==="list"&&this.loadProjectGraph(!0),i=!0}for(const r of e.affectedInitiativeIds??[]){if(e.affectedEntityIds?.includes(r)){const a=this.initiativeDetails.get().get(r);a&&(this.setInitiativeDetailCache(r,{...a,stale:!0}),i=!0),this.selectedInitiativeId.get()===r&&this.initTab.get()==="overview"&&(this.loadInitiativeDetail(r,!0),i=!0)}for(const[a,o]of this.initiativeTabs.get()){const l=a.slice(`${r}:`.length);a.startsWith(`${r}:`)&&s.has(l)&&(this.setInitiativeTabCache(a,{...o,stale:!0}),i=!0)}this.selectedInitiativeId.get()===r&&this.initTab.get()!=="overview"&&s.has(this.initTab.get())&&(this.loadInitiativeTab(r,this.initTab.get(),!0),i=!0)}if(i){e.affectsProjectSummary&&this.refreshProjectSummaryInBackground();return}this.refreshProjectSummaryInBackground()}startPolling(){this.pollTimer===null&&(this.pollTimer=window.setInterval(()=>{this.refreshProjectSummaryInBackground()},3e3))}async fetchJson(e){const t=e.includes("?")?"&":"?",s=await fetch(`${e}${t}ts=${Date.now()}`,{cache:"no-store"});if(!s.ok)throw new Error(`Request failed for ${e}`);return await s.json()}sortEntities(e){return[...e].sort((t,s)=>{const i=new Date(t.updatedAt).getTime(),r=new Date(s.updatedAt).getTime();return i!==r?r-i:t.id.localeCompare(s.id)})}buildIssueTree(e,t,s){const i=new Map(e.issues.map(l=>[l.id,l])),r=new Map;for(const l of e.subIssueLinks){if(!s.has(l.parent.id)||!s.has(l.issue.id))continue;const u=r.get(l.parent.id)??[];u.push(l.issue.id),r.set(l.parent.id,u)}const a=l=>{const u=i.get(l);if(!u)return null;const p=this.sortEntities((r.get(l)??[]).map(d=>i.get(d)).filter(d=>!!d));return{issue:u,children:p.map(d=>a(d.id)).filter(d=>d!==null)}};return this.sortEntities(t.map(l=>i.get(l)).filter(l=>!!l)).map(l=>a(l.id)).filter(l=>l!==null)}issueTreeNodeIds(e){return[e.issue.id,...e.children.flatMap(t=>this.issueTreeNodeIds(t))]}formatTenantDisplayName(e){return e.replace(/-[0-9a-f]{12}$/i,"").split(/[-_]+/).filter(t=>t.length>0).map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`).join(" ")}readTenantFromUrl(){return this.readRoute().tenantId}readProjectFromUrl(){return this.readRoute().projectId}currentRoute(){return{tenantId:this.selectedTenant.get(),projectId:this.selectedProjectId.get(),page:this.activePage.get(),section:this.activeSection.get(),entityId:this.selectedId.get(),initiativeId:this.selectedInitiativeId.get(),initiativeTab:this.initTab.get(),target:this.selectedNestedTarget.get()}}readRoute(){const e=new URL(window.location.href),t=new URLSearchParams(e.hash.slice(1)),s=e.searchParams,i=t.get("tenant")??s.get("tenant"),r=t.get("project")??s.get("project"),a=t.get("section"),o=t.get("entity"),l=t.get("initiative"),u=t.get("page"),p=u==="entity"?"entity":u==="initiative"?"initiative":u==="project"?"list":o?"entity":l?"initiative":"list",d=t.get("tab"),g=Nn.includes(d)?d:"overview",b=t.get("target"),x=t.get("target-id"),E=t.get("target-scope")??void 0,O=b==="context"?{id:null,scopeRef:E,type:"context"}:x&&b==="context-term"?{id:x,scopeRef:E,type:b}:x&&(b==="context-term"||b==="issue-comment"||b==="plan-entry")?{type:b,id:x}:null;return{tenantId:i,projectId:r,page:p,section:Gl(a)?a:"initiatives",entityId:o,initiativeId:l,initiativeTab:g,target:O}}normalizeRoute(e){const t=this.entityById.get();if(t.size===0)return e;const s=e.page==="entity"&&e.entityId&&(this.snapshot.get()===null||t.has(e.entityId))?e.entityId:null,i=e.page==="initiative"&&e.initiativeId&&this.bundleForInitiativeId(e.initiativeId)?e.initiativeId:null;return{...e,page:s?"entity":i?"initiative":"list",entityId:s,initiativeId:i,initiativeTab:i?e.initiativeTab:"overview",target:this.normalizeNestedTarget(e.target,s)}}normalizeNestedTarget(e,t){if(!e)return null;if(e.type==="plan-entry")return(this.snapshot.get()?.planEntries??[]).find(r=>r.id===e.id&&r.planId===t&&!r.tombstone)?e:null;if(e.type==="issue-comment")return(t?this.snapshot.get()?.issueComments[t]?.comments.find(r=>r.id===e.id&&!r.tombstone):null)?e:null;const s=e.scopeRef?this.getContextForInitiative(e.scopeRef):this.sharedContext.get();return s?.context.exists&&(e.type==="context"||s.terms.some(i=>i.term===e.id))?e:null}applyRoute(e,t=!0){const s=this.normalizeRoute(e);return s.initiativeId!==this.selectedInitiativeId.get()&&this.cancelInitiativeTabPrefetch(),this.selectedTenant.set(s.tenantId),this.selectedProjectId.set(s.projectId),this.activeSection.set(s.section),this.selectedId.set(s.entityId),this.selectedInitiativeId.set(s.initiativeId),this.initTab.set(s.initiativeTab),this.selectedNestedTarget.set(s.target),(s.target?.type==="context"||s.target?.type==="context-term")&&(this.contextTab.set(s.target.scopeRef?"initiatives":"global"),this.selectedContextInitiativeId.set(s.target.scopeRef??null)),this.cascadePath.set([]),this.reRootTrail.set([]),this.clearMasterOverrideIfShallow(),this.activePage.set(s.page),this.activeView.set("overview"),t&&(s.entityId?this.loadEntityDetail(s.entityId):s.initiativeId&&this.isSummaryInitiative(s.initiativeId)?this.loadInitiativeRoute(s.initiativeId,s.initiativeTab):s.section==="adrs"?this.loadProjectAdrs():s.section==="debt"?this.loadProjectDebt():s.section==="context"?this.loadProjectContext():s.section==="graph"&&this.loadProjectGraph()),s}writeRoute(e,t=!1){const s=new URL(window.location.href),i=[],r=(a,o)=>{o&&i.push(`${a}=${encodeURIComponent(o)}`)};r("tenant",e.tenantId),r("project",e.projectId),r("page",e.projectId?e.page==="list"?"project":e.page:null),r("section",e.section==="initiatives"?null:e.section),r("entity",e.entityId),r("initiative",e.initiativeId),r("tab",e.page==="initiative"?e.initiativeTab:null),r("target",e.target?.type??null),r("target-id",e.target?.id??null),r("target-scope",e.target?.scopeRef??null),s.searchParams.delete("tenant"),s.searchParams.delete("project"),s.hash=i.join("&"),window.history[t?"replaceState":"pushState"]({},"",s)}buildTenantScopedPath(e){const t=this.selectedTenant.get(),s=this.selectedProjectId.get();if(!t&&!s)return e;const i=e.includes("?")?"&":"?",r=new URLSearchParams;return t&&r.set("tenant",t),s&&r.set("project",s),r.size>0?`${e}${i}${r}`:e}stopLiveUpdates(){this.events?.close(),this.events=null,this.pollTimer!==null&&(window.clearInterval(this.pollTimer),this.pollTimer=null)}}function rn(n){return new Set(n.map(t=>t.definition.trim().toLowerCase()).filter(t=>t.length>0)).size>1}function bc(n,e){switch(e){case"questions":return n.role==="question";case"decisions":return n.role==="decision";case"includedScope":return n.role==="scope"&&n.scopeDirection==="included";case"excludedScope":return n.role==="scope"&&n.scopeDirection==="excluded";case"constraints":return n.role==="constraint";case"preferences":return n.role==="preference";case"considerations":return n.role==="consideration"}}function vc(n,e){return n.scopeKind!==e.scopeKind?n.scopeKind==="default"?-1:1:n.scopeLabel!==e.scopeLabel?n.scopeLabel.localeCompare(e.scopeLabel):n.contextKey.localeCompare(e.contextKey)}const Gs="tenant-switcher-menu",nn="agent-issues-theme",Ei=class Ei extends rs(de){constructor(){super(...arguments),this.store=new mc,this.medium=!1,this.narrow=!1,this.mobileMasterOpen=!1,this.theme="light",this.globalSearchTrigger=null,this.onSelectTenant=e=>{const t=e.currentTarget.dataset.tenant;t&&this.store.selectTenant(t)},this.onSelectSection=e=>{const t=e.currentTarget.dataset.section;t&&(this.store.selectSection(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSelectInitiative=e=>{const t=e.currentTarget.dataset.initiative;t&&(this.store.selectInitiative(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSelectProject=e=>{const t=e.currentTarget.dataset.project;t&&this.store.selectProject(t)},this.onOpenProjectChooser=()=>{this.store.returnToProjectChooser()},this.onSelectEntity=e=>{const t=e.currentTarget.dataset.id;t&&(this.store.selectEntity(t),this.mobileMasterOpen=!1,this.requestUpdate())},this.onSearchInput=e=>{this.store.search.set(e.target.value)},this.onOpenGlobalSearch=e=>{this.globalSearchTrigger=e.currentTarget,this.store.openGlobalSearch()},this.onCloseGlobalSearch=()=>{this.store.closeGlobalSearch(),this.globalSearchTrigger?.focus()},this.onOpenGlobalSearchTarget=e=>{this.store.openSearchTarget(e.detail),this.onCloseGlobalSearch()},this.onRetryGlobalSearch=()=>{this.store.retryGlobalSearch()},this.onRetryProjectSection=e=>{const t=e.currentTarget.dataset.section;t==="adrs"?this.store.retryProjectAdrs():t==="debt"?this.store.retryProjectDebt():t==="context"?this.store.retryProjectContext():t==="graph"&&this.store.retryProjectGraph()},this.onWindowKeyDown=e=>{const t=e.target;e.key.toLowerCase()!=="k"||!e.metaKey&&!e.ctrlKey||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t?.isContentEditable||(e.preventDefault(),this.globalSearchTrigger=document.activeElement instanceof HTMLElement?document.activeElement:this.shadowRoot?.querySelector("[data-global-search-trigger]")??null,this.store.openGlobalSearch())},this.onToggleRail=()=>{this.store.toggleRail()},this.onToggleMaster=()=>{this.store.toggleMaster()},this.onToggleMobileMaster=async()=>{this.mobileMasterOpen=!this.mobileMasterOpen,this.requestUpdate(),this.mobileMasterOpen&&(await this.updateComplete,this.shadowRoot?.querySelector(".master-search")?.focus())},this.onToggleTheme=()=>{const e=this.theme==="light"?"dark":"light";this.setTheme(e,!0)},this.onToggleEpic=e=>{const t=e.currentTarget.dataset.epicToggle;t&&this.store.toggleEpicExpanded(t)},this.onContextSearchInput=e=>{this.store.contextSearch.set(e.target.value)},this.onSetContextTab=e=>{const t=e.currentTarget.dataset.contextTab;t&&this.store.setContextTab(t)},this.onSetContextInitiativeFilter=e=>{const t=e.currentTarget.dataset.contextInitiative??"";this.store.setContextInitiativeFilter(t||null)},this.onSetMasterStatusFilter=e=>{const t=e.currentTarget,s=t.dataset.masterSection,i=t.dataset.masterStatus;s!=="initiatives"&&s!=="adrs"||!i||this.store.setMasterStatusFilter(s,i)},this.onSetDebtFilter=e=>{const t=e.currentTarget,s=t.dataset.debtFilter,i=t.dataset.debtValue;!s||!i||this.store.setDebtFilter(s,i)},this.onToggleProjectGraphKind=e=>{const t=e.detail.kind;t&&this.store.toggleProjectGraphKind(t)},this.onProjectNodeOpen=e=>{const{id:t,kind:s}=e.detail;if(t){if(s==="initiative"){this.store.selectInitiative(t);return}this.store.selectProjectGraphEntity(t,s)}},this.updateNarrowMode=()=>{const e=window.innerWidth<=900,t=!e&&window.innerWidth<=1200;this.narrow===e&&this.medium===t||(this.narrow=e,this.medium=t,e||(this.mobileMasterOpen=!1),this.requestUpdate())}}toAriaBoolean(e){return e?"true":"false"}formatStatusFilter(e){return e==="all"?"All":e.split("-").map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`).join(" ")}focusContextTarget(){for(const i of this.renderRoot.querySelectorAll(".is-context-target, .is-context-term-target"))i.classList.remove("is-context-target","is-context-term-target");const e=this.store.selectedNestedTarget.get();if(!e||e.type!=="context"&&e.type!=="context-term")return;const t=e.type==="context"?[...this.renderRoot.querySelectorAll(".ctx-context-summary")].find(i=>i.dataset.contextScope===(e.scopeRef??"shared")):[...this.renderRoot.querySelectorAll(".ctx-term")].find(i=>i.dataset.term===e.id);if(!t)return;const s=e.type==="context"?"is-context-target":"is-context-term-target";t.classList.remove(s),t.offsetWidth,t.classList.add(s),t.focus({preventScroll:!0}),typeof t.scrollIntoView=="function"&&t.scrollIntoView({behavior:"smooth",block:"center"})}updated(){this.focusContextTarget()}connectedCallback(){super.connectedCallback();const e=window.localStorage.getItem(nn);this.setTheme(e==="dark"?"dark":"light"),this.updateNarrowMode(),window.addEventListener("resize",this.updateNarrowMode),window.addEventListener("keydown",this.onWindowKeyDown),this.store.connect()}disconnectedCallback(){window.removeEventListener("resize",this.updateNarrowMode),window.removeEventListener("keydown",this.onWindowKeyDown),this.store.disconnect(),super.disconnectedCallback()}setTheme(e,t=!1){this.theme=e,document.documentElement.dataset.theme=e,t&&window.localStorage.setItem(nn,e),this.requestUpdate()}renderThemeToggle(e){const t=this.theme==="light"?"dark":"light",s=this.theme==="light"?"☾":"☼";return h`
|
|
2953
2948
|
<button
|
|
2954
2949
|
aria-label=${`Switch to ${t} theme`}
|
|
2955
2950
|
aria-pressed=${this.toAriaBoolean(this.theme==="dark")}
|
|
@@ -3051,7 +3046,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3051
3046
|
<div class="nav-group-label">Plan</div>
|
|
3052
3047
|
${Gt(i,r=>h`
|
|
3053
3048
|
<button
|
|
3054
|
-
class=${
|
|
3049
|
+
class=${Q({active:s===r.section,"nav-item":!0})}
|
|
3055
3050
|
data-section=${r.section}
|
|
3056
3051
|
data-tenant-nav=${r.section}
|
|
3057
3052
|
title=${r.label}
|
|
@@ -3076,9 +3071,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3076
3071
|
</nav>
|
|
3077
3072
|
<div class="rail-foot">
|
|
3078
3073
|
<span class="rail-foot-copy">${e.projectDescription.get()}</span>
|
|
3079
|
-
${w(!this.narrow,()=>this.renderThemeToggle("rail"),()=>k)}
|
|
3074
|
+
${w(!this.narrow&&!this.medium,()=>this.renderThemeToggle("rail"),()=>k)}
|
|
3080
3075
|
</div>
|
|
3081
|
-
${w(this.narrow,()=>this.renderThemeToggle("header"),()=>k)}
|
|
3076
|
+
${w(this.narrow||this.medium,()=>this.renderThemeToggle("header"),()=>k)}
|
|
3082
3077
|
</aside>
|
|
3083
3078
|
`}renderProjectCard(e){const t=e.initiativeCount>0?Math.round(e.completedInitiativeCount/e.initiativeCount*100):0;return h`
|
|
3084
3079
|
<button
|
|
@@ -3124,7 +3119,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3124
3119
|
</main>
|
|
3125
3120
|
`}renderInitiativeCard(e){const t=this.store,{initiative:s}=e,i=e.issueCount>0?Math.round(e.completedIssueCount/e.issueCount*100):0;return h`
|
|
3126
3121
|
<button
|
|
3127
|
-
class=${
|
|
3122
|
+
class=${Q({active:t.activeInitiativeId.get()===s.id,"m-item":!0})}
|
|
3128
3123
|
data-initiative=${s.id}
|
|
3129
3124
|
@click=${this.onSelectInitiative}
|
|
3130
3125
|
>
|
|
@@ -3170,7 +3165,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3170
3165
|
</section>
|
|
3171
3166
|
`}renderAdrCard(e){const t=this.store,s=e.adr;return h`
|
|
3172
3167
|
<button
|
|
3173
|
-
class=${
|
|
3168
|
+
class=${Q({active:t.selectedId.get()===s.id,"m-item":!0})}
|
|
3174
3169
|
data-id=${s.id}
|
|
3175
3170
|
data-scope=${e.scope}
|
|
3176
3171
|
@click=${this.onSelectEntity}
|
|
@@ -3187,7 +3182,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3187
3182
|
</button>
|
|
3188
3183
|
`}renderDebtCard(e){const t=this.store;return h`
|
|
3189
3184
|
<button
|
|
3190
|
-
class=${
|
|
3185
|
+
class=${Q({active:t.selectedId.get()===e.id,"m-item":!0})}
|
|
3191
3186
|
data-id=${e.id}
|
|
3192
3187
|
@click=${this.onSelectEntity}
|
|
3193
3188
|
>
|
|
@@ -3212,7 +3207,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3212
3207
|
${D(["all",...s],r=>r,r=>h`
|
|
3213
3208
|
<button
|
|
3214
3209
|
aria-pressed=${this.toAriaBoolean(i===r)}
|
|
3215
|
-
class=${
|
|
3210
|
+
class=${Q({active:i===r,"master-status-chip":!0})}
|
|
3216
3211
|
data-debt-filter=${e}
|
|
3217
3212
|
data-debt-value=${r}
|
|
3218
3213
|
@click=${this.onSetDebtFilter}
|
|
@@ -3290,7 +3285,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3290
3285
|
>
|
|
3291
3286
|
<button
|
|
3292
3287
|
aria-selected=${this.toAriaBoolean(l===null)}
|
|
3293
|
-
class=${
|
|
3288
|
+
class=${Q({active:l===null,"ctx-initiative-tab":!0})}
|
|
3294
3289
|
role="tab"
|
|
3295
3290
|
@click=${this.onSetContextInitiativeFilter}
|
|
3296
3291
|
>
|
|
@@ -3299,7 +3294,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3299
3294
|
${D(a,d=>d.initiative.id,d=>h`
|
|
3300
3295
|
<button
|
|
3301
3296
|
aria-selected=${this.toAriaBoolean(l===d.initiative.id)}
|
|
3302
|
-
class=${
|
|
3297
|
+
class=${Q({active:l===d.initiative.id,"ctx-initiative-tab":!0})}
|
|
3303
3298
|
data-context-initiative=${d.initiative.id}
|
|
3304
3299
|
role="tab"
|
|
3305
3300
|
@click=${this.onSetContextInitiativeFilter}
|
|
@@ -3325,7 +3320,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3325
3320
|
</div>
|
|
3326
3321
|
`,()=>h`<p class="ctx-empty">No initiative-scoped terms match the current search.</p>`)}
|
|
3327
3322
|
</section>
|
|
3328
|
-
`}renderMaster(){const e=this.store,t=e.activeSection.get(),s=e.search.get().trim().toLowerCase(),i=t==="adrs",r=t==="debt",a=i?"adrs":"initiatives",o=i?e.adrStatusFilter.get():e.initiativeStatusFilter.get(),l=i?e.adrRailEntries.get().map(
|
|
3323
|
+
`}renderMaster(){const e=this.store,t=e.activeSection.get(),s=e.search.get().trim().toLowerCase(),i=t==="adrs",r=t==="debt",a=i?"adrs":"initiatives",o=i?e.adrStatusFilter.get():e.initiativeStatusFilter.get(),l=i?e.adrRailEntries.get().map(y=>y.adr.status):e.projectSummaryInitiatives.get().map(y=>y.initiative.status),u=["all",...new Set(l)].sort((y,R)=>y==="all"?-1:R==="all"?1:y.localeCompare(R)),p=e.projectSummaryEpicGroups.get().map(y=>({...y,initiatives:y.initiatives.filter(R=>(o==="all"||R.initiative.status===o)&&`${R.initiative.title} ${R.initiative.id}`.toLowerCase().includes(s))})).filter(y=>y.initiatives.length>0),d=e.adrRailEntries.get().filter(y=>(o==="all"||y.adr.status===o)&&`${y.adr.title} ${y.adr.id}`.toLowerCase().includes(s)),g=e.allDebtRecords.get(),b=e.debtRecords.get().filter(y=>`${y.title} ${y.id} ${y.category??""} ${y.priority??""}`.toLowerCase().includes(s)),x=[...new Set(g.map(y=>y.category).filter(y=>!!y))].sort(),E=[...new Set(g.map(y=>y.priority).filter(y=>!!y))].sort(),O=[...new Set(g.map(y=>y.status))].sort(),I=this.renderSectionFeedback(t),_=t==="initiatives"&&e.selectedProjectId.get()!==null&&e.projectSummary.get()===null&&e.syncLabel.get()==="connecting";return h`
|
|
3329
3324
|
<section class="master" data-pane="master">
|
|
3330
3325
|
<button
|
|
3331
3326
|
class="pane-collapse"
|
|
@@ -3346,23 +3341,23 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3346
3341
|
/>
|
|
3347
3342
|
${w(r,()=>h`
|
|
3348
3343
|
${this.renderDebtFilter("lifecycle","Lifecycle",O,e.debtLifecycleFilter.get())}
|
|
3349
|
-
${this.renderDebtFilter("category","Category",
|
|
3350
|
-
${this.renderDebtFilter("priority","Priority",
|
|
3344
|
+
${this.renderDebtFilter("category","Category",x,e.debtCategoryFilter.get())}
|
|
3345
|
+
${this.renderDebtFilter("priority","Priority",E,e.debtPriorityFilter.get())}
|
|
3351
3346
|
`,()=>h`
|
|
3352
3347
|
<div
|
|
3353
3348
|
aria-label=${`Filter ${i?"ADRs":"initiatives"} by status`}
|
|
3354
3349
|
class="master-status-filters"
|
|
3355
3350
|
role="group"
|
|
3356
3351
|
>
|
|
3357
|
-
${D(u,
|
|
3352
|
+
${D(u,y=>y,y=>h`
|
|
3358
3353
|
<button
|
|
3359
|
-
aria-pressed=${this.toAriaBoolean(o===
|
|
3360
|
-
class=${
|
|
3354
|
+
aria-pressed=${this.toAriaBoolean(o===y)}
|
|
3355
|
+
class=${Q({active:o===y,"master-status-chip":!0})}
|
|
3361
3356
|
data-master-section=${a}
|
|
3362
|
-
data-master-status=${
|
|
3357
|
+
data-master-status=${y}
|
|
3363
3358
|
@click=${this.onSetMasterStatusFilter}
|
|
3364
3359
|
>
|
|
3365
|
-
${this.formatStatusFilter(
|
|
3360
|
+
${this.formatStatusFilter(y)}
|
|
3366
3361
|
</button>
|
|
3367
3362
|
`)}
|
|
3368
3363
|
</div>
|
|
@@ -3370,7 +3365,12 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3370
3365
|
</div>
|
|
3371
3366
|
${I}
|
|
3372
3367
|
<div class="master-list">
|
|
3373
|
-
${
|
|
3368
|
+
${w(_,()=>h`
|
|
3369
|
+
<div aria-live="polite" class="master-loading" role="status">
|
|
3370
|
+
<span aria-hidden="true" class="master-loading-spinner"></span>
|
|
3371
|
+
<span>Loading initiatives</span>
|
|
3372
|
+
</div>
|
|
3373
|
+
`,()=>et(t,[["adrs",()=>h`${D(d,y=>y.adr.id,y=>this.renderAdrCard(y))}`],["debt",()=>h`${D(b,y=>y.id,y=>this.renderDebtCard(y))}`]],()=>h`${D(p,y=>y.epic.id,y=>this.renderEpicInitiativeGroup(y))}`))}
|
|
3374
3374
|
</div>
|
|
3375
3375
|
</section>
|
|
3376
3376
|
`}renderSectionFeedback(e){const t=e==="adrs"?this.store.projectAdrsCache.get():e==="debt"?this.store.projectDebtCache.get():e==="context"?this.store.projectContextCache.get():e==="graph"?this.store.projectGraphCache.get():null;return t?t.error?h`
|
|
@@ -3383,11 +3383,19 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3383
3383
|
Retry
|
|
3384
3384
|
</button>
|
|
3385
3385
|
</div>
|
|
3386
|
-
`:t.loading?h`<div class="project-state">Loading section...</div>`:k:k}renderDetail(){const e=this.store,t=e.activeSection.get(),s=e.selectedInitiativeId.get(),i=e.selectedId.get();if(t==="context"){const r=e.sharedContext.get()
|
|
3386
|
+
`:t.loading?h`<div class="project-state">Loading section...</div>`:k:k}renderDetail(){const e=this.store,t=e.activeSection.get(),s=e.selectedInitiativeId.get(),i=e.selectedId.get();if(t==="context"){const r=e.sharedContext.get();if(!r)return h`
|
|
3387
|
+
<section class="detail" data-pane="detail">
|
|
3388
|
+
<div class="detail-inner wide-inner">
|
|
3389
|
+
<div class="ai-crumbs">${e.selectedTenantDisplayName.get()} · Context</div>
|
|
3390
|
+
<h1 class="d-title">${w(e.projectContextCache.get().error,()=>h`Context unavailable`,()=>h`Loading context`)}</h1>
|
|
3391
|
+
${this.renderSectionFeedback("context")}
|
|
3392
|
+
</div>
|
|
3393
|
+
</section>
|
|
3394
|
+
`;const a=e.contextTab.get(),o={all:"Search all context…",global:"Search shared context…",initiatives:"Search initiative terminology…"}[a];return h`
|
|
3387
3395
|
<section class="detail" data-pane="detail">
|
|
3388
3396
|
<div class="detail-inner wide-inner">
|
|
3389
3397
|
<div class="ai-crumbs">${e.selectedTenantDisplayName.get()} · Context</div>
|
|
3390
|
-
<h1 class="d-title">${r
|
|
3398
|
+
<h1 class="d-title">${r.context.title}</h1>
|
|
3391
3399
|
<p class="d-sub">Shared glossary plus initiative-scoped term discovery, with scope preserved so local language stays findable without becoming silently global.</p>
|
|
3392
3400
|
${this.renderSectionFeedback("context")}
|
|
3393
3401
|
<div class="ctx-controls">
|
|
@@ -3400,7 +3408,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3400
3408
|
<div class="ctx-tabs">
|
|
3401
3409
|
${D([{label:"All",tab:"all"},{label:"Global",tab:"global"},{label:"Initiatives",tab:"initiatives"}],l=>l.tab,l=>h`
|
|
3402
3410
|
<button
|
|
3403
|
-
class=${
|
|
3411
|
+
class=${Q({active:a===l.tab,"ctx-tab":!0})}
|
|
3404
3412
|
data-context-tab=${l.tab}
|
|
3405
3413
|
@click=${this.onSetContextTab}
|
|
3406
3414
|
>
|
|
@@ -3458,7 +3466,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3458
3466
|
</div>
|
|
3459
3467
|
</section>
|
|
3460
3468
|
`}render(){const e=this.store;if(e.selectedTenant.get()&&!e.selectedProjectId.get())return this.renderProjectChooser();const t=e.activeSection.get(),s=!this.narrow&&(t==="graph"||t==="context"),i=e.railCollapsed.get(),r=!s&&e.masterCollapsed.get(),a=e.selectedId.get()!==null||e.selectedInitiativeId.get()!==null||t==="context"||t==="graph";return h`
|
|
3461
|
-
<div class=${
|
|
3469
|
+
<div class=${Q({console:!0,"has-detail":a,"master-collapsed":r,medium:this.medium,"mobile-master-open":this.mobileMasterOpen,narrow:this.narrow,"rail-collapsed":i,wide:s})}>
|
|
3462
3470
|
${this.renderRail()}
|
|
3463
3471
|
${w(!s,()=>this.renderMaster(),()=>k)}
|
|
3464
3472
|
${this.renderDetail()}
|
|
@@ -3471,7 +3479,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3471
3479
|
></agent-issues-global-search-overlay>
|
|
3472
3480
|
`,()=>k)}
|
|
3473
3481
|
</div>
|
|
3474
|
-
`}};
|
|
3482
|
+
`}};Ei.styles=[ls,xi,ge`
|
|
3475
3483
|
:host {
|
|
3476
3484
|
display: block;
|
|
3477
3485
|
height: 100vh;
|
|
@@ -3813,6 +3821,35 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3813
3821
|
flex: 1;
|
|
3814
3822
|
overflow-y: auto;
|
|
3815
3823
|
}
|
|
3824
|
+
.master-loading {
|
|
3825
|
+
display: grid;
|
|
3826
|
+
gap: 10px;
|
|
3827
|
+
min-height: 160px;
|
|
3828
|
+
place-content: center;
|
|
3829
|
+
place-items: center;
|
|
3830
|
+
color: var(--muted);
|
|
3831
|
+
font-size: 12px;
|
|
3832
|
+
font-weight: 600;
|
|
3833
|
+
}
|
|
3834
|
+
.master-loading-spinner {
|
|
3835
|
+
box-sizing: border-box;
|
|
3836
|
+
width: 18px;
|
|
3837
|
+
height: 18px;
|
|
3838
|
+
border: 2px solid var(--border);
|
|
3839
|
+
border-top-color: var(--accent);
|
|
3840
|
+
border-radius: 50%;
|
|
3841
|
+
animation: master-loading-spin 700ms linear infinite;
|
|
3842
|
+
}
|
|
3843
|
+
@keyframes master-loading-spin {
|
|
3844
|
+
to {
|
|
3845
|
+
transform: rotate(360deg);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3849
|
+
.master-loading-spinner {
|
|
3850
|
+
animation: none;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3816
3853
|
.m-item {
|
|
3817
3854
|
display: block;
|
|
3818
3855
|
width: stretch;
|
|
@@ -3936,6 +3973,18 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
3936
3973
|
margin: 6px 0 0;
|
|
3937
3974
|
font-size: 24px;
|
|
3938
3975
|
}
|
|
3976
|
+
.console.medium .header-theme-toggle {
|
|
3977
|
+
display: inline-flex;
|
|
3978
|
+
flex: 0 0 40px;
|
|
3979
|
+
align-self: stretch;
|
|
3980
|
+
width: 40px;
|
|
3981
|
+
height: auto;
|
|
3982
|
+
margin-left: auto;
|
|
3983
|
+
border-top: 0;
|
|
3984
|
+
border-right: 0;
|
|
3985
|
+
border-bottom: 0;
|
|
3986
|
+
border-radius: 0;
|
|
3987
|
+
}
|
|
3939
3988
|
.d-sub {
|
|
3940
3989
|
max-width: 70ch;
|
|
3941
3990
|
margin: 10px 0 0;
|
|
@@ -4493,4 +4542,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
|
|
|
4493
4542
|
display: block;
|
|
4494
4543
|
}
|
|
4495
4544
|
}
|
|
4496
|
-
`];let
|
|
4545
|
+
`];let li=Ei;customElements.define("agent-issues-app",li);const an=document.querySelector("#app");an&&an.replaceChildren(document.createElement("agent-issues-app"));
|