1import{d as s,e as p}from"./chunk-ZVFPVE2Y.js";import{k as a}from"./chunk-YJXU6CME.js";var o=class extends p{write(t){return a(this,null,function*(){if(typeof navigator>"u"||!navigator.clipboard)throw this.unavailable("Clipboard API not available in this browser");if(t.string!==void 0)yield this.writeText(t.string);else if(t.url)yield this.writeText(t.url);else if(t.image)if(typeof ClipboardItem<"u")try{let e=yield(yield fetch(t.image)).blob(),r=new ClipboardItem({[e.type]:e});yield navigator.clipboard.write([r])}catch(e){throw new Error("Failed to write image")}else throw this.unavailable("Writing images to the clipboard is not supported in this browser");else throw new Error("Nothing to write")})}read(){return a(this,null,function*(){if(typeof navigator>"u"||!navigator.clipboard)throw this.unavailable("Clipboard API not available in this browser");if(typeof ClipboardItem<"u")try{let t=yield navigator.clipboard.read(),e=t[0].types[0],r=yield t[0].getType(e);return{value:yield this._getBlobData(r,e),type:e}}catch(t){return this.readText()}else return this.readText()})}readText(){return a(this,null,function*(){if(typeof navigator>"u"||!navigator.clipboard||!navigator.clipboard.readText)throw this.unavailable("Reading from clipboard not supported in this browser");return{value:yield navigator.clipboard.readText(),type:"text/plain"}})}writeText(t){return a(this,null,function*(){if(typeof navigator>"u"||!navigator.clipboard||!navigator.clipboard.writeText)throw this.unavailable("Writting to clipboard not supported in this browser");yield navigator.clipboard.writeText(t)})}_getBlobData(t,e){return new Promise((r,d)=>{let i=new FileReader;e.includes("image")?i.readAsDataURL(t):i.readAsText(t),i.onloadend=()=>{let n=i.result;r(n)},i.onerror=n=>{d(n)}})}};var b=s("Clipboard",{web:()=>new o});var x=l=>a(null,null,function*(){return yield b.write({string:l})});export{x as writeToClipboard};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.