orc-ai 0.1.63 → 0.1.64

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 (98) hide show
  1. package/README.md +3 -2
  2. package/dist/index.js +897 -803
  3. package/dist/skills/orc-platform/SKILL.md +1 -1
  4. package/dist/skills/orc-platform/references/html-kit.md +154 -0
  5. package/dist/skills/orc-platform/references/scratchpads.md +6 -2
  6. package/dist/web/assets/{Agents-DmrIiUAL.js → Agents-G5dt5_s6.js} +2 -2
  7. package/dist/web/assets/Audit-De9E5Tfd.js +1 -0
  8. package/dist/web/assets/ChatUiRenderer-B1D3eTfy.js +4 -0
  9. package/dist/web/assets/ConfirmDialog-Cp1PcD4R.js +1 -0
  10. package/dist/web/assets/{Dashboard-Dh9P-zTd.js → Dashboard-DWorNfLX.js} +1 -1
  11. package/dist/web/assets/DocumentWorkspace-DZI0NvGD.js +1 -0
  12. package/dist/web/assets/FileEditor-CarhD1G9.js +1 -0
  13. package/dist/web/assets/{IntegrationCallback-CUZ5N-88.js → IntegrationCallback-CuUd_OOy.js} +1 -1
  14. package/dist/web/assets/JobWebhooks-8emXf4c1.js +1 -0
  15. package/dist/web/assets/Jobs-ComQ_dFU.js +3 -0
  16. package/dist/web/assets/Knowledge-Cm2ZVDRs.js +1 -0
  17. package/dist/web/assets/{MarkdownRenderer-fsBqw-wB.js → MarkdownRenderer-CHALCapQ.js} +5 -5
  18. package/dist/web/assets/{NativeFolderField-BuHwey26.js → NativeFolderField-CdaIEZa-.js} +1 -1
  19. package/dist/web/assets/PackageCatalog-CcPUM8f8.js +8 -0
  20. package/dist/web/assets/{PackageRunDialog-C8m43ZhJ.js → PackageRunDialog-DV1E6WX3.js} +19 -19
  21. package/dist/web/assets/{Pager-Dbs7fj3d.js → Pager-DZtibAkl.js} +1 -1
  22. package/dist/web/assets/Projects-BxrWujMD.js +3 -0
  23. package/dist/web/assets/{ResponsiveFilters-HzhzzjyL.js → ResponsiveFilters-C3siPRT-.js} +1 -1
  24. package/dist/web/assets/{ResumeActions-e6YpUhEq.js → ResumeActions-0eJvpGmW.js} +1 -1
  25. package/dist/web/assets/Rules-CHdgAIUd.js +18 -0
  26. package/dist/web/assets/{ScratchpadDiagramEditor-DkW_SmM8.js → ScratchpadDiagramEditor-6R8JsXS3.js} +1 -1
  27. package/dist/web/assets/Scratchpads-uD9R68sw.js +10 -0
  28. package/dist/web/assets/{SessionHomeLink-BAWO86fJ.js → SessionHomeLink-CMCZb7Vy.js} +1 -1
  29. package/dist/web/assets/Sessions-BD9AlzAN.js +4 -0
  30. package/dist/web/assets/Settings-Bt1even4.js +14 -0
  31. package/dist/web/assets/Skills-BSsN8kq-.js +3 -0
  32. package/dist/web/assets/{SourceEditor-B6pT-Rc0.js → SourceEditor-V5vL7Aof.js} +4 -4
  33. package/dist/web/assets/{TagInput-ChFu05vJ.js → TagInput-DU4zMpED.js} +1 -1
  34. package/dist/web/assets/TaskDetailSheet-C8dGHMsb.js +1 -0
  35. package/dist/web/assets/{Tasks-CC92r1kL.js → Tasks-wxRlyx-L.js} +6 -6
  36. package/dist/web/assets/Terminals-BFRG72xa.js +2 -0
  37. package/dist/web/assets/{ViewHeader-D-lhe59Y.js → ViewHeader-CKIR1ZTZ.js} +1 -1
  38. package/dist/web/assets/{Webhooks-BxpA1QBK.js → Webhooks-Bg3pm4rJ.js} +1 -1
  39. package/dist/web/assets/{badge-BqTVr27Z.js → badge-DfvoXiLp.js} +1 -1
  40. package/dist/web/assets/check-DrnDUgkq.js +1 -0
  41. package/dist/web/assets/chevron-down-C1WyGsAA.js +1 -0
  42. package/dist/web/assets/chevron-up-ZnWliPW7.js +1 -0
  43. package/dist/web/assets/{chunk-OB3PAWPO-1IihCzFx.js → chunk-OB3PAWPO-BD6ylT0A.js} +1 -1
  44. package/dist/web/assets/{circle-check-DWP3C_MJ.js → circle-check-CnioupGj.js} +1 -1
  45. package/dist/web/assets/{client-954dj6K2.js → client-DigivyCS.js} +1 -1
  46. package/dist/web/assets/{download-BD7lYc4O.js → download-CNwtbYo1.js} +1 -1
  47. package/dist/web/assets/{highlighted-body-JLMTFACH-CAMR1LA5.js → highlighted-body-JLMTFACH-dpkthrjz.js} +1 -1
  48. package/dist/web/assets/{index-XIDqokJX.js → index-Bc-Nka6Y.js} +50 -49
  49. package/dist/web/assets/index-BrDTqMtQ.css +1 -0
  50. package/dist/web/assets/{live-sessions-C6D_vHcN.js → live-sessions-BG3mNXnQ.js} +1 -1
  51. package/dist/web/assets/{maximize-2-BUxUwGbf.js → maximize-2-CcupqYE8.js} +1 -1
  52. package/dist/web/assets/mermaid-WFAXDIZX-BX9NWlJb.js +1 -0
  53. package/dist/web/assets/orc-kit-BZEVA3Qv.js +317 -0
  54. package/dist/web/assets/{scratchpad-kinds-B0Y6McXL.js → scratchpad-kinds-RGciqVT1.js} +1 -1
  55. package/dist/web/assets/{scratchpad-routes-BtsIfhUW.js → scratchpad-routes-Q2TRGUnx.js} +1 -1
  56. package/dist/web/assets/send-0IpktRLv.js +1 -0
  57. package/dist/web/assets/{upload-CPf6QZHl.js → upload-CaDKCpy5.js} +1 -1
  58. package/dist/web/assets/{useDetailRoute-DOhAbdV7.js → useDetailRoute-B-xjWsyW.js} +1 -1
  59. package/dist/web/assets/{useIntegrations-C0MAVKB4.js → useIntegrations-C6zijOMH.js} +1 -1
  60. package/dist/web/assets/{useJobs-BlWldKP0.js → useJobs-Dly6n-pv.js} +1 -1
  61. package/dist/web/assets/{useMemories-CAf8HcOI.js → useMemories-jakANU6m.js} +1 -1
  62. package/dist/web/assets/useProjectScope-DpgzthH7.js +1 -0
  63. package/dist/web/assets/{useSessions-DiUU2FN8.js → useSessions-tFa1FZ9M.js} +1 -1
  64. package/dist/web/assets/{view-params-DD7i9s5g.js → view-params-YEmeZppw.js} +1 -1
  65. package/dist/web/assets/{x-tY-z3woy.js → x-BayoBYp_.js} +1 -1
  66. package/dist/web/index.html +11 -18
  67. package/dist/web/sw.js +26 -17
  68. package/package.json +1 -1
  69. package/dist/web/assets/Audit-DGSNmToV.js +0 -1
  70. package/dist/web/assets/ChatUiRenderer-Dddr55cW.js +0 -4
  71. package/dist/web/assets/ConfirmDialog-B5es4nUp.js +0 -1
  72. package/dist/web/assets/DocumentWorkspace-I81K42yx.js +0 -1
  73. package/dist/web/assets/FileEditor-wRs221QU.js +0 -1
  74. package/dist/web/assets/JobWebhooks-oaF694Af.js +0 -1
  75. package/dist/web/assets/Jobs-Lmyw5700.js +0 -3
  76. package/dist/web/assets/Knowledge-V4JuZnUZ.js +0 -1
  77. package/dist/web/assets/Markdown-D-AaJ4bU.js +0 -2
  78. package/dist/web/assets/MarkdownEditor-5U4_BhYm.js +0 -2
  79. package/dist/web/assets/PackageCatalog-BC-yAjPQ.js +0 -8
  80. package/dist/web/assets/Projects-C280nbHV.js +0 -3
  81. package/dist/web/assets/Rules-BwsnRQBe.js +0 -18
  82. package/dist/web/assets/Scratchpads-BtUKOhup.js +0 -10
  83. package/dist/web/assets/Sessions-Cn2dIJBt.js +0 -4
  84. package/dist/web/assets/Settings-Bb01CfFw.js +0 -14
  85. package/dist/web/assets/Skills-Vw41zPVg.js +0 -3
  86. package/dist/web/assets/TaskDetailSheet-DuTfo6rZ.js +0 -1
  87. package/dist/web/assets/Terminals-dCbgpRsm.js +0 -2
  88. package/dist/web/assets/check-Cg2_C_4I.js +0 -1
  89. package/dist/web/assets/chevron-down-KBvm_HoX.js +0 -1
  90. package/dist/web/assets/dialog-DNIYhwi4.js +0 -1
  91. package/dist/web/assets/file-kind-BYU1kv95.js +0 -1
  92. package/dist/web/assets/index-hvCYuRJb.css +0 -1
  93. package/dist/web/assets/label-Bm_d0NKL.js +0 -1
  94. package/dist/web/assets/mermaid-WFAXDIZX-Bzg8wVqT.js +0 -1
  95. package/dist/web/assets/select-cyLFVkkB.js +0 -1
  96. package/dist/web/assets/tabs-bEwJLtA0.js +0 -1
  97. package/dist/web/assets/textarea-CovStda2.js +0 -1
  98. package/dist/web/assets/useProjectScope-DtEj9j-P.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{h as r}from"./client-954dj6K2.js";import{t as i}from"./Markdown-D-AaJ4bU.js";import{t as a}from"./file-kind-BYU1kv95.js";import{d as o,wr as s}from"./index-XIDqokJX.js";var c={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};c.node;var l=r(c),u=[],d=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?d:u).push(n+=e[t])})();function f(e){if(e<768)return!1;for(let t=0,n=u.length;;){let r=t+n>>1;if(e<u[r])n=r;else if(e>=d[r])t=r+1;else return!0;if(t==n)return!1}}function p(e){return e>=127462&&e<=127487}var m=8205;function h(e,t,n=!0,r=!0){return(n?g:_)(e,t,r)}function g(e,t,n){if(t==e.length)return t;t&&y(e.charCodeAt(t))&&b(e.charCodeAt(t-1))&&t--;let r=v(e,t);for(t+=ee(r);t<e.length;){let i=v(e,t);if(r==m||i==m||n&&f(i))t+=ee(i),r=i;else if(p(i)){let n=0,r=t-2;for(;r>=0&&p(v(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function _(e,t,n){for(;t>1;){let r=g(e,t-2,n);if(r<t)return r;t--}return 0}function v(e,t){let n=e.charCodeAt(t);if(!b(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return y(r)?(n-55296<<10)+(r-56320)+65536:n}function y(e){return e>=56320&&e<57344}function b(e){return e>=55296&&e<56320}function ee(e){return e<65536?1:2}var x=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=le(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),te.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=le(this,e,t);let n=[];return this.decompose(e,t,n,0),te.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ae(this),i=new ae(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ae(this,e)}iterRange(e,t=this.length){return new oe(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new se(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new S(t):te.from(S.split(t,[]))}},S=class e extends x{constructor(e,t=ne(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ce(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ie(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=re(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=le(this,t,n);let i=re(this.text,re(r.text,ie(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):te.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{h as r}from"./client-DigivyCS.js";import{Hn as i,d as a,ei as o,yt as s}from"./index-Bc-Nka6Y.js";var c={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};c.node;var l=r(c),u=[],d=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,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t<e.length;t++)(t%2?d:u).push(n+=e[t])})();function f(e){if(e<768)return!1;for(let t=0,n=u.length;;){let r=t+n>>1;if(e<u[r])n=r;else if(e>=d[r])t=r+1;else return!0;if(t==n)return!1}}function p(e){return e>=127462&&e<=127487}var m=8205;function h(e,t,n=!0,r=!0){return(n?g:_)(e,t,r)}function g(e,t,n){if(t==e.length)return t;t&&y(e.charCodeAt(t))&&b(e.charCodeAt(t-1))&&t--;let r=v(e,t);for(t+=ee(r);t<e.length;){let i=v(e,t);if(r==m||i==m||n&&f(i))t+=ee(i),r=i;else if(p(i)){let n=0,r=t-2;for(;r>=0&&p(v(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function _(e,t,n){for(;t>1;){let r=g(e,t-2,n);if(r<t)return r;t--}return 0}function v(e,t){let n=e.charCodeAt(t);if(!b(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return y(r)?(n-55296<<10)+(r-56320)+65536:n}function y(e){return e>=56320&&e<57344}function b(e){return e>=55296&&e<56320}function ee(e){return e<65536?1:2}var x=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=le(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),te.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=le(this,e,t);let n=[];return this.decompose(e,t,n,0),te.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ae(this),i=new ae(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ae(this,e)}iterRange(e,t=this.length){return new oe(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new se(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new S(t):te.from(S.split(t,[]))}},S=class e extends x{constructor(e,t=ne(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ce(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ie(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=re(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=le(this,t,n);let i=re(this.text,re(r.text,ie(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):te.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
2
2
  `){[e,t]=le(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},te=class e extends x{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=le(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
3
3
  `){[e,t]=le(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new S(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof S&&c&&(n=u[u.length-1])instanceof S&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new S(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};x.empty=new S([``],0);function ne(e){let t=-1;for(let n of e)t+=n.length+1;return t}function re(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function ie(e,t,n){return re(e,[``],t,n)}var ae=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof S?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof S?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(r instanceof S){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof S?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},oe=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new ae(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},se=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(x.prototype[Symbol.iterator]=function(){return this.iter()},ae.prototype[Symbol.iterator]=oe.prototype[Symbol.iterator]=se.prototype[Symbol.iterator]=function(){return this});var ce=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function le(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function C(e,t,n=!0,r=!0){return h(e,t,n,r)}function ue(e){return e>=56320&&e<57344}function de(e){return e>=55296&&e<56320}function fe(e,t){let n=e.charCodeAt(t);if(!de(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ue(r)?(n-55296<<10)+(r-56320)+65536:n}function pe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function me(e){return e<65536?1:2}var he=/\r\n?|\n/,ge=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(ge||={}),_e=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){xe(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:Ce(this,e)}mapDesc(e,t=!1){return e.empty?this:Se(this,e,t)}mapPos(e,t=-1,n=ge.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=ge.Simple&&c>=e&&(n==ge.TrackDel&&r<e&&c>e||n==ge.TrackBefore&&r<e||n==ge.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},ve=class e extends _e{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return xe(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Se(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(x.empty);r.push(a?t.slice(i,i+a):x.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:Ce(this,e,!0)}map(e,t=!1){return e.empty?this:Se(this,e,t,!0)}iterChanges(e,t=!1){xe(this,e,t)}get desc(){return _e.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new we(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);ye(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;ye(n,e,t),t>0&&be(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);ye(n,e,-1),ye(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:_e.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&ye(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?x.of(l.split(r||he)):l:x.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&ye(i,e-o,-1),ye(i,s-e,d),be(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(x.empty);r[e]=x.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function ye(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function be(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(x.empty);e.push(n)}}function xe(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=x.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Se(e,t,n,r=!1){let i=[],a=r?[]:null,o=new we(e),s=new we(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);ye(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(ye(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(ye(i,0,o.ins),a&&be(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;ye(i,t,e<o.i?o.ins:0),a&&e<o.i&&be(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?ve.createSet(i,a):_e.create(i);else throw Error(`Mismatched change set lengths`)}function Ce(e,t,n=!1){let r=[],i=n?[]:null,a=new we(e),o=new we(t);for(let e=!1;;)if(a.done&&o.done)return i?ve.createSet(r,i):_e.create(r);else if(a.ins==0)ye(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)ye(r,0,o.ins,e),i&&be(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;ye(r,t,n,e),i&&n&&be(i,r,o.text)}else o.ins==-1?(ye(r,a.off?0:a.len,t,e),i&&be(i,r,a.textBit(t))):(ye(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&be(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var we=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?x.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?x.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Te=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return w.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return w.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return w.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},w=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Te.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return Te.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?Te.create(t,e,a|32,n):Te.create(e,t,a,n)}static undirectionalRange(e,t){return Te.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Ee(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var De=0,T=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=De++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Oe),!!t.static,t.enables)}of(e){return new ke([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new ke(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new ke(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Oe(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var ke=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=De++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||je(e,c)){let r=t(e);if(a?!Ae(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=We(o,c);if(this.dependencies.every(t=>t instanceof T?o.facet(t)===e.facet(t):t instanceof Pe?o.field(t,!1)==e.field(t,!1):!0)||(a?Ae(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Ae(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function je(e,t){let n=!1;for(let r of t)Ue(e,r)&1&&(n=!0);return n}function Me(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=We(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Ue(e,t);return e.values[o]=s(e),1},update(e,n){if(!je(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=je(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&Oe(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Ne=T.define({static:!0}),Pe=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(De++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ne).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ne),i=n.facet(Ne),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ne.of({field:this,create:e})]}get extension(){return this}},Fe={lowest:4,low:3,default:2,high:1,highest:0};function Ie(e){return t=>new Re(t,e)}var Le={highest:Ie(Fe.highest),high:Ie(Fe.high),default:Ie(Fe.default),low:Ie(Fe.low),lowest:Ie(Fe.lowest)},Re=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},ze=class e{of(e){return new Be(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Be=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ve=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of He(t,n,o))e instanceof Pe?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Oe(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Me(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function He(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Be&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Be){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Re)a(e.inner,e.prec);else if(e instanceof Pe)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof ke)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Fe.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Fe.default),r.reduce((e,t)=>e.concat(t))}function Ue(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function We(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Ge=T.define(),Ke=T.define({combine:e=>e.some(e=>e),static:!0}),qe=T.define({combine:e=>e.length?e[0]:void 0,static:!0}),Je=T.define(),Ye=T.define(),Xe=T.define(),Ze=T.define({combine:e=>e.length?e[0]:!1}),Qe=class{constructor(e,t){this.type=e,this.value=t}static define(){return new $e}},$e=class{of(e){return new Qe(this,e)}},et=class{constructor(e){this.map=e}of(e){return new E(this,e)}},E=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new et(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};E.reconfigure=E.define(),E.appendConfig=E.define();var tt=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Ee(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};tt.time=Qe.define(),tt.userEvent=Qe.define(),tt.addToHistory=Qe.define(),tt.remote=Qe.define();function nt(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function rt(e,t,n){let r,i,a;return n?(r=t.changes,i=ve.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:E.mapEffects(e.effects,r).concat(E.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function it(e,t,n){let r=t.selection,i=lt(t.annotations);return t.userEvent&&(i=i.concat(tt.userEvent.of(t.userEvent))),{changes:t.changes instanceof ve?t.changes:ve.of(t.changes||[],n,e.facet(qe)),selection:r&&(r instanceof w?r:w.single(r.anchor,r.head)),effects:lt(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function at(e,t,n){let r=it(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=rt(r,it(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=tt.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return st(n?ot(i):i)}function ot(e){let t=e.startState,n=!0;for(let r of t.facet(Je)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:nt(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=ve.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=tt.create(t,r,e.selection&&e.selection.map(i),E.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Ye);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof tt?i:Array.isArray(i)&&i.length==1&&i[0]instanceof tt?i[0]:at(t,lt(i),!1)}return e}function st(e){let t=e.startState,n=t.facet(Xe),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=rt(r,it(t,a,e.changes.newLength),!0))}return r==e?e:tt.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var ct=[];function lt(e){return e==null?ct:Array.isArray(e)?e:[e]}var D=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(D||={}),ut=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,dt;try{dt=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function ft(e){if(dt)return dt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>`€`&&(n.toUpperCase()!=n.toLowerCase()||ut.test(n)))return!0}return!1}function pt(e){return t=>{if(!/\S/.test(t))return D.Space;if(ft(t))return D.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return D.Word;return D.Other}}var O=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Ue(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`)}else return Ue(this,n),We(this,n)}update(...e){return at(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(ze.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(E.reconfigure)?(n=null,r=e.value):e.is(E.appendConfig)&&(n=null,r=lt(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ve.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Ke)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:w.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=lt(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=E.mapEffects(a,c).concat(E.mapEffects(lt(o.effects),l))}return{changes:r,selection:w.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof ve?t:ve.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return x.of(t.split(this.facet(e.lineSeparator)||he))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ue(this,t),We(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Pe&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:w.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ve.resolve(t.extensions||[],new Map),r=t.doc instanceof x?t.doc:x.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||he)),i=t.selection?t.selection instanceof w?t.selection:w.single(t.selection.anchor,t.selection.head):w.single(0);return Ee(i,r.length),n.staticFacet(Ke)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
@@ -44,11 +44,11 @@ except \${error}:
44
44
  `,{label:`if`,detail:`block`,type:`keyword`}),J(`if \${}:
45
45
  \${}
46
46
  else:
47
- \${}`,{label:`if`,detail:`/ else block`,type:`keyword`}),J("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:`class`,detail:`definition`,type:`keyword`}),J("import ${module}",{label:`import`,detail:`statement`,type:`keyword`}),J("from ${module} import ${names}",{label:`from`,detail:`import`,type:`keyword`})],nD=Tg(QE,wg(eD.concat(tD)));function rD(e){let{node:t,pos:n}=e,r=e.lineIndent(n,-1),i=null;for(;;){let a=t.childBefore(n);if(!a)break;if(a.name==`Comment`)n=a.from;else if(a.name==`Body`||a.name==`MatchBody`)e.baseIndentFor(a)+e.unit<=r&&(i=a),t=a;else if(a.name==`MatchClause`)t=a;else if(a.type.is(`Statement`))t=a;else break}return i}function iD(e,t){let n=e.baseIndentFor(t),r=e.lineAt(e.pos,-1),i=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&e.node.to<i+100&&!/\S/.test(e.state.sliceDoc(i,e.node.to))&&e.lineIndent(e.pos,-1)<=n||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(e.textAfter)&&e.lineIndent(e.pos,-1)>n?null:n+e.unit}var aD=Lu.define({name:`python`,parser:GE.configure({props:[td.add({Body:e=>iD(e,/^\s*(#|$)/.test(e.textAfter)&&rD(e)||e.node)??e.continue(),MatchBody:e=>iD(e,rD(e)||e.node)??e.continue(),IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ud({closing:`)`}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ud({closing:`}`}),"ArrayExpression ArrayComprehensionExpression":ud({closing:`]`}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{let t=rD(e);return(t&&iD(e,t))??e.continue()}}),_d.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":vd,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`'''`,`"""`],stringPrefixes:[`f`,`fr`,`rf`,`r`,`u`,`b`,`br`,`rb`,`F`,`FR`,`RF`,`R`,`U`,`B`,`BR`,`RB`]},commentTokens:{line:`#`},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function oD(){return new qu(aD,[aD.data.of({autocomplete:$E}),aD.data.of({autocomplete:nD})])}var sD=63,cD=64,lD=1,uD=2,dD=3,fD=4,pD=5,mD=6,hD=7,gD=65,_D=66,vD=8,yD=9,bD=10,xD=11,SD=12,CD=13,wD=19,TD=20,ED=29,DD=33,OD=34,kD=47,AD=0,jD=1,MD=2,ND=3,PD=4,FD=class{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}};FD.top=new FD(null,-1,AD);function ID(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(RD(t)||t==-1)return n}}function LD(e){return e==32||e==9}function RD(e){return e==10||e==13}function zD(e){return LD(e)||RD(e)}function BD(e){return e<0||zD(e)}var VD=new ry({start:FD.top,reduce(e,t){return e.type==ND&&(t==TD||t==OD)?e.parent:e},shift(e,t,n,r){if(t==dD)return new FD(e,ID(r,r.pos),jD);if(t==gD||t==pD)return new FD(e,ID(r,r.pos),MD);if(t==sD)return e.parent;if(t==wD||t==DD)return new FD(e,0,ND);if(t==CD&&e.type==PD)return e.parent;if(t==kD){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new FD(e,e.depth+ +t[0],PD)}return e},hash(e){return e.hash}});function HD(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&BD(e.peek(n+3))}var UD=new X((e,t)=>{if(e.next==-1&&t.canShift(cD))return e.acceptToken(cD);let n=e.peek(-1);if((RD(n)||n<0)&&t.context.type!=ND){if(HD(e,45)){if(t.canShift(sD))e.acceptToken(sD);else return e.acceptToken(lD,3)}if(HD(e,46)){if(t.canShift(sD))e.acceptToken(sD);else return e.acceptToken(uD,3)}let n=0;for(;e.next==32;)n++,e.advance();(n<t.context.depth||n==t.context.depth&&t.context.type==jD&&(e.next!=45||!BD(e.peek(1))))&&e.next!=-1&&!RD(e.next)&&e.next!=35&&e.acceptToken(sD,-n)}},{contextual:!0}),WD=new X((e,t)=>{if(t.context.type==ND)e.next==63&&(e.advance(),BD(e.next)&&e.acceptToken(hD));else if(e.next==45)e.advance(),BD(e.next)&&e.acceptToken(t.context.type==jD&&t.context.depth==ID(e,e.pos-1)?fD:dD);else if(e.next==63)e.advance(),BD(e.next)&&e.acceptToken(t.context.type==MD&&t.context.depth==ID(e,e.pos-1)?mD:pD);else{let n=e.pos;for(;;)if(LD(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)JD(e);else if(e.next==38)YD(e);else if(e.next==42){YD(e);break}else if(e.next==39||e.next==34){if(XD(e,!0))break;return}else if(e.next==91||e.next==123){if(!ZD(e))return;break}else{tO(e,!0,!1,0);break}for(;LD(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(ED))return;BD(e.peek(1))&&e.acceptTokenTo(t.context.type==MD&&t.context.depth==ID(e,n)?_D:gD,n)}}},{contextual:!0});function GD(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function KD(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function qD(e,t){return e.next==37?(e.advance(),KD(e.next)&&e.advance(),KD(e.next)&&e.advance(),!0):GD(e.next)||t&&e.next==44?(e.advance(),!0):!1}function JD(e){if(e.advance(),e.next==60){for(e.advance();;)if(!qD(e,!0)){e.next==62&&e.advance();break}}else for(;qD(e,!1););}function YD(e){for(e.advance();!BD(e.next)&&$D(e.next)!=`f`;)e.advance()}function XD(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==n){if(a==39){if(e.next==39)e.advance();else break}else break}else if(a==92&&n==34)e.next>=0&&e.advance();else if(RD(a)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function ZD(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!XD(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else if(e.next<0||e.pos>n||RD(e.next))return!1;else e.advance()}var QD=`iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif`;function $D(e){return e<33?`u`:e>125?`s`:QD[e-33]}function eO(e,t){let n=$D(e);return n!=`u`&&!(t&&n==`f`)}function tO(e,t,n,r){if($D(e.next)==`s`||(e.next==63||e.next==58||e.next==45)&&eO(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let a=e.next,o=0,s=r+1;for(;zD(a);){if(RD(a)){if(t)return!1;s=0}else s++;a=e.peek(++o)}if(!(a>=0&&(a==58?eO(e.peek(o+1),n):a==35?e.peek(o-1)!=32:eO(a,n)))||!n&&s<=r||s==0&&!n&&(HD(e,45,o)||HD(e,46,o)))break;if(t&&$D(a)==`f`)return!1;for(let t=o;t>=0;t--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}var nO=new X((e,t)=>{if(e.next==33)JD(e),e.acceptToken(SD);else if(e.next==38||e.next==42){let t=e.next==38?bD:xD;YD(e),e.acceptToken(t)}else e.next==39||e.next==34?(XD(e,!1),e.acceptToken(yD)):tO(e,!1,t.context.type==ND,t.context.depth)&&e.acceptToken(vD)}),rO=new X((e,t)=>{let n=t.context.type==PD?t.context.depth:-1,r=e.pos;scan:for(;;){let i=0,a=e.next;for(;a==32;)a=e.peek(++i);if(!i&&(HD(e,45,i)||HD(e,46,i))||!RD(a)&&(n<0&&(n=Math.max(t.context.depth+1,i)),i<n))break;for(;;){if(e.next<0)break scan;let t=RD(e.next);if(e.advance(),t)continue scan;r=e.pos}}e.acceptTokenTo(CD,r)}),iO=uu({DirectiveName:G.keyword,DirectiveContent:G.attributeValue,"DirectiveEnd DocEnd":G.meta,QuotedLiteral:G.string,BlockLiteralHeader:G.special(G.string),BlockLiteralContent:G.content,Literal:G.content,"Key/Literal Key/QuotedLiteral":G.definition(G.propertyName),"Anchor Alias":G.labelName,Tag:G.typeName,Comment:G.lineComment,": , -":G.separator,"?":G.punctuation,"[ ]":G.squareBracket,"{ }":G.brace}),aO=iy.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQ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c!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:`⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document`,maxTerm:74,context:VD,nodeProps:[[`isolate`,-3,8,9,14,``],[`openedBy`,18,`[`,32,`{`],[`closedBy`,19,`]`,33,`}`]],propSources:[iO],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]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]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),sO=Lu.define({name:`yaml`,parser:aO.configure({props:[td.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name==`BlockLiteralContent`&&t.from<t.to)return e.baseIndentFor(t);if(t.name==`BlockLiteral`)return e.baseIndentFor(t)+e.unit;if(t.name==`BlockSequence`||t.name==`BlockMapping`)return e.column(t.firstChild.from,1);if(t.name==`QuotedLiteral`)return null;if(t.name==`Literal`){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)return null}}return null},FlowMapping:ud({closing:`}`}),FlowSequence:ud({closing:`]`})}),_d.add({"FlowMapping FlowSequence":vd,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:`#`},indentOnInput:/^\s*[\]\}]$/}});function cO(){return new qu(sO)}var lO=Lu.define({name:`yaml-frontmatter`,parser:oO.configure({props:[uu({DashLine:G.meta})]})});function uO(e){let{language:t,support:n}=e.content instanceof qu?e.content:{language:e.content,support:[]};return new qu(lO.configure({wrap:Wl(e=>e.name==`FrontmatterContent`?{parser:sO.parser}:e.name==`Body`?{parser:t.parser}:null)}),n)}function dO(e){let t=e.split(`.`).pop()?.toLowerCase();return[`ts`,`tsx`,`js`,`jsx`,`mjs`,`cjs`].includes(t??``)?yS({typescript:t===`ts`||t===`tsx`,jsx:t===`jsx`||t===`tsx`}):t===`json`?iC():t===`css`?sb():[`html`,`htm`].includes(t??``)?ZS():[`md`,`markdown`,`mdx`].includes(t??``)?uO({content:iT()}):[`yaml`,`yml`].includes(t??``)?cO():t===`py`?oD():[]}var fO=n(),pO=Qe.define();function mO({path:e,value:t,onChange:n,onSave:r,readOnly:c=!1,height:u=320,testId:d=`code-editor-input`,id:f,label:p,placeholder:m,hidePreview:h=!1,defaultWrap:g=!1,line:_}){let{theme:v}=o(),y=(0,Y.useRef)(null),b=(0,Y.useRef)(null),ee=(0,Y.useRef)({path:e,value:t,readOnly:c,testId:d,id:f,label:p,placeholder:m,defaultWrap:g,theme:v}),x=(0,Y.useRef)(n);x.current=n;let S=(0,Y.useRef)(r);S.current=r;let te=(0,Y.useRef)(t.includes(`\r
47
+ \${}`,{label:`if`,detail:`/ else block`,type:`keyword`}),J("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:`class`,detail:`definition`,type:`keyword`}),J("import ${module}",{label:`import`,detail:`statement`,type:`keyword`}),J("from ${module} import ${names}",{label:`from`,detail:`import`,type:`keyword`})],nD=Tg(QE,wg(eD.concat(tD)));function rD(e){let{node:t,pos:n}=e,r=e.lineIndent(n,-1),i=null;for(;;){let a=t.childBefore(n);if(!a)break;if(a.name==`Comment`)n=a.from;else if(a.name==`Body`||a.name==`MatchBody`)e.baseIndentFor(a)+e.unit<=r&&(i=a),t=a;else if(a.name==`MatchClause`)t=a;else if(a.type.is(`Statement`))t=a;else break}return i}function iD(e,t){let n=e.baseIndentFor(t),r=e.lineAt(e.pos,-1),i=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&e.node.to<i+100&&!/\S/.test(e.state.sliceDoc(i,e.node.to))&&e.lineIndent(e.pos,-1)<=n||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(e.textAfter)&&e.lineIndent(e.pos,-1)>n?null:n+e.unit}var aD=Lu.define({name:`python`,parser:GE.configure({props:[td.add({Body:e=>iD(e,/^\s*(#|$)/.test(e.textAfter)&&rD(e)||e.node)??e.continue(),MatchBody:e=>iD(e,rD(e)||e.node)??e.continue(),IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ud({closing:`)`}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ud({closing:`}`}),"ArrayExpression ArrayComprehensionExpression":ud({closing:`]`}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{let t=rD(e);return(t&&iD(e,t))??e.continue()}}),_d.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":vd,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`'''`,`"""`],stringPrefixes:[`f`,`fr`,`rf`,`r`,`u`,`b`,`br`,`rb`,`F`,`FR`,`RF`,`R`,`U`,`B`,`BR`,`RB`]},commentTokens:{line:`#`},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function oD(){return new qu(aD,[aD.data.of({autocomplete:$E}),aD.data.of({autocomplete:nD})])}var sD=63,cD=64,lD=1,uD=2,dD=3,fD=4,pD=5,mD=6,hD=7,gD=65,_D=66,vD=8,yD=9,bD=10,xD=11,SD=12,CD=13,wD=19,TD=20,ED=29,DD=33,OD=34,kD=47,AD=0,jD=1,MD=2,ND=3,PD=4,FD=class{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}};FD.top=new FD(null,-1,AD);function ID(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(RD(t)||t==-1)return n}}function LD(e){return e==32||e==9}function RD(e){return e==10||e==13}function zD(e){return LD(e)||RD(e)}function BD(e){return e<0||zD(e)}var VD=new ry({start:FD.top,reduce(e,t){return e.type==ND&&(t==TD||t==OD)?e.parent:e},shift(e,t,n,r){if(t==dD)return new FD(e,ID(r,r.pos),jD);if(t==gD||t==pD)return new FD(e,ID(r,r.pos),MD);if(t==sD)return e.parent;if(t==wD||t==DD)return new FD(e,0,ND);if(t==CD&&e.type==PD)return e.parent;if(t==kD){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new FD(e,e.depth+ +t[0],PD)}return e},hash(e){return e.hash}});function HD(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&BD(e.peek(n+3))}var UD=new X((e,t)=>{if(e.next==-1&&t.canShift(cD))return e.acceptToken(cD);let n=e.peek(-1);if((RD(n)||n<0)&&t.context.type!=ND){if(HD(e,45)){if(t.canShift(sD))e.acceptToken(sD);else return e.acceptToken(lD,3)}if(HD(e,46)){if(t.canShift(sD))e.acceptToken(sD);else return e.acceptToken(uD,3)}let n=0;for(;e.next==32;)n++,e.advance();(n<t.context.depth||n==t.context.depth&&t.context.type==jD&&(e.next!=45||!BD(e.peek(1))))&&e.next!=-1&&!RD(e.next)&&e.next!=35&&e.acceptToken(sD,-n)}},{contextual:!0}),WD=new X((e,t)=>{if(t.context.type==ND)e.next==63&&(e.advance(),BD(e.next)&&e.acceptToken(hD));else if(e.next==45)e.advance(),BD(e.next)&&e.acceptToken(t.context.type==jD&&t.context.depth==ID(e,e.pos-1)?fD:dD);else if(e.next==63)e.advance(),BD(e.next)&&e.acceptToken(t.context.type==MD&&t.context.depth==ID(e,e.pos-1)?mD:pD);else{let n=e.pos;for(;;)if(LD(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)JD(e);else if(e.next==38)YD(e);else if(e.next==42){YD(e);break}else if(e.next==39||e.next==34){if(XD(e,!0))break;return}else if(e.next==91||e.next==123){if(!ZD(e))return;break}else{tO(e,!0,!1,0);break}for(;LD(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(ED))return;BD(e.peek(1))&&e.acceptTokenTo(t.context.type==MD&&t.context.depth==ID(e,n)?_D:gD,n)}}},{contextual:!0});function GD(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function KD(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function qD(e,t){return e.next==37?(e.advance(),KD(e.next)&&e.advance(),KD(e.next)&&e.advance(),!0):GD(e.next)||t&&e.next==44?(e.advance(),!0):!1}function JD(e){if(e.advance(),e.next==60){for(e.advance();;)if(!qD(e,!0)){e.next==62&&e.advance();break}}else for(;qD(e,!1););}function YD(e){for(e.advance();!BD(e.next)&&$D(e.next)!=`f`;)e.advance()}function XD(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==n){if(a==39){if(e.next==39)e.advance();else break}else break}else if(a==92&&n==34)e.next>=0&&e.advance();else if(RD(a)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function ZD(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!XD(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else if(e.next<0||e.pos>n||RD(e.next))return!1;else e.advance()}var QD=`iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif`;function $D(e){return e<33?`u`:e>125?`s`:QD[e-33]}function eO(e,t){let n=$D(e);return n!=`u`&&!(t&&n==`f`)}function tO(e,t,n,r){if($D(e.next)==`s`||(e.next==63||e.next==58||e.next==45)&&eO(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let a=e.next,o=0,s=r+1;for(;zD(a);){if(RD(a)){if(t)return!1;s=0}else s++;a=e.peek(++o)}if(!(a>=0&&(a==58?eO(e.peek(o+1),n):a==35?e.peek(o-1)!=32:eO(a,n)))||!n&&s<=r||s==0&&!n&&(HD(e,45,o)||HD(e,46,o)))break;if(t&&$D(a)==`f`)return!1;for(let t=o;t>=0;t--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}var nO=new X((e,t)=>{if(e.next==33)JD(e),e.acceptToken(SD);else if(e.next==38||e.next==42){let t=e.next==38?bD:xD;YD(e),e.acceptToken(t)}else e.next==39||e.next==34?(XD(e,!1),e.acceptToken(yD)):tO(e,!1,t.context.type==ND,t.context.depth)&&e.acceptToken(vD)}),rO=new X((e,t)=>{let n=t.context.type==PD?t.context.depth:-1,r=e.pos;scan:for(;;){let i=0,a=e.next;for(;a==32;)a=e.peek(++i);if(!i&&(HD(e,45,i)||HD(e,46,i))||!RD(a)&&(n<0&&(n=Math.max(t.context.depth+1,i)),i<n))break;for(;;){if(e.next<0)break scan;let t=RD(e.next);if(e.advance(),t)continue scan;r=e.pos}}e.acceptTokenTo(CD,r)}),iO=uu({DirectiveName:G.keyword,DirectiveContent:G.attributeValue,"DirectiveEnd DocEnd":G.meta,QuotedLiteral:G.string,BlockLiteralHeader:G.special(G.string),BlockLiteralContent:G.content,Literal:G.content,"Key/Literal Key/QuotedLiteral":G.definition(G.propertyName),"Anchor Alias":G.labelName,Tag:G.typeName,Comment:G.lineComment,": , -":G.separator,"?":G.punctuation,"[ ]":G.squareBracket,"{ }":G.brace}),aO=iy.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*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UXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:`⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document`,maxTerm:74,context:VD,nodeProps:[[`isolate`,-3,8,9,14,``],[`openedBy`,18,`[`,32,`{`],[`closedBy`,19,`]`,33,`}`]],propSources:[iO],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#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#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d",stateData:`!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~`,goto:`vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS`,nodeNames:`⚠ Document Frontmatter DashLine FrontmatterContent Body`,maxTerm:10,skippedNodes:[0],repeatNodeCount:2,tokenData:"$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),sO=Lu.define({name:`yaml`,parser:aO.configure({props:[td.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name==`BlockLiteralContent`&&t.from<t.to)return e.baseIndentFor(t);if(t.name==`BlockLiteral`)return e.baseIndentFor(t)+e.unit;if(t.name==`BlockSequence`||t.name==`BlockMapping`)return e.column(t.firstChild.from,1);if(t.name==`QuotedLiteral`)return null;if(t.name==`Literal`){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)return null}}return null},FlowMapping:ud({closing:`}`}),FlowSequence:ud({closing:`]`})}),_d.add({"FlowMapping FlowSequence":vd,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:`#`},indentOnInput:/^\s*[\]\}]$/}});function cO(){return new qu(sO)}var lO=Lu.define({name:`yaml-frontmatter`,parser:oO.configure({props:[uu({DashLine:G.meta})]})});function uO(e){let{language:t,support:n}=e.content instanceof qu?e.content:{language:e.content,support:[]};return new qu(lO.configure({wrap:Wl(e=>e.name==`FrontmatterContent`?{parser:sO.parser}:e.name==`Body`?{parser:t.parser}:null)}),n)}function dO(e){let t=e.split(`.`).pop()?.toLowerCase();return[`ts`,`tsx`,`js`,`jsx`,`mjs`,`cjs`].includes(t??``)?yS({typescript:t===`ts`||t===`tsx`,jsx:t===`jsx`||t===`tsx`}):t===`json`?iC():t===`css`?sb():[`html`,`htm`].includes(t??``)?ZS():[`md`,`markdown`,`mdx`].includes(t??``)?uO({content:iT()}):[`yaml`,`yml`].includes(t??``)?cO():t===`py`?oD():[]}var fO=n(),pO=Qe.define();function mO({path:e,value:t,onChange:n,onSave:r,readOnly:c=!1,height:u=320,testId:d=`code-editor-input`,id:f,label:p,placeholder:m,hidePreview:h=!1,defaultWrap:g=!1,line:_}){let{theme:v}=a(),y=(0,Y.useRef)(null),b=(0,Y.useRef)(null),ee=(0,Y.useRef)({path:e,value:t,readOnly:c,testId:d,id:f,label:p,placeholder:m,defaultWrap:g,theme:v}),x=(0,Y.useRef)(n);x.current=n;let S=(0,Y.useRef)(r);S.current=r;let te=(0,Y.useRef)(t.includes(`\r
48
48
  `)?`\r
49
49
  `:`
50
- `),ne=(0,Y.useRef)(new ze),re=(0,Y.useRef)(new ze),ie=(0,Y.useRef)(new ze),ae=(0,Y.useRef)(new ze),oe=(0,Y.useRef)(new ze),[se,ce]=(0,Y.useState)(g||a(e)),[le,C]=(0,Y.useState)(!1),[ue,de]=(0,Y.useState)(t.split(/\r?\n/).length);return(0,Y.useEffect)(()=>{if(!y.current)return;let e=ee.current,t=new z({parent:y.current,state:O.create({doc:e.value,extensions:[Pv,re.current.of(e.theme===`dark`?bg:[]),ne.current.of(dO(e.path)),ie.current.of([O.readOnly.of(e.readOnly),z.editable.of(!e.readOnly)]),ae.current.of(z.contentAttributes.of({"aria-label":e.label??`Edit ${e.path}`,"data-testid":e.testId,...e.id?{id:e.id}:{}})),e.placeholder?Xs(e.placeholder):[],es.of([{key:`Mod-s`,run:()=>(S.current?.(),!0)},qm]),oe.current.of(e.defaultWrap||a(e.path)?z.lineWrapping:[]),Le.highest(z.theme({"&":{height:`100%`,backgroundColor:`rgb(var(--background))`,color:`rgb(var(--foreground))`,fontSize:`14px`},"@media (max-width: 640px)":{"&":{fontSize:`16px`}},".cm-scroller":{overflow:`auto`,fontFamily:`"IBM Plex Mono", Consolas, monospace`},".cm-gutters":{backgroundColor:`rgb(var(--surface-low))`,color:`rgb(var(--muted-foreground))`,borderRight:`1px solid rgb(var(--border))`},".cm-activeLine, .cm-activeLineGutter":{backgroundColor:`rgb(var(--surface-highest) / 0.4)`},".cm-cursor":{borderLeftColor:`rgb(var(--foreground))`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`rgb(var(--primary) / 0.25)`},".cm-panels, .cm-tooltip":{backgroundColor:`rgb(var(--surface-high))`,color:`rgb(var(--foreground))`},".cm-textfield, .cm-button":{background:`rgb(var(--background))`,color:`rgb(var(--foreground))`,border:`1px solid rgb(var(--control-border))`},".cm-textfield:focus-visible, .cm-button:focus-visible":{outline:`2px solid rgb(var(--focus))`,outlineOffset:`3px`},".cm-placeholder":{color:`rgb(var(--muted-foreground))`},".cm-content":{padding:`12px 0`},".cm-line":{padding:`0 12px`}})),z.updateListener.of(e=>{e.docChanged&&(de(e.state.doc.lines),!e.transactions.some(e=>e.annotation(pO))&&x.current?.(e.state.doc.toString().replace(/\n/g,te.current)))})]})});return b.current=t,()=>{b.current=null,t.destroy()}},[]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:re.current.reconfigure(v===`dark`?bg:[])})},[v]),(0,Y.useEffect)(()=>{let e=b.current;if(!e||!_||!Number.isFinite(_))return;let t=e.state.doc.line(Math.max(1,Math.min(e.state.doc.lines,Math.trunc(_)))).from;e.dispatch({selection:{anchor:t},effects:z.scrollIntoView(t,{y:`center`})}),e.focus()},[_]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ne.current.reconfigure(dO(e))}),C(!1)},[e]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ie.current.reconfigure([O.readOnly.of(c),z.editable.of(!c)])})},[c]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ae.current.reconfigure(z.contentAttributes.of({"aria-label":p??`Edit ${e}`,"data-testid":d,...f?{id:f}:{}}))})},[f,p,e,d]),(0,Y.useEffect)(()=>{let e=b.current;e&&(te.current=t.includes(`\r
50
+ `),ne=(0,Y.useRef)(new ze),re=(0,Y.useRef)(new ze),ie=(0,Y.useRef)(new ze),ae=(0,Y.useRef)(new ze),oe=(0,Y.useRef)(new ze),[se,ce]=(0,Y.useState)(g||s(e)),[le,C]=(0,Y.useState)(!1),[ue,de]=(0,Y.useState)(t.split(/\r?\n/).length);return(0,Y.useEffect)(()=>{if(!y.current)return;let e=ee.current,t=new z({parent:y.current,state:O.create({doc:e.value,extensions:[Pv,re.current.of(e.theme===`dark`?bg:[]),ne.current.of(dO(e.path)),ie.current.of([O.readOnly.of(e.readOnly),z.editable.of(!e.readOnly)]),ae.current.of(z.contentAttributes.of({"aria-label":e.label??`Edit ${e.path}`,"data-testid":e.testId,...e.id?{id:e.id}:{}})),e.placeholder?Xs(e.placeholder):[],es.of([{key:`Mod-s`,run:()=>(S.current?.(),!0)},qm]),oe.current.of(e.defaultWrap||s(e.path)?z.lineWrapping:[]),Le.highest(z.theme({"&":{height:`100%`,backgroundColor:`rgb(var(--background))`,color:`rgb(var(--foreground))`,fontSize:`14px`},"@media (max-width: 640px)":{"&":{fontSize:`16px`}},".cm-scroller":{overflow:`auto`,fontFamily:`"IBM Plex Mono", Consolas, monospace`},".cm-gutters":{backgroundColor:`rgb(var(--surface-low))`,color:`rgb(var(--muted-foreground))`,borderRight:`1px solid rgb(var(--border))`},".cm-activeLine, .cm-activeLineGutter":{backgroundColor:`rgb(var(--surface-highest) / 0.4)`},".cm-cursor":{borderLeftColor:`rgb(var(--foreground))`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`rgb(var(--primary) / 0.25)`},".cm-panels, .cm-tooltip":{backgroundColor:`rgb(var(--surface-high))`,color:`rgb(var(--foreground))`},".cm-textfield, .cm-button":{background:`rgb(var(--background))`,color:`rgb(var(--foreground))`,border:`1px solid rgb(var(--control-border))`},".cm-textfield:focus-visible, .cm-button:focus-visible":{outline:`2px solid rgb(var(--focus))`,outlineOffset:`3px`},".cm-placeholder":{color:`rgb(var(--muted-foreground))`},".cm-content":{padding:`12px 0`},".cm-line":{padding:`0 12px`}})),z.updateListener.of(e=>{e.docChanged&&(de(e.state.doc.lines),!e.transactions.some(e=>e.annotation(pO))&&x.current?.(e.state.doc.toString().replace(/\n/g,te.current)))})]})});return b.current=t,()=>{b.current=null,t.destroy()}},[]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:re.current.reconfigure(v===`dark`?bg:[])})},[v]),(0,Y.useEffect)(()=>{let e=b.current;if(!e||!_||!Number.isFinite(_))return;let t=e.state.doc.line(Math.max(1,Math.min(e.state.doc.lines,Math.trunc(_)))).from;e.dispatch({selection:{anchor:t},effects:z.scrollIntoView(t,{y:`center`})}),e.focus()},[_]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ne.current.reconfigure(dO(e))}),C(!1)},[e]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ie.current.reconfigure([O.readOnly.of(c),z.editable.of(!c)])})},[c]),(0,Y.useEffect)(()=>{b.current?.dispatch({effects:ae.current.reconfigure(z.contentAttributes.of({"aria-label":p??`Edit ${e}`,"data-testid":d,...f?{id:f}:{}}))})},[f,p,e,d]),(0,Y.useEffect)(()=>{let e=b.current;e&&(te.current=t.includes(`\r
51
51
  `)?`\r
52
52
  `:`
53
53
  `,e.state.doc.toString()!==t.replace(/\r\n/g,`
54
- `)&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t},annotations:pO.of(!0)}))},[t]),(0,fO.jsxs)(`div`,{"data-testid":`code-editor`,"data-file-path":e,"data-read-only":c,className:`flex min-h-0 flex-col overflow-hidden rounded-xs border border-control-border`,style:{height:u},children:[(0,fO.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-surface-highest px-2 py-1 text-xs`,children:[(0,fO.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-outline`,title:e,children:[e,c?` · Read-only`:``]}),!h&&a(e)&&(0,fO.jsx)(`button`,{type:`button`,"data-testid":`code-editor-preview-toggle`,"aria-pressed":le,onClick:()=>C(!le),className:`rounded px-2 py-1 hover:bg-surface-highest`,children:le?`Show source`:`Preview Markdown`}),(0,fO.jsx)(`button`,{type:`button`,"aria-label":`Find in file`,title:`Find (Ctrl/Cmd+F)`,onClick:()=>{C(!1),b.current&&Jh(b.current)},className:`inline-flex min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 items-center justify-center rounded p-1 text-outline hover:bg-surface-highest`,children:(0,fO.jsx)(s,{size:14})}),(0,fO.jsx)(`button`,{type:`button`,"aria-label":`Word wrap`,title:`Word wrap`,"aria-pressed":se,onClick:()=>{let e=!se;ce(e),b.current?.dispatch({effects:oe.current.reconfigure(e?z.lineWrapping:[])})},className:`inline-flex min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 items-center justify-center rounded p-1 hover:bg-surface-highest ${se?`text-primary`:`text-outline`}`,children:(0,fO.jsx)(l,{size:14})})]}),(0,fO.jsx)(`div`,{ref:y,className:`min-h-0 flex-1 overflow-hidden ${le?`hidden`:``}`}),le&&(0,fO.jsx)(`div`,{"data-testid":`code-editor-markdown-preview`,className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,fO.jsx)(i,{children:t})}),(0,fO.jsxs)(`footer`,{className:`shrink-0 border-t border-surface-highest px-3 py-1 text-[10px] text-outline`,children:[ue,` `,ue===1?`line`:`lines`,` · UTF-8`]})]})}export{mO as SourceEditor};
54
+ `)&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t},annotations:pO.of(!0)}))},[t]),(0,fO.jsxs)(`div`,{"data-testid":`code-editor`,"data-file-path":e,"data-read-only":c,className:`flex min-h-0 flex-col overflow-hidden rounded-xs border border-control-border`,style:{height:u},children:[(0,fO.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-surface-highest px-2 py-1 text-xs`,children:[(0,fO.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-outline`,title:e,children:[e,c?` · Read-only`:``]}),!h&&s(e)&&(0,fO.jsx)(`button`,{type:`button`,"data-testid":`code-editor-preview-toggle`,"aria-pressed":le,onClick:()=>C(!le),className:`rounded px-2 py-1 hover:bg-surface-highest`,children:le?`Show source`:`Preview Markdown`}),(0,fO.jsx)(`button`,{type:`button`,"aria-label":`Find in file`,title:`Find (Ctrl/Cmd+F)`,onClick:()=>{C(!1),b.current&&Jh(b.current)},className:`inline-flex min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 items-center justify-center rounded p-1 text-outline hover:bg-surface-highest`,children:(0,fO.jsx)(o,{size:14})}),(0,fO.jsx)(`button`,{type:`button`,"aria-label":`Word wrap`,title:`Word wrap`,"aria-pressed":se,onClick:()=>{let e=!se;ce(e),b.current?.dispatch({effects:oe.current.reconfigure(e?z.lineWrapping:[])})},className:`inline-flex min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 items-center justify-center rounded p-1 hover:bg-surface-highest ${se?`text-primary`:`text-outline`}`,children:(0,fO.jsx)(l,{size:14})})]}),(0,fO.jsx)(`div`,{ref:y,className:`min-h-0 flex-1 overflow-hidden ${le?`hidden`:``}`}),le&&(0,fO.jsx)(`div`,{"data-testid":`code-editor-markdown-preview`,className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,fO.jsx)(i,{children:t})}),(0,fO.jsxs)(`footer`,{className:`shrink-0 border-t border-surface-highest px-3 py-1 text-[10px] text-outline`,children:[ue,` `,ue===1?`line`:`lines`,` · UTF-8`]})]})}export{mO as SourceEditor};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{c as r}from"./button-By-NN7c7.js";import{t as i}from"./x-tY-z3woy.js";var a=e(t(),1),o=n(),s=/[,\s]+/;function c(e,t){let n=t.split(s).map(e=>e.trim()).filter(Boolean);return[...new Set([...e,...n])]}function l({value:e,onChange:t,onDraftChange:n,suggestions:l=[],placeholder:u=`Add a label`,"aria-label":d,"data-testid":f}){let[p,m]=(0,a.useState)(``),h=(0,a.useRef)(null),g=(0,a.useId)(),_=l.filter(t=>!e.includes(t));function v(e){m(e),n?.(e)}function y(n){let r=c(e,n);r.length!==e.length&&t(r),v(``)}function b(n){let r=n.split(s);if(r.length>1){let n=r.pop()??``;t(c(e,r.join(`,`))),v(n)}else v(n)}function x(n){(n.key===`Enter`||n.key===`Tab`)&&p.trim()?(n.preventDefault(),y(p)):n.key===`Backspace`&&!p&&e.length>0&&(n.preventDefault(),t(e.slice(0,-1)))}function S(e){let t=e.clipboardData.getData(`text`);s.test(t)&&(e.preventDefault(),y(`${p},${t}`))}return(0,o.jsxs)(`div`,{className:r(`flex min-h-10 w-full cursor-text flex-wrap items-center gap-1.5 rounded-md border border-control-border bg-surface px-2 py-1.5 text-sm`,`focus-within:ring-2 focus-within:ring-focus focus-within:ring-offset-2 ring-offset-background`),onClick:()=>h.current?.focus(),children:[e.map(n=>(0,o.jsxs)(`span`,{"data-testid":`tag-input-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full border border-outline-variant bg-surface-high py-0.5 pl-2.5 pr-1 text-xs text-on-surface`,children:[(0,o.jsx)(`span`,{className:`truncate`,children:n}),(0,o.jsx)(`button`,{type:`button`,"aria-label":`Remove ${n}`,className:`rounded-full p-0.5 text-outline hover:bg-surface-highest hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus`,onClick:r=>{r.stopPropagation(),t(e.filter(e=>e!==n)),h.current?.focus()},children:(0,o.jsx)(i,{size:12,"aria-hidden":!0})})]},n)),(0,o.jsx)(`input`,{ref:h,"aria-label":d,"data-testid":f,list:_.length>0?g:void 0,value:p,onChange:e=>b(e.target.value),onKeyDown:x,onPaste:S,onBlur:()=>p.trim()&&y(p),placeholder:e.length===0?u:``,className:`h-7 min-w-32 flex-1 bg-transparent px-1 outline-hidden placeholder:text-muted-foreground`}),_.length>0&&(0,o.jsx)(`datalist`,{id:g,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))})]})}export{l as t};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{c as r}from"./button-By-NN7c7.js";import{t as i}from"./x-BayoBYp_.js";var a=e(t(),1),o=n(),s=/[,\s]+/;function c(e,t){let n=t.split(s).map(e=>e.trim()).filter(Boolean);return[...new Set([...e,...n])]}function l({value:e,onChange:t,onDraftChange:n,suggestions:l=[],placeholder:u=`Add a label`,"aria-label":d,"data-testid":f}){let[p,m]=(0,a.useState)(``),h=(0,a.useRef)(null),g=(0,a.useId)(),_=l.filter(t=>!e.includes(t));function v(e){m(e),n?.(e)}function y(n){let r=c(e,n);r.length!==e.length&&t(r),v(``)}function b(n){let r=n.split(s);if(r.length>1){let n=r.pop()??``;t(c(e,r.join(`,`))),v(n)}else v(n)}function x(n){(n.key===`Enter`||n.key===`Tab`)&&p.trim()?(n.preventDefault(),y(p)):n.key===`Backspace`&&!p&&e.length>0&&(n.preventDefault(),t(e.slice(0,-1)))}function S(e){let t=e.clipboardData.getData(`text`);s.test(t)&&(e.preventDefault(),y(`${p},${t}`))}return(0,o.jsxs)(`div`,{className:r(`flex min-h-10 w-full cursor-text flex-wrap items-center gap-1.5 rounded-md border border-control-border bg-surface px-2 py-1.5 text-sm`,`focus-within:ring-2 focus-within:ring-focus focus-within:ring-offset-2 ring-offset-background`),onClick:()=>h.current?.focus(),children:[e.map(n=>(0,o.jsxs)(`span`,{"data-testid":`tag-input-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full border border-outline-variant bg-surface-high py-0.5 pl-2.5 pr-1 text-xs text-on-surface`,children:[(0,o.jsx)(`span`,{className:`truncate`,children:n}),(0,o.jsx)(`button`,{type:`button`,"aria-label":`Remove ${n}`,className:`rounded-full p-0.5 text-outline hover:bg-surface-highest hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus`,onClick:r=>{r.stopPropagation(),t(e.filter(e=>e!==n)),h.current?.focus()},children:(0,o.jsx)(i,{size:12,"aria-hidden":!0})})]},n)),(0,o.jsx)(`input`,{ref:h,"aria-label":d,"data-testid":f,list:_.length>0?g:void 0,value:p,onChange:e=>b(e.target.value),onKeyDown:x,onPaste:S,onBlur:()=>p.trim()&&y(p),placeholder:e.length===0?u:``,className:`h-7 min-w-32 flex-1 bg-transparent px-1 outline-hidden placeholder:text-muted-foreground`}),_.length>0&&(0,o.jsx)(`datalist`,{id:g,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))})]})}export{l as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{h as r,t as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-By-NN7c7.js";import{h as o}from"./client-DigivyCS.js";import{A as s,B as c,C as l,D as u,E as d,Et as f,F as p,Ft as m,Gr as h,Gt as g,H as ee,Hn as _,Hr as v,Ht as y,I as b,It as x,Jt as te,Kr as S,Kt as C,L as w,Lt as T,M as E,Mi as D,Mt as ne,N as O,Nt as re,O as k,P as A,R as j,T as ie,Ur as M,Ut as ae,Wr as N,Xt as P,Yr as oe,_i as F,at as I,b as L,ci as se,ct as R,fi as ce,hn as z,ii as le,it as B,j as V,jt as ue,k as H,kt as de,lt as fe,mn as pe,nt as U,ot as W,pn as me,qt as he,rt as G,w as K,x as ge,z as q}from"./index-Bc-Nka6Y.js";import{t as J}from"./ConfirmDialog-Cp1PcD4R.js";import{t as _e}from"./PriorityBadge-DOfXvpzs.js";import{t as ve}from"./StatusBadge-CKL0hTFN.js";import{i as ye,n as be,r as xe,s as Se}from"./live-sessions-BG3mNXnQ.js";import{t as Ce}from"./ErrorState-DB0nWfcc.js";import{d as we}from"./useSessions-tFa1FZ9M.js";import{t as Te}from"./ResumeActions-0eJvpGmW.js";var Ee={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Ee.node;var De=o(Ee),Oe={name:`user-check`,size:24,node:[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};Oe.node;var ke=o(Oe),Y=e(t(),1),X=n(),Ae=new Set([`task_id`,`task_title`,`project_id`,`skill_name`,`required_review`,`max_review_rounds`]),je={running:`bg-primary/15 text-primary border-primary/40`,completed:`bg-secondary/15 text-secondary border-secondary/40`,halted:`bg-error/15 text-error border-error/40`,cancelled:`bg-surface-highest text-outline border-outline-variant`},Me={pending:`text-primary`,running:`text-primary`,awaiting_human:`text-tertiary`,succeeded:`text-secondary`,failed:`text-error`,cancelled:`text-outline`,skipped:`text-outline`};function Z({children:e,className:t}){return(0,X.jsx)(`span`,{className:`inline-flex px-2 py-0.5 font-label text-xs rounded-md border ${t??`bg-surface-highest border-surface-highest text-on-surface-variant`}`,children:e})}function Ne({taskId:e}){let{data:t,isLoading:n}=u(e),[r,i]=(0,Y.useState)(null);return n?(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`Loading flow…`}):t?(0,X.jsx)(Pe,{run:t,taskId:e,selectedNodeId:r,onSelectNode:e=>i(t=>t===e?null:e)}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,"data-testid":`flow-run-empty`,children:`No flow has run on this task yet.`})}function Pe({run:e,taskId:t,selectedNodeId:n,onSelectNode:r}){let i=(0,Y.useMemo)(()=>j(e.definition),[e.definition]),o=(0,Y.useMemo)(()=>b(e),[e]),c=(0,Y.useMemo)(()=>V(e),[e]),l=ie(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(!1),m=Object.entries(e.vars).filter(([e])=>!Ae.has(e));return(0,X.jsxs)(`div`,{className:`space-y-4`,"data-testid":`flow-run-panel`,"data-flow-status":e.status,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.flow_source===`task`?(0,X.jsx)(`span`,{className:`font-body text-sm text-on-surface truncate`,"data-testid":`flow-run-name`,children:e.flow_name}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(!0),className:`font-body text-sm text-primary hover:underline truncate`,"data-testid":`flow-run-name`,children:e.flow_name}),(0,X.jsx)(Z,{children:e.flow_source}),(0,X.jsx)(Z,{className:je[e.status],children:e.status})]}),e.status===`running`&&(0,X.jsxs)(a,{variant:`ghost`,"data-testid":`flow-halt-button`,size:`sm`,onClick:()=>d(!0),className:`font-label text-xs bg-error/10 text-error border border-error/30 hover:bg-error/20 min-h-11 sm:min-h-9 px-3`,children:[(0,X.jsx)(De,{size:11,className:`mr-1`}),`Halt`]})]}),e.halt_reason&&(0,X.jsxs)(`div`,{className:`p-2 rounded-lg border border-border bg-transparent space-y-0.5`,"data-testid":`flow-halt-reason`,"data-halt-reason":e.halt_reason,children:[(0,X.jsxs)(`div`,{className:`font-label text-xs font-medium text-error`,children:[`Halted: `,e.halt_reason.replace(/_/g,` `)]}),e.halt_description&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:e.halt_description})]}),i?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(H,{definition:i,states:o,selectedNodeId:n,onSelectNode:r}),(0,X.jsx)(s,{})]}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`This run did not record a readable definition, so its graph cannot be drawn.`}),c&&(0,X.jsx)(Fe,{taskId:t,nodeRun:c,definition:i,isHalting:l.isPending}),i&&n&&(0,X.jsx)(Ie,{definition:i,nodeId:n}),(0,X.jsx)(Le,{run:e,selectedNodeId:n,onSelectNode:r}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1`,children:[(0,X.jsxs)(Q,{label:`Executions`,children:[e.node_executions,i?.limits.max_node_executions?` / ${i.limits.max_node_executions}`:``]}),(0,X.jsx)(Q,{label:`Elapsed`,children:O(e.started_at,e.ended_at)}),(0,X.jsx)(Q,{label:`Started`,children:A(e.started_at)}),(0,X.jsx)(Q,{label:`Ended`,children:A(e.ended_at)})]}),m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,"data-testid":`flow-run-vars`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Run vars`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:m.map(([e,t])=>(0,X.jsxs)(Z,{children:[e,`=`,JSON.stringify(t)]},e))})]}),(0,X.jsx)(K,{flowName:f?e.flow_name:null,open:f,onClose:()=>p(!1)}),(0,X.jsx)(J,{open:u,title:`Halt Flow`,description:`Stop flow "${e.flow_name}" and kill any live agent sessions for this task? The task keeps its current status.`,confirmLabel:`Halt`,variant:`destructive`,isPending:l.isPending,onConfirm:()=>l.mutate({taskId:t,reason:`halted from the web dashboard`},{onSuccess:()=>d(!1)}),onCancel:()=>d(!1)})]})}function Q({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:e}),(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:t})]})}function Fe({taskId:e,nodeRun:t,definition:n,isHalting:r}){let i=(0,Y.useMemo)(()=>n?w(n,t.node_id):[],[n,t.node_id]),o=d(),[s,c]=(0,Y.useState)(i[0]??``),[l,u]=(0,Y.useState)(``),f=s.trim();return(0,X.jsxs)(`div`,{className:`p-3 rounded-lg border border-border bg-transparent space-y-3`,"data-testid":`flow-gate-form`,"data-gate-node":t.node_id,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-tertiary`,children:[(0,X.jsx)(ke,{size:12}),`Waiting for you at “`,t.node_id,`”`]}),n?.nodeById[t.node_id]?.prompt&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface whitespace-pre-wrap`,children:n.nodeById[t.node_id]?.prompt}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Outcome`}),i.length>0?(0,X.jsxs)(U,{value:s,onValueChange:c,children:[(0,X.jsx)(I,{"aria-label":`Outcome`,"data-testid":`flow-gate-outcome`,className:`bg-background border-control-border text-on-surface font-label text-sm min-h-11 sm:min-h-9`,children:(0,X.jsx)(W,{placeholder:`Pick an outcome`})}),(0,X.jsx)(G,{className:`bg-surface-highest border-surface-highest`,children:i.map(e=>(0,X.jsx)(B,{value:e,className:`font-label text-xs`,children:e},e))})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(S,{"aria-label":`Outcome`,"data-testid":`flow-gate-outcome-input`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. approved`,className:`bg-background border-control-border text-on-surface font-body text-sm min-h-11 sm:min-h-9`}),(0,X.jsx)(`p`,{className:`font-body text-sm text-outline`,children:`This node routes everything through a catch-all edge, so any outcome continues the flow.`})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Comment (posted on the task)`}),(0,X.jsx)(h,{"aria-label":`Comment posted on the task`,"data-testid":`flow-gate-comment`,value:l,onChange:e=>u(e.target.value),placeholder:`Why this outcome…`,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`,rows:2})]}),o.error&&(0,X.jsx)(`div`,{className:`font-body text-sm text-error`,"data-testid":`flow-gate-error`,children:o.error.message}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(a,{"data-testid":`flow-gate-submit`,size:`sm`,disabled:o.isPending||r||f.length===0,onClick:()=>o.mutate({taskId:e,outcome:f,...l.trim()?{summary:l.trim()}:{},author:`human`},{onSuccess:()=>u(``)}),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90 min-h-11 sm:min-h-9 px-3`,children:o.isPending?`Resuming…`:`Resume flow`})})]})}function Ie({definition:e,nodeId:t}){let n=e.nodeById[t];if(!n)return null;let r=e.edges.map((e,t)=>({edge:e,index:t})).filter(({edge:e})=>e.from===t);return(0,X.jsxs)(`div`,{className:`p-2 rounded-lg border border-surface-highest bg-surface-highest/30 space-y-2`,"data-testid":`flow-node-detail`,"data-node-id":t,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,X.jsx)(`span`,{className:`font-body text-sm font-medium text-on-surface`,children:n.id}),(0,X.jsx)(Z,{children:n.kind}),n.skill&&(0,X.jsxs)(Z,{children:[`skill `,n.skill]}),n.role&&(0,X.jsx)(Z,{children:n.role}),n.task_status&&(0,X.jsxs)(Z,{children:[`sets `,n.task_status]}),n.max_visits!==void 0&&(0,X.jsxs)(Z,{children:[`max `,n.max_visits,` visits`]}),n.routing===`all`&&(0,X.jsx)(Z,{children:`fan out`}),n.join&&(0,X.jsxs)(Z,{children:[`join `,n.join.mode,` of `,n.join.from.join(`, `)]}),n.on_error&&(0,X.jsxs)(Z,{children:[`on error → `,n.on_error]})]}),n.description&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant`,children:n.description}),r.length>0&&(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:`Outgoing edges (first match wins)`}),r.map(({edge:e,index:t},n)=>(0,X.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,"data-testid":`flow-node-detail-edge`,children:[n+1,`. → `,e.to,` `,(0,X.jsxs)(`span`,{className:`text-outline`,children:[`when `,E(e.when)]}),e.label&&(0,X.jsxs)(`span`,{className:`text-outline`,children:[` (`,e.label,`)`]})]},t))]})]})}function Le({run:e,selectedNodeId:t,onSelectNode:n}){return(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`div`,{className:`font-label text-xs font-medium text-outline`,children:[`Ledger (`,e.nodes.length,` `,e.nodes.length===1?`visit`:`visits`,`)`]}),e.nodes.length===0?(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`Nothing has run yet.`}):(0,X.jsx)(`div`,{className:`space-y-1`,children:e.nodes.map((e,r)=>(0,X.jsxs)(`div`,{onClick:()=>n(e.node_id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(e.node_id)},"data-testid":`flow-ledger-row`,"data-node-id":e.node_id,"data-node-status":e.status,"data-node-outcome":e.outcome??``,className:`w-full text-left p-2 rounded-lg border transition-colors cursor-pointer ${t===e.node_id?`border-primary/40 bg-primary/5`:`border-surface-highest bg-surface-highest/40 hover:bg-surface-highest/70`}`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,X.jsx)(`span`,{className:`font-label text-[10px] text-outline`,children:r+1}),(0,X.jsx)(`span`,{className:`font-body text-sm text-on-surface`,children:e.node_id}),(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-outline`,children:[`visit `,e.attempt,e.retry>0?` · retry ${e.retry}`:``]}),(0,X.jsx)(`span`,{className:`font-label text-[10px] ${Me[e.status]??`text-outline`}`,children:e.status.replace(/_/g,` `)}),e.outcome&&(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-primary`,children:[`→ `,e.outcome]}),(0,X.jsxs)(`span`,{className:`font-label text-[10px] text-outline ml-auto`,children:[O(e.started_at??e.created_at,e.ended_at),e.started_at===null&&p(e.status)?` waiting`:``]})]}),e.summary&&(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface-variant mt-1 whitespace-pre-wrap`,children:e.summary}),e.error&&(0,X.jsx)(`div`,{className:`font-body text-sm text-error mt-1 whitespace-pre-wrap`,children:e.error}),e.gateway_session_id&&(0,X.jsxs)(i,{to:`/sessions/${e.gateway_session_id}`,onClick:e=>e.stopPropagation(),className:`font-mono text-xs text-primary hover:underline mt-1 inline-block`,"data-testid":`flow-ledger-session-link`,children:[`session `,e.gateway_session_id.slice(-8)]})]},`${e.node_id}-${e.attempt}-${e.retry}`))})]})}function Re({children:e}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(F,{size:12}),`Flow`,e]})}var $=[`git_repo`,`git_branch`,`git_worktree`,`github_issue`,`github_pr`],ze={git_repo:`Repository folder`,git_branch:`Branch`,git_worktree:`Worktree folder`,github_issue:`GitHub issue URL`,github_pr:`GitHub PR URL`};function Be({task:e}){let[t,n]=(0,Y.useState)(!1),[r,i]=(0,Y.useState)(()=>Object.fromEntries($.map(t=>[t,e[t]??``]))),a=P();return(0,X.jsxs)(`section`,{"data-testid":`task-git-links`,className:`space-y-2 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex justify-between`,children:[(0,X.jsx)(`strong`,{children:`Git / GitHub`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`task-git-edit`,onClick:()=>{i(Object.fromEntries($.map(t=>[t,e[t]??``]))),n(!t)},children:`Edit links`})]}),t?(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),a.mutate({id:e.id,...Object.fromEntries($.map(e=>[e,r[e].trim()||null]))},{onSuccess:()=>n(!1)})},className:`space-y-2`,children:[$.map(e=>(0,X.jsxs)(`label`,{className:`block`,children:[ze[e],(0,X.jsx)(`input`,{"data-testid":`task-link-${e}`,className:`w-full bg-surface-highest p-2`,value:r[e],onChange:t=>i({...r,[e]:t.target.value})})]},e)),(0,X.jsx)(`button`,{type:`submit`,"data-testid":`task-git-save`,disabled:a.isPending,className:`text-primary`,children:`Save links`}),a.error&&(0,X.jsx)(`p`,{role:`alert`,children:a.error.message})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[$.map(t=>e[t]?(0,X.jsxs)(`p`,{className:`break-all`,children:[ze[t],`:`,` `,t.startsWith(`github_`)?(0,X.jsx)(`a`,{href:e[t]??``,target:`_blank`,rel:`noreferrer`,className:`text-primary`,children:e[t]}):e[t]]},t):null),!$.some(t=>e[t])&&(0,X.jsx)(`p`,{className:`text-outline`,children:`No links yet. Link a checkout from its terminal Git panel, or edit here.`})]}),e.git_worktree&&(0,X.jsx)(`div`,{className:`border-t border-outline-variant pt-2`,children:(0,X.jsx)(de,{path:e.git_worktree,showOutput:!0})})]})}function Ve({taskId:e}){let[t]=r(),{data:n,isLoading:a,error:o,refetch:s}=we(e),c=(n??[]).filter(e=>e.tokens_used!=null),l=c.reduce((e,t)=>e+(t.tokens_used??0),0),u=(n??[]).map(e=>e.last_activity_at??``).sort().pop(),d=N((n??[]).map(M));return(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,"data-testid":`task-sessions`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs text-outline`,children:[(0,X.jsx)(D,{size:12}),`Agent sessions`,d&&(0,X.jsx)(v,{state:d,compact:!0,testId:`task-sessions-state`}),n&&n.length>0&&(0,X.jsxs)(`span`,{className:`font-body text-xs normal-case tracking-normal text-on-surface-variant`,children:[` `,`· `,n.length,` ·`,` `,be(l,c.some(e=>e.tokens_estimated)),` `,`tokens · last active `,ye(u??null)]})]}),o?(0,X.jsx)(Ce,{message:o.message,onRetry:()=>s()}):a?(0,X.jsx)(`p`,{role:`status`,className:`text-sm text-outline`,children:`Loading agent sessions…`}):!n||n.length===0?(0,X.jsx)(`div`,{className:`font-body text-xs text-outline`,children:`No session yet. Add a session: line with the session id to the task body, or pick the task on the Sessions page.`}):(0,X.jsx)(`div`,{className:`space-y-1`,children:n.map(e=>(0,X.jsxs)(`div`,{"data-testid":`task-session-row`,className:`flex flex-wrap items-center gap-3 px-2 py-2 rounded-lg`,children:[(0,X.jsx)(v,{state:M(e),compact:!0,context:e.agent}),(0,X.jsx)(`span`,{className:`font-label text-xs text-primary w-14 shrink-0`,children:e.agent}),(0,X.jsx)(i,{to:Se(`/sessions?session=${encodeURIComponent(e.id)}`,t.get(`project`)??e.project_id),"data-testid":`task-session-link`,className:`flex-1 min-w-0 truncate font-body text-xs text-on-surface hover:text-primary`,title:e.name??void 0,children:e.name??e.session_id}),(0,X.jsx)(`span`,{className:`font-label text-xs text-outline shrink-0`,children:xe(e)}),(0,X.jsx)(`span`,{className:`font-label text-xs text-outline shrink-0`,children:ye(e.last_activity_at)}),(0,X.jsx)(Te,{session:e})]},e.id))})]})}var He=[`todo`,`doing`,`review`,`blocked`,`done`],Ue=[`low`,`normal`,`high`,`critical`],We=[`blocks`,`blocked_by`,`relates_to`,`duplicates`,`clones`,`subtask_of`,`parent_of`];function Ge({taskId:e,open:t,onOpenChange:n,projectScope:r=`all`}){let{data:i,isLoading:o,error:s,refetch:c}=C(e),u=i&&(r===`all`||(r===`unassigned`?i.project_id===null:i.project_id===r)),d=u?i:void 0;(0,Y.useEffect)(()=>{t&&i&&!u&&n(!1)},[t,i,u,n]);let{data:p}=he(d?.id??null),{data:v}=te(d?.id??null),{data:b}=f(),w=y(),E=ae(),D=g(),[O,A]=(0,Y.useState)(``),[j,ie]=(0,Y.useState)(`human`),[M,N]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(``),[L,z]=(0,Y.useState)(`relates_to`),[V,H]=(0,Y.useState)(!1),de=()=>{e&&O.trim()&&w.mutate({id:e,content:O.trim(),author:j||`human`},{onSuccess:()=>{A(``)}})},fe=()=>{e&&P.trim()&&E.mutate({id:e,to_task_id:P.trim(),link_type:L},{onSuccess:()=>{F(``),N(!1)}})},pe=(0,Y.useMemo)(()=>v?v.reduce((e,t)=>{let n=t.link_type;return e[n]||(e[n]=[]),e[n].push(t),e},{}):{},[v]),me=l(d??{}),K=ee(d??{}),ge=(0,Y.useMemo)(()=>!d?.project_id||!b?null:b.find(e=>e.id===d.project_id)?.name??d.project_id.slice(-6),[d?.project_id,b]),J=e=>e?new Date(e).toLocaleString():`-`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{open:t,onOpenChange:n,children:(0,X.jsxs)(re,{"data-testid":`task-detail-sheet`,defaultWidth:620,resizeKey:`tasks`,children:[(0,X.jsx)(x,{children:o?(0,X.jsx)(k,{className:`h-5 w-48 bg-surface-highest`}):d?(0,X.jsxs)(`div`,{className:`space-y-2 pr-6`,children:[(0,X.jsx)(T,{children:d.title}),d.github_sync&&(0,X.jsxs)(`div`,{className:`space-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`a`,{"data-testid":`task-github-issue-link`,href:d.github_issue??void 0,target:`_blank`,rel:`noreferrer`,className:`underline`,children:[`GitHub #`,d.github_sync.number]}),(0,X.jsx)(`p`,{children:`Title, description and labels come from GitHub. Status changes sync both ways.`}),d.github_sync.error?(0,X.jsx)(`p`,{role:`alert`,className:`text-error`,children:d.github_sync.error}):d.status===d.github_sync.status?null:(0,X.jsx)(`p`,{children:`Status awaiting GitHub sync.`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(ve,{status:d.status}),(0,X.jsx)(_e,{priority:d.priority})]})]}):(0,X.jsx)(T,{children:`Task not found`})}),(0,X.jsxs)(ne,{children:[(w.error||E.error||D.error)&&(0,X.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-error`,children:(w.error??E.error??D.error)?.message}),s?(0,X.jsx)(Ce,{message:s.message,onRetry:()=>c()}):o?(0,X.jsx)(`div`,{className:`space-y-4`,children:Array.from({length:6}).map((e,t)=>(0,X.jsx)(k,{className:`h-8 w-full bg-surface-highest`},t))}):d?(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(Be,{task:d},d.id),d.body&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Body`}),(0,X.jsx)(`div`,{"data-testid":`task-detail-body`,className:`font-body text-sm text-on-surface wrap-break-word`,children:(0,X.jsx)(_,{readable:!0,children:d.body})})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,X.jsx)(q,{label:`ID`,children:(0,X.jsx)(`span`,{className:`font-mono text-xs break-all`,children:d.id})}),(0,X.jsx)(q,{label:`Author`,children:d.author}),(0,X.jsx)(q,{label:`Claimed By`,children:d.claimed_by??`-`}),(0,X.jsx)(q,{label:`Project`,children:ge??`-`}),(0,X.jsx)(q,{label:`Skill`,children:d.skill_name??`-`}),(0,X.jsxs)(q,{label:`Agent Backend`,children:[(0,X.jsx)(`span`,{"data-testid":`task-backend-name`,children:K.label}),K.available===!1&&(0,X.jsxs)(`span`,{className:`text-error`,title:`This backend is not usable right now`,children:[` `,`○`]})]}),(0,X.jsx)(q,{label:`Flow`,children:(0,X.jsx)(`span`,{"data-testid":`task-flow-name`,children:me.label})}),(0,X.jsx)(q,{label:`Required Review`,children:d.required_review?`Yes`:`No`}),(0,X.jsx)(q,{label:`Max Review Rounds`,children:d.max_review_rounds}),(0,X.jsx)(q,{label:`Due`,children:(0,X.jsx)(`span`,{className:(e=>e?new Date(e)<new Date:!1)(d.due_at)&&d.status!==`done`?`text-error`:``,children:J(d.due_at)})}),(0,X.jsx)(q,{label:`Created`,children:J(d.created_at)}),(0,X.jsx)(q,{label:`Updated`,children:J(d.updated_at)})]}),d.progress>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Progress`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`flex-1 h-2 bg-surface-highest rounded-lg overflow-hidden`,children:(0,X.jsx)(`div`,{className:`h-full bg-primary rounded-lg transition-all`,style:{width:`${Math.min(100,d.progress)}%`}})}),(0,X.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[d.progress,`%`]})]})]}),d.tags&&d.tags.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-xs font-medium text-outline`,children:`Tags`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:d.tags.map(e=>(0,X.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-label bg-primary/10 text-primary border border-primary/20 rounded-lg`,children:e},e))})]}),(0,X.jsx)(Ve,{taskId:d.id}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsx)(Re,{}),(0,X.jsx)(Ne,{taskId:d.id})]}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(ce,{size:12}),`Links`]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`text-primary hover:text-primary/80 transition-colors`,children:(0,X.jsx)(le,{size:14})})]}),v&&v.length>0?(0,X.jsx)(`div`,{className:`space-y-2`,children:Object.entries(pe).map(([t,n])=>(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`font-label text-[10px] font-medium text-outline`,children:t.replace(/_/g,` `)}),n.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 bg-surface-highest/50 rounded-lg`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:t.from_task_id===e?t.to_task_id.slice(-6):t.from_task_id.slice(-6)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>D.mutate({taskId:e,linkId:t.id}),className:`text-outline hover:text-error transition-colors p-0.5`,children:(0,X.jsx)(oe,{size:10})})]},t.id))]},t))}):(0,X.jsx)(`div`,{className:`font-body text-sm text-outline`,children:`No links`}),M&&(0,X.jsxs)(`div`,{className:`space-y-2 p-2 bg-surface-highest/30 rounded-lg border border-surface-highest`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Link Type`}),(0,X.jsxs)(U,{value:L,onValueChange:e=>z(e),children:[(0,X.jsx)(I,{className:`bg-background border-control-border text-on-surface font-label text-xs h-7`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(G,{className:`bg-surface-highest border-surface-highest`,children:We.map(e=>(0,X.jsx)(B,{value:e,className:`font-label text-xs`,children:e.replace(/_/g,` `)},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Target Task ID`}),(0,X.jsx)(S,{value:P,onChange:e=>F(e.target.value),placeholder:`Task ID...`,className:`bg-background border-control-border text-on-surface font-body text-sm h-7`})]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{N(!1),F(``)},className:`font-label text-xs text-outline h-6 px-2`,children:`Cancel`}),(0,X.jsx)(a,{size:`sm`,onClick:fe,disabled:E.isPending||!P.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2`,children:`Add`})]})]})]}),(0,X.jsxs)(`div`,{className:`border-t border-surface-highest pt-4 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 font-label text-xs font-medium text-outline`,children:[(0,X.jsx)(se,{size:12}),`Comments (`,p?.length??0,`)`]}),p&&p.length>0&&(0,X.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,X.jsxs)(`div`,{className:`py-2 border-b border-border space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`font-label text-xs text-primary`,children:e.author}),(0,X.jsx)(`span`,{className:`font-label text-[10px] text-outline`,children:new Date(e.created_at).toLocaleString()})]}),(0,X.jsx)(`div`,{className:`font-body text-sm text-on-surface whitespace-pre-wrap wrap-break-word`,children:e.content})]},e.id))}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(S,{"aria-label":`Comment author`,value:j,onChange:e=>ie(e.target.value),placeholder:`Author`,className:`bg-background border-control-border text-on-surface font-body text-sm h-7 w-24`}),(0,X.jsx)(h,{value:O,onChange:e=>A(e.target.value),placeholder:`Add a comment...`,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none flex-1`,rows:2})]}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(a,{"data-testid":`task-comment-submit`,size:`sm`,onClick:de,disabled:w.isPending||!O.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2`,children:w.isPending?`...`:`Comment`})})]})]})]}):(0,X.jsx)(`div`,{className:`text-outline font-label text-xs font-medium text-center py-8`,children:`Task not found`})]}),d&&(0,X.jsx)(m,{children:(0,X.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>H(!0),className:`font-label text-xs font-medium bg-transparent text-on-surface border border-control-border hover:bg-surface`,children:`Edit task`})})]})}),d&&V&&(0,X.jsx)(Ke,{task:d,open:V,onClose:()=>H(!1)})]})}function Ke({task:e,open:t,onClose:n}){let{data:r}=f(),i=P(),[o,s]=(0,Y.useState)(e.title),[l,u]=(0,Y.useState)(e.body??``),[d,p]=(0,Y.useState)(e.status),[m,h]=(0,Y.useState)(e.priority),[g,ee]=(0,Y.useState)(e.due_at??``),[_,v]=(0,Y.useState)((e.tags??[]).join(`, `)),[y,b]=(0,Y.useState)(e.project_id??``),[x,te]=(0,Y.useState)(e.skill_name??``),[C,w]=(0,Y.useState)(e.agent_backend??`__default__`),[T,E]=(0,Y.useState)(e.required_review),[D,ne]=(0,Y.useState)(String(e.max_review_rounds)),[O,re]=(0,Y.useState)(e.flow_name??`__default__`),k=(t,r=n)=>{if(t.preventDefault(),!o.trim())return;let a=_.split(`,`).map(e=>e.trim()).filter(Boolean);i.mutate({id:e.id,...e.github_sync?{}:{title:o.trim(),body:l.trim()||null},status:d,priority:m,due_at:g||null,tags:a.length>0?a:null,project_id:y||null,skill_name:x||null,agent_backend:C===`__default__`?null:C,required_review:T,max_review_rounds:Number(D)||3,...e.flow_override?{}:{flow_name:O===`__default__`?null:O}},{onSuccess:r})};return(0,X.jsx)(fe,{testId:`edit-task-dialog`,open:t,onClose:n,busy:i.isPending,dirty:JSON.stringify([o,l,d,m,g,_,y,x,C,T,D,O])!==JSON.stringify([e.title,e.body??``,e.status,e.priority,e.due_at??``,(e.tags??[]).join(`, `),e.project_id??``,e.skill_name??``,e.agent_backend??`__default__`,e.required_review,String(e.max_review_rounds),e.flow_name??`__default__`]),children:(t,n)=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(pe,{children:(0,X.jsx)(z,{className:`font-headline text-sm font-medium text-on-surface`,children:`Edit task`})}),(0,X.jsxs)(`form`,{onSubmit:e=>k(e,n),className:`min-h-0`,children:[(0,X.jsxs)(`div`,{className:`work-form-body grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Title *`}),(0,X.jsx)(S,{"aria-label":`Title`,"data-testid":`edit-task-title`,value:o,readOnly:!!e.github_sync,onChange:e=>s(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsx)(L,{label:`Body`,"aria-label":`Body`,"data-testid":`edit-task-body`,value:l,readOnly:!!e.github_sync,onChange:u,rows:4}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Status`}),(0,X.jsxs)(U,{value:d,onValueChange:e=>p(e),children:[(0,X.jsx)(I,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(G,{className:`bg-surface-highest border-surface-highest`,children:He.map(e=>(0,X.jsx)(B,{value:e,className:`font-label text-xs`,children:e.replace(/_/g,` `)},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Priority`}),(0,X.jsxs)(U,{value:m,onValueChange:e=>h(e),children:[(0,X.jsx)(I,{"aria-label":`Priority`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(G,{className:`bg-surface-highest border-surface-highest`,children:Ue.map(e=>(0,X.jsx)(B,{value:e,className:`font-label text-xs`,children:e},e))})]})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Due date`}),(0,X.jsx)(S,{type:`datetime-local`,value:g?g.slice(0,16):``,onChange:e=>ee(e.target.value?new Date(e.target.value).toISOString():``),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Project`}),(0,X.jsxs)(U,{value:y||`__none__`,disabled:!!e.github_sync,onValueChange:e=>b(e===`__none__`?``:e),children:[(0,X.jsx)(I,{"aria-label":`Project`,className:`bg-background border-control-border text-on-surface font-label text-xs`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(G,{className:`bg-surface-highest border-surface-highest`,children:[(0,X.jsx)(B,{value:`__none__`,className:`font-label text-xs`,children:`None`}),r?.map(e=>(0,X.jsx)(B,{value:e.id,className:`font-label text-xs`,children:e.name},e.id))]})]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Tags (comma-separated)`}),(0,X.jsx)(S,{"aria-label":`Tags`,value:_,onChange:e=>v(e.target.value),placeholder:`tag1, tag2`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Skill Name`}),(0,X.jsx)(S,{"aria-label":`Skill override`,value:x,onChange:e=>te(e.target.value),placeholder:`e.g. code-review`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsx)(c,{value:C,onChange:w,testId:`edit-task-backend`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5 flex items-center gap-2 pt-4`,children:[(0,X.jsx)(`input`,{type:`checkbox`,id:`edit-required-review`,checked:T,onChange:e=>E(e.target.checked),className:`accent-primary`}),(0,X.jsx)(R,{htmlFor:`edit-required-review`,className:`font-label text-xs font-medium text-outline cursor-pointer`,children:`Required Review`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(R,{className:`font-label text-xs font-medium text-outline`,children:`Max Review Rounds`}),(0,X.jsx)(S,{type:`number`,value:D,onChange:e=>ne(e.target.value),min:1,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),e.flow_override?(0,X.jsxs)(`p`,{className:`font-body text-sm text-outline`,"data-testid":`task-flow-override-note`,children:[`This task carries an inline flow definition (flow_override), which beats any named flow. Detach it with `,(0,X.jsx)(`code`,{children:`orc flow attach`}),` to use a named flow instead.`]}):(0,X.jsx)(ge,{value:O,onChange:re,testId:`edit-task-flow`}),i.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error md:col-span-2`,children:i.error.message})]}),(0,X.jsxs)(me,{className:`work-form-footer`,children:[(0,X.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`form-cancel`,onClick:t,className:`font-label text-xs text-outline`,children:`Cancel`}),(0,X.jsx)(a,{"data-testid":`edit-task-submit`,type:`submit`,size:`sm`,disabled:i.isPending||!o.trim(),className:`font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90`,children:i.isPending?`Saving...`:`Save`})]})]})]})})}export{Ge as t};