primer_view_components 0.0.43 → 0.0.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -4
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/components/primer/alpha/button_marketing.rb +70 -0
  6. data/app/components/primer/auto_complete.rb +97 -41
  7. data/app/components/primer/auto_complete/auto_complete.html.erb +1 -0
  8. data/app/components/primer/beta/text.rb +27 -0
  9. data/app/components/primer/blankslate_component.rb +2 -1
  10. data/app/components/primer/button_component.rb +3 -2
  11. data/app/components/primer/details_component.rb +12 -1
  12. data/app/components/primer/dropdown.d.ts +1 -0
  13. data/app/components/primer/{dropdown_component.html.erb → dropdown.html.erb} +2 -1
  14. data/app/components/primer/dropdown.js +1 -0
  15. data/app/components/primer/dropdown.rb +149 -0
  16. data/app/components/primer/dropdown.ts +1 -0
  17. data/app/components/primer/dropdown/menu.d.ts +1 -0
  18. data/app/components/primer/dropdown/menu.html.erb +25 -0
  19. data/app/components/primer/dropdown/menu.js +1 -0
  20. data/app/components/primer/dropdown/menu.rb +99 -0
  21. data/app/components/primer/dropdown/menu.ts +1 -0
  22. data/app/components/primer/heading_component.rb +1 -1
  23. data/app/components/primer/icon_button.rb +1 -1
  24. data/app/components/primer/navigation/tab_component.rb +2 -2
  25. data/app/components/primer/octicon_component.rb +3 -2
  26. data/app/components/primer/primer.d.ts +1 -0
  27. data/app/components/primer/primer.js +1 -0
  28. data/app/components/primer/primer.ts +1 -0
  29. data/app/components/primer/spinner_component.rb +2 -0
  30. data/lib/primer/view_components/linters/argument_mappers/button.rb +82 -0
  31. data/lib/primer/view_components/linters/argument_mappers/conversion_error.rb +10 -0
  32. data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +46 -0
  33. data/lib/primer/view_components/linters/button_component_migration_counter.rb +20 -1
  34. data/lib/primer/view_components/linters/flash_component_migration_counter.rb +1 -1
  35. data/lib/primer/view_components/linters/helpers.rb +7 -3
  36. data/lib/primer/view_components/version.rb +1 -1
  37. data/lib/tasks/docs.rake +111 -96
  38. data/lib/yard/docs_helper.rb +12 -2
  39. data/static/statuses.json +6 -4
  40. metadata +17 -8
  41. data/app/components/primer/button_marketing_component.rb +0 -68
  42. data/app/components/primer/dropdown/menu_component.html.erb +0 -12
  43. data/app/components/primer/dropdown/menu_component.rb +0 -46
  44. data/app/components/primer/dropdown_component.rb +0 -73
  45. data/app/components/primer/text_component.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78f4fe987616d5ab746cbd6d6a0bc79ff62ecf33eb2365af3ade87a43461d35b
4
- data.tar.gz: 2813cf307508ab9a413d98edbba54e1d7735dc86e853a42587487c7293d42571
3
+ metadata.gz: 8134ca7a0a270e780b58ce74eabd681c4c2d20ace4b45dd0a5a85eff6a21635d
4
+ data.tar.gz: 8a8bc46d3f161e4398d129881b2ef6a0f1fe8f4a513b6cf82bd8b1c466f36d2d
5
5
  SHA512:
6
- metadata.gz: 7b13c5c05eb27d2a635396d736daa1039024bef7ddb456d20ec037f2cf270e8cb157ebd40619ca8eed4523e9cde5af2d990b428dc2ff663a42faaf01070a48ef
7
- data.tar.gz: c5e126fcf17bf04914a2ea054ca181991a8cb0fda5659753c4e03241e6dfcfe8a5e876b915033cfc69b11c10b3b7946403fdb86f1fca3161eb1278eae29d99ed
6
+ metadata.gz: '0557945a7c1e8ce40e117c65c283ecc7b0d2e1480d130586dbc5bc807d4ac084ec776928ac400eaa6c7a2391edb9b22e21c97071b9a499cb7221af78f1c4dbf4'
7
+ data.tar.gz: 31f974e2c2dc37056d9f67cb8036092521469d1d8e36c694dd02e664df50d7bffc12e6c3308853a89ad6b8a9794cc911196656fd36f5b3e6b4b389ee5fcd6a1e
data/CHANGELOG.md CHANGED
@@ -2,11 +2,55 @@
2
2
 
3
3
  ## main
4
4
 
5
- ## 0.0.43
5
+ ## 0.0.44
6
6
 
7
- * Upgrade primer/css to 17.2.1
7
+ ### Updates
8
8
 
9
- *Jon Rohan*
9
+ * Allow `Dropdown` menu items to be rendered outside a list.
10
+
11
+ *Manuel Puyol*
12
+
13
+ ### Breaking changes
14
+
15
+ * Require a label or `aria-label` to be provided for `AutoComplete` component.
16
+
17
+ *Kate Higa*
18
+
19
+ * Renames:
20
+ * `DropdownComponent` to `Dropdown`.
21
+ * `Dropdown::MenuComponent` to `Dropdown::Menu`.
22
+ * `Primer::ButtonMarketingComponent` to `Primer::Alpha::ButtonMarketing`.
23
+ * `Primer::TextComponent` to `Primer::Beta::Text`.
24
+
25
+ *Manuel Puyol*
26
+
27
+ * Removes `summary_classes` attribute in favor of the `summary` slot in `Dropdown`.
28
+
29
+ *Manuel Puyol*
30
+
31
+ ### Misc
32
+
33
+ * Add linter suggestions for `Button` component.
34
+
35
+ *Manuel Puyol*
36
+
37
+ * Sort documentation arguments.
38
+
39
+ *Jon Rohan*
40
+
41
+ * Add validations for docs generation.
42
+
43
+ *Manuel Puyol, Kate Higa*
44
+
45
+ * Change docs header order.
46
+
47
+ *Manuel Puyol, Kate Higa*
48
+
49
+ * Add preliminary criteria for new `alpha` components.
50
+
51
+ *Joel Hawksley*
52
+
53
+ ## 0.0.43
10
54
 
11
55
  ### New
12
56
 
@@ -48,6 +92,10 @@
48
92
 
49
93
  *Manuel Puyol*
50
94
 
95
+ * Upgrade primer/css to 17.2.1
96
+
97
+ *Jon Rohan*
98
+
51
99
  ## 0.0.42
52
100
 
53
101
  ### New
@@ -352,7 +400,7 @@
352
400
 
353
401
  *Manuel Puyol*
354
402
 
355
- * **Breaking change:** Rename `ButtonMarketingComponent` `button_type` argument to `scheme`.
403
+ * **Breaking change:** Rename `ButtonMarketing` `button_type` argument to `scheme`.
356
404
 
357
405
  *Manuel Puyol*
358
406
 
