!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClipboardAddon=t():e.ClipboardAddon=t()}(self,()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.Base64=t.BrowserClipboardProvider=t.ClipboardAddon=void 0,t.ClipboardAddon=class{constructor(e=new o,t=new r){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){const r=this._base64.encodeText(t);this._terminal?.input(`]52;${e};${r}`,!1)}_setOrReportClipboard(e){const t=e.split(";");if(t.length<2)return!0;const r=t[0],o=t[1];if("?"===o){const e=this._provider.readText(r);return e instanceof Promise?e.then(e=>(this._readText(r,e),!0)):(this._readText(r,e),!0)}let i="";try{i=this._base64.decodeText(o)}catch{}const s=this._provider.writeText(r,i);return!(s instanceof Promise)||s.then(()=>!0)}};class r{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}}t.BrowserClipboardProvider=r;class o{encodeText(e){const t=(new TextEncoder).encode(e);if(void 0!==t.toBase64)return t.toBase64();let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}decodeText(e){if(void 0!==Uint8Array.fromBase64){try{return(new TextDecoder).decode(Uint8Array.fromBase64(e))}catch{}return""}try{const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;++e)r[e]=t.charCodeAt(e);return(new TextDecoder).decode(r)}catch{}return""}}t.Base64=o})(),e})());//# sourceMappingURL=https://github.com/VSCodium/sourcemaps/releases/download/stable-4c0b0c6cc561d2d3636d1ec250935431876ce4dc/node_modules-@xterm-addon-clipboard-lib-addon-clipboard.js.map