static: remove side effectful imports from shared scripts

To complete the transition to module based scripts this change
removes the remaining side effectful imports from the playground
and jump modal code.

Change-Id: I1f50973118cab866c7a58c860894cb1fe708df9d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/346436
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/static/frontend/unit/main/main.js b/static/frontend/unit/main/main.js
index 115f1fa..d0e6fc8 100644
--- a/static/frontend/unit/main/main.js
+++ b/static/frontend/unit/main/main.js
@@ -1,4 +1,4 @@
-var c=document.querySelector(".JumpDialog"),p=c==null?void 0:c.querySelector(".JumpDialog-body"),o=c==null?void 0:c.querySelector(".JumpDialog-list"),u=c==null?void 0:c.querySelector(".JumpDialog-input"),M=document.querySelector(".js-documentation"),h;function V(){let s=[];if(!!M){for(let e of M.querySelectorAll("[data-kind]"))s.push(J(e));for(let e of s)e.link.addEventListener("click",function(){c==null||c.close()});return s.sort(function(e,t){return e.lower.localeCompare(t.lower)}),s}}function J(s){var r;let e=document.createElement("a"),t=s.getAttribute("id");e.setAttribute("href","#"+t),e.setAttribute("tabindex","-1"),e.setAttribute("data-gtmc","jump to link");let i=s.getAttribute("data-kind");return{link:e,name:t!=null?t:"",kind:i!=null?i:"",lower:(r=t==null?void 0:t.toLowerCase())!=null?r:""}}var S,T=-1;function x(s){for(S=s,h||(h=V()),g(-1);o==null?void 0:o.firstChild;)o.firstChild.remove();if(s){let e=s.toLowerCase(),t=[],i=[],r=[],l=(n,a,d)=>n.name.substring(0,a)+"<b>"+n.name.substring(a,d)+"</b>"+n.name.substring(d);for(let n of h!=null?h:[]){let a=n.name.toLowerCase();if(a===e)n.link.innerHTML=l(n,0,n.name.length),t.push(n);else if(a.startsWith(e))n.link.innerHTML=l(n,0,s.length),i.push(n);else{let d=a.indexOf(e);d>-1&&(n.link.innerHTML=l(n,d,d+s.length),r.push(n))}}for(let n of t.concat(i).concat(r))o==null||o.appendChild(n.link)}else{if(!h||h.length===0){let e=document.createElement("i");e.innerHTML="There are no symbols on this page.",o==null||o.appendChild(e)}for(let e of h!=null?h:[])e.link.innerHTML=e.name+" <i>"+e.kind+"</i>",o==null||o.appendChild(e.link)}p&&(p.scrollTop=0),(h==null?void 0:h.length)&&o&&o.children.length>0&&g(0)}function g(s){let e=o==null?void 0:o.children;if(!(!e||!p)){if(T>=0&&e[T].classList.remove("JumpDialog-active"),s>=e.length&&(s=e.length-1),s>=0){e[s].classList.add("JumpDialog-active");let t=e[s].offsetTop-e[0].offsetTop,i=t+e[s].clientHeight;t<p.scrollTop?p.scrollTop=t:i>p.scrollTop+p.clientHeight&&(p.scrollTop=i-p.clientHeight)}T=s}}function H(s){if(T<0)return;let e=T+s;e<0&&(e=0),g(e)}u==null||u.addEventListener("keyup",function(){u.value.toUpperCase()!=S.toUpperCase()&&x(u.value)});u==null||u.addEventListener("keydown",function(s){let e=38,t=40,i=13;switch(s.which){case e:H(-1),s.preventDefault();break;case t:H(1),s.preventDefault();break;case i:T>=0&&o&&(o.children[T].click(),s.preventDefault());break}});var E=document.querySelector(".ShortcutsDialog");document.addEventListener("keypress",function(s){if((c==null?void 0:c.open)||(E==null?void 0:E.open))return;let e=s.target,t=e==null?void 0:e.tagName;if(t=="INPUT"||t=="SELECT"||t=="TEXTAREA"||(e==null?void 0:e.contentEditable)=="true"||s.metaKey||s.ctrlKey)return;switch(String.fromCharCode(s.which)){case"f":case"F":s.preventDefault(),u&&(u.value=""),c==null||c.showModal(),u==null||u.focus(),x("");break;case"?":E==null||E.showModal();break}});var O=document.querySelector(".js-jumpToInput");O&&O.addEventListener("click",()=>{u&&(u.value=""),x("")});var f={PLAY_HREF:".js-exampleHref",PLAY_CONTAINER:".js-exampleContainer",EXAMPLE_INPUT:".Documentation-exampleCode",EXAMPLE_OUTPUT:".Documentation-exampleOutput",EXAMPLE_ERROR:".Documentation-exampleError",PLAY_BUTTON:".Documentation-examplePlayButton",SHARE_BUTTON:".Documentation-exampleShareButton",FORMAT_BUTTON:".Documentation-exampleFormatButton",RUN_BUTTON:".Documentation-exampleRunButton"},B=class{constructor(e){this.exampleEl=e;var t,i,r,l;this.exampleEl=e,this.anchorEl=e.querySelector("a"),this.errorEl=e.querySelector(f.EXAMPLE_ERROR),this.playButtonEl=e.querySelector(f.PLAY_BUTTON),this.shareButtonEl=e.querySelector(f.SHARE_BUTTON),this.formatButtonEl=e.querySelector(f.FORMAT_BUTTON),this.runButtonEl=e.querySelector(f.RUN_BUTTON),this.inputEl=this.makeTextArea(e.querySelector(f.EXAMPLE_INPUT)),this.outputEl=e.querySelector(f.EXAMPLE_OUTPUT),(t=this.playButtonEl)==null||t.addEventListener("click",()=>this.handleShareButtonClick()),(i=this.shareButtonEl)==null||i.addEventListener("click",()=>this.handleShareButtonClick()),(r=this.formatButtonEl)==null||r.addEventListener("click",()=>this.handleFormatButtonClick()),(l=this.runButtonEl)==null||l.addEventListener("click",()=>this.handleRunButtonClick()),!!this.inputEl&&(this.resize(),this.inputEl.addEventListener("keyup",()=>this.resize()),this.inputEl.addEventListener("keydown",n=>this.onKeydown(n)))}makeTextArea(e){var i,r;let t=document.createElement("textarea");return t.classList.add("Documentation-exampleCode","code"),t.spellcheck=!1,t.value=(i=e==null?void 0:e.textContent)!=null?i:"",(r=e==null?void 0:e.parentElement)==null||r.replaceChild(t,e),t}getAnchorHash(){var e;return(e=this.anchorEl)==null?void 0:e.hash}expand(){this.exampleEl.open=!0}resize(){var e;if((e=this.inputEl)==null?void 0:e.value){let t=(this.inputEl.value.match(/\n/g)||[]).length;this.inputEl.style.height=`${(20+t*20+12+2)/16}rem`}}onKeydown(e){e.key==="Tab"&&(document.execCommand("insertText",!1,"	"),e.preventDefault())}setInputText(e){this.inputEl&&(this.inputEl.value=e)}setOutputText(e){this.outputEl&&(this.outputEl.textContent=e)}setErrorText(e){this.errorEl&&(this.errorEl.textContent=e),this.setOutputText("An error has occurred\u2026")}handleShareButtonClick(){var t;let e="https://play.golang.org/p/";this.setOutputText("Waiting for remote server\u2026"),fetch("/play/share",{method:"POST",body:(t=this.inputEl)==null?void 0:t.value}).then(i=>i.text()).then(i=>{let r=e+i;this.setOutputText(`<a href="${r}">${r}</a>`),window.open(r)}).catch(i=>{this.setErrorText(i)})}handleFormatButtonClick(){var t,i;this.setOutputText("Waiting for remote server\u2026");let e=new FormData;e.append("body",(i=(t=this.inputEl)==null?void 0:t.value)!=null?i:""),fetch("/play/fmt",{method:"POST",body:e}).then(r=>r.json()).then(({Body:r,Error:l})=>{this.setOutputText(l||"Done."),r&&(this.setInputText(r),this.resize())}).catch(r=>{this.setErrorText(r)})}handleRunButtonClick(){var e;this.setOutputText("Waiting for remote server\u2026"),fetch("/play/compile",{method:"POST",body:JSON.stringify({body:(e=this.inputEl)==null?void 0:e.value,version:2})}).then(t=>t.json()).then(async({Events:t,Errors:i})=>{this.setOutputText(i||"");for(let r of t||[])this.setOutputText(r.Message),await new Promise(l=>setTimeout(l,r.Delay/1e6))}).catch(t=>{this.setErrorText(t)})}},R=location.hash.match(/^#(example-.*)$/);if(R){let s=document.getElementById(R[1]);s&&(s.open=!0)}var K=[...document.querySelectorAll(f.PLAY_HREF)],$=s=>K.find(e=>e.hash===s.getAnchorHash());for(let s of document.querySelectorAll(f.PLAY_CONTAINER)){let e=new B(s),t=$(e);t?t.addEventListener("click",()=>{e.expand()}):console.warn("example href not found")}var L=class{constructor(e){this.el=e;this.el.addEventListener("change",t=>{let i=t.target,r=i.value;i.value.startsWith("/")||(r="/"+r),window.location.href=r})}};function N(s){let e=document.createElement("label");e.classList.add("go-Label"),e.setAttribute("aria-label","Menu");let t=document.createElement("select");t.classList.add("go-Select","js-selectNav"),e.appendChild(t);let i=document.createElement("optgroup");i.label="Outline",t.appendChild(i);let r={},l;for(let n of s.treeitems){if(Number(n.depth)>4)continue;n.groupTreeitem?(l=r[n.groupTreeitem.label],l||(l=r[n.groupTreeitem.label]=document.createElement("optgroup"),l.label=n.groupTreeitem.label,t.appendChild(l))):l=i;let a=document.createElement("option");a.label=n.label,a.textContent=n.label,a.value=n.el.href.replace(window.location.origin,"").replace("/",""),l.appendChild(a)}return s.addObserver(n=>{var b;let a=n.el.hash,d=(b=t.querySelector(`[value$="${a}"]`))==null?void 0:b.value;d&&(t.value=d)},50),e}var y=class{constructor(e){this.el=e;this.handleResize=()=>{this.el.style.setProperty("--js-tree-height","100vh"),this.el.style.setProperty("--js-tree-height",this.el.clientHeight+"px")};this.treeitems=[],this.firstChars=[],this.firstTreeitem=null,this.lastTreeitem=null,this.observerCallbacks=[],this.init()}init(){this.handleResize(),window.addEventListener("resize",this.handleResize),this.findTreeItems(),this.updateVisibleTreeitems(),this.observeTargets(),this.firstTreeitem&&(this.firstTreeitem.el.tabIndex=0)}observeTargets(){this.addObserver(i=>{this.expandTreeitem(i),this.setSelected(i)});let e=new Map,t=new IntersectionObserver(i=>{for(let r of i)e.set(r.target.id,r.isIntersecting||r.intersectionRatio===1);for(let[r,l]of e)if(l){let n=this.treeitems.find(a=>{var d;return(d=a.el)==null?void 0:d.href.endsWith(`#${r}`)});if(n)for(let a of this.observerCallbacks)a(n);break}},{threshold:1,rootMargin:"-60px 0px 0px 0px"});for(let i of this.treeitems.map(r=>r.el.getAttribute("href")))if(i){let r=i.replace(window.location.origin,"").replace("/","").replace("#",""),l=document.getElementById(r);l&&t.observe(l)}}addObserver(e,t=200){this.observerCallbacks.push(G(e,t))}setFocusToNextItem(e){let t=null;for(let i=e.index+1;i<this.treeitems.length;i++){let r=this.treeitems[i];if(r.isVisible){t=r;break}}t&&this.setFocusToItem(t)}setFocusToPreviousItem(e){let t=null;for(let i=e.index-1;i>-1;i--){let r=this.treeitems[i];if(r.isVisible){t=r;break}}t&&this.setFocusToItem(t)}setFocusToParentItem(e){e.groupTreeitem&&this.setFocusToItem(e.groupTreeitem)}setFocusToFirstItem(){this.firstTreeitem&&this.setFocusToItem(this.firstTreeitem)}setFocusToLastItem(){this.lastTreeitem&&this.setFocusToItem(this.lastTreeitem)}setSelected(e){var t;for(let i of this.el.querySelectorAll('[aria-expanded="true"]'))i!==e.el&&(((t=i.nextElementSibling)==null?void 0:t.contains(e.el))||i.setAttribute("aria-expanded","false"));for(let i of this.el.querySelectorAll("[aria-selected]"))i!==e.el&&i.setAttribute("aria-selected","false");e.el.setAttribute("aria-selected","true"),this.updateVisibleTreeitems(),this.setFocusToItem(e,!1)}expandTreeitem(e){let t=e;for(;t;)t.isExpandable&&t.el.setAttribute("aria-expanded","true"),t=t.groupTreeitem;this.updateVisibleTreeitems()}expandAllSiblingItems(e){for(let t of this.treeitems)t.groupTreeitem===e.groupTreeitem&&t.isExpandable&&this.expandTreeitem(t)}collapseTreeitem(e){let t=null;e.isExpanded()?t=e:t=e.groupTreeitem,t&&(t.el.setAttribute("aria-expanded","false"),this.updateVisibleTreeitems(),this.setFocusToItem(t))}setFocusByFirstCharacter(e,t){let i,r;t=t.toLowerCase(),i=e.index+1,i===this.treeitems.length&&(i=0),r=this.getIndexFirstChars(i,t),r===-1&&(r=this.getIndexFirstChars(0,t)),r>-1&&this.setFocusToItem(this.treeitems[r])}findTreeItems(){let e=(t,i)=>{let r=i,l=t.firstElementChild;for(;l;)(l.tagName==="A"||l.tagName==="SPAN")&&(r=new q(l,this,i),this.treeitems.push(r),this.firstChars.push(r.label.substring(0,1).toLowerCase())),l.firstElementChild&&e(l,r),l=l.nextElementSibling};e(this.el,null),this.treeitems.map((t,i)=>t.index=i)}updateVisibleTreeitems(){this.firstTreeitem=this.treeitems[0];for(let e of this.treeitems){let t=e.groupTreeitem;for(e.isVisible=!0;t&&t.el!==this.el;)t.isExpanded()||(e.isVisible=!1),t=t.groupTreeitem;e.isVisible&&(this.lastTreeitem=e)}}setFocusToItem(e,t=!0){e.el.tabIndex=0,t&&e.el.focus();for(let i of this.treeitems)i!==e&&(i.el.tabIndex=-1)}getIndexFirstChars(e,t){for(let i=e;i<this.firstChars.length;i++)if(this.treeitems[i].isVisible&&t===this.firstChars[i])return i;return-1}},q=class{constructor(e,t,i){var n,a,d,b,w;e.tabIndex=-1,this.el=e,this.groupTreeitem=i,this.label=(a=(n=e.textContent)==null?void 0:n.trim())!=null?a:"",this.tree=t,this.depth=((i==null?void 0:i.depth)||0)+1,this.index=0;let r=e.parentElement;(r==null?void 0:r.tagName.toLowerCase())==="li"&&(r==null||r.setAttribute("role","none")),e.setAttribute("aria-level",this.depth+""),e.getAttribute("aria-label")&&(this.label=(b=(d=e==null?void 0:e.getAttribute("aria-label"))==null?void 0:d.trim())!=null?b:""),this.isExpandable=!1,this.isVisible=!1,this.isInGroup=!!i;let l=e.nextElementSibling;for(;l;){if(l.tagName.toLowerCase()=="ul"){let I=`${(w=i==null?void 0:i.label)!=null?w:""} nav group ${this.label}`.replace(/[\W_]+/g,"_");e.setAttribute("aria-owns",I),e.setAttribute("aria-expanded","false"),l.setAttribute("role","group"),l.setAttribute("id",I),this.isExpandable=!0;break}l=l.nextElementSibling}this.init()}init(){this.el.tabIndex=-1,this.el.getAttribute("role")||this.el.setAttribute("role","treeitem"),this.el.addEventListener("keydown",this.handleKeydown.bind(this)),this.el.addEventListener("click",this.handleClick.bind(this)),this.el.addEventListener("focus",this.handleFocus.bind(this)),this.el.addEventListener("blur",this.handleBlur.bind(this))}isExpanded(){return this.isExpandable?this.el.getAttribute("aria-expanded")==="true":!1}isSelected(){return this.el.getAttribute("aria-selected")==="true"}handleClick(e){e.target!==this.el&&e.target!==this.el.firstElementChild||(this.isExpandable&&(this.isExpanded()&&this.isSelected()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),e.stopPropagation()),this.tree.setSelected(this))}handleFocus(){var t;let e=this.el;this.isExpandable&&(e=(t=e.firstElementChild)!=null?t:e),e.classList.add("focus")}handleBlur(){var t;let e=this.el;this.isExpandable&&(e=(t=e.firstElementChild)!=null?t:e),e.classList.remove("focus")}handleKeydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=!1;switch(e.key){case" ":case"Enter":this.isExpandable?(this.isExpanded()&&this.isSelected()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),t=!0):e.stopPropagation(),this.tree.setSelected(this);break;case"ArrowUp":this.tree.setFocusToPreviousItem(this),t=!0;break;case"ArrowDown":this.tree.setFocusToNextItem(this),t=!0;break;case"ArrowRight":this.isExpandable&&(this.isExpanded()?this.tree.setFocusToNextItem(this):this.tree.expandTreeitem(this)),t=!0;break;case"ArrowLeft":this.isExpandable&&this.isExpanded()?(this.tree.collapseTreeitem(this),t=!0):this.isInGroup&&(this.tree.setFocusToParentItem(this),t=!0);break;case"Home":this.tree.setFocusToFirstItem(),t=!0;break;case"End":this.tree.setFocusToLastItem(),t=!0;break;default:e.key.length===1&&e.key.match(/\S/)&&(e.key=="*"?this.tree.expandAllSiblingItems(this):this.tree.setFocusByFirstCharacter(this,e.key),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())}};function G(s,e){let t;return(...i)=>{let r=()=>{t=null,s(...i)};t&&clearTimeout(t),t=setTimeout(r,e)}}var A=class{constructor(e,t){this.table=e;this.toggleAll=t;this.expandAllItems=()=>{this.toggles.map(e=>e.setAttribute("aria-expanded","true")),this.update()};this.collapseAllItems=()=>{this.toggles.map(e=>e.setAttribute("aria-expanded","false")),this.update()};this.update=()=>{this.updateVisibleItems(),setTimeout(()=>this.updateGlobalToggle())};this.rows=Array.from(e.querySelectorAll("[data-aria-controls]")),this.toggles=Array.from(this.table.querySelectorAll("[aria-expanded]")),this.setAttributes(),this.attachEventListeners(),this.update()}setAttributes(){for(let e of["data-aria-controls","data-aria-labelledby","data-id"])this.table.querySelectorAll(`[${e}]`).forEach(t=>{var i;t.setAttribute(e.replace("data-",""),(i=t.getAttribute(e))!=null?i:""),t.removeAttribute(e)})}attachEventListeners(){var e;this.rows.forEach(t=>{t.addEventListener("click",i=>{this.handleToggleClick(i)})}),(e=this.toggleAll)==null||e.addEventListener("click",()=>{this.expandAllItems()}),document.addEventListener("keydown",t=>{(t.ctrlKey||t.metaKey)&&t.key==="f"&&this.expandAllItems()})}handleToggleClick(e){let t=e.currentTarget;(t==null?void 0:t.hasAttribute("aria-expanded"))||(t=this.table.querySelector(`button[aria-controls="${t==null?void 0:t.getAttribute("aria-controls")}"]`));let i=(t==null?void 0:t.getAttribute("aria-expanded"))==="true";t==null||t.setAttribute("aria-expanded",i?"false":"true"),e.stopPropagation(),this.update()}updateVisibleItems(){this.rows.map(e=>{var r;let t=(e==null?void 0:e.getAttribute("aria-expanded"))==="true",i=(r=e==null?void 0:e.getAttribute("aria-controls"))==null?void 0:r.trimEnd().split(" ");i==null||i.map(l=>{let n=document.getElementById(`${l}`);t?(n==null||n.classList.add("visible"),n==null||n.classList.remove("hidden")):(n==null||n.classList.add("hidden"),n==null||n.classList.remove("visible"))})})}updateGlobalToggle(){if(!this.toggleAll)return;this.rows.some(t=>t.hasAttribute("aria-expanded"))&&(this.toggleAll.style.display="block"),this.toggles.some(t=>t.getAttribute("aria-expanded")==="false")?(this.toggleAll.innerText="Expand all",this.toggleAll.onclick=this.expandAllItems):(this.toggleAll.innerText="Collapse all",this.toggleAll.onclick=this.collapseAllItems)}};var F=document.querySelector(".js-expandableTable");if(F){let s=new A(F,document.querySelector(".js-expandAllDirectories"));window.location.search.includes("expand-directories")&&s.expandAllItems()}var P=document.querySelector(".js-tree");if(P){let s=new y(P),e=N(s),t=document.querySelector(".js-mainNavMobile");t&&t.firstElementChild&&(t==null||t.replaceChild(e,t.firstElementChild)),e.firstElementChild&&new L(e.firstElementChild)}var m=document.querySelector(".js-readme"),C=document.querySelector(".js-readmeContent"),U=document.querySelector(".js-readmeOutline"),v=document.querySelectorAll(".js-readmeExpand"),D=document.querySelector(".js-readmeCollapse"),k=document.querySelector(".DocNavMobile-select");m&&C&&U&&v.length&&D&&(window.location.hash.includes("readme")&&m.classList.add("UnitReadme--expanded"),k==null||k.addEventListener("change",s=>{s.target.value.startsWith("readme-")&&m.classList.add("UnitReadme--expanded")}),v.forEach(s=>s.addEventListener("click",e=>{e.preventDefault(),m.classList.add("UnitReadme--expanded"),m.scrollIntoView()})),D.addEventListener("click",s=>{s.preventDefault(),m.classList.remove("UnitReadme--expanded"),v[1]&&v[1].scrollIntoView({block:"center"})}),C.addEventListener("keyup",()=>{m.classList.add("UnitReadme--expanded")}),C.addEventListener("click",()=>{m.classList.add("UnitReadme--expanded")}),U.addEventListener("click",()=>{m.classList.add("UnitReadme--expanded")}),document.addEventListener("keydown",s=>{(s.ctrlKey||s.metaKey)&&s.key==="f"&&m.classList.add("UnitReadme--expanded")}));function _(){var t;if(!location.hash)return;let s=document.getElementById(location.hash.slice(1)),e=(t=s==null?void 0:s.parentElement)==null?void 0:t.parentElement;(e==null?void 0:e.nodeName)==="DETAILS"&&(e.open=!0)}_();window.addEventListener("hashchange",()=>_());document.querySelectorAll(".js-buildContextSelect").forEach(s=>{s.addEventListener("change",e=>{window.location.search=`?GOOS=${e.target.value}`})});
+var p={PLAY_HREF:".js-exampleHref",PLAY_CONTAINER:".js-exampleContainer",EXAMPLE_INPUT:".Documentation-exampleCode",EXAMPLE_OUTPUT:".Documentation-exampleOutput",EXAMPLE_ERROR:".Documentation-exampleError",PLAY_BUTTON:".Documentation-examplePlayButton",SHARE_BUTTON:".Documentation-exampleShareButton",FORMAT_BUTTON:".Documentation-exampleFormatButton",RUN_BUTTON:".Documentation-exampleRunButton"},I=class{constructor(e){this.exampleEl=e;var t,i,s,l;this.exampleEl=e,this.anchorEl=e.querySelector("a"),this.errorEl=e.querySelector(p.EXAMPLE_ERROR),this.playButtonEl=e.querySelector(p.PLAY_BUTTON),this.shareButtonEl=e.querySelector(p.SHARE_BUTTON),this.formatButtonEl=e.querySelector(p.FORMAT_BUTTON),this.runButtonEl=e.querySelector(p.RUN_BUTTON),this.inputEl=this.makeTextArea(e.querySelector(p.EXAMPLE_INPUT)),this.outputEl=e.querySelector(p.EXAMPLE_OUTPUT),(t=this.playButtonEl)==null||t.addEventListener("click",()=>this.handleShareButtonClick()),(i=this.shareButtonEl)==null||i.addEventListener("click",()=>this.handleShareButtonClick()),(s=this.formatButtonEl)==null||s.addEventListener("click",()=>this.handleFormatButtonClick()),(l=this.runButtonEl)==null||l.addEventListener("click",()=>this.handleRunButtonClick()),!!this.inputEl&&(this.resize(),this.inputEl.addEventListener("keyup",()=>this.resize()),this.inputEl.addEventListener("keydown",n=>this.onKeydown(n)))}makeTextArea(e){var i,s;let t=document.createElement("textarea");return t.classList.add("Documentation-exampleCode","code"),t.spellcheck=!1,t.value=(i=e==null?void 0:e.textContent)!=null?i:"",(s=e==null?void 0:e.parentElement)==null||s.replaceChild(t,e),t}getAnchorHash(){var e;return(e=this.anchorEl)==null?void 0:e.hash}expand(){this.exampleEl.open=!0}resize(){var e;if((e=this.inputEl)==null?void 0:e.value){let t=(this.inputEl.value.match(/\n/g)||[]).length;this.inputEl.style.height=`${(20+t*20+12+2)/16}rem`}}onKeydown(e){e.key==="Tab"&&(document.execCommand("insertText",!1,"	"),e.preventDefault())}setInputText(e){this.inputEl&&(this.inputEl.value=e)}setOutputText(e){this.outputEl&&(this.outputEl.textContent=e)}setErrorText(e){this.errorEl&&(this.errorEl.textContent=e),this.setOutputText("An error has occurred\u2026")}handleShareButtonClick(){var t;let e="https://play.golang.org/p/";this.setOutputText("Waiting for remote server\u2026"),fetch("/play/share",{method:"POST",body:(t=this.inputEl)==null?void 0:t.value}).then(i=>i.text()).then(i=>{let s=e+i;this.setOutputText(`<a href="${s}">${s}</a>`),window.open(s)}).catch(i=>{this.setErrorText(i)})}handleFormatButtonClick(){var t,i;this.setOutputText("Waiting for remote server\u2026");let e=new FormData;e.append("body",(i=(t=this.inputEl)==null?void 0:t.value)!=null?i:""),fetch("/play/fmt",{method:"POST",body:e}).then(s=>s.json()).then(({Body:s,Error:l})=>{this.setOutputText(l||"Done."),s&&(this.setInputText(s),this.resize())}).catch(s=>{this.setErrorText(s)})}handleRunButtonClick(){var e;this.setOutputText("Waiting for remote server\u2026"),fetch("/play/compile",{method:"POST",body:JSON.stringify({body:(e=this.inputEl)==null?void 0:e.value,version:2})}).then(t=>t.json()).then(async({Events:t,Errors:i})=>{this.setOutputText(i||"");for(let s of t||[])this.setOutputText(s.Message),await new Promise(l=>setTimeout(l,s.Delay/1e6))}).catch(t=>{this.setErrorText(t)})}};function M(){let r=location.hash.match(/^#(example-.*)$/);if(r){let i=document.getElementById(r[1]);i&&(i.open=!0)}let e=[...document.querySelectorAll(p.PLAY_HREF)],t=i=>e.find(s=>s.hash===i.getAnchorHash());for(let i of document.querySelectorAll(p.PLAY_CONTAINER)){let s=new I(i),l=t(s);l?l.addEventListener("click",()=>{s.expand()}):console.warn("example href not found")}}var c=document.querySelector(".JumpDialog"),f=c==null?void 0:c.querySelector(".JumpDialog-body"),o=c==null?void 0:c.querySelector(".JumpDialog-list"),u=c==null?void 0:c.querySelector(".JumpDialog-input"),S=document.querySelector(".js-documentation"),h;function _(){let r=[];if(!!S){for(let e of S.querySelectorAll("[data-kind]"))r.push(V(e));for(let e of r)e.link.addEventListener("click",function(){c==null||c.close()});return r.sort(function(e,t){return e.lower.localeCompare(t.lower)}),r}}function V(r){var s;let e=document.createElement("a"),t=r.getAttribute("id");e.setAttribute("href","#"+t),e.setAttribute("tabindex","-1"),e.setAttribute("data-gtmc","jump to link");let i=r.getAttribute("data-kind");return{link:e,name:t!=null?t:"",kind:i!=null?i:"",lower:(s=t==null?void 0:t.toLowerCase())!=null?s:""}}var H,T=-1;function v(r){for(H=r,h||(h=_()),x(-1);o==null?void 0:o.firstChild;)o.firstChild.remove();if(r){let e=r.toLowerCase(),t=[],i=[],s=[],l=(n,a,d)=>n.name.substring(0,a)+"<b>"+n.name.substring(a,d)+"</b>"+n.name.substring(d);for(let n of h!=null?h:[]){let a=n.name.toLowerCase();if(a===e)n.link.innerHTML=l(n,0,n.name.length),t.push(n);else if(a.startsWith(e))n.link.innerHTML=l(n,0,r.length),i.push(n);else{let d=a.indexOf(e);d>-1&&(n.link.innerHTML=l(n,d,d+r.length),s.push(n))}}for(let n of t.concat(i).concat(s))o==null||o.appendChild(n.link)}else{if(!h||h.length===0){let e=document.createElement("i");e.innerHTML="There are no symbols on this page.",o==null||o.appendChild(e)}for(let e of h!=null?h:[])e.link.innerHTML=e.name+" <i>"+e.kind+"</i>",o==null||o.appendChild(e.link)}f&&(f.scrollTop=0),(h==null?void 0:h.length)&&o&&o.children.length>0&&x(0)}function x(r){let e=o==null?void 0:o.children;if(!(!e||!f)){if(T>=0&&e[T].classList.remove("JumpDialog-active"),r>=e.length&&(r=e.length-1),r>=0){e[r].classList.add("JumpDialog-active");let t=e[r].offsetTop-e[0].offsetTop,i=t+e[r].clientHeight;t<f.scrollTop?f.scrollTop=t:i>f.scrollTop+f.clientHeight&&(f.scrollTop=i-f.clientHeight)}T=r}}function O(r){if(T<0)return;let e=T+r;e<0&&(e=0),x(e)}function B(){u==null||u.addEventListener("keyup",function(){u.value.toUpperCase()!=H.toUpperCase()&&v(u.value)}),u==null||u.addEventListener("keydown",function(t){let i=38,s=40,l=13;switch(t.which){case i:O(-1),t.preventDefault();break;case s:O(1),t.preventDefault();break;case l:T>=0&&o&&(o.children[T].click(),t.preventDefault());break}});let r=document.querySelector(".ShortcutsDialog");document.addEventListener("keypress",function(t){if((c==null?void 0:c.open)||(r==null?void 0:r.open))return;let i=t.target,s=i==null?void 0:i.tagName;if(s=="INPUT"||s=="SELECT"||s=="TEXTAREA"||(i==null?void 0:i.contentEditable)=="true"||t.metaKey||t.ctrlKey)return;switch(String.fromCharCode(t.which)){case"f":case"F":t.preventDefault(),u&&(u.value=""),c==null||c.showModal(),u==null||u.focus(),v("");break;case"?":r==null||r.showModal();break}});let e=document.querySelector(".js-jumpToInput");e&&e.addEventListener("click",()=>{u&&(u.value=""),v("")})}var g=class{constructor(e){this.el=e;this.el.addEventListener("change",t=>{let i=t.target,s=i.value;i.value.startsWith("/")||(s="/"+s),window.location.href=s})}};function R(r){let e=document.createElement("label");e.classList.add("go-Label"),e.setAttribute("aria-label","Menu");let t=document.createElement("select");t.classList.add("go-Select","js-selectNav"),e.appendChild(t);let i=document.createElement("optgroup");i.label="Outline",t.appendChild(i);let s={},l;for(let n of r.treeitems){if(Number(n.depth)>4)continue;n.groupTreeitem?(l=s[n.groupTreeitem.label],l||(l=s[n.groupTreeitem.label]=document.createElement("optgroup"),l.label=n.groupTreeitem.label,t.appendChild(l))):l=i;let a=document.createElement("option");a.label=n.label,a.textContent=n.label,a.value=n.el.href.replace(window.location.origin,"").replace("/",""),l.appendChild(a)}return r.addObserver(n=>{var E;let a=n.el.hash,d=(E=t.querySelector(`[value$="${a}"]`))==null?void 0:E.value;d&&(t.value=d)},50),e}var L=class{constructor(e){this.el=e;this.handleResize=()=>{this.el.style.setProperty("--js-tree-height","100vh"),this.el.style.setProperty("--js-tree-height",this.el.clientHeight+"px")};this.treeitems=[],this.firstChars=[],this.firstTreeitem=null,this.lastTreeitem=null,this.observerCallbacks=[],this.init()}init(){this.handleResize(),window.addEventListener("resize",this.handleResize),this.findTreeItems(),this.updateVisibleTreeitems(),this.observeTargets(),this.firstTreeitem&&(this.firstTreeitem.el.tabIndex=0)}observeTargets(){this.addObserver(i=>{this.expandTreeitem(i),this.setSelected(i)});let e=new Map,t=new IntersectionObserver(i=>{for(let s of i)e.set(s.target.id,s.isIntersecting||s.intersectionRatio===1);for(let[s,l]of e)if(l){let n=this.treeitems.find(a=>{var d;return(d=a.el)==null?void 0:d.href.endsWith(`#${s}`)});if(n)for(let a of this.observerCallbacks)a(n);break}},{threshold:1,rootMargin:"-60px 0px 0px 0px"});for(let i of this.treeitems.map(s=>s.el.getAttribute("href")))if(i){let s=i.replace(window.location.origin,"").replace("/","").replace("#",""),l=document.getElementById(s);l&&t.observe(l)}}addObserver(e,t=200){this.observerCallbacks.push(J(e,t))}setFocusToNextItem(e){let t=null;for(let i=e.index+1;i<this.treeitems.length;i++){let s=this.treeitems[i];if(s.isVisible){t=s;break}}t&&this.setFocusToItem(t)}setFocusToPreviousItem(e){let t=null;for(let i=e.index-1;i>-1;i--){let s=this.treeitems[i];if(s.isVisible){t=s;break}}t&&this.setFocusToItem(t)}setFocusToParentItem(e){e.groupTreeitem&&this.setFocusToItem(e.groupTreeitem)}setFocusToFirstItem(){this.firstTreeitem&&this.setFocusToItem(this.firstTreeitem)}setFocusToLastItem(){this.lastTreeitem&&this.setFocusToItem(this.lastTreeitem)}setSelected(e){var t;for(let i of this.el.querySelectorAll('[aria-expanded="true"]'))i!==e.el&&(((t=i.nextElementSibling)==null?void 0:t.contains(e.el))||i.setAttribute("aria-expanded","false"));for(let i of this.el.querySelectorAll("[aria-selected]"))i!==e.el&&i.setAttribute("aria-selected","false");e.el.setAttribute("aria-selected","true"),this.updateVisibleTreeitems(),this.setFocusToItem(e,!1)}expandTreeitem(e){let t=e;for(;t;)t.isExpandable&&t.el.setAttribute("aria-expanded","true"),t=t.groupTreeitem;this.updateVisibleTreeitems()}expandAllSiblingItems(e){for(let t of this.treeitems)t.groupTreeitem===e.groupTreeitem&&t.isExpandable&&this.expandTreeitem(t)}collapseTreeitem(e){let t=null;e.isExpanded()?t=e:t=e.groupTreeitem,t&&(t.el.setAttribute("aria-expanded","false"),this.updateVisibleTreeitems(),this.setFocusToItem(t))}setFocusByFirstCharacter(e,t){let i,s;t=t.toLowerCase(),i=e.index+1,i===this.treeitems.length&&(i=0),s=this.getIndexFirstChars(i,t),s===-1&&(s=this.getIndexFirstChars(0,t)),s>-1&&this.setFocusToItem(this.treeitems[s])}findTreeItems(){let e=(t,i)=>{let s=i,l=t.firstElementChild;for(;l;)(l.tagName==="A"||l.tagName==="SPAN")&&(s=new N(l,this,i),this.treeitems.push(s),this.firstChars.push(s.label.substring(0,1).toLowerCase())),l.firstElementChild&&e(l,s),l=l.nextElementSibling};e(this.el,null),this.treeitems.map((t,i)=>t.index=i)}updateVisibleTreeitems(){this.firstTreeitem=this.treeitems[0];for(let e of this.treeitems){let t=e.groupTreeitem;for(e.isVisible=!0;t&&t.el!==this.el;)t.isExpanded()||(e.isVisible=!1),t=t.groupTreeitem;e.isVisible&&(this.lastTreeitem=e)}}setFocusToItem(e,t=!0){e.el.tabIndex=0,t&&e.el.focus();for(let i of this.treeitems)i!==e&&(i.el.tabIndex=-1)}getIndexFirstChars(e,t){for(let i=e;i<this.firstChars.length;i++)if(this.treeitems[i].isVisible&&t===this.firstChars[i])return i;return-1}},N=class{constructor(e,t,i){var n,a,d,E,k;e.tabIndex=-1,this.el=e,this.groupTreeitem=i,this.label=(a=(n=e.textContent)==null?void 0:n.trim())!=null?a:"",this.tree=t,this.depth=((i==null?void 0:i.depth)||0)+1,this.index=0;let s=e.parentElement;(s==null?void 0:s.tagName.toLowerCase())==="li"&&(s==null||s.setAttribute("role","none")),e.setAttribute("aria-level",this.depth+""),e.getAttribute("aria-label")&&(this.label=(E=(d=e==null?void 0:e.getAttribute("aria-label"))==null?void 0:d.trim())!=null?E:""),this.isExpandable=!1,this.isVisible=!1,this.isInGroup=!!i;let l=e.nextElementSibling;for(;l;){if(l.tagName.toLowerCase()=="ul"){let w=`${(k=i==null?void 0:i.label)!=null?k:""} nav group ${this.label}`.replace(/[\W_]+/g,"_");e.setAttribute("aria-owns",w),e.setAttribute("aria-expanded","false"),l.setAttribute("role","group"),l.setAttribute("id",w),this.isExpandable=!0;break}l=l.nextElementSibling}this.init()}init(){this.el.tabIndex=-1,this.el.getAttribute("role")||this.el.setAttribute("role","treeitem"),this.el.addEventListener("keydown",this.handleKeydown.bind(this)),this.el.addEventListener("click",this.handleClick.bind(this)),this.el.addEventListener("focus",this.handleFocus.bind(this)),this.el.addEventListener("blur",this.handleBlur.bind(this))}isExpanded(){return this.isExpandable?this.el.getAttribute("aria-expanded")==="true":!1}isSelected(){return this.el.getAttribute("aria-selected")==="true"}handleClick(e){e.target!==this.el&&e.target!==this.el.firstElementChild||(this.isExpandable&&(this.isExpanded()&&this.isSelected()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),e.stopPropagation()),this.tree.setSelected(this))}handleFocus(){var t;let e=this.el;this.isExpandable&&(e=(t=e.firstElementChild)!=null?t:e),e.classList.add("focus")}handleBlur(){var t;let e=this.el;this.isExpandable&&(e=(t=e.firstElementChild)!=null?t:e),e.classList.remove("focus")}handleKeydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=!1;switch(e.key){case" ":case"Enter":this.isExpandable?(this.isExpanded()&&this.isSelected()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),t=!0):e.stopPropagation(),this.tree.setSelected(this);break;case"ArrowUp":this.tree.setFocusToPreviousItem(this),t=!0;break;case"ArrowDown":this.tree.setFocusToNextItem(this),t=!0;break;case"ArrowRight":this.isExpandable&&(this.isExpanded()?this.tree.setFocusToNextItem(this):this.tree.expandTreeitem(this)),t=!0;break;case"ArrowLeft":this.isExpandable&&this.isExpanded()?(this.tree.collapseTreeitem(this),t=!0):this.isInGroup&&(this.tree.setFocusToParentItem(this),t=!0);break;case"Home":this.tree.setFocusToFirstItem(),t=!0;break;case"End":this.tree.setFocusToLastItem(),t=!0;break;default:e.key.length===1&&e.key.match(/\S/)&&(e.key=="*"?this.tree.expandAllSiblingItems(this):this.tree.setFocusByFirstCharacter(this,e.key),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())}};function J(r,e){let t;return(...i)=>{let s=()=>{t=null,r(...i)};t&&clearTimeout(t),t=setTimeout(s,e)}}var y=class{constructor(e,t){this.table=e;this.toggleAll=t;this.expandAllItems=()=>{this.toggles.map(e=>e.setAttribute("aria-expanded","true")),this.update()};this.collapseAllItems=()=>{this.toggles.map(e=>e.setAttribute("aria-expanded","false")),this.update()};this.update=()=>{this.updateVisibleItems(),setTimeout(()=>this.updateGlobalToggle())};this.rows=Array.from(e.querySelectorAll("[data-aria-controls]")),this.toggles=Array.from(this.table.querySelectorAll("[aria-expanded]")),this.setAttributes(),this.attachEventListeners(),this.update()}setAttributes(){for(let e of["data-aria-controls","data-aria-labelledby","data-id"])this.table.querySelectorAll(`[${e}]`).forEach(t=>{var i;t.setAttribute(e.replace("data-",""),(i=t.getAttribute(e))!=null?i:""),t.removeAttribute(e)})}attachEventListeners(){var e;this.rows.forEach(t=>{t.addEventListener("click",i=>{this.handleToggleClick(i)})}),(e=this.toggleAll)==null||e.addEventListener("click",()=>{this.expandAllItems()}),document.addEventListener("keydown",t=>{(t.ctrlKey||t.metaKey)&&t.key==="f"&&this.expandAllItems()})}handleToggleClick(e){let t=e.currentTarget;(t==null?void 0:t.hasAttribute("aria-expanded"))||(t=this.table.querySelector(`button[aria-controls="${t==null?void 0:t.getAttribute("aria-controls")}"]`));let i=(t==null?void 0:t.getAttribute("aria-expanded"))==="true";t==null||t.setAttribute("aria-expanded",i?"false":"true"),e.stopPropagation(),this.update()}updateVisibleItems(){this.rows.map(e=>{var s;let t=(e==null?void 0:e.getAttribute("aria-expanded"))==="true",i=(s=e==null?void 0:e.getAttribute("aria-controls"))==null?void 0:s.trimEnd().split(" ");i==null||i.map(l=>{let n=document.getElementById(`${l}`);t?(n==null||n.classList.add("visible"),n==null||n.classList.remove("hidden")):(n==null||n.classList.add("hidden"),n==null||n.classList.remove("visible"))})})}updateGlobalToggle(){if(!this.toggleAll)return;this.rows.some(t=>t.hasAttribute("aria-expanded"))&&(this.toggleAll.style.display="block"),this.toggles.some(t=>t.getAttribute("aria-expanded")==="false")?(this.toggleAll.innerText="Expand all",this.toggleAll.onclick=this.expandAllItems):(this.toggleAll.innerText="Collapse all",this.toggleAll.onclick=this.collapseAllItems)}};B();M();var P=document.querySelector(".js-expandableTable");if(P){let r=new y(P,document.querySelector(".js-expandAllDirectories"));window.location.search.includes("expand-directories")&&r.expandAllItems()}var q=document.querySelector(".js-tree");if(q){let r=new L(q),e=R(r),t=document.querySelector(".js-mainNavMobile");t&&t.firstElementChild&&(t==null||t.replaceChild(e,t.firstElementChild)),e.firstElementChild&&new g(e.firstElementChild)}var m=document.querySelector(".js-readme"),A=document.querySelector(".js-readmeContent"),F=document.querySelector(".js-readmeOutline"),b=document.querySelectorAll(".js-readmeExpand"),U=document.querySelector(".js-readmeCollapse"),C=document.querySelector(".DocNavMobile-select");m&&A&&F&&b.length&&U&&(window.location.hash.includes("readme")&&m.classList.add("UnitReadme--expanded"),C==null||C.addEventListener("change",r=>{r.target.value.startsWith("readme-")&&m.classList.add("UnitReadme--expanded")}),b.forEach(r=>r.addEventListener("click",e=>{e.preventDefault(),m.classList.add("UnitReadme--expanded"),m.scrollIntoView()})),U.addEventListener("click",r=>{r.preventDefault(),m.classList.remove("UnitReadme--expanded"),b[1]&&b[1].scrollIntoView({block:"center"})}),A.addEventListener("keyup",()=>{m.classList.add("UnitReadme--expanded")}),A.addEventListener("click",()=>{m.classList.add("UnitReadme--expanded")}),F.addEventListener("click",()=>{m.classList.add("UnitReadme--expanded")}),document.addEventListener("keydown",r=>{(r.ctrlKey||r.metaKey)&&r.key==="f"&&m.classList.add("UnitReadme--expanded")}));function D(){var t;if(!location.hash)return;let r=document.getElementById(location.hash.slice(1)),e=(t=r==null?void 0:r.parentElement)==null?void 0:t.parentElement;(e==null?void 0:e.nodeName)==="DETAILS"&&(e.open=!0)}D();window.addEventListener("hashchange",()=>D());document.querySelectorAll(".js-buildContextSelect").forEach(r=>{r.addEventListener("change",e=>{window.location.search=`?GOOS=${e.target.value}`})});
 /*!
  * @license
  * Copyright 2019-2020 The Go Authors. All rights reserved.
diff --git a/static/frontend/unit/main/main.js.map b/static/frontend/unit/main/main.js.map
index 8c6b73c..ba96971 100644
--- a/static/frontend/unit/main/main.js.map
+++ b/static/frontend/unit/main/main.js.map
@@ -1,7 +1,7 @@
 {
   "version": 3,
-  "sources": ["../../../shared/jump/jump.ts", "../../../shared/playground/playground.ts", "../../../shared/outline/select.ts", "../../../shared/outline/tree.ts", "../../../shared/table/table.ts", "main.ts"],
-  "sourcesContent": ["/*!\n * @license\n * Copyright 2019-2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the behavior of the \"jump to symbol\" dialog for Go\n// package documentation, as well as the simple dialog that displays keyboard\n// shortcuts.\n\n// The DOM for the dialogs is at the bottom of static/frontend/unit/main/_modals.tmpl.\n// The CSS is in static/frontend/unit/main/_modals.css.\n\n// The dialog is activated by pressing the 'f' key. It presents a list\n// (#JumpDialog-list) of all Go symbols displayed in the documentation.\n// Entering text in the dialog's text box (#JumpDialog-filter) restricts the\n// list to symbols containing the text. Clicking on an symbol jumps to\n// its documentation.\n\n// This code is based on\n// https://go.googlesource.com/gddo/+/refs/heads/master/gddo-server/assets/site.js.\n// It was modified to remove the dependence on jquery and bootstrap.\n\nconst jumpDialog = document.querySelector<HTMLDialogElement>('.JumpDialog');\nconst jumpBody = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-body');\nconst jumpList = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-list');\nconst jumpFilter = jumpDialog?.querySelector<HTMLInputElement>('.JumpDialog-input');\nconst doc = document.querySelector<HTMLDivElement>('.js-documentation');\n\ninterface JumpListItem {\n  link: HTMLAnchorElement;\n  name: string;\n  kind: string;\n  lower: string;\n}\n\nlet jumpListItems: JumpListItem[] | undefined; // All the symbols in the doc; computed only once.\n\n// collectJumpListItems returns a list of items, one for each symbol in the\n// documentation on the current page.\n//\n// It uses the data-kind attribute generated in the documentation HTML to find\n// the symbols and their id attributes.\n//\n// If there are no data-kind attributes, then we have older doc; fall back to\n// a less precise method.\nfunction collectJumpListItems() {\n  const items = [];\n  if (!doc) return;\n  for (const el of doc.querySelectorAll('[data-kind]')) {\n    items.push(newJumpListItem(el));\n  }\n\n  // Clicking on any of the links closes the dialog.\n  for (const item of items) {\n    item.link.addEventListener('click', function () {\n      jumpDialog?.close();\n    });\n  }\n  // Sort case-insensitively by symbol name.\n  items.sort(function (a, b) {\n    return a.lower.localeCompare(b.lower);\n  });\n  return items;\n}\n\n// newJumpListItem creates a new item for the DOM element el.\n// An item is an object with:\n// - name: the element's id (which is the symbol name)\n// - kind: the element's kind (function, variable, etc.),\n// - link: a link ('a' tag) to the element\n// - lower: the name in lower case, just for sorting\nfunction newJumpListItem(el: Element): JumpListItem {\n  const a = document.createElement('a');\n  const name = el.getAttribute('id');\n  a.setAttribute('href', '#' + name);\n  a.setAttribute('tabindex', '-1');\n  a.setAttribute('data-gtmc', 'jump to link');\n  const kind = el.getAttribute('data-kind');\n  return {\n    link: a,\n    name: name ?? '',\n    kind: kind ?? '',\n    lower: name?.toLowerCase() ?? '', // for sorting\n  };\n}\n\nlet lastFilterValue: string; // The last contents of the filter text box.\nlet activeJumpItem = -1; // The index of the currently active item in the list.\n\n// updateJumpList sets the elements of the dialog list to\n// everything whose name contains filter.\nfunction updateJumpList(filter: string) {\n  lastFilterValue = filter;\n  if (!jumpListItems) {\n    jumpListItems = collectJumpListItems();\n  }\n  setActiveJumpItem(-1);\n\n  // Remove all children from list.\n  while (jumpList?.firstChild) {\n    jumpList.firstChild.remove();\n  }\n\n  if (filter) {\n    // A filter is set. We treat the filter as a substring that can appear in\n    // an item name (case insensitive), and find the following matches - in\n    // order of priority:\n    //\n    // 1. Exact matches (the filter matches the item's name exactly)\n    // 2. Prefix matches (the item's name starts with filter)\n    // 3. Infix matches (the filter is a substring of the item's name)\n    const filterLowerCase = filter.toLowerCase();\n\n    const exactMatches = [];\n    const prefixMatches = [];\n    const infixMatches = [];\n\n    // makeLinkHtml creates the link name HTML for a list item. item is the DOM\n    // item. item.name.substr(boldStart, boldEnd) will be bolded.\n    const makeLinkHtml = (item: JumpListItem, boldStart: number, boldEnd: number) => {\n      return (\n        item.name.substring(0, boldStart) +\n        '<b>' +\n        item.name.substring(boldStart, boldEnd) +\n        '</b>' +\n        item.name.substring(boldEnd)\n      );\n    };\n\n    for (const item of jumpListItems ?? []) {\n      const nameLowerCase = item.name.toLowerCase();\n\n      if (nameLowerCase === filterLowerCase) {\n        item.link.innerHTML = makeLinkHtml(item, 0, item.name.length);\n        exactMatches.push(item);\n      } else if (nameLowerCase.startsWith(filterLowerCase)) {\n        item.link.innerHTML = makeLinkHtml(item, 0, filter.length);\n        prefixMatches.push(item);\n      } else {\n        const index = nameLowerCase.indexOf(filterLowerCase);\n        if (index > -1) {\n          item.link.innerHTML = makeLinkHtml(item, index, index + filter.length);\n          infixMatches.push(item);\n        }\n      }\n    }\n\n    for (const item of exactMatches.concat(prefixMatches).concat(infixMatches)) {\n      jumpList?.appendChild(item.link);\n    }\n  } else {\n    if (!jumpListItems || jumpListItems.length === 0) {\n      const msg = document.createElement('i');\n      msg.innerHTML = 'There are no symbols on this page.';\n      jumpList?.appendChild(msg);\n    }\n    // No filter set; display all items in their existing order.\n    for (const item of jumpListItems ?? []) {\n      item.link.innerHTML = item.name + ' <i>' + item.kind + '</i>';\n      jumpList?.appendChild(item.link);\n    }\n  }\n\n  if (jumpBody) {\n    jumpBody.scrollTop = 0;\n  }\n  if (jumpListItems?.length && jumpList && jumpList.children.length > 0) {\n    setActiveJumpItem(0);\n  }\n}\n\n// Set the active jump item to n.\nfunction setActiveJumpItem(n: number) {\n  const cs = jumpList?.children as HTMLCollectionOf<HTMLElement> | null | undefined;\n  if (!cs || !jumpBody) {\n    return;\n  }\n  if (activeJumpItem >= 0) {\n    cs[activeJumpItem].classList.remove('JumpDialog-active');\n  }\n  if (n >= cs.length) {\n    n = cs.length - 1;\n  }\n  if (n >= 0) {\n    cs[n].classList.add('JumpDialog-active');\n\n    // Scroll so the active item is visible.\n    // For some reason cs[n].scrollIntoView() doesn't behave as I'd expect:\n    // it moves the entire dialog box in the viewport.\n\n    // Get the top and bottom of the active item relative to jumpBody.\n    const activeTop = cs[n].offsetTop - cs[0].offsetTop;\n    const activeBottom = activeTop + cs[n].clientHeight;\n    if (activeTop < jumpBody.scrollTop) {\n      // Off the top; scroll up.\n      jumpBody.scrollTop = activeTop;\n    } else if (activeBottom > jumpBody.scrollTop + jumpBody.clientHeight) {\n      // Off the bottom; scroll down.\n      jumpBody.scrollTop = activeBottom - jumpBody.clientHeight;\n    }\n  }\n  activeJumpItem = n;\n}\n\n// Increment the activeJumpItem by delta.\nfunction incActiveJumpItem(delta: number) {\n  if (activeJumpItem < 0) {\n    return;\n  }\n  let n = activeJumpItem + delta;\n  if (n < 0) {\n    n = 0;\n  }\n  setActiveJumpItem(n);\n}\n\n// Pressing a key in the filter updates the list (if the filter actually changed).\njumpFilter?.addEventListener('keyup', function () {\n  if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {\n    updateJumpList(jumpFilter.value);\n  }\n});\n\n// Pressing enter in the filter selects the first element in the list.\njumpFilter?.addEventListener('keydown', function (event) {\n  const upArrow = 38;\n  const downArrow = 40;\n  const enterKey = 13;\n  switch (event.which) {\n    case upArrow:\n      incActiveJumpItem(-1);\n      event.preventDefault();\n      break;\n    case downArrow:\n      incActiveJumpItem(1);\n      event.preventDefault();\n      break;\n    case enterKey:\n      if (activeJumpItem >= 0) {\n        if (jumpList) {\n          (jumpList.children[activeJumpItem] as HTMLElement).click();\n          event.preventDefault();\n        }\n      }\n      break;\n  }\n});\n\nconst shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');\n\n// Keyboard shortcuts:\n// - Pressing '/' focuses the search box\n// - Pressing 'f' or 'F' opens the jump-to-symbol dialog.\n// - Pressing '?' opens up the shortcut dialog.\n// Ignore a keypress if a dialog is already open, or if it is pressed on a\n// component that wants to consume it.\ndocument.addEventListener('keypress', function (e) {\n  if (jumpDialog?.open || shortcutsDialog?.open) {\n    return;\n  }\n  const target = e.target as HTMLElement | null;\n  const t = target?.tagName;\n  if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {\n    return;\n  }\n  if (target?.contentEditable == 'true') {\n    return;\n  }\n  if (e.metaKey || e.ctrlKey) {\n    return;\n  }\n  const ch = String.fromCharCode(e.which);\n  switch (ch) {\n    case 'f':\n    case 'F':\n      e.preventDefault();\n      if (jumpFilter) {\n        jumpFilter.value = '';\n      }\n      jumpDialog?.showModal();\n      jumpFilter?.focus();\n      updateJumpList('');\n      break;\n    case '?':\n      shortcutsDialog?.showModal();\n      break;\n  }\n});\n\nconst jumpOutlineInput = document.querySelector('.js-jumpToInput');\nif (jumpOutlineInput) {\n  jumpOutlineInput.addEventListener('click', () => {\n    if (jumpFilter) {\n      jumpFilter.value = '';\n    }\n    updateJumpList('');\n  });\n}\n\nexport {};\n", "/*!\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the playground implementation of the documentation\n// page. The playground involves a \"play\" button that allows you to open up\n// a new link to play.golang.org using the example code.\n\n// The CSS is in static/frontend/unit/main/_doc.css\n\n/**\n * CSS classes used by PlaygroundExampleController\n */\nconst PlayExampleClassName = {\n  PLAY_HREF: '.js-exampleHref',\n  PLAY_CONTAINER: '.js-exampleContainer',\n  EXAMPLE_INPUT: '.Documentation-exampleCode',\n  EXAMPLE_OUTPUT: '.Documentation-exampleOutput',\n  EXAMPLE_ERROR: '.Documentation-exampleError',\n  PLAY_BUTTON: '.Documentation-examplePlayButton',\n  SHARE_BUTTON: '.Documentation-exampleShareButton',\n  FORMAT_BUTTON: '.Documentation-exampleFormatButton',\n  RUN_BUTTON: '.Documentation-exampleRunButton',\n};\n\n/**\n * This controller enables playground examples to expand their dropdown or\n * generate shareable Go Playground URLs.\n */\nexport class PlaygroundExampleController {\n  /**\n   * The anchor tag used to identify the container with an example href.\n   * There is only one in an example container div.\n   */\n  private readonly anchorEl: HTMLAnchorElement | null;\n\n  /**\n   * The error element\n   */\n  private readonly errorEl: Element | null;\n\n  /**\n   * Buttons that redirect to an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly playButtonEl: Element | null;\n  private readonly shareButtonEl: Element | null;\n\n  /**\n   * Button that formats the code in an example's playground.\n   */\n  private readonly formatButtonEl: Element | null;\n\n  /**\n   * Button that runs the code in an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly runButtonEl: Element | null;\n\n  /**\n   * The executable code of an example.\n   */\n  private readonly inputEl: HTMLTextAreaElement | null;\n\n  /**\n   * The output of the given example code. This only exists if the\n   * author of the package provides an output for this example.\n   */\n  private readonly outputEl: Element | null;\n\n  /**\n   * @param exampleEl The div that contains playground content for the given example.\n   */\n  constructor(private readonly exampleEl: HTMLDetailsElement) {\n    this.exampleEl = exampleEl;\n    this.anchorEl = exampleEl.querySelector('a');\n    this.errorEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_ERROR);\n    this.playButtonEl = exampleEl.querySelector(PlayExampleClassName.PLAY_BUTTON);\n    this.shareButtonEl = exampleEl.querySelector(PlayExampleClassName.SHARE_BUTTON);\n    this.formatButtonEl = exampleEl.querySelector(PlayExampleClassName.FORMAT_BUTTON);\n    this.runButtonEl = exampleEl.querySelector(PlayExampleClassName.RUN_BUTTON);\n    this.inputEl = this.makeTextArea(exampleEl.querySelector(PlayExampleClassName.EXAMPLE_INPUT));\n    this.outputEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_OUTPUT);\n\n    // This is legacy listener to be replaced the listener for shareButtonEl.\n    this.playButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.shareButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.formatButtonEl?.addEventListener('click', () => this.handleFormatButtonClick());\n    this.runButtonEl?.addEventListener('click', () => this.handleRunButtonClick());\n\n    if (!this.inputEl) return;\n\n    this.resize();\n    this.inputEl.addEventListener('keyup', () => this.resize());\n    this.inputEl.addEventListener('keydown', e => this.onKeydown(e));\n  }\n\n  /**\n   * Replace the pre element with a textarea. The examples are initially rendered\n   * as pre elements so they're fully visible when JS is disabled.\n   */\n  makeTextArea(el: Element | null): HTMLTextAreaElement {\n    const t = document.createElement('textarea');\n    t.classList.add('Documentation-exampleCode', 'code');\n    t.spellcheck = false;\n    t.value = el?.textContent ?? '';\n    el?.parentElement?.replaceChild(t, el);\n    return t;\n  }\n\n  /**\n   * Retrieve the hash value of the anchor element.\n   */\n  getAnchorHash(): string | undefined {\n    return this.anchorEl?.hash;\n  }\n\n  /**\n   * Expands the current playground example.\n   */\n  expand(): void {\n    this.exampleEl.open = true;\n  }\n\n  /**\n   * Resizes the input element to accomodate the amount of text present.\n   */\n  private resize(): void {\n    if (this.inputEl?.value) {\n      const numLineBreaks = (this.inputEl.value.match(/\\n/g) || []).length;\n      // min-height + lines x line-height + padding + border\n      this.inputEl.style.height = `${(20 + numLineBreaks * 20 + 12 + 2) / 16}rem`;\n    }\n  }\n\n  /**\n   * Handler to override keyboard behavior in the playground's\n   * textarea element.\n   *\n   * Tab key inserts tabs into the example playground instead of\n   * switching to the next interactive element.\n   * @param e input element keyboard event.\n   */\n  private onKeydown(e: KeyboardEvent) {\n    if (e.key === 'Tab') {\n      document.execCommand('insertText', false, '\\t');\n      e.preventDefault();\n    }\n  }\n\n  /**\n   * Changes the text of the example's input box.\n   */\n  private setInputText(output: string) {\n    if (this.inputEl) {\n      this.inputEl.value = output;\n    }\n  }\n\n  /**\n   * Changes the text of the example's output box.\n   */\n  private setOutputText(output: string) {\n    if (this.outputEl) {\n      this.outputEl.textContent = output;\n    }\n  }\n\n  /**\n   * Sets the error message text and overwrites\n   * output box to indicate a failed response.\n   */\n  private setErrorText(err: string) {\n    if (this.errorEl) {\n      this.errorEl.textContent = err;\n    }\n    this.setOutputText('An error has occurred\u2026');\n  }\n\n  /**\n   * Opens a new window to play.golang.org using the\n   * example snippet's code in the playground.\n   */\n  private handleShareButtonClick() {\n    const PLAYGROUND_BASE_URL = 'https://play.golang.org/p/';\n\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/share', {\n      method: 'POST',\n      body: this.inputEl?.value,\n    })\n      .then(res => res.text())\n      .then(shareId => {\n        const href = PLAYGROUND_BASE_URL + shareId;\n        this.setOutputText(`<a href=\"${href}\">${href}</a>`);\n        window.open(href);\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs gofmt on the example snippet in the playground.\n   */\n  private handleFormatButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n    const body = new FormData();\n    body.append('body', this.inputEl?.value ?? '');\n\n    fetch('/play/fmt', {\n      method: 'POST',\n      body: body,\n    })\n      .then(res => res.json())\n      .then(({ Body, Error }) => {\n        this.setOutputText(Error || 'Done.');\n        if (Body) {\n          this.setInputText(Body);\n          this.resize();\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs the code snippet in the example playground.\n   */\n  private handleRunButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/compile', {\n      method: 'POST',\n      body: JSON.stringify({ body: this.inputEl?.value, version: 2 }),\n    })\n      .then(res => res.json())\n      .then(async ({ Events, Errors }) => {\n        this.setOutputText(Errors || '');\n        for (const e of Events || []) {\n          this.setOutputText(e.Message);\n          await new Promise(resolve => setTimeout(resolve, e.Delay / 1000000));\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n}\n\nconst exampleHashRegex = location.hash.match(/^#(example-.*)$/);\nif (exampleHashRegex) {\n  const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;\n  if (exampleHashEl) {\n    exampleHashEl.open = true;\n  }\n}\n\n// We use a spread operator to convert a nodelist into an array of elements.\nconst exampleHrefs = [\n  ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),\n];\n\n/**\n * Sometimes exampleHrefs and playContainers are in different order, so we\n * find an exampleHref from a common hash.\n * @param playContainer - playground container\n */\nconst findExampleHash = (playContainer: PlaygroundExampleController) =>\n  exampleHrefs.find(ex => {\n    return ex.hash === playContainer.getAnchorHash();\n  });\n\nfor (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {\n  // There should be the same amount of hrefs referencing examples as example containers.\n  const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);\n  const exampleHref = findExampleHash(playContainer);\n  if (exampleHref) {\n    exampleHref.addEventListener('click', () => {\n      playContainer.expand();\n    });\n  } else {\n    console.warn('example href not found');\n  }\n}\n", "/**\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\nimport { TreeNavController } from './tree.js';\n\nexport class SelectNavController {\n  constructor(private el: Element) {\n    this.el.addEventListener('change', e => {\n      const target = e.target as HTMLSelectElement;\n      let href = target.value;\n      if (!target.value.startsWith('/')) {\n        href = '/' + href;\n      }\n      window.location.href = href;\n    });\n  }\n}\n\nexport function makeSelectNav(tree: TreeNavController): HTMLLabelElement {\n  const label = document.createElement('label');\n  label.classList.add('go-Label');\n  label.setAttribute('aria-label', 'Menu');\n  const select = document.createElement('select');\n  select.classList.add('go-Select', 'js-selectNav');\n  label.appendChild(select);\n  const outline = document.createElement('optgroup');\n  outline.label = 'Outline';\n  select.appendChild(outline);\n  const groupMap: Record<string, HTMLOptGroupElement> = {};\n  let group: HTMLOptGroupElement;\n  for (const t of tree.treeitems) {\n    if (Number(t.depth) > 4) continue;\n    if (t.groupTreeitem) {\n      group = groupMap[t.groupTreeitem.label];\n      if (!group) {\n        group = groupMap[t.groupTreeitem.label] = document.createElement('optgroup');\n        group.label = t.groupTreeitem.label;\n        select.appendChild(group);\n      }\n    } else {\n      group = outline;\n    }\n    const o = document.createElement('option');\n    o.label = t.label;\n    o.textContent = t.label;\n    o.value = (t.el as HTMLAnchorElement).href.replace(window.location.origin, '').replace('/', '');\n    group.appendChild(o);\n  }\n  tree.addObserver(t => {\n    const hash = (t.el as HTMLAnchorElement).hash;\n    const value = select.querySelector<HTMLOptionElement>(`[value$=\"${hash}\"]`)?.value;\n    if (value) {\n      select.value = value;\n    }\n  }, 50);\n  return label;\n}\n", "/**\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n/**\n * TreeNavController is the navigation tree component of the documentation page.\n * It adds accessiblity attributes to a tree, observes the heading elements\n * focus the topmost link for headings visible on the page, and implements the\n * WAI-ARIA Treeview Design Pattern with full\n * [keyboard support](https://www.w3.org/TR/wai-aria-practices/examples/treeview/treeview-2/treeview-2a.html#kbd_label).\n */\nexport class TreeNavController {\n  treeitems: TreeItem[];\n\n  /**\n   * firstChars is the first character of each treeitem in the same order\n   * as this.treeitems. We use this array to set focus by character when\n   * navigating the tree with a keyboard.\n   */\n  private firstChars: string[];\n  private firstTreeitem: TreeItem | null;\n  private lastTreeitem: TreeItem | null;\n  private observerCallbacks: ((t: TreeItem) => void)[];\n\n  constructor(private el: HTMLElement) {\n    this.treeitems = [];\n    this.firstChars = [];\n    this.firstTreeitem = null;\n    this.lastTreeitem = null;\n    this.observerCallbacks = [];\n    this.init();\n  }\n\n  private init(): void {\n    this.handleResize();\n    window.addEventListener('resize', this.handleResize);\n    this.findTreeItems();\n    this.updateVisibleTreeitems();\n    this.observeTargets();\n    if (this.firstTreeitem) {\n      this.firstTreeitem.el.tabIndex = 0;\n    }\n  }\n\n  private handleResize = (): void => {\n    this.el.style.setProperty('--js-tree-height', '100vh');\n    this.el.style.setProperty('--js-tree-height', this.el.clientHeight + 'px');\n  };\n\n  private observeTargets() {\n    this.addObserver(treeitem => {\n      this.expandTreeitem(treeitem);\n      this.setSelected(treeitem);\n      // TODO: Fix scroll issue in https://golang.org/issue/47450.\n      // treeitem.el.scrollIntoView({ block: 'nearest' });\n    });\n\n    const targets = new Map<string, boolean>();\n    const observer = new IntersectionObserver(\n      entries => {\n        for (const entry of entries) {\n          targets.set(entry.target.id, entry.isIntersecting || entry.intersectionRatio === 1);\n        }\n        for (const [id, isIntersecting] of targets) {\n          if (isIntersecting) {\n            const active = this.treeitems.find(t =>\n              (t.el as HTMLAnchorElement)?.href.endsWith(`#${id}`)\n            );\n            if (active) {\n              for (const fn of this.observerCallbacks) {\n                fn(active);\n              }\n            }\n            break;\n          }\n        }\n      },\n      {\n        threshold: 1.0,\n        rootMargin: '-60px 0px 0px 0px',\n      }\n    );\n\n    for (const href of this.treeitems.map(t => t.el.getAttribute('href'))) {\n      if (href) {\n        const id = href.replace(window.location.origin, '').replace('/', '').replace('#', '');\n        const target = document.getElementById(id);\n        if (target) {\n          observer.observe(target);\n        }\n      }\n    }\n  }\n\n  addObserver(fn: (t: TreeItem) => void, delay = 200): void {\n    this.observerCallbacks.push(debounce(fn, delay));\n  }\n\n  setFocusToNextItem(currentItem: TreeItem): void {\n    let nextItem = null;\n    for (let i = currentItem.index + 1; i < this.treeitems.length; i++) {\n      const ti = this.treeitems[i];\n      if (ti.isVisible) {\n        nextItem = ti;\n        break;\n      }\n    }\n    if (nextItem) {\n      this.setFocusToItem(nextItem);\n    }\n  }\n\n  setFocusToPreviousItem(currentItem: TreeItem): void {\n    let prevItem = null;\n    for (let i = currentItem.index - 1; i > -1; i--) {\n      const ti = this.treeitems[i];\n      if (ti.isVisible) {\n        prevItem = ti;\n        break;\n      }\n    }\n    if (prevItem) {\n      this.setFocusToItem(prevItem);\n    }\n  }\n\n  setFocusToParentItem(currentItem: TreeItem): void {\n    if (currentItem.groupTreeitem) {\n      this.setFocusToItem(currentItem.groupTreeitem);\n    }\n  }\n\n  setFocusToFirstItem(): void {\n    this.firstTreeitem && this.setFocusToItem(this.firstTreeitem);\n  }\n\n  setFocusToLastItem(): void {\n    this.lastTreeitem && this.setFocusToItem(this.lastTreeitem);\n  }\n\n  setSelected(currentItem: TreeItem): void {\n    for (const l1 of this.el.querySelectorAll('[aria-expanded=\"true\"]')) {\n      if (l1 === currentItem.el) continue;\n      if (!l1.nextElementSibling?.contains(currentItem.el)) {\n        l1.setAttribute('aria-expanded', 'false');\n      }\n    }\n    for (const l1 of this.el.querySelectorAll('[aria-selected]')) {\n      if (l1 !== currentItem.el) {\n        l1.setAttribute('aria-selected', 'false');\n      }\n    }\n    currentItem.el.setAttribute('aria-selected', 'true');\n    this.updateVisibleTreeitems();\n    this.setFocusToItem(currentItem, false);\n  }\n\n  expandTreeitem(treeitem: TreeItem): void {\n    let currentItem: TreeItem | null = treeitem;\n    while (currentItem) {\n      if (currentItem.isExpandable) {\n        currentItem.el.setAttribute('aria-expanded', 'true');\n      }\n      currentItem = currentItem.groupTreeitem;\n    }\n    this.updateVisibleTreeitems();\n  }\n\n  expandAllSiblingItems(currentItem: TreeItem): void {\n    for (const ti of this.treeitems) {\n      if (ti.groupTreeitem === currentItem.groupTreeitem && ti.isExpandable) {\n        this.expandTreeitem(ti);\n      }\n    }\n  }\n\n  collapseTreeitem(currentItem: TreeItem): void {\n    let groupTreeitem = null;\n\n    if (currentItem.isExpanded()) {\n      groupTreeitem = currentItem;\n    } else {\n      groupTreeitem = currentItem.groupTreeitem;\n    }\n\n    if (groupTreeitem) {\n      groupTreeitem.el.setAttribute('aria-expanded', 'false');\n      this.updateVisibleTreeitems();\n      this.setFocusToItem(groupTreeitem);\n    }\n  }\n\n  setFocusByFirstCharacter(currentItem: TreeItem, char: string): void {\n    let start: number, index: number;\n    char = char.toLowerCase();\n\n    // Get start index for search based on position of currentItem\n    start = currentItem.index + 1;\n    if (start === this.treeitems.length) {\n      start = 0;\n    }\n\n    // Check remaining slots in the menu\n    index = this.getIndexFirstChars(start, char);\n\n    // If not found in remaining slots, check from beginning\n    if (index === -1) {\n      index = this.getIndexFirstChars(0, char);\n    }\n\n    // If match was found...\n    if (index > -1) {\n      this.setFocusToItem(this.treeitems[index]);\n    }\n  }\n\n  private findTreeItems() {\n    const findItems = (el: HTMLElement, group: TreeItem | null) => {\n      let ti = group;\n      let curr = el.firstElementChild as HTMLElement;\n      while (curr) {\n        if (curr.tagName === 'A' || curr.tagName === 'SPAN') {\n          ti = new TreeItem(curr, this, group);\n          this.treeitems.push(ti);\n          this.firstChars.push(ti.label.substring(0, 1).toLowerCase());\n        }\n        if (curr.firstElementChild) {\n          findItems(curr, ti);\n        }\n        curr = curr.nextElementSibling as HTMLElement;\n      }\n    };\n    findItems(this.el as HTMLElement, null);\n    this.treeitems.map((ti, idx) => (ti.index = idx));\n  }\n\n  private updateVisibleTreeitems(): void {\n    this.firstTreeitem = this.treeitems[0];\n\n    for (const ti of this.treeitems) {\n      let parent = ti.groupTreeitem;\n      ti.isVisible = true;\n      while (parent && parent.el !== this.el) {\n        if (!parent.isExpanded()) {\n          ti.isVisible = false;\n        }\n        parent = parent.groupTreeitem;\n      }\n      if (ti.isVisible) {\n        this.lastTreeitem = ti;\n      }\n    }\n  }\n\n  private setFocusToItem(treeitem: TreeItem, focusEl = true) {\n    treeitem.el.tabIndex = 0;\n    if (focusEl) {\n      treeitem.el.focus();\n    }\n    for (const ti of this.treeitems) {\n      if (ti !== treeitem) {\n        ti.el.tabIndex = -1;\n      }\n    }\n  }\n\n  private getIndexFirstChars(startIndex: number, char: string): number {\n    for (let i = startIndex; i < this.firstChars.length; i++) {\n      if (this.treeitems[i].isVisible && char === this.firstChars[i]) {\n        return i;\n      }\n    }\n    return -1;\n  }\n}\n\nclass TreeItem {\n  el: HTMLElement;\n  groupTreeitem: TreeItem | null;\n  label: string;\n  isExpandable: boolean;\n  isVisible: boolean;\n  depth: number;\n  index: number;\n\n  private tree: TreeNavController;\n  private isInGroup: boolean;\n\n  constructor(el: HTMLElement, treeObj: TreeNavController, group: TreeItem | null) {\n    el.tabIndex = -1;\n    this.el = el;\n    this.groupTreeitem = group;\n    this.label = el.textContent?.trim() ?? '';\n    this.tree = treeObj;\n    this.depth = (group?.depth || 0) + 1;\n    this.index = 0;\n\n    const parent = el.parentElement;\n    if (parent?.tagName.toLowerCase() === 'li') {\n      parent?.setAttribute('role', 'none');\n    }\n    el.setAttribute('aria-level', this.depth + '');\n    if (el.getAttribute('aria-label')) {\n      this.label = el?.getAttribute('aria-label')?.trim() ?? '';\n    }\n\n    this.isExpandable = false;\n    this.isVisible = false;\n    this.isInGroup = !!group;\n\n    let curr = el.nextElementSibling;\n    while (curr) {\n      if (curr.tagName.toLowerCase() == 'ul') {\n        const groupId = `${group?.label ?? ''} nav group ${this.label}`.replace(/[\\W_]+/g, '_');\n        el.setAttribute('aria-owns', groupId);\n        el.setAttribute('aria-expanded', 'false');\n        curr.setAttribute('role', 'group');\n        curr.setAttribute('id', groupId);\n        this.isExpandable = true;\n        break;\n      }\n\n      curr = curr.nextElementSibling;\n    }\n    this.init();\n  }\n\n  private init() {\n    this.el.tabIndex = -1;\n    if (!this.el.getAttribute('role')) {\n      this.el.setAttribute('role', 'treeitem');\n    }\n    this.el.addEventListener('keydown', this.handleKeydown.bind(this));\n    this.el.addEventListener('click', this.handleClick.bind(this));\n    this.el.addEventListener('focus', this.handleFocus.bind(this));\n    this.el.addEventListener('blur', this.handleBlur.bind(this));\n  }\n\n  isExpanded() {\n    if (this.isExpandable) {\n      return this.el.getAttribute('aria-expanded') === 'true';\n    }\n\n    return false;\n  }\n\n  isSelected() {\n    return this.el.getAttribute('aria-selected') === 'true';\n  }\n\n  private handleClick(event: MouseEvent) {\n    // only process click events that directly happened on this treeitem\n    if (event.target !== this.el && event.target !== this.el.firstElementChild) {\n      return;\n    }\n    if (this.isExpandable) {\n      if (this.isExpanded() && this.isSelected()) {\n        this.tree.collapseTreeitem(this);\n      } else {\n        this.tree.expandTreeitem(this);\n      }\n      event.stopPropagation();\n    }\n    this.tree.setSelected(this);\n  }\n\n  private handleFocus() {\n    let el = this.el;\n    if (this.isExpandable) {\n      el = (el.firstElementChild as HTMLElement) ?? el;\n    }\n    el.classList.add('focus');\n  }\n\n  private handleBlur() {\n    let el = this.el;\n    if (this.isExpandable) {\n      el = (el.firstElementChild as HTMLElement) ?? el;\n    }\n    el.classList.remove('focus');\n  }\n\n  private handleKeydown(event: KeyboardEvent) {\n    if (event.altKey || event.ctrlKey || event.metaKey) {\n      return;\n    }\n\n    let captured = false;\n    switch (event.key) {\n      case ' ':\n      case 'Enter':\n        if (this.isExpandable) {\n          if (this.isExpanded() && this.isSelected()) {\n            this.tree.collapseTreeitem(this);\n          } else {\n            this.tree.expandTreeitem(this);\n          }\n          captured = true;\n        } else {\n          event.stopPropagation();\n        }\n        this.tree.setSelected(this);\n        break;\n\n      case 'ArrowUp':\n        this.tree.setFocusToPreviousItem(this);\n        captured = true;\n        break;\n\n      case 'ArrowDown':\n        this.tree.setFocusToNextItem(this);\n        captured = true;\n        break;\n\n      case 'ArrowRight':\n        if (this.isExpandable) {\n          if (this.isExpanded()) {\n            this.tree.setFocusToNextItem(this);\n          } else {\n            this.tree.expandTreeitem(this);\n          }\n        }\n        captured = true;\n        break;\n\n      case 'ArrowLeft':\n        if (this.isExpandable && this.isExpanded()) {\n          this.tree.collapseTreeitem(this);\n          captured = true;\n        } else {\n          if (this.isInGroup) {\n            this.tree.setFocusToParentItem(this);\n            captured = true;\n          }\n        }\n        break;\n\n      case 'Home':\n        this.tree.setFocusToFirstItem();\n        captured = true;\n        break;\n\n      case 'End':\n        this.tree.setFocusToLastItem();\n        captured = true;\n        break;\n\n      default:\n        if (event.key.length === 1 && event.key.match(/\\S/)) {\n          if (event.key == '*') {\n            this.tree.expandAllSiblingItems(this);\n          } else {\n            this.tree.setFocusByFirstCharacter(this, event.key);\n          }\n          captured = true;\n        }\n        break;\n    }\n\n    if (captured) {\n      event.stopPropagation();\n      event.preventDefault();\n    }\n  }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction debounce<T extends (...args: any[]) => any>(func: T, wait: number) {\n  let timeout: ReturnType<typeof setTimeout> | null;\n  return (...args: Parameters<T>) => {\n    const later = () => {\n      timeout = null;\n      func(...args);\n    };\n    if (timeout) {\n      clearTimeout(timeout);\n    }\n    timeout = setTimeout(later, wait);\n  };\n}\n", "/*!\n * @license\n * Copyright 2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n/**\n * Controller for a table element with expandable rows. Adds event listeners to\n * a toggle within a table row that controls visiblity of additional related\n * rows in the table.\n *\n * @example\n * ```typescript\n * import {ExpandableRowsTableController} from '/static/js/table';\n *\n * const el = document .querySelector<HTMLTableElement>('.js-myTableElement')\n * new ExpandableRowsTableController(el));\n * ```\n */\nexport class ExpandableRowsTableController {\n  private rows: HTMLTableRowElement[];\n  private toggles: HTMLButtonElement[];\n\n  /**\n   * Create a table controller.\n   * @param table - The table element to which the controller binds.\n   */\n  constructor(private table: HTMLTableElement, private toggleAll?: HTMLButtonElement | null) {\n    this.rows = Array.from(table.querySelectorAll<HTMLTableRowElement>('[data-aria-controls]'));\n    this.toggles = Array.from(this.table.querySelectorAll('[aria-expanded]'));\n    this.setAttributes();\n    this.attachEventListeners();\n    this.update();\n  }\n\n  /**\n   * setAttributes sets data-aria-* and data-id attributes to regular\n   * html attributes as a workaround for limitations from safehtml.\n   */\n  private setAttributes() {\n    for (const a of ['data-aria-controls', 'data-aria-labelledby', 'data-id']) {\n      this.table.querySelectorAll(`[${a}]`).forEach(t => {\n        t.setAttribute(a.replace('data-', ''), t.getAttribute(a) ?? '');\n        t.removeAttribute(a);\n      });\n    }\n  }\n\n  private attachEventListeners() {\n    this.rows.forEach(t => {\n      t.addEventListener('click', e => {\n        this.handleToggleClick(e);\n      });\n    });\n    this.toggleAll?.addEventListener('click', () => {\n      this.expandAllItems();\n    });\n\n    document.addEventListener('keydown', e => {\n      if ((e.ctrlKey || e.metaKey) && e.key === 'f') {\n        this.expandAllItems();\n      }\n    });\n  }\n\n  private handleToggleClick(e: MouseEvent) {\n    let target = e.currentTarget as HTMLTableRowElement | null;\n    if (!target?.hasAttribute('aria-expanded')) {\n      target = this.table.querySelector(\n        `button[aria-controls=\"${target?.getAttribute('aria-controls')}\"]`\n      );\n    }\n    const isExpanded = target?.getAttribute('aria-expanded') === 'true';\n    target?.setAttribute('aria-expanded', isExpanded ? 'false' : 'true');\n    e.stopPropagation();\n    this.update();\n  }\n\n  expandAllItems = (): void => {\n    this.toggles.map(t => t.setAttribute('aria-expanded', 'true'));\n    this.update();\n  };\n\n  private collapseAllItems = () => {\n    this.toggles.map(t => t.setAttribute('aria-expanded', 'false'));\n    this.update();\n  };\n\n  private update = () => {\n    this.updateVisibleItems();\n    setTimeout(() => this.updateGlobalToggle());\n  };\n\n  private updateVisibleItems() {\n    this.rows.map(t => {\n      const isExpanded = t?.getAttribute('aria-expanded') === 'true';\n      const rowIds = t?.getAttribute('aria-controls')?.trimEnd().split(' ');\n      rowIds?.map(id => {\n        const target = document.getElementById(`${id}`);\n        if (isExpanded) {\n          target?.classList.add('visible');\n          target?.classList.remove('hidden');\n        } else {\n          target?.classList.add('hidden');\n          target?.classList.remove('visible');\n        }\n      });\n    });\n  }\n\n  private updateGlobalToggle() {\n    if (!this.toggleAll) return;\n    if (this.rows.some(t => t.hasAttribute('aria-expanded'))) {\n      this.toggleAll.style.display = 'block';\n    }\n    const someCollapsed = this.toggles.some(el => el.getAttribute('aria-expanded') === 'false');\n    if (someCollapsed) {\n      this.toggleAll.innerText = 'Expand all';\n      this.toggleAll.onclick = this.expandAllItems;\n    } else {\n      this.toggleAll.innerText = 'Collapse all';\n      this.toggleAll.onclick = this.collapseAllItems;\n    }\n  }\n}\n", "import '../../../shared/jump/jump';\nimport '../../../shared/playground/playground';\n\nimport { SelectNavController, makeSelectNav } from '../../../shared/outline/select';\nimport { TreeNavController } from '../../../shared/outline/tree';\nimport { ExpandableRowsTableController } from '../../../shared/table/table';\n\nconst directories = document.querySelector<HTMLTableElement>('.js-expandableTable');\nif (directories) {\n  const table = new ExpandableRowsTableController(\n    directories,\n    document.querySelector<HTMLButtonElement>('.js-expandAllDirectories')\n  );\n  // Expand directories on page load with expand-directories query param.\n  if (window.location.search.includes('expand-directories')) {\n    table.expandAllItems();\n  }\n}\n\nconst treeEl = document.querySelector<HTMLElement>('.js-tree');\nif (treeEl) {\n  const treeCtrl = new TreeNavController(treeEl);\n  const select = makeSelectNav(treeCtrl);\n  const mobileNav = document.querySelector('.js-mainNavMobile');\n  if (mobileNav && mobileNav.firstElementChild) {\n    mobileNav?.replaceChild(select, mobileNav.firstElementChild);\n  }\n  if (select.firstElementChild) {\n    new SelectNavController(select.firstElementChild);\n  }\n}\n\n/**\n * Event handlers for expanding and collapsing the readme section.\n */\nconst readme = document.querySelector('.js-readme');\nconst readmeContent = document.querySelector('.js-readmeContent');\nconst readmeOutline = document.querySelector('.js-readmeOutline');\nconst readmeExpand = document.querySelectorAll('.js-readmeExpand');\nconst readmeCollapse = document.querySelector('.js-readmeCollapse');\nconst mobileNavSelect = document.querySelector<HTMLSelectElement>('.DocNavMobile-select');\nif (readme && readmeContent && readmeOutline && readmeExpand.length && readmeCollapse) {\n  if (window.location.hash.includes('readme')) {\n    readme.classList.add('UnitReadme--expanded');\n  }\n  mobileNavSelect?.addEventListener('change', e => {\n    if ((e.target as HTMLSelectElement).value.startsWith('readme-')) {\n      readme.classList.add('UnitReadme--expanded');\n    }\n  });\n  readmeExpand.forEach(el =>\n    el.addEventListener('click', e => {\n      e.preventDefault();\n      readme.classList.add('UnitReadme--expanded');\n      readme.scrollIntoView();\n    })\n  );\n  readmeCollapse.addEventListener('click', e => {\n    e.preventDefault();\n    readme.classList.remove('UnitReadme--expanded');\n    if (readmeExpand[1]) {\n      readmeExpand[1].scrollIntoView({ block: 'center' });\n    }\n  });\n  readmeContent.addEventListener('keyup', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  readmeContent.addEventListener('click', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  readmeOutline.addEventListener('click', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  document.addEventListener('keydown', e => {\n    if ((e.ctrlKey || e.metaKey) && e.key === 'f') {\n      readme.classList.add('UnitReadme--expanded');\n    }\n  });\n}\n\n/**\n * Expand details items that are focused. This will expand\n * deprecated symbols when they are navigated to from the index\n * or a direct link.\n */\nfunction openDeprecatedSymbol() {\n  if (!location.hash) return;\n  const heading = document.getElementById(location.hash.slice(1));\n  const grandParent = heading?.parentElement?.parentElement as HTMLDetailsElement | null;\n  if (grandParent?.nodeName === 'DETAILS') {\n    grandParent.open = true;\n  }\n}\nopenDeprecatedSymbol();\nwindow.addEventListener('hashchange', () => openDeprecatedSymbol());\n\n/**\n * Listen for changes in the build context dropdown.\n */\ndocument.querySelectorAll('.js-buildContextSelect').forEach(el => {\n  el.addEventListener('change', e => {\n    window.location.search = `?GOOS=${(e.target as HTMLSelectElement).value}`;\n  });\n});\n"],
-  "mappings": "AAAA,AAwBA,GAAM,GAAa,SAAS,cAAiC,eACvD,EAAW,iBAAY,cAA8B,oBACrD,EAAW,iBAAY,cAA8B,oBACrD,EAAa,iBAAY,cAAgC,qBACzD,EAAM,SAAS,cAA8B,qBAS/C,EAUJ,YAAgC,CAC9B,GAAM,GAAQ,GACd,GAAI,EAAC,EACL,QAAW,KAAM,GAAI,iBAAiB,eACpC,EAAM,KAAK,EAAgB,IAI7B,OAAW,KAAQ,GACjB,EAAK,KAAK,iBAAiB,QAAS,UAAY,CAC9C,WAAY,UAIhB,SAAM,KAAK,SAAU,EAAG,EAAG,CACzB,MAAO,GAAE,MAAM,cAAc,EAAE,SAE1B,GAST,WAAyB,EAA2B,CAzEpD,MA0EE,GAAM,GAAI,SAAS,cAAc,KAC3B,EAAO,EAAG,aAAa,MAC7B,EAAE,aAAa,OAAQ,IAAM,GAC7B,EAAE,aAAa,WAAY,MAC3B,EAAE,aAAa,YAAa,gBAC5B,GAAM,GAAO,EAAG,aAAa,aAC7B,MAAO,CACL,KAAM,EACN,KAAM,UAAQ,GACd,KAAM,UAAQ,GACd,MAAO,oBAAM,gBAAN,OAAuB,IAIlC,GAAI,GACA,EAAiB,GAIrB,WAAwB,EAAgB,CAQtC,IAPA,EAAkB,EACb,GACH,GAAgB,KAElB,EAAkB,IAGX,iBAAU,YACf,EAAS,WAAW,SAGtB,GAAI,EAAQ,CAQV,GAAM,GAAkB,EAAO,cAEzB,EAAe,GACf,EAAgB,GAChB,EAAe,GAIf,EAAe,CAAC,EAAoB,EAAmB,IAEzD,EAAK,KAAK,UAAU,EAAG,GACvB,MACA,EAAK,KAAK,UAAU,EAAW,GAC/B,OACA,EAAK,KAAK,UAAU,GAIxB,OAAW,KAAQ,WAAiB,GAAI,CACtC,GAAM,GAAgB,EAAK,KA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,EAAe,SAAS,iBAAiB,oBACzC,EAAiB,SAAS,cAAc,sBACxC,EAAkB,SAAS,cAAiC,wBAClE,AAAI,GAAU,GAAiB,GAAiB,EAAa,QAAU,GACjE,QAAO,SAAS,KAAK,SAAS,WAChC,EAAO,UAAU,IAAI,wBAEvB,WAAiB,iBAAiB,SAAU,GAAK,CAC/C,AAAK,EAAE,OAA6B,MAAM,WAAW,YACnD,EAAO,UAAU,IAAI,0BAGzB,EAAa,QAAQ,GACnB,EAAG,iBAAiB,QAAS,GAAK,CAChC,EAAE,iBACF,EAAO,UAAU,IAAI,wBACrB,EAAO,oBAGX,EAAe,iBAAiB,QAAS,GAAK,CAC5C,EAAE,iBACF,EAAO,UAAU,OAAO,wBACpB,EAAa,IACf,EAAa,GAAG,eAAe,CAAE,MAAO,aAG5C,EAAc,iBAAiB,QAAS,IAAM,CAC5C,EAAO,UAAU,IAAI,0BAEvB,EAAc,iBAAiB,QAAS,IAAM,CAC5C,EAAO,UAAU,IAAI,0BAEvB,EAAc,iBAAiB,QAAS,IAAM,CAC5C,EAAO,UAAU,IAAI,0BAEvB,SAAS,iBAAiB,UAAW,GAAK,CACxC,AAAK,GAAE,SAAW,EAAE,UAAY,EAAE,MAAQ,KACxC,EAAO,UAAU,IAAI,2BAU3B,YAAgC,CArFhC,MAsFE,GAAI,CAAC,SAAS,KAAM,OACpB,GAAM,GAAU,SAAS,eAAe,SAAS,KAAK,MAAM,IACtD,EAAc,oBAAS,gBAAT,cAAwB,cAC5C,AAAI,kBAAa,YAAa,WAC5B,GAAY,KAAO,IAGvB,IACA,OAAO,iBAAiB,aAAc,IAAM,KAK5C,SAAS,iBAAiB,0BAA0B,QAAQ,GAAM,CAChE,EAAG,iBAAiB,SAAU,GAAK,CACjC,OAAO,SAAS,OAAS,SAAU,EAAE,OAA6B",
+  "sources": ["../../../shared/playground/playground.ts", "../../../shared/jump/jump.ts", "../../../shared/outline/select.ts", "../../../shared/outline/tree.ts", "../../../shared/table/table.ts", "main.ts"],
+  "sourcesContent": ["/*!\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the playground implementation of the documentation\n// page. The playground involves a \"play\" button that allows you to open up\n// a new link to play.golang.org using the example code.\n\n// The CSS is in static/frontend/unit/main/_doc.css\n\n/**\n * CSS classes used by PlaygroundExampleController\n */\nconst PlayExampleClassName = {\n  PLAY_HREF: '.js-exampleHref',\n  PLAY_CONTAINER: '.js-exampleContainer',\n  EXAMPLE_INPUT: '.Documentation-exampleCode',\n  EXAMPLE_OUTPUT: '.Documentation-exampleOutput',\n  EXAMPLE_ERROR: '.Documentation-exampleError',\n  PLAY_BUTTON: '.Documentation-examplePlayButton',\n  SHARE_BUTTON: '.Documentation-exampleShareButton',\n  FORMAT_BUTTON: '.Documentation-exampleFormatButton',\n  RUN_BUTTON: '.Documentation-exampleRunButton',\n};\n\n/**\n * This controller enables playground examples to expand their dropdown or\n * generate shareable Go Playground URLs.\n */\nexport class PlaygroundExampleController {\n  /**\n   * The anchor tag used to identify the container with an example href.\n   * There is only one in an example container div.\n   */\n  private readonly anchorEl: HTMLAnchorElement | null;\n\n  /**\n   * The error element\n   */\n  private readonly errorEl: Element | null;\n\n  /**\n   * Buttons that redirect to an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly playButtonEl: Element | null;\n  private readonly shareButtonEl: Element | null;\n\n  /**\n   * Button that formats the code in an example's playground.\n   */\n  private readonly formatButtonEl: Element | null;\n\n  /**\n   * Button that runs the code in an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly runButtonEl: Element | null;\n\n  /**\n   * The executable code of an example.\n   */\n  private readonly inputEl: HTMLTextAreaElement | null;\n\n  /**\n   * The output of the given example code. This only exists if the\n   * author of the package provides an output for this example.\n   */\n  private readonly outputEl: Element | null;\n\n  /**\n   * @param exampleEl The div that contains playground content for the given example.\n   */\n  constructor(private readonly exampleEl: HTMLDetailsElement) {\n    this.exampleEl = exampleEl;\n    this.anchorEl = exampleEl.querySelector('a');\n    this.errorEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_ERROR);\n    this.playButtonEl = exampleEl.querySelector(PlayExampleClassName.PLAY_BUTTON);\n    this.shareButtonEl = exampleEl.querySelector(PlayExampleClassName.SHARE_BUTTON);\n    this.formatButtonEl = exampleEl.querySelector(PlayExampleClassName.FORMAT_BUTTON);\n    this.runButtonEl = exampleEl.querySelector(PlayExampleClassName.RUN_BUTTON);\n    this.inputEl = this.makeTextArea(exampleEl.querySelector(PlayExampleClassName.EXAMPLE_INPUT));\n    this.outputEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_OUTPUT);\n\n    // This is legacy listener to be replaced the listener for shareButtonEl.\n    this.playButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.shareButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.formatButtonEl?.addEventListener('click', () => this.handleFormatButtonClick());\n    this.runButtonEl?.addEventListener('click', () => this.handleRunButtonClick());\n\n    if (!this.inputEl) return;\n\n    this.resize();\n    this.inputEl.addEventListener('keyup', () => this.resize());\n    this.inputEl.addEventListener('keydown', e => this.onKeydown(e));\n  }\n\n  /**\n   * Replace the pre element with a textarea. The examples are initially rendered\n   * as pre elements so they're fully visible when JS is disabled.\n   */\n  makeTextArea(el: Element | null): HTMLTextAreaElement {\n    const t = document.createElement('textarea');\n    t.classList.add('Documentation-exampleCode', 'code');\n    t.spellcheck = false;\n    t.value = el?.textContent ?? '';\n    el?.parentElement?.replaceChild(t, el);\n    return t;\n  }\n\n  /**\n   * Retrieve the hash value of the anchor element.\n   */\n  getAnchorHash(): string | undefined {\n    return this.anchorEl?.hash;\n  }\n\n  /**\n   * Expands the current playground example.\n   */\n  expand(): void {\n    this.exampleEl.open = true;\n  }\n\n  /**\n   * Resizes the input element to accomodate the amount of text present.\n   */\n  private resize(): void {\n    if (this.inputEl?.value) {\n      const numLineBreaks = (this.inputEl.value.match(/\\n/g) || []).length;\n      // min-height + lines x line-height + padding + border\n      this.inputEl.style.height = `${(20 + numLineBreaks * 20 + 12 + 2) / 16}rem`;\n    }\n  }\n\n  /**\n   * Handler to override keyboard behavior in the playground's\n   * textarea element.\n   *\n   * Tab key inserts tabs into the example playground instead of\n   * switching to the next interactive element.\n   * @param e input element keyboard event.\n   */\n  private onKeydown(e: KeyboardEvent) {\n    if (e.key === 'Tab') {\n      document.execCommand('insertText', false, '\\t');\n      e.preventDefault();\n    }\n  }\n\n  /**\n   * Changes the text of the example's input box.\n   */\n  private setInputText(output: string) {\n    if (this.inputEl) {\n      this.inputEl.value = output;\n    }\n  }\n\n  /**\n   * Changes the text of the example's output box.\n   */\n  private setOutputText(output: string) {\n    if (this.outputEl) {\n      this.outputEl.textContent = output;\n    }\n  }\n\n  /**\n   * Sets the error message text and overwrites\n   * output box to indicate a failed response.\n   */\n  private setErrorText(err: string) {\n    if (this.errorEl) {\n      this.errorEl.textContent = err;\n    }\n    this.setOutputText('An error has occurred\u2026');\n  }\n\n  /**\n   * Opens a new window to play.golang.org using the\n   * example snippet's code in the playground.\n   */\n  private handleShareButtonClick() {\n    const PLAYGROUND_BASE_URL = 'https://play.golang.org/p/';\n\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/share', {\n      method: 'POST',\n      body: this.inputEl?.value,\n    })\n      .then(res => res.text())\n      .then(shareId => {\n        const href = PLAYGROUND_BASE_URL + shareId;\n        this.setOutputText(`<a href=\"${href}\">${href}</a>`);\n        window.open(href);\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs gofmt on the example snippet in the playground.\n   */\n  private handleFormatButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n    const body = new FormData();\n    body.append('body', this.inputEl?.value ?? '');\n\n    fetch('/play/fmt', {\n      method: 'POST',\n      body: body,\n    })\n      .then(res => res.json())\n      .then(({ Body, Error }) => {\n        this.setOutputText(Error || 'Done.');\n        if (Body) {\n          this.setInputText(Body);\n          this.resize();\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs the code snippet in the example playground.\n   */\n  private handleRunButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/compile', {\n      method: 'POST',\n      body: JSON.stringify({ body: this.inputEl?.value, version: 2 }),\n    })\n      .then(res => res.json())\n      .then(async ({ Events, Errors }) => {\n        this.setOutputText(Errors || '');\n        for (const e of Events || []) {\n          this.setOutputText(e.Message);\n          await new Promise(resolve => setTimeout(resolve, e.Delay / 1000000));\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n}\n\nexport function initPlaygrounds(): void {\n  const exampleHashRegex = location.hash.match(/^#(example-.*)$/);\n  if (exampleHashRegex) {\n    const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;\n    if (exampleHashEl) {\n      exampleHashEl.open = true;\n    }\n  }\n\n  // We use a spread operator to convert a nodelist into an array of elements.\n  const exampleHrefs = [\n    ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),\n  ];\n\n  /**\n   * Sometimes exampleHrefs and playContainers are in different order, so we\n   * find an exampleHref from a common hash.\n   * @param playContainer - playground container\n   */\n  const findExampleHash = (playContainer: PlaygroundExampleController) =>\n    exampleHrefs.find(ex => {\n      return ex.hash === playContainer.getAnchorHash();\n    });\n\n  for (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {\n    // There should be the same amount of hrefs referencing examples as example containers.\n    const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);\n    const exampleHref = findExampleHash(playContainer);\n    if (exampleHref) {\n      exampleHref.addEventListener('click', () => {\n        playContainer.expand();\n      });\n    } else {\n      console.warn('example href not found');\n    }\n  }\n}\n", "/*!\n * @license\n * Copyright 2019-2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the behavior of the \"jump to symbol\" dialog for Go\n// package documentation, as well as the simple dialog that displays keyboard\n// shortcuts.\n\n// The DOM for the dialogs is at the bottom of static/frontend/unit/main/_modals.tmpl.\n// The CSS is in static/frontend/unit/main/_modals.css.\n\n// The dialog is activated by pressing the 'f' key. It presents a list\n// (#JumpDialog-list) of all Go symbols displayed in the documentation.\n// Entering text in the dialog's text box (#JumpDialog-filter) restricts the\n// list to symbols containing the text. Clicking on an symbol jumps to\n// its documentation.\n\n// This code is based on\n// https://go.googlesource.com/gddo/+/refs/heads/master/gddo-server/assets/site.js.\n// It was modified to remove the dependence on jquery and bootstrap.\n\nconst jumpDialog = document.querySelector<HTMLDialogElement>('.JumpDialog');\nconst jumpBody = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-body');\nconst jumpList = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-list');\nconst jumpFilter = jumpDialog?.querySelector<HTMLInputElement>('.JumpDialog-input');\nconst doc = document.querySelector<HTMLDivElement>('.js-documentation');\n\ninterface JumpListItem {\n  link: HTMLAnchorElement;\n  name: string;\n  kind: string;\n  lower: string;\n}\n\nlet jumpListItems: JumpListItem[] | undefined; // All the symbols in the doc; computed only once.\n\n// collectJumpListItems returns a list of items, one for each symbol in the\n// documentation on the current page.\n//\n// It uses the data-kind attribute generated in the documentation HTML to find\n// the symbols and their id attributes.\n//\n// If there are no data-kind attributes, then we have older doc; fall back to\n// a less precise method.\nfunction collectJumpListItems() {\n  const items = [];\n  if (!doc) return;\n  for (const el of doc.querySelectorAll('[data-kind]')) {\n    items.push(newJumpListItem(el));\n  }\n\n  // Clicking on any of the links closes the dialog.\n  for (const item of items) {\n    item.link.addEventListener('click', function () {\n      jumpDialog?.close();\n    });\n  }\n  // Sort case-insensitively by symbol name.\n  items.sort(function (a, b) {\n    return a.lower.localeCompare(b.lower);\n  });\n  return items;\n}\n\n// newJumpListItem creates a new item for the DOM element el.\n// An item is an object with:\n// - name: the element's id (which is the symbol name)\n// - kind: the element's kind (function, variable, etc.),\n// - link: a link ('a' tag) to the element\n// - lower: the name in lower case, just for sorting\nfunction newJumpListItem(el: Element): JumpListItem {\n  const a = document.createElement('a');\n  const name = el.getAttribute('id');\n  a.setAttribute('href', '#' + name);\n  a.setAttribute('tabindex', '-1');\n  a.setAttribute('data-gtmc', 'jump to link');\n  const kind = el.getAttribute('data-kind');\n  return {\n    link: a,\n    name: name ?? '',\n    kind: kind ?? '',\n    lower: name?.toLowerCase() ?? '', // for sorting\n  };\n}\n\nlet lastFilterValue: string; // The last contents of the filter text box.\nlet activeJumpItem = -1; // The index of the currently active item in the list.\n\n// updateJumpList sets the elements of the dialog list to\n// everything whose name contains filter.\nfunction updateJumpList(filter: string) {\n  lastFilterValue = filter;\n  if (!jumpListItems) {\n    jumpListItems = collectJumpListItems();\n  }\n  setActiveJumpItem(-1);\n\n  // Remove all children from list.\n  while (jumpList?.firstChild) {\n    jumpList.firstChild.remove();\n  }\n\n  if (filter) {\n    // A filter is set. We treat the filter as a substring that can appear in\n    // an item name (case insensitive), and find the following matches - in\n    // order of priority:\n    //\n    // 1. Exact matches (the filter matches the item's name exactly)\n    // 2. Prefix matches (the item's name starts with filter)\n    // 3. Infix matches (the filter is a substring of the item's name)\n    const filterLowerCase = filter.toLowerCase();\n\n    const exactMatches = [];\n    const prefixMatches = [];\n    const infixMatches = [];\n\n    // makeLinkHtml creates the link name HTML for a list item. item is the DOM\n    // item. item.name.substr(boldStart, boldEnd) will be bolded.\n    const makeLinkHtml = (item: JumpListItem, boldStart: number, boldEnd: number) => {\n      return (\n        item.name.substring(0, boldStart) +\n        '<b>' +\n        item.name.substring(boldStart, boldEnd) +\n        '</b>' +\n        item.name.substring(boldEnd)\n      );\n    };\n\n    for (const item of jumpListItems ?? []) {\n      const nameLowerCase = item.name.toLowerCase();\n\n      if (nameLowerCase === filterLowerCase) {\n        item.link.innerHTML = makeLinkHtml(item, 0, item.name.length);\n        exactMatches.push(item);\n      } else if (nameLowerCase.startsWith(filterLowerCase)) {\n        item.link.innerHTML = makeLinkHtml(item, 0, filter.length);\n        prefixMatches.push(item);\n      } else {\n        const index = nameLowerCase.indexOf(filterLowerCase);\n        if (index > -1) {\n          item.link.innerHTML = makeLinkHtml(item, index, index + filter.length);\n          infixMatches.push(item);\n        }\n      }\n    }\n\n    for (const item of exactMatches.concat(prefixMatches).concat(infixMatches)) {\n      jumpList?.appendChild(item.link);\n    }\n  } else {\n    if (!jumpListItems || jumpListItems.length === 0) {\n      const msg = document.createElement('i');\n      msg.innerHTML = 'There are no symbols on this page.';\n      jumpList?.appendChild(msg);\n    }\n    // No filter set; display all items in their existing order.\n    for (const item of jumpListItems ?? []) {\n      item.link.innerHTML = item.name + ' <i>' + item.kind + '</i>';\n      jumpList?.appendChild(item.link);\n    }\n  }\n\n  if (jumpBody) {\n    jumpBody.scrollTop = 0;\n  }\n  if (jumpListItems?.length && jumpList && jumpList.children.length > 0) {\n    setActiveJumpItem(0);\n  }\n}\n\n// Set the active jump item to n.\nfunction setActiveJumpItem(n: number) {\n  const cs = jumpList?.children as HTMLCollectionOf<HTMLElement> | null | undefined;\n  if (!cs || !jumpBody) {\n    return;\n  }\n  if (activeJumpItem >= 0) {\n    cs[activeJumpItem].classList.remove('JumpDialog-active');\n  }\n  if (n >= cs.length) {\n    n = cs.length - 1;\n  }\n  if (n >= 0) {\n    cs[n].classList.add('JumpDialog-active');\n\n    // Scroll so the active item is visible.\n    // For some reason cs[n].scrollIntoView() doesn't behave as I'd expect:\n    // it moves the entire dialog box in the viewport.\n\n    // Get the top and bottom of the active item relative to jumpBody.\n    const activeTop = cs[n].offsetTop - cs[0].offsetTop;\n    const activeBottom = activeTop + cs[n].clientHeight;\n    if (activeTop < jumpBody.scrollTop) {\n      // Off the top; scroll up.\n      jumpBody.scrollTop = activeTop;\n    } else if (activeBottom > jumpBody.scrollTop + jumpBody.clientHeight) {\n      // Off the bottom; scroll down.\n      jumpBody.scrollTop = activeBottom - jumpBody.clientHeight;\n    }\n  }\n  activeJumpItem = n;\n}\n\n// Increment the activeJumpItem by delta.\nfunction incActiveJumpItem(delta: number) {\n  if (activeJumpItem < 0) {\n    return;\n  }\n  let n = activeJumpItem + delta;\n  if (n < 0) {\n    n = 0;\n  }\n  setActiveJumpItem(n);\n}\n\nexport function initModals(): void {\n  // Pressing a key in the filter updates the list (if the filter actually changed).\n  jumpFilter?.addEventListener('keyup', function () {\n    if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {\n      updateJumpList(jumpFilter.value);\n    }\n  });\n\n  // Pressing enter in the filter selects the first element in the list.\n  jumpFilter?.addEventListener('keydown', function (event) {\n    const upArrow = 38;\n    const downArrow = 40;\n    const enterKey = 13;\n    switch (event.which) {\n      case upArrow:\n        incActiveJumpItem(-1);\n        event.preventDefault();\n        break;\n      case downArrow:\n        incActiveJumpItem(1);\n        event.preventDefault();\n        break;\n      case enterKey:\n        if (activeJumpItem >= 0) {\n          if (jumpList) {\n            (jumpList.children[activeJumpItem] as HTMLElement).click();\n            event.preventDefault();\n          }\n        }\n        break;\n    }\n  });\n\n  const shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');\n\n  // Keyboard shortcuts:\n  // - Pressing '/' focuses the search box\n  // - Pressing 'f' or 'F' opens the jump-to-symbol dialog.\n  // - Pressing '?' opens up the shortcut dialog.\n  // Ignore a keypress if a dialog is already open, or if it is pressed on a\n  // component that wants to consume it.\n  document.addEventListener('keypress', function (e) {\n    if (jumpDialog?.open || shortcutsDialog?.open) {\n      return;\n    }\n    const target = e.target as HTMLElement | null;\n    const t = target?.tagName;\n    if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {\n      return;\n    }\n    if (target?.contentEditable == 'true') {\n      return;\n    }\n    if (e.metaKey || e.ctrlKey) {\n      return;\n    }\n    const ch = String.fromCharCode(e.which);\n    switch (ch) {\n      case 'f':\n      case 'F':\n        e.preventDefault();\n        if (jumpFilter) {\n          jumpFilter.value = '';\n        }\n        jumpDialog?.showModal();\n        jumpFilter?.focus();\n        updateJumpList('');\n        break;\n      case '?':\n        shortcutsDialog?.showModal();\n        break;\n    }\n  });\n\n  const jumpOutlineInput = document.querySelector('.js-jumpToInput');\n  if (jumpOutlineInput) {\n    jumpOutlineInput.addEventListener('click', () => {\n      if (jumpFilter) {\n        jumpFilter.value = '';\n      }\n      updateJumpList('');\n    });\n  }\n}\n", "/**\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\nimport { TreeNavController } from './tree.js';\n\nexport class SelectNavController {\n  constructor(private el: Element) {\n    this.el.addEventListener('change', e => {\n      const target = e.target as HTMLSelectElement;\n      let href = target.value;\n      if (!target.value.startsWith('/')) {\n        href = '/' + href;\n      }\n      window.location.href = href;\n    });\n  }\n}\n\nexport function makeSelectNav(tree: TreeNavController): HTMLLabelElement {\n  const label = document.createElement('label');\n  label.classList.add('go-Label');\n  label.setAttribute('aria-label', 'Menu');\n  const select = document.createElement('select');\n  select.classList.add('go-Select', 'js-selectNav');\n  label.appendChild(select);\n  const outline = document.createElement('optgroup');\n  outline.label = 'Outline';\n  select.appendChild(outline);\n  const groupMap: Record<string, HTMLOptGroupElement> = {};\n  let group: HTMLOptGroupElement;\n  for (const t of tree.treeitems) {\n    if (Number(t.depth) > 4) continue;\n    if (t.groupTreeitem) {\n      group = groupMap[t.groupTreeitem.label];\n      if (!group) {\n        group = groupMap[t.groupTreeitem.label] = document.createElement('optgroup');\n        group.label = t.groupTreeitem.label;\n        select.appendChild(group);\n      }\n    } else {\n      group = outline;\n    }\n    const o = document.createElement('option');\n    o.label = t.label;\n    o.textContent = t.label;\n    o.value = (t.el as HTMLAnchorElement).href.replace(window.location.origin, '').replace('/', '');\n    group.appendChild(o);\n  }\n  tree.addObserver(t => {\n    const hash = (t.el as HTMLAnchorElement).hash;\n    const value = select.querySelector<HTMLOptionElement>(`[value$=\"${hash}\"]`)?.value;\n    if (value) {\n      select.value = value;\n    }\n  }, 50);\n  return label;\n}\n", "/**\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n/**\n * TreeNavController is the navigation tree component of the documentation page.\n * It adds accessiblity attributes to a tree, observes the heading elements\n * focus the topmost link for headings visible on the page, and implements the\n * WAI-ARIA Treeview Design Pattern with full\n * [keyboard support](https://www.w3.org/TR/wai-aria-practices/examples/treeview/treeview-2/treeview-2a.html#kbd_label).\n */\nexport class TreeNavController {\n  treeitems: TreeItem[];\n\n  /**\n   * firstChars is the first character of each treeitem in the same order\n   * as this.treeitems. We use this array to set focus by character when\n   * navigating the tree with a keyboard.\n   */\n  private firstChars: string[];\n  private firstTreeitem: TreeItem | null;\n  private lastTreeitem: TreeItem | null;\n  private observerCallbacks: ((t: TreeItem) => void)[];\n\n  constructor(private el: HTMLElement) {\n    this.treeitems = [];\n    this.firstChars = [];\n    this.firstTreeitem = null;\n    this.lastTreeitem = null;\n    this.observerCallbacks = [];\n    this.init();\n  }\n\n  private init(): void {\n    this.handleResize();\n    window.addEventListener('resize', this.handleResize);\n    this.findTreeItems();\n    this.updateVisibleTreeitems();\n    this.observeTargets();\n    if (this.firstTreeitem) {\n      this.firstTreeitem.el.tabIndex = 0;\n    }\n  }\n\n  private handleResize = (): void => {\n    this.el.style.setProperty('--js-tree-height', '100vh');\n    this.el.style.setProperty('--js-tree-height', this.el.clientHeight + 'px');\n  };\n\n  private observeTargets() {\n    this.addObserver(treeitem => {\n      this.expandTreeitem(treeitem);\n      this.setSelected(treeitem);\n      // TODO: Fix scroll issue in https://golang.org/issue/47450.\n      // treeitem.el.scrollIntoView({ block: 'nearest' });\n    });\n\n    const targets = new Map<string, boolean>();\n    const observer = new IntersectionObserver(\n      entries => {\n        for (const entry of entries) {\n          targets.set(entry.target.id, entry.isIntersecting || entry.intersectionRatio === 1);\n        }\n        for (const [id, isIntersecting] of targets) {\n          if (isIntersecting) {\n            const active = this.treeitems.find(t =>\n              (t.el as HTMLAnchorElement)?.href.endsWith(`#${id}`)\n            );\n            if (active) {\n              for (const fn of this.observerCallbacks) {\n                fn(active);\n              }\n            }\n            break;\n          }\n        }\n      },\n      {\n        threshold: 1.0,\n        rootMargin: '-60px 0px 0px 0px',\n      }\n    );\n\n    for (const href of this.treeitems.map(t => t.el.getAttribute('href'))) {\n      if (href) {\n        const id = href.replace(window.location.origin, '').replace('/', '').replace('#', '');\n        const target = document.getElementById(id);\n        if (target) {\n          observer.observe(target);\n        }\n      }\n    }\n  }\n\n  addObserver(fn: (t: TreeItem) => void, delay = 200): void {\n    this.observerCallbacks.push(debounce(fn, delay));\n  }\n\n  setFocusToNextItem(currentItem: TreeItem): void {\n    let nextItem = null;\n    for (let i = currentItem.index + 1; i < this.treeitems.length; i++) {\n      const ti = this.treeitems[i];\n      if (ti.isVisible) {\n        nextItem = ti;\n        break;\n      }\n    }\n    if (nextItem) {\n      this.setFocusToItem(nextItem);\n    }\n  }\n\n  setFocusToPreviousItem(currentItem: TreeItem): void {\n    let prevItem = null;\n    for (let i = currentItem.index - 1; i > -1; i--) {\n      const ti = this.treeitems[i];\n      if (ti.isVisible) {\n        prevItem = ti;\n        break;\n      }\n    }\n    if (prevItem) {\n      this.setFocusToItem(prevItem);\n    }\n  }\n\n  setFocusToParentItem(currentItem: TreeItem): void {\n    if (currentItem.groupTreeitem) {\n      this.setFocusToItem(currentItem.groupTreeitem);\n    }\n  }\n\n  setFocusToFirstItem(): void {\n    this.firstTreeitem && this.setFocusToItem(this.firstTreeitem);\n  }\n\n  setFocusToLastItem(): void {\n    this.lastTreeitem && this.setFocusToItem(this.lastTreeitem);\n  }\n\n  setSelected(currentItem: TreeItem): void {\n    for (const l1 of this.el.querySelectorAll('[aria-expanded=\"true\"]')) {\n      if (l1 === currentItem.el) continue;\n      if (!l1.nextElementSibling?.contains(currentItem.el)) {\n        l1.setAttribute('aria-expanded', 'false');\n      }\n    }\n    for (const l1 of this.el.querySelectorAll('[aria-selected]')) {\n      if (l1 !== currentItem.el) {\n        l1.setAttribute('aria-selected', 'false');\n      }\n    }\n    currentItem.el.setAttribute('aria-selected', 'true');\n    this.updateVisibleTreeitems();\n    this.setFocusToItem(currentItem, false);\n  }\n\n  expandTreeitem(treeitem: TreeItem): void {\n    let currentItem: TreeItem | null = treeitem;\n    while (currentItem) {\n      if (currentItem.isExpandable) {\n        currentItem.el.setAttribute('aria-expanded', 'true');\n      }\n      currentItem = currentItem.groupTreeitem;\n    }\n    this.updateVisibleTreeitems();\n  }\n\n  expandAllSiblingItems(currentItem: TreeItem): void {\n    for (const ti of this.treeitems) {\n      if (ti.groupTreeitem === currentItem.groupTreeitem && ti.isExpandable) {\n        this.expandTreeitem(ti);\n      }\n    }\n  }\n\n  collapseTreeitem(currentItem: TreeItem): void {\n    let groupTreeitem = null;\n\n    if (currentItem.isExpanded()) {\n      groupTreeitem = currentItem;\n    } else {\n      groupTreeitem = currentItem.groupTreeitem;\n    }\n\n    if (groupTreeitem) {\n      groupTreeitem.el.setAttribute('aria-expanded', 'false');\n      this.updateVisibleTreeitems();\n      this.setFocusToItem(groupTreeitem);\n    }\n  }\n\n  setFocusByFirstCharacter(currentItem: TreeItem, char: string): void {\n    let start: number, index: number;\n    char = char.toLowerCase();\n\n    // Get start index for search based on position of currentItem\n    start = currentItem.index + 1;\n    if (start === this.treeitems.length) {\n      start = 0;\n    }\n\n    // Check remaining slots in the menu\n    index = this.getIndexFirstChars(start, char);\n\n    // If not found in remaining slots, check from beginning\n    if (index === -1) {\n      index = this.getIndexFirstChars(0, char);\n    }\n\n    // If match was found...\n    if (index > -1) {\n      this.setFocusToItem(this.treeitems[index]);\n    }\n  }\n\n  private findTreeItems() {\n    const findItems = (el: HTMLElement, group: TreeItem | null) => {\n      let ti = group;\n      let curr = el.firstElementChild as HTMLElement;\n      while (curr) {\n        if (curr.tagName === 'A' || curr.tagName === 'SPAN') {\n          ti = new TreeItem(curr, this, group);\n          this.treeitems.push(ti);\n          this.firstChars.push(ti.label.substring(0, 1).toLowerCase());\n        }\n        if (curr.firstElementChild) {\n          findItems(curr, ti);\n        }\n        curr = curr.nextElementSibling as HTMLElement;\n      }\n    };\n    findItems(this.el as HTMLElement, null);\n    this.treeitems.map((ti, idx) => (ti.index = idx));\n  }\n\n  private updateVisibleTreeitems(): void {\n    this.firstTreeitem = this.treeitems[0];\n\n    for (const ti of this.treeitems) {\n      let parent = ti.groupTreeitem;\n      ti.isVisible = true;\n      while (parent && parent.el !== this.el) {\n        if (!parent.isExpanded()) {\n          ti.isVisible = false;\n        }\n        parent = parent.groupTreeitem;\n      }\n      if (ti.isVisible) {\n        this.lastTreeitem = ti;\n      }\n    }\n  }\n\n  private setFocusToItem(treeitem: TreeItem, focusEl = true) {\n    treeitem.el.tabIndex = 0;\n    if (focusEl) {\n      treeitem.el.focus();\n    }\n    for (const ti of this.treeitems) {\n      if (ti !== treeitem) {\n        ti.el.tabIndex = -1;\n      }\n    }\n  }\n\n  private getIndexFirstChars(startIndex: number, char: string): number {\n    for (let i = startIndex; i < this.firstChars.length; i++) {\n      if (this.treeitems[i].isVisible && char === this.firstChars[i]) {\n        return i;\n      }\n    }\n    return -1;\n  }\n}\n\nclass TreeItem {\n  el: HTMLElement;\n  groupTreeitem: TreeItem | null;\n  label: string;\n  isExpandable: boolean;\n  isVisible: boolean;\n  depth: number;\n  index: number;\n\n  private tree: TreeNavController;\n  private isInGroup: boolean;\n\n  constructor(el: HTMLElement, treeObj: TreeNavController, group: TreeItem | null) {\n    el.tabIndex = -1;\n    this.el = el;\n    this.groupTreeitem = group;\n    this.label = el.textContent?.trim() ?? '';\n    this.tree = treeObj;\n    this.depth = (group?.depth || 0) + 1;\n    this.index = 0;\n\n    const parent = el.parentElement;\n    if (parent?.tagName.toLowerCase() === 'li') {\n      parent?.setAttribute('role', 'none');\n    }\n    el.setAttribute('aria-level', this.depth + '');\n    if (el.getAttribute('aria-label')) {\n      this.label = el?.getAttribute('aria-label')?.trim() ?? '';\n    }\n\n    this.isExpandable = false;\n    this.isVisible = false;\n    this.isInGroup = !!group;\n\n    let curr = el.nextElementSibling;\n    while (curr) {\n      if (curr.tagName.toLowerCase() == 'ul') {\n        const groupId = `${group?.label ?? ''} nav group ${this.label}`.replace(/[\\W_]+/g, '_');\n        el.setAttribute('aria-owns', groupId);\n        el.setAttribute('aria-expanded', 'false');\n        curr.setAttribute('role', 'group');\n        curr.setAttribute('id', groupId);\n        this.isExpandable = true;\n        break;\n      }\n\n      curr = curr.nextElementSibling;\n    }\n    this.init();\n  }\n\n  private init() {\n    this.el.tabIndex = -1;\n    if (!this.el.getAttribute('role')) {\n      this.el.setAttribute('role', 'treeitem');\n    }\n    this.el.addEventListener('keydown', this.handleKeydown.bind(this));\n    this.el.addEventListener('click', this.handleClick.bind(this));\n    this.el.addEventListener('focus', this.handleFocus.bind(this));\n    this.el.addEventListener('blur', this.handleBlur.bind(this));\n  }\n\n  isExpanded() {\n    if (this.isExpandable) {\n      return this.el.getAttribute('aria-expanded') === 'true';\n    }\n\n    return false;\n  }\n\n  isSelected() {\n    return this.el.getAttribute('aria-selected') === 'true';\n  }\n\n  private handleClick(event: MouseEvent) {\n    // only process click events that directly happened on this treeitem\n    if (event.target !== this.el && event.target !== this.el.firstElementChild) {\n      return;\n    }\n    if (this.isExpandable) {\n      if (this.isExpanded() && this.isSelected()) {\n        this.tree.collapseTreeitem(this);\n      } else {\n        this.tree.expandTreeitem(this);\n      }\n      event.stopPropagation();\n    }\n    this.tree.setSelected(this);\n  }\n\n  private handleFocus() {\n    let el = this.el;\n    if (this.isExpandable) {\n      el = (el.firstElementChild as HTMLElement) ?? el;\n    }\n    el.classList.add('focus');\n  }\n\n  private handleBlur() {\n    let el = this.el;\n    if (this.isExpandable) {\n      el = (el.firstElementChild as HTMLElement) ?? el;\n    }\n    el.classList.remove('focus');\n  }\n\n  private handleKeydown(event: KeyboardEvent) {\n    if (event.altKey || event.ctrlKey || event.metaKey) {\n      return;\n    }\n\n    let captured = false;\n    switch (event.key) {\n      case ' ':\n      case 'Enter':\n        if (this.isExpandable) {\n          if (this.isExpanded() && this.isSelected()) {\n            this.tree.collapseTreeitem(this);\n          } else {\n            this.tree.expandTreeitem(this);\n          }\n          captured = true;\n        } else {\n          event.stopPropagation();\n        }\n        this.tree.setSelected(this);\n        break;\n\n      case 'ArrowUp':\n        this.tree.setFocusToPreviousItem(this);\n        captured = true;\n        break;\n\n      case 'ArrowDown':\n        this.tree.setFocusToNextItem(this);\n        captured = true;\n        break;\n\n      case 'ArrowRight':\n        if (this.isExpandable) {\n          if (this.isExpanded()) {\n            this.tree.setFocusToNextItem(this);\n          } else {\n            this.tree.expandTreeitem(this);\n          }\n        }\n        captured = true;\n        break;\n\n      case 'ArrowLeft':\n        if (this.isExpandable && this.isExpanded()) {\n          this.tree.collapseTreeitem(this);\n          captured = true;\n        } else {\n          if (this.isInGroup) {\n            this.tree.setFocusToParentItem(this);\n            captured = true;\n          }\n        }\n        break;\n\n      case 'Home':\n        this.tree.setFocusToFirstItem();\n        captured = true;\n        break;\n\n      case 'End':\n        this.tree.setFocusToLastItem();\n        captured = true;\n        break;\n\n      default:\n        if (event.key.length === 1 && event.key.match(/\\S/)) {\n          if (event.key == '*') {\n            this.tree.expandAllSiblingItems(this);\n          } else {\n            this.tree.setFocusByFirstCharacter(this, event.key);\n          }\n          captured = true;\n        }\n        break;\n    }\n\n    if (captured) {\n      event.stopPropagation();\n      event.preventDefault();\n    }\n  }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction debounce<T extends (...args: any[]) => any>(func: T, wait: number) {\n  let timeout: ReturnType<typeof setTimeout> | null;\n  return (...args: Parameters<T>) => {\n    const later = () => {\n      timeout = null;\n      func(...args);\n    };\n    if (timeout) {\n      clearTimeout(timeout);\n    }\n    timeout = setTimeout(later, wait);\n  };\n}\n", "/*!\n * @license\n * Copyright 2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n/**\n * Controller for a table element with expandable rows. Adds event listeners to\n * a toggle within a table row that controls visiblity of additional related\n * rows in the table.\n *\n * @example\n * ```typescript\n * import {ExpandableRowsTableController} from '/static/js/table';\n *\n * const el = document .querySelector<HTMLTableElement>('.js-myTableElement')\n * new ExpandableRowsTableController(el));\n * ```\n */\nexport class ExpandableRowsTableController {\n  private rows: HTMLTableRowElement[];\n  private toggles: HTMLButtonElement[];\n\n  /**\n   * Create a table controller.\n   * @param table - The table element to which the controller binds.\n   */\n  constructor(private table: HTMLTableElement, private toggleAll?: HTMLButtonElement | null) {\n    this.rows = Array.from(table.querySelectorAll<HTMLTableRowElement>('[data-aria-controls]'));\n    this.toggles = Array.from(this.table.querySelectorAll('[aria-expanded]'));\n    this.setAttributes();\n    this.attachEventListeners();\n    this.update();\n  }\n\n  /**\n   * setAttributes sets data-aria-* and data-id attributes to regular\n   * html attributes as a workaround for limitations from safehtml.\n   */\n  private setAttributes() {\n    for (const a of ['data-aria-controls', 'data-aria-labelledby', 'data-id']) {\n      this.table.querySelectorAll(`[${a}]`).forEach(t => {\n        t.setAttribute(a.replace('data-', ''), t.getAttribute(a) ?? '');\n        t.removeAttribute(a);\n      });\n    }\n  }\n\n  private attachEventListeners() {\n    this.rows.forEach(t => {\n      t.addEventListener('click', e => {\n        this.handleToggleClick(e);\n      });\n    });\n    this.toggleAll?.addEventListener('click', () => {\n      this.expandAllItems();\n    });\n\n    document.addEventListener('keydown', e => {\n      if ((e.ctrlKey || e.metaKey) && e.key === 'f') {\n        this.expandAllItems();\n      }\n    });\n  }\n\n  private handleToggleClick(e: MouseEvent) {\n    let target = e.currentTarget as HTMLTableRowElement | null;\n    if (!target?.hasAttribute('aria-expanded')) {\n      target = this.table.querySelector(\n        `button[aria-controls=\"${target?.getAttribute('aria-controls')}\"]`\n      );\n    }\n    const isExpanded = target?.getAttribute('aria-expanded') === 'true';\n    target?.setAttribute('aria-expanded', isExpanded ? 'false' : 'true');\n    e.stopPropagation();\n    this.update();\n  }\n\n  expandAllItems = (): void => {\n    this.toggles.map(t => t.setAttribute('aria-expanded', 'true'));\n    this.update();\n  };\n\n  private collapseAllItems = () => {\n    this.toggles.map(t => t.setAttribute('aria-expanded', 'false'));\n    this.update();\n  };\n\n  private update = () => {\n    this.updateVisibleItems();\n    setTimeout(() => this.updateGlobalToggle());\n  };\n\n  private updateVisibleItems() {\n    this.rows.map(t => {\n      const isExpanded = t?.getAttribute('aria-expanded') === 'true';\n      const rowIds = t?.getAttribute('aria-controls')?.trimEnd().split(' ');\n      rowIds?.map(id => {\n        const target = document.getElementById(`${id}`);\n        if (isExpanded) {\n          target?.classList.add('visible');\n          target?.classList.remove('hidden');\n        } else {\n          target?.classList.add('hidden');\n          target?.classList.remove('visible');\n        }\n      });\n    });\n  }\n\n  private updateGlobalToggle() {\n    if (!this.toggleAll) return;\n    if (this.rows.some(t => t.hasAttribute('aria-expanded'))) {\n      this.toggleAll.style.display = 'block';\n    }\n    const someCollapsed = this.toggles.some(el => el.getAttribute('aria-expanded') === 'false');\n    if (someCollapsed) {\n      this.toggleAll.innerText = 'Expand all';\n      this.toggleAll.onclick = this.expandAllItems;\n    } else {\n      this.toggleAll.innerText = 'Collapse all';\n      this.toggleAll.onclick = this.collapseAllItems;\n    }\n  }\n}\n", "import { initPlaygrounds } from 'static/shared/playground/playground';\nimport { initModals } from 'static/shared/jump/jump';\nimport { SelectNavController, makeSelectNav } from 'static/shared/outline/select';\nimport { TreeNavController } from 'static/shared/outline/tree';\nimport { ExpandableRowsTableController } from 'static/shared/table/table';\n\ninitModals();\ninitPlaygrounds();\n\nconst directories = document.querySelector<HTMLTableElement>('.js-expandableTable');\nif (directories) {\n  const table = new ExpandableRowsTableController(\n    directories,\n    document.querySelector<HTMLButtonElement>('.js-expandAllDirectories')\n  );\n  // Expand directories on page load with expand-directories query param.\n  if (window.location.search.includes('expand-directories')) {\n    table.expandAllItems();\n  }\n}\n\nconst treeEl = document.querySelector<HTMLElement>('.js-tree');\nif (treeEl) {\n  const treeCtrl = new TreeNavController(treeEl);\n  const select = makeSelectNav(treeCtrl);\n  const mobileNav = document.querySelector('.js-mainNavMobile');\n  if (mobileNav && mobileNav.firstElementChild) {\n    mobileNav?.replaceChild(select, mobileNav.firstElementChild);\n  }\n  if (select.firstElementChild) {\n    new SelectNavController(select.firstElementChild);\n  }\n}\n\n/**\n * Event handlers for expanding and collapsing the readme section.\n */\nconst readme = document.querySelector('.js-readme');\nconst readmeContent = document.querySelector('.js-readmeContent');\nconst readmeOutline = document.querySelector('.js-readmeOutline');\nconst readmeExpand = document.querySelectorAll('.js-readmeExpand');\nconst readmeCollapse = document.querySelector('.js-readmeCollapse');\nconst mobileNavSelect = document.querySelector<HTMLSelectElement>('.DocNavMobile-select');\nif (readme && readmeContent && readmeOutline && readmeExpand.length && readmeCollapse) {\n  if (window.location.hash.includes('readme')) {\n    readme.classList.add('UnitReadme--expanded');\n  }\n  mobileNavSelect?.addEventListener('change', e => {\n    if ((e.target as HTMLSelectElement).value.startsWith('readme-')) {\n      readme.classList.add('UnitReadme--expanded');\n    }\n  });\n  readmeExpand.forEach(el =>\n    el.addEventListener('click', e => {\n      e.preventDefault();\n      readme.classList.add('UnitReadme--expanded');\n      readme.scrollIntoView();\n    })\n  );\n  readmeCollapse.addEventListener('click', e => {\n    e.preventDefault();\n    readme.classList.remove('UnitReadme--expanded');\n    if (readmeExpand[1]) {\n      readmeExpand[1].scrollIntoView({ block: 'center' });\n    }\n  });\n  readmeContent.addEventListener('keyup', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  readmeContent.addEventListener('click', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  readmeOutline.addEventListener('click', () => {\n    readme.classList.add('UnitReadme--expanded');\n  });\n  document.addEventListener('keydown', e => {\n    if ((e.ctrlKey || e.metaKey) && e.key === 'f') {\n      readme.classList.add('UnitReadme--expanded');\n    }\n  });\n}\n\n/**\n * Expand details items that are focused. This will expand\n * deprecated symbols when they are navigated to from the index\n * or a direct link.\n */\nfunction openDeprecatedSymbol() {\n  if (!location.hash) return;\n  const heading = document.getElementById(location.hash.slice(1));\n  const grandParent = heading?.parentElement?.parentElement as HTMLDetailsElement | null;\n  if (grandParent?.nodeName === 'DETAILS') {\n    grandParent.open = true;\n  }\n}\nopenDeprecatedSymbol();\nwindow.addEventListener('hashchange', () => openDeprecatedSymbol());\n\n/**\n * Listen for changes in the build context dropdown.\n */\ndocument.querySelectorAll('.js-buildContextSelect').forEach(el => {\n  el.addEventListener('change', e => {\n    window.location.search = `?GOOS=${(e.target as HTMLSelectElement).value}`;\n  });\n});\n"],
+  "mappings": "AAAA,AAgBA,GAAM,GAAuB,CAC3B,UAAW,kBACX,eAAgB,uBAChB,cAAe,6BACf,eAAgB,+BAChB,cAAe,8BACf,YAAa,mCACb,aAAc,oCACd,cAAe,qCACf,WAAY,mCAOP,OAAkC,CA4CvC,YAA6B,EAA+B,CAA/B,iBA5E/B,YA6FI,AAhBA,KAAK,UAAY,EACjB,KAAK,SAAW,EAAU,cAAc,KACxC,KAAK,QAAU,EAAU,cAAc,EAAqB,eAC5D,KAAK,aAAe,EAAU,cAAc,EAAqB,aACjE,KAAK,cAAgB,EAAU,cAAc,EAAqB,cAClE,KAAK,eAAiB,EAAU,cAAc,EAAqB,eACnE,KAAK,YAAc,EAAU,cAAc,EAAqB,YAChE,KAAK,QAAU,KAAK,aAAa,EAAU,cAAc,EAAqB,gBAC9E,KAAK,SAAW,EAAU,cAAc,EAAqB,gBAG7D,QAAK,eAAL,QAAmB,iBAAiB,QAAS,IAAM,KAAK,0BACxD,QAAK,gBAAL,QAAoB,iBAAiB,QAAS,IAAM,KAAK,0BACzD,QAAK,iBAAL,QAAqB,iBAAiB,QAAS,IAAM,KAAK,2BAC1D,QAAK,cAAL,QAAkB,iBAAiB,QAAS,IAAM,KAAK,wBAEnD,EAAC,KAAK,SAEV,MAAK,SACL,KAAK,QAAQ,iBAAiB,QAAS,IAAM,KAAK,UAClD,KAAK,QAAQ,iBAAiB,UAAW,GAAK,KAAK,UAAU,KAO/D,a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O,IAGvB,IACA,OAAO,iBAAiB,aAAc,IAAM,KAK5C,SAAS,iBAAiB,0BAA0B,QAAQ,GAAM,CAChE,EAAG,iBAAiB,SAAU,GAAK,CACjC,OAAO,SAAS,OAAS,SAAU,EAAE,OAA6B",
   "names": []
 }
diff --git a/static/frontend/unit/main/main.ts b/static/frontend/unit/main/main.ts
index 4421862..a37443d 100644
--- a/static/frontend/unit/main/main.ts
+++ b/static/frontend/unit/main/main.ts
@@ -1,9 +1,11 @@
-import '../../../shared/jump/jump';
-import '../../../shared/playground/playground';
+import { initPlaygrounds } from 'static/shared/playground/playground';
+import { initModals } from 'static/shared/jump/jump';
+import { SelectNavController, makeSelectNav } from 'static/shared/outline/select';
+import { TreeNavController } from 'static/shared/outline/tree';
+import { ExpandableRowsTableController } from 'static/shared/table/table';
 
-import { SelectNavController, makeSelectNav } from '../../../shared/outline/select';
-import { TreeNavController } from '../../../shared/outline/tree';
-import { ExpandableRowsTableController } from '../../../shared/table/table';
+initModals();
+initPlaygrounds();
 
 const directories = document.querySelector<HTMLTableElement>('.js-expandableTable');
 if (directories) {
diff --git a/static/shared/jump/jump.js b/static/shared/jump/jump.js
index 9a09340..04d9ed7 100644
--- a/static/shared/jump/jump.js
+++ b/static/shared/jump/jump.js
@@ -3,5 +3,5 @@
  * Copyright 2019-2020 The Go Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the LICENSE file.
- */const c=document.querySelector(".JumpDialog"),a=c==null?void 0:c.querySelector(".JumpDialog-body"),o=c==null?void 0:c.querySelector(".JumpDialog-list"),r=c==null?void 0:c.querySelector(".JumpDialog-input"),L=document.querySelector(".js-documentation");let s;function w(){const t=[];if(!!L){for(const e of L.querySelectorAll("[data-kind]"))t.push(M(e));for(const e of t)e.link.addEventListener("click",function(){c==null||c.close()});return t.sort(function(e,n){return e.lower.localeCompare(n.lower)}),t}}function M(t){var m;const e=document.createElement("a"),n=t.getAttribute("id");e.setAttribute("href","#"+n),e.setAttribute("tabindex","-1"),e.setAttribute("data-gtmc","jump to link");const l=t.getAttribute("data-kind");return{link:e,name:n!=null?n:"",kind:l!=null?l:"",lower:(m=n==null?void 0:n.toLowerCase())!=null?m:""}}let v,f=-1;function T(t){for(v=t,s||(s=w()),k(-1);o==null?void 0:o.firstChild;)o.firstChild.remove();if(t){const e=t.toLowerCase(),n=[],l=[],m=[],p=(i,u,d)=>i.name.substring(0,u)+"<b>"+i.name.substring(u,d)+"</b>"+i.name.substring(d);for(const i of s!=null?s:[]){const u=i.name.toLowerCase();if(u===e)i.link.innerHTML=p(i,0,i.name.length),n.push(i);else if(u.startsWith(e))i.link.innerHTML=p(i,0,t.length),l.push(i);else{const d=u.indexOf(e);d>-1&&(i.link.innerHTML=p(i,d,d+t.length),m.push(i))}}for(const i of n.concat(l).concat(m))o==null||o.appendChild(i.link)}else{if(!s||s.length===0){const e=document.createElement("i");e.innerHTML="There are no symbols on this page.",o==null||o.appendChild(e)}for(const e of s!=null?s:[])e.link.innerHTML=e.name+" <i>"+e.kind+"</i>",o==null||o.appendChild(e.link)}a&&(a.scrollTop=0),(s==null?void 0:s.length)&&o&&o.children.length>0&&k(0)}function k(t){const e=o==null?void 0:o.children;if(!(!e||!a)){if(f>=0&&e[f].classList.remove("JumpDialog-active"),t>=e.length&&(t=e.length-1),t>=0){e[t].classList.add("JumpDialog-active");const n=e[t].offsetTop-e[0].offsetTop,l=n+e[t].clientHeight;n<a.scrollTop?a.scrollTop=n:l>a.scrollTop+a.clientHeight&&(a.scrollTop=l-a.clientHeight)}f=t}}function E(t){if(f<0)return;let e=f+t;e<0&&(e=0),k(e)}r==null||r.addEventListener("keyup",function(){r.value.toUpperCase()!=v.toUpperCase()&&T(r.value)}),r==null||r.addEventListener("keydown",function(t){const e=38,n=40,l=13;switch(t.which){case e:E(-1),t.preventDefault();break;case n:E(1),t.preventDefault();break;case l:f>=0&&o&&(o.children[f].click(),t.preventDefault());break}});const h=document.querySelector(".ShortcutsDialog");document.addEventListener("keypress",function(t){if((c==null?void 0:c.open)||(h==null?void 0:h.open))return;const e=t.target,n=e==null?void 0:e.tagName;if(n=="INPUT"||n=="SELECT"||n=="TEXTAREA"||(e==null?void 0:e.contentEditable)=="true"||t.metaKey||t.ctrlKey)return;switch(String.fromCharCode(t.which)){case"f":case"F":t.preventDefault(),r&&(r.value=""),c==null||c.showModal(),r==null||r.focus(),T("");break;case"?":h==null||h.showModal();break}});const b=document.querySelector(".js-jumpToInput");b&&b.addEventListener("click",()=>{r&&(r.value=""),T("")});
+ */const c=document.querySelector(".JumpDialog"),f=c==null?void 0:c.querySelector(".JumpDialog-body"),o=c==null?void 0:c.querySelector(".JumpDialog-list"),s=c==null?void 0:c.querySelector(".JumpDialog-input"),k=document.querySelector(".js-documentation");let l;function E(){const t=[];if(!!k){for(const e of k.querySelectorAll("[data-kind]"))t.push(M(e));for(const e of t)e.link.addEventListener("click",function(){c==null||c.close()});return t.sort(function(e,n){return e.lower.localeCompare(n.lower)}),t}}function M(t){var a;const e=document.createElement("a"),n=t.getAttribute("id");e.setAttribute("href","#"+n),e.setAttribute("tabindex","-1"),e.setAttribute("data-gtmc","jump to link");const i=t.getAttribute("data-kind");return{link:e,name:n!=null?n:"",kind:i!=null?i:"",lower:(a=n==null?void 0:n.toLowerCase())!=null?a:""}}let v,u=-1;function p(t){for(v=t,l||(l=E()),T(-1);o==null?void 0:o.firstChild;)o.firstChild.remove();if(t){const e=t.toLowerCase(),n=[],i=[],a=[],d=(r,h,m)=>r.name.substring(0,h)+"<b>"+r.name.substring(h,m)+"</b>"+r.name.substring(m);for(const r of l!=null?l:[]){const h=r.name.toLowerCase();if(h===e)r.link.innerHTML=d(r,0,r.name.length),n.push(r);else if(h.startsWith(e))r.link.innerHTML=d(r,0,t.length),i.push(r);else{const m=h.indexOf(e);m>-1&&(r.link.innerHTML=d(r,m,m+t.length),a.push(r))}}for(const r of n.concat(i).concat(a))o==null||o.appendChild(r.link)}else{if(!l||l.length===0){const e=document.createElement("i");e.innerHTML="There are no symbols on this page.",o==null||o.appendChild(e)}for(const e of l!=null?l:[])e.link.innerHTML=e.name+" <i>"+e.kind+"</i>",o==null||o.appendChild(e.link)}f&&(f.scrollTop=0),(l==null?void 0:l.length)&&o&&o.children.length>0&&T(0)}function T(t){const e=o==null?void 0:o.children;if(!(!e||!f)){if(u>=0&&e[u].classList.remove("JumpDialog-active"),t>=e.length&&(t=e.length-1),t>=0){e[t].classList.add("JumpDialog-active");const n=e[t].offsetTop-e[0].offsetTop,i=n+e[t].clientHeight;n<f.scrollTop?f.scrollTop=n:i>f.scrollTop+f.clientHeight&&(f.scrollTop=i-f.clientHeight)}u=t}}function L(t){if(u<0)return;let e=u+t;e<0&&(e=0),T(e)}function b(){s==null||s.addEventListener("keyup",function(){s.value.toUpperCase()!=v.toUpperCase()&&p(s.value)}),s==null||s.addEventListener("keydown",function(n){const i=38,a=40,d=13;switch(n.which){case i:L(-1),n.preventDefault();break;case a:L(1),n.preventDefault();break;case d:u>=0&&o&&(o.children[u].click(),n.preventDefault());break}});const t=document.querySelector(".ShortcutsDialog");document.addEventListener("keypress",function(n){if((c==null?void 0:c.open)||(t==null?void 0:t.open))return;const i=n.target,a=i==null?void 0:i.tagName;if(a=="INPUT"||a=="SELECT"||a=="TEXTAREA"||(i==null?void 0:i.contentEditable)=="true"||n.metaKey||n.ctrlKey)return;switch(String.fromCharCode(n.which)){case"f":case"F":n.preventDefault(),s&&(s.value=""),c==null||c.showModal(),s==null||s.focus(),p("");break;case"?":t==null||t.showModal();break}});const e=document.querySelector(".js-jumpToInput");e&&e.addEventListener("click",()=>{s&&(s.value=""),p("")})}export{b as initModals};
 //# sourceMappingURL=jump.js.map
diff --git a/static/shared/jump/jump.js.map b/static/shared/jump/jump.js.map
index 4ff645d..d39336b 100644
--- a/static/shared/jump/jump.js.map
+++ b/static/shared/jump/jump.js.map
@@ -1,7 +1,7 @@
 {
   "version": 3,
   "sources": ["jump.ts"],
-  "sourcesContent": ["/*!\n * @license\n * Copyright 2019-2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the behavior of the \"jump to symbol\" dialog for Go\n// package documentation, as well as the simple dialog that displays keyboard\n// shortcuts.\n\n// The DOM for the dialogs is at the bottom of static/frontend/unit/main/_modals.tmpl.\n// The CSS is in static/frontend/unit/main/_modals.css.\n\n// The dialog is activated by pressing the 'f' key. It presents a list\n// (#JumpDialog-list) of all Go symbols displayed in the documentation.\n// Entering text in the dialog's text box (#JumpDialog-filter) restricts the\n// list to symbols containing the text. Clicking on an symbol jumps to\n// its documentation.\n\n// This code is based on\n// https://go.googlesource.com/gddo/+/refs/heads/master/gddo-server/assets/site.js.\n// It was modified to remove the dependence on jquery and bootstrap.\n\nconst jumpDialog = document.querySelector<HTMLDialogElement>('.JumpDialog');\nconst jumpBody = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-body');\nconst jumpList = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-list');\nconst jumpFilter = jumpDialog?.querySelector<HTMLInputElement>('.JumpDialog-input');\nconst doc = document.querySelector<HTMLDivElement>('.js-documentation');\n\ninterface JumpListItem {\n  link: HTMLAnchorElement;\n  name: string;\n  kind: string;\n  lower: string;\n}\n\nlet jumpListItems: JumpListItem[] | undefined; // All the symbols in the doc; computed only once.\n\n// collectJumpListItems returns a list of items, one for each symbol in the\n// documentation on the current page.\n//\n// It uses the data-kind attribute generated in the documentation HTML to find\n// the symbols and their id attributes.\n//\n// If there are no data-kind attributes, then we have older doc; fall back to\n// a less precise method.\nfunction collectJumpListItems() {\n  const items = [];\n  if (!doc) return;\n  for (const el of doc.querySelectorAll('[data-kind]')) {\n    items.push(newJumpListItem(el));\n  }\n\n  // Clicking on any of the links closes the dialog.\n  for (const item of items) {\n    item.link.addEventListener('click', function () {\n      jumpDialog?.close();\n    });\n  }\n  // Sort case-insensitively by symbol name.\n  items.sort(function (a, b) {\n    return a.lower.localeCompare(b.lower);\n  });\n  return items;\n}\n\n// newJumpListItem creates a new item for the DOM element el.\n// An item is an object with:\n// - name: the element's id (which is the symbol name)\n// - kind: the element's kind (function, variable, etc.),\n// - link: a link ('a' tag) to the element\n// - lower: the name in lower case, just for sorting\nfunction newJumpListItem(el: Element): JumpListItem {\n  const a = document.createElement('a');\n  const name = el.getAttribute('id');\n  a.setAttribute('href', '#' + name);\n  a.setAttribute('tabindex', '-1');\n  a.setAttribute('data-gtmc', 'jump to link');\n  const kind = el.getAttribute('data-kind');\n  return {\n    link: a,\n    name: name ?? '',\n    kind: kind ?? '',\n    lower: name?.toLowerCase() ?? '', // for sorting\n  };\n}\n\nlet lastFilterValue: string; // The last contents of the filter text box.\nlet activeJumpItem = -1; // The index of the currently active item in the list.\n\n// updateJumpList sets the elements of the dialog list to\n// everything whose name contains filter.\nfunction updateJumpList(filter: string) {\n  lastFilterValue = filter;\n  if (!jumpListItems) {\n    jumpListItems = collectJumpListItems();\n  }\n  setActiveJumpItem(-1);\n\n  // Remove all children from list.\n  while (jumpList?.firstChild) {\n    jumpList.firstChild.remove();\n  }\n\n  if (filter) {\n    // A filter is set. We treat the filter as a substring that can appear in\n    // an item name (case insensitive), and find the following matches - in\n    // order of priority:\n    //\n    // 1. Exact matches (the filter matches the item's name exactly)\n    // 2. Prefix matches (the item's name starts with filter)\n    // 3. Infix matches (the filter is a substring of the item's name)\n    const filterLowerCase = filter.toLowerCase();\n\n    const exactMatches = [];\n    const prefixMatches = [];\n    const infixMatches = [];\n\n    // makeLinkHtml creates the link name HTML for a list item. item is the DOM\n    // item. item.name.substr(boldStart, boldEnd) will be bolded.\n    const makeLinkHtml = (item: JumpListItem, boldStart: number, boldEnd: number) => {\n      return (\n        item.name.substring(0, boldStart) +\n        '<b>' +\n        item.name.substring(boldStart, boldEnd) +\n        '</b>' +\n        item.name.substring(boldEnd)\n      );\n    };\n\n    for (const item of jumpListItems ?? []) {\n      const nameLowerCase = item.name.toLowerCase();\n\n      if (nameLowerCase === filterLowerCase) {\n        item.link.innerHTML = makeLinkHtml(item, 0, item.name.length);\n        exactMatches.push(item);\n      } else if (nameLowerCase.startsWith(filterLowerCase)) {\n        item.link.innerHTML = makeLinkHtml(item, 0, filter.length);\n        prefixMatches.push(item);\n      } else {\n        const index = nameLowerCase.indexOf(filterLowerCase);\n        if (index > -1) {\n          item.link.innerHTML = makeLinkHtml(item, index, index + filter.length);\n          infixMatches.push(item);\n        }\n      }\n    }\n\n    for (const item of exactMatches.concat(prefixMatches).concat(infixMatches)) {\n      jumpList?.appendChild(item.link);\n    }\n  } else {\n    if (!jumpListItems || jumpListItems.length === 0) {\n      const msg = document.createElement('i');\n      msg.innerHTML = 'There are no symbols on this page.';\n      jumpList?.appendChild(msg);\n    }\n    // No filter set; display all items in their existing order.\n    for (const item of jumpListItems ?? []) {\n      item.link.innerHTML = item.name + ' <i>' + item.kind + '</i>';\n      jumpList?.appendChild(item.link);\n    }\n  }\n\n  if (jumpBody) {\n    jumpBody.scrollTop = 0;\n  }\n  if (jumpListItems?.length && jumpList && jumpList.children.length > 0) {\n    setActiveJumpItem(0);\n  }\n}\n\n// Set the active jump item to n.\nfunction setActiveJumpItem(n: number) {\n  const cs = jumpList?.children as HTMLCollectionOf<HTMLElement> | null | undefined;\n  if (!cs || !jumpBody) {\n    return;\n  }\n  if (activeJumpItem >= 0) {\n    cs[activeJumpItem].classList.remove('JumpDialog-active');\n  }\n  if (n >= cs.length) {\n    n = cs.length - 1;\n  }\n  if (n >= 0) {\n    cs[n].classList.add('JumpDialog-active');\n\n    // Scroll so the active item is visible.\n    // For some reason cs[n].scrollIntoView() doesn't behave as I'd expect:\n    // it moves the entire dialog box in the viewport.\n\n    // Get the top and bottom of the active item relative to jumpBody.\n    const activeTop = cs[n].offsetTop - cs[0].offsetTop;\n    const activeBottom = activeTop + cs[n].clientHeight;\n    if (activeTop < jumpBody.scrollTop) {\n      // Off the top; scroll up.\n      jumpBody.scrollTop = activeTop;\n    } else if (activeBottom > jumpBody.scrollTop + jumpBody.clientHeight) {\n      // Off the bottom; scroll down.\n      jumpBody.scrollTop = activeBottom - jumpBody.clientHeight;\n    }\n  }\n  activeJumpItem = n;\n}\n\n// Increment the activeJumpItem by delta.\nfunction incActiveJumpItem(delta: number) {\n  if (activeJumpItem < 0) {\n    return;\n  }\n  let n = activeJumpItem + delta;\n  if (n < 0) {\n    n = 0;\n  }\n  setActiveJumpItem(n);\n}\n\n// Pressing a key in the filter updates the list (if the filter actually changed).\njumpFilter?.addEventListener('keyup', function () {\n  if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {\n    updateJumpList(jumpFilter.value);\n  }\n});\n\n// Pressing enter in the filter selects the first element in the list.\njumpFilter?.addEventListener('keydown', function (event) {\n  const upArrow = 38;\n  const downArrow = 40;\n  const enterKey = 13;\n  switch (event.which) {\n    case upArrow:\n      incActiveJumpItem(-1);\n      event.preventDefault();\n      break;\n    case downArrow:\n      incActiveJumpItem(1);\n      event.preventDefault();\n      break;\n    case enterKey:\n      if (activeJumpItem >= 0) {\n        if (jumpList) {\n          (jumpList.children[activeJumpItem] as HTMLElement).click();\n          event.preventDefault();\n        }\n      }\n      break;\n  }\n});\n\nconst shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');\n\n// Keyboard shortcuts:\n// - Pressing '/' focuses the search box\n// - Pressing 'f' or 'F' opens the jump-to-symbol dialog.\n// - Pressing '?' opens up the shortcut dialog.\n// Ignore a keypress if a dialog is already open, or if it is pressed on a\n// component that wants to consume it.\ndocument.addEventListener('keypress', function (e) {\n  if (jumpDialog?.open || shortcutsDialog?.open) {\n    return;\n  }\n  const target = e.target as HTMLElement | null;\n  const t = target?.tagName;\n  if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {\n    return;\n  }\n  if (target?.contentEditable == 'true') {\n    return;\n  }\n  if (e.metaKey || e.ctrlKey) {\n    return;\n  }\n  const ch = String.fromCharCode(e.which);\n  switch (ch) {\n    case 'f':\n    case 'F':\n      e.preventDefault();\n      if (jumpFilter) {\n        jumpFilter.value = '';\n      }\n      jumpDialog?.showModal();\n      jumpFilter?.focus();\n      updateJumpList('');\n      break;\n    case '?':\n      shortcutsDialog?.showModal();\n      break;\n  }\n});\n\nconst jumpOutlineInput = document.querySelector('.js-jumpToInput');\nif (jumpOutlineInput) {\n  jumpOutlineInput.addEventListener('click', () => {\n    if (jumpFilter) {\n      jumpFilter.value = '';\n    }\n    updateJumpList('');\n  });\n}\n\nexport {};\n"],
-  "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAwBA,KAAM,GAAa,SAAS,cAAiC,eACvD,EAAW,iBAAY,cAA8B,oBACrD,EAAW,iBAAY,cAA8B,oBACrD,EAAa,iBAAY,cAAgC,qBACzD,EAAM,SAAS,cAA8B,qBASnD,GAAI,GAUJ,YAAgC,CAC9B,KAAM,GAAQ,GACd,GAAI,EAAC,EACL,UAAW,KAAM,GAAI,iBAAiB,eACpC,EAAM,KAAK,EAAgB,IAI7B,SAAW,KAAQ,GACjB,EAAK,KAAK,iBAAiB,QAAS,UAAY,CAC9C,WAAY,UAIhB,SAAM,KAAK,SAAU,EAAG,EAAG,CACzB,MAAO,GAAE,MAAM,cAAc,EAAE,SAE1B,GAST,WAAyB,EAA2B,CAzEpD,MA0EE,KAAM,GAAI,SAAS,cAAc,KAC3B,EAAO,EAAG,aAAa,MAC7B,EAAE,aAAa,OAAQ,IAAM,GAC7B,EAAE,aAAa,WAAY,MAC3B,EAAE,aAAa,YAAa,gBAC5B,KAAM,GAAO,EAAG,aAAa,aAC7B,MAAO,CACL,KAAM,EACN,KAAM,UAAQ,GACd,KAAM,UAAQ,GACd,MAAO,oBAAM,gBAAN,OAAuB,IAIlC,GAAI,GACA,EAAiB,GAIrB,WAAwB,EAAgB,CAQtC,IAPA,EAAkB,EACb,GACH,GAAgB,KAElB,EAAkB,IAGX,iBAAU,YACf,EAAS,WAAW,SAGtB,GAAI,EAAQ,CAQV,KAAM,GAAkB,EAAO,cAEzB,EAAe,GACf,EAAg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Z,EAAe,EAAS,UAAY,EAAS,cAEtD,GAAS,UAAY,EAAe,EAAS,cAGjD,EAAiB,GAInB,WAA2B,EAAe,CACxC,GAAI,EAAiB,EACnB,OAEF,GAAI,GAAI,EAAiB,EACzB,AAAI,EAAI,GACN,GAAI,GAEN,EAAkB,GAIpB,WAAY,iBAAiB,QAAS,UAAY,CAChD,AAAI,EAAW,MAAM,eAAiB,EAAgB,eACpD,EAAe,EAAW,SAK9B,WAAY,iBAAiB,UAAW,SAAU,EAAO,CACvD,KAAM,GAAU,GACV,EAAY,GACZ,EAAW,GACjB,OAAQ,EAAM,WACP,GACH,EAAkB,IAClB,EAAM,iBACN,UACG,GACH,EAAkB,GAClB,EAAM,iBACN,UACG,GACH,AAAI,GAAkB,GAChB,GACD,GAAS,SAAS,GAAgC,QACnD,EAAM,kBAGV,SAIN,KAAM,GAAkB,SAAS,cAAiC,oBAQlE,SAAS,iBAAiB,WAAY,SAAU,EAAG,CACjD,GAAI,kBAAY,OAAQ,kBAAiB,MACvC,OAEF,KAAM,GAAS,EAAE,OACX,EAAI,iBAAQ,QAOlB,GANI,GAAK,SAAW,GAAK,UAAY,GAAK,YAGtC,kBAAQ,kBAAmB,QAG3B,EAAE,SAAW,EAAE,QACjB,OAGF,OADW,OAAO,aAAa,EAAE,YAE1B,QACA,IACH,EAAE,iBACE,GACF,GAAW,MAAQ,IAErB,WAAY,YACZ,WAAY,QACZ,EAAe,IACf,UACG,IACH,WAAiB,YACjB,SAIN,KAAM,GAAmB,SAAS,cAAc,mBAChD,AAAI,GACF,EAAiB,iBAAiB,QAAS,IAAM,CAC/C,AAAI,GACF,GAAW,MAAQ,IAErB,EAAe",
+  "sourcesContent": ["/*!\n * @license\n * Copyright 2019-2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the behavior of the \"jump to symbol\" dialog for Go\n// package documentation, as well as the simple dialog that displays keyboard\n// shortcuts.\n\n// The DOM for the dialogs is at the bottom of static/frontend/unit/main/_modals.tmpl.\n// The CSS is in static/frontend/unit/main/_modals.css.\n\n// The dialog is activated by pressing the 'f' key. It presents a list\n// (#JumpDialog-list) of all Go symbols displayed in the documentation.\n// Entering text in the dialog's text box (#JumpDialog-filter) restricts the\n// list to symbols containing the text. Clicking on an symbol jumps to\n// its documentation.\n\n// This code is based on\n// https://go.googlesource.com/gddo/+/refs/heads/master/gddo-server/assets/site.js.\n// It was modified to remove the dependence on jquery and bootstrap.\n\nconst jumpDialog = document.querySelector<HTMLDialogElement>('.JumpDialog');\nconst jumpBody = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-body');\nconst jumpList = jumpDialog?.querySelector<HTMLDivElement>('.JumpDialog-list');\nconst jumpFilter = jumpDialog?.querySelector<HTMLInputElement>('.JumpDialog-input');\nconst doc = document.querySelector<HTMLDivElement>('.js-documentation');\n\ninterface JumpListItem {\n  link: HTMLAnchorElement;\n  name: string;\n  kind: string;\n  lower: string;\n}\n\nlet jumpListItems: JumpListItem[] | undefined; // All the symbols in the doc; computed only once.\n\n// collectJumpListItems returns a list of items, one for each symbol in the\n// documentation on the current page.\n//\n// It uses the data-kind attribute generated in the documentation HTML to find\n// the symbols and their id attributes.\n//\n// If there are no data-kind attributes, then we have older doc; fall back to\n// a less precise method.\nfunction collectJumpListItems() {\n  const items = [];\n  if (!doc) return;\n  for (const el of doc.querySelectorAll('[data-kind]')) {\n    items.push(newJumpListItem(el));\n  }\n\n  // Clicking on any of the links closes the dialog.\n  for (const item of items) {\n    item.link.addEventListener('click', function () {\n      jumpDialog?.close();\n    });\n  }\n  // Sort case-insensitively by symbol name.\n  items.sort(function (a, b) {\n    return a.lower.localeCompare(b.lower);\n  });\n  return items;\n}\n\n// newJumpListItem creates a new item for the DOM element el.\n// An item is an object with:\n// - name: the element's id (which is the symbol name)\n// - kind: the element's kind (function, variable, etc.),\n// - link: a link ('a' tag) to the element\n// - lower: the name in lower case, just for sorting\nfunction newJumpListItem(el: Element): JumpListItem {\n  const a = document.createElement('a');\n  const name = el.getAttribute('id');\n  a.setAttribute('href', '#' + name);\n  a.setAttribute('tabindex', '-1');\n  a.setAttribute('data-gtmc', 'jump to link');\n  const kind = el.getAttribute('data-kind');\n  return {\n    link: a,\n    name: name ?? '',\n    kind: kind ?? '',\n    lower: name?.toLowerCase() ?? '', // for sorting\n  };\n}\n\nlet lastFilterValue: string; // The last contents of the filter text box.\nlet activeJumpItem = -1; // The index of the currently active item in the list.\n\n// updateJumpList sets the elements of the dialog list to\n// everything whose name contains filter.\nfunction updateJumpList(filter: string) {\n  lastFilterValue = filter;\n  if (!jumpListItems) {\n    jumpListItems = collectJumpListItems();\n  }\n  setActiveJumpItem(-1);\n\n  // Remove all children from list.\n  while (jumpList?.firstChild) {\n    jumpList.firstChild.remove();\n  }\n\n  if (filter) {\n    // A filter is set. We treat the filter as a substring that can appear in\n    // an item name (case insensitive), and find the following matches - in\n    // order of priority:\n    //\n    // 1. Exact matches (the filter matches the item's name exactly)\n    // 2. Prefix matches (the item's name starts with filter)\n    // 3. Infix matches (the filter is a substring of the item's name)\n    const filterLowerCase = filter.toLowerCase();\n\n    const exactMatches = [];\n    const prefixMatches = [];\n    const infixMatches = [];\n\n    // makeLinkHtml creates the link name HTML for a list item. item is the DOM\n    // item. item.name.substr(boldStart, boldEnd) will be bolded.\n    const makeLinkHtml = (item: JumpListItem, boldStart: number, boldEnd: number) => {\n      return (\n        item.name.substring(0, boldStart) +\n        '<b>' +\n        item.name.substring(boldStart, boldEnd) +\n        '</b>' +\n        item.name.substring(boldEnd)\n      );\n    };\n\n    for (const item of jumpListItems ?? []) {\n      const nameLowerCase = item.name.toLowerCase();\n\n      if (nameLowerCase === filterLowerCase) {\n        item.link.innerHTML = makeLinkHtml(item, 0, item.name.length);\n        exactMatches.push(item);\n      } else if (nameLowerCase.startsWith(filterLowerCase)) {\n        item.link.innerHTML = makeLinkHtml(item, 0, filter.length);\n        prefixMatches.push(item);\n      } else {\n        const index = nameLowerCase.indexOf(filterLowerCase);\n        if (index > -1) {\n          item.link.innerHTML = makeLinkHtml(item, index, index + filter.length);\n          infixMatches.push(item);\n        }\n      }\n    }\n\n    for (const item of exactMatches.concat(prefixMatches).concat(infixMatches)) {\n      jumpList?.appendChild(item.link);\n    }\n  } else {\n    if (!jumpListItems || jumpListItems.length === 0) {\n      const msg = document.createElement('i');\n      msg.innerHTML = 'There are no symbols on this page.';\n      jumpList?.appendChild(msg);\n    }\n    // No filter set; display all items in their existing order.\n    for (const item of jumpListItems ?? []) {\n      item.link.innerHTML = item.name + ' <i>' + item.kind + '</i>';\n      jumpList?.appendChild(item.link);\n    }\n  }\n\n  if (jumpBody) {\n    jumpBody.scrollTop = 0;\n  }\n  if (jumpListItems?.length && jumpList && jumpList.children.length > 0) {\n    setActiveJumpItem(0);\n  }\n}\n\n// Set the active jump item to n.\nfunction setActiveJumpItem(n: number) {\n  const cs = jumpList?.children as HTMLCollectionOf<HTMLElement> | null | undefined;\n  if (!cs || !jumpBody) {\n    return;\n  }\n  if (activeJumpItem >= 0) {\n    cs[activeJumpItem].classList.remove('JumpDialog-active');\n  }\n  if (n >= cs.length) {\n    n = cs.length - 1;\n  }\n  if (n >= 0) {\n    cs[n].classList.add('JumpDialog-active');\n\n    // Scroll so the active item is visible.\n    // For some reason cs[n].scrollIntoView() doesn't behave as I'd expect:\n    // it moves the entire dialog box in the viewport.\n\n    // Get the top and bottom of the active item relative to jumpBody.\n    const activeTop = cs[n].offsetTop - cs[0].offsetTop;\n    const activeBottom = activeTop + cs[n].clientHeight;\n    if (activeTop < jumpBody.scrollTop) {\n      // Off the top; scroll up.\n      jumpBody.scrollTop = activeTop;\n    } else if (activeBottom > jumpBody.scrollTop + jumpBody.clientHeight) {\n      // Off the bottom; scroll down.\n      jumpBody.scrollTop = activeBottom - jumpBody.clientHeight;\n    }\n  }\n  activeJumpItem = n;\n}\n\n// Increment the activeJumpItem by delta.\nfunction incActiveJumpItem(delta: number) {\n  if (activeJumpItem < 0) {\n    return;\n  }\n  let n = activeJumpItem + delta;\n  if (n < 0) {\n    n = 0;\n  }\n  setActiveJumpItem(n);\n}\n\nexport function initModals(): void {\n  // Pressing a key in the filter updates the list (if the filter actually changed).\n  jumpFilter?.addEventListener('keyup', function () {\n    if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {\n      updateJumpList(jumpFilter.value);\n    }\n  });\n\n  // Pressing enter in the filter selects the first element in the list.\n  jumpFilter?.addEventListener('keydown', function (event) {\n    const upArrow = 38;\n    const downArrow = 40;\n    const enterKey = 13;\n    switch (event.which) {\n      case upArrow:\n        incActiveJumpItem(-1);\n        event.preventDefault();\n        break;\n      case downArrow:\n        incActiveJumpItem(1);\n        event.preventDefault();\n        break;\n      case enterKey:\n        if (activeJumpItem >= 0) {\n          if (jumpList) {\n            (jumpList.children[activeJumpItem] as HTMLElement).click();\n            event.preventDefault();\n          }\n        }\n        break;\n    }\n  });\n\n  const shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');\n\n  // Keyboard shortcuts:\n  // - Pressing '/' focuses the search box\n  // - Pressing 'f' or 'F' opens the jump-to-symbol dialog.\n  // - Pressing '?' opens up the shortcut dialog.\n  // Ignore a keypress if a dialog is already open, or if it is pressed on a\n  // component that wants to consume it.\n  document.addEventListener('keypress', function (e) {\n    if (jumpDialog?.open || shortcutsDialog?.open) {\n      return;\n    }\n    const target = e.target as HTMLElement | null;\n    const t = target?.tagName;\n    if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {\n      return;\n    }\n    if (target?.contentEditable == 'true') {\n      return;\n    }\n    if (e.metaKey || e.ctrlKey) {\n      return;\n    }\n    const ch = String.fromCharCode(e.which);\n    switch (ch) {\n      case 'f':\n      case 'F':\n        e.preventDefault();\n        if (jumpFilter) {\n          jumpFilter.value = '';\n        }\n        jumpDialog?.showModal();\n        jumpFilter?.focus();\n        updateJumpList('');\n        break;\n      case '?':\n        shortcutsDialog?.showModal();\n        break;\n    }\n  });\n\n  const jumpOutlineInput = document.querySelector('.js-jumpToInput');\n  if (jumpOutlineInput) {\n    jumpOutlineInput.addEventListener('click', () => {\n      if (jumpFilter) {\n        jumpFilter.value = '';\n      }\n      updateJumpList('');\n    });\n  }\n}\n"],
+  "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAwBA,KAAM,GAAa,SAAS,cAAiC,eACvD,EAAW,iBAAY,cAA8B,oBACrD,EAAW,iBAAY,cAA8B,oBACrD,EAAa,iBAAY,cAAgC,qBACzD,EAAM,SAAS,cAA8B,qBASnD,GAAI,GAUJ,YAAgC,CAC9B,KAAM,GAAQ,GACd,GAAI,EAAC,EACL,UAAW,KAAM,GAAI,iBAAiB,eACpC,EAAM,KAAK,EAAgB,IAI7B,SAAW,KAAQ,GACjB,EAAK,KAAK,iBAAiB,QAAS,UAAY,CAC9C,WAAY,UAIhB,SAAM,KAAK,SAAU,EAAG,EAAG,CACzB,MAAO,GAAE,MAAM,cAAc,EAAE,SAE1B,GAST,WAAyB,EAA2B,CAzEpD,MA0EE,KAAM,GAAI,SAAS,cAAc,KAC3B,EAAO,EAAG,aAAa,MAC7B,EAAE,aAAa,OAAQ,IAAM,GAC7B,EAAE,aAAa,WAAY,MAC3B,EAAE,aAAa,YAAa,gBAC5B,KAAM,GAAO,EAAG,aAAa,aAC7B,MAAO,CACL,KAAM,EACN,KAAM,UAAQ,GACd,KAAM,UAAQ,GACd,MAAO,oBAAM,gBAAN,OAAuB,IAIlC,GAAI,GACA,EAAiB,GAIrB,WAAwB,EAAgB,CAQtC,IAPA,EAAkB,EACb,GACH,GAAgB,KAElB,EAAkB,IAGX,iBAAU,YACf,EAAS,WAAW,SAGtB,GAAI,EAAQ,CAQV,KAAM,GAAkB,EAAO,cAEzB,EAAe,GACf,EAAgB,GAChB,EAAe,GAIf,EAAe,CAAC,EAAoB,EAAmB,IAEzD,EAAK,KAAK,UAAU,EAAG,GACvB,MACA,EAAK,KAAK,UAAU,EAAW,GAC/B,OACA,EAA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,GAAI,EAAiB,EACzB,AAAI,EAAI,GACN,GAAI,GAEN,EAAkB,GAGb,YAA4B,CAEjC,WAAY,iBAAiB,QAAS,UAAY,CAChD,AAAI,EAAW,MAAM,eAAiB,EAAgB,eACpD,EAAe,EAAW,SAK9B,WAAY,iBAAiB,UAAW,SAAU,EAAO,CACvD,KAAM,GAAU,GACV,EAAY,GACZ,EAAW,GACjB,OAAQ,EAAM,WACP,GACH,EAAkB,IAClB,EAAM,iBACN,UACG,GACH,EAAkB,GAClB,EAAM,iBACN,UACG,GACH,AAAI,GAAkB,GAChB,GACD,GAAS,SAAS,GAAgC,QACnD,EAAM,kBAGV,SAIN,KAAM,GAAkB,SAAS,cAAiC,oBAQlE,SAAS,iBAAiB,WAAY,SAAU,EAAG,CACjD,GAAI,kBAAY,OAAQ,kBAAiB,MACvC,OAEF,KAAM,GAAS,EAAE,OACX,EAAI,iBAAQ,QAOlB,GANI,GAAK,SAAW,GAAK,UAAY,GAAK,YAGtC,kBAAQ,kBAAmB,QAG3B,EAAE,SAAW,EAAE,QACjB,OAGF,OADW,OAAO,aAAa,EAAE,YAE1B,QACA,IACH,EAAE,iBACE,GACF,GAAW,MAAQ,IAErB,WAAY,YACZ,WAAY,QACZ,EAAe,IACf,UACG,IACH,WAAiB,YACjB,SAIN,KAAM,GAAmB,SAAS,cAAc,mBAChD,AAAI,GACF,EAAiB,iBAAiB,QAAS,IAAM,CAC/C,AAAI,GACF,GAAW,MAAQ,IAErB,EAAe",
   "names": []
 }
diff --git a/static/shared/jump/jump.ts b/static/shared/jump/jump.ts
index 03db6ee..fe4965a 100644
--- a/static/shared/jump/jump.ts
+++ b/static/shared/jump/jump.ts
@@ -216,87 +216,87 @@
   setActiveJumpItem(n);
 }
 
-// Pressing a key in the filter updates the list (if the filter actually changed).
-jumpFilter?.addEventListener('keyup', function () {
-  if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {
-    updateJumpList(jumpFilter.value);
-  }
-});
+export function initModals(): void {
+  // Pressing a key in the filter updates the list (if the filter actually changed).
+  jumpFilter?.addEventListener('keyup', function () {
+    if (jumpFilter.value.toUpperCase() != lastFilterValue.toUpperCase()) {
+      updateJumpList(jumpFilter.value);
+    }
+  });
 
-// Pressing enter in the filter selects the first element in the list.
-jumpFilter?.addEventListener('keydown', function (event) {
-  const upArrow = 38;
-  const downArrow = 40;
-  const enterKey = 13;
-  switch (event.which) {
-    case upArrow:
-      incActiveJumpItem(-1);
-      event.preventDefault();
-      break;
-    case downArrow:
-      incActiveJumpItem(1);
-      event.preventDefault();
-      break;
-    case enterKey:
-      if (activeJumpItem >= 0) {
-        if (jumpList) {
-          (jumpList.children[activeJumpItem] as HTMLElement).click();
-          event.preventDefault();
+  // Pressing enter in the filter selects the first element in the list.
+  jumpFilter?.addEventListener('keydown', function (event) {
+    const upArrow = 38;
+    const downArrow = 40;
+    const enterKey = 13;
+    switch (event.which) {
+      case upArrow:
+        incActiveJumpItem(-1);
+        event.preventDefault();
+        break;
+      case downArrow:
+        incActiveJumpItem(1);
+        event.preventDefault();
+        break;
+      case enterKey:
+        if (activeJumpItem >= 0) {
+          if (jumpList) {
+            (jumpList.children[activeJumpItem] as HTMLElement).click();
+            event.preventDefault();
+          }
         }
-      }
-      break;
-  }
-});
+        break;
+    }
+  });
 
-const shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');
+  const shortcutsDialog = document.querySelector<HTMLDialogElement>('.ShortcutsDialog');
 
-// Keyboard shortcuts:
-// - Pressing '/' focuses the search box
-// - Pressing 'f' or 'F' opens the jump-to-symbol dialog.
-// - Pressing '?' opens up the shortcut dialog.
-// Ignore a keypress if a dialog is already open, or if it is pressed on a
-// component that wants to consume it.
-document.addEventListener('keypress', function (e) {
-  if (jumpDialog?.open || shortcutsDialog?.open) {
-    return;
-  }
-  const target = e.target as HTMLElement | null;
-  const t = target?.tagName;
-  if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {
-    return;
-  }
-  if (target?.contentEditable == 'true') {
-    return;
-  }
-  if (e.metaKey || e.ctrlKey) {
-    return;
-  }
-  const ch = String.fromCharCode(e.which);
-  switch (ch) {
-    case 'f':
-    case 'F':
-      e.preventDefault();
+  // Keyboard shortcuts:
+  // - Pressing '/' focuses the search box
+  // - Pressing 'f' or 'F' opens the jump-to-symbol dialog.
+  // - Pressing '?' opens up the shortcut dialog.
+  // Ignore a keypress if a dialog is already open, or if it is pressed on a
+  // component that wants to consume it.
+  document.addEventListener('keypress', function (e) {
+    if (jumpDialog?.open || shortcutsDialog?.open) {
+      return;
+    }
+    const target = e.target as HTMLElement | null;
+    const t = target?.tagName;
+    if (t == 'INPUT' || t == 'SELECT' || t == 'TEXTAREA') {
+      return;
+    }
+    if (target?.contentEditable == 'true') {
+      return;
+    }
+    if (e.metaKey || e.ctrlKey) {
+      return;
+    }
+    const ch = String.fromCharCode(e.which);
+    switch (ch) {
+      case 'f':
+      case 'F':
+        e.preventDefault();
+        if (jumpFilter) {
+          jumpFilter.value = '';
+        }
+        jumpDialog?.showModal();
+        jumpFilter?.focus();
+        updateJumpList('');
+        break;
+      case '?':
+        shortcutsDialog?.showModal();
+        break;
+    }
+  });
+
+  const jumpOutlineInput = document.querySelector('.js-jumpToInput');
+  if (jumpOutlineInput) {
+    jumpOutlineInput.addEventListener('click', () => {
       if (jumpFilter) {
         jumpFilter.value = '';
       }
-      jumpDialog?.showModal();
-      jumpFilter?.focus();
       updateJumpList('');
-      break;
-    case '?':
-      shortcutsDialog?.showModal();
-      break;
+    });
   }
-});
-
-const jumpOutlineInput = document.querySelector('.js-jumpToInput');
-if (jumpOutlineInput) {
-  jumpOutlineInput.addEventListener('click', () => {
-    if (jumpFilter) {
-      jumpFilter.value = '';
-    }
-    updateJumpList('');
-  });
 }
-
-export {};
diff --git a/static/shared/playground/playground.js b/static/shared/playground/playground.js
index 5f85361..3c28bfe 100644
--- a/static/shared/playground/playground.js
+++ b/static/shared/playground/playground.js
@@ -3,5 +3,5 @@
  * Copyright 2021 The Go Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the LICENSE file.
- */const o={PLAY_HREF:".js-exampleHref",PLAY_CONTAINER:".js-exampleContainer",EXAMPLE_INPUT:".Documentation-exampleCode",EXAMPLE_OUTPUT:".Documentation-exampleOutput",EXAMPLE_ERROR:".Documentation-exampleError",PLAY_BUTTON:".Documentation-examplePlayButton",SHARE_BUTTON:".Documentation-exampleShareButton",FORMAT_BUTTON:".Documentation-exampleFormatButton",RUN_BUTTON:".Documentation-exampleRunButton"};class u{constructor(t){this.exampleEl=t;var e,r,n,l;this.exampleEl=t,this.anchorEl=t.querySelector("a"),this.errorEl=t.querySelector(o.EXAMPLE_ERROR),this.playButtonEl=t.querySelector(o.PLAY_BUTTON),this.shareButtonEl=t.querySelector(o.SHARE_BUTTON),this.formatButtonEl=t.querySelector(o.FORMAT_BUTTON),this.runButtonEl=t.querySelector(o.RUN_BUTTON),this.inputEl=this.makeTextArea(t.querySelector(o.EXAMPLE_INPUT)),this.outputEl=t.querySelector(o.EXAMPLE_OUTPUT),(e=this.playButtonEl)==null||e.addEventListener("click",()=>this.handleShareButtonClick()),(r=this.shareButtonEl)==null||r.addEventListener("click",()=>this.handleShareButtonClick()),(n=this.formatButtonEl)==null||n.addEventListener("click",()=>this.handleFormatButtonClick()),(l=this.runButtonEl)==null||l.addEventListener("click",()=>this.handleRunButtonClick()),!!this.inputEl&&(this.resize(),this.inputEl.addEventListener("keyup",()=>this.resize()),this.inputEl.addEventListener("keydown",s=>this.onKeydown(s)))}makeTextArea(t){var r,n;const e=document.createElement("textarea");return e.classList.add("Documentation-exampleCode","code"),e.spellcheck=!1,e.value=(r=t==null?void 0:t.textContent)!=null?r:"",(n=t==null?void 0:t.parentElement)==null||n.replaceChild(e,t),e}getAnchorHash(){var t;return(t=this.anchorEl)==null?void 0:t.hash}expand(){this.exampleEl.open=!0}resize(){var t;if((t=this.inputEl)==null?void 0:t.value){const e=(this.inputEl.value.match(/\n/g)||[]).length;this.inputEl.style.height=`${(20+e*20+12+2)/16}rem`}}onKeydown(t){t.key==="Tab"&&(document.execCommand("insertText",!1,"	"),t.preventDefault())}setInputText(t){this.inputEl&&(this.inputEl.value=t)}setOutputText(t){this.outputEl&&(this.outputEl.textContent=t)}setErrorText(t){this.errorEl&&(this.errorEl.textContent=t),this.setOutputText("An error has occurred\u2026")}handleShareButtonClick(){var e;const t="https://play.golang.org/p/";this.setOutputText("Waiting for remote server\u2026"),fetch("/play/share",{method:"POST",body:(e=this.inputEl)==null?void 0:e.value}).then(r=>r.text()).then(r=>{const n=t+r;this.setOutputText(`<a href="${n}">${n}</a>`),window.open(n)}).catch(r=>{this.setErrorText(r)})}handleFormatButtonClick(){var e,r;this.setOutputText("Waiting for remote server\u2026");const t=new FormData;t.append("body",(r=(e=this.inputEl)==null?void 0:e.value)!=null?r:""),fetch("/play/fmt",{method:"POST",body:t}).then(n=>n.json()).then(({Body:n,Error:l})=>{this.setOutputText(l||"Done."),n&&(this.setInputText(n),this.resize())}).catch(n=>{this.setErrorText(n)})}handleRunButtonClick(){var t;this.setOutputText("Waiting for remote server\u2026"),fetch("/play/compile",{method:"POST",body:JSON.stringify({body:(t=this.inputEl)==null?void 0:t.value,version:2})}).then(e=>e.json()).then(async({Events:e,Errors:r})=>{this.setOutputText(r||"");for(const n of e||[])this.setOutputText(n.Message),await new Promise(l=>setTimeout(l,n.Delay/1e6))}).catch(e=>{this.setErrorText(e)})}}const i=location.hash.match(/^#(example-.*)$/);if(i){const a=document.getElementById(i[1]);a&&(a.open=!0)}const h=[...document.querySelectorAll(o.PLAY_HREF)],c=a=>h.find(t=>t.hash===a.getAnchorHash());for(const a of document.querySelectorAll(o.PLAY_CONTAINER)){const t=new u(a),e=c(t);e?e.addEventListener("click",()=>{t.expand()}):console.warn("example href not found")}export{u as PlaygroundExampleController};
+ */const a={PLAY_HREF:".js-exampleHref",PLAY_CONTAINER:".js-exampleContainer",EXAMPLE_INPUT:".Documentation-exampleCode",EXAMPLE_OUTPUT:".Documentation-exampleOutput",EXAMPLE_ERROR:".Documentation-exampleError",PLAY_BUTTON:".Documentation-examplePlayButton",SHARE_BUTTON:".Documentation-exampleShareButton",FORMAT_BUTTON:".Documentation-exampleFormatButton",RUN_BUTTON:".Documentation-exampleRunButton"};class s{constructor(t){this.exampleEl=t;var e,r,n,o;this.exampleEl=t,this.anchorEl=t.querySelector("a"),this.errorEl=t.querySelector(a.EXAMPLE_ERROR),this.playButtonEl=t.querySelector(a.PLAY_BUTTON),this.shareButtonEl=t.querySelector(a.SHARE_BUTTON),this.formatButtonEl=t.querySelector(a.FORMAT_BUTTON),this.runButtonEl=t.querySelector(a.RUN_BUTTON),this.inputEl=this.makeTextArea(t.querySelector(a.EXAMPLE_INPUT)),this.outputEl=t.querySelector(a.EXAMPLE_OUTPUT),(e=this.playButtonEl)==null||e.addEventListener("click",()=>this.handleShareButtonClick()),(r=this.shareButtonEl)==null||r.addEventListener("click",()=>this.handleShareButtonClick()),(n=this.formatButtonEl)==null||n.addEventListener("click",()=>this.handleFormatButtonClick()),(o=this.runButtonEl)==null||o.addEventListener("click",()=>this.handleRunButtonClick()),!!this.inputEl&&(this.resize(),this.inputEl.addEventListener("keyup",()=>this.resize()),this.inputEl.addEventListener("keydown",l=>this.onKeydown(l)))}makeTextArea(t){var r,n;const e=document.createElement("textarea");return e.classList.add("Documentation-exampleCode","code"),e.spellcheck=!1,e.value=(r=t==null?void 0:t.textContent)!=null?r:"",(n=t==null?void 0:t.parentElement)==null||n.replaceChild(e,t),e}getAnchorHash(){var t;return(t=this.anchorEl)==null?void 0:t.hash}expand(){this.exampleEl.open=!0}resize(){var t;if((t=this.inputEl)==null?void 0:t.value){const e=(this.inputEl.value.match(/\n/g)||[]).length;this.inputEl.style.height=`${(20+e*20+12+2)/16}rem`}}onKeydown(t){t.key==="Tab"&&(document.execCommand("insertText",!1,"	"),t.preventDefault())}setInputText(t){this.inputEl&&(this.inputEl.value=t)}setOutputText(t){this.outputEl&&(this.outputEl.textContent=t)}setErrorText(t){this.errorEl&&(this.errorEl.textContent=t),this.setOutputText("An error has occurred\u2026")}handleShareButtonClick(){var e;const t="https://play.golang.org/p/";this.setOutputText("Waiting for remote server\u2026"),fetch("/play/share",{method:"POST",body:(e=this.inputEl)==null?void 0:e.value}).then(r=>r.text()).then(r=>{const n=t+r;this.setOutputText(`<a href="${n}">${n}</a>`),window.open(n)}).catch(r=>{this.setErrorText(r)})}handleFormatButtonClick(){var e,r;this.setOutputText("Waiting for remote server\u2026");const t=new FormData;t.append("body",(r=(e=this.inputEl)==null?void 0:e.value)!=null?r:""),fetch("/play/fmt",{method:"POST",body:t}).then(n=>n.json()).then(({Body:n,Error:o})=>{this.setOutputText(o||"Done."),n&&(this.setInputText(n),this.resize())}).catch(n=>{this.setErrorText(n)})}handleRunButtonClick(){var t;this.setOutputText("Waiting for remote server\u2026"),fetch("/play/compile",{method:"POST",body:JSON.stringify({body:(t=this.inputEl)==null?void 0:t.value,version:2})}).then(e=>e.json()).then(async({Events:e,Errors:r})=>{this.setOutputText(r||"");for(const n of e||[])this.setOutputText(n.Message),await new Promise(o=>setTimeout(o,n.Delay/1e6))}).catch(e=>{this.setErrorText(e)})}}function u(){const i=location.hash.match(/^#(example-.*)$/);if(i){const r=document.getElementById(i[1]);r&&(r.open=!0)}const t=[...document.querySelectorAll(a.PLAY_HREF)],e=r=>t.find(n=>n.hash===r.getAnchorHash());for(const r of document.querySelectorAll(a.PLAY_CONTAINER)){const n=new s(r),o=e(n);o?o.addEventListener("click",()=>{n.expand()}):console.warn("example href not found")}}export{s as PlaygroundExampleController,u as initPlaygrounds};
 //# sourceMappingURL=playground.js.map
diff --git a/static/shared/playground/playground.js.map b/static/shared/playground/playground.js.map
index 35ddf5b..d858f6e 100644
--- a/static/shared/playground/playground.js.map
+++ b/static/shared/playground/playground.js.map
@@ -1,7 +1,7 @@
 {
   "version": 3,
   "sources": ["playground.ts"],
-  "sourcesContent": ["/*!\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the playground implementation of the documentation\n// page. The playground involves a \"play\" button that allows you to open up\n// a new link to play.golang.org using the example code.\n\n// The CSS is in static/frontend/unit/main/_doc.css\n\n/**\n * CSS classes used by PlaygroundExampleController\n */\nconst PlayExampleClassName = {\n  PLAY_HREF: '.js-exampleHref',\n  PLAY_CONTAINER: '.js-exampleContainer',\n  EXAMPLE_INPUT: '.Documentation-exampleCode',\n  EXAMPLE_OUTPUT: '.Documentation-exampleOutput',\n  EXAMPLE_ERROR: '.Documentation-exampleError',\n  PLAY_BUTTON: '.Documentation-examplePlayButton',\n  SHARE_BUTTON: '.Documentation-exampleShareButton',\n  FORMAT_BUTTON: '.Documentation-exampleFormatButton',\n  RUN_BUTTON: '.Documentation-exampleRunButton',\n};\n\n/**\n * This controller enables playground examples to expand their dropdown or\n * generate shareable Go Playground URLs.\n */\nexport class PlaygroundExampleController {\n  /**\n   * The anchor tag used to identify the container with an example href.\n   * There is only one in an example container div.\n   */\n  private readonly anchorEl: HTMLAnchorElement | null;\n\n  /**\n   * The error element\n   */\n  private readonly errorEl: Element | null;\n\n  /**\n   * Buttons that redirect to an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly playButtonEl: Element | null;\n  private readonly shareButtonEl: Element | null;\n\n  /**\n   * Button that formats the code in an example's playground.\n   */\n  private readonly formatButtonEl: Element | null;\n\n  /**\n   * Button that runs the code in an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly runButtonEl: Element | null;\n\n  /**\n   * The executable code of an example.\n   */\n  private readonly inputEl: HTMLTextAreaElement | null;\n\n  /**\n   * The output of the given example code. This only exists if the\n   * author of the package provides an output for this example.\n   */\n  private readonly outputEl: Element | null;\n\n  /**\n   * @param exampleEl The div that contains playground content for the given example.\n   */\n  constructor(private readonly exampleEl: HTMLDetailsElement) {\n    this.exampleEl = exampleEl;\n    this.anchorEl = exampleEl.querySelector('a');\n    this.errorEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_ERROR);\n    this.playButtonEl = exampleEl.querySelector(PlayExampleClassName.PLAY_BUTTON);\n    this.shareButtonEl = exampleEl.querySelector(PlayExampleClassName.SHARE_BUTTON);\n    this.formatButtonEl = exampleEl.querySelector(PlayExampleClassName.FORMAT_BUTTON);\n    this.runButtonEl = exampleEl.querySelector(PlayExampleClassName.RUN_BUTTON);\n    this.inputEl = this.makeTextArea(exampleEl.querySelector(PlayExampleClassName.EXAMPLE_INPUT));\n    this.outputEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_OUTPUT);\n\n    // This is legacy listener to be replaced the listener for shareButtonEl.\n    this.playButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.shareButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.formatButtonEl?.addEventListener('click', () => this.handleFormatButtonClick());\n    this.runButtonEl?.addEventListener('click', () => this.handleRunButtonClick());\n\n    if (!this.inputEl) return;\n\n    this.resize();\n    this.inputEl.addEventListener('keyup', () => this.resize());\n    this.inputEl.addEventListener('keydown', e => this.onKeydown(e));\n  }\n\n  /**\n   * Replace the pre element with a textarea. The examples are initially rendered\n   * as pre elements so they're fully visible when JS is disabled.\n   */\n  makeTextArea(el: Element | null): HTMLTextAreaElement {\n    const t = document.createElement('textarea');\n    t.classList.add('Documentation-exampleCode', 'code');\n    t.spellcheck = false;\n    t.value = el?.textContent ?? '';\n    el?.parentElement?.replaceChild(t, el);\n    return t;\n  }\n\n  /**\n   * Retrieve the hash value of the anchor element.\n   */\n  getAnchorHash(): string | undefined {\n    return this.anchorEl?.hash;\n  }\n\n  /**\n   * Expands the current playground example.\n   */\n  expand(): void {\n    this.exampleEl.open = true;\n  }\n\n  /**\n   * Resizes the input element to accomodate the amount of text present.\n   */\n  private resize(): void {\n    if (this.inputEl?.value) {\n      const numLineBreaks = (this.inputEl.value.match(/\\n/g) || []).length;\n      // min-height + lines x line-height + padding + border\n      this.inputEl.style.height = `${(20 + numLineBreaks * 20 + 12 + 2) / 16}rem`;\n    }\n  }\n\n  /**\n   * Handler to override keyboard behavior in the playground's\n   * textarea element.\n   *\n   * Tab key inserts tabs into the example playground instead of\n   * switching to the next interactive element.\n   * @param e input element keyboard event.\n   */\n  private onKeydown(e: KeyboardEvent) {\n    if (e.key === 'Tab') {\n      document.execCommand('insertText', false, '\\t');\n      e.preventDefault();\n    }\n  }\n\n  /**\n   * Changes the text of the example's input box.\n   */\n  private setInputText(output: string) {\n    if (this.inputEl) {\n      this.inputEl.value = output;\n    }\n  }\n\n  /**\n   * Changes the text of the example's output box.\n   */\n  private setOutputText(output: string) {\n    if (this.outputEl) {\n      this.outputEl.textContent = output;\n    }\n  }\n\n  /**\n   * Sets the error message text and overwrites\n   * output box to indicate a failed response.\n   */\n  private setErrorText(err: string) {\n    if (this.errorEl) {\n      this.errorEl.textContent = err;\n    }\n    this.setOutputText('An error has occurred\u2026');\n  }\n\n  /**\n   * Opens a new window to play.golang.org using the\n   * example snippet's code in the playground.\n   */\n  private handleShareButtonClick() {\n    const PLAYGROUND_BASE_URL = 'https://play.golang.org/p/';\n\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/share', {\n      method: 'POST',\n      body: this.inputEl?.value,\n    })\n      .then(res => res.text())\n      .then(shareId => {\n        const href = PLAYGROUND_BASE_URL + shareId;\n        this.setOutputText(`<a href=\"${href}\">${href}</a>`);\n        window.open(href);\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs gofmt on the example snippet in the playground.\n   */\n  private handleFormatButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n    const body = new FormData();\n    body.append('body', this.inputEl?.value ?? '');\n\n    fetch('/play/fmt', {\n      method: 'POST',\n      body: body,\n    })\n      .then(res => res.json())\n      .then(({ Body, Error }) => {\n        this.setOutputText(Error || 'Done.');\n        if (Body) {\n          this.setInputText(Body);\n          this.resize();\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs the code snippet in the example playground.\n   */\n  private handleRunButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/compile', {\n      method: 'POST',\n      body: JSON.stringify({ body: this.inputEl?.value, version: 2 }),\n    })\n      .then(res => res.json())\n      .then(async ({ Events, Errors }) => {\n        this.setOutputText(Errors || '');\n        for (const e of Events || []) {\n          this.setOutputText(e.Message);\n          await new Promise(resolve => setTimeout(resolve, e.Delay / 1000000));\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n}\n\nconst exampleHashRegex = location.hash.match(/^#(example-.*)$/);\nif (exampleHashRegex) {\n  const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;\n  if (exampleHashEl) {\n    exampleHashEl.open = true;\n  }\n}\n\n// We use a spread operator to convert a nodelist into an array of elements.\nconst exampleHrefs = [\n  ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),\n];\n\n/**\n * Sometimes exampleHrefs and playContainers are in different order, so we\n * find an exampleHref from a common hash.\n * @param playContainer - playground container\n */\nconst findExampleHash = (playContainer: PlaygroundExampleController) =>\n  exampleHrefs.find(ex => {\n    return ex.hash === playContainer.getAnchorHash();\n  });\n\nfor (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {\n  // There should be the same amount of hrefs referencing examples as example containers.\n  const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);\n  const exampleHref = findExampleHash(playContainer);\n  if (exampleHref) {\n    exampleHref.addEventListener('click', () => {\n      playContainer.expand();\n    });\n  } else {\n    console.warn('example href not found');\n  }\n}\n"],
-  "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAgBA,KAAM,GAAuB,CAC3B,UAAW,kBACX,eAAgB,uBAChB,cAAe,6BACf,eAAgB,+BAChB,cAAe,8BACf,YAAa,mCACb,aAAc,oCACd,cAAe,qCACf,WAAY,mCAOP,OAAkC,CA4CvC,YAA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M,GAAmB,SAAS,KAAK,MAAM,mBAC7C,GAAI,EAAkB,CACpB,KAAM,GAAgB,SAAS,eAAe,EAAiB,IAC/D,AAAI,GACF,GAAc,KAAO,IAKzB,KAAM,GAAe,CACnB,GAAG,SAAS,iBAAoC,EAAqB,YAQjE,EAAkB,AAAC,GACvB,EAAa,KAAK,GACT,EAAG,OAAS,EAAc,iBAGrC,SAAW,KAAM,UAAS,iBAAiB,EAAqB,gBAAiB,CAE/E,KAAM,GAAgB,GAAI,GAA4B,GAChD,EAAc,EAAgB,GACpC,AAAI,EACF,EAAY,iBAAiB,QAAS,IAAM,CAC1C,EAAc,WAGhB,QAAQ,KAAK",
+  "sourcesContent": ["/*!\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// This file implements the playground implementation of the documentation\n// page. The playground involves a \"play\" button that allows you to open up\n// a new link to play.golang.org using the example code.\n\n// The CSS is in static/frontend/unit/main/_doc.css\n\n/**\n * CSS classes used by PlaygroundExampleController\n */\nconst PlayExampleClassName = {\n  PLAY_HREF: '.js-exampleHref',\n  PLAY_CONTAINER: '.js-exampleContainer',\n  EXAMPLE_INPUT: '.Documentation-exampleCode',\n  EXAMPLE_OUTPUT: '.Documentation-exampleOutput',\n  EXAMPLE_ERROR: '.Documentation-exampleError',\n  PLAY_BUTTON: '.Documentation-examplePlayButton',\n  SHARE_BUTTON: '.Documentation-exampleShareButton',\n  FORMAT_BUTTON: '.Documentation-exampleFormatButton',\n  RUN_BUTTON: '.Documentation-exampleRunButton',\n};\n\n/**\n * This controller enables playground examples to expand their dropdown or\n * generate shareable Go Playground URLs.\n */\nexport class PlaygroundExampleController {\n  /**\n   * The anchor tag used to identify the container with an example href.\n   * There is only one in an example container div.\n   */\n  private readonly anchorEl: HTMLAnchorElement | null;\n\n  /**\n   * The error element\n   */\n  private readonly errorEl: Element | null;\n\n  /**\n   * Buttons that redirect to an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly playButtonEl: Element | null;\n  private readonly shareButtonEl: Element | null;\n\n  /**\n   * Button that formats the code in an example's playground.\n   */\n  private readonly formatButtonEl: Element | null;\n\n  /**\n   * Button that runs the code in an example's playground, this element\n   * only exists in executable examples.\n   */\n  private readonly runButtonEl: Element | null;\n\n  /**\n   * The executable code of an example.\n   */\n  private readonly inputEl: HTMLTextAreaElement | null;\n\n  /**\n   * The output of the given example code. This only exists if the\n   * author of the package provides an output for this example.\n   */\n  private readonly outputEl: Element | null;\n\n  /**\n   * @param exampleEl The div that contains playground content for the given example.\n   */\n  constructor(private readonly exampleEl: HTMLDetailsElement) {\n    this.exampleEl = exampleEl;\n    this.anchorEl = exampleEl.querySelector('a');\n    this.errorEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_ERROR);\n    this.playButtonEl = exampleEl.querySelector(PlayExampleClassName.PLAY_BUTTON);\n    this.shareButtonEl = exampleEl.querySelector(PlayExampleClassName.SHARE_BUTTON);\n    this.formatButtonEl = exampleEl.querySelector(PlayExampleClassName.FORMAT_BUTTON);\n    this.runButtonEl = exampleEl.querySelector(PlayExampleClassName.RUN_BUTTON);\n    this.inputEl = this.makeTextArea(exampleEl.querySelector(PlayExampleClassName.EXAMPLE_INPUT));\n    this.outputEl = exampleEl.querySelector(PlayExampleClassName.EXAMPLE_OUTPUT);\n\n    // This is legacy listener to be replaced the listener for shareButtonEl.\n    this.playButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.shareButtonEl?.addEventListener('click', () => this.handleShareButtonClick());\n    this.formatButtonEl?.addEventListener('click', () => this.handleFormatButtonClick());\n    this.runButtonEl?.addEventListener('click', () => this.handleRunButtonClick());\n\n    if (!this.inputEl) return;\n\n    this.resize();\n    this.inputEl.addEventListener('keyup', () => this.resize());\n    this.inputEl.addEventListener('keydown', e => this.onKeydown(e));\n  }\n\n  /**\n   * Replace the pre element with a textarea. The examples are initially rendered\n   * as pre elements so they're fully visible when JS is disabled.\n   */\n  makeTextArea(el: Element | null): HTMLTextAreaElement {\n    const t = document.createElement('textarea');\n    t.classList.add('Documentation-exampleCode', 'code');\n    t.spellcheck = false;\n    t.value = el?.textContent ?? '';\n    el?.parentElement?.replaceChild(t, el);\n    return t;\n  }\n\n  /**\n   * Retrieve the hash value of the anchor element.\n   */\n  getAnchorHash(): string | undefined {\n    return this.anchorEl?.hash;\n  }\n\n  /**\n   * Expands the current playground example.\n   */\n  expand(): void {\n    this.exampleEl.open = true;\n  }\n\n  /**\n   * Resizes the input element to accomodate the amount of text present.\n   */\n  private resize(): void {\n    if (this.inputEl?.value) {\n      const numLineBreaks = (this.inputEl.value.match(/\\n/g) || []).length;\n      // min-height + lines x line-height + padding + border\n      this.inputEl.style.height = `${(20 + numLineBreaks * 20 + 12 + 2) / 16}rem`;\n    }\n  }\n\n  /**\n   * Handler to override keyboard behavior in the playground's\n   * textarea element.\n   *\n   * Tab key inserts tabs into the example playground instead of\n   * switching to the next interactive element.\n   * @param e input element keyboard event.\n   */\n  private onKeydown(e: KeyboardEvent) {\n    if (e.key === 'Tab') {\n      document.execCommand('insertText', false, '\\t');\n      e.preventDefault();\n    }\n  }\n\n  /**\n   * Changes the text of the example's input box.\n   */\n  private setInputText(output: string) {\n    if (this.inputEl) {\n      this.inputEl.value = output;\n    }\n  }\n\n  /**\n   * Changes the text of the example's output box.\n   */\n  private setOutputText(output: string) {\n    if (this.outputEl) {\n      this.outputEl.textContent = output;\n    }\n  }\n\n  /**\n   * Sets the error message text and overwrites\n   * output box to indicate a failed response.\n   */\n  private setErrorText(err: string) {\n    if (this.errorEl) {\n      this.errorEl.textContent = err;\n    }\n    this.setOutputText('An error has occurred\u2026');\n  }\n\n  /**\n   * Opens a new window to play.golang.org using the\n   * example snippet's code in the playground.\n   */\n  private handleShareButtonClick() {\n    const PLAYGROUND_BASE_URL = 'https://play.golang.org/p/';\n\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/share', {\n      method: 'POST',\n      body: this.inputEl?.value,\n    })\n      .then(res => res.text())\n      .then(shareId => {\n        const href = PLAYGROUND_BASE_URL + shareId;\n        this.setOutputText(`<a href=\"${href}\">${href}</a>`);\n        window.open(href);\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs gofmt on the example snippet in the playground.\n   */\n  private handleFormatButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n    const body = new FormData();\n    body.append('body', this.inputEl?.value ?? '');\n\n    fetch('/play/fmt', {\n      method: 'POST',\n      body: body,\n    })\n      .then(res => res.json())\n      .then(({ Body, Error }) => {\n        this.setOutputText(Error || 'Done.');\n        if (Body) {\n          this.setInputText(Body);\n          this.resize();\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n\n  /**\n   * Runs the code snippet in the example playground.\n   */\n  private handleRunButtonClick() {\n    this.setOutputText('Waiting for remote server\u2026');\n\n    fetch('/play/compile', {\n      method: 'POST',\n      body: JSON.stringify({ body: this.inputEl?.value, version: 2 }),\n    })\n      .then(res => res.json())\n      .then(async ({ Events, Errors }) => {\n        this.setOutputText(Errors || '');\n        for (const e of Events || []) {\n          this.setOutputText(e.Message);\n          await new Promise(resolve => setTimeout(resolve, e.Delay / 1000000));\n        }\n      })\n      .catch(err => {\n        this.setErrorText(err);\n      });\n  }\n}\n\nexport function initPlaygrounds(): void {\n  const exampleHashRegex = location.hash.match(/^#(example-.*)$/);\n  if (exampleHashRegex) {\n    const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;\n    if (exampleHashEl) {\n      exampleHashEl.open = true;\n    }\n  }\n\n  // We use a spread operator to convert a nodelist into an array of elements.\n  const exampleHrefs = [\n    ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),\n  ];\n\n  /**\n   * Sometimes exampleHrefs and playContainers are in different order, so we\n   * find an exampleHref from a common hash.\n   * @param playContainer - playground container\n   */\n  const findExampleHash = (playContainer: PlaygroundExampleController) =>\n    exampleHrefs.find(ex => {\n      return ex.hash === playContainer.getAnchorHash();\n    });\n\n  for (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {\n    // There should be the same amount of hrefs referencing examples as example containers.\n    const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);\n    const exampleHref = findExampleHash(playContainer);\n    if (exampleHref) {\n      exampleHref.addEventListener('click', () => {\n        playContainer.expand();\n      });\n    } else {\n      console.warn('example href not found');\n    }\n  }\n}\n"],
+  "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAgBA,KAAM,GAAuB,CAC3B,UAAW,kBACX,eAAgB,uBAChB,cAAe,6BACf,eAAgB,+BAChB,cAAe,8BACf,YAAa,mCACb,aAAc,oCACd,cAAe,qCACf,WAAY,mCAOP,OAAkC,CA4CvC,YAA6B,EAA+B,CAA/B,iBA5E/B,YA6FI,AAhBA,KAAK,UAAY,EACjB,KAAK,SAAW,EAAU,cAAc,KACxC,KAAK,QAAU,EAAU,cAAc,EAAqB,eAC5D,KAAK,aAAe,EAAU,cAAc,EAAqB,aACjE,KAAK,cAAgB,EAAU,cAAc,EAAqB,cAClE,KAAK,eAAiB,EAAU,cAAc,EAAqB,eACnE,KAAK,YAAc,EAAU,cAAc,EAAqB,YAChE,KAAK,QAAU,KAAK,aAAa,EAAU,cAAc,EAAqB,gBAC9E,KAAK,SAAW,EAAU,cAAc,EAAqB,gBAG7D,QAAK,eAAL,QAAmB,iBAAiB,QAAS,IAAM,KAAK,0BACxD,QAAK,gBAAL,QAAoB,iBAAiB,QAAS,IAAM,KAAK,0BACzD,QAAK,iBAAL,QAAqB,iBAAiB,QAAS,IAAM,KAAK,2BAC1D,QAAK,cAAL,QAAkB,iBAAiB,QAAS,IAAM,KAAK,wBAEnD,EAAC,KAAK,SAEV,MAAK,SACL,KAAK,QAAQ,iBAAiB,QAAS,IAAM,KAAK,UAClD,KAAK,QAAQ,iBAAiB,UAAW,GAAK,KAAK,UAAU,KAO/D,aAAa,EAAyC,CAx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,CAAE,OAAM,WAAY,CACzB,KAAK,cAAc,GAAS,SACxB,GACF,MAAK,aAAa,GAClB,KAAK,YAGR,MAAM,GAAO,CACZ,KAAK,aAAa,KAOhB,sBAAuB,CA1OjC,MA2OI,KAAK,cAAc,mCAEnB,MAAM,gBAAiB,CACrB,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAM,QAAK,UAAL,cAAc,MAAO,QAAS,MAE1D,KAAK,GAAO,EAAI,QAChB,KAAK,MAAO,CAAE,SAAQ,YAAa,CAClC,KAAK,cAAc,GAAU,IAC7B,SAAW,KAAK,IAAU,GACxB,KAAK,cAAc,EAAE,SACrB,KAAM,IAAI,SAAQ,GAAW,WAAW,EAAS,EAAE,MAAQ,QAG9D,MAAM,GAAO,CACZ,KAAK,aAAa,MAKnB,YAAiC,CACtC,KAAM,GAAmB,SAAS,KAAK,MAAM,mBAC7C,GAAI,EAAkB,CACpB,KAAM,GAAgB,SAAS,eAAe,EAAiB,IAC/D,AAAI,GACF,GAAc,KAAO,IAKzB,KAAM,GAAe,CACnB,GAAG,SAAS,iBAAoC,EAAqB,YAQjE,EAAkB,AAAC,GACvB,EAAa,KAAK,GACT,EAAG,OAAS,EAAc,iBAGrC,SAAW,KAAM,UAAS,iBAAiB,EAAqB,gBAAiB,CAE/E,KAAM,GAAgB,GAAI,GAA4B,GAChD,EAAc,EAAgB,GACpC,AAAI,EACF,EAAY,iBAAiB,QAAS,IAAM,CAC1C,EAAc,WAGhB,QAAQ,KAAK",
   "names": []
 }
diff --git a/static/shared/playground/playground.ts b/static/shared/playground/playground.ts
index dea7794..d0b5261 100644
--- a/static/shared/playground/playground.ts
+++ b/static/shared/playground/playground.ts
@@ -253,38 +253,40 @@
   }
 }
 
-const exampleHashRegex = location.hash.match(/^#(example-.*)$/);
-if (exampleHashRegex) {
-  const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;
-  if (exampleHashEl) {
-    exampleHashEl.open = true;
+export function initPlaygrounds(): void {
+  const exampleHashRegex = location.hash.match(/^#(example-.*)$/);
+  if (exampleHashRegex) {
+    const exampleHashEl = document.getElementById(exampleHashRegex[1]) as HTMLDetailsElement;
+    if (exampleHashEl) {
+      exampleHashEl.open = true;
+    }
   }
-}
 
-// We use a spread operator to convert a nodelist into an array of elements.
-const exampleHrefs = [
-  ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),
-];
+  // We use a spread operator to convert a nodelist into an array of elements.
+  const exampleHrefs = [
+    ...document.querySelectorAll<HTMLAnchorElement>(PlayExampleClassName.PLAY_HREF),
+  ];
 
-/**
- * Sometimes exampleHrefs and playContainers are in different order, so we
- * find an exampleHref from a common hash.
- * @param playContainer - playground container
- */
-const findExampleHash = (playContainer: PlaygroundExampleController) =>
-  exampleHrefs.find(ex => {
-    return ex.hash === playContainer.getAnchorHash();
-  });
-
-for (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {
-  // There should be the same amount of hrefs referencing examples as example containers.
-  const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);
-  const exampleHref = findExampleHash(playContainer);
-  if (exampleHref) {
-    exampleHref.addEventListener('click', () => {
-      playContainer.expand();
+  /**
+   * Sometimes exampleHrefs and playContainers are in different order, so we
+   * find an exampleHref from a common hash.
+   * @param playContainer - playground container
+   */
+  const findExampleHash = (playContainer: PlaygroundExampleController) =>
+    exampleHrefs.find(ex => {
+      return ex.hash === playContainer.getAnchorHash();
     });
-  } else {
-    console.warn('example href not found');
+
+  for (const el of document.querySelectorAll(PlayExampleClassName.PLAY_CONTAINER)) {
+    // There should be the same amount of hrefs referencing examples as example containers.
+    const playContainer = new PlaygroundExampleController(el as HTMLDetailsElement);
+    const exampleHref = findExampleHash(playContainer);
+    if (exampleHref) {
+      exampleHref.addEventListener('click', () => {
+        playContainer.expand();
+      });
+    } else {
+      console.warn('example href not found');
+    }
   }
 }