@@ -1,2 +1,2 @@
1
- const t=!!navigator.userAgent.match(/Macintosh/);class e{constructor(e,n){this.input=e,this.list=n,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.keyboardEventHandler=e=>function(e,n){if(e.shiftKey||e.metaKey||e.altKey)return;if(!t&&e.ctrlKey)return;if(n.isComposing)return;switch(e.key){case"Enter":case"Tab":(function(t,e){const n=e.querySelector('[aria-selected="true"]');return!!n&&("true"===n.getAttribute("aria-disabled")||n.click(),!0)})(n.input,n.list)&&e.preventDefault();break;case"Escape":n.clearSelection();break;case"ArrowDown":n.navigate(1),e.preventDefault();break;case"ArrowUp":n.navigate(-1),e.preventDefault();break;case"n":t&&e.ctrlKey&&(n.navigate(1),e.preventDefault());break;case"p":t&&e.ctrlKey&&(n.navigate(-1),e.preventDefault());break;default:if(e.ctrlKey)break;n.clearSelection()}}(e,this),this.compositionEventHandler=t=>function(t,e){e.isComposing="compositionstart"===t.type;if(!document.getElementById(e.input.getAttribute("aria-controls")||""))return;e.clearSelection()}(t,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",n)}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",n)}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(i)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(i),o=n.indexOf(e);if(o===n.length-1&&1===t||0===o&&-1===t)return this.clearSelection(),void this.input.focus();let r=1===t?0:n.length-1;if(e&&o>=0){const e=o+t;e>=0&&e<n.length&&(r=e)}const a=n[r];if(a)for(const t of n)a===t?(this.input.setAttribute("aria-activedescendant",a.id),a.setAttribute("aria-selected","true"),s(this.list,a)):t.setAttribute("aria-selected","false")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.setAttribute("aria-selected","false")}}function n(t){if(!(t.target instanceof Element))return;const e=t.target.closest('[role="option"]');e&&"true"!==e.getAttribute("aria-disabled")&&function(t){t.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}(e)}function i(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function s(t,e){(function(t,e){const n=t.scrollTop,i=n+t.clientHeight,s=e.offsetTop,o=s+e.clientHeight;return s>=n&&o<=i})(t,e)||(t.scrollTop=e.offsetTop)}class o extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const r=new WeakMap;function a(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=r.get(t);n&&n.abort();r.set(t,e);const i=()=>r.delete(t),s=function(t){return new Promise(((e,n)=>{t.onload=function(){t.status>=200&&t.status<300?e(t.responseText):n(new Error(t.responseText))},t.onerror=n,t.send()}))}(e);return s.then(i,i),s}(t,n)}class c{constructor(t,n,i){this.container=t,this.input=n,this.results=i,this.combobox=new e(n,i),this.results.hidden=!0,this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...i){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...i)}),e)}}(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}onKeydown(t){if("Escape"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.container.open=!0,t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.fetchResults()}onInputBlur(){this.interactingWithList?this.interactingWithList=!1:this.container.open=!1}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement))return;if(this.container.open=!1,e instanceof HTMLAnchorElement)return;const n=e.getAttribute("data-autocomplete-value")||e.textContent;this.container.value=n}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}fetchResults(){const t=this.input.value.trim();if(!t)return void(this.container.open=!1);const e=this.container.src;if(!e)return;const n=new URL(e,window.location.href),i=new URLSearchParams(n.search.slice(1));i.append("q",t),n.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),a(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=!!this.results.querySelector('[role="option"]');this.container.open=e,this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))})).catch((()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))}))}open(){this.results.hidden&&(this.combobox.start(),this.results.hidden=!1)}close(){this.results.hidden||(this.combobox.stop(),this.results.hidden=!0)}}const u=new WeakMap;class l extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);e instanceof HTMLInputElement&&n&&(u.set(this,new c(this,e,n)),n.setAttribute("role","listbox"))}disconnectedCallback(){const t=u.get(this);t&&(t.destroy(),u.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}static get observedAttributes(){return["open","value"]}attributeChangedCallback(t,e,n){if(e===n)return;const i=u.get(this);if(i)switch(t){case"open":null===n?i.close():i.open();break;case"value":null!==n&&(i.input.value=n),this.dispatchEvent(new o("auto-complete-change",{bubbles:!0,relatedTarget:i.input}))}}}function d(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t.textContent);const e=getSelection();if(null==e)return Promise.reject(new Error);e.removeAllRanges();const n=document.createRange();return n.selectNodeContents(t),e.addRange(n),document.execCommand("copy"),e.removeAllRanges(),Promise.resolve()}function h(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t);const e=document.body;if(!e)return Promise.reject(new Error);const n=function(t){const e=document.createElement("pre");return e.style.width="1px",e.style.height="1px",e.style.position="fixed",e.style.top="5px",e.textContent=t,e}(t);return e.appendChild(n),d(n),e.removeChild(n),Promise.resolve()}function m(t){const e=t.getAttribute("for"),n=t.getAttribute("value");function i(){t.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)h(n).then(i);else if(e){const n="getRootNode"in Element.prototype?t.getRootNode():t.ownerDocument;if(!(n instanceof Document||"ShadowRoot"in window&&n instanceof ShadowRoot))return;const o=n.getElementById(e);o&&(s=o,s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement?h(s.value):s instanceof HTMLAnchorElement&&s.hasAttribute("href")?h(s.href):d(s)).then(i)}var s}function f(t){const e=t.currentTarget;e instanceof HTMLElement&&m(e)}function p(t){if(" "===t.key||"Enter"===t.key){const e=t.currentTarget;e instanceof HTMLElement&&(t.preventDefault(),m(e))}}function g(t){t.currentTarget.addEventListener("keydown",p)}function b(t){t.currentTarget.removeEventListener("keydown",p)}window.customElements.get("auto-complete")||(window.AutocompleteElement=l,window.customElements.define("auto-complete",l));class w extends HTMLElement{constructor(){super(),this.addEventListener("click",f),this.addEventListener("focus",g),this.addEventListener("blur",b)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}window.customElements.get("clipboard-copy")||(window.ClipboardCopyElement=w,window.customElements.define("clipboard-copy",w));function v(t){""===t.style.display||"block"===t.style.display?t.style.display="none":t.style.display="block"}function y(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(v(e),v(n))}const E=new WeakMap;document.addEventListener("clipboard-copy",(function({target:t}){if(!(t instanceof HTMLElement))return;if(!t.hasAttribute("data-view-component"))return;const e=E.get(t);e?(clearTimeout(e),E.delete(t)):y(t),E.set(t,setTimeout(y,2e3,t))}));class A extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),i=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=i+1;t>=n.length&&(t=0),M(this,t)}else if("ArrowLeft"===t.code){let t=i-1;t<0&&(t=n.length-1),M(this,t)}else"Home"===t.code?(M(this,0),t.preventDefault()):"End"===t.code&&(M(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const n=t.target.closest('[role="tab"]');if(!n||!n.closest('[role="tablist"]'))return;M(this,e.indexOf(n))}))}connectedCallback(){for(const t of this.querySelectorAll('[role="tablist"] [role="tab"]'))t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false"),t.hasAttribute("tabindex")||("true"===t.getAttribute("aria-selected")?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1"))}}function M(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),i=t.querySelectorAll('[role="tabpanel"]'),s=n[e],o=i[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:o}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of i)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");s.setAttribute("aria-selected","true"),s.setAttribute("tabindex","0"),s.focus(),o.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:o}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=A,window.customElements.define("tab-container",A));const T=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["January","February","March","April","May","June","July","August","September","October","November","December"];function L(t){return`0${t}`.slice(-2)}function k(t,e){const n=t.getDay(),i=t.getDate(),s=t.getMonth(),o=t.getFullYear(),r=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let u;switch(e[1]){case"%":return"%";case"a":return T[n].slice(0,3);case"A":return T[n];case"b":return x[s].slice(0,3);case"B":return x[s];case"c":return t.toString();case"d":return L(i);case"e":return String(i);case"H":return L(r);case"I":return L(k(t,"%l"));case"l":return String(0===r||12===r?12:(r+12)%12);case"m":return L(s+1);case"M":return L(a);case"p":return r>11?"PM":"AM";case"P":return r>11?"pm":"am";case"S":return L(c);case"w":return String(n);case"y":return L(o%100);case"Y":return String(o);case"Z":return u=t.toString().match(/\((\w+)\)$/),u?u[1]:"";case"z":return u=t.toString().match(/\w([+-]\d\d\d\d) /),u?u[1]:""}return""}))}function C(t){let e;return function(){if(e)return e;if("Intl"in window)try{return e=new Intl.DateTimeFormat(void 0,t),e}catch(t){if(!(t instanceof RangeError))throw t}}}let S=null;const H=C({day:"numeric",month:"short"});function D(){if(null!==S)return S;const t=H();if(t){const e=t.format(new Date(0));return S=!!e.match(/^\d/),S}return!1}let $=null;const I=C({day:"numeric",month:"short",year:"numeric"});function R(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const F=new WeakMap;class Y extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year","time-zone-name"]}connectedCallback(){const t=this.getFormattedTitle();t&&!this.hasAttribute("title")&&this.setAttribute("title",t);const e=this.getFormattedDate();e&&(this.textContent=e)}attributeChangedCallback(t,e,n){const i=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?F.delete(this):F.set(this,new Date(t))}const s=this.getFormattedTitle(),o=this.getAttribute("title");"title"===t||!s||o&&o!==i||this.setAttribute("title",s);const r=this.getFormattedDate();r&&(this.textContent=r)}get date(){return F.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=q();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const q=C({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),W=new WeakMap;class X extends Y{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||W.delete(this),super.attributeChangedCallback(t,e,n)}getFormattedDate(){const t=this.date;if(!t)return;return`${function(t,e){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let i=D()?"weekday day month year":"weekday month day, year";for(const e in n){const s=n[e][t.getAttribute(e)||""];i=i.replace(e,s||"")}return i=i.replace(/(\s,)|(,\s$)/,""),k(e,i).replace(/\s+/," ").trim()}(this,t)||""} ${function(t,e){const n={},i=t.getAttribute("hour");"numeric"!==i&&"2-digit"!==i||(n.hour=i);const s=t.getAttribute("minute");"numeric"!==s&&"2-digit"!==s||(n.minute=s);const o=t.getAttribute("second");"numeric"!==o&&"2-digit"!==o||(n.second=o);const r=t.getAttribute("time-zone-name");"short"!==r&&"long"!==r||(n.timeZoneName=r);if(0===Object.keys(n).length)return;let a=W.get(t);a||(a=C(n),W.set(t,a));const c=a();if(c)return c.format(e);return k(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||""}`.trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=X,window.customElements.define("local-time",X));class K{constructor(t,e){this.date=t,this.locale=e}toString(){const t=this.timeElapsed();if(t)return t;{const t=this.timeAhead();return t||`on ${this.formatDate()}`}}timeElapsed(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24);return t>=0&&s<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24);return t>=0&&s<30?this.timeUntil():null}timeAgo(){const t=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(t)}timeAgoFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24),o=Math.round(s/30),r=Math.round(o/12);return t<0||e<10?O(this.locale,0,"second"):e<45?O(this.locale,-e,"second"):e<90||n<45?O(this.locale,-n,"minute"):n<90||i<24?O(this.locale,-i,"hour"):i<36||s<30?O(this.locale,-s,"day"):o<18?O(this.locale,-o,"month"):O(this.locale,-r,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24),o=Math.round(s/30),r=Math.round(o/12);return n<1?"1m":n<60?`${n}m`:i<24?`${i}h`:s<365?`${s}d`:`${r}y`}timeUntil(){const t=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(t)}timeUntilFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24),o=Math.round(s/30),r=Math.round(o/12);return o>=18||o>=12?O(this.locale,r,"year"):s>=45||s>=30?O(this.locale,o,"month"):i>=36||i>=24?O(this.locale,s,"day"):n>=90||n>=45?O(this.locale,i,"hour"):e>=90||e>=45?O(this.locale,n,"minute"):O(this.locale,e>=10?e:0,"second")}microTimeUntil(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),s=Math.round(i/24),o=Math.round(s/30),r=Math.round(o/12);return s>=365?`${r}y`:i>=24?`${s}d`:n>=60?`${i}h`:n>1?`${n}m`:"1m"}formatDate(){let t=D()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==$)return $;const t=I();if(t){const e=t.format(new Date(0));return $=!!e.match(/\d,/),$}return!0}()?", %Y":" %Y"),k(this.date,t)}formatTime(){const t=z();return t?t.format(this.date):k(this.date,"%l:%M%P")}}function O(t,e,n){const i=function(t,e){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(t,e)}catch(t){if(!(t instanceof RangeError))throw t}}(t,{numeric:"auto"});return i?i.format(e,n):function(t,e){if(0===t)switch(e){case"year":case"quarter":case"month":case"week":return`this ${e}`;case"day":return"today";case"hour":case"minute":return`in 0 ${e}s`;case"second":return"now"}else if(1===t)switch(e){case"year":case"quarter":case"month":case"week":return`next ${e}`;case"day":return"tomorrow";case"hour":case"minute":case"second":return`in 1 ${e}`}else if(-1===t)switch(e){case"year":case"quarter":case"month":case"week":return`last ${e}`;case"day":return"yesterday";case"hour":case"minute":case"second":return`1 ${e} ago`}else if(t>1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`in ${t} ${e}s`}else if(t<-1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`${-t} ${e}s ago`}throw new RangeError(`Invalid unit argument for format() '${e}'`)}(e,n)}const z=C({hour:"numeric",minute:"2-digit"});class U extends Y{getFormattedDate(){const t=this.date;if(t)return new K(t,R(this)).toString()}connectedCallback(){P.push(this),B||(N(),B=window.setInterval(N,6e4)),super.connectedCallback()}disconnectedCallback(){const t=P.indexOf(this);-1!==t&&P.splice(t,1),P.length||B&&(clearInterval(B),B=null)}}const P=[];let B;function N(){let t,e,n;for(e=0,n=P.length;e<n;e++)t=P[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=U,window.customElements.define("relative-time",U));class Z extends U{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new K(e,R(this)).microTimeAgo():new K(e,R(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=Z,window.customElements.define("time-ago",Z));class j extends U{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new K(e,R(this)).microTimeUntil():new K(e,R(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=j,window.customElements.define("time-until",j));const J=new WeakMap,G=new WeakMap,Q=new WeakMap;function V(t){const e=t.currentTarget;if(!(e instanceof rt))return;const{box:n,image:i}=Q.get(e)||{};if(!n||!i)return;let s=0,o=0;if(t instanceof KeyboardEvent)"ArrowUp"===t.key?o=-1:"ArrowDown"===t.key?o=1:"ArrowLeft"===t.key?s=-1:"ArrowRight"===t.key&&(s=1);else if(G.has(e)&&t instanceof MouseEvent){const n=G.get(e);s=t.pageX-n.dragStartX,o=t.pageY-n.dragStartY}else if(G.has(e)&&t instanceof TouchEvent){const{pageX:n,pageY:i}=t.changedTouches[0],{dragStartX:r,dragStartY:a}=G.get(e);s=n-r,o=i-a}if(0!==s||0!==o){const t=Math.min(Math.max(0,n.offsetLeft+s),i.width-n.offsetWidth),r=Math.min(Math.max(0,n.offsetTop+o),i.height-n.offsetHeight);n.style.left=`${t}px`,n.style.top=`${r}px`,ot(e,{x:t,y:r,width:n.offsetWidth,height:n.offsetHeight})}if(t instanceof MouseEvent)G.set(e,{dragStartX:t.pageX,dragStartY:t.pageY});else if(t instanceof TouchEvent){const{pageX:n,pageY:i}=t.changedTouches[0];G.set(e,{dragStartX:n,dragStartY:i})}}function _(t){const e=t.target;if(!(e instanceof HTMLElement))return;const n=tt(e);if(!(n instanceof rt))return;const{box:i}=Q.get(n)||{};if(!i)return;const s=n.getBoundingClientRect();let o,r,a;if(t instanceof KeyboardEvent){if("Escape"===t.key)return it(n);if("-"===t.key&&(a=-10),"="===t.key&&(a=10),!a)return;o=i.offsetWidth+a,r=i.offsetHeight+a,J.set(n,{startX:i.offsetLeft,startY:i.offsetTop})}else if(t instanceof MouseEvent){const e=J.get(n);if(!e)return;o=t.pageX-e.startX-s.left-window.pageXOffset,r=t.pageY-e.startY-s.top-window.pageYOffset}else if(t instanceof TouchEvent){const e=J.get(n);if(!e)return;o=t.changedTouches[0].pageX-e.startX-s.left-window.pageXOffset,r=t.changedTouches[0].pageY-e.startY-s.top-window.pageYOffset}o&&r&&nt(n,o,r,!(t instanceof KeyboardEvent))}function tt(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t}function et(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const n=tt(e);if(!(n instanceof rt))return;const{box:i}=Q.get(n)||{};if(!i)return;const s=t.target;if(s instanceof HTMLElement)if(s.hasAttribute("data-direction")){const e=s.getAttribute("data-direction")||"";n.addEventListener("mousemove",_),n.addEventListener("touchmove",_,{passive:!0}),["nw","se"].indexOf(e)>=0&&n.classList.add("nwse"),["ne","sw"].indexOf(e)>=0&&n.classList.add("nesw"),J.set(n,{startX:i.offsetLeft+(["se","ne"].indexOf(e)>=0?0:i.offsetWidth),startY:i.offsetTop+(["se","sw"].indexOf(e)>=0?0:i.offsetHeight)}),_(t)}else n.addEventListener("mousemove",V),n.addEventListener("touchmove",V,{passive:!0})}function nt(t,e,n,i=!0){let s=Math.max(Math.abs(e),Math.abs(n),10);const o=J.get(t);if(!o)return;const{box:r,image:a}=Q.get(t)||{};if(!r||!a)return;s=Math.min(s,n>0?a.height-o.startY:o.startY,e>0?a.width-o.startX:o.startX);const c=i?Math.round(Math.max(0,e>0?o.startX:o.startX-s)):r.offsetLeft,u=i?Math.round(Math.max(0,n>0?o.startY:o.startY-s)):r.offsetTop;r.style.left=`${c}px`,r.style.top=`${u}px`,r.style.width=`${s}px`,r.style.height=`${s}px`,ot(t,{x:c,y:u,width:s,height:s})}function it(t){const{image:e}=Q.get(t)||{};if(!e)return;const n=Math.round(e.clientWidth>e.clientHeight?e.clientHeight:e.clientWidth);J.set(t,{startX:(e.clientWidth-n)/2,startY:(e.clientHeight-n)/2}),nt(t,n,n)}function st(t){const e=t.currentTarget;e instanceof rt&&(G.delete(e),e.classList.remove("nwse","nesw"),e.removeEventListener("mousemove",_),e.removeEventListener("mousemove",V),e.removeEventListener("touchmove",_),e.removeEventListener("touchmove",V))}function ot(t,e){const{image:n}=Q.get(t)||{};if(!n)return;const i=n.naturalWidth/n.width;for(const n in e){const s=Math.round(e[n]*i);e[n]=s;const o=t.querySelector(`[data-image-crop-input='${n}']`);o instanceof HTMLInputElement&&(o.value=s.toString())}t.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:e}))}class rt extends HTMLElement{connectedCallback(){if(Q.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML='\n<style>\n :host { touch-action: none; display: block; }\n :host(.nesw) { cursor: nesw-resize; }\n :host(.nwse) { cursor: nwse-resize; }\n :host(.nesw) .crop-box, :host(.nwse) .crop-box { cursor: inherit; }\n :host([loaded]) .crop-image { display: block; }\n :host([loaded]) ::slotted([data-loading-slot]), .crop-image { display: none; }\n\n .crop-wrapper {\n position: relative;\n font-size: 0;\n }\n .crop-container {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n position: absolute;\n overflow: hidden;\n z-index: 1;\n top: 0;\n width: 100%;\n height: 100%;\n }\n\n :host([rounded]) .crop-box {\n border-radius: 50%;\n box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);\n }\n .crop-box {\n position: absolute;\n border: 1px dashed #fff;\n box-sizing: border-box;\n cursor: move;\n }\n\n :host([rounded]) .crop-outline {\n outline: none;\n }\n .crop-outline {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n outline: 4000px solid rgba(0, 0, 0, .3);\n }\n\n .handle { position: absolute; }\n :host([rounded]) .handle::before { border-radius: 50%; }\n .handle:before {\n position: absolute;\n display: block;\n padding: 4px;\n transform: translate(-50%, -50%);\n content: \' \';\n background: #fff;\n border: 1px solid #767676;\n }\n .ne { top: 0; right: 0; cursor: nesw-resize; }\n .nw { top: 0; left: 0; cursor: nwse-resize; }\n .se { bottom: 0; right: 0; cursor: nwse-resize; }\n .sw { bottom: 0; left: 0; cursor: nesw-resize; }\n</style>\n<slot></slot>\n<div class="crop-wrapper">\n <img width="100%" class="crop-image" alt="">\n <div class="crop-container">\n <div data-crop-box class="crop-box">\n <div class="crop-outline"></div>\n <div data-direction="nw" class="handle nw"></div>\n <div data-direction="ne" class="handle ne"></div>\n <div data-direction="sw" class="handle sw"></div>\n <div data-direction="se" class="handle se"></div>\n </div>\n </div>\n</div>\n';const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const n=t.querySelector("img");n instanceof HTMLImageElement&&(Q.set(this,{box:e,image:n}),n.addEventListener("load",(()=>{this.loaded=!0,it(this)})),this.addEventListener("mouseleave",st),this.addEventListener("touchend",st),this.addEventListener("mouseup",st),e.addEventListener("mousedown",et),e.addEventListener("touchstart",et,{passive:!0}),this.addEventListener("keydown",V),this.addEventListener("keydown",_),this.src&&(n.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(t){t?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(t,e,n){const{image:i}=Q.get(this)||{};"src"===t&&(this.loaded=!1,i&&(i.src=n))}}window.customElements.get("image-crop")||(window.ImageCropElement=rt,window.customElements.define("image-crop",rt));
1
+ const t=!!navigator.userAgent.match(/Macintosh/);class e{constructor(e,n){this.input=e,this.list=n,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.keyboardEventHandler=e=>function(e,n){if(e.shiftKey||e.metaKey||e.altKey)return;if(!t&&e.ctrlKey)return;if(n.isComposing)return;switch(e.key){case"Enter":case"Tab":(function(t,e){const n=e.querySelector('[aria-selected="true"]');return!!n&&("true"===n.getAttribute("aria-disabled")||n.click(),!0)})(n.input,n.list)&&e.preventDefault();break;case"Escape":n.clearSelection();break;case"ArrowDown":n.navigate(1),e.preventDefault();break;case"ArrowUp":n.navigate(-1),e.preventDefault();break;case"n":t&&e.ctrlKey&&(n.navigate(1),e.preventDefault());break;case"p":t&&e.ctrlKey&&(n.navigate(-1),e.preventDefault());break;default:if(e.ctrlKey)break;n.clearSelection()}}(e,this),this.compositionEventHandler=t=>function(t,e){e.isComposing="compositionstart"===t.type;if(!document.getElementById(e.input.getAttribute("aria-controls")||""))return;e.clearSelection()}(t,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",n)}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",n)}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(i)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(i),s=n.indexOf(e);if(s===n.length-1&&1===t||0===s&&-1===t)return this.clearSelection(),void this.input.focus();let r=1===t?0:n.length-1;if(e&&s>=0){const e=s+t;e>=0&&e<n.length&&(r=e)}const a=n[r];if(a)for(const t of n)a===t?(this.input.setAttribute("aria-activedescendant",a.id),a.setAttribute("aria-selected","true"),o(this.list,a)):t.setAttribute("aria-selected","false")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.setAttribute("aria-selected","false")}}function n(t){if(!(t.target instanceof Element))return;const e=t.target.closest('[role="option"]');e&&"true"!==e.getAttribute("aria-disabled")&&function(t){t.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}(e)}function i(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function o(t,e){(function(t,e){const n=t.scrollTop,i=n+t.clientHeight,o=e.offsetTop,s=o+e.clientHeight;return o>=n&&s<=i})(t,e)||(t.scrollTop=e.offsetTop)}class s extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const r=new WeakMap;function a(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=r.get(t);n&&n.abort();r.set(t,e);const i=()=>r.delete(t),o=function(t){return new Promise(((e,n)=>{t.onload=function(){t.status>=200&&t.status<300?e(t.responseText):n(new Error(t.responseText))},t.onerror=n,t.send()}))}(e);return o.then(i,i),o}(t,n)}class c{constructor(t,n,i){this.container=t,this.input=n,this.results=i,this.combobox=new e(n,i),this.results.hidden=!0,this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...i){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...i)}),e)}}(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}onKeydown(t){if("Escape"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.container.open=!0,t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.fetchResults()}onInputBlur(){this.interactingWithList?this.interactingWithList=!1:this.container.open=!1}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement))return;if(this.container.open=!1,e instanceof HTMLAnchorElement)return;const n=e.getAttribute("data-autocomplete-value")||e.textContent;this.container.value=n}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}fetchResults(){const t=this.input.value.trim();if(!t)return void(this.container.open=!1);const e=this.container.src;if(!e)return;const n=new URL(e,window.location.href),i=new URLSearchParams(n.search.slice(1));i.append("q",t),n.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),a(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=!!this.results.querySelector('[role="option"]');this.container.open=e,this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))})).catch((()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))}))}open(){this.results.hidden&&(this.combobox.start(),this.results.hidden=!1)}close(){this.results.hidden||(this.combobox.stop(),this.results.hidden=!0)}}const u=new WeakMap;class l extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);e instanceof HTMLInputElement&&n&&(u.set(this,new c(this,e,n)),n.setAttribute("role","listbox"))}disconnectedCallback(){const t=u.get(this);t&&(t.destroy(),u.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}static get observedAttributes(){return["open","value"]}attributeChangedCallback(t,e,n){if(e===n)return;const i=u.get(this);if(i)switch(t){case"open":null===n?i.close():i.open();break;case"value":null!==n&&(i.input.value=n),this.dispatchEvent(new s("auto-complete-change",{bubbles:!0,relatedTarget:i.input}))}}}function d(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t.textContent);const e=getSelection();if(null==e)return Promise.reject(new Error);e.removeAllRanges();const n=document.createRange();return n.selectNodeContents(t),e.addRange(n),document.execCommand("copy"),e.removeAllRanges(),Promise.resolve()}function h(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t);const e=document.body;if(!e)return Promise.reject(new Error);const n=function(t){const e=document.createElement("pre");return e.style.width="1px",e.style.height="1px",e.style.position="fixed",e.style.top="5px",e.textContent=t,e}(t);return e.appendChild(n),d(n),e.removeChild(n),Promise.resolve()}function m(t){const e=t.getAttribute("for"),n=t.getAttribute("value");function i(){t.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)h(n).then(i);else if(e){const n="getRootNode"in Element.prototype?t.getRootNode():t.ownerDocument;if(!(n instanceof Document||"ShadowRoot"in window&&n instanceof ShadowRoot))return;const s=n.getElementById(e);s&&(o=s,o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?h(o.value):o instanceof HTMLAnchorElement&&o.hasAttribute("href")?h(o.href):d(o)).then(i)}var o}function f(t){const e=t.currentTarget;e instanceof HTMLElement&&m(e)}function p(t){if(" "===t.key||"Enter"===t.key){const e=t.currentTarget;e instanceof HTMLElement&&(t.preventDefault(),m(e))}}function g(t){t.currentTarget.addEventListener("keydown",p)}function b(t){t.currentTarget.removeEventListener("keydown",p)}window.customElements.get("auto-complete")||(window.AutocompleteElement=l,window.customElements.define("auto-complete",l));class w extends HTMLElement{constructor(){super(),this.addEventListener("click",f),this.addEventListener("focus",g),this.addEventListener("blur",b)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}window.customElements.get("clipboard-copy")||(window.ClipboardCopyElement=w,window.customElements.define("clipboard-copy",w));function v(t){""===t.style.display||"block"===t.style.display?t.style.display="none":t.style.display="block"}function y(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(v(e),v(n))}const E=new WeakMap;document.addEventListener("clipboard-copy",(function({target:t}){if(!(t instanceof HTMLElement))return;if(!t.hasAttribute("data-view-component"))return;const e=E.get(t);e?(clearTimeout(e),E.delete(t)):y(t),E.set(t,setTimeout(y,2e3,t))}));class A extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),i=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=i+1;t>=n.length&&(t=0),M(this,t)}else if("ArrowLeft"===t.code){let t=i-1;t<0&&(t=n.length-1),M(this,t)}else"Home"===t.code?(M(this,0),t.preventDefault()):"End"===t.code&&(M(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const n=t.target.closest('[role="tab"]');if(!n||!n.closest('[role="tablist"]'))return;M(this,e.indexOf(n))}))}connectedCallback(){for(const t of this.querySelectorAll('[role="tablist"] [role="tab"]'))t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false"),t.hasAttribute("tabindex")||("true"===t.getAttribute("aria-selected")?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1"))}}function M(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),i=t.querySelectorAll('[role="tabpanel"]'),o=n[e],s=i[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:s}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of i)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");o.setAttribute("aria-selected","true"),o.setAttribute("tabindex","0"),o.focus(),s.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:s}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=A,window.customElements.define("tab-container",A));const x=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],T=["January","February","March","April","May","June","July","August","September","October","November","December"];function L(t){return`0${t}`.slice(-2)}function k(t,e){const n=t.getDay(),i=t.getDate(),o=t.getMonth(),s=t.getFullYear(),r=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let u;switch(e[1]){case"%":return"%";case"a":return x[n].slice(0,3);case"A":return x[n];case"b":return T[o].slice(0,3);case"B":return T[o];case"c":return t.toString();case"d":return L(i);case"e":return String(i);case"H":return L(r);case"I":return L(k(t,"%l"));case"l":return String(0===r||12===r?12:(r+12)%12);case"m":return L(o+1);case"M":return L(a);case"p":return r>11?"PM":"AM";case"P":return r>11?"pm":"am";case"S":return L(c);case"w":return String(n);case"y":return L(s%100);case"Y":return String(s);case"Z":return u=t.toString().match(/\((\w+)\)$/),u?u[1]:"";case"z":return u=t.toString().match(/\w([+-]\d\d\d\d) /),u?u[1]:""}return""}))}function S(t){let e;return function(){if(e)return e;if("Intl"in window)try{return e=new Intl.DateTimeFormat(void 0,t),e}catch(t){if(!(t instanceof RangeError))throw t}}}let C=null;const H=S({day:"numeric",month:"short"});function D(){if(null!==C)return C;const t=H();if(t){const e=t.format(new Date(0));return C=!!e.match(/^\d/),C}return!1}let q=null;const I=S({day:"numeric",month:"short",year:"numeric"});function $(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const R=new WeakMap;class F extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year","time-zone-name"]}connectedCallback(){const t=this.getFormattedTitle();t&&!this.hasAttribute("title")&&this.setAttribute("title",t);const e=this.getFormattedDate();e&&(this.textContent=e)}attributeChangedCallback(t,e,n){const i=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?R.delete(this):R.set(this,new Date(t))}const o=this.getFormattedTitle(),s=this.getAttribute("title");"title"===t||!o||s&&s!==i||this.setAttribute("title",o);const r=this.getFormattedDate();r&&(this.textContent=r)}get date(){return R.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=Y();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const Y=S({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),W=new WeakMap;class X extends F{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||W.delete(this),super.attributeChangedCallback(t,e,n)}getFormattedDate(){const t=this.date;if(!t)return;return`${function(t,e){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let i=D()?"weekday day month year":"weekday month day, year";for(const e in n){const o=n[e][t.getAttribute(e)||""];i=i.replace(e,o||"")}return i=i.replace(/(\s,)|(,\s$)/,""),k(e,i).replace(/\s+/," ").trim()}(this,t)||""} ${function(t,e){const n={},i=t.getAttribute("hour");"numeric"!==i&&"2-digit"!==i||(n.hour=i);const o=t.getAttribute("minute");"numeric"!==o&&"2-digit"!==o||(n.minute=o);const s=t.getAttribute("second");"numeric"!==s&&"2-digit"!==s||(n.second=s);const r=t.getAttribute("time-zone-name");"short"!==r&&"long"!==r||(n.timeZoneName=r);if(0===Object.keys(n).length)return;let a=W.get(t);a||(a=S(n),W.set(t,a));const c=a();if(c)return c.format(e);return k(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||""}`.trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=X,window.customElements.define("local-time",X));class K{constructor(t,e){this.date=t,this.locale=e}toString(){const t=this.timeElapsed();if(t)return t;{const t=this.timeAhead();return t||`on ${this.formatDate()}`}}timeElapsed(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24);return t>=0&&o<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24);return t>=0&&o<30?this.timeUntil():null}timeAgo(){const t=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(t)}timeAgoFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24),s=Math.round(o/30),r=Math.round(s/12);return t<0||e<10?O(this.locale,0,"second"):e<45?O(this.locale,-e,"second"):e<90||n<45?O(this.locale,-n,"minute"):n<90||i<24?O(this.locale,-i,"hour"):i<36||o<30?O(this.locale,-o,"day"):s<18?O(this.locale,-s,"month"):O(this.locale,-r,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24),s=Math.round(o/30),r=Math.round(s/12);return n<1?"1m":n<60?`${n}m`:i<24?`${i}h`:o<365?`${o}d`:`${r}y`}timeUntil(){const t=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(t)}timeUntilFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24),s=Math.round(o/30),r=Math.round(s/12);return s>=18||s>=12?O(this.locale,r,"year"):o>=45||o>=30?O(this.locale,s,"month"):i>=36||i>=24?O(this.locale,o,"day"):n>=90||n>=45?O(this.locale,i,"hour"):e>=90||e>=45?O(this.locale,n,"minute"):O(this.locale,e>=10?e:0,"second")}microTimeUntil(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),o=Math.round(i/24),s=Math.round(o/30),r=Math.round(s/12);return o>=365?`${r}y`:i>=24?`${o}d`:n>=60?`${i}h`:n>1?`${n}m`:"1m"}formatDate(){let t=D()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==q)return q;const t=I();if(t){const e=t.format(new Date(0));return q=!!e.match(/\d,/),q}return!0}()?", %Y":" %Y"),k(this.date,t)}formatTime(){const t=U();return t?t.format(this.date):k(this.date,"%l:%M%P")}}function O(t,e,n){const i=function(t,e){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(t,e)}catch(t){if(!(t instanceof RangeError))throw t}}(t,{numeric:"auto"});return i?i.format(e,n):function(t,e){if(0===t)switch(e){case"year":case"quarter":case"month":case"week":return`this ${e}`;case"day":return"today";case"hour":case"minute":return`in 0 ${e}s`;case"second":return"now"}else if(1===t)switch(e){case"year":case"quarter":case"month":case"week":return`next ${e}`;case"day":return"tomorrow";case"hour":case"minute":case"second":return`in 1 ${e}`}else if(-1===t)switch(e){case"year":case"quarter":case"month":case"week":return`last ${e}`;case"day":return"yesterday";case"hour":case"minute":case"second":return`1 ${e} ago`}else if(t>1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`in ${t} ${e}s`}else if(t<-1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return`${-t} ${e}s ago`}throw new RangeError(`Invalid unit argument for format() '${e}'`)}(e,n)}const U=S({hour:"numeric",minute:"2-digit"});class z extends F{getFormattedDate(){const t=this.date;if(t)return new K(t,$(this)).toString()}connectedCallback(){P.push(this),B||(N(),B=window.setInterval(N,6e4)),super.connectedCallback()}disconnectedCallback(){const t=P.indexOf(this);-1!==t&&P.splice(t,1),P.length||B&&(clearInterval(B),B=null)}}const P=[];let B;function N(){let t,e,n;for(e=0,n=P.length;e<n;e++)t=P[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=z,window.customElements.define("relative-time",z));class Z extends z{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new K(e,$(this)).microTimeAgo():new K(e,$(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=Z,window.customElements.define("time-ago",Z));class j extends z{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new K(e,$(this)).microTimeUntil():new K(e,$(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=j,window.customElements.define("time-until",j));const J=new WeakMap,G=new WeakMap,Q=new WeakMap;function V(t){const e=t.currentTarget;if(!(e instanceof rt))return;const{box:n,image:i}=Q.get(e)||{};if(!n||!i)return;let o=0,s=0;if(t instanceof KeyboardEvent)"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?o=-1:"ArrowRight"===t.key&&(o=1);else if(G.has(e)&&t instanceof MouseEvent){const n=G.get(e);o=t.pageX-n.dragStartX,s=t.pageY-n.dragStartY}else if(G.has(e)&&t instanceof TouchEvent){const{pageX:n,pageY:i}=t.changedTouches[0],{dragStartX:r,dragStartY:a}=G.get(e);o=n-r,s=i-a}if(0!==o||0!==s){const t=Math.min(Math.max(0,n.offsetLeft+o),i.width-n.offsetWidth),r=Math.min(Math.max(0,n.offsetTop+s),i.height-n.offsetHeight);n.style.left=`${t}px`,n.style.top=`${r}px`,st(e,{x:t,y:r,width:n.offsetWidth,height:n.offsetHeight})}if(t instanceof MouseEvent)G.set(e,{dragStartX:t.pageX,dragStartY:t.pageY});else if(t instanceof TouchEvent){const{pageX:n,pageY:i}=t.changedTouches[0];G.set(e,{dragStartX:n,dragStartY:i})}}function _(t){const e=t.target;if(!(e instanceof HTMLElement))return;const n=tt(e);if(!(n instanceof rt))return;const{box:i}=Q.get(n)||{};if(!i)return;const o=n.getBoundingClientRect();let s,r,a;if(t instanceof KeyboardEvent){if("Escape"===t.key)return it(n);if("-"===t.key&&(a=-10),"="===t.key&&(a=10),!a)return;s=i.offsetWidth+a,r=i.offsetHeight+a,J.set(n,{startX:i.offsetLeft,startY:i.offsetTop})}else if(t instanceof MouseEvent){const e=J.get(n);if(!e)return;s=t.pageX-e.startX-o.left-window.pageXOffset,r=t.pageY-e.startY-o.top-window.pageYOffset}else if(t instanceof TouchEvent){const e=J.get(n);if(!e)return;s=t.changedTouches[0].pageX-e.startX-o.left-window.pageXOffset,r=t.changedTouches[0].pageY-e.startY-o.top-window.pageYOffset}s&&r&&nt(n,s,r,!(t instanceof KeyboardEvent))}function tt(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t}function et(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const n=tt(e);if(!(n instanceof rt))return;const{box:i}=Q.get(n)||{};if(!i)return;const o=t.target;if(o instanceof HTMLElement)if(o.hasAttribute("data-direction")){const e=o.getAttribute("data-direction")||"";n.addEventListener("mousemove",_),n.addEventListener("touchmove",_,{passive:!0}),["nw","se"].indexOf(e)>=0&&n.classList.add("nwse"),["ne","sw"].indexOf(e)>=0&&n.classList.add("nesw"),J.set(n,{startX:i.offsetLeft+(["se","ne"].indexOf(e)>=0?0:i.offsetWidth),startY:i.offsetTop+(["se","sw"].indexOf(e)>=0?0:i.offsetHeight)}),_(t)}else n.addEventListener("mousemove",V),n.addEventListener("touchmove",V,{passive:!0})}function nt(t,e,n,i=!0){let o=Math.max(Math.abs(e),Math.abs(n),10);const s=J.get(t);if(!s)return;const{box:r,image:a}=Q.get(t)||{};if(!r||!a)return;o=Math.min(o,n>0?a.height-s.startY:s.startY,e>0?a.width-s.startX:s.startX);const c=i?Math.round(Math.max(0,e>0?s.startX:s.startX-o)):r.offsetLeft,u=i?Math.round(Math.max(0,n>0?s.startY:s.startY-o)):r.offsetTop;r.style.left=`${c}px`,r.style.top=`${u}px`,r.style.width=`${o}px`,r.style.height=`${o}px`,st(t,{x:c,y:u,width:o,height:o})}function it(t){const{image:e}=Q.get(t)||{};if(!e)return;const n=Math.round(e.clientWidth>e.clientHeight?e.clientHeight:e.clientWidth);J.set(t,{startX:(e.clientWidth-n)/2,startY:(e.clientHeight-n)/2}),nt(t,n,n)}function ot(t){const e=t.currentTarget;e instanceof rt&&(G.delete(e),e.classList.remove("nwse","nesw"),e.removeEventListener("mousemove",_),e.removeEventListener("mousemove",V),e.removeEventListener("touchmove",_),e.removeEventListener("touchmove",V))}function st(t,e){const{image:n}=Q.get(t)||{};if(!n)return;const i=n.naturalWidth/n.width;for(const n in e){const o=Math.round(e[n]*i);e[n]=o;const s=t.querySelector(`[data-image-crop-input='${n}']`);s instanceof HTMLInputElement&&(s.value=o.toString())}t.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:e}))}class rt extends HTMLElement{connectedCallback(){if(Q.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML='\n<style>\n :host { touch-action: none; display: block; }\n :host(.nesw) { cursor: nesw-resize; }\n :host(.nwse) { cursor: nwse-resize; }\n :host(.nesw) .crop-box, :host(.nwse) .crop-box { cursor: inherit; }\n :host([loaded]) .crop-image { display: block; }\n :host([loaded]) ::slotted([data-loading-slot]), .crop-image { display: none; }\n\n .crop-wrapper {\n position: relative;\n font-size: 0;\n }\n .crop-container {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n position: absolute;\n overflow: hidden;\n z-index: 1;\n top: 0;\n width: 100%;\n height: 100%;\n }\n\n :host([rounded]) .crop-box {\n border-radius: 50%;\n box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);\n }\n .crop-box {\n position: absolute;\n border: 1px dashed #fff;\n box-sizing: border-box;\n cursor: move;\n }\n\n :host([rounded]) .crop-outline {\n outline: none;\n }\n .crop-outline {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n outline: 4000px solid rgba(0, 0, 0, .3);\n }\n\n .handle { position: absolute; }\n :host([rounded]) .handle::before { border-radius: 50%; }\n .handle:before {\n position: absolute;\n display: block;\n padding: 4px;\n transform: translate(-50%, -50%);\n content: \' \';\n background: #fff;\n border: 1px solid #767676;\n }\n .ne { top: 0; right: 0; cursor: nesw-resize; }\n .nw { top: 0; left: 0; cursor: nwse-resize; }\n .se { bottom: 0; right: 0; cursor: nwse-resize; }\n .sw { bottom: 0; left: 0; cursor: nesw-resize; }\n</style>\n<slot></slot>\n<div class="crop-wrapper">\n <img width="100%" class="crop-image" alt="">\n <div class="crop-container">\n <div data-crop-box class="crop-box">\n <div class="crop-outline"></div>\n <div data-direction="nw" class="handle nw"></div>\n <div data-direction="ne" class="handle ne"></div>\n <div data-direction="sw" class="handle sw"></div>\n <div data-direction="se" class="handle se"></div>\n </div>\n </div>\n</div>\n';const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const n=t.querySelector("img");n instanceof HTMLImageElement&&(Q.set(this,{box:e,image:n}),n.addEventListener("load",(()=>{this.loaded=!0,it(this)})),this.addEventListener("mouseleave",ot),this.addEventListener("touchend",ot),this.addEventListener("mouseup",ot),e.addEventListener("mousedown",et),e.addEventListener("touchstart",et,{passive:!0}),this.addEventListener("keydown",V),this.addEventListener("keydown",_),this.src&&(n.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(t){t?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(t,e,n){const{image:i}=Q.get(this)||{};"src"===t&&(this.loaded=!1,i&&(i.src=n))}}window.customElements.get("image-crop")||(window.ImageCropElement=rt,window.customElements.define("image-crop",rt));class at extends HTMLElement{constructor(){super()}get preload(){return this.hasAttribute("preload")}set preload(t){t?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const t=this.parentElement;if(!t)return;const e=t.querySelector("summary");e&&(e.setAttribute("aria-haspopup","menu"),e.hasAttribute("role")||e.setAttribute("role","button"));const n=[lt(t,"compositionstart",(t=>yt(this,t))),lt(t,"compositionend",(t=>yt(this,t))),lt(t,"click",(e=>gt(t,this,e))),lt(t,"change",(e=>gt(t,this,e))),lt(t,"keydown",(e=>function(t,e,n){if(!(n instanceof KeyboardEvent))return;if(t.querySelector("details[open]"))return;const i=ct.get(e);if(!i||i.isComposing)return;const o=n.target instanceof Element&&"SUMMARY"===n.target.tagName;switch(n.key){case"Escape":t.hasAttribute("open")&&(vt(t),n.preventDefault(),n.stopPropagation());break;case"ArrowDown":{o&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=ft(t,!0);e&&e.focus(),n.preventDefault()}break;case"ArrowUp":{o&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=ft(t,!1);e&&e.focus(),n.preventDefault()}break;case"n":if(pt&&n.ctrlKey){const e=ft(t,!0);e&&e.focus(),n.preventDefault()}break;case"p":if(pt&&n.ctrlKey){const e=ft(t,!1);e&&e.focus(),n.preventDefault()}break;case" ":case"Enter":{const e=document.activeElement;e instanceof HTMLElement&&wt(e)&&e.closest("details")===t&&(n.preventDefault(),n.stopPropagation(),e.click())}}}(t,this,e))),lt(t,"toggle",(()=>dt(t,this)),{once:!0}),lt(t,"toggle",(()=>function(t){if(!t.hasAttribute("open"))return;for(const e of document.querySelectorAll("details[open] > details-menu")){const n=e.closest("details");n&&n!==t&&!n.contains(t)&&n.removeAttribute("open")}}(t))),this.preload?lt(t,"mouseover",(()=>dt(t,this)),{once:!0}):ut,...ht(t)];ct.set(this,{subscriptions:n,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=ct.get(this);if(t){ct.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const ct=new WeakMap,ut={unsubscribe(){}};function lt(t,e,n,i=!1){return t.addEventListener(e,n,i),{unsubscribe:()=>{t.removeEventListener(e,n,i)}}}function dt(t,e){const n=e.getAttribute("src");if(!n)return;const i=ct.get(e);if(!i)return;if(i.loaded)return;i.loaded=!0;const o=e.querySelector("include-fragment");o&&!o.hasAttribute("src")&&(o.addEventListener("loadend",(()=>mt(t))),o.setAttribute("src",n))}function ht(t){let e=!1;return[lt(t,"mousedown",(()=>e=!0)),lt(t,"keydown",(()=>e=!1)),lt(t,"toggle",(()=>{t.hasAttribute("open")&&(mt(t)||e||function(t){const e=document.activeElement;if(e&&wt(e)&&t.contains(e))return;const n=ft(t,!0);n&&n.focus()}(t))}))]}function mt(t){if(!t.hasAttribute("open"))return!1;const e=t.querySelector("[autofocus]");return!!e&&(e.focus(),!0)}function ft(t,e){const n=Array.from(t.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled]):not([aria-disabled="true"])')),i=document.activeElement,o=i instanceof HTMLElement?n.indexOf(i):-1,s=e?n[o+1]:n[o-1],r=e?n[0]:n[n.length-1];return s||r}const pt=navigator.userAgent.match(/Macintosh/);function gt(t,e,n){const i=n.target;if(i instanceof Element&&i.closest("details")===t)if("click"===n.type){const e=i.closest('[role="menuitem"], [role="menuitemradio"]'),n=e&&"LABEL"===e.tagName&&e.querySelector("input");e&&!n&&bt(e,t)}else if("change"===n.type){const e=i.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');e&&bt(e,t)}}function bt(t,e){if(t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled"))return;const n=t.closest("details-menu");if(!n)return;n.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:t}}))&&(!function(t,e){const n=e.querySelector("[data-menu-button]");if(!n)return;const i=function(t){if(!t)return null;const e=t.hasAttribute("data-menu-button-text")?t:t.querySelector("[data-menu-button-text]");return e?e.getAttribute("data-menu-button-text")||e.textContent:null}(t);if(i)n.textContent=i;else{const e=function(t){if(!t)return null;const e=t.hasAttribute("data-menu-button-contents")?t:t.querySelector("[data-menu-button-contents]");return e?e.innerHTML:null}(t);e&&(n.innerHTML=e)}}(t,e),function(t,e){for(const n of e.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const e=n.querySelector('input[type="radio"], input[type="checkbox"]');let i=(n===t).toString();e instanceof HTMLInputElement&&(i=e.indeterminate?"mixed":e.checked.toString()),n.setAttribute("aria-checked",i)}}(t,e),"menuitemcheckbox"!==t.getAttribute("role")&&vt(e),n.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:t}})))}function wt(t){const e=t.getAttribute("role");return"menuitem"===e||"menuitemcheckbox"===e||"menuitemradio"===e}function vt(t){if(!t.hasAttribute("open"))return;t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}function yt(t,e){const n=ct.get(t);n&&(n.isComposing="compositionstart"===e.type)}window.customElements.get("details-menu")||(window.DetailsMenuElement=at,window.customElements.define("details-menu",at));
2
2
  //# sourceMappingURL=primer_view_components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/combobox-nav/dist/index.js","../../../node_modules/@github/auto-complete-element/dist/index.js","../../../node_modules/@github/clipboard-copy-element/dist/index.esm.js","../../components/primer/clipboard_copy_component.js","../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/index.js","../../../node_modules/@github/image-crop-element/dist/index.js"],"sourcesContent":["const ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\nexport default class Combobox {\n constructor(input, list) {\n this.input = input;\n this.list = list;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random()\n .toString()\n .slice(2, 6)}`;\n }\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.setAttribute('aria-selected', 'false');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.setAttribute('aria-selected', 'false');\n }\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n case 'Tab':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nclass AutocompleteEvent extends CustomEvent {\n constructor(type, init) {\n super(type, init);\n this.relatedTarget = init.relatedTarget;\n }\n}\n\nfunction debounce(callback, wait = 0) {\n let timeout;\n return function (...Rest) {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => {\n clearTimeout(timeout);\n callback(...Rest);\n }, wait);\n };\n}\n\nconst requests = new WeakMap();\nfunction fragment(el, url) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.setRequestHeader('Accept', 'text/fragment+html');\n return request(el, xhr);\n}\nfunction request(el, xhr) {\n const pending = requests.get(el);\n if (pending)\n pending.abort();\n requests.set(el, xhr);\n const clear = () => requests.delete(el);\n const result = send(xhr);\n result.then(clear, clear);\n return result;\n}\nfunction send(xhr) {\n return new Promise((resolve, reject) => {\n xhr.onload = function () {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText);\n }\n else {\n reject(new Error(xhr.responseText));\n }\n };\n xhr.onerror = reject;\n xhr.send();\n });\n}\n\nclass Autocomplete {\n constructor(container, input, results) {\n this.container = container;\n this.input = input;\n this.results = results;\n this.combobox = new Combobox(input, results);\n this.results.hidden = true;\n this.input.setAttribute('autocomplete', 'off');\n this.input.setAttribute('spellcheck', 'false');\n this.interactingWithList = false;\n this.onInputChange = debounce(this.onInputChange.bind(this), 300);\n this.onResultsMouseDown = this.onResultsMouseDown.bind(this);\n this.onInputBlur = this.onInputBlur.bind(this);\n this.onInputFocus = this.onInputFocus.bind(this);\n this.onKeydown = this.onKeydown.bind(this);\n this.onCommit = this.onCommit.bind(this);\n this.input.addEventListener('keydown', this.onKeydown);\n this.input.addEventListener('focus', this.onInputFocus);\n this.input.addEventListener('blur', this.onInputBlur);\n this.input.addEventListener('input', this.onInputChange);\n this.results.addEventListener('mousedown', this.onResultsMouseDown);\n this.results.addEventListener('combobox-commit', this.onCommit);\n }\n destroy() {\n this.input.removeEventListener('keydown', this.onKeydown);\n this.input.removeEventListener('focus', this.onInputFocus);\n this.input.removeEventListener('blur', this.onInputBlur);\n this.input.removeEventListener('input', this.onInputChange);\n this.results.removeEventListener('mousedown', this.onResultsMouseDown);\n this.results.removeEventListener('combobox-commit', this.onCommit);\n }\n onKeydown(event) {\n if (event.key === 'Escape' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowUp' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowDown' && !this.container.open) {\n if (!this.input.value.trim())\n return;\n this.container.open = true;\n event.stopPropagation();\n event.preventDefault();\n }\n }\n onInputFocus() {\n this.fetchResults();\n }\n onInputBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.container.open = false;\n }\n onCommit({ target }) {\n const selected = target;\n if (!(selected instanceof HTMLElement))\n return;\n this.container.open = false;\n if (selected instanceof HTMLAnchorElement)\n return;\n const value = selected.getAttribute('data-autocomplete-value') || selected.textContent;\n this.container.value = value;\n }\n onResultsMouseDown() {\n this.interactingWithList = true;\n }\n onInputChange() {\n this.container.removeAttribute('value');\n this.fetchResults();\n }\n identifyOptions() {\n let id = 0;\n for (const el of this.results.querySelectorAll('[role=\"option\"]:not([id])')) {\n el.id = `${this.results.id}-option-${id++}`;\n }\n }\n fetchResults() {\n const query = this.input.value.trim();\n if (!query) {\n this.container.open = false;\n return;\n }\n const src = this.container.src;\n if (!src)\n return;\n const url = new URL(src, window.location.href);\n const params = new URLSearchParams(url.search.slice(1));\n params.append('q', query);\n url.search = params.toString();\n this.container.dispatchEvent(new CustomEvent('loadstart'));\n fragment(this.input, url.toString())\n .then(html => {\n this.results.innerHTML = html;\n this.identifyOptions();\n const hasResults = !!this.results.querySelector('[role=\"option\"]');\n this.container.open = hasResults;\n this.container.dispatchEvent(new CustomEvent('load'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n })\n .catch(() => {\n this.container.dispatchEvent(new CustomEvent('error'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n });\n }\n open() {\n if (!this.results.hidden)\n return;\n this.combobox.start();\n this.results.hidden = false;\n }\n close() {\n if (this.results.hidden)\n return;\n this.combobox.stop();\n this.results.hidden = true;\n }\n}\n\nconst state = new WeakMap();\nclass AutocompleteElement extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const listId = this.getAttribute('for');\n if (!listId)\n return;\n const input = this.querySelector('input');\n const results = document.getElementById(listId);\n if (!(input instanceof HTMLInputElement) || !results)\n return;\n state.set(this, new Autocomplete(this, input, results));\n results.setAttribute('role', 'listbox');\n }\n disconnectedCallback() {\n const autocomplete = state.get(this);\n if (autocomplete) {\n autocomplete.destroy();\n state.delete(this);\n }\n }\n get src() {\n return this.getAttribute('src') || '';\n }\n set src(url) {\n this.setAttribute('src', url);\n }\n get value() {\n return this.getAttribute('value') || '';\n }\n set value(value) {\n this.setAttribute('value', value);\n }\n get open() {\n return this.hasAttribute('open');\n }\n set open(value) {\n if (value) {\n this.setAttribute('open', '');\n }\n else {\n this.removeAttribute('open');\n }\n }\n static get observedAttributes() {\n return ['open', 'value'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue)\n return;\n const autocomplete = state.get(this);\n if (!autocomplete)\n return;\n switch (name) {\n case 'open':\n newValue === null ? autocomplete.close() : autocomplete.open();\n break;\n case 'value':\n if (newValue !== null) {\n autocomplete.input.value = newValue;\n }\n this.dispatchEvent(new AutocompleteEvent('auto-complete-change', {\n bubbles: true,\n relatedTarget: autocomplete.input\n }));\n break;\n }\n }\n}\n\nif (!window.customElements.get('auto-complete')) {\n window.AutocompleteElement = AutocompleteElement;\n window.customElements.define('auto-complete', AutocompleteElement);\n}\n\nexport default AutocompleteElement;\nexport { AutocompleteEvent };\n","function createNode(text) {\n const node = document.createElement('pre');\n node.style.width = '1px';\n node.style.height = '1px';\n node.style.position = 'fixed';\n node.style.top = '5px';\n node.textContent = text;\n return node;\n}\n\nfunction copyNode(node) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(node.textContent);\n }\n\n const selection = getSelection();\n\n if (selection == null) {\n return Promise.reject(new Error());\n }\n\n selection.removeAllRanges();\n const range = document.createRange();\n range.selectNodeContents(node);\n selection.addRange(range);\n document.execCommand('copy');\n selection.removeAllRanges();\n return Promise.resolve();\n}\nfunction copyText(text) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(text);\n }\n\n const body = document.body;\n\n if (!body) {\n return Promise.reject(new Error());\n }\n\n const node = createNode(text);\n body.appendChild(node);\n copyNode(node);\n body.removeChild(node);\n return Promise.resolve();\n}\n\nfunction copy(button) {\n const id = button.getAttribute('for');\n const text = button.getAttribute('value');\n\n function trigger() {\n button.dispatchEvent(new CustomEvent('clipboard-copy', {\n bubbles: true\n }));\n }\n\n if (text) {\n copyText(text).then(trigger);\n } else if (id) {\n const root = 'getRootNode' in Element.prototype ? button.getRootNode() : button.ownerDocument;\n if (!(root instanceof Document || 'ShadowRoot' in window && root instanceof ShadowRoot)) return;\n const node = root.getElementById(id);\n if (node) copyTarget(node).then(trigger);\n }\n}\n\nfunction copyTarget(content) {\n if (content instanceof HTMLInputElement || content instanceof HTMLTextAreaElement) {\n return copyText(content.value);\n } else if (content instanceof HTMLAnchorElement && content.hasAttribute('href')) {\n return copyText(content.href);\n } else {\n return copyNode(content);\n }\n}\n\nfunction clicked(event) {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n copy(button);\n }\n}\n\nfunction keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n event.preventDefault();\n copy(button);\n }\n }\n}\n\nfunction focused(event) {\n event.currentTarget.addEventListener('keydown', keydown);\n}\n\nfunction blurred(event) {\n event.currentTarget.removeEventListener('keydown', keydown);\n}\n\nclass ClipboardCopyElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('click', clicked);\n this.addEventListener('focus', focused);\n this.addEventListener('blur', blurred);\n }\n\n connectedCallback() {\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n }\n\n get value() {\n return this.getAttribute('value') || '';\n }\n\n set value(text) {\n this.setAttribute('value', text);\n }\n\n}\n\nif (!window.customElements.get('clipboard-copy')) {\n window.ClipboardCopyElement = ClipboardCopyElement;\n window.customElements.define('clipboard-copy', ClipboardCopyElement);\n}\n\nexport default ClipboardCopyElement;\n","import '@github/clipboard-copy-element';\nconst CLIPBOARD_COPY_TIMER_DURATION = 2000;\nfunction toggleSVG(svg) {\n if (svg.style.display === '' || svg.style.display === 'block') {\n svg.style.display = 'none';\n }\n else {\n svg.style.display = 'block';\n }\n}\n// Toggle a copy button.\nfunction toggleCopyButton(button) {\n const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');\n if (!clippyIcon || !checkIcon)\n return;\n toggleSVG(clippyIcon);\n toggleSVG(checkIcon);\n}\nconst clipboardCopyElementTimers = new WeakMap();\ndocument.addEventListener('clipboard-copy', function ({ target }) {\n if (!(target instanceof HTMLElement))\n return;\n if (!target.hasAttribute('data-view-component'))\n return;\n const currentTimeout = clipboardCopyElementTimers.get(target);\n if (currentTimeout) {\n clearTimeout(currentTimeout);\n clipboardCopyElementTimers.delete(target);\n }\n else {\n toggleCopyButton(target);\n }\n clipboardCopyElementTimers.set(target, setTimeout(toggleCopyButton, CLIPBOARD_COPY_TIMER_DURATION, target));\n});\n","export default class TabContainerElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('keydown', (event) => {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.getAttribute('role') !== 'tab' && !target.closest('[role=\"tablist\"]'))\n return;\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n const currentIndex = tabs.indexOf(tabs.find(tab => tab.matches('[aria-selected=\"true\"]')));\n if (event.code === 'ArrowRight') {\n let index = currentIndex + 1;\n if (index >= tabs.length)\n index = 0;\n selectTab(this, index);\n }\n else if (event.code === 'ArrowLeft') {\n let index = currentIndex - 1;\n if (index < 0)\n index = tabs.length - 1;\n selectTab(this, index);\n }\n else if (event.code === 'Home') {\n selectTab(this, 0);\n event.preventDefault();\n }\n else if (event.code === 'End') {\n selectTab(this, tabs.length - 1);\n event.preventDefault();\n }\n });\n this.addEventListener('click', (event) => {\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n if (!(event.target instanceof Element))\n return;\n const tab = event.target.closest('[role=\"tab\"]');\n if (!tab || !tab.closest('[role=\"tablist\"]'))\n return;\n const index = tabs.indexOf(tab);\n selectTab(this, index);\n });\n }\n connectedCallback() {\n for (const tab of this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]')) {\n if (!tab.hasAttribute('aria-selected')) {\n tab.setAttribute('aria-selected', 'false');\n }\n if (!tab.hasAttribute('tabindex')) {\n if (tab.getAttribute('aria-selected') === 'true') {\n tab.setAttribute('tabindex', '0');\n }\n else {\n tab.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\nfunction selectTab(tabContainer, index) {\n const tabs = tabContainer.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]');\n const panels = tabContainer.querySelectorAll('[role=\"tabpanel\"]');\n const selectedTab = tabs[index];\n const selectedPanel = panels[index];\n const cancelled = !tabContainer.dispatchEvent(new CustomEvent('tab-container-change', {\n bubbles: true,\n cancelable: true,\n detail: { relatedTarget: selectedPanel }\n }));\n if (cancelled)\n return;\n for (const tab of tabs) {\n tab.setAttribute('aria-selected', 'false');\n tab.setAttribute('tabindex', '-1');\n }\n for (const panel of panels) {\n panel.hidden = true;\n if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) {\n panel.setAttribute('tabindex', '0');\n }\n }\n selectedTab.setAttribute('aria-selected', 'true');\n selectedTab.setAttribute('tabindex', '0');\n selectedTab.focus();\n selectedPanel.hidden = false;\n tabContainer.dispatchEvent(new CustomEvent('tab-container-changed', {\n bubbles: true,\n detail: { relatedTarget: selectedPanel }\n }));\n}\nif (!window.customElements.get('tab-container')) {\n window.TabContainerElement = TabContainerElement;\n window.customElements.define('tab-container', TabContainerElement);\n}\n//# sourceMappingURL=index.js.map","const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst months = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December'\n];\nfunction pad(num) {\n return `0${num}`.slice(-2);\n}\nfunction strftime(time, formatString) {\n const day = time.getDay();\n const date = time.getDate();\n const month = time.getMonth();\n const year = time.getFullYear();\n const hour = time.getHours();\n const minute = time.getMinutes();\n const second = time.getSeconds();\n return formatString.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g, function (_arg) {\n let match;\n const modifier = _arg[1];\n switch (modifier) {\n case '%':\n return '%';\n case 'a':\n return weekdays[day].slice(0, 3);\n case 'A':\n return weekdays[day];\n case 'b':\n return months[month].slice(0, 3);\n case 'B':\n return months[month];\n case 'c':\n return time.toString();\n case 'd':\n return pad(date);\n case 'e':\n return String(date);\n case 'H':\n return pad(hour);\n case 'I':\n return pad(strftime(time, '%l'));\n case 'l':\n if (hour === 0 || hour === 12) {\n return String(12);\n }\n else {\n return String((hour + 12) % 12);\n }\n case 'm':\n return pad(month + 1);\n case 'M':\n return pad(minute);\n case 'p':\n if (hour > 11) {\n return 'PM';\n }\n else {\n return 'AM';\n }\n case 'P':\n if (hour > 11) {\n return 'pm';\n }\n else {\n return 'am';\n }\n case 'S':\n return pad(second);\n case 'w':\n return String(day);\n case 'y':\n return pad(year % 100);\n case 'Y':\n return String(year);\n case 'Z':\n match = time.toString().match(/\\((\\w+)\\)$/);\n return match ? match[1] : '';\n case 'z':\n match = time.toString().match(/\\w([+-]\\d\\d\\d\\d) /);\n return match ? match[1] : '';\n }\n return '';\n });\n}\nfunction makeFormatter(options) {\n let format;\n return function () {\n if (format)\n return format;\n if ('Intl' in window) {\n try {\n format = new Intl.DateTimeFormat(undefined, options);\n return format;\n }\n catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n };\n}\nlet dayFirst = null;\nconst dayFirstFormatter = makeFormatter({ day: 'numeric', month: 'short' });\nfunction isDayFirst() {\n if (dayFirst !== null) {\n return dayFirst;\n }\n const formatter = dayFirstFormatter();\n if (formatter) {\n const output = formatter.format(new Date(0));\n dayFirst = !!output.match(/^\\d/);\n return dayFirst;\n }\n else {\n return false;\n }\n}\nlet yearSeparator = null;\nconst yearFormatter = makeFormatter({ day: 'numeric', month: 'short', year: 'numeric' });\nfunction isYearSeparator() {\n if (yearSeparator !== null) {\n return yearSeparator;\n }\n const formatter = yearFormatter();\n if (formatter) {\n const output = formatter.format(new Date(0));\n yearSeparator = !!output.match(/\\d,/);\n return yearSeparator;\n }\n else {\n return true;\n }\n}\nfunction isThisYear(date) {\n const now = new Date();\n return now.getUTCFullYear() === date.getUTCFullYear();\n}\nfunction makeRelativeFormat(locale, options) {\n if ('Intl' in window && 'RelativeTimeFormat' in window.Intl) {\n try {\n return new Intl.RelativeTimeFormat(locale, options);\n }\n catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n}\nfunction localeFromElement(el) {\n const container = el.closest('[lang]');\n if (container instanceof HTMLElement && container.lang) {\n return container.lang;\n }\n return 'default';\n}\n\nconst datetimes = new WeakMap();\nclass ExtendedTimeElement extends HTMLElement {\n static get observedAttributes() {\n return [\n 'datetime',\n 'day',\n 'format',\n 'lang',\n 'hour',\n 'minute',\n 'month',\n 'second',\n 'title',\n 'weekday',\n 'year',\n 'time-zone-name'\n ];\n }\n connectedCallback() {\n const title = this.getFormattedTitle();\n if (title && !this.hasAttribute('title')) {\n this.setAttribute('title', title);\n }\n const text = this.getFormattedDate();\n if (text) {\n this.textContent = text;\n }\n }\n attributeChangedCallback(attrName, oldValue, newValue) {\n const oldTitle = this.getFormattedTitle();\n if (attrName === 'datetime') {\n const millis = Date.parse(newValue);\n if (isNaN(millis)) {\n datetimes.delete(this);\n }\n else {\n datetimes.set(this, new Date(millis));\n }\n }\n const title = this.getFormattedTitle();\n const currentTitle = this.getAttribute('title');\n if (attrName !== 'title' && title && (!currentTitle || currentTitle === oldTitle)) {\n this.setAttribute('title', title);\n }\n const text = this.getFormattedDate();\n if (text) {\n this.textContent = text;\n }\n }\n get date() {\n return datetimes.get(this);\n }\n getFormattedTitle() {\n const date = this.date;\n if (!date)\n return;\n const formatter = titleFormatter();\n if (formatter) {\n return formatter.format(date);\n }\n else {\n try {\n return date.toLocaleString();\n }\n catch (e) {\n if (e instanceof RangeError) {\n return date.toString();\n }\n else {\n throw e;\n }\n }\n }\n }\n getFormattedDate() {\n return;\n }\n}\nconst titleFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short'\n});\n\nconst formatters = new WeakMap();\nclass LocalTimeElement extends ExtendedTimeElement {\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'hour' || attrName === 'minute' || attrName === 'second' || attrName === 'time-zone-name') {\n formatters.delete(this);\n }\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n getFormattedDate() {\n const d = this.date;\n if (!d)\n return;\n const date = formatDate(this, d) || '';\n const time = formatTime(this, d) || '';\n return `${date} ${time}`.trim();\n }\n}\nfunction formatDate(el, date) {\n const props = {\n weekday: {\n short: '%a',\n long: '%A'\n },\n day: {\n numeric: '%e',\n '2-digit': '%d'\n },\n month: {\n short: '%b',\n long: '%B'\n },\n year: {\n numeric: '%Y',\n '2-digit': '%y'\n }\n };\n let format = isDayFirst() ? 'weekday day month year' : 'weekday month day, year';\n for (const prop in props) {\n const value = props[prop][el.getAttribute(prop) || ''];\n format = format.replace(prop, value || '');\n }\n format = format.replace(/(\\s,)|(,\\s$)/, '');\n return strftime(date, format).replace(/\\s+/, ' ').trim();\n}\nfunction formatTime(el, date) {\n const options = {};\n const hour = el.getAttribute('hour');\n if (hour === 'numeric' || hour === '2-digit')\n options.hour = hour;\n const minute = el.getAttribute('minute');\n if (minute === 'numeric' || minute === '2-digit')\n options.minute = minute;\n const second = el.getAttribute('second');\n if (second === 'numeric' || second === '2-digit')\n options.second = second;\n const tz = el.getAttribute('time-zone-name');\n if (tz === 'short' || tz === 'long')\n options.timeZoneName = tz;\n if (Object.keys(options).length === 0) {\n return;\n }\n let factory = formatters.get(el);\n if (!factory) {\n factory = makeFormatter(options);\n formatters.set(el, factory);\n }\n const formatter = factory();\n if (formatter) {\n return formatter.format(date);\n }\n else {\n const timef = options.second ? '%H:%M:%S' : '%H:%M';\n return strftime(date, timef);\n }\n}\nif (!window.customElements.get('local-time')) {\n window.LocalTimeElement = LocalTimeElement;\n window.customElements.define('local-time', LocalTimeElement);\n}\n\nclass RelativeTime {\n constructor(date, locale) {\n this.date = date;\n this.locale = locale;\n }\n toString() {\n const ago = this.timeElapsed();\n if (ago) {\n return ago;\n }\n else {\n const ahead = this.timeAhead();\n if (ahead) {\n return ahead;\n }\n else {\n return `on ${this.formatDate()}`;\n }\n }\n }\n timeElapsed() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && day < 30) {\n return this.timeAgoFromMs(ms);\n }\n else {\n return null;\n }\n }\n timeAhead() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && day < 30) {\n return this.timeUntil();\n }\n else {\n return null;\n }\n }\n timeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n return this.timeAgoFromMs(ms);\n }\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (ms < 0) {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n else if (sec < 10) {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n else if (sec < 45) {\n return formatRelativeTime(this.locale, -sec, 'second');\n }\n else if (sec < 90) {\n return formatRelativeTime(this.locale, -min, 'minute');\n }\n else if (min < 45) {\n return formatRelativeTime(this.locale, -min, 'minute');\n }\n else if (min < 90) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n }\n else if (hr < 24) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n }\n else if (hr < 36) {\n return formatRelativeTime(this.locale, -day, 'day');\n }\n else if (day < 30) {\n return formatRelativeTime(this.locale, -day, 'day');\n }\n else if (month < 18) {\n return formatRelativeTime(this.locale, -month, 'month');\n }\n else {\n return formatRelativeTime(this.locale, -year, 'year');\n }\n }\n microTimeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (min < 1) {\n return '1m';\n }\n else if (min < 60) {\n return `${min}m`;\n }\n else if (hr < 24) {\n return `${hr}h`;\n }\n else if (day < 365) {\n return `${day}d`;\n }\n else {\n return `${year}y`;\n }\n }\n timeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n return this.timeUntilFromMs(ms);\n }\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (month >= 18) {\n return formatRelativeTime(this.locale, year, 'year');\n }\n else if (month >= 12) {\n return formatRelativeTime(this.locale, year, 'year');\n }\n else if (day >= 45) {\n return formatRelativeTime(this.locale, month, 'month');\n }\n else if (day >= 30) {\n return formatRelativeTime(this.locale, month, 'month');\n }\n else if (hr >= 36) {\n return formatRelativeTime(this.locale, day, 'day');\n }\n else if (hr >= 24) {\n return formatRelativeTime(this.locale, day, 'day');\n }\n else if (min >= 90) {\n return formatRelativeTime(this.locale, hr, 'hour');\n }\n else if (min >= 45) {\n return formatRelativeTime(this.locale, hr, 'hour');\n }\n else if (sec >= 90) {\n return formatRelativeTime(this.locale, min, 'minute');\n }\n else if (sec >= 45) {\n return formatRelativeTime(this.locale, min, 'minute');\n }\n else if (sec >= 10) {\n return formatRelativeTime(this.locale, sec, 'second');\n }\n else {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n }\n microTimeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (day >= 365) {\n return `${year}y`;\n }\n else if (hr >= 24) {\n return `${day}d`;\n }\n else if (min >= 60) {\n return `${hr}h`;\n }\n else if (min > 1) {\n return `${min}m`;\n }\n else {\n return '1m';\n }\n }\n formatDate() {\n let format = isDayFirst() ? '%e %b' : '%b %e';\n if (!isThisYear(this.date)) {\n format += isYearSeparator() ? ', %Y' : ' %Y';\n }\n return strftime(this.date, format);\n }\n formatTime() {\n const formatter = timeFormatter();\n if (formatter) {\n return formatter.format(this.date);\n }\n else {\n return strftime(this.date, '%l:%M%P');\n }\n }\n}\nfunction formatRelativeTime(locale, value, unit) {\n const formatter = makeRelativeFormat(locale, { numeric: 'auto' });\n if (formatter) {\n return formatter.format(value, unit);\n }\n else {\n return formatEnRelativeTime(value, unit);\n }\n}\nfunction formatEnRelativeTime(value, unit) {\n if (value === 0) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `this ${unit}`;\n case 'day':\n return 'today';\n case 'hour':\n case 'minute':\n return `in 0 ${unit}s`;\n case 'second':\n return 'now';\n }\n }\n else if (value === 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `next ${unit}`;\n case 'day':\n return 'tomorrow';\n case 'hour':\n case 'minute':\n case 'second':\n return `in 1 ${unit}`;\n }\n }\n else if (value === -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `last ${unit}`;\n case 'day':\n return 'yesterday';\n case 'hour':\n case 'minute':\n case 'second':\n return `1 ${unit} ago`;\n }\n }\n else if (value > 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return `in ${value} ${unit}s`;\n }\n }\n else if (value < -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return `${-value} ${unit}s ago`;\n }\n }\n throw new RangeError(`Invalid unit argument for format() '${unit}'`);\n}\nconst timeFormatter = makeFormatter({ hour: 'numeric', minute: '2-digit' });\n\nclass RelativeTimeElement extends ExtendedTimeElement {\n getFormattedDate() {\n const date = this.date;\n if (!date)\n return;\n return new RelativeTime(date, localeFromElement(this)).toString();\n }\n connectedCallback() {\n nowElements.push(this);\n if (!updateNowElementsId) {\n updateNowElements();\n updateNowElementsId = window.setInterval(updateNowElements, 60 * 1000);\n }\n super.connectedCallback();\n }\n disconnectedCallback() {\n const ix = nowElements.indexOf(this);\n if (ix !== -1) {\n nowElements.splice(ix, 1);\n }\n if (!nowElements.length) {\n if (updateNowElementsId) {\n clearInterval(updateNowElementsId);\n updateNowElementsId = null;\n }\n }\n }\n}\nconst nowElements = [];\nlet updateNowElementsId;\nfunction updateNowElements() {\n let time, i, len;\n for (i = 0, len = nowElements.length; i < len; i++) {\n time = nowElements[i];\n time.textContent = time.getFormattedDate() || '';\n }\n}\nif (!window.customElements.get('relative-time')) {\n window.RelativeTimeElement = RelativeTimeElement;\n window.customElements.define('relative-time', RelativeTimeElement);\n}\n\nclass TimeAgoElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date)\n return;\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeAgo();\n }\n else {\n return new RelativeTime(date, localeFromElement(this)).timeAgo();\n }\n }\n}\nif (!window.customElements.get('time-ago')) {\n window.TimeAgoElement = TimeAgoElement;\n window.customElements.define('time-ago', TimeAgoElement);\n}\n\nclass TimeUntilElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date)\n return;\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeUntil();\n }\n else {\n return new RelativeTime(date, localeFromElement(this)).timeUntil();\n }\n }\n}\nif (!window.customElements.get('time-until')) {\n window.TimeUntilElement = TimeUntilElement;\n window.customElements.define('time-until', TimeUntilElement);\n}\n\nexport { LocalTimeElement, RelativeTimeElement, TimeAgoElement, TimeUntilElement };\n","const startPositions = new WeakMap();\nconst dragStartPositions = new WeakMap();\nconst constructedElements = new WeakMap();\nfunction moveCropArea(event) {\n const el = event.currentTarget;\n if (!(el instanceof ImageCropElement))\n return;\n const { box, image } = constructedElements.get(el) || {};\n if (!box || !image)\n return;\n let deltaX = 0;\n let deltaY = 0;\n if (event instanceof KeyboardEvent) {\n if (event.key === 'ArrowUp') {\n deltaY = -1;\n }\n else if (event.key === 'ArrowDown') {\n deltaY = 1;\n }\n else if (event.key === 'ArrowLeft') {\n deltaX = -1;\n }\n else if (event.key === 'ArrowRight') {\n deltaX = 1;\n }\n }\n else if (dragStartPositions.has(el) && event instanceof MouseEvent) {\n const pos = dragStartPositions.get(el);\n deltaX = event.pageX - pos.dragStartX;\n deltaY = event.pageY - pos.dragStartY;\n }\n else if (dragStartPositions.has(el) && event instanceof TouchEvent) {\n const { pageX, pageY } = event.changedTouches[0];\n const { dragStartX, dragStartY } = dragStartPositions.get(el);\n deltaX = pageX - dragStartX;\n deltaY = pageY - dragStartY;\n }\n if (deltaX !== 0 || deltaY !== 0) {\n const x = Math.min(Math.max(0, box.offsetLeft + deltaX), image.width - box.offsetWidth);\n const y = Math.min(Math.max(0, box.offsetTop + deltaY), image.height - box.offsetHeight);\n box.style.left = `${x}px`;\n box.style.top = `${y}px`;\n fireChangeEvent(el, { x, y, width: box.offsetWidth, height: box.offsetHeight });\n }\n if (event instanceof MouseEvent) {\n dragStartPositions.set(el, {\n dragStartX: event.pageX,\n dragStartY: event.pageY\n });\n }\n else if (event instanceof TouchEvent) {\n const { pageX, pageY } = event.changedTouches[0];\n dragStartPositions.set(el, {\n dragStartX: pageX,\n dragStartY: pageY\n });\n }\n}\nfunction updateCropArea(event) {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n const el = getShadowHost(target);\n if (!(el instanceof ImageCropElement))\n return;\n const { box } = constructedElements.get(el) || {};\n if (!box)\n return;\n const rect = el.getBoundingClientRect();\n let deltaX, deltaY, delta;\n if (event instanceof KeyboardEvent) {\n if (event.key === 'Escape')\n return setInitialPosition(el);\n if (event.key === '-')\n delta = -10;\n if (event.key === '=')\n delta = +10;\n if (!delta)\n return;\n deltaX = box.offsetWidth + delta;\n deltaY = box.offsetHeight + delta;\n startPositions.set(el, { startX: box.offsetLeft, startY: box.offsetTop });\n }\n else if (event instanceof MouseEvent) {\n const pos = startPositions.get(el);\n if (!pos)\n return;\n deltaX = event.pageX - pos.startX - rect.left - window.pageXOffset;\n deltaY = event.pageY - pos.startY - rect.top - window.pageYOffset;\n }\n else if (event instanceof TouchEvent) {\n const pos = startPositions.get(el);\n if (!pos)\n return;\n deltaX = event.changedTouches[0].pageX - pos.startX - rect.left - window.pageXOffset;\n deltaY = event.changedTouches[0].pageY - pos.startY - rect.top - window.pageYOffset;\n }\n if (deltaX && deltaY)\n updateDimensions(el, deltaX, deltaY, !(event instanceof KeyboardEvent));\n}\nfunction getShadowHost(el) {\n const rootNode = el.getRootNode();\n if (!(rootNode instanceof ShadowRoot))\n return el;\n return rootNode.host;\n}\nfunction startUpdate(event) {\n const currentTarget = event.currentTarget;\n if (!(currentTarget instanceof HTMLElement))\n return;\n const el = getShadowHost(currentTarget);\n if (!(el instanceof ImageCropElement))\n return;\n const { box } = constructedElements.get(el) || {};\n if (!box)\n return;\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.hasAttribute('data-direction')) {\n const direction = target.getAttribute('data-direction') || '';\n el.addEventListener('mousemove', updateCropArea);\n el.addEventListener('touchmove', updateCropArea, { passive: true });\n if (['nw', 'se'].indexOf(direction) >= 0)\n el.classList.add('nwse');\n if (['ne', 'sw'].indexOf(direction) >= 0)\n el.classList.add('nesw');\n startPositions.set(el, {\n startX: box.offsetLeft + (['se', 'ne'].indexOf(direction) >= 0 ? 0 : box.offsetWidth),\n startY: box.offsetTop + (['se', 'sw'].indexOf(direction) >= 0 ? 0 : box.offsetHeight)\n });\n updateCropArea(event);\n }\n else {\n el.addEventListener('mousemove', moveCropArea);\n el.addEventListener('touchmove', moveCropArea, { passive: true });\n }\n}\nfunction updateDimensions(target, deltaX, deltaY, reposition = true) {\n let newSide = Math.max(Math.abs(deltaX), Math.abs(deltaY), 10);\n const pos = startPositions.get(target);\n if (!pos)\n return;\n const { box, image } = constructedElements.get(target) || {};\n if (!box || !image)\n return;\n newSide = Math.min(newSide, deltaY > 0 ? image.height - pos.startY : pos.startY, deltaX > 0 ? image.width - pos.startX : pos.startX);\n const x = reposition ? Math.round(Math.max(0, deltaX > 0 ? pos.startX : pos.startX - newSide)) : box.offsetLeft;\n const y = reposition ? Math.round(Math.max(0, deltaY > 0 ? pos.startY : pos.startY - newSide)) : box.offsetTop;\n box.style.left = `${x}px`;\n box.style.top = `${y}px`;\n box.style.width = `${newSide}px`;\n box.style.height = `${newSide}px`;\n fireChangeEvent(target, { x, y, width: newSide, height: newSide });\n}\nfunction setInitialPosition(el) {\n const { image } = constructedElements.get(el) || {};\n if (!image)\n return;\n const side = Math.round(image.clientWidth > image.clientHeight ? image.clientHeight : image.clientWidth);\n startPositions.set(el, {\n startX: (image.clientWidth - side) / 2,\n startY: (image.clientHeight - side) / 2\n });\n updateDimensions(el, side, side);\n}\nfunction stopUpdate(event) {\n const el = event.currentTarget;\n if (!(el instanceof ImageCropElement))\n return;\n dragStartPositions.delete(el);\n el.classList.remove('nwse', 'nesw');\n el.removeEventListener('mousemove', updateCropArea);\n el.removeEventListener('mousemove', moveCropArea);\n el.removeEventListener('touchmove', updateCropArea);\n el.removeEventListener('touchmove', moveCropArea);\n}\nfunction fireChangeEvent(target, result) {\n const { image } = constructedElements.get(target) || {};\n if (!image)\n return;\n const ratio = image.naturalWidth / image.width;\n for (const key in result) {\n const value = Math.round(result[key] * ratio);\n result[key] = value;\n const slottedInput = target.querySelector(`[data-image-crop-input='${key}']`);\n if (slottedInput instanceof HTMLInputElement)\n slottedInput.value = value.toString();\n }\n target.dispatchEvent(new CustomEvent('image-crop-change', { bubbles: true, detail: result }));\n}\nclass ImageCropElement extends HTMLElement {\n connectedCallback() {\n if (constructedElements.has(this))\n return;\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.innerHTML = `\n<style>\n :host { touch-action: none; display: block; }\n :host(.nesw) { cursor: nesw-resize; }\n :host(.nwse) { cursor: nwse-resize; }\n :host(.nesw) .crop-box, :host(.nwse) .crop-box { cursor: inherit; }\n :host([loaded]) .crop-image { display: block; }\n :host([loaded]) ::slotted([data-loading-slot]), .crop-image { display: none; }\n\n .crop-wrapper {\n position: relative;\n font-size: 0;\n }\n .crop-container {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n position: absolute;\n overflow: hidden;\n z-index: 1;\n top: 0;\n width: 100%;\n height: 100%;\n }\n\n :host([rounded]) .crop-box {\n border-radius: 50%;\n box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);\n }\n .crop-box {\n position: absolute;\n border: 1px dashed #fff;\n box-sizing: border-box;\n cursor: move;\n }\n\n :host([rounded]) .crop-outline {\n outline: none;\n }\n .crop-outline {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n outline: 4000px solid rgba(0, 0, 0, .3);\n }\n\n .handle { position: absolute; }\n :host([rounded]) .handle::before { border-radius: 50%; }\n .handle:before {\n position: absolute;\n display: block;\n padding: 4px;\n transform: translate(-50%, -50%);\n content: ' ';\n background: #fff;\n border: 1px solid #767676;\n }\n .ne { top: 0; right: 0; cursor: nesw-resize; }\n .nw { top: 0; left: 0; cursor: nwse-resize; }\n .se { bottom: 0; right: 0; cursor: nwse-resize; }\n .sw { bottom: 0; left: 0; cursor: nesw-resize; }\n</style>\n<slot></slot>\n<div class=\"crop-wrapper\">\n <img width=\"100%\" class=\"crop-image\" alt=\"\">\n <div class=\"crop-container\">\n <div data-crop-box class=\"crop-box\">\n <div class=\"crop-outline\"></div>\n <div data-direction=\"nw\" class=\"handle nw\"></div>\n <div data-direction=\"ne\" class=\"handle ne\"></div>\n <div data-direction=\"sw\" class=\"handle sw\"></div>\n <div data-direction=\"se\" class=\"handle se\"></div>\n </div>\n </div>\n</div>\n`;\n const box = shadowRoot.querySelector('[data-crop-box]');\n if (!(box instanceof HTMLElement))\n return;\n const image = shadowRoot.querySelector('img');\n if (!(image instanceof HTMLImageElement))\n return;\n constructedElements.set(this, { box, image });\n image.addEventListener('load', () => {\n this.loaded = true;\n setInitialPosition(this);\n });\n this.addEventListener('mouseleave', stopUpdate);\n this.addEventListener('touchend', stopUpdate);\n this.addEventListener('mouseup', stopUpdate);\n box.addEventListener('mousedown', startUpdate);\n box.addEventListener('touchstart', startUpdate, { passive: true });\n this.addEventListener('keydown', moveCropArea);\n this.addEventListener('keydown', updateCropArea);\n if (this.src)\n image.src = this.src;\n }\n static get observedAttributes() {\n return ['src'];\n }\n get src() {\n return this.getAttribute('src');\n }\n set src(val) {\n if (val) {\n this.setAttribute('src', val);\n }\n else {\n this.removeAttribute('src');\n }\n }\n get loaded() {\n return this.hasAttribute('loaded');\n }\n set loaded(val) {\n if (val) {\n this.setAttribute('loaded', '');\n }\n else {\n this.removeAttribute('loaded');\n }\n }\n attributeChangedCallback(attribute, oldValue, newValue) {\n const { image } = constructedElements.get(this) || {};\n if (attribute === 'src') {\n this.loaded = false;\n if (image)\n image.src = newValue;\n }\n }\n}\nexport default ImageCropElement;\nif (!window.customElements.get('image-crop')) {\n window.ImageCropElement = ImageCropElement;\n window.customElements.define('image-crop', ImageCropElement);\n}\n"],"names":["ctrlBindings","navigator","userAgent","match","Combobox","[object Object]","input","list","this","isComposing","id","Math","random","toString","slice","keyboardEventHandler","event","combobox","shiftKey","metaKey","altKey","ctrlKey","key","target","querySelector","getAttribute","click","commit","preventDefault","clearSelection","navigate","keyboardBindings","compositionEventHandler","type","document","getElementById","trackComposition","inputHandler","bind","setAttribute","stop","removeAttribute","addEventListener","commitWithElement","removeEventListener","indexDiff","focusEl","Array","from","querySelectorAll","filter","visible","els","focusIndex","indexOf","length","focus","indexOfItem","newIndex","el","scrollTo","Element","closest","dispatchEvent","CustomEvent","bubbles","fireCommitEvent","hidden","HTMLInputElement","offsetWidth","offsetHeight","container","element","scrollTop","containerBottom","clientHeight","top","offsetTop","bottom","inViewport","AutocompleteEvent","init","super","relatedTarget","requests","WeakMap","fragment","url","xhr","XMLHttpRequest","open","setRequestHeader","pending","get","abort","set","clear","delete","result","Promise","resolve","reject","onload","status","responseText","Error","onerror","send","then","request","Autocomplete","results","interactingWithList","onInputChange","callback","wait","timeout","Rest","clearTimeout","window","setTimeout","debounce","onResultsMouseDown","onInputBlur","onInputFocus","onKeydown","onCommit","stopPropagation","value","trim","fetchResults","selected","HTMLElement","HTMLAnchorElement","textContent","query","src","URL","location","href","params","URLSearchParams","search","append","html","innerHTML","identifyOptions","hasResults","catch","start","state","AutocompleteElement","listId","autocomplete","destroy","hasAttribute","observedAttributes","name","oldValue","newValue","close","copyNode","node","clipboard","writeText","selection","getSelection","removeAllRanges","range","createRange","selectNodeContents","addRange","execCommand","copyText","text","body","createElement","style","width","height","position","createNode","appendChild","removeChild","copy","button","trigger","root","prototype","getRootNode","ownerDocument","Document","ShadowRoot","content","HTMLTextAreaElement","clicked","currentTarget","keydown","focused","blurred","customElements","define","ClipboardCopyElement","toggleSVG","svg","display","toggleCopyButton","clippyIcon","checkIcon","clipboardCopyElementTimers","currentTimeout","TabContainerElement","tabs","currentIndex","find","tab","matches","code","index","selectTab","tabContainer","panels","selectedTab","selectedPanel","cancelable","detail","panel","weekdays","months","pad","num","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","lang","datetimes","ExtendedTimeElement","title","getFormattedTitle","getFormattedDate","attrName","oldTitle","millis","parse","isNaN","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","round","min","hr","timeAgoFromMs","timeUntil","formatRelativeTime","timeUntilFromMs","getUTCFullYear","isYearSeparator","timeFormatter","unit","RelativeTimeFormat","makeRelativeFormat","formatEnRelativeTime","RelativeTimeElement","nowElements","push","updateNowElementsId","updateNowElements","setInterval","connectedCallback","ix","splice","clearInterval","i","len","TimeAgoElement","microTimeAgo","timeAgo","TimeUntilElement","microTimeUntil","startPositions","dragStartPositions","constructedElements","moveCropArea","ImageCropElement","box","image","deltaX","deltaY","KeyboardEvent","has","MouseEvent","pos","pageX","dragStartX","pageY","dragStartY","TouchEvent","changedTouches","x","max","offsetLeft","y","left","fireChangeEvent","updateCropArea","getShadowHost","rect","getBoundingClientRect","delta","setInitialPosition","startX","startY","pageXOffset","pageYOffset","updateDimensions","rootNode","host","startUpdate","direction","passive","classList","add","reposition","newSide","abs","side","clientWidth","stopUpdate","remove","ratio","naturalWidth","slottedInput","shadowRoot","attachShadow","mode","HTM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/S,iBAAiB,YAAagV,IAClCjC,EAAI/S,iBAAiB,aAAcgV,GAAa,CAAEE,SAAS,IAC3DpX,KAAKkC,iBAAiB,UAAW6S,GACjC/U,KAAKkC,iBAAiB,UAAWmU,GAC7BrW,KAAKgI,MACLkN,EAAMlN,IAAMhI,KAAKgI,MAEzBoB,gCACI,MAAO,CAAC,OAEZpB,UACI,OAAOhI,KAAKiB,aAAa,OAE7B+G,QAAQsQ,GACAA,EACAtY,KAAK+B,aAAa,MAAOuW,GAGzBtY,KAAKiC,gBAAgB,OAG7BoW,aACI,OAAOrY,KAAKmJ,aAAa,UAE7BkP,WAAWC,GACHA,EACAtY,KAAK+B,aAAa,SAAU,IAG5B/B,KAAKiC,gBAAgB,UAG7BpC,yBAAyB0Y,EAAWjP,EAAUC,GAC1C,MAAM2L,MAAEA,GAAUJ,EAAoBzP,IAAIrF,OAAS,GACjC,QAAduY,IACAvY,KAAKqY,QAAS,EACVnD,IACAA,EAAMlN,IAAMuB,KAKvBxC,OAAOiF,eAAe3G,IAAI,gBAC3B0B,OAAOiO,iBAAmBA,GAC1BjO,OAAOiF,eAAeC,OAAO,aAAc+I"}
