copilot-operator 0.1.88 → 0.1.90

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.
Files changed (44) hide show
  1. package/dist/src/api/operator.controller.js +66 -3
  2. package/dist/src/api/operator.service.js +141 -0
  3. package/dist/src/api/server.js +5 -1
  4. package/dist/src/cli.js +6 -0
  5. package/dist/src/config/live.js +1 -1
  6. package/dist/src/config/schema.js +12 -0
  7. package/dist/src/orchestrator/taskRunner.js +9 -2
  8. package/dist/src/plan/systemGuide.js +158 -0
  9. package/dist/src/session/locatorFailures.js +55 -0
  10. package/dist/src/transport/copilotTransport.js +310 -65
  11. package/dist/src/transport/keptWindow.js +3 -0
  12. package/dist/src/transport/locators.js +126 -5
  13. package/dist/src/transport/pageHtml.js +62 -0
  14. package/dist/web/404.html +2 -2
  15. package/dist/web/_next/static/chunks/{1077.26ca37faa3726fff.js → 1077.1cc6d439e3dd0fa9.js} +1 -1
  16. package/dist/web/_next/static/chunks/{1548.f5790cd11a91309f.js → 1548.3de9dc874e47558e.js} +1 -1
  17. package/dist/web/_next/static/chunks/{2163.aa9d9b82fcde6caa.js → 2163.66458fb9c54fb52d.js} +1 -1
  18. package/dist/web/_next/static/chunks/{714.b7dbce98ba0b59a8.js → 714.cffed2b87154be0f.js} +1 -1
  19. package/dist/web/_next/static/chunks/{7220.0ca53eefec5d01ea.js → 7220.30b6a3e1bd41e51a.js} +1 -1
  20. package/dist/web/_next/static/chunks/7921-d3a4a261e08950e0.js +1 -0
  21. package/dist/web/_next/static/chunks/{8584.9f3b058a8f67d3d7.js → 8584.36422ed19d6c43e9.js} +1 -1
  22. package/dist/web/_next/static/chunks/{9067.107f6164157e0aa1.js → 9067.e579f97591576de2.js} +1 -1
  23. package/dist/web/_next/static/chunks/{9747.984a86f70f9cd973.js → 9747.11247f0e21542f6d.js} +1 -1
  24. package/dist/web/_next/static/chunks/app/layout-7b5fa7c74ecd6939.js +1 -0
  25. package/dist/web/_next/static/chunks/app/queue/{page-317151444eda8115.js → page-7909ba7c9e3d4c2d.js} +1 -1
  26. package/dist/web/_next/static/chunks/app/settings/page-7651920337bbb580.js +1 -0
  27. package/dist/web/_next/static/chunks/{webpack-c015bbeb103c0856.js → webpack-78ec62098b09e4a0.js} +1 -1
  28. package/dist/web/_next/static/css/{0c5d6d5914aa3824.css → d74aa18c98dacdb4.css} +1 -1
  29. package/dist/web/defaults.html +2 -2
  30. package/dist/web/defaults.txt +8 -8
  31. package/dist/web/index.html +3 -3
  32. package/dist/web/index.txt +9 -9
  33. package/dist/web/queue.html +2 -2
  34. package/dist/web/queue.txt +9 -9
  35. package/dist/web/settings.html +2 -2
  36. package/dist/web/settings.txt +9 -9
  37. package/dist/web/system.html +2 -2
  38. package/dist/web/system.txt +9 -9
  39. package/package.json +3 -2
  40. package/dist/web/_next/static/chunks/7921-8f6503aba840928a.js +0 -1
  41. package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +0 -1
  42. package/dist/web/_next/static/chunks/app/settings/page-95069cb94d79e909.js +0 -1
  43. /package/dist/web/_next/static/{hLBBsG7Kn4vd0p_J-47BJ → 3VkK1sxEugkae88HSFR-i}/_buildManifest.js +0 -0
  44. /package/dist/web/_next/static/{hLBBsG7Kn4vd0p_J-47BJ → 3VkK1sxEugkae88HSFR-i}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{952:()=>{},1691:(e,t,n)=>{"use strict";n.d(t,{DR:()=>m,J1:()=>w,Lh:()=>h});var a=n(73365),l=n(1521),s=n(1702),i=n(15549),r=n(8205),o=n(87527),c=n(24872);function d(e){return"/settings?locator=".concat(encodeURIComponent(e),"#chat-locators")}function h(e){let{failure:t,inSettings:n=!1,onDismiss:l}=e,{t:s}=(0,r.kj)(),o=(0,r.W3)(),h=s("chatloc.".concat(t.key));return(0,a.jsxs)("div",{className:"notice ".concat(t.stopped?"":"caution"," locator-failure").trim(),role:"alert","data-locator":t.key,style:{overflowWrap:"anywhere"},children:[!n&&(0,a.jsx)("strong",{children:s(t.stopped?"chatloc.failTitle":"chatloc.warnTitle",{name:h})}),(0,a.jsxs)("p",{className:"small",style:{margin:"4px 0"},children:[s("chatloc.failWhen",{when:o(t.at)})," ",(0,a.jsx)("code",{className:"picker-example",children:t.locator})]}),t.why&&(0,a.jsx)("p",{className:"muted small",style:{margin:"4px 0"},children:t.why}),(0,a.jsxs)("div",{className:"row",style:{marginTop:6},children:[!n&&(0,a.jsx)("a",{className:"button-link",href:d(t.key),children:s("chatloc.fix")}),t.html&&(0,a.jsx)("a",{className:"button-link",href:i.FH.locatorHtmlUrl(t.key),download:!0,children:s("chatloc.html")}),(0,a.jsx)(c.i8,{text:t.prompt,what:"chatloc.promptWhy",label:"chatloc.prompt"}),(0,a.jsx)("button",{type:"button",className:"quiet",onClick:l,children:s("chatloc.dismiss")})]}),(0,a.jsx)("p",{className:"why",children:s("chatloc.how")})]})}let u="cop.locatorFailure.opened";function m(){let[e,t]=(0,l.useState)([]),n=async()=>{await i.FH.locatorFailures().then(e=>t(e.filter(e=>!e.changed))).catch(()=>void 0)};return(0,o.z)(n,5e3),{list:e,dismiss:async e=>{t(t=>t.filter(t=>t.key!==e)),await i.FH.dismissLocatorFailure(e).catch(()=>void 0)},reload:n}}function w(){let e=(0,s.usePathname)(),{list:t,dismiss:n}=m(),i="/settings"===e||"/settings/"===e;return((0,l.useEffect)(()=>{if(i)return;let e=t.find(e=>e.stopped);if(!e)return;let n="".concat(e.key,"@").concat(e.at),a=function(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(u))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}();if(!a.includes(n)){try{window.localStorage.setItem(u,JSON.stringify([...a,n].slice(-50)))}catch(e){return}window.location.assign(d(e.key))}},[t,i]),i||0===t.length)?null:(0,a.jsx)("div",{style:{marginBottom:12},children:t.map(e=>(0,a.jsx)(h,{failure:e,onDismiss:()=>void n(e.key)},e.key))})}},19050:(e,t,n)=>{"use strict";n.d(t,{Shell:()=>M});var a=n(73365),l=n(18197),s=n.n(l),i=n(1702),r=n(16752),o=n(36657),c=n(1521),d=n(98196),h=n(8205);let u={w:560,h:110};function m(e){if(0===e.getClientRects().length)return null;let t=e.getBoundingClientRect(),[n,a,l,s]=[t.left,t.top,t.right,t.bottom];for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){let e=window.getComputedStyle(t);if("visible"===e.overflowX&&"visible"===e.overflowY)continue;let i=t.getBoundingClientRect();[n,a,l,s]=[Math.max(n,i.left),Math.max(a,i.top),Math.min(l,i.right),Math.min(s,i.bottom)]}return[n,a,l,s]=[Math.max(n,0),Math.max(a,0),Math.min(l,window.innerWidth),Math.min(s,window.innerHeight)],l-n<4||s-a<4?null:{x:n,y:a,w:l-n,h:s-a}}function w(){let{t:e}=(0,h.kj)(),[t,n]=(0,c.useState)(0),[l,s]=(0,c.useState)([]),[i,r]=(0,c.useState)({w:0,h:0}),o=(0,c.useRef)(new Set);return((0,c.useEffect)(()=>{let e=()=>{let e=[...document.querySelectorAll("[data-awaits]")].filter(e=>e.getClientRects().length>0&&!e.closest("[data-kerrigan-thinking]"));for(let l of(n(e.length),e)){var t,a;let e=null!=(t=l.dataset.awaits)?t:"";o.current.has(e)||(o.current.add(e),l.closest("[data-follow]")||(null!=(a=l.closest("[data-awaits-frame]"))?a:l).scrollIntoView({block:"nearest"}),!function(){let e=document.activeElement;return e instanceof HTMLElement&&(e.isContentEditable||e.matches('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]), textarea, select'))}()&&l.focus({preventScroll:!0}))}},t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-awaits","hidden","data-kerrigan-thinking"]}),e(),()=>t.disconnect()},[]),(0,c.useEffect)(()=>{if(0===t)return void s([]);let e=0,n=()=>{let t=[...document.querySelectorAll("[data-awaits]")].filter(e=>!e.closest("[data-kerrigan-thinking]")).map(m).filter(e=>null!==e);s(e=>e.length===t.length&&e.every((e,n)=>.5>Math.abs(e.x-t[n].x)&&.5>Math.abs(e.y-t[n].y)&&.5>Math.abs(e.w-t[n].w)&&.5>Math.abs(e.h-t[n].h))?e:t),r(e=>e.w===window.innerWidth&&e.h===window.innerHeight?e:{w:window.innerWidth,h:window.innerHeight}),e=requestAnimationFrame(n)};return n(),()=>cancelAnimationFrame(e)},[t]),0===t||"undefined"==typeof document)?null:(0,d.createPortal)((0,a.jsxs)("div",{className:"awaiting",children:[(0,a.jsxs)("svg",{className:"awaiting-dim",width:i.w,height:i.h,"aria-hidden":"true",children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("mask",{id:"awaiting-holes",children:[(0,a.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),l.map((e,t)=>(0,a.jsx)("rect",{x:e.x-6,y:e.y-6,width:e.w+12,height:e.h+12,rx:"12",fill:"black"},t))]})}),(0,a.jsx)("rect",{className:"awaiting-shade",width:"100%",height:"100%",mask:"url(#awaiting-holes)"}),l.map((e,t)=>(0,a.jsx)("rect",{className:"awaiting-ring",x:e.x-6,y:e.y-6,width:e.w+12,height:e.h+12,rx:"12"},t))]}),(0,a.jsxs)("p",{className:"awaiting-label",role:"status",style:function(e,t,n){let a,l,s=Math.min(u.w,t-32),i=(e,t)=>({left:e,top:t,maxWidth:s});if(a=t/2,l=n/2,!e.some(e=>{let t,n;return t={x:a-s/2,y:l-u.h/2,w:s,h:u.h},n={x:e.x-6,y:e.y-6,w:e.w+12,h:e.h+12},t.x<n.x+n.w&&n.x<t.x+t.w&&t.y<n.y+n.h&&n.y<t.y+t.h}))return i(t/2,n/2);let r=Math.min(...e.map(e=>e.x))-6,o=t-Math.max(...e.map(e=>e.x+e.w))-6,c=Math.min(...e.map(e=>e.y))-6,d=n-Math.max(...e.map(e=>e.y+e.h))-6,h=[{fits:r>=s+32,size:r,place:()=>i(r/2,n/2)},{fits:o>=s+32,size:o,place:()=>i(t-o/2,n/2)},{fits:c>=u.h+32,size:c,place:()=>i(t/2,c/2)},{fits:d>=u.h+32,size:d,place:()=>i(t/2,n-d/2)}].filter(e=>e.fits);return h.length>0?h.sort((e,t)=>t.size-e.size)[0].place():i(t/2,u.h/2+16)}(l,i.w||window.innerWidth,i.h||window.innerHeight),children:[(0,a.jsx)("span",{className:"awaiting-dot","aria-hidden":"true"}),e("awaiting.title")]})]}),document.body)}var f=n(15549);function x(){let{t:e}=(0,h.kj)(),[t,n]=(0,c.useState)(null),l=(0,c.useRef)(null);return((0,c.useEffect)(()=>{let e=(0,f._G)(e=>{0!==e.running&&e.now.length+e.next.length+e.window.length!==0&&(n(e),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>n(null),9e3))});return()=>{e(),l.current&&clearTimeout(l.current)}},[]),t)?(0,a.jsxs)("div",{className:"settings-taken",role:"status","data-testid":"settings-taken",children:[(0,a.jsxs)("div",{className:"settings-taken-lines",children:[t.now.length>0&&(0,a.jsx)("p",{className:"settings-taken-now",children:e("live.now")}),t.next.length>0&&(0,a.jsx)("p",{children:e("live.next")}),t.window.length>0&&(0,a.jsx)("p",{children:e("live.window")})]}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn","aria-label":e("live.close"),title:e("live.close"),onClick:()=>n(null),children:"✕"})]}):null}var g=n(61238);let p="cop.done.seen";function y(){let{t:e}=(0,h.kj)(),t=(0,g.v)(),[n,l]=(0,c.useState)(""),[s,i]=(0,c.useState)(!1);(0,c.useEffect)(()=>l(function(){try{var e;return null!=(e=localStorage.getItem(p))?e:""}catch(e){return""}}()),[]),(0,c.useEffect)(()=>{let e=()=>i(null!==document.querySelector("[data-awaits]"));e();let t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-awaits"]}),()=>t.disconnect()},[]);let r=!t||t.running||t.starting||t.queue||!t.last||"aborted"===t.last.status?null:t.last,o=null!==r&&r.at!==n&&!s;if((0,c.useEffect)(()=>{if(!o||!r)return;let e=()=>{l(r.at);try{localStorage.setItem(p,r.at)}catch(e){}};return window.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",e,!0),()=>{window.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",e,!0)}},[o,r]),!o||!r||"undefined"==typeof document)return null;let u="done"===r.status;return(0,d.createPortal)((0,a.jsxs)("p",{className:u?"done-label":"done-label done-label-ended",role:"status","data-testid":"done-label",children:[u&&(0,a.jsx)("span",{className:"done-mark","aria-hidden":"true",children:"✓"}),u?e("done.label"):e("done.ended",{status:e("status.".concat(r.status))})]}),document.body)}var j=n(87527);function b(e){var t,n;let{failure:l,reason:s,onDismiss:i,intro:r,children:o}=e,{t:c}=(0,h.kj)(),d=(0,h.W3)(),u=null!=(n=null!=(t=null==l?void 0:l.message)?t:s)?n:"";return(0,a.jsxs)("div",{className:"notice caution start-failure",role:"alert",style:{overflowWrap:"anywhere"},children:[r&&(0,a.jsx)("p",{className:"small",style:{marginTop:0},children:r}),(0,a.jsx)("strong",{children:c("startfail.title")}),l&&(0,a.jsx)("p",{className:"small",style:{margin:"4px 0"},children:c("startfail.where",{stage:c("startfail.stage.".concat(l.stage))})}),(0,a.jsx)("pre",{className:"sync-cmd small",style:{margin:"6px 0"},children:u}),o,l&&(0,a.jsxs)("p",{className:"muted small",style:{margin:"4px 0"},children:[l.runId?c("startfail.when",{when:d(l.at),run:l.runId}):c("startfail.whenNoRun",{when:d(l.at)}),l.sessions.length>0?" \xb7 ".concat(l.sessions.map(e=>'"'.concat(e,'"')).join(", ")):""]}),(0,a.jsxs)("div",{className:"row",style:{marginTop:6},children:[l&&(0,a.jsx)("a",{className:"button-link",href:f.FH.startFailureUrl(l.id),download:!0,children:c("startfail.download")}),(0,a.jsx)("a",{className:l?"button-link":"button-link plain",href:f.FH.terminalUrl(),download:!0,children:c("startfail.terminal")}),i&&(0,a.jsx)("button",{type:"button",className:"quiet",onClick:i,children:c("startfail.dismiss")})]}),(0,a.jsx)("p",{className:"why",children:c("startfail.downloadWhy")})]})}let v="cop.startFailure.dismissed";function k(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(v))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}function N(){let{t:e}=(0,h.kj)(),[t,n]=(0,c.useState)([]),[l,s]=(0,c.useState)([]);(0,j.z)(()=>f.FH.startFailures(!0).then(e=>{n(e),s(k())}).catch(()=>void 0),5e3);let i=t.find(e=>!l.includes(e.id));return i?(0,a.jsx)("div",{style:{marginBottom:12},children:(0,a.jsx)(b,{failure:i,intro:e("at-turn"===i.stage?"startfail.laterSession":"startfail.later"),onDismiss:()=>{let e=[...new Set([...k(),i.id])].slice(-50);try{window.localStorage.setItem(v,JSON.stringify(e))}catch(e){}s(e)}})}):null}var S=n(1691),E=n(83285);function M(e){let{children:t}=e;return"/"===(0,i.usePathname)()?(0,a.jsxs)("div",{className:"wb-root",children:[(0,a.jsx)(o.U,{}),(0,a.jsx)(N,{}),(0,a.jsx)(S.J1,{}),(0,a.jsx)("main",{id:"main",className:"wb-main",children:t}),(0,a.jsx)(w,{}),(0,a.jsx)(x,{}),(0,a.jsx)(y,{})]}):(0,a.jsxs)("div",{className:"wrap",children:[(0,a.jsxs)("header",{className:"top",children:[(0,a.jsx)("h1",{children:(0,a.jsxs)(s(),{href:"/",className:"brand-link",children:[(0,a.jsx)(E.g,{}),"copilot-operator"]})}),(0,a.jsx)(r.s,{})]}),(0,a.jsx)(o.U,{}),(0,a.jsx)(N,{}),(0,a.jsx)(S.J1,{}),(0,a.jsx)("main",{id:"main",children:t}),(0,a.jsx)(w,{}),(0,a.jsx)(x,{}),(0,a.jsx)(y,{})]})}},66417:(e,t,n)=>{Promise.resolve().then(n.bind(n,51035)),Promise.resolve().then(n.t.bind(n,952,23)),Promise.resolve().then(n.bind(n,16752)),Promise.resolve().then(n.bind(n,87712)),Promise.resolve().then(n.bind(n,19050)),Promise.resolve().then(n.bind(n,98078)),Promise.resolve().then(n.bind(n,8205))},87712:(e,t,n)=>{"use strict";n.d(t,{ScrollJump:()=>i});var a=n(73365),l=n(1521),s=n(8205);function i(){let{t:e}=(0,s.kj)(),[t,n]=(0,l.useState)({long:!1,atTop:!0,atBottom:!1});return((0,l.useEffect)(()=>{let e=()=>{let e=document.documentElement;n({long:e.scrollHeight>2*window.innerHeight,atTop:window.scrollY<200,atBottom:window.innerHeight+window.scrollY>=e.scrollHeight-200})};e(),window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("resize",e);let t=new ResizeObserver(e);return t.observe(document.body),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),t.disconnect()}},[]),t.long)?(0,a.jsxs)("div",{className:"scroll-jump",children:[!t.atTop&&(0,a.jsx)("button",{type:"button","aria-label":e("scroll.top"),title:e("scroll.top"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"↑"}),!t.atBottom&&(0,a.jsx)("button",{type:"button","aria-label":e("scroll.bottom"),title:e("scroll.bottom"),onClick:()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"}),children:"↓"})]}):null}}},e=>{e.O(0,[7353,8197,7921,895,8124,2347,3131,7358],()=>e(e.s=66417)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8166],{43359:(e,l,a)=>{Promise.resolve().then(a.bind(a,96658))},96658:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>y});var s=a(73365),n=a(1521),i=a(18197),d=a.n(i),t=a(15549),r=a(8205),c=a(87527),o=a(41370),u=a(24784),m=a(5462),h=a(51035);let p={waiting:"q.waiting",running:"q.running",done:"q.done",failed:"q.failed",skipped:"q.skipped",stopped:"q.stopped",parked:"q.parked"},q="cop.queue.names";function x(e){let{items:l,titleOf:a}=e,{t:i}=(0,r.kj)(),[d,t]=(0,n.useState)(!1),[c,o]=(0,n.useState)(null);if((0,n.useEffect)(()=>{try{t("on"===window.localStorage.getItem(q))}catch(e){}},[]),0===l.length)return null;let u=new Map(l.map((e,l)=>[e.id,l])),m=l.flatMap((e,a)=>e.dependsOn.map(e=>u.get(e)).filter(e=>void 0!==e&&e<a).map(s=>({from:l[s],to:e,i:s,j:a,lift:Math.min(26+(a-s)*33.28,150)}))),h=Math.max(30,...m.map(e=>e.lift))+14+12,x=64+(l.length-1)*104+64,j=h+12+(d?34:14),g=c?l.find(e=>e.id===c):void 0,v=g?u.get(g.id):0;return(0,s.jsxs)("div",{className:"queue-graph",children:[(0,s.jsxs)("div",{className:"row queue-graph-head",children:[(0,s.jsx)("h3",{children:i("q.graph")}),(0,s.jsxs)("label",{className:"queue-graph-names",children:[(0,s.jsx)("input",{type:"checkbox",checked:d,onChange:e=>(e=>{t(e);try{window.localStorage.setItem(q,e?"on":"off")}catch(e){}})(e.target.checked)}),i("q.showNames")]})]}),(0,s.jsx)("p",{className:"muted small",children:i("q.graphWhy")}),(0,s.jsx)("div",{className:"queue-graph-scroll",children:(0,s.jsxs)("svg",{width:x,height:j,viewBox:"0 0 ".concat(x," ").concat(j),role:"img","aria-label":i("q.graphLabel",{n:l.length,links:m.length}),children:[(0,s.jsx)("defs",{children:(0,s.jsx)("marker",{id:"qg-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,s.jsx)("path",{d:"M0 0 L10 5 L0 10 z",className:"qg-arrowhead"})})}),(0,s.jsx)("line",{x1:64,y1:h,x2:64+(l.length-1)*104,y2:h,className:"qg-line"}),m.map(e=>{let l=64+104*e.i,a=64+104*e.j-7.199999999999999,n="failed"===e.from.status||"skipped"===e.from.status||"stopped"===e.from.status;return(0,s.jsx)("path",{d:"M ".concat(l," ").concat(h-12," C ").concat(l," ").concat(h-e.lift,", ").concat(a," ").concat(h-e.lift,", ").concat(a," ").concat(h-12),className:"qg-thread".concat(n?" is-broken":"").concat(c&&e.from.id!==c&&e.to.id!==c?" is-dim":""),markerEnd:"url(#qg-arrow)"},"".concat(e.from.id,"-").concat(e.to.id))}),l.map((e,l)=>{let n,t;return(0,s.jsxs)("g",{className:"qg-task s-".concat(e.status).concat((n=e.id,!c||n===c||m.some(e=>e.from.id===c&&e.to.id===n||e.to.id===c&&e.from.id===n))?"":" is-dim"),transform:"translate(".concat(64+104*l," ").concat(h,")"),tabIndex:0,"aria-label":"".concat(l+1,". ").concat(a(e)," — ").concat(i(p[e.status])),onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),onFocus:()=>o(e.id),onBlur:()=>o(null),children:[(0,s.jsx)("title",{children:"".concat(l+1,". ").concat(a(e)," — ").concat(i(p[e.status]))}),"running"===e.status&&(0,s.jsx)("circle",{r:17,className:"qg-pulse"}),(0,s.jsx)("circle",{r:12,className:"qg-dot"}),(0,s.jsx)("text",{className:"qg-n",dy:"0.35em",children:l+1}),d&&(0,s.jsx)("text",{className:"qg-name",y:28,children:(t=a(e)).length>15?"".concat(t.slice(0,14),"…"):t})]},e.id)})]})}),(0,s.jsx)("div",{className:"qg-tip","aria-live":"polite",children:g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("strong",{children:[v+1,". ",a(g)]}),(0,s.jsx)("span",{className:"queue-status s-".concat(g.status),children:i(p[g.status])}),g.dependsOn.length>0&&(0,s.jsx)("span",{className:"small muted",children:i("q.dependsOnList",{list:g.dependsOn.map(e=>{var l;return"#".concat((null!=(l=u.get(e))?l:0)+1)}).join(", ")})})]}):(0,s.jsx)("span",{className:"small muted",children:i("q.graphPoint")})}),(0,s.jsxs)("ul",{className:"qg-legend small muted","aria-hidden":"true",children:[["waiting","running","done","failed","skipped"].map(e=>(0,s.jsxs)("li",{children:[(0,s.jsx)("svg",{width:"12",height:"12",viewBox:"-7 -7 14 14",children:(0,s.jsx)("circle",{r:"6",className:"qg-dot s-".concat(e)})}),i(p[e])]},e)),(0,s.jsxs)("li",{children:[(0,s.jsx)("svg",{width:"26",height:"12",viewBox:"0 0 26 12",children:(0,s.jsx)("path",{d:"M 2 11 C 2 1, 24 1, 24 11",className:"qg-thread"})}),i("q.graphThread")]})]})]})}var j=a(34982);let g={name:"",prompt:"",model:"",dependsOn:[],branch:"folder",review:!0,reviewModel:"",lead:!1,workerModel:"",skill:"",plan:!0},v="cop.chat.thread",b={waiting:"q.waiting",running:"q.running",done:"q.done",failed:"q.failed",skipped:"q.skipped",stopped:"q.stopped",parked:"q.parked"},f=e=>{var l;return(null==(l=e.name)?void 0:l.trim())||e.prompt.split(/\r?\n/)[0].trim().slice(0,80)||"…"},k=e=>({id:e.id,...e.name?{name:e.name}:{},prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:e.review,...e.reviewModel?{reviewModel:e.reviewModel}:{},...e.lead?{lead:!0}:{},...e.workerModel?{workerModel:e.workerModel}:{},...e.skill?{skill:e.skill}:{},...e.plan?{plan:!0}:{}}),w=e=>({...e.name.trim()?{name:e.name.trim()}:{},prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:!e.lead&&e.review,...!e.lead&&e.review&&e.reviewModel?{reviewModel:e.reviewModel}:{},...e.lead?{lead:!0,...e.workerModel?{workerModel:e.workerModel}:{}}:{},...e.skill?{skill:e.skill}:{},...e.plan?{plan:!0}:{}}),N=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase();function y(){var e,l;let{t:a}=(0,r.kj)(),[i,p]=(0,n.useState)(null),[q,y]=(0,n.useState)(null),[F,C]=(0,n.useState)(null),[O,S]=(0,n.useState)(!1),[I,W]=(0,n.useState)([]),[L,H]=(0,n.useState)(g),[E,A]=(0,n.useState)(null),[B,_]=(0,n.useState)(""),[Q,D]=(0,n.useState)(!1),Y=(0,n.useCallback)(()=>t.FH.queue().then(p).catch(e=>_(e.message)),[]),[P,R]=(0,n.useState)(""),T=""!==P?P:String(null!=(e=null==i?void 0:i.parkAfterSec)?e:120),z=async()=>{if(""===P)return;let e=Number(P);if(!Number.isFinite(e)||e<0)return void R("");try{p(await t.FH.setQueueSettings(Math.round(e)))}catch(e){_(e.message)}finally{R("")}};(0,c.z)(Y,(null==i?void 0:i.running)?2e3:6e3),(0,n.useEffect)(()=>{t.FH.models().then(y).catch(()=>void 0),t.FH.workspace().then(C).catch(()=>void 0),t.FH.skills().then(e=>W(e.skills)).catch(()=>void 0),t.FH.settings().then(e=>{var l,a,s;let n=null!=(s=e.raw.copilot)?s:{},i=(null==(a=e.defaults)||null==(l=a.copilot)?void 0:l.manualModel)!==!1;S("boolean"==typeof n.manualModel?n.manualModel:i)}).catch(()=>void 0)},[]);let K=null!=(l=null==i?void 0:i.items)?l:[],U=e=>K.findIndex(l=>l.id===e)+1,X=async e=>{D(!0),_("");try{return p(await t.FH.setQueue(e)),!0}catch(e){return _(e.message),!1}finally{D(!1)}},Z=!!(null==i?void 0:i.busy)&&!i.running&&!E,$=async()=>{let e=K.map(k),l=E?e.findIndex(e=>e.id===E):-1;l>=0?e[l]={id:e[l].id,...w(L)}:e.push({id:function(e){let l=e.length+1;for(;e.some(e=>e.id==="q".concat(l));)l+=1;return"q".concat(l)}(K),...w(L)}),await X(e)&&(H(g),A(null),Z&&await V(t.FH.runQueue))},G=(e,l)=>{let a=K.map(k),s=a.findIndex(l=>l.id===e),n=s+l;s<0||n<0||n>=a.length||([a[s],a[n]]=[a[n],a[s]],X(a))},J=async e=>{await (0,h.Z)(a("q.removeConfirm",{title:f(e)}))&&X(K.filter(l=>l.id!==e.id).map(l=>({...k(l),dependsOn:l.dependsOn.filter(l=>l!==e.id)})))},V=async e=>{D(!0),_("");try{p(await e())}catch(e){_(e.message)}finally{D(!1)}},ee=I.filter(e=>!e.projectDir||(null==F?void 0:F.ok)&&N(e.projectDir)===N(F.dir)),el=L.skill&&!ee.some(e=>e.name===L.skill)?[...ee,{name:L.skill,description:"",text:"",projectDir:""}]:ee,ea=K.findIndex(e=>"running"===e.status),es=!!i&&!i.running&&ea>=0,en=(0,o.q)(es),ei=K.filter(e=>"waiting"===e.status).length,ed=(null==i?void 0:i.running)&&ea>=0?a("q.runningNow",{n:ea+1,of:K.length}):a("q.counts",{waiting:ei,done:K.filter(e=>"done"===e.status).length,failed:K.filter(e=>["failed","skipped","stopped"].includes(e.status)).length}),et=E?K.slice(0,Math.max(0,U(E)-1)):K,er=!!q&&K.some(e=>"waiting"===e.status&&(!e.model&&!(e.lead&&q.defaultLeadModel||q.defaultModel)||!e.lead&&e.review&&!e.reviewModel&&!q.defaultReviewModel));return(0,s.jsxs)("div",{className:"queue-page",children:[B&&(0,s.jsx)("div",{className:"panel err",role:"alert",children:B}),(0,s.jsxs)("section",{className:"panel",id:"queue","aria-labelledby":"queue-title",children:[(0,s.jsx)("h2",{id:"queue-title",children:a("q.title")}),(0,s.jsx)("p",{className:"muted small",children:a("q.intro")}),F&&(0,s.jsx)("p",{className:"small queue-folder",children:F.ok?a("q.folder",{dir:F.dir}):a("q.noFolder")}),O&&(0,s.jsxs)("p",{className:"why warned-text queue-by-hand",children:[a("q.byHand")," ",(0,s.jsx)(d(),{href:"/settings#model",children:a("q.byHandLink")})]}),er&&(0,s.jsxs)("p",{className:"why warned-text queue-no-model",children:[a("q.noModel")," ",(0,s.jsx)(d(),{href:"/settings#model",children:a("q.byHandLink")})]}),(null==i?void 0:i.busy)&&(0,s.jsx)(M,{busy:i.busy,running:i.running}),(0,s.jsxs)("div",{className:"settings-field queue-park-after",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-park-after",children:a("q.parkAfter")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.parkAfter")}),text:a("q.parkAfterWhy")})]}),(0,s.jsxs)("div",{className:"field-control",children:[(0,s.jsx)("input",{id:"queue-park-after",type:"number",min:0,max:86400,value:T,onChange:e=>R(e.target.value),onBlur:()=>void z(),onKeyDown:e=>{"Enter"===e.key&&z()}})," ",(0,s.jsx)("span",{className:"muted small",children:a("q.parkAfterUnit")})]})]}),(0,s.jsxs)("div",{className:"row queue-controls",children:[(null==i?void 0:i.running)||es?(0,s.jsx)("button",{onClick:()=>void V(t.FH.stopQueue),disabled:Q||es,"aria-busy":es||void 0,children:es?(0,s.jsxs)(s.Fragment,{children:[a("q.stopping"),(0,s.jsx)("span",{className:"saving-dots",children:en})]}):a("q.stop")}):(0,s.jsx)("button",{className:"primary",onClick:()=>void V(t.FH.runQueue),disabled:Q||0===ei||!i,children:a("q.run")}),i&&(0,s.jsx)("span",{className:"muted small",role:"status",children:ed})]}),(0,s.jsx)(x,{items:K,titleOf:f}),i?0===K.length?(0,s.jsx)("p",{className:"muted",children:a("q.empty")}):(0,s.jsx)("ol",{className:"queue-list",children:K.map((e,l)=>(0,s.jsxs)("li",{className:"queue-item is-".concat(e.status).concat(E===e.id?" is-editing":""),"data-id":e.id,children:[(0,s.jsxs)("div",{className:"queue-head",children:[(0,s.jsx)("span",{className:"queue-n",children:l+1}),(0,s.jsx)("span",{className:"queue-status s-".concat(e.status),children:a(b[e.status])}),(0,s.jsx)("span",{className:"queue-title",children:f(e)})]}),(0,s.jsxs)("div",{className:"queue-meta small muted",children:[e.lead?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:a("q.leadOn")}),(0,s.jsx)("span",{children:a("q.leadIs",{model:e.model||a("q.settingsModel")})}),(0,s.jsx)("span",{children:a("q.workerIs",{model:e.workerModel||a("q.settingsModel")})})]}):(0,s.jsx)("span",{children:e.model||a("q.settingsModel")}),(0,s.jsx)("span",{children:"main"===e.branch?a("q.branchMain"):a("q.branchFolder")}),e.review&&(0,s.jsx)("span",{children:e.reviewModel?a("q.reviewOnModel",{model:e.reviewModel}):a("q.reviewOn")}),e.dependsOn.length>0&&(0,s.jsx)("span",{children:a("q.dependsOnList",{list:e.dependsOn.map(e=>"#".concat(U(e))).join(", ")})}),e.skill&&(0,s.jsx)("span",{className:"queue-skill",children:a("q.skillIs",{name:e.skill})}),e.plan&&(0,s.jsx)("span",{children:a("q.planOn")}),e.branchName&&(0,s.jsx)("span",{className:"queue-skill",title:e.branchFrom?a("q.branchFromWhy",{from:e.branchFrom}):void 0,children:a("q.branchIs",{name:e.branchName})})]}),e.name&&e.name.trim()!==e.prompt.trim()&&(0,s.jsx)("div",{className:"small queue-prompt",children:e.prompt.split(/\r?\n/)[0]}),e.why&&(0,s.jsx)("div",{className:"small queue-why",children:e.why}),"parked"===e.status&&e.waitsFor&&(0,s.jsx)("div",{className:"queue-parked",children:(0,s.jsx)(j.a,{parked:e.waitsFor,onAnswer:async l=>p(await t.FH.answerParked(e.id,l))})}),(0,s.jsxs)("div",{className:"row queue-actions",children:[e.sessionId&&(0,s.jsx)(d(),{href:"/",onClick:()=>(e=>{try{window.localStorage.setItem(v,e)}catch(e){}})(e.sessionId),children:a("q.openChat")}),"running"!==e.status&&(0,s.jsxs)(s.Fragment,{children:["waiting"===e.status?(0,s.jsx)("button",{className:"quiet",onClick:()=>{var l,a,s,n,i;A(e.id),H({name:null!=(a=e.name)?a:"",prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:e.review,reviewModel:null!=(s=e.reviewModel)?s:"",lead:!!e.lead,workerModel:null!=(n=e.workerModel)?n:"",skill:null!=(i=e.skill)?i:"",plan:!!e.plan}),null==(l=document.getElementById("queue-name"))||l.focus()},disabled:Q,children:a("q.edit")}):(0,s.jsx)("button",{className:"quiet",onClick:()=>{let l;return l=e.id,void X(K.map(e=>e.id===l?{...k(e),status:"waiting"}:k(e)))},disabled:Q,children:a("q.again")}),(0,s.jsx)("button",{className:"quiet",onClick:()=>G(e.id,-1),disabled:Q||0===l,"aria-label":a("q.up"),title:a("q.up"),children:"↑"}),(0,s.jsx)("button",{className:"quiet",onClick:()=>G(e.id,1),disabled:Q||l===K.length-1,"aria-label":a("q.down"),title:a("q.down"),children:"↓"}),(0,s.jsx)("button",{className:"quiet",onClick:()=>void J(e),disabled:Q,children:a("q.remove")})]})]})]},e.id))}):(0,s.jsx)("p",{className:"muted small",children:a("q.loading")})]}),(0,s.jsxs)("section",{className:"panel",id:"queue-add","aria-labelledby":"queue-add-title",children:[(0,s.jsx)("h2",{id:"queue-add-title",children:E?a("q.editTitle",{n:U(E)}):a("q.addTitle")}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-name",children:a("q.name")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.name")}),text:a("q.nameWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)("input",{id:"queue-name",type:"text",maxLength:80,value:L.name,placeholder:L.prompt?f({prompt:L.prompt}):"",onChange:e=>H({...L,name:e.target.value})})})]}),(0,s.jsx)("label",{htmlFor:"queue-prompt",children:a("q.prompt")}),(0,s.jsx)("textarea",{id:"queue-prompt",rows:5,value:L.prompt,onChange:e=>H({...L,prompt:e.target.value})}),(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-plan",type:"checkbox",checked:L.plan,onChange:e=>H({...L,plan:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-plan",children:a("q.plan")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.plan")}),text:a("q.planWhy")})]})}),(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-lead",type:"checkbox",checked:L.lead,onChange:e=>H({...L,lead:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-lead",children:a("q.lead")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.lead")}),text:a("q.leadWhy")})]})}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-model",children:L.lead?a("q.leadModel"):a("q.model")}),(0,s.jsx)(m.q,{label:a("info.about",{name:L.lead?a("q.leadModel"):a("q.model")}),text:L.lead?a("q.leadModelWhy"):a("q.modelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-model",chosen:L.model,onChange:e=>H({...L,model:e}),none:a("q.modelSettings",{name:L.lead&&(null==q?void 0:q.defaultLeadModel)||(null==q?void 0:q.defaultModel)||"—"}),catalogue:q})})]}),L.lead&&(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-worker-model",children:a("q.workerModel")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.workerModel")}),text:a("q.workerModelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-worker-model",chosen:L.workerModel,onChange:e=>H({...L,workerModel:e}),none:a("q.modelSettings",{name:(null==q?void 0:q.defaultModel)||L.model||(null==q?void 0:q.defaultLeadModel)||"—"}),catalogue:q})})]}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-branch",children:a("q.branch")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.branch")}),text:a("q.branchWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsxs)("select",{id:"queue-branch",value:L.branch,onChange:e=>H({...L,branch:"main"===e.target.value?"main":"folder"}),children:[(0,s.jsx)("option",{value:"folder",children:a("q.branchFolder")}),(0,s.jsx)("option",{value:"main",children:a("q.branchMain")})]})})]}),!L.lead&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-review",type:"checkbox",checked:L.review,onChange:e=>H({...L,review:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-review",children:a("q.review")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.review")}),text:a("q.reviewWhy")})]})}),L.review&&(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-review-model",children:a("q.reviewModel")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.reviewModel")}),text:a("q.reviewModelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-review-model",chosen:L.reviewModel,onChange:e=>H({...L,reviewModel:e}),none:a("q.modelSettings",{name:(null==q?void 0:q.defaultReviewModel)||"—"}),catalogue:q})})]})]}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-skill",children:a("q.skill")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.skill")}),text:a("q.skillWhy")})]}),(0,s.jsxs)("div",{className:"field-control queue-skill-pick",children:[(0,s.jsxs)("select",{id:"queue-skill",value:L.skill,onChange:e=>H({...L,skill:e.target.value}),children:[(0,s.jsx)("option",{value:"",children:a("chat.skillNone")}),el.map(e=>(0,s.jsxs)("option",{value:e.name,title:e.description||void 0,children:["/",e.name]},e.name))]}),(0,s.jsx)(d(),{href:"/settings#skills",className:"button-link plain small",title:a("chat.skillsLinkWhy"),children:a("chat.skillsLink")})]})]}),et.length>0&&(0,s.jsxs)("fieldset",{className:"queue-depends",children:[(0,s.jsxs)("legend",{className:"field-label",children:[(0,s.jsx)("span",{className:"field-name",children:a("q.dependsOn")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.dependsOn")}),text:a("q.dependsOnWhy")})]}),et.map(e=>(0,s.jsxs)("label",{className:"queue-dep",children:[(0,s.jsx)("input",{type:"checkbox",checked:L.dependsOn.includes(e.id),onChange:l=>H({...L,dependsOn:l.target.checked?[...L.dependsOn,e.id]:L.dependsOn.filter(l=>l!==e.id)})}),(0,s.jsxs)("span",{children:["#",U(e.id)," ",f(e)]})]},e.id))]}),Q&&"main"===L.branch&&(0,s.jsx)("p",{className:"small muted queue-preparing",role:"status",children:a("q.preparing")}),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)("button",{className:"primary",onClick:()=>void $(),disabled:Q||!L.prompt.trim(),title:Z?a("q.addAfterWhy"):void 0,children:E?a("q.save"):Z?a("q.addAfter"):a("q.add")}),E&&(0,s.jsx)("button",{className:"quiet",onClick:()=>{A(null),H(g)},children:a("q.cancel")})]})]})]})}function M(e){let{busy:l,running:a}=e,{t:n}=(0,r.kj)(),i="chat"===l.kind?n("q.busyChat",{title:l.title}):n("models"===l.kind?"q.busyModels":"q.busyLogin");return(0,s.jsxs)("p",{className:"small queue-busy",role:"status",children:[(0,s.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",n(a?"q.busyRunning":"q.busyIdle",{what:i})," ","chat"===l.kind&&(0,s.jsx)(d(),{href:"/",onClick:()=>{try{window.localStorage.setItem(v,l.sessionId)}catch(e){}},children:n("q.openChat")})]})}}},e=>{e.O(0,[8197,7921,895,1024,2347,3131,7358],()=>e(e.s=43359)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8166],{43359:(e,l,a)=>{Promise.resolve().then(a.bind(a,96658))},96658:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>y});var s=a(73365),n=a(1521),i=a(18197),d=a.n(i),t=a(15549),r=a(8205),c=a(87527),o=a(41370),u=a(24784),m=a(5462),h=a(51035);let p={waiting:"q.waiting",running:"q.running",done:"q.done",failed:"q.failed",skipped:"q.skipped",stopped:"q.stopped",parked:"q.parked"},q="cop.queue.names";function x(e){let{items:l,titleOf:a}=e,{t:i}=(0,r.kj)(),[d,t]=(0,n.useState)(!1),[c,o]=(0,n.useState)(null);if((0,n.useEffect)(()=>{try{t("on"===window.localStorage.getItem(q))}catch(e){}},[]),0===l.length)return null;let u=new Map(l.map((e,l)=>[e.id,l])),m=l.flatMap((e,a)=>e.dependsOn.map(e=>u.get(e)).filter(e=>void 0!==e&&e<a).map(s=>({from:l[s],to:e,i:s,j:a,lift:Math.min(26+(a-s)*33.28,150)}))),h=Math.max(30,...m.map(e=>e.lift))+14+12,x=64+(l.length-1)*104+64,j=h+12+(d?34:14),g=c?l.find(e=>e.id===c):void 0,v=g?u.get(g.id):0;return(0,s.jsxs)("div",{className:"queue-graph",children:[(0,s.jsxs)("div",{className:"row queue-graph-head",children:[(0,s.jsx)("h3",{children:i("q.graph")}),(0,s.jsxs)("label",{className:"queue-graph-names",children:[(0,s.jsx)("input",{type:"checkbox",checked:d,onChange:e=>(e=>{t(e);try{window.localStorage.setItem(q,e?"on":"off")}catch(e){}})(e.target.checked)}),i("q.showNames")]})]}),(0,s.jsx)("p",{className:"muted small",children:i("q.graphWhy")}),(0,s.jsx)("div",{className:"queue-graph-scroll",children:(0,s.jsxs)("svg",{width:x,height:j,viewBox:"0 0 ".concat(x," ").concat(j),role:"img","aria-label":i("q.graphLabel",{n:l.length,links:m.length}),children:[(0,s.jsx)("defs",{children:(0,s.jsx)("marker",{id:"qg-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,s.jsx)("path",{d:"M0 0 L10 5 L0 10 z",className:"qg-arrowhead"})})}),(0,s.jsx)("line",{x1:64,y1:h,x2:64+(l.length-1)*104,y2:h,className:"qg-line"}),m.map(e=>{let l=64+104*e.i,a=64+104*e.j-7.199999999999999,n="failed"===e.from.status||"skipped"===e.from.status||"stopped"===e.from.status;return(0,s.jsx)("path",{d:"M ".concat(l," ").concat(h-12," C ").concat(l," ").concat(h-e.lift,", ").concat(a," ").concat(h-e.lift,", ").concat(a," ").concat(h-12),className:"qg-thread".concat(n?" is-broken":"").concat(c&&e.from.id!==c&&e.to.id!==c?" is-dim":""),markerEnd:"url(#qg-arrow)"},"".concat(e.from.id,"-").concat(e.to.id))}),l.map((e,l)=>{let n,t;return(0,s.jsxs)("g",{className:"qg-task s-".concat(e.status).concat((n=e.id,!c||n===c||m.some(e=>e.from.id===c&&e.to.id===n||e.to.id===c&&e.from.id===n))?"":" is-dim"),transform:"translate(".concat(64+104*l," ").concat(h,")"),tabIndex:0,"aria-label":"".concat(l+1,". ").concat(a(e)," — ").concat(i(p[e.status])),onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),onFocus:()=>o(e.id),onBlur:()=>o(null),children:[(0,s.jsx)("title",{children:"".concat(l+1,". ").concat(a(e)," — ").concat(i(p[e.status]))}),"running"===e.status&&(0,s.jsx)("circle",{r:17,className:"qg-pulse"}),(0,s.jsx)("circle",{r:12,className:"qg-dot"}),(0,s.jsx)("text",{className:"qg-n",dy:"0.35em",children:l+1}),d&&(0,s.jsx)("text",{className:"qg-name",y:28,children:(t=a(e)).length>15?"".concat(t.slice(0,14),"…"):t})]},e.id)})]})}),(0,s.jsx)("div",{className:"qg-tip","aria-live":"polite",children:g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("strong",{children:[v+1,". ",a(g)]}),(0,s.jsx)("span",{className:"queue-status s-".concat(g.status),children:i(p[g.status])}),g.dependsOn.length>0&&(0,s.jsx)("span",{className:"small muted",children:i("q.dependsOnList",{list:g.dependsOn.map(e=>{var l;return"#".concat((null!=(l=u.get(e))?l:0)+1)}).join(", ")})})]}):(0,s.jsx)("span",{className:"small muted",children:i("q.graphPoint")})}),(0,s.jsxs)("ul",{className:"qg-legend small muted","aria-hidden":"true",children:[["waiting","running","done","failed","skipped"].map(e=>(0,s.jsxs)("li",{children:[(0,s.jsx)("svg",{width:"12",height:"12",viewBox:"-7 -7 14 14",children:(0,s.jsx)("circle",{r:"6",className:"qg-dot s-".concat(e)})}),i(p[e])]},e)),(0,s.jsxs)("li",{children:[(0,s.jsx)("svg",{width:"26",height:"12",viewBox:"0 0 26 12",children:(0,s.jsx)("path",{d:"M 2 11 C 2 1, 24 1, 24 11",className:"qg-thread"})}),i("q.graphThread")]})]})]})}var j=a(34982);let g={name:"",prompt:"",model:"",dependsOn:[],branch:"folder",review:!0,reviewModel:"",lead:!1,workerModel:"",skill:"",plan:!0},v="cop.chat.thread",b={waiting:"q.waiting",running:"q.running",done:"q.done",failed:"q.failed",skipped:"q.skipped",stopped:"q.stopped",parked:"q.parked"},f=e=>{var l;return(null==(l=e.name)?void 0:l.trim())||e.prompt.split(/\r?\n/)[0].trim().slice(0,80)||"…"},k=e=>({id:e.id,...e.name?{name:e.name}:{},prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:e.review,...e.reviewModel?{reviewModel:e.reviewModel}:{},...e.lead?{lead:!0}:{},...e.workerModel?{workerModel:e.workerModel}:{},...e.skill?{skill:e.skill}:{},...e.plan?{plan:!0}:{}}),w=e=>({...e.name.trim()?{name:e.name.trim()}:{},prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:!e.lead&&e.review,...!e.lead&&e.review&&e.reviewModel?{reviewModel:e.reviewModel}:{},...e.lead?{lead:!0,...e.workerModel?{workerModel:e.workerModel}:{}}:{},...e.skill?{skill:e.skill}:{},...e.plan?{plan:!0}:{}}),N=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase();function y(){var e,l;let{t:a}=(0,r.kj)(),[i,p]=(0,n.useState)(null),[q,y]=(0,n.useState)(null),[F,C]=(0,n.useState)(null),[O,S]=(0,n.useState)(!1),[I,L]=(0,n.useState)([]),[W,H]=(0,n.useState)(g),[E,A]=(0,n.useState)(null),[B,_]=(0,n.useState)(""),[Q,D]=(0,n.useState)(!1),Y=(0,n.useCallback)(()=>t.FH.queue().then(p).catch(e=>_(e.message)),[]),[P,R]=(0,n.useState)(""),T=""!==P?P:String(null!=(e=null==i?void 0:i.parkAfterSec)?e:120),z=async()=>{if(""===P)return;let e=Number(P);if(!Number.isFinite(e)||e<0)return void R("");try{p(await t.FH.setQueueSettings(Math.round(e)))}catch(e){_(e.message)}finally{R("")}};(0,c.z)(Y,(null==i?void 0:i.running)?2e3:6e3),(0,n.useEffect)(()=>{t.FH.models().then(y).catch(()=>void 0),t.FH.workspace().then(C).catch(()=>void 0),t.FH.skills().then(e=>L(e.skills)).catch(()=>void 0),t.FH.settings().then(e=>{var l,a,s;let n=null!=(s=e.raw.copilot)?s:{},i=(null==(a=e.defaults)||null==(l=a.copilot)?void 0:l.manualModel)!==!1;S("boolean"==typeof n.manualModel?n.manualModel:i)}).catch(()=>void 0)},[]);let K=null!=(l=null==i?void 0:i.items)?l:[],U=e=>K.findIndex(l=>l.id===e)+1,X=async e=>{D(!0),_("");try{return p(await t.FH.setQueue(e)),!0}catch(e){return _(e.message),!1}finally{D(!1)}},Z=!!(null==i?void 0:i.busy)&&!i.running&&!E,$=async()=>{let e=K.map(k),l=E?e.findIndex(e=>e.id===E):-1;l>=0?e[l]={id:e[l].id,...w(W)}:e.push({id:function(e){let l=e.length+1;for(;e.some(e=>e.id==="q".concat(l));)l+=1;return"q".concat(l)}(K),...w(W)}),await X(e)&&(H(g),A(null),Z&&await V(t.FH.runQueue))},G=(e,l)=>{let a=K.map(k),s=a.findIndex(l=>l.id===e),n=s+l;s<0||n<0||n>=a.length||([a[s],a[n]]=[a[n],a[s]],X(a))},J=async e=>{await (0,h.Z)(a("q.removeConfirm",{title:f(e)}))&&X(K.filter(l=>l.id!==e.id).map(l=>({...k(l),dependsOn:l.dependsOn.filter(l=>l!==e.id)})))},V=async e=>{D(!0),_("");try{p(await e())}catch(e){_(e.message)}finally{D(!1)}},ee=I.filter(e=>!e.projectDir||(null==F?void 0:F.ok)&&N(e.projectDir)===N(F.dir)),el=W.skill&&!ee.some(e=>e.name===W.skill)?[...ee,{name:W.skill,description:"",text:"",projectDir:""}]:ee,ea=K.findIndex(e=>"running"===e.status),es=!!i&&!i.running&&ea>=0,en=(0,o.q)(es),ei=K.filter(e=>"waiting"===e.status).length,ed=(null==i?void 0:i.running)&&ea>=0?a("q.runningNow",{n:ea+1,of:K.length}):a("q.counts",{waiting:ei,done:K.filter(e=>"done"===e.status).length,failed:K.filter(e=>["failed","skipped","stopped"].includes(e.status)).length}),et=E?K.slice(0,Math.max(0,U(E)-1)):K,er=!!q&&K.some(e=>"waiting"===e.status&&(!e.model&&!(e.lead&&q.defaultLeadModel||q.defaultModel)||!e.lead&&e.review&&!e.reviewModel&&!q.defaultReviewModel));return(0,s.jsxs)("div",{className:"queue-page",children:[B&&(0,s.jsx)("div",{className:"panel err",role:"alert",children:B}),(0,s.jsxs)("section",{className:"panel",id:"queue","aria-labelledby":"queue-title",children:[(0,s.jsx)("h2",{id:"queue-title",children:a("q.title")}),(0,s.jsx)("p",{className:"muted small",children:a("q.intro")}),F&&(0,s.jsx)("p",{className:"small queue-folder",children:F.ok?a("q.folder",{dir:F.dir}):a("q.noFolder")}),O&&(0,s.jsxs)("p",{className:"why warned-text queue-by-hand",children:[a("q.byHand")," ",(0,s.jsx)(d(),{href:"/settings#model",children:a("q.byHandLink")})]}),er&&(0,s.jsxs)("p",{className:"why warned-text queue-no-model",children:[a("q.noModel")," ",(0,s.jsx)(d(),{href:"/settings#model",children:a("q.byHandLink")})]}),(null==i?void 0:i.busy)&&(0,s.jsx)(M,{busy:i.busy,running:i.running}),(0,s.jsxs)("div",{className:"settings-field queue-park-after",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-park-after",children:a("q.parkAfter")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.parkAfter")}),text:a("q.parkAfterWhy")})]}),(0,s.jsxs)("div",{className:"field-control",children:[(0,s.jsx)("input",{id:"queue-park-after",type:"number",min:0,max:86400,value:T,onChange:e=>R(e.target.value),onBlur:()=>void z(),onKeyDown:e=>{"Enter"===e.key&&z()}})," ",(0,s.jsx)("span",{className:"muted small",children:a("q.parkAfterUnit")})]})]}),(0,s.jsxs)("div",{className:"row queue-controls",children:[(null==i?void 0:i.running)||es?(0,s.jsx)("button",{onClick:()=>void V(t.FH.stopQueue),disabled:Q||es,"aria-busy":es||void 0,children:es?(0,s.jsxs)(s.Fragment,{children:[a("q.stopping"),(0,s.jsx)("span",{className:"saving-dots",children:en})]}):a("q.stop")}):(0,s.jsx)("button",{className:"primary",onClick:()=>void V(t.FH.runQueue),disabled:Q||0===ei||!i,children:a("q.run")}),i&&(0,s.jsx)("span",{className:"muted small",role:"status",children:ed})]}),(0,s.jsx)(x,{items:K,titleOf:f}),i?0===K.length?(0,s.jsx)("p",{className:"muted",children:a("q.empty")}):(0,s.jsx)("ol",{className:"queue-list",children:K.map((e,l)=>(0,s.jsxs)("li",{className:"queue-item is-".concat(e.status).concat(E===e.id?" is-editing":""),"data-id":e.id,children:[(0,s.jsxs)("div",{className:"queue-head",children:[(0,s.jsx)("span",{className:"queue-n",children:l+1}),(0,s.jsx)("span",{className:"queue-status s-".concat(e.status),children:a(b[e.status])}),(0,s.jsx)("span",{className:"queue-title",children:f(e)})]}),(0,s.jsxs)("div",{className:"queue-meta small muted",children:[e.lead?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:a("q.leadOn")}),(0,s.jsx)("span",{children:a("q.leadIs",{model:e.model||a("q.settingsModel")})}),(0,s.jsx)("span",{children:a("q.workerIs",{model:e.workerModel||a("q.settingsModel")})})]}):(0,s.jsx)("span",{children:e.model||a("q.settingsModel")}),(0,s.jsx)("span",{children:"main"===e.branch?a("q.branchMain"):a("q.branchFolder")}),e.review&&(0,s.jsx)("span",{children:e.reviewModel?a("q.reviewOnModel",{model:e.reviewModel}):a("q.reviewOn")}),e.dependsOn.length>0&&(0,s.jsx)("span",{children:a("q.dependsOnList",{list:e.dependsOn.map(e=>"#".concat(U(e))).join(", ")})}),e.skill&&(0,s.jsx)("span",{className:"queue-skill",children:a("q.skillIs",{name:e.skill})}),e.plan&&(0,s.jsx)("span",{children:a("q.planOn")}),e.branchName&&(0,s.jsx)("span",{className:"queue-skill",title:e.branchFrom?a("q.branchFromWhy",{from:e.branchFrom}):void 0,children:a("q.branchIs",{name:e.branchName})})]}),e.name&&e.name.trim()!==e.prompt.trim()&&(0,s.jsx)("div",{className:"small queue-prompt",children:e.prompt.split(/\r?\n/)[0]}),e.why&&(0,s.jsx)("div",{className:"small queue-why",children:e.why}),"parked"===e.status&&e.waitsFor&&(0,s.jsx)("div",{className:"queue-parked",children:(0,s.jsx)(j.a,{parked:e.waitsFor,onAnswer:async l=>p(await t.FH.answerParked(e.id,l))})}),(0,s.jsxs)("div",{className:"row queue-actions",children:[e.sessionId&&(0,s.jsx)(d(),{href:"/",onClick:()=>(e=>{try{window.localStorage.setItem(v,e)}catch(e){}})(e.sessionId),children:a("q.openChat")}),"running"!==e.status&&(0,s.jsxs)(s.Fragment,{children:["waiting"===e.status?(0,s.jsx)("button",{className:"quiet",onClick:()=>{var l,a,s,n,i;A(e.id),H({name:null!=(a=e.name)?a:"",prompt:e.prompt,model:e.model,dependsOn:e.dependsOn,branch:e.branch,review:e.review,reviewModel:null!=(s=e.reviewModel)?s:"",lead:!!e.lead,workerModel:null!=(n=e.workerModel)?n:"",skill:null!=(i=e.skill)?i:"",plan:!!e.plan}),null==(l=document.getElementById("queue-name"))||l.focus()},disabled:Q,children:a("q.edit")}):(0,s.jsx)("button",{className:"quiet",onClick:()=>{let l;return l=e.id,void X(K.map(e=>e.id===l?{...k(e),status:"waiting"}:k(e)))},disabled:Q,children:a("q.again")}),(0,s.jsx)("button",{className:"quiet",onClick:()=>G(e.id,-1),disabled:Q||0===l,"aria-label":a("q.up"),title:a("q.up"),children:"↑"}),(0,s.jsx)("button",{className:"quiet",onClick:()=>G(e.id,1),disabled:Q||l===K.length-1,"aria-label":a("q.down"),title:a("q.down"),children:"↓"}),(0,s.jsx)("button",{className:"quiet",onClick:()=>void J(e),disabled:Q,children:a("q.remove")})]})]})]},e.id))}):(0,s.jsx)("p",{className:"muted small",children:a("q.loading")})]}),(0,s.jsxs)("section",{className:"panel",id:"queue-add","aria-labelledby":"queue-add-title",children:[(0,s.jsx)("h2",{id:"queue-add-title",children:E?a("q.editTitle",{n:U(E)}):a("q.addTitle")}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-name",children:a("q.name")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.name")}),text:a("q.nameWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)("input",{id:"queue-name",type:"text",maxLength:80,value:W.name,placeholder:W.prompt?f({prompt:W.prompt}):"",onChange:e=>H({...W,name:e.target.value})})})]}),(0,s.jsx)("label",{htmlFor:"queue-prompt",children:a("q.prompt")}),(0,s.jsx)("textarea",{id:"queue-prompt",rows:5,value:W.prompt,onChange:e=>H({...W,prompt:e.target.value})}),(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-plan",type:"checkbox",checked:W.plan,onChange:e=>H({...W,plan:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-plan",children:a("q.plan")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.plan")}),text:a("q.planWhy")})]})}),(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-lead",type:"checkbox",checked:W.lead,onChange:e=>H({...W,lead:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-lead",children:a("q.lead")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.lead")}),text:a("q.leadWhy")})]})}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-model",children:W.lead?a("q.leadModel"):a("q.model")}),(0,s.jsx)(m.q,{label:a("info.about",{name:W.lead?a("q.leadModel"):a("q.model")}),text:W.lead?a("q.leadModelWhy"):a("q.modelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-model",chosen:W.model,onChange:e=>H({...W,model:e}),none:a("q.modelSettings",{name:W.lead&&(null==q?void 0:q.defaultLeadModel)||(null==q?void 0:q.defaultModel)||"—"}),catalogue:q})})]}),W.lead&&(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-worker-model",children:a("q.workerModel")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.workerModel")}),text:a("q.workerModelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-worker-model",chosen:W.workerModel,onChange:e=>H({...W,workerModel:e}),none:a("q.modelSettings",{name:(null==q?void 0:q.defaultModel)||W.model||(null==q?void 0:q.defaultLeadModel)||"—"}),catalogue:q})})]}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-branch",children:a("q.branch")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.branch")}),text:a("q.branchWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsxs)("select",{id:"queue-branch",value:W.branch,onChange:e=>H({...W,branch:"main"===e.target.value?"main":"folder"}),children:[(0,s.jsx)("option",{value:"folder",children:a("q.branchFolder")}),(0,s.jsx)("option",{value:"main",children:a("q.branchMain")})]})})]}),!W.lead&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"settings-field",children:(0,s.jsxs)("div",{className:"field-label check-label",children:[(0,s.jsx)("input",{id:"queue-review",type:"checkbox",checked:W.review,onChange:e=>H({...W,review:e.target.checked})}),(0,s.jsx)("label",{htmlFor:"queue-review",children:a("q.review")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.review")}),text:a("q.reviewWhy")})]})}),W.review&&(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-review-model",children:a("q.reviewModel")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.reviewModel")}),text:a("q.reviewModelWhy")})]}),(0,s.jsx)("div",{className:"field-control",children:(0,s.jsx)(u.Yb,{id:"queue-review-model",chosen:W.reviewModel,onChange:e=>H({...W,reviewModel:e}),none:a("q.modelSettings",{name:(null==q?void 0:q.defaultReviewModel)||"—"}),catalogue:q})})]})]}),(0,s.jsxs)("div",{className:"settings-field",children:[(0,s.jsxs)("div",{className:"field-label",children:[(0,s.jsx)("label",{htmlFor:"queue-skill",children:a("q.skill")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.skill")}),text:a("q.skillWhy")})]}),(0,s.jsxs)("div",{className:"field-control queue-skill-pick",children:[(0,s.jsxs)("select",{id:"queue-skill",value:W.skill,onChange:e=>H({...W,skill:e.target.value}),children:[(0,s.jsx)("option",{value:"",children:a("chat.skillNone")}),el.map(e=>(0,s.jsxs)("option",{value:e.name,title:e.description||void 0,children:["/",e.name]},e.name))]}),(0,s.jsx)(d(),{href:"/settings#skills",className:"button-link plain small",title:a("chat.skillsLinkWhy"),children:a("chat.skillsLink")})]})]}),et.length>0&&(0,s.jsxs)("fieldset",{className:"queue-depends",children:[(0,s.jsxs)("legend",{className:"field-label",children:[(0,s.jsx)("span",{className:"field-name",children:a("q.dependsOn")}),(0,s.jsx)(m.q,{label:a("info.about",{name:a("q.dependsOn")}),text:a("q.dependsOnWhy")})]}),et.map(e=>(0,s.jsxs)("label",{className:"queue-dep",children:[(0,s.jsx)("input",{type:"checkbox",checked:W.dependsOn.includes(e.id),onChange:l=>H({...W,dependsOn:l.target.checked?[...W.dependsOn,e.id]:W.dependsOn.filter(l=>l!==e.id)})}),(0,s.jsxs)("span",{children:["#",U(e.id)," ",f(e)]})]},e.id))]}),Q&&"main"===W.branch&&(0,s.jsx)("p",{className:"small muted queue-preparing",role:"status",children:a("q.preparing")}),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)("button",{className:"primary",onClick:()=>void $(),disabled:Q||!W.prompt.trim(),title:Z?a("q.addAfterWhy"):void 0,children:E?a("q.save"):Z?a("q.addAfter"):a("q.add")}),E&&(0,s.jsx)("button",{className:"quiet",onClick:()=>{A(null),H(g)},children:a("q.cancel")})]})]})]})}function M(e){let{busy:l,running:a}=e,{t:n}=(0,r.kj)(),i="chat"===l.kind?n("q.busyChat",{title:l.title}):n("models"===l.kind?"q.busyModels":"locators"===l.kind?"q.busyLocators":"q.busyLogin");return(0,s.jsxs)("p",{className:"small queue-busy",role:"status",children:[(0,s.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",n(a?"q.busyRunning":"q.busyIdle",{what:i})," ","chat"===l.kind&&(0,s.jsx)(d(),{href:"/",onClick:()=>{try{window.localStorage.setItem(v,l.sessionId)}catch(e){}},children:n("q.openChat")})]})}}},e=>{e.O(0,[8197,7921,895,1024,2347,3131,7358],()=>e(e.s=43359)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4662],{1691:(e,t,l)=>{"use strict";l.d(t,{DR:()=>h,J1:()=>p,Lh:()=>u});var a=l(73365),n=l(1521),s=l(1702),r=l(15549),i=l(8205),o=l(87527),c=l(24872);function d(e){return"/settings?locator=".concat(encodeURIComponent(e),"#chat-locators")}function u(e){let{failure:t,inSettings:l=!1,onDismiss:n}=e,{t:s}=(0,i.kj)(),o=(0,i.W3)(),u=s("chatloc.".concat(t.key));return(0,a.jsxs)("div",{className:"notice ".concat(t.stopped?"":"caution"," locator-failure").trim(),role:"alert","data-locator":t.key,style:{overflowWrap:"anywhere"},children:[!l&&(0,a.jsx)("strong",{children:s(t.stopped?"chatloc.failTitle":"chatloc.warnTitle",{name:u})}),(0,a.jsxs)("p",{className:"small",style:{margin:"4px 0"},children:[s("chatloc.failWhen",{when:o(t.at)})," ",(0,a.jsx)("code",{className:"picker-example",children:t.locator})]}),t.why&&(0,a.jsx)("p",{className:"muted small",style:{margin:"4px 0"},children:t.why}),(0,a.jsxs)("div",{className:"row",style:{marginTop:6},children:[!l&&(0,a.jsx)("a",{className:"button-link",href:d(t.key),children:s("chatloc.fix")}),t.html&&(0,a.jsx)("a",{className:"button-link",href:r.FH.locatorHtmlUrl(t.key),download:!0,children:s("chatloc.html")}),(0,a.jsx)(c.i8,{text:t.prompt,what:"chatloc.promptWhy",label:"chatloc.prompt"}),(0,a.jsx)("button",{type:"button",className:"quiet",onClick:n,children:s("chatloc.dismiss")})]}),(0,a.jsx)("p",{className:"why",children:s("chatloc.how")})]})}let m="cop.locatorFailure.opened";function h(){let[e,t]=(0,n.useState)([]),l=async()=>{await r.FH.locatorFailures().then(e=>t(e.filter(e=>!e.changed))).catch(()=>void 0)};return(0,o.z)(l,5e3),{list:e,dismiss:async e=>{t(t=>t.filter(t=>t.key!==e)),await r.FH.dismissLocatorFailure(e).catch(()=>void 0)},reload:l}}function p(){let e=(0,s.usePathname)(),{list:t,dismiss:l}=h(),r="/settings"===e||"/settings/"===e;return((0,n.useEffect)(()=>{if(r)return;let e=t.find(e=>e.stopped);if(!e)return;let l="".concat(e.key,"@").concat(e.at),a=function(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(m))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}();if(!a.includes(l)){try{window.localStorage.setItem(m,JSON.stringify([...a,l].slice(-50)))}catch(e){return}window.location.assign(d(e.key))}},[t,r]),r||0===t.length)?null:(0,a.jsx)("div",{style:{marginBottom:12},children:t.map(e=>(0,a.jsx)(u,{failure:e,onDismiss:()=>void l(e.key)},e.key))})}},1702:(e,t,l)=>{"use strict";var a=l(99962);l.o(a,"usePathname")&&l.d(t,{usePathname:function(){return a.usePathname}}),l.o(a,"useRouter")&&l.d(t,{useRouter:function(){return a.useRouter}})},5462:(e,t,l)=>{"use strict";l.d(t,{f:()=>s,q:()=>r});var a=l(73365),n=l(1521);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"below",[t,l]=(0,n.useState)(!1),a=(0,n.useRef)(null),s=(0,n.useRef)(null),r=(0,n.useId)(),[i,o]=(0,n.useState)({visibility:"hidden"}),c=(0,n.useCallback)(()=>l(!1),[]),d=(0,n.useCallback)(()=>l(e=>!e),[]);return(0,n.useLayoutEffect)(()=>{var l;let n,r;if(!t)return void o({visibility:"hidden"});let i=null==(l=a.current)?void 0:l.getBoundingClientRect(),c=s.current;if(!i||!c)return;let d=c.offsetWidth,u=c.offsetHeight;"right"===e?(n=i.right+6,r=Math.min(i.top,window.innerHeight-u-8)):(n=Math.min(i.left,window.innerWidth-d-8),r=i.bottom+6+u>window.innerHeight-8?i.top-6-u:i.bottom+6),o({left:Math.max(8,n),top:Math.max(8,r)})},[t,e]),(0,n.useEffect)(()=>{if(!t)return;let e=e=>{var t,n;let r=e.target;(null==(t=s.current)?void 0:t.contains(r))||(null==(n=a.current)?void 0:n.contains(r))||l(!1)},n=e=>{var t;"Escape"===e.key&&(l(!1),null==(t=a.current)||t.focus())},r=()=>l(!1);return document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n),window.addEventListener("resize",r),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",n),window.removeEventListener("resize",r)}},[t]),{open:t,setOpen:l,toggle:d,close:c,anchor:a,panel:s,style:i,id:r}}function r(e){let{label:t,text:l}=e,n=s("below");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{ref:n.anchor,type:"button",className:"info-btn","aria-label":t,title:t,"aria-expanded":n.open,"aria-controls":n.open?n.id:void 0,onClick:n.toggle,children:"i"}),n.open&&(0,a.jsxs)("div",{ref:n.panel,id:n.id,role:"dialog","aria-label":t,className:"pop info-pop",style:n.style,children:[(0,a.jsx)("p",{className:"pop-title",children:t}),l.split(/\n\s*\n/).map((e,t)=>{let l=t>0?/^([^::.。\n]{2,90}?)\s?(?::\s|:)/.exec(e):null;return(0,a.jsx)("p",{children:l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:l[1]}),e.slice(l[1].length)]}):e},e)})]})]})}},11272:(e,t,l)=>{"use strict";l.d(t,{O:()=>n});var a=l(73365);function n(){return(0,a.jsxs)("svg",{className:"branch-ico",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,a.jsx)("path",{d:"M4.5 3.5v9M4.5 10c0-3 7-2.5 7-5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),(0,a.jsx)("circle",{cx:"4.5",cy:"3",r:"1.7",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"4.5",cy:"13",r:"1.7",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"11.5",cy:"4.2",r:"1.7",fill:"currentColor"})]})}},24784:(e,t,l)=>{"use strict";l.d(t,{Yb:()=>o,u:()=>i});var a=l(73365),n=l(1521),s=l(15549),r=l(8205);let i="::by-hand::";function o(e){var t,l,o;let{id:c,chosen:d,onChange:u,none:m,byHand:h,catalogue:p,disabled:x=!1,style:f}=e,{t:v}=(0,r.kj)(),j=function(e){let[t,l]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let t=!0;return s.FH.models().then(e=>{t&&l(e)}).catch(()=>void 0),()=>{t=!1}},[e]),void 0!==e?e:t}(p),g=null!=(t=null==j?void 0:j.options)?t:[],y=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),b=d&&d!==i?g.find(e=>y(e.name)===y(d)):void 0,k=null!=(l=null==b?void 0:b.name)?l:d,w=!!b||d===i&&void 0!==h,N=g.filter(e=>!e.group),S=new Map;for(let e of g)e.group&&S.set(e.group,[...null!=(o=S.get(e.group))?o:[],e]);return(0,a.jsxs)("select",{id:c,value:k,onChange:e=>u(e.target.value),disabled:x,style:{width:"auto",minWidth:280,...f},children:[void 0!==h&&(0,a.jsx)("option",{value:i,children:h}),void 0!==m&&(0,a.jsx)("option",{value:"",children:m}),d&&!w&&(0,a.jsx)("option",{value:d,children:v("model.notInList",{name:d})}),N.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(v("model.unavailable")):""]},e.name)),[...S.entries()].map(e=>{let[t,l]=e;return(0,a.jsx)("optgroup",{label:t,children:l.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(v("model.unavailable")):""]},e.name))},t)})]})}},24872:(e,t,l)=>{"use strict";l.d(t,{Dk:()=>r,T4:()=>o,i8:()=>i});var a=l(73365),n=l(1521),s=l(8205);async function r(e){try{return await navigator.clipboard.writeText(e),!0}catch(e){}try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let l=document.execCommand("copy");return t.remove(),l}catch(e){return!1}}function i(e){let{text:t,what:l,label:i="copy.copy",className:o=""}=e,{t:c}=(0,s.kj)(),[d,u]=(0,n.useState)(""),m=(0,n.useRef)(void 0);(0,n.useEffect)(()=>()=>window.clearTimeout(m.current),[]);let h=async()=>{u(await r(t)?"copied":"failed"),window.clearTimeout(m.current),m.current=window.setTimeout(()=>u(""),2e3)};return(0,a.jsx)("button",{type:"button",className:"quiet small copy-btn ".concat(o).trim(),onClick:()=>void h(),title:c(l),"aria-label":c(l),children:(0,a.jsx)("span",{"aria-live":"polite",children:c("copied"===d?"copy.copied":"failed"===d?"copy.failed":i)})})}function o(e){let{text:t}=e;return(0,a.jsx)("div",{className:"cs-copy-row",children:(0,a.jsx)(i,{text:t,what:"copy.allWhy",label:"copy.all",className:"copy-all"})})}},51035:(e,t,l)=>{"use strict";l.d(t,{DialogHost:()=>d,Z:()=>c});var a=l(73365),n=l(1521),s=l(8205),r=l(94969);let i=null,o=[];function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(l=>{var a;return a={kind:"confirm",message:e,...t,resolve:l},void(i?i(a):o.push(a))})}function d(e){var t,l;let{children:c}=e,{t:d}=(0,s.kj)(),[u,m]=(0,n.useState)([]),h=(0,n.useRef)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(i=e=>m(t=>[...t,e]),o.length>0){let e=o.splice(0,o.length);m(t=>[...t,...e])}return()=>{i=null}},[]);let x=u[0],f=(0,n.useCallback)(e=>{x&&(x.resolve(e),m(e=>e.slice(1)))},[x]);return(0,r.V)(p,!!x,h),(0,n.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),f(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,f]),(0,a.jsxs)(a.Fragment,{children:[c,x&&(0,a.jsx)("div",{className:"modal-backdrop",onClick:()=>f(!1),role:"presentation",children:(0,a.jsxs)("div",{ref:p,className:"modal".concat(x.danger?" danger":""),role:"confirm"===x.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{id:"modal-title",children:null!=(t=x.title)?t:d("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,a.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,a.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,a.jsx)("button",{type:"button",className:"quiet",onClick:()=>f(!1),children:d("dialog.cancel")}),(0,a.jsx)("button",{ref:h,type:"button",className:x.danger?"danger":"primary",onClick:()=>f(!0),children:null!=(l=x.okLabel)?l:d("dialog.ok")})]})]})})]})}},65323:(e,t,l)=>{Promise.resolve().then(l.bind(l,91082))},87527:(e,t,l)=>{"use strict";l.d(t,{z:()=>n});var a=l(1521);function n(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,a.useRef)(e);n.current=e,(0,a.useEffect)(()=>{let e;if(!l)return;let a=!1,s=async()=>{try{await n.current()}catch(e){}finally{a||(e=setTimeout(()=>void s(),t))}};return s(),()=>{a=!0,e&&clearTimeout(e)}},[t,l])}},91082:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>b});var a=l(73365),n=l(1521),s=l(15549);let r="{$model_name}",i="{$provider_name}",o=["button","rows","model","provider","providerModel"],c=["composer","send","userMessage","turn","answer","copy","stop","conversationLink","chatMore","renameItem","renameInput","renameSave"],d="{$chat_id}",u={chatMore:d},m={button:null,rows:null,model:r,provider:i,providerModel:r};function h(e){return e.includes("'")?e.includes('"')?"concat('".concat(e.split("'").join("', \"'\", '"),"')"):'"'.concat(e,'"'):"'".concat(e,"'")}function p(e,t){let l=e,a=(e,t)=>{void 0!==t&&(l=l.split("'".concat(e,"'")).join(t.includes("'")?h(t):"'".concat(t,"'")).split('"'.concat(e,'"')).join(t.includes('"')?h(t):'"'.concat(t,'"')).split(e).join(t))};return a(r,t.model),a(i,t.provider),l}var x=l(1691),f=l(8205),v=l(51035),j=l(24784),g=l(5462),y=l(11272);function b(){let{t:e}=(0,f.kj)();(0,n.useEffect)(()=>{let e,t=0,l=()=>{let l=decodeURIComponent(window.location.hash.slice(1));if(!l)return;let a=Date.now()+5e3;cancelAnimationFrame(t);let n=()=>{let s=document.getElementById(l);if(!s){Date.now()<a&&(t=requestAnimationFrame(n));return}let r="reduced"===document.documentElement.dataset.motion||window.matchMedia("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({block:"start",behavior:r?"auto":"smooth"}),s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}),s.classList.remove("spotlight"),s.offsetWidth,s.classList.add("spotlight"),clearTimeout(e),e=setTimeout(()=>s.classList.remove("spotlight"),4200)};n()};return l(),window.addEventListener("hashchange",l),()=>{window.removeEventListener("hashchange",l),cancelAnimationFrame(t),clearTimeout(e)}},[]);let[t,l]=(0,n.useState)(null),[r,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)("");(0,n.useEffect)(()=>{s.FH.models().then(l).catch(()=>void 0)},[]);let d=async()=>{if(await (0,v.Z)(e("model.refreshConfirm"))){i(!0),c(e("model.refreshing"));try{var t;let a=await s.FH.models().then(()=>s.FH.refreshModels());l(a),c(0===a.options.length?null!=(t=a.note)?t:e("model.none"):e("model.refreshed",{n:a.options.length}))}catch(e){c(e.message)}finally{i(!1)}}},u={catalogue:t,setCatalogue:l,refreshModels:d,refreshing:r,refreshMsg:o};return(0,a.jsxs)("div",{className:"settings",children:[(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:e("def.title")}),(0,a.jsx)("p",{className:"muted small",children:e("def.intro")}),(0,a.jsx)("p",{className:"why",children:e("def.autoSave")}),(0,a.jsx)("p",{className:"why",children:e("def.live")})]}),(0,a.jsx)(L,{}),(0,a.jsx)(A,{}),(0,a.jsx)(I,{}),(0,a.jsx)(P,{}),(0,a.jsx)(q,{role:"worker",...u}),(0,a.jsx)(q,{role:"lead",...u}),(0,a.jsx)(q,{role:"kerrigan",...u}),(0,a.jsx)(q,{role:"review",...u}),(0,a.jsx)(U,{}),(0,a.jsx)(z,{catalogue:t}),(0,a.jsx)(V,{}),(0,a.jsx)(J,{}),(0,a.jsx)(X,{})]})}function k(e){let{htmlFor:t,label:l,info:n,as:s="label"}=e,{t:r}=(0,f.kj)();return(0,a.jsxs)("div",{className:"field-label",children:["label"===s?(0,a.jsx)("label",{htmlFor:t,children:l}):(0,a.jsx)("span",{className:"field-name",children:l}),(0,a.jsx)(g.q,{label:r("info.about",{name:l}),text:n})]})}function w(e){let{id:t,label:l,info:n,unit:s,children:r}=e;return(0,a.jsxs)("div",{className:"settings-field",children:[(0,a.jsx)(k,{htmlFor:t,label:l,info:n}),(0,a.jsxs)("div",{className:"field-control",children:[r,s&&(0,a.jsx)("span",{className:"unit",children:s})]})]})}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:900,l=(0,n.useRef)(null),a=(0,n.useRef)(null),s=(0,n.useRef)(e);return s.current=e,(0,n.useEffect)(()=>()=>{l.current&&clearTimeout(l.current),a.current&&s.current(a.current.value)},[]),e=>{l.current&&clearTimeout(l.current),a.current={value:e},l.current=setTimeout(()=>{a.current=null,s.current(e)},t)}}function S(e){let{id:t,value:l,min:s,max:r,onChange:i,disabled:o}=e,[c,d]=(0,n.useState)(String(l));return(0,n.useEffect)(()=>d(e=>C(e)===l?e:String(l)),[l]),(0,a.jsx)("input",{id:t,type:"number",className:"number",min:s,max:r,step:1,value:c,onChange:e=>{d(e.target.value);let t=C(e.target.value);null!==t&&t>=s&&t<=r&&i(t)},onBlur:()=>{let e=C(c),t=null===e?l:Math.max(s,Math.min(r,e));d(String(t)),t!==l&&i(t)},disabled:o})}function C(e){if(""===e.trim())return null;let t=Number(e);return Number.isInteger(t)?t:null}let R=(0,n.createContext)(e=>e);function F(){let[e,t]=(0,n.useState)(0),l=(0,n.useRef)(!0);return(0,n.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),{saving:e>0,track:(0,n.useCallback)(async e=>{let a=Date.now();t(e=>e+1);try{return await e}finally{setTimeout(()=>{l.current&&t(e=>Math.max(0,e-1))},Math.max(0,1600-(Date.now()-a)))}},[])}}function M(){let[e,t]=(0,n.useState)(1);return(0,n.useEffect)(()=>{let e=setInterval(()=>t(e=>e%3+1),380);return()=>clearInterval(e)},[]),(0,a.jsx)("span",{className:"saving-dots","aria-hidden":"true",children:".".repeat(e)})}function W(e){let{msg:t,saving:l}=e,{t:n}=(0,f.kj)();return l?(0,a.jsx)("div",{className:"row saved-note",children:(0,a.jsxs)("span",{className:"saving small",role:"status",children:[n("def.saving"),(0,a.jsx)(M,{})]})}):t?(0,a.jsx)("div",{className:"row saved-note",children:(0,a.jsx)("span",{className:"muted small",role:"status",children:t})}):null}let E={name:"",description:"",text:"",projectDir:"",forKerrigan:""};function I(){let{t:e}=(0,f.kj)(),{saving:t,track:l}=F(),[r,i]=(0,n.useState)(null),[o,c]=(0,n.useState)({maxDescription:300,maxForKerrigan:3e3}),[d,u]=(0,n.useState)([]),[m,h]=(0,n.useState)(""),[p,x]=(0,n.useState)(""),[j,g]=(0,n.useState)(!1),[y,b]=(0,n.useState)(E);(0,n.useEffect)(()=>{s.FH.skills().then(e=>{var t;i(e.skills),c({maxDescription:e.maxDescription,maxForKerrigan:null!=(t=e.maxForKerrigan)?t:3e3})}).catch(e=>x(e.message)),s.FH.project().then(e=>u([...e.rootDir?[{name:e.name||e.rootDir,dir:e.rootDir}]:[],...e.others.map(e=>({name:e.name,dir:e.rootDir}))])).catch(()=>void 0)},[]);let k=async t=>{g(!0),x("");try{let a=await l(s.FH.setSkills(t));return i(a.skills),h(e("skills.saved",{n:a.skills.length})),!0}catch(e){return x(e.message),!1}finally{g(!1)}},w=null!=r?r:[],N=async()=>{await k([...w,{...y,name:y.name.trim().toLowerCase()}])&&b(E)},S=async t=>{await (0,v.Z)(e("skills.removeConfirm",{name:w[t].name}),{okLabel:e("skills.remove"),danger:!0})&&await k(w.filter((e,l)=>l!==t))};return(0,a.jsxs)("section",{className:"panel",id:"skills","aria-labelledby":"skills-title",children:[(0,a.jsx)("h2",{id:"skills-title",children:e("skills.title")}),(0,a.jsx)("p",{className:"muted small",children:e("skills.intro")}),p&&(0,a.jsx)("div",{className:"err",children:p}),r&&0===r.length&&(0,a.jsx)("p",{className:"muted small",children:e("skills.none")}),w.map((e,t)=>(0,a.jsx)(D,{skill:e,projects:d,limits:o,onChange:e=>k(w.map((l,a)=>a===t?e:l)),onRemove:()=>void S(t),busy:j},"skill-".concat(t))),(0,a.jsx)(W,{msg:m,saving:t}),(0,a.jsx)("h3",{id:"skills-add",children:e("skills.addTitle")}),(0,a.jsx)(D,{skill:y,projects:d,limits:o,onDraft:b,busy:j}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:j||!y.name.trim()||!y.text.trim(),children:e("skills.add")})})]})}function O(){return(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M2.5 4h11M6 4V2.5h4V4M3.8 4l.7 9.5h7l.7-9.5M6.6 6.6v4.8M9.4 6.6v4.8"})})}function D(e){var t;let{skill:l,projects:s,limits:r,onChange:i,onDraft:o,onRemove:c,busy:d}=e,{t:u}=(0,f.kj)(),m=(0,n.useId)(),[h,p]=(0,n.useState)(l),x=(0,n.useRef)(!1);(0,n.useEffect)(()=>{x.current||p(l)},[l]);let v=e=>{let t={...h,...e};return p(t),null==o||o(t),t},j=N(async e=>{x.current=!1,i&&(e.text!==l.text||e.forKerrigan!==l.forKerrigan)&&await i(e)},1200),g=()=>{i&&(h.name!==l.name||h.description!==l.description)&&i(h)};return(0,a.jsxs)("div",{className:"panel inner skill-entry".concat(i?"":" skill-new"),children:[c&&(0,a.jsxs)("div",{className:"skill-head",children:[(0,a.jsxs)("span",{className:"skill-title",children:["/",h.name]}),(0,a.jsxs)("button",{type:"button",className:"danger skill-delete",onClick:c,disabled:d,"aria-label":u("skills.removeOne",{name:h.name}),title:u("skills.removeOne",{name:h.name}),children:[(0,a.jsx)(O,{}),u("skills.remove")]})]}),(0,a.jsxs)("div",{className:"project-fields",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"".concat(m,"-name"),label:u("skills.name"),info:u("skills.nameInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons skill-name-box",children:[(0,a.jsx)("span",{className:"skill-slash","aria-hidden":"true",children:"/"}),(0,a.jsx)("input",{id:"".concat(m,"-name"),type:"text",value:h.name,onChange:e=>v({name:e.target.value}),onBlur:g,placeholder:"new-test",spellCheck:!1})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"".concat(m,"-description"),label:u("skills.description"),info:u("skills.descriptionInfo")}),(0,a.jsx)("input",{id:"".concat(m,"-description"),type:"text",value:h.description,maxLength:r.maxDescription,onChange:e=>v({description:e.target.value}),onBlur:g})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"".concat(m,"-project"),label:u("skills.project"),info:u("skills.projectInfo")}),(0,a.jsx)("div",{className:"input-with-buttons",children:(0,a.jsxs)("select",{id:"".concat(m,"-project"),value:h.projectDir,onChange:e=>{let t=v({projectDir:e.target.value});i&&i(t)},children:[(0,a.jsx)("option",{value:"",children:u("skills.allProjects")}),s.map(e=>(0,a.jsx)("option",{value:e.dir,children:e.name},e.dir))]})})]})]}),(0,a.jsxs)("div",{className:"project-level2",children:[(0,a.jsx)(k,{htmlFor:"".concat(m,"-text"),label:u("skills.text"),info:u("skills.textInfo")}),(0,a.jsx)("textarea",{id:"".concat(m,"-text"),className:"prose",rows:5,value:h.text,onChange:e=>{let t=v({text:e.target.value});i&&(x.current=!0,j(t))},placeholder:u("skills.textPlaceholder")}),(0,a.jsx)("span",{className:"muted small skill-count",children:u("skills.count",{n:h.text.length.toLocaleString()})})]}),(0,a.jsxs)("div",{className:"project-level2",children:[(0,a.jsx)(k,{htmlFor:"".concat(m,"-kerrigan"),label:u("skills.forKerrigan"),info:u("skills.forKerriganInfo")}),(0,a.jsx)("textarea",{id:"".concat(m,"-kerrigan"),className:"prose",rows:3,maxLength:r.maxForKerrigan,value:null!=(t=h.forKerrigan)?t:"",onChange:e=>{let t=v({forKerrigan:e.target.value});i&&(x.current=!0,j(t))},placeholder:u("skills.forKerriganPlaceholder")})]})]})}function L(){let{t:e}=(0,f.kj)(),[t,l]=(0,n.useState)(null),[r,i]=(0,n.useState)("");return(0,n.useEffect)(()=>{s.FH.level1().then(e=>l(e.content)).catch(t=>i(e("l1.failed",{reason:t.message})))},[]),(0,a.jsxs)("section",{className:"panel",id:"level1","aria-labelledby":"level1-title",children:[(0,a.jsxs)("div",{className:"row section-title",children:[(0,a.jsx)("h2",{id:"level1-title",children:e("l1.title")}),(0,a.jsx)("span",{className:"badge",children:e("l1.readOnly")})]}),(0,a.jsx)("div",{className:"callout",role:"note",children:e("l1.what")}),r&&(0,a.jsx)("div",{className:"err",children:r}),(0,a.jsxs)("details",{className:"l1-text",children:[(0,a.jsx)("summary",{children:e("l1.show")}),(0,a.jsx)("pre",{className:"l1-pre",children:null!=t?t:"…"})]})]})}function A(){var e,t;let{t:l}=(0,f.kj)(),{saving:r,track:i}=F(),[o,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(""),[m,h]=(0,n.useState)(""),[p,x]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[b,w]=(0,n.useState)(""),[S,C]=(0,n.useState)(""),R=(0,n.useCallback)(async()=>{try{let e=await s.FH.project();c(e),u(e.rootDir),h(e.name),j("")}catch(e){j(e.message)}},[]);(0,n.useEffect)(()=>{R()},[R]);let M=async(e,t)=>{y(!0),x("");try{let l=await i(s.FH.setProject(e));return c(l),u(l.rootDir),x(t(l)),j(""),!0}catch(e){return j(e.message),!1}finally{y(!1)}},E=e=>M({rootDir:e},e=>e.rootDir?l("proj.saved",{dir:e.rootDir}):l("proj.cleared")),I=e=>M({name:e},()=>l("proj.nameSaved")),O=N(E),D=N(I),L=async(e,t)=>{y(!0);try{var l;let a=await s.FH.browseFolder(t.trim()||void 0);a.ok?e(a.path):a.cancelled||j(null!=(l=a.reason)?l:"")}catch(e){j(e.message)}finally{y(!1)}},A=null!=(e=null==o?void 0:o.others)?e:[],P=e=>e.map(e=>({name:e.name,rootDir:e.rootDir,level2:e.level2,readOnly:e.readOnly})),T=(e,t,l)=>M({others:P(A.map(l=>l.name===e.name?{...l,...t}:l))},l),q=async()=>{await M({others:[...P(A),{name:b.trim(),rootDir:S.trim(),level2:"",readOnly:!1}]},e=>l("proj.othersSaved",{n:e.others.length}))&&(w(""),C(""))};return(0,a.jsxs)("section",{className:"panel",id:"project","aria-labelledby":"project-title",children:[(0,a.jsx)("h2",{id:"project-title",children:l("proj.title")}),(0,a.jsx)("p",{className:"muted small",children:l("proj.intro")}),v&&(0,a.jsx)("div",{className:"err",children:v}),(0,a.jsx)(H,{name:m,dir:d,repoOk:!!(null==o?void 0:o.repoOk),repoProblem:null==o?void 0:o.repoProblem,branch:null==o?void 0:o.branch,level2:null!=(t=null==o?void 0:o.level2)?t:"",readOnly:(null==o?void 0:o.readOnly)===!0,onReadOnly:e=>M({readOnly:e},()=>l(e?"proj.readOnlyOn":"proj.readOnlyOff",{name:m||d})),isDefault:!0,busy:g,onNameInput:e=>{h(e),D(e)},onName:e=>void I(e),onDirInput:e=>{u(e),O(e)},onDir:e=>void E(e),onBrowse:()=>void L(e=>void E(e),d),onLevel2:e=>M({level2:e},()=>l("proj.level2Saved",{name:m||d})),onRemove:(null==o?void 0:o.rootDir)?()=>void E(""):void 0,removeLabel:l("proj.clear")}),o&&!o.rootDir&&(0,a.jsx)("p",{className:"muted small",children:l("proj.none")}),A.map((e,t)=>(0,a.jsx)(H,{name:e.name,dir:e.rootDir,repoOk:e.repoOk,repoProblem:e.repoProblem,branch:e.branch,level2:e.level2,readOnly:!0===e.readOnly,onReadOnly:t=>T(e,{readOnly:t},()=>l(t?"proj.readOnlyOn":"proj.readOnlyOff",{name:e.name})),busy:g,onName:t=>void T(e,{name:t},()=>l("proj.nameSaved")),onDir:t=>void T(e,{rootDir:t},()=>l("proj.othersSaved",{n:A.length})),onBrowse:()=>void L(t=>void T(e,{rootDir:t},()=>l("proj.othersSaved",{n:A.length})),e.rootDir),onLevel2:t=>T(e,{level2:t},()=>l("proj.level2Saved",{name:e.name})),onRemove:()=>{let t;t=e.name,M({others:P(A.filter(e=>e.name!==t))},e=>l("proj.othersSaved",{n:e.others.length}))},removeLabel:l("proj.otherRemove")},"other-".concat(t))),(0,a.jsx)(W,{msg:p,saving:r}),(0,a.jsx)("h3",{id:"others",children:l("proj.addTitle")}),(0,a.jsx)("p",{className:"muted small",children:l("proj.othersIntro")}),(0,a.jsxs)("div",{className:"project-fields add-project",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"new-project-name",label:l("proj.entryName"),info:l("proj.nameInfo")}),(0,a.jsx)("input",{id:"new-project-name",type:"text",value:b,onChange:e=>w(e.target.value),placeholder:l("proj.entryName"),disabled:g})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"new-project-dir",label:l("proj.entryDir"),info:l("proj.dirInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsx)("input",{id:"new-project-dir",type:"text",value:S,onChange:e=>C(e.target.value),placeholder:"C:\\Projects\\my-app-tests",disabled:g}),(0,a.jsx)("button",{onClick:()=>void L(e=>C(e),S),disabled:g,children:l("mirror.browse")}),(0,a.jsx)("button",{className:"primary",onClick:()=>void q(),disabled:g||!b.trim()||!S.trim(),children:l("proj.otherAdd")})]})]})]})]})}function H(e){var t;let{name:l,dir:s,repoOk:r,repoProblem:i,branch:o,level2:c,readOnly:d,onReadOnly:u,isDefault:m=!1,busy:h,onNameInput:p,onName:x,onDirInput:v,onDir:j,onBrowse:b,onLevel2:w,onRemove:S,removeLabel:C}=e,{t:R}=(0,f.kj)(),F=(0,n.useId)(),[M,W]=(0,n.useState)(l),[E,I]=(0,n.useState)(s),[O,D]=(0,n.useState)(c),L=(0,n.useRef)(!1),[A,H]=(0,n.useState)(d);(0,n.useEffect)(()=>H(d),[d]),(0,n.useEffect)(()=>W(l),[l]),(0,n.useEffect)(()=>I(s),[s]),(0,n.useEffect)(()=>{L.current||D(c)},[c]);let P=N(async e=>{L.current=!1,e!==c&&await w(e)},1200);return(0,a.jsxs)("div",{className:"panel inner project-entry",children:[(0,a.jsxs)("div",{className:"row project-tags",children:[m&&(0,a.jsx)("span",{className:"chip",title:R("proj.isDefaultWhy"),children:R("proj.isDefault")}),A&&(0,a.jsx)("span",{className:"badge reference",title:R("proj.readOnlyInfo"),children:R("proj.readOnlyBadge")}),s&&(0,a.jsx)("span",{className:"badge ".concat(r?"done":""),title:r?R("proj.isRepo"):i,children:R(r?"proj.otherRepo":"proj.otherNotRepo")}),s&&r&&o&&(0,a.jsxs)("span",{className:"branch-tag",children:[(0,a.jsxs)("span",{className:"badge branch",children:[(0,a.jsx)(y.O,{})," ","HEAD"===o?R("proj.detached"):R("proj.branch",{name:o})]}),(0,a.jsx)(g.q,{label:R("info.about",{name:R("proj.branch",{name:o})}),text:R("proj.branchInfo")})]})]}),s&&!r&&(0,a.jsx)("p",{className:"muted small",children:i||R("proj.notRepoWhy")}),(0,a.jsxs)("div",{className:"field-label check-label project-readonly",children:[(0,a.jsx)("input",{id:"".concat(F,"-readonly"),type:"checkbox",checked:A,onChange:e=>{let t=e.target.checked;H(t),u(t).then(e=>{!1===e&&H(!t)})}}),(0,a.jsx)("label",{htmlFor:"".concat(F,"-readonly"),children:R("proj.readOnly")}),(0,a.jsx)(g.q,{label:R("info.about",{name:R("proj.readOnly")}),text:R("proj.readOnlyInfo")})]}),(0,a.jsxs)("div",{className:"project-fields",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"".concat(F,"-name"),label:R("proj.entryName"),info:R("proj.nameInfo")}),(0,a.jsx)("input",{id:"".concat(F,"-name"),type:"text",value:M,onChange:e=>{W(e.target.value),null==p||p(e.target.value)},onBlur:()=>{(M!==l||p)&&x(M)},placeholder:s?null!=(t=s.replace(/[\\/]+$/,"").split(/[\\/]/).pop())?t:"":R("proj.namePlaceholder")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(k,{htmlFor:"".concat(F,"-dir"),label:R("proj.entryDir"),info:R("proj.dirInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsx)("input",{id:"".concat(F,"-dir"),type:"text",value:E,onChange:e=>{I(e.target.value),null==v||v(e.target.value)},onBlur:()=>{(E!==s||v)&&j(E)},placeholder:"C:\\Projects\\my-app"}),(0,a.jsx)("button",{onClick:b,disabled:h,children:R("mirror.browse")}),S&&(0,a.jsx)("button",{className:"quiet",onClick:S,disabled:h,children:C})]})]})]}),(0,a.jsxs)("div",{className:"project-level2",children:[(0,a.jsx)(k,{htmlFor:"".concat(F,"-level2"),label:R("proj.level2"),info:R("proj.level2Info")}),(0,a.jsx)("textarea",{id:"".concat(F,"-level2"),className:"prose",rows:4,value:O,onChange:e=>{L.current=!0,D(e.target.value),P(e.target.value)},placeholder:R("proj.level2Placeholder")}),(0,a.jsx)("span",{className:"muted small",children:R("proj.level2Count",{n:O.length.toLocaleString()})})]})]})}function P(){let{t:e}=(0,f.kj)(),[t,l]=(0,n.useState)(""),[r,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)(""),[d,u]=(0,n.useState)(""),m=async()=>{i(!0),u(""),c(e("login.waiting"));try{let e=await s.FH.login(t);e.ok?c(e.message):(c(""),u(e.message))}catch(e){c(""),u(e.message)}finally{i(!1)}};return(0,a.jsxs)("section",{className:"panel",id:"login","aria-labelledby":"login-title",children:[(0,a.jsx)("h2",{id:"login-title",children:e("login.title")}),(0,a.jsx)("p",{className:"muted small",children:e("login.intro")}),d&&(0,a.jsx)("div",{className:"err",children:d}),(0,a.jsxs)(w,{id:"login-account",label:e("login.account"),info:e("login.accountWhy"),children:[(0,a.jsx)("input",{id:"login-account",type:"email",value:t,onChange:e=>l(e.target.value),placeholder:"name@company.com",disabled:r}),(0,a.jsx)("button",{className:"primary",onClick:()=>void m(),disabled:r,children:r?e("login.busy"):e("login.button")})]}),o&&(0,a.jsx)("div",{className:"small",role:"status",children:o})]})}let T={worker:{section:"model",pick:"default-model",manualId:"manual-model",manualKey:"manualModel",field:"defaultModel",title:"def.modelTitle",intro:"def.modelIntro",info:"def.modelInfo",manualWhy:"def.manualModelWhy",saved:"def.modelSaved",cleared:"def.modelCleared",save:async e=>(await s.FH.setDefaultModel(e)).defaultModel},lead:{section:"lead-model",pick:"default-lead-model",manualId:"manual-lead-model",manualKey:"leadManualModel",field:"defaultLeadModel",title:"def.leadTitle",intro:"def.leadIntro",info:"def.leadInfo",manualWhy:"def.leadManualWhy",saved:"def.leadSaved",cleared:"def.leadCleared",save:async e=>(await s.FH.setDefaultLeadModel(e)).defaultLeadModel},kerrigan:{section:"kerrigan-model",pick:"default-kerrigan-model",manualId:"manual-kerrigan-model",manualKey:"kerriganManualModel",field:"defaultKerriganModel",title:"def.kerriganTitle",intro:"def.kerriganIntro",info:"def.kerriganInfo",manualWhy:"def.kerriganManualWhy",saved:"def.kerriganSaved",cleared:"def.kerriganCleared",save:async e=>(await s.FH.setDefaultKerriganModel(e)).defaultKerriganModel},review:{section:"review",pick:"default-review-model",manualId:"manual-review-model",manualKey:"reviewManualModel",field:"defaultReviewModel",title:"def.reviewTitle",intro:"def.reviewIntro",info:"def.reviewInfo",manualWhy:"def.reviewManualWhy",saved:"def.reviewSaved",cleared:"def.reviewCleared",save:async e=>(await s.FH.setDefaultReviewModel(e)).defaultReviewModel}};function q(e){var t,l;let{role:s,catalogue:r,setCatalogue:i,refreshModels:o,refreshing:c,refreshMsg:d}=e,{t:u}=(0,f.kj)(),m=(0,f.W3)(),h=T[s],{saving:p,track:x}=F(),[v,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(""),[k,N]=(0,n.useState)(!1),S=null!=(t=null==r?void 0:r[h.field])?t:"",C=async e=>{N(!0),g("");try{let t=await x(h.save(e));r&&i({...r,[h.field]:t}),g(t?u(h.saved,{name:t}):u(h.cleared)),b("")}catch(e){b(e.message)}finally{N(!1)}},M="review"===s&&""!==S&&S===(null!=(l=null==r?void 0:r.defaultModel)?l:"");return(0,a.jsx)(R.Provider,{value:x,children:(0,a.jsxs)("section",{className:"panel",id:h.section,"aria-labelledby":"".concat(h.section,"-title"),children:[(0,a.jsx)("h2",{id:"".concat(h.section,"-title"),children:u(h.title)}),(0,a.jsx)("p",{className:"muted small",children:u(h.intro)}),y&&(0,a.jsx)("div",{className:"err",children:y}),(0,a.jsxs)(w,{id:h.pick,label:u("def.modelField"),info:u(h.info),children:[(0,a.jsx)(j.Yb,{id:h.pick,chosen:S,onChange:e=>void C(e),none:u("def.modelNone"),catalogue:r,disabled:k||c}),(0,a.jsx)("button",{className:"quiet",onClick:()=>void C(""),disabled:k||!S,children:u("proj.clear")}),(0,a.jsx)("button",{onClick:()=>void o(),disabled:k||c,children:u("model.refresh")})]}),(0,a.jsx)("p",{className:"muted small field-after",children:(null==r?void 0:r.readAt)?u("model.readAt",{t:m(r.readAt),n:r.options.length}):u("model.neverRead")}),M&&(0,a.jsx)("p",{className:"why field-after warned-text",children:u("def.reviewSame")}),(0,a.jsx)(K,{id:h.manualId,setting:h.manualKey,why:h.manualWhy}),(0,a.jsx)(W,{msg:v||d,saving:p})]})})}function K(e){let{id:t,setting:l,why:r}=e,{t:i}=(0,f.kj)(),o=(0,n.useContext)(R),[c,d]=(0,n.useState)(null),[u,m]=(0,n.useState)("");(0,n.useEffect)(()=>{s.FH.settings().then(e=>{var t,a,n;let s=null!=(n=e.raw.copilot)?n:{},r=(null==(a=e.defaults)||null==(t=a.copilot)?void 0:t.manualModel)!==!1,i="boolean"==typeof s.manualModel?s.manualModel:r,o="boolean"==typeof s.leadManualModel?s.leadManualModel:i,c=s[l];d("boolean"==typeof c?c:"kerriganManualModel"===l?o:i)}).catch(e=>m(e.message))},[l]);let h=async e=>{d(e);try{await o(s.FH.settings().then(t=>{var a;return s.FH.saveSettings({...t.raw,copilot:{...null!=(a=t.raw.copilot)?a:{},[l]:e}})})),m("")}catch(e){m(e.message)}};return(0,a.jsxs)("div",{className:"settings-field",children:[(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:t,type:"checkbox",checked:!0===c,disabled:null===c,onChange:e=>void h(e.target.checked)}),(0,a.jsx)("label",{htmlFor:t,children:i("def.manualModel")}),(0,a.jsx)(g.q,{label:i("info.about",{name:i("def.manualModel")}),text:i(r)})]}),u&&(0,a.jsx)("div",{className:"err",children:u})]})}let B=[{group:"write",title:"chatloc.group.write",keys:["composer","send","userMessage"]},{group:"answer",title:"chatloc.group.answer",keys:["turn","answer","copy","stop"]},{group:"conversations",title:"chatloc.group.conversations",keys:["conversationLink","chatMore","renameItem","renameInput","renameSave"]}];function U(){let{t:e}=(0,f.kj)(),{saving:t,track:l}=F(),[r,i]=(0,n.useState)(null),[o,d]=(0,n.useState)(null),[u,m]=(0,n.useState)(""),[h,p]=(0,n.useState)(""),v=(0,n.useRef)(Promise.resolve()),j=(0,x.DR)(),[y,b]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,S]=(0,n.useState)(""),C=async()=>{b(!0),S("");try{w(await s.FH.checkLocators()),await j.reload()}catch(e){S(e.message)}finally{b(!1)}},M=e=>{var t;return null!=(t=null==k?void 0:k.results.filter(t=>t.status===e).length)?t:0};return(0,n.useEffect)(()=>{s.FH.settings().then(e=>{var t,l,a,n;let s=null!=(a=(null!=(l=e.raw.copilot)?l:{}).chatLocators)?a:{};i(Object.fromEntries(c.map(e=>{var t;return[e,null!=(t=s[e])?t:""]}))),d(null!=(n=null==(t=e.chat)?void 0:t.defaults)?n:null)}).catch(e=>p(e.message))},[]),(0,n.useEffect)(()=>{if(!r||!o)return;let e=new URLSearchParams(window.location.search).get("locator");if(!e||!c.includes(e))return;let t=document.getElementById("chat-".concat(e));t&&(t.scrollIntoView({block:"center"}),t.focus())},[r,o]),(0,a.jsx)(R.Provider,{value:l,children:(0,a.jsxs)("section",{className:"panel",id:"chat-locators","aria-labelledby":"chat-locators-title",children:[(0,a.jsx)("h2",{id:"chat-locators-title",children:e("chatloc.title")}),(0,a.jsx)("p",{className:"muted small",children:e("chatloc.intro")}),(0,a.jsxs)("details",{className:"picker-how",children:[(0,a.jsx)("summary",{children:e("chatloc.howTitle")}),(0,a.jsx)("p",{className:"small",children:e("chatloc.how")})]}),h&&(0,a.jsx)("div",{className:"err",children:h}),(0,a.jsxs)("div",{className:"row locator-check",children:[(0,a.jsx)("button",{type:"button",onClick:()=>void C(),disabled:y||!r,children:y?e("chatloc.checking"):e("chatloc.check")}),(0,a.jsx)(g.q,{label:e("info.about",{name:e("chatloc.check")}),text:e("chatloc.checkWhy")})]}),N&&(0,a.jsx)("div",{className:"err",role:"alert",children:N}),k&&(0,a.jsx)("p",{className:"muted small locator-check-done",role:"status",children:e("chatloc.checkDone",{found:M("found"),none:M("none"),other:M("not-here")})}),r&&o?B.map(t=>(0,a.jsxs)("div",{className:"locator-group",children:[(0,a.jsx)("h3",{children:e(t.title)}),t.keys.map(t=>{var n,i;let c=null!=(n=j.list.find(e=>e.key===t))?n:null;return(0,a.jsx)(Z,{field:t,idPrefix:"chat",label:e("chatloc.".concat(t)),why:e("chatloc.".concat(t,"Why")),initial:r[t],fallback:o[t],example:null,failed:c?(0,a.jsx)(x.Lh,{failure:c,inSettings:!0,onDismiss:()=>void j.dismiss(t)}):null,checked:null!=(i=null==k?void 0:k.results.find(e=>e.key===t))?i:null,onSave:a=>((t,a)=>{let n=async()=>{try{var n,r;let i=(await s.FH.settings()).raw,o={...null!=(n=i.copilot)?n:{}},c={...null!=(r=o.chatLocators)?r:{}};a.trim()?c[t]=a.trim():delete c[t],0===Object.keys(c).length?delete o.chatLocators:o.chatLocators=c,m(""),await l(s.FH.saveSettings({...i,copilot:o})),m(e("loc.saved")),p(""),await j.reload()}catch(e){p(e.message)}},r=v.current.then(n,n);return v.current=r.catch(()=>void 0),r})(t,a)},t)})]},t.group)):!h&&(0,a.jsx)("p",{className:"muted small",children:e("loc.loading")}),(0,a.jsx)(W,{msg:u,saving:t})]})})}let _=[{key:"button",label:"loc.button",why:"loc.buttonWhy"},{key:"rows",label:"loc.rows",why:"loc.rowsWhy"},{key:"model",label:"loc.model",why:"loc.modelWhy"},{key:"provider",label:"loc.provider",why:"loc.providerWhy"},{key:"providerModel",label:"loc.providerModel",why:"loc.providerModelWhy"}];function z(e){var t,l,r,i;let{catalogue:c}=e,{t:d}=(0,f.kj)(),{saving:u,track:m}=F(),[h,p]=(0,n.useState)(null),[x,v]=(0,n.useState)(null),[j,y]=(0,n.useState)(null),[b,k]=(0,n.useState)(!1),[w,N]=(0,n.useState)(""),[S,C]=(0,n.useState)(""),M=(0,n.useRef)(Promise.resolve());(0,n.useEffect)(()=>{s.FH.settings().then(e=>{var t,l,a,n,s,r;let i=null!=(a=e.raw.copilot)?a:{},c=null!=(n=i.pickerLocators)?n:{};p(Object.fromEntries(o.map(e=>{var t;return[e,null!=(t=c[e])?t:""]}))),v(null!=(s=null==(t=e.picker)?void 0:t.defaults)?s:null),y(null!=(r=null==(l=e.picker)?void 0:l.dirs)?r:null),k(!0===i.pickerSteps)}).catch(e=>C(e.message))},[]);let E=e=>{let t=async()=>{try{var t;let l=(await s.FH.settings()).raw;N(""),await m(s.FH.saveSettings({...l,copilot:e({...null!=(t=l.copilot)?t:{}})})),N(d("loc.saved")),C("")}catch(e){C(e.message)}},l=M.current.then(t,t);return M.current=l.catch(()=>void 0),l},I=null!=(l=null==c||null==(t=c.options.find(e=>!e.group))?void 0:t.name)?l:"Think deeper",O=null==c?void 0:c.options.find(e=>e.group),D=null!=(r=null==O?void 0:O.group)?r:"Claude",L=null!=(i=null==O?void 0:O.name)?i:"Opus 5.5";return(0,a.jsx)(R.Provider,{value:m,children:(0,a.jsxs)("section",{className:"panel",id:"picker-locators","aria-labelledby":"picker-locators-title",children:[(0,a.jsx)("h2",{id:"picker-locators-title",children:d("loc.title")}),(0,a.jsx)("p",{className:"muted small",children:d("loc.intro")}),(0,a.jsxs)("details",{className:"picker-how",children:[(0,a.jsx)("summary",{children:d("loc.howTitle")}),(0,a.jsxs)("ol",{className:"small",children:[(0,a.jsx)("li",{children:d("loc.how1")}),(0,a.jsx)("li",{children:d("loc.how2")}),(0,a.jsx)("li",{children:d("loc.how3")}),(0,a.jsx)("li",{children:d("loc.how4")})]})]}),S&&(0,a.jsx)("div",{className:"err",children:S}),h&&x?_.map(e=>{let t;return(0,a.jsx)(Z,{field:e.key,label:d(e.label),why:d(e.why),initial:h[e.key],fallback:x[e.key],example:"model"===(t=e.key)?{name:I,names:{model:I}}:"provider"===t?{name:D,names:{provider:D}}:"providerModel"===t?{name:L,names:{model:L,provider:D}}:null,onSave:t=>{let l;return l=e.key,E(e=>{var a;let n={...null!=(a=e.pickerLocators)?a:{}};t.trim()?n[l]=t.trim():delete n[l];let s={...e,pickerLocators:n};return 0===Object.keys(n).length&&delete s.pickerLocators,s})}},e.key)}):!S&&(0,a.jsx)("p",{className:"muted small",children:d("loc.loading")}),(0,a.jsx)("div",{className:"settings-field",children:(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"picker-steps",type:"checkbox",checked:b,disabled:!h,onChange:e=>{let t=e.target.checked;k(t),E(e=>({...e,pickerSteps:t}))}}),(0,a.jsx)("label",{htmlFor:"picker-steps",children:d("loc.steps")}),(0,a.jsx)(g.q,{label:d("info.about",{name:d("loc.steps")}),text:d("loc.stepsWhy")})]})}),j&&(0,a.jsx)("p",{className:"muted small field-after picker-dirs",children:d("loc.stepsWhere",{run:j.run,read:j.read})}),(0,a.jsx)(W,{msg:w,saving:u})]})})}function Z(e){let{field:t,idPrefix:l="picker",label:s,why:r,initial:i,fallback:o,example:c,failed:h=null,checked:x=null,onSave:v}=e,{t:j}=(0,f.kj)(),[g,y]=(0,n.useState)(i),[b,w]=(0,n.useState)(null),S=N(e=>v(e)),C="".concat(l,"-").concat(t),R=b?"placeholder"===b.kind?j("loc.noPlaceholder",{ph:b.placeholder}):"colons"===b.kind?j("loc.twoColons",{axis:b.axis}):"xpath"===b.kind?j("loc.badXPath",{msg:b.message}):j("loc.badCss",{msg:b.message}):"",F=g.trim()||o;return(0,a.jsxs)("div",{className:"settings-field picker-field".concat(h?" locator-failed":""),"data-locator-field":t,children:[(0,a.jsx)(k,{htmlFor:C,label:s,info:r}),(0,a.jsxs)("div",{className:"field-control",children:[(0,a.jsx)("input",{id:C,type:"text",className:"picker-locator",spellCheck:!1,autoComplete:"off",value:g,placeholder:o,"aria-invalid":!!b||!!h||void 0,onChange:e=>(e=>{y(e);let l=function(e,t,l){var a,n;let s=t.trim();if(""===s)return null;let r=e in m?m[e]:null!=(a=u[e])?a:null;if(r&&!s.includes(r))return{kind:"placeholder",placeholder:r};let i=s.startsWith("xpath=")||!s.startsWith("css=")&&/^\s*(\/|\(|\.\.?\/)/.test(s),o=/(^|[/[(|\s])(ancestor-or-self|ancestor|attribute|child|descendant-or-self|descendant|following-sibling|following|parent|preceding-sibling|preceding|self):(?!:)/.exec(s);if(o&&i)return{kind:"colons",axis:o[2]};if(!l||/^[a-z][a-z:-]*=/.test(s)&&!/^(css|xpath)=/.test(s)||s.includes(">>"))return null;let c=p(s.replace(/^(xpath|css)=/,""),{model:"Think deeper",provider:"Claude"}).split(d).join("id");try{i?l.evaluate(c,l,null,XPathResult.ANY_TYPE,null):l.querySelector(c)}catch(t){let e=(null!=(n=t.message)?n:String(t)).replace(/^Failed to execute '\w+' on 'Document': /,"");return i?{kind:"xpath",message:e}:{kind:"css",message:e}}return null}(t,e,document);w(l),l||S(e)})(e.target.value)}),(0,a.jsx)("button",{className:"quiet",disabled:!g,onClick:()=>{y(""),w(null),v("")},children:j("loc.default")})]}),b?(0,a.jsx)("div",{className:"err field-after",role:"alert",children:R}):(0,a.jsxs)("p",{className:"muted small field-after picker-note",children:[!g.trim()&&(0,a.jsxs)("span",{children:[j("loc.isDefault")," "]}),c&&(0,a.jsxs)(a.Fragment,{children:[j("loc.example",{name:c.name})," ",(0,a.jsx)("code",{className:"picker-example",children:p(F,c.names)})]})]}),x&&(0,a.jsxs)("p",{className:"small field-after locator-checked ".concat(x.status),"data-status":x.status,children:["found"===x.status?"✓ ".concat(j("chatloc.found",{n:x.count})):"none"===x.status?"✗ ".concat(j("chatloc.notFound")):"– ".concat(j("chatloc.notHere")),x.note&&(0,a.jsxs)("span",{className:"muted",children:[" ",j("chatloc.note.".concat(x.note))]})]}),h&&(0,a.jsx)("div",{className:"field-after",children:h})]})}function V(){let{t:e}=(0,f.kj)(),{saving:t,track:l}=F(),[r,i]=(0,n.useState)(null),o=(0,n.useRef)(null),c=(0,n.useRef)(Promise.resolve()),[d,u]=(0,n.useState)(2),[m,h]=(0,n.useState)(3),[p,x]=(0,n.useState)(3),[j,y]=(0,n.useState)(2),[b,k]=(0,n.useState)(2),[C,R]=(0,n.useState)(60),[M,E]=(0,n.useState)(240),[I,O]=(0,n.useState)(20),[D,L]=(0,n.useState)(6),[A,H]=(0,n.useState)(900),[P,T]=(0,n.useState)(12e4),[q,K]=(0,n.useState)(!1),[B,U]=(0,n.useState)(60),[_,z]=(0,n.useState)(!1),[Z,V]=(0,n.useState)(90),[$,J]=(0,n.useState)("none"),[Y,X]=(0,n.useState)("confirm"),[G,Q]=(0,n.useState)("ask"),[ee,et]=(0,n.useState)("ask"),[el,ea]=(0,n.useState)("ask"),[en,es]=(0,n.useState)("copy"),[er,ei]=(0,n.useState)("ask"),[eo,ec]=(0,n.useState)(2),[ed,eu]=(0,n.useState)(15),[em,eh]=(0,n.useState)(""),[ep,ex]=(0,n.useState)("");(0,n.useEffect)(()=>{s.FH.settings().then(e=>{var t,l,a,n,s,r,c,d,m;o.current=e.raw,i(e.raw);let p=null!=(t=e.raw.limits)?t:{};h("number"==typeof p.autoContinue?p.autoContinue:3),x("number"==typeof p.reopenWindow?p.reopenWindow:3),u("number"==typeof p.retryBlockedInFreshChat?p.retryBlockedInFreshChat:2),y("number"==typeof p.minApproachesBeforeBlocked?p.minApproachesBeforeBlocked:2),k("number"==typeof p.maxReviewRounds?p.maxReviewRounds:2),R("number"==typeof p.maxIterations?p.maxIterations:60),E("number"==typeof p.maxRunMinutes?p.maxRunMinutes:240),O("number"==typeof p.maxSubtasks?p.maxSubtasks:20),L("number"==typeof p.maxKerriganSends?p.maxKerriganSends:6),T("number"==typeof p.maxMessageChars?p.maxMessageChars:12e4),ei(null!=(l=p.subtaskRetryMode)?l:"ask"),ec("number"==typeof p.subtaskRetries?p.subtaskRetries:2),eu("number"==typeof p.subtaskRetryWaitSec?p.subtaskRetryWaitSec:15);let f=null!=(a=e.raw.pacing)?a:{};K(!0===f.gapEnabled),U("number"==typeof f.gapSec?f.gapSec:60),z(!0===f.gapRandom),V("number"==typeof f.gapMaxSec?f.gapMaxSec:90);let v=null!=(n=e.raw.copilot)?n:{};H("number"==typeof v.replyTimeoutSec?v.replyTimeoutSec:900);let j=null!=(s=e.raw.execution)?s:{};es("exchange"===j.kerriganResult?"exchange":"copy"),Q("run"===j.writtenScripts?"run":"ask"),J(null!=(r=j.isolation)?r:"none"),X(null!=(c=j.mode)?c:"confirm"),et(null!=(d=j.networkFetch)?d:"ask"),ea(null!=(m=j.questions)?m:"ask")}).catch(e=>ex(e.message))},[]);let ef=(t,a,n)=>{let r=async()=>{var r;if(!o.current)return;let c=await s.FH.settings().then(e=>e.raw).catch(()=>o.current),d={...c,[t]:{...null!=(r=c[t])?r:{},[a]:n}};eh("");try{await l(s.FH.saveSettings(d)),o.current=d,i(d),eh(e("exec.saved")),ex("")}catch(e){ex(e.message)}},d=c.current.then(r);return c.current=d.catch(()=>void 0),d},ev=N(e=>ef("limits","retryBlockedInFreshChat",e)),ej=N(e=>ef("limits","autoContinue",e)),eg=N(e=>ef("limits","reopenWindow",e)),ey=N(e=>ef("limits","minApproachesBeforeBlocked",e)),eb=N(e=>ef("limits","maxReviewRounds",e)),ek=N(e=>ef("limits","maxIterations",e)),ew=N(e=>ef("limits","maxRunMinutes",e)),eN=N(e=>ef("limits","maxSubtasks",e)),eS=N(e=>ef("limits","maxKerriganSends",e)),eC=N(e=>ef("copilot","replyTimeoutSec",e)),eR=N(e=>ef("limits","maxMessageChars",e)),eF=N(e=>ef("limits","subtaskRetries",e)),eM=N(e=>ef("limits","subtaskRetryWaitSec",e)),eW=N(e=>ef("pacing","gapSec",e)),eE=N(e=>ef("pacing","gapMaxSec",e)),eI=(e,t)=>ef("execution",e,t),eO=[{id:"auto-continue",label:e("exec.autoContinue"),info:e("exec.autoContinueWhy"),unit:e("exec.autoContinueUnit"),value:m,min:0,max:20,set:h,later:ej},{id:"reopen-window",label:e("exec.reopenWindow"),info:e("exec.reopenWindowWhy"),unit:e("exec.reopenWindowUnit"),value:p,min:0,max:10,set:x,later:eg},{id:"min-approaches",label:e("exec.minApproaches"),info:e("exec.minApproachesWhy"),unit:e("exec.minApproachesUnit"),value:j,min:2,max:20,set:y,later:ey},{id:"max-review-rounds",label:e("exec.maxReviewRounds"),info:e("exec.maxReviewRoundsWhy"),unit:e("exec.maxReviewRoundsUnit"),value:b,min:1,max:6,set:k,later:eb},{id:"retry-blocked",label:e("exec.retryBlocked"),info:e("exec.retryBlockedWhy"),unit:e("exec.retryBlockedTimes"),value:d,min:0,max:5,set:u,later:ev},{id:"max-iterations",label:e("exec.maxIterations"),info:e("exec.maxIterationsWhy"),unit:e("exec.maxIterationsUnit"),value:C,min:5,max:200,set:R,later:ek},{id:"max-minutes",label:e("exec.maxRunMinutes"),info:e("exec.maxRunMinutesWhy"),unit:e("exec.maxRunMinutesUnit"),value:M,min:10,max:1440,set:E,later:ew},{id:"max-subtasks",label:e("exec.maxSubtasks"),info:e("exec.maxSubtasksWhy"),unit:e("exec.maxSubtasksUnit"),value:I,min:1,max:100,set:O,later:eN},{id:"max-kerrigan-sends",label:e("exec.maxKerriganSends"),info:e("exec.maxKerriganSendsWhy"),unit:e("exec.maxKerriganSendsUnit"),value:D,min:1,max:50,set:L,later:eS},{id:"reply-timeout",label:e("exec.replyTimeout"),info:e("exec.replyTimeoutWhy"),unit:e("exec.replyTimeoutUnit"),value:A,min:60,max:10800,set:H,later:eC},{id:"max-message-chars",label:e("exec.maxMessageChars"),info:e("exec.maxMessageCharsWhy"),unit:e("exec.maxMessageCharsUnit"),value:P,min:1e3,max:1e6,set:T,later:eR}];return(0,a.jsxs)("section",{className:"panel",id:"execution","aria-labelledby":"execution-title",children:[(0,a.jsx)("h2",{id:"execution-title",children:e("exec.title")}),(0,a.jsx)("p",{className:"muted small",children:e("exec.intro")}),ep&&(0,a.jsx)("div",{className:"err",children:ep}),eO.map(e=>(0,a.jsx)(w,{id:e.id,label:e.label,info:e.info,unit:e.unit,children:(0,a.jsx)(S,{id:e.id,value:e.value,min:e.min,max:e.max,onChange:t=>{e.set(t),e.later(t)},disabled:!r})},e.id)),(0,a.jsx)("div",{className:"settings-field",children:(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"gap-on",type:"checkbox",checked:q,disabled:!r,onChange:e=>{K(e.target.checked),ef("pacing","gapEnabled",e.target.checked)}}),(0,a.jsx)("label",{htmlFor:"gap-on",children:e("exec.gap")}),(0,a.jsx)(g.q,{label:e("info.about",{name:e("exec.gap")}),text:e("exec.gapWhy")})]})}),q&&(0,a.jsx)(w,{id:"gap-sec",label:e("exec.gapSec"),info:e("exec.gapSecWhy"),unit:e("exec.gapUnit"),children:(0,a.jsx)(S,{id:"gap-sec",value:B,min:1,max:3600,onChange:e=>{U(e),eW(e)},disabled:!r})}),q&&(0,a.jsx)("div",{className:"settings-field gap-random",children:(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"gap-random",type:"checkbox",checked:_,disabled:!r,onChange:e=>{z(e.target.checked),ef("pacing","gapRandom",e.target.checked),e.target.checked&&Z<B&&(V(B),eE(B))}}),(0,a.jsx)("label",{htmlFor:"gap-random",children:e("exec.gapRandom")}),(0,a.jsx)(g.q,{label:e("info.about",{name:e("exec.gapRandom")}),text:e("exec.gapRandomWhy")})]})}),q&&_&&(0,a.jsx)(w,{id:"gap-max",label:e("exec.gapMax"),info:e("exec.gapMaxWhy"),unit:e("exec.gapUnit"),children:(0,a.jsx)(S,{id:"gap-max",value:Z,min:B,max:3600,onChange:e=>{V(e),eE(e)},disabled:!r})}),(0,a.jsx)(w,{id:"isolation",label:e("exec.isolation"),info:e("exec.isolationWhy"),children:(0,a.jsxs)("select",{id:"isolation",value:$,onChange:e=>{let t=e.target.value;J(t),eI("isolation",t)},disabled:!r,children:[(0,a.jsx)("option",{value:"none",children:e("exec.isolationNone")}),(0,a.jsx)("option",{value:"none-accepted",children:e("exec.isolationNoneAccepted")}),(0,a.jsx)("option",{value:"separate-account",children:e("exec.isolationAccount")}),(0,a.jsx)("option",{value:"sandbox",children:e("exec.isolationSandbox")}),(0,a.jsx)("option",{value:"vm",children:e("exec.isolationVm")})]})}),(0,a.jsx)(w,{id:"start-mode",label:e("exec.startMode"),info:e("exec.startModeWhy"),children:(0,a.jsxs)("select",{id:"start-mode",value:"confirm"===Y?"confirm":"run"===G?"unattended":"unattended-ask",onChange:async t=>{let l=t.target.value;if("unattended-ask"===l&&"unattended"!==Y&&!await (0,v.Z)(e("exec.modeAutoConfirm"))||"unattended"===l&&!await (0,v.Z)(e("exec.modeAutoAllConfirm")))return;let a="confirm"===l?"confirm":"unattended",n="unattended"===l?"run":"ask";X(a),Q(n),eI("mode",a).then(()=>eI("writtenScripts",n))},disabled:!r,children:[(0,a.jsx)("option",{value:"confirm",children:e("exec.startModeAsk")}),(0,a.jsx)("option",{value:"unattended-ask",children:e("exec.startModeAutoAsk")}),(0,a.jsx)("option",{value:"unattended",children:e("exec.startModeAuto")})]})}),(0,a.jsx)(w,{id:"network-fetch",label:e("exec.networkFetch"),info:e("exec.networkFetchWhy"),children:(0,a.jsxs)("select",{id:"network-fetch",value:ee,onChange:e=>{let t=e.target.value;et(t),eI("networkFetch",t)},disabled:!r,children:[(0,a.jsx)("option",{value:"ask",children:e("exec.networkFetchAsk")}),(0,a.jsx)("option",{value:"refuse",children:e("exec.networkFetchRefuse")}),(0,a.jsx)("option",{value:"run",children:e("exec.networkFetchRun")})]})}),(0,a.jsx)(w,{id:"questions",label:e("exec.questions"),info:e("exec.questionsWhy"),children:(0,a.jsxs)("select",{id:"questions",value:el,onChange:async t=>{let l=t.target.value;("agree"!==l||await (0,v.Z)(e("exec.questionsAgreeConfirm")))&&(ea(l),eI("questions",l))},disabled:!r,children:[(0,a.jsx)("option",{value:"ask",children:e("exec.questionsAsk")}),(0,a.jsx)("option",{value:"agree",children:e("exec.questionsAgree")})]})}),(0,a.jsx)(w,{id:"kerrigan-result",label:e("exec.kerriganResult"),info:e("exec.kerriganResultWhy"),children:(0,a.jsxs)("select",{id:"kerrigan-result",value:en,onChange:e=>{let t="exchange"===e.target.value?"exchange":"copy";es(t),eI("kerriganResult",t)},disabled:!r,children:[(0,a.jsx)("option",{value:"copy",children:e("exec.kerriganResultCopy")}),(0,a.jsx)("option",{value:"exchange",children:e("exec.kerriganResultExchange")})]})}),(0,a.jsx)("h3",{id:"subtask-retry",children:e("exec.subRetryTitle")}),(0,a.jsx)("p",{className:"muted small",children:e("exec.subRetryIntro")}),(0,a.jsx)(w,{id:"subtask-retry-mode",label:e("exec.subRetryMode"),info:e("exec.subRetryModeWhy"),children:(0,a.jsxs)("select",{id:"subtask-retry-mode",value:er,onChange:e=>{let t=e.target.value;ei(t),ef("limits","subtaskRetryMode",t)},disabled:!r,children:[(0,a.jsx)("option",{value:"ask",children:e("exec.subRetryAsk")}),(0,a.jsx)("option",{value:"same",children:e("exec.subRetrySame")}),(0,a.jsx)("option",{value:"fresh",children:e("exec.subRetryFresh")}),(0,a.jsx)("option",{value:"lead",children:e("exec.subRetryLead")})]})}),(0,a.jsx)(w,{id:"subtask-retries",label:e("exec.subRetries"),info:e("exec.subRetriesWhy"),unit:e("exec.subRetriesUnit"),children:(0,a.jsx)(S,{id:"subtask-retries",value:eo,min:0,max:3,onChange:e=>{ec(e),eF(e)},disabled:!r})}),(0,a.jsx)(w,{id:"subtask-retry-wait",label:e("exec.subRetryWait"),info:e("exec.subRetryWaitWhy"),unit:e("exec.subRetryWaitUnit"),children:(0,a.jsx)(S,{id:"subtask-retry-wait",value:ed,min:0,max:600,onChange:e=>{eu(e),eM(e)},disabled:!r})}),(0,a.jsx)(W,{msg:em,saving:t})]})}let $=/^[a-z0-9][a-z0-9._+-]*$/;function J(){let{t:e}=(0,f.kj)(),{saving:t,track:l}=F(),[r,i]=(0,n.useState)(null),[o,c]=(0,n.useState)([]),[d,u]=(0,n.useState)([]),[m,h]=(0,n.useState)([]),[p,x]=(0,n.useState)({platforms:{},readOnly:[],inForce:[]}),[j,y]=(0,n.useState)(""),[b,k]=(0,n.useState)(""),[N,S]=(0,n.useState)(""),C=(0,n.useCallback)(async()=>{var e,t,l,a;let n=await s.FH.settings(),r=null!=(l=n.raw.execution)?l:{},o=(null!=(a=null==(t=n.defaults)||null==(e=t.execution)?void 0:e.allowedPrograms)?a:[]).slice();h(o),i(Array.isArray(r.allowedPrograms)?r.allowedPrograms:o),c(Array.isArray(r.readOnlyPrograms)?r.readOnlyPrograms:[]),u(Array.isArray(r.runWithoutAsking)?r.runWithoutAsking:[]),n.programs&&x(n.programs)},[]);(0,n.useEffect)(()=>{C().catch(e=>S(e.message))},[C]);let R=async function(t,a){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;S(""),k("");try{var r;let i=(await s.FH.settings()).raw,o={...null!=(r=i.execution)?r:{}};return null===t?(delete o.allowedPrograms,delete o.readOnlyPrograms,delete o.runWithoutAsking):(o.allowedPrograms=t,o.readOnlyPrograms=a,o.runWithoutAsking=n),await l(s.FH.saveSettings({...i,execution:o})),await C(),k(e("prog.saved",{n:(null!=t?t:m).length})),!0}catch(e){return S(e.message),!1}},M=null!=r?r:[],E=async()=>{let t=j.trim().toLowerCase().replace(/\.(exe|cmd|bat|com)$/,"");if(!$.test(t))return S(e("prog.badName"));if(M.includes(t))return S(e("prog.already",{name:t}));let l=p.readOnly.includes(t)?[...o.filter(e=>e!==t),t]:o;await R([...M,t],l)&&y("")},I=async t=>{await (0,v.Z)(e("prog.removeConfirm",{name:t}),{okLabel:e("prog.removeOk"),danger:!0})&&await R(M.filter(e=>e!==t),o.filter(e=>e!==t),d.filter(e=>e!==t))},O=async(t,l)=>{var a;("run"!==l||await (0,v.Z)(e("prog.modeRunConfirm",{name:null!=(a=p.platforms[t])?a:t})))&&await R(M,"read-only"===l?[...o.filter(e=>e!==t),t]:o.filter(e=>e!==t),"run"===l?[...d.filter(e=>e!==t),t]:d.filter(e=>e!==t))},D=async()=>{await (0,v.Z)(e("prog.restoreConfirm"))&&await R(null,[],[])},L=(e,t)=>e.localeCompare(t,"en",{sensitivity:"base"}),A=M.filter(e=>p.platforms[e]).sort(L),H=M.filter(e=>!p.platforms[e]).sort(L),P=r&&p.inForce.length>0?M.filter(e=>!p.inForce.includes(e)):[],T=M.length<=1,q=t=>(0,a.jsx)("button",{type:"button",className:"quiet prog-remove",onClick:()=>void I(t),disabled:!r||T,"aria-label":e("prog.removeOne",{name:t}),title:T?e("prog.lastWhy"):e("prog.removeOne",{name:t}),children:"✕"});return(0,a.jsxs)("section",{className:"panel",id:"programs","aria-labelledby":"programs-title",children:[(0,a.jsx)("h2",{id:"programs-title",children:e("prog.title")}),(0,a.jsx)("p",{className:"muted small",children:e("prog.intro")}),N&&(0,a.jsx)("div",{className:"err",children:N}),P.length>0&&(0,a.jsx)("p",{className:"reason small",children:e("prog.locked",{list:P.join(", ")})}),A.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{id:"programs-platforms",children:e("prog.platforms")}),A.map(t=>(0,a.jsxs)("div",{className:"settings-field prog-platform",children:[(0,a.jsxs)("div",{className:"field-label",children:[(0,a.jsxs)("label",{htmlFor:"prog-mode-".concat(t),children:[(0,a.jsx)("code",{children:t})," ",(0,a.jsx)("span",{className:"muted",children:p.platforms[t]})]}),(0,a.jsx)(g.q,{label:e("info.about",{name:t}),text:e("prog.modeWhy")})]}),(0,a.jsxs)("div",{className:"field-control",children:[(0,a.jsxs)("select",{id:"prog-mode-".concat(t),value:o.includes(t)?"read-only":d.includes(t)?"run":"ask",onChange:e=>void O(t,e.target.value),disabled:!r,children:[(0,a.jsx)("option",{value:"ask",children:e("prog.modeAsk")}),p.readOnly.includes(t)&&(0,a.jsx)("option",{value:"read-only",children:e("prog.modeReadOnly")}),(0,a.jsx)("option",{value:"run",children:e("prog.modeRun")})]}),q(t)]})]},t)),A.some(e=>o.includes(e))&&(0,a.jsx)("p",{className:"small prog-note",children:e("prog.readOnlyNote")}),A.some(e=>d.includes(e))&&(0,a.jsx)("p",{className:"small prog-note prog-run-note",children:e("prog.runNote",{list:A.filter(e=>d.includes(e)).join(", ")})})]}),(0,a.jsx)("h3",{id:"programs-others",children:e("prog.others")}),(0,a.jsx)("ul",{className:"prog-chips",children:H.map(e=>(0,a.jsxs)("li",{className:"prog-chip",children:[(0,a.jsx)("code",{children:e}),q(e)]},e))}),(0,a.jsxs)(w,{id:"prog-add",label:e("prog.add"),info:e("prog.addWhy"),children:[(0,a.jsx)("input",{id:"prog-add",type:"text",dir:"ltr",spellCheck:!1,autoComplete:"off",value:j,placeholder:"az",onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E())},disabled:!r}),(0,a.jsx)("button",{type:"button",className:"primary",onClick:()=>void E(),disabled:!r||!j.trim(),children:e("prog.addButton")})]}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("button",{type:"button",onClick:()=>void D(),disabled:!r,children:e("prog.restore")})}),(0,a.jsx)(W,{msg:b,saving:t})]})}let Y=[{kind:"ts",name:"TypeScript",ext:".ts .mts .cts .tsx"},{kind:"js",name:"JavaScript",ext:".js .mjs .cjs .jsx"},{kind:"py",name:"Python",ext:".py .pyw"},{kind:"ps1",name:"PowerShell",ext:".ps1 .psm1"},{kind:"cmd",name:"cmd",ext:".bat .cmd"},{kind:"sh",name:"bash",ext:".sh .bash .zsh"},{kind:"other",name:"Ruby, Perl, PHP",ext:".rb .pl .php"},{kind:"npm",name:"npm"}];function X(){let{t:e,locale:t}=(0,f.kj)(),{saving:l,track:r}=F(),[i,o]=(0,n.useState)(null),[c,d]=(0,n.useState)(null),[u,m]=(0,n.useState)(""),[h,p]=(0,n.useState)(""),x=(0,n.useCallback)(async()=>{var e,t,l,a,n;let r=await s.FH.settings(),i=null!=(a=null==(e=r.raw.execution)?void 0:e.scripts)?a:{},c=null!=(n=null==(l=r.defaults)||null==(t=l.execution)?void 0:t.scripts)?n:{};o(Object.fromEntries(Y.map(e=>{var t,l,a,n,s,r,o,d;let{kind:u}=e;return[u,{own:null==(r=null!=(s=null==(t=i[u])?void 0:t.own)?s:null==(l=c[u])?void 0:l.own)||r,written:null!=(d=null!=(o=null==(a=i[u])?void 0:a.written)?o:null==(n=c[u])?void 0:n.written)&&d}]}))),r.scripts&&d(r.scripts)},[]);(0,n.useEffect)(()=>{x().catch(e=>p(e.message))},[x]);let j=async t=>{p(""),m("");try{var l;let a=(await s.FH.settings()).raw,n={...null!=(l=a.execution)?l:{}};null===t?delete n.scripts:n.scripts=t,await r(s.FH.saveSettings({...a,execution:n})),await x(),m(e("scr.saved"))}catch(e){p(e.message)}},y=(e,t,l)=>{if(!i)return;let a={...i,[e]:{...i[e],[t]:l}};o(a),j(a)},b=async()=>{await (0,v.Z)(e("scr.restoreConfirm"))&&await j(null)},k=t=>"npm"===t.kind?e("scr.npm"):t.name,w=[...Y].sort((e,l)=>k(e).localeCompare(k(l),t,{sensitivity:"base"})),N=!!i&&Object.values(i).some(e=>e.written),S=!!i&&!!c&&Y.some(e=>{var t,l;let{kind:a}=e;return(null==(t=i[a])?void 0:t.written)&&!(null==(l=c.inForce[a])?void 0:l.written)});return(0,a.jsxs)("section",{className:"panel",id:"scripts","aria-labelledby":"scripts-title",children:[(0,a.jsx)("h2",{id:"scripts-title",children:e("scr.title")}),(0,a.jsx)("p",{className:"muted small",children:e("scr.intro")}),h&&(0,a.jsx)("div",{className:"err",children:h}),S&&(0,a.jsx)("p",{className:"reason small",children:e("scr.locked")}),(0,a.jsxs)("table",{className:"scripts-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{scope:"col",children:e("scr.kind")}),(0,a.jsx)("th",{scope:"col",children:(0,a.jsxs)("span",{className:"scripts-head",children:[e("scr.own")," ",(0,a.jsx)(g.q,{label:e("info.about",{name:e("scr.own")}),text:e("scr.ownWhy")})]})}),(0,a.jsx)("th",{scope:"col",children:(0,a.jsxs)("span",{className:"scripts-head",children:[e("scr.written")," ",(0,a.jsx)(g.q,{label:e("info.about",{name:e("scr.written")}),text:e("scr.writtenWhy")})]})})]})}),(0,a.jsx)("tbody",{children:w.map(t=>{var l,n,s,r;return(0,a.jsxs)("tr",{"data-kind":t.kind,children:[(0,a.jsxs)("th",{scope:"row",children:[k(t)," ",t.ext&&(0,a.jsx)("code",{className:"muted small",dir:"ltr",children:t.ext})]}),(0,a.jsx)("td",{children:(0,a.jsx)("input",{type:"checkbox",id:"scr-".concat(t.kind,"-own"),"aria-label":e("scr.ownOf",{kind:k(t)}),checked:null==(s=null==i||null==(l=i[t.kind])?void 0:l.own)||s,disabled:!i,onChange:e=>y(t.kind,"own",e.target.checked)})}),(0,a.jsx)("td",{children:(0,a.jsx)("input",{type:"checkbox",id:"scr-".concat(t.kind,"-written"),"aria-label":e("scr.writtenOf",{kind:k(t)}),checked:null!=(r=null==i||null==(n=i[t.kind])?void 0:n.written)&&r,disabled:!i,onChange:e=>y(t.kind,"written",e.target.checked)})})]},t.kind)})})]}),N&&(0,a.jsx)("p",{className:"small prog-note",children:e("scr.writtenNote")}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("button",{type:"button",onClick:()=>void b(),disabled:!i,children:e("scr.restore")})}),(0,a.jsx)(W,{msg:u,saving:l})]})}},94969:(e,t,l)=>{"use strict";l.d(t,{V:()=>s});var a=l(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(e,t,l){(0,a.useEffect)(()=>{var a,s;if(!t)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=e.current,o=null!=(s=null!=(a=null==l?void 0:l.current)?a:null==i?void 0:i.querySelector(n))?s:null;null==o||o.focus();let c=e=>{if("Tab"!==e.key||!i)return;let t=Array.from(i.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let l=t[0],a=t[t.length-1],s=i.contains(document.activeElement);e.shiftKey&&(document.activeElement===l||!s)?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a&&s||(e.preventDefault(),l.focus())};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),r&&document.contains(r)&&r.focus()}},[e,t,l])}}},e=>{e.O(0,[7921,2347,3131,7358],()=>e(e.s=65323)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (()=>{"use strict";var e={},a={};function f(d){var c=a[d];if(void 0!==c)return c.exports;var b=a[d]={exports:{}},t=!0;try{e[d].call(b.exports,b,b.exports,f),t=!1}finally{t&&delete a[d]}return b.exports}f.m=e,(()=>{var e=[];f.O=(a,d,c,b)=>{if(d){b=b||0;for(var t=e.length;t>0&&e[t-1][2]>b;t--)e[t]=e[t-1];e[t]=[d,c,b];return}for(var r=1/0,t=0;t<e.length;t++){for(var[d,c,b]=e[t],o=!0,n=0;n<d.length;n++)(!1&b||r>=b)&&Object.keys(f.O).every(e=>f.O[e](d[n]))?d.splice(n--,1):(o=!1,b<r&&(r=b));if(o){e.splice(t--,1);var i=c();void 0!==i&&(a=i)}}return a}})(),f.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return f.d(a,{a:a}),a},(()=>{var e,a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;f.t=function(d,c){if(1&c&&(d=this(d)),8&c||"object"==typeof d&&d&&(4&c&&d.__esModule||16&c&&"function"==typeof d.then))return d;var b=Object.create(null);f.r(b);var t={};e=e||[null,a({}),a([]),a(a)];for(var r=2&c&&d;"object"==typeof r&&!~e.indexOf(r);r=a(r))Object.getOwnPropertyNames(r).forEach(e=>t[e]=()=>d[e]);return t.default=()=>d,f.d(b,t),b}})(),f.d=(e,a)=>{for(var d in a)f.o(a,d)&&!f.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((a,d)=>(f.f[d](e,a),a),[])),f.u=e=>"static/chunks/"+(({1384:"17449abc",2060:"20154aaa",4033:"f99cb6a2",5459:"85120a0e",6543:"2398d077",7100:"82d3f3cb",7278:"63b9f8e2",8653:"a9ddb983",9346:"c7ea4e13"})[e]||e)+"."+({12:"06a7f14bd6716249",76:"f9c2aea58a61692f",80:"df762af692aca107",192:"955be0d5fcd27ec6",344:"41cc997c8c8deeed",358:"4791f77f174006f3",384:"063f394c789898a7",386:"2718f961400a3322",441:"172f3f581f0030d1",442:"2e236a6c5c413bd9",464:"f60ecfb6c72ec733",603:"4055460889ea24d8",640:"2c2baacde5197a77",642:"b70763e1cfe9e45e",714:"b7dbce98ba0b59a8",795:"710d39b80c9ae80c",896:"eb46d6e001d25d0f",937:"6d8406b06135134f",948:"132a0571d85c8b01",972:"db753db904050e48",992:"8470b96c23472686",1017:"ce926873b598fb89",1077:"26ca37faa3726fff",1083:"0122bea31f7199d9",1350:"a5dc706c8110fd34",1384:"fa53da036b7dcfb4",1490:"f5154054ddfd3dee",1536:"98fab69162f370f0",1548:"f5790cd11a91309f",1584:"7500138d08971f81",1706:"db51b57351297898",1707:"7d64ffc060c697a0",1732:"90182d376c75c315",1872:"d12259d09bb1173f",1880:"87829ecb91209eda",1920:"59b93a4215a75653",2037:"d1bb5e37c7fe85ae",2060:"28032c3aa5bcd84d",2063:"4745e20abad5b208",2163:"aa9d9b82fcde6caa",2175:"8c8957600f6b88a8",2280:"5a3754f49656d989",2355:"d6bb92f10d516f81",2378:"4f15342be64a9d23",2395:"c2c4d3696d3b5542",2435:"9b433b38d34b4b2e",2486:"d130023b2b399eaa",2506:"bc8515842e225d2a",2529:"c88688b437d71d68",2606:"8e9434e7fee257b9",2738:"2559ed1058f6fb19",2821:"409d92f5ac5b8142",2908:"4e0e875d2d471932",3088:"12b1d19ca55225b7",3117:"a4e1c3348e8bead9",3152:"d623d85a9afed5d3",3184:"0788c67536fc4140",3194:"8ee589997ce1e093",3233:"1dcc2798f7f5efa0",3322:"4f7b378a41711478",3564:"bfa030e92401f57d",3690:"f691d3fcbd70073d",3696:"a367f4c8f42909d1",3748:"8726b202d79d0dba",3794:"19aedfb95f89dc48",3804:"593b14643e74a2a1",3816:"9f5568918e35e4ef",3854:"39b7a1bf2b4189fe",3859:"f56f3c6ac4b74cf1",3976:"11b159e82e0aa974",3986:"d47ed4855773e6dd",4008:"3691a32e1711848f",4033:"3f570aeba3860608",4054:"1c8d37b1513d20d8",4328:"e326d66dd5c820c6",4444:"36f5d8532bd6300d",4459:"d6df347eb58fccd7",4560:"b8235d283fb3608c",4619:"ae3628373decf74f",4623:"d5711a8d967e49f4",4670:"6b811cc3f67a851c",4812:"0af1380aa478f6d3",4912:"1ab85b0ebf52a3e0",4969:"4f7aff472cf938bf",4982:"bbbd303d665de4f0",5052:"dc8c36742419eed5",5115:"fbe164892bfd6fa4",5120:"b4aadb89d4fb4f65",5448:"1c4e0b719af53b3f",5459:"ac16dccf0b8d73d3",5664:"507fea1f6305067e",5706:"be484c6a7bed3fde",5790:"fe114d1a18741d62",6072:"b4b359b24b1738d4",6230:"8645bbed143793da",6260:"6b5b5c9713d7133f",6336:"b09d0d920c7631eb",6364:"5b0466f24f4ecf58",6419:"61399b0413b8bef0",6421:"3ace3aefc3e7350e",6542:"963ec591b5c2bc5a",6543:"79ae940919b9695e",6554:"0110334a71e72bbe",6688:"4a6ac23ba061262b",6885:"8fb8eeb9e792b515",6891:"dd910309748ad46b",6896:"33fdeb4e682c2cab",6912:"3416822e13b4bc03",6944:"635230aa8cb23871",6964:"35718884ad3375bc",6992:"4b059bae2659231d",6996:"7c41217972cabc3f",7024:"8bc670b892a558bb",7040:"e058d8f95c3c11e7",7100:"23be11b749288234",7220:"0ca53eefec5d01ea",7250:"7f1d45021e49d2fd",7278:"218fd437b256a7e4",7290:"7bceed706f7b6df5",7301:"c60eb2ba8ae6b859",7307:"39c27470a879fd0a",7328:"021e5e45124e40de",7333:"04d0e45b223dadd4",7340:"a5a75ee889c30b74",7443:"c189418756727101",7484:"c0e6bfca7b2fb65e",7489:"395193bf37b80884",7496:"e638a7286c17e438",7507:"9fd648884587a7f3",7664:"bd6265e6e94e1ecd",7695:"11ba99db589cb586",7764:"e62333ee1d63a458",7872:"9b08a88b7289949f",8024:"4bd0b5a7f26a0f7d",8173:"b82aa1855e641605",8216:"b248ebe0af447347",8360:"371456f14873ee9f",8381:"2d6783c030f8a913",8544:"7c1fb012f9073eaa",8547:"424f9970cc72775f",8584:"9f3b058a8f67d3d7",8616:"8e05c4a20dcdf39d",8653:"8bbb677720017a57",8662:"f2663643214caed1",8689:"e564346c6e0d16be",8752:"bf29293df3366e17",8800:"3c7b01176e98160a",8924:"49dd385ac101fb7e",9003:"3d5c7a418d0b858b",9067:"107f6164157e0aa1",9068:"9662bb8fa5fdc637",9125:"8589db5ba200cbf1",9178:"a7631bd283f2a69c",9190:"e3a90b1a9ed21668",9202:"8dcf7e6a85cc3d36",9249:"916a423ac8a07e76",9296:"59fcfc8261a4c6bd",9312:"e1fb4089a122d3d3",9313:"e4f6405d96375c40",9346:"9b71b5f026a1d6d4",9348:"022486b05b882739",9418:"1e8f8e14bb5fe3ae",9591:"d205941f0062de24",9628:"d8954a2bd28b85a6",9636:"35df6241125f8513",9658:"cdecb568f615e4c9",9680:"d10b204d08ca3a62",9728:"1d4cb6c68bd55f44",9747:"984a86f70f9cd973",9763:"da9015d4a1b533b9",9784:"c9938b7e977e14eb",9812:"024424a52730b057",9884:"8712c5ed7b044ff2",9888:"ce925cd415b672ef",9891:"a97db7c8f05693d1",9904:"a3d2f8569d7355ab",9924:"03252dda78c705c3",9968:"3d45ff9183e8b07b",9984:"cdabea5a592e42a1"})[e]+".js",f.miniCssF=e=>"static/css/"+({2737:"4bfdd3ebb3d1a180",3499:"2de713eca93a7750",5591:"73368887921d70d9"})[e]+".css",f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={},a="_N_E:";f.l=(d,c,b,t)=>{if(e[d])return void e[d].push(c);if(void 0!==b)for(var r,o,n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var l=n[i];if(l.getAttribute("src")==d||l.getAttribute("data-webpack")==a+b){r=l;break}}r||(o=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,f.nc&&r.setAttribute("nonce",f.nc),r.setAttribute("data-webpack",a+b),r.src=f.tu(d)),e[d]=[c];var u=(a,f)=>{r.onerror=r.onload=null,clearTimeout(s);var c=e[d];if(delete e[d],r.parentNode&&r.parentNode.removeChild(r),c&&c.forEach(e=>e(f)),a)return a(f)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),o&&document.head.appendChild(r)}})(),f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.U=function(e){var a=new URL(e,"x:/"),f={};for(var d in a)f[d]=a[d];for(var d in f.href=e,f.pathname=e.replace(/[?#].*/,""),f.origin=f.protocol="",f.toString=f.toJSON=()=>e,f)Object.defineProperty(this,d,{enumerable:!0,configurable:!0,value:f[d]})},f.U.prototype=URL.prototype,(()=>{var e;f.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),f.tu=e=>f.tt().createScriptURL(e),f.p="/_next/",(()=>{var e={8068:0};f.f.miniCss=(a,d)=>{e[a]?d.push(e[a]):0!==e[a]&&({2737:1,3499:1,5591:1})[a]&&d.push(e[a]=(e=>new Promise((a,d)=>{var c=f.miniCssF(e),b=f.p+c;if(((e,a)=>{for(var f=document.getElementsByTagName("link"),d=0;d<f.length;d++){var c=f[d],b=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(b===e||b===a))return c}for(var t=document.getElementsByTagName("style"),d=0;d<t.length;d++){var c=t[d],b=c.getAttribute("data-href");if(b===e||b===a)return c}})(c,b))return a();((e,a,f,d)=>{var c=document.createElement("link");return c.rel="stylesheet",c.type="text/css",c.onerror=c.onload=b=>{if(c.onerror=c.onload=null,"load"===b.type)f();else{var t=b&&("load"===b.type?"missing":b.type),r=b&&b.target&&b.target.href||a,o=Error("Loading CSS chunk "+e+" failed.\n("+r+")");o.code="CSS_CHUNK_LOAD_FAILED",o.type=t,o.request=r,c.parentNode.removeChild(c),d(o)}},c.href=a,!function(e){if("function"==typeof _N_E_STYLE_LOAD){let{href:a,onload:f,onerror:d}=e;_N_E_STYLE_LOAD(0===a.indexOf(window.location.origin)?new URL(a).pathname:a).then(()=>null==f?void 0:f.call(e,{type:"load"}),()=>null==d?void 0:d.call(e,{}))}else document.head.appendChild(e)}(c)})(e,b,a,d)}))(a).then(()=>{e[a]=0},f=>{throw delete e[a],f}))}})(),(()=>{f.b=document.baseURI||self.location.href;var e={8068:0,7353:0};f.f.j=(a,d)=>{var c=f.o(e,a)?e[a]:void 0;if(0!==c)if(c)d.push(c[2]);else if(/^(2737|3499|5591|7353|8068)$/.test(a))e[a]=0;else{var b=new Promise((f,d)=>c=e[a]=[f,d]);d.push(c[2]=b);var t=f.p+f.u(a),r=Error();f.l(t,d=>{if(f.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var b=d&&("load"===d.type?"missing":d.type),t=d&&d.target&&d.target.src;r.message="Loading chunk "+a+" failed.\n("+b+": "+t+")",r.name="ChunkLoadError",r.type=b,r.request=t,c[1](r)}},"chunk-"+a,a)}},f.O.j=a=>0===e[a];var a=(a,d)=>{var c,b,[t,r,o]=d,n=0;if(t.some(a=>0!==e[a])){for(c in r)f.o(r,c)&&(f.m[c]=r[c]);if(o)var i=o(f)}for(a&&a(d);n<t.length;n++)b=t[n],f.o(e,b)&&e[b]&&e[b][0](),e[b]=0;return f.O(i)},d=self.webpackChunk_N_E=self.webpackChunk_N_E||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})()})();
1
+ (()=>{"use strict";var e={},a={};function f(d){var c=a[d];if(void 0!==c)return c.exports;var b=a[d]={exports:{}},t=!0;try{e[d].call(b.exports,b,b.exports,f),t=!1}finally{t&&delete a[d]}return b.exports}f.m=e,(()=>{var e=[];f.O=(a,d,c,b)=>{if(d){b=b||0;for(var t=e.length;t>0&&e[t-1][2]>b;t--)e[t]=e[t-1];e[t]=[d,c,b];return}for(var r=1/0,t=0;t<e.length;t++){for(var[d,c,b]=e[t],o=!0,n=0;n<d.length;n++)(!1&b||r>=b)&&Object.keys(f.O).every(e=>f.O[e](d[n]))?d.splice(n--,1):(o=!1,b<r&&(r=b));if(o){e.splice(t--,1);var i=c();void 0!==i&&(a=i)}}return a}})(),f.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return f.d(a,{a:a}),a},(()=>{var e,a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;f.t=function(d,c){if(1&c&&(d=this(d)),8&c||"object"==typeof d&&d&&(4&c&&d.__esModule||16&c&&"function"==typeof d.then))return d;var b=Object.create(null);f.r(b);var t={};e=e||[null,a({}),a([]),a(a)];for(var r=2&c&&d;"object"==typeof r&&!~e.indexOf(r);r=a(r))Object.getOwnPropertyNames(r).forEach(e=>t[e]=()=>d[e]);return t.default=()=>d,f.d(b,t),b}})(),f.d=(e,a)=>{for(var d in a)f.o(a,d)&&!f.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((a,d)=>(f.f[d](e,a),a),[])),f.u=e=>"static/chunks/"+(({1384:"17449abc",2060:"20154aaa",4033:"f99cb6a2",5459:"85120a0e",6543:"2398d077",7100:"82d3f3cb",7278:"63b9f8e2",8653:"a9ddb983",9346:"c7ea4e13"})[e]||e)+"."+({12:"06a7f14bd6716249",76:"f9c2aea58a61692f",80:"df762af692aca107",192:"955be0d5fcd27ec6",344:"41cc997c8c8deeed",358:"4791f77f174006f3",384:"063f394c789898a7",386:"2718f961400a3322",441:"172f3f581f0030d1",442:"2e236a6c5c413bd9",464:"f60ecfb6c72ec733",603:"4055460889ea24d8",640:"2c2baacde5197a77",642:"b70763e1cfe9e45e",714:"cffed2b87154be0f",795:"710d39b80c9ae80c",896:"eb46d6e001d25d0f",937:"6d8406b06135134f",948:"132a0571d85c8b01",972:"db753db904050e48",992:"8470b96c23472686",1017:"ce926873b598fb89",1077:"1cc6d439e3dd0fa9",1083:"0122bea31f7199d9",1350:"a5dc706c8110fd34",1384:"fa53da036b7dcfb4",1490:"f5154054ddfd3dee",1536:"98fab69162f370f0",1548:"3de9dc874e47558e",1584:"7500138d08971f81",1706:"db51b57351297898",1707:"7d64ffc060c697a0",1732:"90182d376c75c315",1872:"d12259d09bb1173f",1880:"87829ecb91209eda",1920:"59b93a4215a75653",2037:"d1bb5e37c7fe85ae",2060:"28032c3aa5bcd84d",2063:"4745e20abad5b208",2163:"66458fb9c54fb52d",2175:"8c8957600f6b88a8",2280:"5a3754f49656d989",2355:"d6bb92f10d516f81",2378:"4f15342be64a9d23",2395:"c2c4d3696d3b5542",2435:"9b433b38d34b4b2e",2486:"d130023b2b399eaa",2506:"bc8515842e225d2a",2529:"c88688b437d71d68",2606:"8e9434e7fee257b9",2738:"2559ed1058f6fb19",2821:"409d92f5ac5b8142",2908:"4e0e875d2d471932",3088:"12b1d19ca55225b7",3117:"a4e1c3348e8bead9",3152:"d623d85a9afed5d3",3184:"0788c67536fc4140",3194:"8ee589997ce1e093",3233:"1dcc2798f7f5efa0",3322:"4f7b378a41711478",3564:"bfa030e92401f57d",3690:"f691d3fcbd70073d",3696:"a367f4c8f42909d1",3748:"8726b202d79d0dba",3794:"19aedfb95f89dc48",3804:"593b14643e74a2a1",3816:"9f5568918e35e4ef",3854:"39b7a1bf2b4189fe",3859:"f56f3c6ac4b74cf1",3976:"11b159e82e0aa974",3986:"d47ed4855773e6dd",4008:"3691a32e1711848f",4033:"3f570aeba3860608",4054:"1c8d37b1513d20d8",4328:"e326d66dd5c820c6",4444:"36f5d8532bd6300d",4459:"d6df347eb58fccd7",4560:"b8235d283fb3608c",4619:"ae3628373decf74f",4623:"d5711a8d967e49f4",4670:"6b811cc3f67a851c",4812:"0af1380aa478f6d3",4912:"1ab85b0ebf52a3e0",4969:"4f7aff472cf938bf",4982:"bbbd303d665de4f0",5052:"dc8c36742419eed5",5115:"fbe164892bfd6fa4",5120:"b4aadb89d4fb4f65",5448:"1c4e0b719af53b3f",5459:"ac16dccf0b8d73d3",5664:"507fea1f6305067e",5706:"be484c6a7bed3fde",5790:"fe114d1a18741d62",6072:"b4b359b24b1738d4",6230:"8645bbed143793da",6260:"6b5b5c9713d7133f",6336:"b09d0d920c7631eb",6364:"5b0466f24f4ecf58",6419:"61399b0413b8bef0",6421:"3ace3aefc3e7350e",6542:"963ec591b5c2bc5a",6543:"79ae940919b9695e",6554:"0110334a71e72bbe",6688:"4a6ac23ba061262b",6885:"8fb8eeb9e792b515",6891:"dd910309748ad46b",6896:"33fdeb4e682c2cab",6912:"3416822e13b4bc03",6944:"635230aa8cb23871",6964:"35718884ad3375bc",6992:"4b059bae2659231d",6996:"7c41217972cabc3f",7024:"8bc670b892a558bb",7040:"e058d8f95c3c11e7",7100:"23be11b749288234",7220:"30b6a3e1bd41e51a",7250:"7f1d45021e49d2fd",7278:"218fd437b256a7e4",7290:"7bceed706f7b6df5",7301:"c60eb2ba8ae6b859",7307:"39c27470a879fd0a",7328:"021e5e45124e40de",7333:"04d0e45b223dadd4",7340:"a5a75ee889c30b74",7443:"c189418756727101",7484:"c0e6bfca7b2fb65e",7489:"395193bf37b80884",7496:"e638a7286c17e438",7507:"9fd648884587a7f3",7664:"bd6265e6e94e1ecd",7695:"11ba99db589cb586",7764:"e62333ee1d63a458",7872:"9b08a88b7289949f",8024:"4bd0b5a7f26a0f7d",8173:"b82aa1855e641605",8216:"b248ebe0af447347",8360:"371456f14873ee9f",8381:"2d6783c030f8a913",8544:"7c1fb012f9073eaa",8547:"424f9970cc72775f",8584:"36422ed19d6c43e9",8616:"8e05c4a20dcdf39d",8653:"8bbb677720017a57",8662:"f2663643214caed1",8689:"e564346c6e0d16be",8752:"bf29293df3366e17",8800:"3c7b01176e98160a",8924:"49dd385ac101fb7e",9003:"3d5c7a418d0b858b",9067:"e579f97591576de2",9068:"9662bb8fa5fdc637",9125:"8589db5ba200cbf1",9178:"a7631bd283f2a69c",9190:"e3a90b1a9ed21668",9202:"8dcf7e6a85cc3d36",9249:"916a423ac8a07e76",9296:"59fcfc8261a4c6bd",9312:"e1fb4089a122d3d3",9313:"e4f6405d96375c40",9346:"9b71b5f026a1d6d4",9348:"022486b05b882739",9418:"1e8f8e14bb5fe3ae",9591:"d205941f0062de24",9628:"d8954a2bd28b85a6",9636:"35df6241125f8513",9658:"cdecb568f615e4c9",9680:"d10b204d08ca3a62",9728:"1d4cb6c68bd55f44",9747:"11247f0e21542f6d",9763:"da9015d4a1b533b9",9784:"c9938b7e977e14eb",9812:"024424a52730b057",9884:"8712c5ed7b044ff2",9888:"ce925cd415b672ef",9891:"a97db7c8f05693d1",9904:"a3d2f8569d7355ab",9924:"03252dda78c705c3",9968:"3d45ff9183e8b07b",9984:"cdabea5a592e42a1"})[e]+".js",f.miniCssF=e=>"static/css/"+({2737:"4bfdd3ebb3d1a180",3499:"2de713eca93a7750",5591:"73368887921d70d9"})[e]+".css",f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={},a="_N_E:";f.l=(d,c,b,t)=>{if(e[d])return void e[d].push(c);if(void 0!==b)for(var r,o,n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var l=n[i];if(l.getAttribute("src")==d||l.getAttribute("data-webpack")==a+b){r=l;break}}r||(o=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,f.nc&&r.setAttribute("nonce",f.nc),r.setAttribute("data-webpack",a+b),r.src=f.tu(d)),e[d]=[c];var u=(a,f)=>{r.onerror=r.onload=null,clearTimeout(s);var c=e[d];if(delete e[d],r.parentNode&&r.parentNode.removeChild(r),c&&c.forEach(e=>e(f)),a)return a(f)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),o&&document.head.appendChild(r)}})(),f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.U=function(e){var a=new URL(e,"x:/"),f={};for(var d in a)f[d]=a[d];for(var d in f.href=e,f.pathname=e.replace(/[?#].*/,""),f.origin=f.protocol="",f.toString=f.toJSON=()=>e,f)Object.defineProperty(this,d,{enumerable:!0,configurable:!0,value:f[d]})},f.U.prototype=URL.prototype,(()=>{var e;f.tt=()=>(void 0===e&&(e={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("nextjs#bundler",e))),e)})(),f.tu=e=>f.tt().createScriptURL(e),f.p="/_next/",(()=>{var e={8068:0};f.f.miniCss=(a,d)=>{e[a]?d.push(e[a]):0!==e[a]&&({2737:1,3499:1,5591:1})[a]&&d.push(e[a]=(e=>new Promise((a,d)=>{var c=f.miniCssF(e),b=f.p+c;if(((e,a)=>{for(var f=document.getElementsByTagName("link"),d=0;d<f.length;d++){var c=f[d],b=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(b===e||b===a))return c}for(var t=document.getElementsByTagName("style"),d=0;d<t.length;d++){var c=t[d],b=c.getAttribute("data-href");if(b===e||b===a)return c}})(c,b))return a();((e,a,f,d)=>{var c=document.createElement("link");return c.rel="stylesheet",c.type="text/css",c.onerror=c.onload=b=>{if(c.onerror=c.onload=null,"load"===b.type)f();else{var t=b&&("load"===b.type?"missing":b.type),r=b&&b.target&&b.target.href||a,o=Error("Loading CSS chunk "+e+" failed.\n("+r+")");o.code="CSS_CHUNK_LOAD_FAILED",o.type=t,o.request=r,c.parentNode.removeChild(c),d(o)}},c.href=a,!function(e){if("function"==typeof _N_E_STYLE_LOAD){let{href:a,onload:f,onerror:d}=e;_N_E_STYLE_LOAD(0===a.indexOf(window.location.origin)?new URL(a).pathname:a).then(()=>null==f?void 0:f.call(e,{type:"load"}),()=>null==d?void 0:d.call(e,{}))}else document.head.appendChild(e)}(c)})(e,b,a,d)}))(a).then(()=>{e[a]=0},f=>{throw delete e[a],f}))}})(),(()=>{f.b=document.baseURI||self.location.href;var e={8068:0,7353:0};f.f.j=(a,d)=>{var c=f.o(e,a)?e[a]:void 0;if(0!==c)if(c)d.push(c[2]);else if(/^(2737|3499|5591|7353|8068)$/.test(a))e[a]=0;else{var b=new Promise((f,d)=>c=e[a]=[f,d]);d.push(c[2]=b);var t=f.p+f.u(a),r=Error();f.l(t,d=>{if(f.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var b=d&&("load"===d.type?"missing":d.type),t=d&&d.target&&d.target.src;r.message="Loading chunk "+a+" failed.\n("+b+": "+t+")",r.name="ChunkLoadError",r.type=b,r.request=t,c[1](r)}},"chunk-"+a,a)}},f.O.j=a=>0===e[a];var a=(a,d)=>{var c,b,[t,r,o]=d,n=0;if(t.some(a=>0!==e[a])){for(c in r)f.o(r,c)&&(f.m[c]=r[c]);if(o)var i=o(f)}for(a&&a(d);n<t.length;n++)b=t[n],f.o(e,b)&&e[b]&&e[b][0](),e[b]=0;return f.O(i)},d=self.webpackChunk_N_E=self.webpackChunk_N_E||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})()})();