1import{u as p,y as h,i as u,e as b,k as y,v as g,I as d,V as m}from"./index-CJc8hgUW.js";var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,c=(e,t,i,l)=>{for(var o=l>1?void 0:l?v(t,i):t,n=e.length-1,r;n>=0;n--)(r=e[n])&&(o=(l?r(t,i,o):r(o))||o);return l&&o&&f(t,i,o),o};let a=null;function w(){return a||(a=document.createElement("gist-share-dialog"),document.body.appendChild(a)),a}let s=class extends p{constructor(){super(...arguments),this.link="",this.copyLabel="Copy",this.dialogEl=null,this.resolveFn=null,this.onCancel=e=>{e.preventDefault(),this.finish()},this.onFocusInput=e=>{e.target.select()},this.copy=async()=>{try{await navigator.clipboard.writeText(this.link),this.copyLabel="Copied!"}catch{this.copyLabel="Copy failed"}setTimeout(()=>{this.copyLabel="Copy"},1500)}}static open(e){return w().openDialog(e)}connectedCallback(){super.connectedCallback()}firstUpdated(){this.dialogEl=this.shadowRoot?.querySelector("dialog")??null;const e=this.shadowRoot?.querySelector(".dialog-header");this.dialogEl&&e&&h(this.dialogEl,e)}openDialog(e){return this.link=e,this.copyLabel="Copy",new Promise(t=>{this.resolveFn=t,this.updateComplete.then(()=>{this.dialogEl?.showModal();const i=this.shadowRoot?.querySelector("input.link");i?.focus(),i?.select()})})}finish(){this.dialogEl?.close();const e=this.resolveFn;this.resolveFn=null,queueMicrotask(()=>e?.())}render(){return b` 2 <dialog @cancel=${this.onCancel} @keydown=${u}> 3 <button type="button" class="close-x" title="Close" @click=${()=>this.finish()}>Ã</button> 4 <form 5 @submit=${e=>{e.preventDefault(),this.finish()}} 6 > 7 <div class="dialog-header"> 8 <h2>Share workspace</h2> 9 <div class="header-actions"> 10 <button type="submit" class="primary">Close</button> 11 </div> 12 </div> 13 <div class="dialog-body"> 14 <a class="link-preview" href=${this.link} target="_blank" rel="noopener noreferrer" title=${this.link}>${this.link}</a> 15 <div class="link-row"> 16 <input class="link" type="text" readonly .value=${this.link} @focus=${this.onFocusInput} /> 17 <button type="button" class="ghost copy" @click=${()=>void this.copy()}>${this.copyLabel}</button> 18 </div> 19 <p class="caution">â This link contains your GitHub token â anyone you send it to can read and modify your gists. Only share it with people you trust.</p> 20 </div> 21 </form> 22 </dialog> 23 `}};s.styles=[y,g` 24 dialog { 25 min-width: 420px; 26 max-width: 560px; 27 } 28 a.link-preview { 29 display: block; 30 max-width: 100%; 31 overflow: hidden; 32 white-space: nowrap; 33 text-overflow: ellipsis; 34 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 35 font-size: 0.8rem; 36 color: #2563eb; 37 text-decoration: underline; 38 margin-bottom: 0.4rem; 39 } 40 .link-row { 41 display: flex; 42 gap: 0.5rem; 43 } 44 input.link { 45 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 46 font-size: 0.8rem; 47 padding: 0.45rem 0.55rem; 48 border: 1px solid #d1d5db; 49 border-radius: 0.25rem; 50 width: 100%; 51 box-sizing: border-box; 52 background: white; 53 } 54 button.ghost.copy { 55 white-space: nowrap; 56 } 57 .caution { 58 color: #b45309; 59 font-size: 0.82rem; 60 line-height: 1.5; 61 margin: 0; 62 background: #fffbeb; 63 border: 1px solid #fde68a; 64 border-radius: 0.3rem; 65 padding: 0.55rem 0.7rem; 66 } 67 `];c([d()],s.prototype,"link",2);c([d()],s.prototype,"copyLabel",2);s=c([m("gist-share-dialog")],s);export{s as GistShareDialog}; 68//# sourceMappingURL=gist-share-dialog-D7wNqASC.js.map
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.