@teammy/server 0.2.20 → 0.2.22

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 (106) hide show
  1. package/dist/main.js +8784 -7601
  2. package/dist/web/assets/Assistant-Dm68Y4gs.js +1 -0
  3. package/dist/web/assets/Computers-BtcIsnDD.css +1 -0
  4. package/dist/web/assets/Computers-mf4P8Wjw.js +13 -0
  5. package/dist/web/assets/{Conversation-BjRCD81A.js → Conversation-ClLZZ3fG.js} +1 -1
  6. package/dist/web/assets/{Dashboard-DmtWx-WI.js → Dashboard-pokwbwJV.js} +1 -1
  7. package/dist/web/assets/{Dropdown-DXEtBxVr.js → Dropdown-DGFI68Vd.js} +1 -1
  8. package/dist/web/assets/Files-CtxaCO6n.js +1 -0
  9. package/dist/web/assets/{Help-BeJ09zt7.js → Help-B_1p7Xir.js} +87 -25
  10. package/dist/web/assets/Markdown-gPLWRWEJ.js +29 -0
  11. package/dist/web/assets/{MessageComposer-0eprbRl2.js → MessageComposer-BoOgfyPA.js} +1 -1
  12. package/dist/web/assets/ResourceLibrary-Cr_Emgq2.js +6 -0
  13. package/dist/web/assets/{TerminalPane-CEaXud0k.js → TerminalPane-5Gw9ZNxq.js} +2 -2
  14. package/dist/web/assets/WorkspaceTree-DZ6DN_OX.js +1 -0
  15. package/dist/web/assets/{file-links-Bo7XBz3i.js → file-links-CoVqmrXg.js} +1 -1
  16. package/dist/web/assets/index-BZEKT27U.js +10 -0
  17. package/dist/web/assets/task-links-DTqf18C2.js +1 -0
  18. package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
  19. package/dist/web/downloads/teammy-skill.zip +0 -0
  20. package/dist/web/index.html +2 -2
  21. package/dist/web/notification-worker.js +126 -0
  22. package/node_modules/cron-parser/LICENSE +21 -0
  23. package/node_modules/cron-parser/README.md +437 -0
  24. package/node_modules/cron-parser/dist/CronDate.js +558 -0
  25. package/node_modules/cron-parser/dist/CronExpression.js +531 -0
  26. package/node_modules/cron-parser/dist/CronExpressionParser.js +482 -0
  27. package/node_modules/cron-parser/dist/CronFieldCollection.js +380 -0
  28. package/node_modules/cron-parser/dist/CronFileParser.js +92 -0
  29. package/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +60 -0
  30. package/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +57 -0
  31. package/node_modules/cron-parser/dist/fields/CronField.js +222 -0
  32. package/node_modules/cron-parser/dist/fields/CronHour.js +40 -0
  33. package/node_modules/cron-parser/dist/fields/CronMinute.js +40 -0
  34. package/node_modules/cron-parser/dist/fields/CronMonth.js +44 -0
  35. package/node_modules/cron-parser/dist/fields/CronSecond.js +40 -0
  36. package/node_modules/cron-parser/dist/fields/index.js +24 -0
  37. package/node_modules/cron-parser/dist/fields/types.js +2 -0
  38. package/node_modules/cron-parser/dist/index.js +31 -0
  39. package/node_modules/cron-parser/dist/types/CronDate.d.ts +293 -0
  40. package/node_modules/cron-parser/dist/types/CronExpression.d.ts +118 -0
  41. package/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +65 -0
  42. package/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +153 -0
  43. package/node_modules/cron-parser/dist/types/CronFileParser.d.ts +30 -0
  44. package/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +33 -0
  45. package/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +31 -0
  46. package/node_modules/cron-parser/dist/types/fields/CronField.d.ts +136 -0
  47. package/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +23 -0
  48. package/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +23 -0
  49. package/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +24 -0
  50. package/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +23 -0
  51. package/node_modules/cron-parser/dist/types/fields/index.d.ts +8 -0
  52. package/node_modules/cron-parser/dist/types/fields/types.d.ts +18 -0
  53. package/node_modules/cron-parser/dist/types/index.d.ts +8 -0
  54. package/node_modules/cron-parser/dist/types/utils/random.d.ts +10 -0
  55. package/node_modules/cron-parser/dist/utils/random.js +38 -0
  56. package/node_modules/cron-parser/package.json +117 -0
  57. package/node_modules/luxon/LICENSE.md +7 -0
  58. package/node_modules/luxon/README.md +55 -0
  59. package/node_modules/luxon/build/amd/luxon.js +8741 -0
  60. package/node_modules/luxon/build/amd/luxon.js.map +1 -0
  61. package/node_modules/luxon/build/cjs-browser/luxon.js +8739 -0
  62. package/node_modules/luxon/build/cjs-browser/luxon.js.map +1 -0
  63. package/node_modules/luxon/build/es6/luxon.mjs +8133 -0
  64. package/node_modules/luxon/build/es6/luxon.mjs.map +1 -0
  65. package/node_modules/luxon/build/global/luxon.js +8744 -0
  66. package/node_modules/luxon/build/global/luxon.js.map +1 -0
  67. package/node_modules/luxon/build/global/luxon.min.js +1 -0
  68. package/node_modules/luxon/build/global/luxon.min.js.map +1 -0
  69. package/node_modules/luxon/build/node/luxon.js +7792 -0
  70. package/node_modules/luxon/build/node/luxon.js.map +1 -0
  71. package/node_modules/luxon/package.json +87 -0
  72. package/node_modules/luxon/src/datetime.js +2603 -0
  73. package/node_modules/luxon/src/duration.js +1009 -0
  74. package/node_modules/luxon/src/errors.js +61 -0
  75. package/node_modules/luxon/src/impl/conversions.js +206 -0
  76. package/node_modules/luxon/src/impl/diff.js +95 -0
  77. package/node_modules/luxon/src/impl/digits.js +94 -0
  78. package/node_modules/luxon/src/impl/english.js +233 -0
  79. package/node_modules/luxon/src/impl/formats.js +176 -0
  80. package/node_modules/luxon/src/impl/formatter.js +434 -0
  81. package/node_modules/luxon/src/impl/invalid.js +14 -0
  82. package/node_modules/luxon/src/impl/locale.js +569 -0
  83. package/node_modules/luxon/src/impl/regexParser.js +335 -0
  84. package/node_modules/luxon/src/impl/tokenParser.js +505 -0
  85. package/node_modules/luxon/src/impl/util.js +330 -0
  86. package/node_modules/luxon/src/impl/zoneUtil.js +34 -0
  87. package/node_modules/luxon/src/info.js +205 -0
  88. package/node_modules/luxon/src/interval.js +669 -0
  89. package/node_modules/luxon/src/luxon.js +26 -0
  90. package/node_modules/luxon/src/package.json +4 -0
  91. package/node_modules/luxon/src/settings.js +180 -0
  92. package/node_modules/luxon/src/zone.js +97 -0
  93. package/node_modules/luxon/src/zones/IANAZone.js +235 -0
  94. package/node_modules/luxon/src/zones/fixedOffsetZone.js +150 -0
  95. package/node_modules/luxon/src/zones/invalidZone.js +53 -0
  96. package/node_modules/luxon/src/zones/systemZone.js +61 -0
  97. package/package.json +3 -1
  98. package/dist/web/assets/Assistant-By7rPMl2.js +0 -1
  99. package/dist/web/assets/Computers-B4ZMJ8tu.js +0 -13
  100. package/dist/web/assets/Computers-CBnQX-2p.css +0 -1
  101. package/dist/web/assets/Files-4IxSFpqk.js +0 -1
  102. package/dist/web/assets/Markdown-DGF8VSqv.js +0 -29
  103. package/dist/web/assets/ResourceLibrary-rlrdDWGo.js +0 -6
  104. package/dist/web/assets/WorkspaceTree-CwGvdfr0.js +0 -1
  105. package/dist/web/assets/index-Cr9kdjwc.js +0 -10
  106. package/dist/web/assets/task-links-B7fExlHK.js +0 -1