1
+ {"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/combobox-nav/dist/index.js","../../../node_modules/@github/auto-complete-element/dist/index.js","../../../node_modules/@github/clipboard-copy-element/dist/index.esm.js","../../components/primer/clipboard_copy_component.js","../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/index.js","../../../node_modules/@github/image-crop-element/dist/index.js","../../../node_modules/@github/details-menu-element/dist/index.js"],"sourcesContent":["const ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\nexport default class Combobox {\n constructor(input, list) {\n this.input = input;\n this.list = list;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random()\n .toString()\n .slice(2, 6)}`;\n }\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.setAttribute('aria-selected', 'false');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.setAttribute('aria-selected', 'false');\n }\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n case 'Tab':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nclass AutocompleteEvent extends CustomEvent {\n constructor(type, init) {\n super(type, init);\n this.relatedTarget = init.relatedTarget;\n }\n}\n\nfunction debounce(callback, wait = 0) {\n let timeout;\n return function (...Rest) {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => {\n clearTimeout(timeout);\n callback(...Rest);\n }, wait);\n };\n}\n\nconst requests = new WeakMap();\nfunction fragment(el, url) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.setRequestHeader('Accept', 'text/fragment+html');\n return request(el, xhr);\n}\nfunction request(el, xhr) {\n const pending = requests.get(el);\n if (pending)\n pending.abort();\n requests.set(el, xhr);\n const clear = () => requests.delete(el);\n const result = send(xhr);\n result.then(clear, clear);\n return result;\n}\nfunction send(xhr) {\n return new Promise((resolve, reject) => {\n xhr.onload = function () {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText);\n }\n else {\n reject(new Error(xhr.responseText));\n }\n };\n xhr.onerror = reject;\n xhr.send();\n });\n}\n\nclass Autocomplete {\n constructor(container, input, results) {\n this.container = container;\n this.input = input;\n this.results = results;\n this.combobox = new Combobox(input, results);\n this.results.hidden = true;\n this.input.setAttribute('autocomplete', 'off');\n this.input.setAttribute('spellcheck', 'false');\n this.interactingWithList = false;\n this.onInputChange = debounce(this.onInputChange.bind(this), 300);\n this.onResultsMouseDown = this.onResultsMouseDown.bind(this);\n this.onInputBlur = this.onInputBlur.bind(this);\n this.onInputFocus = this.onInputFocus.bind(this);\n this.onKeydown = this.onKeydown.bind(this);\n this.onCommit = this.onCommit.bind(this);\n this.input.addEventListener('keydown', this.onKeydown);\n this.input.addEventListener('focus', this.onInputFocus);\n this.input.addEventListener('blur', this.onInputBlur);\n this.input.addEventListener('input', this.onInputChange);\n this.results.addEventListener('mousedown', this.onResultsMouseDown);\n this.results.addEventListener('combobox-commit', this.onCommit);\n }\n destroy() {\n this.input.removeEventListener('keydown', this.onKeydown);\n this.input.removeEventListener('focus', this.onInputFocus);\n this.input.removeEventListener('blur', this.onInputBlur);\n this.input.removeEventListener('input', this.onInputChange);\n this.results.removeEventListener('mousedown', this.onResultsMouseDown);\n this.results.removeEventListener('combobox-commit', this.onCommit);\n }\n onKeydown(event) {\n if (event.key === 'Escape' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowUp' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowDown' && !this.container.open) {\n if (!this.input.value.trim())\n return;\n this.container.open = true;\n event.stopPropagation();\n event.preventDefault();\n }\n }\n onInputFocus() {\n this.fetchResults();\n }\n onInputBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.container.open = false;\n }\n onCommit({ target }) {\n const selected = target;\n if (!(selected instanceof HTMLElement))\n return;\n this.container.open = false;\n if (selected instanceof HTMLAnchorElement)\n return;\n const value = selected.getAttribute('data-autocomplete-value') || selected.textContent;\n this.container.value = value;\n }\n onResultsMouseDown() {\n this.interactingWithList = true;\n }\n onInputChange() {\n this.container.removeAttribute('value');\n this.fetchResults();\n }\n identifyOptions() {\n let id = 0;\n for (const el of this.results.querySelectorAll('[role=\"option\"]:not([id])')) {\n el.id = `${this.results.id}-option-${id++}`;\n }\n }\n fetchResults() {\n const query = this.input.value.trim();\n if (!query) {\n this.container.open = false;\n return;\n }\n const src = this.container.src;\n if (!src)\n return;\n const url = new URL(src, window.location.href);\n const params = new URLSearchParams(url.search.slice(1));\n params.append('q', query);\n url.search = params.toString();\n this.container.dispatchEvent(new CustomEvent('loadstart'));\n fragment(this.input, url.toString())\n .then(html => {\n this.results.innerHTML = html;\n this.identifyOptions();\n const hasResults = !!this.results.querySelector('[role=\"option\"]');\n this.container.open = hasResults;\n this.container.dispatchEvent(new CustomEvent('load'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n })\n .catch(() => {\n this.container.dispatchEvent(new CustomEvent('error'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n });\n }\n open() {\n if (!this.results.hidden)\n return;\n this.combobox.start();\n this.results.hidden = false;\n }\n close() {\n if (this.results.hidden)\n return;\n this.combobox.stop();\n this.results.hidden = true;\n }\n}\n\nconst state = new WeakMap();\nclass AutocompleteElement extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const listId = this.getAttribute('for');\n if (!listId)\n return;\n const input = this.querySelector('input');\n const results = document.getElementById(listId);\n if (!(input instanceof HTMLInputElement) || !results)\n return;\n state.set(this, new Autocomplete(this, input, results));\n results.setAttribute('role', 'listbox');\n }\n disconnectedCallback() {\n const autocomplete = state.get(this);\n if (autocomplete) {\n autocomplete.destroy();\n state.delete(this);\n }\n }\n get src() {\n return this.getAttribute('src') || '';\n }\n set src(url) {\n this.setAttribute('src', url);\n }\n get value() {\n return this.getAttribute('value') || '';\n }\n set value(value) {\n this.setAttribute('value', value);\n }\n get open() {\n return this.hasAttribute('open');\n }\n set open(value) {\n if (value) {\n this.setAttribute('open', '');\n }\n else {\n this.removeAttribute('open');\n }\n }\n static get observedAttributes() {\n return ['open', 'value'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue)\n return;\n const autocomplete = state.get(this);\n if (!autocomplete)\n return;\n switch (name) {\n case 'open':\n newValue === null ? autocomplete.close() : autocomplete.open();\n break;\n case 'value':\n if (newValue !== null) {\n autocomplete.input.value = newValue;\n }\n this.dispatchEvent(new AutocompleteEvent('auto-complete-change', {\n bubbles: true,\n relatedTarget: autocomplete.input\n }));\n break;\n }\n }\n}\n\nif (!window.customElements.get('auto-complete')) {\n window.AutocompleteElement = AutocompleteElement;\n window.customElements.define('auto-complete', AutocompleteElement);\n}\n\nexport default AutocompleteElement;\nexport { AutocompleteEvent };\n","function createNode(text) {\n const node = document.createElement('pre');\n node.style.width = '1px';\n node.style.height = '1px';\n node.style.position = 'fixed';\n node.style.top = '5px';\n node.textContent = text;\n return node;\n}\n\nfunction copyNode(node) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(node.textContent);\n }\n\n const selection = getSelection();\n\n if (selection == null) {\n return Promise.reject(new Error());\n }\n\n selection.removeAllRanges();\n const range = document.createRange();\n range.selectNodeContents(node);\n selection.addRange(range);\n document.execCommand('copy');\n selection.removeAllRanges();\n return Promise.resolve();\n}\nfunction copyText(text) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(text);\n }\n\n const body = document.body;\n\n if (!body) {\n return Promise.reject(new Error());\n }\n\n const node = createNode(text);\n body.appendChild(node);\n copyNode(node);\n body.removeChild(node);\n return Promise.resolve();\n}\n\nfunction copy(button) {\n const id = button.getAttribute('for');\n const text = button.getAttribute('value');\n\n function trigger() {\n button.dispatchEvent(new CustomEvent('clipboard-copy', {\n bubbles: true\n }));\n }\n\n if (text) {\n copyText(text).then(trigger);\n } else if (id) {\n const root = 'getRootNode' in Element.prototype ? button.getRootNode() : button.ownerDocument;\n if (!(root instanceof Document || 'ShadowRoot' in window && root instanceof ShadowRoot)) return;\n const node = root.getElementById(id);\n if (node) copyTarget(node).then(trigger);\n }\n}\n\nfunction copyTarget(content) {\n if (content instanceof HTMLInputElement || content instanceof HTMLTextAreaElement) {\n return copyText(content.value);\n } else if (content instanceof HTMLAnchorElement && content.hasAttribute('href')) {\n return copyText(content.href);\n } else {\n return copyNode(content);\n }\n}\n\nfunction clicked(event) {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n copy(button);\n }\n}\n\nfunction keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n event.preventDefault();\n copy(button);\n }\n }\n}\n\nfunction focused(event) {\n event.currentTarget.addEventListener('keydown', keydown);\n}\n\nfunction blurred(event) {\n event.currentTarget.removeEventListener('keydown', keydown);\n}\n\nclass ClipboardCopyElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('click', clicked);\n this.addEventListener('focus', focused);\n this.addEventListener('blur', blurred);\n }\n\n connectedCallback() {\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n }\n\n get value() {\n return this.getAttribute('value') || '';\n }\n\n set value(text) {\n this.setAttribute('value', text);\n }\n\n}\n\nif (!window.customElements.get('clipboard-copy')) {\n window.ClipboardCopyElement = ClipboardCopyElement;\n window.customElements.define('clipboard-copy', ClipboardCopyElement);\n}\n\nexport default ClipboardCopyElement;\n","import '@github/clipboard-copy-element';\nconst CLIPBOARD_COPY_TIMER_DURATION = 2000;\nfunction toggleSVG(svg) {\n if (svg.style.display === '' || svg.style.display === 'block') {\n svg.style.display = 'none';\n }\n else {\n svg.style.display = 'block';\n }\n}\n// Toggle a copy button.\nfunction toggleCopyButton(button) {\n const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');\n if (!clippyIcon || !checkIcon)\n return;\n toggleSVG(clippyIcon);\n toggleSVG(checkIcon);\n}\nconst clipboardCopyElementTimers = new WeakMap();\ndocument.addEventListener('clipboard-copy', function ({ target }) {\n if (!(target instanceof HTMLElement))\n return;\n if (!target.hasAttribute('data-view-component'))\n return;\n const currentTimeout = clipboardCopyElementTimers.get(target);\n if (currentTimeout) {\n clearTimeout(currentTimeout);\n clipboardCopyElementTimers.delete(target);\n }\n else {\n toggleCopyButton(target);\n }\n clipboardCopyElementTimers.set(target, setTimeout(toggleCopyButton, CLIPBOARD_COPY_TIMER_DURATION, target));\n});\n","export default class TabContainerElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('keydown', (event) => {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.getAttribute('role') !== 'tab' && !target.closest('[role=\"tablist\"]'))\n return;\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n const currentIndex = tabs.indexOf(tabs.find(tab => tab.matches('[aria-selected=\"true\"]')));\n if (event.code === 'ArrowRight') {\n let index = currentIndex + 1;\n if (index >= tabs.length)\n index = 0;\n selectTab(this, index);\n }\n else if (event.code === 'ArrowLeft') {\n let index = currentIndex - 1;\n if (index < 0)\n index = tabs.length - 1;\n selectTab(this, index);\n }\n else if (event.code === 'Home') {\n selectTab(this, 0);\n event.preventDefault();\n }\n else if (event.code === 'End') {\n selectTab(this, tabs.length - 1);\n event.preventDefault();\n }\n });\n this.addEventListener('click', (event) => {\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n if (!(event.target instanceof Element))\n return;\n const tab = event.target.closest('[role=\"tab\"]');\n if (!tab || !tab.closest('[role=\"tablist\"]'))\n return;\n const index = tabs.indexOf(tab);\n selectTab(this, index);\n });\n }\n connectedCallback() {\n for (const tab of this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]')) {\n if (!tab.hasAttribute('aria-selected')) {\n tab.setAttribute('aria-selected', 'false');\n }\n if (!tab.hasAttribute('tabindex')) {\n if (tab.getAttribute('aria-selected') === 'true') {\n tab.setAttribute('tabindex', '0');\n }\n else {\n tab.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\nfunction selectTab(tabContainer, index) {\n const tabs = tabContainer.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]');\n const panels = tabContainer.querySelectorAll('[role=\"tabpanel\"]');\n const selectedTab = tabs[index];\n const selectedPanel = panels[index];\n const cancelled = !tabContainer.dispatchEvent(new CustomEvent('tab-container-change', {\n bubbles: true,\n cancelable: true,\n detail: { relatedTarget: selectedPanel }\n }));\n if (cancelled)\n return;\n for (const tab of tabs) {\n tab.setAttribute('aria-selected', 'false');\n tab.setAttribute('tabindex', '-1');\n }\n for (const panel of panels) {\n panel.hidden = true;\n if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) {\n panel.setAttribute('tabindex', '0');\n }\n }\n selectedTab.setAttribute('aria-selected', 'true');\n selectedTab.setAttribute('tabindex', '0');\n selectedTab.focus();\n selectedPanel.hidden = false;\n tabContainer.dispatchEvent(new CustomEvent('tab-container-changed', {\n bubbles: true,\n detail: { relatedTarget: selectedPanel }\n }));\n}\nif (!window.customElements.get('tab-container')) {\n window.TabContainerElement = TabContainerElement;\n window.customElements.define('tab-container', TabContainerElement);\n}\n//# sourceMappingURL=index.js.map","const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst months = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December'\n];\nfunction pad(num) {\n return `0${num}`.slice(-2);\n}\nfunction strftime(time, formatString) {\n const day = time.getDay();\n const date = time.getDate();\n const month = time.getMonth();\n const year = time.getFullYear();\n const hour = time.getHours();\n const minute = time.getMinutes();\n const second = time.getSeconds();\n return formatString.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g, function (_arg) {\n let match;\n const modifier = _arg[1];\n switch (modifier) {\n case '%':\n return '%';\n case 'a':\n return weekdays[day].slice(0, 3);\n case 'A':\n return weekdays[day];\n case 'b':\n return months[month].slice(0, 3);\n case 'B':\n return months[month];\n case 'c':\n return time.toString();\n case 'd':\n return pad(date);\n case 'e':\n return String(date);\n case 'H':\n return pad(hour);\n case 'I':\n return pad(strftime(time, '%l'));\n case 'l':\n if (hour === 0 || hour === 12) {\n return String(12);\n }\n else {\n return String((hour + 12) % 12);\n }\n case 'm':\n return pad(month + 1);\n case 'M':\n return pad(minute);\n case 'p':\n if (hour > 11) {\n return 'PM';\n }\n else {\n return 'AM';\n }\n case 'P':\n if (hour > 11) {\n return 'pm';\n }\n else {\n return 'am';\n }\n case 'S':\n return pad(second);\n case 'w':\n return String(day);\n case 'y':\n return pad(year % 100);\n case 'Y':\n return String(year);\n case 'Z':\n match = time.toString().match(/\\((\\w+)\\)$/);\n return match ? match[1] : '';\n case 'z':\n match = time.toString().match(/\\w([+-]\\d\\d\\d\\d) /);\n return match ? match[1] : '';\n }\n return '';\n });\n}\nfunction makeFormatter(options) {\n let format;\n return function () {\n if (format)\n return format;\n if ('Intl' in window) {\n try {\n format = new Intl.DateTimeFormat(undefined, options);\n return format;\n }\n catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n };\n}\nlet dayFirst = null;\nconst dayFirstFormatter = makeFormatter({ day: 'numeric', month: 'short' });\nfunction isDayFirst() {\n if (dayFirst !== null) {\n return dayFirst;\n }\n const formatter = dayFirstFormatter();\n if (formatter) {\n const output = formatter.format(new Date(0));\n dayFirst = !!output.match(/^\\d/);\n return dayFirst;\n }\n else {\n return false;\n }\n}\nlet yearSeparator = null;\nconst yearFormatter = makeFormatter({ day: 'numeric', month: 'short', year: 'numeric' });\nfunction isYearSeparator() {\n if (yearSeparator !== null) {\n return yearSeparator;\n }\n const formatter = yearFormatter();\n if (formatter) {\n const output = formatter.format(new Date(0));\n yearSeparator = !!output.match(/\\d,/);\n return yearSeparator;\n }\n else {\n return true;\n }\n}\nfunction isThisYear(date) {\n const now = new Date();\n return now.getUTCFullYear() === date.getUTCFullYear();\n}\nfunction makeRelativeFormat(locale, options) {\n if ('Intl' in window && 'RelativeTimeFormat' in window.Intl) {\n try {\n return new Intl.RelativeTimeFormat(locale, options);\n }\n catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n}\nfunction localeFromElement(el) {\n const container = el.closest('[lang]');\n if (container instanceof HTMLElement && container.lang) {\n return container.lang;\n }\n return 'default';\n}\n\nconst datetimes = new WeakMap();\nclass ExtendedTimeElement extends HTMLElement {\n static get observedAttributes() {\n return [\n 'datetime',\n 'day',\n 'format',\n 'lang',\n 'hour',\n 'minute',\n 'month',\n 'second',\n 'title',\n 'weekday',\n 'year',\n 'time-zone-name'\n ];\n }\n connectedCallback() {\n const title = this.getFormattedTitle();\n if (title && !this.hasAttribute('title')) {\n this.setAttribute('title', title);\n }\n const text = this.getFormattedDate();\n if (text) {\n this.textContent = text;\n }\n }\n attributeChangedCallback(attrName, oldValue, newValue) {\n const oldTitle = this.getFormattedTitle();\n if (attrName === 'datetime') {\n const millis = Date.parse(newValue);\n if (isNaN(millis)) {\n datetimes.delete(this);\n }\n else {\n datetimes.set(this, new Date(millis));\n }\n }\n const title = this.getFormattedTitle();\n const currentTitle = this.getAttribute('title');\n if (attrName !== 'title' && title && (!currentTitle || currentTitle === oldTitle)) {\n this.setAttribute('title', title);\n }\n const text = this.getFormattedDate();\n if (text) {\n this.textContent = text;\n }\n }\n get date() {\n return datetimes.get(this);\n }\n getFormattedTitle() {\n const date = this.date;\n if (!date)\n return;\n const formatter = titleFormatter();\n if (formatter) {\n return formatter.format(date);\n }\n else {\n try {\n return date.toLocaleString();\n }\n catch (e) {\n if (e instanceof RangeError) {\n return date.toString();\n }\n else {\n throw e;\n }\n }\n }\n }\n getFormattedDate() {\n return;\n }\n}\nconst titleFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short'\n});\n\nconst formatters = new WeakMap();\nclass LocalTimeElement extends ExtendedTimeElement {\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'hour' || attrName === 'minute' || attrName === 'second' || attrName === 'time-zone-name') {\n formatters.delete(this);\n }\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n getFormattedDate() {\n const d = this.date;\n if (!d)\n return;\n const date = formatDate(this, d) || '';\n const time = formatTime(this, d) || '';\n return `${date} ${time}`.trim();\n }\n}\nfunction formatDate(el, date) {\n const props = {\n weekday: {\n short: '%a',\n long: '%A'\n },\n day: {\n numeric: '%e',\n '2-digit': '%d'\n },\n month: {\n short: '%b',\n long: '%B'\n },\n year: {\n numeric: '%Y',\n '2-digit': '%y'\n }\n };\n let format = isDayFirst() ? 'weekday day month year' : 'weekday month day, year';\n for (const prop in props) {\n const value = props[prop][el.getAttribute(prop) || ''];\n format = format.replace(prop, value || '');\n }\n format = format.replace(/(\\s,)|(,\\s$)/, '');\n return strftime(date, format).replace(/\\s+/, ' ').trim();\n}\nfunction formatTime(el, date) {\n const options = {};\n const hour = el.getAttribute('hour');\n if (hour === 'numeric' || hour === '2-digit')\n options.hour = hour;\n const minute = el.getAttribute('minute');\n if (minute === 'numeric' || minute === '2-digit')\n options.minute = minute;\n const second = el.getAttribute('second');\n if (second === 'numeric' || second === '2-digit')\n options.second = second;\n const tz = el.getAttribute('time-zone-name');\n if (tz === 'short' || tz === 'long')\n options.timeZoneName = tz;\n if (Object.keys(options).length === 0) {\n return;\n }\n let factory = formatters.get(el);\n if (!factory) {\n factory = makeFormatter(options);\n formatters.set(el, factory);\n }\n const formatter = factory();\n if (formatter) {\n return formatter.format(date);\n }\n else {\n const timef = options.second ? '%H:%M:%S' : '%H:%M';\n return strftime(date, timef);\n }\n}\nif (!window.customElements.get('local-time')) {\n window.LocalTimeElement = LocalTimeElement;\n window.customElements.define('local-time', LocalTimeElement);\n}\n\nclass RelativeTime {\n constructor(date, locale) {\n this.date = date;\n this.locale = locale;\n }\n toString() {\n const ago = this.timeElapsed();\n if (ago) {\n return ago;\n }\n else {\n const ahead = this.timeAhead();\n if (ahead) {\n return ahead;\n }\n else {\n return `on ${this.formatDate()}`;\n }\n }\n }\n timeElapsed() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && day < 30) {\n return this.timeAgoFromMs(ms);\n }\n else {\n return null;\n }\n }\n timeAhead() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && day < 30) {\n return this.timeUntil();\n }\n else {\n return null;\n }\n }\n timeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n return this.timeAgoFromMs(ms);\n }\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (ms < 0) {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n else if (sec < 10) {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n else if (sec < 45) {\n return formatRelativeTime(this.locale, -sec, 'second');\n }\n else if (sec < 90) {\n return formatRelativeTime(this.locale, -min, 'minute');\n }\n else if (min < 45) {\n return formatRelativeTime(this.locale, -min, 'minute');\n }\n else if (min < 90) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n }\n else if (hr < 24) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n }\n else if (hr < 36) {\n return formatRelativeTime(this.locale, -day, 'day');\n }\n else if (day < 30) {\n return formatRelativeTime(this.locale, -day, 'day');\n }\n else if (month < 18) {\n return formatRelativeTime(this.locale, -month, 'month');\n }\n else {\n return formatRelativeTime(this.locale, -year, 'year');\n }\n }\n microTimeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (min < 1) {\n return '1m';\n }\n else if (min < 60) {\n return `${min}m`;\n }\n else if (hr < 24) {\n return `${hr}h`;\n }\n else if (day < 365) {\n return `${day}d`;\n }\n else {\n return `${year}y`;\n }\n }\n timeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n return this.timeUntilFromMs(ms);\n }\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (month >= 18) {\n return formatRelativeTime(this.locale, year, 'year');\n }\n else if (month >= 12) {\n return formatRelativeTime(this.locale, year, 'year');\n }\n else if (day >= 45) {\n return formatRelativeTime(this.locale, month, 'month');\n }\n else if (day >= 30) {\n return formatRelativeTime(this.locale, month, 'month');\n }\n else if (hr >= 36) {\n return formatRelativeTime(this.locale, day, 'day');\n }\n else if (hr >= 24) {\n return formatRelativeTime(this.locale, day, 'day');\n }\n else if (min >= 90) {\n return formatRelativeTime(this.locale, hr, 'hour');\n }\n else if (min >= 45) {\n return formatRelativeTime(this.locale, hr, 'hour');\n }\n else if (sec >= 90) {\n return formatRelativeTime(this.locale, min, 'minute');\n }\n else if (sec >= 45) {\n return formatRelativeTime(this.locale, min, 'minute');\n }\n else if (sec >= 10) {\n return formatRelativeTime(this.locale, sec, 'second');\n }\n else {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n }\n microTimeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (day >= 365) {\n return `${year}y`;\n }\n else if (hr >= 24) {\n return `${day}d`;\n }\n else if (min >= 60) {\n return `${hr}h`;\n }\n else if (min > 1) {\n return `${min}m`;\n }\n else {\n return '1m';\n }\n }\n formatDate() {\n let format = isDayFirst() ? '%e %b' : '%b %e';\n if (!isThisYear(this.date)) {\n format += isYearSeparator() ? ', %Y' : ' %Y';\n }\n return strftime(this.date, format);\n }\n formatTime() {\n const formatter = timeFormatter();\n if (formatter) {\n return formatter.format(this.date);\n }\n else {\n return strftime(this.date, '%l:%M%P');\n }\n }\n}\nfunction formatRelativeTime(locale, value, unit) {\n const formatter = makeRelativeFormat(locale, { numeric: 'auto' });\n if (formatter) {\n return formatter.format(value, unit);\n }\n else {\n return formatEnRelativeTime(value, unit);\n }\n}\nfunction formatEnRelativeTime(value, unit) {\n if (value === 0) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `this ${unit}`;\n case 'day':\n return 'today';\n case 'hour':\n case 'minute':\n return `in 0 ${unit}s`;\n case 'second':\n return 'now';\n }\n }\n else if (value === 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `next ${unit}`;\n case 'day':\n return 'tomorrow';\n case 'hour':\n case 'minute':\n case 'second':\n return `in 1 ${unit}`;\n }\n }\n else if (value === -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return `last ${unit}`;\n case 'day':\n return 'yesterday';\n case 'hour':\n case 'minute':\n case 'second':\n return `1 ${unit} ago`;\n }\n }\n else if (value > 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return `in ${value} ${unit}s`;\n }\n }\n else if (value < -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return `${-value} ${unit}s ago`;\n }\n }\n throw new RangeError(`Invalid unit argument for format() '${unit}'`);\n}\nconst timeFormatter = makeFormatter({ hour: 'numeric', minute: '2-digit' });\n\nclass RelativeTimeElement extends ExtendedTimeElement {\n getFormattedDate() {\n const date = this.date;\n if (!date)\n return;\n return new RelativeTime(date, localeFromElement(this)).toString();\n }\n connectedCallback() {\n nowElements.push(this);\n if (!updateNowElementsId) {\n updateNowElements();\n updateNowElementsId = window.setInterval(updateNowElements, 60 * 1000);\n }\n super.connectedCallback();\n }\n disconnectedCallback() {\n const ix = nowElements.indexOf(this);\n if (ix !== -1) {\n nowElements.splice(ix, 1);\n }\n if (!nowElements.length) {\n if (updateNowElementsId) {\n clearInterval(updateNowElementsId);\n updateNowElementsId = null;\n }\n }\n }\n}\nconst nowElements = [];\nlet updateNowElementsId;\nfunction updateNowElements() {\n let time, i, len;\n for (i = 0, len = nowElements.length; i < len; i++) {\n time = nowElements[i];\n time.textContent = time.getFormattedDate() || '';\n }\n}\nif (!window.customElements.get('relative-time')) {\n window.RelativeTimeElement = RelativeTimeElement;\n window.customElements.define('relative-time', RelativeTimeElement);\n}\n\nclass TimeAgoElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date)\n return;\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeAgo();\n }\n else {\n return new RelativeTime(date, localeFromElement(this)).timeAgo();\n }\n }\n}\nif (!window.customElements.get('time-ago')) {\n window.TimeAgoElement = TimeAgoElement;\n window.customElements.define('time-ago', TimeAgoElement);\n}\n\nclass TimeUntilElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date)\n return;\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeUntil();\n }\n else {\n return new RelativeTime(date, localeFromElement(this)).timeUntil();\n }\n }\n}\nif (!window.customElements.get('time-until')) {\n window.TimeUntilElement = TimeUntilElement;\n window.customElements.define('time-until', TimeUntilElement);\n}\n\nexport { LocalTimeElement, RelativeTimeElement, TimeAgoElement, TimeUntilElement };\n","const startPositions = new WeakMap();\nconst dragStartPositions = new WeakMap();\nconst constructedElements = new WeakMap();\nfunction moveCropArea(event) {\n const el = event.currentTarget;\n if (!(el instanceof ImageCropElement))\n return;\n const { box, image } = constructedElements.get(el) || {};\n if (!box || !image)\n return;\n let deltaX = 0;\n let deltaY = 0;\n if (event instanceof KeyboardEvent) {\n if (event.key === 'ArrowUp') {\n deltaY = -1;\n }\n else if (event.key === 'ArrowDown') {\n deltaY = 1;\n }\n else if (event.key === 'ArrowLeft') {\n deltaX = -1;\n }\n else if (event.key === 'ArrowRight') {\n deltaX = 1;\n }\n }\n else if (dragStartPositions.has(el) && event instanceof MouseEvent) {\n const pos = dragStartPositions.get(el);\n deltaX = event.pageX - pos.dragStartX;\n deltaY = event.pageY - pos.dragStartY;\n }\n else if (dragStartPositions.has(el) && event instanceof TouchEvent) {\n const { pageX, pageY } = event.changedTouches[0];\n const { dragStartX, dragStartY } = dragStartPositions.get(el);\n deltaX = pageX - dragStartX;\n deltaY = pageY - dragStartY;\n }\n if (deltaX !== 0 || deltaY !== 0) {\n const x = Math.min(Math.max(0, box.offsetLeft + deltaX), image.width - box.offsetWidth);\n const y = Math.min(Math.max(0, box.offsetTop + deltaY), image.height - box.offsetHeight);\n box.style.left = `${x}px`;\n box.style.top = `${y}px`;\n fireChangeEvent(el, { x, y, width: box.offsetWidth, height: box.offsetHeight });\n }\n if (event instanceof MouseEvent) {\n dragStartPositions.set(el, {\n dragStartX: event.pageX,\n dragStartY: event.pageY\n });\n }\n else if (event instanceof TouchEvent) {\n const { pageX, pageY } = event.changedTouches[0];\n dragStartPositions.set(el, {\n dragStartX: pageX,\n dragStartY: pageY\n });\n }\n}\nfunction updateCropArea(event) {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n const el = getShadowHost(target);\n if (!(el instanceof ImageCropElement))\n return;\n const { box } = constructedElements.get(el) || {};\n if (!box)\n return;\n const rect = el.getBoundingClientRect();\n let deltaX, deltaY, delta;\n if (event instanceof KeyboardEvent) {\n if (event.key === 'Escape')\n return setInitialPosition(el);\n if (event.key === '-')\n delta = -10;\n if (event.key === '=')\n delta = +10;\n if (!delta)\n return;\n deltaX = box.offsetWidth + delta;\n deltaY = box.offsetHeight + delta;\n startPositions.set(el, { startX: box.offsetLeft, startY: box.offsetTop });\n }\n else if (event instanceof MouseEvent) {\n const pos = startPositions.get(el);\n if (!pos)\n return;\n deltaX = event.pageX - pos.startX - rect.left - window.pageXOffset;\n deltaY = event.pageY - pos.startY - rect.top - window.pageYOffset;\n }\n else if (event instanceof TouchEvent) {\n const pos = startPositions.get(el);\n if (!pos)\n return;\n deltaX = event.changedTouches[0].pageX - pos.startX - rect.left - window.pageXOffset;\n deltaY = event.changedTouches[0].pageY - pos.startY - rect.top - window.pageYOffset;\n }\n if (deltaX && deltaY)\n updateDimensions(el, deltaX, deltaY, !(event instanceof KeyboardEvent));\n}\nfunction getShadowHost(el) {\n const rootNode = el.getRootNode();\n if (!(rootNode instanceof ShadowRoot))\n return el;\n return rootNode.host;\n}\nfunction startUpdate(event) {\n const currentTarget = event.currentTarget;\n if (!(currentTarget instanceof HTMLElement))\n return;\n const el = getShadowHost(currentTarget);\n if (!(el instanceof ImageCropElement))\n return;\n const { box } = constructedElements.get(el) || {};\n if (!box)\n return;\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.hasAttribute('data-direction')) {\n const direction = target.getAttribute('data-direction') || '';\n el.addEventListener('mousemove', updateCropArea);\n el.addEventListener('touchmove', updateCropArea, { passive: true });\n if (['nw', 'se'].indexOf(direction) >= 0)\n el.classList.add('nwse');\n if (['ne', 'sw'].indexOf(direction) >= 0)\n el.classList.add('nesw');\n startPositions.set(el, {\n startX: box.offsetLeft + (['se', 'ne'].indexOf(direction) >= 0 ? 0 : box.offsetWidth),\n startY: box.offsetTop + (['se', 'sw'].indexOf(direction) >= 0 ? 0 : box.offsetHeight)\n });\n updateCropArea(event);\n }\n else {\n el.addEventListener('mousemove', moveCropArea);\n el.addEventListener('touchmove', moveCropArea, { passive: true });\n }\n}\nfunction updateDimensions(target, deltaX, deltaY, reposition = true) {\n let newSide = Math.max(Math.abs(deltaX), Math.abs(deltaY), 10);\n const pos = startPositions.get(target);\n if (!pos)\n return;\n const { box, image } = constructedElements.get(target) || {};\n if (!box || !image)\n return;\n newSide = Math.min(newSide, deltaY > 0 ? image.height - pos.startY : pos.startY, deltaX > 0 ? image.width - pos.startX : pos.startX);\n const x = reposition ? Math.round(Math.max(0, deltaX > 0 ? pos.startX : pos.startX - newSide)) : box.offsetLeft;\n const y = reposition ? Math.round(Math.max(0, deltaY > 0 ? pos.startY : pos.startY - newSide)) : box.offsetTop;\n box.style.left = `${x}px`;\n box.style.top = `${y}px`;\n box.style.width = `${newSide}px`;\n box.style.height = `${newSide}px`;\n fireChangeEvent(target, { x, y, width: newSide, height: newSide });\n}\nfunction setInitialPosition(el) {\n const { image } = constructedElements.get(el) || {};\n if (!image)\n return;\n const side = Math.round(image.clientWidth > image.clientHeight ? image.clientHeight : image.clientWidth);\n startPositions.set(el, {\n startX: (image.clientWidth - side) / 2,\n startY: (image.clientHeight - side) / 2\n });\n updateDimensions(el, side, side);\n}\nfunction stopUpdate(event) {\n const el = event.currentTarget;\n if (!(el instanceof ImageCropElement))\n return;\n dragStartPositions.delete(el);\n el.classList.remove('nwse', 'nesw');\n el.removeEventListener('mousemove', updateCropArea);\n el.removeEventListener('mousemove', moveCropArea);\n el.removeEventListener('touchmove', updateCropArea);\n el.removeEventListener('touchmove', moveCropArea);\n}\nfunction fireChangeEvent(target, result) {\n const { image } = constructedElements.get(target) || {};\n if (!image)\n return;\n const ratio = image.naturalWidth / image.width;\n for (const key in result) {\n const value = Math.round(result[key] * ratio);\n result[key] = value;\n const slottedInput = target.querySelector(`[data-image-crop-input='${key}']`);\n if (slottedInput instanceof HTMLInputElement)\n slottedInput.value = value.toString();\n }\n target.dispatchEvent(new CustomEvent('image-crop-change', { bubbles: true, detail: result }));\n}\nclass ImageCropElement extends HTMLElement {\n connectedCallback() {\n if (constructedElements.has(this))\n return;\n const shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.innerHTML = `\n<style>\n :host { touch-action: none; display: block; }\n :host(.nesw) { cursor: nesw-resize; }\n :host(.nwse) { cursor: nwse-resize; }\n :host(.nesw) .crop-box, :host(.nwse) .crop-box { cursor: inherit; }\n :host([loaded]) .crop-image { display: block; }\n :host([loaded]) ::slotted([data-loading-slot]), .crop-image { display: none; }\n\n .crop-wrapper {\n position: relative;\n font-size: 0;\n }\n .crop-container {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n position: absolute;\n overflow: hidden;\n z-index: 1;\n top: 0;\n width: 100%;\n height: 100%;\n }\n\n :host([rounded]) .crop-box {\n border-radius: 50%;\n box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);\n }\n .crop-box {\n position: absolute;\n border: 1px dashed #fff;\n box-sizing: border-box;\n cursor: move;\n }\n\n :host([rounded]) .crop-outline {\n outline: none;\n }\n .crop-outline {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n outline: 4000px solid rgba(0, 0, 0, .3);\n }\n\n .handle { position: absolute; }\n :host([rounded]) .handle::before { border-radius: 50%; }\n .handle:before {\n position: absolute;\n display: block;\n padding: 4px;\n transform: translate(-50%, -50%);\n content: ' ';\n background: #fff;\n border: 1px solid #767676;\n }\n .ne { top: 0; right: 0; cursor: nesw-resize; }\n .nw { top: 0; left: 0; cursor: nwse-resize; }\n .se { bottom: 0; right: 0; cursor: nwse-resize; }\n .sw { bottom: 0; left: 0; cursor: nesw-resize; }\n</style>\n<slot></slot>\n<div class=\"crop-wrapper\">\n <img width=\"100%\" class=\"crop-image\" alt=\"\">\n <div class=\"crop-container\">\n <div data-crop-box class=\"crop-box\">\n <div class=\"crop-outline\"></div>\n <div data-direction=\"nw\" class=\"handle nw\"></div>\n <div data-direction=\"ne\" class=\"handle ne\"></div>\n <div data-direction=\"sw\" class=\"handle sw\"></div>\n <div data-direction=\"se\" class=\"handle se\"></div>\n </div>\n </div>\n</div>\n`;\n const box = shadowRoot.querySelector('[data-crop-box]');\n if (!(box instanceof HTMLElement))\n return;\n const image = shadowRoot.querySelector('img');\n if (!(image instanceof HTMLImageElement))\n return;\n constructedElements.set(this, { box, image });\n image.addEventListener('load', () => {\n this.loaded = true;\n setInitialPosition(this);\n });\n this.addEventListener('mouseleave', stopUpdate);\n this.addEventListener('touchend', stopUpdate);\n this.addEventListener('mouseup', stopUpdate);\n box.addEventListener('mousedown', startUpdate);\n box.addEventListener('touchstart', startUpdate, { passive: true });\n this.addEventListener('keydown', moveCropArea);\n this.addEventListener('keydown', updateCropArea);\n if (this.src)\n image.src = this.src;\n }\n static get observedAttributes() {\n return ['src'];\n }\n get src() {\n return this.getAttribute('src');\n }\n set src(val) {\n if (val) {\n this.setAttribute('src', val);\n }\n else {\n this.removeAttribute('src');\n }\n }\n get loaded() {\n return this.hasAttribute('loaded');\n }\n set loaded(val) {\n if (val) {\n this.setAttribute('loaded', '');\n }\n else {\n this.removeAttribute('loaded');\n }\n }\n attributeChangedCallback(attribute, oldValue, newValue) {\n const { image } = constructedElements.get(this) || {};\n if (attribute === 'src') {\n this.loaded = false;\n if (image)\n image.src = newValue;\n }\n }\n}\nexport default ImageCropElement;\nif (!window.customElements.get('image-crop')) {\n window.ImageCropElement = ImageCropElement;\n window.customElements.define('image-crop', ImageCropElement);\n}\n","class DetailsMenuElement extends HTMLElement {\n constructor() {\n super();\n }\n get preload() {\n return this.hasAttribute('preload');\n }\n set preload(value) {\n if (value) {\n this.setAttribute('preload', '');\n }\n else {\n this.removeAttribute('preload');\n }\n }\n get src() {\n return this.getAttribute('src') || '';\n }\n set src(value) {\n this.setAttribute('src', value);\n }\n connectedCallback() {\n if (!this.hasAttribute('role'))\n this.setAttribute('role', 'menu');\n const details = this.parentElement;\n if (!details)\n return;\n const summary = details.querySelector('summary');\n if (summary) {\n summary.setAttribute('aria-haspopup', 'menu');\n if (!summary.hasAttribute('role'))\n summary.setAttribute('role', 'button');\n }\n const subscriptions = [\n fromEvent(details, 'compositionstart', e => trackComposition(this, e)),\n fromEvent(details, 'compositionend', e => trackComposition(this, e)),\n fromEvent(details, 'click', e => shouldCommit(details, this, e)),\n fromEvent(details, 'change', e => shouldCommit(details, this, e)),\n fromEvent(details, 'keydown', e => keydown(details, this, e)),\n fromEvent(details, 'toggle', () => loadFragment(details, this), { once: true }),\n fromEvent(details, 'toggle', () => closeCurrentMenu(details)),\n this.preload\n ? fromEvent(details, 'mouseover', () => loadFragment(details, this), { once: true })\n : NullSubscription,\n ...focusOnOpen(details)\n ];\n states.set(this, { subscriptions, loaded: false, isComposing: false });\n }\n disconnectedCallback() {\n const state = states.get(this);\n if (!state)\n return;\n states.delete(this);\n for (const sub of state.subscriptions) {\n sub.unsubscribe();\n }\n }\n}\nconst states = new WeakMap();\nconst NullSubscription = {\n unsubscribe() {\n }\n};\nfunction fromEvent(target, eventName, onNext, options = false) {\n target.addEventListener(eventName, onNext, options);\n return {\n unsubscribe: () => {\n target.removeEventListener(eventName, onNext, options);\n }\n };\n}\nfunction loadFragment(details, menu) {\n const src = menu.getAttribute('src');\n if (!src)\n return;\n const state = states.get(menu);\n if (!state)\n return;\n if (state.loaded)\n return;\n state.loaded = true;\n const loader = menu.querySelector('include-fragment');\n if (loader && !loader.hasAttribute('src')) {\n loader.addEventListener('loadend', () => autofocus(details));\n loader.setAttribute('src', src);\n }\n}\nfunction focusOnOpen(details) {\n let isMouse = false;\n const onmousedown = () => (isMouse = true);\n const onkeydown = () => (isMouse = false);\n const ontoggle = () => {\n if (!details.hasAttribute('open'))\n return;\n if (autofocus(details))\n return;\n if (!isMouse)\n focusFirstItem(details);\n };\n return [\n fromEvent(details, 'mousedown', onmousedown),\n fromEvent(details, 'keydown', onkeydown),\n fromEvent(details, 'toggle', ontoggle)\n ];\n}\nfunction closeCurrentMenu(details) {\n if (!details.hasAttribute('open'))\n return;\n for (const menu of document.querySelectorAll('details[open] > details-menu')) {\n const opened = menu.closest('details');\n if (opened && opened !== details && !opened.contains(details)) {\n opened.removeAttribute('open');\n }\n }\n}\nfunction autofocus(details) {\n if (!details.hasAttribute('open'))\n return false;\n const input = details.querySelector('[autofocus]');\n if (input) {\n input.focus();\n return true;\n }\n else {\n return false;\n }\n}\nfunction focusFirstItem(details) {\n const selected = document.activeElement;\n if (selected && isMenuItem(selected) && details.contains(selected))\n return;\n const target = sibling(details, true);\n if (target)\n target.focus();\n}\nfunction sibling(details, next) {\n const options = Array.from(details.querySelectorAll('[role^=\"menuitem\"]:not([hidden]):not([disabled]):not([aria-disabled=\"true\"])'));\n const selected = document.activeElement;\n const index = selected instanceof HTMLElement ? options.indexOf(selected) : -1;\n const found = next ? options[index + 1] : options[index - 1];\n const def = next ? options[0] : options[options.length - 1];\n return found || def;\n}\nconst ctrlBindings = navigator.userAgent.match(/Macintosh/);\nfunction shouldCommit(details, menu, event) {\n const target = event.target;\n if (!(target instanceof Element))\n return;\n if (target.closest('details') !== details)\n return;\n if (event.type === 'click') {\n const menuitem = target.closest('[role=\"menuitem\"], [role=\"menuitemradio\"]');\n const onlyCommitOnChangeEvent = menuitem && menuitem.tagName === 'LABEL' && menuitem.querySelector('input');\n if (menuitem && !onlyCommitOnChangeEvent) {\n commit(menuitem, details);\n }\n }\n else if (event.type === 'change') {\n const menuitem = target.closest('[role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]');\n if (menuitem)\n commit(menuitem, details);\n }\n}\nfunction updateChecked(selected, details) {\n for (const el of details.querySelectorAll('[role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]')) {\n const input = el.querySelector('input[type=\"radio\"], input[type=\"checkbox\"]');\n let checkState = (el === selected).toString();\n if (input instanceof HTMLInputElement) {\n checkState = input.indeterminate ? 'mixed' : input.checked.toString();\n }\n el.setAttribute('aria-checked', checkState);\n }\n}\nfunction commit(selected, details) {\n if (selected.hasAttribute('disabled') || selected.getAttribute('aria-disabled') === 'true')\n return;\n const menu = selected.closest('details-menu');\n if (!menu)\n return;\n const dispatched = menu.dispatchEvent(new CustomEvent('details-menu-select', {\n cancelable: true,\n detail: { relatedTarget: selected }\n }));\n if (!dispatched)\n return;\n updateLabel(selected, details);\n updateChecked(selected, details);\n if (selected.getAttribute('role') !== 'menuitemcheckbox')\n close(details);\n menu.dispatchEvent(new CustomEvent('details-menu-selected', {\n detail: { relatedTarget: selected }\n }));\n}\nfunction keydown(details, menu, event) {\n if (!(event instanceof KeyboardEvent))\n return;\n if (details.querySelector('details[open]'))\n return;\n const state = states.get(menu);\n if (!state || state.isComposing)\n return;\n const isSummaryFocused = event.target instanceof Element && event.target.tagName === 'SUMMARY';\n switch (event.key) {\n case 'Escape':\n if (details.hasAttribute('open')) {\n close(details);\n event.preventDefault();\n event.stopPropagation();\n }\n break;\n case 'ArrowDown':\n {\n if (isSummaryFocused && !details.hasAttribute('open')) {\n details.setAttribute('open', '');\n }\n const target = sibling(details, true);\n if (target)\n target.focus();\n event.preventDefault();\n }\n break;\n case 'ArrowUp':\n {\n if (isSummaryFocused && !details.hasAttribute('open')) {\n details.setAttribute('open', '');\n }\n const target = sibling(details, false);\n if (target)\n target.focus();\n event.preventDefault();\n }\n break;\n case 'n':\n {\n if (ctrlBindings && event.ctrlKey) {\n const target = sibling(details, true);\n if (target)\n target.focus();\n event.preventDefault();\n }\n }\n break;\n case 'p':\n {\n if (ctrlBindings && event.ctrlKey) {\n const target = sibling(details, false);\n if (target)\n target.focus();\n event.preventDefault();\n }\n }\n break;\n case ' ':\n case 'Enter':\n {\n const selected = document.activeElement;\n if (selected instanceof HTMLElement && isMenuItem(selected) && selected.closest('details') === details) {\n event.preventDefault();\n event.stopPropagation();\n selected.click();\n }\n }\n break;\n }\n}\nfunction isMenuItem(el) {\n const role = el.getAttribute('role');\n return role === 'menuitem' || role === 'menuitemcheckbox' || role === 'menuitemradio';\n}\nfunction close(details) {\n const wasOpen = details.hasAttribute('open');\n if (!wasOpen)\n return;\n details.removeAttribute('open');\n const summary = details.querySelector('summary');\n if (summary)\n summary.focus();\n}\nfunction updateLabel(item, details) {\n const button = details.querySelector('[data-menu-button]');\n if (!button)\n return;\n const text = labelText(item);\n if (text) {\n button.textContent = text;\n }\n else {\n const html = labelHTML(item);\n if (html)\n button.innerHTML = html;\n }\n}\nfunction labelText(el) {\n if (!el)\n return null;\n const textEl = el.hasAttribute('data-menu-button-text') ? el : el.querySelector('[data-menu-button-text]');\n if (!textEl)\n return null;\n return textEl.getAttribute('data-menu-button-text') || textEl.textContent;\n}\nfunction labelHTML(el) {\n if (!el)\n return null;\n const contentsEl = el.hasAttribute('data-menu-button-contents') ? el : el.querySelector('[data-menu-button-contents]');\n return contentsEl ? contentsEl.innerHTML : null;\n}\nfunction trackComposition(menu, event) {\n const state = states.get(menu);\n if (!state)\n return;\n state.isComposing = event.type === 'compositionstart';\n}\nexport default DetailsMenuElement;\nif (!window.customElements.get('details-menu')) {\n window.DetailsMenuElement = DetailsMenuElement;\n window.customElements.define('details-menu', DetailsMenuElement);\n}\n"],"names":["ctrlBindings","navigator","userAgent","match","Combobox","[object Object]","input","list","this","isComposing","id","Math","random","toString","slice","keyboardEventHandler","event","combobox","shiftKey","metaKey","altKey","ctrlKey","key","target","querySelector","getAttribute","click","commit","preventDefault","clearSelection","navigate","keyboardBindings","compositionEventHandler","type","document","getElementById","trackComposition","inputHandler","bind","setAttribute","stop","removeAttribute","addEventListener","commitWithElement","removeEventListener","indexDiff","focusEl","Array","from","querySelectorAll","filter","visible","els","focusIndex","indexOf","length","focus","indexOfItem","newIndex","el","scrollTo","Element","closest","dispatchEvent","CustomEvent","bubbles","fireCommitEvent","hidden","HTMLInputElement","offsetWidth","offsetHeight","container","element","scrollTop","containerBottom","clientHeight","top","offsetTop","bottom","inViewport","AutocompleteEvent","init","super","relatedTarget","requests","WeakMap","fragment","url","xhr","XMLHttpRequest","open","setRequestHeader","pending","get","abort","set","clear","delete","result","Promise","resolve","reject","onload","status","responseText","Error","onerror","send","then","request","Autocomplete","results","interactingWithList","onInputChange","callback","wait","timeout","Rest","clearTimeout","window","setTimeout","debounce","onResultsMouseDown","onInputBlur","onInputFocus","onKeydown","onCommit","stopPropagation","value","trim","fetchResults","selected","HTMLElement","HTMLAnchorElement","textContent","query","src","URL","location","href","params","URLSearchParams","search","append","html","innerHTML","identifyOptions","hasResults","catch","start","state","AutocompleteElement","listId","autocomplete","destroy","hasAttribute","observedAttributes","name","oldValue","newValue","close","copyNode","node","clipboard","writeText","selection","getSelection","removeAllRanges","range","createRange","selectNodeContents","addRange","execCommand","copyText","text","body","createElement","style","width","height","position","createNode","appendChild","removeChild","copy","button","trigger","root","prototype","getRootNode","ownerDocument","Document","ShadowRoot","content","HTMLTextAreaElement","clicked","currentTarget","keydown","focused","blurred","customElements","define","ClipboardCopyElement","toggleSVG","svg","display","toggleCopyButton","clippyIcon","checkIcon","clipboardCopyElementTimers","currentTimeout","TabContainerElement","tabs","currentIndex","find","tab","matches","code","index","selectTab","tabContainer","panels","selectedTab","selectedPanel","cancelable","detail","panel","weekdays","months","pad","num","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","lang","datetimes","ExtendedTimeElement","title","getFormattedTitle","getFormattedDate","attrName","oldTitle","millis","parse","isNaN","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","round","min","hr","timeAgoFromMs","timeUntil","formatRelativeTime","timeUntilFromMs","getUTCFullYear","isYearSeparator","timeFormatter","unit","RelativeTimeFormat","makeRelativeFormat","formatEnRelativeTime","RelativeTimeElement","nowElements","push","updateNowElementsId","updateNowElements","setInterval","connectedCallback","ix","splice","clearInterval","i","len","TimeAgoElement","microTimeAgo","timeAgo","TimeUntilElement","microTimeUntil","startPositions","dragStartPositions","constructedElements","moveCropArea","ImageCropElement","box","image","deltaX","deltaY","KeyboardEvent","has","MouseEvent","pos","pageX","dragStartX","pageY","dragStartY","TouchEvent","changedTouches","x","max","offsetLeft","y","left","fireChangeEvent","updateCropArea","getShadowHost","rect","getBoundingClientRect","delta","setInitialPosition","startX","startY","pageXOffset","pageYOffset","updateDimensions","rootNode","host","startUpdate","direction","passive","classList","add","reposition","newSide","abs","side","clientWidth","stopUpdate","remove","ratio","naturalWidth","slottedInput","shadowRoot","attachShadow","mode","HTMLImageElement","loaded","val","attribute","DetailsMenuElement","preload","details","parentElement","summary","subscriptions","fromEvent","shouldCommit","menu","states","isSummaryFocused","tagName","sibling","activeElement","isMenuItem","loadFragment","once","opened","contains","closeCurrentMenu","NullSubscription","focusOnOpen","sub","unsubscribe","eventName","onNext","loader","autofocus","isMouse","focusFirstItem","next","found","def","menuitem","onlyCommitOnChangeEvent","item","textEl","labelText","contentsEl","labelHTML","updateLabel","checkState","indeterminate","checked","updateChecked","role"],"mappings":"AAAA,MAAMA,IAAiBC,UAAUC,UAAUC,MAAM,aAClC,MAAMC,EACjBC,YAAYC,EAAOC,GACfC,KAAKF,MAAQA,EACbE,KAAKD,KAAOA,EACZC,KAAKC,aAAc,EACdF,EAAKG,KACNH,EAAKG,GAAK,YAAYC,KAAKC,SACtBC,WACAC,MAAM,EAAG,MAElBN,KAAKO,qBAAuBC,GAuEpC,SAA0BA,EAAOC,GAC7B,GAAID,EAAME,UAAYF,EAAMG,SAAWH,EAAMI,OACzC,OACJ,IAAKpB,GAAgBgB,EAAMK,QACvB,OACJ,GAAIJ,EAASR,YACT,OACJ,OAAQO,EAAMM,KACV,IAAK,QACL,IAAK,OA4Cb,SAAgBhB,EAAOC,GACnB,MAAMgB,EAAShB,EAAKiB,cAAc,0BAClC,QAAKD,IAEwC,SAAzCA,EAAOE,aAAa,kBAExBF,EAAOG,SADI,IAhDCC,CAAOV,EAASX,MAAOW,EAASV,OAChCS,EAAMY,iBAEV,MACJ,IAAK,SACDX,EAASY,iBACT,MACJ,IAAK,YACDZ,EAASa,SAAS,GAClBd,EAAMY,iBACN,MACJ,IAAK,UACDX,EAASa,UAAU,GACnBd,EAAMY,iBACN,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,SAAS,GAClBd,EAAMY,kBAEV,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,UAAU,GACnBd,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.g. in forms). Use links for destinations, or moving from one page to another.
6
+ class ButtonMarketing < Primer::Component
7
+ DEFAULT_SCHEME = :default
8
+ SCHEME_MAPPINGS = {
9
+ DEFAULT_SCHEME => "",
10
+ :primary => "btn-primary-mktg",
11
+ :outline => "btn-outline-mktg",
12
+ :transparent => "btn-transparent"
13
+ }.freeze
14
+ SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
15
+
16
+ DEFAULT_VARIANT = :default
17
+ VARIANT_MAPPINGS = {
18
+ DEFAULT_VARIANT => "",
19
+ :large => "btn-large-mktg"
20
+ }.freeze
21
+ VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
22
+
23
+ DEFAULT_TAG = :button
24
+ TAG_OPTIONS = [DEFAULT_TAG, :a].freeze
25
+
26
+ DEFAULT_TYPE = :button
27
+ TYPE_OPTIONS = [DEFAULT_TYPE, :submit].freeze
28
+
29
+ # @example Schemes
30
+ # <%= render(Primer::Alpha::ButtonMarketing.new(mr: 2)) { "Default" } %>
31
+ # <%= render(Primer::Alpha::ButtonMarketing.new(scheme: :primary, mr: 2)) { "Primary" } %>
32
+ # <%= render(Primer::Alpha::ButtonMarketing.new(scheme: :outline)) { "Outline" } %>
33
+ # <div class="color-bg-canvas-inverse">
34
+ # <%= render(Primer::Alpha::ButtonMarketing.new(scheme: :transparent)) { "Transparent" } %>
35
+ # </div>
36
+ #
37
+ # @example Sizes
38
+ # <%= render(Primer::Alpha::ButtonMarketing.new(mr: 2)) { "Default" } %>
39
+ # <%= render(Primer::Alpha::ButtonMarketing.new(variant: :large)) { "Large" } %>
40
+ #
41
+ # @param scheme [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::SCHEME_OPTIONS) %>
42
+ # @param variant [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::VARIANT_OPTIONS) %>
43
+ # @param tag [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::TAG_OPTIONS) %>
44
+ # @param type [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::TYPE_OPTIONS) %>
45
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
46
+ def initialize(
47
+ scheme: DEFAULT_SCHEME,
48
+ variant: DEFAULT_VARIANT,
49
+ tag: DEFAULT_TAG,
50
+ type: DEFAULT_TYPE,
51
+ **system_arguments
52
+ )
53
+ @system_arguments = system_arguments
54
+ @system_arguments[:block] = false
55
+ @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
56
+ @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
57
+ @system_arguments[:classes] = class_names(
58
+ "btn-mktg",
59
+ SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
60
+ VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
61
+ system_arguments[:classes]
62
+ )
63
+ end
64
+
65
+ def call
66
+ render(Primer::BaseButton.new(**@system_arguments)) { content }
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,27 +1,44 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- # Use `AutoComplete` to populate input values from server search results.
4
+ # Use `AutoComplete` to provide a user with a list of selectable suggestions that appear when they type into the
5
+ # input field. This list is populated by server search results.
5
6
  # @accessibility
