@event4u/agent-config 9.7.0 → 9.8.0
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +144 -0
- package/README.md +5 -5
- package/dist/agent-src/commands/commit/in-chunks.md +8 -0
- package/dist/agent-src/commands/commit.md +17 -0
- package/dist/agent-src/commands/pr/create.md +4 -0
- package/dist/agent-src/contexts/override-system.md +75 -5
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +97 -0
- package/dist/agent-src/rules/domain-safety-pii.md +1 -0
- package/dist/agent-src/rules/external-code-graph-interop.md +13 -3
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +2 -0
- package/dist/agent-src/rules/git-history-discipline.md +2 -0
- package/dist/agent-src/rules/language-and-tone.md +2 -0
- package/dist/agent-src/rules/lethal-trifecta-guard.md +3 -0
- package/dist/agent-src/rules/media-governance-routing.md +2 -0
- package/dist/agent-src/rules/minimal-safe-diff.md +2 -0
- package/dist/agent-src/rules/no-roadmap-references.md +3 -0
- package/dist/agent-src/rules/non-destructive-by-default.md +20 -0
- package/dist/agent-src/rules/onboarding-gate.md +2 -0
- package/dist/agent-src/rules/output-discipline.md +2 -0
- package/dist/agent-src/rules/persona-governance.md +2 -0
- package/dist/agent-src/rules/preservation-guard.md +3 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +2 -0
- package/dist/agent-src/rules/secret-vcs-guard.md +106 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +1 -1
- package/dist/agent-src/rules/skill-quality.md +2 -0
- package/dist/agent-src/rules/source-confidentiality.md +2 -0
- package/dist/agent-src/rules/source-of-truth.md +2 -0
- package/dist/agent-src/rules/telegraph-speak.md +2 -0
- package/dist/agent-src/rules/token-optimizer-maintenance.md +2 -0
- package/dist/agent-src/rules/tool-safety.md +1 -0
- package/dist/agent-src/rules/verify-before-complete.md +2 -0
- package/dist/agent-src/skills/adr-create/SKILL.md +17 -1
- package/dist/agent-src/skills/code-intelligence/SKILL.md +94 -0
- package/dist/agent-src/skills/gated-reach/SKILL.md +185 -0
- package/dist/agent-src/skills/gated-reach/evals/triggers.json +72 -0
- package/dist/agent-src/skills/image-analyser/SKILL.md +14 -12
- package/dist/agent-src/skills/image-editing/SKILL.md +1 -0
- package/dist/agent-src/skills/readme-writing/SKILL.md +6 -1
- package/dist/agent-src/skills/screenshot-hygiene/SKILL.md +171 -0
- package/dist/agent-src/skills/secrets-management/SKILL.md +44 -1
- package/dist/agent-src/skills/subagent-orchestration/prompts/adversarial-verification-council.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-and-judge-two-stage.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-and-judge.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-competitively.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-in-parallel.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-in-steps.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/do-in-worktrees.md +29 -0
- package/dist/agent-src/skills/subagent-orchestration/prompts/judge-with-debate.md +29 -0
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +4 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/github-workflows/secret-scan.yml +65 -0
- package/dist/cli/configRoot.js +112 -0
- package/dist/cli/configRoot.js.map +1 -0
- package/dist/cli/configRoot.test.js +97 -0
- package/dist/cli/configRoot.test.js.map +1 -0
- package/dist/cli/help.js +4 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +19 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +161 -44
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +13 -8
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +11 -6
- package/dist/install/install.mjs +16 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/router.json +1 -1
- package/dist/server/app.js +10 -0
- package/dist/server/app.js.map +1 -1
- package/dist/server/routes/ping.js +18 -0
- package/dist/server/routes/ping.js.map +1 -1
- package/dist/server/schemas/settings.js +8 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/server/serverInfo.js +6 -2
- package/dist/server/serverInfo.js.map +1 -1
- package/dist/server/token.js +11 -4
- package/dist/server/token.js.map +1 -1
- package/dist/server/writeRoot.js +15 -1
- package/dist/server/writeRoot.js.map +1 -1
- package/dist/shared/capabilities.js +33 -0
- package/dist/shared/capabilities.js.map +1 -0
- package/dist/shared/capabilities.test.js +39 -0
- package/dist/shared/capabilities.test.js.map +1 -0
- package/dist/ui/assets/{index-BiEZiZ31.js → index-CrmZ34Rg.js} +16 -16
- package/dist/ui/assets/index-CrmZ34Rg.js.map +1 -0
- package/dist/ui/index.html +14 -5
- package/docs/CLAIMS.md +62 -37
- package/docs/architecture.md +2 -2
- package/docs/benchmark.md +137 -0
- package/docs/catalog.md +8 -3
- package/docs/comparison.yaml +44 -2
- package/docs/contracts/local-server-ports.md +53 -0
- package/docs/contracts/no-runtime-boundary.md +1 -1
- package/docs/contracts/subagent-boundary.md +15 -0
- package/docs/customization.md +14 -3
- package/docs/decisions/ADR-016-installer-architecture.md +2 -0
- package/docs/decisions/ADR-088-no-external-runtime-federation.md +1 -1
- package/docs/decisions/ADR-094-agent-memory-layer-removal.md +1 -1
- package/docs/decisions/ADR-109-subagent-v1-contract.md +2 -0
- package/docs/decisions/ADR-110-discipline-profile-resolution-locus.md +2 -0
- package/docs/decisions/ADR-113-ci-native-release-label-trigger.md +11 -3
- package/docs/decisions/ADR-124-embedded-engine-doctrine.md +255 -0
- package/docs/decisions/ADR-125-doc-screenshot-anonymization.md +131 -0
- package/docs/decisions/ADR-126-internet-reach-operator-tooling.md +254 -0
- package/docs/decisions/ADR-127-enforcement-claims-must-resolve.md +150 -0
- package/docs/decisions/ADR-128-executable-evidence-and-measured-escalation.md +201 -0
- package/docs/decisions/INDEX.md +21 -0
- package/docs/decisions/engine-reclassification-2026-07.md +104 -0
- package/docs/distribution/awesome-list-submission.md +1 -1
- package/docs/distribution/registries.md +36 -27
- package/docs/enforcement-by-host.md +7 -0
- package/docs/featured-skills.md +2 -2
- package/docs/getting-started-by-role.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/governance-advantage.md +1 -1
- package/docs/guides/gated-platform-reads.md +221 -0
- package/docs/positioning-evidence.md +1 -1
- package/docs/proof.md +92 -16
- package/docs/threat-model.md +1 -0
- package/package.json +5 -2
- package/src/config/agent-settings.template.yml +43 -0
- package/src/config/reach-channels.yml +217 -0
- package/src/config/reach-prescriptions-intake.yml +200 -0
- package/src/scripts/_dispatch.bash +15 -0
- package/src/scripts/_lib/exec_evidence.ts +251 -0
- package/src/scripts/_lib/fixtures/secret-detector/negatives.txt +10 -0
- package/src/scripts/_lib/fixtures/secret-detector/positives.txt +11 -0
- package/src/scripts/_lib/kernel_rules.ts +46 -0
- package/src/scripts/_lib/reddit_thread_parse.ts +598 -0
- package/src/scripts/_lib/risk_paths.ts +160 -0
- package/src/scripts/_lib/secret_detector.test.ts +103 -0
- package/src/scripts/_lib/secret_detector.ts +319 -0
- package/src/scripts/_lib/tool_probe.ts +359 -0
- package/src/scripts/adr/regenerate_index.ts +81 -6
- package/src/scripts/audit_adr_coverage.ts +33 -0
- package/src/scripts/build_proof.ts +162 -0
- package/src/scripts/check_adr_frontmatter.ts +195 -0
- package/src/scripts/check_artefact_count_messaging.ts +4 -0
- package/src/scripts/check_backstop_debt.ts +200 -0
- package/src/scripts/check_claims.ts +188 -8
- package/src/scripts/check_comparison.ts +12 -0
- package/src/scripts/check_enforcement_coverage.ts +592 -0
- package/src/scripts/check_kernel_rule_bundle.ts +16 -12
- package/src/scripts/check_reach_channels.ts +407 -0
- package/src/scripts/check_reach_staleness.ts +364 -0
- package/src/scripts/check_secret_leak.test.ts +47 -0
- package/src/scripts/check_secret_leak.ts +290 -0
- package/src/scripts/code_graph/build.ts +0 -0
- package/src/scripts/code_graph/cli.ts +207 -0
- package/src/scripts/code_graph/detect.ts +134 -0
- package/src/scripts/code_graph/extract.ts +386 -0
- package/src/scripts/code_graph/loader.ts +123 -0
- package/src/scripts/code_graph/query.ts +176 -0
- package/src/scripts/code_graph/sanitize.ts +30 -0
- package/src/scripts/code_graph/types.ts +83 -0
- package/src/scripts/code_graph/validate.ts +63 -0
- package/src/scripts/external_sources_denylist.json +3 -1
- package/src/scripts/generate_subagent_floor.ts +194 -0
- package/src/scripts/hook_manifest.yaml +13 -3
- package/src/scripts/hooks/code_graph_nudge_hook.ts +184 -0
- package/src/scripts/iron_law_sha.ts +3 -12
- package/src/scripts/lint_override_kernel_guard.ts +219 -0
- package/src/scripts/measure_rule_budget.ts +3 -12
- package/src/scripts/postinstall_gui.ts +129 -0
- package/src/scripts/reach_doctor.ts +1651 -0
- package/src/scripts/release.ts +24 -3
- package/src/scripts/risk_escalation_shadow.ts +160 -0
- package/src/scripts/schemas/agent-settings.schema.json +23 -0
- package/src/scripts/schemas/reach-channels.schema.json +134 -0
- package/src/scripts/schemas/reach-doctor-payload.schema.json +220 -0
- package/src/scripts/schemas/rule.schema.json +10 -0
- package/src/scripts/skill_linter.ts +55 -0
- package/src/scripts/validate_reach_prescriptions.ts +751 -0
- package/src/server/schemas/settings.ts +16 -0
- package/src/shared/capabilities.test.ts +43 -0
- package/src/shared/capabilities.ts +75 -0
- package/src/templates/minimal/agents-overrides-readme.md +20 -0
- package/dist/ui/assets/index-BiEZiZ31.js.map +0 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))t(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&t(o)}).observe(document,{childList:!0,subtree:!0});function i(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function t(l){if(l.ep)return;l.ep=!0;const a=i(l);fetch(l.href,a)}})();var di,x,$r,Lr,ie,Bt,Rr,Fr,Ei,Cn,qe,Pr,dt,Mi,Di,Fn={},Pn=[],wa=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,fi=Array.isArray;function q(e,n){for(var i in n)e[i]=n[i];return e}function ft(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function xa(e,n,i){var t,l,a,o={};for(a in n)a=="key"?t=n[a]:a=="ref"?l=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?di.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return An(e,o,t,l,null)}function An(e,n,i,t,l){var a={type:e,props:n,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++$r,__i:-1,__u:0};return l==null&&x.vnode!=null&&x.vnode(a),a}function M(e){return e.children}function Ke(e,n){this.props=e,this.context=n}function Pe(e,n){if(n==null)return e.__?Pe(e.__,e.__i+1):null;for(var i;n<e.__k.length;n++)if((i=e.__k[n])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?Pe(e):null}function Sa(e){if(e.__P&&e.__d){var n=e.__v,i=n.__e,t=[],l=[],a=q({},n);a.__v=n.__v+1,x.vnode&&x.vnode(a),ht(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,t,i??Pe(n),!!(32&n.__u),l),a.__v=n.__v,a.__.__k[a.__i]=a,Br(t,a,l),n.__e=n.__=null,a.__e!=i&&Mr(a)}}function Mr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Mr(e)}function Ut(e){(!e.__d&&(e.__d=!0)&&ie.push(e)&&!Mn.__r++||Bt!=x.debounceRendering)&&((Bt=x.debounceRendering)||Rr)(Mn)}function Mn(){try{for(var e,n=1;ie.length;)ie.length>n&&ie.sort(Fr),e=ie.shift(),n=ie.length,Sa(e)}finally{ie.length=Mn.__r=0}}function Dr(e,n,i,t,l,a,o,c,s,u,h){var d,_,f,v,m,k,b,g=t&&t.__k||Pn,H=n.length;for(s=Ca(i,n,g,s,H),d=0;d<H;d++)(f=i.__k[d])!=null&&(_=f.__i!=-1&&g[f.__i]||Fn,f.__i=d,k=ht(e,f,_,l,a,o,c,s,u,h),v=f.__e,f.ref&&_.ref!=f.ref&&(_.ref&&pt(_.ref,null,f),h.push(f.ref,f.__c||v,f)),m==null&&v!=null&&(m=v),(b=!!(4&f.__u))||_.__k===f.__k?(s=jr(f,s,e,b),b&&_.__e&&(_.__e=null)):typeof f.type=="function"&&k!==void 0?s=k:v&&(s=v.nextSibling),f.__u&=-7);return i.__e=m,s}function Ca(e,n,i,t,l){var a,o,c,s,u,h=i.length,d=h,_=0;for(e.__k=new Array(l),a=0;a<l;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[a]=An(null,o,null,null,null):fi(o)?o=e.__k[a]=An(M,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=An(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,s=a+_,o.__=e,o.__b=e.__b+1,c=null,(u=o.__i=Aa(o,i,s,d))!=-1&&(d--,(c=i[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(l>h?_--:l<h&&_++),typeof o.type!="function"&&(o.__u|=4)):u!=s&&(u==s-1?_--:u==s+1?_++:(u>s?_--:_++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<h;a++)(c=i[a])!=null&&!(2&c.__u)&&(c.__e==t&&(t=Pe(c)),Hr(c,c));return t}function jr(e,n,i,t){var l,a;if(typeof e.type=="function"){for(l=e.__k,a=0;l&&a<l.length;a++)l[a]&&(l[a].__=e,n=jr(l[a],n,i,t));return n}e.__e!=n&&(t&&(n&&e.type&&!n.parentNode&&(n=Pe(e)),i.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Aa(e,n,i,t){var l,a,o,c=e.key,s=e.type,u=n[i],h=u!=null&&(2&u.__u)==0;if(u===null&&c==null||h&&c==u.key&&s==u.type)return i;if(t>(h?1:0)){for(l=i-1,a=i+1;l>=0||a<n.length;)if((u=n[o=l>=0?l--:a++])!=null&&!(2&u.__u)&&c==u.key&&s==u.type)return o}return-1}function Ht(e,n,i){n[0]=="-"?e.setProperty(n,i??""):e[n]=i==null?"":typeof i!="number"||wa.test(n)?i:i+"px"}function kn(e,n,i,t,l){var a,o;e:if(n=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof t=="string"&&(e.style.cssText=t=""),t)for(n in t)i&&n in i||Ht(e.style,n,"");if(i)for(n in i)t&&i[n]==t[n]||Ht(e.style,n,i[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Pr,"$1")),o=n.toLowerCase(),n=o in e||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=i,i?t?i[qe]=t[qe]:(i[qe]=dt,e.addEventListener(n,a?Di:Mi,a)):e.removeEventListener(n,a?Di:Mi,a);else{if(l=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&i==1?"":i))}}function Wt(e){return function(n){if(this.l){var i=this.l[n.type+e];if(n[Cn]==null)n[Cn]=dt++;else if(n[Cn]<i[qe])return;return i(x.event?x.event(n):n)}}}function ht(e,n,i,t,l,a,o,c,s,u){var h,d,_,f,v,m,k,b,g,H,oe,ze,jt,bn,Ti,W=n.type;if(n.constructor!==void 0)return null;128&i.__u&&(s=!!(32&i.__u),a=[c=n.__e=i.__e]),(h=x.__b)&&h(n);e:if(typeof W=="function")try{if(b=n.props,g=W.prototype&&W.prototype.render,H=(h=W.contextType)&&t[h.__c],oe=h?H?H.props.value:h.__:t,i.__c?k=(d=n.__c=i.__c).__=d.__E:(g?n.__c=d=new W(b,oe):(n.__c=d=new Ke(b,oe),d.constructor=W,d.render=Ea),H&&H.sub(d),d.state||(d.state={}),d.__n=t,_=d.__d=!0,d.__h=[],d._sb=[]),g&&d.__s==null&&(d.__s=d.state),g&&W.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=q({},d.__s)),q(d.__s,W.getDerivedStateFromProps(b,d.__s))),f=d.props,v=d.state,d.__v=n,_)g&&W.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),g&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(g&&W.getDerivedStateFromProps==null&&b!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,oe),n.__v==i.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,oe)===!1){n.__v!=i.__v&&(d.props=b,d.state=d.__s,d.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(be){be&&(be.__=n)}),Pn.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,oe),g&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,v,m)})}if(d.context=oe,d.props=b,d.__P=e,d.__e=!1,ze=x.__r,jt=0,g)d.state=d.__s,d.__d=!1,ze&&ze(n),h=d.render(d.props,d.state,d.context),Pn.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,ze&&ze(n),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++jt<25);d.state=d.__s,d.getChildContext!=null&&(t=q(q({},t),d.getChildContext())),g&&!_&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(f,v)),bn=h!=null&&h.type===M&&h.key==null?Ur(h.props.children):h,c=Dr(e,fi(bn)?bn:[bn],n,i,t,l,a,o,c,s,u),d.base=n.__e,n.__u&=-161,d.__h.length&&o.push(d),k&&(d.__E=d.__=null)}catch(be){if(n.__v=null,s||a!=null)if(be.then){for(n.__u|=s?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a[a.indexOf(c)]=null,n.__e=c}else{for(Ti=a.length;Ti--;)ft(a[Ti]);ji(n)}else n.__e=i.__e,n.__k=i.__k,be.then||ji(n);x.__e(be,n,i)}else a==null&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):c=n.__e=Ta(i.__e,n,i,t,l,a,o,s,u);return(h=x.diffed)&&h(n),128&n.__u?void 0:c}function ji(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ji))}function Br(e,n,i){for(var t=0;t<i.length;t++)pt(i[t],i[++t],i[++t]);x.__c&&x.__c(n,e),e.some(function(l){try{e=l.__h,l.__h=[],e.some(function(a){a.call(l)})}catch(a){x.__e(a,l.__v)}})}function Ur(e){return typeof e!="object"||e==null||e.__b>0?e:fi(e)?e.map(Ur):e.constructor!==void 0?null:q({},e)}function Ta(e,n,i,t,l,a,o,c,s){var u,h,d,_,f,v,m,k=i.props||Fn,b=n.props,g=n.type;if(g=="svg"?l="http://www.w3.org/2000/svg":g=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(b);e=document.createElementNS(l,g,b.is&&b),c&&(x.__m&&x.__m(n,a),c=!1),a=null}if(g==null)k===b||c&&e.data==b||(e.data=b);else{if(a=g=="textarea"&&b.defaultValue!=null?null:a&&di.call(e.childNodes),!c&&a!=null)for(k={},u=0;u<e.attributes.length;u++)k[(f=e.attributes[u]).name]=f.value;for(u in k)f=k[u],u=="dangerouslySetInnerHTML"?d=f:u=="children"||u in b||u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b||kn(e,u,null,f,l);for(u in b)f=b[u],u=="children"?_=f:u=="dangerouslySetInnerHTML"?h=f:u=="value"?v=f:u=="checked"?m=f:c&&typeof f!="function"||k[u]===f||kn(e,u,f,k[u],l);if(h)c||d&&(h.__html==d.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(d&&(e.innerHTML=""),Dr(n.type=="template"?e.content:e,fi(_)?_:[_],n,i,t,g=="foreignObject"?"http://www.w3.org/1999/xhtml":l,a,o,a?a[0]:i.__k&&Pe(i,0),c,s),a!=null)for(u=a.length;u--;)ft(a[u]);c&&g!="textarea"||(u="value",g=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||g=="progress"&&!v||g=="option"&&v!=k[u])&&kn(e,u,v,k[u],l),u="checked",m!=null&&m!=e[u]&&kn(e,u,m,k[u],l))}return e}function pt(e,n,i){try{if(typeof e=="function"){var t=typeof e.__u=="function";t&&e.__u(),t&&n==null||(e.__u=e(n))}else e.current=n}catch(l){x.__e(l,i)}}function Hr(e,n,i){var t,l;if(x.unmount&&x.unmount(e),(t=e.ref)&&(t.current&&t.current!=e.__e||pt(t,null,n)),(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(a){x.__e(a,n)}t.base=t.__P=null}if(t=e.__k)for(l=0;l<t.length;l++)t[l]&&Hr(t[l],n,i||typeof e.type!="function");i||ft(e.__e),e.__c=e.__=e.__e=void 0}function Ea(e,n,i){return this.constructor(e,i)}function Oa(e,n,i){var t,l,a,o;n==document&&(n=document.documentElement),x.__&&x.__(e,n),l=(t=!1)?null:n.__k,a=[],o=[],ht(n,e=n.__k=xa(M,null,[e]),l||Fn,Fn,n.namespaceURI,l?null:n.firstChild?di.call(n.childNodes):null,a,l?l.__e:n.firstChild,t,o),Br(a,e,o)}di=Pn.slice,x={__e:function(e,n,i,t){for(var l,a,o;n=n.__;)if((l=n.__c)&&!l.__)try{if((a=l.constructor)&&a.getDerivedStateFromError!=null&&(l.setState(a.getDerivedStateFromError(e)),o=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(e,t||{}),o=l.__d),o)return l.__E=l}catch(c){e=c}throw e}},$r=0,Lr=function(e){return e!=null&&e.constructor===void 0},Ke.prototype.setState=function(e,n){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=q({},this.state),typeof e=="function"&&(e=e(q({},i),this.props)),e&&q(i,e),e!=null&&this.__v&&(n&&this._sb.push(n),Ut(this))},Ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ut(this))},Ke.prototype.render=M,ie=[],Rr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fr=function(e,n){return e.__v.__b-n.__v.__b},Mn.__r=0,Ei=Math.random().toString(8),Cn="__d"+Ei,qe="__a"+Ei,Pr=/(PointerCapture)$|Capture$/i,dt=0,Mi=Wt(!1),Di=Wt(!0);var Na=0;function r(e,n,i,t,l,a){n||(n={});var o,c,s=n;if("ref"in s)for(c in s={},n)c=="ref"?o=n[c]:s[c]=n[c];var u={type:e,props:s,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Na,__i:-1,__u:0,__source:l,__self:a};if(typeof e=="function"&&(o=e.defaultProps))for(c in o)s[c]===void 0&&(s[c]=o[c]);return x.vnode&&x.vnode(u),u}var en,C,Oi,zt,Bi=0,Wr=[],T=x,Yt=T.__b,qt=T.__r,Kt=T.diffed,Gt=T.__c,Vt=T.unmount,Jt=T.__;function vt(e,n){T.__h&&T.__h(C,e,Bi||n),Bi=0;var i=C.__H||(C.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function _t(e){return Bi=1,Ia(qr,e)}function Ia(e,n,i){var t=vt(en++,2);if(t.t=e,!t.__c&&(t.__=[qr(void 0,n),function(c){var s=t.__N?t.__N[0]:t.__[0],u=t.t(s,c);s!==u&&(t.__N=[u,t.__[1]],t.__c.setState({}))}],t.__c=C,!C.__f)){var l=function(c,s,u){if(!t.__c.__H)return!0;var h=t.__c.__H.__.filter(function(_){return _.__c});if(h.every(function(_){return!_.__N}))return!a||a.call(this,c,s,u);var d=t.__c.props!==c;return h.some(function(_){if(_.__N){var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(d=!0)}}),a&&a.call(this,c,s,u)||d};C.__f=!0;var a=C.shouldComponentUpdate,o=C.componentWillUpdate;C.componentWillUpdate=function(c,s,u){if(this.__e){var h=a;a=void 0,l(c,s,u),a=h}o&&o.call(this,c,s,u)},C.shouldComponentUpdate=l}return t.__N||t.__}function ee(e,n){var i=vt(en++,3);!T.__s&&Yr(i.__H,n)&&(i.__=e,i.u=n,C.__H.__h.push(i))}function zr(e,n){var i=vt(en++,7);return Yr(i.__H,n)&&(i.__=e(),i.__H=n,i.__h=e),i.__}function $a(){for(var e;e=Wr.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Tn),n.__h.some(Ui),n.__h=[]}catch(i){n.__h=[],T.__e(i,e.__v)}}}T.__b=function(e){C=null,Yt&&Yt(e)},T.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Jt&&Jt(e,n)},T.__r=function(e){qt&&qt(e),en=0;var n=(C=e.__c).__H;n&&(Oi===C?(n.__h=[],C.__h=[],n.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(n.__h.some(Tn),n.__h.some(Ui),n.__h=[],en=0)),Oi=C},T.diffed=function(e){Kt&&Kt(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Wr.push(n)!==1&&zt===T.requestAnimationFrame||((zt=T.requestAnimationFrame)||La)($a)),n.__H.__.some(function(i){i.u&&(i.__H=i.u),i.u=void 0})),Oi=C=null},T.__c=function(e,n){n.some(function(i){try{i.__h.some(Tn),i.__h=i.__h.filter(function(t){return!t.__||Ui(t)})}catch(t){n.some(function(l){l.__h&&(l.__h=[])}),n=[],T.__e(t,i.__v)}}),Gt&&Gt(e,n)},T.unmount=function(e){Vt&&Vt(e);var n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(t){try{Tn(t)}catch(l){n=l}}),i.__H=void 0,n&&T.__e(n,i.__v))};var Qt=typeof requestAnimationFrame=="function";function La(e){var n,i=function(){clearTimeout(t),Qt&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(i,35);Qt&&(n=requestAnimationFrame(i))}function Tn(e){var n=C,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),C=n}function Ui(e){var n=C;e.__c=e.__(),C=n}function Yr(e,n){return!e||e.length!==n.length||n.some(function(i,t){return i!==e[t]})}function qr(e,n){return typeof n=="function"?n(e):n}var Ra=Symbol.for("preact-signals");function hi(){if(G>1)G--;else{var e,n=!1;for(function(){var l=jn;for(jn=void 0;l!==void 0;)l.S.v===l.v&&(l.S.i=l.i),l=l.o}();Ge!==void 0;){var i=Ge;for(Ge=void 0,Dn++;i!==void 0;){var t=i.u;if(i.u=void 0,i.f&=-3,!(8&i.f)&&Gr(i))try{i.c()}catch(l){n||(e=l,n=!0)}i=t}}if(Dn=0,G--,n)throw e}}function Fa(e){if(G>0)return e();Hi=++Pa,G++;try{return e()}finally{hi()}}var S=void 0;function mt(e){var n=S;S=void 0;try{return e()}finally{S=n}}var Ge=void 0,G=0,Dn=0,Pa=0,Hi=0,jn=void 0,Bn=0;function Kr(e){if(S!==void 0){var n=e.n;if(n===void 0||n.t!==S)return n={i:0,S:e,p:S.s,n:void 0,t:S,e:void 0,x:void 0,r:n},S.s!==void 0&&(S.s.n=n),S.s=n,e.n=n,32&S.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=S.s,n.n=void 0,S.s.n=n,S.s=n),n}}function L(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}L.prototype.brand=Ra;L.prototype.h=function(){return!0};L.prototype.S=function(e){var n=this,i=this.t;i!==e&&e.e===void 0&&(e.x=i,this.t=e,i!==void 0?i.e=e:mt(function(){var t;(t=n.W)==null||t.call(n)}))};L.prototype.U=function(e){var n=this;if(this.t!==void 0){var i=e.e,t=e.x;i!==void 0&&(i.x=t,e.e=void 0),t!==void 0&&(t.e=i,e.x=void 0),e===this.t&&(this.t=t,t===void 0&&mt(function(){var l;(l=n.Z)==null||l.call(n)}))}};L.prototype.subscribe=function(e){var n=this;return _n(function(){var i=n.value,t=S;S=void 0;try{e(i)}finally{S=t}},{name:"sub"})};L.prototype.valueOf=function(){return this.value};L.prototype.toString=function(){return this.value+""};L.prototype.toJSON=function(){return this.value};L.prototype.peek=function(){var e=this;return mt(function(){return e.value})};Object.defineProperty(L.prototype,"value",{get:function(){var e=Kr(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Dn>100)throw new Error("Cycle detected");(function(i){G!==0&&Dn===0&&i.l!==Hi&&(i.l=Hi,jn={S:i,v:i.v,i:i.i,o:jn})})(this),this.v=e,this.i++,Bn++,G++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{hi()}}}});function p(e,n){return new L(e,n)}function Gr(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function Vr(e){for(var n=e.s;n!==void 0;n=n.n){var i=n.S.n;if(i!==void 0&&(n.r=i),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function Jr(e){for(var n=e.s,i=void 0;n!==void 0;){var t=n.p;n.i===-1?(n.S.U(n),t!==void 0&&(t.n=n.n),n.n!==void 0&&(n.n.p=t)):i=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=t}e.s=i}function ge(e,n){L.call(this,void 0),this.x=e,this.s=void 0,this.g=Bn-1,this.f=4,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}ge.prototype=new L;ge.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Bn))return!0;if(this.g=Bn,this.f|=1,this.i>0&&!Gr(this))return this.f&=-2,!0;var e=S;try{Vr(this),S=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return S=e,Jr(this),this.f&=-2,!0};ge.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}L.prototype.S.call(this,e)};ge.prototype.U=function(e){if(this.t!==void 0&&(L.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};ge.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(ge.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Kr(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Zt(e,n){return new ge(e,n)}function Qr(e){var n=e.m;if(e.m=void 0,typeof n=="function"){G++;var i=S;S=void 0;try{n()}catch(t){throw e.f&=-2,e.f|=8,gt(e),t}finally{S=i,hi()}}}function gt(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,Qr(e)}function Ma(e){if(S!==this)throw new Error("Out-of-order effect");Jr(this),S=e,this.f&=-2,8&this.f&>(this),hi()}function He(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name}He.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{e()}};He.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Qr(this),Vr(this),G++;var e=S;return S=this,Ma.bind(this,e)};He.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ge,Ge=this)};He.prototype.d=function(){this.f|=8,1&this.f||gt(this)};He.prototype.dispose=function(){this.d()};function _n(e,n){var i=new He(e,n);try{i.c()}catch(l){throw i.d(),l}var t=i.d.bind(i);return t[Symbol.dispose]=t,t}var Zr,wn,Da=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Xr=[];_n(function(){Zr=this.N})();function We(e,n){x[e]=n.bind(null,x[e]||function(){})}function Un(e){if(wn){var n=wn;wn=void 0,n()}wn=e&&e.S()}function el(e){var n=this,i=e.data,t=Ba(i);t.value=i;var l=zr(function(){for(var c=n,s=n.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}var u=Zt(function(){var f=t.value.value;return f===0?0:f===!0?"":f||""}),h=Zt(function(){return!Array.isArray(u.value)&&!Lr(u.value)}),d=_n(function(){if(this.N=nl,h.value){var f=u.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=f)}}),_=n.__$u.d;return n.__$u.d=function(){d(),_.call(this)},[h,u]},[]),a=l[0],o=l[1];return a.value?o.peek():o.value}el.displayName="ReactiveTextNode";Object.defineProperties(L.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:el},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});We("__b",function(e,n){if(typeof n.type=="string"){var i,t=n.props;for(var l in t)if(l!=="children"){var a=t[l];a instanceof L&&(i||(n.__np=i={}),i[l]=a,t[l]=a.peek())}}e(n)});We("__r",function(e,n){if(e(n),n.type!==M){Un();var i,t=n.__c;t&&(t.__$f&=-2,(i=t.__$u)===void 0&&(t.__$u=i=function(l,a){var o;return _n(function(){o=this},{name:a}),o.c=l,o}(function(){var l;Da&&((l=i.y)==null||l.call(i)),t.__$f|=1,t.setState({})},typeof n.type=="function"?n.type.displayName||n.type.name:""))),Un(i)}});We("__e",function(e,n,i,t){Un(),e(n,i,t)});We("diffed",function(e,n){Un();var i;if(typeof n.type=="string"&&(i=n.__e)){var t=n.__np,l=n.props;if(t){var a=i.U;if(a)for(var o in a){var c=a[o];c!==void 0&&!(o in t)&&(c.d(),a[o]=void 0)}else a={},i.U=a;for(var s in t){var u=a[s],h=t[s];u===void 0?(u=ja(i,s,h),a[s]=u):u.o(h,l)}for(var d in t)l[d]=t[d]}}e(n)});function ja(e,n,i,t){var l=n in e&&e.ownerSVGElement===void 0,a=p(i),o=i.peek();return{o:function(c,s){a.value=c,o=c.peek()},d:_n(function(){this.N=nl;var c=a.value.value;o!==c?(o=void 0,l?e[n]=c:c!=null&&(c!==!1||n[4]==="-")?e.setAttribute(n,c):e.removeAttribute(n)):o=void 0})}}We("unmount",function(e,n){if(typeof n.type=="string"){var i=n.__e;if(i){var t=i.U;if(t){i.U=void 0;for(var l in t){var a=t[l];a&&a.d()}}}n.__np=void 0}else{var o=n.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}e(n)});We("__h",function(e,n,i,t){(t<3||t===9)&&(n.__$f|=2),e(n,i,t)});Ke.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var i=this.__$u,t=i&&i.s!==void 0;for(var l in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(t||a||4&this.__$f)||1&this.__$f)return!0}else if(!(t||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function Ba(e,n){return zr(function(){return p(e,n)},[])}var Ua=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Ha(){Fa(function(){for(var e;e=Xr.shift();)Zr.call(e)})}function nl(){Xr.push(this)===1&&(x.requestAnimationFrame||Ua)(Ha)}function il(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Hn=p(il());function pi(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let Xt=!1;function Wa(){Xt||(Xt=!0,window.addEventListener("hashchange",()=>{Hn.value=il()}))}let nn=null;function za(e){nn=e}class A extends Error{status;body;constructor(n,i,t){super(t),this.status=n,this.body=i}}async function w(e,n={}){const i={Accept:"application/json",...n.headers??{}};nn!==null&&(i.Authorization=`Bearer ${nn}`);const{body:t,...l}=n,a={...l,headers:i};t!==void 0&&(a.body=JSON.stringify(t),i["Content-Type"]="application/json");const o=await fetch(e,a),c=await o.text(),s=c===""?{}:JSON.parse(c);if(!o.ok){const u=s.error?.message??`request failed (${o.status})`;throw new A(o.status,s,u)}return s}async function Ya(e,n,i,t={}){const l={Accept:"text/event-stream","Content-Type":"application/json",...t.headers??{}};nn!==null&&(l.Authorization=`Bearer ${nn}`);const a=await fetch(e,{...t,method:"POST",headers:l,body:JSON.stringify(n)});if(!a.ok||a.body===null){const h=await a.text().catch(()=>"");let d={};try{d=h===""?{}:JSON.parse(h)}catch{}throw new A(a.status,d,d.error?.message??`stream failed (${a.status})`)}const o=a.body.getReader(),c=new TextDecoder;let s="";const u=h=>{for(const d of h.split(`
|
|
1
|
+
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))t(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&t(o)}).observe(document,{childList:!0,subtree:!0});function i(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function t(l){if(l.ep)return;l.ep=!0;const a=i(l);fetch(l.href,a)}})();var di,x,Lr,$r,ie,Ut,Rr,Fr,Ei,Cn,qe,Pr,dt,Mi,Di,Fn={},Pn=[],wa=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,fi=Array.isArray;function q(e,n){for(var i in n)e[i]=n[i];return e}function ft(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function xa(e,n,i){var t,l,a,o={};for(a in n)a=="key"?t=n[a]:a=="ref"?l=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?di.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return An(e,o,t,l,null)}function An(e,n,i,t,l){var a={type:e,props:n,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++Lr,__i:-1,__u:0};return l==null&&x.vnode!=null&&x.vnode(a),a}function M(e){return e.children}function Ke(e,n){this.props=e,this.context=n}function Pe(e,n){if(n==null)return e.__?Pe(e.__,e.__i+1):null;for(var i;n<e.__k.length;n++)if((i=e.__k[n])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?Pe(e):null}function Sa(e){if(e.__P&&e.__d){var n=e.__v,i=n.__e,t=[],l=[],a=q({},n);a.__v=n.__v+1,x.vnode&&x.vnode(a),ht(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,t,i??Pe(n),!!(32&n.__u),l),a.__v=n.__v,a.__.__k[a.__i]=a,Ur(t,a,l),n.__e=n.__=null,a.__e!=i&&Mr(a)}}function Mr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Mr(e)}function Bt(e){(!e.__d&&(e.__d=!0)&&ie.push(e)&&!Mn.__r++||Ut!=x.debounceRendering)&&((Ut=x.debounceRendering)||Rr)(Mn)}function Mn(){try{for(var e,n=1;ie.length;)ie.length>n&&ie.sort(Fr),e=ie.shift(),n=ie.length,Sa(e)}finally{ie.length=Mn.__r=0}}function Dr(e,n,i,t,l,a,o,c,s,u,h){var d,_,f,v,m,k,b,g=t&&t.__k||Pn,H=n.length;for(s=Ca(i,n,g,s,H),d=0;d<H;d++)(f=i.__k[d])!=null&&(_=f.__i!=-1&&g[f.__i]||Fn,f.__i=d,k=ht(e,f,_,l,a,o,c,s,u,h),v=f.__e,f.ref&&_.ref!=f.ref&&(_.ref&&pt(_.ref,null,f),h.push(f.ref,f.__c||v,f)),m==null&&v!=null&&(m=v),(b=!!(4&f.__u))||_.__k===f.__k?(s=jr(f,s,e,b),b&&_.__e&&(_.__e=null)):typeof f.type=="function"&&k!==void 0?s=k:v&&(s=v.nextSibling),f.__u&=-7);return i.__e=m,s}function Ca(e,n,i,t,l){var a,o,c,s,u,h=i.length,d=h,_=0;for(e.__k=new Array(l),a=0;a<l;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[a]=An(null,o,null,null,null):fi(o)?o=e.__k[a]=An(M,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=An(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,s=a+_,o.__=e,o.__b=e.__b+1,c=null,(u=o.__i=Aa(o,i,s,d))!=-1&&(d--,(c=i[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(l>h?_--:l<h&&_++),typeof o.type!="function"&&(o.__u|=4)):u!=s&&(u==s-1?_--:u==s+1?_++:(u>s?_--:_++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<h;a++)(c=i[a])!=null&&!(2&c.__u)&&(c.__e==t&&(t=Pe(c)),Hr(c,c));return t}function jr(e,n,i,t){var l,a;if(typeof e.type=="function"){for(l=e.__k,a=0;l&&a<l.length;a++)l[a]&&(l[a].__=e,n=jr(l[a],n,i,t));return n}e.__e!=n&&(t&&(n&&e.type&&!n.parentNode&&(n=Pe(e)),i.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Aa(e,n,i,t){var l,a,o,c=e.key,s=e.type,u=n[i],h=u!=null&&(2&u.__u)==0;if(u===null&&c==null||h&&c==u.key&&s==u.type)return i;if(t>(h?1:0)){for(l=i-1,a=i+1;l>=0||a<n.length;)if((u=n[o=l>=0?l--:a++])!=null&&!(2&u.__u)&&c==u.key&&s==u.type)return o}return-1}function Ht(e,n,i){n[0]=="-"?e.setProperty(n,i??""):e[n]=i==null?"":typeof i!="number"||wa.test(n)?i:i+"px"}function kn(e,n,i,t,l){var a,o;e:if(n=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof t=="string"&&(e.style.cssText=t=""),t)for(n in t)i&&n in i||Ht(e.style,n,"");if(i)for(n in i)t&&i[n]==t[n]||Ht(e.style,n,i[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Pr,"$1")),o=n.toLowerCase(),n=o in e||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=i,i?t?i[qe]=t[qe]:(i[qe]=dt,e.addEventListener(n,a?Di:Mi,a)):e.removeEventListener(n,a?Di:Mi,a);else{if(l=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&i==1?"":i))}}function Wt(e){return function(n){if(this.l){var i=this.l[n.type+e];if(n[Cn]==null)n[Cn]=dt++;else if(n[Cn]<i[qe])return;return i(x.event?x.event(n):n)}}}function ht(e,n,i,t,l,a,o,c,s,u){var h,d,_,f,v,m,k,b,g,H,oe,ze,jt,bn,Ti,W=n.type;if(n.constructor!==void 0)return null;128&i.__u&&(s=!!(32&i.__u),a=[c=n.__e=i.__e]),(h=x.__b)&&h(n);e:if(typeof W=="function")try{if(b=n.props,g=W.prototype&&W.prototype.render,H=(h=W.contextType)&&t[h.__c],oe=h?H?H.props.value:h.__:t,i.__c?k=(d=n.__c=i.__c).__=d.__E:(g?n.__c=d=new W(b,oe):(n.__c=d=new Ke(b,oe),d.constructor=W,d.render=Ea),H&&H.sub(d),d.state||(d.state={}),d.__n=t,_=d.__d=!0,d.__h=[],d._sb=[]),g&&d.__s==null&&(d.__s=d.state),g&&W.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=q({},d.__s)),q(d.__s,W.getDerivedStateFromProps(b,d.__s))),f=d.props,v=d.state,d.__v=n,_)g&&W.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),g&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(g&&W.getDerivedStateFromProps==null&&b!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,oe),n.__v==i.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,oe)===!1){n.__v!=i.__v&&(d.props=b,d.state=d.__s,d.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some(function(be){be&&(be.__=n)}),Pn.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,oe),g&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,v,m)})}if(d.context=oe,d.props=b,d.__P=e,d.__e=!1,ze=x.__r,jt=0,g)d.state=d.__s,d.__d=!1,ze&&ze(n),h=d.render(d.props,d.state,d.context),Pn.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,ze&&ze(n),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++jt<25);d.state=d.__s,d.getChildContext!=null&&(t=q(q({},t),d.getChildContext())),g&&!_&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(f,v)),bn=h!=null&&h.type===M&&h.key==null?Br(h.props.children):h,c=Dr(e,fi(bn)?bn:[bn],n,i,t,l,a,o,c,s,u),d.base=n.__e,n.__u&=-161,d.__h.length&&o.push(d),k&&(d.__E=d.__=null)}catch(be){if(n.__v=null,s||a!=null)if(be.then){for(n.__u|=s?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a[a.indexOf(c)]=null,n.__e=c}else{for(Ti=a.length;Ti--;)ft(a[Ti]);ji(n)}else n.__e=i.__e,n.__k=i.__k,be.then||ji(n);x.__e(be,n,i)}else a==null&&n.__v==i.__v?(n.__k=i.__k,n.__e=i.__e):c=n.__e=Ta(i.__e,n,i,t,l,a,o,s,u);return(h=x.diffed)&&h(n),128&n.__u?void 0:c}function ji(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ji))}function Ur(e,n,i){for(var t=0;t<i.length;t++)pt(i[t],i[++t],i[++t]);x.__c&&x.__c(n,e),e.some(function(l){try{e=l.__h,l.__h=[],e.some(function(a){a.call(l)})}catch(a){x.__e(a,l.__v)}})}function Br(e){return typeof e!="object"||e==null||e.__b>0?e:fi(e)?e.map(Br):e.constructor!==void 0?null:q({},e)}function Ta(e,n,i,t,l,a,o,c,s){var u,h,d,_,f,v,m,k=i.props||Fn,b=n.props,g=n.type;if(g=="svg"?l="http://www.w3.org/2000/svg":g=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(b);e=document.createElementNS(l,g,b.is&&b),c&&(x.__m&&x.__m(n,a),c=!1),a=null}if(g==null)k===b||c&&e.data==b||(e.data=b);else{if(a=g=="textarea"&&b.defaultValue!=null?null:a&&di.call(e.childNodes),!c&&a!=null)for(k={},u=0;u<e.attributes.length;u++)k[(f=e.attributes[u]).name]=f.value;for(u in k)f=k[u],u=="dangerouslySetInnerHTML"?d=f:u=="children"||u in b||u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b||kn(e,u,null,f,l);for(u in b)f=b[u],u=="children"?_=f:u=="dangerouslySetInnerHTML"?h=f:u=="value"?v=f:u=="checked"?m=f:c&&typeof f!="function"||k[u]===f||kn(e,u,f,k[u],l);if(h)c||d&&(h.__html==d.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(d&&(e.innerHTML=""),Dr(n.type=="template"?e.content:e,fi(_)?_:[_],n,i,t,g=="foreignObject"?"http://www.w3.org/1999/xhtml":l,a,o,a?a[0]:i.__k&&Pe(i,0),c,s),a!=null)for(u=a.length;u--;)ft(a[u]);c&&g!="textarea"||(u="value",g=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||g=="progress"&&!v||g=="option"&&v!=k[u])&&kn(e,u,v,k[u],l),u="checked",m!=null&&m!=e[u]&&kn(e,u,m,k[u],l))}return e}function pt(e,n,i){try{if(typeof e=="function"){var t=typeof e.__u=="function";t&&e.__u(),t&&n==null||(e.__u=e(n))}else e.current=n}catch(l){x.__e(l,i)}}function Hr(e,n,i){var t,l;if(x.unmount&&x.unmount(e),(t=e.ref)&&(t.current&&t.current!=e.__e||pt(t,null,n)),(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(a){x.__e(a,n)}t.base=t.__P=null}if(t=e.__k)for(l=0;l<t.length;l++)t[l]&&Hr(t[l],n,i||typeof e.type!="function");i||ft(e.__e),e.__c=e.__=e.__e=void 0}function Ea(e,n,i){return this.constructor(e,i)}function Oa(e,n,i){var t,l,a,o;n==document&&(n=document.documentElement),x.__&&x.__(e,n),l=(t=!1)?null:n.__k,a=[],o=[],ht(n,e=n.__k=xa(M,null,[e]),l||Fn,Fn,n.namespaceURI,l?null:n.firstChild?di.call(n.childNodes):null,a,l?l.__e:n.firstChild,t,o),Ur(a,e,o)}di=Pn.slice,x={__e:function(e,n,i,t){for(var l,a,o;n=n.__;)if((l=n.__c)&&!l.__)try{if((a=l.constructor)&&a.getDerivedStateFromError!=null&&(l.setState(a.getDerivedStateFromError(e)),o=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(e,t||{}),o=l.__d),o)return l.__E=l}catch(c){e=c}throw e}},Lr=0,$r=function(e){return e!=null&&e.constructor===void 0},Ke.prototype.setState=function(e,n){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=q({},this.state),typeof e=="function"&&(e=e(q({},i),this.props)),e&&q(i,e),e!=null&&this.__v&&(n&&this._sb.push(n),Bt(this))},Ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bt(this))},Ke.prototype.render=M,ie=[],Rr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fr=function(e,n){return e.__v.__b-n.__v.__b},Mn.__r=0,Ei=Math.random().toString(8),Cn="__d"+Ei,qe="__a"+Ei,Pr=/(PointerCapture)$|Capture$/i,dt=0,Mi=Wt(!1),Di=Wt(!0);var Na=0;function r(e,n,i,t,l,a){n||(n={});var o,c,s=n;if("ref"in s)for(c in s={},n)c=="ref"?o=n[c]:s[c]=n[c];var u={type:e,props:s,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Na,__i:-1,__u:0,__source:l,__self:a};if(typeof e=="function"&&(o=e.defaultProps))for(c in o)s[c]===void 0&&(s[c]=o[c]);return x.vnode&&x.vnode(u),u}var en,C,Oi,zt,Ui=0,Wr=[],T=x,Yt=T.__b,qt=T.__r,Kt=T.diffed,Gt=T.__c,Vt=T.unmount,Jt=T.__;function vt(e,n){T.__h&&T.__h(C,e,Ui||n),Ui=0;var i=C.__H||(C.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function _t(e){return Ui=1,Ia(qr,e)}function Ia(e,n,i){var t=vt(en++,2);if(t.t=e,!t.__c&&(t.__=[qr(void 0,n),function(c){var s=t.__N?t.__N[0]:t.__[0],u=t.t(s,c);s!==u&&(t.__N=[u,t.__[1]],t.__c.setState({}))}],t.__c=C,!C.__f)){var l=function(c,s,u){if(!t.__c.__H)return!0;var h=t.__c.__H.__.filter(function(_){return _.__c});if(h.every(function(_){return!_.__N}))return!a||a.call(this,c,s,u);var d=t.__c.props!==c;return h.some(function(_){if(_.__N){var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(d=!0)}}),a&&a.call(this,c,s,u)||d};C.__f=!0;var a=C.shouldComponentUpdate,o=C.componentWillUpdate;C.componentWillUpdate=function(c,s,u){if(this.__e){var h=a;a=void 0,l(c,s,u),a=h}o&&o.call(this,c,s,u)},C.shouldComponentUpdate=l}return t.__N||t.__}function ee(e,n){var i=vt(en++,3);!T.__s&&Yr(i.__H,n)&&(i.__=e,i.u=n,C.__H.__h.push(i))}function zr(e,n){var i=vt(en++,7);return Yr(i.__H,n)&&(i.__=e(),i.__H=n,i.__h=e),i.__}function La(){for(var e;e=Wr.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Tn),n.__h.some(Bi),n.__h=[]}catch(i){n.__h=[],T.__e(i,e.__v)}}}T.__b=function(e){C=null,Yt&&Yt(e)},T.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Jt&&Jt(e,n)},T.__r=function(e){qt&&qt(e),en=0;var n=(C=e.__c).__H;n&&(Oi===C?(n.__h=[],C.__h=[],n.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(n.__h.some(Tn),n.__h.some(Bi),n.__h=[],en=0)),Oi=C},T.diffed=function(e){Kt&&Kt(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Wr.push(n)!==1&&zt===T.requestAnimationFrame||((zt=T.requestAnimationFrame)||$a)(La)),n.__H.__.some(function(i){i.u&&(i.__H=i.u),i.u=void 0})),Oi=C=null},T.__c=function(e,n){n.some(function(i){try{i.__h.some(Tn),i.__h=i.__h.filter(function(t){return!t.__||Bi(t)})}catch(t){n.some(function(l){l.__h&&(l.__h=[])}),n=[],T.__e(t,i.__v)}}),Gt&&Gt(e,n)},T.unmount=function(e){Vt&&Vt(e);var n,i=e.__c;i&&i.__H&&(i.__H.__.some(function(t){try{Tn(t)}catch(l){n=l}}),i.__H=void 0,n&&T.__e(n,i.__v))};var Qt=typeof requestAnimationFrame=="function";function $a(e){var n,i=function(){clearTimeout(t),Qt&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(i,35);Qt&&(n=requestAnimationFrame(i))}function Tn(e){var n=C,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),C=n}function Bi(e){var n=C;e.__c=e.__(),C=n}function Yr(e,n){return!e||e.length!==n.length||n.some(function(i,t){return i!==e[t]})}function qr(e,n){return typeof n=="function"?n(e):n}var Ra=Symbol.for("preact-signals");function hi(){if(G>1)G--;else{var e,n=!1;for(function(){var l=jn;for(jn=void 0;l!==void 0;)l.S.v===l.v&&(l.S.i=l.i),l=l.o}();Ge!==void 0;){var i=Ge;for(Ge=void 0,Dn++;i!==void 0;){var t=i.u;if(i.u=void 0,i.f&=-3,!(8&i.f)&&Gr(i))try{i.c()}catch(l){n||(e=l,n=!0)}i=t}}if(Dn=0,G--,n)throw e}}function Fa(e){if(G>0)return e();Hi=++Pa,G++;try{return e()}finally{hi()}}var S=void 0;function mt(e){var n=S;S=void 0;try{return e()}finally{S=n}}var Ge=void 0,G=0,Dn=0,Pa=0,Hi=0,jn=void 0,Un=0;function Kr(e){if(S!==void 0){var n=e.n;if(n===void 0||n.t!==S)return n={i:0,S:e,p:S.s,n:void 0,t:S,e:void 0,x:void 0,r:n},S.s!==void 0&&(S.s.n=n),S.s=n,e.n=n,32&S.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=S.s,n.n=void 0,S.s.n=n,S.s=n),n}}function $(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}$.prototype.brand=Ra;$.prototype.h=function(){return!0};$.prototype.S=function(e){var n=this,i=this.t;i!==e&&e.e===void 0&&(e.x=i,this.t=e,i!==void 0?i.e=e:mt(function(){var t;(t=n.W)==null||t.call(n)}))};$.prototype.U=function(e){var n=this;if(this.t!==void 0){var i=e.e,t=e.x;i!==void 0&&(i.x=t,e.e=void 0),t!==void 0&&(t.e=i,e.x=void 0),e===this.t&&(this.t=t,t===void 0&&mt(function(){var l;(l=n.Z)==null||l.call(n)}))}};$.prototype.subscribe=function(e){var n=this;return _n(function(){var i=n.value,t=S;S=void 0;try{e(i)}finally{S=t}},{name:"sub"})};$.prototype.valueOf=function(){return this.value};$.prototype.toString=function(){return this.value+""};$.prototype.toJSON=function(){return this.value};$.prototype.peek=function(){var e=this;return mt(function(){return e.value})};Object.defineProperty($.prototype,"value",{get:function(){var e=Kr(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Dn>100)throw new Error("Cycle detected");(function(i){G!==0&&Dn===0&&i.l!==Hi&&(i.l=Hi,jn={S:i,v:i.v,i:i.i,o:jn})})(this),this.v=e,this.i++,Un++,G++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{hi()}}}});function p(e,n){return new $(e,n)}function Gr(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function Vr(e){for(var n=e.s;n!==void 0;n=n.n){var i=n.S.n;if(i!==void 0&&(n.r=i),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function Jr(e){for(var n=e.s,i=void 0;n!==void 0;){var t=n.p;n.i===-1?(n.S.U(n),t!==void 0&&(t.n=n.n),n.n!==void 0&&(n.n.p=t)):i=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=t}e.s=i}function ge(e,n){$.call(this,void 0),this.x=e,this.s=void 0,this.g=Un-1,this.f=4,this.W=n?.watched,this.Z=n?.unwatched,this.name=n?.name}ge.prototype=new $;ge.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Un))return!0;if(this.g=Un,this.f|=1,this.i>0&&!Gr(this))return this.f&=-2,!0;var e=S;try{Vr(this),S=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return S=e,Jr(this),this.f&=-2,!0};ge.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}$.prototype.S.call(this,e)};ge.prototype.U=function(e){if(this.t!==void 0&&($.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};ge.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(ge.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Kr(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Zt(e,n){return new ge(e,n)}function Qr(e){var n=e.m;if(e.m=void 0,typeof n=="function"){G++;var i=S;S=void 0;try{n()}catch(t){throw e.f&=-2,e.f|=8,gt(e),t}finally{S=i,hi()}}}function gt(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,Qr(e)}function Ma(e){if(S!==this)throw new Error("Out-of-order effect");Jr(this),S=e,this.f&=-2,8&this.f&>(this),hi()}function He(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n?.name}He.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{e()}};He.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Qr(this),Vr(this),G++;var e=S;return S=this,Ma.bind(this,e)};He.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ge,Ge=this)};He.prototype.d=function(){this.f|=8,1&this.f||gt(this)};He.prototype.dispose=function(){this.d()};function _n(e,n){var i=new He(e,n);try{i.c()}catch(l){throw i.d(),l}var t=i.d.bind(i);return t[Symbol.dispose]=t,t}var Zr,wn,Da=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Xr=[];_n(function(){Zr=this.N})();function We(e,n){x[e]=n.bind(null,x[e]||function(){})}function Bn(e){if(wn){var n=wn;wn=void 0,n()}wn=e&&e.S()}function el(e){var n=this,i=e.data,t=Ua(i);t.value=i;var l=zr(function(){for(var c=n,s=n.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}var u=Zt(function(){var f=t.value.value;return f===0?0:f===!0?"":f||""}),h=Zt(function(){return!Array.isArray(u.value)&&!$r(u.value)}),d=_n(function(){if(this.N=nl,h.value){var f=u.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=f)}}),_=n.__$u.d;return n.__$u.d=function(){d(),_.call(this)},[h,u]},[]),a=l[0],o=l[1];return a.value?o.peek():o.value}el.displayName="ReactiveTextNode";Object.defineProperties($.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:el},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});We("__b",function(e,n){if(typeof n.type=="string"){var i,t=n.props;for(var l in t)if(l!=="children"){var a=t[l];a instanceof $&&(i||(n.__np=i={}),i[l]=a,t[l]=a.peek())}}e(n)});We("__r",function(e,n){if(e(n),n.type!==M){Bn();var i,t=n.__c;t&&(t.__$f&=-2,(i=t.__$u)===void 0&&(t.__$u=i=function(l,a){var o;return _n(function(){o=this},{name:a}),o.c=l,o}(function(){var l;Da&&((l=i.y)==null||l.call(i)),t.__$f|=1,t.setState({})},typeof n.type=="function"?n.type.displayName||n.type.name:""))),Bn(i)}});We("__e",function(e,n,i,t){Bn(),e(n,i,t)});We("diffed",function(e,n){Bn();var i;if(typeof n.type=="string"&&(i=n.__e)){var t=n.__np,l=n.props;if(t){var a=i.U;if(a)for(var o in a){var c=a[o];c!==void 0&&!(o in t)&&(c.d(),a[o]=void 0)}else a={},i.U=a;for(var s in t){var u=a[s],h=t[s];u===void 0?(u=ja(i,s,h),a[s]=u):u.o(h,l)}for(var d in t)l[d]=t[d]}}e(n)});function ja(e,n,i,t){var l=n in e&&e.ownerSVGElement===void 0,a=p(i),o=i.peek();return{o:function(c,s){a.value=c,o=c.peek()},d:_n(function(){this.N=nl;var c=a.value.value;o!==c?(o=void 0,l?e[n]=c:c!=null&&(c!==!1||n[4]==="-")?e.setAttribute(n,c):e.removeAttribute(n)):o=void 0})}}We("unmount",function(e,n){if(typeof n.type=="string"){var i=n.__e;if(i){var t=i.U;if(t){i.U=void 0;for(var l in t){var a=t[l];a&&a.d()}}}n.__np=void 0}else{var o=n.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}e(n)});We("__h",function(e,n,i,t){(t<3||t===9)&&(n.__$f|=2),e(n,i,t)});Ke.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var i=this.__$u,t=i&&i.s!==void 0;for(var l in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(t||a||4&this.__$f)||1&this.__$f)return!0}else if(!(t||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function Ua(e,n){return zr(function(){return p(e,n)},[])}var Ba=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Ha(){Fa(function(){for(var e;e=Xr.shift();)Zr.call(e)})}function nl(){Xr.push(this)===1&&(x.requestAnimationFrame||Ba)(Ha)}function il(){const e=window.location.hash;return e===""||e==="#"?"/":e.startsWith("#")?e.slice(1):e}const Hn=p(il());function pi(e){const n=e.startsWith("/")?e:`/${e}`;`#${n}`!==window.location.hash&&(window.location.hash=n)}let Xt=!1;function Wa(){Xt||(Xt=!0,window.addEventListener("hashchange",()=>{Hn.value=il()}))}let nn=null;function za(e){nn=e}class A extends Error{status;body;constructor(n,i,t){super(t),this.status=n,this.body=i}}async function w(e,n={}){const i={Accept:"application/json",...n.headers??{}};nn!==null&&(i.Authorization=`Bearer ${nn}`);const{body:t,...l}=n,a={...l,headers:i};t!==void 0&&(a.body=JSON.stringify(t),i["Content-Type"]="application/json");const o=await fetch(e,a),c=await o.text(),s=c===""?{}:JSON.parse(c);if(!o.ok){const u=s.error?.message??`request failed (${o.status})`;throw new A(o.status,s,u)}return s}async function Ya(e,n,i,t={}){const l={Accept:"text/event-stream","Content-Type":"application/json",...t.headers??{}};nn!==null&&(l.Authorization=`Bearer ${nn}`);const a=await fetch(e,{...t,method:"POST",headers:l,body:JSON.stringify(n)});if(!a.ok||a.body===null){const h=await a.text().catch(()=>"");let d={};try{d=h===""?{}:JSON.parse(h)}catch{}throw new A(a.status,d,d.error?.message??`stream failed (${a.status})`)}const o=a.body.getReader(),c=new TextDecoder;let s="";const u=h=>{for(const d of h.split(`
|
|
2
2
|
`)){if(!d.startsWith("data:"))continue;const _=d.slice(5).trim();if(_!=="")try{i(JSON.parse(_))}catch{}}};for(;;){const{done:h,value:d}=await o.read();if(h)break;s+=c.decode(d,{stream:!0});let _=s.indexOf(`
|
|
3
3
|
|
|
4
4
|
`);for(;_!==-1;)u(s.slice(0,_)),s=s.slice(_+2),_=s.indexOf(`
|
|
5
5
|
|
|
6
|
-
`)}s.trim()!==""&&u(s)}const Me=p(null);async function qa(){try{const e=await w("/api/v1/ping");Me.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{Me.value=null}}function
|
|
6
|
+
`)}s.trim()!==""&&u(s)}const Me=p(null);async function qa(){try{const e=await w("/api/v1/ping");Me.value={...e,projectScopeAvailable:e.projectScopeAvailable===!0,projectSurface:e.projectSurface===!0,devSurfaces:e.devSurfaces===!0}}catch{Me.value=null}}function U(e){switch(e.code){case"VALIDATION":return"Some fields need attention before saving.";case"CONFLICT":return"This file changed on disk while you were editing. Review the latest version and re-save.";case"PRECONDITION_REQUIRED":return"Reload the page once — the optimistic-lock token is missing.";case"NOT_FOUND":return"The file does not exist yet. Use the wizard to create it.";case"ATOMIC_WRITE":return"Write failed mid-flight. The file was not partially modified.";case"YAML_PARSE":return"YAML parse error — fix the file by hand, then reload.";default:return e.message}}function Ka(e){return/expected (boolean|string|number)/i.test(e)?e.replace(/^expected/i,"Expected"):e}function vi(e){const n={};for(const i of e.fields??[])n[i.path]=Ka(i.message);return n}function Ga({id:e,children:n}){return r("p",{class:"ac-field__description",id:e,children:n})}function Va({id:e,children:n}){return r("p",{class:"ac-field__error",id:e,role:"alert","aria-live":"polite",children:n})}function ye({id:e,label:n,description:i,error:t,children:l}){const a=i!==void 0?`${e}-desc`:void 0,o=t!==void 0?`${e}-err`:void 0;return r("div",{class:"ac-field","data-invalid":t!==void 0?"true":void 0,children:[r("label",{class:"ac-field__label",for:e,children:n}),i!==void 0?r(Ga,{id:a,children:i}):null,r("div",{class:"ac-field__control","aria-describedby":a,"aria-errormessage":o,children:l}),t!==void 0?r(Va,{id:o,children:t}):null]})}function tl(e){return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("input",{class:"ac-input",type:"text",id:e.id,name:e.name,value:e.value,placeholder:e.placeholder,"aria-invalid":e.error!==void 0?"true":void 0,onInput:n=>e.onChange(n.currentTarget.value)})})}function Ja(e){const n=e.step??(e.integer===!0?1:"any");return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("input",{class:"ac-input",type:"number",id:e.id,name:e.name,value:Number.isFinite(e.value)?String(e.value):"0",min:e.min,max:e.max,step:n,"aria-invalid":e.error!==void 0?"true":void 0,onInput:i=>{const t=i.currentTarget.value,l=t===""?0:Number(t);e.onChange(Number.isFinite(l)?l:0)}})})}function Qa(e){return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("label",{class:"ac-toggle",children:[r("input",{type:"checkbox",id:e.id,name:e.name,checked:e.value,"aria-invalid":e.error!==void 0?"true":void 0,onChange:n=>e.onChange(n.currentTarget.checked)}),r("span",{class:"ac-toggle__track","aria-hidden":"true"}),r("span",{class:"ac-toggle__state",children:e.value?"On":"Off"})]})})}function rl(e){const n=e.options.length>3;return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:n?r("select",{class:"ac-input",id:e.id,name:e.name,value:e.value,"aria-invalid":e.error!==void 0?"true":void 0,onChange:i=>e.onChange(i.currentTarget.value),children:e.options.map(i=>r("option",{value:i.value,children:i.label??(i.value===""?"(none)":i.value)},i.value))}):r("div",{class:"ac-radio-group",role:"radiogroup","aria-labelledby":`${e.id}-label`,children:e.options.map(i=>{const t=`${e.id}-${i.value||"none"}`;return r("label",{class:"ac-radio",for:t,children:[r("input",{type:"radio",id:t,name:e.name,value:i.value,checked:i.value===e.value,onChange:()=>e.onChange(i.value)}),r("span",{children:i.label??(i.value===""?"(none)":i.value)})]},i.value)})})})}function Wn(e){return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:r("textarea",{class:"ac-textarea",id:e.id,name:e.name,rows:e.rows??6,placeholder:e.placeholder,"aria-invalid":e.error!==void 0?"true":void 0,onInput:n=>e.onChange(n.currentTarget.value),children:e.value})})}function ll(e){return e.replace(/_/g," ").replace(/\./g," › ").replace(/\b\w/g,n=>n.toUpperCase())}function Za(e){return e.enum!==void 0&&e.enum.length>0?"enum":e.type==="integer"?"integer":e.type==="number"?"number":e.type==="boolean"?"boolean":e.type==="string"?"string":e.type==="array"&&e.items?.type==="string"?"array-of-strings":"unsupported"}function Ni(e,n){const i=Za(n);return{path:e,kind:i,label:ll(e[e.length-1]??""),description:n.description,options:n.enum,min:n.minimum,max:n.maximum,defaultValue:n.default}}function al(e){const n=[],i=e.properties??{};for(const[t,l]of Object.entries(i))if(l.type==="object"&&l.properties!==void 0){const a=[];for(const[o,c]of Object.entries(l.properties))if(c.type==="object"&&c.properties!==void 0)for(const[s,u]of Object.entries(c.properties))a.push(Ni([t,o,s],u));else a.push(Ni([t,o],c));n.push({path:[t],label:ll(t),description:l.description,fields:a})}else{const a=n.find(c=>c.path[0]==="__general"),o=Ni([t],l);a===void 0?n.unshift({path:["__general"],label:"General",fields:[o]}):a.fields.push(o)}return n}function mn(e,n){let i=e;for(const t of n){if(i===null||typeof i!="object"||Array.isArray(i))return;i=i[t]}return i}function tn(e,n,i){if(n.length===0)return e;const[t,...l]=n;if(t===void 0)return e;const a={...e};if(l.length===0)return a[t]=i,a;const o=a[t],c=o!==null&&typeof o=="object"&&!Array.isArray(o)?o:{};return a[t]=tn(c,l,i),a}function Ie(e){return e.join(".")}function er(e,n,i,t){const l=Ie(e.path),a=l,o=mn(n,e.path),c=i[l],s=u=>{t(tn(n,e.path,u))};switch(e.kind){case"string":{const u=typeof o=="string"?o:"";return u.length>80?r(Wn,{id:l,name:a,label:e.label,description:e.description,error:c,value:u,onChange:s}):r(tl,{id:l,name:a,label:e.label,description:e.description,error:c,value:u,onChange:s})}case"enum":{const u=typeof o=="string"||typeof o=="number"?String(o):"",h=(e.options??[]).map(d=>({value:String(d)}));return r(rl,{id:l,name:a,label:e.label,description:e.description,error:c,value:u,options:h,onChange:s})}case"number":case"integer":{const u=typeof o=="number"?o:0;return r(Ja,{id:l,name:a,label:e.label,description:e.description,error:c,value:u,integer:e.kind==="integer",min:e.min,max:e.max,onChange:s})}case"boolean":{const u=typeof o=="boolean"?o:!1;return r(Qa,{id:l,name:a,label:e.label,description:e.description,error:c,value:u,onChange:s})}case"array-of-strings":{const h=(Array.isArray(o)?o.filter(d=>typeof d=="string"):[]).join(`
|
|
7
7
|
`);return r(Wn,{id:l,name:a,label:e.label,description:`${e.description??""} (one entry per line)`.trim(),error:c,value:h,onChange:d=>{const _=d.split(`
|
|
8
8
|
`).map(f=>f.trim()).filter(f=>f!=="");s(_)}})}default:return null}}function Xa({field:e,values:n,errors:i,onChange:t,decorate:l}){const a=Ie(e.path),o=l?.(a,e);return o===void 0?r("div",{children:er(e,n,i,t)},a):r("div",{class:`ac-field-row${o.modified?" ac-field-row--modified":""}`,children:[r("div",{class:"ac-field-row__body",children:er(e,n,i,t)}),r("div",{class:"ac-field-row__meta",children:[o.sourceLabel!==void 0?r("span",{class:"ac-badge ac-badge--source",title:`Value set in the ${o.sourceLabel} layer`,children:o.sourceLabel}):null,o.modified&&o.onReset!==void 0?r("button",{type:"button",class:"ac-field-row__reset",title:"Reset to default",onClick:o.onReset,children:"Reset"}):null]})]})}function ol({section:e,values:n,errors:i,onChange:t,decorate:l,footer:a}){return r("section",{class:"ac-section","aria-labelledby":`section-${Ie(e.path)}`,children:[r("h2",{class:"ac-section__title",id:`section-${Ie(e.path)}`,children:e.label}),e.description!==void 0?r("p",{class:"ac-section__description",children:e.description}):null,r("div",{class:"ac-section__fields",children:e.fields.map(o=>r(Xa,{field:o,values:n,errors:i,onChange:t,decorate:l},Ie(o.path)))}),a]})}function eo(e){const n=al(e.schema),i=e.errors??{};return r("form",{class:"ac-form",onSubmit:t=>t.preventDefault(),children:[n.map(t=>r(ol,{section:t,values:e.values,errors:i,onChange:e.onChange,decorate:e.decorate},Ie(t.path))),e.actions!==void 0?r("div",{class:"ac-form__actions",children:e.actions}):null]})}function no(e){const[n]=_t(()=>`${e.id}-list`);return r(ye,{id:e.id,label:e.label,description:e.description,error:e.error,children:[r("input",{class:"ac-input",type:"text",id:e.id,name:e.name,value:e.value,placeholder:e.placeholder,list:n,"aria-invalid":e.error!==void 0?"true":void 0,onInput:i=>e.onChange(i.currentTarget.value)}),r("datalist",{id:n,children:e.suggestions.map(i=>r("option",{value:i},i))})]})}const io=["developer","reviewer","designer","product-manager","ops","qa","maintainer"],to=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function nr(){return new Date().toISOString().slice(0,10)}function ke(e,n){return e?.[n]}function ro({value:e,onChange:n,errors:i,hideRole:t,hideIdentityBasics:l}){const[a,o]=_t(""),c="umd-role-suggestions";function s(v){n({...e,...v,last_updated:nr()})}const u=e.role.filter(v=>v.trim()!=="");function h(v){const m=v.trim();if(m===""||u.includes(m)){o("");return}s({role:[...u,m]}),o("")}function d(v){u.length<=1||s({role:u.filter(m=>m!==v)})}function _(v){const m={...e,last_updated:nr()};v===""?delete m.notes:m.notes=v,n(m)}const f=io.filter(v=>!u.includes(v));return r("div",{class:"ac-user-md-form",children:[l?null:r(tl,{id:"umd-name",name:"identity.name",label:"Name",description:'How the agent addresses you in chat (e.g. "Matze", "Sarah"). Required.',value:e.identity.name,error:ke(i,"identity.name"),onChange:v=>s({identity:{...e.identity,name:v}})}),l?null:r(no,{id:"umd-language",name:"language",label:"Language",description:"BCP-47 tag the agent mirrors in replies (e.g. 'de', 'en', 'en-US').",value:e.language,suggestions:to,error:ke(i,"language"),onChange:v=>s({language:v})}),t?null:r(ye,{id:"umd-role-input",label:"Roles",description:"One or more roles. Seeded suggestions are non-binding — type anything and press Enter.",error:ke(i,"role"),children:[r("ul",{class:"ac-chip-list","data-testid":"umd-role-list",children:u.map(v=>r("li",{class:"ac-chip",children:[r("span",{children:v}),r("button",{type:"button",class:"ac-chip__remove","aria-label":`Remove ${v}`,disabled:u.length<=1,onClick:()=>d(v),children:"×"})]},v))}),r("div",{class:"ac-role-add",children:[r("input",{class:"ac-input",type:"text",id:"umd-role-input",name:"role-add",list:c,placeholder:"Add a role and press Enter",value:a,onInput:v=>o(v.currentTarget.value),onKeyDown:v=>{(v.key==="Enter"||v.key===",")&&(v.preventDefault(),h(a))}}),r("datalist",{id:c,children:f.map(v=>r("option",{value:v},v))}),r("button",{type:"button",class:"ac-button",onClick:()=>h(a),children:"Add role"})]})]}),r(rl,{id:"umd-pace",name:"style.pace",label:"Pace",value:e.style.pace,error:ke(i,"style.pace"),options:[{value:"pragmatic",label:"Pragmatic"},{value:"thorough",label:"Thorough"},{value:"rapid",label:"Rapid"}],onChange:v=>s({style:{...e.style,pace:v}})}),r(Wn,{id:"umd-voice",name:"voice_sample",label:"Voice sample",description:"One to three sentences in your own style. The agent uses it as a tone anchor.",rows:4,value:e.voice_sample,error:ke(i,"voice_sample"),onChange:v=>s({voice_sample:v})}),r(Wn,{id:"umd-notes",name:"notes",label:"Notes",description:"Optional free-form prose the agent remembers across sessions.",rows:6,value:e.notes??"",error:ke(i,"notes"),onChange:_})]})}function cl(){return{version:1,identity:{name:""},language:"en",role:[],style:{pace:"pragmatic"},voice_sample:"",last_updated:"1970-01-01"}}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xn(e,n){return typeof e=="string"?e:n}function lo(e){return e==="thorough"||e==="rapid"?e:"pragmatic"}function ao(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim()!==""):[]}function oo(e){if(typeof e=="string")return e===""?void 0:e}function tr(e){const n=cl(),i=ir(e.identity)?e.identity:{},t=ir(e.style)?e.style:{},l=oo(e.notes),a={version:1,identity:{name:xn(i.name,n.identity.name)},language:xn(e.language,n.language),role:ao(e.role),style:{pace:lo(t.pace)},voice_sample:xn(e.voice_sample,n.voice_sample),last_updated:xn(e.last_updated,n.last_updated)};return l!==void 0&&(a.notes=l),a}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function sl(e){return typeof e>"u"||e===null}function co(e){return typeof e=="object"&&e!==null}function so(e){return Array.isArray(e)?e:sl(e)?[]:[e]}function uo(e,n){var i,t,l,a;if(n)for(a=Object.keys(n),i=0,t=a.length;i<t;i+=1)l=a[i],e[l]=n[l];return e}function fo(e,n){var i="",t;for(t=0;t<n;t+=1)i+=e;return i}function ho(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var po=sl,vo=co,_o=so,mo=fo,go=ho,yo=uo,I={isNothing:po,isObject:vo,toArray:_o,repeat:mo,isNegativeZero:go,extend:yo};function ul(e,n){var i="",t=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(i+='in "'+e.mark.name+'" '),i+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(i+=`
|
|
9
9
|
|
|
10
|
-
`+e.mark.snippet),t+" "+i):t}function rn(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ul(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}rn.prototype=Object.create(Error.prototype);rn.prototype.constructor=rn;rn.prototype.toString=function(n){return this.name+": "+ul(this,n)};var F=rn;function Ii(e,n,i,t,l){var a="",o="",c=Math.floor(l/2)-1;return t-n>c&&(a=" ... ",n=t-c+a.length),i-t>c&&(o=" ...",i=t+c-o.length),{str:a+e.slice(n,i).replace(/\t/g,"→")+o,pos:t-n+a.length}}function
|
|
11
|
-
`+c;for(u=Ii(e.buffer,t[o],l[o],e.position,d),c+=I.repeat(" ",n.indent)
|
|
10
|
+
`+e.mark.snippet),t+" "+i):t}function rn(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ul(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}rn.prototype=Object.create(Error.prototype);rn.prototype.constructor=rn;rn.prototype.toString=function(n){return this.name+": "+ul(this,n)};var F=rn;function Ii(e,n,i,t,l){var a="",o="",c=Math.floor(l/2)-1;return t-n>c&&(a=" ... ",n=t-c+a.length),i-t>c&&(o=" ...",i=t+c-o.length),{str:a+e.slice(n,i).replace(/\t/g,"→")+o,pos:t-n+a.length}}function Li(e,n){return I.repeat(" ",n-e.length)+e}function bo(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var i=/\r?\n|\r|\0/g,t=[0],l=[],a,o=-1;a=i.exec(e.buffer);)l.push(a.index),t.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=t.length-2);o<0&&(o=t.length-1);var c="",s,u,h=Math.min(e.line+n.linesAfter,l.length).toString().length,d=n.maxLength-(n.indent+h+3);for(s=1;s<=n.linesBefore&&!(o-s<0);s++)u=Ii(e.buffer,t[o-s],l[o-s],e.position-(t[o]-t[o-s]),d),c=I.repeat(" ",n.indent)+Li((e.line-s+1).toString(),h)+" | "+u.str+`
|
|
11
|
+
`+c;for(u=Ii(e.buffer,t[o],l[o],e.position,d),c+=I.repeat(" ",n.indent)+Li((e.line+1).toString(),h)+" | "+u.str+`
|
|
12
12
|
`,c+=I.repeat("-",n.indent+h+3+u.pos)+`^
|
|
13
|
-
`,s=1;s<=n.linesAfter&&!(o+s>=l.length);s++)u=Ii(e.buffer,t[o+s],l[o+s],e.position-(t[o]-t[o+s]),d),c+=I.repeat(" ",n.indent)
|
|
14
|
-
`;return c.replace(/\n$/,"")}var ko=bo,wo=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xo=["scalar","sequence","mapping"];function So(e){var n={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(t){n[String(t)]=i})}),n}function Co(e,n){if(n=n||{},Object.keys(n).forEach(function(i){if(wo.indexOf(i)===-1)throw new F('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(i){return i},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=So(n.styleAliases||null),xo.indexOf(this.kind)===-1)throw new F('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var
|
|
15
|
-
\r`;function Vo(e){if(e===null)return!1;var n,i,t=0,l=e.length,a=yt;for(i=0;i<l;i++)if(n=a.indexOf(e.charAt(i)),!(n>64)){if(n<0)return!1;t+=6}return t%8===0}function Jo(e){var n,i,t=e.replace(/[\r\n=]/g,""),l=t.length,a=yt,o=0,c=[];for(n=0;n<l;n++)n%4===0&&n&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|a.indexOf(t.charAt(n));return i=l%4*6,i===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):i===18?(c.push(o>>10&255),c.push(o>>2&255)):i===12&&c.push(o>>4&255),new Uint8Array(c)}function Qo(e){var n="",i=0,t,l,a=e.length,o=yt;for(t=0;t<a;t++)t%3===0&&t&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]),i=(i<<8)+e[t];return l=a%3,l===0?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]):l===2?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):l===1&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}function Zo(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Al=new
|
|
16
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function _c(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Rl(e,n,i){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:i}):e[n]=i}var Fl=new Array(256),Pl=new Array(256);for(var we=0;we<256;we++)Fl[we]=or(we)?1:0,Pl[we]=or(we);function mc(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||bt,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Ml(e,n){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=ko(i),new F(n,i)}function y(e,n){throw Ml(e,n)}function qn(e,n){e.onWarning&&e.onWarning.call(null,Ml(e,n))}var cr={YAML:function(n,i,t){var l,a,o;n.version!==null&&y(n,"duplication of %YAML directive"),t.length!==1&&y(n,"YAML directive accepts exactly one argument"),l=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),l===null&&y(n,"ill-formed argument of the YAML directive"),a=parseInt(l[1],10),o=parseInt(l[2],10),a!==1&&y(n,"unacceptable YAML version of the document"),n.version=t[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&qn(n,"unsupported YAML version of the document")},TAG:function(n,i,t){var l,a;t.length!==2&&y(n,"TAG directive accepts exactly two arguments"),l=t[0],a=t[1]
|
|
17
|
-
`,n-1))}function gc(e,n,i){var t,l,a,o,c,s,u,h,d=e.kind,_=e.result,f;if(f=e.input.charCodeAt(e.position),D(f)||Ae(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(l=e.input.charCodeAt(e.position+1),D(l)||i&&Ae(l)))return!1;for(e.kind="scalar",e.result="",a=o=e.position,c=!1;f!==0;){if(f===58){if(l=e.input.charCodeAt(e.position+1),D(l)||i&&Ae(l))break}else if(f===35){if(t=e.input.charCodeAt(e.position-1),D(t))break}else{if(e.position===e.lineStart&&_i(e)||i&&Ae(f))break;if(z(f))if(s=e.line,u=e.lineStart,h=e.lineIndent,N(e,!1,-1),e.lineIndent>=n){c=!0,f=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=s,e.lineStart=u,e.lineIndent=h;break}}c&&(le(e,a,o,!1),wt(e,e.line-s),a=o=e.position,c=!1),se(f)||(o=e.position+1),f=e.input.charCodeAt(++e.position)}return le(e,a,o,!1),e.result?!0:(e.kind=d,e.result=_,!1)}function yc(e,n){var i,t,l;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=l=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(le(e,t,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)t=e.position,e.position++,l=e.position;else return!0;else z(i)?(le(e,t,l,!0),wt(e,N(e,!1,n)),t=l=e.position):e.position===e.lineStart&&_i(e)?y(e,"unexpected end of the document within a single quoted scalar"):(e.position++,l=e.position);y(e,"unexpected end of the stream within a single quoted scalar")}function bc(e,n){var i,t,l,a,o,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=t=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return le(e,i,e.position,!0),e.position++,!0;if(c===92){if(le(e,i,e.position,!0),c=e.input.charCodeAt(++e.position),z(c))N(e,!1,n);else if(c<256&&Fl[c])e.result+=Pl[c],e.position++;else if((o=pc(c))>0){for(l=o,a=0;l>0;l--)c=e.input.charCodeAt(++e.position),(o=hc(c))>=0?a=(a<<4)+o:y(e,"expected hexadecimal character");e.result+=_c(a),e.position++}else y(e,"unknown escape sequence");i=t=e.position}else z(c)?(le(e,i,t,!0),wt(e,N(e,!1,n)),i=t=e.position):e.position===e.lineStart&&_i(e)?y(e,"unexpected end of the document within a double quoted scalar"):(e.position++,t=e.position)}y(e,"unexpected end of the stream within a double quoted scalar")}function kc(e,n){var i=!0,t,l,a,o=e.tag,c,s=e.anchor,u,h,d,_,f,v=Object.create(null),m,k,b,g;if(g=e.input.charCodeAt(e.position),g===91)h=93,f=!1,c=[];else if(g===123)h=125,f=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),g=e.input.charCodeAt(++e.position);g!==0;){if(N(e,!0,n),g=e.input.charCodeAt(e.position),g===h)return e.position++,e.tag=o,e.anchor=s,e.kind=f?"mapping":"sequence",e.result=c,!0;i?g===44&&y(e,"expected the node content, but found ','"):y(e,"missed comma between flow collection entries"),k=m=b=null,d=_=!1,g===63&&(u=e.input.charCodeAt(e.position+1),D(u)&&(d=_=!0,e.position++,N(e,!0,n))),t=e.line,l=e.lineStart,a=e.position,De(e,n,zn,!1,!0),k=e.tag,m=e.result,N(e,!0,n),g=e.input.charCodeAt(e.position),(_||e.line===t)&&g===58&&(d=!0,g=e.input.charCodeAt(++e.position),N(e,!0,n),De(e,n,zn,!1,!0),b=e.result),f?Te(e,c,v,k,m,b,t,l,a):d?c.push(Te(e,null,v,k,m,b,t,l,a)):c.push(m),N(e,!0,n),g=e.input.charCodeAt(e.position),g===44?(i=!0,g=e.input.charCodeAt(++e.position)):i=!1}y(e,"unexpected end of the stream within a flow collection")}function wc(e,n){var i,t,l
|
|
18
|
-
`,a?1+s:s):l
|
|
13
|
+
`,s=1;s<=n.linesAfter&&!(o+s>=l.length);s++)u=Ii(e.buffer,t[o+s],l[o+s],e.position-(t[o]-t[o+s]),d),c+=I.repeat(" ",n.indent)+Li((e.line+s+1).toString(),h)+" | "+u.str+`
|
|
14
|
+
`;return c.replace(/\n$/,"")}var ko=bo,wo=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xo=["scalar","sequence","mapping"];function So(e){var n={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(t){n[String(t)]=i})}),n}function Co(e,n){if(n=n||{},Object.keys(n).forEach(function(i){if(wo.indexOf(i)===-1)throw new F('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(i){return i},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=So(n.styleAliases||null),xo.indexOf(this.kind)===-1)throw new F('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var L=Co;function rr(e,n){var i=[];return e[n].forEach(function(t){var l=i.length;i.forEach(function(a,o){a.tag===t.tag&&a.kind===t.kind&&a.multi===t.multi&&(l=o)}),i[l]=t}),i}function Ao(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,i;function t(l){l.multi?(e.multi[l.kind].push(l),e.multi.fallback.push(l)):e[l.kind][l.tag]=e.fallback[l.tag]=l}for(n=0,i=arguments.length;n<i;n+=1)arguments[n].forEach(t);return e}function Wi(e){return this.extend(e)}Wi.prototype.extend=function(n){var i=[],t=[];if(n instanceof L)t.push(n);else if(Array.isArray(n))t=t.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(i=i.concat(n.implicit)),n.explicit&&(t=t.concat(n.explicit));else throw new F("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(a){if(!(a instanceof L))throw new F("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new F("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new F("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),t.forEach(function(a){if(!(a instanceof L))throw new F("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var l=Object.create(Wi.prototype);return l.implicit=(this.implicit||[]).concat(i),l.explicit=(this.explicit||[]).concat(t),l.compiledImplicit=rr(l,"implicit"),l.compiledExplicit=rr(l,"explicit"),l.compiledTypeMap=Ao(l.compiledImplicit,l.compiledExplicit),l};var dl=Wi,fl=new L("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),hl=new L("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),pl=new L("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),vl=new dl({explicit:[fl,hl,pl]});function To(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function Eo(){return null}function Oo(e){return e===null}var _l=new L("tag:yaml.org,2002:null",{kind:"scalar",resolve:To,construct:Eo,predicate:Oo,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function No(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function Io(e){return e==="true"||e==="True"||e==="TRUE"}function Lo(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var ml=new L("tag:yaml.org,2002:bool",{kind:"scalar",resolve:No,construct:Io,predicate:Lo,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function $o(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Ro(e){return 48<=e&&e<=55}function Fo(e){return 48<=e&&e<=57}function Po(e){if(e===null)return!1;var n=e.length,i=0,t=!1,l;if(!n)return!1;if(l=e[i],(l==="-"||l==="+")&&(l=e[++i]),l==="0"){if(i+1===n)return!0;if(l=e[++i],l==="b"){for(i++;i<n;i++)if(l=e[i],l!=="_"){if(l!=="0"&&l!=="1")return!1;t=!0}return t&&l!=="_"}if(l==="x"){for(i++;i<n;i++)if(l=e[i],l!=="_"){if(!$o(e.charCodeAt(i)))return!1;t=!0}return t&&l!=="_"}if(l==="o"){for(i++;i<n;i++)if(l=e[i],l!=="_"){if(!Ro(e.charCodeAt(i)))return!1;t=!0}return t&&l!=="_"}}if(l==="_")return!1;for(;i<n;i++)if(l=e[i],l!=="_"){if(!Fo(e.charCodeAt(i)))return!1;t=!0}return!(!t||l==="_")}function Mo(e){var n=e,i=1,t;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),t=n[0],(t==="-"||t==="+")&&(t==="-"&&(i=-1),n=n.slice(1),t=n[0]),n==="0")return 0;if(t==="0"){if(n[1]==="b")return i*parseInt(n.slice(2),2);if(n[1]==="x")return i*parseInt(n.slice(2),16);if(n[1]==="o")return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)}function Do(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!I.isNegativeZero(e)}var gl=new L("tag:yaml.org,2002:int",{kind:"scalar",resolve:Po,construct:Mo,predicate:Do,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),jo=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Uo(e){return!(e===null||!jo.test(e)||e[e.length-1]==="_")}function Bo(e){var n,i;return n=e.replace(/_/g,"").toLowerCase(),i=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:i*parseFloat(n,10)}var Ho=/^[-+]?[0-9]+e/;function Wo(e,n){var i;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(I.isNegativeZero(e))return"-0.0";return i=e.toString(10),Ho.test(i)?i.replace("e",".e"):i}function zo(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||I.isNegativeZero(e))}var yl=new L("tag:yaml.org,2002:float",{kind:"scalar",resolve:Uo,construct:Bo,predicate:zo,represent:Wo,defaultStyle:"lowercase"}),bl=vl.extend({implicit:[_l,ml,gl,yl]}),kl=bl,wl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),xl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Yo(e){return e===null?!1:wl.exec(e)!==null||xl.exec(e)!==null}function qo(e){var n,i,t,l,a,o,c,s=0,u=null,h,d,_;if(n=wl.exec(e),n===null&&(n=xl.exec(e)),n===null)throw new Error("Date resolve error");if(i=+n[1],t=+n[2]-1,l=+n[3],!n[4])return new Date(Date.UTC(i,t,l));if(a=+n[4],o=+n[5],c=+n[6],n[7]){for(s=n[7].slice(0,3);s.length<3;)s+="0";s=+s}return n[9]&&(h=+n[10],d=+(n[11]||0),u=(h*60+d)*6e4,n[9]==="-"&&(u=-u)),_=new Date(Date.UTC(i,t,l,a,o,c,s)),u&&_.setTime(_.getTime()-u),_}function Ko(e){return e.toISOString()}var Sl=new L("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Yo,construct:qo,instanceOf:Date,represent:Ko});function Go(e){return e==="<<"||e===null}var Cl=new L("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Go}),yt=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
15
|
+
\r`;function Vo(e){if(e===null)return!1;var n,i,t=0,l=e.length,a=yt;for(i=0;i<l;i++)if(n=a.indexOf(e.charAt(i)),!(n>64)){if(n<0)return!1;t+=6}return t%8===0}function Jo(e){var n,i,t=e.replace(/[\r\n=]/g,""),l=t.length,a=yt,o=0,c=[];for(n=0;n<l;n++)n%4===0&&n&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|a.indexOf(t.charAt(n));return i=l%4*6,i===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):i===18?(c.push(o>>10&255),c.push(o>>2&255)):i===12&&c.push(o>>4&255),new Uint8Array(c)}function Qo(e){var n="",i=0,t,l,a=e.length,o=yt;for(t=0;t<a;t++)t%3===0&&t&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]),i=(i<<8)+e[t];return l=a%3,l===0?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]):l===2?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):l===1&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}function Zo(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Al=new L("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Vo,construct:Jo,predicate:Zo,represent:Qo}),Xo=Object.prototype.hasOwnProperty,ec=Object.prototype.toString;function nc(e){if(e===null)return!0;var n=[],i,t,l,a,o,c=e;for(i=0,t=c.length;i<t;i+=1){if(l=c[i],o=!1,ec.call(l)!=="[object Object]")return!1;for(a in l)if(Xo.call(l,a))if(!o)o=!0;else return!1;if(!o)return!1;if(n.indexOf(a)===-1)n.push(a);else return!1}return!0}function ic(e){return e!==null?e:[]}var Tl=new L("tag:yaml.org,2002:omap",{kind:"sequence",resolve:nc,construct:ic}),tc=Object.prototype.toString;function rc(e){if(e===null)return!0;var n,i,t,l,a,o=e;for(a=new Array(o.length),n=0,i=o.length;n<i;n+=1){if(t=o[n],tc.call(t)!=="[object Object]"||(l=Object.keys(t),l.length!==1))return!1;a[n]=[l[0],t[l[0]]]}return!0}function lc(e){if(e===null)return[];var n,i,t,l,a,o=e;for(a=new Array(o.length),n=0,i=o.length;n<i;n+=1)t=o[n],l=Object.keys(t),a[n]=[l[0],t[l[0]]];return a}var El=new L("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:rc,construct:lc}),ac=Object.prototype.hasOwnProperty;function oc(e){if(e===null)return!0;var n,i=e;for(n in i)if(ac.call(i,n)&&i[n]!==null)return!1;return!0}function cc(e){return e!==null?e:{}}var Ol=new L("tag:yaml.org,2002:set",{kind:"mapping",resolve:oc,construct:cc}),bt=kl.extend({implicit:[Sl,Cl],explicit:[Al,Tl,El,Ol]}),ae=Object.prototype.hasOwnProperty,zn=1,Nl=2,Il=3,Yn=4,$i=1,sc=2,lr=3,uc=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dc=/[\x85\u2028\u2029]/,fc=/[,\[\]\{\}]/,Ll=/^(?:!|!!|![a-z\-]+!)$/i,$l=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ar(e){return Object.prototype.toString.call(e)}function z(e){return e===10||e===13}function se(e){return e===9||e===32}function D(e){return e===9||e===32||e===10||e===13}function Ae(e){return e===44||e===91||e===93||e===123||e===125}function hc(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function pc(e){return e===120?2:e===117?4:e===85?8:0}function vc(e){return 48<=e&&e<=57?e-48:-1}function or(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
16
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function _c(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Rl(e,n,i){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:i}):e[n]=i}var Fl=new Array(256),Pl=new Array(256);for(var we=0;we<256;we++)Fl[we]=or(we)?1:0,Pl[we]=or(we);function mc(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||bt,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Ml(e,n){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=ko(i),new F(n,i)}function y(e,n){throw Ml(e,n)}function qn(e,n){e.onWarning&&e.onWarning.call(null,Ml(e,n))}var cr={YAML:function(n,i,t){var l,a,o;n.version!==null&&y(n,"duplication of %YAML directive"),t.length!==1&&y(n,"YAML directive accepts exactly one argument"),l=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),l===null&&y(n,"ill-formed argument of the YAML directive"),a=parseInt(l[1],10),o=parseInt(l[2],10),a!==1&&y(n,"unacceptable YAML version of the document"),n.version=t[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&qn(n,"unsupported YAML version of the document")},TAG:function(n,i,t){var l,a;t.length!==2&&y(n,"TAG directive accepts exactly two arguments"),l=t[0],a=t[1],Ll.test(l)||y(n,"ill-formed tag handle (first argument) of the TAG directive"),ae.call(n.tagMap,l)&&y(n,'there is a previously declared suffix for "'+l+'" tag handle'),$l.test(a)||y(n,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{y(n,"tag prefix is malformed: "+a)}n.tagMap[l]=a}};function le(e,n,i,t){var l,a,o,c;if(n<i){if(c=e.input.slice(n,i),t)for(l=0,a=c.length;l<a;l+=1)o=c.charCodeAt(l),o===9||32<=o&&o<=1114111||y(e,"expected valid JSON character");else uc.test(c)&&y(e,"the stream contains non-printable characters");e.result+=c}}function sr(e,n,i,t){var l,a,o,c;for(I.isObject(i)||y(e,"cannot merge mappings; the provided source object is unacceptable"),l=Object.keys(i),o=0,c=l.length;o<c;o+=1)a=l[o],ae.call(n,a)||(Rl(n,a,i[a]),t[a]=!0)}function Te(e,n,i,t,l,a,o,c,s){var u,h;if(Array.isArray(l))for(l=Array.prototype.slice.call(l),u=0,h=l.length;u<h;u+=1)Array.isArray(l[u])&&y(e,"nested arrays are not supported inside keys"),typeof l=="object"&&ar(l[u])==="[object Object]"&&(l[u]="[object Object]");if(typeof l=="object"&&ar(l)==="[object Object]"&&(l="[object Object]"),l=String(l),n===null&&(n={}),t==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(u=0,h=a.length;u<h;u+=1)sr(e,n,a[u],i);else sr(e,n,a,i);else!e.json&&!ae.call(i,l)&&ae.call(n,l)&&(e.line=o||e.line,e.lineStart=c||e.lineStart,e.position=s||e.position,y(e,"duplicated mapping key")),Rl(n,l,a),delete i[l];return n}function kt(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):y(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function N(e,n,i){for(var t=0,l=e.input.charCodeAt(e.position);l!==0;){for(;se(l);)l===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),l=e.input.charCodeAt(++e.position);if(n&&l===35)do l=e.input.charCodeAt(++e.position);while(l!==10&&l!==13&&l!==0);if(z(l))for(kt(e),l=e.input.charCodeAt(e.position),t++,e.lineIndent=0;l===32;)e.lineIndent++,l=e.input.charCodeAt(++e.position);else break}return i!==-1&&t!==0&&e.lineIndent<i&&qn(e,"deficient indentation"),t}function _i(e){var n=e.position,i;return i=e.input.charCodeAt(n),!!((i===45||i===46)&&i===e.input.charCodeAt(n+1)&&i===e.input.charCodeAt(n+2)&&(n+=3,i=e.input.charCodeAt(n),i===0||D(i)))}function wt(e,n){n===1?e.result+=" ":n>1&&(e.result+=I.repeat(`
|
|
17
|
+
`,n-1))}function gc(e,n,i){var t,l,a,o,c,s,u,h,d=e.kind,_=e.result,f;if(f=e.input.charCodeAt(e.position),D(f)||Ae(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(l=e.input.charCodeAt(e.position+1),D(l)||i&&Ae(l)))return!1;for(e.kind="scalar",e.result="",a=o=e.position,c=!1;f!==0;){if(f===58){if(l=e.input.charCodeAt(e.position+1),D(l)||i&&Ae(l))break}else if(f===35){if(t=e.input.charCodeAt(e.position-1),D(t))break}else{if(e.position===e.lineStart&&_i(e)||i&&Ae(f))break;if(z(f))if(s=e.line,u=e.lineStart,h=e.lineIndent,N(e,!1,-1),e.lineIndent>=n){c=!0,f=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=s,e.lineStart=u,e.lineIndent=h;break}}c&&(le(e,a,o,!1),wt(e,e.line-s),a=o=e.position,c=!1),se(f)||(o=e.position+1),f=e.input.charCodeAt(++e.position)}return le(e,a,o,!1),e.result?!0:(e.kind=d,e.result=_,!1)}function yc(e,n){var i,t,l;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=l=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(le(e,t,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)t=e.position,e.position++,l=e.position;else return!0;else z(i)?(le(e,t,l,!0),wt(e,N(e,!1,n)),t=l=e.position):e.position===e.lineStart&&_i(e)?y(e,"unexpected end of the document within a single quoted scalar"):(e.position++,l=e.position);y(e,"unexpected end of the stream within a single quoted scalar")}function bc(e,n){var i,t,l,a,o,c;if(c=e.input.charCodeAt(e.position),c!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=t=e.position;(c=e.input.charCodeAt(e.position))!==0;){if(c===34)return le(e,i,e.position,!0),e.position++,!0;if(c===92){if(le(e,i,e.position,!0),c=e.input.charCodeAt(++e.position),z(c))N(e,!1,n);else if(c<256&&Fl[c])e.result+=Pl[c],e.position++;else if((o=pc(c))>0){for(l=o,a=0;l>0;l--)c=e.input.charCodeAt(++e.position),(o=hc(c))>=0?a=(a<<4)+o:y(e,"expected hexadecimal character");e.result+=_c(a),e.position++}else y(e,"unknown escape sequence");i=t=e.position}else z(c)?(le(e,i,t,!0),wt(e,N(e,!1,n)),i=t=e.position):e.position===e.lineStart&&_i(e)?y(e,"unexpected end of the document within a double quoted scalar"):(e.position++,t=e.position)}y(e,"unexpected end of the stream within a double quoted scalar")}function kc(e,n){var i=!0,t,l,a,o=e.tag,c,s=e.anchor,u,h,d,_,f,v=Object.create(null),m,k,b,g;if(g=e.input.charCodeAt(e.position),g===91)h=93,f=!1,c=[];else if(g===123)h=125,f=!0,c={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),g=e.input.charCodeAt(++e.position);g!==0;){if(N(e,!0,n),g=e.input.charCodeAt(e.position),g===h)return e.position++,e.tag=o,e.anchor=s,e.kind=f?"mapping":"sequence",e.result=c,!0;i?g===44&&y(e,"expected the node content, but found ','"):y(e,"missed comma between flow collection entries"),k=m=b=null,d=_=!1,g===63&&(u=e.input.charCodeAt(e.position+1),D(u)&&(d=_=!0,e.position++,N(e,!0,n))),t=e.line,l=e.lineStart,a=e.position,De(e,n,zn,!1,!0),k=e.tag,m=e.result,N(e,!0,n),g=e.input.charCodeAt(e.position),(_||e.line===t)&&g===58&&(d=!0,g=e.input.charCodeAt(++e.position),N(e,!0,n),De(e,n,zn,!1,!0),b=e.result),f?Te(e,c,v,k,m,b,t,l,a):d?c.push(Te(e,null,v,k,m,b,t,l,a)):c.push(m),N(e,!0,n),g=e.input.charCodeAt(e.position),g===44?(i=!0,g=e.input.charCodeAt(++e.position)):i=!1}y(e,"unexpected end of the stream within a flow collection")}function wc(e,n){var i,t,l=$i,a=!1,o=!1,c=n,s=0,u=!1,h,d;if(d=e.input.charCodeAt(e.position),d===124)t=!1;else if(d===62)t=!0;else return!1;for(e.kind="scalar",e.result="";d!==0;)if(d=e.input.charCodeAt(++e.position),d===43||d===45)$i===l?l=d===43?lr:sc:y(e,"repeat of a chomping mode identifier");else if((h=vc(d))>=0)h===0?y(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?y(e,"repeat of an indentation width identifier"):(c=n+h-1,o=!0);else break;if(se(d)){do d=e.input.charCodeAt(++e.position);while(se(d));if(d===35)do d=e.input.charCodeAt(++e.position);while(!z(d)&&d!==0)}for(;d!==0;){for(kt(e),e.lineIndent=0,d=e.input.charCodeAt(e.position);(!o||e.lineIndent<c)&&d===32;)e.lineIndent++,d=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>c&&(c=e.lineIndent),z(d)){s++;continue}if(e.lineIndent<c){l===lr?e.result+=I.repeat(`
|
|
18
|
+
`,a?1+s:s):l===$i&&a&&(e.result+=`
|
|
19
19
|
`);break}for(t?se(d)?(u=!0,e.result+=I.repeat(`
|
|
20
20
|
`,a?1+s:s)):u?(u=!1,e.result+=I.repeat(`
|
|
21
21
|
`,s+1)):s===0?a&&(e.result+=" "):e.result+=I.repeat(`
|
|
22
22
|
`,s):e.result+=I.repeat(`
|
|
23
|
-
`,a?1+s:s),a=!0,o=!0,s=0,i=e.position;!z(d)&&d!==0;)d=e.input.charCodeAt(++e.position);le(e,i,e.position,!1)}return!0}function ur(e,n){var i,t=e.tag,l=e.anchor,a=[],o,c=!1,s;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),s=e.input.charCodeAt(e.position);s!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,y(e,"tab characters must not be used in indentation")),!(s!==45||(o=e.input.charCodeAt(e.position+1),!D(o))));){if(c=!0,e.position++,N(e,!0,-1)&&e.lineIndent<=n){a.push(null),s=e.input.charCodeAt(e.position);continue}if(i=e.line,De(e,n,Il,!1,!0),a.push(e.result),N(e,!0,-1),s=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>n)&&s!==0)y(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return c?(e.tag=t,e.anchor=l,e.kind="sequence",e.result=a,!0):!1}function xc(e,n,i){var t,l,a,o,c,s,u=e.tag,h=e.anchor,d={},_=Object.create(null),f=null,v=null,m=null,k=!1,b=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=d),g=e.input.charCodeAt(e.position);g!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,y(e,"tab characters must not be used in indentation")),t=e.input.charCodeAt(e.position+1),a=e.line,(g===63||g===58)&&D(t))g===63?(k&&(Te(e,d,_,f,v,null,o,c,s),f=v=m=null),b=!0,k=!0,l=!0):k?(k=!1,l=!0):y(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=t;else{if(o=e.line,c=e.lineStart,s=e.position,!De(e,i,Nl,!1,!0))break;if(e.line===a){for(g=e.input.charCodeAt(e.position);se(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),D(g)||y(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(Te(e,d,_,f,v,null,o,c,s),f=v=m=null),b=!0,k=!1,l=!1,f=e.tag,v=e.result;else if(b)y(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=h,!0}else if(b)y(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=h,!0}if((e.line===a||e.lineIndent>n)&&(k&&(o=e.line,c=e.lineStart,s=e.position),De(e,n,Yn,!0,l)&&(k?v=e.result:m=e.result),k||(Te(e,d,_,f,v,m,o,c,s),f=v=m=null),N(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>n)&&g!==0)y(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return k&&Te(e,d,_,f,v,null,o,c,s),b&&(e.tag=u,e.anchor=h,e.kind="mapping",e.result=d),b}function Sc(e){var n,i=!1,t=!1,l,a,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&y(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(i=!0,o=e.input.charCodeAt(++e.position)):o===33?(t=!0,l="!!",o=e.input.charCodeAt(++e.position)):l="!",n=e.position,i){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):y(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!D(o);)o===33&&(t?y(e,"tag suffix cannot contain exclamation marks"):(l=e.input.slice(n-1,e.position+1)
|
|
24
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new mc(e,n),t=e.indexOf("\0");for(t!==-1&&(i.position=t,y(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Tc(i);return i.documents}function Ec(e,n,i){n!==null&&typeof n=="object"&&typeof i>"u"&&(i=n,n=null);var t=Dl(e,i);if(typeof n!="function")return t;for(var l=0,a=t.length;l<a;l+=1)n(t[l])}function Oc(e,n){var i=Dl(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new F("expected a single document in the stream, but found more")}}var Nc=Ec,Ic=Oc,jl={loadAll:Nc,load:Ic},
|
|
23
|
+
`,a?1+s:s),a=!0,o=!0,s=0,i=e.position;!z(d)&&d!==0;)d=e.input.charCodeAt(++e.position);le(e,i,e.position,!1)}return!0}function ur(e,n){var i,t=e.tag,l=e.anchor,a=[],o,c=!1,s;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),s=e.input.charCodeAt(e.position);s!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,y(e,"tab characters must not be used in indentation")),!(s!==45||(o=e.input.charCodeAt(e.position+1),!D(o))));){if(c=!0,e.position++,N(e,!0,-1)&&e.lineIndent<=n){a.push(null),s=e.input.charCodeAt(e.position);continue}if(i=e.line,De(e,n,Il,!1,!0),a.push(e.result),N(e,!0,-1),s=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>n)&&s!==0)y(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return c?(e.tag=t,e.anchor=l,e.kind="sequence",e.result=a,!0):!1}function xc(e,n,i){var t,l,a,o,c,s,u=e.tag,h=e.anchor,d={},_=Object.create(null),f=null,v=null,m=null,k=!1,b=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=d),g=e.input.charCodeAt(e.position);g!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,y(e,"tab characters must not be used in indentation")),t=e.input.charCodeAt(e.position+1),a=e.line,(g===63||g===58)&&D(t))g===63?(k&&(Te(e,d,_,f,v,null,o,c,s),f=v=m=null),b=!0,k=!0,l=!0):k?(k=!1,l=!0):y(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=t;else{if(o=e.line,c=e.lineStart,s=e.position,!De(e,i,Nl,!1,!0))break;if(e.line===a){for(g=e.input.charCodeAt(e.position);se(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),D(g)||y(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(Te(e,d,_,f,v,null,o,c,s),f=v=m=null),b=!0,k=!1,l=!1,f=e.tag,v=e.result;else if(b)y(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=h,!0}else if(b)y(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=h,!0}if((e.line===a||e.lineIndent>n)&&(k&&(o=e.line,c=e.lineStart,s=e.position),De(e,n,Yn,!0,l)&&(k?v=e.result:m=e.result),k||(Te(e,d,_,f,v,m,o,c,s),f=v=m=null),N(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>n)&&g!==0)y(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return k&&Te(e,d,_,f,v,null,o,c,s),b&&(e.tag=u,e.anchor=h,e.kind="mapping",e.result=d),b}function Sc(e){var n,i=!1,t=!1,l,a,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&y(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(i=!0,o=e.input.charCodeAt(++e.position)):o===33?(t=!0,l="!!",o=e.input.charCodeAt(++e.position)):l="!",n=e.position,i){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):y(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!D(o);)o===33&&(t?y(e,"tag suffix cannot contain exclamation marks"):(l=e.input.slice(n-1,e.position+1),Ll.test(l)||y(e,"named tag handle cannot contain such characters"),t=!0,n=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(n,e.position),fc.test(a)&&y(e,"tag suffix cannot contain flow indicator characters")}a&&!$l.test(a)&&y(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{y(e,"tag name is malformed: "+a)}return i?e.tag=a:ae.call(e.tagMap,l)?e.tag=e.tagMap[l]+a:l==="!"?e.tag="!"+a:l==="!!"?e.tag="tag:yaml.org,2002:"+a:y(e,'undeclared tag handle "'+l+'"'),!0}function Cc(e){var n,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&y(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!D(i)&&!Ae(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&y(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Ac(e){var n,i,t;if(t=e.input.charCodeAt(e.position),t!==42)return!1;for(t=e.input.charCodeAt(++e.position),n=e.position;t!==0&&!D(t)&&!Ae(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&y(e,"name of an alias node must contain at least one character"),i=e.input.slice(n,e.position),ae.call(e.anchorMap,i)||y(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],N(e,!0,-1),!0}function De(e,n,i,t,l){var a,o,c,s=1,u=!1,h=!1,d,_,f,v,m,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=o=c=Yn===i||Il===i,t&&N(e,!0,-1)&&(u=!0,e.lineIndent>n?s=1:e.lineIndent===n?s=0:e.lineIndent<n&&(s=-1)),s===1)for(;Sc(e)||Cc(e);)N(e,!0,-1)?(u=!0,c=a,e.lineIndent>n?s=1:e.lineIndent===n?s=0:e.lineIndent<n&&(s=-1)):c=!1;if(c&&(c=u||l),(s===1||Yn===i)&&(zn===i||Nl===i?m=n:m=n+1,k=e.position-e.lineStart,s===1?c&&(ur(e,k)||xc(e,k,m))||kc(e,m)?h=!0:(o&&wc(e,m)||yc(e,m)||bc(e,m)?h=!0:Ac(e)?(h=!0,(e.tag!==null||e.anchor!==null)&&y(e,"alias node should not have any properties")):gc(e,m,zn===i)&&(h=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):s===0&&(h=c&&ur(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&y(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),d=0,_=e.implicitTypes.length;d<_;d+=1)if(v=e.implicitTypes[d],v.resolve(e.result)){e.result=v.construct(e.result),e.tag=v.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ae.call(e.typeMap[e.kind||"fallback"],e.tag))v=e.typeMap[e.kind||"fallback"][e.tag];else for(v=null,f=e.typeMap.multi[e.kind||"fallback"],d=0,_=f.length;d<_;d+=1)if(e.tag.slice(0,f[d].tag.length)===f[d].tag){v=f[d];break}v||y(e,"unknown tag !<"+e.tag+">"),e.result!==null&&v.kind!==e.kind&&y(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+v.kind+'", not "'+e.kind+'"'),v.resolve(e.result,e.tag)?(e.result=v.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):y(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}function Tc(e){var n=e.position,i,t,l,a=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(N(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(a=!0,o=e.input.charCodeAt(++e.position),i=e.position;o!==0&&!D(o);)o=e.input.charCodeAt(++e.position);for(t=e.input.slice(i,e.position),l=[],t.length<1&&y(e,"directive name must not be less than one character in length");o!==0;){for(;se(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!z(o));break}if(z(o))break;for(i=e.position;o!==0&&!D(o);)o=e.input.charCodeAt(++e.position);l.push(e.input.slice(i,e.position))}o!==0&&kt(e),ae.call(cr,t)?cr[t](e,t,l):qn(e,'unknown document directive "'+t+'"')}if(N(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,N(e,!0,-1)):a&&y(e,"directives end mark is expected"),De(e,e.lineIndent-1,Yn,!1,!0),N(e,!0,-1),e.checkLineBreaks&&dc.test(e.input.slice(n,e.position))&&qn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&_i(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,N(e,!0,-1));return}if(e.position<e.length-1)y(e,"end of the stream or a document separator is expected");else return}function Dl(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
24
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new mc(e,n),t=e.indexOf("\0");for(t!==-1&&(i.position=t,y(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Tc(i);return i.documents}function Ec(e,n,i){n!==null&&typeof n=="object"&&typeof i>"u"&&(i=n,n=null);var t=Dl(e,i);if(typeof n!="function")return t;for(var l=0,a=t.length;l<a;l+=1)n(t[l])}function Oc(e,n){var i=Dl(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new F("expected a single document in the stream, but found more")}}var Nc=Ec,Ic=Oc,jl={loadAll:Nc,load:Ic},Ul=Object.prototype.toString,Bl=Object.prototype.hasOwnProperty,xt=65279,Lc=9,ln=10,$c=13,Rc=32,Fc=33,Pc=34,zi=35,Mc=37,Dc=38,jc=39,Uc=42,Hl=44,Bc=45,Kn=58,Hc=61,Wc=62,zc=63,Yc=64,Wl=91,zl=93,qc=96,Yl=123,Kc=124,ql=125,R={};R[0]="\\0";R[7]="\\a";R[8]="\\b";R[9]="\\t";R[10]="\\n";R[11]="\\v";R[12]="\\f";R[13]="\\r";R[27]="\\e";R[34]='\\"';R[92]="\\\\";R[133]="\\N";R[160]="\\_";R[8232]="\\L";R[8233]="\\P";var Gc=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Vc=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Jc(e,n){var i,t,l,a,o,c,s;if(n===null)return{};for(i={},t=Object.keys(n),l=0,a=t.length;l<a;l+=1)o=t[l],c=String(n[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),s=e.compiledTypeMap.fallback[o],s&&Bl.call(s.styleAliases,c)&&(c=s.styleAliases[c]),i[o]=c;return i}function Qc(e){var n,i,t;if(n=e.toString(16).toUpperCase(),e<=255)i="x",t=2;else if(e<=65535)i="u",t=4;else if(e<=4294967295)i="U",t=8;else throw new F("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+I.repeat("0",t-n.length)+n}var Zc=1,an=2;function Xc(e){this.schema=e.schema||bt,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=I.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Jc(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?an:Zc,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function dr(e,n){for(var i=I.repeat(" ",n),t=0,l=-1,a="",o,c=e.length;t<c;)l=e.indexOf(`
|
|
25
25
|
`,t),l===-1?(o=e.slice(t),t=c):(o=e.slice(t,l+1),t=l+1),o.length&&o!==`
|
|
26
26
|
`&&(a+=i),a+=o;return a}function Yi(e,n){return`
|
|
27
|
-
`+I.repeat(" ",e.indent*n)}function es(e,n){var i,t,l;for(i=0,t=e.implicitTypes.length;i<t;i+=1)if(l=e.implicitTypes[i],l.resolve(n))return!0;return!1}function Gn(e){return e===Rc||e
|
|
27
|
+
`+I.repeat(" ",e.indent*n)}function es(e,n){var i,t,l;for(i=0,t=e.implicitTypes.length;i<t;i+=1)if(l=e.implicitTypes[i],l.resolve(n))return!0;return!1}function Gn(e){return e===Rc||e===Lc}function on(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==xt||65536<=e&&e<=1114111}function fr(e){return on(e)&&e!==xt&&e!==$c&&e!==ln}function hr(e,n,i){var t=fr(e),l=t&&!Gn(e);return(i?t:t&&e!==Hl&&e!==Wl&&e!==zl&&e!==Yl&&e!==ql)&&e!==zi&&!(n===Kn&&!l)||fr(n)&&!Gn(n)&&e===zi||n===Kn&&l}function ns(e){return on(e)&&e!==xt&&!Gn(e)&&e!==Bc&&e!==zc&&e!==Kn&&e!==Hl&&e!==Wl&&e!==zl&&e!==Yl&&e!==ql&&e!==zi&&e!==Dc&&e!==Uc&&e!==Fc&&e!==Kc&&e!==Hc&&e!==Wc&&e!==jc&&e!==Pc&&e!==Mc&&e!==Yc&&e!==qc}function is(e){return!Gn(e)&&e!==Kn}function Ye(e,n){var i=e.charCodeAt(n),t;return i>=55296&&i<=56319&&n+1<e.length&&(t=e.charCodeAt(n+1),t>=56320&&t<=57343)?(i-55296)*1024+t-56320+65536:i}function Kl(e){var n=/^\n* /;return n.test(e)}var Gl=1,qi=2,Vl=3,Jl=4,Se=5;function ts(e,n,i,t,l,a,o,c){var s,u=0,h=null,d=!1,_=!1,f=t!==-1,v=-1,m=ns(Ye(e,0))&&is(Ye(e,e.length-1));if(n||o)for(s=0;s<e.length;u>=65536?s+=2:s++){if(u=Ye(e,s),!on(u))return Se;m=m&&hr(u,h,c),h=u}else{for(s=0;s<e.length;u>=65536?s+=2:s++){if(u=Ye(e,s),u===ln)d=!0,f&&(_=_||s-v-1>t&&e[v+1]!==" ",v=s);else if(!on(u))return Se;m=m&&hr(u,h,c),h=u}_=_||f&&s-v-1>t&&e[v+1]!==" "}return!d&&!_?m&&!o&&!l(e)?Gl:a===an?Se:qi:i>9&&Kl(e)?Se:o?a===an?Se:qi:_?Jl:Vl}function rs(e,n,i,t,l){e.dump=function(){if(n.length===0)return e.quotingType===an?'""':"''";if(!e.noCompatMode&&(Gc.indexOf(n)!==-1||Vc.test(n)))return e.quotingType===an?'"'+n+'"':"'"+n+"'";var a=e.indent*Math.max(1,i),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=t||e.flowLevel>-1&&i>=e.flowLevel;function s(u){return es(e,u)}switch(ts(n,c,e.indent,o,s,e.quotingType,e.forceQuotes&&!t,l)){case Gl:return n;case qi:return"'"+n.replace(/'/g,"''")+"'";case Vl:return"|"+pr(n,e.indent)+vr(dr(n,a));case Jl:return">"+pr(n,e.indent)+vr(dr(ls(n,o),a));case Se:return'"'+as(n)+'"';default:throw new F("impossible error: invalid scalar style")}}()}function pr(e,n){var i=Kl(e)?String(n):"",t=e[e.length-1]===`
|
|
28
28
|
`,l=t&&(e[e.length-2]===`
|
|
29
29
|
`||e===`
|
|
30
30
|
`),a=l?"+":t?"":"-";return i+a+`
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
`:"")+_r(s,n),l=a}return t}function _r(e,n){if(e===""||e[0]===" ")return e;for(var i=/ [^ ]/g,t,l=0,a,o=0,c=0,s="";t=i.exec(e);)c=t.index,c-l>n&&(a=o>l?o:c,s+=`
|
|
36
36
|
`+e.slice(l,a),l=a+1),o=c;return s+=`
|
|
37
37
|
`,e.length-l>n&&o>l?s+=e.slice(l,o)+`
|
|
38
|
-
`+e.slice(o+1):s+=e.slice(l),s.slice(1)}function as(e){for(var n="",i=0,t,l=0;l<e.length;i>=65536?l+=2:l++)i=Ye(e,l),t=R[i],!t&&on(i)?(n+=e[l],i>=65536&&(n+=e[l+1])):n+=t||Qc(i);return n}function os(e,n,i){var t="",l=e.tag,a,o,c;for(a=0,o=i.length;a<o;a+=1)c=i[a],e.replacer&&(c=e.replacer.call(i,String(a),c)),(Q(e,n,c,!1,!1)||typeof c>"u"&&Q(e,n,null,!1,!1))&&(t!==""&&(t+=","+(e.condenseFlow?"":" ")),t+=e.dump);e.tag=l,e.dump="["+t+"]"}function mr(e,n,i,t){var l="",a=e.tag,o,c,s;for(o=0,c=i.length;o<c;o+=1)s=i[o],e.replacer&&(s=e.replacer.call(i,String(o),s)),(Q(e,n+1,s,!0,!0,!1,!0)||typeof s>"u"&&Q(e,n+1,null,!0,!0,!1,!0))&&((!t||l!=="")&&(l+=Yi(e,n)),e.dump&&ln===e.dump.charCodeAt(0)?l+="-":l+="- ",l+=e.dump);e.tag=a,e.dump=l||"[]"}function cs(e,n,i){var t="",l=e.tag,a=Object.keys(i),o,c,s,u,h;for(o=0,c=a.length;o<c;o+=1)h="",t!==""&&(h+=", "),e.condenseFlow&&(h+='"'),s=a[o],u=i[s],e.replacer&&(u=e.replacer.call(i,s,u)),Q(e,n,s,!1,!1)&&(e.dump.length>1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,n,u,!1,!1)&&(h+=e.dump,t+=h));e.tag=l,e.dump="{"+t+"}"}function ss(e,n,i,t){var l="",a=e.tag,o=Object.keys(i),c,s,u,h,d,_;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new F("sortKeys must be a boolean or a function");for(c=0,s=o.length;c<s;c+=1)_="",(!t||l!=="")&&(_+=Yi(e,n)),u=o[c],h=i[u],e.replacer&&(h=e.replacer.call(i,u,h)),Q(e,n+1,u,!0,!0,!0)&&(d=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,d&&(e.dump&&ln===e.dump.charCodeAt(0)?_+="?":_+="? "),_+=e.dump,d&&(_+=Yi(e,n)),Q(e,n+1,h,!0,d)&&(e.dump&&ln===e.dump.charCodeAt(0)?_+=":":_+=": ",_+=e.dump,l+=_));e.tag=a,e.dump=l||"{}"}function gr(e,n,i){var t,l,a,o,c,s;for(l=i?e.explicitTypes:e.implicitTypes,a=0,o=l.length;a<o;a+=1)if(c=l[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof n=="object"&&n instanceof c.instanceOf)&&(!c.predicate||c.predicate(n))){if(i?c.multi&&c.representName?e.tag=c.representName(n):e.tag=c.tag:e.tag="?",c.represent){if(s=e.styleMap[c.tag]||c.defaultStyle,
|
|
39
|
-
`:""}var fs=ds,hs={dump:fs};function St(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var ps=$,vs=dl,_s=vl,ms=bl,gs=kl,ys=bt,bs=jl.load,ks=jl.loadAll,ws=hs.dump,xs=F,Ss={binary:Al,float:yl,map:pl,null:_l,pairs:El,set:Ol,timestamp:Sl,bool:ml,int:gl,merge:Cl,omap:Tl,seq:hl,str:fl},Cs=St("safeLoad","load"),As=St("safeLoadAll","loadAll"),Ts=St("safeDump","dump"),Es={Type:ps,Schema:vs,FAILSAFE_SCHEMA:_s,JSON_SCHEMA:ms,CORE_SCHEMA:gs,DEFAULT_SCHEMA:ys,load:bs,loadAll:ks,dump:ws,YAMLException:xs,types:Ss,safeLoad:Cs,safeLoadAll:As,safeDump:Ts};function Os(e){if(e.trim()==="")return{};const i=Es.load(e);if(i==null)return{};if(typeof i!="object"||Array.isArray(i))throw new Error(".agent-user.yml must parse to an object");return i}const yr={id:"welcome",title:"Welcome — who are you?",navLabel:"You",subtitle:"Your name and language. Stored in .agent-user.yml; we pre-fill what we can detect.",kind:"welcome"},br={id:"profile",title:"Which experience?",navLabel:"Experience",subtitle:"Pick the experience that fits you — developer · content · founder · agency · finance · ops. It selects your default command/skill surface and persona pre-selection. Cost tier is a secondary knob on a later step. You can switch later with `agent-config use --profile=<id>`.",kind:"form",paths:["profile.id"]},Ns=[{id:"ai-tools",title:"Which AI tools do you use?",navLabel:"AI tools",subtitle:"Pick the editors and CLIs that should pick up this config. Auto-detect runs first; you can override.",kind:"aiTools"},{id:"roles",title:"What do you work on?",navLabel:"Roles",subtitle:"Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in .agent-user.yml.",kind:"roles"},{id:"packs",title:"Which capability packs do you want?",navLabel:"Packs",subtitle:"Founder-strategy, finance-basic, gtm-sales, ops-people, ai-video — pick zero or more. You can change this later.",kind:"packs"},{id:"legal-consent",title:"Legal review-prep — not legal advice",navLabel:"Legal consent",subtitle:"Only relevant if you picked the legal-review-prep pack. It provides templates and general information, never legal advice — check the box to acknowledge before it activates. Leave unchecked otherwise; the pack stays inactive.",kind:"form",paths:["legal_review_prep.acknowledged"]}],kr=[{id:"identity",title:"Editor & behaviour",navLabel:"Preferences",subtitle:"Your IDE plus how the agent behaves: autonomy, output verbosity, PR-comment style. rtk presence is auto-detected (see the rtk row). Your name lives in .agent-user.yml (later step).",kind:"form",paths:["personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon"]},{id:"cost",title:"Budgets, rules & cadence",navLabel:"Budgets & cadence",subtitle:"Independent levers: rule_loading_tier (how many behavioural rules load — token footprint), cost.budgets (optional USD ceilings), model.auto_switch (per-skill model tier), plus quality/roadmap cadence and memory thresholds.",kind:"form",paths:["rule_loading_tier","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns"]},{id:"user-md",title:"Your .agent-user.yml",navLabel:"User profile",subtitle:"Identity, voice, preferences. Stored at agents/settings/.agent-user.yml. Skip to leave empty.",kind:"userMd"},{id:"review",title:"Review & finish",navLabel:"Review",subtitle:"These keys will change. Confirm to write .agent-settings.yml and .agent-user.yml atomically.",kind:"review"}];function Ql(e={}){return e.extended===!0?[yr,br,...Ns,...kr]:[yr,br,...kr]}function mi(e,n={}){const i=Ql(n),t=Math.max(0,Math.min(i.length-1,e));return i[t]}function Is(e){const n={},i=t=>{n[t]=!0;const l=e.clusterOf.get(t);l!==void 0&&(n[l]=!0)};for(const t of e.installed)i(t);for(const t of e.roleDefaults)i(t);for(const t of e.detected)i(t);return n}function $s(e,n){const i=new Set(n);return e.filter(t=>t!=="engineering-base"&&!i.has(t)).sort()}function Ls(e,n){const i={type:"object",properties:{},...e.description!==void 0?{description:e.description}:{}},t=i.properties,l=e.properties??{};for(const a of n){const o=a.split(".").filter(H=>H.length>0);if(o.length===0)continue;const[c,s,u]=o;if(c===void 0)continue;const h=l[c];if(h===void 0)continue;if(s===void 0){t[c]=h;continue}const d=h.properties?.[s];if(d===void 0)continue;const f=t[c]??{type:"object",properties:{},...h.description!==void 0?{description:h.description}:{}},v=f.properties??={};if(u===void 0){v[s]=d,t[c]=f;continue}const m=d.properties?.[u];if(m===void 0)continue;const b=v[s]??{type:"object",properties:{},...d.description!==void 0?{description:d.description}:{}},g=b.properties??={};g[u]=m,v[s]=b,t[c]=f}return i}function Rs({current:e,total:n}){const i=Math.max(1,n),t=Math.max(0,Math.min(i-1,e)),l=Array.from({length:i},(o,c)=>c<=t),a=Math.round((t+1)/i*100);return r("div",{class:"ac-wizard__progress",role:"progressbar","aria-valuenow":t+1,"aria-valuemin":1,"aria-valuemax":i,"aria-valuetext":`Step ${t+1} of ${i} (${a}%)`,children:l.map((o,c)=>r("span",{class:`ac-wizard__progress-segment${o?" ac-wizard__progress-segment--filled":""}`,"aria-hidden":"true"},c))})}function Fs({step:e,index:n,total:i}){return r("header",{class:"ac-page__header ac-wizard__header",children:[r("p",{class:"ac-wizard__step-count",children:["Step ",n+1," of ",i]}),r("div",{class:"ac-wizard__header-text",children:[r("h1",{children:e.title}),r("p",{class:"ac-wizard__subtitle",children:e.subtitle})]}),r(Rs,{current:n,total:i})]})}function Ps(e){const n=e.canFinish??!0,i=e.completed??!1;return r("div",{class:"ac-form__actions ac-wizard__nav",children:[r("button",{type:"button",class:"ac-button",disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:"Back"}),e.canSkip&&e.onSkip!==void 0?r("button",{type:"button",class:"ac-button ac-wizard__skip",disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??"Skip"}):null,e.isLast?i?null:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy||!n,onClick:e.onFinish,children:e.busy?"Saving…":"Finish & save"}):r("button",{type:"button",class:"ac-button ac-button--primary",disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??"Next"})]})}function Zl(e,n){return e.kind!=="form"||e.paths===void 0?!1:!!(e.paths.includes(n)||e.id==="cost"&&(n.startsWith("telegraph.")||n.startsWith("verbosity.")))}function Ms(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Zl(e,n)}function Ds(e,n){for(const i of Object.keys(n.errors))if(Ms(e,i))return!0;return!1}function js(e,n){if(Ds(e,n))return{label:"needs attention",tone:"error"};if(e.kind==="userMd")return n.userMdChanged?{label:n.userMdAction==="create"?"will create":"will replace",tone:"changed"}:{label:"",tone:"idle"};if(e.kind==="form"){const i=n.changes.filter(t=>Zl(e,t.path)).length;return i===0?{label:"",tone:"idle"}:{label:`${i} change${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="aiTools"){const i=n.selectedToolsCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} tool${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="packs"){const i=n.selectedPacksCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} pack${i===1?"":"s"}`,tone:"changed"}}return{label:"",tone:"idle"}}function Bs(e){const n=e.steps.filter((c,s)=>s!==e.currentIndex),i=e.packRemovals??[],t=e.selectedToolIds??[],l=e.packAdditions??[],a=e.changes.length,o=t.length>0||l.length>0||a>0||e.userMdChanged;return r(M,{children:[o?r("section",{class:"ac-review-summary","aria-label":"What happens on Finish",children:[r("h2",{class:"ac-review-summary__title",children:"What happens on Finish"}),r("ul",{class:"ac-review-summary__list",children:[a>0?r("li",{children:[r("strong",{children:a})," setting",a===1?"":"s"," will change"," ","in ",r("code",{children:".agent-settings.yml"}),"."]}):r("li",{children:"No settings change."}),e.userMdChanged?r("li",{children:[r("code",{children:".agent-user.yml"})," will be"," ",e.userMdAction==="create"?"created":"updated","."]}):null,t.length>0?r("li",{children:["Config is installed for ",t.length," tool",t.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:t.map(c=>r("code",{class:"ac-review-summary__chip",children:c},c))})]}):null,l.length>0?r("li",{children:["New pack",l.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:l.map(c=>r("code",{class:"ac-review-summary__chip",children:c},c))})]}):null]})]}):null,i.length>0?r("div",{class:"ac-review-removals",role:"alert",children:[r("p",{class:"ac-review-removals__title",children:["⚠️ ",i.length===1?"1 installed pack will be removed":`${i.length} installed packs will be removed`]}),r("ul",{class:"ac-review-removals__list",children:i.map(c=>r("li",{children:r("code",{children:c})},c))}),r("label",{class:"ac-review-removals__confirm",children:[r("input",{type:"checkbox",checked:e.removalsConfirmed??!1,onChange:c=>{e.onConfirmRemovals?.(c.currentTarget.checked)}}),r("span",{children:"I understand these packs will no longer be installed. Re-check them on the packs step to keep them."})]})]}):null,r("nav",{class:"ac-wizard__review-nav","aria-label":"Jump back to a step",children:[r("p",{class:"ac-wizard__review-nav-label",children:"Jump back to a step:"}),r("ul",{class:"ac-wizard__review-nav-list",children:n.map(c=>{const s=e.steps.indexOf(c),u=js(c,e),h=u.tone==="error"?"ac-wizard__review-nav-button ac-wizard__review-nav-button--error":"ac-wizard__review-nav-button";return r("li",{children:r("button",{type:"button",class:h,onClick:()=>{e.onJump(s)},children:[r("span",{class:"ac-wizard__review-nav-index",children:s+1}),r("span",{class:"ac-wizard__review-nav-text",children:c.navLabel}),u.label!==""?r("span",{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${u.tone}`,children:u.label}):null]})},c.id)})})]})]})}function Us(e){const n=e.abortedAt??"unknown time",i=e.abortNote??"no further detail recorded",t=e.writesSinceRollback;return r("aside",{class:"ac-banner ac-banner--recovery",role:"alert",children:[r("strong",{children:"Previous install was interrupted."}),r("p",{children:["Aborted at ",r("code",{children:n})," — ",i,". ",t," write",t===1?"":"s"," landed before the abort marker."]}),r("p",{children:"Pick how to recover before continuing. Resume reopens the wizard fresh, Rollback discards the abort state, Ignore hides this banner without touching the log."}),r("div",{class:"ac-banner__actions",children:[r("button",{type:"button",disabled:e.busy,onClick:()=>e.onResume(),children:"Resume install"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onRollback(),children:"Rollback"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onIgnore(),children:"Ignore"})]})]})}function Hs(){return r("section",{class:"ac-continue-screen","aria-labelledby":"ac-continue-title",children:[r("h2",{id:"ac-continue-title",children:"Install complete — continue with setup?"}),r("p",{children:"Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:"}),r("ul",{children:[r("li",{children:[r("strong",{children:"Next"})," — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your",r("code",{children:" .agent-user.yml"}),", and finally the project module roots."]}),r("li",{children:[r("strong",{children:"Finish install here"})," — skip the rest and write ",r("code",{children:".agent-settings.yml"})," with the install-only selections. You can re-run ",r("code",{children:"agent-config setup"}),"later to pick up the personalisation steps."]})]})]})}function Ws(e){const n=e.version??"unknown";return r("section",{class:"ac-backup-screen","aria-labelledby":"ac-backup-title",children:[r("h2",{id:"ac-backup-title",children:"Existing v3 install detected"}),r("p",{children:["Found a v3.x install at ",r("code",{children:e.sourcePath})," ","(VERSION: ",r("code",{children:n}),"). v4 is a hard-cut release with no auto-migration — settings, identity, and history layouts changed. The wizard can back up the v3 tree before writing the v4 layout so you can roll back manually if needed."]}),e.error!==null?r("p",{class:"ac-banner ac-banner--error",children:["Backup failed: ",e.error]}):null,r("ul",{children:[r("li",{children:[r("strong",{children:"Backup v3 and proceed"})," — copies the tree to ",r("code",{children:e.backupTarget}),", then runs the v4 install. Restore later with",r("code",{children:[" mv ",e.backupTarget," ",e.sourcePath]}),"."]}),r("li",{children:[r("strong",{children:"Abort, uninstall v3 first"})," — closes the wizard. You decide what to keep."]})]}),r("div",{class:"ac-backup-screen__actions",children:[r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?"Backing up…":"Backup v3 and proceed"}),r("button",{type:"button",class:"ac-button",disabled:e.busy,onClick:()=>e.onAbort(),children:"Abort, uninstall v3 first"})]})]})}const zs=[{title:"Restart your AI tools",detail:"Editors and CLIs pick up the new skills, rules, and commands on their next start."},{title:"Verify the installation",detail:"A read-only health report — scope, deployed files, drift.",command:"agent-config doctor"},{title:"Tune your settings any time",detail:"Opens the configuration GUI (global settings; --project for a project).",command:"agent-config config"},{title:"Initialize a project",detail:"Adds the minimal agents/ bridge + .gitignore block to a repository.",command:"agent-config init --project"},{title:"Stay up to date",detail:"Upgrades the global install and additively syncs your settings.",command:"agent-config upgrade"}];function Ys({text:e}){const[n,i]=_t(!1);return r("button",{type:"button",class:"ac-button ac-checklist__copy",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{i(!0),setTimeout(()=>{i(!1)},1500)})},children:n?"Copied ✓":"Copy"})}function qs({message:e}){return r("div",{class:"ac-checklist",children:[r("div",{class:"ac-checklist__hero",children:[r("h2",{class:"ac-checklist__headline",children:"Setup complete"}),e!==null?r("p",{class:"ac-checklist__message",children:e}):null]}),r("ol",{class:"ac-checklist__items",children:zs.map(n=>r("li",{class:"ac-checklist__item",children:[r("div",{class:"ac-checklist__text",children:[r("span",{class:"ac-checklist__item-title",children:n.title}),r("span",{class:"ac-checklist__item-detail",children:n.detail})]}),n.command!==void 0?r("div",{class:"ac-checklist__cmd-row",children:[r("code",{class:"ac-checklist__cmd",children:n.command}),r(Ys,{text:n.command})]}):null]},n.title))}),r("p",{class:"ac-checklist__close-hint",children:"You can close this browser window — the local server shuts down on its own."})]})}const Xl=p(!1),Ve=p(null),E=p(null),Vn=p(!1),Jn=p(!1),ve=p(0),Ct=p(null),U=p({}),ea=p({}),na=p(0),$e=p({}),O=p(null),ue=p(null),At=p(!1),Gi=p(!1),gi=p(!1),ia=p({}),yi=p([]);p("global");const Ee=p(!1),P=p(!1),Ks=p(!1),Qn=p(!1),Zn=p(null),Tt=p([]),Xn=p({}),ei=p(!0),ni=p(""),ii=p("agents");p(!1);const ta=p(null),Gs=[{id:"claude-code",label:"Claude Code"},{id:"claude-desktop",label:"Claude Desktop"},{id:"cursor",label:"Cursor"},{id:"windsurf",label:"Windsurf"},{id:"cline",label:"Cline"},{id:"gemini-cli",label:"Gemini CLI"},{id:"copilot",label:"GitHub Copilot"},{id:"augment",label:"Augment"},{id:"aider",label:"Aider"},{id:"codex",label:"Codex"},{id:"roocode",label:"Roo Code"},{id:"continue",label:"Continue"},{id:"kilocode",label:"Kilo Code"},{id:"zed",label:"Zed"},{id:"jetbrains",label:"JetBrains"},{id:"kiro",label:"Kiro"},{id:"qoder",label:"Qoder"},{id:"opencode",label:"OpenCode"},{id:"trae",label:"Trae"},{id:"antigravity",label:"Antigravity"},{id:"codebuddy",label:"CodeBuddy"},{id:"droid",label:"Droid"},{id:"warp",label:"Warp"}],Vi=p(!1),Le=p(!1),de=p(null),bi=p([]),ki=p([]),_e=p([]),Ji=p(!1),gn=p([]),V=p({}),ra=p(!1),Qi=p(!1),En=p(!1),Et=p({}),wr=p(!1),la=p(null),aa=p(null),oa=p("https://github.com/event4u-app/rtk");p(!1);p(null);p([]);p({});p({});const Z=p({}),te=p({}),Zi=p(!1),xr=p(!1);p({});p(null);p(null);p(!1);p(null);const ti=p(null),ca=p(!1),Xi=p(null),et=p(!1),nt=p(!1),it=p(null),Re=p(null),On=p(!1),Ot=p(!1);function sa(){return Ql({extended:P.value})}function je(){return sa().length}function Vs(e){return e??new Date().toISOString()}function Nt(e){return Math.max(0,Math.min(je()-1,e))}function Js(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Qs(){try{return await w("/api/v1/settings")}catch(e){if(e instanceof A&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0)return{values:n.defaults,lastModified:n.lastModified??0,path:n.path??".agent-settings.yml",schema:n.schema};const i=await w("/api/v1/schema");return{values:{},lastModified:0,path:".agent-settings.yml",schema:i.settings}}throw e}}async function Zs(){try{const e=await w("/api/v1/install/recovery");ti.value=e.incomplete?e:null}catch{ti.value=null}}async function Xs(){try{const e=await w("/api/v1/install/legacy-v3");Xi.value=e.present?e:null}catch{Xi.value=null}}async function eu(){nt.value=!0,it.value=null;try{await w("/api/v1/install/backup-v3",{method:"POST"}),et.value=!0}catch(e){it.value=e instanceof A?B(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{nt.value=!1}}async function Ri(e){try{await w("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){E.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}ti.value=null,ca.value=!0}async function nu(){Ve.value=null;try{Zs(),Xs();const[e,n]=await Promise.all([w("/api/v1/wizard/state"),Qs()]);Ct.value=Js(n.schema),na.value=n.lastModified,ea.value=n.values,ia.value=n.legacyHints??{},P.value=e.extendedSteps===!0,Re.value=e.wizardMode??null;const i=Object.keys(e.partial??{});U.value=i.length>0?{...n.values,...e.partial}:n.values,ve.value=Nt(e.step),Ee.value=!1,Xl.value=!0;const t=mi(ve.value,{extended:P.value});(t.kind==="welcome"||t.kind==="userMd"||t.kind==="review")&&It(),(t.kind==="roles"||t.kind==="aiTools"||t.kind==="packs")&&yn(),t.kind==="roles"&&$t(),t.kind==="aiTools"&&wi(),t.id==="identity"&&ua(),t.kind==="review"&&da()}catch(e){e instanceof A?Ve.value=B(e.body.error??{code:"UNKNOWN",message:e.message}):Ve.value=e instanceof Error?e.message:String(e)}}function iu(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function It(){if(!Gi.value)try{const e=await w("/api/v1/user-md");if(At.value=e.exists,e.exists&&e.identity!==null){const n=tr(e.identity);ue.value=n,O.value=n}else{let n;try{const t=await w("/api/v1/user-md/template");n=tr(Os(t.body))}catch{n=cl()}const i=ia.value.user_name;typeof i=="string"&&i.trim()!==""&&(n=iu(n,i)),ue.value=n,O.value=n}}catch(e){E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Gi.value=!0}}const tu=new Set(["python"]);async function yn(){if(!(Vi.value||Le.value)){Le.value=!0,de.value=null;try{const[e,n]=await Promise.all([w("/api/v1/wizard/manifest"),w("/api/v1/wizard/auto-detect")]),i=(e.packs??[]).map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",requires_hint:a.requires_hint,cluster:a.cluster??void 0,workspaces:a.workspaces}));bi.value=i,gn.value=(e.workspaces??[]).filter(a=>a.id!=="agent-config-maintainer").map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",default_packs:a.default_packs??[],optional_packs:a.optional_packs??[],...a.example_roles!==void 0?{example_roles:a.example_roles}:{}}));const t=new Set(i.map(a=>a.id)),l=n.signals.map(a=>a.id.startsWith("pack-")?a.id.slice(5):a.id).filter(a=>t.has(a)).filter(a=>!tu.has(a));ki.value=l,_e.value=(e.installedPacks??[]).filter(a=>t.has(a))}catch(e){e instanceof A?de.value=B(e.body.error??{code:"UNKNOWN",message:e.message}):de.value=e instanceof Error?e.message:String(e)}finally{Le.value=!1,Vi.value=!0}}}async function wi(){if(!(Qi.value||En.value)){En.value=!0;try{const e=await w("/api/v1/wizard/detect-tools"),n=e.tools??{},i=e.configured??[];if(Et.value=n,Object.keys(Z.value).length===0){const t={};if(i.length>0)for(const l of i)t[l]=!0;else for(const[l,a]of Object.entries(n))a&&(t[l]=!0);Z.value=t}}catch{}finally{En.value=!1,Qi.value=!0}}}async function ua(){if(!wr.value){wr.value=!0;try{const e=await w("/api/v1/wizard/detect-rtk"),n=e.installed===!0;la.value=n,aa.value=e.installCommand??null,typeof e.repo=="string"&&(oa.value=e.repo);const i=U.value.personal??{};U.value={...U.value,personal:{...i,rtk_installed:n}}}catch{}}}async function ru(e,n){try{await w("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:je(),partial:n,startedAt:Vs(null)}})}catch(i){E.value={message:i instanceof Error?i.message:String(i),tone:"error"}}}async function da(){Jn.value=!0;try{const e=await w("/api/v1/settings/diff",{method:"POST",body:{values:U.value,ifUnmodifiedSince:na.value}});yi.value=e.changes,$e.value={}}catch(e){e instanceof A?($e.value=vi(e.body.error??{message:e.message}),E.value={message:B(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Jn.value=!1}}function ri(){return gi.value?!1:O.value===null||ue.value===null?O.value!==ue.value:JSON.stringify(O.value)!==JSON.stringify(ue.value)}async function Oe(e){const n=Nt(e);await ru(n,U.value),ve.value=n,E.value=null;const i=mi(n,{extended:P.value});(i.kind==="welcome"||i.kind==="userMd")&&It(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&yn(),i.kind==="roles"&&$t(),i.kind==="packs"&&Si(),i.kind==="aiTools"&&wi(),i.id==="identity"&&ua(),i.kind==="review"&&da()}function xi(){const e=te.value,n=new Map(bi.value.map(a=>[a.id,a])),i=Object.entries(e).filter(([,a])=>a===!0).map(([a])=>a).filter(a=>{const o=n.get(a)?.cluster;return o===void 0||e[o]===!0}),t=new Set,l=a=>{if(!t.has(a)){t.add(a);for(const o of n.get(a)?.requires_hint??[])l(o)}};for(const a of i)l(a);return[...t].sort()}async function $t(){if(await Promise.all([yn(),It()]),ra.value||Object.values(V.value).some(Boolean))return;const e=O.value?.role??[];if(e.length===0)return;const n=new Set(gn.value.map(t=>t.id)),i={};for(const t of e)n.has(t)&&(i[t]=!0);Object.keys(i).length!==0&&(V.value=i,Si())}function Si(){if(Zi.value)return;const e=Object.entries(V.value).filter(([,l])=>l===!0).map(([l])=>l),n=new Map(gn.value.map(l=>[l.id,l])),i=[];for(const l of e)for(const a of n.get(l)?.default_packs??[])i.push(a);const t=new Map;for(const l of bi.value)l.cluster!==void 0&&t.set(l.id,l.cluster);te.value=Is({installed:_e.value,roleDefaults:i,detected:ki.value,clusterOf:t})}function lu(){const e=Object.entries(Z.value).filter(([,t])=>t===!0).map(([t])=>t);if(e.length===0)return null;const n=xi(),i={schema_version:"wizard-v2",tools:e,packs:n,settings:U.value};return Me.value?.dryRun===!0&&(i.dry_run=!0),i}async function au(){Vn.value=!0,E.value=null;try{const e={settings:U.value},n=Object.entries(V.value).filter(([,s])=>s===!0).map(([s])=>s),i=O.value!==null&&typeof O.value.identity?.name=="string"&&O.value.identity.name.trim().length>0;O.value!==null&&i&&(ri()||n.length>0)&&(e.identity=n.length>0?{...O.value,role:n}:O.value);const t=await w("/api/v1/wizard/finish",{method:"POST",body:e}),l="You can close this browser window now.",a=t.dryRun===!0?"Dry-run complete — no files written. Settings would be saved.":Array.isArray(t.writtenPaths)?`Saved (${t.writtenPaths.join(", ")}). Wizard complete.`:"Wizard complete.",o=P.value?lu():null;let c="";if(o!==null&&o.dry_run===!0)try{await w("/api/v1/wizard/apply",{method:"POST",body:o}),c=" Installer preview OK (dry-run) — no files written."}catch(s){c=` Installer preview failed: ${s instanceof A?B(s.body.error??{code:"UNKNOWN",message:s.message}):s instanceof Error?s.message:String(s)}.`}else if(o!==null)try{let s=null;await Ya("/api/v1/wizard/apply",o,d=>{d.type==="error"&&(s=typeof d.message=="string"?d.message:"install failed")});const u=o.tools.length,h=o.packs.length;c=s!==null?` Installer failed: ${s}. Settings were saved; re-run the wizard to retry.`:` Installer applied ${u} tool${u===1?"":"s"}`+(h>0?` and ${h} pack${h===1?"":"s"}.`:".")}catch(s){c=` Installer bridge failed: ${s instanceof A?B(s.body.error??{code:"UNKNOWN",message:s.message}):s instanceof Error?s.message:String(s)}. Settings were saved; re-run the wizard to retry the install plan.`}E.value={message:`${a}${c} ${l}`,tone:"success"},ve.value=Nt(je()-1),ea.value=U.value,ue.value=ri()?O.value:ue.value,yi.value=[],Ee.value=!0}catch(e){e instanceof A?($e.value=vi(e.body.error??{message:e.message}),E.value={message:B(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Vn.value=!1}}async function ou(){Ot.value=!0,await Promise.all([yn(),wi()]),await $t(),Si(),await Oe(je()-1)}function cu(){ee(()=>{yn(),wi()},[]);const e=Le.value||En.value||!Vi.value||!Qi.value,n=Object.values(Et.value).filter(Boolean).length,i=_e.value.length,t=ki.value.filter(l=>!_e.value.includes(l)).length;return r("div",{class:"ac-start",children:[r("section",{class:"ac-start__card ac-start__card--primary",children:[r("h2",{class:"ac-start__title",children:"Recommended setup"}),r("p",{class:"ac-start__desc",children:"The fastest path — we pre-select everything we can detect and you confirm one review screen before anything is written."}),r("ul",{class:"ac-start__facts",children:[r("li",{children:e?"Detecting your AI tools…":n===0?"No AI tools detected — pick them on the review screen.":`${n} AI tool${n===1?"":"s"} detected and pre-selected.`}),r("li",{children:e?"Detecting capability packs…":i>0?`${i} installed pack${i===1?"":"s"} kept${t>0?`, ${t} more auto-detected`:""}.`:t>0?`${t} capability pack${t===1?"":"s"} auto-detected.`:"No packs pre-selected — add them any time later."}),r("li",{children:"Settings keep their current values (or safe defaults on a first run)."}),r("li",{children:"Nothing is written until you confirm the review screen."})]}),r("button",{type:"button",class:"ac-button ac-button--primary ac-start__cta",disabled:e,onClick:()=>{ou()},children:e?"Detecting…":"Use recommended setup"})]}),r("section",{class:"ac-start__card",children:[r("h2",{class:"ac-start__title",children:"Customize"}),r("p",{class:"ac-start__desc",children:"Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself."}),r("button",{type:"button",class:"ac-button ac-start__cta",onClick:()=>{Ot.value=!0},children:"Customize step by step"})]})]})}const su=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function uu(){if(xr.value)return;const e=O.value;if(e===null)return;xr.value=!0;let n=e;if(e.identity.name.trim()===""){const i=Me.value?.systemUser;i!==void 0&&i.trim()!==""&&(n={...n,identity:{...n.identity,name:i}})}if(!At.value&&typeof navigator<"u"){const i=(navigator.language||"").split("-")[0];i.length>=2&&(n={...n,language:i})}n!==e&&(O.value=n)}function du(){const e=O.value;if(ee(()=>{uu()},[e]),e===null)return r("p",{children:"Loading…"});const n=i=>{O.value={...i,last_updated:new Date().toISOString().slice(0,10)},gi.value=!1};return r("div",{class:"ac-wizard-step-stub ac-wizard__module-fields",children:[r("p",{children:["Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in ",r("code",{children:".agent-user.yml"}),"."]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-name",children:"Name"}),r("input",{class:"ac-input",id:"welcome-name",type:"text",placeholder:"How should the agent address you?",value:e.identity.name,onInput:i=>n({...e,identity:{...e.identity,name:i.currentTarget.value}})})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-lang",children:"Language"}),r("input",{class:"ac-input",id:"welcome-lang",type:"text",list:"welcome-lang-list",placeholder:"BCP-47 code, e.g. de, en, en-US",value:e.language,onInput:i=>n({...e,language:i.currentTarget.value})}),r("datalist",{id:"welcome-lang-list",children:su.map(i=>r("option",{value:i},i))})]})]})}function fu(){const e=Z.value,n=Et.value;return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard."}),r("ul",{class:"ac-wizard__tool-list",children:Gs.map(i=>{const t=n[i.id]===!0;return r("li",{class:"ac-wizard__tool-row",children:[r("label",{class:"ac-wizard__tool-label",children:[r("input",{type:"checkbox",checked:e[i.id]??!1,onChange:l=>{const a=l.currentTarget.checked;Z.value={...e,[i.id]:a}}})," ",i.label]}),r("span",{class:`ac-badge ${t?"ac-badge--installed":"ac-badge--missing"}`,title:t?"Detected on this machine":"Not detected on this machine",children:t?"installed":"not installed"})]},i.id)})})]})}function hu(){if(Le.value)return r("p",{children:"Loading roles…"});if(de.value!==null)return r("div",{class:"ac-wizard-step-stub",children:r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]})});const e=V.value,n=gn.value,i=(t,l)=>{ra.value=!0,V.value={...V.value,[t]:l},Si()};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:["Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in",r("code",{children:" .agent-user.yml"}),"."]}),n.length===0?r("p",{children:r("em",{children:"No roles available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:n.map(t=>r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:e[t.id]??!1,onChange:l=>{i(t.id,l.currentTarget.checked)}}),r("span",{class:"ac-pack-tile__title",children:t.label})]}),(t.example_roles??[]).length>0?r("p",{class:"ac-pack-tile__role",children:["e.g. ",(t.example_roles??[]).join(", ")]}):null,t.description!==""?r("p",{class:"ac-pack-tile__desc",children:t.description}):null]},t.id))})]})}function pu(){if(Le.value)return r("p",{children:"Loading discovery manifest…"});if(de.value!==null)return r("div",{class:"ac-wizard-step-stub",children:[r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]}),r("p",{children:"The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list."})]});const e=te.value,n=new Set(ki.value),i=new Set(_e.value),t=f=>i.has(f)?r("span",{class:"ac-badge ac-badge--installed",children:"installed"}):n.has(f)?r("span",{class:"ac-badge ac-badge--detected",children:"auto-detected"}):null,l=new Map(gn.value.map(f=>[f.id,f.label])),a=V.value,o=f=>{const v=(f??[]).filter(m=>m!=="agent-config-maintainer");return v.length===0?null:r("span",{class:"ac-pack-tile__ws",children:v.map(m=>r("span",{class:`ac-badge ac-badge--ws${a[m]===!0?" ac-badge--ws-active":""}`,title:a[m]===!0?"Matches a role you picked":"Workspace / area",children:l.get(m)??m},m))})},c=bi.value.filter(f=>f.id!=="engineering-base"),s=new Map;for(const f of c)if(f.cluster!==void 0){const v=s.get(f.cluster)??[];v.push(f),s.set(f.cluster,v)}const u=new Set(c.filter(f=>f.cluster!==void 0).map(f=>f.id)),h=c.filter(f=>!u.has(f.id)),d=(f,v)=>{Zi.value=!0,te.value={...te.value,[f]:v}},_=(f,v)=>{Zi.value=!0;const m={...te.value,[f]:v};if(v)for(const k of s.get(f)??[])m[k.id]===void 0&&(m[k.id]=!0);te.value=m};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all."}),h.length===0?r("p",{children:r("em",{children:"No packs available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:h.map(f=>{const v=s.get(f.id)??[],m=v.length>0,k=e[f.id]??!1;return r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:k,onChange:b=>{const g=b.currentTarget.checked;m?_(f.id,g):d(f.id,g)}}),r("span",{class:"ac-pack-tile__title",children:f.label}),t(f.id)]}),o(f.workspaces),f.description!==""?r("p",{class:"ac-pack-tile__desc",children:f.description}):null,m?r("fieldset",{class:"ac-pack-tile__children",disabled:!k,children:v.map(b=>r("label",{class:"ac-pack-tile__child",children:[r("input",{type:"checkbox",checked:e[b.id]??!1,disabled:!k,onChange:g=>{d(b.id,g.currentTarget.checked)}}),r("span",{children:b.label}),t(b.id)]},b.id))}):null]},f.id)})})]})}function vu(){const e=la.value,n=aa.value;return r("div",{class:"ac-rtk-row",children:[r("div",{class:"ac-rtk-row__head",children:[r("span",{class:"ac-rtk-row__label",children:["rtk ",r("small",{children:"(Rust Token Killer)"})]}),e===null?r("span",{class:"ac-badge ac-badge--missing",children:"detecting…"}):e?r("span",{class:"ac-badge ac-badge--installed",children:"installed"}):r("span",{class:"ac-badge ac-badge--missing",children:"not installed"})]}),e===!1?r("div",{class:"ac-rtk-row__install",children:[r("p",{class:"ac-field__description",children:"rtk wraps verbose CLI output for ~60–90% token savings. Install it, then re-open the wizard to pick up detection:"}),n!==null?r("code",{class:"ac-rtk-row__cmd",children:n}):null,r("a",{class:"ac-button",href:oa.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}function _u(){const e=mi(ve.value,{extended:P.value});if(P.value&&Re.value==="install"&&e.id==="identity"&&!On.value)return r(Hs,{});if(e.kind==="form"){const i=Ls(Ct.value,e.paths??[]);return r(M,{children:[e.id==="identity"?r(vu,{}):null,r(eo,{schema:i,values:U.value,errors:$e.value,onChange:t=>{U.value=t}})]})}return e.kind==="userMd"?!Gi.value||O.value===null?r("p",{children:"Loading .agent-user.yml…"}):r(ro,{value:O.value,errors:$e.value,hideRole:P.value&&Re.value==="install",hideIdentityBasics:P.value&&Re.value==="install",onChange:i=>{O.value=i,gi.value=!1}}):e.kind==="welcome"?r(du,{}):e.kind==="aiTools"?r(fu,{}):e.kind==="roles"?r(hu,{}):e.kind==="packs"?r(pu,{}):r(Bs,{steps:sa(),currentIndex:ve.value,changes:yi.value,errors:$e.value,userMdChanged:ri(),userMdAction:At.value?"replace":"create",loading:Jn.value,onJump:i=>{Oe(i)},selectedToolsCount:Object.values(Z.value).filter(Boolean).length,selectedPacksCount:Object.values(te.value).filter(Boolean).length,packRemovals:tt(),removalsConfirmed:Ji.value,onConfirmRemovals:i=>{Ji.value=i},selectedToolIds:Object.entries(Z.value).filter(([,i])=>i).map(([i])=>i),packAdditions:P.value?xi().filter(i=>i!=="engineering-base"&&!_e.value.includes(i)):[]})}function tt(){return P.value?$s(_e.value,xi()):[]}function Sr({path:e}){if(ee(()=>{nu()},[]),!Xl.value||Ct.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Setup wizard"}),Ve.value!==null?r("p",{class:"ac-banner ac-banner--error",children:Ve.value}):r("p",{children:"Loading…"})]});const n=ve.value,i=je(),t=mi(n,{extended:P.value}),l=n===i-1,a=t.kind==="aiTools"&&Object.values(Z.value).filter(Boolean).length===0||t.kind==="roles"&&Object.values(V.value).filter(Boolean).length===0||t.kind==="packs"&&xi().length===0,o=P.value&&Re.value==="install"&&t.id==="identity"&&!On.value,c=ti.value,s=c!==null&&!ca.value,u=Xi.value,h=u!==null&&u.present&&!et.value,d=P.value&&Re.value==="install"&&n===0&&!Ot.value&&!Ee.value;return h?r("div",{class:"ac-page",children:r(Ws,{sourcePath:u.path,backupTarget:u.backupTarget,version:u.version,busy:nt.value,error:it.value,onBackupAndProceed:()=>{eu()},onAbort:()=>{E.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},et.value=!0}})}):d?r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:r("h1",{children:"Set up agent-config"})}),E.value!==null?r("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,r(cu,{})]}):r("div",{class:"ac-page",children:[r(Fs,{step:t,index:n,total:i}),s?r(Us,{abortedAt:c.abortedAt,abortNote:c.abortNote,writesSinceRollback:c.writesSinceRollback,busy:Vn.value,onResume:()=>{Ri("resume")},onRollback:()=>{Ri("rollback")},onIgnore:()=>{Ri("ignore")}}):null,E.value!==null&&!(Ee.value&&l&&E.value.tone==="success")?r("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,r("div",{class:"ac-wizard__step",children:Ee.value&&l?r(qs,{message:E.value?.tone==="success"?E.value.message:null}):r(_u,{})}),a?r("p",{class:"ac-wizard__hint",children:t.kind==="aiTools"?"Select at least one AI tool to continue.":t.kind==="roles"?"Select at least one role to continue.":"Select at least one capability pack to continue."}):null,r(Ps,{canGoPrev:n>0,canGoNext:!l&&!a,canSkip:o||t.kind==="userMd",skipLabel:o?"Finish install here":"Skip",isLast:l,busy:Vn.value||Jn.value,canFinish:(yi.value.length>0||ri()||tt().length>0||P.value&&Object.values(Z.value).some(Boolean))&&(tt().length===0||Ji.value),completed:Ee.value,onPrev:()=>{Oe(n-1)},onNext:()=>{if(o){On.value=!0;return}Oe(n+1)},onSkip:()=>{if(o){On.value=!0,Oe(je()-1);return}gi.value=!0,Oe(n+1)},onFinish:()=>{au()}})]})}const mu=new Set(["profile.id","rule_loading_tier","discipline_profile","personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon","personal.pr_progress_comments","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns","memory.cadence","chat_history.enabled","update_check.enabled","subagents.enabled","subagents.auto","worktrees.mode","legal_review_prep.acknowledged"]);function Cr(e){return mu.has(e)}function gu(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function fa(e,n){if(e.kind==="enum_removed"){const i=new Set(e.values??[]);return n!==void 0&&i.has(n)?"must_fix":"info"}return e.kind==="type_changed"?"must_fix":e.kind==="default_changed"?n===void 0||gu(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const rt=p(!0),li=p(null),lt=p(!1),Ci=p(null),Be=p({}),at=p(0),me=p({}),re=p(null),J=p(!1),cn=p(!1);function fe(e){return`${e.key}:${e.kind}`}async function yu(){rt.value=!0,li.value=null,lt.value=!1,cn.value=!1;try{const e=await w("/api/v1/settings/changes"),n=await w("/api/v1/settings");Ci.value=e.delta,Be.value=n.values,at.value=n.lastModified,bu(e.delta,n.values)}catch(e){e instanceof A&&e.status===404?lt.value=!0:li.value=e instanceof Error?e.message:String(e)}finally{rt.value=!1}}function bu(e,n){const i={};for(const t of e.changes){const l=fa(t,mn(n,t.key.split(".")));l==="adopt"?i[fe(t)]={mode:"adopt"}:l==="review"?i[fe(t)]={mode:"keep"}:l==="must_fix"&&(i[fe(t)]={mode:null})}me.value=i}function Lt(e){return fa(e,mn(Be.value,e.key.split(".")))}function Je(e,n){me.value={...me.value,[e]:n}}function Rt(){const e=Ci.value;return e===null?[]:e.changes.filter(n=>{if(Lt(n)!=="must_fix")return!1;const i=me.value[fe(n)];return i===void 0||i.mode===null||i.mode==="custom"&&(i.value===void 0||i.value==="")})}function ku(){const e=Ci.value;let n=Be.value;if(e===null)return n;for(const i of e.changes){const t=me.value[fe(i)];if(t===void 0||t.mode===null||t.mode==="keep")continue;const l=i.key.split(".");t.mode==="adopt"&&i.new?.default!==void 0?n=tn(n,l,i.new.default):t.mode==="custom"&&t.value!==void 0&&(n=tn(n,l,t.value))}return n}async function wu(){if(J.value)return;const e=Rt();if(e.length>0){re.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}J.value=!0,re.value=null;try{const n=ku();if(JSON.stringify(n)!==JSON.stringify(Be.value)){const i=await w("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(at.value)},body:{values:n}});Be.value=n,at.value=i.lastModified}await w("/api/v1/settings/changes/ack",{method:"POST"}),cn.value=!0}catch(n){n instanceof A?re.value=B(n.body.error??{code:"UNKNOWN",message:n.message}):re.value=n instanceof Error?n.message:String(n)}finally{J.value=!1}}async function xu(){if(J.value)return;if(Rt().length>0){re.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}J.value=!0;try{await w("/api/v1/settings/changes/ack",{method:"POST"}),cn.value=!0}catch(n){re.value=n instanceof Error?n.message:String(n)}finally{J.value=!1}}function ne(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Fi({change:e,id:n}){const i=e.new,l=me.value[n]?.value;return i?.enum!==void 0?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onChange:a=>{const o=a.currentTarget.value;Je(n,{mode:"custom",value:o})},children:[r("option",{value:"",disabled:!0,children:"Choose a value…"}),i.enum.map(a=>r("option",{value:String(a),children:String(a)},String(a)))]}):i?.type==="boolean"?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onChange:a=>{Je(n,{mode:"custom",value:a.currentTarget.value==="true"})},children:[r("option",{value:"",disabled:!0,children:"Choose…"}),r("option",{value:"true",children:"true"}),r("option",{value:"false",children:"false"})]}):r("input",{class:"ac-input",type:i?.type==="number"||i?.type==="integer"?"number":"text","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onInput:a=>{const o=a.currentTarget.value,c=i?.type==="number"||i?.type==="integer"?Number(o):o;Je(n,{mode:"custom",value:c})}})}function Su({change:e}){const n=Lt(e),i=fe(e),t=me.value[i],l=mn(Be.value,e.key.split("."));return r("li",{class:`ac-change-card ac-change-card--${n}`,"data-key":e.key,"data-kind":e.kind,children:[r("div",{class:"ac-change-card__head",children:[r("code",{class:"ac-change-card__key",children:e.key}),r("span",{class:`ac-change-card__badge ac-change-card__badge--${n}`,children:n==="must_fix"?"Must fix":n==="adopt"?"New default":n==="review"?"Review":"Info"})]}),e.new?.description!==void 0?r("p",{class:"ac-change-card__desc",children:e.new.description}):null,e.kind==="default_changed"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Default changed: ",r("code",{children:ne(e.old?.default)})," → ",r("code",{children:ne(e.new?.default)}),n==="review"?r(M,{children:[" · your value: ",r("code",{children:ne(l)})]}):null]}),r("div",{class:"ac-change-card__choices",role:"radiogroup","aria-label":`Resolution for ${e.key}`,children:[r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:t?.mode==="adopt",onChange:()=>{Je(i,{mode:"adopt"})}}),r("span",{children:["Adopt new default (",r("code",{children:ne(e.new?.default)}),")"]})]}),r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:t?.mode==="keep",onChange:()=>{Je(i,{mode:"keep"})}}),r("span",{children:["Keep current (",r("code",{children:ne(l??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Your value ",r("code",{children:ne(l)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),r(Fi,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["Removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")})," — your value ",r("code",{children:ne(l??e.new?.default)})," is unaffected."]}):null,e.kind==="enum_added"?r("p",{class:"ac-change-card__detail",children:["New option",(e.values?.length??0)===1?"":"s"," available: ",r("code",{children:(e.values??[]).join(", ")})]}):null,e.kind==="added"?n==="must_fix"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),r(Fi,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["New setting · default: ",r("code",{children:ne(e.new?.default)}),e.new?.enum!==void 0?r(M,{children:[" · options: ",r("code",{children:e.new.enum.join(", ")})]}):null]}):null,e.kind==="removed"?r("p",{class:"ac-change-card__detail",children:"This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted)."}):null,e.kind==="type_changed"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Type changed: ",r("code",{children:e.old?.type})," → ",r("code",{children:e.new?.type}),". Define a new value:"]}),r(Fi,{change:e,id:i})]}):null]})}function Cu(e){const n=new Map;for(const u of e.changes){const h=Lt(u);n.set(h,[...n.get(h)??[],u])}const i=[],t=n.get("must_fix")??[];t.length>0&&i.push({title:"Must fix",hint:"These stored values are invalid after the upgrade — saving is blocked until each has a valid value.",changes:t});const l=[...n.get("adopt")??[],...n.get("review")??[]];l.length>0&&i.push({title:"Changed defaults",hint:"Values you never customized are preselected to adopt the new default; customized values are kept unless you choose otherwise.",changes:l});const a=n.get("info")??[],o=a.filter(u=>u.kind==="added"),c=a.filter(u=>u.kind==="enum_added"),s=a.filter(u=>u.kind!=="added"&&u.kind!=="enum_added");return o.length>0&&i.push({title:"New settings",changes:o}),c.length>0&&i.push({title:"New options",changes:c}),s.length>0&&i.push({title:"Removed / other",changes:s}),i}function Au(){if(ee(()=>{yu()},[]),rt.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{children:"Loading…"})]});if(li.value!==null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner ac-banner--error",children:li.value})]});if(cn.value||lt.value)return r("div",{class:"ac-page ac-settings-changes",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner",children:cn.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),r("button",{type:"button",class:"ac-button",onClick:()=>pi("/settings"),children:"Back to Settings"})]});const e=Ci.value;if(e===null)return r("div",{class:"ac-page",children:r("h1",{children:"Settings changes"})});const n=Cu(e),i=Rt().length;return r("div",{class:"ac-page ac-settings-changes",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-page__lede",children:["The upgrade ",r("code",{children:e.oldVersion})," → ",r("code",{children:e.newVersion})," changed the available settings. Review below — nothing was changed automatically."]})]}),re.value!==null?r("p",{class:"ac-banner ac-banner--error",role:"alert",children:re.value}):null,n.map(t=>r("section",{class:"ac-settings-changes__group",children:[r("h2",{children:[t.title," ",r("span",{class:"ac-settings-changes__count",children:["(",t.changes.length,")"]})]}),t.hint!==void 0?r("p",{class:"ac-settings-changes__hint",children:t.hint}):null,r("ul",{class:"ac-settings-changes__list",children:t.changes.map(l=>r(Su,{change:l},fe(l)))})]},t.title)),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",disabled:J.value,onClick:()=>{xu()},children:"Dismiss (keep everything)"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:J.value||i>0,title:i>0?`${i} “Must fix” item${i===1?"":"s"} unresolved`:void 0,onClick:()=>{wu()},children:J.value?"Saving…":"Apply & finish review"})]})]})}const xe=p(null);function Tu(){return ee(()=>{(async()=>{try{const e=await w("/api/v1/settings/changes");xe.value=e.delta.changes.length}catch{xe.value=null}})()},[]),xe.value===null||xe.value===0?null:r("div",{class:"ac-banner ac-banner--pending",role:"status",children:[r("span",{children:["An upgrade changed ",xe.value," setting",xe.value===1?"":"s"," — review recommended."]}),r("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>pi("/settings/changes"),children:"Review changes"})]})}const ot=p(!1),ai=p(null),X=p({}),oi=p(null),sn=p(0),un=p({}),K=p(null),dn=p(!1),Ue=p(null),Nn=p(""),Ce=p(!1),In=p({}),$n=p({global:new Set,project:new Set});function Ar(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Tr(){ai.value=null;try{const e=await w("/api/v1/settings");X.value=e.values,oi.value=Ar(e.schema),sn.value=e.lastModified,$n.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},ot.value=!0}catch(e){if(e instanceof A&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){X.value=n.defaults,oi.value=Ar(n.schema),sn.value=n.lastModified??0,ot.value=!0;return}}ai.value=e instanceof Error?e.message:String(e)}}async function Eu(){if(!dn.value){K.value=null,un.value={};try{const e=await w("/api/v1/settings/diff",{method:"POST",body:{values:X.value,ifUnmodifiedSince:sn.value}});if(e.changes.length===0){K.value="No changes to save.";return}Ue.value=e.changes}catch(e){e instanceof A?(un.value=vi(e.body.error??{message:e.message}),K.value=B(e.body.error??{code:"UNKNOWN",message:e.message})):K.value=e instanceof Error?e.message:String(e)}}}async function Ou(){dn.value=!0;try{const e=await w("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(sn.value)},body:{values:X.value}});sn.value=e.lastModified,Ue.value=null,K.value=`Saved (${e.writtenPaths.join(", ")}).`}catch(e){if(e instanceof A){const n=e.body.error??{code:"UNKNOWN",message:e.message};un.value=vi(n),K.value=B(n),Ue.value=null;const i=Object.keys(un.value)[0];i!==void 0&&queueMicrotask(()=>{const t=document.getElementById(i);t!==null&&t.focus()})}else K.value=e instanceof Error?e.message:String(e)}finally{dn.value=!1}}function Ft(e){if(e.defaultValue===void 0)return!1;const n=mn(X.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function Nu(e,n){const i=Ft(n),t=$n.value.project.has(e)?"project":$n.value.global.has(e)&&$n.value.project.size>0?"global":void 0;return{modified:i,onReset:i&&n.defaultValue!==void 0?()=>{X.value=tn(X.value,n.path,n.defaultValue)}:void 0,sourceLabel:t}}function Iu(e,n){const i=n.toLowerCase();return e.path.join(".").toLowerCase().includes(i)||e.label.toLowerCase().includes(i)||(e.description??"").toLowerCase().includes(i)}function $u(e){const n=Nn.value.trim(),i=Ce.value,t=e.path.join("."),l=In.value[t]===!0;let a=e.fields.filter(u=>u.kind!=="unsupported");if(n!==""&&(a=a.filter(u=>Iu(u,n))),i&&(a=a.filter(u=>Ft(u))),n!==""||i)return a.length===0?null:{section:e,visible:a,hiddenAdvancedCount:0,expanded:l};const o=a.filter(u=>Cr(u.path.join("."))),c=a.filter(u=>!Cr(u.path.join("."))),s=l?[...o,...c]:o;return s.length===0&&c.length===0?null:{section:e,visible:s,hiddenAdvancedCount:l?0:c.length,expanded:l}}function Lu(e){In.value={...In.value,[e]:In.value[e]!==!0}}function Ru({changes:e}){return r("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:r("div",{class:"ac-modal__panel",children:[r("h2",{id:"diff-title",children:"Confirm changes"}),r("ul",{class:"ac-diff",children:e.map(n=>r("li",{children:[r("code",{children:n.path}),r("span",{class:"ac-diff__before",children:JSON.stringify(n.from)}),r("span",{class:"ac-diff__arrow",children:"→"}),r("span",{class:"ac-diff__after",children:JSON.stringify(n.to)})]},n.path))}),r("div",{class:"ac-modal__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Ue.value=null},children:"Cancel"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:dn.value,onClick:()=>{Ou()},children:dn.value?"Saving…":"Save"})]})]})})}function Fu(){if(ee(()=>{Tr()},[]),!ot.value||oi.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings"}),ai.value!==null?r("p",{class:"ac-banner ac-banner--error",children:ai.value}):r("p",{children:"Loading…"})]});const e=al(oi.value),n=e.map($u).filter(l=>l!==null),i=e.flatMap(l=>l.fields).filter(l=>Ft(l)).length,t=Nn.value.trim()!==""||Ce.value;return r("div",{class:"ac-page ac-settings-hub",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings"}),r("nav",{class:"ac-page__nav",children:r("a",{href:"#/settings/user",children:"Edit .agent-user.yml →"})})]}),r(Tu,{}),r("div",{class:"ac-settings-hub__toolbar",role:"search",children:[r("input",{class:"ac-input ac-settings-hub__search",type:"search",placeholder:"Search all settings (basic and advanced)…",value:Nn.value,onInput:l=>{Nn.value=l.currentTarget.value}}),r("button",{type:"button",class:`ac-chip-toggle${Ce.value?" ac-chip-toggle--active":""}`,"aria-pressed":Ce.value,onClick:()=>{Ce.value=!Ce.value},children:["@modified",i>0?` (${i})`:""]})]}),K.value!==null?r("p",{class:"ac-banner",children:K.value}):null,r("form",{class:"ac-form",onSubmit:l=>l.preventDefault(),children:[n.length===0?r("p",{class:"ac-settings-hub__empty",children:"No settings match."}):n.map(l=>{const a=l.section.path.join(".");return r(ol,{section:{...l.section,fields:l.visible},values:X.value,errors:un.value,onChange:o=>{X.value=o},decorate:Nu,footer:!t&&(l.hiddenAdvancedCount>0||l.expanded)?r("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":l.expanded,onClick:()=>{Lu(a)},children:l.expanded?"Hide advanced settings":`Show ${l.hiddenAdvancedCount} advanced setting${l.hiddenAdvancedCount===1?"":"s"}`}):void 0},a)}),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Tr()},children:"Reload"}),r("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{Eu()},children:"Preview & Save"})]})]}),Ue.value!==null?r(Ru,{changes:Ue.value}):null]})}const ci=p(!1),Fe=p(null);async function Pu(){Qn.value=!0,Zn.value=null;try{const e=await w("/api/v1/modules/detect");Tt.value=e.candidates,ta.value=e.project_root;const n={};for(const i of e.candidates)n[i.path]=!0;Xn.value=n,ei.value=e.proposed_block.enabled,ni.value=e.proposed_block.namespace_template??"",ii.value=e.proposed_block.agent_folder??"agents"}catch(e){Zn.value=e instanceof A?B(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{Qn.value=!1,Ks.value=!0}}function Mu(){const e=new Set(Tt.value.map(t=>t.path)),n=Xn.value,i=Object.keys(n).filter(t=>n[t]===!0&&e.has(t));return{enabled:ei.value,root_paths:i,namespace_template:ni.value,agent_folder:ii.value||"agents"}}async function Du(){ci.value=!0,Fe.value=null;try{const e=await w("/api/v1/modules/apply",{method:"POST",body:Mu()});Fe.value={message:e.appliedTo!==null?`Saved project settings to ${e.appliedTo}.`:`Saved project settings to ${e.projectRoot}.`,tone:"success"}}catch(e){const n=e instanceof A?B(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);Fe.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{ci.value=!1}}function ju(){if(Qn.value)return r("p",{children:"Detecting module roots…"});if(Zn.value!==null)return r("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",Zn.value]});const e=Tt.value,n=Xn.value,i=ta.value;return r("div",{class:"ac-section",children:[i!==null?r("p",{class:"ac-section__description",children:["Scanning ",r("code",{children:i}),". Pick which detected roots the agent should treat as modules. These write to",r("code",{children:" .agent-project-settings.yml"})," in this repo only."]}):null,r("label",{children:[r("input",{type:"checkbox",checked:ei.value,onChange:t=>{ei.value=t.currentTarget.checked}})," ","Enable module discovery (writes ",r("code",{children:"modules.enabled"}),")"]}),e.length===0?r("p",{children:[r("em",{children:"No module roots detected."})," The scan found no common module layouts (Laravel ",r("code",{children:"app/Modules/"}),", Symfony",r("code",{children:" src/Module/"}),", Node ",r("code",{children:"packages/"}),", Python",r("code",{children:" src/"}),", Go ",r("code",{children:"internal/"}),")."]}):r("ul",{style:"list-style: none; padding-left: 0;",children:e.map(t=>r("li",{children:r("label",{children:[r("input",{type:"checkbox",checked:n[t.path]??!1,onChange:l=>{const a=l.currentTarget.checked;Xn.value={...n,[t.path]:a}}})," ",r("code",{children:t.path})," — ",t.stack," ",r("small",{children:["(",t.confidence," confidence)"]})]})},t.path))}),r("div",{class:"ac-wizard__module-fields",children:[r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-namespace",children:"Namespace template"}),r("input",{id:"ac-modules-namespace",class:"ac-input",type:"text",value:ni.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:t=>{ni.value=t.currentTarget.value}}),r("span",{class:"ac-field__description",children:"How a module path maps to its namespace. Leave blank to skip namespacing."})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-agent-folder",children:"Agent folder"}),r("input",{id:"ac-modules-agent-folder",class:"ac-input",type:"text",value:ii.value,placeholder:"agents",onInput:t=>{ii.value=t.currentTarget.value}}),r("span",{class:"ac-field__description",children:["Folder name that holds per-module agent docs (default ",r("code",{children:"agents"}),")."]})]})]})]})}function Bu(){return ee(()=>{Pu()},[]),r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Project settings"}),r("p",{class:"ac-section__description",children:["Configuration scoped to this repository — written to",r("code",{children:" .agent-project-settings.yml"}),", not the global tree."]})]}),Fe.value!==null?r("p",{class:`ac-banner ac-banner--${Fe.value.tone==="success"?"success":"error"}`,children:Fe.value.message}):null,r("section",{class:"ac-section",children:[r("h2",{class:"ac-section__title",children:"Modules"}),r(ju,{})]}),r("div",{class:"ac-form__actions ac-wizard__nav",children:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:ci.value||Qn.value,onClick:()=>{Du()},children:ci.value?"Saving…":"Save project settings"})})]})}const Ln=p([]),fn=p([]),ct=p([]),st=p([]),si=p(null),ha=p(!1),Qe=p(null),j=p(null),Pi=p("plain"),ui=p({}),pa=p([]),Er={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function Uu(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const Pt=p(Uu());function Hu(e){Pt.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const hn=p([]),Y=p(null),Ne=p({}),he=p(!1),pn=p(null),ce=p(""),Ze=p(!1),Ai=p(!1),ut=p(null),pe=p(null),vn=p([]),Rn=p(new Set),va="claude-code",Or=2e3;async function Wu(){Qe.value=null;try{const[e,n,i,t,l,a]=await Promise.all([w("/api/v1/workspace/roles"),w("/api/v1/workspace/sessions?limit=20"),w("/api/v1/workspace/knowledge?limit=20"),w("/api/v1/workspace/documents?limit=20"),w("/api/v1/workspace/drive-health").catch(()=>({health:{}})),w("/api/v1/workspace/hosts").catch(()=>({hosts:[]}))]);Ln.value=e.roles,fn.value=n.sessions,ct.value=i.chunks,st.value=t.documents,ui.value=l.health??{},pa.value=a.hosts??[],ha.value=!0}catch(e){e instanceof A?Qe.value=e.body?.error?.message??e.message:Qe.value=e instanceof Error?e.message:String(e)}}async function zu(e,n){try{const i=await w(`/api/v1/workspace/roles/${e}/tasks`);hn.value=i.tasks}catch{hn.value=n}}async function Mt(e){pe.value=e,Rn.value=new Set;try{const n=await w(`/api/v1/workspace/sessions/${e}`);vn.value=Array.isArray(n.log)?n.log:[]}catch{vn.value=[]}}async function Yu(e){j.value=null,Ai.value=!1,ce.value="",Y.value=null,await Mt(e)}async function _a(e,n,i){j.value=null,he.value=!0,ce.value="",Ai.value=!1,ut.value={role:e,task:n,inputs:i};try{const t=await w("/api/v1/workspace/launch",{method:"POST",body:{role:e,task:n,inputs:i,host:Pt.value}});pn.value=t,j.value=ma(t),Y.value=null,await Mt(t.id);const l=await w("/api/v1/workspace/sessions?limit=20");fn.value=l.sessions,await Dt()}catch(t){pn.value=null,t instanceof A?j.value=t.body?.error?.message??t.message:j.value=t instanceof Error?t.message:String(t)}finally{he.value=!1}}async function qu(e,n){if(!(n.trim()===""||Ze.value)){Ze.value=!0,j.value=null;try{const i=await w(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});pn.value=i,j.value=ma(i),i.driven&&(ce.value=""),await Mt(e);const t=await w("/api/v1/workspace/sessions?limit=20");fn.value=t.sessions,await Dt()}catch(i){i instanceof A&&i.status===410?(Ai.value=!0,j.value="Host session expired — start a new conversation."):i instanceof A?j.value=i.body?.error?.message??i.message:j.value=i instanceof Error?i.message:String(i)}finally{Ze.value=!1}}}async function Dt(){try{const e=await w("/api/v1/workspace/drive-health");ui.value=e.health??{}}catch{}}async function Ku(e){try{await w(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Dt()}catch{}}function ma(e){return e.driven?e.recovered===!0?`Host recovered — drove the turn for ${e.role} · ${e.task}.`:`Drove the turn for ${e.role} · ${e.task}.`:e.host_killed===!0?`Host ${va} is paused after repeated failures — handed off to the inbox.`:e.error_kind==="render-error"?`Couldn't fill the prompt: ${e.error??"missing input"}.`:e.reason==="no-prompt-for-task"?"Recorded the session — this task has no runnable prompt yet.":typeof e.handoff=="string"?`Prepared a hand-off — open ${e.handoff} and paste it into your host.`:`Recorded the session ${e.id} (${e.role} · ${e.task}).`}function Gu({role:e}){const n=si.value===e.slug;return r("button",{type:"button",class:`ac-workspace__role${n?" ac-workspace__role--active":""}`,"aria-current":n?"true":void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{si.value=e.slug,j.value=null,pn.value=null,Y.value=null,Ne.value={},hn.value=e.first_tasks,zu(e.slug,e.first_tasks)},children:[r("span",{class:"ac-workspace__role-name",children:e.display_name}),r("span",{class:"ac-workspace__role-status","data-status":e.status,children:e.status}),r("span",{class:"ac-workspace__role-tagline",children:e.tagline})]})}function Vu({role:e,task:n}){const i=n.inputs??[],t=Ne.value,l=i.some(a=>a.required&&(t[a.name]??"").trim()==="");return r("form",{class:"ac-workspace__task-form",onSubmit:a=>{a.preventDefault(),!l&&!he.value&&_a(e,n.name,Ne.value)},children:[i.length===0?r("p",{class:"ac-workspace__form-note",children:"No inputs — runs the prompt as-is."}):i.map(a=>r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:[a.name,a.required?r("span",{class:"ac-workspace__req","aria-hidden":"true",children:" *"}):null]}),r("textarea",{class:"ac-workspace__field-input",placeholder:a.shape,required:a.required,"aria-label":`${a.name}${a.required?" (required)":""}`,value:t[a.name]??"",onInput:o=>{Ne.value={...Ne.value,[a.name]:o.target.value}}})]},a.name)),r("div",{class:"ac-workspace__form-actions",children:[r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:l||he.value,children:he.value?"Running…":"Run task"}),r("button",{type:"button",class:"ac-button",onClick:()=>{Y.value=null},children:"Cancel"})]})]})}function Ju(e){const n=[];for(const i of e){const t=i.data??{};if(i.kind==="launcher.input")t.followup===!0?n.push({kind:"user",text:typeof t.prompt=="string"?t.prompt:""}):n.push({kind:"task",text:typeof t.task=="string"?t.task:""});else if(i.kind==="host.turn"){const l=t.usage,a=l!=null?`${typeof t.model=="string"?t.model:va} · in ${l.input_tokens??0} / out ${l.output_tokens??0} tokens`:void 0;n.push({kind:"assistant",text:typeof t.text=="string"?t.text:"",meta:a})}else if(i.kind==="host.error"){const l=typeof t.error_kind=="string"?t.error_kind:"error";n.push({kind:"error",text:`${l}: ${typeof t.error=="string"?t.error:""}`})}}return n}function Qu(){if(pe.value===null)return null;const e=Ju(vn.value),n=vn.value.some(i=>i.kind==="host.turn");return r("section",{class:"ac-workspace__thread","aria-label":"Conversation thread",children:[r("h2",{class:"ac-workspace__heading",children:"Conversation"}),e.length===0?r("p",{class:"ac-workspace__empty",children:"No turns yet."}):r("ol",{class:"ac-workspace__thread-list",children:e.map((i,t)=>{const l=i.kind==="assistant"&&i.text.length>Or,a=Rn.value.has(t),o=l&&!a?`${i.text.slice(0,Or)}…`:i.text;return r("li",{class:`ac-workspace__thread-block ac-workspace__thread-block--${i.kind}`,children:[r("span",{class:"ac-workspace__thread-role",children:i.kind==="task"?"Task":i.kind==="user"?"You":i.kind==="assistant"?"Host":"Error"}),r("pre",{class:"ac-workspace__thread-text",children:o}),l?r("button",{type:"button",class:"ac-button",onClick:()=>{const c=new Set(Rn.value);c.has(t)?c.delete(t):c.add(t),Rn.value=c},children:a?"Show less":"Show full"}):null,i.meta!=null?r("p",{class:"ac-workspace__turn-meta",children:i.meta}):null]},t)})}),Ai.value?r("div",{class:"ac-workspace__followup-gone",role:"status",children:[r("p",{children:"Host session expired."}),ut.value!==null?r("button",{type:"button",class:"ac-button ac-button--primary",disabled:he.value,onClick:()=>{const i=ut.value;i!==null&&_a(i.role,i.task,i.inputs)},children:he.value?"Starting…":"Start a new conversation"}):r("p",{children:"Pick a task above to start a new conversation."})]}):n?r("form",{class:"ac-workspace__followup",onSubmit:i=>{i.preventDefault(),pe.value!==null&&qu(pe.value,ce.value)},children:[r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:"Follow up"}),r("textarea",{class:"ac-workspace__field-input",placeholder:"Continue this conversation — e.g. make it shorter","aria-label":"Follow-up prompt",value:ce.value,onInput:i=>{ce.value=i.target.value}})]}),r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:ce.value.trim()===""||Ze.value,children:Ze.value?"Continuing…":"Send follow-up"})]}):null]})}function Zu({role:e}){const n=hn.value.length>0?hn.value:e.first_tasks;return r("section",{class:"ac-workspace__tasks","aria-labelledby":"task-heading",children:[r("h2",{id:"task-heading",class:"ac-workspace__heading",children:["First tasks · ",e.display_name]}),n.length===0?r("p",{class:"ac-workspace__empty",children:"No tasks scaffolded yet for this role."}):r("ul",{class:"ac-workspace__task-list",children:n.map(i=>r("li",{class:"ac-workspace__task",children:[r("div",{class:"ac-workspace__task-head",children:[r("span",{class:"ac-workspace__task-name",children:i.name}),r("button",{type:"button",class:"ac-button ac-button--primary","aria-expanded":Y.value===i.name,onClick:()=>{Y.value=Y.value===i.name?null:i.name,Ne.value={},pn.value=null,pe.value=null,vn.value=[]},children:Y.value===i.name?"Close":"Start session"})]}),r("p",{class:"ac-workspace__task-intent",children:i.intent}),i.prompt!==""?r("code",{class:"ac-workspace__task-prompt",children:["prompts/",i.prompt]}):null,Y.value===i.name?r(Vu,{role:e.slug,task:i}):null]},i.name))}),e.skills.length>0?r("details",{class:"ac-workspace__skills",children:[r("summary",{children:["Skill shortlist (",e.skills.length,")"]}),r("ul",{class:"ac-workspace__skill-list",children:[e.skills.slice(0,5).map(i=>r("li",{class:"ac-workspace__skill",children:[r("code",{children:i.id})," — ",i.why]},i.id)),e.skills.length>5?r("li",{class:"ac-workspace__skill-more",children:["+ ",e.skills.length-5," more"]}):null]})]}):null]})}function Xu(){return r("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[r("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),fn.value.length===0?r("p",{class:"ac-workspace__empty",children:"No sessions yet — pick a role and start one."}):r("ul",{class:"ac-workspace__session-list",children:fn.value.map(e=>r("li",{class:"ac-workspace__session",children:r("button",{type:"button",class:`ac-workspace__session-open${pe.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":pe.value===e.id?"true":void 0,onClick:()=>{Yu(e.id)},children:[r("span",{class:"ac-workspace__session-id",children:e.id.slice(0,16)}),r("span",{class:"ac-workspace__session-role",children:e.role}),r("span",{class:"ac-workspace__session-task",children:e.task})]})},e.id))})]})}function ed(){return r("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[r("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),ct.value.length===0?r("p",{class:"ac-workspace__empty",children:["No sources yet. Run ",r("code",{children:"/knowledge:ingest <path>"})," to add documents."]}):r("ol",{class:"ac-workspace__citation-list",children:ct.value.map((e,n)=>r("li",{class:"ac-workspace__citation",children:[r("span",{class:"ac-workspace__citation-marker","aria-label":`Citation ${n+1}`,children:["[",n+1,"]"]}),r("a",{href:`file://${e.source}`,class:"ac-workspace__citation-source",title:"Open source in OS default app",children:e.source.split("/").pop()??e.source}),e.pinned?r("span",{class:"ac-workspace__citation-pin","aria-label":"pinned",children:"★"}):null,r("p",{class:"ac-workspace__citation-excerpt",children:[e.excerpt.slice(0,200),e.excerpt.length>200?"…":""]})]},e.id))})]})}function nd(){return r("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[r("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),st.value.length===0?r("p",{class:"ac-workspace__empty",children:"No documents yet. Saved drafts land here."}):r("ul",{class:"ac-workspace__doc-list",children:st.value.map(e=>r("li",{class:"ac-workspace__doc",children:[r("span",{class:"ac-workspace__doc-type","data-type":e.type,children:e.type}),r("span",{class:"ac-workspace__doc-title",children:e.title}),r("time",{class:"ac-workspace__doc-time",dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function id(){const n=Object.values(ui.value).filter(i=>i.killed||i.consecutive_failures>0);return r("section",{class:"ac-workspace__drive-health","aria-labelledby":"drive-health-heading",children:[r("h2",{id:"drive-health-heading",class:"ac-workspace__heading",children:"Host health"}),n.length===0?r("p",{class:"ac-workspace__empty",children:"All hosts healthy."}):r("ul",{class:"ac-workspace__health-list",children:Object.entries(ui.value).filter(([,i])=>i.killed||i.consecutive_failures>0).map(([i,t])=>{const l=t.killed?t.kill_reason==="manual"?"paused (manual)":"paused — auto-recovering":"degraded";return r("li",{class:"ac-workspace__health","data-killed":t.killed?"true":"false",children:[r("span",{class:"ac-workspace__health-host",children:i}),r("span",{class:"ac-workspace__health-state",children:l}),r("span",{class:"ac-workspace__health-meta",children:[t.consecutive_failures," fail streak",t.last_error_kind!=null?` · ${t.last_error_kind}`:""]}),t.killed?r("button",{type:"button",class:"ac-button ac-workspace__health-reset","aria-label":`Reset ${i}`,onClick:()=>{Ku(i)},children:"Reset"}):null]},i)})})]})}function td(){const e=Pi.value;return r("fieldset",{class:"ac-workspace__explain",children:[r("legend",{class:"ac-workspace__heading",children:"Explanation style"}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"plain",checked:e==="plain",onChange:()=>{Pi.value="plain"},"aria-label":"Plain language"}),r("span",{children:"Plain language"})]}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"technical",checked:e==="technical",onChange:()=>{Pi.value="technical"},"aria-label":"Technical detail"}),r("span",{children:"Technical detail"})]}),r("p",{class:"ac-workspace__explain-hint",children:e==="plain"?"Replies use everyday words. Toggle to see the technical view.":"Replies keep the technical vocabulary. Toggle for the plain view."})]})}function rd(){const e=pa.value,n=e.length>0?e.map(t=>t.id):Object.keys(Er),i=new Map(e.map(t=>[t.id,t.cli_present]));return r("label",{class:"ac-workspace__host-picker",children:[r("span",{class:"ac-workspace__host-label",children:"Host"}),r("select",{class:"ac-workspace__host-select","aria-label":"Host agent",value:Pt.value,onChange:t=>{Hu(t.target.value)},children:n.map(t=>{const l=i.get(t)!==!1,a=Er[t]??t;return r("option",{value:t,disabled:!l,children:[a," (",t,")",l?"":" — not installed"]},t)})})]})}function ld(){if(ee(()=>{Wu()},[]),Qe.value!==null)return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-banner ac-banner--error",children:Qe.value})]});if(!ha.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Workspace"}),r("p",{children:"Loading…"})]});const e=si.value!==null?Ln.value.find(n=>n.slug===si.value)??null:null;return r("div",{class:"ac-page ac-workspace",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-page__subtitle",children:"Pick a role, pick a first task, run it."}),r(rd,{})]}),j.value!==null?r("p",{class:"ac-banner",role:"status",children:j.value}):null,r("div",{class:"ac-workspace__grid",children:[r("section",{class:"ac-workspace__roles","aria-labelledby":"roles-heading",children:[r("h2",{id:"roles-heading",class:"ac-workspace__heading",children:"Roles"}),Ln.value.length===0?r("p",{class:"ac-workspace__empty",children:"No roles installed."}):r("div",{class:"ac-workspace__role-grid",children:Ln.value.map(n=>r(Gu,{role:n},n.slug))})]}),r("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?r(Zu,{role:e}):r("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),r(Qu,{}),r(Xu,{})]}),r("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[r(ed,{}),r(nd,{}),r(id,{}),r(td,{})]})]})]})}const ga="agent-config-theme";function ad(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const Xe=p(ad());function od(){try{const e=localStorage.getItem(ga);return e==="light"||e==="dark"?e:null}catch{return null}}function ya(e){Xe.value=e,document.documentElement.setAttribute("data-theme",e)}function cd(){const e=Xe.value==="dark"?"light":"dark";try{localStorage.setItem(ga,e)}catch{}ya(e)}function sd(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{od()===null&&ya(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}const ba=[{id:"setup",label:"Setup",hashPath:"/setup",matches:["/setup","/wizard"]},{id:"settings",label:"Settings",hashPath:"/settings",matches:["/settings"]},{id:"project",label:"Project",hashPath:"/project",matches:["/project"]},{id:"workspace",label:"Workspace",hashPath:"/workspace",matches:["/workspace"]}];function ka(e){for(const n of ba)for(const i of n.matches)if(e===i||e.startsWith(`${i}/`))return n.id;return null}function ud(e){const n=Me.value,i=ka(e);return ba.filter(t=>t.id==="project"?n?.projectSurface===!0||i==="project":t.id==="workspace"?n?.devSurfaces===!0||i==="workspace":!0)}function dd(){const e=Hn.value,n=ka(e);return r("header",{class:"ac-topnav",children:r("div",{class:"ac-topnav__inner",children:[r("div",{class:"ac-topnav__brand",children:[r("h1",{class:"ac-topnav__title",children:"@event4u/agent-config"}),r("p",{class:"ac-topnav__subtitle",children:"Browser Wizard"})]}),r("nav",{class:"ac-topnav__tabs","aria-label":"Surfaces",children:ud(e).map(i=>r("button",{type:"button",class:`ac-topnav__tab${n===i.id?" ac-topnav__tab--active":""}`,"aria-current":n===i.id?"page":void 0,onClick:()=>pi(i.hashPath),children:i.label},i.id))}),r("button",{type:"button",class:"ac-topnav__theme","aria-label":Xe.value==="dark"?"Switch to light theme":"Switch to dark theme",title:Xe.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{cd()},children:Xe.value==="dark"?"☀":"☾"})]})})}function fd({path:e}){return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Page not found"}),r("p",{children:["Nothing routed to ",r("code",{children:e}),". Try ",r("a",{href:"#/setup",children:"Setup"}),"."]})]})}function hd(){const e=Me.value;return e===null||e.dryRun!==!0?null:r("div",{class:"ac-dryrun-banner",role:"status","aria-live":"polite",children:[r("strong",{children:"DRY RUN"}),r("span",{children:" · no files will be written. Validation + rendering run normally; commits return a preview."})]})}function pd(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?r(Sr,{path:e}):e.startsWith("/wizard")?r(Sr,{path:e}):e==="/settings/changes"?r(Au,{}):e==="/settings"||e.startsWith("/settings/")?r(Fu,{}):e==="/project"||e.startsWith("/project/")?r(Bu,{}):e==="/workspace"?r(ld,{}):r(fd,{path:e})}function vd(){return ee(()=>{Wa(),Hn.value==="/"&&pi("/setup"),qa()},[]),r(M,{children:[r(hd,{}),r(dd,{}),pd(Hn.value)]})}const _d=3e4,md=30*6e4;let Sn=null,Nr=!1;function Ir(e){if(!Nr&&(Nr=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function gd(e){if(typeof window>"u")return()=>{};let n=Date.now();const i=()=>{n=Date.now()},t=["pointerdown","keydown","wheel","touchstart"];for(const c of t)window.addEventListener(c,i,{passive:!0});const l=()=>{document.hidden||i()};document.addEventListener("visibilitychange",l);const a=()=>{Sn!==null&&clearInterval(Sn),Sn=null;for(const c of t)window.removeEventListener(c,i);document.removeEventListener("visibilitychange",l),window.removeEventListener("pagehide",o)};Sn=setInterval(()=>{if(!document.hidden){if(Date.now()-n>md){Ir(e),a();return}w("/api/v1/ping").catch(()=>{})}},_d);function o(){Ir(e)}return window.addEventListener("pagehide",o),a}function yd(){return new URLSearchParams(window.location.search).get("token")}function bd(){const e=document.getElementById("app");if(e===null)return;const n=yd();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}za(n),gd(n),sd(),e.textContent="",Oa(r(vd,{}),e)}bd();
|
|
40
|
-
//# sourceMappingURL=index-
|
|
38
|
+
`+e.slice(o+1):s+=e.slice(l),s.slice(1)}function as(e){for(var n="",i=0,t,l=0;l<e.length;i>=65536?l+=2:l++)i=Ye(e,l),t=R[i],!t&&on(i)?(n+=e[l],i>=65536&&(n+=e[l+1])):n+=t||Qc(i);return n}function os(e,n,i){var t="",l=e.tag,a,o,c;for(a=0,o=i.length;a<o;a+=1)c=i[a],e.replacer&&(c=e.replacer.call(i,String(a),c)),(Q(e,n,c,!1,!1)||typeof c>"u"&&Q(e,n,null,!1,!1))&&(t!==""&&(t+=","+(e.condenseFlow?"":" ")),t+=e.dump);e.tag=l,e.dump="["+t+"]"}function mr(e,n,i,t){var l="",a=e.tag,o,c,s;for(o=0,c=i.length;o<c;o+=1)s=i[o],e.replacer&&(s=e.replacer.call(i,String(o),s)),(Q(e,n+1,s,!0,!0,!1,!0)||typeof s>"u"&&Q(e,n+1,null,!0,!0,!1,!0))&&((!t||l!=="")&&(l+=Yi(e,n)),e.dump&&ln===e.dump.charCodeAt(0)?l+="-":l+="- ",l+=e.dump);e.tag=a,e.dump=l||"[]"}function cs(e,n,i){var t="",l=e.tag,a=Object.keys(i),o,c,s,u,h;for(o=0,c=a.length;o<c;o+=1)h="",t!==""&&(h+=", "),e.condenseFlow&&(h+='"'),s=a[o],u=i[s],e.replacer&&(u=e.replacer.call(i,s,u)),Q(e,n,s,!1,!1)&&(e.dump.length>1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,n,u,!1,!1)&&(h+=e.dump,t+=h));e.tag=l,e.dump="{"+t+"}"}function ss(e,n,i,t){var l="",a=e.tag,o=Object.keys(i),c,s,u,h,d,_;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new F("sortKeys must be a boolean or a function");for(c=0,s=o.length;c<s;c+=1)_="",(!t||l!=="")&&(_+=Yi(e,n)),u=o[c],h=i[u],e.replacer&&(h=e.replacer.call(i,u,h)),Q(e,n+1,u,!0,!0,!0)&&(d=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,d&&(e.dump&&ln===e.dump.charCodeAt(0)?_+="?":_+="? "),_+=e.dump,d&&(_+=Yi(e,n)),Q(e,n+1,h,!0,d)&&(e.dump&&ln===e.dump.charCodeAt(0)?_+=":":_+=": ",_+=e.dump,l+=_));e.tag=a,e.dump=l||"{}"}function gr(e,n,i){var t,l,a,o,c,s;for(l=i?e.explicitTypes:e.implicitTypes,a=0,o=l.length;a<o;a+=1)if(c=l[a],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof n=="object"&&n instanceof c.instanceOf)&&(!c.predicate||c.predicate(n))){if(i?c.multi&&c.representName?e.tag=c.representName(n):e.tag=c.tag:e.tag="?",c.represent){if(s=e.styleMap[c.tag]||c.defaultStyle,Ul.call(c.represent)==="[object Function]")t=c.represent(n,s);else if(Bl.call(c.represent,s))t=c.represent[s](n,s);else throw new F("!<"+c.tag+'> tag resolver accepts not "'+s+'" style');e.dump=t}return!0}return!1}function Q(e,n,i,t,l,a,o){e.tag=null,e.dump=i,gr(e,i,!1)||gr(e,i,!0);var c=Ul.call(e.dump),s=t,u;t&&(t=e.flowLevel<0||e.flowLevel>n);var h=c==="[object Object]"||c==="[object Array]",d,_;if(h&&(d=e.duplicates.indexOf(i),_=d!==-1),(e.tag!==null&&e.tag!=="?"||_||e.indent!==2&&n>0)&&(l=!1),_&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&_&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),c==="[object Object]")t&&Object.keys(e.dump).length!==0?(ss(e,n,e.dump,l),_&&(e.dump="&ref_"+d+e.dump)):(cs(e,n,e.dump),_&&(e.dump="&ref_"+d+" "+e.dump));else if(c==="[object Array]")t&&e.dump.length!==0?(e.noArrayIndent&&!o&&n>0?mr(e,n-1,e.dump,l):mr(e,n,e.dump,l),_&&(e.dump="&ref_"+d+e.dump)):(os(e,n,e.dump),_&&(e.dump="&ref_"+d+" "+e.dump));else if(c==="[object String]")e.tag!=="?"&&rs(e,e.dump,n,a,s);else{if(c==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new F("unacceptable kind of an object to dump "+c)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function us(e,n){var i=[],t=[],l,a;for(Ki(e,i,t),l=0,a=t.length;l<a;l+=1)n.duplicates.push(i[t[l]]);n.usedDuplicates=new Array(a)}function Ki(e,n,i){var t,l,a;if(e!==null&&typeof e=="object")if(l=n.indexOf(e),l!==-1)i.indexOf(l)===-1&&i.push(l);else if(n.push(e),Array.isArray(e))for(l=0,a=e.length;l<a;l+=1)Ki(e[l],n,i);else for(t=Object.keys(e),l=0,a=t.length;l<a;l+=1)Ki(e[t[l]],n,i)}function ds(e,n){n=n||{};var i=new Xc(n);i.noRefs||us(e,i);var t=e;return i.replacer&&(t=i.replacer.call({"":t},"",t)),Q(i,0,t,!0,!0)?i.dump+`
|
|
39
|
+
`:""}var fs=ds,hs={dump:fs};function St(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var ps=L,vs=dl,_s=vl,ms=bl,gs=kl,ys=bt,bs=jl.load,ks=jl.loadAll,ws=hs.dump,xs=F,Ss={binary:Al,float:yl,map:pl,null:_l,pairs:El,set:Ol,timestamp:Sl,bool:ml,int:gl,merge:Cl,omap:Tl,seq:hl,str:fl},Cs=St("safeLoad","load"),As=St("safeLoadAll","loadAll"),Ts=St("safeDump","dump"),Es={Type:ps,Schema:vs,FAILSAFE_SCHEMA:_s,JSON_SCHEMA:ms,CORE_SCHEMA:gs,DEFAULT_SCHEMA:ys,load:bs,loadAll:ks,dump:ws,YAMLException:xs,types:Ss,safeLoad:Cs,safeLoadAll:As,safeDump:Ts};function Os(e){if(e.trim()==="")return{};const i=Es.load(e);if(i==null)return{};if(typeof i!="object"||Array.isArray(i))throw new Error(".agent-user.yml must parse to an object");return i}const yr={id:"welcome",title:"Welcome — who are you?",navLabel:"You",subtitle:"Your name and language. Stored in .agent-user.yml; we pre-fill what we can detect.",kind:"welcome"},br={id:"profile",title:"Which experience?",navLabel:"Experience",subtitle:"Pick the experience that fits you — developer · content · founder · agency · finance · ops. It selects your default command/skill surface and persona pre-selection. Cost tier is a secondary knob on a later step. You can switch later with `agent-config use --profile=<id>`.",kind:"form",paths:["profile.id"]},Ns=[{id:"ai-tools",title:"Which AI tools do you use?",navLabel:"AI tools",subtitle:"Pick the editors and CLIs that should pick up this config. Auto-detect runs first; you can override.",kind:"aiTools"},{id:"roles",title:"What do you work on?",navLabel:"Roles",subtitle:"Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in .agent-user.yml.",kind:"roles"},{id:"packs",title:"Which capability packs do you want?",navLabel:"Packs",subtitle:"Founder-strategy, finance-basic, gtm-sales, ops-people, ai-video — pick zero or more. You can change this later.",kind:"packs"},{id:"legal-consent",title:"Legal review-prep — not legal advice",navLabel:"Legal consent",subtitle:"Only relevant if you picked the legal-review-prep pack. It provides templates and general information, never legal advice — check the box to acknowledge before it activates. Leave unchecked otherwise; the pack stays inactive.",kind:"form",paths:["legal_review_prep.acknowledged"]}],kr=[{id:"identity",title:"Editor & behaviour",navLabel:"Preferences",subtitle:"Your IDE plus how the agent behaves: autonomy, output verbosity, PR-comment style. rtk presence is auto-detected (see the rtk row). Your name lives in .agent-user.yml (later step).",kind:"form",paths:["personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon"]},{id:"cost",title:"Budgets, rules & cadence",navLabel:"Budgets & cadence",subtitle:"Independent levers: rule_loading_tier (how many behavioural rules load — token footprint), cost.budgets (optional USD ceilings), model.auto_switch (per-skill model tier), plus quality/roadmap cadence and memory thresholds.",kind:"form",paths:["rule_loading_tier","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns"]},{id:"user-md",title:"Your .agent-user.yml",navLabel:"User profile",subtitle:"Identity, voice, preferences. Stored at agents/settings/.agent-user.yml. Skip to leave empty.",kind:"userMd"},{id:"review",title:"Review & finish",navLabel:"Review",subtitle:"These keys will change. Confirm to write .agent-settings.yml and .agent-user.yml atomically.",kind:"review"}];function Ql(e={}){return e.extended===!0?[yr,br,...Ns,...kr]:[yr,br,...kr]}function mi(e,n={}){const i=Ql(n),t=Math.max(0,Math.min(i.length-1,e));return i[t]}function Is(e){const n={},i=t=>{n[t]=!0;const l=e.clusterOf.get(t);l!==void 0&&(n[l]=!0)};for(const t of e.installed)i(t);for(const t of e.roleDefaults)i(t);for(const t of e.detected)i(t);return n}function Ls(e,n){const i=new Set(n);return e.filter(t=>t!=="engineering-base"&&!i.has(t)).sort()}function $s(e,n){const i={type:"object",properties:{},...e.description!==void 0?{description:e.description}:{}},t=i.properties,l=e.properties??{};for(const a of n){const o=a.split(".").filter(H=>H.length>0);if(o.length===0)continue;const[c,s,u]=o;if(c===void 0)continue;const h=l[c];if(h===void 0)continue;if(s===void 0){t[c]=h;continue}const d=h.properties?.[s];if(d===void 0)continue;const f=t[c]??{type:"object",properties:{},...h.description!==void 0?{description:h.description}:{}},v=f.properties??={};if(u===void 0){v[s]=d,t[c]=f;continue}const m=d.properties?.[u];if(m===void 0)continue;const b=v[s]??{type:"object",properties:{},...d.description!==void 0?{description:d.description}:{}},g=b.properties??={};g[u]=m,v[s]=b,t[c]=f}return i}function Rs({current:e,total:n}){const i=Math.max(1,n),t=Math.max(0,Math.min(i-1,e)),l=Array.from({length:i},(o,c)=>c<=t),a=Math.round((t+1)/i*100);return r("div",{class:"ac-wizard__progress",role:"progressbar","aria-valuenow":t+1,"aria-valuemin":1,"aria-valuemax":i,"aria-valuetext":`Step ${t+1} of ${i} (${a}%)`,children:l.map((o,c)=>r("span",{class:`ac-wizard__progress-segment${o?" ac-wizard__progress-segment--filled":""}`,"aria-hidden":"true"},c))})}function Fs({step:e,index:n,total:i}){return r("header",{class:"ac-page__header ac-wizard__header",children:[r("p",{class:"ac-wizard__step-count",children:["Step ",n+1," of ",i]}),r("div",{class:"ac-wizard__header-text",children:[r("h1",{children:e.title}),r("p",{class:"ac-wizard__subtitle",children:e.subtitle})]}),r(Rs,{current:n,total:i})]})}function Ps(e){const n=e.canFinish??!0,i=e.completed??!1;return r("div",{class:"ac-form__actions ac-wizard__nav",children:[r("button",{type:"button",class:"ac-button",disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:"Back"}),e.canSkip&&e.onSkip!==void 0?r("button",{type:"button",class:"ac-button ac-wizard__skip",disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??"Skip"}):null,e.isLast?i?null:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy||!n,onClick:e.onFinish,children:e.busy?"Saving…":"Finish & save"}):r("button",{type:"button",class:"ac-button ac-button--primary",disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??"Next"})]})}function Zl(e,n){return e.kind!=="form"||e.paths===void 0?!1:!!(e.paths.includes(n)||e.id==="cost"&&(n.startsWith("telegraph.")||n.startsWith("verbosity.")))}function Ms(e,n){return e.kind==="userMd"?n==="body"||n.startsWith("body."):Zl(e,n)}function Ds(e,n){for(const i of Object.keys(n.errors))if(Ms(e,i))return!0;return!1}function js(e,n){if(Ds(e,n))return{label:"needs attention",tone:"error"};if(e.kind==="userMd")return n.userMdChanged?{label:n.userMdAction==="create"?"will create":"will replace",tone:"changed"}:{label:"",tone:"idle"};if(e.kind==="form"){const i=n.changes.filter(t=>Zl(e,t.path)).length;return i===0?{label:"",tone:"idle"}:{label:`${i} change${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="aiTools"){const i=n.selectedToolsCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} tool${i===1?"":"s"}`,tone:"changed"}}if(e.kind==="packs"){const i=n.selectedPacksCount??0;return i===0?{label:"",tone:"idle"}:{label:`${i} pack${i===1?"":"s"}`,tone:"changed"}}return{label:"",tone:"idle"}}function Us(e){const n=e.steps.filter((c,s)=>s!==e.currentIndex),i=e.packRemovals??[],t=e.selectedToolIds??[],l=e.packAdditions??[],a=e.changes.length,o=t.length>0||l.length>0||a>0||e.userMdChanged;return r(M,{children:[o?r("section",{class:"ac-review-summary","aria-label":"What happens on Finish",children:[r("h2",{class:"ac-review-summary__title",children:"What happens on Finish"}),r("ul",{class:"ac-review-summary__list",children:[a>0?r("li",{children:[r("strong",{children:a})," setting",a===1?"":"s"," will change"," ","in ",r("code",{children:".agent-settings.yml"}),"."]}):r("li",{children:"No settings change."}),e.userMdChanged?r("li",{children:[r("code",{children:".agent-user.yml"})," will be"," ",e.userMdAction==="create"?"created":"updated","."]}):null,t.length>0?r("li",{children:["Config is installed for ",t.length," tool",t.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:t.map(c=>r("code",{class:"ac-review-summary__chip",children:c},c))})]}):null,l.length>0?r("li",{children:["New pack",l.length===1?"":"s",":",r("span",{class:"ac-review-summary__chips",children:l.map(c=>r("code",{class:"ac-review-summary__chip",children:c},c))})]}):null]})]}):null,i.length>0?r("div",{class:"ac-review-removals",role:"alert",children:[r("p",{class:"ac-review-removals__title",children:["⚠️ ",i.length===1?"1 installed pack will be removed":`${i.length} installed packs will be removed`]}),r("ul",{class:"ac-review-removals__list",children:i.map(c=>r("li",{children:r("code",{children:c})},c))}),r("label",{class:"ac-review-removals__confirm",children:[r("input",{type:"checkbox",checked:e.removalsConfirmed??!1,onChange:c=>{e.onConfirmRemovals?.(c.currentTarget.checked)}}),r("span",{children:"I understand these packs will no longer be installed. Re-check them on the packs step to keep them."})]})]}):null,r("nav",{class:"ac-wizard__review-nav","aria-label":"Jump back to a step",children:[r("p",{class:"ac-wizard__review-nav-label",children:"Jump back to a step:"}),r("ul",{class:"ac-wizard__review-nav-list",children:n.map(c=>{const s=e.steps.indexOf(c),u=js(c,e),h=u.tone==="error"?"ac-wizard__review-nav-button ac-wizard__review-nav-button--error":"ac-wizard__review-nav-button";return r("li",{children:r("button",{type:"button",class:h,onClick:()=>{e.onJump(s)},children:[r("span",{class:"ac-wizard__review-nav-index",children:s+1}),r("span",{class:"ac-wizard__review-nav-text",children:c.navLabel}),u.label!==""?r("span",{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${u.tone}`,children:u.label}):null]})},c.id)})})]})]})}function Bs(e){const n=e.abortedAt??"unknown time",i=e.abortNote??"no further detail recorded",t=e.writesSinceRollback;return r("aside",{class:"ac-banner ac-banner--recovery",role:"alert",children:[r("strong",{children:"Previous install was interrupted."}),r("p",{children:["Aborted at ",r("code",{children:n})," — ",i,". ",t," write",t===1?"":"s"," landed before the abort marker."]}),r("p",{children:"Pick how to recover before continuing. Resume reopens the wizard fresh, Rollback discards the abort state, Ignore hides this banner without touching the log."}),r("div",{class:"ac-banner__actions",children:[r("button",{type:"button",disabled:e.busy,onClick:()=>e.onResume(),children:"Resume install"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onRollback(),children:"Rollback"}),r("button",{type:"button",disabled:e.busy,onClick:()=>e.onIgnore(),children:"Ignore"})]})]})}function Hs(){return r("section",{class:"ac-continue-screen","aria-labelledby":"ac-continue-title",children:[r("h2",{id:"ac-continue-title",children:"Install complete — continue with setup?"}),r("p",{children:"Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:"}),r("ul",{children:[r("li",{children:[r("strong",{children:"Next"})," — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your",r("code",{children:" .agent-user.yml"}),", and finally the project module roots."]}),r("li",{children:[r("strong",{children:"Finish install here"})," — skip the rest and write ",r("code",{children:".agent-settings.yml"})," with the install-only selections. You can re-run ",r("code",{children:"agent-config setup"}),"later to pick up the personalisation steps."]})]})]})}function Ws(e){const n=e.version??"unknown";return r("section",{class:"ac-backup-screen","aria-labelledby":"ac-backup-title",children:[r("h2",{id:"ac-backup-title",children:"Existing v3 install detected"}),r("p",{children:["Found a v3.x install at ",r("code",{children:e.sourcePath})," ","(VERSION: ",r("code",{children:n}),"). v4 is a hard-cut release with no auto-migration — settings, identity, and history layouts changed. The wizard can back up the v3 tree before writing the v4 layout so you can roll back manually if needed."]}),e.error!==null?r("p",{class:"ac-banner ac-banner--error",children:["Backup failed: ",e.error]}):null,r("ul",{children:[r("li",{children:[r("strong",{children:"Backup v3 and proceed"})," — copies the tree to ",r("code",{children:e.backupTarget}),", then runs the v4 install. Restore later with",r("code",{children:[" mv ",e.backupTarget," ",e.sourcePath]}),"."]}),r("li",{children:[r("strong",{children:"Abort, uninstall v3 first"})," — closes the wizard. You decide what to keep."]})]}),r("div",{class:"ac-backup-screen__actions",children:[r("button",{type:"button",class:"ac-button ac-button--primary",disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?"Backing up…":"Backup v3 and proceed"}),r("button",{type:"button",class:"ac-button",disabled:e.busy,onClick:()=>e.onAbort(),children:"Abort, uninstall v3 first"})]})]})}const zs=[{title:"Restart your AI tools",detail:"Editors and CLIs pick up the new skills, rules, and commands on their next start."},{title:"Verify the installation",detail:"A read-only health report — scope, deployed files, drift.",command:"agent-config doctor"},{title:"Tune your settings any time",detail:"Opens the configuration GUI (global settings; --project for a project).",command:"agent-config config"},{title:"Initialize a project",detail:"Adds the minimal agents/ bridge + .gitignore block to a repository.",command:"agent-config init --project"},{title:"Stay up to date",detail:"Upgrades the global install and additively syncs your settings.",command:"agent-config upgrade"}];function Ys({text:e}){const[n,i]=_t(!1);return r("button",{type:"button",class:"ac-button ac-checklist__copy",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{i(!0),setTimeout(()=>{i(!1)},1500)})},children:n?"Copied ✓":"Copy"})}function qs({message:e}){return r("div",{class:"ac-checklist",children:[r("div",{class:"ac-checklist__hero",children:[r("h2",{class:"ac-checklist__headline",children:"Setup complete"}),e!==null?r("p",{class:"ac-checklist__message",children:e}):null]}),r("ol",{class:"ac-checklist__items",children:zs.map(n=>r("li",{class:"ac-checklist__item",children:[r("div",{class:"ac-checklist__text",children:[r("span",{class:"ac-checklist__item-title",children:n.title}),r("span",{class:"ac-checklist__item-detail",children:n.detail})]}),n.command!==void 0?r("div",{class:"ac-checklist__cmd-row",children:[r("code",{class:"ac-checklist__cmd",children:n.command}),r(Ys,{text:n.command})]}):null]},n.title))}),r("p",{class:"ac-checklist__close-hint",children:"You can close this browser window — the local server shuts down on its own."})]})}const Xl=p(!1),Ve=p(null),E=p(null),Vn=p(!1),Jn=p(!1),ve=p(0),Ct=p(null),B=p({}),ea=p({}),na=p(0),Le=p({}),O=p(null),ue=p(null),At=p(!1),Gi=p(!1),gi=p(!1),ia=p({}),yi=p([]);p("global");const Ee=p(!1),P=p(!1),Ks=p(!1),Qn=p(!1),Zn=p(null),Tt=p([]),Xn=p({}),ei=p(!0),ni=p(""),ii=p("agents");p(!1);const ta=p(null),Gs=[{id:"claude-code",label:"Claude Code"},{id:"claude-desktop",label:"Claude Desktop"},{id:"cursor",label:"Cursor"},{id:"windsurf",label:"Windsurf"},{id:"cline",label:"Cline"},{id:"gemini-cli",label:"Gemini CLI"},{id:"copilot",label:"GitHub Copilot"},{id:"augment",label:"Augment"},{id:"aider",label:"Aider"},{id:"codex",label:"Codex"},{id:"roocode",label:"Roo Code"},{id:"continue",label:"Continue"},{id:"kilocode",label:"Kilo Code"},{id:"zed",label:"Zed"},{id:"jetbrains",label:"JetBrains"},{id:"kiro",label:"Kiro"},{id:"qoder",label:"Qoder"},{id:"opencode",label:"OpenCode"},{id:"trae",label:"Trae"},{id:"antigravity",label:"Antigravity"},{id:"codebuddy",label:"CodeBuddy"},{id:"droid",label:"Droid"},{id:"warp",label:"Warp"}],Vi=p(!1),$e=p(!1),de=p(null),bi=p([]),ki=p([]),_e=p([]),Ji=p(!1),gn=p([]),V=p({}),ra=p(!1),Qi=p(!1),En=p(!1),Et=p({}),wr=p(!1),la=p(null),aa=p(null),oa=p("https://github.com/event4u-app/rtk");p(!1);p(null);p([]);p({});p({});const Z=p({}),te=p({}),Zi=p(!1),xr=p(!1);p({});p(null);p(null);p(!1);p(null);const ti=p(null),ca=p(!1),Xi=p(null),et=p(!1),nt=p(!1),it=p(null),Re=p(null),On=p(!1),Ot=p(!1);function sa(){return Ql({extended:P.value})}function je(){return sa().length}function Vs(e){return e??new Date().toISOString()}function Nt(e){return Math.max(0,Math.min(je()-1,e))}function Js(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Qs(){try{return await w("/api/v1/settings")}catch(e){if(e instanceof A&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0)return{values:n.defaults,lastModified:n.lastModified??0,path:n.path??".agent-settings.yml",schema:n.schema};const i=await w("/api/v1/schema");return{values:{},lastModified:0,path:".agent-settings.yml",schema:i.settings}}throw e}}async function Zs(){try{const e=await w("/api/v1/install/recovery");ti.value=e.incomplete?e:null}catch{ti.value=null}}async function Xs(){try{const e=await w("/api/v1/install/legacy-v3");Xi.value=e.present?e:null}catch{Xi.value=null}}async function eu(){nt.value=!0,it.value=null;try{await w("/api/v1/install/backup-v3",{method:"POST"}),et.value=!0}catch(e){it.value=e instanceof A?U(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{nt.value=!1}}async function Ri(e){try{await w("/api/v1/install/recovery/dismiss",{method:"POST",body:{reason:e}})}catch(n){E.value={message:n instanceof Error?n.message:String(n),tone:"error"};return}ti.value=null,ca.value=!0}async function nu(){Ve.value=null;try{Zs(),Xs();const[e,n]=await Promise.all([w("/api/v1/wizard/state"),Qs()]);Ct.value=Js(n.schema),na.value=n.lastModified,ea.value=n.values,ia.value=n.legacyHints??{},P.value=e.extendedSteps===!0,Re.value=e.wizardMode??null;const i=Object.keys(e.partial??{});B.value=i.length>0?{...n.values,...e.partial}:n.values,ve.value=Nt(e.step),Ee.value=!1,Xl.value=!0;const t=mi(ve.value,{extended:P.value});(t.kind==="welcome"||t.kind==="userMd"||t.kind==="review")&&It(),(t.kind==="roles"||t.kind==="aiTools"||t.kind==="packs")&&yn(),t.kind==="roles"&&Lt(),t.kind==="aiTools"&&wi(),t.id==="identity"&&ua(),t.kind==="review"&&da()}catch(e){e instanceof A?Ve.value=U(e.body.error??{code:"UNKNOWN",message:e.message}):Ve.value=e instanceof Error?e.message:String(e)}}function iu(e,n){return e.identity.name.trim()!==""?e:{...e,identity:{...e.identity,name:n}}}async function It(){if(!Gi.value)try{const e=await w("/api/v1/user-md");if(At.value=e.exists,e.exists&&e.identity!==null){const n=tr(e.identity);ue.value=n,O.value=n}else{let n;try{const t=await w("/api/v1/user-md/template");n=tr(Os(t.body))}catch{n=cl()}const i=ia.value.user_name;typeof i=="string"&&i.trim()!==""&&(n=iu(n,i)),ue.value=n,O.value=n}}catch(e){E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Gi.value=!0}}const tu=new Set(["python"]);async function yn(){if(!(Vi.value||$e.value)){$e.value=!0,de.value=null;try{const[e,n]=await Promise.all([w("/api/v1/wizard/manifest"),w("/api/v1/wizard/auto-detect")]),i=(e.packs??[]).map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",requires_hint:a.requires_hint,cluster:a.cluster??void 0,workspaces:a.workspaces}));bi.value=i,gn.value=(e.workspaces??[]).filter(a=>a.id!=="agent-config-maintainer").map(a=>({id:a.id,label:a.label??a.id,description:a.description??"",default_packs:a.default_packs??[],optional_packs:a.optional_packs??[],...a.example_roles!==void 0?{example_roles:a.example_roles}:{}}));const t=new Set(i.map(a=>a.id)),l=n.signals.map(a=>a.id.startsWith("pack-")?a.id.slice(5):a.id).filter(a=>t.has(a)).filter(a=>!tu.has(a));ki.value=l,_e.value=(e.installedPacks??[]).filter(a=>t.has(a))}catch(e){e instanceof A?de.value=U(e.body.error??{code:"UNKNOWN",message:e.message}):de.value=e instanceof Error?e.message:String(e)}finally{$e.value=!1,Vi.value=!0}}}async function wi(){if(!(Qi.value||En.value)){En.value=!0;try{const e=await w("/api/v1/wizard/detect-tools"),n=e.tools??{},i=e.configured??[];if(Et.value=n,Object.keys(Z.value).length===0){const t={};if(i.length>0)for(const l of i)t[l]=!0;else for(const[l,a]of Object.entries(n))a&&(t[l]=!0);Z.value=t}}catch{}finally{En.value=!1,Qi.value=!0}}}async function ua(){if(!wr.value){wr.value=!0;try{const e=await w("/api/v1/wizard/detect-rtk"),n=e.installed===!0;la.value=n,aa.value=e.installCommand??null,typeof e.repo=="string"&&(oa.value=e.repo);const i=B.value.personal??{};B.value={...B.value,personal:{...i,rtk_installed:n}}}catch{}}}async function ru(e,n){try{await w("/api/v1/wizard/state",{method:"POST",body:{step:e,totalSteps:je(),partial:n,startedAt:Vs(null)}})}catch(i){E.value={message:i instanceof Error?i.message:String(i),tone:"error"}}}async function da(){Jn.value=!0;try{const e=await w("/api/v1/settings/diff",{method:"POST",body:{values:B.value,ifUnmodifiedSince:na.value}});yi.value=e.changes,Le.value={}}catch(e){e instanceof A?(Le.value=vi(e.body.error??{message:e.message}),E.value={message:U(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Jn.value=!1}}function ri(){return gi.value?!1:O.value===null||ue.value===null?O.value!==ue.value:JSON.stringify(O.value)!==JSON.stringify(ue.value)}async function Oe(e){const n=Nt(e);await ru(n,B.value),ve.value=n,E.value=null;const i=mi(n,{extended:P.value});(i.kind==="welcome"||i.kind==="userMd")&&It(),(i.kind==="roles"||i.kind==="aiTools"||i.kind==="packs")&&yn(),i.kind==="roles"&&Lt(),i.kind==="packs"&&Si(),i.kind==="aiTools"&&wi(),i.id==="identity"&&ua(),i.kind==="review"&&da()}function xi(){const e=te.value,n=new Map(bi.value.map(a=>[a.id,a])),i=Object.entries(e).filter(([,a])=>a===!0).map(([a])=>a).filter(a=>{const o=n.get(a)?.cluster;return o===void 0||e[o]===!0}),t=new Set,l=a=>{if(!t.has(a)){t.add(a);for(const o of n.get(a)?.requires_hint??[])l(o)}};for(const a of i)l(a);return[...t].sort()}async function Lt(){if(await Promise.all([yn(),It()]),ra.value||Object.values(V.value).some(Boolean))return;const e=O.value?.role??[];if(e.length===0)return;const n=new Set(gn.value.map(t=>t.id)),i={};for(const t of e)n.has(t)&&(i[t]=!0);Object.keys(i).length!==0&&(V.value=i,Si())}function Si(){if(Zi.value)return;const e=Object.entries(V.value).filter(([,l])=>l===!0).map(([l])=>l),n=new Map(gn.value.map(l=>[l.id,l])),i=[];for(const l of e)for(const a of n.get(l)?.default_packs??[])i.push(a);const t=new Map;for(const l of bi.value)l.cluster!==void 0&&t.set(l.id,l.cluster);te.value=Is({installed:_e.value,roleDefaults:i,detected:ki.value,clusterOf:t})}function lu(){const e=Object.entries(Z.value).filter(([,t])=>t===!0).map(([t])=>t);if(e.length===0)return null;const n=xi(),i={schema_version:"wizard-v2",tools:e,packs:n,settings:B.value};return Me.value?.dryRun===!0&&(i.dry_run=!0),i}async function au(){Vn.value=!0,E.value=null;try{const e={settings:B.value},n=Object.entries(V.value).filter(([,s])=>s===!0).map(([s])=>s),i=O.value!==null&&typeof O.value.identity?.name=="string"&&O.value.identity.name.trim().length>0;O.value!==null&&i&&(ri()||n.length>0)&&(e.identity=n.length>0?{...O.value,role:n}:O.value);const t=await w("/api/v1/wizard/finish",{method:"POST",body:e}),l="You can close this browser window now.",a=t.dryRun===!0?"Dry-run complete — no files written. Settings would be saved.":Array.isArray(t.writtenPaths)?`Saved (${t.writtenPaths.join(", ")}). Wizard complete.`:"Wizard complete.",o=P.value?lu():null;let c="";if(o!==null&&o.dry_run===!0)try{await w("/api/v1/wizard/apply",{method:"POST",body:o}),c=" Installer preview OK (dry-run) — no files written."}catch(s){c=` Installer preview failed: ${s instanceof A?U(s.body.error??{code:"UNKNOWN",message:s.message}):s instanceof Error?s.message:String(s)}.`}else if(o!==null)try{let s=null;await Ya("/api/v1/wizard/apply",o,d=>{d.type==="error"&&(s=typeof d.message=="string"?d.message:"install failed")});const u=o.tools.length,h=o.packs.length;c=s!==null?` Installer failed: ${s}. Settings were saved; re-run the wizard to retry.`:` Installer applied ${u} tool${u===1?"":"s"}`+(h>0?` and ${h} pack${h===1?"":"s"}.`:".")}catch(s){c=` Installer bridge failed: ${s instanceof A?U(s.body.error??{code:"UNKNOWN",message:s.message}):s instanceof Error?s.message:String(s)}. Settings were saved; re-run the wizard to retry the install plan.`}E.value={message:`${a}${c} ${l}`,tone:"success"},ve.value=Nt(je()-1),ea.value=B.value,ue.value=ri()?O.value:ue.value,yi.value=[],Ee.value=!0}catch(e){e instanceof A?(Le.value=vi(e.body.error??{message:e.message}),E.value={message:U(e.body.error??{code:"UNKNOWN",message:e.message}),tone:"error"}):E.value={message:e instanceof Error?e.message:String(e),tone:"error"}}finally{Vn.value=!1}}async function ou(){Ot.value=!0,await Promise.all([yn(),wi()]),await Lt(),Si(),await Oe(je()-1)}function cu(){ee(()=>{yn(),wi()},[]);const e=$e.value||En.value||!Vi.value||!Qi.value,n=Object.values(Et.value).filter(Boolean).length,i=_e.value.length,t=ki.value.filter(l=>!_e.value.includes(l)).length;return r("div",{class:"ac-start",children:[r("section",{class:"ac-start__card ac-start__card--primary",children:[r("h2",{class:"ac-start__title",children:"Recommended setup"}),r("p",{class:"ac-start__desc",children:"The fastest path — we pre-select everything we can detect and you confirm one review screen before anything is written."}),r("ul",{class:"ac-start__facts",children:[r("li",{children:e?"Detecting your AI tools…":n===0?"No AI tools detected — pick them on the review screen.":`${n} AI tool${n===1?"":"s"} detected and pre-selected.`}),r("li",{children:e?"Detecting capability packs…":i>0?`${i} installed pack${i===1?"":"s"} kept${t>0?`, ${t} more auto-detected`:""}.`:t>0?`${t} capability pack${t===1?"":"s"} auto-detected.`:"No packs pre-selected — add them any time later."}),r("li",{children:"Settings keep their current values (or safe defaults on a first run)."}),r("li",{children:"Nothing is written until you confirm the review screen."})]}),r("button",{type:"button",class:"ac-button ac-button--primary ac-start__cta",disabled:e,onClick:()=>{ou()},children:e?"Detecting…":"Use recommended setup"})]}),r("section",{class:"ac-start__card",children:[r("h2",{class:"ac-start__title",children:"Customize"}),r("p",{class:"ac-start__desc",children:"Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself."}),r("button",{type:"button",class:"ac-button ac-start__cta",onClick:()=>{Ot.value=!0},children:"Customize step by step"})]})]})}const su=["de","en","en-US","en-GB","fr","es","it","nl","pt","pt-BR"];function uu(){if(xr.value)return;const e=O.value;if(e===null)return;xr.value=!0;let n=e;if(e.identity.name.trim()===""){const i=Me.value?.systemUser;i!==void 0&&i.trim()!==""&&(n={...n,identity:{...n.identity,name:i}})}if(!At.value&&typeof navigator<"u"){const i=(navigator.language||"").split("-")[0];i.length>=2&&(n={...n,language:i})}n!==e&&(O.value=n)}function du(){const e=O.value;if(ee(()=>{uu()},[e]),e===null)return r("p",{children:"Loading…"});const n=i=>{O.value={...i,last_updated:new Date().toISOString().slice(0,10)},gi.value=!1};return r("div",{class:"ac-wizard-step-stub ac-wizard__module-fields",children:[r("p",{children:["Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in ",r("code",{children:".agent-user.yml"}),"."]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-name",children:"Name"}),r("input",{class:"ac-input",id:"welcome-name",type:"text",placeholder:"How should the agent address you?",value:e.identity.name,onInput:i=>n({...e,identity:{...e.identity,name:i.currentTarget.value}})})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"welcome-lang",children:"Language"}),r("input",{class:"ac-input",id:"welcome-lang",type:"text",list:"welcome-lang-list",placeholder:"BCP-47 code, e.g. de, en, en-US",value:e.language,onInput:i=>n({...e,language:i.currentTarget.value})}),r("datalist",{id:"welcome-lang-list",children:su.map(i=>r("option",{value:i},i))})]})]})}function fu(){const e=Z.value,n=Et.value;return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard."}),r("ul",{class:"ac-wizard__tool-list",children:Gs.map(i=>{const t=n[i.id]===!0;return r("li",{class:"ac-wizard__tool-row",children:[r("label",{class:"ac-wizard__tool-label",children:[r("input",{type:"checkbox",checked:e[i.id]??!1,onChange:l=>{const a=l.currentTarget.checked;Z.value={...e,[i.id]:a}}})," ",i.label]}),r("span",{class:`ac-badge ${t?"ac-badge--installed":"ac-badge--missing"}`,title:t?"Detected on this machine":"Not detected on this machine",children:t?"installed":"not installed"})]},i.id)})})]})}function hu(){if($e.value)return r("p",{children:"Loading roles…"});if(de.value!==null)return r("div",{class:"ac-wizard-step-stub",children:r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]})});const e=V.value,n=gn.value,i=(t,l)=>{ra.value=!0,V.value={...V.value,[t]:l},Si()};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:["Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in",r("code",{children:" .agent-user.yml"}),"."]}),n.length===0?r("p",{children:r("em",{children:"No roles available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:n.map(t=>r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:e[t.id]??!1,onChange:l=>{i(t.id,l.currentTarget.checked)}}),r("span",{class:"ac-pack-tile__title",children:t.label})]}),(t.example_roles??[]).length>0?r("p",{class:"ac-pack-tile__role",children:["e.g. ",(t.example_roles??[]).join(", ")]}):null,t.description!==""?r("p",{class:"ac-pack-tile__desc",children:t.description}):null]},t.id))})]})}function pu(){if($e.value)return r("p",{children:"Loading discovery manifest…"});if(de.value!==null)return r("div",{class:"ac-wizard-step-stub",children:[r("p",{class:"ac-banner ac-banner--error",children:["Discovery failed: ",de.value]}),r("p",{children:"The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list."})]});const e=te.value,n=new Set(ki.value),i=new Set(_e.value),t=f=>i.has(f)?r("span",{class:"ac-badge ac-badge--installed",children:"installed"}):n.has(f)?r("span",{class:"ac-badge ac-badge--detected",children:"auto-detected"}):null,l=new Map(gn.value.map(f=>[f.id,f.label])),a=V.value,o=f=>{const v=(f??[]).filter(m=>m!=="agent-config-maintainer");return v.length===0?null:r("span",{class:"ac-pack-tile__ws",children:v.map(m=>r("span",{class:`ac-badge ac-badge--ws${a[m]===!0?" ac-badge--ws-active":""}`,title:a[m]===!0?"Matches a role you picked":"Workspace / area",children:l.get(m)??m},m))})},c=bi.value.filter(f=>f.id!=="engineering-base"),s=new Map;for(const f of c)if(f.cluster!==void 0){const v=s.get(f.cluster)??[];v.push(f),s.set(f.cluster,v)}const u=new Set(c.filter(f=>f.cluster!==void 0).map(f=>f.id)),h=c.filter(f=>!u.has(f.id)),d=(f,v)=>{Zi.value=!0,te.value={...te.value,[f]:v}},_=(f,v)=>{Zi.value=!0;const m={...te.value,[f]:v};if(v)for(const k of s.get(f)??[])m[k.id]===void 0&&(m[k.id]=!0);te.value=m};return r("div",{class:"ac-wizard-step-stub",children:[r("p",{children:"Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all."}),h.length===0?r("p",{children:r("em",{children:"No packs available in the manifest."})}):r("div",{class:"ac-wizard__pack-grid",children:h.map(f=>{const v=s.get(f.id)??[],m=v.length>0,k=e[f.id]??!1;return r("section",{class:"ac-pack-tile",children:[r("label",{class:"ac-pack-tile__head",children:[r("input",{type:"checkbox",checked:k,onChange:b=>{const g=b.currentTarget.checked;m?_(f.id,g):d(f.id,g)}}),r("span",{class:"ac-pack-tile__title",children:f.label}),t(f.id)]}),o(f.workspaces),f.description!==""?r("p",{class:"ac-pack-tile__desc",children:f.description}):null,m?r("fieldset",{class:"ac-pack-tile__children",disabled:!k,children:v.map(b=>r("label",{class:"ac-pack-tile__child",children:[r("input",{type:"checkbox",checked:e[b.id]??!1,disabled:!k,onChange:g=>{d(b.id,g.currentTarget.checked)}}),r("span",{children:b.label}),t(b.id)]},b.id))}):null]},f.id)})})]})}function vu(){const e=la.value,n=aa.value;return r("div",{class:"ac-rtk-row",children:[r("div",{class:"ac-rtk-row__head",children:[r("span",{class:"ac-rtk-row__label",children:["rtk ",r("small",{children:"(Rust Token Killer)"})]}),e===null?r("span",{class:"ac-badge ac-badge--missing",children:"detecting…"}):e?r("span",{class:"ac-badge ac-badge--installed",children:"installed"}):r("span",{class:"ac-badge ac-badge--missing",children:"not installed"})]}),e===!1?r("div",{class:"ac-rtk-row__install",children:[r("p",{class:"ac-field__description",children:"rtk wraps verbose CLI output for ~60–90% token savings. Install it, then re-open the wizard to pick up detection:"}),n!==null?r("code",{class:"ac-rtk-row__cmd",children:n}):null,r("a",{class:"ac-button",href:oa.value,target:"_blank",rel:"noreferrer noopener",children:"Open rtk repo"})]}):null]})}function _u(){const e=mi(ve.value,{extended:P.value});if(P.value&&Re.value==="install"&&e.id==="identity"&&!On.value)return r(Hs,{});if(e.kind==="form"){const i=$s(Ct.value,e.paths??[]);return r(M,{children:[e.id==="identity"?r(vu,{}):null,r(eo,{schema:i,values:B.value,errors:Le.value,onChange:t=>{B.value=t}})]})}return e.kind==="userMd"?!Gi.value||O.value===null?r("p",{children:"Loading .agent-user.yml…"}):r(ro,{value:O.value,errors:Le.value,hideRole:P.value&&Re.value==="install",hideIdentityBasics:P.value&&Re.value==="install",onChange:i=>{O.value=i,gi.value=!1}}):e.kind==="welcome"?r(du,{}):e.kind==="aiTools"?r(fu,{}):e.kind==="roles"?r(hu,{}):e.kind==="packs"?r(pu,{}):r(Us,{steps:sa(),currentIndex:ve.value,changes:yi.value,errors:Le.value,userMdChanged:ri(),userMdAction:At.value?"replace":"create",loading:Jn.value,onJump:i=>{Oe(i)},selectedToolsCount:Object.values(Z.value).filter(Boolean).length,selectedPacksCount:Object.values(te.value).filter(Boolean).length,packRemovals:tt(),removalsConfirmed:Ji.value,onConfirmRemovals:i=>{Ji.value=i},selectedToolIds:Object.entries(Z.value).filter(([,i])=>i).map(([i])=>i),packAdditions:P.value?xi().filter(i=>i!=="engineering-base"&&!_e.value.includes(i)):[]})}function tt(){return P.value?Ls(_e.value,xi()):[]}function Sr({path:e}){if(ee(()=>{nu()},[]),!Xl.value||Ct.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Setup wizard"}),Ve.value!==null?r("p",{class:"ac-banner ac-banner--error",children:Ve.value}):r("p",{children:"Loading…"})]});const n=ve.value,i=je(),t=mi(n,{extended:P.value}),l=n===i-1,a=t.kind==="aiTools"&&Object.values(Z.value).filter(Boolean).length===0||t.kind==="roles"&&Object.values(V.value).filter(Boolean).length===0||t.kind==="packs"&&xi().length===0,o=P.value&&Re.value==="install"&&t.id==="identity"&&!On.value,c=ti.value,s=c!==null&&!ca.value,u=Xi.value,h=u!==null&&u.present&&!et.value,d=P.value&&Re.value==="install"&&n===0&&!Ot.value&&!Ee.value;return h?r("div",{class:"ac-page",children:r(Ws,{sourcePath:u.path,backupTarget:u.backupTarget,version:u.version,busy:nt.value,error:it.value,onBackupAndProceed:()=>{eu()},onAbort:()=>{E.value={tone:"info",message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},et.value=!0}})}):d?r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:r("h1",{children:"Set up agent-config"})}),E.value!==null?r("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,r(cu,{})]}):r("div",{class:"ac-page",children:[r(Fs,{step:t,index:n,total:i}),s?r(Bs,{abortedAt:c.abortedAt,abortNote:c.abortNote,writesSinceRollback:c.writesSinceRollback,busy:Vn.value,onResume:()=>{Ri("resume")},onRollback:()=>{Ri("rollback")},onIgnore:()=>{Ri("ignore")}}):null,E.value!==null&&!(Ee.value&&l&&E.value.tone==="success")?r("p",{class:`ac-banner${E.value.tone==="error"?" ac-banner--error":""}`,children:E.value.message}):null,r("div",{class:"ac-wizard__step",children:Ee.value&&l?r(qs,{message:E.value?.tone==="success"?E.value.message:null}):r(_u,{})}),a?r("p",{class:"ac-wizard__hint",children:t.kind==="aiTools"?"Select at least one AI tool to continue.":t.kind==="roles"?"Select at least one role to continue.":"Select at least one capability pack to continue."}):null,r(Ps,{canGoPrev:n>0,canGoNext:!l&&!a,canSkip:o||t.kind==="userMd",skipLabel:o?"Finish install here":"Skip",isLast:l,busy:Vn.value||Jn.value,canFinish:(yi.value.length>0||ri()||tt().length>0||P.value&&Object.values(Z.value).some(Boolean))&&(tt().length===0||Ji.value),completed:Ee.value,onPrev:()=>{Oe(n-1)},onNext:()=>{if(o){On.value=!0;return}Oe(n+1)},onSkip:()=>{if(o){On.value=!0,Oe(je()-1);return}gi.value=!0,Oe(n+1)},onFinish:()=>{au()}})]})}const mu=new Set(["profile.id","rule_loading_tier","discipline_profile","personal.ide","personal.open_edited_files","personal.autonomy","personal.minimal_output","personal.play_by_play","personal.pr_comment_bot_icon","personal.pr_progress_comments","cost.budgets.daily","cost.budgets.weekly","cost.budgets.monthly","cost.enforcement","model.auto_switch","tokens.rich_skills","roadmap.quality_cadence","roadmap.dashboard_regen_cadence","quality.local_auto_run","quality.wait_for_remote_ci","memory.review_threshold","memory.redact_patterns","memory.cadence","chat_history.enabled","update_check.enabled","subagents.enabled","subagents.auto","worktrees.mode","legal_review_prep.acknowledged"]);function Cr(e){return mu.has(e)}function gu(e,n){return JSON.stringify(e??null)===JSON.stringify(n??null)}function fa(e,n){if(e.kind==="enum_removed"){const i=new Set(e.values??[]);return n!==void 0&&i.has(n)?"must_fix":"info"}return e.kind==="type_changed"?"must_fix":e.kind==="default_changed"?n===void 0||gu(n,e.old?.default)?"adopt":"review":e.kind==="added"&&e.new?.default===void 0?"must_fix":"info"}const rt=p(!0),li=p(null),lt=p(!1),Ci=p(null),Ue=p({}),at=p(0),me=p({}),re=p(null),J=p(!1),cn=p(!1);function fe(e){return`${e.key}:${e.kind}`}async function yu(){rt.value=!0,li.value=null,lt.value=!1,cn.value=!1;try{const e=await w("/api/v1/settings/changes"),n=await w("/api/v1/settings");Ci.value=e.delta,Ue.value=n.values,at.value=n.lastModified,bu(e.delta,n.values)}catch(e){e instanceof A&&e.status===404?lt.value=!0:li.value=e instanceof Error?e.message:String(e)}finally{rt.value=!1}}function bu(e,n){const i={};for(const t of e.changes){const l=fa(t,mn(n,t.key.split(".")));l==="adopt"?i[fe(t)]={mode:"adopt"}:l==="review"?i[fe(t)]={mode:"keep"}:l==="must_fix"&&(i[fe(t)]={mode:null})}me.value=i}function $t(e){return fa(e,mn(Ue.value,e.key.split(".")))}function Je(e,n){me.value={...me.value,[e]:n}}function Rt(){const e=Ci.value;return e===null?[]:e.changes.filter(n=>{if($t(n)!=="must_fix")return!1;const i=me.value[fe(n)];return i===void 0||i.mode===null||i.mode==="custom"&&(i.value===void 0||i.value==="")})}function ku(){const e=Ci.value;let n=Ue.value;if(e===null)return n;for(const i of e.changes){const t=me.value[fe(i)];if(t===void 0||t.mode===null||t.mode==="keep")continue;const l=i.key.split(".");t.mode==="adopt"&&i.new?.default!==void 0?n=tn(n,l,i.new.default):t.mode==="custom"&&t.value!==void 0&&(n=tn(n,l,t.value))}return n}async function wu(){if(J.value)return;const e=Rt();if(e.length>0){re.value=`Resolve the ${e.length} “Must fix” item${e.length===1?"":"s"} first.`;return}J.value=!0,re.value=null;try{const n=ku();if(JSON.stringify(n)!==JSON.stringify(Ue.value)){const i=await w("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(at.value)},body:{values:n}});Ue.value=n,at.value=i.lastModified}await w("/api/v1/settings/changes/ack",{method:"POST"}),cn.value=!0}catch(n){n instanceof A?re.value=U(n.body.error??{code:"UNKNOWN",message:n.message}):re.value=n instanceof Error?n.message:String(n)}finally{J.value=!1}}async function xu(){if(J.value)return;if(Rt().length>0){re.value="Cannot dismiss — “Must fix” items would leave invalid values in place.";return}J.value=!0;try{await w("/api/v1/settings/changes/ack",{method:"POST"}),cn.value=!0}catch(n){re.value=n instanceof Error?n.message:String(n)}finally{J.value=!1}}function ne(e){return e===void 0?"—":typeof e=="string"?e:JSON.stringify(e)}function Fi({change:e,id:n}){const i=e.new,l=me.value[n]?.value;return i?.enum!==void 0?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onChange:a=>{const o=a.currentTarget.value;Je(n,{mode:"custom",value:o})},children:[r("option",{value:"",disabled:!0,children:"Choose a value…"}),i.enum.map(a=>r("option",{value:String(a),children:String(a)},String(a)))]}):i?.type==="boolean"?r("select",{class:"ac-input","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onChange:a=>{Je(n,{mode:"custom",value:a.currentTarget.value==="true"})},children:[r("option",{value:"",disabled:!0,children:"Choose…"}),r("option",{value:"true",children:"true"}),r("option",{value:"false",children:"false"})]}):r("input",{class:"ac-input",type:i?.type==="number"||i?.type==="integer"?"number":"text","aria-label":`New value for ${e.key}`,value:l===void 0?"":String(l),onInput:a=>{const o=a.currentTarget.value,c=i?.type==="number"||i?.type==="integer"?Number(o):o;Je(n,{mode:"custom",value:c})}})}function Su({change:e}){const n=$t(e),i=fe(e),t=me.value[i],l=mn(Ue.value,e.key.split("."));return r("li",{class:`ac-change-card ac-change-card--${n}`,"data-key":e.key,"data-kind":e.kind,children:[r("div",{class:"ac-change-card__head",children:[r("code",{class:"ac-change-card__key",children:e.key}),r("span",{class:`ac-change-card__badge ac-change-card__badge--${n}`,children:n==="must_fix"?"Must fix":n==="adopt"?"New default":n==="review"?"Review":"Info"})]}),e.new?.description!==void 0?r("p",{class:"ac-change-card__desc",children:e.new.description}):null,e.kind==="default_changed"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Default changed: ",r("code",{children:ne(e.old?.default)})," → ",r("code",{children:ne(e.new?.default)}),n==="review"?r(M,{children:[" · your value: ",r("code",{children:ne(l)})]}):null]}),r("div",{class:"ac-change-card__choices",role:"radiogroup","aria-label":`Resolution for ${e.key}`,children:[r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:t?.mode==="adopt",onChange:()=>{Je(i,{mode:"adopt"})}}),r("span",{children:["Adopt new default (",r("code",{children:ne(e.new?.default)}),")"]})]}),r("label",{class:"ac-change-card__choice",children:[r("input",{type:"radio",name:i,checked:t?.mode==="keep",onChange:()=>{Je(i,{mode:"keep"})}}),r("span",{children:["Keep current (",r("code",{children:ne(l??e.old?.default)}),")"]})]})]})]}):null,e.kind==="enum_removed"?n==="must_fix"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Your value ",r("code",{children:ne(l)})," is no longer valid — removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")}),". Pick a replacement:"]}),r(Fi,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["Removed option",(e.values?.length??0)===1?"":"s",": ",r("code",{children:(e.values??[]).join(", ")})," — your value ",r("code",{children:ne(l??e.new?.default)})," is unaffected."]}):null,e.kind==="enum_added"?r("p",{class:"ac-change-card__detail",children:["New option",(e.values?.length??0)===1?"":"s"," available: ",r("code",{children:(e.values??[]).join(", ")})]}):null,e.kind==="added"?n==="must_fix"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:"New setting without a shipped default — define a value:"}),r(Fi,{change:e,id:i})]}):r("p",{class:"ac-change-card__detail",children:["New setting · default: ",r("code",{children:ne(e.new?.default)}),e.new?.enum!==void 0?r(M,{children:[" · options: ",r("code",{children:e.new.enum.join(", ")})]}):null]}):null,e.kind==="removed"?r("p",{class:"ac-change-card__detail",children:"This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted)."}):null,e.kind==="type_changed"?r(M,{children:[r("p",{class:"ac-change-card__detail",children:["Type changed: ",r("code",{children:e.old?.type})," → ",r("code",{children:e.new?.type}),". Define a new value:"]}),r(Fi,{change:e,id:i})]}):null]})}function Cu(e){const n=new Map;for(const u of e.changes){const h=$t(u);n.set(h,[...n.get(h)??[],u])}const i=[],t=n.get("must_fix")??[];t.length>0&&i.push({title:"Must fix",hint:"These stored values are invalid after the upgrade — saving is blocked until each has a valid value.",changes:t});const l=[...n.get("adopt")??[],...n.get("review")??[]];l.length>0&&i.push({title:"Changed defaults",hint:"Values you never customized are preselected to adopt the new default; customized values are kept unless you choose otherwise.",changes:l});const a=n.get("info")??[],o=a.filter(u=>u.kind==="added"),c=a.filter(u=>u.kind==="enum_added"),s=a.filter(u=>u.kind!=="added"&&u.kind!=="enum_added");return o.length>0&&i.push({title:"New settings",changes:o}),c.length>0&&i.push({title:"New options",changes:c}),s.length>0&&i.push({title:"Removed / other",changes:s}),i}function Au(){if(ee(()=>{yu()},[]),rt.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{children:"Loading…"})]});if(li.value!==null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner ac-banner--error",children:li.value})]});if(cn.value||lt.value)return r("div",{class:"ac-page ac-settings-changes",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-banner",children:cn.value?"Review complete — all changes resolved.":"Nothing to review — your settings are up to date."}),r("button",{type:"button",class:"ac-button",onClick:()=>pi("/settings"),children:"Back to Settings"})]});const e=Ci.value;if(e===null)return r("div",{class:"ac-page",children:r("h1",{children:"Settings changes"})});const n=Cu(e),i=Rt().length;return r("div",{class:"ac-page ac-settings-changes",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings changes"}),r("p",{class:"ac-page__lede",children:["The upgrade ",r("code",{children:e.oldVersion})," → ",r("code",{children:e.newVersion})," changed the available settings. Review below — nothing was changed automatically."]})]}),re.value!==null?r("p",{class:"ac-banner ac-banner--error",role:"alert",children:re.value}):null,n.map(t=>r("section",{class:"ac-settings-changes__group",children:[r("h2",{children:[t.title," ",r("span",{class:"ac-settings-changes__count",children:["(",t.changes.length,")"]})]}),t.hint!==void 0?r("p",{class:"ac-settings-changes__hint",children:t.hint}):null,r("ul",{class:"ac-settings-changes__list",children:t.changes.map(l=>r(Su,{change:l},fe(l)))})]},t.title)),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",disabled:J.value,onClick:()=>{xu()},children:"Dismiss (keep everything)"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:J.value||i>0,title:i>0?`${i} “Must fix” item${i===1?"":"s"} unresolved`:void 0,onClick:()=>{wu()},children:J.value?"Saving…":"Apply & finish review"})]})]})}const xe=p(null);function Tu(){return ee(()=>{(async()=>{try{const e=await w("/api/v1/settings/changes");xe.value=e.delta.changes.length}catch{xe.value=null}})()},[]),xe.value===null||xe.value===0?null:r("div",{class:"ac-banner ac-banner--pending",role:"status",children:[r("span",{children:["An upgrade changed ",xe.value," setting",xe.value===1?"":"s"," — review recommended."]}),r("button",{type:"button",class:"ac-button ac-button--small",onClick:()=>pi("/settings/changes"),children:"Review changes"})]})}const ot=p(!1),ai=p(null),X=p({}),oi=p(null),sn=p(0),un=p({}),K=p(null),dn=p(!1),Be=p(null),Nn=p(""),Ce=p(!1),In=p({}),Ln=p({global:new Set,project:new Set});function Ar(e){if("$ref"in e&&e.$ref!==void 0&&"definitions"in e&&e.definitions!==void 0){const n=e.$ref.replace("#/definitions/",""),i=e.definitions[n];if(i!==void 0)return i}return e}async function Tr(){ai.value=null;try{const e=await w("/api/v1/settings");X.value=e.values,oi.value=Ar(e.schema),sn.value=e.lastModified,Ln.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},ot.value=!0}catch(e){if(e instanceof A&&e.status===404&&e.body.error?.code==="NOT_FOUND"){const n=e.body;if(n.defaults!==void 0&&n.schema!==void 0){X.value=n.defaults,oi.value=Ar(n.schema),sn.value=n.lastModified??0,ot.value=!0;return}}ai.value=e instanceof Error?e.message:String(e)}}async function Eu(){if(!dn.value){K.value=null,un.value={};try{const e=await w("/api/v1/settings/diff",{method:"POST",body:{values:X.value,ifUnmodifiedSince:sn.value}});if(e.changes.length===0){K.value="No changes to save.";return}Be.value=e.changes}catch(e){e instanceof A?(un.value=vi(e.body.error??{message:e.message}),K.value=U(e.body.error??{code:"UNKNOWN",message:e.message})):K.value=e instanceof Error?e.message:String(e)}}}async function Ou(){dn.value=!0;try{const e=await w("/api/v1/settings",{method:"PUT",headers:{"If-Unmodified-Since":String(sn.value)},body:{values:X.value}});sn.value=e.lastModified,Be.value=null,K.value=`Saved (${e.writtenPaths.join(", ")}).`}catch(e){if(e instanceof A){const n=e.body.error??{code:"UNKNOWN",message:e.message};un.value=vi(n),K.value=U(n),Be.value=null;const i=Object.keys(un.value)[0];i!==void 0&&queueMicrotask(()=>{const t=document.getElementById(i);t!==null&&t.focus()})}else K.value=e instanceof Error?e.message:String(e)}finally{dn.value=!1}}function Ft(e){if(e.defaultValue===void 0)return!1;const n=mn(X.value,e.path);return n===void 0?!1:JSON.stringify(n)!==JSON.stringify(e.defaultValue)}function Nu(e,n){const i=Ft(n),t=Ln.value.project.has(e)?"project":Ln.value.global.has(e)&&Ln.value.project.size>0?"global":void 0;return{modified:i,onReset:i&&n.defaultValue!==void 0?()=>{X.value=tn(X.value,n.path,n.defaultValue)}:void 0,sourceLabel:t}}function Iu(e,n){const i=n.toLowerCase();return e.path.join(".").toLowerCase().includes(i)||e.label.toLowerCase().includes(i)||(e.description??"").toLowerCase().includes(i)}function Lu(e){const n=Nn.value.trim(),i=Ce.value,t=e.path.join("."),l=In.value[t]===!0;let a=e.fields.filter(u=>u.kind!=="unsupported");if(n!==""&&(a=a.filter(u=>Iu(u,n))),i&&(a=a.filter(u=>Ft(u))),n!==""||i)return a.length===0?null:{section:e,visible:a,hiddenAdvancedCount:0,expanded:l};const o=a.filter(u=>Cr(u.path.join("."))),c=a.filter(u=>!Cr(u.path.join("."))),s=l?[...o,...c]:o;return s.length===0&&c.length===0?null:{section:e,visible:s,hiddenAdvancedCount:l?0:c.length,expanded:l}}function $u(e){In.value={...In.value,[e]:In.value[e]!==!0}}function Ru({changes:e}){return r("div",{class:"ac-modal",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:r("div",{class:"ac-modal__panel",children:[r("h2",{id:"diff-title",children:"Confirm changes"}),r("ul",{class:"ac-diff",children:e.map(n=>r("li",{children:[r("code",{children:n.path}),r("span",{class:"ac-diff__before",children:JSON.stringify(n.from)}),r("span",{class:"ac-diff__arrow",children:"→"}),r("span",{class:"ac-diff__after",children:JSON.stringify(n.to)})]},n.path))}),r("div",{class:"ac-modal__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Be.value=null},children:"Cancel"}),r("button",{type:"button",class:"ac-button ac-button--primary",disabled:dn.value,onClick:()=>{Ou()},children:dn.value?"Saving…":"Save"})]})]})})}function Fu(){if(ee(()=>{Tr()},[]),!ot.value||oi.value===null)return r("div",{class:"ac-page",children:[r("h1",{children:"Settings"}),ai.value!==null?r("p",{class:"ac-banner ac-banner--error",children:ai.value}):r("p",{children:"Loading…"})]});const e=al(oi.value),n=e.map(Lu).filter(l=>l!==null),i=e.flatMap(l=>l.fields).filter(l=>Ft(l)).length,t=Nn.value.trim()!==""||Ce.value;return r("div",{class:"ac-page ac-settings-hub",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Settings"}),r("nav",{class:"ac-page__nav",children:r("a",{href:"#/settings/user",children:"Edit .agent-user.yml →"})})]}),r(Tu,{}),r("div",{class:"ac-settings-hub__toolbar",role:"search",children:[r("input",{class:"ac-input ac-settings-hub__search",type:"search",placeholder:"Search all settings (basic and advanced)…",value:Nn.value,onInput:l=>{Nn.value=l.currentTarget.value}}),r("button",{type:"button",class:`ac-chip-toggle${Ce.value?" ac-chip-toggle--active":""}`,"aria-pressed":Ce.value,onClick:()=>{Ce.value=!Ce.value},children:["@modified",i>0?` (${i})`:""]})]}),K.value!==null?r("p",{class:"ac-banner",children:K.value}):null,r("form",{class:"ac-form",onSubmit:l=>l.preventDefault(),children:[n.length===0?r("p",{class:"ac-settings-hub__empty",children:"No settings match."}):n.map(l=>{const a=l.section.path.join(".");return r(ol,{section:{...l.section,fields:l.visible},values:X.value,errors:un.value,onChange:o=>{X.value=o},decorate:Nu,footer:!t&&(l.hiddenAdvancedCount>0||l.expanded)?r("button",{type:"button",class:"ac-settings-hub__disclosure","aria-expanded":l.expanded,onClick:()=>{$u(a)},children:l.expanded?"Hide advanced settings":`Show ${l.hiddenAdvancedCount} advanced setting${l.hiddenAdvancedCount===1?"":"s"}`}):void 0},a)}),r("div",{class:"ac-form__actions",children:[r("button",{type:"button",class:"ac-button",onClick:()=>{Tr()},children:"Reload"}),r("button",{type:"button",class:"ac-button ac-button--primary",onClick:()=>{Eu()},children:"Preview & Save"})]})]}),Be.value!==null?r(Ru,{changes:Be.value}):null]})}const ci=p(!1),Fe=p(null);async function Pu(){Qn.value=!0,Zn.value=null;try{const e=await w("/api/v1/modules/detect");Tt.value=e.candidates,ta.value=e.project_root;const n={};for(const i of e.candidates)n[i.path]=!0;Xn.value=n,ei.value=e.proposed_block.enabled,ni.value=e.proposed_block.namespace_template??"",ii.value=e.proposed_block.agent_folder??"agents"}catch(e){Zn.value=e instanceof A?U(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e)}finally{Qn.value=!1,Ks.value=!0}}function Mu(){const e=new Set(Tt.value.map(t=>t.path)),n=Xn.value,i=Object.keys(n).filter(t=>n[t]===!0&&e.has(t));return{enabled:ei.value,root_paths:i,namespace_template:ni.value,agent_folder:ii.value||"agents"}}async function Du(){ci.value=!0,Fe.value=null;try{const e=await w("/api/v1/modules/apply",{method:"POST",body:Mu()});Fe.value={message:e.appliedTo!==null?`Saved project settings to ${e.appliedTo}.`:`Saved project settings to ${e.projectRoot}.`,tone:"success"}}catch(e){const n=e instanceof A?U(e.body.error??{code:"UNKNOWN",message:e.message}):e instanceof Error?e.message:String(e);Fe.value={message:`Could not save project settings: ${n}`,tone:"error"}}finally{ci.value=!1}}function ju(){if(Qn.value)return r("p",{children:"Detecting module roots…"});if(Zn.value!==null)return r("p",{class:"ac-banner ac-banner--error",children:["Module detection failed: ",Zn.value]});const e=Tt.value,n=Xn.value,i=ta.value;return r("div",{class:"ac-section",children:[i!==null?r("p",{class:"ac-section__description",children:["Scanning ",r("code",{children:i}),". Pick which detected roots the agent should treat as modules. These write to",r("code",{children:" .agent-project-settings.yml"})," in this repo only."]}):null,r("label",{children:[r("input",{type:"checkbox",checked:ei.value,onChange:t=>{ei.value=t.currentTarget.checked}})," ","Enable module discovery (writes ",r("code",{children:"modules.enabled"}),")"]}),e.length===0?r("p",{children:[r("em",{children:"No module roots detected."})," The scan found no common module layouts (Laravel ",r("code",{children:"app/Modules/"}),", Symfony",r("code",{children:" src/Module/"}),", Node ",r("code",{children:"packages/"}),", Python",r("code",{children:" src/"}),", Go ",r("code",{children:"internal/"}),")."]}):r("ul",{style:"list-style: none; padding-left: 0;",children:e.map(t=>r("li",{children:r("label",{children:[r("input",{type:"checkbox",checked:n[t.path]??!1,onChange:l=>{const a=l.currentTarget.checked;Xn.value={...n,[t.path]:a}}})," ",r("code",{children:t.path})," — ",t.stack," ",r("small",{children:["(",t.confidence," confidence)"]})]})},t.path))}),r("div",{class:"ac-wizard__module-fields",children:[r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-namespace",children:"Namespace template"}),r("input",{id:"ac-modules-namespace",class:"ac-input",type:"text",value:ni.value,placeholder:"e.g. App\\\\Modules\\\\{ModuleName}\\\\App",onInput:t=>{ni.value=t.currentTarget.value}}),r("span",{class:"ac-field__description",children:"How a module path maps to its namespace. Leave blank to skip namespacing."})]}),r("div",{class:"ac-field",children:[r("label",{class:"ac-field__label",for:"ac-modules-agent-folder",children:"Agent folder"}),r("input",{id:"ac-modules-agent-folder",class:"ac-input",type:"text",value:ii.value,placeholder:"agents",onInput:t=>{ii.value=t.currentTarget.value}}),r("span",{class:"ac-field__description",children:["Folder name that holds per-module agent docs (default ",r("code",{children:"agents"}),")."]})]})]})]})}function Uu(){return ee(()=>{Pu()},[]),r("div",{class:"ac-page",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Project settings"}),r("p",{class:"ac-section__description",children:["Configuration scoped to this repository — written to",r("code",{children:" .agent-project-settings.yml"}),", not the global tree."]})]}),Fe.value!==null?r("p",{class:`ac-banner ac-banner--${Fe.value.tone==="success"?"success":"error"}`,children:Fe.value.message}):null,r("section",{class:"ac-section",children:[r("h2",{class:"ac-section__title",children:"Modules"}),r(ju,{})]}),r("div",{class:"ac-form__actions ac-wizard__nav",children:r("button",{type:"button",class:"ac-button ac-button--primary",disabled:ci.value||Qn.value,onClick:()=>{Du()},children:ci.value?"Saving…":"Save project settings"})})]})}const $n=p([]),fn=p([]),ct=p([]),st=p([]),si=p(null),ha=p(!1),Qe=p(null),j=p(null),Pi=p("plain"),ui=p({}),pa=p([]),Er={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini"};function Bu(){try{return globalThis.sessionStorage?.getItem("ac-workspace-host")??"claude-code"}catch{return"claude-code"}}const Pt=p(Bu());function Hu(e){Pt.value=e;try{globalThis.sessionStorage?.setItem("ac-workspace-host",e)}catch{}}const hn=p([]),Y=p(null),Ne=p({}),he=p(!1),pn=p(null),ce=p(""),Ze=p(!1),Ai=p(!1),ut=p(null),pe=p(null),vn=p([]),Rn=p(new Set),va="claude-code",Or=2e3;async function Wu(){Qe.value=null;try{const[e,n,i,t,l,a]=await Promise.all([w("/api/v1/workspace/roles"),w("/api/v1/workspace/sessions?limit=20"),w("/api/v1/workspace/knowledge?limit=20"),w("/api/v1/workspace/documents?limit=20"),w("/api/v1/workspace/drive-health").catch(()=>({health:{}})),w("/api/v1/workspace/hosts").catch(()=>({hosts:[]}))]);$n.value=e.roles,fn.value=n.sessions,ct.value=i.chunks,st.value=t.documents,ui.value=l.health??{},pa.value=a.hosts??[],ha.value=!0}catch(e){e instanceof A?Qe.value=e.body?.error?.message??e.message:Qe.value=e instanceof Error?e.message:String(e)}}async function zu(e,n){try{const i=await w(`/api/v1/workspace/roles/${e}/tasks`);hn.value=i.tasks}catch{hn.value=n}}async function Mt(e){pe.value=e,Rn.value=new Set;try{const n=await w(`/api/v1/workspace/sessions/${e}`);vn.value=Array.isArray(n.log)?n.log:[]}catch{vn.value=[]}}async function Yu(e){j.value=null,Ai.value=!1,ce.value="",Y.value=null,await Mt(e)}async function _a(e,n,i){j.value=null,he.value=!0,ce.value="",Ai.value=!1,ut.value={role:e,task:n,inputs:i};try{const t=await w("/api/v1/workspace/launch",{method:"POST",body:{role:e,task:n,inputs:i,host:Pt.value}});pn.value=t,j.value=ma(t),Y.value=null,await Mt(t.id);const l=await w("/api/v1/workspace/sessions?limit=20");fn.value=l.sessions,await Dt()}catch(t){pn.value=null,t instanceof A?j.value=t.body?.error?.message??t.message:j.value=t instanceof Error?t.message:String(t)}finally{he.value=!1}}async function qu(e,n){if(!(n.trim()===""||Ze.value)){Ze.value=!0,j.value=null;try{const i=await w(`/api/v1/workspace/sessions/${e}/continue`,{method:"POST",body:{prompt:n}});pn.value=i,j.value=ma(i),i.driven&&(ce.value=""),await Mt(e);const t=await w("/api/v1/workspace/sessions?limit=20");fn.value=t.sessions,await Dt()}catch(i){i instanceof A&&i.status===410?(Ai.value=!0,j.value="Host session expired — start a new conversation."):i instanceof A?j.value=i.body?.error?.message??i.message:j.value=i instanceof Error?i.message:String(i)}finally{Ze.value=!1}}}async function Dt(){try{const e=await w("/api/v1/workspace/drive-health");ui.value=e.health??{}}catch{}}async function Ku(e){try{await w(`/api/v1/workspace/drive-health/${e}/reset`,{method:"POST"}),await Dt()}catch{}}function ma(e){return e.driven?e.recovered===!0?`Host recovered — drove the turn for ${e.role} · ${e.task}.`:`Drove the turn for ${e.role} · ${e.task}.`:e.host_killed===!0?`Host ${va} is paused after repeated failures — handed off to the inbox.`:e.error_kind==="render-error"?`Couldn't fill the prompt: ${e.error??"missing input"}.`:e.reason==="no-prompt-for-task"?"Recorded the session — this task has no runnable prompt yet.":typeof e.handoff=="string"?`Prepared a hand-off — open ${e.handoff} and paste it into your host.`:`Recorded the session ${e.id} (${e.role} · ${e.task}).`}function Gu({role:e}){const n=si.value===e.slug;return r("button",{type:"button",class:`ac-workspace__role${n?" ac-workspace__role--active":""}`,"aria-current":n?"true":void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{si.value=e.slug,j.value=null,pn.value=null,Y.value=null,Ne.value={},hn.value=e.first_tasks,zu(e.slug,e.first_tasks)},children:[r("span",{class:"ac-workspace__role-name",children:e.display_name}),r("span",{class:"ac-workspace__role-status","data-status":e.status,children:e.status}),r("span",{class:"ac-workspace__role-tagline",children:e.tagline})]})}function Vu({role:e,task:n}){const i=n.inputs??[],t=Ne.value,l=i.some(a=>a.required&&(t[a.name]??"").trim()==="");return r("form",{class:"ac-workspace__task-form",onSubmit:a=>{a.preventDefault(),!l&&!he.value&&_a(e,n.name,Ne.value)},children:[i.length===0?r("p",{class:"ac-workspace__form-note",children:"No inputs — runs the prompt as-is."}):i.map(a=>r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:[a.name,a.required?r("span",{class:"ac-workspace__req","aria-hidden":"true",children:" *"}):null]}),r("textarea",{class:"ac-workspace__field-input",placeholder:a.shape,required:a.required,"aria-label":`${a.name}${a.required?" (required)":""}`,value:t[a.name]??"",onInput:o=>{Ne.value={...Ne.value,[a.name]:o.target.value}}})]},a.name)),r("div",{class:"ac-workspace__form-actions",children:[r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:l||he.value,children:he.value?"Running…":"Run task"}),r("button",{type:"button",class:"ac-button",onClick:()=>{Y.value=null},children:"Cancel"})]})]})}function Ju(e){const n=[];for(const i of e){const t=i.data??{};if(i.kind==="launcher.input")t.followup===!0?n.push({kind:"user",text:typeof t.prompt=="string"?t.prompt:""}):n.push({kind:"task",text:typeof t.task=="string"?t.task:""});else if(i.kind==="host.turn"){const l=t.usage,a=l!=null?`${typeof t.model=="string"?t.model:va} · in ${l.input_tokens??0} / out ${l.output_tokens??0} tokens`:void 0;n.push({kind:"assistant",text:typeof t.text=="string"?t.text:"",meta:a})}else if(i.kind==="host.error"){const l=typeof t.error_kind=="string"?t.error_kind:"error";n.push({kind:"error",text:`${l}: ${typeof t.error=="string"?t.error:""}`})}}return n}function Qu(){if(pe.value===null)return null;const e=Ju(vn.value),n=vn.value.some(i=>i.kind==="host.turn");return r("section",{class:"ac-workspace__thread","aria-label":"Conversation thread",children:[r("h2",{class:"ac-workspace__heading",children:"Conversation"}),e.length===0?r("p",{class:"ac-workspace__empty",children:"No turns yet."}):r("ol",{class:"ac-workspace__thread-list",children:e.map((i,t)=>{const l=i.kind==="assistant"&&i.text.length>Or,a=Rn.value.has(t),o=l&&!a?`${i.text.slice(0,Or)}…`:i.text;return r("li",{class:`ac-workspace__thread-block ac-workspace__thread-block--${i.kind}`,children:[r("span",{class:"ac-workspace__thread-role",children:i.kind==="task"?"Task":i.kind==="user"?"You":i.kind==="assistant"?"Host":"Error"}),r("pre",{class:"ac-workspace__thread-text",children:o}),l?r("button",{type:"button",class:"ac-button",onClick:()=>{const c=new Set(Rn.value);c.has(t)?c.delete(t):c.add(t),Rn.value=c},children:a?"Show less":"Show full"}):null,i.meta!=null?r("p",{class:"ac-workspace__turn-meta",children:i.meta}):null]},t)})}),Ai.value?r("div",{class:"ac-workspace__followup-gone",role:"status",children:[r("p",{children:"Host session expired."}),ut.value!==null?r("button",{type:"button",class:"ac-button ac-button--primary",disabled:he.value,onClick:()=>{const i=ut.value;i!==null&&_a(i.role,i.task,i.inputs)},children:he.value?"Starting…":"Start a new conversation"}):r("p",{children:"Pick a task above to start a new conversation."})]}):n?r("form",{class:"ac-workspace__followup",onSubmit:i=>{i.preventDefault(),pe.value!==null&&qu(pe.value,ce.value)},children:[r("label",{class:"ac-workspace__field",children:[r("span",{class:"ac-workspace__field-label",children:"Follow up"}),r("textarea",{class:"ac-workspace__field-input",placeholder:"Continue this conversation — e.g. make it shorter","aria-label":"Follow-up prompt",value:ce.value,onInput:i=>{ce.value=i.target.value}})]}),r("button",{type:"submit",class:"ac-button ac-button--primary",disabled:ce.value.trim()===""||Ze.value,children:Ze.value?"Continuing…":"Send follow-up"})]}):null]})}function Zu({role:e}){const n=hn.value.length>0?hn.value:e.first_tasks;return r("section",{class:"ac-workspace__tasks","aria-labelledby":"task-heading",children:[r("h2",{id:"task-heading",class:"ac-workspace__heading",children:["First tasks · ",e.display_name]}),n.length===0?r("p",{class:"ac-workspace__empty",children:"No tasks scaffolded yet for this role."}):r("ul",{class:"ac-workspace__task-list",children:n.map(i=>r("li",{class:"ac-workspace__task",children:[r("div",{class:"ac-workspace__task-head",children:[r("span",{class:"ac-workspace__task-name",children:i.name}),r("button",{type:"button",class:"ac-button ac-button--primary","aria-expanded":Y.value===i.name,onClick:()=>{Y.value=Y.value===i.name?null:i.name,Ne.value={},pn.value=null,pe.value=null,vn.value=[]},children:Y.value===i.name?"Close":"Start session"})]}),r("p",{class:"ac-workspace__task-intent",children:i.intent}),i.prompt!==""?r("code",{class:"ac-workspace__task-prompt",children:["prompts/",i.prompt]}):null,Y.value===i.name?r(Vu,{role:e.slug,task:i}):null]},i.name))}),e.skills.length>0?r("details",{class:"ac-workspace__skills",children:[r("summary",{children:["Skill shortlist (",e.skills.length,")"]}),r("ul",{class:"ac-workspace__skill-list",children:[e.skills.slice(0,5).map(i=>r("li",{class:"ac-workspace__skill",children:[r("code",{children:i.id})," — ",i.why]},i.id)),e.skills.length>5?r("li",{class:"ac-workspace__skill-more",children:["+ ",e.skills.length-5," more"]}):null]})]}):null]})}function Xu(){return r("section",{class:"ac-workspace__sessions","aria-labelledby":"sessions-heading",children:[r("h2",{id:"sessions-heading",class:"ac-workspace__heading",children:"Recent sessions"}),fn.value.length===0?r("p",{class:"ac-workspace__empty",children:"No sessions yet — pick a role and start one."}):r("ul",{class:"ac-workspace__session-list",children:fn.value.map(e=>r("li",{class:"ac-workspace__session",children:r("button",{type:"button",class:`ac-workspace__session-open${pe.value===e.id?" ac-workspace__session-open--active":""}`,"aria-label":`Open session ${e.task}`,"aria-current":pe.value===e.id?"true":void 0,onClick:()=>{Yu(e.id)},children:[r("span",{class:"ac-workspace__session-id",children:e.id.slice(0,16)}),r("span",{class:"ac-workspace__session-role",children:e.role}),r("span",{class:"ac-workspace__session-task",children:e.task})]})},e.id))})]})}function ed(){return r("section",{class:"ac-workspace__knowledge","aria-labelledby":"knowledge-heading",children:[r("h2",{id:"knowledge-heading",class:"ac-workspace__heading",children:"Knowledge sources"}),ct.value.length===0?r("p",{class:"ac-workspace__empty",children:["No sources yet. Run ",r("code",{children:"/knowledge:ingest <path>"})," to add documents."]}):r("ol",{class:"ac-workspace__citation-list",children:ct.value.map((e,n)=>r("li",{class:"ac-workspace__citation",children:[r("span",{class:"ac-workspace__citation-marker","aria-label":`Citation ${n+1}`,children:["[",n+1,"]"]}),r("a",{href:`file://${e.source}`,class:"ac-workspace__citation-source",title:"Open source in OS default app",children:e.source.split("/").pop()??e.source}),e.pinned?r("span",{class:"ac-workspace__citation-pin","aria-label":"pinned",children:"★"}):null,r("p",{class:"ac-workspace__citation-excerpt",children:[e.excerpt.slice(0,200),e.excerpt.length>200?"…":""]})]},e.id))})]})}function nd(){return r("section",{class:"ac-workspace__recent","aria-labelledby":"recent-heading",children:[r("h2",{id:"recent-heading",class:"ac-workspace__heading",children:"Recent documents"}),st.value.length===0?r("p",{class:"ac-workspace__empty",children:"No documents yet. Saved drafts land here."}):r("ul",{class:"ac-workspace__doc-list",children:st.value.map(e=>r("li",{class:"ac-workspace__doc",children:[r("span",{class:"ac-workspace__doc-type","data-type":e.type,children:e.type}),r("span",{class:"ac-workspace__doc-title",children:e.title}),r("time",{class:"ac-workspace__doc-time",dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function id(){const n=Object.values(ui.value).filter(i=>i.killed||i.consecutive_failures>0);return r("section",{class:"ac-workspace__drive-health","aria-labelledby":"drive-health-heading",children:[r("h2",{id:"drive-health-heading",class:"ac-workspace__heading",children:"Host health"}),n.length===0?r("p",{class:"ac-workspace__empty",children:"All hosts healthy."}):r("ul",{class:"ac-workspace__health-list",children:Object.entries(ui.value).filter(([,i])=>i.killed||i.consecutive_failures>0).map(([i,t])=>{const l=t.killed?t.kill_reason==="manual"?"paused (manual)":"paused — auto-recovering":"degraded";return r("li",{class:"ac-workspace__health","data-killed":t.killed?"true":"false",children:[r("span",{class:"ac-workspace__health-host",children:i}),r("span",{class:"ac-workspace__health-state",children:l}),r("span",{class:"ac-workspace__health-meta",children:[t.consecutive_failures," fail streak",t.last_error_kind!=null?` · ${t.last_error_kind}`:""]}),t.killed?r("button",{type:"button",class:"ac-button ac-workspace__health-reset","aria-label":`Reset ${i}`,onClick:()=>{Ku(i)},children:"Reset"}):null]},i)})})]})}function td(){const e=Pi.value;return r("fieldset",{class:"ac-workspace__explain",children:[r("legend",{class:"ac-workspace__heading",children:"Explanation style"}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"plain",checked:e==="plain",onChange:()=>{Pi.value="plain"},"aria-label":"Plain language"}),r("span",{children:"Plain language"})]}),r("label",{class:"ac-workspace__explain-option",children:[r("input",{type:"radio",name:"explain-mode",value:"technical",checked:e==="technical",onChange:()=>{Pi.value="technical"},"aria-label":"Technical detail"}),r("span",{children:"Technical detail"})]}),r("p",{class:"ac-workspace__explain-hint",children:e==="plain"?"Replies use everyday words. Toggle to see the technical view.":"Replies keep the technical vocabulary. Toggle for the plain view."})]})}function rd(){const e=pa.value,n=e.length>0?e.map(t=>t.id):Object.keys(Er),i=new Map(e.map(t=>[t.id,t.cli_present]));return r("label",{class:"ac-workspace__host-picker",children:[r("span",{class:"ac-workspace__host-label",children:"Host"}),r("select",{class:"ac-workspace__host-select","aria-label":"Host agent",value:Pt.value,onChange:t=>{Hu(t.target.value)},children:n.map(t=>{const l=i.get(t)!==!1,a=Er[t]??t;return r("option",{value:t,disabled:!l,children:[a," (",t,")",l?"":" — not installed"]},t)})})]})}function ld(){if(ee(()=>{Wu()},[]),Qe.value!==null)return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-banner ac-banner--error",children:Qe.value})]});if(!ha.value)return r("div",{class:"ac-page",children:[r("h1",{children:"Workspace"}),r("p",{children:"Loading…"})]});const e=si.value!==null?$n.value.find(n=>n.slug===si.value)??null:null;return r("div",{class:"ac-page ac-workspace",children:[r("header",{class:"ac-page__header",children:[r("h1",{children:"Workspace"}),r("p",{class:"ac-page__subtitle",children:"Pick a role, pick a first task, run it."}),r(rd,{})]}),j.value!==null?r("p",{class:"ac-banner",role:"status",children:j.value}):null,r("div",{class:"ac-workspace__grid",children:[r("section",{class:"ac-workspace__roles","aria-labelledby":"roles-heading",children:[r("h2",{id:"roles-heading",class:"ac-workspace__heading",children:"Roles"}),$n.value.length===0?r("p",{class:"ac-workspace__empty",children:"No roles installed."}):r("div",{class:"ac-workspace__role-grid",children:$n.value.map(n=>r(Gu,{role:n},n.slug))})]}),r("main",{class:"ac-workspace__main","aria-label":"Tasks and sessions",children:[e!==null?r(Zu,{role:e}):r("p",{class:"ac-workspace__empty",children:"Pick a role on the left to see its first tasks."}),r(Qu,{}),r(Xu,{})]}),r("aside",{class:"ac-workspace__rail","aria-label":"Knowledge and documents",children:[r(ed,{}),r(nd,{}),r(id,{}),r(td,{})]})]})]})}const ga="agent-config-theme";function ad(){return(typeof document<"u"?document.documentElement.getAttribute("data-theme"):null)==="dark"?"dark":"light"}const Xe=p(ad());function od(){try{const e=localStorage.getItem(ga);return e==="light"||e==="dark"?e:null}catch{return null}}function cd(){if(typeof window>"u")return null;try{const e=new URLSearchParams(window.location.search).get("theme");return e==="light"||e==="dark"?e:null}catch{return null}}function sd(){return od()===null&&cd()===null}function ya(e){Xe.value=e,document.documentElement.setAttribute("data-theme",e)}function ud(){const e=Xe.value==="dark"?"light":"dark";try{localStorage.setItem(ga,e)}catch{}ya(e)}function dd(){if(typeof window>"u"||typeof window.matchMedia!="function")return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>{sd()&&ya(e.matches?"dark":"light")};typeof e.addEventListener=="function"&&e.addEventListener("change",n)}function fd(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embed")==="1"}const hd=fd(),ba=[{id:"setup",label:"Setup",hashPath:"/setup",matches:["/setup","/wizard"]},{id:"settings",label:"Settings",hashPath:"/settings",matches:["/settings"]},{id:"project",label:"Project",hashPath:"/project",matches:["/project"]},{id:"workspace",label:"Workspace",hashPath:"/workspace",matches:["/workspace"]}];function ka(e){for(const n of ba)for(const i of n.matches)if(e===i||e.startsWith(`${i}/`))return n.id;return null}function pd(e){const n=Me.value,i=ka(e);return ba.filter(t=>t.id==="project"?n?.projectSurface===!0||i==="project":t.id==="workspace"?n?.devSurfaces===!0||i==="workspace":!0)}function vd(){const e=Hn.value,n=ka(e);return r("header",{class:"ac-topnav",children:r("div",{class:"ac-topnav__inner",children:[r("div",{class:"ac-topnav__brand",children:[r("h1",{class:"ac-topnav__title",children:"@event4u/agent-config"}),r("p",{class:"ac-topnav__subtitle",children:"Browser Wizard"})]}),r("nav",{class:"ac-topnav__tabs","aria-label":"Surfaces",children:pd(e).map(i=>r("button",{type:"button",class:`ac-topnav__tab${n===i.id?" ac-topnav__tab--active":""}`,"aria-current":n===i.id?"page":void 0,onClick:()=>pi(i.hashPath),children:i.label},i.id))}),r("button",{type:"button",class:"ac-topnav__theme","aria-label":Xe.value==="dark"?"Switch to light theme":"Switch to dark theme",title:Xe.value==="dark"?"Switch to light theme":"Switch to dark theme",onClick:()=>{ud()},children:Xe.value==="dark"?"☀":"☾"})]})})}function _d({path:e}){return r("div",{class:"ac-page ac-page--error",children:[r("h1",{children:"Page not found"}),r("p",{children:["Nothing routed to ",r("code",{children:e}),". Try ",r("a",{href:"#/setup",children:"Setup"}),"."]})]})}function md(){const e=Me.value;return e===null||e.dryRun!==!0?null:r("div",{class:"ac-dryrun-banner",role:"status","aria-live":"polite",children:[r("strong",{children:"DRY RUN"}),r("span",{children:" · no files will be written. Validation + rendering run normally; commits return a preview."})]})}function gd(e){return e==="/"||e==="/setup"||e.startsWith("/setup/")?r(Sr,{path:e}):e.startsWith("/wizard")?r(Sr,{path:e}):e==="/settings/changes"?r(Au,{}):e==="/settings"||e.startsWith("/settings/")?r(Fu,{}):e==="/project"||e.startsWith("/project/")?r(Uu,{}):e==="/workspace"?r(ld,{}):r(_d,{path:e})}function yd(){return ee(()=>{Wa(),Hn.value==="/"&&pi("/setup"),qa()},[]),r(M,{children:[r(md,{}),hd?null:r(vd,{}),gd(Hn.value)]})}const bd=3e4,kd=30*6e4;let Sn=null,Nr=!1;function Ir(e){if(!Nr&&(Nr=!0,!(typeof navigator>"u"||typeof navigator.sendBeacon!="function")))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function wd(e){if(typeof window>"u")return()=>{};let n=Date.now();const i=()=>{n=Date.now()},t=["pointerdown","keydown","wheel","touchstart"];for(const c of t)window.addEventListener(c,i,{passive:!0});const l=()=>{document.hidden||i()};document.addEventListener("visibilitychange",l);const a=()=>{Sn!==null&&clearInterval(Sn),Sn=null;for(const c of t)window.removeEventListener(c,i);document.removeEventListener("visibilitychange",l),window.removeEventListener("pagehide",o)};Sn=setInterval(()=>{if(!document.hidden){if(Date.now()-n>kd){Ir(e),a();return}w("/api/v1/ping").catch(()=>{})}},bd);function o(){Ir(e)}return window.addEventListener("pagehide",o),a}function xd(){if(typeof window>"u"||typeof window.history?.replaceState!="function")return;const e=new URLSearchParams(window.location.search);if(!e.has("token"))return;e.delete("token");const n=e.toString(),i=window.location.pathname+(n?`?${n}`:"")+window.location.hash;window.history.replaceState(window.history.state,"",i)}function Sd(){return new URLSearchParams(window.location.search).get("token")}function Cd(){const e=document.getElementById("app");if(e===null)return;const n=Sd();if(n===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}za(n),xd(),wd(n),dd(),e.textContent="",Oa(r(yd,{}),e)}Cd();
|
|
40
|
+
//# sourceMappingURL=index-CrmZ34Rg.js.map
|