@@ -1,4 +1,4 @@
1
- import{C as e,F as t,c as n,d as r,j as i,kt as a,l as o,t as s,w as c}from"./Dropdown-DXEtBxVr.js";import{M as l}from"./index-Cr9kdjwc.js";import{i as u}from"./Markdown-DGF8VSqv.js";import{t as d}from"./Computers-B4ZMJ8tu.js";var f=a(),p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{for(var i=r>1?void 0:r?m(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&p(t,n,i),i},_=(e,t)=>(n,r)=>t(n,r,e),v=`Terminal input`,ee={get:()=>v,set:e=>v=e},te=`Too much output to announce, navigate to rows manually to read`,ne={get:()=>te,set:e=>te=e};function re(e){return e.replace(/\r?\n/g,`\r`)}function y(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ie(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ae(e,t,n,r){e.stopPropagation(),e.clipboardData&&oe(e.clipboardData.getData(`text/plain`),t,n,r)}function oe(e,t,n,r){e=re(e),e=y(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function b(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function se(e,t,n,r,i){b(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function x(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ce(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var le=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},ue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},S=``,de=` `,fe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new C}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},C=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},w=class e extends fe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new C,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?x(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pe=`di$target`,me=`di$dependencies`,he=new Map;function ge(e){return e[me]||[]}function T(e){if(he.has(e))return he.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);_e(t,e,r)};return t._id=e,he.set(e,t),t}function _e(e,t,n){t[pe]===t?t[me].push({id:e,index:n}):(t[me]=[{id:e,index:n}],t[pe]=t)}var E=T(`BufferService`),ve=T(`CoreMouseService`),D=T(`CoreService`),ye=T(`CharsetService`),be=T(`InstantiationService`),xe=T(`LogService`),O=T(`OptionsService`),Se=T(`OscLinkService`),Ce=T(`UnicodeService`),we=T(`DecorationService`),Te=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new w,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ee(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Te=g([_(0,E),_(1,O),_(2,Se)],Te);function Ee(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{At as e,I as t,M as n,T as r,c as i,d as a,l as o,t as s,w as c}from"./Dropdown-DGFI68Vd.js";import{F as l}from"./index-BZEKT27U.js";import{a as u}from"./Markdown-gPLWRWEJ.js";import{t as d}from"./Computers-mf4P8Wjw.js";var f=e(),p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{for(var i=r>1?void 0:r?m(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&p(t,n,i),i},_=(e,t)=>(n,r)=>t(n,r,e),v=`Terminal input`,ee={get:()=>v,set:e=>v=e},te=`Too much output to announce, navigate to rows manually to read`,ne={get:()=>te,set:e=>te=e};function re(e){return e.replace(/\r?\n/g,`\r`)}function y(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ie(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ae(e,t,n,r){e.stopPropagation(),e.clipboardData&&oe(e.clipboardData.getData(`text/plain`),t,n,r)}function oe(e,t,n,r){e=re(e),e=y(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function b(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function se(e,t,n,r,i){b(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function x(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ce(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var le=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},ue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},S=``,de=` `,fe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new C}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},C=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},w=class e extends fe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new C,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?x(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pe=`di$target`,me=`di$dependencies`,he=new Map;function ge(e){return e[me]||[]}function T(e){if(he.has(e))return he.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);_e(t,e,r)};return t._id=e,he.set(e,t),t}function _e(e,t,n){t[pe]===t?t[me].push({id:e,index:n}):(t[me]=[{id:e,index:n}],t[pe]=t)}var E=T(`BufferService`),ve=T(`CoreMouseService`),D=T(`CoreService`),ye=T(`CharsetService`),be=T(`InstantiationService`),xe=T(`LogService`),O=T(`OptionsService`),Se=T(`OscLinkService`),Ce=T(`UnicodeService`),we=T(`DecorationService`),Te=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new w,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ee(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Te=g([_(0,E),_(1,O),_(2,Se)],Te);function Ee(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var De=T(`CharSizeService`),Oe=T(`CoreBrowserService`),ke=T(`MouseService`),Ae=T(`RenderService`),je=T(`SelectionService`),Me=T(`CharacterJoinerService`),Ne=T(`ThemeService`),Pe=T(`LinkProviderService`),Fe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ve.isErrorNoTelemetry(e)?new Ve(e.message+`
4
4
 
@@ -19,4 +19,4 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
19
19
 
20
20
  `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function bs(e){Ss(e)||ys.onUnexpectedError(e)}var xs=`Canceled`;function Ss(e){return e instanceof Cs||e instanceof Error&&e.name===xs&&e.message===xs}var Cs=class extends Error{constructor(){super(xs),this.name=this.message}},ws=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Ts;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ts||={});var Es=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ts.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Es.empty=new Es(e=>{});function Ds(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Os;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function ee(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=ee})(Os||={});var ks=null;function As(e){return ks?.trackDisposable(e),e}function js(e){ks?.markAsDisposed(e)}function Ms(e,t){ks?.setParent(e,t)}function Ns(e){if(Os.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Ps(...e){return Fs(()=>Ns(e))}function Fs(e){let t=As({dispose:Ds(()=>{js(t),e()})});return t}var Is=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,As(this)}dispose(){this._isDisposed||(js(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ns(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Ms(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Ms(e,null))}};Is.DISABLE_DISPOSED_WARNING=!1;var Ls=Is,Rs=class{constructor(){this._store=new Ls,As(this),Ms(this._store,this)}dispose(){js(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Rs.None=Object.freeze({dispose(){}});var zs=class{constructor(){this._isDisposed=!1,As(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ms(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,js(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ms(e,null),e}},Bs=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Bs.Undefined=new Bs(void 0);var Vs=globalThis.performance&&typeof globalThis.performance.now==`function`,Hs=class e{static create(t){return new e(t)}constructor(e){this._now=Vs&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Us;(e=>{e.None=()=>Rs.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(Ps(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new tc({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new tc({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new tc({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function ee(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new tc({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=ee;function te(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new tc({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=te;function ne(e){return new Promise(t=>n(e)(t))}e.toPromise=ne;function re(e){let t=new tc;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=re;function y(e,t){return e(e=>t.fire(e))}e.forward=y;function ie(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=ie;class ae{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new tc(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function oe(e,t){return new ae(e,t).emitter.event}e.fromObservable=oe;function b(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Ls?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=b})(Us||={});var Ws=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Hs,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ws.all=new Set,Ws._idPool=0;var Gs=Ws,Ks=-1,qs=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Xs(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};qs._idPool=1;var Js=qs,Ys=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
21
21
  `).slice(2).join(`
22
- `))}},Xs=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Zs=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Qs=0,$s=class{constructor(e){this.value=e,this.id=Qs++}},ec=2,tc=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ks>0||this._options?.leakWarningThreshold?new Js(e?.onListenerError??bs,this._options?.leakWarningThreshold??Ks):void 0,this._perfMon=this._options?._profName?new Gs(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Zs(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||bs)(n),Rs.None}if(this._disposed)return Rs.None;t&&(e=e.bind(t));let r=new $s(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Ys.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof $s?(this._deliveryQueue??=new nc,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Fs(()=>{i?.(),this._removeListener(r)});return n instanceof Ls?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ec<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||bs;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof $s)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},nc=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rc=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ic;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof ac?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Us.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rc})})(ic||={});var ac=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?rc:(this._emitter||=new tc,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},oc=`en`,sc=!1,cc=!1,lc=oc,uc,dc=globalThis,fc;typeof dc.vscode<`u`&&typeof dc.vscode.process<`u`?fc=dc.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(fc=process);var pc=typeof fc?.versions?.electron==`string`&&fc?.type===`renderer`;if(typeof fc==`object`){fc.platform,fc.platform,sc=fc.platform===`linux`,sc&&fc.env.SNAP&&fc.env.SNAP_REVISION,fc.env.CI||fc.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lc=oc;let e=fc.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,lc=t.resolvedLanguage||oc,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!pc?(uc=navigator.userAgent,uc.indexOf(`Windows`),uc.indexOf(`Macintosh`),(uc.indexOf(`Macintosh`)>=0||uc.indexOf(`iPad`)>=0||uc.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,sc=uc.indexOf(`Linux`)>=0,uc?.indexOf(`Mobi`),cc=!0,lc=globalThis._VSCODE_NLS_LANGUAGE||oc,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);cc&&typeof dc.importScripts==`function`&&dc.origin;var mc=uc,hc=lc,gc;(e=>{function t(){return hc}e.value=t;function n(){return hc.length===2?hc===`en`:hc.length>=3&&hc[0]===`e`&&hc[1]===`n`&&hc[2]===`-`}e.isDefaultVariant=n;function r(){return hc===`en`}e.isDefault=r})(gc||={});var _c=typeof dc.postMessage==`function`&&!dc.importScripts;(()=>{if(_c){let e=[];dc.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),dc.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var vc=!!(mc&&mc.indexOf(`Chrome`)>=0);mc&&mc.indexOf(`Firefox`),!vc&&mc&&mc.indexOf(`Safari`),mc&&mc.indexOf(`Edg/`),mc&&mc.indexOf(`Android`);function yc(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=Fs(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var bc;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(bc||={});var xc=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new tc,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Us.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};xc.EMPTY=xc.fromArray([]);var Sc=class extends Rs{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new zs),this._linesCacheDisposables=this._register(new zs),this._register(Fs(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ps(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=yc(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},Cc=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},wc=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},Tc=class extends Rs{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Fs(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Ns(n)}}}clearHighlightDecorations(){Ns(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Ns(e))),s.push(i)}}return s.length===0?void 0:s}},Ec=class extends Rs{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new tc)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Dc=class extends Rs{constructor(e){super(),this._highlightTimeout=this._register(new zs),this._lineCache=this._register(new zs),this._state=new Cc,this._resultTracker=this._register(new Ec),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Sc(e),this._engine=new wc(e,this._lineCache.value),this._decorationManager=new Tc(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Fs(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=yc(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},Oc=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=Ac.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function kc(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Ac=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!kc(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},jc=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Mc(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var Nc=class{constructor(e=Mc,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||jc;this._linkProvider=this._terminal.registerLinkProvider(new Oc(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function Pc(e,t){return{provideLinks(n,r){let i=e.buffer.active,a=n-1,o=a;for(;a>0&&i.getLine(a)?.isWrapped;)a--;for(;i.getLine(o+1)?.isWrapped;)o++;let s=[],c=i.getNullCell(),l=``;for(let t=a;t<=o;t++){let n=i.getLine(t);if(!n)break;let r=Math.min(e.cols,n.length);for(let e=0;e<r;e++){n.getCell(e,c);let a=c.getWidth();if(!a)continue;let u=c.getChars();if(!u&&e===r-1&&t<o&&i.getLine(t+1)?.getCell(0)?.getWidth()===2)continue;let d=u||` `,f={start:{x:e+1,y:t+1},end:{x:e+a,y:t+1}};for(let e=0;e<d.length;e++)s.push(f);l+=d}}r(u(l).map(({start:e,end:n,link:r})=>({text:l.slice(e,n),range:{start:s[e].start,end:s[n-1].end},activate(e){(e.metaKey||e.ctrlKey)&&t(r)}})))}}}var $=i();function Fc(){let e=document.querySelector(`meta[name="teammy-style-nonce"]`)?.content;return new Proxy(document,{get(t,n){if(n===`createElement`)return(n,r)=>{let i=t.createElement(n,r);n===`style`&&e&&i.setAttribute(`nonce`,e);let a=i.appendChild;return i.appendChild=function(t){return t instanceof HTMLStyleElement&&e&&(t.nonce=e),a.call(this,t)},i};let r=Reflect.get(t,n,t);return typeof r==`function`?r.bind(t):r}})}function Ic({terminal:i,connection:a,onClosed:u,onFile:p}){let m=(0,f.useRef)(null),h=(0,f.useRef)(null),g=(0,f.useRef)(null),_=(0,f.useRef)(null),v=(0,f.useRef)(!1),ee=(0,f.useRef)(i);ee.current=i;let te=(0,f.useRef)(p);te.current=p;let[ne,re]=(0,f.useState)(!1),y=e(),[ie,ae]=(0,f.useState)(!1),[oe,b]=(0,f.useState)(``),[se,x]=(0,f.useState)(!1),[ce,le]=(0,f.useState)(!1),{send:ue,subscribe:S,request:de}=a,fe=a.connected&&a.directories.includes(i.directory),C=a.terminals.some(e=>e.id===i.id),w=(0,f.useRef)(()=>{});(0,f.useEffect)(()=>{let e={id:i.id,directory:i.directory},n=new hs({documentOverride:Fc(),cursorBlink:!0,cursorStyle:`bar`,fontSize:13,lineHeight:1.3,fontFamily:`"SFMono-Regular", Consolas, "Liberation Mono", monospace`,scrollback:2e3,allowProposedApi:!0,disableStdin:!0,theme:{background:`#faf9f7`,foreground:`#343434`,cursor:`#b75930`,selectionBackground:`#dedbd5`,black:`#30343b`,red:`#ac3737`,green:`#52733b`,yellow:`#967124`,blue:`#3f649c`,magenta:`#855092`,cyan:`#347b83`,white:`#b2b0ac`,brightBlack:`#737373`,brightRed:`#c74747`,brightGreen:`#5d833c`,brightYellow:`#9e7529`,brightBlue:`#547fbd`,brightMagenta:`#9861a5`,brightCyan:`#488f98`,brightWhite:`#dedbd5`}}),r=new vs,a=new Dc;n.loadAddon(r),n.loadAddon(a),n.loadAddon(new Nc((e,t)=>{(e.metaKey||e.ctrlKey)&&/^https?:\/\//i.test(t)&&window.open(t,`_blank`,`noopener,noreferrer`)})),n.registerLinkProvider(Pc(n,e=>te.current(e)));for(let e of[`c`,`n`]){n.parser.registerCsiHandler({final:e},()=>!0);for(let t of[`?`,`>`,`=`])n.parser.registerCsiHandler({prefix:t,final:e},()=>!0)}n.parser.registerCsiHandler({prefix:`>`,final:`q`},()=>!0),n.parser.registerCsiHandler({intermediates:`$`,final:`p`},()=>!0),n.parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},()=>!0),n.parser.registerDcsHandler({intermediates:`$`,final:`q`},()=>!0);for(let e of[4,10,11,12])n.parser.registerOscHandler(e,e=>e.includes(`?`));n.open(m.current),h.current=n,g.current=r,_.current=a;let o=-1,s=!1,l=e=>{try{ue(e)}catch(e){y(t(e))}};w.current=()=>{m.current?.clientWidth&&m.current.clientHeight&&!document.hidden&&(r.fit(),v.current&&ee.current.state===`running`&&l({...e,type:`resize`,cols:n.cols,rows:n.rows}))};let u=new ResizeObserver(()=>w.current());u.observe(m.current);let d=()=>{document.hidden||w.current()};document.addEventListener(`visibilitychange`,d);let f=S(t=>{if(`id`in t&&t.id===e.id){if(t.type===`snapshot`)v.current=!0,o=t.seq,n.reset(),n.resize(t.cols,t.rows),n.write(t.data,()=>{s||(n.options.disableStdin=ee.current.state!==`running`,re(!0),y(``),w.current(),n.focus())});else if(t.type===`size`)n.resize(t.cols,t.rows);else if(t.type===`output`){if(!v.current||t.seq<=o)return;if(t.seq!==o+1){v.current=!1,l({...e,type:`attach`});return}o=t.seq,n.write(t.data)}else t.type===`result`&&t.error&&y(t.error)}}),p=n.onData(t=>{if(!v.current||ee.current.state!==`running`)return;let n=t.match(/[\s\S]{1,16000}/gu)??[];for(let t of n)l({...e,type:`input`,data:t})});return n.attachCustomKeyEventHandler(e=>e.type===`keydown`&&(e.metaKey||e.ctrlKey&&e.shiftKey)&&e.key.toLowerCase()===`c`&&n.hasSelection()?(y(``),c(n.getSelection()).catch(()=>y(`未能复制所选终端内容,请重试。`)),!1):!0),()=>{s=!0,v.current=!1;try{ue({...e,type:`detach`})}catch{}f(),p.dispose(),u.disconnect(),document.removeEventListener(`visibilitychange`,d),n.dispose(),h.current=null,g.current=null,_.current=null}},[i.id,i.directory,ue,S,y]),(0,f.useEffect)(()=>{if(v.current=!1,re(!1),h.current&&(h.current.options.disableStdin=!0),fe&&C)try{ue({type:`attach`,id:i.id,directory:i.directory})}catch(e){y(t(e))}},[fe,C,i.id,i.directory,ue,y]),(0,f.useEffect)(()=>{h.current&&(h.current.options.disableStdin=!ne||i.state!==`running`)},[ne,i.state]);async function pe(e,n){le(!0),y(``);try{await de(e===`rename`?{type:e,id:i.id,directory:i.directory,title:n}:{type:e,id:i.id,directory:i.directory}),e===`close`&&u()}catch(e){y(t(e))}finally{le(!1),x(!1)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{title:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(d,{title:i.title,busy:ce||!fe,onSave:e=>pe(`rename`,e)}),(0,$.jsxs)(`p`,{className:`terminal-location`,title:i.cwd,children:[`执行位置:`,i.cwd]})]}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{icon:`search`,label:`查找终端内容`,onClick:()=>ae(!ie)}),(0,$.jsx)(s,{id:`terminal-menu`,routeKey:i.id,triggerId:`terminal-actions`,label:`终端操作`,trigger:(0,$.jsx)(n,{name:`more`}),className:`computer-create-menu`,children:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{role:`menuitem`,onClick:()=>{h.current?.clear(),e()},children:`清屏`}),(0,$.jsx)(`button`,{role:`menuitem`,disabled:!fe||!C,onClick:()=>{e(),x(!0)},children:`关闭终端`})]})})]})}),ie&&(0,$.jsxs)(`form`,{className:`terminal-search`,onSubmit:e=>{e.preventDefault(),_.current?.findNext(oe)},children:[(0,$.jsx)(`input`,{autoFocus:!0,"aria-label":`查找终端内容`,placeholder:`查找`,value:oe,onChange:e=>{b(e.target.value),_.current?.findNext(e.target.value)}}),(0,$.jsx)(o,{icon:`close`,label:`关闭查找`,onClick:()=>{ae(!1),_.current?.clearDecorations(),h.current?.focus()}})]}),(0,$.jsx)(`div`,{className:`terminal-surface`,"data-testid":`terminal-pane`,children:(0,$.jsx)(`div`,{className:`terminal-emulator`,ref:m,"aria-label":`交互终端`})}),(!ne||i.state===`exited`||!C)&&(0,$.jsx)(`p`,{className:`terminal-status`,role:`status`,children:fe?C?i.state===`exited`?`进程已退出 · ${i.exitCode??0}`:`正在连接…`:`终端已结束,请新建终端。`:`连接已断开,正在重连…`}),se&&(0,$.jsxs)(r,{id:`terminal-close`,title:`关闭终端`,onClose:()=>x(!1),children:[(0,$.jsx)(`p`,{children:`结束此终端及其中运行的进程?`}),(0,$.jsxs)(`div`,{className:`actions`,children:[(0,$.jsx)(`button`,{onClick:()=>x(!1),children:`取消`}),(0,$.jsx)(`button`,{className:`primary`,disabled:ce,onClick:()=>void pe(`close`),children:`关闭终端`})]})]})]})}export{Ic as default};
22
+ `))}},Xs=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Zs=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Qs=0,$s=class{constructor(e){this.value=e,this.id=Qs++}},ec=2,tc=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ks>0||this._options?.leakWarningThreshold?new Js(e?.onListenerError??bs,this._options?.leakWarningThreshold??Ks):void 0,this._perfMon=this._options?._profName?new Gs(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Zs(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||bs)(n),Rs.None}if(this._disposed)return Rs.None;t&&(e=e.bind(t));let r=new $s(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Ys.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof $s?(this._deliveryQueue??=new nc,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Fs(()=>{i?.(),this._removeListener(r)});return n instanceof Ls?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ec<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||bs;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof $s)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},nc=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rc=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ic;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof ac?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Us.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rc})})(ic||={});var ac=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?rc:(this._emitter||=new tc,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},oc=`en`,sc=!1,cc=!1,lc=oc,uc,dc=globalThis,fc;typeof dc.vscode<`u`&&typeof dc.vscode.process<`u`?fc=dc.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(fc=process);var pc=typeof fc?.versions?.electron==`string`&&fc?.type===`renderer`;if(typeof fc==`object`){fc.platform,fc.platform,sc=fc.platform===`linux`,sc&&fc.env.SNAP&&fc.env.SNAP_REVISION,fc.env.CI||fc.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lc=oc;let e=fc.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,lc=t.resolvedLanguage||oc,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!pc?(uc=navigator.userAgent,uc.indexOf(`Windows`),uc.indexOf(`Macintosh`),(uc.indexOf(`Macintosh`)>=0||uc.indexOf(`iPad`)>=0||uc.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,sc=uc.indexOf(`Linux`)>=0,uc?.indexOf(`Mobi`),cc=!0,lc=globalThis._VSCODE_NLS_LANGUAGE||oc,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);cc&&typeof dc.importScripts==`function`&&dc.origin;var mc=uc,hc=lc,gc;(e=>{function t(){return hc}e.value=t;function n(){return hc.length===2?hc===`en`:hc.length>=3&&hc[0]===`e`&&hc[1]===`n`&&hc[2]===`-`}e.isDefaultVariant=n;function r(){return hc===`en`}e.isDefault=r})(gc||={});var _c=typeof dc.postMessage==`function`&&!dc.importScripts;(()=>{if(_c){let e=[];dc.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),dc.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var vc=!!(mc&&mc.indexOf(`Chrome`)>=0);mc&&mc.indexOf(`Firefox`),!vc&&mc&&mc.indexOf(`Safari`),mc&&mc.indexOf(`Edg/`),mc&&mc.indexOf(`Android`);function yc(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=Fs(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var bc;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(bc||={});var xc=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new tc,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Us.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};xc.EMPTY=xc.fromArray([]);var Sc=class extends Rs{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new zs),this._linesCacheDisposables=this._register(new zs),this._register(Fs(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ps(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=yc(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},Cc=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},wc=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},Tc=class extends Rs{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Fs(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Ns(n)}}}clearHighlightDecorations(){Ns(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Ns(e))),s.push(i)}}return s.length===0?void 0:s}},Ec=class extends Rs{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new tc)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Dc=class extends Rs{constructor(e){super(),this._highlightTimeout=this._register(new zs),this._lineCache=this._register(new zs),this._state=new Cc,this._resultTracker=this._register(new Ec),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Sc(e),this._engine=new wc(e,this._lineCache.value),this._decorationManager=new Tc(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Fs(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=yc(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},Oc=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=Ac.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function kc(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Ac=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!kc(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},jc=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Mc(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var Nc=class{constructor(e=Mc,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||jc;this._linkProvider=this._terminal.registerLinkProvider(new Oc(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function Pc(e,t){return{provideLinks(n,r){let i=e.buffer.active,a=n-1,o=a;for(;a>0&&i.getLine(a)?.isWrapped;)a--;for(;i.getLine(o+1)?.isWrapped;)o++;let s=[],c=i.getNullCell(),l=``;for(let t=a;t<=o;t++){let n=i.getLine(t);if(!n)break;let r=Math.min(e.cols,n.length);for(let e=0;e<r;e++){n.getCell(e,c);let a=c.getWidth();if(!a)continue;let u=c.getChars();if(!u&&e===r-1&&t<o&&i.getLine(t+1)?.getCell(0)?.getWidth()===2)continue;let d=u||` `,f={start:{x:e+1,y:t+1},end:{x:e+a,y:t+1}};for(let e=0;e<d.length;e++)s.push(f);l+=d}}r(u(l).map(({start:e,end:n,link:r})=>({text:l.slice(e,n),range:{start:s[e].start,end:s[n-1].end},activate(e){(e.metaKey||e.ctrlKey)&&t(r)}})))}}}var $=n();function Fc(){let e=document.querySelector(`meta[name="teammy-style-nonce"]`)?.content;return new Proxy(document,{get(t,n){if(n===`createElement`)return(n,r)=>{let i=t.createElement(n,r);n===`style`&&e&&i.setAttribute(`nonce`,e);let a=i.appendChild;return i.appendChild=function(t){return t instanceof HTMLStyleElement&&e&&(t.nonce=e),a.call(this,t)},i};let r=Reflect.get(t,n,t);return typeof r==`function`?r.bind(t):r}})}function Ic({terminal:e,connection:n,onClosed:u,onFile:p}){let m=(0,f.useRef)(null),h=(0,f.useRef)(null),g=(0,f.useRef)(null),_=(0,f.useRef)(null),v=(0,f.useRef)(!1),ee=(0,f.useRef)(e);ee.current=e;let te=(0,f.useRef)(p);te.current=p;let[ne,re]=(0,f.useState)(!1),y=c(),[ie,ae]=(0,f.useState)(!1),[oe,b]=(0,f.useState)(``),[se,x]=(0,f.useState)(!1),[ce,le]=(0,f.useState)(!1),{send:ue,subscribe:S,request:de}=n,fe=n.connected&&n.directories.includes(e.directory),C=n.terminals.some(t=>t.id===e.id),w=(0,f.useRef)(()=>{});(0,f.useEffect)(()=>{let n={id:e.id,directory:e.directory},i=new hs({documentOverride:Fc(),cursorBlink:!0,cursorStyle:`bar`,fontSize:13,lineHeight:1.3,fontFamily:`"SFMono-Regular", Consolas, "Liberation Mono", monospace`,scrollback:2e3,allowProposedApi:!0,disableStdin:!0,theme:{background:`#faf9f7`,foreground:`#343434`,cursor:`#b75930`,selectionBackground:`#dedbd5`,black:`#30343b`,red:`#ac3737`,green:`#52733b`,yellow:`#967124`,blue:`#3f649c`,magenta:`#855092`,cyan:`#347b83`,white:`#b2b0ac`,brightBlack:`#737373`,brightRed:`#c74747`,brightGreen:`#5d833c`,brightYellow:`#9e7529`,brightBlue:`#547fbd`,brightMagenta:`#9861a5`,brightCyan:`#488f98`,brightWhite:`#dedbd5`}}),a=new vs,o=new Dc;i.loadAddon(a),i.loadAddon(o),i.loadAddon(new Nc((e,t)=>{(e.metaKey||e.ctrlKey)&&/^https?:\/\//i.test(t)&&window.open(t,`_blank`,`noopener,noreferrer`)})),i.registerLinkProvider(Pc(i,e=>te.current(e)));for(let e of[`c`,`n`]){i.parser.registerCsiHandler({final:e},()=>!0);for(let t of[`?`,`>`,`=`])i.parser.registerCsiHandler({prefix:t,final:e},()=>!0)}i.parser.registerCsiHandler({prefix:`>`,final:`q`},()=>!0),i.parser.registerCsiHandler({intermediates:`$`,final:`p`},()=>!0),i.parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},()=>!0),i.parser.registerDcsHandler({intermediates:`$`,final:`q`},()=>!0);for(let e of[4,10,11,12])i.parser.registerOscHandler(e,e=>e.includes(`?`));i.open(m.current),h.current=i,g.current=a,_.current=o;let s=-1,c=!1,l=e=>{try{ue(e)}catch(e){y(t(e))}};w.current=()=>{m.current?.clientWidth&&m.current.clientHeight&&!document.hidden&&(a.fit(),v.current&&ee.current.state===`running`&&l({...n,type:`resize`,cols:i.cols,rows:i.rows}))};let u=new ResizeObserver(()=>w.current());u.observe(m.current);let d=()=>{document.hidden||w.current()};document.addEventListener(`visibilitychange`,d);let f=S(e=>{if(`id`in e&&e.id===n.id){if(e.type===`snapshot`)v.current=!0,s=e.seq,i.reset(),i.resize(e.cols,e.rows),i.write(e.data,()=>{c||(i.options.disableStdin=ee.current.state!==`running`,re(!0),y(``),w.current(),i.focus())});else if(e.type===`size`)i.resize(e.cols,e.rows);else if(e.type===`output`){if(!v.current||e.seq<=s)return;if(e.seq!==s+1){v.current=!1,l({...n,type:`attach`});return}s=e.seq,i.write(e.data)}else e.type===`result`&&e.error&&y(e.error)}}),p=i.onData(e=>{if(!v.current||ee.current.state!==`running`)return;let t=e.match(/[\s\S]{1,16000}/gu)??[];for(let e of t)l({...n,type:`input`,data:e})});return i.attachCustomKeyEventHandler(e=>e.type===`keydown`&&(e.metaKey||e.ctrlKey&&e.shiftKey)&&e.key.toLowerCase()===`c`&&i.hasSelection()?(y(``),r(i.getSelection()).catch(()=>y(`未能复制所选终端内容,请重试。`)),!1):!0),()=>{c=!0,v.current=!1;try{ue({...n,type:`detach`})}catch{}f(),p.dispose(),u.disconnect(),document.removeEventListener(`visibilitychange`,d),i.dispose(),h.current=null,g.current=null,_.current=null}},[e.id,e.directory,ue,S,y]),(0,f.useEffect)(()=>{if(v.current=!1,re(!1),h.current&&(h.current.options.disableStdin=!0),fe&&C)try{ue({type:`attach`,id:e.id,directory:e.directory})}catch(e){y(t(e))}},[fe,C,e.id,e.directory,ue,y]),(0,f.useEffect)(()=>{h.current&&(h.current.options.disableStdin=!ne||e.state!==`running`)},[ne,e.state]);async function pe(n,r){le(!0),y(``);try{await de(n===`rename`?{type:n,id:e.id,directory:e.directory,title:r}:{type:n,id:e.id,directory:e.directory}),n===`close`&&u()}catch(e){y(t(e))}finally{le(!1),x(!1)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{title:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(d,{title:e.title,busy:ce||!fe,onSave:e=>pe(`rename`,e)}),(0,$.jsxs)(`p`,{className:`terminal-location`,title:e.cwd,children:[`执行位置:`,e.cwd]})]}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{icon:`search`,label:`查找终端内容`,onClick:()=>ae(!ie)}),(0,$.jsx)(s,{id:`terminal-menu`,routeKey:e.id,triggerId:`terminal-actions`,label:`终端操作`,trigger:(0,$.jsx)(i,{name:`more`}),className:`computer-create-menu`,children:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{role:`menuitem`,onClick:()=>{h.current?.clear(),e()},children:`清屏`}),(0,$.jsx)(`button`,{role:`menuitem`,disabled:!fe||!C,onClick:()=>{e(),x(!0)},children:`关闭终端`})]})})]})}),ie&&(0,$.jsxs)(`form`,{className:`terminal-search`,onSubmit:e=>{e.preventDefault(),_.current?.findNext(oe)},children:[(0,$.jsx)(`input`,{autoFocus:!0,"aria-label":`查找终端内容`,placeholder:`查找`,value:oe,onChange:e=>{b(e.target.value),_.current?.findNext(e.target.value)}}),(0,$.jsx)(o,{icon:`close`,label:`关闭查找`,onClick:()=>{ae(!1),_.current?.clearDecorations(),h.current?.focus()}})]}),(0,$.jsx)(`div`,{className:`terminal-surface`,"data-testid":`terminal-pane`,children:(0,$.jsx)(`div`,{className:`terminal-emulator`,ref:m,"aria-label":`交互终端`})}),(!ne||e.state===`exited`||!C)&&(0,$.jsx)(`p`,{className:`terminal-status`,role:`status`,children:fe?C?e.state===`exited`?`进程已退出 · ${e.exitCode??0}`:`正在连接…`:`终端已结束,请新建终端。`:`连接已断开,正在重连…`}),se&&(0,$.jsxs)(a,{id:`terminal-close`,title:`关闭终端`,onClose:()=>x(!1),children:[(0,$.jsx)(`p`,{children:`结束此终端及其中运行的进程?`}),(0,$.jsxs)(`div`,{className:`actions`,children:[(0,$.jsx)(`button`,{onClick:()=>x(!1),children:`取消`}),(0,$.jsx)(`button`,{className:`primary`,disabled:ce,onClick:()=>void pe(`close`),children:`关闭终端`})]})]})]})}export{Ic as default};
@@ -0,0 +1 @@
1
+ import{A as e,At as t,Ct as n,I as r,M as i,O as a,S as o,bt as s,c,dt as l,lt as u,mt as d,st as f,vt as p,w as m,wt as h}from"./Dropdown-DGFI68Vd.js";import{U as g,z as _}from"./index-BZEKT27U.js";var v=i();function y({url:e,name:t}){return(0,v.jsx)(`iframe`,{className:`html-preview`,title:`${t} 预览`,src:`${e}${e.includes(`?`)?`&`:`?`}view=html`,sandbox:``,referrerPolicy:`no-referrer`})}var b=t(),x=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function S(e,t){return x.compare(e,t)||(e<t?-1:+(e>t))}var C=`_project`,w=`_resources`,T=e=>e===`_project`||e===`_resources`,E=e=>/^_memory(?:\/|$)/i.test(e);h([l,p(C),p(w)]);var D=n().max(255).refine(e=>{let t=e.endsWith(`/`),n=t?e.slice(0,-1):e;return f.safeParse(n).success&&!n.includes(`/`)&&!n.startsWith(`.`)&&!/^_?teammy/i.test(n)&&!E(n)&&(t?n.startsWith(`_`):n.includes(`.`))},`Use a root file (README.md) or an underscore-prefixed directory (_template/).`);s({maintainer:l.nullable(),paths:d(D).max(30).refine(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length),revision:u}).strict().omit({revision:!0}).extend({expectedRevision:u}).strict();function O(e){return e.split(`/`).some(e=>/^\.teammy(?:[-.]|$)/i.test(e))}function k(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)].filter(e=>!e.closest(`[hidden]`)),r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var A=(e,t)=>`${e}/${t}`,j=e=>({"--tree-level":e});function M({members:e,...t}){let[n,r]=(0,b.useState)(()=>`folder:${A(e.find(e=>e.hasFiles)?.id??`_project`,``)}`);return(0,v.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:k,children:(0,v.jsx)(P,{owner:C,path:``,level:1,members:e.filter(e=>e.hasFiles),context:{...t,focused:n,onFocus:r}})})}function N({owner:e,path:t,level:n,context:r}){let i=r.expanded.has(A(e,t)),a=`folder:${A(e,t)}`;return(0,v.jsxs)(`div`,{role:`none`,children:[(0,v.jsxs)(_,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:j(n),"aria-label":t||e,"aria-level":n,"aria-expanded":i,"aria-selected":r.selected?.kind===`directory`&&r.selected.owner===e&&r.selected.path===t,tabIndex:r.focused===a?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>r.onFocus(a),onClick:()=>r.onToggle(e,t),leading:(0,v.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,v.jsx)(c,{name:`chevron`,size:`small`})}),children:[(0,v.jsx)(c,{name:`files`}),(0,v.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),i&&(0,v.jsx)(P,{owner:e,path:t,level:n+1,context:r})]})}function P({owner:t,path:n,level:i,context:s,members:l=[]}){let{api:u,projectId:d}=g(),f=(0,b.useCallback)(e=>u.tree(t,n,void 0,``,e),[t,n]),p=a(f,!1,e(d,`file-tree`,t,n)),[h,y]=(0,b.useState)(),[x,C]=(0,b.useState)(!1),w=m(),D=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>D.current?.abort(),[]);let k=h?.revision===p.data?.revision?h:void 0,M=k?k.nextCursor:p.data?.nextCursor;async function P(){if(!M||!p.data||x)return;C(!0),w(``);let e=new AbortController;D.current=e;try{let r=await u.tree(t,n,p.data.revision,M,e.signal);e.signal.aborted||y({...r,entries:[...k?.entries??[],...r.entries]})}catch(t){e.signal.aborted||w(r(t))}finally{e.signal.aborted||C(!1)}}let F=[...(p.data?.entries??[]).filter(e=>!O(e.path)),...(k?.entries??[]).filter(e=>!O(e.path))],I=s.revealed;if(I?.owner===t&&!O(I.path)&&(!n||I.path.startsWith(n+`/`))){let e=n?I.path.slice(n.length+1):I.path,t=e.indexOf(`/`),r=t<0?I.path:[n,e.slice(0,t)].filter(Boolean).join(`/`);F.some(e=>e.path===r)||F.push(t<0?{...I.file,kind:`file`}:{kind:`directory`,path:r})}let L=[...F.filter(e=>t!==`_project`||!E(e.path)).map(e=>({...e,owner:t})),...l.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?S(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,v.jsxs)(`div`,{role:`group`,"aria-label":A(T(t)?`teamcontext`:t,n),"aria-busy":p.loading||x,children:[p.loading&&(0,v.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,v.jsx)(o,{resource:p}),L.map(e=>e.kind===`directory`?(0,v.jsx)(N,{owner:e.owner,path:e.path,level:i,context:s},A(e.owner,e.path)):(0,v.jsxs)(_,{type:`button`,role:`treeitem`,className:`tree-item`,style:j(i),"aria-label":e.path,"aria-level":i,"aria-selected":s.selected?.kind===`file`&&s.selected.owner===t&&s.selected.path===e.path,tabIndex:s.focused===`file:${A(t,e.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":t,"data-file-path":e.path,onFocus:()=>s.onFocus(`file:${A(t,e.path)}`),onClick:()=>s.onSelect(t,e.path),leading:(0,v.jsx)(`span`,{className:`tree-chevron`}),children:[(0,v.jsx)(c,{name:`file`}),(0,v.jsx)(`span`,{className:`tree-name`,children:e.path.split(`/`).at(-1)})]},e.path)),M&&(0,v.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:x,onClick:()=>void P(),children:x?`正在加载…`:`加载更多`})]})}export{E as a,S as c,C as i,y as l,A as n,O as o,k as r,T as s,M as t};
@@ -1 +1 @@
1
- import{ot as e}from"./Dropdown-DXEtBxVr.js";function t(t,n){if(!n||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(n))return null;try{let r=n.split(/[?#]/,1)[0],i=r?t.split(`/`).slice(0,-1):t.split(`/`);for(let e of r.split(`/`)){let t=decodeURIComponent(e);if(t&&t!==`.`){if(t===`..`){if(!i.length)return null;i.pop()}else{if(t.includes(`/`)||t.includes(`\\`))return null;i.push(t)}}}return{path:i.length?e.parse(i.join(`/`)):``,directory:r.endsWith(`/`),anchor:n.includes(`#`)?decodeURIComponent(n.slice(n.indexOf(`#`)+1)):``}}catch{return null}}export{t};
1
+ import{st as e}from"./Dropdown-DGFI68Vd.js";function t(t,n){if(!n||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(n))return null;try{let r=n.split(/[?#]/,1)[0],i=r?t.split(`/`).slice(0,-1):t.split(`/`);for(let e of r.split(`/`)){let t=decodeURIComponent(e);if(t&&t!==`.`){if(t===`..`){if(!i.length)return null;i.pop()}else{if(t.includes(`/`)||t.includes(`\\`))return null;i.push(t)}}}return{path:i.length?e.parse(i.join(`/`)):``,directory:r.endsWith(`/`),anchor:n.includes(`#`)?decodeURIComponent(n.slice(n.indexOf(`#`)+1)):``}}catch{return null}}export{t};