6
- # Always provide a label for the `Autocomplete` component.
7
+ # Always set an accessible label to help the user interact with the component.
8
+ #
9
+ # * Set the `label` slot to render a visible label. Alternatively, associate an existing visible text element
10
+ # as a label by setting `aria-labelledby`.
11
+ # * If you must use a non-visible label, set `:"aria-label"` on `AutoComplete` and Primer
12
+ # will apply it to the correct elements. However, please note that a visible label should almost
13
+ # always be used unless there is compelling reason not to. A placeholder is not a label.
7
14
  class AutoComplete < Primer::Component
8
15
  status :beta
9
16
 
10
- DEFAULT_INPUT_TYPE = :text
11
- INPUT_TYPE_OPTIONS = [DEFAULT_INPUT_TYPE, :search].freeze
17
+ # Optionally render a visible label. See <%= link_to_accessibility %>
18
+ #
19
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
20
+ renders_one :label, lambda { |**system_arguments|
21
+ system_arguments[:for] = @input_id
22
+ system_arguments[:tag] = :label
23
+ Primer::BaseComponent.new(**system_arguments)
24
+ }
12
25
 
13
26
  # Required input used to search for results
14
27
  #
15
- # @param type [Symbol] <%= one_of(Primer::AutoComplete::INPUT_TYPE_OPTIONS) %>
28
+ # @param type [Symbol] <%= one_of(Primer::AutoComplete::Input::TYPE_OPTIONS) %>
16
29
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
17
- renders_one :input, lambda { |type: DEFAULT_INPUT_TYPE, classes: "form-control", **system_arguments|
18
- system_arguments[:tag] = :input
19
- system_arguments[:type] = fetch_or_fallback(INPUT_TYPE_OPTIONS, type, DEFAULT_INPUT_TYPE)
20
- system_arguments[:classes] = classes
21
- Primer::BaseComponent.new(**system_arguments)
30
+ renders_one :input, lambda { |**system_arguments|
31
+ aria_label = system_arguments[:"aria-label"] || system_arguments.dig(:aria, :label) || @aria_label
32
+ if aria_label.present?
33
+ system_arguments[:"aria-label"] = aria_label
34
+ system_arguments[:aria]&.delete(:label)
35
+ end
36
+
37
+ Input.new(id: @input_id, **system_arguments)
22
38
  }
23
39
 
24
40
  # Optional icon to be rendered before the input. Has the same arguments as <%= link_to_component(Primer::OcticonComponent) %>.
41
+ #
25
42
  renders_one :icon, Primer::OcticonComponent
26
43
 
27
44
  # Customizable results list.
@@ -29,72 +46,111 @@ module Primer
29
46
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
30
47
  renders_one :results, lambda { |**system_arguments|
31
48
  system_arguments[:tag] = :ul
32
- system_arguments[:id] = @id
49
+ system_arguments[:id] = @list_id
33
50
  system_arguments[:classes] = class_names(
34
51
  "autocomplete-results",
35
52
  system_arguments[:classes]
36
53
  )
37
54
 
55
+ aria_label = system_arguments[:"aria-label"] || system_arguments.dig(:aria, :label) || @aria_label
56
+ system_arguments[:"aria-label"] = aria_label if aria_label.present?
57
+ system_arguments[:aria]&.delete(:label)
58
+
38
59
  Primer::BaseComponent.new(**system_arguments)
39
60
  }
40
61
 
41
62
  # @example Default
42
- # <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
43
- # <% c.input(type: :text, name: "input") %>
44
- # <% c.results do %>
45
- # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
46
- # Selected
47
- # <% end %>
48
- # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
49
- # Not selected
50
- # <% end %>
51
- # <% end %>
63
+ # <%= render(Primer::AutoComplete.new(src: "/auto_complete", input_id: "fruits-input-1", list_id: "fruits-popup-1", position: :relative)) do |c| %>
64
+ # <% c.label(classes:"").with_content("Fruits") %>
65
+ # <% c.input(type: :text) %>
66
+ # <% end %>
67
+ #
68
+ # @example With `aria-label`
69
+ # <%= render(Primer::AutoComplete.new("aria-label": "Fruits", src: "/auto_complete", input_id: "fruits-input-2", list_id: "fruits-popup-2", position: :relative)) do |c| %>
70
+ # <% c.input(type: :text) %>
71
+ # <% end %>
72
+ #
73
+ # @example With `aria-labelledby`
74
+ # <%= render(Primer::HeadingComponent.new(tag: :h2, id: "search-1")) { "Search" } %>
75
+ # <%= render(Primer::AutoComplete.new(src: "/auto_complete", input_id: "fruits-input-3", list_id: "fruits-popup-2", position: :relative)) do |c| %>
76
+ # <% c.input("aria-labelledby": "search-1") %>
52
77
  # <% end %>
53
78
  #
54
79
  # @example With custom classes for the results
55
- # <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
56
- # <% c.input(type: :text, name: "input") %>
80
+ # <%= render(Primer::AutoComplete.new(src: "/auto_complete", input_id: "fruits-input-4", list_id: "fruits-popup-3", position: :relative)) do |c| %>
81
+ # <% c.label(classes:"").with_content("Fruits") %>
82
+ # <% c.input(type: :text) %>
57
83
  # <% c.results(classes: "custom-class") do %>
58
- # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
59
- # Selected
84
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "apple")) do |c| %>
85
+ # Apple
60
86
  # <% end %>
