primer_view_components 0.0.92 → 0.0.93

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +2 -2
  4. data/app/assets/javascripts/primer_view_components.js +1 -1
  5. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  6. data/app/assets/styles/primer_view_components.css +1 -0
  7. data/app/assets/styles/primer_view_components.css.map +1 -1
  8. data/app/components/primer/alpha/dialog/body.rb +25 -0
  9. data/app/components/primer/alpha/dialog/footer.rb +31 -0
  10. data/app/components/primer/alpha/dialog/header.html.erb +15 -0
  11. data/app/components/primer/alpha/dialog/header.rb +37 -0
  12. data/app/components/primer/alpha/dialog.html.erb +12 -0
  13. data/app/components/primer/alpha/dialog.rb +160 -0
  14. data/app/components/primer/alpha/modal-dialog-element.d.ts +1 -1
  15. data/app/components/primer/alpha/modal-dialog-element.js +2 -3
  16. data/app/components/primer/alpha/modal-dialog-element.ts +148 -0
  17. data/app/components/primer/alpha/toggle-switch-element.js +2 -0
  18. data/app/components/primer/alpha/toggle-switch-element.ts +2 -1
  19. data/app/components/primer/alpha/tool-tip-element.ts +0 -1
  20. data/app/components/primer/beta/button.html.erb +23 -0
  21. data/app/components/primer/beta/button.pcss +332 -0
  22. data/app/components/primer/beta/button.rb +189 -0
  23. data/app/components/primer/beta/icon_button.html.erb +6 -0
  24. data/app/components/primer/beta/icon_button.rb +104 -0
  25. data/app/components/primer/clipboard_copy_component.ts +1 -1
  26. data/app/components/primer/experimental/action-bar-element.d.ts +14 -0
  27. data/app/components/primer/experimental/action-bar-element.js +139 -0
  28. data/app/components/primer/experimental/action-menu-element.d.ts +31 -0
  29. data/app/components/primer/experimental/action-menu-element.js +334 -0
  30. data/app/components/primer/experimental/overflow-menu-element.d.ts +13 -0
  31. data/app/components/primer/experimental/overflow-menu-element.js +113 -0
  32. data/app/components/primer/primer.d.ts +1 -0
  33. data/app/components/primer/primer.js +1 -0
  34. data/app/components/primer/primer.pcss +1 -0
  35. data/app/components/primer/primer.ts +1 -0
  36. data/lib/postcss_mixins/focusBoxShadowInset.pcss +6 -0
  37. data/lib/postcss_mixins/focusOutline.pcss +5 -0
  38. data/lib/postcss_mixins/focusOutlineOnEmphasis.pcss +6 -0
  39. data/lib/postcss_mixins/minTouchTarget.js +20 -0
  40. data/lib/postcss_mixins/targetBoxShadow.pcss +6 -0
  41. data/lib/primer/view_components/linters/argument_mappers/base.rb +1 -1
  42. data/lib/primer/view_components/version.rb +1 -1
  43. data/lib/tasks/docs.rake +3 -8
  44. data/static/arguments.yml +113 -0
  45. data/static/audited_at.json +6 -0
  46. data/static/constants.json +107 -0
  47. data/static/statuses.json +6 -0
  48. metadata +25 -5
  49. data/app/components/primer/alpha/segmented-control-element.d.ts +0 -8
  50. data/app/components/primer/alpha/segmented-control-element.js +0 -28
  51. data/static/classes.yml +0 -230
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c39d7e6adae573a8ee5e405f002cb16b5a22c4b988b088e3d2de9fb8cdc5899
4
- data.tar.gz: 1e8d2fd35d372ca561efb9b30956718c1728a63871406569aa6eb0cdefa98246
3
+ metadata.gz: a4f6b8d9b6a6e9c102db81ecf2e2358db387050f558612366958b629ce76cdfd
4
+ data.tar.gz: b7e33994a8f44ef1892b10c212a0a53a57c9bdc4d026fa225b88cf4b338c2ed9
5
5
  SHA512:
