UNPKG

@openproject/primer-view-components

Version:

ViewComponents of the Primer Design System for OpenProject

1 lines • 202 kB
!function(){"use strict";var t,e,i,n,s,o,r,a,l=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},c=function(t,e,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i};const d=new WeakMap;let h=null;class IncludeFragmentElement extends HTMLElement{constructor(){super(...arguments),t.add(this),e.set(this,!1),i.set(this,new IntersectionObserver((e=>{for(const s of e)if(s.isIntersecting){const{target:e}=s;if(l(this,i,"f").unobserve(e),!(e instanceof IncludeFragmentElement))return;"lazy"===e.loading&&l(this,t,"m",n).call(this)}}),{rootMargin:"0px 0px 256px 0px",threshold:.01}))}static define(t="include-fragment",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){h=null===t?t:Promise.resolve(t)}static get observedAttributes(){return["src","loading"]}get src(){const t=this.getAttribute("src");if(t){const e=this.ownerDocument.createElement("a");return e.href=t,e.href}return""}set src(t){this.setAttribute("src",t)}get loading(){return"lazy"===this.getAttribute("loading")?"lazy":"eager"}set loading(t){this.setAttribute("loading",t)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}get data(){return l(this,t,"m",o).call(this)}attributeChangedCallback(e,i){"src"===e?this.isConnected&&"eager"===this.loading&&l(this,t,"m",n).call(this):"loading"===e&&this.isConnected&&"eager"!==i&&"eager"===this.loading&&l(this,t,"m",n).call(this)}connectedCallback(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=":host {display: block;}",this.shadowRoot.append(t,document.createElement("slot"))}this.src&&"eager"===this.loading&&l(this,t,"m",n).call(this),"lazy"===this.loading&&l(this,i,"f").observe(this)}request(){const t=this.src;if(!t)throw new Error("missing src");return new Request(t,{method:"GET",credentials:"same-origin",headers:{Accept:this.accept||"text/html"}})}load(){return l(this,t,"m",o).call(this)}fetch(t){return fetch(t)}refetch(){d.delete(this),l(this,t,"m",n).call(this)}}e=new WeakMap,i=new WeakMap,t=new WeakSet,n=async function(){if(!l(this,e,"f")){c(this,e,!0,"f"),l(this,i,"f").unobserve(this);try{const i=await l(this,t,"m",s).call(this);if(i instanceof Error)throw i;const n=i,o=document.createElement("template");o.innerHTML=n;const r=document.importNode(o.content,!0);if(!this.dispatchEvent(new CustomEvent("include-fragment-replace",{cancelable:!0,detail:{fragment:r}})))return void c(this,e,!1,"f");this.replaceWith(r),this.dispatchEvent(new CustomEvent("include-fragment-replaced"))}catch(t){this.classList.add("is-error")}finally{c(this,e,!1,"f")}}},s=async function(){const e=this.src,i=d.get(this);if(i&&i.src===e)return i.data;{let i;return i=e?l(this,t,"m",a).call(this):Promise.reject(new Error("missing src")),d.set(this,{src:e,data:i}),i}},o=async function(){const e=await l(this,t,"m",s).call(this);if(e instanceof Error)throw e;return e.toString()},r=async function(t,e){await new Promise((t=>setTimeout(t,0)));for(const i of t)this.dispatchEvent(e?new CustomEvent(i,{detail:{error:e}}):new Event(i))},a=async function(){try{await l(this,t,"m",r).call(this,["loadstart"]);const i=await this.fetch(this.request()),n=i.headers.get("Content-Type");if(!(e=this.accept,e&&e.split(",").find((t=>t.match(/^\s*\*\/\*/)))||n&&n.includes(this.accept?this.accept:"text/html")))throw new Error(`Failed to load resource: expected ${this.accept||"text/html"} but was ${n}`);if(200!==i.status)throw new Error(`Failed to load resource: the server responded with a status of ${i.status}`);const s=await i.text();let o=s;if(h){o=(await h).createHTML(s,i)}return l(this,t,"m",r).call(this,["load","loadend"]),o}catch(e){throw l(this,t,"m",r).call(this,["error","loadend"],e),e}var e};const u="undefined"!=typeof globalThis?globalThis:window;try{u.IncludeFragmentElement=IncludeFragmentElement.define()}catch(t){if(!(u.DOMException&&t instanceof DOMException&&"NotSupportedError"===t.name||t instanceof ReferenceError))throw t}const m=new WeakMap;class RemoteInputElement extends HTMLElement{constructor(){super();const t=f.bind(null,this,!0),e={currentQuery:null,oninput:p((e=>t(e))),fetch:t,controller:null};m.set(this,e)}static get observedAttributes(){return["src"]}attributeChangedCallback(t,e){e&&"src"===t&&f(this,!1)}connectedCallback(){const t=this.input;if(!t)return;t.setAttribute("autocomplete","off"),t.setAttribute("spellcheck","false");const e=m.get(this);e&&(t.addEventListener("focus",e.fetch),t.addEventListener("change",e.fetch),t.addEventListener("input",e.oninput))}disconnectedCallback(){const t=this.input;if(!t)return;const e=m.get(this);e&&(t.removeEventListener("focus",e.fetch),t.removeEventListener("change",e.fetch),t.removeEventListener("input",e.oninput))}get input(){const t=this.querySelector("input, textarea");return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}}async function f(t,e,i){const n=t.input;if(!n)return;const s=m.get(t);if(!s)return;const o=n.value;if(e&&s.currentQuery===o)return;s.currentQuery=o;const r=t.src;if(!r)return;const a=document.getElementById(t.getAttribute("aria-owns")||"");if(!a)return;const l=new URL(r,window.location.href),c=new URLSearchParams(l.search);let d;c.append(t.getAttribute("param")||"q",o),l.search=c.toString(),s.controller?s.controller.abort():(t.dispatchEvent(new CustomEvent("loadstart")),t.setAttribute("loading","")),s.controller="AbortController"in window?new AbortController:{signal:null,abort(){}};let h="";try{d=await async function(t,e,i){try{const n=await fetch(e,i);return t.dispatchEvent(new CustomEvent("load")),t.dispatchEvent(new CustomEvent("loadend")),n}catch(e){throw e instanceof Error&&"AbortError"!==(null==e?void 0:e.name)&&(t.dispatchEvent(new CustomEvent("error")),t.dispatchEvent(new CustomEvent("loadend"))),e}}(t,l.toString(),{signal:s.controller.signal,credentials:"same-origin",headers:{accept:"text/fragment+html"}}),h=await d.text(),t.removeAttribute("loading"),s.controller=null}catch(e){return void(e instanceof Error&&"AbortError"!==e.name&&(t.removeAttribute("loading"),s.controller=null))}d&&d.ok?(a.innerHTML=h,t.dispatchEvent(new CustomEvent("remote-input-success",{bubbles:!0,detail:{eventType:i?i.type:void 0}}))):t.dispatchEvent(new CustomEvent("remote-input-error",{bubbles:!0}))}function p(t){let e;return function(i){clearTimeout(e),e=setTimeout((()=>{clearTimeout(e),t(i)}),300)}}function g(t,e,i,n){var s,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,i,r):s(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function b(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function v(t,e,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i}window.customElements.get("remote-input")||(window.RemoteInputElement=RemoteInputElement,window.customElements.define("remote-input",RemoteInputElement)),"function"==typeof SuppressedError&&SuppressedError;const w=new WeakSet;function y(t){k(t),A(t)}const E=new WeakMap;function A(t=document){if(E.has(t))return E.get(t);let e=!1;const i=new MutationObserver((t=>{for(const e of t)if("attributes"===e.type&&e.target instanceof Element)S(e.target);else if("childList"===e.type&&e.addedNodes.length)for(const t of e.addedNodes)t instanceof Element&&k(t)}));i.observe(t,{childList:!0,subtree:!0,attributeFilter:["data-action"]});const n={get closed(){return e},unsubscribe(){e=!0,E.delete(t),i.disconnect()}};return E.set(t,n),n}function k(t){for(const e of t.querySelectorAll("[data-action]"))S(e);t instanceof Element&&t.hasAttribute("data-action")&&S(t)}function L(t){const e=t.currentTarget;for(const i of T(e))if(t.type===i.type){const n=e.closest(i.tag);w.has(n)&&"function"==typeof n[i.method]&&n[i.method](t);const s=e.getRootNode();if(s instanceof ShadowRoot&&w.has(s.host)&&s.host.matches(i.tag)){const e=s.host;"function"==typeof e[i.method]&&e[i.method](t)}}}function*T(t){for(const e of(t.getAttribute("data-action")||"").trim().split(/\s+/)){const t=e.lastIndexOf(":"),i=Math.max(0,e.lastIndexOf("#"))||e.length;yield{type:e.slice(0,t),tag:e.slice(t+1,i),method:e.slice(i+1)||"handleEvent"}||"handleEvent"}}function S(t){for(const e of T(t))t.addEventListener(e.type,L)}const C=t=>String("symbol"==typeof t?t.description:t).replace(/([A-Z]($|[a-z]))/g,"-$1").replace(/--/g,"-").replace(/^-|-$/,"").toLowerCase(),x=(t,e="property")=>{const i=C(t);if(!i.includes("-"))throw new DOMException(`${e}: ${String(t)} is not a valid ${e} name`,"SyntaxError");return i};const M="attr";function I(t,e){$(t,M).add(e)}const D=new WeakSet;function P(t,e){if(D.has(t))return;D.add(t);const i=Object.getPrototypeOf(t),n=i?.constructor?.attrPrefix??"data-";e||(e=$(i,M));for(const i of e){const e=t[i],s=x(`${n}${i}`);let o={configurable:!0,get(){return this.getAttribute(s)||""},set(t){this.setAttribute(s,t||"")}};"number"==typeof e?o={configurable:!0,get(){return Number(this.getAttribute(s)||0)},set(t){this.setAttribute(s,t)}}:"boolean"==typeof e&&(o={configurable:!0,get(){return this.hasAttribute(s)},set(t){this.toggleAttribute(s,t)}}),Object.defineProperty(t,i,o),i in t&&!t.hasAttribute(s)&&o.set.call(t,e)}}const N=new Map,H=new Promise((t=>{"loading"!==document.readyState?t():document.addEventListener("readystatechange",(()=>t()),{once:!0})})),F=new Promise((t=>{const e=new AbortController;e.signal.addEventListener("abort",(()=>t()));const i={once:!0,passive:!0,signal:e.signal},n=()=>e.abort();document.addEventListener("mousedown",n,i),document.addEventListener("touchstart",n,i),document.addEventListener("keydown",n,i),document.addEventListener("pointerdown",n,i)})),O={ready:()=>H,firstInteraction:()=>F,visible:t=>new Promise((e=>{const i=new IntersectionObserver((t=>{for(const n of t)if(n.isIntersecting)return e(),void i.disconnect()}),{rootMargin:"0px 0px 256px 0px",threshold:.01});for(const e of document.querySelectorAll(t))i.observe(e)}))},q=new WeakMap;function V(t){cancelAnimationFrame(q.get(t)||0),q.set(t,requestAnimationFrame((()=>{for(const e of N.keys()){const i=t instanceof Element&&t.matches(e)?t:t.querySelector(e);if(customElements.get(e)||i){const n=i?.getAttribute("data-load-on")||"ready",s=n in O?O[n]:O.ready;for(const t of N.get(e)||[])s(e).then(t);N.delete(e),q.delete(t)}}})))}let R;const W=Symbol.for("catalyst");class B{constructor(t,e){const i=this,n=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){i.connectedCallback(this,n)};const s=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){i.disconnectedCallback(this,s)};const o=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,e,n){i.attributeChangedCallback(this,t,e,n,o)};let r=t.observedAttributes||[];Object.defineProperty(t,"observedAttributes",{configurable:!0,get(){return i.observedAttributes(this,r)},set(t){r=t}}),function(t){let e=t.observedAttributes||[];const i=t.attrPrefix??"data-",n=t=>x(`${i}${t}`);Object.defineProperty(t,"observedAttributes",{configurable:!0,get:()=>[...$(t.prototype,M)].map(n).concat(e),set(t){e=t}})}(t),function(t,e){const i=e||C(t.name).replace(/-element$/,"");try{window.customElements.define(i,t),window[t.name]=customElements.get(i)}catch(t){if(!(t instanceof DOMException&&"NotSupportedError"===t.name))throw t}}(t,e)}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),P(t),function(t){w.add(t),t.shadowRoot&&y(t.shadowRoot),k(t),A(t.ownerDocument)}(t),e?.call(t),t.shadowRoot&&(y(t.shadowRoot),function(t){R||(R=new MutationObserver((t=>{if(N.size)for(const e of t)for(const t of e.addedNodes)t instanceof Element&&V(t)}))),V(t),R.observe(t,{subtree:!0,childList:!0})}(t.shadowRoot))}disconnectedCallback(t,e){e?.call(t)}attributeChangedCallback(t,e,i,n,s){P(t),"data-catalyst"!==e&&s&&s.call(t,e,i,n)}}function $(t,e){if(!Object.prototype.hasOwnProperty.call(t,W)){const e=t[W],i=t[W]=new Map;if(e)for(const[t,n]of e)i.set(t,new Set(n))}const i=t[W];return i.has(e)||i.set(e,new Set),i.get(e)}function U(t,e){$(t,"target").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const i=t.tagName.toLowerCase();if(t.shadowRoot)for(const n of t.shadowRoot.querySelectorAll(`[data-target~="${i}.${e}"]`))if(!n.closest(i))return n;for(const n of t.querySelectorAll(`[data-target~="${i}.${e}"]`))if(n.closest(i)===t)return n}(this,e)}})}function K(t,e){$(t,"targets").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const i=t.tagName.toLowerCase(),n=[];if(t.shadowRoot)for(const s of t.shadowRoot.querySelectorAll(`[data-targets~="${i}.${e}"]`))s.closest(i)||n.push(s);for(const s of t.querySelectorAll(`[data-targets~="${i}.${e}"]`))s.closest(i)===t&&n.push(s);return n}(this,e)}})}function j(t){if("string"==typeof t)return e=>{new B(e,t)};new B(t)}var z;class _{constructor(t){this.resizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.target;t instanceof HTMLElement&&this.update(t)}})),this.resizeObserver.observe(t)}unobserve(t){this.resizeObserver.unobserve(t)}update(t){const e=t.querySelectorAll("li");for(const t of e){const e=t.querySelector(".ActionListItem-label");if(!e)continue;const i=t.querySelector(".ActionListItem-truncationTooltip");if(!i)continue;const n=e.scrollWidth>e.clientWidth;i.style.display=n?"":"none"}}}let Z=class ActionListElement extends HTMLElement{constructor(){super(...arguments),z.set(this,void 0)}connectedCallback(){v(this,z,new _(this),"f")}disconnectedCallback(){b(this,z,"f").unobserve(this)}};z=new WeakMap,Z=g([j("action-list")],Z);const Y={"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"]},G={start:["end","center"],end:["start","center"],center:["end","start"]};function J(t,e,i={}){const n=function(t){if(function(t){var e;if("DIALOG"===t.tagName)return!0;try{if(t.matches(":popover-open")&&/native code/.test(null===(e=document.body.showPopover)||void 0===e?void 0:e.toString()))return!0}catch(t){return!1}return!1}(t))return document.body;let e=t.parentNode;for(;null!==e;){if(e instanceof HTMLElement&&"static"!==getComputedStyle(e).position)return e;e=e.parentNode}return document.body}(t),s=function(t){let e=t;for(;null!==e&&e instanceof Element;){if("visible"!==getComputedStyle(e).overflow)break;e=e.parentNode}const i=e!==document.body&&e instanceof HTMLElement?e:document.body,n=i.getBoundingClientRect(),s=getComputedStyle(i),[o,r,a,l]=[s.borderTopWidth,s.borderLeftWidth,s.borderRightWidth,s.borderBottomWidth].map((t=>parseInt(t,10)||0));return{top:n.top+o,left:n.left+r,width:n.width-a-r,height:Math.max(n.height-o-l,i===document.body?window.innerHeight:-1/0)}}(n),o=getComputedStyle(n),r=n.getBoundingClientRect(),[a,l]=[o.borderTopWidth,o.borderLeftWidth].map((t=>parseInt(t,10)||0));return function(t,e,i,n,{side:s,align:o,allowOutOfBounds:r,anchorOffset:a,alignmentOffset:l}){const c={top:t.top-e.top,left:t.left-e.left,width:t.width,height:t.height};let d=Q(i,n,s,o,a,l),h=s,u=o;if(d.top-=e.top,d.left-=e.left,!r){const r=Y[s];let m=0;if(r){let t=s;for(;m<r.length&&tt(t,d,c,i);){const s=r[m++];t=s,d=Q(i,n,s,o,a,l),d.top-=e.top,d.left-=e.left,h=s}}const f=G[o];let p=0;if(f){let t=o;for(;p<f.length&&et(t,d,c,i);){const s=f[p++];t=s,d=Q(i,n,h,s,a,l),d.top-=e.top,d.left-=e.left,u=s}}d.top<c.top&&(d.top=c.top),d.left<c.left&&(d.left=c.left),d.left+i.width>t.width+c.left&&(d.left=t.width+c.left-i.width),r&&m<r.length&&d.top+i.height>t.height+c.top&&(d.top=Math.max(t.height+c.top-i.height,0))}return Object.assign(Object.assign({},d),{anchorSide:h,anchorAlign:u})}(s,{top:r.top+a,left:r.left+l},t.getBoundingClientRect(),e instanceof Element?e.getBoundingClientRect():e,function(t={}){var e,i,n,s,o;const r=null!==(e=t.side)&&void 0!==e?e:X.side,a=null!==(i=t.align)&&void 0!==i?i:X.align;return{side:r,align:a,anchorOffset:null!==(n=t.anchorOffset)&&void 0!==n?n:"inside-center"===r?0:X.anchorOffset,alignmentOffset:null!==(s=t.alignmentOffset)&&void 0!==s?s:"center"!==a&&r.startsWith("inside")?X.alignmentOffset:0,allowOutOfBounds:null!==(o=t.allowOutOfBounds)&&void 0!==o?o:X.allowOutOfBounds}}(i))}const X={side:"outside-bottom",align:"start",anchorOffset:4,alignmentOffset:4,allowOutOfBounds:!1};function Q(t,e,i,n,s,o){const r=e.left+e.width,a=e.top+e.height;let l=-1,c=-1;return"outside-top"===i?l=e.top-s-t.height:"outside-bottom"===i?l=a+s:"outside-left"===i?c=e.left-s-t.width:"outside-right"===i&&(c=r+s),"outside-top"!==i&&"outside-bottom"!==i||(c="start"===n?e.left+o:"center"===n?e.left-(t.width-e.width)/2+o:r-t.width-o),"outside-left"!==i&&"outside-right"!==i||(l="start"===n?e.top+o:"center"===n?e.top-(t.height-e.height)/2+o:a-t.height-o),"inside-top"===i?l=e.top+s:"inside-bottom"===i?l=a-s-t.height:"inside-left"===i?c=e.left+s:"inside-right"===i?c=r-s-t.width:"inside-center"===i&&(c=(r+e.left)/2-t.width/2+s),"inside-top"===i||"inside-bottom"===i?c="start"===n?e.left+o:"center"===n?e.left-(t.width-e.width)/2+o:r-t.width-o:"inside-left"!==i&&"inside-right"!==i&&"inside-center"!==i||(l="start"===n?e.top+o:"center"===n?e.top-(t.height-e.height)/2+o:a-t.height-o),{top:l,left:c}}function tt(t,e,i,n){return"outside-top"===t||"outside-bottom"===t?e.top<i.top||e.top+n.height>i.height+i.top:e.left<i.left||e.left+n.width>i.width+i.left}function et(t,e,i,n){return"end"===t?e.left<i.left:"start"===t||"center"===t?e.left+n.width>i.left+i.width||e.left<i.left:void 0}function*it(t,e={}){var i,n;const s=null!==(i=e.strict)&&void 0!==i&&i,o=null!==(n=e.onlyTabbable)&&void 0!==n&&n?ot:st,r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>t instanceof HTMLElement&&o(t,s)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let a=null;if(!e.reverse&&o(t,s)&&(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&&o(t,s)&&(yield t)}function nt(t,e=!1){return it(t,{reverse:e,strict:!0,onlyTabbable:!0}).next().value}function st(t,e=!1){const i=["BUTTON","INPUT","SELECT","TEXTAREA","OPTGROUP","OPTION","FIELDSET"].includes(t.tagName)&&t.disabled,n=t.hidden,s=t instanceof HTMLInputElement&&"hidden"===t.type,o=t.classList.contains("sentinel");if(i||n||s||o)return!1;if(e){const e=getComputedStyle(t),i=0===t.offsetWidth||0===t.offsetHeight,n=["hidden","collapse"].includes(e.visibility),s="none"===e.display||!t.offsetParent,o=0===t.getClientRects().length;if(i||n||o||s)return!1}return null!=t.getAttribute("tabindex")||("true"===t.getAttribute("contenteditable")||"plaintext-only"===t.getAttribute("contenteditable")||!(t instanceof HTMLAnchorElement&&null==t.getAttribute("href"))&&-1!==t.tabIndex)}function ot(t,e=!1){return st(t,e)&&"-1"!==t.getAttribute("tabindex")}let rt=!1;function at(){}try{const t=Object.create({},{signal:{get(){rt=!0}}});window.addEventListener("test",at,t),window.removeEventListener("test",at,t)}catch(t){}function lt(){rt||(!function(){if("undefined"==typeof window)return;const t=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(e,i,n){return"object"==typeof n&&"signal"in n&&n.signal instanceof AbortSignal&&t.call(n.signal,"abort",(()=>{this.removeEventListener(e,i,n)})),t.call(this,e,i,n)}}(),rt=!0)}lt();const ct=[];let dt,ht;function ut(t,e,i){const n=new AbortController,s=null!=i?i:n.signal;t.setAttribute("data-focus-trap","active");const o=document.createElement("span");o.setAttribute("class","sentinel"),o.setAttribute("tabindex","0"),o.setAttribute("aria-hidden","true"),o.onfocus=()=>{const e=nt(t,!0);null==e||e.focus()};const r=document.createElement("span");r.setAttribute("class","sentinel"),r.setAttribute("tabindex","0"),r.setAttribute("aria-hidden","true"),r.onfocus=()=>{const e=nt(t);null==e||e.focus()};Array.from(t.children).filter((t=>t.classList.contains("sentinel")&&"SPAN"===t.tagName)).length||(t.prepend(o),t.append(r));const a=function(t,e){const i=new MutationObserver((i=>{for(const n of i)if("childList"===n.type&&n.addedNodes.length){if(Array.from(n.addedNodes).filter((t=>t instanceof HTMLElement&&t.classList.contains("sentinel")&&"SPAN"===t.tagName)).length)return;const i=t.firstElementChild,s=t.lastElementChild,[o,r]=e;(null==i?void 0:i.classList.contains("sentinel"))||t.insertAdjacentElement("afterbegin",o),(null==s?void 0:s.classList.contains("sentinel"))||t.insertAdjacentElement("beforeend",r)}}));return i.observe(t,{childList:!0}),i}(t,[o,r]);let l;function c(i){if(i instanceof HTMLElement&&document.contains(t)){if(t.contains(i))return void(l=i);if(l&&ot(l)&&t.contains(l))return void l.focus();if(e&&t.contains(e))return void e.focus();{const e=nt(t);return void(null==e||e.focus())}}}const d=function(t){const e=new AbortController;return t.addEventListener("abort",(()=>{e.abort()})),e}(s);if(dt){const t=dt;dt.container.setAttribute("data-focus-trap","suspended"),dt.controller.abort(),ct.push(t)}d.signal.addEventListener("abort",(()=>{dt=void 0})),s.addEventListener("abort",(()=>{t.removeAttribute("data-focus-trap");const e=t.getElementsByClassName("sentinel");for(;e.length>0;)e[0].remove();const i=ct.findIndex((e=>e.container===t));i>=0&&ct.splice(i,1),a.disconnect(),function(){const t=ct.pop();t&&ut(t.container,t.initialFocus,t.originalSignal)}()})),document.addEventListener("focus",(t=>{c(t.target)}),{signal:d.signal,capture:!0}),c(document.activeElement),dt={container:t,controller:d,initialFocus:e,originalSignal:s};const h=ct.findIndex((e=>e.container===t));if(h>=0&&ct.splice(h,1),!i)return n}function mt(){return void 0===ht&&(ht=/^mac/i.test(window.navigator.platform)),ht}let ft=1e4;const pt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);var gt;lt(),function(t){t[t.ArrowHorizontal=1]="ArrowHorizontal",t[t.ArrowVertical=2]="ArrowVertical",t[t.JK=4]="JK",t[t.HL=8]="HL",t[t.HomeAndEnd=16]="HomeAndEnd",t[t.PageUpDown=256]="PageUpDown",t[t.WS=32]="WS",t[t.AD=64]="AD",t[t.Tab=128]="Tab",t[t.Backspace=512]="Backspace",t[t.ArrowAll=3]="ArrowAll",t[t.HJKL=12]="HJKL",t[t.WASD=96]="WASD",t[t.All=511]="All"}(gt||(gt={}));const bt={ArrowLeft:gt.ArrowHorizontal,ArrowDown:gt.ArrowVertical,ArrowUp:gt.ArrowVertical,ArrowRight:gt.ArrowHorizontal,h:gt.HL,j:gt.JK,k:gt.JK,l:gt.HL,a:gt.AD,s:gt.WS,w:gt.WS,d:gt.AD,Tab:gt.Tab,Home:gt.HomeAndEnd,End:gt.HomeAndEnd,PageUp:gt.PageUpDown,PageDown:gt.PageUpDown,Backspace:gt.Backspace},vt={ArrowLeft:"previous",ArrowDown:"next",ArrowUp:"previous",ArrowRight:"next",h:"previous",j:"next",k:"previous",l:"next",a:"previous",s:"next",w:"previous",d:"next",Tab:"next",Home:"start",End:"end",PageUp:"start",PageDown:"end",Backspace:"previous"};function wt(t){const e=vt[t.key];if("Tab"===t.key&&t.shiftKey)return"previous";const i=mt();if(i&&t.metaKey||!i&&t.ctrlKey){if("ArrowLeft"===t.key||"ArrowUp"===t.key)return"start";if("ArrowRight"===t.key||"ArrowDown"===t.key)return"end"}return e}function yt(t,e){const i=t.key,n=[...i].length,s=function(t){var e,i;if(!(t instanceof HTMLElement))return!1;const n=t.nodeName.toLowerCase(),s=null!==(i=null===(e=t.getAttribute("type"))||void 0===e?void 0:e.toLowerCase())&&void 0!==i?i:"text",o="true"===t.ariaReadOnly||"true"===t.getAttribute("aria-readonly")||null!==t.getAttribute("readonly");return("select"===n||"textarea"===n||"input"===n&&!pt.has(s)||t.isContentEditable)&&!o}(e),o=e instanceof HTMLSelectElement;if(s&&(1===n||"Home"===i||"End"===i))return!0;if(o)return!("ArrowDown"!==i||!mt()||t.metaKey)||!("ArrowDown"!==i||mt()||!t.altKey);if(s&&!o){const t=e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement,n=t&&0===e.selectionStart&&0===e.selectionEnd,s=t&&e.selectionStart===e.value.length&&e.selectionEnd===e.value.length;if("ArrowLeft"===i&&!n)return!0;if("ArrowRight"===i&&!s)return!0;const o=e instanceof HTMLElement&&e.isContentEditable;if(e instanceof HTMLTextAreaElement||o){if("PageUp"===i||"PageDown"===i)return!0;if("ArrowUp"===i&&!n)return!0;if("ArrowDown"===i&&!s)return!0}}return!1}const Et="data-is-active-descendant",At="activated-directly",kt="activated-indirectly",Lt="data-has-active-descendant";function Tt(t,e){var i,n,s,o,r,a;const l=[],c=new WeakMap,d=null!==(i=null==e?void 0:e.bindKeys)&&void 0!==i?i:((null==e?void 0:e.getNextFocusable)?gt.ArrowAll:gt.ArrowVertical)|gt.HomeAndEnd,h=null!==(n=null==e?void 0:e.focusOutBehavior)&&void 0!==n?n:"stop",u=null!==(s=null==e?void 0:e.focusInStrategy)&&void 0!==s?s:"previous",m=null==e?void 0:e.activeDescendantControl,f=null==e?void 0:e.onActiveDescendantChanged,p=null!==(o=null==e?void 0:e.ignoreHoverEvents)&&void 0!==o&&o;let g;const b=null!==(r=null==e?void 0:e.preventScroll)&&void 0!==r&&r,v="initial"===u&&(null==e?void 0:e.activeDescendantControl);function w(){return l[0]}function y(t,e=!1){const i=g;g=t,m?t&&document.activeElement===m?E(i,t,e):A():(i&&i!==t&&c.has(i)&&i.setAttribute("tabindex","-1"),null==t||t.setAttribute("tabindex","0"))}function E(e,i,n=!1){i.id||i.setAttribute("id","__primer_id_"+ft++),e&&e!==i&&e.removeAttribute(Et),m&&(n||m.getAttribute("aria-activedescendant")!==i.id)&&(m.setAttribute("aria-activedescendant",i.id),t.setAttribute(Lt,i.id),i.setAttribute(Et,n?At:kt),null==f||f(i,e,n))}function A(e=g){"first"===u&&(g=void 0),null==m||m.removeAttribute("aria-activedescendant"),t.removeAttribute(Lt),null==e||e.removeAttribute(Et);for(const e of t.querySelectorAll(`[${Et}]`))null==e||e.removeAttribute(Et);null==f||f(void 0,e,!1)}function k(...t){const i=t.filter((t=>{var i,n;return null===(n=null===(i=null==e?void 0:e.focusableElementFilter)||void 0===i?void 0:i.call(e,t))||void 0===n||n}));if(0!==i.length){l.splice(function(t){const e=t[0];if(0===l.length)return 0;let i=0,n=l.length-1;for(;i<=n;){const t=Math.floor((i+n)/2);L(e,l[t])?n=t-1:i=t+1}return i}(i),0,...i);for(const t of i)c.has(t)||c.set(t,t.getAttribute("tabindex")),t.setAttribute("tabindex","-1");g||v||y(w())}}function L(t,e){return(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)>0}function T(...t){for(const e of t){const t=l.indexOf(e);t>=0&&l.splice(t,1);const i=c.get(e);if(void 0!==i&&(null===i?e.removeAttribute("tabindex"):e.setAttribute("tabindex",i),c.delete(e)),e===g){y(w())}}}const S={reverse:null==e?void 0:e.reverse,strict:null==e?void 0:e.strict,onlyTabbable:null==e?void 0:e.onlyTabbable};k(...it(t,S));const C="function"==typeof u?u(document.body):w();v||y(C);new MutationObserver((t=>{for(const e of t){for(const t of e.removedNodes)t instanceof HTMLElement&&T(...it(t));"attributes"===e.type&&null===e.oldValue&&e.target instanceof HTMLElement&&T(e.target)}for(const e of t){for(const t of e.addedNodes)t instanceof HTMLElement&&k(...it(t,S));"attributes"===e.type&&null!==e.oldValue&&e.target instanceof HTMLElement&&k(e.target)}})).observe(t,{subtree:!0,childList:!0,attributeFilter:["hidden","disabled"],attributeOldValue:!0});const x=new AbortController,M=null!==(a=null==e?void 0:e.abortSignal)&&void 0!==a?a:x.signal;let I;M.addEventListener("abort",(()=>{T(...l)})),t.addEventListener("mousedown",(t=>{t.target instanceof HTMLElement&&t.target!==document.activeElement&&(I=l.indexOf(t.target))}),{signal:M}),m?(t.addEventListener("focusin",(t=>{t.target instanceof HTMLElement&&l.includes(t.target)&&(m.focus({preventScroll:b}),y(t.target))}),{signal:M}),p||t.addEventListener("mousemove",(({target:t})=>{if(!(t instanceof Node))return;const e=l.find((e=>e.contains(t)));e&&y(e)}),{signal:M,capture:!0}),m.addEventListener("focusin",(()=>{g?E(void 0,g):v||y(w())}),{signal:M}),m.addEventListener("focusout",(()=>{A()}),{signal:M})):t.addEventListener("focusin",(e=>{if(e.target instanceof HTMLElement)if(void 0!==I)I>=0&&l[I]!==g&&y(l[I]),I=void 0;else if("previous"===u)y(e.target);else if("closest"===u||"first"===u){if(e.relatedTarget instanceof Element&&!t.contains(e.relatedTarget)){const t="previous"===P?l.length-1:0,e=l[t];return void(null==e||e.focus({preventScroll:b}))}y(e.target)}else if("function"==typeof u)if(e.relatedTarget instanceof Element&&!t.contains(e.relatedTarget)){const t=u(e.relatedTarget);if((t?l.indexOf(t):-1)>=0&&t instanceof HTMLElement)return void t.focus({preventScroll:b});console.warn("Element requested is not a known focusable element.")}else y(e.target);P=void 0}),{signal:M});const D=null!=m?m:t;let P;return"closest"===u&&document.addEventListener("keydown",(t=>{"Tab"===t.key&&(P=wt(t))}),{signal:M,capture:!0}),D.addEventListener("keydown",(i=>{var n;if(i.key in vt){const s=bt[i.key];if(!i.defaultPrevented&&(s&d)>0&&!yt(i,document.activeElement)){const s=wt(i);let o;if((null==e?void 0:e.getNextFocusable)&&(o=e.getNextFocusable(s,null!==(n=document.activeElement)&&void 0!==n?n:void 0,i)),!o){const e=function(){if(!g)return v?-1:0;const e=l.indexOf(g);return-1!==e?e:g===t?-1:0}();let n=e;"previous"===s?n-=1:"start"===s?n=0:"next"===s?n+=1:n=l.length-1,n<0&&(n="wrap"===h&&"Tab"!==i.key?l.length-1:0),n>=l.length&&(n="wrap"===h&&"Tab"!==i.key?0:l.length-1),e!==n&&(o=l[n])}m?y(o||g,!0):o&&(P=s,o.focus({preventScroll:b})),("Tab"!==i.key||o)&&i.preventDefault()}}}),{signal:M}),x}var St,Ct,xt,Mt,It,Dt,Pt,Nt;const Ht=new IntersectionObserver((t=>{for(const e of t){const t=e.target;e.isIntersecting&&t instanceof Ot&&t.update()}})),Ft=new ResizeObserver((t=>{for(const e of t){const t=e.target;t instanceof Ot&&t.update()}}));let Ot=class ActionBarElement extends HTMLElement{constructor(){super(...arguments),St.add(this),Ct.set(this,null),xt.set(this,!1)}connectedCallback(){Ft.observe(this),Ht.observe(this),this.style.overflow="visible",this.update()}disconnectedCallback(){Ft.unobserve(this),Ht.unobserve(this)}menuItemClick(t){const e=t.currentTarget,i=e?.getAttribute("data-for");i&&document.getElementById(i)?.click()}update(){b(this,xt,"f")||(v(this,xt,!0,"f"),requestAnimationFrame((()=>{v(this,xt,!1,"f"),b(this,St,"m",Mt).call(this)})))}};Ct=new WeakMap,xt=new WeakMap,St=new WeakSet,Mt=function(){const t=b(this,St,"a",It);if(!t)return;const e=t.getBoundingClientRect().top,i=b(this,St,"a",Nt),n=Array.from(this.items,(t=>({top:t.getBoundingClientRect().top,isDivider:t.classList.contains("ActionBar-divider")})));let s=!1;for(let t=0;t<n.length;t++){const o=n[t];o.isDivider?s=!0:(o.top>e?(b(this,St,"m",Pt).call(this,t,i),this.moreMenu.hidden&&(this.moreMenu.hidden=!1),s&&b(this,St,"m",Pt).call(this,t-1,i)):(b(this,St,"m",Dt).call(this,t,i),t===this.items.length-1&&(this.moreMenu.hidden=!0),s&&b(this,St,"m",Dt).call(this,t-1,i)),s=!1)}b(this,Ct,"f")&&b(this,Ct,"f").abort(),v(this,Ct,Tt(this,{bindKeys:gt.ArrowHorizontal|gt.HomeAndEnd,focusOutBehavior:"wrap",focusableElementFilter:t=>{const e=this.items.indexOf(t.parentElement),i=e>-1&&"visible"===this.items[e].style.visibility,n=t===this.moreMenu.invokerElement&&!this.moreMenu.hidden;return i||n}}),"f")},It=function(){return this.items.find((t=>!t.classList.contains("ActionBar-divider")))??null},Dt=function(t,e){const i=this.items[t],n=e[t];i&&n&&(i.style.setProperty("visibility","visible"),n.hidden=!0)},Pt=function(t,e){const i=this.items[t],n=e[t];i&&n&&(i.style.setProperty("visibility","hidden"),n.hidden=!1)},Nt=function(){return this.moreMenu.querySelectorAll('[role="menu"] > li')},g([K],Ot.prototype,"items",void 0),g([U],Ot.prototype,"itemContainer",void 0),g([U],Ot.prototype,"moreMenu",void 0),Ot=g([j("action-bar")],Ot),window.ActionBarElement=Ot;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 i=[Rt(t,"compositionstart",(t=>Yt(this,t))),Rt(t,"compositionend",(t=>Yt(this,t))),Rt(t,"click",(e=>jt(t,e))),Rt(t,"change",(e=>jt(t,e))),Rt(t,"keydown",(e=>function(t,e,i){if(!(i instanceof KeyboardEvent))return;if(t.querySelector("details[open]"))return;const n=qt.get(e);if(!n||n.isComposing)return;const s=i.target instanceof Element&&"SUMMARY"===i.target.tagName;switch(i.key){case"Escape":t.hasAttribute("open")&&(Zt(t),i.preventDefault(),i.stopPropagation());break;case"ArrowDown":{s&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=Ut(t,!0);e&&e.focus(),i.preventDefault()}break;case"ArrowUp":{s&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=Ut(t,!1);e&&e.focus(),i.preventDefault()}break;case"n":if(Kt&&i.ctrlKey){const e=Ut(t,!0);e&&e.focus(),i.preventDefault()}break;case"p":if(Kt&&i.ctrlKey){const e=Ut(t,!1);e&&e.focus(),i.preventDefault()}break;case" ":case"Enter":{const e=document.activeElement;e instanceof HTMLElement&&_t(e)&&e.closest("details")===t&&(i.preventDefault(),i.stopPropagation(),e.click())}}}(t,this,e))),Rt(t,"toggle",(()=>Wt(t,this)),{once:!0}),Rt(t,"toggle",(()=>function(t){if(!t.hasAttribute("open"))return;for(const e of document.querySelectorAll("details[open] > details-menu")){const i=e.closest("details");i&&i!==t&&!i.contains(t)&&i.removeAttribute("open")}}(t))),this.preload?Rt(t,"mouseover",(()=>Wt(t,this)),{once:!0}):Vt,...Bt(t)];qt.set(this,{subscriptions:i,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=qt.get(this);if(t){qt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const qt=new WeakMap,Vt={unsubscribe(){}};function Rt(t,e,i,n=!1){return t.addEventListener(e,i,n),{unsubscribe:()=>{t.removeEventListener(e,i,n)}}}function Wt(t,e){const i=e.getAttribute("src");if(!i)return;const n=qt.get(e);if(!n)return;if(n.loaded)return;n.loaded=!0;const s=e.querySelector("include-fragment");s&&!s.hasAttribute("src")&&(s.addEventListener("loadend",(()=>$t(t))),s.setAttribute("src",i))}function Bt(t){let e=!1;return[Rt(t,"mousedown",(()=>e=!0)),Rt(t,"keydown",(()=>e=!1)),Rt(t,"toggle",(()=>{t.hasAttribute("open")&&($t(t)||e||function(t){const e=document.activeElement;if(e&&_t(e)&&t.contains(e))return;const i=Ut(t,!0);i&&i.focus()}(t))}))]}function $t(t){if(!t.hasAttribute("open"))return!1;const e=t.querySelector("details-menu [autofocus]");return!!e&&(e.focus(),!0)}function Ut(t,e){const i=Array.from(t.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled])')),n=document.activeElement,s=n instanceof HTMLElement?i.indexOf(n):-1,o=e?i[s+1]:i[s-1],r=e?i[0]:i[i.length-1];return o||r}const Kt=navigator.userAgent.match(/Macintosh/);function jt(t,e){const i=e.target;if(i instanceof Element&&i.closest("details")===t)if("click"===e.type){const e=i.closest('[role="menuitem"], [role="menuitemradio"]');if(!e)return;const n=e.querySelector("input");if("LABEL"===e.tagName&&i===n)return;"LABEL"===e.tagName&&n&&!n.checked||zt(e,t)}else if("change"===e.type){const e=i.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');e&&zt(e,t)}}function zt(t,e){if(t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled"))return;const i=t.closest("details-menu");if(!i)return;i.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:t}}))&&(!function(t,e){const i=e.querySelector("[data-menu-button]");if(!i)return;const n=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(n)i.textContent=n;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&&(i.innerHTML=e)}}(t,e),function(t,e){for(const i of e.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const e=i.querySelector('input[type="radio"], input[type="checkbox"]');let n=(i===t).toString();e instanceof HTMLInputElement&&(n=e.indeterminate?"mixed":e.checked.toString()),i.setAttribute("aria-checked",n)}}(t,e),"menuitemcheckbox"!==t.getAttribute("role")&&Zt(e),i.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:t}})))}function _t(t){const e=t.getAttribute("role");return"menuitem"===e||"menuitemcheckbox"===e||"menuitemradio"===e}function Zt(t){if(!t.hasAttribute("open"))return;t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}function Yt(t,e){const i=qt.get(t);i&&(i.isComposing="compositionstart"===e.type)}var Gt,Jt;window.customElements.get("details-menu")||(window.DetailsMenuElement=DetailsMenuElement,window.customElements.define("details-menu",DetailsMenuElement));const Xt=(()=>{const t=new Set;let e=null,i=null;function n(){for(const e of t)e.update()}return s=>{window.addEventListener("resize",n),window.addEventListener("scroll",n),e||(e=new IntersectionObserver((e=>{for(const i of e){const e=i.target;i.isIntersecting?(e.update(),t.add(e)):t.delete(e)}}))),i||(i=new ResizeObserver((()=>{for(const e of t)e.update()}))),i.observe(s.ownerDocument.documentElement),e.observe(s)}})();class AnchoredPositionElement extends HTMLElement{constructor(){super(...arguments),Gt.set(this,null),Jt.set(this,void 0)}get align(){const t=this.getAttribute("align");return"center"===t||"end"===t?t:"start"}set align(t){this.setAttribute("align",`${t}`)}get side(){const t=this.getAttribute("side");return"inside-top"===t||"inside-bottom"===t||"inside-left"===t||"inside-right"===t||"inside-center"===t||"outside-top"===t||"outside-left"===t||"outside-right"===t?t:"outside-bottom"}set side(t){this.setAttribute("side",`${t}`)}get anchorOffset(){const t=this.getAttribute("anchor-offset");return"spacious"===t||"8"===t?8:4}set anchorOffset(t){this.setAttribute("anchor-offset",`${t}`)}get anchor(){return this.getAttribute("anchor")||""}set anchor(t){this.setAttribute("anchor",`${t}`)}get anchorElement(){if(b(this,Gt,"f"))return b(this,Gt,"f");const t=this.anchor;return t?this.ownerDocument.getElementById(t):null}set anchorElement(t){v(this,Gt,t,"f"),b(this,Gt,"f")||this.removeAttribute("anchor")}get alignmentOffset(){return Number(this.getAttribute("alignment-offset"))}set alignmentOffset(t){this.setAttribute("alignment-offset",`${t}`)}get allowOutOfBounds(){return this.hasAttribute("allow-out-of-bounds")}set allowOutOfBounds(t){this.toggleAttribute("allow-out-of-bounds",t)}connectedCallback(){this.update(),this.addEventListener("beforetoggle",(()=>this.update())),Xt(this)}attributeChangedCallback(){this.update()}update(){this.isConnected&&(cancelAnimationFrame(b(this,Jt,"f")),v(this,Jt,requestAnimationFrame((()=>{const t=this.anchorElement;if(this.classList.toggle("not-anchored",!t),t){const{left:e,top:i}=J(this,t,this);this.style.top=`${i}px`,this.style.left=`${e}px`,this.style.bottom="auto",this.style.right="auto"}else this.style.top="0",this.style.left="0",this.style.bottom="0",this.style.right="0"})),"f"))}}var Qt,te,ee;function ie(t){t.body.style.getPropertyValue("--dialog-scrollgutter")||t.body.style.setProperty("--dialog-scrollgutter",window.innerWidth-t.body.clientWidth+"px")}function ne(t){const e=t.target,i=e?.closest("button");if(!i||i.hasAttribute("disabled")||"true"===i.getAttribute("aria-disabled"))return;let n=i?.getAttribute("data-show-dialog-id");if(n){const e=document.getElementById(n);if(e instanceof HTMLDialogElement){ie(e.ownerDocument),e.showModal(),t.preventDefault();let n=i,s=!1;for(;n;)n=n.parentElement?.closest("[popover]"),n&&"auto"===n.popover&&(n.classList.add("dialog-inside-popover-fix"),n.popover="manual",n.showPopover(),s=!0);s&&(e.addEventListener("close",(t=>t.stopImmediatePropagation()),{once:!0}),e.close(),e.showModal(),e.addEventListener("close",(()=>{for(const t of e.ownerDocument.querySelectorAll(".dialog-inside-popover-fix"))t.contains(e)&&(t.classList.remove("dialog-inside-popover-fix"),t.popover="auto",t.showPopover())}),{once:!0}))}}if(n=i.getAttribute("data-close-dialog-id")||i.getAttribute("data-submit-dialog-id"),n){const t=document.getElementById(n);t instanceof HTMLDialogElement&&t.open&&t.close()}}Gt=new WeakMap,Jt=new WeakMap,AnchoredPositionElement.observedAttributes=["align","side","anchor","alignment-offset","allow-out-of-bounds"],customElements.get("anchored-position")||(window.AnchoredPositionElement=AnchoredPositionElement,customElements.define("anchored-position",AnchoredPositionElement));class DialogHelperElement extends HTMLElement{constructor(){super(...arguments),Qt.add(this),te.set(this,null)}get dialog(){return this.querySelector("dialog")}connectedCallback(){const{signal:t}=v(this,te,new AbortController,"f");document.addEventListener("click",ne,!0),document.addEventListener("click",this,{signal:t}),new MutationObserver((t=>{for(const e of t)e.target===this.dialog&&b(this,Qt,"m",ee).call(this)})).observe(this,{subtree:!0,attributeFilter:["open"]}),b(this,Qt,"m",ee).call(this)}disconnectedCallback(){b(this,te,"f")?.abort()}handleEvent(t){const e=t.target,i=this.dialog;if(e!==i||!i?.open)return;if(i.querySelector("form"))return;const n=i.getBoundingClientRect();n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width||i.close()}}te=new WeakMap,Qt=new WeakSet,ee=function(){this.dialog&&this.dialog.matches("[open]:not(:modal)")&&(this.dialog.addEventListener("close",(t=>t.stopImmediatePropagation()),{once:!0}),this.dialog.close(),ie(this.dialog.ownerDocument),this.dialog.showModal())},window.customElements.get("dialog-helper")||(window.DialogHelperElement=DialogHelperElement,window.customElements.define("dialog-helper",DialogHelperElement));var se=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...n}={}){super(t,n),this.oldState=String(e||""),this.newState=String(i||"")}},oe=new WeakMap;function re(t,e,i){oe.set(t,setTimeout((()=>{oe.has(t)&&t.dispatchEvent(new se("toggle",{cancelable:!1,oldState:e,newState:i}))}),0))}var ae=globalThis.ShadowRoot||function(){},le=globalThis.HTMLDialogElement||function(){},ce=new WeakMap,de=new WeakMap,he=new WeakMap;function ue(t){return he.get(t)||"hidden"}var me=new WeakMap;function fe(t,e){return("auto"===t.popover||"manual"===t.popover)&&(!!t.isConnected&&((!e||"showing"===ue(t))&&(!(!e&&"hidden"!==ue(t))&&(!(t instanceof le&&t.hasAttribute("open"))&&document.fullscreenElement!==t))))}function pe(t){return t?Array.from(de.get(t.ownerDocument)||[]).indexOf(t)+1:0}function ge(t){const e=we(t),i=function(t){for(;t;){const e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if((t=t.parentElement||ve(t))instanceof ae&&(t=t.host),t instanceof Document)return}}(t);return pe(e)>pe(i)?e:i}function be(t){const e=de.get(t);for(const t of e||[]){if(t.isConnected)return t;e.delete(t)}return null}function ve(t){return"function"==typeof t.getRootNode?t.getRootNode():t.parentNode?ve(t.parentNode):t}function we(t){for(;t;){if(t instanceof HTMLElement&&"auto"===t.popover&&"showing"===he.get(t))return t;if((t=t instanceof Element&&t.assignedSlot||t.parentElement||ve(t))instanceof ae&&(t=t.host),t instanceof Document)return}}function ye(t){return!(t.hidden||t instanceof ae)&&((!(t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLOptGroupElement||t instanceof HTMLOptionElement||t instanceof HTMLFieldSetElement)||!t.disabled)&&(!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(!(t instanceof HTMLAnchorElement&&""===t.href)&&("number"==typeof t.tabIndex&&-1!==t.tabIndex))))}function Ee(t){(function(t){if(t.shadowRoot&&!0!==t.shadowRoot.delegatesFocus)return null;let e=t;e.shadowRoot&&(e=e.shadowRoot);let i=e.querySelector("[autofocus]");if(i)return i;{const t=e.querySelectorAll("slot");for(const e of t){const t=e.assignedElements({flatten:!0});for(const e of t){if(e.hasAttribute("autofocus"))return e;if(i=e.querySelector("[autofocus]"),i)return i}}}const n=t.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let s=n.currentNode;for(;s;){if(ye(s))return s;s=n.nextNode()}})(t)?.focus()}var Ae=new WeakMap;function ke(t){if(!fe(t,!1))return;const e=t.ownerDocument;if(!t.dispatchEvent(new se("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"})))return;if(!fe(t,!1))return;let i=!1;if("auto"===t.popover){const i=t.getAttribute("popover");if(Se(function(t){const e=new Map;let i=0;for(const n of de.get(t.ownerDocument)||[])e.set(n,i),i+=1;e.set(t,i),i+=1;let n=null;return function(t){const i=we(t);if(null===i)return null;const s=e.get(i);(null===n||e.get(n)<s)&&(n=i)}(t.parentElement||ve(t)),n}(t)||e,!1,!0),i!==t.getAttribute("popover")||!fe(t,!1))return}be(e)||(i=!0),Ae.delete(t);const n=e.activeElement;t.classList.add(":popover-open"),he.set(t,"showing"),ce.has(e)||ce.set(e,new Set),ce.get(e).add(t),Ee(t),"auto"===t.popover&&(de.has(e)||de.set(e,new Set),de.get(e).add(t),Ie(me.get(t),!0)),i&&n&&"auto"===t.popover&&Ae.set(t,n),re(t,"closed","open")}function Le(t,e=!1,i=!1){if(!fe(t,!0))return;const n=t.ownerDocument;if("auto"===t.popover&&(Se(t,e,i),!fe(t,!0)))return;if(Ie(me.get(t),!1),me.delete(t),i&&(t.dispatchEvent(new se("beforetoggle",{oldState:"open",newState:"closed"})),!fe(t,!0)))return;ce.get(n)?.delete(t),de.get(n)?.delete(t),t.classList.remove(":popover-open"),he.set(t,"hidden"),i&&re(t,"open","closed");const s=Ae.get(t);s&&(Ae.delete(t),e&&s.focus())}function Te(t,e=!1,i=!1){let n=be(t);for(;n;)Le(n,e,i),n=be(t)}function Se(t,e,i){const n=t.ownerDocument||t;if(t instanceof Document)return Te(n,e,i);let s=null,o=!1;for(const e of de.get(n)||[])if(e===t)o=!0;else if(o){s=e;break}if(!o)return Te(n,e,i);for(;s&&"showing"===ue(s)&&de.get(n)?.size;)Le(s,e,i)}var Ce=new WeakMap;function xe(t){if(!t.isTrusted)return;const e=t.composedPath()[0];if(!e)return;const i=e.ownerDocument;if(!be(i))return;const n=ge(e);if(n&&"pointerdown"===t.type)Ce.set(i,n);else if("pointerup"===t.type){const t=Ce.get(i)===n;Ce.delete(i),t&&Se(n||i,!1,!0)}}var Me=new WeakMap;function Ie(t,e=!1){if(!t)return;Me.has(t)||Me.set(t,t.getAttribute("aria-expanded"));const i=t.popoverTargetElement;if(i instanceof HTMLElement&&"auto"===i.popover)t.setAttribute("aria-expanded",String(e));else{const e=Me.get(t);e?t.setAttribute("aria-expanded",e):t.removeAttribute("aria-expanded")}}var De=globalThis.ShadowRoot||function(){};function Pe(t,e,i){const n=t[e];Object.defineProperty(t,e,{value(t){return n.call(this,i(t))}})}var Ne=/(^|[^\\]):popover-open\b/g;function He(){const t="function"==typeof globalThis.CSSLayerBlockRule;return`\n${t?"@layer popover-polyfill {":""}\n :where([popover]) {\n position: fixed;\n z-index: 2147483647;\n inset: 0;\n padding: 0.25em;\n width: fit-content;\n height: fit-content;\n border-width: initial;\n border-color: initial;\n border-image: initial;\n border-style: solid;\n background-color: canvas;\n color: canvastext;\n overflow: auto;\n margin: auto;\n }\n\n :where([popover]:not(.\\:popover-open)) {\n display: none;\n }\n\n :where(dialog[popover].\\:popover-open) {\n display: block;\n }\n\n :where(dialog[popover][open]) {\n display: revert;\n }\n\n :where([anchor].\\:popover-open) {\n inset: auto;\n }\n\n :where([anchor]:popover-open) {\n inset: auto;\n }\n\n @supports not (background-color: canvas) {\n :where([popover]) {\n background-color: white;\n color: black;\n }\n }\n\n @supports (width: -moz-fit-content) {\n :where([popover]) {\n width: -moz-fit-content;\n height: -moz-fit-content;\n }\n }\n\n @supports not (inset: 0) {\n :where([popover]) {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n }\n${t?"}":""}\n`}var Fe,Oe,qe,Ve,Re=null;function We(t){const e=He();if(null===Re)try{(Re=new CSSStyleSheet).replaceSync(e)}catch{Re=!1}if(!1===Re){const i=document.createElement("style");i.textContent=e,t instanceof Document?t.head.prepend(i):t.prepend(i)}else t.adoptedStyleSheets=[Re,...t.adoptedStyleSheets]}"undefined"!=typeof HTMLElement&&"object"==typeof HTMLElement.prototype&&"popover"in HTMLElement.prototype||function(){if("undefined"==typeof window)return;function t(t){return t?.includes(":popover-open")&&(t=t.replace(Ne,"$1.\\:popover-open")),t}window.ToggleEvent=window.ToggleEvent||se,Pe(Document.prototype,"querySelector",t),Pe(Document.prototype,"querySelectorAll",t),Pe(Element.prototype,"querySelector",t),Pe(Element.prototype,"querySelecto