61
- # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
62
- # Not selected
87
+ # <%= render(Primer::AutoComplete::Item.new(value: "orange")) do |c| %>
88
+ # Orange
63
89
  # <% end %>
64
90
  # <% end %>
65
91
  # <% end %>
66
92
  #
67
93
  # @example With Icon
68
- # <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
69
- # <% c.input(type: :text, name: "input") %>
94
+ # <%= render(Primer::AutoComplete.new(src: "/auto_complete", list_id: "fruits-popup-4", input_id: "fruits-input-4", position: :relative)) do |c| %>
95
+ # <% c.label(classes:"").with_content("Fruits") %>
96
+ # <% c.input(type: :text) %>
70
97
  # <% c.icon(icon: :search) %>
71
- # <% c.results do %>
72
- # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
73
- # Selected
74
- # <% end %>
75
- # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
76
- # Not selected
77
- # <% end %>
78
- # <% end %>
79
98
  # <% end %>
80
99
  #
81
100
  # @param src [String] The route to query.
82
- # @param id [String] Id of the list element.
101
+ # @param input_id [String] Id of the input element.
102
+ # @param list_id [String] Id of the list element.
83
103
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
84
- def initialize(src:, id:, **system_arguments)
85
- @id = id
104
+ def initialize(src:, list_id:, input_id:, **system_arguments)
105
+ @list_id = list_id
106
+ @input_id = input_id
107
+ @aria_label = system_arguments[:"aria-label"] || system_arguments.dig(:aria, :label)
108
+
109
+ system_arguments.delete(:"aria-label") && system_arguments[:aria]&.delete(:label)
86
110
 