6
- metadata.gz: a867f937fce3a68dc844bb293e0b48b612e3a2ebb151aa1f5c4c84322d4c71808d2d4af38152ed1988b955c5851135f9e5232c2edb8abd52d116b43f1a8f2e9d
7
- data.tar.gz: a1f73f7716e6517669bde1160ded1b6fea05040c5ace935916e6d6781aa5b8964645e9f7d382a84e4ec098b37fe6bcdb93fc9c80031e76e21fe6956ffcb6267d
6
+ metadata.gz: a341624162434e19530a7a8bb53c5d180442e37826ab46fa8ec789087e139d32ac6c3a8fa817736ae3e0251cd7dc6248169719fbba141caebfe055491dae118d
7
+ data.tar.gz: 77284eb9bc5ef5328e848316c6751d10bce90726918922c2e0b615a51ff73dbba2d20005834a52c2b148c011158cc4602323379bc681a7811d574c4ba6b911ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.0.93
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1214](https://github.com/primer/view_components/pull/1214) [`33949aa9`](https://github.com/primer/view_components/commit/33949aa9e1be9e9a86a1eefb10e9cd3b47ecdeda) Thanks [@keithamus](https://github.com/keithamus)! - Adding Primer Dialog Component
8
+
9
+ * [#1325](https://github.com/primer/view_components/pull/1325) [`a54e5510`](https://github.com/primer/view_components/commit/a54e5510ecc87b55ed9a6bf71ac1c9d2e3b3fef9) Thanks [@langermank](https://github.com/langermank)! - Adding Primer::Beta::Button and Primer::Beta::IconButton with visual refinements
10
+
11
+ - [#1340](https://github.com/primer/view_components/pull/1340) [`a4f868c3`](https://github.com/primer/view_components/commit/a4f868c32af1ae76f2bba760e9565c2bade22f56) Thanks [@jsoref](https://github.com/jsoref)! - Let forks ✅ on `main`
12
+
13
+ * [#1335](https://github.com/primer/view_components/pull/1335) [`cbf52761`](https://github.com/primer/view_components/commit/cbf52761ab5624dfd9bc35a2220f87068c370039) Thanks [@jonrohan](https://github.com/jonrohan)! - Adding the `postcss-mixins` plugin to our CSS build step.
14
+
3
15
  ## 0.0.92
4
16
 
5
17
  ### Patch Changes
data/README.md CHANGED
@@ -4,13 +4,13 @@
4
4
 
5
5
  <h1 align="center">Primer ViewComponents</h1>
6
6
 
7
- <p align="center">ViewComponents for the Primer Design System</p>
7
+ <p align="center">ViewComponents for the Primer Design System.</p>
8
8
 
9
9
  _Note: This library is under active pre-1.0 development. Breaking changes are likely in patch releases._
10
10
 
11
11
  ## Documentation
12
12
 
13
- Visit [https://primer.style/view-components/](https://primer.style/view-components//) to view documentation.
13
+ Visit [https://primer.style/view-components/](https://primer.style/view-components/) to view documentation.
14
14
 
15
15
  ## License
16
16
 
@@ -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(o)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(o),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"),i(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 o(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function i(t,e){(function(t,e){const n=t.scrollTop,o=n+t.clientHeight,i=e.offsetTop,s=i+e.clientHeight;return i>=n&&s<=o})(t,e)||(t.scrollTop=e.offsetTop)}const s=window.testScreenReaderDelay||100;class r{constructor(t,n,o,i=!1){var s;if(this.container=t,this.input=n,this.results=o,this.combobox=new e(n,o),this.feedback=document.getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=i,this.clearButton=document.getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=o.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){const t=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(null==t?void 0:t.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.hidden=!0,this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...o){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...o)}),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.handleClear=this.handleClear.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),null===(s=this.clearButton)||void 0===s||s.addEventListener("click",this.handleClear)}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)}handleClear(t){t.preventDefault(),"true"===this.input.getAttribute("aria-expanded")&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.container.open=!1}onKeydown(t){if("Enter"===t.key&&this.container.open&&this.autoselectEnabled){const e=this.results.children[0];e&&(t.stopPropagation(),t.preventDefault(),this.onCommit({target:e}))}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.updateFeedbackForScreenReaders(`${e.textContent||""} selected.`),this.container.value=n,n||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),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++}`}updateFeedbackForScreenReaders(t){setTimeout((()=>{this.feedback&&(this.feedback.textContent=t)}),s)}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),o=new URLSearchParams(n.search.slice(1));o.append("q",t),n.search=o.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=this.results.querySelectorAll('[role="option"]'),n=!!e.length,o=e.length,[i]=e,s=null==i?void 0:i.textContent;this.autoselectEnabled&&s?this.updateFeedbackForScreenReaders(`${o} results. ${s} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${o||"No"} results.`),this.container.open=n,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)}}class a extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const c=new WeakMap;function l(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=c.get(t);n&&n.abort();c.set(t,e);const o=()=>c.delete(t),i=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 i.then(o,o),i}(t,n)}const u=new WeakMap;class AutocompleteElement extends HTMLElement{constructor(){super(...arguments),this.fetchResult=l}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);if(!(e instanceof HTMLInputElement&&n))return;const o="true"===this.getAttribute("data-autoselect");u.set(this,new r(this,e,n,o)),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 o=u.get(this);if(o)switch(t){case"open":null===n?o.close():o.open();break;case"value":null!==n&&(o.input.value=n),this.dispatchEvent(new a("auto-complete-change",{bubbles:!0,relatedTarget:o.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 f(t){const e=t.getAttribute("for"),n=t.getAttribute("value");function o(){t.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)h(n).then(o);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&&(i=s,i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement?h(i.value):i instanceof HTMLAnchorElement&&i.hasAttribute("href")?h(i.href):d(i)).then(o)}var i}function m(t){const e=t.currentTarget;e instanceof HTMLElement&&f(e)}function p(t){if(" "===t.key||"Enter"===t.key){const e=t.currentTarget;e instanceof HTMLElement&&(t.preventDefault(),f(e))}}function b(t){t.currentTarget.addEventListener("keydown",p)}function g(t){t.currentTarget.removeEventListener("keydown",p)}window.customElements.get("auto-complete")||(window.AutocompleteElement=AutocompleteElement,window.customElements.define("auto-complete",AutocompleteElement));class ClipboardCopyElement extends HTMLElement{constructor(){super(),this.addEventListener("click",m),this.addEventListener("focus",b),this.addEventListener("blur",g)}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=ClipboardCopyElement,window.customElements.define("clipboard-copy",ClipboardCopyElement));function w(t){t.style.display="inline-block"}function v(t){t.style.display="none"}const y=new WeakMap;function E(t){return Array.from(t.querySelectorAll('[role="tablist"] [role="tab"]')).filter((e=>e instanceof HTMLElement&&e.closest(t.tagName)===t))}document.addEventListener("clipboard-copy",(function({target:t}){if(!(t instanceof HTMLElement))return;if(!t.hasAttribute("data-view-component"))return;const e=y.get(t);e?(clearTimeout(e),y.delete(t)):function(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(v(e),w(n))}(t),y.set(t,setTimeout((()=>{!function(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(w(e),v(n))}(t),y.delete(t)}),2e3))}));class TabContainerElement extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if(e.closest(this.tagName)!==this)return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=E(this),o=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=o+1;t>=n.length&&(t=0),A(this,t)}else if("ArrowLeft"===t.code){let t=o-1;t<0&&(t=n.length-1),A(this,t)}else"Home"===t.code?(A(this,0),t.preventDefault()):"End"===t.code&&(A(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=E(this);if(!(t.target instanceof Element))return;if(t.target.closest(this.tagName)!==this)return;const n=t.target.closest('[role="tab"]');if(!(n instanceof HTMLElement&&n.closest('[role="tablist"]')))return;A(this,e.indexOf(n))}))}connectedCallback(){for(const t of E(this))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 A(t,e){const n=E(t),o=Array.from(t.querySelectorAll('[role="tabpanel"]')).filter((e=>e.closest(t.tagName)===t)),i=n[e],s=o[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 o)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");i.setAttribute("aria-selected","true"),i.setAttribute("tabindex","0"),i.focus(),s.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:s}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=TabContainerElement,window.customElements.define("tab-container",TabContainerElement));const T=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k=["January","February","March","April","May","June","July","August","September","October","November","December"];function x(t){return`0${t}`.slice(-2)}function L(t,e){const n=t.getDay(),o=t.getDate(),i=t.getMonth(),s=t.getFullYear(),r=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let l;switch(e[1]){case"%":return"%";case"a":return T[n].slice(0,3);case"A":return T[n];case"b":return k[i].slice(0,3);case"B":return k[i];case"c":return t.toString();case"d":return x(o);case"e":return String(o);case"H":return x(r);case"I":return x(L(t,"%l"));case"l":return String(0===r||12===r?12:(r+12)%12);case"m":return x(i+1);case"M":return x(a);case"p":return r>11?"PM":"AM";case"P":return r>11?"pm":"am";case"S":return x(c);case"w":return String(n);case"y":return x(s%100);case"Y":return String(s);case"Z":return l=t.toString().match(/\((\w+)\)$/),l?l[1]:"";case"z":return l=t.toString().match(/\w([+-]\d\d\d\d) /),l?l[1]:""}return""}))}function M(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 S=M({day:"numeric",month:"short"});function D(){if(null!==C)return C;const t=S();if(t){const e=t.format(new Date(0));return C=!!e.match(/^\d/),C}return!1}let H=null;const $=M({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 ExtendedTimeElement 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 o=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?F.delete(this):F.set(this,new Date(t))}const i=this.getFormattedTitle(),s=this.getAttribute("title");"title"===t||!i||s&&s!==o||this.setAttribute("title",i);const r=this.getFormattedDate();r&&(this.textContent=r)}get date(){return F.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=O();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const O=M({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),I=new WeakMap;class LocalTimeElement extends ExtendedTimeElement{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||I.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 o=D()?"weekday day month year":"weekday month day, year";for(const e in n){const i=n[e][t.getAttribute(e)||""];o=o.replace(e,i||"")}return o=o.replace(/(\s,)|(,\s$)/,""),L(e,o).replace(/\s+/," ").trim()}(this,t)||""} ${function(t,e){const n={},o=t.getAttribute("hour");"numeric"!==o&&"2-digit"!==o||(n.hour=o);const i=t.getAttribute("minute");"numeric"!==i&&"2-digit"!==i||(n.minute=i);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=I.get(t);a||(a=M(n),I.set(t,a));const c=a();if(c)return c.format(e);return L(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||""}`.trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=LocalTimeElement,window.customElements.define("local-time",LocalTimeElement));class q{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),o=Math.round(n/60),i=Math.round(o/24);return t>=0&&i<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),o=Math.round(n/60),i=Math.round(o/24);return t>=0&&i<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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return t<0||e<10?W(this.locale,0,"second"):e<45?W(this.locale,-e,"second"):e<90||n<45?W(this.locale,-n,"minute"):n<90||o<24?W(this.locale,-o,"hour"):o<36||i<30?W(this.locale,-i,"day"):s<18?W(this.locale,-s,"month"):W(this.locale,-r,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return n<1?"1m":n<60?`${n}m`:o<24?`${o}h`:i<365?`${i}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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return s>=18||s>=12?W(this.locale,r,"year"):i>=45||i>=30?W(this.locale,s,"month"):o>=36||o>=24?W(this.locale,i,"day"):n>=90||n>=45?W(this.locale,o,"hour"):e>=90||e>=45?W(this.locale,n,"minute"):W(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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return i>=365?`${r}y`:o>=24?`${i}d`:n>=60?`${o}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!==H)return H;const t=$();if(t){const e=t.format(new Date(0));return H=!!e.match(/\d,/),H}return!0}()?", %Y":" %Y"),L(this.date,t)}formatTime(){const t=P();return t?t.format(this.date):L(this.date,"%l:%M%P")}}function W(t,e,n){const o=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 o?o.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 P=M({hour:"numeric",minute:"2-digit"});class RelativeTimeElement extends ExtendedTimeElement{getFormattedDate(){const t=this.date;if(t)return new q(t,R(this)).toString()}connectedCallback(){B.push(this),Y||(N(),Y=window.setInterval(N,6e4)),super.connectedCallback()}disconnectedCallback(){const t=B.indexOf(this);-1!==t&&B.splice(t,1),B.length||Y&&(clearInterval(Y),Y=null)}}const B=[];let Y;function N(){let t,e,n;for(e=0,n=B.length;e<n;e++)t=B[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=RelativeTimeElement,window.customElements.define("relative-time",RelativeTimeElement));class TimeAgoElement extends RelativeTimeElement{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new q(e,R(this)).microTimeAgo():new q(e,R(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=TimeAgoElement,window.customElements.define("time-ago",TimeAgoElement));class TimeUntilElement extends RelativeTimeElement{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new q(e,R(this)).microTimeUntil():new q(e,R(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=TimeUntilElement,window.customElements.define("time-until",TimeUntilElement));const U=new WeakMap,X=new WeakMap,K=new WeakMap;function j(t){const e=t.currentTarget;if(!(e instanceof ImageCropElement))return;const{box:n,image:o}=K.get(e)||{};if(!n||!o)return;let i=0,s=0;if(t instanceof KeyboardEvent)"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);else if(X.has(e)&&t instanceof MouseEvent){const n=X.get(e);i=t.pageX-n.dragStartX,s=t.pageY-n.dragStartY}else if(X.has(e)&&t instanceof TouchEvent){const{pageX:n,pageY:o}=t.changedTouches[0],{dragStartX:r,dragStartY:a}=X.get(e);i=n-r,s=o-a}if(0!==i||0!==s){const t=Math.min(Math.max(0,n.offsetLeft+i),o.width-n.offsetWidth),r=Math.min(Math.max(0,n.offsetTop+s),o.height-n.offsetHeight);n.style.left=`${t}px`,n.style.top=`${r}px`,Q(e,{x:t,y:r,width:n.offsetWidth,height:n.offsetHeight})}if(t instanceof MouseEvent)X.set(e,{dragStartX:t.pageX,dragStartY:t.pageY});else if(t instanceof TouchEvent){const{pageX:n,pageY:o}=t.changedTouches[0];X.set(e,{dragStartX:n,dragStartY:o})}}function z(t){const e=t.target;if(!(e instanceof HTMLElement))return;const n=V(e);if(!(n instanceof ImageCropElement))return;const{box:o}=K.get(n)||{};if(!o)return;const i=n.getBoundingClientRect();let s,r,a;if(t instanceof KeyboardEvent){if("Escape"===t.key)return G(n);if("-"===t.key&&(a=-10),"="===t.key&&(a=10),!a)return;s=o.offsetWidth+a,r=o.offsetHeight+a,U.set(n,{startX:o.offsetLeft,startY:o.offsetTop})}else if(t instanceof MouseEvent){const e=U.get(n);if(!e)return;s=t.pageX-e.startX-i.left-window.pageXOffset,r=t.pageY-e.startY-i.top-window.pageYOffset}else if(t instanceof TouchEvent){const e=U.get(n);if(!e)return;s=t.changedTouches[0].pageX-e.startX-i.left-window.pageXOffset,r=t.changedTouches[0].pageY-e.startY-i.top-window.pageYOffset}s&&r&&J(n,s,r,!(t instanceof KeyboardEvent))}function V(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t}function Z(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const n=V(e);if(!(n instanceof ImageCropElement))return;const{box:o}=K.get(n)||{};if(!o)return;const i=t.target;if(i instanceof HTMLElement)if(i.hasAttribute("data-direction")){const e=i.getAttribute("data-direction")||"";n.addEventListener("mousemove",z),n.addEventListener("touchmove",z,{passive:!0}),["nw","se"].indexOf(e)>=0&&n.classList.add("nwse"),["ne","sw"].indexOf(e)>=0&&n.classList.add("nesw"),U.set(n,{startX:o.offsetLeft+(["se","ne"].indexOf(e)>=0?0:o.offsetWidth),startY:o.offsetTop+(["se","sw"].indexOf(e)>=0?0:o.offsetHeight)}),z(t)}else n.addEventListener("mousemove",j),n.addEventListener("touchmove",j,{passive:!0})}function J(t,e,n,o=!0){let i=Math.max(Math.abs(e),Math.abs(n),10);const s=U.get(t);if(!s)return;const{box:r,image:a}=K.get(t)||{};if(!r||!a)return;i=Math.min(i,n>0?a.height-s.startY:s.startY,e>0?a.width-s.startX:s.startX);const c=o?Math.round(Math.max(0,e>0?s.startX:s.startX-i)):r.offsetLeft,l=o?Math.round(Math.max(0,n>0?s.startY:s.startY-i)):r.offsetTop;r.style.left=`${c}px`,r.style.top=`${l}px`,r.style.width=`${i}px`,r.style.height=`${i}px`,Q(t,{x:c,y:l,width:i,height:i})}function G(t){const{image:e}=K.get(t)||{};if(!e)return;const n=Math.round(e.clientWidth>e.clientHeight?e.clientHeight:e.clientWidth);U.set(t,{startX:(e.clientWidth-n)/2,startY:(e.clientHeight-n)/2}),J(t,n,n)}function _(t){const e=t.currentTarget;e instanceof ImageCropElement&&(X.delete(e),e.classList.remove("nwse","nesw"),e.removeEventListener("mousemove",z),e.removeEventListener("mousemove",j),e.removeEventListener("touchmove",z),e.removeEventListener("touchmove",j))}function Q(t,e){const{image:n}=K.get(t)||{};if(!n)return;const o=n.naturalWidth/n.width;for(const n in e){const i=Math.round(e[n]*o);e[n]=i;const s=t.querySelector(`[data-image-crop-input='${n}']`);s instanceof HTMLInputElement&&(s.value=i.toString())}t.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:e}))}class ImageCropElement extends HTMLElement{connectedCallback(){if(K.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&&(K.set(this,{box:e,image:n}),n.addEventListener("load",(()=>{this.loaded=!0,G(this)})),this.addEventListener("mouseleave",_),this.addEventListener("touchend",_),this.addEventListener("mouseup",_),e.addEventListener("mousedown",Z),e.addEventListener("touchstart",Z,{passive:!0}),this.addEventListener("keydown",j),this.addEventListener("keydown",z),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:o}=K.get(this)||{};"src"===t&&(this.loaded=!1,o&&(o.src=n))}}window.customElements.get("image-crop")||(window.ImageCropElement=ImageCropElement,window.customElements.define("image-crop",ImageCropElement));class DetailsMenuElement extends HTMLElement{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=[nt(t,"compositionstart",(t=>ht(this,t))),nt(t,"compositionend",(t=>ht(this,t))),nt(t,"click",(e=>ct(t,e))),nt(t,"change",(e=>ct(t,e))),nt(t,"keydown",(e=>function(t,e,n){if(!(n instanceof KeyboardEvent))return;if(t.querySelector("details[open]"))return;const o=tt.get(e);if(!o||o.isComposing)return;const i=n.target instanceof Element&&"SUMMARY"===n.target.tagName;switch(n.key){case"Escape":t.hasAttribute("open")&&(dt(t),n.preventDefault(),n.stopPropagation());break;case"ArrowDown":{i&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=rt(t,!0);e&&e.focus(),n.preventDefault()}break;case"ArrowUp":{i&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=rt(t,!1);e&&e.focus(),n.preventDefault()}break;case"n":if(at&&n.ctrlKey){const e=rt(t,!0);e&&e.focus(),n.preventDefault()}break;case"p":if(at&&n.ctrlKey){const e=rt(t,!1);e&&e.focus(),n.preventDefault()}break;case" ":case"Enter":{const e=document.activeElement;e instanceof HTMLElement&&ut(e)&&e.closest("details")===t&&(n.preventDefault(),n.stopPropagation(),e.click())}}}(t,this,e))),nt(t,"toggle",(()=>ot(t,this)),{once:!0}),nt(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?nt(t,"mouseover",(()=>ot(t,this)),{once:!0}):et,...it(t)];tt.set(this,{subscriptions:n,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=tt.get(this);if(t){tt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const tt=new WeakMap,et={unsubscribe(){}};function nt(t,e,n,o=!1){return t.addEventListener(e,n,o),{unsubscribe:()=>{t.removeEventListener(e,n,o)}}}function ot(t,e){const n=e.getAttribute("src");if(!n)return;const o=tt.get(e);if(!o)return;if(o.loaded)return;o.loaded=!0;const i=e.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",(()=>st(t))),i.setAttribute("src",n))}function it(t){let e=!1;return[nt(t,"mousedown",(()=>e=!0)),nt(t,"keydown",(()=>e=!1)),nt(t,"toggle",(()=>{t.hasAttribute("open")&&(st(t)||e||function(t){const e=document.activeElement;if(e&&ut(e)&&t.contains(e))return;const n=rt(t,!0);n&&n.focus()}(t))}))]}function st(t){if(!t.hasAttribute("open"))return!1;const e=t.querySelector("details-menu [autofocus]");return!!e&&(e.focus(),!0)}function rt(t,e){const n=Array.from(t.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled]):not([aria-disabled="true"])')),o=document.activeElement,i=o instanceof HTMLElement?n.indexOf(o):-1,s=e?n[i+1]:n[i-1],r=e?n[0]:n[n.length-1];return s||r}const at=navigator.userAgent.match(/Macintosh/);function ct(t,e){const n=e.target;if(n instanceof Element&&n.closest("details")===t)if("click"===e.type){const e=n.closest('[role="menuitem"], [role="menuitemradio"]');if(!e)return;const o=e.querySelector("input");if("LABEL"===e.tagName&&n===o)return;"LABEL"===e.tagName&&o&&!o.checked||lt(e,t)}else if("change"===e.type){const e=n.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');e&&lt(e,t)}}function lt(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 o=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(o)n.textContent=o;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 o=(n===t).toString();e instanceof HTMLInputElement&&(o=e.indeterminate?"mixed":e.checked.toString()),n.setAttribute("aria-checked",o)}}(t,e),"menuitemcheckbox"!==t.getAttribute("role")&&dt(e),n.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:t}})))}function ut(t){const e=t.getAttribute("role");return"menuitem"===e||"menuitemcheckbox"===e||"menuitemradio"===e}function dt(t){if(!t.hasAttribute("open"))return;t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}function ht(t,e){const n=tt.get(t);n&&(n.isComposing="compositionstart"===e.type)}function ft(t,e,n,o){var i,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(s<3?i(r):s>3?i(e,n,r):i(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r}function mt(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}function pt(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?i.call(t,n):i?i.value=n:e.set(t,n),n}window.customElements.get("details-menu")||(window.DetailsMenuElement=DetailsMenuElement,window.customElements.define("details-menu",DetailsMenuElement));const bt=new WeakSet;function gt(t){yt(t),vt(t)}const wt=new WeakMap;function vt(t=document){if(wt.has(t))return wt.get(t);let e=!1;const n=new MutationObserver((t=>{for(const e of t)if("attributes"===e.type&&e.target instanceof Element)Tt(e.target);else if("childList"===e.type&&e.addedNodes.length)for(const t of e.addedNodes)t instanceof Element&&yt(t)}));n.observe(t,{childList:!0,subtree:!0,attributeFilter:["data-action"]});const o={get closed(){return e},unsubscribe(){e=!0,wt.delete(t),n.disconnect()}};return wt.set(t,o),o}function yt(t){for(const e of t.querySelectorAll("[data-action]"))Tt(e);t instanceof Element&&t.hasAttribute("data-action")&&Tt(t)}function Et(t){const e=t.currentTarget;for(const n of At(e))if(t.type===n.type){const o=e.closest(n.tag);bt.has(o)&&"function"==typeof o[n.method]&&o[n.method](t);const i=e.getRootNode();if(i instanceof ShadowRoot&&bt.has(i.host)&&i.host.matches(n.tag)){const e=i.host;"function"==typeof e[n.method]&&e[n.method](t)}}}function*At(t){for(const e of(t.getAttribute("data-action")||"").trim().split(/\s+/)){const t=e.lastIndexOf(":"),n=Math.max(0,e.lastIndexOf("#"))||e.length;yield{type:e.slice(0,t),tag:e.slice(t+1,n),method:e.slice(n+1)||"handleEvent"}||"handleEvent"}}function Tt(t){for(const e of At(t))t.addEventListener(e.type,Et)}const kt=t=>String("symbol"==typeof t?t.description:t).replace(/([A-Z]($|[a-z]))/g,"-$1").replace(/--/g,"-").replace(/^-|-$/,"").toLowerCase(),xt=(t,e="property")=>{const n=kt(t);if(!n.includes("-"))throw new DOMException(`${e}: ${String(t)} is not a valid ${e} name`,"SyntaxError");return n};const Lt=new WeakSet;function Mt(t,e){if(Lt.has(t))return;Lt.add(t);const n=Object.getPrototypeOf(t),o=n?.constructor?.attrPrefix??"data-";e||(e=Dt(n,"attr"));for(const n of e){const e=t[n],i=xt(`${o}${n}`);let s={configurable:!0,get(){return this.getAttribute(i)||""},set(t){this.setAttribute(i,t||"")}};"number"==typeof e?s={configurable:!0,get(){return Number(this.getAttribute(i)||0)},set(t){this.setAttribute(i,t)}}:"boolean"==typeof e&&(s={configurable:!0,get(){return this.hasAttribute(i)},set(t){this.toggleAttribute(i,t)}}),Object.defineProperty(t,n,s),n in t&&!t.hasAttribute(i)&&s.set.call(t,e)}}const Ct=Symbol.for("catalyst");class St{constructor(t){const e=this,n=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){e.connectedCallback(this,n)};const o=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){e.disconnectedCallback(this,o)};const i=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,n,o){e.attributeChangedCallback(this,t,n,o,i)};let s=t.observedAttributes||[];Object.defineProperty(t,"observedAttributes",{configurable:!0,get(){return e.observedAttributes(this,s)},set(t){s=t}}),function(t){let e=t.observedAttributes||[];const n=t.attrPrefix??"data-",o=t=>xt(`${n}${t}`);Object.defineProperty(t,"observedAttributes",{configurable:!0,get:()=>[...Dt(t.prototype,"attr")].map(o).concat(e),set(t){e=t}})}(t),function(t){const e=kt(t.name).replace(/-element$/,"");try{window.customElements.define(e,t),window[t.name]=customElements.get(e)}catch(t){if(!(t instanceof DOMException&&"NotSupportedError"===t.name))throw t}}(t)}observedAttributes(t,e){return e}connectedCallback(t,e){t.toggleAttribute("data-catalyst",!0),customElements.upgrade(t),function(t){for(const e of t.querySelectorAll("template[data-shadowroot]"))e.parentElement===t&&t.attachShadow({mode:"closed"===e.getAttribute("data-shadowroot")?"closed":"open"}).append(e.content.cloneNode(!0))}(t),Mt(t),function(t){bt.add(t),t.shadowRoot&&gt(t.shadowRoot),yt(t),vt(t.ownerDocument)}(t),e?.call(t),t.shadowRoot&&gt(t.shadowRoot)}disconnectedCallback(t,e){e?.call(t)}attributeChangedCallback(t,e,n,o,i){Mt(t),"data-catalyst"!==e&&i&&i.call(t,e,n,o)}}function Dt(t,e){if(!Object.prototype.hasOwnProperty.call(t,Ct)){const e=t[Ct],n=t[Ct]=new Map;if(e)for(const[t,o]of e)n.set(t,new Set(o))}const n=t[Ct];return n.has(e)||n.set(e,new Set),n.get(e)}function Ht(t,e){Dt(t,"target").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const n=t.tagName.toLowerCase();if(t.shadowRoot)for(const o of t.shadowRoot.querySelectorAll(`[data-target~="${n}.${e}"]`))if(!o.closest(n))return o;for(const o of t.querySelectorAll(`[data-target~="${n}.${e}"]`))if(o.closest(n)===t)return o}(this,e)}})}function $t(t,e=0,{start:n=!1,middle:o=!1,once:i=!1}={}){return function(t,e=0,{start:n=!0,middle:o=!0,once:i=!1}={}){let s,r=0,a=!1;function c(...l){if(a)return;const u=Date.now()-r;r=Date.now(),n?(n=!1,t.apply(this,l),i&&c.cancel()):(o&&u<e||!o)&&(clearTimeout(s),s=setTimeout((()=>{r=Date.now(),t.apply(this,l),i&&c.cancel()}),o?e-u:e))}return c.cancel=()=>{clearTimeout(s),a=!0},c}(t,e,{start:n,middle:o,once:i})}new Promise((t=>{"loading"!==document.readyState?t():document.addEventListener("readystatechange",(()=>t()),{once:!0})})),new Promise((t=>{const e=new AbortController;e.signal.addEventListener("abort",(()=>t()));const n={once:!0,passive:!0,signal:e.signal},o=()=>e.abort();document.addEventListener("mousedown",o,n),document.addEventListener("touchstart",o,n),document.addEventListener("keydown",o,n),document.addEventListener("pointerdown",o,n)}));let Rt=class ToggleSwitchElement extends HTMLElement{get src(){const t=this.getAttribute("src");if(!t)return null;const e=this.ownerDocument.createElement("a");return e.href=t,e.href}get csrf(){const t=this.querySelector("[data-csrf]");return this.getAttribute("csrf")||t instanceof HTMLInputElement&&t.value||null}get csrfField(){return this.getAttribute("csrf-field")||"authenticity_token"}isRemote(){return null!=this.src}toggle(){this.isRemote()?(this.setLoadingState(),this.check()):this.performToggle()}turnOn(){this.isDisabled()||(this.switch.setAttribute("aria-checked","true"),this.classList.add("ToggleSwitch--checked"))}turnOff(){this.isDisabled()||(this.switch.setAttribute("aria-checked","false"),this.classList.remove("ToggleSwitch--checked"))}isOn(){return"true"===this.switch.getAttribute("aria-checked")}isOff(){return!this.isOn()}isDisabled(){return"true"===this.switch.getAttribute("aria-disabled")}disable(){this.switch.setAttribute("aria-disabled","true")}enable(){this.switch.setAttribute("aria-disabled","false")}performToggle(){this.isOn()?this.turnOff():this.turnOn()}setLoadingState(){this.disable(),this.errorIcon.setAttribute("hidden","hidden"),this.loadingSpinner.removeAttribute("hidden")}setSuccessState(){this.setFinishedState(!1)}setErrorState(){this.setFinishedState(!0)}setFinishedState(t){t&&this.errorIcon.removeAttribute("hidden"),this.loadingSpinner.setAttribute("hidden","hidden"),this.enable()}async check(){const t=new FormData;this.csrf&&t.append(this.csrfField,this.csrf),t.append("value",this.isOn()?"1":"0");try{(await fetch(this.src,{credentials:"same-origin",method:"POST",body:t})).ok?(this.setSuccessState(),this.performToggle()):this.setErrorState()}catch(t){this.setErrorState()}}};ft([Ht],Rt.prototype,"switch",void 0),ft([Ht],Rt.prototype,"loadingSpinner",void 0),ft([Ht],Rt.prototype,"errorIcon",void 0),ft([function(t=0,e={}){return(n,o,i)=>{if(!i||"function"!=typeof i.value)throw new Error("debounce can only decorate functions");const s=i.value;i.value=$t(s,t,e),Object.defineProperty(n,o,i)}}(300)],Rt.prototype,"check",null),Rt=ft([function(t){new St(t)}],Rt);const Ft={"outside-top":["outside-bottom","outside-right","outside-left","outside-bottom"],"outside-bottom":["outside-top","outside-right","outside-left","outside-bottom"],"outside-left":["outside-right","outside-bottom","outside-top","outside-bottom"],"outside-right":["outside-left","outside-bottom","outside-top","outside-bottom"]},Ot={start:["end","center"],end:["start","center"],center:["end","start"]};function It(t,e,n={}){const o=function(t){let e=t.parentNode;for(;null!==e;){if(e instanceof HTMLElement&&"static"!==getComputedStyle(e).position)return e;e=e.parentNode}return document.body}(t),i=function(t){let e=t;for(;null!==e&&e!==document.body;){if("visible"!==getComputedStyle(e).overflow)break;e=e.parentNode}const n=e!==document.body&&e instanceof HTMLElement?e:document.body,o=n.getBoundingClientRect(),i=getComputedStyle(n),[s,r,a,c]=[i.borderTopWidth,i.borderLeftWidth,i.borderRightWidth,i.borderBottomWidth].map((t=>parseInt(t,10)||0));return{top:o.top+s,left:o.left+r,width:o.width-a-r,height:Math.max(o.height-s-c,n===document.body?window.innerHeight:-1/0)}}(o),s=getComputedStyle(o),r=o.getBoundingClientRect(),[a,c]=[s.borderTopWidth,s.borderLeftWidth].map((t=>parseInt(t,10)||0));return function(t,e,n,o,{side:i,align:s,allowOutOfBounds:r,anchorOffset:a,alignmentOffset:c}){const l={top:t.top-e.top,left:t.left-e.left,width:t.width,height:t.height};let u=Nt(n,o,i,s,a,c),d=i,h=s;if(u.top-=e.top,u.left-=e.left,!r){const r=Ft[i];let f=0;if(r){let t=i;for(;f<r.length&&Ut(t,u,l,n);){const i=r[f++];t=i,u=Nt(n,o,i,s,a,c),u.top-=e.top,u.left-=e.left,d=i}}const m=Ot[s];let p=0;if(m){let t=s;for(;p<m.length&&Xt(t,u,l,n);){const i=m[p++];t=i,u=Nt(n,o,d,i,a,c),u.top-=e.top,u.left-=e.left,h=i}}u.top<l.top&&(u.top=l.top),u.left<l.left&&(u.left=l.left),u.left+n.width>t.width+l.left&&(u.left=t.width+l.left-n.width),r&&f<r.length&&u.top+n.height>t.height+l.top&&(u.top=t.height+l.top-n.height)}return Object.assign(Object.assign({},u),{anchorSide:d,anchorAlign:h})}(i,{top:r.top+a,left:r.left+c},t.getBoundingClientRect(),e instanceof Element?e.getBoundingClientRect():e,function(t={}){var e,n,o,i,s;const r=null!==(e=t.side)&&void 0!==e?e:qt,a=null!==(n=t.align)&&void 0!==n?n:Wt;return{side:r,align:a,anchorOffset:null!==(o=t.anchorOffset)&&void 0!==o?o:"inside-center"===r?0:Pt,alignmentOffset:null!==(i=t.alignmentOffset)&&void 0!==i?i:"center"!==a&&r.startsWith("inside")?Bt:0,allowOutOfBounds:null!==(s=t.allowOutOfBounds)&&void 0!==s?s:Yt}}(n))}const qt="outside-bottom",Wt="start",Pt=4,Bt=4,Yt=!1;function Nt(t,e,n,o,i,s){const r=e.left+e.width,a=e.top+e.height;let c=-1,l=-1;return"outside-top"===n?c=e.top-i-t.height:"outside-bottom"===n?c=a+i:"outside-left"===n?l=e.left-i-t.width:"outside-right"===n&&(l=r+i),"outside-top"!==n&&"outside-bottom"!==n||(l="start"===o?e.left+s:"center"===o?e.left-(t.width-e.width)/2+s:r-t.width-s),"outside-left"!==n&&"outside-right"!==n||(c="start"===o?e.top+s:"center"===o?e.top-(t.height-e.height)/2+s:a-t.height-s),"inside-top"===n?c=e.top+i:"inside-bottom"===n?c=a-i-t.height:"inside-left"===n?l=e.left+i:"inside-right"===n?l=r-i-t.width:"inside-center"===n&&(l=(r+e.left)/2-t.width/2+i),"inside-top"===n||"inside-bottom"===n?l="start"===o?e.left+s:"center"===o?e.left-(t.width-e.width)/2+s:r-t.width-s:"inside-left"!==n&&"inside-right"!==n&&"inside-center"!==n||(c="start"===o?e.top+s:"center"===o?e.top-(t.height-e.height)/2+s:a-t.height-s),{top:c,left:l}}function Ut(t,e,n,o){return"outside-top"===t||"outside-bottom"===t?e.top<n.top||e.top+o.height>n.height+n.top:e.left<n.left||e.left+o.width>n.width+n.left}function Xt(t,e,n,o){return"end"===t?e.left<n.left:"start"===t||"center"===t?e.left+o.width>n.left+n.width||e.left<n.left:void 0}var Kt,jt,zt,Vt,Zt,Jt,Gt;const _t=["tooltip-n","tooltip-s","tooltip-e","tooltip-w","tooltip-ne","tooltip-se","tooltip-nw","tooltip-sw"];class ToolTipElement extends HTMLElement{constructor(){super(...arguments),Kt.add(this),jt.set(this,void 0),zt.set(this,"center"),Vt.set(this,"outside-bottom"),Zt.set(this,!1)}styles(){return'\n :host {\n position: absolute;\n z-index: 1000000;\n padding: .5em .75em;\n font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";\n -webkit-font-smoothing: subpixel-antialiased;\n color: var(--color-fg-on-emphasis);\n text-align: center;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: break-word;\n white-space: pre;\n background: var(--color-neutral-emphasis-plus);\n border-radius: 6px;\n opacity: 0;\n max-width: 250px;\n word-wrap: break-word;\n white-space: normal;\n width: max-content;\n }\n\n :host:before{\n position: absolute;\n z-index: 1000001;\n color: var(--color-neutral-emphasis-plus);\n content: "";\n border: 6px solid transparent;\n opacity: 0\n }\n\n @keyframes tooltip-appear {\n from {\n opacity: 0\n }\n to {\n opacity: 1\n }\n }\n\n :host:after{\n position: absolute;\n display: block;\n right: 0;\n left: 0;\n height: 12px;\n content: ""\n }\n\n :host(.tooltip-open),\n :host(.tooltip-open):before {\n animation-name: tooltip-appear;\n animation-duration: .1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: .4s\n }\n\n :host(.tooltip-s):before,\n :host(.tooltip-n):before {\n right: 50%;\n margin-right: -6px;\n }\n\n :host(.tooltip-s):before,\n :host(.tooltip-se):before,\n :host(.tooltip-sw):before {\n bottom: 100%;\n border-bottom-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-s):after,\n :host(.tooltip-se):after,\n :host(.tooltip-sw):after {\n bottom: 100%\n }\n\n :host(.tooltip-n):before,\n :host(.tooltip-ne):before,\n :host(.tooltip-nw):before {\n top: 100%;\n border-top-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-n):after,\n :host(.tooltip-ne):after,\n :host(.tooltip-nw):after {\n top: 100%\n }\n\n :host(.tooltip-se):before,\n :host(.tooltip-ne):before {\n left: 0;\n margin-left: 6px;\n }\n\n :host(.tooltip-sw):before,\n :host(.tooltip-nw):before {\n right: 0;\n margin-right: 6px;\n }\n\n :host(.tooltip-w):before {\n top: 50%;\n bottom: 50%;\n left: 100%;\n margin-top: -6px;\n border-left-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-e):before {\n top: 50%;\n right: 100%;\n bottom: 50%;\n margin-top: -6px;\n border-right-color: var(--color-neutral-emphasis-plus)\n }\n '}get htmlFor(){return this.getAttribute("for")||""}set htmlFor(t){this.setAttribute("for",t)}get type(){return"label"===this.getAttribute("data-type")?"label":"description"}set type(t){this.setAttribute("data-type",t)}get direction(){return this.getAttribute("data-direction")||"s"}set direction(t){this.setAttribute("data-direction",t)}get control(){return this.ownerDocument.getElementById(this.htmlFor)}set hiddenFromView(t){this.classList.toggle("sr-only",t),this.isConnected&&mt(this,Kt,"m",Jt).call(this)}get hiddenFromView(){return this.classList.contains("sr-only")}connectedCallback(){var t;if(!this.shadowRoot){this.attachShadow({mode:"open"}).innerHTML=`\n <style>\n ${this.styles()}\n </style>\n <slot></slot>\n `}if(this.hiddenFromView=!0,pt(this,Zt,!0,"f"),this.id||(this.id=`tooltip-${Date.now()}-${(1e4*Math.random()).toFixed(0)}`),!this.control)return;this.setAttribute("role","tooltip"),null===(t=mt(this,jt,"f"))||void 0===t||t.abort(),pt(this,jt,new AbortController,"f");const{signal:e}=mt(this,jt,"f");this.addEventListener("mouseleave",this,{signal:e}),this.control.addEventListener("mouseenter",this,{signal:e}),this.control.addEventListener("mouseleave",this,{signal:e}),this.control.addEventListener("focus",this,{signal:e}),this.control.addEventListener("blur",this,{signal:e}),this.ownerDocument.addEventListener("keydown",this,{signal:e}),mt(this,Kt,"m",Jt).call(this)}disconnectedCallback(){var t;null===(t=mt(this,jt,"f"))||void 0===t||t.abort()}handleEvent(t){this.control&&("mouseenter"!==t.type&&"focus"!==t.type||!this.hiddenFromView?"blur"===t.type||"mouseleave"===t.type&&t.relatedTarget!==this.control&&t.relatedTarget!==this?this.hiddenFromView=!0:"keydown"!==t.type||"Escape"!==t.key||this.hiddenFromView||(this.hiddenFromView=!0):this.hiddenFromView=!1)}attributeChangedCallback(t){if("id"===t||"data-type"===t){if(!this.id||!this.control)return;if("label"===this.type){let t=this.control.getAttribute("aria-labelledby");t=t?`${t} ${this.id}`:this.id,this.control.setAttribute("aria-labelledby",t),this.setAttribute("aria-hidden","true")}else{let t=this.control.getAttribute("aria-describedby");t=t?`${t} ${this.id}`:this.id,this.control.setAttribute("aria-describedby",t)}}else if("data-direction"===t){this.classList.remove(..._t);const t=this.direction;"n"===t?(pt(this,zt,"center","f"),pt(this,Vt,"outside-top","f")):"ne"===t?(pt(this,zt,"start","f"),pt(this,Vt,"outside-top","f")):"e"===t?(pt(this,zt,"center","f"),pt(this,Vt,"outside-right","f")):"se"===t?(pt(this,zt,"start","f"),pt(this,Vt,"outside-bottom","f")):"s"===t?(pt(this,zt,"center","f"),pt(this,Vt,"outside-bottom","f")):"sw"===t?(pt(this,zt,"end","f"),pt(this,Vt,"outside-bottom","f")):"w"===t?(pt(this,zt,"center","f"),pt(this,Vt,"outside-left","f")):"nw"===t&&(pt(this,zt,"end","f"),pt(this,Vt,"outside-top","f"))}}}jt=new WeakMap,zt=new WeakMap,Vt=new WeakMap,Zt=new WeakMap,Kt=new WeakSet,Jt=function(){if(this.hiddenFromView)this.classList.remove("tooltip-open",..._t);else{this.classList.add("tooltip-open");for(const t of this.ownerDocument.querySelectorAll(this.tagName))t!==this&&(t.hiddenFromView=!0);mt(this,Kt,"m",Gt).call(this)}},Gt=function(){if(!this.control)return;if(!mt(this,Zt,"f")||this.hiddenFromView)return;this.style.left="0px";const t=It(this,this.control,{side:mt(this,Vt,"f"),align:mt(this,zt,"f"),anchorOffset:10}),e=t.anchorSide,n=t.anchorAlign;this.style.top=`${t.top}px`,this.style.left=`${t.left}px`;let o="s";o="outside-left"===e?"w":"outside-right"===e?"e":"outside-top"===e?"center"===n?"n":"start"===n?"ne":"nw":"center"===n?"s":"start"===n?"se":"sw",this.classList.add(`tooltip-${o}`)},ToolTipElement.observedAttributes=["data-type","data-direction","id"],window.customElements.get("tool-tip")||(window.ToolTipElement=ToolTipElement,window.customElements.define("tool-tip",ToolTipElement));
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(o)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(o),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"),i(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 o(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function i(t,e){(function(t,e){const n=t.scrollTop,o=n+t.clientHeight,i=e.offsetTop,s=i+e.clientHeight;return i>=n&&s<=o})(t,e)||(t.scrollTop=e.offsetTop)}const s=window.testScreenReaderDelay||100;class r{constructor(t,n,o,i=!1){var s;if(this.container=t,this.input=n,this.results=o,this.combobox=new e(n,o),this.feedback=document.getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=i,this.clearButton=document.getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=o.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){const t=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(null==t?void 0:t.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.hidden=!0,this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...o){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...o)}),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.handleClear=this.handleClear.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),null===(s=this.clearButton)||void 0===s||s.addEventListener("click",this.handleClear)}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)}handleClear(t){t.preventDefault(),"true"===this.input.getAttribute("aria-expanded")&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.container.open=!1}onKeydown(t){if("Enter"===t.key&&this.container.open&&this.autoselectEnabled){const e=this.results.children[0];e&&(t.stopPropagation(),t.preventDefault(),this.onCommit({target:e}))}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.updateFeedbackForScreenReaders(`${e.textContent||""} selected.`),this.container.value=n,n||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),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++}`}updateFeedbackForScreenReaders(t){setTimeout((()=>{this.feedback&&(this.feedback.textContent=t)}),s)}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),o=new URLSearchParams(n.search.slice(1));o.append("q",t),n.search=o.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=this.results.querySelectorAll('[role="option"]'),n=!!e.length,o=e.length,[i]=e,s=null==i?void 0:i.textContent;this.autoselectEnabled&&s?this.updateFeedbackForScreenReaders(`${o} results. ${s} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${o||"No"} results.`),this.container.open=n,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)}}class a extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const c=new WeakMap;function l(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=c.get(t);n&&n.abort();c.set(t,e);const o=()=>c.delete(t),i=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 i.then(o,o),i}(t,n)}const u=new WeakMap;class AutocompleteElement extends HTMLElement{constructor(){super(...arguments),this.fetchResult=l}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);if(!(e instanceof HTMLInputElement&&n))return;const o="true"===this.getAttribute("data-autoselect");u.set(this,new r(this,e,n,o)),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 o=u.get(this);if(o)switch(t){case"open":null===n?o.close():o.open();break;case"value":null!==n&&(o.input.value=n),this.dispatchEvent(new a("auto-complete-change",{bubbles:!0,relatedTarget:o.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 f(t){const e=t.getAttribute("for"),n=t.getAttribute("value");function o(){t.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)h(n).then(o);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&&(i=s,i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement?h(i.value):i instanceof HTMLAnchorElement&&i.hasAttribute("href")?h(i.href):d(i)).then(o)}var i}function m(t){const e=t.currentTarget;e instanceof HTMLElement&&f(e)}function p(t){if(" "===t.key||"Enter"===t.key){const e=t.currentTarget;e instanceof HTMLElement&&(t.preventDefault(),f(e))}}function b(t){t.currentTarget.addEventListener("keydown",p)}function g(t){t.currentTarget.removeEventListener("keydown",p)}window.customElements.get("auto-complete")||(window.AutocompleteElement=AutocompleteElement,window.customElements.define("auto-complete",AutocompleteElement));class ClipboardCopyElement extends HTMLElement{constructor(){super(),this.addEventListener("click",m),this.addEventListener("focus",b),this.addEventListener("blur",g)}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=ClipboardCopyElement,window.customElements.define("clipboard-copy",ClipboardCopyElement));function w(t){t.style.display="inline-block"}function v(t){t.style.display="none"}const E=new WeakMap;function y(t){return Array.from(t.querySelectorAll('[role="tablist"] [role="tab"]')).filter((e=>e instanceof HTMLElement&&e.closest(t.tagName)===t))}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)):function(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(v(e),w(n))}(t),E.set(t,setTimeout((()=>{!function(t){const[e,n]=t.querySelectorAll(".octicon");e&&n&&(w(e),v(n))}(t),E.delete(t)}),2e3))}));class TabContainerElement extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if(e.closest(this.tagName)!==this)return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=y(this),o=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=o+1;t>=n.length&&(t=0),A(this,t)}else if("ArrowLeft"===t.code){let t=o-1;t<0&&(t=n.length-1),A(this,t)}else"Home"===t.code?(A(this,0),t.preventDefault()):"End"===t.code&&(A(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=y(this);if(!(t.target instanceof Element))return;if(t.target.closest(this.tagName)!==this)return;const n=t.target.closest('[role="tab"]');if(!(n instanceof HTMLElement&&n.closest('[role="tablist"]')))return;A(this,e.indexOf(n))}))}connectedCallback(){for(const t of y(this))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 A(t,e){const n=y(t),o=Array.from(t.querySelectorAll('[role="tabpanel"]')).filter((e=>e.closest(t.tagName)===t)),i=n[e],s=o[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 o)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");i.setAttribute("aria-selected","true"),i.setAttribute("tabindex","0"),i.focus(),s.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:s}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=TabContainerElement,window.customElements.define("tab-container",TabContainerElement));const T=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k=["January","February","March","April","May","June","July","August","September","October","November","December"];function L(t){return`0${t}`.slice(-2)}function x(t,e){const n=t.getDay(),o=t.getDate(),i=t.getMonth(),s=t.getFullYear(),r=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let l;switch(e[1]){case"%":return"%";case"a":return T[n].slice(0,3);case"A":return T[n];case"b":return k[i].slice(0,3);case"B":return k[i];case"c":return t.toString();case"d":return L(o);case"e":return String(o);case"H":return L(r);case"I":return L(x(t,"%l"));case"l":return String(0===r||12===r?12:(r+12)%12);case"m":return L(i+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 l=t.toString().match(/\((\w+)\)$/),l?l[1]:"";case"z":return l=t.toString().match(/\w([+-]\d\d\d\d) /),l?l[1]:""}return""}))}function M(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 S=M({day:"numeric",month:"short"});function D(){if(null!==C)return C;const t=S();if(t){const e=t.format(new Date(0));return C=!!e.match(/^\d/),C}return!1}let H=null;const F=M({day:"numeric",month:"short",year:"numeric"});function R(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const $=new WeakMap;class ExtendedTimeElement 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 o=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?$.delete(this):$.set(this,new Date(t))}const i=this.getFormattedTitle(),s=this.getAttribute("title");"title"===t||!i||s&&s!==o||this.setAttribute("title",i);const r=this.getFormattedDate();r&&(this.textContent=r)}get date(){return $.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=O();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const O=M({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),I=new WeakMap;class LocalTimeElement extends ExtendedTimeElement{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||I.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 o=D()?"weekday day month year":"weekday month day, year";for(const e in n){const i=n[e][t.getAttribute(e)||""];o=o.replace(e,i||"")}return o=o.replace(/(\s,)|(,\s$)/,""),x(e,o).replace(/\s+/," ").trim()}(this,t)||""} ${function(t,e){const n={},o=t.getAttribute("hour");"numeric"!==o&&"2-digit"!==o||(n.hour=o);const i=t.getAttribute("minute");"numeric"!==i&&"2-digit"!==i||(n.minute=i);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=I.get(t);a||(a=M(n),I.set(t,a));const c=a();if(c)return c.format(e);return x(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||""}`.trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=LocalTimeElement,window.customElements.define("local-time",LocalTimeElement));class W{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),o=Math.round(n/60),i=Math.round(o/24);return t>=0&&i<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),o=Math.round(n/60),i=Math.round(o/24);return t>=0&&i<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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return t<0||e<10?q(this.locale,0,"second"):e<45?q(this.locale,-e,"second"):e<90||n<45?q(this.locale,-n,"minute"):n<90||o<24?q(this.locale,-o,"hour"):o<36||i<30?q(this.locale,-i,"day"):s<18?q(this.locale,-s,"month"):q(this.locale,-r,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return n<1?"1m":n<60?`${n}m`:o<24?`${o}h`:i<365?`${i}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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return s>=18||s>=12?q(this.locale,r,"year"):i>=45||i>=30?q(this.locale,s,"month"):o>=36||o>=24?q(this.locale,i,"day"):n>=90||n>=45?q(this.locale,o,"hour"):e>=90||e>=45?q(this.locale,n,"minute"):q(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),o=Math.round(n/60),i=Math.round(o/24),s=Math.round(i/30),r=Math.round(s/12);return i>=365?`${r}y`:o>=24?`${i}d`:n>=60?`${o}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!==H)return H;const t=F();if(t){const e=t.format(new Date(0));return H=!!e.match(/\d,/),H}return!0}()?", %Y":" %Y"),x(this.date,t)}formatTime(){const t=P();return t?t.format(this.date):x(this.date,"%l:%M%P")}}function q(t,e,n){const o=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 o?o.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 P=M({hour:"numeric",minute:"2-digit"});class RelativeTimeElement extends ExtendedTimeElement{getFormattedDate(){const t=this.date;if(t)return new W(t,R(this)).toString()}connectedCallback(){N.push(this),B||(Y(),B=window.setInterval(Y,6e4)),super.connectedCallback()}disconnectedCallback(){const t=N.indexOf(this);-1!==t&&N.splice(t,1),N.length||B&&(clearInterval(B),B=null)}}const N=[];let B;function Y(){let t,e,n;for(e=0,n=N.length;e<n;e++)t=N[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=RelativeTimeElement,window.customElements.define("relative-time",RelativeTimeElement));class TimeAgoElement extends RelativeTimeElement{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new W(e,R(this)).microTimeAgo():new W(e,R(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=TimeAgoElement,window.customElements.define("time-ago",TimeAgoElement));class TimeUntilElement extends RelativeTimeElement{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new W(e,R(this)).microTimeUntil():new W(e,R(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=TimeUntilElement,window.customElements.define("time-until",TimeUntilElement));const U=new WeakMap,X=new WeakMap,K=new WeakMap;function j(t){const e=t.currentTarget;if(!(e instanceof ImageCropElement))return;const{box:n,image:o}=K.get(e)||{};if(!n||!o)return;let i=0,s=0;if(t instanceof KeyboardEvent)"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);else if(X.has(e)&&t instanceof MouseEvent){const n=X.get(e);i=t.pageX-n.dragStartX,s=t.pageY-n.dragStartY}else if(X.has(e)&&t instanceof TouchEvent){const{pageX:n,pageY:o}=t.changedTouches[0],{dragStartX:r,dragStartY:a}=X.get(e);i=n-r,s=o-a}if(0!==i||0!==s){const t=Math.min(Math.max(0,n.offsetLeft+i),o.width-n.offsetWidth),r=Math.min(Math.max(0,n.offsetTop+s),o.height-n.offsetHeight);n.style.left=`${t}px`,n.style.top=`${r}px`,Q(e,{x:t,y:r,width:n.offsetWidth,height:n.offsetHeight})}if(t instanceof MouseEvent)X.set(e,{dragStartX:t.pageX,dragStartY:t.pageY});else if(t instanceof TouchEvent){const{pageX:n,pageY:o}=t.changedTouches[0];X.set(e,{dragStartX:n,dragStartY:o})}}function z(t){const e=t.target;if(!(e instanceof HTMLElement))return;const n=V(e);if(!(n instanceof ImageCropElement))return;const{box:o}=K.get(n)||{};if(!o)return;const i=n.getBoundingClientRect();let s,r,a;if(t instanceof KeyboardEvent){if("Escape"===t.key)return J(n);if("-"===t.key&&(a=-10),"="===t.key&&(a=10),!a)return;s=o.offsetWidth+a,r=o.offsetHeight+a,U.set(n,{startX:o.offsetLeft,startY:o.offsetTop})}else if(t instanceof MouseEvent){const e=U.get(n);if(!e)return;s=t.pageX-e.startX-i.left-window.pageXOffset,r=t.pageY-e.startY-i.top-window.pageYOffset}else if(t instanceof TouchEvent){const e=U.get(n);if(!e)return;s=t.changedTouches[0].pageX-e.startX-i.left-window.pageXOffset,r=t.changedTouches[0].pageY-e.startY-i.top-window.pageYOffset}s&&r&&_(n,s,r,!(t instanceof KeyboardEvent))}function V(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.host:t}function Z(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const n=V(e);if(!(n instanceof ImageCropElement))return;const{box:o}=K.get(n)||{};if(!o)return;const i=t.target;if(i instanceof HTMLElement)if(i.hasAttribute("data-direction")){const e=i.getAttribute("data-direction")||"";n.addEventListener("mousemove",z),n.addEventListener("touchmove",z,{passive:!0}),["nw","se"].indexOf(e)>=0&&n.classList.add("nwse"),["ne","sw"].indexOf(e)>=0&&n.classList.add("nesw"),U.set(n,{startX:o.offsetLeft+(["se","ne"].indexOf(e)>=0?0:o.offsetWidth),startY:o.offsetTop+(["se","sw"].indexOf(e)>=0?0:o.offsetHeight)}),z(t)}else n.addEventListener("mousemove",j),n.addEventListener("touchmove",j,{passive:!0})}function _(t,e,n,o=!0){let i=Math.max(Math.abs(e),Math.abs(n),10);const s=U.get(t);if(!s)return;const{box:r,image:a}=K.get(t)||{};if(!r||!a)return;i=Math.min(i,n>0?a.height-s.startY:s.startY,e>0?a.width-s.startX:s.startX);const c=o?Math.round(Math.max(0,e>0?s.startX:s.startX-i)):r.offsetLeft,l=o?Math.round(Math.max(0,n>0?s.startY:s.startY-i)):r.offsetTop;r.style.left=`${c}px`,r.style.top=`${l}px`,r.style.width=`${i}px`,r.style.height=`${i}px`,Q(t,{x:c,y:l,width:i,height:i})}function J(t){const{image:e}=K.get(t)||{};if(!e)return;const n=Math.round(e.clientWidth>e.clientHeight?e.clientHeight:e.clientWidth);U.set(t,{startX:(e.clientWidth-n)/2,startY:(e.clientHeight-n)/2}),_(t,n,n)}function G(t){const e=t.currentTarget;e instanceof ImageCropElement&&(X.delete(e),e.classList.remove("nwse","nesw"),e.removeEventListener("mousemove",z),e.removeEventListener("mousemove",j),e.removeEventListener("touchmove",z),e.removeEventListener("touchmove",j))}function Q(t,e){const{image:n}=K.get(t)||{};if(!n)return;const o=n.naturalWidth/n.width;for(const n in e){const i=Math.round(e[n]*o);e[n]=i;const s=t.querySelector(`[data-image-crop-input='${n}']`);s instanceof HTMLInputElement&&(s.value=i.toString())}t.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:e}))}class ImageCropElement extends HTMLElement{connectedCallback(){if(K.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&&(K.set(this,{box:e,image:n}),n.addEventListener("load",(()=>{this.loaded=!0,J(this)})),this.addEventListener("mouseleave",G),this.addEventListener("touchend",G),this.addEventListener("mouseup",G),e.addEventListener("mousedown",Z),e.addEventListener("touchstart",Z,{passive:!0}),this.addEventListener("keydown",j),this.addEventListener("keydown",z),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:o}=K.get(this)||{};"src"===t&&(this.loaded=!1,o&&(o.src=n))}}window.customElements.get("image-crop")||(window.ImageCropElement=ImageCropElement,window.customElements.define("image-crop",ImageCropElement));class DetailsMenuElement extends HTMLElement{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=[nt(t,"compositionstart",(t=>ht(this,t))),nt(t,"compositionend",(t=>ht(this,t))),nt(t,"click",(e=>ct(t,e))),nt(t,"change",(e=>ct(t,e))),nt(t,"keydown",(e=>function(t,e,n){if(!(n instanceof KeyboardEvent))return;if(t.querySelector("details[open]"))return;const o=tt.get(e);if(!o||o.isComposing)return;const i=n.target instanceof Element&&"SUMMARY"===n.target.tagName;switch(n.key){case"Escape":t.hasAttribute("open")&&(dt(t),n.preventDefault(),n.stopPropagation());break;case"ArrowDown":{i&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=rt(t,!0);e&&e.focus(),n.preventDefault()}break;case"ArrowUp":{i&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=rt(t,!1);e&&e.focus(),n.preventDefault()}break;case"n":if(at&&n.ctrlKey){const e=rt(t,!0);e&&e.focus(),n.preventDefault()}break;case"p":if(at&&n.ctrlKey){const e=rt(t,!1);e&&e.focus(),n.preventDefault()}break;case" ":case"Enter":{const e=document.activeElement;e instanceof HTMLElement&&ut(e)&&e.closest("details")===t&&(n.preventDefault(),n.stopPropagation(),e.click())}}}(t,this,e))),nt(t,"toggle",(()=>ot(t,this)),{once:!0}),nt(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?nt(t,"mouseover",(()=>ot(t,this)),{once:!0}):et,...it(t)];tt.set(this,{subscriptions:n,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=tt.get(this);if(t){tt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const tt=new WeakMap,et={unsubscribe(){}};function nt(t,e,n,o=!1){return t.addEventListener(e,n,o),{unsubscribe:()=>{t.removeEventListener(e,n,o)}}}function ot(t,e){const n=e.getAttribute("src");if(!n)return;const o=tt.get(e);if(!o)return;if(o.loaded)return;o.loaded=!0;const i=e.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",(()=>st(t))),i.setAttribute("src",n))}function it(t){let e=!1;return[nt(t,"mousedown",(()=>e=!0)),nt(t,"keydown",(()=>e=!1)),nt(t,"toggle",(()=>{t.hasAttribute("open")&&(st(t)||e||function(t){const e=document.activeElement;if(e&&ut(e)&&t.contains(e))return;const n=rt(t,!0);n&&n.focus()}(t))}))]}function st(t){if(!t.hasAttribute("open"))return!1;const e=t.querySelector("details-menu [autofocus]");return!!e&&(e.focus(),!0)}function rt(t,e){const n=Array.from(t.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled]):not([aria-disabled="true"])')),o=document.activeElement,i=o instanceof HTMLElement?n.indexOf(o):-1,s=e?n[i+1]:n[i-1],r=e?n[0]:n[n.length-1];return s||r}const at=navigator.userAgent.match(/Macintosh/);function ct(t,e){const n=e.target;if(n instanceof Element&&n.closest("details")===t)if("click"===e.type){const e=n.closest('[role="menuitem"], [role="menuitemradio"]');if(!e)return;const o=e.querySelector("input");if("LABEL"===e.tagName&&n===o)return;"LABEL"===e.tagName&&o&&!o.checked||lt(e,t)}else if("change"===e.type){const e=n.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');e&&lt(e,t)}}function lt(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 o=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(o)n.textContent=o;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 o=(n===t).toString();e instanceof HTMLInputElement&&(o=e.indeterminate?"mixed":e.checked.toString()),n.setAttribute("aria-checked",o)}}(t,e),"menuitemcheckbox"!==t.getAttribute("role")&&dt(e),n.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:t}})))}function ut(t){const e=t.getAttribute("role");return"menuitem"===e||"menuitemcheckbox"===e||"menuitemradio"===e}function dt(t){if(!t.hasAttribute("open"))return;t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}function ht(t,e){const n=tt.get(t);n&&(n.isComposing="compositionstart"===e.type)}function ft(t,e,n,o){var i,s=arguments.length,r=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(s<3?i(r):s>3?i(e,n,r):i(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r}function mt(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}function pt(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?i.call(t,n):i?i.value=n:e.set(t,n),n}window.customElements.get("details-menu")||(window.DetailsMenuElement=DetailsMenuElement,window.customElements.define("details-menu",DetailsMenuElement));const bt=new WeakSet;function gt(t){Et(t),vt(t)}const wt=new WeakMap;function vt(t=document){if(wt.has(t))return wt.get(t);let e=!1;const n=new MutationObserver((t=>{for(const e of t)if("attributes"===e.type&&e.target instanceof Element)Tt(e.target);else if("childList"===e.type&&e.addedNodes.length)for(const t of e.addedNodes)t instanceof Element&&Et(t)}));n.observe(t,{childList:!0,subtree:!0,attributeFilter:["data-action"]});const o={get closed(){return e},unsubscribe(){e=!0,wt.delete(t),n.disconnect()}};return wt.set(t,o),o}function Et(t){for(const e of t.querySelectorAll("[data-action]"))Tt(e);t instanceof Element&&t.hasAttribute("data-action")&&Tt(t)}function yt(t){const e=t.currentTarget;for(const n of At(e))if(t.type===n.type){const o=e.closest(n.tag);bt.has(o)&&"function"==typeof o[n.method]&&o[n.method](t);const i=e.getRootNode();if(i instanceof ShadowRoot&&bt.has(i.host)&&i.host.matches(n.tag)){const e=i.host;"function"==typeof e[n.method]&&e[n.method](t)}}}function*At(t){for(const e of(t.getAttribute("data-action")||"").trim().split(/\s+/)){const t=e.lastIndexOf(":"),n=Math.max(0,e.lastIndexOf("#"))||e.length;yield{type:e.slice(0,t),tag:e.slice(t+1,n),method:e.slice(n+1)||"handleEvent"}||"handleEvent"}}function Tt(t){for(const e of At(t))t.addEventListener(e.type,yt)}const kt=t=>String("symbol"==typeof t?t.description:t).replace(/([A-Z]($|[a-z]))/g,"-$1").replace(/--/g,"-").replace(/^-|-$/,"").toLowerCase(),Lt=(t,e="property")=>{const n=kt(t);if(!n.includes("-"))throw new DOMException(`${e}: ${String(t)} is not a valid ${e} name`,"SyntaxError");return n};const xt=new WeakSet;function Mt(t,e){if(xt.has(t))return;xt.add(t);const n=Object.getPrototypeOf(t),o=n?.constructor?.attrPrefix??"data-";e||(e=Dt(n,"attr"));for(const n of e){const e=t[n],i=Lt(`${o}${n}`);let s={configurable:!0,get(){return this.getAttribute(i)||""},set(t){this.setAttribute(i,t||"")}};"number"==typeof e?s={configurable:!0,get(){return Number(this.getAttribute(i)||0)},set(t){this.setAttribute(i,t)}}:"boolean"==typeof e&&(s={configurable:!0,get(){return this.hasAttribute(i)},set(t){this.toggleAttribute(i,t)}}),Object.defineProperty(t,n,s),n in t&&!t.hasAttribute(i)&&s.set.call(t,e)}}const Ct=Symbol.for("catalyst");class St{constructor(t){const e=this,n=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){e.connectedCallback(this,n)};const o=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){e.disconnectedCallback(this,o)};const i=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,n,o){e.attributeChangedCallback(this,t,n,o,i)};let s=t.observedAttributes||[];Object.defineProperty(t,"observedAttributes",{configurable:!0,get(){return e.observedAttributes(this,s)},set(t){s=t}}),function(t){let e=t.observedAttributes||[];const n=t.attrPrefix??"data-",o=t=>Lt(`${n}${t}`);Object.defineProperty(t,"observedAttributes",{configurable:!0,get:()=>[...Dt(t.prototype,"attr")].map(o).concat(e),set(t){e=t}})}(t),function(t){const e=kt(t.name).replace(/-element$/,"");try{window.customElements.define(e,t),window[t.name]=customElements.get(e)}catch(t){if(!(t instanceof DOMException&&"NotSupportedError"===t.name))throw t}}(t)}observedAttributes(t,e){return e}connectedCallback(t,e){t.toggleAttribute("data-catalyst",!0),customElements.upgrade(t),function(t){for(const e of t.querySelectorAll("template[data-shadowroot]"))e.parentElement===t&&t.attachShadow({mode:"closed"===e.getAttribute("data-shadowroot")?"closed":"open"}).append(e.content.cloneNode(!0))}(t),Mt(t),function(t){bt.add(t),t.shadowRoot&&gt(t.shadowRoot),Et(t),vt(t.ownerDocument)}(t),e?.call(t),t.shadowRoot&&gt(t.shadowRoot)}disconnectedCallback(t,e){e?.call(t)}attributeChangedCallback(t,e,n,o,i){Mt(t),"data-catalyst"!==e&&i&&i.call(t,e,n,o)}}function Dt(t,e){if(!Object.prototype.hasOwnProperty.call(t,Ct)){const e=t[Ct],n=t[Ct]=new Map;if(e)for(const[t,o]of e)n.set(t,new Set(o))}const n=t[Ct];return n.has(e)||n.set(e,new Set),n.get(e)}function Ht(t,e){Dt(t,"target").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const n=t.tagName.toLowerCase();if(t.shadowRoot)for(const o of t.shadowRoot.querySelectorAll(`[data-target~="${n}.${e}"]`))if(!o.closest(n))return o;for(const o of t.querySelectorAll(`[data-target~="${n}.${e}"]`))if(o.closest(n)===t)return o}(this,e)}})}function Ft(t,e=0,{start:n=!1,middle:o=!1,once:i=!1}={}){return function(t,e=0,{start:n=!0,middle:o=!0,once:i=!1}={}){let s,r=0,a=!1;function c(...l){if(a)return;const u=Date.now()-r;r=Date.now(),n?(n=!1,t.apply(this,l),i&&c.cancel()):(o&&u<e||!o)&&(clearTimeout(s),s=setTimeout((()=>{r=Date.now(),t.apply(this,l),i&&c.cancel()}),o?e-u:e))}return c.cancel=()=>{clearTimeout(s),a=!0},c}(t,e,{start:n,middle:o,once:i})}new Promise((t=>{"loading"!==document.readyState?t():document.addEventListener("readystatechange",(()=>t()),{once:!0})})),new Promise((t=>{const e=new AbortController;e.signal.addEventListener("abort",(()=>t()));const n={once:!0,passive:!0,signal:e.signal},o=()=>e.abort();document.addEventListener("mousedown",o,n),document.addEventListener("touchstart",o,n),document.addEventListener("keydown",o,n),document.addEventListener("pointerdown",o,n)}));let Rt=class ToggleSwitchElement extends HTMLElement{get src(){const t=this.getAttribute("src");if(!t)return null;const e=this.ownerDocument.createElement("a");return e.href=t,e.href}get csrf(){const t=this.querySelector("[data-csrf]");return this.getAttribute("csrf")||t instanceof HTMLInputElement&&t.value||null}get csrfField(){return this.getAttribute("csrf-field")||"authenticity_token"}isRemote(){return null!=this.src}toggle(){this.isRemote()?(this.setLoadingState(),this.check()):this.performToggle()}turnOn(){this.isDisabled()||(this.switch.setAttribute("aria-checked","true"),this.classList.add("ToggleSwitch--checked"))}turnOff(){this.isDisabled()||(this.switch.setAttribute("aria-checked","false"),this.classList.remove("ToggleSwitch--checked"))}isOn(){return"true"===this.switch.getAttribute("aria-checked")}isOff(){return!this.isOn()}isDisabled(){return"true"===this.switch.getAttribute("aria-disabled")}disable(){this.switch.setAttribute("aria-disabled","true")}enable(){this.switch.setAttribute("aria-disabled","false")}performToggle(){this.isOn()?this.turnOff():this.turnOn()}setLoadingState(){this.disable(),this.errorIcon.setAttribute("hidden","hidden"),this.loadingSpinner.removeAttribute("hidden")}setSuccessState(){this.setFinishedState(!1)}setErrorState(){this.setFinishedState(!0)}setFinishedState(t){t&&this.errorIcon.removeAttribute("hidden"),this.loadingSpinner.setAttribute("hidden","hidden"),this.enable()}async check(){const t=new FormData;this.csrf&&t.append(this.csrfField,this.csrf),t.append("value",this.isOn()?"1":"0");try{if(!this.src)throw new Error("invalid src");(await fetch(this.src,{credentials:"same-origin",method:"POST",body:t})).ok?(this.setSuccessState(),this.performToggle()):this.setErrorState()}catch(t){this.setErrorState()}}};ft([Ht],Rt.prototype,"switch",void 0),ft([Ht],Rt.prototype,"loadingSpinner",void 0),ft([Ht],Rt.prototype,"errorIcon",void 0),ft([function(t=0,e={}){return(n,o,i)=>{if(!i||"function"!=typeof i.value)throw new Error("debounce can only decorate functions");const s=i.value;i.value=Ft(s,t,e),Object.defineProperty(n,o,i)}}(300)],Rt.prototype,"check",null),Rt=ft([function(t){new St(t)}],Rt);const $t={"outside-top":["outside-bottom","outside-right","outside-left","outside-bottom"],"outside-bottom":["outside-top","outside-right","outside-left","outside-bottom"],"outside-left":["outside-right","outside-bottom","outside-top","outside-bottom"],"outside-right":["outside-left","outside-bottom","outside-top","outside-bottom"]},Ot={start:["end","center"],end:["start","center"],center:["end","start"]};function It(t,e,n={}){const o=function(t){let e=t.parentNode;for(;null!==e;){if(e instanceof HTMLElement&&"static"!==getComputedStyle(e).position)return e;e=e.parentNode}return document.body}(t),i=function(t){let e=t;for(;null!==e&&e!==document.body;){if("visible"!==getComputedStyle(e).overflow)break;e=e.parentNode}const n=e!==document.body&&e instanceof HTMLElement?e:document.body,o=n.getBoundingClientRect(),i=getComputedStyle(n),[s,r,a,c]=[i.borderTopWidth,i.borderLeftWidth,i.borderRightWidth,i.borderBottomWidth].map((t=>parseInt(t,10)||0));return{top:o.top+s,left:o.left+r,width:o.width-a-r,height:Math.max(o.height-s-c,n===document.body?window.innerHeight:-1/0)}}(o),s=getComputedStyle(o),r=o.getBoundingClientRect(),[a,c]=[s.borderTopWidth,s.borderLeftWidth].map((t=>parseInt(t,10)||0));return function(t,e,n,o,{side:i,align:s,allowOutOfBounds:r,anchorOffset:a,alignmentOffset:c}){const l={top:t.top-e.top,left:t.left-e.left,width:t.width,height:t.height};let u=Yt(n,o,i,s,a,c),d=i,h=s;if(u.top-=e.top,u.left-=e.left,!r){const r=$t[i];let f=0;if(r){let t=i;for(;f<r.length&&Ut(t,u,l,n);){const i=r[f++];t=i,u=Yt(n,o,i,s,a,c),u.top-=e.top,u.left-=e.left,d=i}}const m=Ot[s];let p=0;if(m){let t=s;for(;p<m.length&&Xt(t,u,l,n);){const i=m[p++];t=i,u=Yt(n,o,d,i,a,c),u.top-=e.top,u.left-=e.left,h=i}}u.top<l.top&&(u.top=l.top),u.left<l.left&&(u.left=l.left),u.left+n.width>t.width+l.left&&(u.left=t.width+l.left-n.width),r&&f<r.length&&u.top+n.height>t.height+l.top&&(u.top=t.height+l.top-n.height)}return Object.assign(Object.assign({},u),{anchorSide:d,anchorAlign:h})}(i,{top:r.top+a,left:r.left+c},t.getBoundingClientRect(),e instanceof Element?e.getBoundingClientRect():e,function(t={}){var e,n,o,i,s;const r=null!==(e=t.side)&&void 0!==e?e:Wt,a=null!==(n=t.align)&&void 0!==n?n:qt;return{side:r,align:a,anchorOffset:null!==(o=t.anchorOffset)&&void 0!==o?o:"inside-center"===r?0:Pt,alignmentOffset:null!==(i=t.alignmentOffset)&&void 0!==i?i:"center"!==a&&r.startsWith("inside")?Nt:0,allowOutOfBounds:null!==(s=t.allowOutOfBounds)&&void 0!==s?s:Bt}}(n))}const Wt="outside-bottom",qt="start",Pt=4,Nt=4,Bt=!1;function Yt(t,e,n,o,i,s){const r=e.left+e.width,a=e.top+e.height;let c=-1,l=-1;return"outside-top"===n?c=e.top-i-t.height:"outside-bottom"===n?c=a+i:"outside-left"===n?l=e.left-i-t.width:"outside-right"===n&&(l=r+i),"outside-top"!==n&&"outside-bottom"!==n||(l="start"===o?e.left+s:"center"===o?e.left-(t.width-e.width)/2+s:r-t.width-s),"outside-left"!==n&&"outside-right"!==n||(c="start"===o?e.top+s:"center"===o?e.top-(t.height-e.height)/2+s:a-t.height-s),"inside-top"===n?c=e.top+i:"inside-bottom"===n?c=a-i-t.height:"inside-left"===n?l=e.left+i:"inside-right"===n?l=r-i-t.width:"inside-center"===n&&(l=(r+e.left)/2-t.width/2+i),"inside-top"===n||"inside-bottom"===n?l="start"===o?e.left+s:"center"===o?e.left-(t.width-e.width)/2+s:r-t.width-s:"inside-left"!==n&&"inside-right"!==n&&"inside-center"!==n||(c="start"===o?e.top+s:"center"===o?e.top-(t.height-e.height)/2+s:a-t.height-s),{top:c,left:l}}function Ut(t,e,n,o){return"outside-top"===t||"outside-bottom"===t?e.top<n.top||e.top+o.height>n.height+n.top:e.left<n.left||e.left+o.width>n.width+n.left}function Xt(t,e,n,o){return"end"===t?e.left<n.left:"start"===t||"center"===t?e.left+o.width>n.left+n.width||e.left<n.left:void 0}function Kt(t,e=!1){return function*(t,e={}){var n,o;const i=null!==(n=e.strict)&&void 0!==n&&n,s=null!==(o=e.onlyTabbable)&&void 0!==o&&o?zt:jt,r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>t instanceof HTMLElement&&s(t,i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let a=null;if(!e.reverse&&s(t,i)&&(yield t),e.reverse){let t=r.lastChild();for(;t;)a=t,t=r.lastChild()}else a=r.firstChild();for(;a instanceof HTMLElement;)yield a,a=e.reverse?r.previousNode():r.nextNode();e.reverse&&s(t,i)&&(yield t)}(t,{reverse:e,strict:!0,onlyTabbable:!0}).next().value}function jt(t,e=!1){const n=["BUTTON","INPUT","SELECT","TEXTAREA","OPTGROUP","OPTION","FIELDSET"].includes(t.tagName)&&t.disabled,o=t.hidden,i=t instanceof HTMLInputElement&&"hidden"===t.type,s=t.classList.contains("sentinel");if(n||o||i||s)return!1;if(e){const e=0===t.offsetWidth||0===t.offsetHeight,n=["hidden","collapse"].includes(getComputedStyle(t).visibility),o=0===t.getClientRects().length;if(e||n||o)return!1}return null!=t.getAttribute("tabindex")||!(t instanceof HTMLAnchorElement&&null==t.getAttribute("href"))&&-1!==t.tabIndex}function zt(t,e=!1){return jt(t,e)&&"-1"!==t.getAttribute("tabindex")}let Vt=!1;function Zt(){}try{const t=Object.create({},{signal:{get(){Vt=!0}}});window.addEventListener("test",Zt,t),window.removeEventListener("test",Zt,t)}catch(t){}Vt||(function(){if("undefined"==typeof window)return;const t=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(e,n,o){return"object"==typeof o&&"signal"in o&&o.signal instanceof AbortSignal&&t.call(o.signal,"abort",(()=>{this.removeEventListener(e,n,o)})),t.call(this,e,n,o)}}(),Vt=!0);const _t=[];let Jt;function Gt(t,e,n){const o=new AbortController,i=null!=n?n:o.signal;t.setAttribute("data-focus-trap","active");const s=document.createElement("span");s.setAttribute("class","sentinel"),s.setAttribute("tabindex","0"),s.setAttribute("aria-hidden","true"),s.onfocus=()=>{const e=Kt(t,!0);null==e||e.focus()};const r=document.createElement("span");let a;function c(n){if(n instanceof HTMLElement&&document.contains(t)){if(t.contains(n))return void(a=n);if(a&&zt(a)&&t.contains(a))return void a.focus();if(e&&t.contains(e))return void e.focus();{const e=Kt(t);return void(null==e||e.focus())}}}r.setAttribute("class","sentinel"),r.setAttribute("tabindex","0"),r.setAttribute("aria-hidden","true"),r.onfocus=()=>{const e=Kt(t);null==e||e.focus()},t.prepend(s),t.append(r);const l=function(t){const e=new AbortController;return t.addEventListener("abort",(()=>{e.abort()})),e}(i);if(Jt){const t=Jt;Jt.container.setAttribute("data-focus-trap","suspended"),Jt.controller.abort(),_t.push(t)}l.signal.addEventListener("abort",(()=>{Jt=void 0})),i.addEventListener("abort",(()=>{t.removeAttribute("data-focus-trap");const e=t.getElementsByClassName("sentinel");for(;e.length>0;)e[0].remove();const n=_t.findIndex((e=>e.container===t));n>=0&&_t.splice(n,1),function(){const t=_t.pop();t&&Gt(t.container,t.initialFocus,t.originalSignal)}()})),document.addEventListener("focus",(t=>{c(t.target)}),{signal:l.signal,capture:!0}),c(document.activeElement),Jt={container:t,controller:l,initialFocus:e,originalSignal:i};const u=_t.findIndex((e=>e.container===t));if(u>=0&&_t.splice(u,1),!n)return o}var Qt,te,ee,ne,oe,ie,se;const re=["tooltip-n","tooltip-s","tooltip-e","tooltip-w","tooltip-ne","tooltip-se","tooltip-nw","tooltip-sw"];class ToolTipElement extends HTMLElement{constructor(){super(...arguments),Qt.add(this),te.set(this,void 0),ee.set(this,"center"),ne.set(this,"outside-bottom"),oe.set(this,!1)}styles(){return'\n :host {\n position: absolute;\n z-index: 1000000;\n padding: .5em .75em;\n font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";\n -webkit-font-smoothing: subpixel-antialiased;\n color: var(--color-fg-on-emphasis);\n text-align: center;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: break-word;\n white-space: pre;\n background: var(--color-neutral-emphasis-plus);\n border-radius: 6px;\n opacity: 0;\n max-width: 250px;\n word-wrap: break-word;\n white-space: normal;\n width: max-content;\n }\n\n :host:before{\n position: absolute;\n z-index: 1000001;\n color: var(--color-neutral-emphasis-plus);\n content: "";\n border: 6px solid transparent;\n opacity: 0\n }\n\n @keyframes tooltip-appear {\n from {\n opacity: 0\n }\n to {\n opacity: 1\n }\n }\n\n :host:after{\n position: absolute;\n display: block;\n right: 0;\n left: 0;\n height: 12px;\n content: ""\n }\n\n :host(.tooltip-open),\n :host(.tooltip-open):before {\n animation-name: tooltip-appear;\n animation-duration: .1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: .4s\n }\n\n :host(.tooltip-s):before,\n :host(.tooltip-n):before {\n right: 50%;\n margin-right: -6px;\n }\n\n :host(.tooltip-s):before,\n :host(.tooltip-se):before,\n :host(.tooltip-sw):before {\n bottom: 100%;\n border-bottom-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-s):after,\n :host(.tooltip-se):after,\n :host(.tooltip-sw):after {\n bottom: 100%\n }\n\n :host(.tooltip-n):before,\n :host(.tooltip-ne):before,\n :host(.tooltip-nw):before {\n top: 100%;\n border-top-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-n):after,\n :host(.tooltip-ne):after,\n :host(.tooltip-nw):after {\n top: 100%\n }\n\n :host(.tooltip-se):before,\n :host(.tooltip-ne):before {\n left: 0;\n margin-left: 6px;\n }\n\n :host(.tooltip-sw):before,\n :host(.tooltip-nw):before {\n right: 0;\n margin-right: 6px;\n }\n\n :host(.tooltip-w):before {\n top: 50%;\n bottom: 50%;\n left: 100%;\n margin-top: -6px;\n border-left-color: var(--color-neutral-emphasis-plus)\n }\n\n :host(.tooltip-e):before {\n top: 50%;\n right: 100%;\n bottom: 50%;\n margin-top: -6px;\n border-right-color: var(--color-neutral-emphasis-plus)\n }\n '}get htmlFor(){return this.getAttribute("for")||""}set htmlFor(t){this.setAttribute("for",t)}get type(){return"label"===this.getAttribute("data-type")?"label":"description"}set type(t){this.setAttribute("data-type",t)}get direction(){return this.getAttribute("data-direction")||"s"}set direction(t){this.setAttribute("data-direction",t)}get control(){return this.ownerDocument.getElementById(this.htmlFor)}set hiddenFromView(t){this.classList.toggle("sr-only",t),this.isConnected&&mt(this,Qt,"m",ie).call(this)}get hiddenFromView(){return this.classList.contains("sr-only")}connectedCallback(){var t;if(!this.shadowRoot){this.attachShadow({mode:"open"}).innerHTML=`\n <style>\n ${this.styles()}\n </style>\n <slot></slot>\n `}if(this.hiddenFromView=!0,pt(this,oe,!0,"f"),this.id||(this.id=`tooltip-${Date.now()}-${(1e4*Math.random()).toFixed(0)}`),!this.control)return;this.setAttribute("role","tooltip"),null===(t=mt(this,te,"f"))||void 0===t||t.abort(),pt(this,te,new AbortController,"f");const{signal:e}=mt(this,te,"f");this.addEventListener("mouseleave",this,{signal:e}),this.control.addEventListener("mouseenter",this,{signal:e}),this.control.addEventListener("mouseleave",this,{signal:e}),this.control.addEventListener("focus",this,{signal:e}),this.control.addEventListener("blur",this,{signal:e}),this.ownerDocument.addEventListener("keydown",this,{signal:e}),mt(this,Qt,"m",ie).call(this)}disconnectedCallback(){var t;null===(t=mt(this,te,"f"))||void 0===t||t.abort()}handleEvent(t){this.control&&("mouseenter"!==t.type&&"focus"!==t.type||!this.hiddenFromView?"blur"===t.type||"mouseleave"===t.type&&t.relatedTarget!==this.control&&t.relatedTarget!==this?this.hiddenFromView=!0:"keydown"!==t.type||"Escape"!==t.key||this.hiddenFromView||(this.hiddenFromView=!0):this.hiddenFromView=!1)}attributeChangedCallback(t){if("id"===t||"data-type"===t){if(!this.id||!this.control)return;if("label"===this.type){let t=this.control.getAttribute("aria-labelledby");t=t?`${t} ${this.id}`:this.id,this.control.setAttribute("aria-labelledby",t),this.setAttribute("aria-hidden","true")}else{let t=this.control.getAttribute("aria-describedby");t=t?`${t} ${this.id}`:this.id,this.control.setAttribute("aria-describedby",t)}}else if("data-direction"===t){this.classList.remove(...re);const t=this.direction;"n"===t?(pt(this,ee,"center","f"),pt(this,ne,"outside-top","f")):"ne"===t?(pt(this,ee,"start","f"),pt(this,ne,"outside-top","f")):"e"===t?(pt(this,ee,"center","f"),pt(this,ne,"outside-right","f")):"se"===t?(pt(this,ee,"start","f"),pt(this,ne,"outside-bottom","f")):"s"===t?(pt(this,ee,"center","f"),pt(this,ne,"outside-bottom","f")):"sw"===t?(pt(this,ee,"end","f"),pt(this,ne,"outside-bottom","f")):"w"===t?(pt(this,ee,"center","f"),pt(this,ne,"outside-left","f")):"nw"===t&&(pt(this,ee,"end","f"),pt(this,ne,"outside-top","f"))}}}var ae,ce,le,ue,de,he,fe;function me(t){document.activeElement!==t&&(null==t||t.focus())}te=new WeakMap,ee=new WeakMap,ne=new WeakMap,oe=new WeakMap,Qt=new WeakSet,ie=function(){if(this.hiddenFromView)this.classList.remove("tooltip-open",...re);else{this.classList.add("tooltip-open");for(const t of this.ownerDocument.querySelectorAll(this.tagName))t!==this&&(t.hiddenFromView=!0);mt(this,Qt,"m",se).call(this)}},se=function(){if(!this.control)return;if(!mt(this,oe,"f")||this.hiddenFromView)return;this.style.left="0px";const t=It(this,this.control,{side:mt(this,ne,"f"),align:mt(this,ee,"f"),anchorOffset:10}),e=t.anchorSide,n=t.anchorAlign;this.style.top=`${t.top}px`,this.style.left=`${t.left}px`;let o="s";o="outside-left"===e?"w":"outside-right"===e?"e":"outside-top"===e?"center"===n?"n":"start"===n?"ne":"nw":"center"===n?"s":"start"===n?"se":"sw",this.classList.add(`tooltip-${o}`)},ToolTipElement.observedAttributes=["data-type","data-direction","id"],window.customElements.get("tool-tip")||(window.ToolTipElement=ToolTipElement,window.customElements.define("tool-tip",ToolTipElement));class ModalDialogElement extends HTMLElement{constructor(){super(...arguments),ae.add(this),ce.set(this,new AbortController),le.set(this,null),ue.set(this,void 0),de.set(this,!0)}get open(){return this.hasAttribute("open")}set open(t){var e,n,o,i;if(t){if(this.open)return;this.setAttribute("open",""),null===(e=mt(this,ae,"a",he))||void 0===e||e.classList.remove("Overlay--hidden"),document.body.style.overflow="hidden",mt(this,ce,"f").signal.aborted&&pt(this,ce,new AbortController,"f"),Gt(this,void 0,mt(this,ce,"f").signal)}else{if(!this.open)return;this.removeAttribute("open"),null===(n=mt(this,ae,"a",he))||void 0===n||n.classList.add("Overlay--hidden"),document.body.style.overflow="initial",mt(this,ce,"f").abort();const t=(null===(o=mt(this,ue,"f"))||void 0===o?void 0:o.closest("details"))||(null===(i=mt(this,ue,"f"))||void 0===i?void 0:i.closest("action-menu"));me(t?Kt(t):mt(this,ue,"f")),pt(this,ue,void 0,"f")}}get showButtons(){return document.querySelectorAll(`button[data-show-dialog-id='${this.id}']`)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog");const{signal:t}=pt(this,le,new AbortController,"f");this.ownerDocument.addEventListener("click",(t=>{const e=t.target,n=e.closest(this.tagName)!==this,o=null==e?void 0:e.closest("button");if(!o)return void(n&&this.close());let i=o.getAttribute("data-close-dialog-id");i===this.id&&this.close(),i=o.getAttribute("data-submit-dialog-id"),i===this.id&&this.close(!0),i=o.getAttribute("data-show-dialog-id"),i===this.id&&(t.stopPropagation(),pt(this,ue,o,"f"),this.show())}),{signal:t}),this.addEventListener("keydown",(t=>mt(this,ae,"m",fe).call(this,t)))}disconnectedCallback(){var t;null===(t=mt(this,le,"f"))||void 0===t||t.abort()}show(){this.open=!0}close(t=!1){if(!1===this.open)return;const e=new Event(t?"close":"cancel");this.dispatchEvent(e),this.open=!1}}ce=new WeakMap,le=new WeakMap,ue=new WeakMap,de=new WeakMap,ae=new WeakSet,he=function(){var t;return(null===(t=this.parentElement)||void 0===t?void 0:t.hasAttribute("data-modal-dialog-overlay"))?this.parentElement:null},fe=function(t){if(t instanceof KeyboardEvent&&!t.isComposing)switch(t.key){case"Escape":this.open&&(this.close(),t.preventDefault(),t.stopPropagation())}},window.customElements.get("modal-dialog")||(window.ModalDialogElement=ModalDialogElement,window.customElements.define("modal-dialog",ModalDialogElement));
2
2
  //# sourceMappingURL=primer_view_components.js.map