87
111
  @system_arguments = system_arguments
88
112
  @system_arguments[:tag] = "auto-complete"
89
113
  @system_arguments[:src] = src
90
- @system_arguments[:for] = id
114
+ @system_arguments[:for] = list_id
91
115
  end
92
116
 
93
117
  # add `results` without needing to explicitly call it in the view
94
118
  def before_render
95
119
  raise ArgumentError, "Missing `input` slot" if input.blank?
120
+ raise ArgumentError, "Accessible label is required." if label.blank? && input.missing_label?
96
121
 
97
122
  results(classes: "") unless results
98
123
  end
124
+
125
+ # This component is part of `Primer::AutoCompleteComponent` and should not be
126
+ # used as a standalone component.
127
+ class Input < Primer::Component
128
+ DEFAULT_TYPE = :text
129
+ TYPE_OPTIONS = [DEFAULT_TYPE, :search].freeze
130
+
131
+ # @param type [Symbol] <%= one_of(Primer::AutoComplete::Input::TYPE_OPTIONS) %>
132
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
133
+ def initialize(type: DEFAULT_TYPE, **system_arguments)
134
+ @system_arguments = system_arguments
135
+ @system_arguments[:tag] = :input
136
+
137
+ @aria_label = system_arguments[:"aria-label"]
138
+ @aria_labelledby = system_arguments[:"aria-labelledby"] || system_arguments.dig(:aria, :labelledby)
139
+
140
+ @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
141
+ @system_arguments[:classes] = class_names(
142
+ "form-control",
143
+ system_arguments[:classes]
144
+ )
145
+ end
146
+
147
+ def missing_label?
148
+ @aria_label.blank? && @aria_labelledby.blank?
149
+ end
150
+
151
+ def call
152
+ render(Primer::BaseComponent.new(**@system_arguments))
153
+ end
154
+ end
99
155
  end
100
156
  end
@@ -1,3 +1,4 @@
1
+ <%= label %>
1
2
  <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
3
  <%= input %>
3
4
  <%= icon %>
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # `Text` is a wrapper component that will apply typography styles to the text inside.
6
+ class Text < Primer::Component
7
+ status :beta
8
+
9
+ DEFAULT_TAG = :span
10
+
11
+ # @example Default
12
+ # <%= render(Primer::Beta::Text.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
13
+ # <%= render(Primer::Beta::Text.new(tag: :p, color: :text_danger)) { "Danger Text" } %>
14
+ #
15
+ # @param tag [Symbol]
16
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
17
+ def initialize(tag: DEFAULT_TAG, **system_arguments)
18
+ @system_arguments = system_arguments
19
+ @system_arguments[:tag] = tag
20
+ end
21
+
22
+ def call
23
+ render(Primer::BaseComponent.new(**@system_arguments)) { content }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -95,7 +95,7 @@ module Primer
95
95
  # @param title [String] Text that appears in a larger bold font.
96
96
  # @param title_tag [Symbol] HTML tag to use for title.
97
97
  # @param icon [Symbol] Octicon icon to use at top of component.
98
- # @param icon_size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS) %>
98
+ # @param icon_size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS, sort: false) %>
99
99
  # @param image_src [String] Image to display.
100
100
  # @param image_alt [String] Alt text for image.
101
101
  # @param description [String] Text that appears below the title. Typically a whole sentence.
@@ -107,6 +107,7 @@ module Primer
107
107
  # @param narrow [Boolean] Adds a maximum width.
108
108
  # @param large [Boolean] Increases the font size.
109
109
  # @param spacious [Boolean] Adds extra padding.
110
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
110
111
  def initialize(
111
112
  title: "",
112
113
  title_tag: :h3,
@@ -78,11 +78,12 @@ module Primer
78
78
  #
79
79
  # @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
80
80
  # @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
81
- # @param tag [Symbol] <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
82
- # @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
81
+ # @param tag [Symbol] (Primer::BaseButton::DEFAULT_TAG) <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
82
+ # @param type [Symbol] (Primer::BaseButton::DEFAULT_TYPE) <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
83
83
  # @param group_item [Boolean] Whether button is part of a ButtonGroup.
84
84
  # @param block [Boolean] Whether button is full-width with `display: block`.
85
85
  # @param caret [Boolean] Whether or not to render a caret.
86
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
86
87
  def initialize(
87
88
  scheme: DEFAULT_SCHEME,
88
89
  variant: DEFAULT_VARIANT,
@@ -14,7 +14,7 @@ module Primer
14
14
 
15
15
  # Use the Summary slot as a trigger to reveal the content.
16
16
  #
17
- # @param button [Boolean] Whether to render the Summary as a button or not.
17
+ # @param button [Boolean] (true) Whether to render the Summary as a button or not.
18
18
  # @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
19
19
  renders_one :summary, lambda { |button: true, **system_arguments|
20
20
  system_arguments[:tag] = :summary
@@ -33,6 +33,17 @@ module Primer
33
33
  Primer::BaseComponent.new(**system_arguments)
34
34
  }
35
35
 
36
+ # @example Default
37
+ #
38
+ # <%= render Primer::DetailsComponent.new do |c| %>
39
+ # component.summary do
40
+ # "Summary"
41
+ # end
42
+ # component.body do
43
+ # "Body"
44
+ # end
45
+ # <% end %>
46
+ #
36
47
  # @param overlay [Symbol] Dictates the type of overlay to render with. <%= one_of(Primer::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
37
48
  # @param reset [Boolean] Defatuls to false. If set to true, it will remove the default caret and remove style from the summary element
38
49
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>