@gjsify/example-gtk-adwaita-storybook 0.55.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/browser-main.js +139 -37
  2. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});let t=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}const n=[`Overview`,`Presentation`,`Boxed Lists`,`Controls`,`Buttons`,`Text`,`Drawing`,`Media`,`Layout`,`Windows`,`View Switching`,`Navigation`,`Feedback`];function orderCategories(e){let t=new Map(n.map((e,t)=>[e,t])),r=[...e].filter(e=>t.has(e));r.sort((e,n)=>t.get(e)-t.get(n));let i=e.filter(e=>!t.has(e));return[...r,...i]}var StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances(),r=this._groupByCategory(n);if(this._view.renderSidebar(r,e=>this.select(e)),t){let e=r[0]?.stories[0]?.instance??null;e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return orderCategories([...t.keys()]).map(e=>({category:e,stories:t.get(e)}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}};function controlLabel(e){return e.label||e.name}function bindControl(e,n,r){let i=n.name,a=n.description;switch(n.type){case t.TEXT:{let t=r.text(controlLabel(n),a),o=e.args[i];return t.set(typeof o==`string`?o:``),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`string`?e[i]:``;t.get()!==n&&t.set(n)}}}case t.COLOR:{let t=r.color(controlLabel(n),a),o=e.args[i];return t.set(typeof o==`string`?o:`#000000`),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`string`?e[i]:`#000000`;t.get()!==n&&t.set(n)}}}case t.BOOLEAN:{let t=r.boolean(controlLabel(n),a);return t.set(!!e.args[i]),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=!!e[i];t.get()!==n&&t.set(n)}}}case t.NUMBER:{let t=r.number(n),a=e.args[i];return t.set(typeof a==`number`?a:n.min??0),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`number`?e[i]:0;t.get()!==n&&t.set(n)}}}case t.RANGE:{let t=r.range(n),a=e.args[i],o=typeof a==`number`?a:n.min??0;return t.set(o),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`number`?e[i]:o;t.get()!==n&&t.set(n)}}}case t.SELECT:{let t=n.options;if(!t?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=r.select(n),o=e.args[i],s=Math.max(0,t.findIndex(e=>e.value===o));return a.set(s),a.onChange(n=>{n>=0&&n<t.length&&e.setArg(i,t[n].value)}),{view:a.node,refresh:e=>{let n=e[i],r=t.findIndex(e=>e.value===n);r>=0&&a.get()!==r&&a.set(r)}}}default:return console.warn(`Unsupported control type: ${n.type}`),null}}var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const r=[`system`,`light`,`dark`];var StorybookSettings=class{constructor(e=()=>!1){this._colorScheme=`system`,this._accentMode=`system`,this._accent=`blue`,this._listeners=new Set,this._systemDark=e}get colorScheme(){return this._colorScheme}set colorScheme(e){!r.includes(e)||e===this._colorScheme||(this._colorScheme=e,this._notify())}get accentMode(){return this._accentMode}set accentMode(e){e!==this._accentMode&&(this._accentMode=e,this._notify())}get accent(){return this._accent}set accent(e){e!==this._accent&&(this._accent=e,this._notify())}get resolvedAccent(){return this._accentMode===`custom`?this._accent:null}get resolvedDark(){return this._colorScheme===`dark`?!0:this._colorScheme===`light`?!1:this._systemDark()}get state(){return{colorScheme:this._colorScheme,accentMode:this._accentMode,accent:this._accent}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}systemChanged(){this._colorScheme===`system`&&this._notify()}_notify(){let e=this.state;for(let t of[...this._listeners])try{t(e)}catch{}}},StoryElement=class extends StoryViewBase{constructor(e,t=`Default`,n){super(),this.initBase(e,t,n)}get element(){return this.root}createChrome(e,t){return t?{root:t,hasStage:!1,setStageContent:()=>{},setChromeText:()=>{}}:this._installDefaultChrome()}_installDefaultChrome(){let e=document.createElement(`div`);e.className=`sb-story-page`;let t=document.createElement(`div`);t.className=`sb-story-clamp`;let n=document.createElement(`div`);n.className=`sb-story-group`;let r=document.createElement(`div`);r.className=`sb-story-group-header`;let i=document.createElement(`span`);i.className=`sb-story-group-title`;let a=document.createElement(`span`);a.className=`sb-story-group-description`,r.append(i,a);let o=document.createElement(`div`);return o.className=`story-stage`,n.append(r,o),t.append(n),e.append(t),{root:e,hasStage:!0,setStageContent:e=>o.replaceChildren(e),setChromeText:(e,t)=>{i.textContent=e,a.textContent=t,a.hidden=t.length===0}}}};function createControlRow(e,t){return bindControl(e,t,i)}const i={text(e){let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,e);let cb=()=>{};return t.addEventListener(`changed`,e=>cb(e.detail.text)),{node:t,get:()=>t.text??``,set:e=>{t.text=e},onChange:e=>{cb=e}}},color(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),t&&n.setAttribute(`subtitle`,t);let r=document.createElement(`input`);r.type=`color`,r.className=`sb-color-input`,r.slot=`suffix`,n.appendChild(r);let cb=()=>{};return r.addEventListener(`input`,()=>cb(r.value)),{node:n,get:()=>r.value,set:e=>{r.value=e},onChange:e=>{cb=e}}},boolean(e){let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,e);let cb=()=>{};return t.addEventListener(`notify::active`,e=>cb(e.detail.active)),{node:t,get:()=>t.hasAttribute(`active`),set:e=>{t.toggleAttribute(`active`,e)},onChange:e=>{cb=e}}},number(e){let t=document.createElement(`adw-spin-row`);t.setAttribute(`title`,label(e)),t.setAttribute(`adjustment`,JSON.stringify({lower:e.min??0,upper:e.max??100,stepIncrement:e.step??1}));let cb=()=>{};return t.addEventListener(`notify::value`,e=>cb(e.detail.value)),{node:t,get:()=>t.value??0,set:e=>{t.value=e},onChange:e=>{cb=e}}},select(e){let t=e.options??[],n=document.createElement(`adw-combo-row`);n.setAttribute(`title`,label(e)),n.setAttribute(`model`,JSON.stringify(t.map(e=>e.label)));let cb=()=>{};return n.addEventListener(`notify::selected`,e=>cb(e.detail.selected)),{node:n,get:()=>n.selected??0,set:e=>{n.selected=e},onChange:e=>{cb=e}}},range(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=Number.isInteger(r),format=e=>i?String(Math.round(e)):e.toFixed(2),a=document.createElement(`div`);a.className=`sb-range-row`;let o=document.createElement(`div`);o.className=`sb-range-header`;let s=document.createElement(`span`);s.className=`sb-range-title`,s.textContent=label(e);let c=document.createElement(`span`);c.className=`sb-range-value`,o.append(s,c);let l=document.createElement(`input`);if(l.type=`range`,l.className=`sb-range-input`,l.min=String(t),l.max=String(n),l.step=String(r),e.description){let t=document.createElement(`span`);t.className=`sb-range-description`,t.textContent=e.description,a.append(o,t,l)}else a.append(o,l);let cb=()=>{};return l.addEventListener(`input`,()=>{let e=parseFloat(l.value);c.textContent=format(e),cb(e)}),{node:a,get:()=>parseFloat(l.value),set:e=>{l.value=String(e),c.textContent=format(e)},onChange:e=>{cb=e}}}};function label(e){return e.label||e.name}const a=/^[ \t\n\v\f\r]+|[ \t\n\v\f\r]+$/g;function gStrStrip(e){return e.replace(a,``)}function stringIsNotEmpty(e){return e!=null&&e.length>0}function glibClamp(e,t,n){return e>n?n:e<t?t:e}function stripMnemonic(e){let t=[...e],n=``,r=0;for(;r<t.length;){if(t[r]!==`_`){n+=t[r],r+=1;continue}let e=t[r+1];if(e===void 0)return n;n+=e===`_`?`_`:e,r+=2}return n}const o={UNKNOWN:0,CUSTOM:1,GPL_2_0:2,GPL_3_0:3,LGPL_2_1:4,LGPL_3_0:5,BSD:6,MIT_X11:7,ARTISTIC:8,GPL_2_0_ONLY:9,GPL_3_0_ONLY:10,LGPL_2_1_ONLY:11,LGPL_3_0_ONLY:12,AGPL_3_0:13,AGPL_3_0_ONLY:14,BSD_3:15,APACHE_2_0:16,MPL_2_0:17,"0BSD":18},s=[{name:null,url:null,spdxId:null},{name:null,url:null,spdxId:null},{name:`GNU General Public License, version 2 or later`,url:`https://www.gnu.org/licenses/old-licenses/gpl-2.0.html`,spdxId:`GPL-2.0-or-later`},{name:`GNU General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/gpl-3.0.html`,spdxId:`GPL-3.0-or-later`},{name:`GNU Lesser General Public License, version 2.1 or later`,url:`https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html`,spdxId:`LGPL-2.1-or-later`},{name:`GNU Lesser General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/lgpl-3.0.html`,spdxId:`LGPL-3.0-or-later`},{name:`BSD 2-Clause License`,url:`https://opensource.org/licenses/bsd-license.php`,spdxId:`BSD-2-Clause`},{name:`The MIT License (MIT)`,url:`https://opensource.org/licenses/mit-license.php`,spdxId:`MIT`},{name:`Artistic License 2.0`,url:`https://opensource.org/licenses/artistic-license-2.0.php`,spdxId:`Artistic-2.0`},{name:`GNU General Public License, version 2 only`,url:`https://www.gnu.org/licenses/old-licenses/gpl-2.0.html`,spdxId:`GPL-2.0-only`},{name:`GNU General Public License, version 3 only`,url:`https://www.gnu.org/licenses/gpl-3.0.html`,spdxId:`GPL-3.0-only`},{name:`GNU Lesser General Public License, version 2.1 only`,url:`https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html`,spdxId:`LGPL-2.1-only`},{name:`GNU Lesser General Public License, version 3 only`,url:`https://www.gnu.org/licenses/lgpl-3.0.html`,spdxId:`LGPL-3.0-only`},{name:`GNU Affero General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/agpl-3.0.html`,spdxId:`AGPL-3.0-or-later`},{name:`GNU Affero General Public License, version 3 only`,url:`https://www.gnu.org/licenses/agpl-3.0.html`,spdxId:`AGPL-3.0-only`},{name:`BSD 3-Clause License`,url:`https://opensource.org/licenses/BSD-3-Clause`,spdxId:`BSD-3-Clause`},{name:`Apache License, Version 2.0`,url:`https://opensource.org/licenses/Apache-2.0`,spdxId:`Apache-2.0`},{name:`Mozilla Public License 2.0`,url:`https://opensource.org/licenses/MPL-2.0`,spdxId:`MPL-2.0`},{name:`BSD Zero-Clause License`,url:`https://opensource.org/license/0bsd`,spdxId:`0BSD`}];o.GPL_2_0_ONLY,o.GPL_3_0_ONLY;function licenseText(e,t){if(e===o.UNKNOWN)return null;if(e===o.CUSTOM)return t;let n=s[e];return`This application comes with absolutely no warranty. See the <a href="%s">%s</a> for details.`.replace(`%s`,()=>n.url??``).replace(`%s`,()=>n.name??``)}o.UNKNOWN;function indexOfUrlEnd(e,t){for(let n=t;n<e.length;n++)if(`
2
2
  >`.includes(e[n]))return n;return-1}function parseCreditPerson(e){let t=e.indexOf(`<`),n=t<0?-1:e.indexOf(`>`,t),r=e.indexOf(`http://`),i=e.indexOf(`https://`),a=r;(r<0||i>=0&&i<r)&&(a=i);let o=-1;a>=0&&(o=indexOfUrlEnd(e,a),o<0&&(o=e.length)),a>=0&&(t<0||n<0||a<=t+1)&&(t=a,n=o);let s,c,l;return t>=0&&n>=0?(s=e.slice(0,t),l=e[t]===`<`,c=l?e.slice(t+1,n):e.slice(t,n)):(s=e,c=null,l=!1),s=gStrStrip(s),{name:s,link:c,isEmail:l,uri:c===null?null:l?`mailto:${c}`:c}}const c=[`translator_credits`,`translator-credits`];function translatorCreditsPeople(e){return e==null||c.includes(e)||e.length===0?[]:e.split(`
3
- `)}const l={developers:`Code by`,designers:`Design by`,artists:`Artwork by`,documenters:`Documentation by`,translators:`Translated by`};function creditsSections(e={}){return[{title:l.developers,people:e.developers??[]},{title:l.designers,people:e.designers??[]},{title:l.artists,people:e.artists??[]},{title:l.documenters,people:e.documenters??[]},{title:l.translators,people:translatorCreditsPeople(e.translatorCredits)},...e.creditSections??[]].filter(e=>e.people.length>0).map(e=>({title:e.title,people:e.people.map(parseCreditPerson)}))}const u={dialogTitle:`About`,whatsNewRow:`What’s _New`,detailsRow:`_Details`,websiteRow:`_Website`,supportRow:`_Support Questions`,issueRow:`_Report an Issue`,troubleshootingRow:`_Troubleshooting`,creditsRow:`_Credits`,legalRow:`_Legal`,acknowledgementsRow:`_Acknowledgements`,whatsNewPage:`What’s New`,detailsPage:`Details`,troubleshootingPage:`Troubleshooting`,creditsPage:`Credits`,legalPage:`Legal`,acknowledgementsPage:`Acknowledgements`};function aboutDialogVisibility(e={}){let t=(e.website??``).length>0,n=(e.comments??``).length>0,r=(e.releaseNotes??``).length>0,i=e.hasCustomLinks??!1,a=n||i,o=t&&n||i,s=(e.supportUrl??``).length>0,c=(e.issueUrl??``).length>0,l=(e.debugInfo??``).length>0,u=e.hasCredits??!1,d=e.hasLegal??!1,f=e.hasAcknowledgements??!1;return{appIcon:(e.applicationIcon??``).length>0,appName:(e.applicationName??``).length>0,developerName:(e.developerName??``).length>0,version:(e.version??``).length>0,detailsGroup:t||n||o||r,whatsNewRow:r,detailsRow:n||o,websiteRow:t&&!a,supportGroup:s||c||l,supportRow:s,issueRow:c,troubleshootingRow:l,creditsLegalGroup:u||d||f,creditsRow:u,legalRow:d,acknowledgementsRow:f,commentsLabel:n,linksGroup:o,detailsWebsiteRow:t&&a}}function legalSectionVisible(e,t,n){let r=licenseText(t,n);return e.length>0||r!==null&&r.length>0}const d=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],f={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function isAdwAccentColorName(e){return d.includes(e)}function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}const p=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*(?:[,/]\s*[\d.]+%?\s*)?\)$/i;function parseAdwRgb(e){let t=e.trim(),n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);if(n)return parseAdwRgb(`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`);let r=parseHex(t);if(r)return{red:r[0],green:r[1],blue:r[2]};let i=p.exec(t);if(!i)return null;let a=[i[1],i[2],i[3]].map(Number);return a.some(e=>!Number.isFinite(e)||e<0||e>255)?null:{red:a[0]/255,green:a[1]/255,blue:a[2]/255}}function formatAdwRgb(e){return toHex(e.red,e.green,e.blue)}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function nearestAccent(e){let[,t,n]=linearToOklab(toLinear(e.red),toLinear(e.green),toLinear(e.blue)),r=Math.hypot(t,n),i=Math.atan2(n,t)*180/Math.PI%360;return i<0&&(i+=360),r<.04?`slate`:i>345?`pink`:i>280?`purple`:i>230?`blue`:i>175?`teal`:i>115?`green`:i>75.5?`yellow`:i>35?`orange`:i>10?`red`:`pink`}function adwaitaAccentBgColor(e){return f[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(f[e],t)}function deriveRowLabels(e){let t=e.title??``,n=e.subtitle??``;return{title:t,titleVisible:stringIsNotEmpty(t),subtitle:n,subtitleVisible:stringIsNotEmpty(n)}}var ActionRowState=class{constructor(){this._title=``,this._subtitle=``,this._activatableWidget=null,this._activatable=!1,this._widgetSensitive=!0}get state(){return{...deriveRowLabels({title:this._title,subtitle:this._subtitle}),activatable:this._activatable}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}get activatableWidget(){return this._activatableWidget}setActivatableWidget(e,t=!0){return e===this._activatableWidget?!1:(this._activatableWidget=e,this._widgetSensitive=t,e!==null&&(this._activatable=t),!0)}setActivatableWidgetSensitive(e){if(this._activatableWidget===null)return!1;let t=!!e;return t===this._widgetSensitive?!1:(this._widgetSensitive=t,this.setActivatable(t))}get activatable(){return this._activatable}setActivatable(e){let t=!!e;return t===this._activatable?!1:(this._activatable=t,!0)}activate(){return this._activatableWidget}},SwitchRowState=class{constructor(){this._active=!1}get active(){return this._active}setActive(e){let t=!!e;return t===this._active?!1:(this._active=t,!0)}activate(){return this.setActive(!this._active)}},ButtonRowState=class{constructor(){this._title=``,this._startIconName=``,this._endIconName=``}get state(){return{title:this._title,titleVisible:stringIsNotEmpty(this._title),startIconName:this._startIconName,startIconVisible:stringIsNotEmpty(this._startIconName),endIconName:this._endIconName,endIconVisible:stringIsNotEmpty(this._endIconName),activatable:!0}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get startIconName(){return this._startIconName}setStartIconName(e){let t=e??``;return t===this._startIconName?!1:(this._startIconName=t,!0)}get endIconName(){return this._endIconName}setEndIconName(e){let t=e??``;return t===this._endIconName?!1:(this._endIconName=t,!0)}},WindowTitleState=class{constructor(){this._title=``,this._subtitle=``}get state(){return deriveRowLabels({title:this._title,subtitle:this._subtitle})}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}};const m={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0},g={...m,value:NaN};function finite(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function adjustmentRange(e){return[e.lower,Math.max(e.lower,e.upper-e.pageSize)]}function clampAdjustmentValue(e,t){let[n,r]=adjustmentRange(e);return typeof t!=`number`||Number.isNaN(t)?n:Math.min(r,Math.max(n,t))}function snapAdjustmentValue(e,t){let n=clampAdjustmentValue(e,t),[r,i]=adjustmentRange(e),a=(i-r)/e.stepIncrement,o=Math.floor(a+Math.max(1,Math.abs(a))*1e-12),s=Math.min(o,Math.max(0,Math.round((n-r)/e.stepIncrement)));return Math.min(i,Math.max(r,r+s*e.stepIncrement))}function normalizeAdjustment(e,t=g){let n=e??{},r=finite(n.lower,t.lower),i=Math.max(r,finite(n.upper,t.upper)),a=finite(n.stepIncrement,t.stepIncrement),o=a>0?a:t.stepIncrement>0?t.stepIncrement:m.stepIncrement,s=t.pageIncrement===t.stepIncrement,c=finite(n.pageIncrement,s?o:t.pageIncrement),l={value:0,lower:r,upper:i,stepIncrement:o,pageIncrement:c>0?c:o,pageSize:Math.max(0,finite(n.pageSize,t.pageSize))};return l.value=clampAdjustmentValue(l,typeof n.value==`number`?n.value:t.value),l}const _=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function parseAdjustment(e){if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!=`object`||!t||Array.isArray(t))return{};let n=t,r={};for(let e of _){let t=n[e];typeof t==`number`&&(r[e]=t)}return r}var SpinState=class{constructor(){this._adjustment=normalizeAdjustment(),this._valueSet=!1,this._listeners=new Set,this._rangeListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeChanged(e){return this._rangeListeners.add(e),()=>{this._rangeListeners.delete(e)}}_emit(e){let t={value:this._adjustment.value,interactive:e};for(let e of[...this._listeners])e(t)}_emitChanged(){let e=this._adjustment;for(let t of[...this._rangeListeners])t(e)}_bump(e){let t=clampAdjustmentValue(this._adjustment,this._adjustment.value+e);return t===this._adjustment.value?!1:(this._valueSet=!0,this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}get adjustment(){return{...this._adjustment}}get value(){return this._adjustment.value}configure(e){let t=this._adjustment,n=normalizeAdjustment(e,this._valueSet?t:{...t,value:NaN});typeof e?.value==`number`&&Number.isFinite(e.value)&&(this._valueSet=!0);let r=n.lower!==t.lower||n.upper!==t.upper||n.stepIncrement!==t.stepIncrement||n.pageIncrement!==t.pageIncrement||n.pageSize!==t.pageSize,i=n.value!==t.value;return!r&&!i?!1:(this._adjustment=n,r&&this._emitChanged(),i&&this._emit(!1),!0)}setValue(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!1),!0)}setValueInteractive(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}increment(){return this._bump(this._adjustment.stepIncrement)}decrement(){return this._bump(-this._adjustment.stepIncrement)}};const ee=[`light`,`dark`,`no-preference`],te=`system`;function isAdwSystemColorScheme(e){return typeof e==`string`&&ee.includes(e)}function appearanceFromMeta(e){let t=e(`adw-accent`)?.trim().toLowerCase(),n=e(`adw-color-scheme`)?.trim().toLowerCase();return{...t&&(t===`system`||isAdwAccentColorName(t))?{accent:t}:{},...isAdwSystemColorScheme(n)?{colorScheme:n}:{}}}const ne=[{fg:`#cfe1f5`,start:`#83b6ec`,stop:`#337fdc`},{fg:`#caeaf2`,start:`#7ad9f1`,stop:`#0f9ac8`},{fg:`#cef8d8`,start:`#8de6b1`,stop:`#29ae74`},{fg:`#e6f9d7`,start:`#b5e98a`,stop:`#6ab85b`},{fg:`#f9f4e1`,start:`#f8e359`,stop:`#d29d09`},{fg:`#ffead1`,start:`#ffcb62`,stop:`#d68400`},{fg:`#ffe5c5`,start:`#ffa95a`,stop:`#ed5b00`},{fg:`#f8d2ce`,start:`#f78773`,stop:`#e62d42`},{fg:`#fac7de`,start:`#e973ab`,stop:`#e33b6a`},{fg:`#e7c2e8`,start:`#cb78d4`,stop:`#9945b5`},{fg:`#d5d2f5`,start:`#9e91e8`,stop:`#7a59ca`},{fg:`#f2eade`,start:`#e3cf9c`,stop:`#b08952`},{fg:`#e5d6ca`,start:`#be916d`,stop:`#785336`},{fg:`#d8d7d3`,start:`#c0bfbc`,stop:`#6e6d71`}];function*utf8Bytes(e){for(let t of e){let e=t.codePointAt(0)??0;e>=55296&&e<=57343&&(e=65533),e<128?yield e:e<2048?(yield 192|e>>6,yield 128|e&63):e<65536?(yield 224|e>>12,yield 128|e>>6&63,yield 128|e&63):(yield 240|e>>18,yield 128|e>>12&63,yield 128|e>>6&63,yield 128|e&63)}}function gStrHash(e){let t=5381;for(let n of utf8Bytes(e)){if(n===0)break;t=Math.imul(t,33)+(n>127?n-256:n)>>>0}return t>>>0}function avatarInitials(e){let t=gStrStrip((e??``).toUpperCase()).normalize(`NFC`);if(t.length===0)return``;let n=firstCodePoint(t),r=t.lastIndexOf(` `);return r<0?n:n+firstCodePoint(t.slice(r+1))}function firstCodePoint(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function avatarColorClass(e){return e?gStrHash(e)%14+1:null}function avatarColor(e){let t=avatarColorClass(e);return ne[(t??1)-1]}function avatarMode(e){return e.hasCustomImage?`image`:e.showInitials&&e.text.length>0?`initials`:`icon`}function avatarMaxFontSize(e){return e/1.4142-Math.max(e*.4-5,0)}function avatarFontSize(e,t){let n=avatarMaxFontSize(e);return t.width>0?glibClamp(t.height*(n/t.width),0,n):n}function avatarIconSize(e){return Math.trunc(e/2)}const re=[`suggested-action`],ie={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:ie.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?re:[]}function bannerButtonVisible(e){return typeof e==`string`&&e.length>0}function bannerButtonText(e){return stripMnemonic(e)}const ae=new Set([`none`,`single`,`browse`,`multiple`]);function normalizeBoxSelectionMode(e){return typeof e==`string`&&ae.has(e)?e:`single`}function normalize(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function spanBetween(e,t,n){let r=Math.max(0,Math.min(e,t)),i=Math.min(n-1,Math.max(e,t)),a=[];for(let e=r;e<=i;e++)a.push(e);return a}function isLiveAnchor(e,t){return Number.isInteger(e)&&e>=0&&e<t}function listBoxSelect(e,t,n,r,i,a={},o=!0){let s=normalize(e,r),unchanged=()=>({selection:s,anchor:t});if(i===`none`||!o||!Number.isInteger(n)||n<0||n>=r)return unchanged();let c=new Set(s);if(i===`browse`)return{selection:[n],anchor:n};if(i===`single`){let e=c.has(n);return{selection:a.modify===!0&&e?[]:[n],anchor:a.modify===!0&&e?-1:n}}return a.extend===!0?isLiveAnchor(t,r)?{selection:spanBetween(t,n,r),anchor:t}:{selection:[n],anchor:n}:a.modify===!0?(c.has(n)?c.delete(n):c.add(n),{selection:normalize(c,r),anchor:t}):{selection:[n],anchor:n}}function listBoxSelectRow(e,t,n,r,i,a=!0){let o=normalize(e,r);return i===`none`?{selection:o,anchor:t}:n===null?{selection:[],anchor:-1}:!a||!Number.isInteger(n)||n<0||n>=r||o.includes(n)?{selection:o,anchor:t}:i===`multiple`?{selection:normalize([...o,n],r),anchor:n}:{selection:[n],anchor:n}}function listBoxUnselectRow(e,t,n,r,i){let a=normalize(e,r);return i===`none`||!a.includes(n)?{selection:a,anchor:t}:{selection:i===`multiple`?a.filter(e=>e!==n):[],anchor:t}}function listBoxSelectAll(e,t){return t!==`multiple`||e<=0?null:Array.from({length:e},(e,t)=>t)}function listBoxUnselectAll(e,t){return t===`browse`||t===`none`||e.length===0?null:[]}function normalizeBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e));return Number.isFinite(t)&&t>0?t:0}function normalizeBoxOrientation(e){return e===`vertical`?`vertical`:`horizontal`}const oe=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(e){let t=e.trim();if(!t)return null;let n=splitTopLevel(t);if(n){let e=parseBreakpointCondition(n.left),t=parseBreakpointCondition(n.right);return!e||!t?null:{op:n.op,left:e,right:t}}if(t.startsWith(`(`)&&t.endsWith(`)`))return parseBreakpointCondition(t.slice(1,-1));let r=oe.exec(t);return r?{bound:r[1].toLowerCase(),dimension:r[2].toLowerCase(),value:Number.parseFloat(r[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t,n=!1){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t,this._applied=n}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}},BreakpointBinState=class{constructor(){this._breakpoints=[],this._current=null,this._hasChild=!0}add(e){let t=this._breakpoints.length;return this._breakpoints.push({index:t,condition:parseBreakpointCondition(e.condition),setters:e.setters}),t}setHasChild(e){this._hasChild=e}get current(){return this._current?.index??null}get length(){return this._breakpoints.length}evaluate(e){if(!this._hasChild)return null;let t=null;for(let n=this._breakpoints.length-1;n>=0;n--){let r=this._breakpoints[n];if(r.condition&&evaluateBreakpointCondition(r.condition,e)){t=r;break}}if(t===this._current)return null;let n=this._current;return this._current=t,{from:n?.index??null,to:t?.index??null,writes:transitionWrites(n,t)}}inherit(e){if(e===null){this._current=null;return}let t=this._breakpoints[e];if(!t)throw RangeError(`BreakpointBinState.inherit: no breakpoint at index ${e}; ${this._breakpoints.length} added.`);this._current=t}};function transitionWrites(e,t){let n=[];if(e)for(let r of e.setters)t?.setters.some(e=>e.object===r.object&&e.property===r.property)||n.push({object:r.object,property:r.property,value:r.originalValue});if(t)for(let e of t.setters)n.push({object:e.object,property:e.property,value:e.value});return n}const se=`image-text-button`;function buttonContentIconIsEmpty(e){return e.length===0}function buttonContentIconName(e){return buttonContentIconIsEmpty(e)?`image-missing`:e}function buttonContentLabelText(e,t){return t?stripMnemonic(e):e}const ce=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],le={flat:`flat`,suggested:`suggested-action`,"suggested-action":`suggested-action`,destructive:`destructive-action`,"destructive-action":`destructive-action`,circular:`circular`,pill:`pill`};function buttonStyleClass(e){return e?le[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return ce.filter(e=>t.has(e))}const v=9999;function calendarIsLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function calendarDaysInMonth(e,t){let n=glibClamp(Math.trunc(t),1,12);return n===2?calendarIsLeapYear(e)?29:28:[0,31,28,31,30,31,30,31,31,30,31,30,31][n]}function calendarWeekStart(e,t){let n=(t+e-1)%7;return n<0||n>6?0:n}function calendarDays(e,t,n){let r=glibClamp(Math.trunc(t),1,12),i=glibClamp(Math.trunc(e),1,v),a=glibClamp(Math.trunc(n),0,6),o=calendarDaysInMonth(i,r),s=r===1?12:r-1,c=r===1?i-1:i,l=calendarDaysInMonth(c,s),u=(weekdayOfWeek(i,r,1)-a+7)%7;u===0&&(u=7);let d=[],f=l-u+1;for(let e=0;e<u;e++)d.push({date:{year:c,month:s,day:f},month:`previous`}),f+=1;let p=Math.trunc(u/7),m=u%7;for(let e=1;e<=o;e++)d.push({date:{year:i,month:r,day:e},month:`current`}),m+=1,m===7&&(p+=1,m=0);f=1;let g=r===12?1:r+1,_=r===12?i+1:i;for(;p<=5;p++){for(;m<=6;m++)d.push({date:{year:_,month:g,day:f},month:`next`}),f+=1;m=0}return d}function weekdayOfWeek(e,t,n){return((daysFromCivil(e,t,n)+4)%7+7)%7}function daysFromCivil(e,t,n){let r=t<=2?e-1:e,i=Math.floor((r>=0?r:r-399)/400),a=r-i*400,o=Math.floor((153*(t+(t>2?-3:9))+2)/5)+n-1,s=a*365+Math.floor(a/4)-Math.floor(a/100)+o;return i*146097+s-719468}function civilFromDays(e){let t=e+719468,n=Math.floor((t>=0?t:t-146096)/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=i+n*400,o=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),s=Math.floor((5*o+2)/153),c=o-Math.floor((153*s+2)/5)+1,l=s+(s<10?3:-9);return{year:a+ +(l<=2),month:l,day:c}}function calendarWeekNumber(e){let t=glibClamp(Math.trunc(e.year),1,v),n=glibClamp(Math.trunc(e.month),1,12),r=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(t,n)),i=thursdayOfWeek(daysFromCivil(t,n,r),weekdayOfWeek(t,n,r)),a=civilFromDays(i).year;return 1+Math.round((i-thursdayOfJanuaryFirst(a))/7)}function thursdayOfWeek(e,t){return e-(t+6)%7+3}function thursdayOfJanuaryFirst(e){return thursdayOfWeek(daysFromCivil(e,1,4),weekdayOfWeek(e,1,4))}function calendarNavigationButtons(e){let t=glibClamp(Math.trunc(e.year),1,v),n=glibClamp(Math.trunc(e.month),1,12),r=t===1,i=t===v;return{previousMonth:!r||n!==1,nextMonth:!i||n!==12,previousYear:!r,nextYear:!i}}function calendarStep(e,t){let n=glibClamp(Math.trunc(e.year),1,v),r=glibClamp(Math.trunc(e.month),1,12),i=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(n,r));if(t===`previous-year`||t===`next-year`){let e=n+(t===`next-year`?1:-1);return{year:glibClamp(e,1,v),month:r,day:Math.min(i,calendarDaysInMonth(e,r))}}let a=t===`next-month`?1:-1,o=glibClamp(n*12+(r-1)+a,12,119999),s=Math.floor(o/12),c=o%12+1;return{year:s,month:c,day:Math.min(i,calendarDaysInMonth(s,c))}}function calendarSelectDay(e,t,n=!0){let r=glibClamp(Math.trunc(t.year),1,v),i=glibClamp(Math.trunc(t.month),1,12),a={year:r,month:i,day:glibClamp(Math.trunc(t.day),1,calendarDaysInMonth(r,i))},o=e.day!==a.day;return{date:a,dayChanged:o,monthChanged:e.month!==a.month,yearChanged:e.year!==a.year,emitDaySignal:n&&o}}function calendarMarkDay(e,t,n){let r=Math.trunc(t);if(r<1||r>31||e[r-1]===!0===n)return e;let i=e.slice();return i[r-1]=n,i}function calendarDayIsMarked(e,t){let n=Math.trunc(t);return n<1||n>31?!1:e[n-1]===!0}function calendarClearMarks(){return Array.from({length:31},()=>!1)}const ue=.35;function clamp(e,t,n){return e>n?n:e<t?t:e}function swipeSlope(e){let t=e===`touchpad`?.997:.998;return t/(1-t)/1e3}function swipeVelocityThreshold(e){return e===`touchpad`?.6:.3}function swipeClosestPointIndex(e,t){let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);return n}function swipeNextPointIndex(e,t){for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t)<2**-52||e[n]>t)return n;return-1}function swipePreviousPointIndex(e,t){for(let n=e.length-1;n>=0;n--)if(Math.abs(e[n]-t)<2**-52||e[n]<t)return n;return-1}function swipeBounds(e,t,n){if(e.length===0)return{lower:0,upper:0};if(n)return{lower:e[0],upper:e[e.length-1]};let r=swipeClosestPointIndex(e,t),i,a;return Math.abs(e[r]-t)<.005?(i=r,a=r):(i=swipePreviousPointIndex(e,t),a=swipeNextPointIndex(e,t)),{lower:e[Math.max(i-1,0)],upper:e[Math.min(a+1,e.length-1)]}}function swipeEndProgress(e){let{points:t,progress:n,velocity:r,source:i}=e;if(e.cancelled===!0)return e.cancelProgress??n;if(t.length===0)return n;let{lower:a,upper:o}=swipeBounds(t,e.initialProgress,e.allowLongSwipes);if(Math.abs(r)<swipeVelocityThreshold(i))return clamp(t[swipeClosestPointIndex(t,n)],a,o);let s=swipeSlope(i),c;if(Math.abs(r)>2){let e=s/2/ue,t=Math.abs(r)-2+e;c=ue*t*t-ue*e*e+s*2}else c=Math.abs(r)*s;return t[swipeProjectedPointIndex(t,clamp(c*Math.sign(r)+n,a,o),e.initialProgress,r)]}function swipeProjectedPointIndex(e,t,n,r){let i=swipeClosestPointIndex(e,n),a=swipePreviousPointIndex(e,t),o=swipeNextPointIndex(e,t);if((r>0?a:o)===i){let e=r>0?o:a;if(e>=0)return e}return swipeClosestPointIndex(e,t)}var SwipeTracker=class{constructor(e){this._options=e,this._history=[],this._initialProgress=0,this._progress=0,this._cancelled=!1}get progress(){return this._progress}get initialProgress(){return this._initialProgress}prepare(e){this._initialProgress=e,this._progress=e,this._cancelled=!1}record(e,t){this._trimHistory(t),this._history.push({delta:e,time:t})}advance(e,t){if(!(t>0))return this._progress;let{lower:n,upper:r}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress=clamp(this._progress+e/t,n,r),this._progress}reset(){this._history.length=0,this._initialProgress=0,this._progress=0,this._cancelled=!1}cancel(){this._cancelled=!0}end(e,t=`touch`){this._trimHistory(e);let n=this._velocity(),r=swipeEndProgress({points:this._options.points(),initialProgress:this._initialProgress,progress:this._progress,velocity:n,allowLongSwipes:this._options.allowLongSwipes(),source:t,cancelled:this._cancelled,cancelProgress:this._options.cancelProgress?.()??this._initialProgress});return this.reset(),{velocity:n,to:r}}_trimHistory(e){let t=e-150,n=0;for(;n<this._history.length&&this._history[n].time<t;)n++;n>0&&this._history.splice(0,n)}_velocity(){if(this._history.length<2)return 0;let e=this._history[0].time,t=this._history[this._history.length-1].time;if(e===t)return 0;let n=0;for(let e=1;e<this._history.length;e++)n+=this._history[e].delta;let r=n/(t-e),{lower:i,upper:a}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress<=i&&r<0||this._progress>=a&&r>0?0:r}};function approx(e,t){return Math.abs(e-t)<2**-52}function carouselSnapPoints(e){let t=0;return e.map(e=>{let n=t+e-1;return t+=e,n})}function carouselPageAllocation(e,t){let n=0;for(let r of t){let t=r.expand?e:glibClamp(r.natural,r.minimum??0,e);n=Math.max(n,t)}return{pageSize:n,leadingInset:(e-n)/2}}function carouselRange(e,t=0){let n=e.length>0?e[e.length-1]:0;return{lower:0,upper:Math.max(0,t+n)}}function carouselClampPosition(e,t,n=0){let r=carouselRange(t,n);return glibClamp(e,r.lower,r.upper)}function carouselClosestSnapPoint(e,t){return t.length===0?-1:swipeClosestPointIndex(t,e)}function carouselPageAtPosition(e,t){return carouselClosestSnapPoint(carouselClampPosition(e,t),t)}function cRound(e){return Math.sign(e)*Math.round(Math.abs(e))}function carouselNavigateTarget(e,t,n){if(t<=0)return null;let r=cRound(e);return n===`back`?r>0?r-1:null:r<t-1?r+1:null}function carouselWheelStep(e){if(e.source===`touchpad`)return 0;let t=e.source===`mouse`,n=0;return(e.orientation===`vertical`||t)&&(e.deltaY>0?n=1:e.deltaY<0&&(n=-1)),e.orientation===`horizontal`&&n===0&&(e.deltaX>0?n=1:e.deltaX<0&&(n=-1)),n}function carouselReorderShift(e){let{closestPoint:t,oldPoint:n,newPoint:r,size:i}=e;return approx(t,n)?r-n:(approx(n,t)||n>t)&&(approx(t,r)||t>r)?i:(approx(r,t)||r>t)&&(approx(t,n)||t>n)?-i:0}function nthPageDiagnostic(e,t){return`adw_carousel_get_nth_page: assertion 'n < adw_carousel_get_n_pages (self)' failed (n = ${e}, n_pages = ${t})`}function positionDiagnostic(e,t){return`${e}: assertion 'position >= -1' failed (position = ${t})`}function unknownPageDiagnostic(e){return`AdwCarousel: no page with id '${e}'`}function nonFiniteDiagnostic(e,t){return`AdwCarousel: ${e} must be a finite double (got ${t})`}var CarouselState=class{constructor(e={}){this._children=[],this._position=0,this._wheelLockedAt=null,this._settledPage=null,this._listeners=new Set,this._pageChangedListeners=new Set,this._diagnostics=[],this._orientation=e.orientation??`horizontal`,this._interactive=e.interactive??!0,this._allowScrollWheel=e.allowScrollWheel??!0,this._allowMouseDrag=e.allowMouseDrag??!0,this._allowLongSwipes=e.allowLongSwipes??!1,this._spacing=e.spacing??0,this._revealDuration=e.revealDuration??0,this._now=e.now??(()=>Date.now()),this._onScrollTo=e.onScrollTo,this._animateScroll=e.animateScroll??!1}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}onPageChanged(e){return this._pageChangedListeners.add(e),()=>{this._pageChangedListeners.delete(e)}}_emit(e,t){let n={position:this._position,nPages:this.nPages,page:this.pageAt(this._position),interactive:t,reason:e};for(let e of[...this._listeners])e(n)}get nPages(){let e=0;for(let t of this._children)t.removing||e++;return e}get ids(){return this._children.filter(e=>!e.removing).map(e=>e.id)}get position(){return this._position}get sizes(){return this._children.map(e=>e.size)}get snapPoints(){return carouselSnapPoints(this.sizes)}get range(){return carouselRange(this.snapPoints)}_visibleSnapPoints(){return this.snapPoints.filter((e,t)=>!this._children[t].removing)}pageAt(e){return carouselPageAtPosition(e,this._visibleSnapPoints())}indexOf(e){let t=0;for(let n of this._children)if(!n.removing){if(n.id===e)return t;t++}return-1}snapPointOf(e){let t=this._nthLink(e);return t<0?void 0:this.snapPoints[t]}_nthLink(e){let t=e;for(let e=0;e<this._children.length;e++)if(!this._children[e].removing&&t--===0)return e;return-1}_closestChildIndex(e,t,n){let r=this.snapPoints,i=[],a=[];this._children.forEach((e,o)=>{e.adding&&!t||e.removing&&!n||(i.push(o),a.push(r[o]))});let o=carouselClosestSnapPoint(e,a);return o<0?-1:i[o]}_updateShiftPositionFlag(e){let t=this._closestChildIndex(this._position,!1,!0);t<0||(this._children[e].shiftPosition=t>=e)}_updateShiftFlags(){this._children.forEach((e,t)=>{(e.adding||e.removing)&&this._updateShiftPositionFlag(t)})}setPosition(e,t=!1){if(!Number.isFinite(e))return this._diagnostics.push(nonFiniteDiagnostic(`position`,e)),!1;let n=carouselClampPosition(e,this.snapPoints),r=n!==this._position;return this._position=n,this._updateShiftFlags(),this._emit(`position`,t),r}scrollTo(e,t={}){let n=this.nPages;if(!Number.isInteger(e)||e<0||e>=n)return this._diagnostics.push(nthPageDiagnostic(e,n)),!1;let r=t.interactive??!1,i=t.animate??this._animateScroll,a=this.snapPointOf(e);return this._onScrollTo?.({index:e,position:a,interactive:r,animate:i}),i||(this.setPosition(a,r),this.settle()),!0}settle(){let e=this.pageAt(this._position);this._settledPage=e;for(let t of[...this._pageChangedListeners])t(e)}settleIfArrived(e=.01){let t=this.pageAt(this._position),n=this.snapPointOf(t);return n===void 0||Math.abs(this._position-n)>=e?(this._settledPage=null,!1):this._settledPage===t?!1:(this.settle(),!0)}navigate(e){if(!this._interactive)return!1;let t=carouselNavigateTarget(this._position,this.nPages,e);return t===null?!1:this.scrollTo(t,{interactive:!0})}handleWheel(e){if(!this._allowScrollWheel||this._wheelLockedAt!==null&&this._now()-this._wheelLockedAt<150||!this._interactive)return 0;let t=this.nPages;if(t===0)return 0;let n=carouselWheelStep({...e,orientation:this._orientation});if(n===0)return 0;let r=glibClamp(this.pageAt(this._position)+n,0,t-1);return this.scrollTo(r,{interactive:!0}),this._wheelLockedAt=this._now(),n}insertPage(e,t=-1){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_insert`,t)),!1;let n={id:e,size:0,adding:!0,removing:!1,shiftPosition:!1},r=t>=0?this._nthLink(t):-1,i=r<0?this._children.length:r;return this._children.splice(i,0,n),this._updateShiftPositionFlag(i),this._emit(`n-pages`,!1),!0}removePage(e){let t=this._children.findIndex(t=>t.id===e&&!t.removing);if(t<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let n=this._children[t];return n.removing=!0,this._updateShiftPositionFlag(t),n.adding&&this._children.splice(t,1),this._emit(`n-pages`,!1),!0}reorderPage(e,t){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_reorder`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;if(t===n)return!1;let r=this._closestChildIndex(this._position,!0,!0),i=this.snapPoints,a=r<0?0:i[r],o=i[n],s=this.nPages,c=t<0||t>s?s:t;if(n===s-1&&c===s)return!1;let l;l=c===s?-1:c>n?this._nthLink(c+1):this._nthLink(c);let u;u=l>=0?c>n?i[l-1]:i[l]:i[i.length-1];let[d]=this._children.splice(n,1);l<0?this._children.push(d):this._children.splice(l>n?l-1:l,0,d);let f=carouselReorderShift({closestPoint:a,oldPoint:o,newPoint:u,size:d.size});return f===0?(this._emit(`geometry`,!1),!0):(this._position=carouselClampPosition(this._position+f,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0)}setPageSize(e,t){if(!Number.isFinite(t))return this._diagnostics.push(nonFiniteDiagnostic(`size of page '${e}'`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let r=this._children[n],i=t-r.size,a=r.shiftPosition&&i!==0;return r.size=t,r.removing&&t<=0?this._children.splice(n,1):r.adding&&t>=1&&(r.adding=!1),a?(this._position=carouselClampPosition(this._position+i,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0):(this._emit(`geometry`,!1),!0)}skipReveal(e){let t=this._children.find(t=>t.id===e);return!t||!t.adding&&!t.removing?!1:this.setPageSize(e,+!t.removing)}get orientation(){return this._orientation}setOrientation(e){return e===this._orientation?!1:(this._orientation=e,this._emit(`geometry`,!1),!0)}get interactive(){return this._interactive}setInteractive(e){let t=!!e;return t===this._interactive?!1:(this._interactive=t,!0)}get allowScrollWheel(){return this._allowScrollWheel}setAllowScrollWheel(e){let t=!!e;return t===this._allowScrollWheel?!1:(this._allowScrollWheel=t,!0)}get allowMouseDrag(){return this._allowMouseDrag}setAllowMouseDrag(e){let t=!!e;return t===this._allowMouseDrag?!1:(this._allowMouseDrag=t,!0)}get allowLongSwipes(){return this._allowLongSwipes}setAllowLongSwipes(e){let t=!!e;return t===this._allowLongSwipes?!1:(this._allowLongSwipes=t,!0)}get spacing(){return this._spacing}setSpacing(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`spacing`,e)),!1):e===this._spacing?!1:(this._spacing=e,this._emit(`geometry`,!1),!0)}get revealDuration(){return this._revealDuration}setRevealDuration(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`reveal-duration`,e)),!1):e===this._revealDuration?!1:(this._revealDuration=e,!0)}pageDistance(e){return e+this._spacing}get diagnostics(){return this._diagnostics}};function resolveCheckState(e,t){return t?`indeterminate`:e?`checked`:`unchecked`}var RadioGroupState=class{constructor(){this._selected=new Map,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){for(let t of[...this._listeners])t(e)}selected(e){return this._selected.get(e)??null}select(e,t){let n=this._selected.get(e);return n===t?!1:(this._selected.set(e,t),this._emit({name:e,selected:t,deselected:n??null}),!0)}};function adwLerp(e,t,n){return e*(1-n)+t*n}function inverseLerp(e,t,n){return(n-e)/(t-e)}function easeOutCubic(e){let t=e-1;return t*t*t+1}function easeInOutSine(e){return-.5*(Math.cos(Math.PI*e)-1)}const y={maximumSize:600,tighteningThreshold:400};function clampThresholds(e){let t=Math.max(Math.min(e.tighteningThreshold,e.maximumSize),e.childMin),n=Math.max(t,e.maximumSize);return{lower:t,max:n,upper:t+3*(n-t)}}function childSizeFrom(e,t,n){let{lower:r,max:i,upper:a}=t;return e<0?Math.min(n,Math.ceil(i)):e<=r?e:e>=a?Math.ceil(i):Math.floor(adwLerp(r,i,easeOutCubic(inverseLerp(r,a,e))))}const b=[`small`,`medium`,`large`];function clampAllocate(e,t){let n=clampThresholds(t),r=Math.ceil(n.max),i=Math.ceil(n.lower),a=childSizeFrom(e,n,t.childNat);return{childSize:a,childMaximum:r,lowerThreshold:i,sizeClass:a>=r?`large`:a<=i?`small`:`medium`,offset:Math.trunc((e-a)/2)}}function normalizeClampSize(e,t){let n=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(n)?Math.max(0,Math.trunc(n)):t}const de={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:de.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const fe=[`undershoot-top`,`undershoot-bottom`],pe=[`raised`,`border`];function toolbarViewClasses(e){let t=[];return e.topBarStyle===`flat`&&!e.extendContentToTopEdge&&e.topBarHeight>0&&t.push(`undershoot-top`),e.bottomBarStyle===`flat`&&!e.extendContentToBottomEdge&&e.bottomBarHeight>0&&t.push(`undershoot-bottom`),{view:t,topBar:toolbarBarStyleClasses(e.topBarStyle),bottomBar:toolbarBarStyleClasses(e.bottomBarStyle)}}function spinnerGeometry(e,t){let n=Math.min(Math.floor(Math.min(e,t)/2),64/2),r=n*2;return{radius:n,diameter:r,lineWidth:r/8,centerX:Math.round(e/2),centerY:Math.round(t/2)}}function resolveSpinnerSize(e){let t=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(t)?Math.max(t,16):16}function resolvePageTitle(e,t){return e??t}const me=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return me.test(t)?t:``}function nameNotFoundDiagnostic(e){return`Child name '${e}' not found in AdwViewStack`}function duplicateNameDiagnostic(e){return`While adding page: duplicate child name in AdwViewStack: ${e}`}var ViewStackState=class{constructor(){this._pages=[],this._visibleIndex=-1,this._listeners=new Set,this._diagnostics=[],this._pagesView=null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t=this._pageAt(this._visibleIndex),n={index:this._visibleIndex,name:t?.name??``,title:t?.title??``,page:t,interactive:e};for(let e of[...this._listeners])e(n)}_pageAt(e){return e>=0&&e<this._pages.length?this._pages[e]:void 0}_firstVisibleIndex(){return this._pages.findIndex(e=>e.visible)}_record(e){return{name:e.name,title:resolvePageTitle(e.title,e.name),icon:normalizeIconName(e.icon),content:e.content,visible:e.visible??!0,badgeNumber:Number.isFinite(e.badgeNumber)?Math.trunc(e.badgeNumber):0,needsAttention:e.needsAttention===!0,useUnderline:e.useUnderline===!0,startsSection:e.startsSection===!0,sectionTitle:e.sectionTitle??``}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}get count(){return this._pages.length}indexOfName(e){return this._pages.findIndex(t=>t.name===e)}isSelected(e){return!Number.isInteger(e)||e<0||e>=this._pages.length?!1:e===this._visibleIndex}addPage(e){return this._insertRecord(this._record(e),this._pages.length)}insertPage(e,t){return!Number.isInteger(t)||t<0||t>this._pages.length?null:this._insertRecord(this._record(e),t)}_insertRecord(e,t){return this.indexOfName(e.name)>=0&&this._diagnostics.push(duplicateNameDiagnostic(e.name)),this._pages.splice(t,0,e),this._pagesView=null,this._visibleIndex<0?(e.visible&&(this._visibleIndex=t,this._emit(!1)),e):(t<=this._visibleIndex&&(this._visibleIndex+=1),e)}movePage(e,t){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||e>=this._pages.length||t<0||t>=this._pages.length||e===t)return!1;let[n]=this._pages.splice(e,1);if(this._pages.splice(t,0,n),this._pagesView=null,this._visibleIndex===e)this._visibleIndex=t;else{let n=this._visibleIndex;n>e&&--n,n>=t&&(n+=1),this._visibleIndex=n}return!0}removePage(e){let t=this.indexOfName(e);return t<0?!1:(this._pages.splice(t,1),this._pagesView=null,t===this._visibleIndex?this._visibleIndex=-1:t<this._visibleIndex&&--this._visibleIndex,!0)}get visibleIndex(){return this._visibleIndex}setVisibleIndex(e,t=!0){return!Number.isInteger(e)||e<0||e>=this._pages.length||e===this._visibleIndex||!this._pages[e].visible?!1:(this._visibleIndex=e,this._emit(t),!0)}get visibleName(){return this._pageAt(this._visibleIndex)?.name??``}setVisibleName(e,t=!0){if(e==null)return!1;let n=this.indexOfName(e);return n<0?(this._diagnostics.push(nameNotFoundDiagnostic(e)),!1):this.setVisibleIndex(n,t)}get visiblePage(){return this._pageAt(this._visibleIndex)}get visibleTitle(){return this._pageAt(this._visibleIndex)?.title??``}setPageVisible(e,t){let n=this.indexOfName(e);if(n<0)return this._diagnostics.push(nameNotFoundDiagnostic(e)),!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(r.visible=i,this._visibleIndex<0&&i?(this._visibleIndex=n,this._emit(!1),!0):this._visibleIndex===n&&!i?(this._visibleIndex=this._firstVisibleIndex(),this._emit(!1),!0):!1)}get duplicateNames(){let e=new Set,t=[];for(let n of this._pages)e.has(n.name)?t.includes(n.name)||t.push(n.name):e.add(n.name);return t}get diagnostics(){return this._diagnostics}};function tabsRevealed(e){return e.autohide?e.nPages>1||e.nPinnedPages>=1||e.isTransferringPage:!0}function tabCloseVisible(e){return e.pinned?!1:e.hovering&&e.fullyVisible||e.selected||e.dragging}function tabTooltip(e){return e.tooltip===``?e.title:e.tooltip}function tabSearchMatches(e,t){if(t===``)return!0;let n=foldForSearch(t);return[e.title,e.tooltip,e.keyword].some(e=>e===``?!1:foldForSearch(e).includes(n))}function foldForSearch(e){return e.normalize(`NFKC`).toLocaleLowerCase()}function tabIconState(e,t){let n=e.indicatorIcon,r=e.icon;return!e.loading&&e.pinned&&r===null&&(r=t),{icon:r,spinner:e.loading,iconVisible:(r!==null||e.loading)&&(!e.pinned||n===null),indicatorVisible:n!==null}}function isDescendantOfPage(e,t,n){let r=t;for(;r!==null&&r!==n;)r=e.find(e=>e.id===r)?.parentId??null;return r===n}function successorAfterClose(e,t,n){if(t!==n)return n;let r=e.findIndex(e=>e.id===t);if(r<0)return n;let i=e[r].parentId;if(i!==null&&r>0){let t=e[r-1];if(isDescendantOfPage(e,t.id,i))return t.id;let n=e.find(e=>e.id===i);if(n&&t.pinned&&n.pinned)return n.id}return r<e.length-1?e[r+1].id:r>0?e[r-1].id:null}function assertionDiagnostic(e,t){return`${e}: assertion '${t}' failed`}var TabViewState=class{constructor(e={}){this._stack=new ViewStackState,this._selectionListeners=new Set,this._pagesListeners=new Set,this._diagnostics=[],this._selectedId=null,this._deferSelection=!1,this._deferredSelection=null,this._pagesSource=null,this._pagesView=null,this._handlers=e,this._stack.subscribe(e=>{let t=this._selectedId,n=e.page?.content?.id??null;this._selectedId=n;let r={selectedId:n,selectedIndex:e.index,previousId:t,interactive:e.interactive};this._deferSelection?this._deferredSelection=r:this._emitSelection(r)})}subscribe(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}subscribePages(e){return this._pagesListeners.add(e),()=>{this._pagesListeners.delete(e)}}_emitSelection(e){for(let t of[...this._selectionListeners])t(e)}_emitPages(e){for(let t of[...this._pagesListeners])t(e)}_flushDeferredSelection(){let e=this._deferredSelection;e&&(this._deferredSelection=null,this._emitSelection(e))}get pages(){let e=this._stack.pages;return(this._pagesSource!==e||this._pagesView===null)&&(this._pagesSource=e,this._pagesView=Object.freeze(e.map(e=>e.content))),this._pagesView}get nPages(){return this._stack.count}get nPinnedPages(){let e=this.pages.findIndex(e=>!e.pinned);return e<0?this.pages.length:e}getNthPage(e){return!Number.isInteger(e)||e<0||e>=this.nPages?null:this.pages[e]}getPagePosition(e){return this._stack.indexOfName(e)}getPage(e){return this._recordOf(e)}isClosing(e){return this._recordOf(e)?.closing??!1}get diagnostics(){return this._diagnostics}get selectedId(){return this._stack.visiblePage?.content?.id??null}get selectedIndex(){return this._stack.visibleIndex}get selectedPage(){return this._stack.visiblePage?.content??null}setSelectedPage(e,t=!0){if(e!==null&&typeof e!=`string`)return this.pages.includes(e)?this.setSelectedPage(e.id,t):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1);let n=typeof e==`string`?e:null;if(n===null)return this.nPages>0&&this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`ADW_IS_TAB_PAGE (selected_page)`)),!1;let r=this.getPagePosition(n);return r<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1):this._stack.setVisibleIndex(r,t)}selectNthPage(e){return this._stack.setVisibleIndex(e,!0)}selectPreviousPage(){let e=this.selectedIndex;return e<=0?!1:this._stack.setVisibleIndex(e-1,!0)}selectNextPage(){let e=this.selectedIndex;return e<0||e>=this.nPages-1?!1:this._stack.setVisibleIndex(e+1,!0)}selectFirstPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage(t?0:this.nPinnedPages);return n===e&&!t&&(n=this.getNthPage(0)),!n||n===e?!1:this.setSelectedPage(n.id)}selectLastPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage((t?this.nPinnedPages:this.nPages)-1);return n===e&&t&&(n=this.getNthPage(this.nPages-1)),!n||n===e?!1:this.setSelectedPage(n.id)}cycleNextPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectNextPage()?!0:this._stack.setVisibleIndex(0,!0)}cyclePreviousPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectPreviousPage()?!0:this._stack.setVisibleIndex(this.nPages-1,!0)}addPage(e,t=null){if(t===null)return this._insert(e,this.nPages,!1,null);let n=this.getPagePosition(t);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_add_page`,`page_belongs_to_this_view (self, parent)`)),-1;let r=this.pages[n].pinned?this.nPinnedPages-1:n;do if(r++,r>=this.nPages)break;while(isDescendantOfPage(this.pages,this.pages[r].id,t));return this._insert(e,r,!1,t)}insertPage(e,t){return!Number.isInteger(t)||t<this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position >= self->n_pinned_pages`)),-1):t>this.nPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position <= self->n_pages`)),-1):this._insert(e,t,!1,null)}prependPage(e){return this._insert(e,this.nPinnedPages,!1,null)}appendPage(e){return this._insert(e,this.nPages,!1,null)}insertPinnedPage(e,t){return!Number.isInteger(t)||t<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position >= 0`)),-1):t>this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position <= self->n_pinned_pages`)),-1):this._insert(e,t,!0,null)}prependPinnedPage(e){return this._insert(e,0,!0,null)}appendPinnedPage(e){return this._insert(e,this.nPinnedPages,!0,null)}_insert(e,t,n,r){if(this.getPagePosition(e.id)>=0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`page id '${e.id}' is unique`)),-1;let i={id:e.id,title:e.title??``,tooltip:e.tooltip??``,keyword:e.keyword??``,icon:e.icon??null,indicatorIcon:e.indicatorIcon??null,loading:e.loading??!1,needsAttention:e.needsAttention??!1,pinned:n,parentId:r,closing:!1,content:e.content};return this._deferSelection=!0,this._stack.insertPage({name:i.id,content:i},t),this._deferSelection=!1,this._emitPages({kind:`attached`,id:i.id,position:t,previousPosition:-1}),this._flushDeferredSelection(),t}setPagePinned(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_page_pinned`,`page_belongs_to_this_view (self, page)`)),-1;let r=this._recordAt(n),i=!!t;if(r.pinned===i)return-1;let a=i?this.nPinnedPages:this.nPinnedPages-1;return r.pinned=i,n!==a&&this._stack.movePage(n,a),this._emitPages({kind:`pinned`,id:e,position:a,previousPosition:n}),a}closePage(e){let t=this._recordOf(e);if(!t)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page`,`page_belongs_to_this_view (self, page)`)),!1;if(t.closing)return!1;t.closing=!0;let n=this._handlers.onClosePage?this._handlers.onClosePage(t):!t.pinned;return n!==`defer`&&this.closePageFinish(e,n),!0}closePageFinish(e,t){let n=this._recordOf(e);return n?n.closing?(n.closing=!1,t?this.detachPage(e)!==null:!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page->closing`)),!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page_belongs_to_this_view (self, page)`)),!1)}detachPage(e){let t=this.getPagePosition(e);if(t<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_detach_page`,`page_belongs_to_this_view (self, page)`)),null;let n=this._recordAt(t),r=successorAfterClose(this.pages,e,this.selectedId);r!==null&&r!==this.selectedId&&this.setSelectedPage(r,!1);let i=this.selectedId===e;this._stack.removePage(e);for(let t of this._records())t.parentId===e&&(t.parentId=n.parentId);return i&&(this._selectedId=null,this._emitSelection({selectedId:null,selectedIndex:-1,previousId:e,interactive:!1})),this._emitPages({kind:`detached`,id:e,position:t,previousPosition:t}),n}closeOtherPages(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_other_pages`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>=0;e--)e!==t&&this.closePage(n[e])}closePagesBefore(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_before`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=t-1;e>=0;e--)this.closePage(n[e])}closePagesAfter(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_after`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>t;e--)this.closePage(n[e])}reorderPage(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, page)`)),!1;let r=this.pages[n].pinned,i=r?0:this.nPinnedPages,a=r?this.nPinnedPages:this.nPages;return!Number.isInteger(t)||t<i||t>=a?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,r?`position < self->n_pinned_pages`:`position >= self->n_pinned_pages`)),!1):n===t?!1:(this._stack.movePage(n,t),this._emitPages({kind:`reordered`,id:e,position:t,previousPosition:n}),!0)}reorderBackward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t<=(this.pages[t].pinned?0:this.nPinnedPages)?!1:this.reorderPage(e,t-1)}reorderForward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t>=(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1?!1:this.reorderPage(e,t+1)}reorderFirst(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,this.pages[t].pinned?0:this.nPinnedPages)}reorderLast(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1)}_reorderMissing(e){return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, '${e}')`)),!1}setPageTitle(e,t){return this._update(e,e=>{let n=t??``;return e.title===n?!1:(e.title=n,!0)})}setPageTooltip(e,t){return this._update(e,e=>{let n=t??``;return e.tooltip===n?!1:(e.tooltip=n,!0)})}setPageKeyword(e,t){return this._update(e,e=>{let n=t??``;return e.keyword===n?!1:(e.keyword=n,!0)})}setPageIcon(e,t){return this._update(e,e=>e.icon===t?!1:(e.icon=t,!0))}setPageIndicatorIcon(e,t){return this._update(e,e=>e.indicatorIcon===t?!1:(e.indicatorIcon=t,!0))}setPageLoading(e,t){return this._update(e,e=>{let n=!!t;return e.loading===n?!1:(e.loading=n,!0)})}setPageNeedsAttention(e,t){return this._update(e,e=>{let n=!!t;return e.needsAttention===n?!1:(e.needsAttention=n,!0)})}_update(e,t){let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_page_set_property`,`ADW_IS_TAB_PAGE (self)`)),!1):t(this._recordAt(n))?(this._emitPages({kind:`updated`,id:e,position:n,previousPosition:n}),!0):!1}_records(){return this._stack.pages.map(e=>e.content)}_recordAt(e){return this._stack.pages[e].content}_recordOf(e){let t=this.getPagePosition(e);return t<0?null:this._recordAt(t)}};const he=new Set([`normal`,`section`,`subtotal`,`total`]);function dataGridTracks(e){let t=e.some(e=>e.width!==void 0||e.flex!==void 0);return e.map((e,n)=>e.width===void 0?e.flex===void 0?!t&&n===0?{kind:`slack`}:{kind:`auto`}:{kind:`flex`,weight:e.flex}:{kind:`fixed`,css:e.width})}function dataGridTrackTemplate(e){return e.map(e=>{switch(e.kind){case`fixed`:return e.css;case`flex`:return`${e.weight}fr`;case`slack`:return`minmax(0px, 1fr)`;case`auto`:return`auto`}}).join(` `)}function dataGridColumnAlign(e){return e.align??(e.numeric?`end`:`start`)}function dataGridColumnClasses(e){let t=[`adw-data-grid-cell`,`align-${dataGridColumnAlign(e)}`];return e.numeric&&t.push(`numeric`),e.monospace&&t.push(`mono`),t}function dataGridCellText(e){return e==null?``:String(e)}function normalizeDataGridVariant(e){return typeof e==`string`&&he.has(e)?e:`normal`}function normalizeDataGridColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>({key:String(e.key),label:e.label===void 0?void 0:String(e.label),align:e.align,width:e.width===void 0?void 0:String(e.width),flex:typeof e.flex==`number`?e.flex:void 0,monospace:e.monospace===!0,numeric:e.numeric===!0})):[]}function dataGridRowInteractive(e,t,n){return e===`normal`&&t!==!1&&(t===!0||n)}var AdwAlertResponses=class{constructor(e=``,t=``){this._responses=[],this._defaultResponse=null,this._closeResponse=`close`,this._heading=e??``,this._body=t??``}get heading(){return this._heading}set heading(e){this._heading=e??``}get body(){return this._body}set body(e){this._body=e??``}addResponse(e,t,n={}){let r=this._responses.find(t=>t.id===e);if(r){r.label=t,n.appearance!==void 0&&(r.appearance=n.appearance),n.enabled!==void 0&&(r.enabled=n.enabled);return}this._responses.push({id:e,label:t,appearance:n.appearance??`default`,enabled:n.enabled??!0})}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}hasResponse(e){return this._responses.some(t=>t.id===e)}setResponseAppearance(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.appearance=t)}getResponseAppearance(e){return this._responses.find(t=>t.id===e)?.appearance??`default`}setResponseEnabled(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.enabled=t)}getResponseEnabled(e){return this._responses.find(t=>t.id===e)?.enabled??!0}get responses(){return this._responses}get defaultResponse(){return this._defaultResponse}set defaultResponse(e){this._defaultResponse=e}get closeResponse(){return this._closeResponse}set closeResponse(e){this._closeResponse=e||`close`}get usesActionSheet(){return this._responses.length>3}orderResponses(){let e=this._responses.find(e=>e.id===this._defaultResponse)??this._responses[0],t=this._responses.filter(t=>t!==e);return{ok:e,cancel:t[t.length-1],neutral:t.length>=2?t[0]:void 0}}resolveById(e){return e!=null&&this.hasResponse(e)?e:this._closeResponse}resolveLabel(e){return e==null?this._closeResponse:this.resolveById(this._responses.find(t=>t.label===e)?.id)}};function resolveBottomSheetClose(e,t){let n=!!t.open,r=!!t.canClose;switch(e){case`drag-handle`:return`ignored`;case`swipe`:return n&&r?`close`:`ignored`;case`dimming`:return n?r?`close`:`close-attempt`:`ignored`;case`close-button`:return r?n?`close`:`delegate`:`close-attempt`;case`escape`:return r&&n?`close`:`close-attempt`}}function resolveBottomSheetOpen(e,t){if(e===`drag-handle`)return`ignored`;let n=resolveBottomSheetChrome(t);return n.layer!==`bottom-bar`||!n.surfaceVisible||n.bottomBarInert?`ignored`:`open`}function resolveBottomSheetChrome(e){let t=!!e.open,n=!!e.hasBottomBar,r=e.revealBottomBar??!0;return{layer:t||!n?`sheet`:`bottom-bar`,surfaceVisible:t||n&&r,bottomBarInert:!e.canOpen,dimmed:t&&(e.modal??!0)}}var BottomSheetPresentation=class{constructor(e={}){this._open=!1,this._canClose=!0,this._canOpen=!0,this._hasBottomBar=!1,this._revealBottomBar=!0,this._modal=!0,this._hasBeenOpen=!1,this._listeners=new Set,this._onClosing=e.onClosing,this._onClosed=e.onClosed}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._open)}get open(){return this._open}get canClose(){return this._canClose}get hasBeenOpen(){return this._hasBeenOpen}get canOpen(){return this._canOpen}get hasBottomBar(){return this._hasBottomBar}get revealBottomBar(){return this._revealBottomBar}get modal(){return this._modal}get chrome(){return resolveBottomSheetChrome(this)}setCanClose(e){let t=!!e;return t===this._canClose?!1:(this._canClose=t,!0)}setCanOpen(e){let t=!!e;return t===this._canOpen?!1:(this._canOpen=t,!0)}setHasBottomBar(e){let t=!!e;return t===this._hasBottomBar?!1:(this._hasBottomBar=t,!0)}setModal(e){let t=!!e;return t===this._modal?!1:(this._modal=t,!0)}setRevealBottomBar(e){let t=!!e;return t===this._revealBottomBar?!1:(this._revealBottomBar=t,!0)}setOpen(e){let t=!!e;return this._open===t?(!this._hasBeenOpen&&!t&&(this._onClosing?.(),this._onClosed?.()),!1):(this._open=t,t&&(this._hasBeenOpen=!0),!t&&(this._onClosing?.(),this._open!==t)?!1:(this._emit(),!0))}requestClose(e){let t=resolveBottomSheetClose(e,this);return t===`close`&&this.setOpen(!1),t}requestOpen(e){let t=resolveBottomSheetOpen(e,this);return t===`open`&&this.setOpen(!0),t}finishClose(){return this._open?!1:(this._onClosed?.(),!0)}};const x=65535,ge=`Apply`;function entryTextLength(e){return[...e??``].length}function clampEntryText(e,t){let n=e??``;if(!Number.isFinite(t)||t<=0)return n;let r=``,i=0;for(let e of n){if(i>=t)break;r+=e,i++}return r}var EntryRowState=class{constructor(){this._text=``,this._maxLength=0,this._editing=!1,this._editable=!0,this._showApplyButton=!1,this._showIndicator=!1,this._textChanged=!1,this._activatesDefault=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_update(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){let e=entryTextLength(this._text),t=e===0&&!(this._editing&&this._editable)&&!this._textChanged;return{text:this._text,textLength:e,empty:t,editing:this._editing,editable:this._editable,textChanged:this._textChanged,editIconVisible:!this._textChanged&&(!this._editing||!this._editable),editIconSensitive:this._editable,indicatorVisible:this._editing&&this._showIndicator,applyButtonVisible:this._textChanged,emptyTarget:+!t}}get text(){return this._text}setText(e){let t=clampEntryText(e??``,this._maxLength);return t===this._text?!1:(this._text=t,this._latchAndUpdate(),!0)}_latchAndUpdate(){this._showApplyButton&&this._editing&&(this._textChanged=!0),this._update()}get textLength(){return entryTextLength(this._text)}get maxLength(){return this._maxLength}setMaxLength(e){let t=Number.isFinite(e)?Math.min(x,Math.max(0,Math.trunc(e))):0;if(t===this._maxLength)return!1;this._maxLength=t;let n=clampEntryText(this._text,t);return n!==this._text&&(this._text=n,this._latchAndUpdate()),!0}get editing(){return this._editing}setEditing(e){let t=!!e;return t===this._editing?!1:(this._editing=t,this._update(),!0)}get editable(){return this._editable}setEditable(e){let t=!!e;return t===this._editable?!1:(this._editable=t,this._update(),!0)}get showApplyButton(){return this._showApplyButton}setShowApplyButton(e){let t=!!e;return t===this._showApplyButton?!1:(this._showApplyButton=t,!t&&this._textChanged&&(this._textChanged=!1,this._update()),!0)}setShowIndicator(e){this._showIndicator=!!e,this._update()}get activatesDefault(){return this._activatesDefault}setActivatesDefault(e){let t=!!e;return t===this._activatesDefault?!1:(this._activatesDefault=t,!0)}get textChanged(){return this._textChanged}apply(){this._textChanged=!1,this._update()}activate(){return this._textChanged?(this.apply(),{signal:`apply`}):{signal:`entry-activated`,activateDefault:this._activatesDefault}}},PasswordEntryRowState=class{constructor(e){this._revealed=!1,this._capsLockOn=!1,this._listeners=new Set,this._entry=e}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){return{revealed:this._revealed,capsLockOn:this._capsLockOn,peekIconName:this._revealed?`view-conceal-symbolic`:`view-reveal-symbolic`,peekLabel:this._revealed?`Hide Password`:`Show Password`,indicatorIconName:`caps-lock-symbolic`,indicatorTooltip:`Caps Lock is on`}}get revealed(){return this._revealed}setRevealed(e){let t=!!e;return t===this._revealed?!1:(this._revealed=t,this._pushIndicator(),this._emit(),!0)}togglePeek(){return this.setRevealed(!this._revealed)}get capsLockOn(){return this._capsLockOn}setCapsLockOn(e){let t=!!e;return t===this._capsLockOn?!1:(this._capsLockOn=t,this._pushIndicator(),this._emit(),!0)}_pushIndicator(){this._entry.setShowIndicator(!this._revealed&&this._capsLockOn)}};function gridColumns(e,t=1){if(e.length===0)return 0;let n=e[0],r=1;for(;r<e.length&&Math.abs(e[r]-n)<=t;)r++;return r}function gridNavigate(e,t,n,r){if(n<=0||t<0||t>=n)return null;let i=Math.max(1,Math.floor(r)),a;switch(e){case`ArrowLeft`:a=t-1;break;case`ArrowRight`:a=t+1;break;case`ArrowUp`:a=t-i;break;case`ArrowDown`:a=t+i;break;case`Home`:a=0;break;case`End`:a=n-1;break;default:return null}return a<0||a>=n||a===t?null:a}var AdwToast=class{constructor(e=``,t={}){this.title=e,this.timeout=t.timeout??5e3,this.buttonLabel=t.buttonLabel??``}get hasButton(){return this.buttonLabel.length>0}},AdwToastQueue=class{constructor(e){this._pending=[],this._current=null,this._timer=null,this._scheduler=e.scheduler,this._handlers={onShow:e.onShow,onHide:e.onHide}}get current(){return this._current}get showing(){return this._current!==null}get pending(){return this._pending.length}add(e){this._current===null?this._show(e):this._pending.push(e)}dismiss(){if(this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e);let t=this._pending.shift();t&&this._show(t)}clear(){if(this._pending.length=0,this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e)}_show(e){this._current=e,this._handlers.onShow(e),e.timeout>0&&(this._timer=this._scheduler.schedule(()=>{this._current===e&&this.dismiss()},e.timeout))}_clearTimer(){this._timer!==null&&(this._scheduler.cancel(this._timer),this._timer=null)}};function normalizeComboOptions(e){return Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return{value:e,label:e};let t=e?.value===void 0?String(e?.label??``):String(e.value);return{value:t,label:e?.label===void 0?t:String(e.label)}}):[]}function parseListModel(e){if(!e)return[];try{return normalizeComboOptions(JSON.parse(e))}catch{return[]}}function clampListSelection(e,t){return Number.isFinite(e)&&e>=0&&e<t?e:t===0?-1:0}function sameItem(e,t){return e!==void 0&&t!==void 0&&e.value===t.value&&e.label===t.label}function listItemsChanged(e,t){let n=e??[],r=t??[],i=Math.min(n.length,r.length),a=0;for(;a<i&&sameItem(n[a],r[a]);)a++;let o=0;for(;o<i-a&&sameItem(n[n.length-1-o],r[r.length-1-o]);)o++;let s=n.length-a-o,c=r.length-a-o;return s===0&&c===0?null:{position:a,removed:s,added:c}}const _e=new Set([`none`,`single`,`multiple`]);function normalizeListSelectionMode(e){return typeof e==`string`&&_e.has(e)?e:`single`}function normalizeSelection(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function listViewSelect(e,t,n,r,i,a={}){let o=normalizeSelection(e,r);if(i===`none`)return{selection:[],anchor:t};if(!Number.isInteger(n)||n<0||n>=r)return{selection:o,anchor:t};let s=new Set(o);if(i===`multiple`&&a.extend&&t>=0&&t<r){let e=Math.min(t,n),i=Math.max(t,n),o=[];for(let t=e;t<=i;t++)o.push(t);if(a.modify)if(s.has(t))for(let e of o)s.add(e);else for(let e of o)s.delete(e);else{s.clear();for(let e of o)s.add(e)}return{selection:normalizeSelection(s,r),anchor:n}}return a.modify?s.has(n)?i===`multiple`&&s.delete(n):(i===`multiple`||s.clear(),s.add(n)):(s.clear(),s.add(n)),{selection:normalizeSelection(s,r),anchor:n}}function listViewSelectAll(e,t){return t===`multiple`?Array.from({length:e},(e,t)=>t):[]}var ListViewState=class{constructor(){this._model=[],this._selection=[],this._anchor=-1,this._mode=`single`,this._itemListeners=new Set,this._selectionListeners=new Set}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.delete(e)}}subscribeSelection(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}get model(){return this._model.map(e=>({value:e.value,label:e.label}))}get count(){return this._model.length}get selection(){return[...this._selection]}get selectionMode(){return this._mode}setModel(e){let t=Array.isArray(e)?e:[],n=listItemsChanged(this._model,t);this._model=t.map(e=>({value:e.value,label:e.label}));let r=normalizeSelection(this._selection,this._model.length),i=r.length!==this._selection.length;if(this._selection=r,this._anchor>=this._model.length&&(this._anchor=-1),n)for(let e of[...this._itemListeners])e(n);i&&this._emitSelection(!1)}setSelectionMode(e){e!==this._mode&&(this._mode=e,e===`none`&&this._selection.length>0?(this._selection=[],this._emitSelection(!1)):e===`single`&&this._selection.length>1&&(this._selection=this._selection.includes(this._anchor)?[this._anchor]:[this._selection[0]],this._emitSelection(!1)))}isSelected(e){return this._selection.includes(e)}selectItem(e,t={},n=!0){let r=listViewSelect(this._selection,this._anchor,e,this._model.length,this._mode,t);return this._anchor=r.anchor,this._applySelection(r.selection,n)}selectAll(e=!1){return this._applySelection(listViewSelectAll(this._model.length,this._mode),e)}unselectAll(e=!1){return this._applySelection([],e)}setSelection(e,t=!1){let n=normalizeSelection(e,this._model.length),r=this._mode===`none`?[]:this._mode===`single`?n.slice(0,1):n;return r.length>0&&(this._anchor=r[r.length-1]),this._applySelection(r,t)}itemContext(e){let t=this._model[e];return t===void 0?null:{item:{value:t.value,label:t.label},position:e,selected:this.isSelected(e)}}_applySelection(e,t){return e.length===this._selection.length&&e.every((e,t)=>e===this._selection[t])?!1:(this._selection=e,this._emitSelection(t),!0)}_emitSelection(e){let t={selection:[...this._selection],interactive:e};for(let e of[...this._selectionListeners])e(t)}};function gridViewColumns(e,t,n,r=1,i=7){let a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(i)),s=Math.floor((e+n)/Math.max(1,t+n));return Math.min(Math.max(s,a),Math.max(a,o))}function listItemField(e,t){return t===`value`?e.value:e.label}function normalizeColumnViewColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>{let t=e.key===`value`?`value`:`label`;return{key:t,title:e.title===void 0?t:String(e.title),id:e.id===void 0?t:String(e.id),expand:e.expand===!0,fixedWidth:typeof e.fixedWidth==`number`?e.fixedWidth:-1,visible:e.visible!==!1,sortable:e.sortable===!0}}):[]}function parseColumnViewColumns(e){if(!e)return[];try{return normalizeColumnViewColumns(JSON.parse(e))}catch{return[]}}function columnViewSort(e,t){if(t.sortable!==!0)return e;let n=t.id??t.key;return e!==null&&e.column===n?{column:n,descending:!e.descending}:{column:n,descending:!1}}function columnViewTracks(e){return e.filter(e=>e.visible!==!1).map(e=>{let t=e.fixedWidth??-1;return t>0?{kind:`fixed`,css:`${t}px`}:e.expand===!0?{kind:`flex`,weight:1}:{kind:`auto`}})}const ve={indents:0,expander:`none`,level:1};function treeExpanderLayout(e,t={}){if(!e)return ve;let n=t.indentForDepth!==!1,r=t.indentForIcon!==!1,i=t.hideExpander===!0,a=n?Math.max(0,Math.floor(e.depth)):0,o=e.expandable&&!i;return!o&&r&&a++,{indents:a,expander:o?e.expanded?`expanded`:`collapsed`:`none`,level:a+1}}function treeExpanderAction(e,t={}){if(e===`+`||e===`*`)return`expand`;if(e===`-`||e===`/`)return`collapse`;if(e===` `&&t.ctrlKey===!0)return`toggle`;if(t.shiftKey!==!0)return`none`;let n=t.rtl===!0;return e===`ArrowRight`?n?`collapse`:`expand`:e===`ArrowLeft`?n?`expand`:`collapse`:`none`}function treeExpanderExpanded(e,t){switch(t){case`expand`:return!0;case`collapse`:return!1;case`toggle`:return!e;case`none`:return e}}var ExpanderState=class{constructor(){this._expanded=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._expanded)}get expanded(){return this._expanded}setExpanded(e){let t=!!e;return t===this._expanded?!1:(this._expanded=t,this._emit(),!0)}toggle(){return this.setExpanded(!this._expanded)}expand(){return this.setExpanded(!0)}collapse(){return this.setExpanded(!1)}},ComboState=class{constructor(){this._options=[],this._selected=0,this._listeners=new Set,this._itemListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.delete(e)}}_emit(e){let t={selected:this._selected,value:this.selectedValue,label:this.selectedLabel,interactive:e};for(let e of[...this._listeners])e(t)}_setIndex(e,t){return e===this._selected?!1:(this._selected=e,this._emit(t),!0)}get model(){return this._options.map(e=>({value:e.value,label:e.label}))}setModel(e){let t=this._options,n=Array.isArray(e)?e:[],r=listItemsChanged(t,n);if(this._options=n.map(e=>({value:e.value,label:e.label})),this._selected=clampListSelection(this._selected,n.length),r)for(let e of[...this._itemListeners])e(r);this._emit(!1)}get selectedIndex(){return this._selected}get presentsChooser(){return this._options.length>1}setSelectedIndex(e){return this._setIndex(Number.isFinite(e)?e:0,!1)}get selectedValue(){return this._options[this._selected]?.value??``}get selectedLabel(){return this._options[this._selected]?.label??``}setSelectedValue(e){let t=this._options.findIndex(t=>t.value===e);return t>=0?this.setSelectedIndex(t):!1}hasIndex(e){return Number.isFinite(e)&&e>=0&&e<this._options.length}select(e){return!this.hasIndex(e)||e===this._selected?!1:this._setIndex(e,!0)}get count(){return this._options.length}},ToggleGroupState=class{constructor(){this._labels=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e={selected:this._selected,value:this.selectedValue};for(let t of[...this._listeners])t(e)}get labels(){return this._labels}setLabels(e){this._labels=Array.isArray(e)?e:[],this._selected>=this._labels.length&&(this._selected=0)}get selected(){return this._selected}setSelected(e){let t=Number.isFinite(e)?e:0;return t===this._selected||t<0||t>=this._labels.length?!1:(this._selected=t,this._emit(),!0)}get selectedValue(){return this._labels[this._selected]??``}get count(){return this._labels.length}};function keptToggles(e){let t=new Set,n=[];for(let r of e){let e=r.name??null;e!==null&&t.has(e)||(e!==null&&t.add(e),n.push(r))}return n}function toggleIndexOfName(e,t){return e.indexOf(t)}const ye=new Map([[`µ`,`μ`],[`ß`,`ss`],[`ʼn`,`ʼn`],[`ſ`,`s`],[`ǰ`,`ǰ`],[`ͅ`,`ι`],[`ΐ`,`ΐ`],[`ΰ`,`ΰ`],[`ς`,`σ`],[`ϐ`,`β`],[`ϑ`,`θ`],[`ϕ`,`φ`],[`ϖ`,`π`],[`ϰ`,`κ`],[`ϱ`,`ρ`],[`ϵ`,`ε`],[`և`,`եւ`],[`ᲀ`,`в`],[`ᲁ`,`д`],[`ᲂ`,`о`],[`ᲃ`,`с`],[`ᲄ`,`т`],[`ᲅ`,`т`],[`ᲆ`,`ъ`],[`ᲇ`,`ѣ`],[`ᲈ`,`ꙋ`],[`ẖ`,`ẖ`],[`ẗ`,`ẗ`],[`ẘ`,`ẘ`],[`ẙ`,`ẙ`],[`ẚ`,`aʾ`],[`ẛ`,`ṡ`],[`ὐ`,`ὐ`],[`ὒ`,`ὒ`],[`ὔ`,`ὔ`],[`ὖ`,`ὖ`],[`ᾀ`,`ἀι`],[`ᾁ`,`ἁι`],[`ᾂ`,`ἂι`],[`ᾃ`,`ἃι`],[`ᾄ`,`ἄι`],[`ᾅ`,`ἅι`],[`ᾆ`,`ἆι`],[`ᾇ`,`ἇι`],[`ᾐ`,`ἠι`],[`ᾑ`,`ἡι`],[`ᾒ`,`ἢι`],[`ᾓ`,`ἣι`],[`ᾔ`,`ἤι`],[`ᾕ`,`ἥι`],[`ᾖ`,`ἦι`],[`ᾗ`,`ἧι`],[`ᾠ`,`ὠι`],[`ᾡ`,`ὡι`],[`ᾢ`,`ὢι`],[`ᾣ`,`ὣι`],[`ᾤ`,`ὤι`],[`ᾥ`,`ὥι`],[`ᾦ`,`ὦι`],[`ᾧ`,`ὧι`],[`ᾲ`,`ὰι`],[`ᾳ`,`αι`],[`ᾴ`,`άι`],[`ᾶ`,`ᾶ`],[`ᾷ`,`ᾶι`],[`ι`,`ι`],[`ῂ`,`ὴι`],[`ῃ`,`ηι`],[`ῄ`,`ήι`],[`ῆ`,`ῆ`],[`ῇ`,`ῆι`],[`ῒ`,`ῒ`],[`ΐ`,`ΐ`],[`ῖ`,`ῖ`],[`ῗ`,`ῗ`],[`ῢ`,`ῢ`],[`ΰ`,`ΰ`],[`ῤ`,`ῤ`],[`ῦ`,`ῦ`],[`ῧ`,`ῧ`],[`ῲ`,`ὼι`],[`ῳ`,`ωι`],[`ῴ`,`ώι`],[`ῶ`,`ῶ`],[`ῷ`,`ῶι`],[`ff`,`ff`],[`fi`,`fi`],[`fl`,`fl`],[`ffi`,`ffi`],[`ffl`,`ffl`],[`ſt`,`st`],[`st`,`st`],[`ﬓ`,`մն`],[`ﬔ`,`մե`],[`ﬕ`,`մի`],[`ﬖ`,`վն`],[`ﬗ`,`մխ`]]);function foldCherokee(e){if(e>=43888&&e<=43967)return String.fromCodePoint(e-43888+5024);if(e>=5112&&e<=5117)return String.fromCodePoint(e-8)}const defaultCaseFolder=e=>{let t=``;for(let n of e.toLowerCase()){let e=n.codePointAt(0);if(e<181){t+=n;continue}t+=ye.get(n)??foldCherokee(e)??n}return t},be=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),xe=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),Se=/[A-Za-z_:]/,Ce=/[A-Za-z0-9._:-]/,we=/[ \t\r\n]/;function escapeMarkup(e){let t=``;for(let n of e)switch(n){case`&`:t+=`&amp;`;break;case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`'`:t+=`&#39;`;break;case`"`:t+=`&#34;`;break;default:{let e=n.codePointAt(0);t+=e>=1&&e<=8||e>=11&&e<=12||e>=14&&e<=31||e===127?`&#x${e.toString(16)};`:n}}return t}function passthroughEnd(e,t){return e.startsWith(`<!--`,t)?{terminator:`-->`}:e.startsWith(`<![CDATA[`,t)?{terminator:`]]>`}:e.startsWith(`<!`,t)||e.startsWith(`<?`,t)?{terminator:`>`}:null}function readEntity(e,t){let n=e.indexOf(`;`,t);if(n<0)return null;let r=e.slice(t+1,n);if(r.length===0)return null;if(r.startsWith(`#`)){let e=r[1]===`x`||r[1]===`X`,t=e?r.slice(2):r.slice(1);if(t.length===0||!(e?/^[0-9a-fA-F]+$/:/^[0-9]+$/).test(t))return null;let i=Number.parseInt(t,e?16:10);return i<=0||i>1114111||i>=55296&&i<=57343?null:{value:String.fromCodePoint(i),next:n+1}}let i=xe.get(r);return i===void 0?null:{value:i,next:n+1}}function readTag(e,t){let n=t+1,r=e[n]===`/`;if(r&&(n+=1),n>=e.length||!Se.test(e[n]))return null;let i=n;for(;n<e.length&&Ce.test(e[n]);)n+=1;let a=e.slice(i,n),o=!1,s=!1;for(;n<e.length;){for(;n<e.length&&we.test(e[n]);)n+=1;let t=e[n];if(t===void 0)return null;if(t===`>`)return{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+1};if(t===`/`)return r||e[n+1]!==`>`?null:(s=!0,{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+2});if(r||!Se.test(t))return null;for(;n<e.length&&Ce.test(e[n]);)n+=1;for(;n<e.length&&we.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&we.test(e[n]);)n+=1;let i=e[n];if(i!==`"`&&i!==`'`)return null;let c=e.indexOf(i,n+1);if(c<0)return null;n=c+1,o=!0}return null}function stripMarkup(e){let t=``,n=[],r=0;for(;r<e.length;){let i=e[r];if(i===`&`){let n=readEntity(e,r);if(!n)return null;t+=n.value,r=n.next;continue}if(i!==`<`){t+=i,r+=1;continue}let a=passthroughEnd(e,r);if(a){let t=e.indexOf(a.terminator,r+2);if(t<0)return null;r=t+a.terminator.length;continue}let o=readTag(e,r);if(!o||!be.has(o.name)||o.hasAttributes&&o.name!==`span`)return null;if(o.closing){if(n.pop()!==o.name)return null}else o.selfClosing||n.push(o.name);r=o.next}return n.length===0?t:null}function makeComparable(e,t={},n=defaultCaseFolder){let r=n(e??``);return(t.useMarkup??!0)&&(r=stripMarkup(r)??r),(t.allowUnderline??!0)&&(t.useUnderline??!1)&&(r=stripMnemonic(r)),r}function displayedLabelText(e,t){let n=e??``;return t?stripMarkup(n)??n:n}function derivePreferencesGroupHeader(e){let t=e.useMarkup??!0,n=stringIsNotEmpty(displayedLabelText(e.title,t)),r=stringIsNotEmpty(displayedLabelText(e.description,t)),i=e.hasHeaderSuffix??!1;return{titleVisible:n,descriptionVisible:r,headerVisible:n||r||i,singleLine:!r&&(i||n),listboxVisible:(e.rowCount??0)>0}}function countVisiblePages(e){let t=0;for(let n of e)n.visible!==!1&&(t+=1);return t}function collectSearchRows(e){let t=[];for(let n of e)if(n.visible!==!1){for(let e of n.groups)if(e.visible!==!1)for(let r of e.rows)r.visible!==!1&&r.title!==``&&t.push({page:n,group:e,row:r})}return t}function rowMatchesQuery(e,t,n=defaultCaseFolder){let r=n(t??``),i={useMarkup:e.useMarkup,useUnderline:e.useUnderline};return makeComparable(e.title,{...i,allowUnderline:!0},n).includes(r)?!0:e.isActionRow?makeComparable(e.subtitle,{...i,allowUnderline:!1},n).includes(r):!1}function createSearchRowSubtitle(e){let t=e.groupTitle??null;t===``&&(t=null);let n=null;return e.pageTitle!==void 0&&e.pageTitle!==null&&(n=e.pageUseUnderline?stripMnemonic(e.pageTitle):e.pageTitle,(e.rowUseMarkup??!0)&&(n=escapeMarkup(n)),n===``&&(n=null)),t===null?n:e.nVisiblePages<=1?t:`${n??e.untitledPageLabel??`Untitled page`} → ${t}`}function searchPreferences(e,t,n={}){let r=n.fold??defaultCaseFolder,i=countVisiblePages(e),a=[];for(let{page:o,group:s,row:c}of collectSearchRows(e))rowMatchesQuery(c,t,r)&&a.push({title:c.title,subtitle:createSearchRowSubtitle({groupTitle:s.title,pageTitle:o.title??``,pageUseUnderline:o.useUnderline,rowUseMarkup:c.useMarkup,nVisiblePages:i,untitledPageLabel:n.untitledPageLabel}),useMarkup:c.useMarkup??!0,useUnderline:c.useUnderline??!1,page:o,group:s,row:c});return a}const Te=[`left`,`right`,`center`,`fill`];function labelDisplayText(e,t,n){let r=e??``,i=t?stripMarkup(r)??r:r;return n?stripMnemonic(i):i}function normalizeLabelXalign$1(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}__name(normalizeLabelXalign$1,`normalizeLabelXalign`);function normalizeLabelJustify(e){return Te.includes(e)?e:`left`}function normalizeLabelYalign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}function labelYalignAlignItems(e){return e<.25?`flex-start`:e>.75?`flex-end`:`center`}const Ee=[`none`,`start`,`middle`,`end`];function normalizeLabelEllipsize(e){return Ee.includes(e)?e:`none`}function labelEllipsizeOverflowValue(e){return e===`none`?`clip`:`ellipsis`}const De=[`word`,`char`,`word-char`];function normalizeLabelWrapMode(e){return De.includes(e)?e:`word`}function normalizeLabelCharCount(e,t){let n=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(n)?Math.max(t,Math.trunc(n)):t}function normalizeLabelWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelMaxWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelLines(e){return normalizeLabelCharCount(e,-1)}function labelEffectiveLines(e,t){return t===`none`?null:e>0?e:1}function labelWidthCharsExtent(e,t){return{minCh:e>=0?e:null,maxCh:t>=0?Math.max(e,t):null}}const Oe=`Back`;function describeNavigationDiagnostic(e){switch(e.code){case`duplicate-tag`:return`Duplicate page tag in AdwNavigationView: ${e.tag}`;case`already-in-stack`:return e.tag===void 0?`Page '${e.title}' is already in navigation stack`:`Page with the tag '${e.tag}' is already in navigation stack`;case`tag-not-found`:return`No page with the tag '${e.tag}' found in AdwNavigationView`;case`not-in-stack`:return`Page '${e.title}' is not in the navigation stack`}}var NavigationViewState=class{constructor(e={}){this._registry=new Map,this._tags=new Map,this._stack=[],this._listeners=new Set,this._pendingRemoval=null,this._animateTransitions=e.animateTransitions??!0,this._popOnEscape=e.popOnEscape??!0,this._onDiagnostic=e.onDiagnostic??null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get stack(){return[...this._stack]}get depth(){return this._stack.length}get pages(){return[...this._registry.keys()]}get visiblePage(){return this._stack.length===0?null:this._stack[this._stack.length-1]}get visiblePageTag(){let e=this.visiblePage;return e===null?null:this.tagOf(e)}get animateTransitions(){return this._animateTransitions}get popOnEscape(){return this._popOnEscape}setAnimateTransitions(e){let t=!!e;return t===this._animateTransitions?!1:(this._animateTransitions=t,!0)}setPopOnEscape(e){let t=!!e;return t===this._popOnEscape?!1:(this._popOnEscape=t,!0)}isRegistered(e){return this._registry.has(e)}isInStack(e){return this._stack.includes(e)}isRemoveOnPop(e){return this._registry.get(e)?.removeOnPop===!0}tagOf(e){return this._registry.get(e)?.tag??null}titleOf(e){return this._registry.get(e)?.title??``}canPopOf(e){return this._registry.get(e)?.canPop??!0}findPage(e){return this._tags.get(e)??null}getPreviousPage(e){let t=this._stack.indexOf(e);return t<=0?null:this._stack[t-1]}add(e,t={}){let n=this._registry.get(e);return n===void 0?this._addPage(e,t,!0):n.removeOnPop&&this._stack.includes(e)?(n.removeOnPop=!1,!0):(n.tag!==null&&this._diagnose({code:`duplicate-tag`,tag:n.tag}),!1)}remove(e){let t=this._registry.get(e);return t===void 0?!1:(this._pendingRemoval===e&&(this._pendingRemoval=null),this._stack.includes(e)?(t.removeOnPop=!0,!0):(this._unregister(e),!0))}setTag(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=t??null;return r===n.tag?!1:r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(n.tag!==null&&this._tags.delete(n.tag),n.tag=r,r!==null&&this._tags.set(r,e),!0)}setTitle(e,t){if(typeof t!=`string`)return!1;let n=this._registry.get(e);return n===void 0||n.title===t?!1:(n.title=t,!0)}setCanPop(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=!!t;return r===n.canPop?!1:(n.canPop=r,!0)}push(e,t={}){return this._maybeAddPage(e,t)?this._pushToStack(e,`push`,this._animateTransitions,!1):!1}pushByTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this._pushToStack(t,`push`,this._animateTransitions,!0)}pop(){let e=this.visiblePage;if(e===null)return!1;let t=this.getPreviousPage(e);return t===null?!1:(this._popFromStack(t,this._animateTransitions),!0)}popToPage(e){return e===this.visiblePage?!1:this._stack.includes(e)?(this._popFromStack(e,this._animateTransitions),!0):(this._diagnose({code:`not-in-stack`,title:this.titleOf(e)}),!1)}popToTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this.popToPage(t)}replace(e,t){let n=this.visiblePage,r=n,i=n!==null,a=!1,o=[],s=new Set;for(let t of e)t!=null&&s.add(t);for(let e=this._stack.length-1;e>=0;e--){let t=this._stack[e],n=this._registry.get(t);n===void 0||!n.removeOnPop||s.has(t)||(t===r&&(a=n.tag!==null,r=null),this._unregister(t)&&o.push(t))}this._stack.length=0;let c=new Set;for(let n of e)if(n!=null){if(c.has(n)){this._diagnose({code:`already-in-stack`,title:this.titleOf(n)});continue}this._maybeAddPage(n,t?.(n)??{})&&(c.add(n),this._stack.push(n))}let l=this.visiblePage,u;u=l===null?r===null?{animate:!1,tagNotify:i&&a,removeAfterTransition:null}:this._beginSwitch(r,null,!0,!1,o):r===l?{animate:!1,tagNotify:!1,removeAfterTransition:null}:this._beginSwitch(r,l,!0,!1,o),this._emitChange(`replace`,n,!0,[],o,u)}replaceWithTags(e){let t=e.map(e=>{let t=this.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this.replace(t)}finishTransition(){let e=this._resolvePendingRemoval();return e===null?[]:[e]}canGoBack(){let e=this.visiblePage;return e===null||!this.canPopOf(e)?!1:this.getPreviousPage(e)!==null}backButtonTooltip(e=Oe){if(!this.canGoBack())return null;let t=this.getPreviousPage(this.visiblePage);if(t===null)return null;let n=this.titleOf(t);return n.length>0?n:e}popFromShortcut(){let e=this.visiblePage;return e===null?`propagate`:this.canPopOf(e)?this.pop()?`stop`:`propagate`:`stop`}popFromEscape(){return this._popOnEscape?this.popFromShortcut():`propagate`}_diagnose(e){this._onDiagnostic?.(e)}_emit(e){for(let t of[...this._listeners])t(e)}_emitChange(e,t,n,r,i,a){let o=this.visiblePage;this._emit({stack:[...this._stack],visiblePage:o,visiblePageTag:o===null?null:this.tagOf(o),previousVisiblePage:t,reason:e,popped:[...r],removed:[...i],removeAfterTransition:a.removeAfterTransition,animate:a.animate,pop:n,tagNotify:a.tagNotify})}_addPage(e,t,n){let r=t.tag??null;return r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(this._registry.set(e,{tag:r,title:t.title??``,canPop:t.canPop===void 0?!0:!!t.canPop,removeOnPop:!1}),r!==null&&this._tags.set(r,e),n&&this._stack.length===0&&this._pushToStack(e,`add`,!1,!1),!0)}_maybeAddPage(e,t){if(this._registry.has(e))return!0;let n=t.tag??null;if(n!==null&&this._tags.has(n))return this._diagnose({code:`duplicate-tag`,tag:n}),!1;if(!this._addPage(e,t,!1))return!1;let r=this._registry.get(e);return r!==void 0&&(r.removeOnPop=!0),!0}_pushToStack(e,t,n,r){if(this._stack.includes(e))return this._diagnose(r?{code:`already-in-stack`,tag:this.tagOf(e)}:{code:`already-in-stack`,title:this.titleOf(e)}),!1;let i=this.visiblePage,a=[];this._stack.push(e);let o=this._beginSwitch(i,e,!1,n,a);return this._emitChange(t,i,!1,[],a,o),!0}_popFromStack(e,t){let n=this.visiblePage;if(e===n)return;let r=this._stack.indexOf(e),i=this._stack.slice(r+1).reverse();this._stack.length=r+1;let a=[],o=this._beginSwitch(n,e,!0,t,a);for(let e of i)e!==n&&this._registry.get(e)?.removeOnPop===!0&&this._unregister(e)&&a.push(e);this._emitChange(`pop`,n,!0,i,a,o)}_beginSwitch(e,t,n,r,i){if(this._pendingRemoval!==null&&this._pendingRemoval!==e){let e=this._resolvePendingRemoval();e!==null&&i.push(e)}let a=null;return n&&e!==null&&this._registry.get(e)?.removeOnPop===!0&&!this._stack.includes(e)&&(a=e,this._pendingRemoval=e),{animate:r&&e!==null,tagNotify:e!==null&&this.tagOf(e)!==null||t!==null&&this.tagOf(t)!==null,removeAfterTransition:a}}_resolvePendingRemoval(){let e=this._pendingRemoval;if(e===null)return null;if(this._pendingRemoval=null,this._stack.includes(e)){let t=this._registry.get(e);return t!==void 0&&(t.removeOnPop=!0),null}return this._unregister(e)?e:null}_unregister(e){let t=this._registry.get(e);return t===void 0?!1:(t.tag!==null&&this._tags.get(t.tag)===e&&this._tags.delete(t.tag),this._registry.delete(e),!0)}};function clampSidebarSelection(e,t){return!Number.isInteger(e)||e<0||e>=t?-1:e}function adjustSidebarSelection(e,t,n,r,i,a){if(t===0&&n>0)return clampSidebarSelection(0,n);let o=e>>>0,s=r>>>0;return s<=o&&s+i>o?-1:s<=o?clampSidebarSelection(o+a-i>>>0,n):e}function flattenSidebarItems(e,t){let n=[],r=[],i=0;return e.forEach((e,a)=>{r.push(i),e.items.forEach((e,r)=>{let o=i+r;t&&!t(e,o)||n.push({index:o,sectionIndex:a,sectionItemIndex:r,item:e,titleVisible:stringIsNotEmpty(e.title),subtitleVisible:stringIsNotEmpty(e.subtitle),iconVisible:stringIsNotEmpty(e.iconName)})}),i+=e.items.length}),{items:n,sectionFirstIndex:r}}function deriveSidebarHeaders(e,t){let n=[],r=null;for(let i of t){if(r===i.sectionIndex)continue;let t=r===null;r=i.sectionIndex;let a=e[i.sectionIndex]?.title??``;t&&a.length===0||n.push({sectionIndex:i.sectionIndex,kind:a.length>0?`title`:`separator`,title:a,first:t})}return n}var SidebarState=class{constructor(){this._mode=`sidebar`,this._sections=[],this._filter=null,this._selected=-1,this._items=[],this._sectionFirstIndex=[],this._visibleItems=[],this._headers=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={selected:this._selected,previous:e,item:this.selectedItem,interactive:t};for(let e of[...this._listeners])e(n)}_applySelected(e,t){if(e===this._selected)return!1;let n=this._selected;return this._selected=e,this._emit(n,t),!0}_invalidate(){let e=flattenSidebarItems(this._sections),t=this._filter;this._items=e.items,this._sectionFirstIndex=e.sectionFirstIndex,this._visibleItems=t?this._items.filter(e=>t(e.item,e.index)):this._items,this._headers=deriveSidebarHeaders(this._sections,this._visibleItems)}get mode(){return this._mode}setMode(e){return e===this._mode?!1:(this._mode=e,!0)}get selectionVisible(){return this._mode===`sidebar`}get sections(){return this._sections}setSections(e){let t=this.count;this._sections=[...e],this._invalidate();let n=adjustSidebarSelection(adjustSidebarSelection(this._selected,t,0,0,t,0),0,this.count,0,0,this.count);this._applySelected(n,!1)}insertSection(e,t){let n=this.count,r=this._sections.length,i=Number.isInteger(t)&&t>=0&&t<r?t:r;this._sections.splice(i,0,e),this._invalidate();let a=this._sectionFirstIndex[i]??0,o=adjustSidebarSelection(this._selected,n,this.count,a,0,e.items.length);return this._applySelected(o,!1),i}removeSectionAt(e){let t=this.sectionAt(e);if(!t)return!1;let n=this.count,r=this._sectionFirstIndex[e]??0,i=t.items.length;return this._sections.splice(e,1),this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,n,this.count,r,i,0),!1),!0}removeAllSections(){let e=this.count;this._sections=[],this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,e,0,0,e,0),!1)}refresh(){this._invalidate()}sectionAt(e){if(!(!Number.isInteger(e)||e<0))return this._sections[e]}sectionFirstIndex(e){return this._sectionFirstIndex[e]??0}get count(){return this._items.length}get items(){return this._items}itemAt(e){if(!(!Number.isInteger(e)||e<0))return this._items[e]?.item}get filter(){return this._filter}setFilter(e){e!==this._filter&&(this._filter=e,this._invalidate())}get visibleItems(){return this._visibleItems}get headers(){return this._headers}get isEmpty(){return this._visibleItems.length===0}get selected(){return this._selected}get selectedItem(){return this.itemAt(this._selected)}setSelected(e){return this._applySelected(clampSidebarSelection(e,this.count),!1)}activate(e){let t=this._visibleItems.find(t=>t.index===e);return!t||t.item.visible===!1||t.item.enabled===!1?{index:e,activated:!1,selectionChanged:!1}:{index:e,activated:!0,selectionChanged:this._applySelected(clampSidebarSelection(e,this.count),!0)}}};const ke=1200,Ae=Math.PI*.35,je=Math.PI*.015,S=Math.PI*.9,Me=Math.PI*.9,C=Math.PI*.7,w=Math.PI*1.1,Ne=Math.PI*1.35,T=Me+w+Ne-C;53*Math.PI*2/T;const Pe=w-C/2;function normalizeSpinnerAngle(e){let t=e;for(;t<0;)t+=Math.PI*2;for(;t>Math.PI*2;)t-=Math.PI*2;return t}function spinnerArcStart(e){let t=e%T,n=t>w?1:easeInOutSine(t/w);return adwLerp(je,S,n)-t*S/T}function spinnerArcEnd(e){let t=e%T,n=w-C,r;return r=t<n?0:t>T-Me?1:easeInOutSine((t-n)/Ne),adwLerp(0,S-je,r)-t*S/T}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+Ae),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+Ae),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=ke*53;return(e%t+t)%t/ke*Math.PI*2}const Fe={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},Ie=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],Le={hyper:{default:`Hyper`,apple:`Hyper`},super:{default:`Super`,apple:`Super`},control:{default:`Ctrl`,apple:`⌃`},alt:{default:`Alt`,apple:`⌥`},shift:{default:`Shift`,apple:`⇧`},meta:{default:`Meta`,apple:`⌘`}},Re={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},ze={exclam:`!`,quotedbl:`"`,numbersign:`#`,dollar:`$`,percent:`%`,ampersand:`&`,apostrophe:`'`,parenleft:`(`,parenright:`)`,asterisk:`*`,plus:`+`,comma:`,`,minus:`-`,period:`.`,slash:`/`,colon:`:`,semicolon:`;`,less:`<`,equal:`=`,greater:`>`,question:`?`,at:`@`,bracketleft:`[`,backslash:`\\`,bracketright:`]`,asciicircum:`^`,underscore:`_`,grave:"`",braceleft:`{`,bar:`|`,braceright:`}`,asciitilde:`~`},Be={Left:{default:`←`},Up:{default:`↑`},Right:{default:`→`},Down:{default:`↓`},space:{default:`␣`},Return:{default:`⏎`},Page_Up:{default:`Page_Up`},Page_Down:{default:`Page_Down`},Escape:{apple:`⎋`},Tab:{apple:`⇥`},BackSpace:{apple:`⌫`},Delete:{apple:`⌦`}};function parseAccelerator(e,t=`default`){let n=new Set,r=e;for(;r.startsWith(`<`);){let e=r.indexOf(`>`);if(e===-1)return null;let i=r.slice(1,e).toLowerCase();if(r=r.slice(e+1),i===`release`)continue;let a=Fe[i];if(!a)return null;n.add(a===`primary`?t===`apple`?`meta`:`control`:a)}return r.length===0?null:{modifiers:n,key:r}}function keycapForKey(e,t){let n=/^([A-Za-z]+)_([LR])$/.exec(e);if(n&&Re[n[1]]){let e=Re[n[1]];return{label:Le[e][t],sideMarker:n[2]}}let r=Be[e];if(r){let e=t===`apple`?r.apple??r.default:r.default;if(e)return{label:e}}let i=/^KP_(.+)$/.exec(e);if(i){let e=printableFor(i[1]);if(e)return{label:`KP ${e.toUpperCase()}`}}let a=printableFor(e);return a?{label:a===`\\`?`Backslash`:a.toUpperCase()}:{label:e.length===1?e.toUpperCase():e}}function printableFor(e){if(e.length===1){let t=e.codePointAt(0)??0;return t>32&&t<127?e:null}return ze[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of Ie)n.modifiers.has(e)&&r.push({label:Le[e][t]});return r.push(keycapForKey(n.key,t)),r}function accessibleFor(e){return e.map(e=>e.sideMarker?`${e.label} ${e.sideMarker}`:e.label).join(`+`)}function parseShortcutLabel(e,t={}){let{disabledText:n=``,direction:r=`ltr`,platform:i=`default`}=t;if(e.length===0)return{nodes:[{kind:`disabled`,text:n}],accessibleLabel:n,error:null};let a=[],o=``,s=null,combination=e=>{for(let t of e.split(`&`)){let e=shortcutKeycaps(t,i);if(!e)return s=t,!1;a.push({kind:`keys`,keys:e}),o+=accessibleFor(e)}return!0},sequence=e=>{let t=r===`rtl`?`←`:`→`,n=e.split(`+`);for(let[e,r]of n.entries())if(e>0&&(a.push({kind:`separator`,text:t}),o+=t),!combination(r))return!1;return!0},range=e=>{let t=e.indexOf(`...`);return t===-1?sequence(e):sequence(e.slice(0,t))?(a.push({kind:`separator`,text:`⋯`}),o+=`…`,sequence(e.slice(t+3))):!1};for(let[t,n]of e.split(` `).entries())if(t>0&&(a.push({kind:`separator`,text:`/`}),o+=` `),!range(n))break;return{nodes:a,accessibleLabel:o,error:s}}const Ve=[`px`,`pt`,`sp`];function adwLengthToPx(e,t,n=96){switch(e){case`pt`:return t*n/72;case`sp`:return t*n/96;default:return t}}function normalizeLengthUnit(e,t){return Ve.includes(e)?e:t}function isSidebarAtVisualStart(e,t=`ltr`){return e===`start`==(t!==`rtl`)}function fractionOf(e){return e.sidebarWidthFraction??.25}function resolveSidebarBounds(e,t=0,n={}){let r=e.sidebarWidthUnit??`sp`,i=e.dpi??96,a=n.ceil?Math.ceil:Math.trunc,o=adwLengthToPx(r,e.minSidebarWidth??180,i),s=adwLengthToPx(r,e.maxSidebarWidth??280,i),c=a(Math.max(t,o));return{min:c,max:a(Math.max(c,s))}}function resolveOverlaySidebarWidth(e){let t=resolveSidebarBounds(e,e.sidebarChildMin??0,{ceil:!0});if(e.collapsed)return glibClamp(e.totalWidth,t.min,t.max);let n=glibClamp(Math.trunc(e.totalWidth*fractionOf(e)),t.min,t.max);return Math.min(n,e.totalWidth-(e.contentMin??0))}function layoutOverlaySplitView(e){let{totalWidth:t,showProgress:n,collapsed:r}=e,i=e.sidebarWidth,a=isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`),o=i,s=Math.trunc(i*n),c=s>i,l={shieldVisible:r&&n>0,sidebarPainted:n>0,shadowProgress:1-Math.min(n,+!!r),shadowSide:a?`left`:`right`};return r?(c&&(o=s),{sidebar:{x:a?c?0:s-i:t-s,width:o},content:{x:0,width:t},...l}):(c&&(o=s,s=i),a?{sidebar:{x:s-i,width:o},content:{x:s,width:t-s},...l}:{sidebar:{x:t-(c?o:s),width:o},content:{x:0,width:t-s},...l})}function tagsConflict(e,t){return e==null||t==null?!1:e===t}function resolveNavigationStack(e){let{hasSidebar:t,hasContent:n,showContent:r}=e,i=e.sidebarPosition===`end`;if(e.changingPage&&t&&n)return r?i?{stack:[`content`],transition:`pop`,page:`sidebar`}:{stack:[`sidebar`,`content`],transition:`push`,page:`content`}:i?{stack:[`content`,`sidebar`],transition:`push`,page:`sidebar`}:{stack:[`sidebar`],transition:`pop`,page:`content`};let a=[];return i?(n&&a.push(`content`),t&&(!r||!n)&&a.push(`sidebar`)):(t&&a.push(`sidebar`),n&&(r||!t)&&a.push(`content`)),{stack:a,transition:`replace`,page:null}}function resolveNavigationAction(e){if(e.action===`pop`)return e.showContent&&e.hasSidebar&&e.hasContent?{kind:`set-show-content`,showContent:!1}:{kind:`delegate`};let{tag:t}=e;return e.contentTag!==null&&e.contentTag!==void 0&&t===e.contentTag?e.showContent&&e.collapsed?{kind:`already-in-stack`,tag:t}:{kind:`set-show-content`,showContent:!0}:e.sidebarTag!==null&&e.sidebarTag!==void 0&&t===e.sidebarTag?{kind:`already-in-stack`,tag:t}:{kind:`delegate`}}const E={alreadyInStack:e=>`Page with the tag '${e}' is already in the navigation stack`,notFound:e=>`No page with the tag '${e}' found in AdwNavigationSplitView`,sidebarCollision:e=>`Trying to add sidebar with the tag '${e}' to AdwNavigationSplitView, but content already has the same tag`,contentCollision:e=>`Trying to add content with the tag '${e}' to AdwNavigationSplitView, but sidebar already has the same tag`,sidebarTagCollision:e=>`Trying to set the sidebar's tag to '${e}', but the content already has the same tag`,contentTagCollision:e=>`Trying to set the content's tag to '${e}', but the sidebar already has the same tag`};var NavigationSplitViewState=class{constructor(e={}){this._sidebar=null,this._content=null,this._sidebarTag=null,this._contentTag=null,this._listeners=new Set,this._sidebarPosition=e.sidebarPosition??`start`,this._collapsed=e.collapsed??!1,this._showContent=e.showContent??!1,this._handlers={onCritical:e.onCritical,onDelegate:e.onDelegate}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t,n=!1){let r={property:e,interactive:n,plan:t};for(let e of[...this._listeners])e(r)}_critical(e){this._handlers.onCritical?.(e)}_plan(e=!1){return resolveNavigationStack({hasSidebar:this._sidebar!==null,hasContent:this._content!==null,sidebarPosition:this._sidebarPosition,showContent:this._showContent,changingPage:e})}get collapsed(){return this._collapsed}get showContent(){return this._showContent}get sidebarPosition(){return this._sidebarPosition}get sidebar(){return this._sidebar}get content(){return this._content}get sidebarTag(){return this._sidebarTag}get contentTag(){return this._contentTag}get stack(){return this._plan()}get visiblePane(){let{stack:e}=this._plan();return e[e.length-1]??null}setSidebar(e){if(e===this._sidebar)return!1;let t=e?.tag??null;return tagsConflict(t,this._contentTag)?(this._critical(E.sidebarCollision(t)),!1):(this._sidebar=e,this._sidebarTag=t,this._emit(`sidebar`,this._plan()),!0)}setContent(e){if(e===this._content)return!1;let t=e?.tag??null;return tagsConflict(this._sidebarTag,t)?(this._critical(E.contentCollision(t)),!1):(this._content=e,this._contentTag=t,this._emit(`content`,this._plan()),!0)}setTag(e,t){return e===`sidebar`?(this._sidebarTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(E.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(E.contentTagCollision(t)),this._contentTag=null,!1):!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`,this._plan()),!0)}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._emit(`collapsed`,this._plan()),!0)}setShowContent(e,t=!1){let n=!!e;if(n===this._showContent)return!1;this._showContent=n;let r=this._collapsed&&this._sidebar!==null&&this._content!==null;return this._emit(`show-content`,this._plan(r),t),!0}push(e){return this._runAction(resolveNavigationAction({action:`push`,tag:e,sidebarTag:this._sidebarTag,contentTag:this._contentTag,showContent:this._showContent,collapsed:this._collapsed}),`push`,e)}pop(){return this._runAction(resolveNavigationAction({action:`pop`,hasSidebar:this._sidebar!==null,hasContent:this._content!==null,showContent:this._showContent}),`pop`)}_runAction(e,t,n){switch(e.kind){case`set-show-content`:return this.setShowContent(e.showContent,!0),e;case`already-in-stack`:return this._critical(E.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(E.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const He={animate(e){return e.onValue(e.to),e.onDone(),{cancel:()=>{}}}};var OverlaySplitViewState=class{constructor(e={}){this._swipeActive=!1,this._animation=null,this._listeners=new Set,this._showSidebar=e.showSidebar??!0,this._collapsed=e.collapsed??!1,this._pinSidebar=e.pinSidebar??!1,this._sidebarPosition=e.sidebarPosition??`start`,this._enableShowGesture=e.enableShowGesture??!0,this._enableHideGesture=e.enableHideGesture??!0,this._showProgress=+!!this._showSidebar,this._animator=e.animator??He}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t=!1){let n={property:e,showSidebar:this._showSidebar,collapsed:this._collapsed,showProgress:this._showProgress,shieldVisible:this.shieldVisible,interactive:t};for(let e of[...this._listeners])e(n)}get showSidebar(){return this._showSidebar}get collapsed(){return this._collapsed}get pinSidebar(){return this._pinSidebar}get sidebarPosition(){return this._sidebarPosition}get enableShowGesture(){return this._enableShowGesture}get enableHideGesture(){return this._enableHideGesture}get showProgress(){return this._showProgress}get shieldVisible(){return this._collapsed&&this._showProgress>0}get sidebarPainted(){return this._showProgress>0}get sidebarFocusable(){return!this._collapsed||this._showSidebar}get contentFocusable(){return!this._collapsed||!this._showSidebar}setShowSidebar(e,t={}){let n=!!e;if(n===this._showSidebar)return!1;this._showSidebar=n;let r=+!!n,i=t.animate??!0;return i||(this._cancelAnimation(),this._showProgress=r),this._emit(`show-sidebar`,t.interactive??!1),i&&!this._swipeActive&&this._startAnimation(r,t.velocity??0),!0}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._pinSidebar||this.setShowSidebar(!t,{animate:!1}),this._emit(`collapsed`),!0)}setPinSidebar(e){let t=!!e;return t===this._pinSidebar?!1:(this._pinSidebar=t,this._emit(`pin-sidebar`),!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`),!0)}setEnableShowGesture(e){let t=!!e;return t===this._enableShowGesture?!1:(this._enableShowGesture=t,!0)}setEnableHideGesture(e){let t=!!e;return t===this._enableHideGesture?!1:(this._enableHideGesture=t,!0)}setShowProgress(e){this._showProgress=e,this._emit(`show-progress`)}escape(){return this._showProgress<2**-52||!this._collapsed?!1:(this.setShowSidebar(!1,{interactive:!0}),!0)}dismissShield(){return this.setShowSidebar(!1,{interactive:!0})}get swipeActive(){return this._swipeActive}beginSwipe(){this._cancelAnimation(),this._swipeActive=!0}endSwipe(e,t=0){if(!this._swipeActive)return{kind:`animate`,to:this._showProgress};this._swipeActive=!1;let n=resolveSwipeRelease({to:e,showSidebar:this._showSidebar});return n.kind===`animate`?this._startAnimation(n.to,t):this.setShowSidebar(n.showSidebar,{velocity:t,interactive:!0}),n}get snapPoints(){return resolveSwipeSnapPoints({showProgress:this._showProgress,enableShowGesture:this._enableShowGesture,enableHideGesture:this._enableHideGesture,swipeActive:this._swipeActive})}_cancelAnimation(){this._animation?.cancel(),this._animation=null}_startAnimation(e,t){this._cancelAnimation();let n=!1,r=this._animator.animate({from:this._showProgress,to:e,velocity:t,clamp:e<.5,onValue:e=>this.setShowProgress(e),onDone:()=>{n=!0,this._animation=null}});n||(this._animation=r)}};function resolveSwipeSnapPoints(e){let t=e.showProgress>0||e.enableShowGesture||e.swipeActive,n=e.showProgress<1||e.enableHideGesture||e.swipeActive;return t&&n?[0,1]:[+!!t]}function resolveSwipeStart(e){let t=Math.abs(e.showProgress-1)<2**-52||e.showProgress>1,n=Math.abs(e.showProgress)<2**-52||e.showProgress<0;return!(t&&!e.collapsed&&e.direction===`forward`||n&&!e.enableShowGesture||t&&!e.enableHideGesture)}function resolveSwipeRelease(e){return e.to>0===e.showSidebar?{kind:`animate`,to:e.to}:{kind:`set-show-sidebar`,showSidebar:e.to>0}}function swipeCancelProgress(e){let t=e<0?-Math.round(-e):Math.round(e);return t===0?0:t}function resolveSwipeArea(e){if(!e.isDrag)return{x:0,y:0,width:0,height:0};let t=Math.max(Math.trunc(e.sidebarWidth*e.showProgress),32);return{x:isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`)?0:e.totalWidth-t,y:0,width:t,height:e.totalHeight}}const Ue=[`action-disabled`,`action-missing`,`macos-menubar`],We=[`horizontal-buttons`,`circular-buttons`,`inline-buttons`],Ge=[`ltr`,`rtl`,`none`],str=e=>typeof e==`string`?e:void 0;function oneOf(e,t){return typeof t==`string`&&e.includes(t)?t:void 0}function put(e,t,n){n!==void 0&&(e[t]=n)}function normalizeMenuModel(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=normalizeEntry(n);e!==null&&t.push(e)}return t}function normalizeEntry(e){if(typeof e==`string`)return{kind:`item`,label:e};if(typeof e!=`object`||!e)return null;let t=e;if(Array.isArray(t.items)&&(t.kind===`section`||t.kind===`submenu`)){let{items:e,kind:n,...r}=t;return normalizeEntry({...r,[n]:e})}if(Array.isArray(t.section)){let e={kind:`section`,items:normalizeMenuModel(t.section)},n=e;return put(n,`label`,str(t.label)),put(n,`displayHint`,oneOf(We,t.displayHint)),put(n,`textDirection`,oneOf(Ge,t.textDirection)),e}if(Array.isArray(t.submenu)){let e={kind:`submenu`,label:str(t.label)??``,items:normalizeMenuModel(t.submenu)},n=e;return put(n,`icon`,str(t.icon)),put(n,`submenuAction`,str(t.submenuAction)),put(n,`macosSpecial`,str(t.macosSpecial)),e}let n=str(t.label),r={kind:`item`,label:n??``},i=r;return put(i,`action`,str(t.action)||void 0),put(i,`icon`,str(t.icon)),put(i,`verbIcon`,str(t.verbIcon)),put(i,`accel`,str(t.accel)),put(i,`hiddenWhen`,oneOf(Ue,t.hiddenWhen)),put(i,`custom`,str(t.custom)),put(i,`id`,str(t.id)),t.useMarkup===!0&&(i.useMarkup=!0),n===void 0&&Object.keys(r).length===2?null:r}function parseMenuModel(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?normalizeMenuModel(t):[]}function menuNodeAt(e,t){if(!Array.isArray(t)||t.length===0)return null;let n=e,r=null;for(let e of t){if(!Number.isInteger(e)||e<0||e>=n.length)return null;r=n[e],n=r.kind===`item`?[]:r.items}return r}function menuItemAt(e,t){let n=menuNodeAt(e,t);return n!==null&&n.kind===`item`?n:null}function flattenMenu(e,t=[]){let n=[],r=!1;return e.forEach((e,i)=>{let a=[...t,i];if(e.kind===`section`){let t=flattenMenu(e.items,a);if(t.length===0)return;n.push({...t[0],separated:n.length>0}),n.push(...t.slice(1)),r=!0;return}n.push({node:e,path:a,separated:r&&n.length>0}),r=!1}),n}function parseDetailedAction(e){if(typeof e!=`string`||e.length===0)return null;let t=e.indexOf(`::`);if(t>0)return{name:e.slice(0,t),target:e.slice(t+2)};let n=e.indexOf(`(`);return n>0&&e.endsWith(`)`)?{name:e.slice(0,n),target:unquote(e.slice(n+1,-1))}:{name:e}}function unquote(e){let t=e[0];if(!(e.length>=2&&(t===`'`||t===`"`)&&e[e.length-1]===t))return e;let n=e.slice(1,-1),r=``;for(let e=0;e<n.length;e+=1){let i=n[e],a=n[e+1];if(i===`\\`&&(a===t||a===`\\`)){r+=a,e+=1;continue}r+=i}return r}function resolveMenuItemState(e,t){let n=parseDetailedAction(e.action);if(t===void 0)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!0,!0)};if(n===null)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!1,!0)};let r=t?.[n.name];if(r===void 0)return{sensitive:!1,toggled:!1,role:`normal`,visible:visibility(e,!1,!1)};let i=r.enabled!==!1,a=`normal`,o=!1;return n.target!==void 0&&r.state!==void 0?(a=`radio`,o=r.state===n.target):(r.state===`true`||r.state===`false`)&&(a=`check`,o=r.state===`true`),{sensitive:i,toggled:o,role:a,visible:visibility(e,!0,i)}}function visibility(e,t,n){switch(e.hiddenWhen){case`action-missing`:return t;case`action-disabled`:return n;case`macos-menubar`:return!0;default:return!0}}const D={name:`adwaita-web`,custom:!1};function menuRefusals(e,t,n=[]){let r=[];return e.forEach((e,i)=>{let a=[...n,i];if(e.kind===`item`){e.custom!==void 0&&!t.custom&&r.push({path:a,what:`custom`,message:`menu item custom="${e.custom}" names an application widget, which ${t.name} cannot host: it has no gtk_popover_menu_add_child. Give the item a label and an action, or keep this menu on GTK.`});return}r.push(...menuRefusals(e.items,t,a))}),r}function assertMenuRenderable(e,t){let n=menuRefusals(e,t);if(n.length===0)return;let r=n.map(e=>` [${e.path.join(`.`)}] ${e.message}`);throw Error(`${t.name} cannot render this menu:\n${r.join(`
4
- `)}`)}const Ke={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},qe=[`none`,`up`,`down`,`left`,`right`];function splitButtonStyleClasses(e,t){let n=[];return t!==null&&t.length>0&&n.push(`image-button`),e!==null&&e.length>0&&n.push(`text-button`),n}function resolveDropdownTooltip(e){return typeof e==`string`&&e.length>0?{text:e,markup:!0}:{text:`More Options`,markup:!1}}function splitButtonArrowIcon(e){return Ke[e]??Ke.down}function splitButtonPopupDirection(e){return e===`none`||!qe.includes(e)?`down`:e}const Je=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&qe.includes(e)}function splitButtonRootState(e,t){return{active:e.active||t.active||e.keyboardActivating||t.keyboardActivating,checked:e.checked||t.checked}}const menuKey=e=>e===null?``:JSON.stringify(e);function internalContent(e){return Object.freeze({adwInternalContent:e})}function derivedPopover(){return Object.freeze({adwDerivedPopover:!0})}var SplitButtonState=class{constructor(){this._mode=`empty`,this._label=null,this._iconName=null,this._child=null,this._useUnderline=!1,this._menuModel=null,this._popover=null,this._direction=`down`,this._dropdownTooltip=``,this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={mode:this._mode,label:this._label,iconName:this._iconName,child:this._child,styleClasses:this.styleClasses,dropdownEnabled:this.dropdownEnabled,open:this._open,notified:e,interactive:t};for(let e of[...this._listeners])e(n)}get mode(){return this._mode}get label(){return this._label}setLabel(e){if(typeof e!=`string`||e===this._label)return!1;let t=[];return this._iconName!==null&&t.push(`icon-name`),this._child!==null&&t.push(`child`),this._child=this._mode===`label`?this._child:internalContent(`label`),this._mode=`label`,this._label=e,this._iconName=null,t.push(`label`),this._emit(t,!1),!0}get iconName(){return this._iconName}setIconName(e){if(typeof e!=`string`||e===this._iconName)return!1;let t=[];return this._label!==null&&t.push(`label`),this._child!==null&&t.push(`child`),this._child=this._mode===`icon`?this._child:internalContent(`icon`),this._mode=`icon`,this._iconName=e,this._label=null,t.push(`icon-name`),this._emit(t,!1),!0}get child(){return this._child}setChild(e){let t=e??null;if(t===this._child)return!1;let n=[];return this._label!==null&&n.push(`label`),this._iconName!==null&&n.push(`icon-name`),this._mode=t===null?`empty`:`child`,this._child=t,this._label=null,this._iconName=null,n.push(`child`),this._emit(n,!1),!0}get styleClasses(){return splitButtonStyleClasses(this._label,this._iconName)}get useUnderline(){return this._useUnderline}setUseUnderline(e){let t=!!e;return t===this._useUnderline?!1:(this._useUnderline=t,this._emit([`use-underline`],!1),!0)}get menuModel(){return this._menuModel}setMenuModel(e){let t=normalizeMenuModel(e),n=t.length>0?t:null;if(menuKey(n)===menuKey(this._menuModel))return!1;let r=n===null?null:derivedPopover(),i=[];return r!==this._popover&&i.push(`popover`),i.push(`menu-model`),this._menuModel=n,this._popover=r,this.dropdownEnabled||(this._open=!1),this._emit(i,!1),!0}get popover(){return this._popover}setPopover(e){let t=e??null;if(t===this._popover)return!1;let n=[];return this._menuModel!==null&&n.push(`menu-model`),n.push(`popover`),this._menuModel=null,this._popover=t,this.dropdownEnabled||(this._open=!1),this._emit(n,!1),!0}get dropdownEnabled(){return this._menuModel!==null||this._popover!==null}get direction(){return this._direction}setDirection(e){return!isSplitButtonDirection(e)||e===this._direction?!1:(this._direction=e,this._emit([`direction`],!1),!0)}get arrowIcon(){return splitButtonArrowIcon(this._direction)}get dropdownTooltip(){return this._dropdownTooltip}setDropdownTooltip(e){return typeof e!=`string`||e===this._dropdownTooltip?!1:(this._dropdownTooltip=e,this._emit([`dropdown-tooltip`],!1),!0)}get open(){return this._open}_setOpen(e,t){return e&&!this.dropdownEnabled||e===this._open?!1:(this._open=e,this._emit([],t),!0)}openMenu(){return this._setOpen(!0,!1)}closeMenu(){return this._setOpen(!1,!1)}toggleMenu(){return this._setOpen(!this._open,!0)}activateMenuItem(e){if(this._menuModel===null)return null;let t=menuItemAt(this._menuModel,e);return t===null?null:(this._setOpen(!1,!0),t)}};const Ye=[`narrow`,`wide`],Xe=[`labels`,`icons`,`both`];function isViewSwitcherPolicy(e){return e===`narrow`||e===`wide`}function isInlineViewSwitcherDisplayMode(e){return e===`labels`||e===`icons`||e===`both`}function createViewSwitcherPage(e){return{name:e.name,title:e.title??null,iconName:e.iconName??null,visible:e.visible??!0,useUnderline:e.useUnderline??!1,badgeNumber:normalizeBadgeNumber(e.badgeNumber),needsAttention:e.needsAttention??!1,startsSection:e.startsSection??!1,sectionTitle:e.sectionTitle??null}}function viewSwitcherPageFromStackPage(e){return createViewSwitcherPage({name:e.name,title:e.title,iconName:e.icon.length>0?e.icon:null,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention,useUnderline:e.useUnderline,startsSection:e.startsSection,sectionTitle:e.sectionTitle})}function viewSwitcherPagesFromStack(e){return e.map(e=>viewSwitcherPageFromStackPage(e))}function viewSwitcherSidebarSections(e){let t=[];for(let n of e)t.length===0||n.startsSection===!0?t.push({title:n.sectionTitle??``,pages:[n]}):t[t.length-1].pages.push(n);return t}function isViewSwitcherButtonVisible(e){return e.visible&&(isPresent(e.title)||isPresent(e.iconName))}function viewSwitcherIconName(e){return isPresent(e)&&e.length>0?e:`image-missing`}function viewSwitcherLabel(e){return isPresent(e.title)?e.useUnderline?stripMnemonic(e.title):e.title:``}function viewSwitcherBadgeLabel(e){let t=normalizeBadgeNumber(e);return t>999?`999+`:t===0?``:String(t)}const O={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=O){let r=normalizeBadgeNumber(t),i=e?n.attentionRequested:``,a=``;return r>999?a=n.badgeOverflow:r>0&&(a=n.badge(r)),i&&a?`${a} ${i}`:i||a}function inlineToggleTooltip(e,t){return t===`icons`?viewSwitcherLabel(e):``}function shouldRevealViewSwitcherBar(e,t){if(!e)return!1;let n=0;for(let e of t)if(e.visible&&(n++,n>1))return!0;return!1}function viewSwitcherButtonOrientation(e){return e===`wide`?`horizontal`:`vertical`}function buildViewSwitcherButtons(e,t,n,r=O){let i=viewSwitcherButtonOrientation(n);return e.map((e,n)=>({pageIndex:n,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),visible:isViewSwitcherButtonVisible(e),selected:n===t,orientation:i,badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,r)}))}function buildInlineToggles(e,t,n=O){let r=t!==`labels`,i=t!==`icons`,a=[];return e.forEach((e,o)=>{e.visible&&a.push({toggleIndex:a.length,pageIndex:o,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),showIcon:r,showLabel:i,tooltip:inlineToggleTooltip(e,t),badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,n)})}),a}function toggleIndexForPage(e,t){if(!Number.isInteger(t)||t<0||t>=e.length||!e[t].visible)return-1;let n=0;for(let r=0;r<t;r++)e[r].visible&&n++;return n}var ViewSwitcherDragSwitch=class{constructor(e){this._timers=new Map,this._scheduler=e.scheduler,this._onSwitch=e.onSwitch,this._delay=e.delay??500}enter(e,t){if(!Number.isInteger(e)||e<0||e===t||this._timers.has(e))return!1;let n=this._scheduler.schedule(()=>{this._timers.delete(e),this._onSwitch(e)},this._delay);return this._timers.set(e,n),!0}leave(e){let t=this._timers.get(e);t!==void 0&&(this._timers.delete(e),this._scheduler.cancel(t))}cancel(){for(let e of this._timers.values())this._scheduler.cancel(e);this._timers.clear()}get pending(){return[...this._timers.keys()].sort((e,t)=>e-t)}},ViewSwitcherState=class{constructor(e={}){this._pages=[],this._pagesView=null,this._stack=new ViewStackState,this._listeners=new Set,this._drag=e.scheduler?new ViewSwitcherDragSwitch({scheduler:e.scheduler,delay:e.dragSwitchDelay,onSwitch:e=>{this.setSelected(e)}}):null,this._subscribeStack()}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}setPages(e){let t=this.selected,n=t>=0?this.selectedName:null;this._pages=e.map(e=>createViewSwitcherPage(e)),this._pagesView=null;let r=new ViewStackState;for(let e of this._pages)r.addPage({name:e.name,title:e.title,visible:e.visible});if(n!==null){let e=r.indexOfName(n);e>=0&&r.setVisibleIndex(e,!1)}this._stack=r,this._subscribeStack(),this._drag?.cancel(),(this.selected!==t||this.selectedName!==(n??``))&&this._emit(!1)}get selected(){return this._stack.visibleIndex}get selectedName(){return this._stack.visibleName}get selectedPage(){return this._pages[this.selected]}get count(){return this._pages.length}setSelected(e,t=!0){return this._stack.setVisibleIndex(e,t)}selectName(e,t=!0){return this._stack.setVisibleName(e,t)}setPageVisible(e,t){let n=this._pages.findIndex(t=>t.name===e);if(n<0)return!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(this._pages[n]={...r,visible:i},this._pagesView=null,this._stack.setPageVisible(e,i))}dragEnter(e){this._drag?.enter(e,this.selected)}dragLeave(e){this._drag?.leave(e)}cancelDrag(){this._drag?.cancel()}get pendingDragSwitches(){return this._drag?.pending??[]}get diagnostics(){return this._stack.diagnostics}_subscribeStack(){this._stack.subscribe(e=>this._emit(e.interactive))}_emit(e){let t=this.selectedPage,n={selected:this.selected,name:t?.name??``,title:t?viewSwitcherLabel(t):``,interactive:e};for(let e of[...this._listeners])e(n)}},ViewSwitcherBarState=class{constructor(){this._reveal=!1,this._revealed=!1,this._pages=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get reveal(){return this._reveal}get revealed(){return this._revealed}setReveal(e){let t=!!e;return t===this._reveal?!1:(this._reveal=t,this._refresh(),!0)}setPages(e){return this._pages=e,this._refresh()}_refresh(){let e=shouldRevealViewSwitcherBar(this._reveal,this._pages);if(e===this._revealed)return!1;this._revealed=e;let t={reveal:this._reveal,revealed:this._revealed};for(let e of[...this._listeners])e(t);return!0}};function isPresent(e){return e!=null}function normalizeBadgeNumber(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function scrollMaxValue(e){return e.upper-e.pageSize}function isScrolledFromStart(e){return e.value>e.lower}function isScrolledFromEnd(e){return e.value<scrollMaxValue(e)}const Ze=[`undershoot-top`,`undershoot-bottom`,`undershoot-start`,`undershoot-end`];function scrollUndershootClasses(e){let t=[],{vertical:n,horizontal:r}=e;return n&&(isScrolledFromStart(n)&&t.push(`undershoot-top`),isScrolledFromEnd(n)&&t.push(`undershoot-bottom`)),r&&(isScrolledFromStart(r)&&t.push(`undershoot-start`),isScrolledFromEnd(r)&&t.push(`undershoot-end`)),t}function overshootDistance(e,t){let n=scrollMaxValue(t);return e<t.lower?e-t.lower:e>n?e-n:0}function accumulateOvershoot(e,t,n){let r=n.lower-100,i=scrollMaxValue(n)+100;return Math.min(Math.max(e+t,r),i)}var PopoverState=class{constructor(){this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={open:this._open,interactive:e};for(let e of[...this._listeners])e(t)}_setOpen(e,t){return e===this._open?!1:(this._open=e,this._emit(t),!0)}get open(){return this._open}popup(){return this._setOpen(!0,!1)}popdown(){return this._setOpen(!1,!1)}toggle(){return this._setOpen(!this._open,!0)}dismiss(){return this._setOpen(!1,!0)}};function resolvePopoverKey(e,t){if(e===`Escape`)return{action:`close`,index:-1};let n=Number.isFinite(t.itemCount)?Math.max(0,Math.trunc(t.itemCount)):0;if(n===0)return{action:`none`,index:-1};let r=t.currentIndex,i=Number.isFinite(r)&&r>=0&&r<n?Math.trunc(r):-1,a=t.hasSearch===!0&&i<0;switch(e){case`ArrowDown`:return{action:`focus`,index:i<0?0:(i+1)%n};case`ArrowUp`:return{action:`focus`,index:i<0?n-1:(i-1+n)%n};case`Home`:return a?{action:`none`,index:-1}:{action:`focus`,index:0};case`End`:return a?{action:`none`,index:-1}:{action:`focus`,index:n-1};case`Enter`:case` `:return i<0?{action:`none`,index:-1}:{action:`activate`,index:i};default:return{action:`none`,index:-1}}}const Qe=[`none`,`fill`,`spread`],$e=[`minimum`,`natural`],et=[`start-to-end`,`end-to-start`];function normalizeWrapBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?0:t}function normalizeWrapBoxAlign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function normalizeWrapBoxJustify(e){return Qe.includes(e)?e:`none`}function normalizeWrapPolicy(e){return $e.includes(e)?e:`natural`}function normalizeNaturalLineLength(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?-1:Math.trunc(t)}function normalizeWrapBoxLengthUnit(e){return normalizeLengthUnit(e,`px`)}function normalizeWrapBoxPackDirection(e){return et.includes(e)?e:`start-to-end`}function wrapBoxLengthToPx(e,t,n=96){return e<0?-1:adwLengthToPx(t,e,n)}function resolveWrapBoxLine(e){let t=e.lastLine&&!e.justifyLastLine?`none`:e.justify;if(t===`none`)return{justify:`none`,growChildren:!1,growGaps:!1,align:e.align};let n=t===`spread`&&e.childrenInLine>1;return{justify:t,growChildren:!n,growGaps:n,align:0}}function wrapPolicyFlexShrink(e){return+(e===`minimum`)}function resolveWrapBoxChildOrder(e){let{children:t,child:n,op:r}=e,i=e.sibling??null;if(i!==null&&i===n)return null;let a=t.indexOf(n);if(r===`insert-after`&&a!==-1||r===`reorder-after`&&a===-1)return null;let o=a===-1?[...t]:t.filter((e,t)=>t!==a);if(i===null)return[n,...o];let s=o.indexOf(i);return s===-1?null:[...o.slice(0,s+1),n,...o.slice(s+1)]}new Set(`ADC.AND.ASL.BCC.BCS.BEQ.BIT.BMI.BNE.BPL.BRK.BVC.BVS.CLC.CLD.CLI.CLV.CMP.CPX.CPY.DEC.DEX.DEY.EOR.INC.INX.INY.JMP.JSR.LDA.LDX.LDY.LSR.NOP.ORA.PHA.PHP.PLA.PLP.ROL.ROR.RTI.RTS.SBC.SEC.SED.SEI.STA.STX.STY.TAX.TAY.TSX.TXA.TXS.TYA`.split(`.`));const tt=`--accent-bg-color`,nt=`--accent-color`;function isAdwaitaDark(e){return e.closest(`.theme-dark`)?!0:e.closest(`.theme-light`)?!1:globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}const k=new WeakSet;function hasAppChosenAccent(e){return k.has(e)}function writeAdwaitaAccent(e,t,n){t.style.setProperty(tt,adwaitaAccentBgColor(e)),t.style.setProperty(nt,adwaitaAccentColor(e,n))}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement;k.add(n),writeAdwaitaAccent(e,n,t.dark??isAdwaitaDark(n))}function clearAdwaitaAccent(e=document.documentElement){k.delete(e),e.style.removeProperty(tt),e.style.removeProperty(nt)}let A={},rt=!1,j=null,it=!1;function readSystemAccent(){if(typeof CSS>`u`||!CSS.supports(`color`,`AccentColor`))return null;let e=document.createElement(`span`);e.style.color=`AccentColor`,e.style.display=`none`,document.documentElement.append(e);let t=getComputedStyle(e).color;e.remove();let n=parseAdwRgb(t);return n?{accent:nearestAccent(n),accentRgb:formatAdwRgb(n)}:null}function resolve(){if(A.accent&&A.accent!==te)return{accent:A.accent,source:`handoff`};let e=A.accentRgb?parseAdwRgb(A.accentRgb):null;if(e)return{accent:nearestAccent(e),source:`handoff`};if(A.accent===te){let e=readSystemAccent();if(e)return{accent:e.accent,source:`system`}}return null}function syncScheme(e){let t=A.colorScheme,n=t===`dark`?`theme-dark`:t===`light`?`theme-light`:null;n!==j&&(j&&e.classList.remove(j),j=null,n&&!e.classList.contains(`theme-dark`)&&!e.classList.contains(`theme-light`)&&(e.classList.add(n),j=n))}function sync(){let e=document.documentElement;if(syncScheme(e),hasAppChosenAccent(e))return;let t=resolve();t?(writeAdwaitaAccent(t.accent,e,isAdwaitaDark(e)),rt=!0):rt&&=(clearAdwaitaAccent(e),!1)}const isHandoffMeta=e=>e.nodeName===`META`&&e.getAttribute(`name`)?.startsWith(`adw-`)===!0;function touchesHandoffMeta(e){return e.type===`attributes`?isHandoffMeta(e.target)||e.attributeName===`name`&&e.oldValue?.startsWith(`adw-`)===!0:[...e.addedNodes,...e.removedNodes].some(isHandoffMeta)}function readMetaHandoff(){A=appearanceFromMeta(e=>document.head.querySelector(`meta[name="${e}"]`)?.getAttribute(`content`)??null)}function followDesktopAppearance(){it||typeof document>`u`||(it=!0,readMetaHandoff(),sync(),new MutationObserver(e=>{e.some(touchesHandoffMeta)&&(readMetaHandoff(),sync())}).observe(document.head,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`content`,`name`],attributeOldValue:!0}),globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).addEventListener(`change`,sync),globalThis.addEventListener(`focus`,()=>{A.accent===te&&sync()}))}function observeAdaptiveSize(e,t){let n=new ResizeObserver(e=>{let n=e[e.length-1];if(!n)return;let r=n.borderBoxSize?.[0];t(r?{width:r.inlineSize,height:r.blockSize}:{width:n.contentRect.width,height:n.contentRect.height})});return n.observe(e),()=>n.disconnect()}function addBreakpoints(e,t){return observeAdaptiveSize(e,e=>{for(let n of t)n.evaluate(e)})}function bindBreakpointSetter(e,t,n,r=!1){return t?addBreakpoints(e,[new AdwBreakpoint(t,{onApply:()=>n(!0),onUnapply:()=>n(!1)},r)]):()=>{}}const at=`adw-scroll-shaded`,ot=`--adw-overshoot`,st=[`overshoot-top`,`overshoot-bottom`],M=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:M.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:M.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return M.has(t.overflowY)||M.has(t.overflowX)}function wheelDeltaPx(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}var AdwScrollShading=class{_root;_mutations=null;_resize=null;_unclamped=new WeakMap;_settleTimers=new WeakMap;_shaded=new Set;_pendingScan=0;_undershootEdges={top:!0,bottom:!0};_onOvershoot;constructor(e,t={}){this._root=e,this._onOvershoot=t.onOvershoot??null}setUndershootEdges(e){if(!(e.top===this._undershootEdges.top&&e.bottom===this._undershootEdges.bottom)){this._undershootEdges={...e};for(let e of this._shaded)this._update(e)}}connect(){this._mutations||(this._root.addEventListener(`scroll`,this._onScroll,{capture:!0,passive:!0}),this._root.addEventListener(`wheel`,this._onWheel,{capture:!0,passive:!0}),this._mutations=new MutationObserver(()=>this._scheduleRefresh()),this._mutations.observe(this._root,{childList:!0,subtree:!0}),this._resize=new ResizeObserver(()=>this._scheduleRefresh()),this._resize.observe(this._root),this.refresh())}disconnect(){this._root.removeEventListener(`scroll`,this._onScroll,{capture:!0}),this._root.removeEventListener(`wheel`,this._onWheel,{capture:!0}),this._mutations?.disconnect(),this._mutations=null,this._resize?.disconnect(),this._resize=null,this._pendingScan&&cancelAnimationFrame(this._pendingScan),this._pendingScan=0;for(let e of this._shaded)this._clear(e);this._shaded.clear()}_scheduleRefresh(){this._pendingScan||=requestAnimationFrame(()=>{this._pendingScan=0,this.refresh()})}refresh(){let e=new Set;isScroller(this._root)&&e.add(this._root);for(let t of this._root.querySelectorAll(`*`))isScroller(t)&&e.add(t);for(let t of this._shaded)e.has(t)||this._clear(t);this._shaded=e;for(let t of e)this._update(t)}_clear(e){e.classList.remove(at,...Ze,...st),e.style.removeProperty(ot)}_update(e){e.classList.add(at);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of Ze){let r=(n!==`undershoot-top`||this._undershootEdges.top)&&(n!==`undershoot-bottom`||this._undershootEdges.bottom);e.classList.toggle(n,r&&t.includes(n))}}_onScroll=e=>{let t=e.target;t instanceof HTMLElement&&this._shaded.has(t)&&this._update(t)};_onWheel=e=>{let t=e.target instanceof HTMLElement?this._scrollerFor(e.target):null;if(!t)return;let{vertical:n}=adjustmentsOf(t);if(!n)return;let r=this._unclamped.get(t)??n.value,i=accumulateOvershoot(overshootDistance(r,n)===0?n.value:r,wheelDeltaPx(e,n.pageSize),n);this._unclamped.set(t,i),this._applyOvershoot(t,overshootDistance(i,n)),clearTimeout(this._settleTimers.get(t)),this._settleTimers.set(t,setTimeout(()=>{this._unclamped.set(t,t.scrollTop),this._applyOvershoot(t,0)},50))};_applyOvershoot(e,t){e.classList.toggle(`overshoot-top`,t<0),e.classList.toggle(`overshoot-bottom`,t>0),t===0?e.style.removeProperty(ot):e.style.setProperty(ot,`${Math.abs(t)}px`),this._onOvershoot?.(t)}_scrollerFor(e){for(let t=e;t;t=t.parentElement){if(this._shaded.has(t))return t;if(t===this._root)break}return null}};const N={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0};({...N}),{...N},{...N},{...N},{...N},{...N},{...N};const withDay=e=>{let t=Array.from({length:31},()=>!1);for(let n of e)t[n-1]=!0;return t};withDay([]),withDay([14]),withDay([14]),withDay([14]),withDay([]),withDay([]),withDay([1]),withDay([1]),withDay([31]),withDay([31]),withDay([]),withDay([31]);const P={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};({...P}),{...P},{...P},{...P},{...P},{...P};const F={active:!1,checked:!1,keyboardActivating:!1};({...F}),{...F},{...F},{...F},{...F},{...F};const ct=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...ct],[...ct],Math.PI*.015,Math.PI*.35,Math.PI*.015,Math.PI*.9;const attributeOf=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),lt=new WeakMap;function bindSlottedChildren(e,t,n){let r=new Map,i=[],a=null;for(let e of t){let t=e.claims;e.name!==void 0&&r.set(e.name,e),t!==void 0&&i.push([t,e]),e.name===void 0&&t===void 0&&(a=e)}let o=new Set,s=null,slotFor=e=>{if(o.has(e))return null;let t=e instanceof Element?e.getAttribute(`slot`)??``:``;if(t!==``)return r.get(t)??null;for(let[t,n]of i)if(t(e))return n;return a},route=t=>{let n=slotFor(t);return n===null?null:`into`in n?(n.into.appendChild(t),n):(n.consume(t),t.parentNode===e&&e.removeChild(t),n)},c={slots:t,slotFor,install(...t){for(let t of Array.from(e.childNodes))route(t);o=new Set(t),e.replaceChildren(...t),s?.disconnect(),s=new MutationObserver(t=>{for(let r of t)if(r.target===e)for(let e of r.addedNodes){let t=route(e);t!==null&&n?.(e,t)}}),s.observe(e,{childList:!0})}};return lt.set(e,c),c}const ut=`adw-icon--`;var GtkImage=class extends HTMLElement{static get observedAttributes(){return[`icon-name`,`size`]}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get resolvedIconName(){return normalizeIconName(this.getAttribute(`icon-name`))}get size(){let e=Number.parseFloat(this.getAttribute(`size`)??``);return Number.isFinite(e)&&e>0?e:null}set size(e){e===null?this.removeAttribute(`size`):this.setAttribute(`size`,String(e))}connectedCallback(){this._render()}attributeChangedCallback(){this._render()}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(ut));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${ut}image-missing`):this.classList.add(`${ut}${t}`),this.setAttribute(`aria-hidden`,`true`);let n=this.size;if(n===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${n}px`;this.style.width=e,this.style.height=e,this.style.setProperty(`mask-size`,e),this.style.setProperty(`-webkit-mask-size`,e)}}};function createGtkImage(e,...t){let n=document.createElement(`gtk-image`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`gtk-image`,GtkImage);const dt=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);var AdwModalSurface=class{_init;_previouslyFocused=null;constructor(e){this._init=e,e.surface.setAttribute(`role`,e.role),e.surface.setAttribute(`aria-modal`,`true`),e.surface.hasAttribute(`tabindex`)||(e.surface.tabIndex=-1),e.host.addEventListener(`keydown`,e=>this._onKeyDown(e))}focusables(){return Array.from(this._init.surface.querySelectorAll(dt)).filter(e=>!e.hasAttribute(`disabled`)&&!e.hidden&&e.getClientRects().length>0)}present(){let e=document.activeElement;this._previouslyFocused=e instanceof HTMLElement&&e!==this._init.host?e:null;let t=this.focusables(),n=this._init.initialFocus?.(t);((n&&t.includes(n)?n:void 0)??t[0]??this._init.surface).focus()}dismiss(){let e=this._previouslyFocused;this._previouslyFocused=null,e&&e.isConnected&&e.focus()}_onKeyDown(e){if(!this._init.isOpen())return;if(e.key===`Escape`){e.stopPropagation(),this._init.onEscape();return}if(e.key!==`Tab`)return;e.stopPropagation();let t=this.focusables();if(t.length===0){e.preventDefault(),this._init.surface.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||i===this._init.surface||i===this._init.host)?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||i===this._init.host)&&(e.preventDefault(),n.focus())}};function rowLabel(e){return stripMnemonic(u[e])}var AdwAboutDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_sheetEl;_modal;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-url`,`open`]}get applicationName(){return this.getAttribute(`application-name`)??``}set applicationName(e){this.setAttribute(`application-name`,e)}get applicationIcon(){return this.getAttribute(`application-icon`)??``}set applicationIcon(e){this.setAttribute(`application-icon`,e)}get developerName(){return this.getAttribute(`developer-name`)??``}set developerName(e){this.setAttribute(`developer-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get supportUrl(){return this.getAttribute(`support-url`)??``}set supportUrl(e){this.setAttribute(`support-url`,e)}get issueUrl(){return this.getAttribute(`issue-url`)??``}set issueUrl(e){this.setAttribute(`issue-url`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get developers(){return this._developers}set developers(e){this._developers=[...e],this._initialized&&this._render()}get designers(){return this._designers}set designers(e){this._designers=[...e],this._initialized&&this._render()}get artists(){return this._artists}set artists(e){this._artists=[...e],this._initialized&&this._render()}get documenters(){return this._documenters}set documenters(e){this._documenters=[...e],this._initialized&&this._render()}present(){this.open=!0}close(){this.open=!1}connectedCallback(){this._initialized||(this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-about-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this.close()),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-about-dialog-sheet`,this._sheetEl.setAttribute(`aria-label`,u.dialogTitle),this.replaceChildren(this._scrimEl,this._sheetEl),this._modal=new AdwModalSurface({host:this,surface:this._sheetEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this.close()}),this._render())}attributeChangedCallback(e,t,n){if(this._initialized&&t!==n){if(e===`open`){this._syncOpen(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open||this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}));return}this._render()}}_syncOpen(){this.classList.toggle(`open`,this.open),this.open?(this._navView.replace?.([`main`]),this._scrollEl.scrollTop=0,this._updateHeaderTitle(),this._modal.present()):this._modal.dismiss()}_creditsSections(){return creditsSections({developers:this._developers,designers:this._designers,artists:this._artists,documenters:this._documenters})}_hasLegal(){let e=this.license.length>0?o.CUSTOM:o.UNKNOWN;return legalSectionVisible(this.copyright,e,this.license)}_render(){let e=this._creditsSections(),t=aboutDialogVisibility({applicationIcon:this.applicationIcon,applicationName:this.applicationName,developerName:this.developerName,version:this.version,comments:this.comments,website:this.website,supportUrl:this.supportUrl,issueUrl:this.issueUrl,hasCredits:e.length>0,hasLegal:this._hasLegal()});this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(t)),t.detailsRow&&this._navView.append(this._buildDetailsPage(t)),t.creditsRow&&this._navView.append(this._buildCreditsPage(e)),t.legalRow&&this._navView.append(this._buildLegalPage()),this._sheetEl.replaceChildren(this._navView),this.classList.toggle(`open`,this.open)}_buildPage(e,t,n,r=t){let i=document.createElement(`adw-navigation-page`);i.setAttribute(`title`,t),i.setAttribute(`tag`,e);let a=document.createElement(`adw-header-bar`);if(a.setAttribute(`title`,r),n){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-button flat circular adw-about-dialog-close`,e.setAttribute(`aria-label`,`Close`),e.addEventListener(`click`,()=>this.close());let endApply=()=>{let t=a.endSection??null;t&&t.appendChild(e)};queueMicrotask(endApply)}let o=document.createElement(`div`);o.className=`adw-about-dialog-scroll`;let s=document.createElement(`div`);s.className=`adw-about-dialog-clamp`;let c=document.createElement(`div`);c.className=`adw-about-dialog-page-body`,s.appendChild(c),o.appendChild(s);let l=document.createElement(`div`);return l.className=`adw-about-dialog-toolbar-view`,l.append(a,o),i.appendChild(l),e===`main`&&(this._scrollEl=o,this._mainToolbarEl=l,l.classList.add(`main-page`),o.addEventListener(`scroll`,()=>this._updateHeaderTitle())),{page:i,body:c,header:a}}_buildMainPage(e){let{page:t,body:n}=this._buildPage(`main`,u.dialogTitle,!0,this.applicationName);if(e.appIcon&&n.appendChild(createGtkImage(this.applicationIcon,`adw-about-dialog-icon`)),e.appName){let e=document.createElement(`span`);e.className=`adw-about-dialog-name`,e.textContent=this.applicationName,n.appendChild(e)}if(e.developerName){let e=document.createElement(`span`);e.className=`adw-about-dialog-developer`,e.textContent=this.developerName,n.appendChild(e)}if(e.version){let e=document.createElement(`span`);e.className=`adw-about-dialog-version`,e.textContent=this.version,n.appendChild(e)}let r=[];e.detailsRow&&r.push(this._buildNavRow(rowLabel(`detailsRow`),`details`)),e.websiteRow&&r.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website));let i=[];e.supportRow&&i.push(this._buildLinkRow(rowLabel(`supportRow`),this.supportUrl)),e.issueRow&&i.push(this._buildLinkRow(rowLabel(`issueRow`),this.issueUrl));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.detailsGroup&&n.appendChild(this._buildGroup(`details`,r)),e.supportGroup&&n.appendChild(this._buildGroup(`support`,i)),e.creditsLegalGroup&&n.appendChild(this._buildGroup(`credits-legal`,a)),t}_buildGroup(e,t,n){let r=document.createElement(`adw-preferences-group`);e!==null&&r.setAttribute(`data-group`,e),n!==void 0&&r.setAttribute(`title`,n);for(let e of t)r.appendChild(e);let i=document.createElement(`div`);return i.className=`adw-about-dialog-rows`,i.appendChild(r),i}_buildNavRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>{this._navView.push?.(t)}),n}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}_buildDetailsPage(e){let{page:t,body:n}=this._buildPage(`details`,u.detailsPage,!1);if(e.commentsLabel){let e=document.createElement(`p`);e.className=`adw-about-dialog-comments`,e.textContent=this.comments,n.appendChild(e)}if(e.linksGroup){let t=[];e.detailsWebsiteRow&&t.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website)),n.appendChild(this._buildGroup(`links`,t))}return t}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``),n.classList.add(`adw-about-dialog-link-row`);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>this._activateLink(t)),n}_buildCreditsPage(e){let{page:t,body:n}=this._buildPage(`credits`,u.creditsPage,!1);for(let t of e){let e=t.people.map(e=>this._buildCreditRow(e));n.appendChild(this._buildGroup(null,e,t.title??void 0))}return t}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;t.setAttribute(`activatable`,``),t.classList.add(`adw-about-dialog-link-row`);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);r.setAttribute(`slot`,`suffix`),t.appendChild(r),t.addEventListener(`activated`,()=>this._activateLink(n))}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,u.legalPage,!1);if(this.copyright){let e=document.createElement(`p`);e.className=`adw-about-dialog-copyright`,e.textContent=this.copyright,t.appendChild(e)}if(this.license){let e=document.createElement(`p`);if(e.className=`adw-about-dialog-license`,this.licenseUrl){let t=document.createElement(`a`);t.href=this.licenseUrl,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(this.licenseUrl)}),e.appendChild(t)}else e.textContent=this.license;t.appendChild(e)}return e}_updateHeaderTitle(){!this._scrollEl||!this._mainToolbarEl||this._mainToolbarEl.classList.toggle(`scrolled`,this._scrollEl.scrollTop>0)}};customElements.define(`adw-about-dialog`,AdwAboutDialog);function bindEmptySections(...e){let derive=()=>{for(let t of e)t.hidden=t.childElementCount===0},t=new MutationObserver(derive);for(let n of e)t.observe(n,{childList:!0});derive()}function attachRowActivation(e){let{row:t,activatable:n}=e,r=e.activate??(()=>t.click());t.addEventListener(`keydown`,e=>{e.target===t&&n()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r()))});let sync=()=>{n()?t.tabIndex=0:t.removeAttribute(`tabindex`)};return sync(),{sync}}const ft=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends HTMLElement{_titleEl;_subtitleEl;_suffixEl;_prefixEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;_activation;static get observedAttributes(){return[`title`,`subtitle`,`activatable`]}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}get activatableWidget(){return this._state.activatableWidget}set activatableWidget(e){this._state.setActivatableWidget(e,e?isSensitive(e):!0)&&(this._observeSensitivity(e),this._syncActivatable())}get activatable(){return this._state.activatable}connectedCallback(){if(this._initialized){this._observeSensitivity(this._state.activatableWidget);return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;let e=document.createElement(`div`);e.className=`adw-action-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),bindEmptySections(this._prefixEl,this._suffixEl),this._adoptAttributes(),this._render(),this.addEventListener(`click`,e=>this._onClick(e)),this._activation=attachRowActivation({row:this,activatable:()=>this._state.activatable})}_adoptAttributes(){this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._state.setActivatable(this.hasAttribute(`activatable`))}disconnectedCallback(){this._sensitivityObserver?.disconnect(),this._sensitivityObserver=null}attributeChangedCallback(){this._initialized&&(this._adoptAttributes(),this._render())}_onClick(e){if(!this._state.activatable)return;let t=this._state.activate();t&&e.target instanceof Node&&t.contains(e.target)||(t?.click(),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0})))}_observeSensitivity(e){if(this._sensitivityObserver?.disconnect(),!e){this._sensitivityObserver=null;return}this._sensitivityObserver??=new MutationObserver(()=>{let e=this._state.activatableWidget;e&&this._state.setActivatableWidgetSensitive(isSensitive(e))&&this._syncActivatable()}),this._sensitivityObserver.observe(e,{attributeFilter:ft})}_syncActivatable(){this.toggleAttribute(`activatable`,this._state.activatable),this._initialized&&this._render()}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r,this.classList.toggle(`activatable`,this._state.activatable),this._activation?.sync()}};customElements.define(`adw-action-row`,AdwActionRow);var AdwAlertResponse=class extends HTMLElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_modal;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;static get observedAttributes(){return[`heading`,`body`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`open`,`prefer-wide-layout`]}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,e)}get body(){return this.getAttribute(`body`)??``}set body(e){this.setAttribute(`body`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get headingUseMarkup(){return this.hasAttribute(`heading-use-markup`)}set headingUseMarkup(e){e?this.setAttribute(`heading-use-markup`,``):this.removeAttribute(`heading-use-markup`)}get bodyUseMarkup(){return this.hasAttribute(`body-use-markup`)}set bodyUseMarkup(e){e?this.setAttribute(`body-use-markup`,``):this.removeAttribute(`body-use-markup`)}get preferWideLayout(){return this.hasAttribute(`prefer-wide-layout`)}set preferWideLayout(e){e?this.setAttribute(`prefer-wide-layout`,``):this.removeAttribute(`prefer-wide-layout`)}get defaultResponse(){return this._model.defaultResponse}set defaultResponse(e){this.setDefaultResponse(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.setCloseResponse(e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-alert-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._dismiss()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-alert-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`alertdialog`,isOpen:()=>this.open,onEscape:()=>this._dismiss(),initialFocus:e=>this._initialFocusTarget(e)});let e=document.createElement(`div`);e.className=`adw-alert-dialog-message`,this._headingEl=document.createElement(`h2`),this._headingEl.className=`adw-alert-dialog-heading`,this._bodyEl=document.createElement(`p`),this._bodyEl.className=`adw-alert-dialog-body`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-alert-dialog-child`,e.append(this._headingEl,this._bodyEl,this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{into:this._childEl}]).install(this._scrimEl,this._dialogEl),bindEmptySections(this._childEl),this._model.heading=this.heading,this._model.body=this.body;let t=this.getAttribute(`close-response`);t!==null&&(this._model.closeResponse=t),this._model.defaultResponse=this.getAttribute(`default-response`),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.addResponse(t,(e.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(t,n),e.getAttribute(`enabled`)===`false`&&this.setResponseEnabled(t,!1)}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`heading`?(this._model.heading=this.heading,this.dispatchEvent(new CustomEvent(`notify::heading`,{bubbles:!0,detail:{heading:this.heading}}))):e===`body`?(this._model.body=this.body,this.dispatchEvent(new CustomEvent(`notify::body`,{bubbles:!0,detail:{body:this.body}}))):e===`close-response`?n!==null&&this.setCloseResponse(n):e===`default-response`?this.setDefaultResponse(n):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._modal.dismiss()))}present(e){this.open=!0}addResponse(e,t){if(this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to add a response with id '${e}', but such a response already exists`);return}let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button adw-alert-dialog-response`,n.textContent=t,n.addEventListener(`click`,()=>this._activateResponse(e)),this._model.addResponse(e,t),this._buttons.set(e,n),this._responseAreaEl&&this._responseAreaEl.appendChild(n),this._render()}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}removeResponse(e){if(!this._model.hasResponse(e))return;this._buttons.get(e)?.remove(),this._buttons.delete(e);let t=this._model.responses.filter(t=>t.id!==e),n=new AdwAlertResponses(this._model.heading,this._model.body);for(let e of t)n.addResponse(e.id,e.label,{appearance:e.appearance,enabled:e.enabled});n.closeResponse=this._model.closeResponse,n.defaultResponse=this._model.defaultResponse===e?null:this._model.defaultResponse,this._model=n,this._render()}hasResponse(e){return this._model.hasResponse(e)}getResponseLabel(e){return this._model.responses.find(t=>t.id===e)?.label??null}setResponseLabel(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}getResponseAppearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}setResponseAppearance(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseAppearance(e,t),n.classList.toggle(`suggested-action`,t===`suggested`),n.classList.toggle(`destructive-action`,t===`destructive`))}getResponseEnabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}setResponseEnabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}setDefaultResponse(e){this._model.defaultResponse=e,this._render()}setCloseResponse(e){this._model.closeResponse=e}_activateResponse(e){this._model.getResponseEnabled(e)&&(this._blockCloseResponse=!0,this.open=!1,this._blockCloseResponse=!1,this._emitResponse(this._model.resolveById(e)))}_dismiss(){this.open&&(this.open=!1,!this._blockCloseResponse&&this._emitResponse(this._model.resolveById(null)))}_emitResponse(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{response:e}}))}_initialFocusTarget(e){return e.find(e=>this._childEl.contains(e))??this._defaultResponseButton()}_defaultResponseButton(){let e=this._model.defaultResponse,t=this._model.responses.find(e=>e.enabled)?.id;return(e!==null&&this._model.getResponseEnabled(e)?this._buttons.get(e):void 0)??(t?this._buttons.get(t):void 0)}_render(){this.classList.toggle(`open`,this.open);let e=this.heading;this.headingUseMarkup?this._headingEl.innerHTML=e:this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?this._bodyEl.innerHTML=t:this._bodyEl.textContent=t,this._bodyEl.hidden=t.length===0;let n=this.preferWideLayout&&this._model.responses.length<=2;this._responseAreaEl.classList.toggle(`horizontal`,n);let r=this._model.defaultResponse;for(let e of this._model.responses){let t=e.id===r&&e.appearance==="default";this._buttons.get(e.id)?.classList.toggle(`default-response`,t)}}};customElements.define(`adw-alert-response`,AdwAlertResponse),customElements.define(`adw-alert-dialog`,AdwAlertDialog);var AdwWindow=class extends HTMLElement{_initialized=!1;_contentEl;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];static get observedAttributes(){return[`width`,`height`]}get contentArea(){return this._contentEl}get content(){return this._contentEl.firstElementChild}set content(e){e&&this._contentEl.appendChild(e)}get breakpoints(){return this._breakpoints}get currentBreakpoint(){return this._breakpoints.find(e=>e.applied)??null}get dialogs(){return this._openDialogs=this._openDialogs.filter(e=>e.isConnected),this._openDialogs}get visibleDialog(){let e=this.dialogs;return e.length>0?e[e.length-1]:null}addBreakpoint(e){let t=new AdwBreakpoint(e,{onApply:()=>this.dataset.breakpoint=e,onUnapply:()=>{this.dataset.breakpoint===e&&delete this.dataset.breakpoint}});return this._breakpoints.push(t),this._bindBreakpoints(),t}connectedCallback(){this._buildOnce(),this._bindBreakpoints()}disconnectedCallback(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}attributeChangedCallback(e){(e===`width`||e===`height`)&&this._applySizeRequest()}_buildOnce(){this._initialized||(this._initialized=!0,this._applySizeRequest(),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-window-content`,bindSlottedChildren(this,[{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._contentEl),this.addEventListener(`notify::open`,e=>{let t=e.target;t!==this&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}_bindBreakpoints(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._initialized&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this,this._breakpoints))}_applySizeRequest(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`);this.style.width=e?`${e}px`:`360px`,this.style.height=t?`${t}px`:`200px`}};customElements.define(`adw-window`,AdwWindow);var AdwApplicationWindow=class extends AdwWindow{_menubarEl=null;_model=[];static get observedAttributes(){return[...AdwWindow.observedAttributes,`show-menubar`,`menu-model`]}get showMenubar(){return this.hasAttribute(`show-menubar`)}set showMenubar(e){e?this.setAttribute(`show-menubar`,``):this.removeAttribute(`show-menubar`)}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),this._renderMenubar()}get menubar(){return this._menubarEl}connectedCallback(){super.connectedCallback(),this._buildMenubar()}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`))),(e===`show-menubar`||e===`menu-model`)&&this._renderMenubar()}_buildMenubar(){this._menubarEl||(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this.contentArea.prepend(this._menubarEl),this._renderMenubar())}_renderMenubar(){let e=this._menubarEl;if(e!==null){e.replaceChildren(),e.hidden=!this.showMenubar||this._model.length===0;for(let t of flattenMenu(this._model)){let n=t.node;if(n.kind===`submenu`){let t=document.createElement(`gtk-menu-button`);t.setAttribute(`menu-title`,n.label),t.menuModel=n.items,e.appendChild(t);continue}let r=document.createElement(`gtk-button`);r.setAttribute(`label`,n.label??``),r.setAttribute(`flat`,``),r.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t.path]}}))}),e.appendChild(r)}}}};customElements.define(`adw-application-window`,AdwApplicationWindow);var AdwAvatar=class extends HTMLElement{_textEl;_iconEl;_imageEl;_initialized=!1;static get observedAttributes(){return[`text`,`size`,`show-initials`,`icon`,`custom-image`]}connectedCallback(){this._initialized||(this._initialized=!0,this._textEl=document.createElement(`span`),this._textEl.className=`adw-avatar-text`,this._iconEl=createGtkImage(null,`adw-avatar-icon`),this._imageEl=document.createElement(`img`),this._imageEl.className=`adw-avatar-custom-image`,this._imageEl.alt=``,this.replaceChildren(this._textEl,this._iconEl,this._imageEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=parseFloat(this.getAttribute(`size`)||`48`);this.style.width=`${e}px`,this.style.height=`${e}px`;let t=this.getAttribute(`text`)??``,n=this.getAttribute(`custom-image`)??``,r=avatarMode({hasCustomImage:n.length>0,showInitials:this.hasAttribute(`show-initials`),text:t});if(this._imageEl.hidden=r!==`image`,r===`image`)this._imageEl.getAttribute(`src`)!==n&&(this._imageEl.src=n),this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.hidden=!0;else if(r===`initials`){let{fg:n,start:r,stop:i}=avatarColor(t);this.style.backgroundImage=`linear-gradient(${r}, ${i})`,this.style.color=n,this._textEl.textContent=avatarInitials(t),this._textEl.hidden=!1,this._iconEl.hidden=!0,this._applyFontSize(e)}else this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.iconName=this.getAttribute(`icon`)??`avatar-default`,this._iconEl.size=avatarIconSize(e),this._iconEl.hidden=!1}_applyFontSize(e){let t=avatarMaxFontSize(e);this._textEl.style.fontSize=`${t}px`;let{width:n,height:r}=this._textEl.getBoundingClientRect();this._textEl.style.fontSize=`${avatarFontSize(e,{width:n,height:r})}px`}};customElements.define(`adw-avatar`,AdwAvatar);var AdwBanner=class extends HTMLElement{_titleEl;_button;_initialized=!1;static get observedAttributes(){return[`title`,`button-label`,`revealed`,`use-markup`,`button-style`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-banner-title`,this._button=document.createElement(`button`),this._button.className=`adw-banner-button`,this._button.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`button-clicked`,{bubbles:!0}))}),this.replaceChildren(this._titleEl,this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.getAttribute(`title`)??``;this.hasAttribute(`use-markup`)?this._titleEl.innerHTML=e:this._titleEl.textContent=e;let t=this.getAttribute(`button-label`)??``;this._button.textContent=bannerButtonText(t),this._button.hidden=!bannerButtonVisible(t);let n=bannerButtonStyleClasses(parseBannerButtonStyle(this.getAttribute(`button-style`)));for(let e of re)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends HTMLElement{_observer=null;get child(){return this.lastElementChild}set child(e){this.setChild(e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._enforceSingleChild(),this._observer??=new MutationObserver(()=>this._enforceSingleChild()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){this._observer?.disconnect()}_enforceSingleChild(){let e=this.lastElementChild;if(e!==null)for(let t of Array.from(this.children)){if(t===e)break;t.remove()}}setChild(e){if(e!==null&&e.parentElement!==null&&e.parentElement!==this)throw Error(`AdwBin.setChild: the child already has a parent.`);if(e===this.child)return;let t=this.child;e===null?t?.remove():this.replaceChildren(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}}))}};customElements.define(`adw-bin`,AdwBin);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheetBottomBar=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_sheetBodyEl;_bottomBarEl;_dragHandleEl;_pendingBottomBar=null;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`can-open`,`reveal-bottom-bar`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._state.modal}set modal(e){this._setBoolAttr(`modal`,e)}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get canOpen(){return this._state.canOpen}set canOpen(e){this._setBoolAttr(`can-open`,e)}get revealBottomBar(){return this._state.revealBottomBar}set revealBottomBar(e){this._setBoolAttr(`reveal-bottom-bar`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}get bottomBar(){return this._initialized?this._bottomBarEl.firstChild:this._pendingBottomBar}setBottomBar(e){if(this._state.setHasBottomBar(e!==null),!this._initialized){this._pendingBottomBar=e;return}e?this._bottomBarEl.replaceChildren(e):this._bottomBarEl.replaceChildren(),this._render()}requestOpen(e){return this._state.requestOpen(e)}requestClose(e){let t=this._state.requestClose(e);return t===`close-attempt`?this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0})):t===`delegate`&&this.dispatchEvent(new CustomEvent(`sheet.close`,{bubbles:!0})),t}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`,this._dimmingEl=document.createElement(`div`),this._dimmingEl.className=`adw-bottom-sheet-dimming`,this._dimmingEl.addEventListener(`click`,()=>this.requestClose(`dimming`)),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-bottom-sheet-sheet`,this._dragHandleEl=document.createElement(`div`),this._dragHandleEl.className=`adw-bottom-sheet-drag-handle`,this._dragHandleEl.setAttribute(`aria-hidden`,`true`),this._sheetBodyEl=document.createElement(`div`),this._sheetBodyEl.className=`adw-bottom-sheet-sheet-body`,this._bottomBarEl=document.createElement(`button`),this._bottomBarEl.type=`button`,this._bottomBarEl.className=`adw-bottom-sheet-bottom-bar`,this._bottomBarEl.addEventListener(`click`,()=>this.requestOpen(`bottom-bar`)),this._sheetEl.append(this._bottomBarEl,this._dragHandleEl,this._sheetBodyEl);let layer=(e,t)=>({claims:t=>t instanceof Element&&t.localName===e,consume:e=>{for(let n of Array.from(e.childNodes))t.appendChild(n)}});bindSlottedChildren(this,[{name:`sheet`,into:this._sheetBodyEl},{name:`bottom-bar`,into:this._bottomBarEl},{name:`content`,into:this._contentEl},layer(`adw-bottom-sheet-sheet`,this._sheetBodyEl),layer(`adw-bottom-sheet-bottom-bar`,this._bottomBarEl),layer(`adw-bottom-sheet-content`,this._contentEl),{into:this._contentEl}],(e,t)=>{!(`into`in t)||t.into!==this._bottomBarEl||(this._state.setHasBottomBar(!0),this._render())}).install(this._contentEl,this._dimmingEl,this._sheetEl),this._pendingBottomBar&&this._bottomBarEl.replaceChildren(this._pendingBottomBar),this._pendingBottomBar=null,this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(!this.open&&!this._sheetEl.contains(e.target)||(e.stopPropagation(),this.requestClose(`escape`)))}),this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._state.setCanOpen(this._boolAttr(`can-open`,!0)),this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._state.setHasBottomBar(this._bottomBarEl.childNodes.length>0),this._state.setOpen(this._boolAttr(`open`,!1)),this._state.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}),this._render()}attributeChangedCallback(e,t,n){if(!this._reflecting&&t!==n){if(e===`open`){this._state.setOpen(this._boolAttr(`open`,!1));return}e===`modal`&&this._state.setModal(this._boolAttr(`modal`,!0)),e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),e===`can-open`&&this._state.setCanOpen(this._boolAttr(`can-open`,!0)),e===`reveal-bottom-bar`&&this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open,t=this._state.chrome,n=t.layer===`bottom-bar`;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this._state.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this.classList.toggle(`showing-bottom-bar`,n&&t.surfaceVisible),this._dimmingEl.classList.toggle(`visible`,t.dimmed),this._bottomBarEl.hidden=!n,this._bottomBarEl.classList.toggle(`inert`,t.bottomBarInert),this._sheetBodyEl.hidden=n,this._dragHandleEl.hidden=!this.showDragHandle||n}_reflectOpen(e){this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1}_boolAttr(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBoolAttr(e,t){t?this.setAttribute(e,``):this.setAttribute(e,`false`)}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet-bottom-bar`,AdwBottomSheetBottomBar),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);function parseBreakpoints(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return console.error("<adw-breakpoint-bin>: `breakpoints` is not JSON; no breakpoint is applied."),[]}return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{condition:t,setters:n}=e;return typeof t==`string`?[{condition:t,setters:Array.isArray(n)?n:[]}]:[]}):[]}var AdwBreakpointBin=class extends HTMLElement{_state=new BreakpointBinState;_dispose;_applied=null;_pendingSync=!1;_originals=new Map;static get observedAttributes(){return[`breakpoints`]}get currentBreakpoint(){return this._state.current}get currentBreakpointAttribute(){let e=this._state.current;return e===null?null:String(e)}get child(){return this.firstElementChild}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._syncSizing(),this._pendingSync=!0,this._observe()}disconnectedCallback(){this._dispose?.(),this._dispose=void 0}attributeChangedCallback(e){e!==`breakpoints`||!this.isConnected||(this._originals.clear(),this._syncBreakpoints())}_syncBreakpoints(){this._pendingSync=!1;let e=parseBreakpoints(this.getAttribute(`breakpoints`));this._state=new BreakpointBinState;for(let t of e){let e=[];for(let n of t.setters){if(typeof n?.target!=`string`||typeof n.property!=`string`)continue;let t=this.querySelector(n.target);if(t===null)continue;let r=`${n.target}\u0000${n.property}\u0000${n.value}`;this._originals.has(r)||this._originals.set(r,t.getAttribute(n.property)),e.push({object:t,property:n.property,value:n.value,originalValue:this._originals.get(r)??null})}this._state.add({condition:t.condition,setters:e})}this._state.inherit(this._applied),this._state.setHasChild(this.child!==null),this._write(this._state.current),this._syncSizing()}_observe(){this._dispose?.(),this._dispose=observeAdaptiveSize(this,e=>{this._pendingSync&&this._syncBreakpoints(),this._state.setHasChild(this.child!==null);let t=this._state.evaluate(e);t!==null&&(this._emit(t.from,`breakpoint-unapply`),this._perform(t.writes),this._write(t.to),this._emit(t.to,`breakpoint-apply`),this.dispatchEvent(new CustomEvent(`notify::current-breakpoint`,{bubbles:!0,detail:{currentBreakpoint:this.currentBreakpointAttribute}})))})}_perform(e){for(let t of e)t.value===null?t.object.removeAttribute(t.property):t.object.setAttribute(t.property,String(t.value))}_write(e){this._applied=e}_emit(e,t){e!==null&&this.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:{index:e}}))}_syncSizing(){let e=this._state.length>0;this.style.minWidth=e?`0px`:``,this.style.minHeight=e?`0px`:``,e&&(this.style.overflow=`hidden`)}};customElements.define(`adw-breakpoint-bin`,AdwBreakpointBin);var AdwButtonContent=class extends HTMLElement{_boxEl;_iconEl;_labelEl;_initialized=!1;_styledHost=null;static get observedAttributes(){return[`icon-name`,`label`,`use-underline`,`can-shrink`]}connectedCallback(){this._initialized||(this._initialized=!0,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-button-content-box`,this._iconEl=createGtkImage(null),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-button-content-label`,this._boxEl.append(this._iconEl,this._labelEl),this.replaceChildren(this._boxEl),this._render()),this._root()}disconnectedCallback(){this._unroot()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}_hostButton(){let e=this.parentElement?.closest(`button, .adw-button`)??null;if(!e)return null;let t=e.parentElement;return t?.matches(`adw-split-button, .adw-split-button`)?t:e}_root(){let e=this._hostButton();e!==this._styledHost&&(this._unroot(),e&&(e.classList.add(se),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(se),this._styledHost=null}_render(){this._iconEl.iconName=buttonContentIconName(this.getAttribute(`icon-name`)??``),this._iconEl.hidden=!1;let e=this.getAttribute(`label`)??``;this._labelEl.textContent=buttonContentLabelText(e,this.hasAttribute(`use-underline`)),this._labelEl.hidden=e.length===0,this.classList.toggle(`can-shrink`,this.hasAttribute(`can-shrink`))}};customElements.define(`adw-button-content`,AdwButtonContent);var AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createGtkImage(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createGtkImage(null,`end`),this._contentsEl.append(this._startIconEl,this._titleEl,this._endIconEl),this.replaceChildren(this._contentsEl),this._initialized=!0,this._render(),this.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0}))}),attachRowActivation({row:this,activatable:()=>!0}))}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._state.setTitle(this.getAttribute(`title`)),this._state.setStartIconName(this.getAttribute(`start-icon-name`)),this._state.setEndIconName(this.getAttribute(`end-icon-name`));let e=this._state.state;this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._paintIcon(this._startIconEl,e.startIconName,e.startIconVisible),this._paintIcon(this._endIconEl,e.endIconName,e.endIconVisible),this.classList.toggle(`activatable`,!0)}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);function attachSwipeDrag(e){let t=new SwipeTracker({points:e.points,allowLongSwipes:e.allowLongSwipes,cancelProgress:e.cancelProgress}),n=null,r=0,i=0,a=0,o=0,s=0,c=`none`,l=null,u=!1,axisOffset=(t,n)=>e.orientation===`vertical`?n:t,progressOffset=(e,t)=>-axisOffset(e,t),release=()=>{let r=n;n=null,c=`none`,t.reset(),globalThis.removeEventListener(`pointermove`,onMove,!0),globalThis.removeEventListener(`pointerup`,onFinish,!0),globalThis.removeEventListener(`pointercancel`,onCancel,!0),globalThis.removeEventListener(`lostpointercapture`,onLostCapture,!0),r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),l!==null&&(e.host.style.scrollSnapType=l.scrollSnapType,e.host.style.scrollBehavior=l.scrollBehavior,e.host.style.userSelect=l.userSelect,l=null)},claimAllowed=t=>{let n=e.points();if(n.length===0)return!1;let a=n[0],c=n[n.length-1];if(Math.abs(a-c)<2**-52)return!1;let l=e.progress(),u=t<0&&(Math.abs(l-a)<2**-52||l<a),d=t>0&&(Math.abs(l-c)<2**-52||l>c);return u||d?!1:e.claimable===void 0?!0:e.claimable({x:r,y:i})||e.claimable({x:o,y:s})},claim=()=>{c=`scrolling`,n!==null&&e.host.setPointerCapture(n),l={scrollSnapType:e.host.style.scrollSnapType,scrollBehavior:e.host.style.scrollBehavior,userSelect:e.host.style.userSelect},e.host.style.scrollSnapType=`none`,e.host.style.scrollBehavior=`auto`,e.host.style.userSelect=`none`},arm=()=>{globalThis.addEventListener(`pointermove`,onMove,!0),globalThis.addEventListener(`pointerup`,onFinish,!0),globalThis.addEventListener(`pointercancel`,onCancel,!0),globalThis.addEventListener(`lostpointercapture`,onLostCapture,!0)};e.host.addEventListener(`pointerdown`,t=>{if(u=!1,n!==null){if(t.pointerId!==n)return;release()}t.pointerType!==`mouse`||t.button!==0||e.enabled()&&t.target?.closest(`select, textarea, input[type="range"], [contenteditable=""], [contenteditable="true"]`)===null&&(n=t.pointerId,r=t.clientX,i=t.clientY,o=t.clientX,s=t.clientY,a=0,c=`pending`,arm())});function onMove(l){if(n!==l.pointerId)return;o=l.clientX,s=l.clientY;let u=l.clientX-r,d=l.clientY-i,f=progressOffset(u,d),p=f-a;a=f;let m=Math.trunc(l.timeStamp);if(t.record(p,m),!(l.buttons&1)){release();return}if(c===`pending`){if(Math.abs(d)>Math.abs(u)!=(e.orientation===`vertical`)){release();return}if(Math.hypot(u,d)<16)return;if(!claimAllowed(f)){release();return}t.prepare(e.progress()),claim(),a=f;return}c===`scrolling`&&(l.preventDefault(),e.onUpdate(t.advance(p,e.pitch())))}function finish(r,i){if(n!==r.pointerId)return;if(c!==`scrolling`){release();return}i&&t.cancel();let{to:a,velocity:o}=t.end(Math.trunc(r.timeStamp));release(),u=!0,e.onEnd(a,o)}function onFinish(e){finish(e,!1)}function onCancel(e){finish(e,!0)}function onLostCapture(e){finish(e,!1)}return e.host.addEventListener(`click`,e=>{u&&(u=!1,e.stopPropagation(),e.preventDefault())},{capture:!0}),{get dragging(){return c===`scrolling`}}}function wheelSource(e){if(e.deltaMode!==0)return`mouse`;let t=Math.abs(e.deltaY),n=Math.abs(e.deltaX);if(n>0&&t>0)return`touchpad`;let r=Math.max(n,t);return!Number.isInteger(r)||r<40?`touchpad`:`mouse`}var AdwCarousel=class extends HTMLElement{_state=new CarouselState({animateScroll:!0,onScrollTo:e=>this._performScroll(e)});_trackEl;_slots=new Map;_nextPageId=0;_scrollRaf=0;_initialized=!1;_pendingPosition=null;_pendingLayout;_layoutObserver;_pendingInteractive=null;_scrollTargetId=null;_drag;static get observedAttributes(){return[`allow-scroll-wheel`,`allow-mouse-drag`,`allow-long-swipes`,`interactive`,`spacing`,`position`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e)),this._state.onPageChanged(e=>{this.dispatchEvent(new CustomEvent(`page-changed`,{bubbles:!0,detail:{index:e}}))})}get nPages(){return this._state.nPages}get position(){return this._state.position}set position(e){this._scrollToPosition(e)}get currentPage(){return this._state.pageAt(this._state.position)}get allowMouseDrag(){return this._state.allowMouseDrag}set allowMouseDrag(e){this.setAttribute(`allow-mouse-drag`,e?`true`:`false`)}get allowScrollWheel(){return this._state.allowScrollWheel}set allowScrollWheel(e){this.setAttribute(`allow-scroll-wheel`,e?`true`:`false`)}get allowLongSwipes(){return this._state.allowLongSwipes}set allowLongSwipes(e){this.toggleAttribute(`allow-long-swipes`,e)}get interactive(){return this._state.interactive}set interactive(e){this.setAttribute(`interactive`,e?`true`:`false`)}get spacing(){return this._state.spacing}set spacing(e){this.setAttribute(`spacing`,String(e))}connectedCallback(){this._initialized||this._build(),this._observeLayout()}_build(){this._initialized=!0,this._trackEl=document.createElement(`div`),this._trackEl.className=`adw-carousel-track`,this._trackEl.style.setProperty(`scroll-behavior`,`smooth`),this._applyAttribute(`allow-scroll-wheel`,this.getAttribute(`allow-scroll-wheel`)),this._applyAttribute(`allow-mouse-drag`,this.getAttribute(`allow-mouse-drag`)),this._applyAttribute(`allow-long-swipes`,this.getAttribute(`allow-long-swipes`)),this._applyAttribute(`interactive`,this.getAttribute(`interactive`)),this._applyAttribute(`spacing`,this.getAttribute(`spacing`));let e=Array.from(this.children).filter(e=>e instanceof HTMLElement);this.replaceChildren(this._trackEl);for(let t of e)this._insert(t,-1);this._trackEl.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._trackEl.addEventListener(`wheel`,this._onWheel,{passive:!1}),this._drag=attachSwipeDrag({host:this._trackEl,orientation:`horizontal`,enabled:()=>this._state.interactive&&this._state.allowMouseDrag,pitch:()=>this._distance(),points:()=>this._state.snapPoints,progress:()=>this._state.position,allowLongSwipes:()=>this._state.allowLongSwipes,cancelProgress:()=>{let e=this._state.snapPoints;return e[carouselClosestSnapPoint(this._state.position,e)]??this._state.position},onUpdate:e=>{let t=this._distance();t>0&&(this._trackEl.scrollLeft=e*t)},onEnd:e=>{let t=this._distance();t>0&&this._trackEl.scrollTo({left:e*t})}}),this._applyAttribute(`position`,this.getAttribute(`position`))}attributeChangedCallback(e,t,n){this._initialized&&this._applyAttribute(e,n)}disconnectedCallback(){this._cancelPendingPosition(),this._layoutObserver?.disconnect(),this._layoutObserver=void 0}_observeLayout(){this._layoutObserver||(this._layoutObserver=new ResizeObserver(()=>{this._allocatePages()&&this._applyScrollFromModel()}),this._layoutObserver.observe(this._trackEl,{box:`border-box`}))}_applyAttribute(e,t){switch(e){case`allow-scroll-wheel`:this._state.setAllowScrollWheel(t!==`false`);return;case`allow-mouse-drag`:this._state.setAllowMouseDrag(t!==`false`);return;case`allow-long-swipes`:this._state.setAllowLongSwipes(t!==null&&t!==`false`),this._applySnapStop();return;case`interactive`:this._state.setInteractive(t!==`false`);return;case`spacing`:{let e=t===null?0:Number.parseFloat(t);Number.isFinite(e)&&this._state.setSpacing(Math.max(0,e)),this._trackEl.style.columnGap=`${this._state.spacing}px`;return}case`position`:t!==null&&this._positionWhenMeasurable(Number.parseFloat(t))}}_positionWhenMeasurable(e){if(Number.isFinite(e)){if(this._trackEl.clientWidth>0){this._cancelPendingPosition(),this._scrollInstantly(e);return}this._pendingPosition=e,!this._pendingLayout&&(this._pendingLayout=new ResizeObserver(()=>{if(this._trackEl.clientWidth<=0)return;let e=this._pendingPosition;this._cancelPendingPosition(),e!==null&&this._scrollInstantly(e)}),this._pendingLayout.observe(this._trackEl))}}_scrollInstantly(e){let t=this._trackEl.style.getPropertyValue(`scroll-behavior`);this._trackEl.style.setProperty(`scroll-behavior`,`auto`);try{this._scrollToPosition(e)}finally{t?this._trackEl.style.setProperty(`scroll-behavior`,t):this._trackEl.style.removeProperty(`scroll-behavior`)}}_cancelPendingPosition(){this._pendingLayout?.disconnect(),this._pendingLayout=void 0,this._pendingPosition=null}_scrollToPosition(e){if(!Number.isFinite(e))return;let t=this._state.pageAt(e);t>=0&&this.scrollToPage(t)}insertPage(e,t=-1){return this._initialized?this._insert(e,t):(this.appendChild(e),!0)}appendPage(e){return this.insertPage(e,-1)}prependPage(e){return this.insertPage(e,0)}removePage(e){let t=this._idOf(e);return t===null||!this._state.removePage(t)?!1:(this._state.skipReveal(t),this._syncTrack(),!0)}reorderPage(e,t){let n=this._idOf(e);return n===null||!this._state.reorderPage(n,t)?!1:(this._syncTrack(),!0)}scrollToPage(e){this._state.scrollTo(e)}navigate(e){return this._state.navigate(e)}_insert(e,t){let n=`page-${this._nextPageId++}`;if(!this._state.insertPage(n,t))return!1;let r=document.createElement(`div`);return r.className=`adw-carousel-page`,r.appendChild(e),this._slots.set(n,r),this._state.skipReveal(n),this._syncTrack(),!0}_idOf(e){for(let[t,n]of this._slots)if(n.contains(e))return t;return null}_syncTrack(){let e=this._state.ids,t=new Set(e);for(let[e,n]of this._slots)t.has(e)||(n.remove(),this._slots.delete(e));e.forEach((e,t)=>{let n=this._slots.get(e);n&&this._trackEl.children[t]!==n&&this._trackEl.insertBefore(n,this._trackEl.children[t]??null)}),this._applySnapStop(),this._allocatePages(),this._applyScrollFromModel()}_allocatePages(){let e=[...this._slots.values()];if(e.length===0)return!1;let t=e[0].getBoundingClientRect().width;this._trackEl.style.removeProperty(`padding-inline`);for(let t of e)t.style.removeProperty(`flex-basis`);let n=this._trackEl.clientWidth;if(!(n>0))return!1;let{pageSize:r,leadingInset:i}=carouselPageAllocation(n,e.map(e=>({natural:e.firstElementChild?.getBoundingClientRect().width??0})));if(!(r>0))return!1;for(let t of e)t.style.flexBasis=`${r}px`;return i>0&&(this._trackEl.style.paddingInline=`${i}px`),Math.round(r)!==Math.round(t)}_applyScrollFromModel(){let e=this._distance();e>0&&this._trackEl.scrollTo({left:this._restorePosition()*e,behavior:`instant`})}_restorePosition(){if(this._scrollTargetId===null)return this._state.position;let e=this._state.ids.indexOf(this._scrollTargetId);return e<0?this._state.position:this._state.snapPointOf(e)??this._state.position}_applySnapStop(){let e=this._state.allowLongSwipes?`normal`:`always`;for(let t of this._slots.values())t.style.setProperty(`scroll-snap-stop`,e)}_distance(){let e=this._trackEl?.firstElementChild;return e?this._state.pageDistance(e.getBoundingClientRect().width):0}_performScroll(e){if(!this._trackEl)return;let t=this._distance();t>0&&(this._pendingInteractive=e.interactive,this._scrollTargetId=this._state.ids[e.index]??null,this._trackEl.scrollTo({left:e.index*t}))}_onScroll=()=>{this._scrollRaf||=requestAnimationFrame(()=>{this._scrollRaf=0,this._updatePositionFromScroll()})};_onWheel=e=>{if(this._drag?.dragging===!0){e.preventDefault();return}this._state.handleWheel({deltaX:e.deltaX,deltaY:e.deltaY,source:wheelSource(e)})!==0&&e.preventDefault()};_updatePositionFromScroll(){let e=this._distance();if(!(e>0))return;let t=this._trackEl.scrollLeft/e;this._state.setPosition(t,this._pendingInteractive??!0)&&this._state.settleIfArrived()&&(this._pendingInteractive=null,this._scrollTargetId=null)}_onStateChange(e){if(e.reason===`n-pages`){this.dispatchEvent(new CustomEvent(`notify::n-pages`,{bubbles:!0,detail:{nPages:e.nPages}}));return}e.reason===`position`&&this.dispatchEvent(new CustomEvent(`notify::position`,{bubbles:!0,detail:{position:e.position,page:e.page,interactive:e.interactive}}))}},AdwCarouselIndicator=class extends HTMLElement{_carousel=null;_initialized=!1;static get observedAttributes(){return[`for`,`carousel`]}get carousel(){return this._carousel}set carousel(e){e!==this._carousel&&(this._detach(),this._carousel=e,this._attach())}connectedCallback(){this._initialized=!0,this._carousel||this._resolveForAttr(),this._attach(),this._render()}disconnectedCallback(){this._detach()}attributeChangedCallback(e){(e===`for`||e===`carousel`)&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`carousel`)??this.getAttribute(`for`);if(!e)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);t instanceof AdwCarousel&&(this._carousel=t)}_attach(){!this._carousel||!this._initialized||(this._carousel.addEventListener(`notify::position`,this._onChange),this._carousel.addEventListener(`notify::n-pages`,this._onChange),this._render())}_detach(){this._carousel&&(this._carousel.removeEventListener(`notify::position`,this._onChange),this._carousel.removeEventListener(`notify::n-pages`,this._onChange))}_onChange=()=>{this._render()};nPages(){return this._carousel?.nPages??0}position(){return this._carousel?.position??0}currentPage(){return this._carousel?.currentPage??-1}goTo(e){this._carousel?.scrollToPage(e)}},AdwCarouselIndicatorDots=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-dot`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}},AdwCarouselIndicatorLines=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-line`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}};function renderIndicator(e,t,n,r,i,a){if(e.childElementCount!==n){let r=[];for(let e=0;e<n;e++){let n=document.createElement(`button`);n.type=`button`,n.className=t,n.setAttribute(`aria-label`,`Page ${e+1}`),n.addEventListener(`click`,()=>a(e)),r.push(n)}e.replaceChildren(...r)}Array.from(e.children).forEach((e,t)=>{let n=Math.max(0,1-Math.abs(r-t)),a=e;a.style.setProperty(`--adw-carousel-progress`,n.toFixed(3)),a.classList.toggle(`active`,t===i),a.setAttribute(`aria-current`,t===i?`true`:`false`)})}customElements.define(`adw-carousel`,AdwCarousel),customElements.define(`adw-carousel-indicator-dots`,AdwCarouselIndicatorDots),customElements.define(`adw-carousel-indicator-lines`,AdwCarouselIndicatorLines);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._allocate()}_allocate(){let e={maximumSize:normalizeClampSize(this.getAttribute(`maximum-size`),y.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),y.tighteningThreshold),childMin:0,childNat:0},t=this.clientWidth,n=Array.from(this.children);if(t<=0){for(let e of n){e.style.maxWidth=``,e.style.marginInline=``;for(let t of b)e.classList.remove(t)}return}let{childSize:r,sizeClass:i}=clampAllocate(t,e);for(let e of n){e.style.maxWidth=`${r}px`,e.style.marginInline=`auto`;for(let t of b)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const pt={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`,`unit`,`orientation`,`hscroll-policy`,`vscroll-policy`]}get maximumSize(){return normalizeClampSize(this.getAttribute(`maximum-size`),y.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),y.tighteningThreshold)}set tighteningThreshold(e){this.setAttribute(`tightening-threshold`,String(e))}get unit(){return normalizeLengthUnit(this.getAttribute(`unit`),`sp`)}set unit(e){this.setAttribute(`unit`,e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._applyOverflow(),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._applyOverflow(),this._allocate()}_applyOverflow(){let e=this.getAttribute(`hscroll-policy`),t=this.getAttribute(`vscroll-policy`);this.style.overflowX=e===null?`auto`:pt[e]??`auto`,this.style.overflowY=t===null?`auto`:pt[t]??`auto`}_allocate(){let e=this.orientation===`vertical`,t=this.unit,n=e?this.clientHeight:this.clientWidth,r={maximumSize:adwLengthToPx(t,this.maximumSize),tighteningThreshold:adwLengthToPx(t,this.tighteningThreshold),childMin:0,childNat:0};for(let t of Array.from(this.children)){if(n<=0){t.style.maxWidth=``,t.style.maxHeight=``,t.style.marginInline=``,t.style.marginBlock=``;for(let e of b)t.classList.remove(e);continue}let{childSize:i,sizeClass:a}=clampAllocate(n,r);e?(t.style.maxWidth=``,t.style.maxHeight=`${i}px`,t.style.marginInline=``,t.style.marginBlock=`auto`):(t.style.maxWidth=`${i}px`,t.style.maxHeight=``,t.style.marginInline=`auto`,t.style.marginBlock=``);for(let e of b)t.classList.toggle(e,e===a)}}};customElements.define(`adw-clamp-scrollable`,AdwClampScrollable);function stringListSlot(e){return{name:`model`,consume:t=>e(parseListModel(t instanceof Element?t.getAttribute(`strings`):null))}}var AdwComboRow=class extends HTMLElement{_select;_valueEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`model`,`selected`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&(this.selected=t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._select=document.createElement(`select`),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(e,this._valueEl,this._select),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10)),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribe(e=>{this._valueEl.textContent=e.label,this._select.selectedIndex!==e.selected&&(this._select.selectedIndex=e.selected),this._syncChooser(),e.interactive&&(this.setAttribute(`selected`,String(e.selected)),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected}})))}),this._select.addEventListener(`change`,()=>{this._state.select(this._select.selectedIndex)}),this._renderOptions(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`model`?this._state.setModel(parseListModel(n)):e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_createOption(e){let t=document.createElement(`option`);return t.value=e.value,t.textContent=e.label,t}_applyItemsChanged(e){if(!this._initialized)return;for(let t=0;t<e.removed;t++)this._select.remove(e.position);let t=this._select.options[e.position]??null,n=this._state.model;for(let r=0;r<e.added;r++){let i=n[e.position+r];i&&this._select.insertBefore(this._createOption(i),t)}}_renderOptions(){this._initialized&&(this._select.replaceChildren(...this._state.model.map(e=>this._createOption(e))),this._select.selectedIndex=this._state.selectedIndex,this._valueEl.textContent=this._state.selectedLabel,this._syncChooser())}_syncChooser(){let e=this._state.presentsChooser;this.dataset.presentsChooser=e?`true`:`false`,this._select.disabled=!e}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}};customElements.define(`adw-combo-row`,AdwComboRow);const mt=[`auto`,`floating`,`bottom-sheet`];var AdwDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_boxEl;_headerEl;_titleEl;_closeBtn;_contentEl;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`,`content-height`,`presentation-mode`,`show-header`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?360:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}get contentHeight(){let e=Number.parseInt(this.getAttribute(`content-height`)??``,10);return Number.isNaN(e)?0:e}set contentHeight(e){e>0?this.setAttribute(`content-height`,String(e)):this.removeAttribute(`content-height`)}get presentationMode(){let e=this.getAttribute(`presentation-mode`);return e&&mt.includes(e)?e:`auto`}set presentationMode(e){this.setAttribute(`presentation-mode`,e)}get contentArea(){return this._contentEl}present(e){this.isConnected||(e??document.body).appendChild(this),this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-dialog`),this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-dialog-box`,this._boxEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._boxEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-dialog-header`;let e=document.createElement(`div`);e.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let t=document.createElement(`div`);t.className=`adw-dialog-header-side adw-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),t.appendChild(this._closeBtn),this._headerEl.append(e,this._titleEl,t),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`,this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),bindSlottedChildren(this,[{into:this._contentEl}]).install(this._scrimEl),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._onClosed()))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_onClosed(){this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss()}decorateHeader(e){}_render(){this.classList.toggle(`open`,this.open);let e=this.title;this._titleEl.textContent=e;let t=e.length>0||this.hasAttribute(`show-header`);this._headerEl.hidden=!t,this.dataset.presentation=this.presentationMode,this._boxEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let n=this.contentHeight;n>0?this._boxEl.style.setProperty(`--adw-dialog-content-height`,`${n}px`):this._boxEl.style.removeProperty(`--adw-dialog-content-height`);let r=!this.canClose;this._closeBtn.disabled=r,this._closeBtn.classList.toggle(`locked`,r),this.decorateHeader(this._headerEl)}};customElements.define(`adw-dialog`,AdwDialog);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}function boolAttribute(e){return e!==null&&e!==`false`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_slots;_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`]}get _classPrefix(){return`adw-entry-row`}get text(){return this._state.text}set text(e){this._state.setText(e??``)}get textLength(){return this._state.textLength}get maxLength(){return this._state.maxLength}set maxLength(e){this._state.setMaxLength(e)}get editable(){return this._state.editable}set editable(e){this._state.setEditable(e)}get showApplyButton(){return this._state.showApplyButton}set showApplyButton(e){this._state.setShowApplyButton(e)}get activatesDefault(){return this._state.activatesDefault}set activatesDefault(e){this._state.setActivatesDefault(e)}get editing(){return this._state.editing}connectedCallback(){this._initialized||(this._initialized=!0,this._build(),this._state.setMaxLength(Number.parseInt(this.getAttribute(`max-length`)??``,10)),this._state.setEditable(this.getAttribute(`editable`)!==`false`),this._state.setShowApplyButton(boolAttribute(this.getAttribute(`show-apply-button`))),this._state.setActivatesDefault(boolAttribute(this.getAttribute(`activates-default`))),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._slots.install(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),this._state.subscribe(e=>this._onStateChanged(e)))}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`title`:this._renderTitle();break;case`text`:this._state.setText(n??``);break;case`editable`:this._state.setEditable(n!==`false`);break;case`max-length`:this._state.setMaxLength(Number.parseInt(n??``,10));break;case`show-apply-button`:this._state.setShowApplyButton(boolAttribute(n));break;case`activates-default`:this._state.setActivatesDefault(boolAttribute(n));break}}addSuffix(e){this._suffixes.append(e),setPartVisible(this._suffixes,!0)}addPrefix(e){this._prefixes.prepend(e),setPartVisible(this._prefixes,!0)}setShowIndicator(e){this._state.setShowIndicator(e)}setIndicatorIconName(e){this._indicator.dataset.iconName=e}setIndicatorTooltip(e){this._indicator.title=e,this._indicator.setAttribute(`aria-label`,e)}apply(){this._state.apply(),this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}))}grabFocusWithoutSelecting(){return this._input.focus(),this._state.editing}_onConnected(){}_build(){let e=this._classPrefix;this._prefixes=document.createElement(`div`),this._prefixes.className=`${e}-prefixes`,this._suffixes=document.createElement(`div`),this._suffixes.className=`${e}-suffixes`,this._emptyTitle=document.createElement(`span`),this._emptyTitle.className=`adw-row-title ${e}-empty-title`,this._title=document.createElement(`span`),this._title.className=`adw-row-title ${e}-title`,this._input=document.createElement(`input`),this._input.className=`${e}-input`,this._input.type=`text`,this._input.addEventListener(`input`,()=>{this._state.setText(this._input.value),this._input.value!==this._state.text&&(this._input.value=this._state.text)}),this._input.addEventListener(`focus`,()=>this._state.setEditing(!0)),this._input.addEventListener(`blur`,()=>this._state.setEditing(!1)),this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._activate())}),this._area=document.createElement(`div`),this._area.className=`${e}-text`,this._area.append(this._emptyTitle,this._title,this._input),this._indicator=document.createElement(`span`),this._indicator.className=`${e}-indicator`,this._indicator.setAttribute(`role`,`img`),this._indicator.textContent=`⇪`,this._applyButton=document.createElement(`button`),this._applyButton.type=`button`,this._applyButton.className=`adw-button suggested-action circular icon-only ${e}-apply`,this._applyButton.dataset.iconName=`adw-entry-apply-symbolic`,this._applyButton.title=ge,this._applyButton.setAttribute(`aria-label`,ge),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createGtkImage(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this._slots=bindSlottedChildren(this,[{name:`prefix`,consume:e=>this.addPrefix(e)},{name:`suffix`,claims:e=>e instanceof Element,consume:e=>this.addSuffix(e)}]),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_maybeFocus(e){let t=e.target;(t===this||t===this._area||t===this._emptyTitle||t===this._title||t===this._editIcon||t===this._indicator||t===this._prefixes||t===this._suffixes)&&this._input.focus()}_activate(){let e=this._state.activate();if(e.signal===`apply`){this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}));return}e.activateDefault&&this.closest(`form`)?.requestSubmit(),this.dispatchEvent(new CustomEvent(`entry-activated`,{bubbles:!0}))}_renderTitle(){let e=this.getAttribute(`title`)??``;this._emptyTitle.textContent=e,this._title.textContent=e}_render(e){this._input.value!==e.text&&(this._input.value=e.text),this._input.readOnly=!e.editable,this.classList.toggle(`focused`,e.editing),this.classList.toggle(`empty`,e.empty),setPartVisible(this._emptyTitle,e.emptyTarget===0),setPartVisible(this._title,e.emptyTarget===1),setPartVisible(this._editIcon,e.editIconVisible),this._editIcon.classList.toggle(`disabled`,!e.editIconSensitive),this._editIcon.setAttribute(`aria-disabled`,String(!e.editIconSensitive)),setPartVisible(this._indicator,e.indicatorVisible),setPartVisible(this._applyButton,e.applyButtonVisible),this.setAttribute(`text-length`,String(e.textLength))}_onStateChanged(e){if(this._render(e),e.text!==this._lastText){this._lastText=e.text;let t={text:e.text};this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:t})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:t}))}e.textLength!==this._lastLength&&(this._lastLength=e.textLength,this.dispatchEvent(new CustomEvent(`notify::text-length`,{bubbles:!0,detail:{textLength:e.textLength}})))}};customElements.define(`adw-entry-row`,AdwEntryRow);var GtkSwitch=class extends HTMLElement{_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`state`,`disabled`,`unfocusable`]}get unfocusable(){return this.hasAttribute(`unfocusable`)}set unfocusable(e){this.toggleAttribute(`unfocusable`,!!e)}get active(){return this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e),this.state=this.active}get state(){return this.hasAttribute(`state`)}set state(e){this.toggleAttribute(`state`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.classList.add(`adw-switch`),this._input=document.createElement(`input`),this._input.type=`checkbox`,this._slider=document.createElement(`span`),this._slider.className=`adw-switch-slider`,this.replaceChildren(this._input,this._slider),this.active&&(this.state=!0),this._input.addEventListener(`change`,()=>{this.active=this._input.checked}),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&(this.active=!this.active)}),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`active`?this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})):e===`state`&&this.dispatchEvent(new CustomEvent(`notify::state`,{bubbles:!0,detail:{state:this.state}})))}_render(){let e=this.disabled;this._input.checked=this.active,this._input.disabled=e,this.unfocusable?this._input.tabIndex=-1:this._input.removeAttribute(`tabindex`),this.classList.toggle(`checked`,this.state),this.classList.toggle(`disabled`,e)}};customElements.define(`gtk-switch`,GtkSwitch);var AdwExpanderRow=class extends HTMLElement{_headerEl;_titleEl;_subtitleEl;_enableSwitch;_chevronEl;_contentEl;_prefixEl;_suffixEl;_state=new ExpanderState;_initialized=!1;_reflectingEnable=!1;constructor(){super(),this._state.subscribe(e=>{e?this.setAttribute(`expanded`,``):this.removeAttribute(`expanded`),this._initialized&&this._render()})}static get observedAttributes(){return[`title`,`subtitle`,`expanded`,`enable-expansion`,`show-enable-switch`]}get expanded(){return this._state.expanded}set expanded(e){this._state.setExpanded(e)}get enableExpansion(){return!this.hasAttribute(`enable-expansion`)||this.getAttribute(`enable-expansion`)!==`false`}set enableExpansion(e){this.setAttribute(`enable-expansion`,e?`true`:`false`)}get contentSection(){return this._contentEl}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._enableSwitch=document.createElement(`gtk-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createGtkImage(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`,this._headerEl.append(this._prefixEl,e,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl},{into:this._contentEl}]).install(this._headerEl,this._contentEl),bindEmptySections(this._prefixEl,this._suffixEl),this._headerEl.addEventListener(`click`,e=>{this._enableSwitch.contains(e.target)||this._state.toggle()&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}}))}),attachRowActivation({row:this._headerEl,activatable:()=>!0}),this._enableSwitch.addEventListener(`notify::active`,e=>{if(e.stopPropagation(),this._reflectingEnable)return;let t=this._enableSwitch.active;this.setAttribute(`enable-expansion`,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`notify::enable-expansion`,{bubbles:!0,detail:{enableExpansion:t}}))}),this._state.setExpanded(this.hasAttribute(`expanded`)),this._render()}attributeChangedCallback(e){this._initialized&&(e===`expanded`&&this._state.setExpanded(this.hasAttribute(`expanded`)),this._render())}_render(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible;let t=this.hasAttribute(`show-enable-switch`);this._enableSwitch.hidden=!t,this._reflectingEnable=!0,this._enableSwitch.active=this.enableExpansion,this._reflectingEnable=!1,this.classList.toggle(`expanded`,this.expanded),this._headerEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.classList.toggle(`expanded`,this.expanded)}};customElements.define(`adw-expander-row`,AdwExpanderRow);var AdwWindowTitle=class extends HTMLElement{_titleEl;_subtitleEl;_state=new WindowTitleState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-window-title-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-window-title-subtitle`,this.replaceChildren(this._titleEl,this._subtitleEl),this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`title`?this._state.setTitle(n):this._state.setSubtitle(n))&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:e===`title`?this._state.title:this._state.subtitle}})))}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-window-title`,AdwWindowTitle);var AdwHeaderBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;_titleEl=null;_page=null;_pageObserver=null;static get observedAttributes(){return[`title`,`subtitle`]}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized){this._followPage(),this._renderTitle();return}this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`,bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`title-widget`,into:this._centerEl},{name:`end`,into:this._endEl}],(e,t)=>{`into`in t&&t.into===this._centerEl&&this._dropDerivedTitle()}).install(this._startEl,this._centerEl,this._endEl),this._centerEl.childElementCount===0&&(this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl)),this._followPage(),this._renderTitle()}disconnectedCallback(){this._pageObserver?.disconnect(),this._pageObserver=null,this._page=null}_followPage(){this._page=this.closest(`adw-navigation-page`),this._page!==null&&(this._pageObserver??=new MutationObserver(()=>this._renderTitle()),this._pageObserver.observe(this._page,{attributes:!0,attributeFilter:[`title`]}))}attributeChangedCallback(){this._initialized&&this._renderTitle()}_dropDerivedTitle(){this._titleEl?.remove(),this._titleEl=null}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e)??(e===`title`?this._page?.getAttribute(`title`)??null:null);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const ht={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createGtkImage(viewSwitcherIconName(e),t)}function applySwitcherIcon(e,t){e.iconName=viewSwitcherIconName(t)}function readSwitcherPage(e){let t=Number.parseInt(e.getAttribute(`badge-number`)??``,10);return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),visible:!e.hasAttribute(`hidden`),useUnderline:e.hasAttribute(`use-underline`),badgeNumber:Number.isNaN(t)?0:t,needsAttention:e.hasAttribute(`needs-attention`)}}function applyIndicator(e,t,n){e.textContent=t,e.classList.toggle(`needs-attention`,n&&t.length===0),e.hidden=t.length===0&&!n}function applyDescription(e,t){t?e.setAttribute(`aria-description`,t):e.removeAttribute(`aria-description`)}const gt={horizontal:{previous:`ArrowLeft`,next:`ArrowRight`},vertical:{previous:`ArrowUp`,next:`ArrowDown`}},adjacentStep=(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r};function attachRovingFocus(e){let keysOf=e=>gt[typeof e==`function`?e():e];e.host.addEventListener(`keydown`,t=>{let{previous:n,next:r}=keysOf(e.orientation),i=e.crossAxis===void 0?null:keysOf(e.crossAxis.orientation);if(t.altKey||t.ctrlKey||t.metaKey)return;let a=e.items(),o=a.findIndex(e=>e===t.target||e.contains(t.target));if(o<0)return;let s=e.step??adjacentStep,c;if(t.key===n)c=s(a,o,-1);else if(t.key===r)c=s(a,o,1);else if(i!==null&&t.key===i.previous)c=e.crossAxis.step(a,o,-1);else if(i!==null&&t.key===i.next)c=e.crossAxis.step(a,o,1);else if(t.key===`Home`)c=0;else if(t.key===`End`)c=a.length-1;else return;t.preventDefault();let l=c===null?void 0:a[c];l===void 0||l===a[o]||(e.select(l),l.focus())})}var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=ht;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_groupEl;_pagesEl;_panels=[];_toggles=[];_displayMode=`labels`;_initialized=!1;_declared=[];_pageObserver;static get observedAttributes(){return[`active`,`display-mode`,`flat`,`round`,`osd`]}constructor(){super()}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get activeToggle(){return toggleIndexForPage(this._state.pages,this._state.selected)}get displayMode(){return this._displayMode}set displayMode(e){this.setAttribute(`display-mode`,e)}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._rebuildToggles(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`)),t=this.getAttribute(`active`);if(this._groupEl=document.createElement(`div`),this._groupEl.className=`adw-inline-view-switcher-group`,this._groupEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._toggles,select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-inline-view-switcher-pages`,this._panels=e.map(e=>{let t=document.createElement(`div`);t.className=`adw-inline-view-switcher-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.name=e.getAttribute(`name`)??``;for(let n of Array.from(e.childNodes))t.appendChild(n);return this._pagesEl.appendChild(t),t}),this.replaceChildren(this._groupEl,this._pagesEl),this._displayMode=this._readDisplayModeAttr(),this._initialized=!0,this._declared=e,this._watchPages(),this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._rebuildToggles()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._rebuildToggles())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive();return}if(e===`display-mode`){let e=this._readDisplayModeAttr();if(e===this._displayMode)return;this._displayMode=e,this._rebuildToggles(),this.dispatchEvent(new CustomEvent(`notify::display-mode`,{bubbles:!0,detail:{displayMode:e}}));return}this._applyStyleClasses()}}_readDisplayModeAttr(){let e=this.getAttribute(`display-mode`);return e===null?`labels`:isInlineViewSwitcherDisplayMode(e)?e:this._displayMode}_rebuildToggles(){if(!this._initialized)return;let e=buildInlineToggles(this._state.pages,this._displayMode);this._groupEl.replaceChildren(),this._toggles=e.map(e=>{let t=document.createElement(`button`);if(t.type=`button`,t.className=`adw-inline-view-switcher-toggle`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e.pageIndex),t.dataset.toggleIndex=String(e.toggleIndex),e.showIcon&&t.appendChild(createSwitcherIcon(e.iconName,`adw-inline-view-switcher-icon`)),e.showLabel){let n=document.createElement(`span`);n.className=`adw-inline-view-switcher-label`,n.textContent=e.label,t.appendChild(n)}let n=document.createElement(`span`);return n.className=`adw-inline-view-switcher-indicator`,n.setAttribute(`aria-hidden`,`true`),applyIndicator(n,e.badgeLabel,e.needsAttention),t.appendChild(n),e.tooltip&&(t.title=e.tooltip),e.showLabel||t.setAttribute(`aria-label`,e.tooltip||e.iconName),applyDescription(t,e.description),t.addEventListener(`click`,()=>{this._state.setSelected(e.pageIndex)}),t.addEventListener(`dragenter`,n=>{t.contains(n.relatedTarget)||this._state.dragEnter(e.pageIndex)}),t.addEventListener(`dragleave`,n=>{t.contains(n.relatedTarget)||this._state.dragLeave(e.pageIndex)}),this._groupEl.appendChild(t),t}),this._render()}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.selected,name:e.name,toggleIndex:this.activeToggle,interactive:e.interactive}}))}_render(){if(!this._initialized)return;this._applyStyleClasses();let e=this.activeToggle;this._toggles.forEach((t,n)=>{let r=n===e&&e!==-1;t.classList.toggle(`active`,r),t.setAttribute(`aria-selected`,String(r)),t.tabIndex=r?0:-1});let t=this._state.selected;this._panels.forEach((e,n)=>{let r=n===t;e.classList.toggle(`active-view`,r),e.hidden=!r}),this._reflectActive()}_applyStyleClasses(){for(let e of[`flat`,`round`,`osd`]){let t=this.hasAttribute(e);this.classList.toggle(e,t),this._groupEl?.classList.toggle(e,t)}for(let e of Xe)this._groupEl.classList.toggle(e,e===this._displayMode)}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-stack-page`,AdwViewStackPage),customElements.define(`adw-inline-view-switcher`,AdwInlineViewSwitcher);var AdwMultiLayoutView=class extends HTMLElement{_layouts=[];_children=new Map;_slots=new Map;_current=null;_acceptingSlots=!1;_observer=null;static get observedAttributes(){return[`layout-name`]}get layoutName(){return this._current?.name??null}set layoutName(e){e!==null&&this.setAttribute(`layout-name`,e)}get layout(){return this._current?.content??null}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._observer?.disconnect(),this._observer=new MutationObserver(()=>this._rebuild()),this._observer.observe(this,{childList:!0}),this._rebuild()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){!this.isConnected||e!==`layout-name`||this._setLayoutByName(this.getAttribute(`layout-name`))}getChild(e){return this._children.get(e)??null}getLayoutByName(e){return this._layouts.find(t=>t.name===e)?.content??null}registerSlot(e,t){if(this._acceptingSlots&&this._slots.get(e)!==t){if(this._slots.has(e)){console.warn(`Duplicate slot ID in AdwLayout ${this.layoutName}: ${e}`);return}this._slots.set(e,t)}}_rebuild(){if(this.isConnected){this._observer?.disconnect();try{this._readAuthoredTree()}finally{this.isConnected&&this._observer?.observe(this,{childList:!0})}}}_readAuthoredTree(){let e=[];for(let t of Array.from(this.children)){let n=t.getAttribute(`name`);if(n!==null){e.push({name:n,content:t});continue}let r=t.getAttribute(`slot`);r===null||r===``||(this._children.has(r)&&console.warn(`While adding child: duplicate slot ${r} in AdwMultiLayoutView; kept the first`),this._children.set(r,t))}this._layouts=e;let t=this.getAttribute(`layout-name`);t===null?this._setLayout(e[0]??null):this._setLayoutByName(t)}_setLayout(e){if(e===this._current){e!==null&&this._mount(e);return}this._current=e,e===null?this._destroy():this._mount(e),this.dispatchEvent(new CustomEvent(`notify::layout`,{bubbles:!0,detail:{layout:this.layoutName}})),this.dispatchEvent(new CustomEvent(`notify::layout-name`,{bubbles:!0,detail:{layoutName:this.layoutName}}))}_setLayoutByName(e){if(e===null)return;let t=this._layouts.find(t=>t.name===e);if(t===void 0){console.error(`Layout name '${e}' not found in AdwMultiLayoutView`);return}this._setLayout(t)}_destroy(){this._slots.clear(),this.replaceChildren()}_mount(e){for(this._destroy(),this._acceptingSlots=!0,this.appendChild(e.content);;){let t=this._slots.size;for(let t of e.content.querySelectorAll(`adw-layout-slot`)){let e=t.getAttribute(`id`);e!==null&&e!==``&&!this._slots.has(e)&&this.registerSlot(e,t)}for(let[e,t]of this._children)this._parent(e,t);if(this._slots.size===t)break}this._acceptingSlots=!1}_parent(e,t){let n=this._slots.get(e);n!==void 0&&t.parentElement!==n&&(this._mirrorVisible(n,t),n.appendChild(t))}_mirrorVisible(e,t){let apply=()=>{e.toggleAttribute(`hidden`,t.hidden===!0)};apply(),new MutationObserver(apply).observe(t,{attributes:!0,attributeFilter:[`hidden`]})}};customElements.define(`adw-multi-layout-view`,AdwMultiLayoutView);var AdwLayoutSlot=class extends HTMLElement{_registered=!1;static get observedAttributes(){return[`id`]}get slotId(){return this.getAttribute(`id`)}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`contents`,this._register()}disconnectedCallback(){this._registered=!1}attributeChangedCallback(e){!this.isConnected||e!==`id`||(this._registered&&console.warn("<adw-layout-slot>: `id` is construct-only upstream; re-registering the slot."),this._register())}_register(){let e=this.slotId;if(e===null||e===``){console.error("<adw-layout-slot> created without an `id` — libadwaita refuses this with g_error.");return}let t=this.closest(`adw-multi-layout-view`);t instanceof AdwMultiLayoutView&&t.registerSlot(e,this),this._registered=!0}};customElements.define(`adw-layout-slot`,AdwLayoutSlot);function readPageProps(e){return{tag:e.tag,title:e.title,canPop:e.canPop}}var AdwNavigationPage=class extends HTMLElement{_syncing=!1;static get observedAttributes(){return[`title`,`tag`,`can-pop`,`no-back-button`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get tag(){return this.getAttribute(`tag`)}set tag(e){e===null?this.removeAttribute(`tag`):this.setAttribute(`tag`,e)}get canPop(){return this.getAttribute(`can-pop`)!==`false`}set canPop(e){this.setAttribute(`can-pop`,e?`true`:`false`)}attributeChangedCallback(e,t){if(this._syncing)return;let n=this.closest(`adw-navigation-view`);n instanceof AdwNavigationView&&n.syncPageProperty(this,e,t)}revertAttribute(e,t){this._syncing=!0,t===null?this.removeAttribute(e):this.setAttribute(e,t),this._syncing=!1}},AdwNavigationView=class extends HTMLElement{_pagesEl;_backButtons=new WeakMap;_initialized=!1;_diagnose=e=>{console.warn(`[adw-navigation-view] ${describeNavigationDiagnostic(e)}`)};_state=new NavigationViewState({onDiagnostic:this._diagnose});static get observedAttributes(){return[`animate-transitions`,`pop-on-escape`]}get animateTransitions(){return this.getAttribute(`animate-transitions`)!==`false`}set animateTransitions(e){this.setAttribute(`animate-transitions`,e?`true`:`false`)}get popOnEscape(){return this.getAttribute(`pop-on-escape`)!==`false`}set popOnEscape(e){this.setAttribute(`pop-on-escape`,e?`true`:`false`)}get visiblePage(){return this._state.visiblePage}get visiblePageTag(){return this._state.visiblePageTag}get depth(){return this._state.depth}get navigationStack(){return this._state.stack}get pages(){return this._state.pages}get canGoBack(){return this._state.canGoBack()}get backButtonTooltip(){return this._state.backButtonTooltip()}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-navigation-page`));this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-navigation-view-pages`;for(let t of e)t.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(t);this.replaceChildren(this._pagesEl),this._state.subscribe(e=>this._onChange(e)),this._state.setAnimateTransitions(this.animateTransitions),this._state.setPopOnEscape(this.popOnEscape),this.addEventListener(`keydown`,this._onKeyDown);for(let t of e)this._state.add(t,readPageProps(t));for(let t of e)this._state.isRegistered(t)||this._detach(t);this._syncClasses(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`pop-on-escape`){this._state.setPopOnEscape(this.popOnEscape);return}this._state.setAnimateTransitions(this.animateTransitions),this._syncClasses()}}syncPageProperty(e,t,n){this._state.isRegistered(e)&&(t===`tag`?(this._state.setTag(e,e.tag),this._state.tagOf(e)!==e.tag&&e.revertAttribute(`tag`,n)):t===`title`?this._state.setTitle(e,e.title):t===`can-pop`&&this._state.setCanPop(e,e.canPop),this._render())}addPage(e){let t=this._state.add(e,readPageProps(e));return this._render(),t}removePage(e){let t=this._state.remove(e);return t&&!this._state.isRegistered(e)&&this._detach(e),this._render(),t}push(e){if(typeof e==`string`)return this.pushByTag(e);let t=this._state.push(e,readPageProps(e));return this._render(),t}pushByTag(e){let t=this._state.pushByTag(e);return this._render(),t}pop(){let e=this._state.pop();return this._render(),e}popToPage(e){let t=this._state.popToPage(e);return this._render(),t}popToTag(e){let t=this._state.popToTag(e);return this._render(),t}replace(e){let t=e.map(e=>{if(typeof e!=`string`)return e??null;let t=this._state.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this._state.replace(t,readPageProps),this._render()}replaceWithTags(e){this._state.replaceWithTags(e),this._render()}findPage(e){return this._state.findPage(e)}getPreviousPage(e){return this._state.getPreviousPage(e)}_onChange(e){for(let t of e.removed)this._detach(t);for(let e of this._state.finishTransition())this._detach(e);if(this._render(),e.reason===`add`||e.reason===`push`)this._dispatch(`pushed`,e.visiblePage);else if(e.reason===`pop`)for(let t of e.popped)this._dispatch(`popped`,t);else this._dispatch(`replaced`,null);e.previousVisiblePage!==e.visiblePage&&this._dispatch(`notify::visible-page`,e.visiblePage)}_dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{page:t,tag:t?.tag??null}}))}_onKeyDown=e=>{if(e.defaultPrevented)return;let t;if(e.key===`Escape`)t=this._state.popFromEscape();else if(e.altKey&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){let n=getComputedStyle(this).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key!==n)return;t=this._state.popFromShortcut()}else return;t===`stop`&&(e.preventDefault(),e.stopPropagation())};_syncClasses(){this.classList.toggle(`animated`,this.animateTransitions)}_render(){let e=this._state.visiblePage;for(let t of this._state.pages){this._attach(t);let n=t===e;t.classList.toggle(`visible-page`,n),t.hidden=!n,n||this._removeBackButton(t)}e&&this._syncBackButton(e)}_attach(e){e.parentNode!==this._pagesEl&&(e.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(e))}_detach(e){this._removeBackButton(e),e.classList.remove(`visible-page`),e.parentNode===this._pagesEl&&this._pagesEl.removeChild(e)}_syncBackButton(e){if(!this._state.canGoBack()||e.hasAttribute(`no-back-button`)){this._removeBackButton(e);return}let t=this._state.backButtonTooltip()??Oe,n=this._backButtons.get(e);if(n){n.setAttribute(`tooltip`,t);return}let r=e.querySelector(`adw-header-bar`);if(!r)return;let i=r.startSection??null;if(!i)return;let a=document.createElement(`gtk-button`);a.classList.add(`adw-navigation-back-button`),a.setAttribute(`icon`,`go-previous`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,t),a.addEventListener(`click`,()=>this.pop()),i.insertBefore(a,i.firstChild),this._backButtons.set(e,a)}_removeBackButton(e){let t=this._backButtons.get(e);t&&(t.parentNode&&t.parentNode.removeChild(t),this._backButtons.delete(e))}};customElements.define(`adw-navigation-view`,AdwNavigationView),customElements.define(`adw-navigation-page`,AdwNavigationPage);var AdwNavigationSplitView=class extends HTMLElement{_sidebarEl;_contentEl;_initialized=!1;_disposeBreakpoint;_breakpointApplied=!1;_state=new NavigationSplitViewState;_reflecting=!1;static get observedAttributes(){return[`collapsed`,`show-content`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`breakpoint`]}get collapsed(){return this._initialized?this._state.collapsed:this.hasAttribute(`collapsed`)}set collapsed(e){this.toggleAttribute(`collapsed`,e)}get showContent(){return this._initialized?this._state.showContent:this.hasAttribute(`show-content`)}set showContent(e){this.toggleAttribute(`show-content`,e)}get sidebarPosition(){return this.getAttribute(`sidebar-position`)===`end`?`end`:`start`}set sidebarPosition(e){this.setAttribute(`sidebar-position`,e)}get sidebarTag(){return this._state.sidebarTag}get contentTag(){return this._state.contentTag}push(e){return this._state.push(e)}pop(){return this._state.pop()}connectedCallback(){this._buildOnce(),this._reflectShowContent(),this._syncWidth(),this._syncClasses(),this._syncBreakpoint()}_buildOnce(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`,bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl}],(e,t)=>this._mountPane(t.name===`sidebar`?`sidebar`:`content`)).install(this._sidebarEl,this._contentEl),this._state=new NavigationSplitViewState({sidebarPosition:this.sidebarPosition,collapsed:this.hasAttribute(`collapsed`),showContent:this.hasAttribute(`show-content`),onCritical:e=>console.error(e),onDelegate:(e,t)=>{let n={tag:t,handled:!1};return this.dispatchEvent(new CustomEvent(`navigation-${e}`,{bubbles:!0,detail:n})),n.handled}}),this._mountPane(`sidebar`),this._mountPane(`content`),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()}))}_mountPane(e){let t=e===`sidebar`?this._sidebarEl:this._contentEl,n=Array.from(t.children),r=n.length>0?{tag:this._tagOf(n)}:null;e===`sidebar`?this._state.setSidebar(r):this._state.setContent(r)}_tagOf(e){for(let t of e){let e=t.getAttribute(`tag`);if(e!==null)return e}return null}_reflectShowContent(){if(this._reflecting)return;let e=this._state.showContent;if(this.hasAttribute(`show-content`)!==e){this._reflecting=!0;try{this.toggleAttribute(`show-content`,e)}finally{this._reflecting=!1}}}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0}attributeChangedCallback(e){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}if(e===`min-sidebar-width`||e===`max-sidebar-width`){this._syncWidth();return}e===`collapsed`&&this._state.setCollapsed(this.hasAttribute(`collapsed`)),e===`show-content`&&this._state.setShowContent(this.hasAttribute(`show-content`)),e===`sidebar-position`&&this._state.setSidebarPosition(this.sidebarPosition),this._syncClasses(),this._syncWidth()}}_syncWidth(){if(this.collapsed){this._sidebarEl.style.minWidth=``,this._sidebarEl.style.maxWidth=``;return}let e=resolveSidebarBounds({minSidebarWidth:this._widthAttr(`min-sidebar-width`,180),maxSidebarWidth:this._widthAttr(`max-sidebar-width`,280)},0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`}_widthAttr(e,t){let n=this.getAttribute(e);if(n===null)return t;let r=parseFloat(n);return Number.isFinite(r)?r:t}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-content`,e.showContent),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,isSidebarAtVisualStart(e.sidebarPosition,this._direction)),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed);let{stack:t}=e.stack,n=t[t.length-1]??null;this._sidebarEl&&(this._sidebarEl.dataset.paneVisible=String(!e.collapsed||n===`sidebar`)),this._contentEl&&(this._contentEl.dataset.paneVisible=String(!e.collapsed||n===`content`))}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}};customElements.define(`adw-navigation-split-view`,AdwNavigationSplitView);const _t={animate(e){let t=0,n=!1,r=performance.now(),step=i=>{if(n)return;let a=Math.min((i-r)/250,1),o=1-(1-a)*(1-a);if(e.onValue(e.from+(e.to-e.from)*o),a<1){t=requestAnimationFrame(step);return}e.onValue(e.to),e.onDone()};return t=requestAnimationFrame(step),{cancel(){n=!0,t&&cancelAnimationFrame(t)}}}};function readTriStateAttr(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var AdwOverlaySplitView=class extends HTMLElement{_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_breakpointApplied=!1;_state=new OverlaySplitViewState;_reflecting=!1;_measuredWidth=0;_resizeObserver;_swipePointer=null;_swipeOrigin={x:0,progress:0};static get observedAttributes(){return[`show-sidebar`,`collapsed`,`pin-sidebar`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`sidebar-width-fraction`,`enable-show-gesture`,`enable-hide-gesture`,`breakpoint`]}get showSidebar(){return this._state.showSidebar}set showSidebar(e){this.setAttribute(`show-sidebar`,e?``:`false`)}get collapsed(){return this._state.collapsed}set collapsed(e){e?this.setAttribute(`collapsed`,``):this.removeAttribute(`collapsed`)}get minSidebarWidth(){return parseFloat(this.getAttribute(`min-sidebar-width`)||`180`)}get maxSidebarWidth(){return parseFloat(this.getAttribute(`max-sidebar-width`)||`280`)}get sidebarWidthFraction(){return parseFloat(this.getAttribute(`sidebar-width-fraction`)||`0.25`)}connectedCallback(){this._buildOnce(),this._bindToDocument(),this._reflectShowSidebar(),this._syncClasses(),this._syncSidebarWidth(),this._syncBreakpoint()}_buildOnce(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._sidebarEl,this._contentEl,this._backdropEl),this._state=new OverlaySplitViewState({collapsed:this.hasAttribute(`collapsed`),showSidebar:readTriStateAttr(this,`show-sidebar`,!0),pinSidebar:this.hasAttribute(`pin-sidebar`),sidebarPosition:this.getAttribute(`sidebar-position`)===`end`?`end`:`start`,enableShowGesture:readTriStateAttr(this,`enable-show-gesture`,!0),enableHideGesture:readTriStateAttr(this,`enable-hide-gesture`,!0),animator:_t}),this._state.subscribe(()=>{this._reflectShowSidebar(),this._syncClasses()}),this.addEventListener(`keydown`,this._onKeyDown),this._bindSwipe())}_bindToDocument(){this._resizeObserver?.disconnect(),this._resizeObserver=new ResizeObserver(e=>{let t=e[e.length-1];if(!t)return;let n=t.borderBoxSize?.[0];this._measuredWidth=n?n.inlineSize:t.contentRect.width,this._syncSidebarWidth(),this._syncClasses()}),this._resizeObserver.observe(this),this._measuredWidth=this.offsetWidth}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_onKeyDown=e=>{e.key!==`Escape`||e.defaultPrevented||this._state.escape()&&e.preventDefault()};attributeChangedCallback(e,t,n){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}this._readAttribute(e),(e===`min-sidebar-width`||e===`max-sidebar-width`||e===`sidebar-width-fraction`||e===`collapsed`)&&this._syncSidebarWidth(),this._syncClasses()}}_readAttribute(e){let t=this._state;if(e===`pin-sidebar`&&t.setPinSidebar(this.hasAttribute(`pin-sidebar`)),e===`sidebar-position`){let e=this.getAttribute(`sidebar-position`);t.setSidebarPosition(e===`end`?`end`:`start`)}e===`show-sidebar`&&t.setShowSidebar(readTriStateAttr(this,`show-sidebar`,!0)),e===`enable-show-gesture`&&t.setEnableShowGesture(readTriStateAttr(this,`enable-show-gesture`,!0)),e===`enable-hide-gesture`&&t.setEnableHideGesture(readTriStateAttr(this,`enable-hide-gesture`,!0)),e===`collapsed`&&t.setCollapsed(this.hasAttribute(`collapsed`)),this._reflectShowSidebar()}_reflectShowSidebar(){if(this._reflecting)return;let e=this._state.showSidebar?``:`false`;if(this.getAttribute(`show-sidebar`)!==e){this._reflecting=!0;try{this.setAttribute(`show-sidebar`,e)}finally{this._reflecting=!1}}}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}openSidebar(){this.showSidebar=!0,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!0}}))}hideSidebar(){this.showSidebar=!1,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!1}}))}toggleSidebar(){this.showSidebar=!this.showSidebar,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:this.showSidebar}}))}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}get _widthSpec(){return{minSidebarWidth:this.minSidebarWidth,maxSidebarWidth:this.maxSidebarWidth,sidebarWidthFraction:this.sidebarWidthFraction}}get _sidebarWidth(){return resolveOverlaySidebarWidth({...this._widthSpec,totalWidth:this._measuredWidth,collapsed:this._state.collapsed})}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-sidebar`,e.showSidebar);let t=isSidebarAtVisualStart(e.sidebarPosition,this._direction);this.classList.toggle(`sidebar-start`,e.sidebarPosition===`start`),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,t),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._sidebarEl?.classList.toggle(`overlay-pane`,e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed),this._backdropEl&&(this._backdropEl.hidden=!e.shieldVisible),this._sidebarEl?.setAttribute(`aria-hidden`,String(!e.sidebarFocusable)),this._contentEl?.setAttribute(`aria-hidden`,String(!e.contentFocusable)),this._syncGeometry()}_syncGeometry(){let e=this._sidebarEl;if(!e)return;if(this._measuredWidth<=0){for(let t of[`left`,`marginLeft`,`marginRight`,`width`,`minWidth`,`maxWidth`,`opacity`,`pointerEvents`])e.style[t]=``;this._backdropEl&&(this._backdropEl.style.opacity=``);return}let t=this._state,n=this._sidebarWidth,r=layoutOverlaySplitView({totalWidth:this._measuredWidth,sidebarWidth:n,showProgress:t.showProgress,collapsed:t.collapsed,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=isSidebarAtVisualStart(t.sidebarPosition,this._direction);if(e.style.width=`${r.sidebar.width}px`,t.collapsed)e.style.marginLeft=``,e.style.marginRight=``,e.style.insetInlineStart=``,e.style.left=`${r.sidebar.x}px`;else{e.style.left=``;let r=n-Math.trunc(n*Math.min(t.showProgress,1));e.style.marginLeft=i?`${-r}px`:``,e.style.marginRight=i?``:`${-r}px`}e.style.opacity=t.showProgress<=0?`0`:`1`,e.style.pointerEvents=t.sidebarPainted?``:`none`,this._backdropEl&&(this._backdropEl.style.opacity=String(1-r.shadowProgress))}_syncSidebarWidth(){if(!this._sidebarEl)return;let e=resolveSidebarBounds(this._widthSpec,0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`,this._syncGeometry()}_bindSwipe(){this.addEventListener(`pointerdown`,e=>{if(this._swipePointer!==null||e.button!==0)return;let t=this._state,n=this.getBoundingClientRect(),r=resolveSwipeArea({isDrag:!0,sidebarWidth:this._sidebarWidth,showProgress:t.showProgress,totalWidth:n.width,totalHeight:n.height,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=e.clientX-n.left,a=e.clientY-n.top;i<r.x||i>r.x+r.width||a<r.y||a>r.y+r.height||(this._swipePointer=e.pointerId,this._swipeOrigin={x:e.clientX,progress:t.showProgress})}),this.addEventListener(`pointermove`,e=>{if(e.pointerId!==this._swipePointer)return;let t=this._state,n=this._sidebarWidth||1,r=isSidebarAtVisualStart(t.sidebarPosition,this._direction),i=(e.clientX-this._swipeOrigin.x)/n*(r?1:-1);if(!t.swipeActive){if(!resolveSwipeStart({showProgress:t.showProgress,collapsed:t.collapsed,direction:i>=0?`forward`:`back`,enableShowGesture:t.enableShowGesture,enableHideGesture:t.enableHideGesture})){this._swipePointer=null;return}t.beginSwipe();try{this.setPointerCapture(e.pointerId)}catch{}}t.setShowProgress(this._swipeOrigin.progress+i)});let release=(e,t)=>{if(e.pointerId!==this._swipePointer)return;this._swipePointer=null;let n=this._state;if(!n.swipeActive)return;this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId);let r=resolveSwipeSnapPoints({showProgress:n.showProgress,enableShowGesture:n.enableShowGesture,enableHideGesture:n.enableHideGesture,swipeActive:!0}),i=t?swipeCancelProgress(n.showProgress):r.reduce((e,t)=>Math.abs(t-n.showProgress)<Math.abs(e-n.showProgress)?t:e);n.endSwipe(i)};this.addEventListener(`pointerup`,e=>release(e,!1)),this.addEventListener(`pointercancel`,e=>release(e,!0))}};customElements.define(`adw-overlay-split-view`,AdwOverlaySplitView);var AdwPasswordEntryRow=class extends AdwEntryRow{_password=new PasswordEntryRowState(this._state);_toggle;_toggleIcon;static get observedAttributes(){return[...AdwEntryRow.observedAttributes,`revealed`]}get _classPrefix(){return`adw-password-entry-row`}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}_onConnected(){this._input.type=`password`,this._input.autocomplete=`off`,this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only ${this._classPrefix}-toggle`,this._toggleIcon=createGtkImage(null),this._toggle.append(this._toggleIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this.addSuffix(this._toggle);let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock);let e=this._password.state;this.setIndicatorIconName(e.indicatorIconName),this.setIndicatorTooltip(e.indicatorTooltip),this.hasAttribute(`revealed`)&&this._password.setRevealed(this.getAttribute(`revealed`)!==`false`),this._renderPassword(this._password.state),this._password.subscribe(e=>{this._renderPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){if(e!==`revealed`){super.attributeChangedCallback(e,t,n);return}this._initialized&&this._password.setRevealed(n!==null&&n!==`false`)}_renderPassword(e){this._input.type=e.revealed?`text`:`password`,this._toggleIcon.dataset.iconName=e.peekIconName,this._toggleIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`)}};customElements.define(`adw-password-entry-row`,AdwPasswordEntryRow);const vt=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),yt=new Set([...vt,`adw-entry-row`,`adw-password-entry-row`,`adw-expander-row`,`adw-button-row`]);function isVisible(e){return!(e instanceof HTMLElement&&e.hidden)}function groupRows(e){let t=e.querySelector(`:scope > .adw-preferences-group-listbox`);return Array.from((t??e).children).filter(e=>yt.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:vt.has(e.tagName.toLowerCase()),useMarkup:!1,useUnderline:!1,ref:e}}function describeGroup(e){return{title:e.getAttribute(`title`)??``,visible:isVisible(e),rows:groupRows(e).map(describeRow),ref:e}}function describePreferencesPages(e){return Array.from(e.querySelectorAll(`adw-preferences-page`)).map(e=>({name:e.getAttribute(`name`),title:e.getAttribute(`title`)??``,iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),visible:isVisible(e),description:e.getAttribute(`description`)??``,groups:Array.from(e.querySelectorAll(`adw-preferences-group`)).map(describeGroup),ref:e}))}function searchPreferencesDom(e,t,n){return searchPreferences(describePreferencesPages(e),t,n)}var AdwPreferencesPage=class extends HTMLElement{static get observedAttributes(){return[`title`,`icon-name`,`name`,`use-underline`,`open`]}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){this.setAttribute(`icon-name`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get groups(){return Array.from(this.querySelectorAll(`adw-preferences-group`))}},AdwPreferencesDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_titleEl;_bodyEl;_pagesEl;_closeBtn;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?640:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}present(){this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}add(e){this._pagesEl.appendChild(e)}removePage(e){return e.parentNode===this._pagesEl?(this._pagesEl.removeChild(e),!0):!1}get pages(){return Array.from(this._pagesEl.querySelectorAll(`adw-preferences-page`))}search(e,t){return searchPreferencesDom(this._pagesEl,e,t)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-preferences-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-preferences-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation());let e=document.createElement(`div`);e.className=`adw-preferences-dialog-header`;let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let n=document.createElement(`div`);n.className=`adw-preferences-dialog-header-side adw-preferences-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-preferences-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),n.appendChild(this._closeBtn),e.append(t,this._titleEl,n),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`,this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(e,this._bodyEl),bindSlottedChildren(this,[{into:this._pagesEl}]).install(this._scrimEl,this._dialogEl),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():(this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss())))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_render(){this.classList.toggle(`open`,this.open);let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._dialogEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let t=!this.canClose;this._closeBtn.disabled=t,this._closeBtn.classList.toggle(`locked`,t)}};customElements.define(`adw-preferences-page`,AdwPreferencesPage),customElements.define(`adw-preferences-dialog`,AdwPreferencesDialog);function isHeaderSuffix(e){return e instanceof Element&&e.getAttribute(`slot`)===`header-suffix`}var AdwPreferencesGroup=class extends HTMLElement{_headerEl;_titleEl;_descriptionEl;_suffixEl;_listboxEl;_initialized=!1;_observer=null;static get observedAttributes(){return[`title`,`description`]}get description(){return this.getAttribute(`description`)??``}set description(e){e?this.setAttribute(`description`,e):this.removeAttribute(`description`)}addRow(e){isHeaderSuffix(e)?this._suffixEl.appendChild(e):this._listboxEl.appendChild(e),this._renderHeader()}removeRow(e){let t=e.parentNode;return t!==this._listboxEl&&t!==this._suffixEl?!1:(t.removeChild(e),this._renderHeader(),!0)}connectedCallback(){if(this._initialized){this._observeBoxes();return}this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let e=document.createElement(`div`);e.className=`adw-preferences-group-labels`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-group-title`,this._descriptionEl=document.createElement(`span`),this._descriptionEl.className=`adw-preferences-group-description`,e.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`,this._headerEl.append(e,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`,bindSlottedChildren(this,[{name:`header-suffix`,into:this._suffixEl},{into:this._listboxEl}],()=>this._renderHeader()).install(this._headerEl,this._listboxEl),this.setAttribute(`role`,`group`),this._observeBoxes()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeBoxes(){this._observer||(this._observer=new MutationObserver(()=>this._renderHeader()),this._observer.observe(this._listboxEl,{childList:!0}),this._observer.observe(this._suffixEl,{childList:!0}),this._renderHeader())}_renderHeader(){let e=this.getAttribute(`title`)??``,t=this.getAttribute(`description`)??``;this._titleEl.textContent=e,this._descriptionEl.textContent=t;let n=derivePreferencesGroupHeader({title:e,description:t,hasHeaderSuffix:this._suffixEl.childElementCount>0,rowCount:this._listboxEl.childElementCount,useMarkup:!1});this._titleEl.hidden=!n.titleVisible,this._descriptionEl.hidden=!n.descriptionVisible,this._headerEl.hidden=!n.headerVisible,this._headerEl.classList.toggle(`single-line`,n.singleLine),this._listboxEl.hidden=!n.listboxVisible}};customElements.define(`adw-preferences-group`,AdwPreferencesGroup);var AdwPreferencesRow=class extends HTMLElement{_titleEl;_contentEl;_initialized=!1;static get observedAttributes(){return[`title`,`title-selectable`,`use-markup`,`use-underline`]}get title(){return this.getAttribute(`title`)??``}set title(e){e===``?this.removeAttribute(`title`):this.setAttribute(`title`,e)}get titleSelectable(){return this.hasAttribute(`title-selectable`)}set titleSelectable(e){this.toggleAttribute(`title-selectable`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get child(){return this._contentEl?.firstElementChild??null}set child(e){this._contentEl?.replaceChildren(...e===null?[]:[e])}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-preferences-row-content`,bindSlottedChildren(this,[{name:`child`,into:this._contentEl}]).install(this._titleEl,this._contentEl),bindEmptySections(this._contentEl),this.setAttribute(`role`,`listitem`),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}})))}_render(){let e=labelDisplayText(this.title,this.useMarkup,this.useUnderline);this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e),this._titleEl.style.userSelect=this.titleSelectable?`text`:``}};customElements.define(`adw-preferences-row`,AdwPreferencesRow);var AdwShortcutLabel=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`accelerator`,`disabled-text`]}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`img`)),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){this.setAttribute(`accelerator`,e)}get disabledText(){return this.getAttribute(`disabled-text`)??``}set disabledText(e){this.setAttribute(`disabled-text`,e)}_render(){let{nodes:e,accessibleLabel:t,error:n}=parseShortcutLabel(this.accelerator,{disabledText:this.disabledText,direction:this._direction()});this.replaceChildren(...e.map(e=>this._nodeElement(e))),this.setAttribute(`aria-label`,t),n&&console.warn(`adw-shortcut-label: failed to parse ${n}, part of accelerator '${this.accelerator}'`)}_direction(){let e=this.isConnected?getComputedStyle(this).direction:``;return e===`rtl`||e===`ltr`?e:this.closest(`[dir="rtl"]`)?`rtl`:`ltr`}_nodeElement(e){if(e.kind===`separator`||e.kind===`disabled`){let t=document.createElement(`span`);return t.className=e.kind===`disabled`?`dimmed adw-shortcut-label-disabled`:`dimmed`,t.textContent=e.text,t}let t=document.createElement(`span`);t.className=`adw-shortcut-label-keys`,t.setAttribute(`dir`,`ltr`);for(let n of e.keys){let e=document.createElement(`span`);if(e.className=`keycap`,e.textContent=n.label,n.sideMarker){let t=document.createElement(`sub`);t.className=`adw-shortcut-label-side`,t.textContent=n.sideMarker,e.append(t)}t.append(e)}return t}};customElements.define(`adw-shortcut-label`,AdwShortcutLabel);var AdwShortcutsDialog=class extends AdwDialog{get sections(){return[...this.contentArea.children].filter(e=>e.localName===`adw-shortcuts-section`)}connectedCallback(){super.connectedCallback(),this.classList.add(`adw-shortcuts-dialog`)}};customElements.define(`adw-shortcuts-dialog`,AdwShortcutsDialog);const bt=new WeakMap,xt=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`,`needs-attention`,`badge-number`]}get enabled(){return!this.hasAttribute(`disabled`)}set enabled(e){this.toggleAttribute(`disabled`,!e)}get visible(){return!this.hasAttribute(`hidden`)}set visible(e){this.toggleAttribute(`hidden`,!e)}attributeChangedCallback(e,t,n){let r=bt.get(this);if(!r)return;let i=n??``;e===`title`?r.spec.title=i:e===`subtitle`?r.spec.subtitle=i:e===`icon-name`?r.spec.iconName=i:e===`disabled`?r.spec.enabled=n===null:e===`hidden`?r.spec.visible=n===null:e===`needs-attention`?r.spec.needsAttention=n===null:e===`badge-number`&&(r.spec.badgeNumber=Number.parseInt(i,10)||0),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=xt.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends HTMLElement{_state=new SidebarState;_listEl;_rows=[];_initialized=!1;_reflecting=!1;static get observedAttributes(){return[`mode`,`selected`]}get selected(){return this._state.selected}set selected(e){this.setAttribute(`selected`,String(e))}get selectedItem(){return this._state.selectedItem}get mode(){return this._state.mode}set mode(e){this.setAttribute(`mode`,e)}get sections(){return this._state.sections}set sections(e){this._state.setSections(e),this._rebuild()}get filter(){return this._state.filter}set filter(e){this._state.setFilter(e),this._rebuild()}connectedCallback(){this._initialized||(this._initialized=!0,this._listEl=document.createElement(`div`),this._listEl.className=`adw-sidebar-list`,this._listEl.setAttribute(`role`,`listbox`),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows.filter(e=>!e.el.hidden&&!e.el.disabled).map(e=>e.el),select:e=>{let t=this._rows.find(t=>t.el===e);t!==void 0&&this._state.setSelected(t.index)}}),this._state.setSections(this._readDeclaredSections()),this._state.setMode(this._readModeAttr()),this.hasAttribute(`selected`)&&this._state.setSelected(this._readSelectedAttr()),this._state.subscribe(e=>this._onSelectionChanged(e)),this.replaceChildren(this._listEl),this._applyMode(),this._rebuild(),this._reflectSelected())}attributeChangedCallback(e){if(!(!this._initialized||this._reflecting)){if(e===`selected`){this._state.setSelected(this._readSelectedAttr()),this._reflectSelected();return}e===`mode`&&this._state.setMode(this._readModeAttr())&&(this._applyMode(),this._applySelection())}}refresh(){this._initialized&&(this._state.refresh(),this._rebuild())}_readDeclaredSections(){let e=[];for(let t of Array.from(this.querySelectorAll(`adw-sidebar-section`))){let n=[];for(let e of Array.from(t.querySelectorAll(`adw-sidebar-item`))){let t={title:e.getAttribute(`title`)??``,subtitle:e.getAttribute(`subtitle`)??``,iconName:e.getAttribute(`icon-name`)??``,enabled:!e.hasAttribute(`disabled`),visible:!e.hasAttribute(`hidden`),badgeNumber:Number.parseInt(e.getAttribute(`badge-number`)??`0`,10)||0,needsAttention:e.hasAttribute(`needs-attention`)};bt.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};xt.set(t,{sidebar:this,spec:r}),e.push(r)}return e}_readModeAttr(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}_readSelectedAttr(){return Number.parseFloat(this.getAttribute(`selected`)??``)}_reflectSelected(){this._reflecting=!0,this.setAttribute(`selected`,String(this._state.selected)),this._reflecting=!1}_onSelectionChanged(e){this._reflectSelected(),this._applySelection(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected,previous:e.previous,interactive:e.interactive}}))}_activate(e){this._state.activate(e).activated&&this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:e}}))}_rebuild(){let e=new Map;for(let t of this._state.headers)e.set(t.sectionIndex,t);let t=[];for(let e of this._state.visibleItems){let n=t[t.length-1];n&&n.sectionIndex===e.sectionIndex?n.items.push(e):t.push({sectionIndex:e.sectionIndex,items:[e]})}this._rows=[];let n=[];for(let r of t){let t=e.get(r.sectionIndex);t&&n.push(this._createHeader(t));let i=document.createElement(`div`);i.className=`adw-sidebar-section`;for(let e of r.items){let t=this._createRow(e);i.appendChild(t),this._rows.push({el:t,index:e.index})}n.push(i)}this._listEl.replaceChildren(...n),this.classList.toggle(`empty`,this._state.isEmpty),this._applySelection()}_createHeader(e){let t=document.createElement(`div`);if(t.className=`adw-sidebar-section-header`,e.kind===`title`){t.classList.add(`has-title`);let n=document.createElement(`span`);n.className=`adw-sidebar-section-heading`,n.textContent=e.title,t.appendChild(n)}else t.classList.add(`separator`);return e.first&&t.classList.add(`first`),t}_createRow(e){let t=e.item,n=document.createElement(`button`);n.type=`button`,n.className=`adw-sidebar-item`,n.setAttribute(`role`,`option`),n.hidden=t.visible===!1,n.disabled=t.enabled===!1;let r=createGtkImage(t.iconName??null,`adw-sidebar-item-icon`);r.hidden=!e.iconVisible,n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-sidebar-item-text`;let a=document.createElement(`span`);a.className=`adw-sidebar-item-title`,a.textContent=t.title,a.hidden=!e.titleVisible,i.appendChild(a);let o=document.createElement(`span`);return o.className=`adw-sidebar-item-subtitle`,o.textContent=t.subtitle??``,o.hidden=!e.subtitleVisible,i.appendChild(o),n.appendChild(i),n.appendChild(this._createIndicator(t)),n.appendChild(createGtkImage(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_createIndicator(e){let t=e.badgeNumber??0,n=e.needsAttention===!0,r=document.createElement(`span`);if(r.className=`indicator`,r.hidden=!n&&t===0,r.classList.toggle(`dot`,t===0),r.classList.toggle(`needs-attention`,n),t>0){let e=document.createElement(`span`);e.className=`numeric`,e.textContent=viewSwitcherBadgeLabel(t),r.appendChild(e)}return r}_applyMode(){let e=this._state.mode===`page`;this.classList.toggle(`page`,e),this.classList.toggle(`mode-sidebar`,!e)}_applySelection(){let e=this._state.selected,t=this._state.selectionVisible;this._rows.forEach((n,r)=>{let i=n.index===e;n.el.classList.toggle(`selected`,i&&t),n.el.setAttribute(`aria-selected`,String(i)),n.el.tabIndex=i||e===-1&&r===0?0:-1})}};customElements.define(`adw-sidebar-item`,AdwSidebarItem),customElements.define(`adw-sidebar-section`,AdwSidebarSection),customElements.define(`adw-sidebar`,AdwSidebar);const St=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of St){let r=e.getAttribute(attributeOf(n)),i=r===null?NaN:Number.parseFloat(r);Number.isFinite(i)&&(t[n]=i)}return t}var AdwSpinRow=class extends HTMLElement{_input;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`adjustment`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?parseAdjustment(e):e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`)));this._state.configure(e);let t=document.createElement(`div`);t.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,t.append(this._titleEl,this._subtitleEl);let n=document.createElement(`div`);n.className=`adw-spin-control`;let r=document.createElement(`button`);r.className=`adw-spin-dec`,r.textContent=`−`,r.addEventListener(`click`,()=>this._adjust(-this._state.adjustment.stepIncrement));let i=document.createElement(`input`);i.type=`text`,i.value=this._formatValue(this._state.value),i.addEventListener(`change`,()=>{let e=parseFloat(i.value);Number.isNaN(e)?i.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let a=document.createElement(`button`);a.className=`adw-spin-inc`,a.textContent=`+`,a.addEventListener(`click`,()=>this._adjust(this._state.adjustment.stepIncrement)),n.append(r,i,a),bindSlottedChildren(this,[{name:`adjustment`,consume:e=>this._state.configure(normalizeAdjustment(authoredAdjustment(e)))}]).install(t,n);let o=this.getAttribute(`value`);this._state.setValue(this._roundToStep(o===null?this._state.value:Number.parseFloat(o))),i.value=this._formatValue(this._state.value),this._input=i,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`title`||e===`subtitle`){this._renderText();return}if(e===`adjustment`){this._state.configure(parseAdjustment(n));return}this._state.setValue(this._roundToStep(Number.parseFloat(n||`0`)))}}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}_adjust(e){this.value=this._state.value+e,this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:this._state.value}}))}_syncValue(){this._input&&(this._input.value=this._formatValue(this._state.value)),this.setAttribute(`value`,String(this._state.value))}_roundToStep(e){if(!Number.isFinite(e))return e;let t=this._countDecimals(this._state.adjustment.stepIncrement);return t>0?parseFloat(e.toFixed(t)):e}_countDecimals(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}_formatValue(e){let t=this._countDecimals(this._state.adjustment.stepIncrement);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);const Ct=`http://www.w3.org/2000/svg`,I=new Set;let wt=0;function tick(e){for(let t of I)t.drawAt(e);wt=I.size>0?requestAnimationFrame(tick):0}function startTicking(){wt===0&&I.size>0&&(wt=requestAnimationFrame(tick))}var AdwSpinner=class extends HTMLElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),I.add(this),this._origin=null,startTicking()}disconnectedCallback(){I.delete(this)}attributeChangedCallback(){this._sync()}drawAt(e){this._origin===null&&(this._origin=e),this._paint(spinnerProgressAt(e-this._origin))}_build(){if(this._svg)return;let e=document.createElementNS(Ct,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(Ct,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(Ct,`circle`);n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-linecap`,`round`),e.append(t,n),this._svg=e,this._track=t,this._arc=n,this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-busy`,`true`),this._sync()}_sync(){let e=this._svg,t=this._track,n=this._arc;if(!e||!t||!n)return;let r=resolveSpinnerSize(this.getAttribute(`size`)),{diameter:i,lineWidth:a}=spinnerGeometry(r,r);this.style.width=`${r}px`,this.style.height=`${r}px`,e.setAttribute(`width`,String(i)),e.setAttribute(`height`,String(i)),e.setAttribute(`viewBox`,`0 0 ${i} ${i}`);let o=(i-a)/2;this._radius=o,this._circumference=2*Math.PI*o;for(let e of[t,n])e.setAttribute(`cx`,String(i/2)),e.setAttribute(`cy`,String(i/2)),e.setAttribute(`r`,String(o)),e.setAttribute(`stroke-width`,String(a));this._paint(this._origin===null?Pe:this._lastProgress)}_lastProgress=Pe;_paint(e){let t=this._arc;if(!t||this._radius<=0)return;this._lastProgress=e;let{end:n,length:r}=spinnerArc(e),i=r*this._radius;t.setAttribute(`stroke-dasharray`,`${i} ${Math.max(this._circumference-i,0)}`),t.setAttribute(`stroke-dashoffset`,String(-n*this._radius))}};customElements.define(`adw-spinner`,AdwSpinner);var PopoverMenuView=class{surface;prefix;onActivate;_model=[];_actions=null;_title=``;_page=[];_openers=new Set;_backRow=null;_key=`[]`;_rows=[];constructor(e,t,n){this.surface=e,this.prefix=t,this.onActivate=n,this.surface.addEventListener(`keydown`,e=>this._onKeyDown(e))}_onKeyDown(e){let t=document.activeElement;if(!(t===null||!this.surface.contains(t))){if(e.key===`ArrowRight`&&this._openers.has(t)){e.preventDefault(),t.click();return}e.key===`ArrowLeft`&&t===this._backRow&&(e.preventDefault(),t.click())}}get rows(){return this._rows}get page(){return this._page}showPage(e){this._page=[...e]}get focusableRows(){return this._rows.filter(e=>!e.hidden&&!e.disabled)}focusPage(e){let t=this.focusableRows;(t[e]??t[0])?.focus()}setMenuModel(e){let t=JSON.stringify(e);t!==this._key&&(this._key=t,this._page=[]),this._model=e}setActions(e){this._actions=e}setTitle(e){this._title=e}reset(){this._page=[]}currentItems(){if(this._page.length===0)return this._model;let e=menuNodeAt(this._model,this._page);return e!==null&&e.kind!==`item`?e.items:this._model}render(){this.surface.replaceChildren(),this._rows=[],this._openers=new Set,this._backRow=null;let e=menuNodeAt(this._model,this._page);this._page.length>0&&e!==null&&e.kind===`submenu`?this.surface.appendChild(this.backRow(e.label)):this._title.length>0&&this.surface.appendChild(this.heading(this._title,`${this.prefix}-title`));let t=``;for(let e of flattenMenu(this.currentItems(),this._page)){e.separated&&this.surface.appendChild(this.separator());let n=e.path.slice(0,-1),r=n.join(`.`);if(r!==t){t=r;let e=this.sectionHeading(n);e!==null&&this.surface.appendChild(this.heading(e,`adw-popover-section-title`))}e.node.kind===`submenu`?this.surface.appendChild(this.submenuRow(e.node.label,e.node.icon,e.path)):this.surface.appendChild(this.itemRow(e.node,e.path))}}sectionHeading(e){if(e.length<=this._page.length)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind===`section`&&t.label!==void 0?t.label:null}heading(e,t){let n=document.createElement(`div`);return n.className=`adw-popover-title ${t}`,n.textContent=e,n}separator(){let e=document.createElement(`div`);return e.className=`adw-popover-separator`,e.setAttribute(`role`,`separator`),e}baseRow(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-popover-item ${e}`,t.tabIndex=-1,this._rows.push(t),t}backRow(e){let t=this.baseRow(`${this.prefix}-item adw-popover-back`);t.setAttribute(`role`,`menuitem`),t.appendChild(createGtkImage(`go-previous`,`${this.prefix}-item-icon`));let n=document.createElement(`span`);return n.className=`${this.prefix}-item-label`,n.textContent=e.length>0?e:`Back`,t.appendChild(n),t.addEventListener(`click`,()=>{this._page=this._page.slice(0,-1),this.render(),this.focusPage(0)}),this._backRow=t,t}submenuRow(e,t,n){let r=this.baseRow(`${this.prefix}-item`);r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),t!==void 0&&t.length>0&&r.appendChild(createGtkImage(t,`${this.prefix}-item-icon`));let i=document.createElement(`span`);return i.className=`${this.prefix}-item-label`,i.textContent=e,r.appendChild(i),r.appendChild(createGtkImage(`go-next`,`adw-popover-item-arrow`)),r.addEventListener(`click`,()=>{this._page=[...n],this.render(),this.focusPage(1)}),this._openers.add(r),r}itemRow(e,t){let n=resolveMenuItemState(e,this._actions??void 0),r=this.baseRow(`${this.prefix}-item`);if(r.hidden=!n.visible,r.disabled=!n.sensitive,n.sensitive||r.setAttribute(`aria-disabled`,`true`),n.role===`normal`)r.setAttribute(`role`,`menuitem`);else{r.setAttribute(`role`,n.role===`check`?`menuitemcheckbox`:`menuitemradio`),r.setAttribute(`aria-checked`,String(n.toggled));let e=document.createElement(`span`);e.className=`adw-popover-item-check ${n.role===`radio`?`radio`:``}`.trim(),r.appendChild(e)}e.icon!==void 0&&e.icon.length>0&&r.appendChild(createGtkImage(e.icon,`${this.prefix}-item-icon`));let i=document.createElement(`span`);if(i.className=`${this.prefix}-item-label`,i.textContent=e.label,r.appendChild(i),e.accel!==void 0&&e.accel.length>0){let t=document.createElement(`span`);t.className=`adw-popover-item-accel`,t.textContent=e.accel,r.appendChild(t)}return r.addEventListener(`click`,()=>{n.sensitive&&this.onActivate(t)}),r}};const Tt=[`bottom`,`top`,`start`,`end`],Et=[`start`,`end`],Dt=[`menu`,`listbox`],Ot=[...Dt,`dialog`];var GtkPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{if(!this.autohide)return;let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&this.autohide&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`,`autohide`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get autohide(){return this.getAttribute(`autohide`)!==`false`}set autohide(e){this.setAttribute(`autohide`,String(e))}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return Tt.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return Et.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return Ot.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden&&!e.disabled)}popup(){this._state.popup()}popdown(){this._state.popdown()}subscribe(e){return this._state.subscribe(t=>e(t.open))}connectedCallback(){this._buildOnce(),this._state.open&&this._bindDocument()}_buildOnce(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover`),this.hasAttribute(`role`)||this.setAttribute(`role`,`menu`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._state.subscribe(e=>this._onStateChange(e.open)),this.hasAttribute(`open`)&&this._state.popup(),this._render())}disconnectedCallback(){this._unbindDocument()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`open`){if(this._reflecting)return;n===null?this._state.popdown():this._state.popup();return}if(e===`role`&&n===null){this.setAttribute(`role`,`menu`);return}this._render()}}_onStateChange(e){e?this._bindDocument():this._unbindDocument(),this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1,this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}_bindDocument(){document.addEventListener(`pointerdown`,this._onDocumentPointerDown),document.addEventListener(`keydown`,this._onDocumentKeyDown,!0)}_unbindDocument(){document.removeEventListener(`pointerdown`,this._onDocumentPointerDown),document.removeEventListener(`keydown`,this._onDocumentKeyDown,!0)}_render(){this.hidden=!this._state.open,this.dataset.position=this.position,this.dataset.align=this.align}_onKeyDown(e){if(!this._state.open||!Dt.includes(this.popoverRole))return;let t=this.items,n=document.activeElement,r=n===null?-1:t.indexOf(n),i=this.querySelector(`input, textarea`)!==null,{action:a,index:o}=resolvePopoverKey(e.key,{itemCount:t.length,currentIndex:r,hasSearch:i});if(a===`focus`){e.preventDefault(),t[o]?.focus();return}a===`activate`&&(e.preventDefault(),t[o]?.click(),this.dispatchEvent(new CustomEvent(`popover-item-activated`,{bubbles:!0,detail:{index:o}})))}};customElements.define(`gtk-popover`,GtkPopover);const kt={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},At={"open-menu-symbolic":`open-menu`,"pan-down-symbolic":`go-down`,"pan-up-symbolic":`go-down`,"pan-start-symbolic":`go-previous`,"pan-end-symbolic":`go-next`},jt={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_menuView;_actions=null;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu-model`,`disabled`,`flat`,`suggested`,`destructive`]}get active(){return this._state.open}get dropdownEnabled(){return this._state.dropdownEnabled}get label(){return this._state.label}set label(e){this.setAttribute(`label`,e??``),this.removeAttribute(`icon-name`)}get iconName(){return this._state.iconName}set iconName(e){this.setAttribute(`icon-name`,e??``),this.removeAttribute(`label`)}get menuModel(){return this._state.menuModel??[]}set menuModel(e){this._state.setMenuModel(this._acceptMenu(e)),this._initialized&&this._render()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,D),n;let r=menuRefusals(n,D);if(r.length===0)return n;console.error(`${D.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._initialized&&this._render()}get dropdownTooltip(){return this._state.dropdownTooltip}set dropdownTooltip(e){this.setAttribute(`dropdown-tooltip`,e??``)}get direction(){return this._state.direction}set direction(e){this.setAttribute(`direction`,e)}get useUnderline(){return this._state.useUnderline}set useUnderline(e){e?this.setAttribute(`use-underline`,``):this.removeAttribute(`use-underline`)}popup(){this._state.openMenu()}popdown(){this._state.closeMenu()}connectedCallback(){this._initialized||(this._initialized=!0,this._inlineLabel=(this.textContent??``).trim(),this.classList.add(`adw-split-button`),this._actionEl=document.createElement(`button`),this._actionEl.type=`button`,this._actionEl.className=`adw-split-button-action`,this._dropdownEl=document.createElement(`button`),this._dropdownEl.type=`button`,this._dropdownEl.className=`adw-split-button-dropdown`,this._dropdownEl.setAttribute(`aria-haspopup`,`menu`),this._arrowEl=createGtkImage(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`gtk-popover`),this._menuEl.classList.add(`adw-split-button-menu`),this._menuEl.setAttribute(`role`,`menu`),this._menuEl.setAttribute(`menu`,``),this._menuEl.setAttribute(`align`,`end`),this.replaceChildren(this._actionEl,this._dropdownEl,this._menuEl),this._menuEl.anchor=this._dropdownEl,this._menuEl.subscribe(e=>{e||(this._state.closeMenu(),this._menuView.reset())}),this._menuView=new PopoverMenuView(this._menuEl,`adw-split-button-menu`,e=>{let t=this._state.activateMenuItem(e);t!==null&&this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,id:t.id??t.label,path:[...e]}}))}),this._menuView.setActions(this._actions),this._actionEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this.dispatchEvent(new CustomEvent(`clicked`,{bubbles:!0}))}),this._dropdownEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this._state.toggleMenu()}),this._syncStateFromAttributes(),this._state.subscribe(e=>this._onStateChange(e)),this._render())}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`label`:case`icon-name`:this._applyContentAttribute(e,n);break;case`use-underline`:this._state.setUseUnderline(n!==null);break;case`direction`:this._state.setDirection(isSplitButtonDirection(n)?n:`down`);break;case`dropdown-tooltip`:this._state.setDropdownTooltip(n??``);break;case`menu-model`:this._state.setMenuModel(this._acceptMenu(parseMenuModel(n),!1));break;default:break}this._render()}}_syncStateFromAttributes(){let e=this.getAttribute(`label`)??(this._inlineLabel.length>0?this._inlineLabel:null),t=this.getAttribute(`icon-name`);e!==null&&this._state.setLabel(e),t!==null&&this._state.setIconName(t),this._state.setUseUnderline(this.hasAttribute(`use-underline`));let n=this.getAttribute(`direction`);isSplitButtonDirection(n)&&this._state.setDirection(n),this._state.setDropdownTooltip(this.getAttribute(`dropdown-tooltip`)??``),this._state.menuModel===null&&this._state.setMenuModel(this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1))}_applyContentAttribute(e,t){if(t!==null){e===`label`?this._state.setLabel(t):this._state.setIconName(t);return}let n=this.getAttribute(e===`label`?`icon-name`:`label`);n===null?this._state.setChild(null):e===`label`?this._state.setIconName(n):this._state.setLabel(n)}_onStateChange(e){for(let t of e.notified)this.dispatchEvent(new CustomEvent(`notify::${t}`,{bubbles:!0}));let t=e.open&&!this._openReflected;e.open!==this._openReflected&&(this._openReflected=e.open,this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.open}}))),this._render(),t&&this._menuView.focusableRows[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._actionEl.disabled=e,this._dropdownEl.disabled=e||!this._state.dropdownEnabled,this.classList.remove(`flat`,`suggested-action`,`destructive-action`);for(let[e,t]of Object.entries(kt))this.hasAttribute(e)&&this.classList.add(t);this._renderContent(),this._renderDropdown(),this._renderMenu()}_renderContent(){let{mode:e,label:t,iconName:n,styleClasses:r}=this._state;this.classList.toggle(`image-button`,r.includes(`image-button`)),this.classList.toggle(`text-button`,r.includes(`text-button`)),this._actionEl.replaceChildren(),this._actionEl.classList.toggle(`icon-only`,e===`icon`),e===`icon`&&n!==null?this._actionEl.appendChild(createGtkImage(n)):e===`label`&&t!==null&&this._actionEl.appendChild(document.createTextNode(t));let i=this.getAttribute(`tooltip`);this._actionEl.title=i??``,e===`icon`?this._actionEl.setAttribute(`aria-label`,i??(n||`Action`)):this._actionEl.removeAttribute(`aria-label`)}_renderDropdown(){let{direction:e,open:t}=this._state,n=splitButtonArrowIcon(e);this._arrowEl.iconName=At[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=jt[splitButtonPopupDirection(e)];let{text:r}=resolveDropdownTooltip(this._state.dropdownTooltip);this._dropdownEl.title=r,this._dropdownEl.setAttribute(`aria-label`,r),this._dropdownEl.setAttribute(`aria-expanded`,String(t));let{checked:i}=splitButtonRootState({active:!1,checked:!1,keyboardActivating:!1},{active:!1,checked:t,keyboardActivating:!1});this.classList.toggle(`checked`,i),this.classList.toggle(`active`,t)}_renderMenu(){this._menuEl.open=this._state.open,this._menuView.setMenuModel(this._state.menuModel??[]),this._menuView.render()}};customElements.define(`adw-split-button`,AdwSplitButton);var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`icon-name`,`title`,`description`]}connectedCallback(){this._initialized||(this._initialized=!0,this._iconEl=createGtkImage(null,`adw-status-page-icon`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-status-page-title`,this._descEl=document.createElement(`span`),this._descEl.className=`adw-status-page-description`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-status-page-child`,bindSlottedChildren(this,[{name:`child`,into:this._childEl},{into:this._childEl}]).install(this._iconEl,this._titleEl,this._descEl,this._childEl),bindEmptySections(this._childEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.getAttribute(`icon`)??this.getAttribute(`icon-name`);this._iconEl.iconName=e,this._iconEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`title`)??``;this._titleEl.textContent=t,this._titleEl.hidden=!stringIsNotEmpty(t);let n=this.getAttribute(`description`)??``;this._descEl.textContent=n,this._descEl.hidden=!stringIsNotEmpty(n)}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwSwitchRow=class extends HTMLElement{_switchEl;_prefixEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`]}get prefixSection(){return this._prefixEl}get active(){return this._initialized?this._state.active:this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-switch-row-prefix`,this._switchEl=document.createElement(`gtk-switch`),this._switchEl.unfocusable=!0,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl}]).install(this._prefixEl,e,this._switchEl),bindEmptySections(this._prefixEl),this._state.setActive(this.hasAttribute(`active`)),this._switchEl.active=this._state.active,this.setAttribute(`role`,`switch`),this.setAttribute(`aria-checked`,String(this._state.active)),this._switchEl.addEventListener(`notify::active`,e=>{e.stopPropagation(),this._apply(this._state.setActive(this._switchEl.active))}),this.addEventListener(`click`,e=>{e.target instanceof Node&&this._switchEl.contains(e.target)||this._apply(this._state.activate())}),attachRowActivation({row:this,activatable:()=>!0}),this._renderText()}attributeChangedCallback(e){this._initialized&&(e===`active`?this._apply(this._state.setActive(this.hasAttribute(`active`))):this._renderText())}_apply(e){e&&(this._switchEl.active=this._state.active,this.toggleAttribute(`active`,this._state.active),this.setAttribute(`aria-checked`,String(this._state.active)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this._state.active}})))}_renderText(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-switch-row`,AdwSwitchRow);const createTabChip=e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-tab`,t.setAttribute(`role`,`tab`);let n=createGtkImage(null,`adw-tab-icon`),r=document.createElement(`adw-spinner`);r.className=`adw-tab-spinner`,r.setAttribute(`size`,`16`),r.hidden=!0;let i=document.createElement(`span`);i.className=`adw-tab-title`;let a=createGtkImage(null,`adw-tab-indicator`),o=document.createElement(`button`);return o.type=`button`,o.className=`adw-tab-close`,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),e.onClose()}),t.append(n,r,i,a,o),t.addEventListener(`click`,()=>e.onSelect()),t.addEventListener(`pointerenter`,()=>e.onHover(!0)),t.addEventListener(`pointerleave`,()=>e.onHover(!1)),{el:t,icon:n,spinner:r,label:i,indicator:a,close:o}},refreshTabChip=(e,t,n)=>{e.label.textContent=t.title,e.el.title=tabTooltip(t),e.el.classList.toggle(`pinned`,t.pinned),e.el.classList.toggle(`needs-attention`,t.needsAttention),e.el.classList.toggle(`closing`,t.closing);let r=tabIconState(t,n);e.icon.iconName=r.icon,e.icon.hidden=!r.iconVisible||r.spinner,e.spinner.hidden=!(r.spinner&&r.iconVisible),e.indicator.iconName=t.indicatorIcon,e.indicator.hidden=!r.indicatorVisible},chipPosition=(e,t)=>t.getBoundingClientRect().left-e.getBoundingClientRect().left+e.scrollLeft,refreshTabChipClose=(e,t,n,r)=>{let i=e.scrollLeft,a=chipPosition(e,t.el),o=a>=i&&a+t.el.offsetWidth<=i+e.clientWidth;t.close.hidden=!tabCloseVisible({hovering:r.hovering,fullyVisible:o,selected:r.selected,dragging:!1,pinned:n.pinned})},scrollChipIntoBar=(e,t)=>{let n=e.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=e.scrollLeft,a=chipPosition(e,t),o=Math.min(r,n-r)/2;a-5<i?e.scrollLeft=a-o:a+r+5>i+n&&(e.scrollLeft=a+r+o-n)},Mt=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends HTMLElement{_boxEl;_startEl;_endEl;_indicatorEl;_chips=new Map;_hovered=new Set;_view=null;_initialized=!1;_preferredAction=null;_dropTypes=[];_dropActions=[];_dropArmed=!1;static get observedAttributes(){return[`view`,`autohide`,`expand-tabs`,`inverted`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}get startActionWidget(){return this._startEl?.firstElementChild??null}set startActionWidget(e){this.startActionWidget!==e&&(this._startEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::start-action-widget`,{bubbles:!0,detail:{widget:e}})))}get endActionWidget(){return this._endEl?.firstElementChild??null}set endActionWidget(e){this.endActionWidget!==e&&(this._endEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::end-action-widget`,{bubbles:!0,detail:{widget:e}})))}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){e?this.setAttribute(`inverted`,``):this.removeAttribute(`inverted`)}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){e?this.setAttribute(`extra-drag-preload`,``):this.removeAttribute(`extra-drag-preload`)}get tabsRevealed(){return tabsRevealed({autohide:this.autohide,nPages:this._view?.nPages??0,nPinnedPages:this._view?.nPinnedPages??0,isTransferringPage:!1})}get isOverflowing(){return this._initialized?this.scrollWidth>this.clientWidth:!1}get extraDragPreferredAction(){return this._preferredAction}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._syncChips(),this._applyRevealed(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._syncChips();return}this._initialized=!0,this.classList.add(`adw-tab-bar`),this.setAttribute(`role`,`tablist`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-tab-bar-start-action`,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-tab-box`,this._indicatorEl=document.createElement(`div`),this._indicatorEl.className=`adw-tab-box-overflow`,this._indicatorEl.hidden=!0,this._boxEl.appendChild(this._indicatorEl),this._endEl=document.createElement(`div`),this._endEl.className=`adw-tab-bar-end-action`,bindSlottedChildren(this,[{name:`start-action-widget`,into:this._startEl},{name:`end-action-widget`,into:this._endEl}]).install(this._startEl,this._boxEl,this._endEl);let e=this.getAttribute(`view`);this.setView(e===null?null:this._resolveView(e)),this._bindView(),this._syncChips(),this._applyRevealed(),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`drop`,this._onDrop)}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`view`:this.setView(n===null?null:this._resolveView(n));return;case`autohide`:this._applyRevealed();break;case`expand-tabs`:case`inverted`:case`extra-drag-preload`:break}(n!==null||e===`view`)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}}))}}setupExtraDropTarget(e,t=[`copy`,`move`]){this._dropTypes=e,this._dropActions=t}_resolveView(e){return document.getElementById(e)??null}_bindView(){this._unbindView();for(let e of Mt)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Mt)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncChips(),this._applyRevealed()};_syncChips(){let e=this._view?.pages??[],t=new Set;e.forEach((e,n)=>{t.add(e.id);let r=this._chips.get(e.id);if(r===void 0){let t=createTabChip({onSelect:()=>this._view?.setSelectedPage(e.id),onClose:()=>this._view?.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshOne(e.id)}});t.el.dataset.pageId=e.id,t.close.tabIndex=-1,this._chips.set(e.id,t),this._boxEl.insertBefore(t.el,this._boxEl.children[n]??null)}else this._boxEl.children[n]!==r.el&&this._boxEl.insertBefore(r.el,this._boxEl.children[n]??null);this._refreshOne(e.id)});for(let[e,n]of this._chips)t.has(e)||(n.el.remove(),this._chips.delete(e),this._hovered.delete(e));this._applyActiveState(),this._boxEl.classList.toggle(`single-tab`,e.length<=1),this._applyOverflow()}_refreshOne(e){let t=this._view?.pages.find(t=>t.id===e),n=this._chips.get(e);t===void 0||n===void 0||(refreshTabChip(n,t,this._view?.getAttribute(`default-icon`)),refreshTabChipClose(this,n,t,{hovering:this._hovered.has(e),selected:this._view?.selectedId===e}))}_applyActiveState(){let e=this._view?.selectedId??null;for(let[t,n]of this._chips){let r=t===e;n.el.classList.toggle(`active`,r),n.el.setAttribute(`aria-selected`,String(r)),n.el.tabIndex=r?0:-1;let i=this._view?.pages.find(e=>e.id===t);i!==void 0&&refreshTabChipClose(this,n,i,{hovering:this._hovered.has(t),selected:r})}if(e===null)return;let t=this._chips.get(e);t!==void 0&&scrollChipIntoBar(this,t.el)}_applyRevealed(){this.hidden=!this.tabsRevealed}_applyOverflow(){this._indicatorEl.hidden=!this.isOverflowing}_onKeyDown(e){let t=this._view;if(t===null)return;let n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?t.cyclePreviousPage():t.cycleNextPage();else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?t.selectPreviousPage():t.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?t.selectFirstPage():t.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let r=Number.parseInt(e.key,10);n=t.selectNthPage(r===0?9:r-1)}else e.key===`ArrowLeft`||e.key===`ArrowRight`?n=e.key===`ArrowLeft`?t.selectPreviousPage():t.selectNextPage():(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?t.selectFirstPage():t.selectLastPage());if(!n)return;e.preventDefault();let r=t.selectedId;r!==null&&this._chips.get(r)?.el.focus({preventScroll:!0})}_onDragOver=e=>{this._dropTypes.length===0||e.dataTransfer===null||[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t))!==void 0&&(e.preventDefault(),e.dataTransfer.dropEffect!==`none`&&(e.dataTransfer.dropEffect=this._dropEffects(e)),this._armHoverValue())};_onDrop=e=>{if(this._dropTypes.length===0||e.dataTransfer===null)return;let t=[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t));if(t===void 0)return;e.preventDefault();let n=this._dropEffects(e),r=this.dispatchEvent(new CustomEvent(`extra-drag-drop`,{bubbles:!0,cancelable:!0,detail:{action:n,data:e.dataTransfer.getData(t)}}));e.dataTransfer.dropEffect=r?n:`none`};_dropEffects(e){let t=this._preferredAction;return t!==null&&this._dropActions.includes(t)?t:this._dropActions[0]??`copy`}_armHoverValue(){if(this._dropArmed)return;this._dropArmed=!0;let e=new CustomEvent(`extra-drag-value`,{bubbles:!0,cancelable:!0,detail:{action:null}});this.dispatchEvent(e);let t=e.detail.action;t!==this._preferredAction&&(this._preferredAction=t,this.dispatchEvent(new CustomEvent(`notify::extra-drag-preferred-action`,{bubbles:!0,detail:{action:t}})))}};customElements.define(`adw-tab-bar`,AdwTabBar);const Nt=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends HTMLElement{_button;_binEl;_labelEl;_indicatorEl;_view=null;_initialized=!1;static get observedAttributes(){return[`view`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._render(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._render();return}this._initialized=!0,this._button=document.createElement(`button`),this._button.type=`button`,this._button.className=`adw-button image-button`,this._button.title=`View Open Tabs`,this._binEl=document.createElement(`span`),this._binEl.className=`adw-tab-button-indicatorbin`;let e=document.createElement(`span`);e.className=`adw-tab-button-plate`,this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-tab-button-label numeric`,this._indicatorEl=document.createElement(`span`),this._indicatorEl.className=`adw-tab-button-indicator`,this._binEl.append(e,this._labelEl),this._button.append(this._binEl,this._indicatorEl),this.replaceChildren(this._button),this.setAttribute(`role`,`button`);let t=this.getAttribute(`view`);this.setView(t===null?null:this._resolveView(t)),this._bindView(),this._render()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){!this._initialized||e!==`view`||this.setView(n===null?null:this._resolveView(n))}_resolveView(e){return document.getElementById(e)??null}_onViewChange=()=>this._render();_bindView(){this._unbindView();for(let e of Nt)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Nt)this._view?.removeEventListener(e,this._onViewChange)}_render(){let e=this._view,t=e?.nPages??0,n=t<100;this._labelEl.textContent=n?String(t):``,this._labelEl.hidden=!n,this._labelEl.classList.toggle(`small`,t>=10),this._binEl.classList.toggle(`overflow`,!n);let r=e?.selectedId??null,i=e?.pages.some(e=>e.needsAttention&&e.id!==r)??!1;this._indicatorEl.classList.toggle(`needs-attention`,i),this._indicatorEl.hidden=!i,this._button.setAttribute(`aria-label`,`View Open Tabs (${t})`)}};customElements.define(`adw-tab-button`,AdwTabButton);var AdwTabOverview=class extends HTMLElement{_childEl;_overviewEl;_headerEl;_startButtonsEl;_endButtonsEl;_titleEl;_searchBtn;_searchEntry;_searchClamp;_searchBar;_menuBtn;_gridEl;_pinnedGridEl;_emptyState;_searchEmptyState;_newTabBtn;_thumbs=new Map;_view=null;_model=[];_searchActive=!1;_initialized=!1;_appliedOpen=!1;_reflecting=!1;static get observedAttributes(){return[`view`,`open`,`inverted`,`enable-search`,`enable-new-tab`,`secondary-menu`,`show-start-title-buttons`,`show-end-title-buttons`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._initialized&&this._syncAll(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}get child(){return this._childEl.firstElementChild}get open(){return this.hasAttribute(`open`)}set open(e){this.setOpen(e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,e)}get enableSearch(){return this.getAttribute(`enable-search`)!==`false`}set enableSearch(e){this.setAttribute(`enable-search`,String(e))}get searchActive(){return this._searchActive}get enableNewTab(){return this.hasAttribute(`enable-new-tab`)}set enableNewTab(e){this.toggleAttribute(`enable-new-tab`,e)}get secondaryMenu(){return this._model}set secondaryMenu(e){let t=normalizeMenuModel(e);assertMenuRenderable(t,D),this._model=t,this._applyMenu()}get showStartTitleButtons(){return this.getAttribute(`show-start-title-buttons`)!==`false`}set showStartTitleButtons(e){this.setAttribute(`show-start-title-buttons`,String(e))}get showEndTitleButtons(){return this.getAttribute(`show-end-title-buttons`)!==`false`}set showEndTitleButtons(e){this.setAttribute(`show-end-title-buttons`,String(e))}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){this.toggleAttribute(`extra-drag-preload`,e)}get extraDragPreferredAction(){return 0}activateOverviewOpen(){return this.open||this._view===null?!1:(this.setOpen(!0),!0)}activateOverviewClose(){return!this.open||this._view===null||this._view.nPages===0?!1:(this.setOpen(!1),!0)}connectedCallback(){if(this._initialized){this._bindView(),this._syncAll();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-tab-overview-child`,this._overviewEl=document.createElement(`div`),this._overviewEl.className=`overview adw-tab-overview-toolbar`,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-header-bar overview-header-bar`,this._startButtonsEl=document.createElement(`div`),this._startButtonsEl.className=`overview-title-buttons start`,this._endButtonsEl=document.createElement(`div`),this._endButtonsEl.className=`overview-title-buttons end`,this._searchBtn=document.createElement(`button`),this._searchBtn.type=`button`,this._searchBtn.className=`adw-button image-button search-button`,this._searchBtn.title=`Search Tabs`,this._searchBtn.appendChild(createGtkImage(`system-search`,`search-button-icon`)),this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-window-title numeric overview-title`,this._menuBtn=document.createElement(`gtk-menu-button`),this._menuBtn.setAttribute(`icon-name`,`view-more`),this._menuBtn.className=`secondary-menu-button`,this._menuBtn.hidden=!0,this._headerEl.append(this._startButtonsEl,this._searchBtn,this._titleEl,this._endButtonsEl,this._menuBtn),this._searchBar=document.createElement(`div`),this._searchBar.className=`adw-search-bar overview-search-bar`,this._searchClamp=document.createElement(`div`),this._searchClamp.className=`adw-clamp overview-search-clamp`,this._searchEntry=document.createElement(`input`),this._searchEntry.type=`search`,this._searchEntry.className=`adw-entry overview-search-entry`,this._searchEntry.placeholder=`Search tabs`,this._searchEntry.setAttribute(`aria-label`,`Search tabs`),this._searchClamp.appendChild(this._searchEntry),this._searchBar.appendChild(this._searchClamp);let e=document.createElement(`div`);e.className=`adw-tab-overview-content`;let t=document.createElement(`div`);t.className=`adw-tab-overview-scroll`,this._pinnedGridEl=this._createGrid(`adw-tab-grid pinned-grid`,`Pinned tabs`),this._gridEl=this._createGrid(`adw-tab-grid`,`Open tabs`),t.append(this._pinnedGridEl,this._gridEl),this._emptyState=document.createElement(`adw-status-page`),this._emptyState.className=`overview-empty-state`,this._emptyState.setAttribute(`icon`,`view-grid`),this._emptyState.setAttribute(`title`,`No Open Tabs`),this._emptyState.hidden=!0,this._searchEmptyState=document.createElement(`adw-status-page`),this._searchEmptyState.className=`overview-search-empty-state`,this._searchEmptyState.setAttribute(`icon`,`system-search`),this._searchEmptyState.setAttribute(`title`,`No Tabs Found`),this._searchEmptyState.setAttribute(`description`,`Try a different search`),this._searchEmptyState.hidden=!0,this._newTabBtn=document.createElement(`button`),this._newTabBtn.type=`button`,this._newTabBtn.className=`adw-button pill suggested-action new-tab-button`,this._newTabBtn.append(createGtkImage(`list-add`,`new-tab-button-icon`),document.createTextNode(`New Tab`)),e.append(t,this._emptyState,this._searchEmptyState,this._newTabBtn),this._overviewEl.append(this._headerEl,this._searchBar,e);let n=Array.from(this.children);this.replaceChildren(this._childEl,this._overviewEl);for(let e of n)this._childEl.appendChild(e);this._searchEntry.addEventListener(`input`,()=>this._onSearchChanged()),this._searchEntry.addEventListener(`keydown`,e=>this._onSearchKeyDown(e)),this._searchBtn.addEventListener(`click`,()=>this._toggleSearchMode()),this._newTabBtn.addEventListener(`click`,()=>this._requestCreateTab()),this.addEventListener(`keydown`,e=>this._onKeyDown(e));let r=this.getAttribute(`view`);this.setView(r===null?this._findView():this._resolveView(r)),r!==null&&this.removeAttribute(`view`);let i=this.getAttribute(`secondary-menu`);i!==null&&(this.secondaryMenu=JSON.parse(i),this.removeAttribute(`secondary-menu`)),this._applyOpen(),this._syncAll()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`view`:this.setView(n===null?this._findView():this._resolveView(n));return;case`open`:this._reflecting||this._applyOpen();return;case`secondary-menu`:if(n===null)return;try{this.secondaryMenu=JSON.parse(n)}catch(e){console.error(`<adw-tab-overview secondary-menu> is not valid JSON: ${String(e)}`)}return;case`enable-new-tab`:this._applyNewTabButton();return;case`inverted`:this._syncGrids();return;case`enable-search`:case`show-start-title-buttons`:case`show-end-title-buttons`:this._applyHeaderBar();return}}_resolveView(e){return document.getElementById(e)??this._findView()}_findView(){return this.querySelector(`adw-tab-view`)}_bindView(){this._unbindView();for(let e of Ft)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Ft)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncAll()};_syncAll(){this._applyTitle(),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton(),this._applyHeaderBar()}_applyTitle(){let e=this._view;this._titleEl.textContent=e===null?``:e.nPages===1?`1 Tab`:`${e.nPages} Tabs`}_syncGrids(){let e=this._view,t=this._searchActive?this._searchEntry.value:``,n=new Set,r=[],i=[];if(e!==null)for(let a of e.pages){if(!tabSearchMatches(a,t)){this._thumbs.get(a.id)?.root.remove(),this._thumbs.delete(a.id);continue}n.add(a.id);let e=this._thumbFor(a.id);this._refreshThumb(e,a),(a.pinned?r:i).push(e.root)}for(let[e,t]of this._thumbs)n.has(e)||(t.root.remove(),this._thumbs.delete(e));this._pinnedGridEl.replaceChildren(...r),this._gridEl.replaceChildren(...i),this._pinnedGridEl.hidden=r.length===0}_applyEmptyStates(){let e=this._pinnedGridEl.childElementCount===0&&this._gridEl.childElementCount===0;this._emptyState.hidden=!(e&&!this._searchActive),this._searchEmptyState.hidden=!(e&&this._searchActive)}_applyNewTabButton(){this._newTabBtn.hidden=!(this.enableNewTab&&!this._searchActive)}_applyHeaderBar(){let e=this._model.length>0;this._headerEl.hidden=!(this.enableSearch||e||this.showStartTitleButtons||this.showEndTitleButtons),this._startButtonsEl.hidden=!this.showStartTitleButtons,this._endButtonsEl.hidden=!this.showEndTitleButtons,this._searchBtn.hidden=!this.enableSearch,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._menuBtn.hidden=!e}_applyMenu(){let e=this._menuBtn;this._model.length>0&&(e.menuModel=this._model),this._applyHeaderBar()}_applyOpen(){let e=this.open;this._overviewEl.hidden=!e,this._childEl.classList.toggle(`background`,e),this._childEl.inert=e,e!==this._appliedOpen&&(this._appliedOpen=e,this._reflecting=!0,e?this.hasAttribute(`open`)||this.setAttribute(`open`,``):this.hasAttribute(`open`)&&(this._searchMode=!1,this._setSearchActive(!1),this._searchEntry.value=``,this.removeAttribute(`open`)),this._reflecting=!1,this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}})))}setOpen(e){this.open!==e&&(this._reflecting=!0,this.toggleAttribute(`open`,e),this._reflecting=!1,this._applyOpen(),e&&this._syncAll())}_searchMode=!1;_toggleSearchMode(){this._searchMode=!this._searchMode,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._searchMode?this._searchEntry.focus():this._stopSearch()}_onSearchChanged(){this._setSearchActive(this._searchEntry.value!==``),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_stopSearch(){this._searchEntry.value=``,this._setSearchActive(!1),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_setSearchActive(e){e!==this._searchActive&&(this._searchActive=e,this.dispatchEvent(new CustomEvent(`notify::search-active`,{bubbles:!0,detail:{searchActive:e}})))}_onSearchKeyDown(e){if(e.key===`Escape`){this._stopSearch(),this._searchMode=!1,this._searchBar.hidden=!this.enableSearch||!this._searchMode;return}e.key===`Enter`&&this._searchActive&&(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault()}_onKeyDown(e){if(!this.open)return;let t=e.target;if(t instanceof Node&&!this._onGridKey(e,t)&&!(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)){if(e.key===`ArrowDown`){if(this._searchBar.contains(t)||this._searchBtn.contains(t)){(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault();return}if(this._menuBtn.contains(t)){(this._focusLastRow(this._pinnedGridEl)||this._focusLastRow(this._gridEl))&&e.preventDefault();return}if(this._newTabBtn.contains(t))return;(this._gridEl.contains(t)||this._pinnedGridEl.contains(t))&&this._newTabBtn.hidden===!1&&(e.preventDefault(),this._newTabBtn.focus());return}this._newTabBtn.contains(t)&&(this._focusLastRow(this._gridEl)||this._focusLastRow(this._pinnedGridEl))&&e.preventDefault()}}_onGridKey(e,t){if(e.altKey||e.ctrlKey||e.metaKey)return!1;let n=[this._pinnedGridEl,this._gridEl].find(e=>e.contains(t));if(n===void 0)return!1;let r=[...n.children].filter(e=>e instanceof HTMLElement),i=r.findIndex(e=>e.contains(t));if(i<0||t instanceof Element&&t.closest(`button`)!==null)return!1;let a=this._view;if(a===null)return!1;if(e.key===`Enter`||e.key===` `){let t=r[i].dataset.pageId;return t===void 0?!1:(e.preventDefault(),a.setSelectedPage(t),this.setOpen(!1),!0)}let o=gridColumns(r.map(e=>e.getBoundingClientRect().top)),s=gridNavigate(e.key,i,r.length,o);if(s===null){let t=[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key);return t&&e.preventDefault(),t}let c=r[s].dataset.pageId;return c===void 0?!1:(e.preventDefault(),a.setSelectedPage(c),r[s].focus(),!0)}_focusFirstRow(e){let t=e.querySelector(`.adw-tab-thumbnail`);return t===null?!1:(t.focus(),!0)}_focusLastRow(e){let t=e.querySelectorAll(`.adw-tab-thumbnail`),n=t[t.length-1];return n===void 0?!1:(n.focus(),!0)}_requestCreateTab(){let e=this._view;if(e===null)return;let t={page:null};if(this.dispatchEvent(new CustomEvent(`create-tab`,{bubbles:!0,detail:t})),t.page===null){console.error("<adw-tab-overview>: the create-tab handler must not leave `detail.page` unset.");return}e.setSelectedPage(t.page.id),this.setOpen(!1),t.page.content?.focus?.()}_createGrid(e,t){let n=document.createElement(`div`);return n.className=e,n.setAttribute(`role`,`grid`),n.setAttribute(`aria-label`,t),n}_thumbFor(e){let t=this._thumbs.get(e);if(t!==void 0)return t;let n=document.createElement(`div`);n.className=`adw-tab-thumbnail`,n.dataset.pageId=e,n.setAttribute(`role`,`gridcell`),n.tabIndex=-1;let r=document.createElement(`div`);r.className=`contents`;let i=document.createElement(`div`);i.className=`thumbnail`;let a=document.createElement(`div`);a.className=`card`;let o=document.createElement(`div`);o.className=`picture`;let s=document.createElement(`span`);s.className=`picture-portrait`,o.appendChild(s);let c=document.createElement(`button`);c.type=`button`,c.className=`tab-close-button adw-button image-button`,c.title=`Close Tab`,c.setAttribute(`aria-label`,`Close Tab`),c.tabIndex=-1,c.appendChild(createGtkImage(`window-close`,`tab-close-icon`));let l=document.createElement(`button`);l.type=`button`,l.className=`tab-unpin-icon`,l.tabIndex=-1,l.title=`Unpin Tab`,l.setAttribute(`aria-label`,`Unpin Tab`),l.dataset.iconName=`adw-tab-unpin-symbolic`;let u=document.createElement(`button`);u.type=`button`,u.className=`tab-indicator adw-button image-button`,u.tabIndex=-1;let d=createGtkImage(null,`tab-indicator-icon`);u.appendChild(d),a.append(o,c,l,u);let f=document.createElement(`div`);f.className=`needs-attention`;let p=document.createElement(`div`);p.className=`gizmo`,f.appendChild(p),i.append(a,f);let m=document.createElement(`div`);m.className=`icon-title-box`;let g=createGtkImage(null,`tab-icon`),_=document.createElement(`span`);_.className=`tab-label`,m.append(g,_),r.append(i,m),n.appendChild(r),n.addEventListener(`click`,()=>{let t=this._view;t!==null&&(t.setSelectedPage(e),this.setOpen(!1))}),n.addEventListener(`auxclick`,t=>{t.button===1&&(t.preventDefault(),this._view?.closePage(e))}),c.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.closePage(e)}),l.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.setPagePinned(e,!1)}),u.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.dispatchEvent(new CustomEvent(`indicator-activated`,{bubbles:!0,detail:{id:e}}))});let ee={root:n,label:_,icon:g,spinner:null,picture:o,portrait:s,closeBtn:c,unpinIcon:l,indicatorBtn:u,indicatorIcon:d,attention:f};return this._thumbs.set(e,ee),ee}_refreshThumb(e,t){if(e.root.title=tabTooltip(t),e.root.setAttribute(`aria-label`,tabTooltip(t)),e.icon.hidden=t.icon===null&&!t.loading,e.root.classList.toggle(`loading`,t.loading),t.loading&&e.spinner===null){let t=document.createElement(`adw-spinner`);t.className=`tab-spinner`,t.setAttribute(`size`,String(Pt)),e.icon.replaceWith(t),e.spinner=t}else!t.loading&&e.spinner!==null&&(e.spinner.replaceWith(e.icon),e.spinner=null);e.indicatorBtn.hidden=t.indicatorIcon===null,e.indicatorIcon.iconName=t.indicatorIcon,e.attention.hidden=!t.needsAttention,e.root.classList.toggle(`inverted`,this.inverted),e.closeBtn.hidden=t.pinned,e.unpinIcon.hidden=!t.pinned,e.label.textContent=t.title,e.portrait.textContent=t.title;let n=this._view?.selectedId===t.id;e.root.classList.toggle(`selected`,n),e.root.setAttribute(`aria-selected`,String(n))}};const Pt=`16`,Ft=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const It=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return It}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}attributeChangedCallback(e,t,n){let r=this.closest(`adw-tab-view`);r instanceof AdwTabView&&r.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_chips=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected-page`,`autohide`,`expand-tabs`,`no-close`]}constructor(){super(),this._barEl=document.createElement(`div`),this._barEl.className=`adw-tab-bar`,this._barEl.setAttribute(`role`,`tablist`),this._tabBoxEl=document.createElement(`div`),this._tabBoxEl.className=`adw-tab-box`,this._barEl.appendChild(this._tabBoxEl),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-tab-view-pages`,this._state.subscribePages(e=>this._onPagesChange(e)),this._state.subscribe(e=>this._onSelectionChange(e))}get selectedPage(){return this._state.selectedPage}set selectedPage(e){this._state.setSelectedPage(e)}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get noClose(){return this.hasAttribute(`no-close`)}set noClose(e){e?this.setAttribute(`no-close`,``):this.removeAttribute(`no-close`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`selected-page`),t=Array.from(this.children);this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)e.localName===`adw-tab-page`?this._adoptDeclaredPage(e):this.appendPage({id:this._nextId(),content:e});e!==null&&this._applySelectedAttribute(e),this._applyBarVisibility(),this._reflectSelected(),this.addEventListener(`keydown`,e=>this._onKeyDown(e))}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`selected-page`){if(this._reflecting)return;let e=this.getAttribute(`selected-page`);e!==null&&this._applySelectedAttribute(e);return}this._applyBarVisibility()}}syncDeclaredPage(e,t,n){let r=e.dataset.pageId;if(r!==void 0)switch(t){case`title`:this._state.setPageTitle(r,n);return;case`tooltip`:this._state.setPageTooltip(r,n);return;case`icon`:this._state.setPageIcon(r,n);return;case`indicator-icon`:this._state.setPageIndicatorIcon(r,n);return;case`keyword`:this._state.setPageKeyword(r,n);return;case`loading`:this._state.setPageLoading(r,n!==null);return;case`needs-attention`:this._state.setPageNeedsAttention(r,n!==null);return;case`pinned`:this._state.setPagePinned(r,n!==null);return}}get pages(){return this._state.pages}get nPages(){return this._state.nPages}get nPinnedPages(){return this._state.nPinnedPages}get selectedId(){return this._state.selectedId}get selectedIndex(){return this._state.selectedIndex}get selectedContent(){return this._state.selectedPage?.content??null}isClosing(e){return this._state.isClosing(e)}setSelectedPage(e){return this._state.setSelectedPage(e)}selectNthPage(e){return this._state.selectNthPage(e)}selectPreviousPage(){return this._state.selectPreviousPage()}selectNextPage(){return this._state.selectNextPage()}selectFirstPage(){return this._state.selectFirstPage()}selectLastPage(){return this._state.selectLastPage()}cycleNextPage(){return this._state.cycleNextPage()}cyclePreviousPage(){return this._state.cyclePreviousPage()}addPage(e,t=null){return this._state.addPage(this._withPanel(e),t)}insertPage(e,t){return this._state.insertPage(this._withPanel(e),t)}prependPage(e){return this._state.prependPage(this._withPanel(e))}appendPage(e){return this._state.appendPage(this._withPanel(e))}insertPinnedPage(e,t){return this._state.insertPinnedPage(this._withPanel(e),t)}prependPinnedPage(e){return this._state.prependPinnedPage(this._withPanel(e))}appendPinnedPage(e){return this._state.appendPinnedPage(this._withPanel(e))}setPagePinned(e,t){return this._state.setPagePinned(e,t)}closePage(e){return this._state.closePage(e)}closePageFinish(e,t){return this._state.closePageFinish(e,t)}closeOtherPages(e){this._state.closeOtherPages(e)}closePagesBefore(e){this._state.closePagesBefore(e)}closePagesAfter(e){this._state.closePagesAfter(e)}detachPage(e){return this._state.detachPage(e)}reorderPage(e,t){return this._state.reorderPage(e,t)}reorderBackward(e){return this._state.reorderBackward(e)}reorderForward(e){return this._state.reorderForward(e)}reorderFirst(e){return this._state.reorderFirst(e)}reorderLast(e){return this._state.reorderLast(e)}setPageTitle(e,t){return this._state.setPageTitle(e,t)}setPageTooltip(e,t){return this._state.setPageTooltip(e,t)}setPageKeyword(e,t){return this._state.setPageKeyword(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageIndicatorIcon(e,t){return this._state.setPageIndicatorIcon(e,t)}setPageLoading(e,t){return this._state.setPageLoading(e,t)}setPageNeedsAttention(e,t){return this._state.setPageNeedsAttention(e,t)}get diagnostics(){return this._state.diagnostics}_adoptDeclaredPage(e){let t={id:e.getAttribute(`page-id`)??this._nextId(),title:e.getAttribute(`title`),tooltip:e.getAttribute(`tooltip`),icon:e.getAttribute(`icon`),indicatorIcon:e.getAttribute(`indicator-icon`),loading:e.hasAttribute(`loading`),needsAttention:e.hasAttribute(`needs-attention`),content:e};e.hasAttribute(`pinned`)?this.appendPinnedPage(t):this.appendPage(t)}_withPanel(e){let t=e.content??document.createElement(`adw-tab-page`);return t.classList.add(`adw-tab-page`),t.setAttribute(`role`,`tabpanel`),t.dataset.pageId=e.id,{...e,content:t}}_nextId(){return this._generatedIds+=1,`tab-${this._generatedIds}`}_onPagesChange(e){switch(e.kind){case`attached`:{let t=this._state.getPage(e.id);t&&this._insertTab(t,e.position);break}case`detached`:this._tabs.get(e.id)?.remove(),this._tabs.delete(e.id),this._chips.delete(e.id),this._hovered.delete(e.id),this._panels.get(e.id)?.remove(),this._panels.delete(e.id);break;case`reordered`:case`pinned`:this._moveTab(e.id,e.position),this._refreshTab(e.id);break;case`updated`:this._refreshTab(e.id);break}this._applyBarVisibility(),this._applyActiveState(),this.dispatchEvent(new CustomEvent(`page-${e.kind}`,{bubbles:!0,detail:{id:e.id,position:e.position,previousPosition:e.previousPosition}}))}_insertTab(e,t){let n=createTabChip({onSelect:()=>this._state.setSelectedPage(e.id),onClose:()=>this._state.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}});n.el.dataset.pageId=e.id,n.close.tabIndex=-1,this._tabBoxEl.insertBefore(n.el,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n.el),this._chips.set(e.id,n);let r=e.content;r&&(this._panels.set(e.id,r),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null)),this._refreshTab(e.id)}_moveTab(e,t){let n=this._tabs.get(e);n&&(n.remove(),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null));let r=this._panels.get(e);r&&(r.remove(),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null))}_refreshTab(e){let t=this._state.getPage(e),n=this._tabs.get(e);!t||!n||(refreshTabChip(this._chips.get(e),t,this.getAttribute(`default-icon`)),this._refreshCloseVisibility(e))}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._chips.get(e);!t||!n||refreshTabChipClose(this._barEl,n,t,{hovering:this._hovered.has(e),selected:this._state.selectedId===e})}_onSelectionChange(e){this._applyActiveState(),this._scrollSelectedTabIntoBar(),this._reflectSelected(),this.dispatchEvent(new CustomEvent(`notify::selected-page`,{bubbles:!0,detail:{selected:e.selectedIndex,selectedId:e.selectedId,previousId:e.previousId,interactive:e.interactive}}))}_applyActiveState(){let e=this._state.selectedId;for(let t of this._state.pages){let n=t.id===e,r=this._tabs.get(t.id);r&&(r.classList.toggle(`active`,n),r.setAttribute(`aria-selected`,String(n)),r.tabIndex=n?0:-1);let i=t.content;i&&(i.classList.toggle(`active-page`,n),i.hidden=!n),this._refreshCloseVisibility(t.id)}}_scrollSelectedTabIntoBar(){let e=this._state.selectedId,t=e===null?void 0:this._tabs.get(e);t&&scrollChipIntoBar(this._barEl,t)}_applyBarVisibility(){let e=tabsRevealed({autohide:this.autohide,nPages:this._state.nPages,nPinnedPages:this._state.nPinnedPages,isTransferringPage:!1});this._barEl.hidden=!e,this._barEl.classList.toggle(`single-tab`,this._state.nPages<=1)}_reflectSelected(){this._reflecting=!0;let e=this._state.selectedId;e===null?this.removeAttribute(`selected-page`):this.getAttribute(`selected-page`)!==e&&this.setAttribute(`selected-page`,e),this._reflecting=!1}_applySelectedAttribute(e){this._state.setSelectedPage(e)}_onKeyDown(e){let t=e.target instanceof Node&&this._barEl.contains(e.target),n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?this._state.cyclePreviousPage():this._state.cycleNextPage();else if(e.ctrlKey&&e.shiftKey&&(e.key===`PageUp`||e.key===`PageDown`)){let t=this._state.selectedId;t!==null&&(n=e.key===`PageUp`?this._state.reorderBackward(t):this._state.reorderForward(t))}else if(e.ctrlKey&&e.shiftKey&&(e.key===`Home`||e.key===`End`)){let t=this._state.selectedId;t!==null&&(n=e.key===`Home`?this._state.reorderFirst(t):this._state.reorderLast(t))}else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?this._state.selectPreviousPage():this._state.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let t=Number.parseInt(e.key,10);n=this._state.selectNthPage(t===0?9:t-1)}else t&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?n=e.key===`ArrowLeft`?this._state.selectPreviousPage():this._state.selectNextPage():t&&(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage());if(n&&(e.preventDefault(),t)){let e=this._state.selectedId;e!==null&&this._tabs.get(e)?.focus({preventScroll:!0})}}_requestClose(e){return this.dispatchEvent(new CustomEvent(`close-page`,{bubbles:!0,cancelable:!0,detail:{index:this._state.getPagePosition(e.id),id:e.id}}))?!e.pinned:`defer`}};customElements.define(`adw-tab-view`,AdwTabView),customElements.define(`adw-tab-page`,AdwTabPage);const Lt={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=Lt;_currentEl=null;_actions=new WeakMap;constructor(){super(),this._queue=new AdwToastQueue({scheduler:{schedule:(e,t)=>this._scheduler.schedule(e,t),cancel:e=>this._scheduler.cancel(e)},onShow:e=>this._mountToast(e),onHide:()=>this._unmountToast(this._queue.pending>0)})}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-toast-overlay-content`,this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,bindSlottedChildren(this,[{into:e}]).install(e,this._toasts)}get scheduler(){return this._scheduler}set scheduler(e){this._scheduler=e}get currentToast(){return this._queue.current}get pendingToasts(){return this._queue.pending}addToast(e,t={}){this._toasts||this.connectedCallback();let n=typeof t==`number`?{timeout:t/1e3}:t,r=new AdwToast(e,{timeout:(n.timeout??5)*1e3,buttonLabel:n.buttonLabel});n.onAction&&this._actions.set(r,n.onAction),this._queue.add(r)}dismiss(){this._queue.dismiss()}clearToasts(){this._queue.clear()}_mountToast(e){let t=document.createElement(`div`);t.className=`adw-toast`;let n=document.createElement(`div`);n.className=`adw-toast-content-wrapper`;let r=document.createElement(`span`);if(r.className=`adw-toast-title`,r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.hasButton){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.buttonLabel,n.addEventListener(`click`,()=>{this._actions.get(e)?.(),this._queue.dismiss()}),t.appendChild(n)}let i=document.createElement(`button`);i.type=`button`,i.className=`adw-toast-close-button`,i.setAttribute(`aria-label`,`Close`),i.appendChild(createGtkImage(`window-close`)),i.addEventListener(`click`,()=>this._queue.dismiss()),t.appendChild(i),this._toasts.appendChild(t),this._currentEl=t,requestAnimationFrame(()=>{t.classList.add(`visible`)})}_unmountToast(e){let t=this._currentEl;if(this._currentEl=null,t){if(e){t.remove();return}t.classList.remove(`visible`),t.classList.add(`hiding`),t.addEventListener(`transitionend`,()=>t.remove(),{once:!0}),this._scheduler.schedule(()=>{t.parentNode&&t.remove()},300)}}};customElements.define(`adw-toast-overlay`,AdwToastOverlay);var AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`,`tooltip`]}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;_stateAttr=`aria-checked`;_names=[];static get observedAttributes(){return[`active`,`active-name`,`flat`,`round`]}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}get activeName(){return this._names[this._state.selected]??null}set activeName(e){e===null?this.removeAttribute(`active-name`):this.setAttribute(`active-name`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`)),t=keptToggles(e.map(e=>({el:e,name:e.getAttribute(`name`)}))).map(e=>e.el);t.length<e.length&&console.warn(`[adw-toggle-group] a toggle name already exists; the later toggle is not added`);let n=this.getAttribute(`role`)?.trim()||null;n===null&&this.setAttribute(`role`,`radiogroup`);let r=n===`tablist`,i=r?`tab`:`radio`;this._stateAttr=r?`aria-selected`:`aria-checked`,this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._innerEl.setAttribute(`role`,`none`),this._buttons=t.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`,n.setAttribute(`role`,i);let r=e.getAttribute(`label`)??``,a=e.getAttribute(`icon-name`)??``,o=e.getAttribute(`tooltip`)??``;return a&&n.appendChild(createGtkImage(a)),r&&n.appendChild(document.createTextNode(r)),n.title=o,!r&&o?n.setAttribute(`aria-label`,o):a&&!r&&n.setAttribute(`aria-label`,a),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl),this._state.setLabels(t.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._names=t.map(e=>e.getAttribute(`name`)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._applyActiveName(),this._render(),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._buttons,select:e=>this._selectIndex(this._buttons.findIndex(t=>t===e))})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}if(e===`active-name`){this._applyActiveName();return}this._render()}}_applyActiveName(){let e=this.getAttribute(`active-name`);if(e===null)return;let t=toggleIndexOfName(this._names,e);t!==-1&&this._state.setSelected(t)}_readActiveAttr(){let e=Number.parseInt(this.getAttribute(`active`)??`0`,10);if(Number.isNaN(e))return 0;let t=Math.max(0,this._state.count-1);return Math.min(Math.max(e,0),t)}_selectIndex(e){this._state.setSelected(e)&&(this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}_render(){this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`round`,this.hasAttribute(`round`));let e=this._state.selected;this._buttons.forEach((t,n)=>{let r=n===e;t.classList.toggle(`active`,r),t.setAttribute(this._stateAttr,String(r)),t.tabIndex=r?0:-1})}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);var AdwToolbarView=class extends HTMLElement{_topEl;_contentEl;_bottomEl;_initialized=!1;_resize=null;_shading=null;static get observedAttributes(){return[`top-bar-style`,`bottom-bar-style`,`extend-content-to-top-edge`,`extend-content-to-bottom-edge`]}get topBar(){return this._topEl}get contentArea(){return this._contentEl}get bottomBar(){return this._bottomEl}connectedCallback(){this._initialized||(this._initialized=!0,this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`,this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`,bindSlottedChildren(this,[{name:`top`,into:this._topEl},{name:`bottom`,into:this._bottomEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._topEl,this._contentEl,this._bottomEl),bindEmptySections(this._topEl,this._bottomEl)),this._shading=new AdwScrollShading(this._contentEl),this._shading.connect(),this._resize=new ResizeObserver(()=>this._syncClasses()),this._resize.observe(this._topEl),this._resize.observe(this._bottomEl),this._syncClasses()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._shading?.disconnect(),this._shading=null}attributeChangedCallback(){this._initialized&&this._syncClasses()}_syncClasses(){let{view:e,topBar:t,bottomBar:n}=toolbarViewClasses({topBarStyle:parseToolbarStyle(this.getAttribute(`top-bar-style`)),bottomBarStyle:parseToolbarStyle(this.getAttribute(`bottom-bar-style`)),extendContentToTopEdge:this.hasAttribute(`extend-content-to-top-edge`),extendContentToBottomEdge:this.hasAttribute(`extend-content-to-bottom-edge`),topBarHeight:this._topEl.offsetHeight,bottomBarHeight:this._bottomEl.offsetHeight});for(let t of fe)this.classList.toggle(t,e.includes(t));for(let e of pe)this._topEl.classList.toggle(e,t.includes(e)),this._bottomEl.classList.toggle(e,n.includes(e));this._shading?.setUndershootEdges({top:e.includes(`undershoot-top`),bottom:e.includes(`undershoot-bottom`)})}};customElements.define(`adw-toolbar-view`,AdwToolbarView);var AdwViewStack=class extends HTMLElement{_state=new ViewStackState;_initialized=!1;static get observedAttributes(){return[`visible-child-name`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e))}get pages(){return this._state.pages}get visibleChildIndex(){return this._state.visibleIndex}selectNthPage(e){return this._state.setVisibleIndex(e)}get visibleChildName(){return this._state.visibleName}set visibleChildName(e){this._state.setVisibleName(e)}get visibleChild(){return this._state.visiblePage?.content??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`visible-child-name`);for(let e of Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`))){let t=e.getAttribute(`name`)??``,n=document.createElement(`div`);n.className=`adw-view-stack-child`,n.dataset.name=t;for(let t of Array.from(e.childNodes))n.appendChild(t);this._state.addPage({name:t,title:e.getAttribute(`title`),icon:e.getAttribute(`icon-name`),content:n,visible:!e.hasAttribute(`hidden`),badgeNumber:e.hasAttribute(`badge-number`)?Number.parseInt(e.getAttribute(`badge-number`)??`0`,10):0,needsAttention:e.hasAttribute(`needs-attention`),useUnderline:e.hasAttribute(`use-underline`),startsSection:e.hasAttribute(`starts-section`),sectionTitle:e.getAttribute(`section-title`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName(),this._emitItemsChanged()}attributeChangedCallback(e,t,n){this._initialized&&e===`visible-child-name`&&n!==null&&n!==this._state.visibleName&&this._state.setVisibleName(n)}add(e,t,n,r){e.classList.add(`adw-view-stack-child`),e.dataset.name=t;let i=this._state.addPage({name:t,title:n,icon:r,content:e});return this.appendChild(e),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),i}addTitled(e,t,n){return this.add(e,t,n)}removePage(e){let t=this._state.pages[this._state.indexOfName(e)]?.content;return this._state.removePage(e)?(t?.remove(),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),!0):!1}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._applyVisibility(),this._emitItemsChanged(),n}_emitItemsChanged(){this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{count:this.pages.length}}))}_onStateChange(e){this._applyVisibility(),this._reflectName(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.index,name:e.name,title:e.title,interactive:e.interactive}}))}_applyVisibility(){let e=this._state.visibleIndex;this._state.pages.forEach((t,n)=>{let r=t.content;if(!r)return;let i=n===e;r.classList.toggle(`active-view`,i),r.hidden=!i})}_reflectName(){if(this._state.visibleIndex<0){this.removeAttribute(`visible-child-name`);return}let e=this._state.visibleName;this.getAttribute(`visible-child-name`)!==e&&this.setAttribute(`visible-child-name`,e)}};customElements.define(`adw-view-stack`,AdwViewStack);var AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=ht;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_barEl;_contentEl;_nodes=[];_declared=[];_pageObserver;_policy=`narrow`;_initialized=!1;static get observedAttributes(){return[`policy`,`active`]}constructor(){super()}get policy(){return this._policy}set policy(e){this.setAttribute(`policy`,e)}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._render(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-switcher-page`)),t=this.getAttribute(`active`);if(this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar`,this._barEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-view-switcher-content`,this._declared=e,this._watchPages(),this._nodes=e.map((e,t)=>this._buildPage(e,t)),this._barEl.append(...this._nodes.map(e=>e.button)),this._contentEl.append(...this._nodes.map(e=>e.body)),this.replaceChildren(this._barEl,this._contentEl),this._policy=this._readPolicyAttr(),this._initialized=!0,this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._render()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._render())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`policy`){let e=this._readPolicyAttr();if(e===this._policy)return;this._policy=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::policy`,{bubbles:!0,detail:{policy:e}}));return}if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive()}}}_buildPage(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-view-switcher-button`,n.setAttribute(`role`,`tab`),n.dataset.pageIndex=String(t);let r=createGtkImage(null,`adw-view-switcher-icon`),i=document.createElement(`span`);i.className=`adw-view-switcher-label`;let a=document.createElement(`span`);a.className=`adw-view-switcher-indicator`,a.setAttribute(`aria-hidden`,`true`),n.append(r,i,a),n.addEventListener(`click`,()=>{this._state.setSelected(t)}),n.addEventListener(`dragenter`,e=>{n.contains(e.relatedTarget)||this._state.dragEnter(t)}),n.addEventListener(`dragleave`,e=>{n.contains(e.relatedTarget)||this._state.dragLeave(t)});let o=document.createElement(`div`);o.className=`adw-view-switcher-page`,o.dataset.name=e.getAttribute(`name`)??``;for(let t of Array.from(e.childNodes))o.appendChild(t);return{button:n,icon:r,label:i,indicator:a,body:o}}_readPolicyAttr(){let e=this.getAttribute(`policy`);return e===null?`narrow`:isViewSwitcherPolicy(e)?e:this._policy}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.selected,name:e.name,title:e.title,interactive:e.interactive}}))}_render(){if(this._initialized){for(let e of Ye)this.classList.toggle(e,e===this._policy);buildViewSwitcherButtons(this._state.pages,this._state.selected,this._policy).forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName),n.body.classList.toggle(`active-view`,e.selected),n.body.hidden=!e.selected)}),this._reflectActive()}}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-switcher-page`,AdwViewSwitcherPage),customElements.define(`adw-view-switcher`,AdwViewSwitcher);var AdwViewSwitcherSidebar=class extends HTMLElement{_sidebar;_placeholderEl;_prefixEl;_suffixEl;_stack=null;_filter=null;_initialized=!1;static get observedAttributes(){return[`stack`,`mode`]}get stack(){return this._stack}set stack(e){this.setStack(e===null?null:typeof e==`string`?this._resolveStack(e):e)}setStack(e){e!==null&&this._stack!==e&&(this._unbindStack(),this._stack=e,this._bindStack(),this._populate(),this._syncSelection(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:e}})))}get mode(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}set mode(e){this.setAttribute(`mode`,e)}get filter(){return this._filter}set filter(e){this._filter=e,this._initialized&&(this._sidebar.filter=e,this._applyEmptyState())}get placeholder(){return this._placeholderEl.firstElementChild}set placeholder(e){e===null?this._placeholderEl.replaceChildren():this._placeholderEl.replaceChildren(e),this._applyEmptyState()}get prefixWidget(){return this._prefixEl.firstElementChild}set prefixWidget(e){e===null?this._prefixEl.replaceChildren():this._prefixEl.replaceChildren(e)}get suffixWidget(){return this._suffixEl.firstElementChild}set suffixWidget(e){e===null?this._suffixEl.replaceChildren():this._suffixEl.replaceChildren(e)}connectedCallback(){if(this._initialized){this._bindStack(),this._populate();return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`view-switcher-sidebar-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`view-switcher-sidebar-suffix`,this._placeholderEl=document.createElement(`div`),this._placeholderEl.className=`view-switcher-sidebar-placeholder`,this._placeholderEl.hidden=!0,this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.addEventListener(`activated`,this._onSidebarActivated);let e=document.createElement(`div`);e.className=`view-switcher-sidebar-box`,e.append(this._sidebar,this._placeholderEl),bindSlottedChildren(this,[{name:`placeholder`,into:this._placeholderEl},{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),this._applyMode();let t=this.getAttribute(`stack`);this.setStack(t===null?this._findStack():this._resolveStack(t)),this._applyEmptyState()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){this._initialized&&(e===`stack`?this.setStack(n===null?this._findStack():this._resolveStack(n)):e===`mode`&&this._applyMode())}_resolveStack(e){return document.getElementById(e)??this._findStack()}_findStack(){return this.parentElement?.querySelector(`adw-view-stack`)??null}_bindStack(){this._unbindStack();for(let e of Rt)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of Rt)this._stack?.removeEventListener(e,this._onStackChange)}_onStackChange=()=>{this._populate(),this._syncSelection()};_onSidebarActivated=e=>{e.stopPropagation();let t=e.detail.index,n=this._stack;n!==null&&(n.selectNthPage(t),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:t}})))};_populate(){let e=this._stack;if(e===null){this._sidebar.sections=[],this._applyEmptyState();return}let t=viewSwitcherPagesFromStack(e.pages);this._sidebar.sections=viewSwitcherSidebarSections(t).map(e=>this._toSectionSpec(e)),this._applyEmptyState()}_toSectionSpec(e){let t=e.pages.map(e=>({title:e.title??``,iconName:e.iconName??``,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention}));return{title:e.title,items:t}}_syncSelection(){let e=this._stack;if(e===null)return;let t=e.visibleChildIndex;t<0||this._sidebar.selected!==t&&(this._sidebar.selected=t)}_applyMode(){let e=this.mode===`page`;this.classList.toggle(`page`,e),this._sidebar.mode=this.mode}_applyEmptyState(){let e=this._sidebar.classList.contains(`empty`);this._placeholderEl.hidden=!e,this.classList.toggle(`empty`,e)}};const Rt=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);var AdwViewSwitcherBar=class extends HTMLElement{_barState=new ViewSwitcherBarState;_barEl;_nodes=[];_stack=null;_initialized=!1;_onStackNotify=()=>this._rebuild();static get observedAttributes(){return[`stack`,`reveal`,`revealed`]}constructor(){super(),this._barState.subscribe(()=>this._applyRevealed())}get stack(){return this._stack}set stack(e){this.setStack(this._resolveStack(e))}get reveal(){return this._barState.reveal}set reveal(e){e?this.setAttribute(`reveal`,``):(this.removeAttribute(`reveal`),this.removeAttribute(`revealed`))}get revealed(){return this._barState.revealed}connectedCallback(){this._initialized||(this._initialized=!0,this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar-box`,this._barEl.setAttribute(`role`,`tablist`),this.replaceChildren(this._barEl),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{let t=this._stack;if(!t)return;let n=Number(e.dataset.pageIndex);t.visibleChildIndex!==n&&t.selectNthPage(n)}})),this._barState.setReveal(this._readReveal());let e=this.getAttribute(`stack`);if(e&&!this._stack){this.setStack(this._resolveStack(e));return}this._bindStack(),this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`reveal`||e===`revealed`){this._barState.setReveal(this._readReveal());return}e===`stack`&&this.setStack(this._resolveStack(n))}}setStack(e){this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild()}refresh(){this._rebuild()}_readReveal(){return this.hasAttribute(`reveal`)||this.hasAttribute(`revealed`)}_bindStack(){this._stack?.addEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.addEventListener(`items-changed`,this._onStackNotify)}_unbindStack(){this._stack?.removeEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.removeEventListener(`items-changed`,this._onStackNotify)}_resolveStack(e){return e===null?null:typeof e==`string`?document.getElementById(e)??null:e}_rebuild(){if(!this._initialized)return;let e=this._stack?.pages??[];this._barState.setPages(e);let t=buildViewSwitcherButtons(viewSwitcherPagesFromStack(e),this._stack?.visibleChildIndex??-1,`narrow`);t.length!==this._nodes.length&&(this._barEl.replaceChildren(),this._nodes=t.map(e=>this._buildButton(e.pageIndex)),this._barEl.append(...this._nodes.map(e=>e.button))),t.forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName))}),this._applyRevealed()}_buildButton(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-view-switcher-bar-button`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e);let n=createGtkImage(null,`adw-view-switcher-bar-icon`),r=document.createElement(`span`);r.className=`adw-view-switcher-bar-label`;let i=document.createElement(`span`);return i.className=`adw-view-switcher-bar-indicator`,i.setAttribute(`aria-hidden`,`true`),t.append(n,r,i),t.addEventListener(`click`,()=>{this._stack?.selectNthPage(e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);const zt=[`child-spacing`,`child-spacing-unit`,`pack-direction`,`align`,`justify`,`justify-last-line`,`line-spacing`,`line-spacing-unit`,`line-homogeneous`,`natural-line-length`,`natural-line-length-unit`,`wrap-reverse`,`wrap-policy`,`orientation`];function alignToJustifyContent(e){return e<.25?`flex-start`:e<.75?`center`:`flex-end`}var AdwWrapBox=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[...zt]}get childSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`child-spacing`))}set childSpacing(e){this.setAttribute(`child-spacing`,String(e))}get childSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`child-spacing-unit`))}set childSpacingUnit(e){this.setAttribute(`child-spacing-unit`,e)}get lineSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`line-spacing`))}set lineSpacing(e){this.setAttribute(`line-spacing`,String(e))}get lineSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`line-spacing-unit`))}set lineSpacingUnit(e){this.setAttribute(`line-spacing-unit`,e)}get align(){return normalizeWrapBoxAlign(this.getAttribute(`align`))}set align(e){this.setAttribute(`align`,String(e))}get justify(){return normalizeWrapBoxJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get justifyLastLine(){return this.hasAttribute(`justify-last-line`)}set justifyLastLine(e){this.toggleAttribute(`justify-last-line`,!!e)}get wrapPolicy(){return normalizeWrapPolicy(this.getAttribute(`wrap-policy`))}set wrapPolicy(e){this.setAttribute(`wrap-policy`,e)}get packDirection(){return normalizeWrapBoxPackDirection(this.getAttribute(`pack-direction`))}set packDirection(e){this.setAttribute(`pack-direction`,e)}get wrapReverse(){return this.hasAttribute(`wrap-reverse`)}set wrapReverse(e){this.toggleAttribute(`wrap-reverse`,!!e)}get lineHomogeneous(){return this.hasAttribute(`line-homogeneous`)}set lineHomogeneous(e){this.toggleAttribute(`line-homogeneous`,!!e)}get naturalLineLength(){return normalizeNaturalLineLength(this.getAttribute(`natural-line-length`))}set naturalLineLength(e){this.setAttribute(`natural-line-length`,String(e))}get naturalLineLengthUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`natural-line-length-unit`))}set naturalLineLengthUnit(e){this.setAttribute(`natural-line-length-unit`,e)}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get _children(){return[...this.children]}insertChildAfter(e,t=null){return this._applyOrder(`insert-after`,e,t)}reorderChildAfter(e,t=null){return this._applyOrder(`reorder-after`,e,t)}removeAll(){for(let e of this._children)this.removeChild(e)}_applyOrder(e,t,n){let r=resolveWrapBoxChildOrder({children:this._children,child:t,sibling:n,op:e});if(r===null)return!1;let i=r.indexOf(t);return this.insertBefore(t,r[i+1]??null),!0}connectedCallback(){this._initialized||(this._initialized=!0,this._sync())}attributeChangedCallback(e,t,n){if(!this._initialized)return;this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){switch(e){case`child-spacing`:case`line-spacing`:return normalizeWrapBoxSpacing(t);case`child-spacing-unit`:case`line-spacing-unit`:case`natural-line-length-unit`:return normalizeWrapBoxLengthUnit(t);case`align`:return normalizeWrapBoxAlign(t);case`justify`:return normalizeWrapBoxJustify(t);case`wrap-policy`:return normalizeWrapPolicy(t);case`pack-direction`:return normalizeWrapBoxPackDirection(t);case`natural-line-length`:return normalizeNaturalLineLength(t);case`orientation`:return t===`vertical`?`vertical`:`horizontal`;default:return t!==null}}_sync(){let e=this.style,t=this.orientation===`vertical`,n=t?`column`:`row`;e.flexDirection=this.packDirection===`end-to-start`?`${n}-reverse`:n,e.flexWrap=this.wrapReverse?`wrap-reverse`:`wrap`;let r=`${wrapBoxLengthToPx(this.childSpacing,this.childSpacingUnit)}px`,i=`${wrapBoxLengthToPx(this.lineSpacing,this.lineSpacingUnit)}px`;t?(e.rowGap=r,e.columnGap=i):(e.columnGap=r,e.rowGap=i),e.setProperty(`--adw-wrap-box-child-spacing`,r);let a=this.justify,o=this.justifyLastLine,s=this.align,c=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!1,childrenInLine:2}),l=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!0,childrenInLine:2});this.dataset.lineJustify=c.justify,this.dataset.lastLineJustify=l.justify,e.justifyContent=c.growGaps?`space-between`:alignToJustifyContent(c.align),e.alignContent=this.lineHomogeneous?`stretch`:`flex-start`,e.setProperty(`--adw-wrap-box-child-shrink`,String(wrapPolicyFlexShrink(this.wrapPolicy)));let u=wrapBoxLengthToPx(this.naturalLineLength,this.naturalLineLengthUnit),d=u===-1?``:`${u}px`;e.maxWidth=t?``:d,e.maxHeight=t?d:``}};customElements.define(`adw-wrap-box`,AdwWrapBox);const Bt={main:`About`,credits:`Credits`,license:`License`,system:`System`},Vt=[`credits`,`license`,`system`],Ht=[`unknown`,`custom`,`gpl-2-0`,`gpl-3-0`,`lgpl-2-1`,`lgpl-3-0`,`bsd`,`mit-x11`,`artistic`,`gpl-2-0-only`,`gpl-3-0-only`,`lgpl-2-1-only`,`lgpl-3-0-only`,`agpl-3-0`,`agpl-3-0-only`,`bsd-3`,`apache-2-0`,`mpl-2-0`,`0bsd`];var GtkAboutDialog=class extends AdwDialog{_built=!1;_logo=``;_switcherEl;_stackEl;_pages=new Map;_populated=new Set;_authors=[];_documenters=[];_artists=[];_creditSections=[];static get observedAttributes(){return[...AdwDialog.observedAttributes,`program-name`,`version`,`copyright`,`comments`,`license`,`license-type`,`system-information`,`website`,`website-label`,`translator-credits`,`logo-icon-name`,`wrap-license`]}get programName(){return this.getAttribute(`program-name`)??``}set programName(e){this.setAttribute(`program-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e),this.setAttribute(`license-type`,`custom`)}get licenseType(){let e=this.getAttribute(`license-type`);return e!==null&&Ht.includes(e)?e:`unknown`}set licenseType(e){Ht.includes(e)?this.setAttribute(`license-type`,e):this.removeAttribute(`license-type`)}get systemInformation(){return this.getAttribute(`system-information`)??``}set systemInformation(e){this.setAttribute(`system-information`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get websiteLabel(){return this.getAttribute(`website-label`)??``}set websiteLabel(e){this.setAttribute(`website-label`,e)}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get logoIconName(){return this.getAttribute(`logo-icon-name`)??``}set logoIconName(e){this.setAttribute(`logo-icon-name`,e)}get wrapLicense(){return this.hasAttribute(`wrap-license`)}set wrapLicense(e){this.toggleAttribute(`wrap-license`,e)}get logo(){return this._logo}set logo(e){this._logo=e,this._built&&this._renderLogo()}get authors(){return[...this._authors]}set authors(e){this._authors=[...e],this._creditsChanged()}get documenters(){return[...this._documenters]}set documenters(e){this._documenters=[...e],this._creditsChanged()}get artists(){return[...this._artists]}set artists(e){this._artists=[...e],this._creditsChanged()}addCreditSection(e,t){this._creditSections.push({name:e,people:[...t]}),this._creditsChanged()}_creditsChanged(){this._populated.delete(`credits`),this._built&&this._renderAbout()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-gtk-about-dialog-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),this._switcherEl.setAttribute(`aria-label`,`Pages`),super.connectedCallback(),this._stackEl=document.createElement(`div`),this._stackEl.className=`adw-gtk-about-dialog-stack`,this._stackEl.dataset.transitionType=`crossfade`,this.setAttribute(`title`,`About ${this.programName||document.title}`);let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderAbout(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this._built&&t!==n&&((e===`license`||e===`license-type`||e===`website`)&&this._populated.delete(`license`),e===`system-information`&&this._populated.delete(`system`),(e===`website`||e===`website-label`||e===`license`||e===`license-type`)&&(this._renderMain(),this._populateLicense()),e===`wrap-license`&&this._populateLicense(),e===`system-information`&&this._populateSystem(),this._renderAbout())}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl),this._renderSwitcher()}get visiblePage(){return this._stackEl.dataset.visible??`main`}showPage(e){this._populatePage(e);for(let[t,n]of this._pages)n.hidden=t!==e;this._stackEl.dataset.visible=e,this._renderSwitcher()}_build(){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-box`;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-head`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-logo-slot`,t.appendChild(n),this._renderLogo();let r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-name`,r.textContent=this.programName||document.title,t.appendChild(r);for(let e of[`main`,...Vt]){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-page`,t.dataset.page=e,t.hidden=e!==`main`,this._pages.set(e,t),this._stackEl.appendChild(t)}return this._renderMain(),t.appendChild(this._stackEl),e.appendChild(t),e}_renderAbout(){this.setAttribute(`title`,`About ${this.programName||document.title}`);for(let e of Vt){let t=this._pages.get(e);if(t===void 0)continue;let n=this._pageVisible(e);t.hidden!==!n&&(t.hidden=!n,n||this._populated.delete(e))}this._pages.get(this._stackEl.dataset.visible??`main`)?.hidden!==!1&&(this._stackEl.dataset.visible=`main`,this._pages.get(`main`).hidden=!1),this._renderMain(),this._renderSwitcher()}_pageVisible(e){return e===`credits`?this._creditsPeople().length>0:e===`license`?this.licenseType===`custom`&&this.license.length>0:this.systemInformation.length>0}_creditsPeople(){let e=[];this._authors.length>0&&e.push({title:`Created by`,people:this._authors}),this._documenters.length>0&&e.push({title:`Documented by`,people:this._documenters});let t=translatorCreditsPeople(this.translatorCredits);t.length>0&&e.push({title:`Translated by`,people:t}),this._artists.length>0&&e.push({title:`Design by`,people:this._artists});for(let t of this._creditSections)e.push({title:t.name,people:t.people});return e}_visiblePages(){return Vt.filter(e=>this._pages.get(e)?.hidden===!1)}_renderSwitcher(){if(this._switcherEl===void 0)return;let e=this._visiblePages();this._switcherEl.hidden=e.length===0,this._switcherEl.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-gtk-about-dialog-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=Bt[e],t.classList.toggle(`checked`,this._stackEl.dataset.visible===e),t.setAttribute(`aria-selected`,String(this._stackEl.dataset.visible===e)),t.addEventListener(`click`,()=>this.showPage(e)),t}))}_renderLogo(){let e=this.contentArea.querySelector(`.adw-gtk-about-dialog-logo-slot`);if(e!==null){if(this.logoIconName.length>0){e.replaceChildren(createGtkImage(this.logoIconName,`adw-gtk-about-dialog-logo`));return}if(this._logo.length>0){let t=document.createElement(`img`);t.className=`adw-gtk-about-dialog-logo`,t.src=this._logo,t.alt=``,e.replaceChildren(t);return}e.replaceChildren()}}_renderMain(){let e=this._pages.get(`main`);if(e===void 0)return;let t=[],label=(e,t)=>{let n=document.createElement(`div`);return n.className=t,n.textContent=e,n};this.version.length>0&&t.push(label(this.version,`adw-gtk-about-dialog-version`)),this.comments.length>0&&t.push(label(this.comments,`adw-gtk-about-dialog-comments`)),this.website.length>0?t.push(this.websiteLabel.length>0?this._link(this.websiteLabel,this.website,`adw-gtk-about-dialog-website`):this._link(`Website`,this.website,`adw-gtk-about-dialog-website`)):this.websiteLabel.length>0&&t.push(label(this.websiteLabel,`adw-gtk-about-dialog-website`)),this.copyright.length>0&&t.push(label(this.copyright,`adw-gtk-about-dialog-copyright`));let n=this._licenseMarkup();n!==null&&t.push(n),e.replaceChildren(...t)}_licenseMarkup(){let e=this.licenseType,t=Ht.indexOf(e),n=t>=0?t:o.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==o.CUSTOM&&n!==o.UNKNOWN){let e=s[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
5
- See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document.createTextNode(` for details.`)),r}return n===o.UNKNOWN||this.license.length===0?null:(this._fillWithLinks(r,this.license),r)}_populateLicense(){let e=this._pages.get(`license`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`,this.wrapLicense&&t.classList.add(`wrap`);let n=this._licenseMarkup();if(n!==null){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-text`,e.replaceChildren(...[...n.childNodes].map(e=>e.cloneNode(!0))),t.appendChild(e)}e.replaceChildren(this._frame(t))}_populateSystem(){let e=this._pages.get(`system`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-text`,this._fillWithLinks(n,this.systemInformation),t.appendChild(n),e.replaceChildren(this._frame(t))}_populateCredits(){let e=this._pages.get(`credits`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-credits-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,Bt.credits);for(let e of this._creditsPeople()){let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-credits-heading`,n.textContent=e.title,t.appendChild(n);for(let n of e.people){let e=parseCreditPerson(n),r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-credits-person`,e.link===null?r.textContent=e.name:r.appendChild(this._link(e.name,e.uri??``,`adw-gtk-about-dialog-credits-link`)),t.appendChild(r)}t.appendChild(document.createElement(`div`))}e.replaceChildren(this._frame(t))}_populatePage(e){this._populated.has(e)||(this._populated.add(e),e===`credits`?this._populateCredits():e===`license`?this._populateLicense():e===`system`&&this._populateSystem())}_frame(e){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-scrolled`;let n=document.createElement(`div`);return n.className=`adw-view`,n.appendChild(e),t.appendChild(n),t}_link(e,t,n){let r=document.createElement(`a`);return r.className=n,r.href=t,r.rel=`noopener noreferrer`,r.textContent=e,r.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(t)}),r}_fillWithLinks(e,t){for(let n of splitLinks(t)){if(n.uri===null){e.appendChild(document.createTextNode(n.text));continue}let t=document.createElement(`a`);t.href=n.uri,t.rel=`noopener noreferrer`,t.textContent=n.text,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n.uri)}),e.appendChild(t)}}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}};function splitLinks(e){let t=[],n=e;for(;n.length>0;){let e=n.indexOf(`<`),r=e<0?-1:n.indexOf(`>`,e),i=n.indexOf(`http://`),a=n.indexOf(`https://`),o=i;(i<0||a>=0&&a<i)&&(o=a);let s=-1;if(o>=0&&(s=`
6
- >`.split(``).reduce((e,t)=>{if(e>=0)return e;let r=n.indexOf(t,o);return r<0?-1:r},-1),s<0&&(s=n.length)),o>=0&&(e<0||r<0||o<=e+1)&&(e=o,r=s),e<0||r<0){t.push({text:n,uri:null});break}e>0&&t.push({text:n.slice(0,e),uri:null});let c=n[e]===`<`,l=c?n.slice(e+1,r):n.slice(e,r);t.push({text:l,uri:c?`mailto:${l}`:l}),n=n.slice(r+ +!!c)}return t}customElements.define(`gtk-about-dialog`,GtkAboutDialog);var GtkActionBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;static get observedAttributes(){return[`revealed`]}get revealed(){return this.getAttribute(`revealed`)!==`false`}set revealed(e){this.setAttribute(`revealed`,e?`true`:`false`)}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-action-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-action-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-action-bar-end`;let e=this._endEl;bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`end`,consume:t=>e.prepend(t)},{into:this._startEl}]).install(this._startEl,this._centerEl,this._endEl),this._renderRevealed()}attributeChangedCallback(){this._initialized&&this._renderRevealed()}_renderRevealed(){this.hidden=!this.revealed}};customElements.define(`gtk-action-bar`,GtkActionBar);const L={minimize:{className:`minimize`,icon:`window-minimize-symbolic`,label:`Minimize`,action:`minimize`},maximize:{className:`maximize`,icon:`window-maximize-symbolic`,label:`Maximize`,action:`toggle-maximized`},close:{className:`close`,icon:`window-close-symbolic`,label:`Close`,action:`close`}},Ut=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends HTMLElement{_initialized=!1;_empty=!0;_window=null;_windowObserver=null;static get observedAttributes(){return[`decoration-layout`,`side`,`use-native-controls`]}get side(){return this.getAttribute(`side`)===`end`?`end`:`start`}set side(e){this._write(`side`,e)}get useNativeControls(){return this.hasAttribute(`use-native-controls`)}get empty(){return this._empty}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followWindow();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._followWindow()}disconnectedCallback(){this._windowObserver?.disconnect(),this._windowObserver=null,this._window=null}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`side`?this.side:this.hasAttribute(e)}_followWindow(){this._windowObserver?.disconnect(),this._applyEmptyClass(),this._window=this.closest(`gtk-window, adw-window`),this._window!==null&&(this._windowObserver??=new MutationObserver(()=>this._render()),this._windowObserver.observe(this._window,{attributes:!0,attributeFilter:Ut})),this._render()}_isSovereign(e){return!e.hasAttribute(`modal`)&&!e.hasAttribute(`transient-for`)}_windowFlag(e,t){return e.getAttribute(t)!==`false`}_layoutHalf(){let e=this.getAttribute(`decoration-layout`)??this._window?.getAttribute(`decoration-layout`)??`:minimize,maximize,close`;if(e===``)return null;let t=e.indexOf(`:`);return t===-1?e:this.side===`start`?e.slice(0,t):e.slice(t+1)}_render(){this.classList.toggle(`start`,this.side===`start`),this.classList.toggle(`end`,this.side===`end`),this.replaceChildren(),this._applyEmptyClass();let e=this._window;if(e===null){this._setEmpty(!0);return}let t=this._isSovereign(e),n=this._layoutHalf();if(n===null){this._setEmpty(!0);return}let r=!0;for(let i of n.split(`,`)){let n=this._buttonFor(i,e,t);n!==null&&(this.appendChild(n),r=!1)}this._setEmpty(r)}_applyEmptyClass(){this.classList.toggle(`empty`,this._empty)}_buttonFor(e,t,n){if(e===`icon`)return n?this._windowIcon(t):null;if(e===`minimize`)return n?this._controlButton(L.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`);return this._controlButton(e?{...L.maximize,icon:`window-restore-symbolic`,label:`Restore`}:L.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(L.close):null}_windowIcon(e){let t=e.getAttribute(`icon-name`);return t===null||t===``?null:createGtkImage(t,`icon`)}_controlButton(e){let t=document.createElement(`button`);return t.className=`adw-window-controls-button ${e.className}`,t.setAttribute(`aria-label`,e.label),t.title=e.label,t.appendChild(createGtkImage(e.icon)),t.addEventListener(`click`,()=>this.dispatchEvent(new CustomEvent(`window-action`,{bubbles:!0,detail:{action:e.action}}))),t}_setEmpty(e){e!==this._empty&&(this._empty=e,this._applyEmptyClass(),this.dispatchEvent(new CustomEvent(`notify::empty`,{bubbles:!0,detail:{empty:e}})))}};customElements.define(`gtk-window-controls`,GtkWindowControls);var GtkWindow=class extends HTMLElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`]}get title(){return this.getAttribute(`title`)}set title(e){this._write(`title`,e)}get decorated(){return this._onByDefault(`decorated`)}set decorated(e){this._write(`decorated`,String(e))}get maximized(){return this._offByDefault(`maximized`)}set maximized(e){this._write(`maximized`,String(e))}get resizable(){return this._onByDefault(`resizable`)}set resizable(e){this._write(`resizable`,String(e))}get deletable(){return this._onByDefault(`deletable`)}set deletable(e){this._write(`deletable`,String(e))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_onByDefault(e){return this.getAttribute(e)!==`false`}_offByDefault(e){return this.hasAttribute(e)}connectedCallback(){if(this._initialized){this._watchTitlebar(),this._render();return}this._initialized=!0,this._titlebar=document.createElement(`div`),this._titlebar.className=`adw-gtk-window-titlebar`,this._content=document.createElement(`div`),this._content.className=`adw-gtk-window-content`,bindSlottedChildren(this,[{name:`titlebar`,into:this._titlebar},...this.extraSlots(),{into:this._content}]).install(...this.strips()),this.addEventListener(`window-action`,e=>this._onWindowAction(e)),this._watchTitlebar(),this._render()}disconnectedCallback(){this._titlebarObserver?.disconnect(),this._titlebarObserver=null}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}extraSlots(){return[]}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){if(e===`default-width`||e===`default-height`){let t=Number.parseFloat(this.getAttribute(e)??``);return Number.isFinite(t)?t:null}return e===`title`||e===`icon-name`||e===`transient-for`?this.getAttribute(e):e===`decorated`||e===`resizable`||e===`deletable`?this._onByDefault(e):this._offByDefault(e)}_render(){this._titlebar.hidden=!this.decorated,this.classList.toggle(`maximized`,this.decorated&&this.maximized),this.classList.toggle(`fullscreen`,this.decorated&&this._offByDefault(`fullscreened`));let e=Number.parseFloat(this.getAttribute(`default-width`)??``),t=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[n,r]of[[`width`,e],[`height`,t]])Number.isFinite(r)&&r>0?this.style.setProperty(n,`${r}px`):this.style.removeProperty(n);let n=this.getAttribute(`title`);n===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,n),this._renderTitlebar()}_renderTitlebar(){if([...this._titlebar.children].some(e=>e!==this._startControls&&e!==this._endControls&&e!==this._titleLabel)){for(let e of[this._startControls,this._endControls,this._titleLabel])e?.remove();this._startControls=null,this._endControls=null,this._titleLabel=null;return}if(!this.decorated)return;this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._titleLabel=document.createElement(`span`),this._titleLabel.className=`adw-gtk-window-title`,this._titlebar.append(this._startControls,this._titleLabel,this._endControls));let e=this.getAttribute(`title`);e===null?this._titleLabel?.removeAttribute(`title`):this._titleLabel?.setAttribute(`title`,e??``)}_onWindowAction(e){let t=e.detail?.action;if(t===`toggle-maximized`){this._write(`maximized`,String(!this._offByDefault(`maximized`)));return}t===`close`&&this.close()}close(){let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented?!1:(this._offByDefault(`hide-on-close`)?this.hidden=!0:this.remove(),!0)}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}};customElements.define(`gtk-window`,GtkWindow);var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static get observedAttributes(){return[...GtkWindow.observedAttributes,`show-menubar`]}get showMenubar(){return this.getAttribute(`show-menubar`)===`true`}set showMenubar(e){this._write(`show-menubar`,String(e))}menubarSection(){if(this._menubar===null){let e=document.createElement(`div`);e.className=`adw-gtk-application-window-menubar`,this._menubar=e}return this._menubar}strips(){return[this._titlebar,this.menubarSection(),this._content]}extraSlots(){return[{name:`menubar`,into:this.menubarSection()}]}connectedCallback(){super.connectedCallback(),this._followMenubar()}disconnectedCallback(){this._menubarObserver?.disconnect(),this._menubarObserver=null}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`show-menubar`&&this._renderMenubar()}_followMenubar(){this._menubarObserver?.disconnect(),this._menubarObserver=new MutationObserver(()=>this._renderMenubar()),this._menubarObserver.observe(this.menubarSection(),{childList:!0}),this._renderMenubar()}_renderMenubar(){let e=this.menubarSection();e.hidden=!this.showMenubar||e.childElementCount===0}};customElements.define(`gtk-application-window`,GtkApplicationWindow);function normalizeAlign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):.5}function normalizeRatio(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,1e-4,1e4):1}var GtkAspectFrame=class extends HTMLElement{static get observedAttributes(){return[`ratio`,`xalign`,`yalign`,`obey-child`]}get ratio(){return normalizeRatio(this.getAttribute(`ratio`))}set ratio(e){this.setAttribute(`ratio`,String(e))}get xalign(){return normalizeAlign(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeAlign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get obeyChild(){let e=this.getAttribute(`obey-child`);return e===null||e!==`false`&&e!==`0`}set obeyChild(e){e?this.setAttribute(`obey-child`,`true`):this.setAttribute(`obey-child`,`false`)}get child(){return this.firstElementChild??null}set child(e){this.firstElementChild!==null&&this.firstElementChild.remove(),e!==null&&this.append(e),this._sync()}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`ratio`?normalizeRatio(t):e===`xalign`||e===`yalign`?normalizeAlign(t):t!==null&&t!==`false`&&t!==`0`}_sync(){let e=this.child;if(e===null)return;let t=e.style;this.obeyChild?t.removeProperty(`aspect-ratio`):t.aspectRatio=String(this.ratio),t.flex=`1 1 auto`,t.maxWidth=`100%`,t.maxHeight=`100%`,this.style.justifyContent=labelYalignAlignItems(this.xalign),this.style.alignItems=labelYalignAlignItems(this.yalign)}};customElements.define(`gtk-aspect-frame`,GtkAspectFrame);const Wt=[`orientation`,`spacing`,`homogeneous`];var GtkBox=class extends HTMLElement{static get observedAttributes(){return[...Wt]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get spacing(){return normalizeBoxSpacing(this.getAttribute(`spacing`))}set spacing(e){this.setAttribute(`spacing`,String(e))}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}connectedCallback(){this._sync()}attributeChangedCallback(e,t,n){this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`orientation`?normalizeBoxOrientation(t):e===`spacing`?normalizeBoxSpacing(t):t!==null}_sync(){this.style.flexDirection=this.orientation===`vertical`?`column`:`row`,this.style.gap=`${this.spacing}px`}};customElements.define(`gtk-box`,GtkBox);const Gt=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends HTMLElement{static signals={clicked:`click`};_button;_label=``;_initialized=!1;_child=null;static get observedAttributes(){return[`icon`,`icon-name`,`label`,`tooltip`,`tooltip-text`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`,`class`]}get button(){return this._button}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent??``).join(``);this._label=(this.getAttribute(`label`)??e).trim(),this._button=document.createElement(`button`),bindSlottedChildren(this,[{name:`child`,claims:e=>e instanceof Element,consume:e=>{this._child=e,this._render()}}]).install(this._button),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`;let t=[...Gt.filter(e=>this.hasAttribute(e)),...this.classList];e.classList.add(...buttonStyleClasses(t));let n=this._child,r=n?null:this.getAttribute(`icon`)??this.getAttribute(`icon-name`),i=n?``:(this.getAttribute(`label`)??this._label).trim();r&&!i&&e.classList.add(`icon-only`),i&&!r&&e.classList.add(`text-button`),n?e.replaceChildren(n):e.replaceChildren(),r&&e.appendChild(createGtkImage(r)),i&&e.appendChild(document.createTextNode(i));let a=this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`);e.title=a??``,r&&!i?e.setAttribute(`aria-label`,a??r):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Kt=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],qt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],R=[{step:`previous-month`,icon:`go-previous`,tooltip:`Previous Month`},{step:`next-month`,icon:`go-next`,tooltip:`Next Month`},{step:`previous-year`,icon:`go-up`,tooltip:`Previous Year`},{step:`next-year`,icon:`go-down`,tooltip:`Next Year`}];var GtkCalendar=class extends HTMLElement{_headerEl;_monthEl;_yearEl;_arrowEls={};_gridEl;_dayNameEls=[];_weekNumberEls=[];_cellEls=[];_marked=calendarClearMarks();_date;_focus=-1;_initialized=!1;static get observedAttributes(){return[`date`,`year`,`month`,`day`,`show-heading`,`show-day-names`,`show-week-numbers`,`week-start`]}get date(){return toIsoDate(this._date)}set date(e){this.setAttribute(`date`,e)}get year(){return this._date.year}set year(e){this.setAttribute(`year`,String(e))}get month(){return this._date.month-1}set month(e){this.setAttribute(`month`,String(e))}get day(){return this._date.day}set day(e){this.setAttribute(`day`,String(e))}get showHeading(){return this.getAttribute(`show-heading`)!==`false`}set showHeading(e){this.setAttribute(`show-heading`,String(!!e))}get showDayNames(){return this.getAttribute(`show-day-names`)!==`false`}set showDayNames(e){this.setAttribute(`show-day-names`,String(!!e))}get showWeekNumbers(){return this.hasAttribute(`show-week-numbers`)}set showWeekNumbers(e){this.toggleAttribute(`show-week-numbers`,!!e)}get weekStart(){let e=this.getAttribute(`week-start`);if(e!==null){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>=0&&t<=6)return t}return localeWeekStart()}set weekStart(e){this.setAttribute(`week-start`,String(e))}get markedDays(){return this._marked.flatMap((e,t)=>e?[t+1]:[])}constructor(){super(),this._date=today()}connectedCallback(){this._initialized||(this._initialized=!0,this._buildHeader(),this._buildGrid(),this.replaceChildren(this._headerEl,this._gridEl),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._adoptAttributes(),this._render())}attributeChangedCallback(e){if(!this._initialized)return;let t=this._adoptAttributes(e);this._render(),(e===`date`||e===`year`||e===`month`||e===`day`)&&this._emitDaySelected(t)}markDay(e){let t=calendarMarkDay(this._marked,e,!0);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}unmarkDay(e){let t=calendarMarkDay(this._marked,e,!1);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}dayIsMarked(e){return calendarDayIsMarked(this._marked,e)}clearMarks(){this._marked=calendarClearMarks(),this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:[]}}))}get cells(){return calendarDays(this._date.year,this._date.month,this.weekStart)}get selectedDate(){return{...this._date}}_buildHeader(){this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-calendar-header`;let e={previousMonth:{icon:R[0].icon,tooltip:R[0].tooltip},nextMonth:{icon:R[1].icon,tooltip:R[1].tooltip},previousYear:{icon:R[2].icon,tooltip:R[2].tooltip},nextYear:{icon:R[3].icon,tooltip:R[3].tooltip}},button=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.className=`adw-calendar-nav-button flat`,i.title=e[t].tooltip,i.setAttribute(`aria-label`,e[t].tooltip),n&&i.classList.add(`expand`),i.style.justifySelf=r,i.addEventListener(`click`,()=>this._onArrow(t)),i.appendChild(createGtkImage(e[t].icon,`adw-calendar-nav-icon`)),this._arrowEls[t]=i,i};this._monthEl=document.createElement(`span`),this._monthEl.className=`adw-calendar-month`,this._yearEl=document.createElement(`span`),this._yearEl.className=`adw-calendar-year`,this._headerEl.append(button(`previousMonth`,!1,`start`),this._monthEl,button(`nextMonth`,!0,`start`),button(`previousYear`,!1,`center`),this._yearEl,button(`nextYear`,!1,`end`)),this._monthEl.style.flex=`1`,this._yearEl.style.paddingInline=`6px`}_buildGrid(){this._gridEl=document.createElement(`div`),this._gridEl.className=`adw-calendar-grid`;for(let e=0;e<7;e++){let e=document.createElement(`span`);e.className=`adw-calendar-day-name`,this._dayNameEls.push(e),this._gridEl.appendChild(e)}let e=document.createElement(`span`);e.className=`adw-calendar-week-spacer`,e.setAttribute(`aria-hidden`,`true`),this._gridEl.appendChild(e);for(let e=0;e<6;e++){let e=document.createElement(`span`);e.className=`adw-calendar-week-number`,this._weekNumberEls.push(e),this._gridEl.appendChild(e);for(let e=0;e<7;e++){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-calendar-cell day-number`,e.addEventListener(`click`,()=>this._onCellClick(Number(e.dataset.index??`0`))),this._cellEls.push(e),this._gridEl.appendChild(e)}}}_adoptAttributes(e){let t=this.getAttribute(`date`);if(t!==null&&!(e===`year`||e===`month`||e===`day`)){let e=parseIsoDate(t);if(e!==null){let t=calendarSelectDay(this._date,e,!1);return this._date=t.date,t}}let n={year:integer(this.getAttribute(`year`),this._date.year),month:integer(this.getAttribute(`month`),this._date.month-1)+1,day:integer(this.getAttribute(`day`),this._date.day)},r=calendarSelectDay(this._date,n,!1);return this._date=r.date,r}_render(){this._monthEl.textContent=qt[this._date.month-1],this._yearEl.textContent=String(this._date.year);let e=calendarDays(this._date.year,this._date.month,this.weekStart);e.forEach((e,t)=>{let n=this._cellEls[t];n.dataset.index=String(t),n.textContent=String(e.date.day),n.setAttribute(`aria-label`,`${qt[e.date.month-1]} ${e.date.day}, ${e.date.year}`),n.classList.toggle(`other-month`,e.month!==`current`)}),this._paintWeekNumbers(e),this._paintStates(),this._paintArrows(),this._paintDayNames(),this._paintVisibility()}_paintWeekNumbers(e){for(let t=0;t<6;t++){let n=e[t*7+6];this._weekNumberEls[t].textContent=String(calendarWeekNumber(n.date))}}_paintStates(){let e=calendarDays(this._date.year,this._date.month,this.weekStart),t=today(),n=t.year===this._date.year&&t.month===this._date.month?t.day:-1;e.forEach((e,t)=>{let r=this._cellEls[t],i=e.month===`current`&&e.date.day===this._date.day,a=e.month===`previous`&&this._date.year===1&&this._date.month===1||e.month===`next`&&this._date.year===9999&&this._date.month===12;r.classList.toggle(`selected`,i),r.classList.toggle(`marked`,e.month===`current`&&calendarDayIsMarked(this._marked,e.date.day)),r.classList.toggle(`today`,e.date.day===n&&e.month===`current`),r.classList.toggle(`focused`,t===this._focus),r.disabled=a,a?r.textContent=``:r.textContent=String(e.date.day)})}_paintArrows(){let e=calendarNavigationButtons(this._date);for(let t of[`previousMonth`,`nextMonth`,`previousYear`,`nextYear`])this._arrowEls[t].disabled=!e[t]}_paintDayNames(){for(let e=0;e<7;e++)this._dayNameEls[e].textContent=Kt[(e+this.weekStart)%7]}_paintVisibility(){this._headerEl.hidden=!this.showHeading;for(let e of this._dayNameEls)e.hidden=!this.showDayNames;for(let e of this._weekNumberEls)e.hidden=!this.showWeekNumbers}_onArrow(e){let t=R.find(t=>arrowNameOf(t.step)===e)?.step;t===void 0||this._arrowEls[e].disabled||this._navigate(t)}_navigate(e){let t=this._date;if(this._date=calendarSelectDay(t,calendarStep(t,e),!1).date,this._focus>=0){let e=this.cells,t=e[this._focus],n=e.findIndex(e=>e.month===t?.month&&e.date.day===t.date.day);this._focus=n>=0?n:-1}this._render(),this.dispatchEvent(new CustomEvent(`notify::date`,{bubbles:!0,detail:{date:this.date}})),this.dispatchEvent(new CustomEvent({"previous-month":`prev-month`,"next-month":`next-month`,"previous-year":`prev-year`,"next-year":`next-year`}[e],{bubbles:!0}))}_emitDaySelected(e){let notify=(e,t)=>this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}));e.dayChanged&&(this.dispatchEvent(new CustomEvent(`day-selected`,{bubbles:!0})),notify(`day`,this._date.day)),e.monthChanged&&notify(`month`,this._date.month-1),e.yearChanged&&notify(`year`,this._date.year),notify(`date`,this.date)}_onCellClick(e){let t=this.cells[e];t!==void 0&&(this._focus=e,t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0))}_selectDate(e,t){let n=calendarSelectDay(this._date,e,t);if(!n.dayChanged&&!n.monthChanged&&!n.yearChanged){this._render();return}this._date=n.date;let r=this.cells.findIndex(e=>e.month===`current`&&e.date.day===this._date.day);r>=0&&(this._focus=r),this._render(),this._emitDaySelected(n)}_onKeyDown(e){let t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]};if(e.ctrlKey){let t={ArrowLeft:`previous-month`,ArrowRight:`next-month`,ArrowUp:`previous-year`,ArrowDown:`next-year`}[e.key];if(t===void 0||(e.preventDefault(),!calendarNavigationButtons(this._date)[arrowNameOf(t)]))return;this._navigate(t);return}if(e.altKey||e.metaKey)return;if(e.key===` `){if(this._focus<0)return;e.preventDefault();let t=this.cells[this._focus];if(t===void 0)return;t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0);return}let n=t[e.key];n!==void 0&&(e.preventDefault(),this._moveFocus(n[0],n[1]))}_moveFocus(e,t){if(this.cells.length===0)return;let n=this._focus<0?-1:Math.trunc(this._focus/7),r=this._focus<0?-1:this._focus%7;t===1?(n>0&&n--,n<0&&(n=5),r<0&&(r=6)):t===-1?(n<5&&n++,r<0&&(r=0)):e===-1?(r>0?r--:n>0&&(r=6,n--),r<0&&(r=6),n<0&&(n=5)):(r<6?r++:n<5&&(r=0,n++),r<0&&(r=0),n<0&&(n=0));let i=n*7+r;this._cellEls[i]?.disabled!==!0&&(this._focus=i,this._paintStates(),this._cellEls[i]?.focus())}};function arrowNameOf(e){switch(e){case`previous-month`:return`previousMonth`;case`next-month`:return`nextMonth`;case`previous-year`:return`previousYear`;default:return`nextYear`}}function localeWeekStart(){let e=globalThis.navigator?.language;if(typeof e!=`string`)return calendarWeekStart(0,0);let t=Intl.Locale;if(t===void 0)return calendarWeekStart(0,0);let n=new t(e).getWeekInfo?.();return n===void 0?calendarWeekStart(0,0):calendarWeekStart(n.firstDay%7,n.firstDay===7?0:1)}function today(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function toIsoDate(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function parseIsoDate(e){let t=/^(-?\d{1,6})-(\d{1,2})-(\d{1,2})$/.exec(e.trim());if(t===null)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31||n<1||n>9999?null:{year:n,month:r,day:i}}function integer(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)?n:t}customElements.define(`gtk-calendar`,GtkCalendar);const z={top:0,center:.5,bottom:1};var GtkCenterBox=class extends HTMLElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in z?e:`center`}set baselinePosition(e){this.setAttribute(`baseline-position`,e)}get shrinkCenterLast(){let e=this.getAttribute(`shrink-center-last`);return e===null||e!==`false`&&e!==`0`}set shrinkCenterLast(e){e?this.removeAttribute(`shrink-center-last`):this.setAttribute(`shrink-center-last`,`false`)}get startWidget(){return this.querySelector(`[slot="start-widget"]`)}set startWidget(e){this._assign(`start-widget`,e)}get centerWidget(){return this.querySelector(`[slot="center-widget"]`)}set centerWidget(e){this._assign(`center-widget`,e)}get endWidget(){return this.querySelector(`[slot="end-widget"]`)}set endWidget(e){this._assign(`end-widget`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`start-widget`,into:this},{name:`center-widget`,into:this},{name:`end-widget`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`shrink-center-last`?t===null||t!==`false`&&t!==`0`:t!==null&&t in z?t:`center`}_assign(e,t){let n=this.querySelector(`[slot="${e}"]`);n!==null&&(n.removeAttribute(`slot`),n.remove()),t!==null&&(t.setAttribute(`slot`,e),this.append(t)),this._sync()}_sync(){let e=this.shrinkCenterLast;for(let t of this.children){let n=t.getAttribute(`slot`),r=n===`center-widget`?!e:n===`start-widget`||n===`end-widget`?e:!1;t.style.flexShrink=String(r?100:1)}this.hasAttribute(`baseline-position`)?this.style.alignItems=labelYalignAlignItems(z[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const B=new RadioGroupState;var AdwCheckBase=class extends HTMLElement{_input;_indicator;_label;_initialized=!1;get checked(){return this.hasAttribute(`checked`)}set checked(e){this.toggleAttribute(`checked`,!!e)}get indeterminate(){return this.hasAttribute(`indeterminate`)}set indeterminate(e){this.toggleAttribute(`indeterminate`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get label(){return this.getAttribute(`label`)??this._label?.textContent??``}set label(e){this.setAttribute(`label`,e)}connectedCallback(){if(this._initialized){this.onConnected();return}this._initialized=!0;let e=[...this.childNodes];this._input=document.createElement(`input`),this._input.type=this.inputType,this._input.className=`adw-check-input`,this._indicator=document.createElement(`span`),this._indicator.className=`adw-check-indicator`,this._label=document.createElement(`span`),this._label.className=`adw-check-label`;let t=this.getAttribute(`label`);t===null?this._label.append(...e):this._label.textContent=t,this.replaceChildren(this._input,this._indicator,this._label),this._input.addEventListener(`change`,()=>this.activate()),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&this.activate()}),this.onConnected(),this.render()}disconnectedCallback(){this.onDisconnected()}attributeChangedCallback(e){this._initialized&&(e===`label`&&(this._label.textContent=this.getAttribute(`label`)??``),this.render(),e===`checked`&&this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})))}onConnected(){}onDisconnected(){}render(){let e=resolveCheckState(this.checked,this.indeterminate);this._input.checked=e===`checked`,this._input.indeterminate=e===`indeterminate`,this._input.setAttribute(`aria-checked`,e===`indeterminate`?`mixed`:String(e===`checked`)),this._input.disabled=this.disabled,this._label.hidden=this._label.childNodes.length===0}},GtkCheckButton=class extends AdwCheckBase{static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`]}get inputType(){return`checkbox`}activate(){this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`]}get inputType(){return`radio`}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??this.label.trim()}set value(e){this.setAttribute(`value`,e)}activate(){if(this.indeterminate=!1,this.name===``){this.checked=!0;return}B.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=B.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&B.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,GtkCheckButton),customElements.define(`adw-radio`,AdwRadio);const Jt={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends HTMLElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Jt};_pending=!1;_initialized=!1;static get observedAttributes(){return[`rgba`,`dialog`,`disabled`]}get rgba(){return{...this._rgba}}set rgba(e){let t=typeof e==`string`?parseCssColor(e):e;t===null||rgbaEqual(t,this._rgba)||(this._rgba=t,this._renderSwatch(),this.dispatchEvent(new CustomEvent(`notify::rgba`,{bubbles:!0,detail:{rgba:this.rgba}})))}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,e?.title!=null&&(this._inputEl.title=e.title),this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._swatchEl=document.createElement(`span`),this._swatchEl.className=`color-button-swatch`,this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button color icon-only`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.appendChild(this._swatchEl),this._inputEl=document.createElement(`input`),this._inputEl.type=`color`,this._inputEl.className=`color-button-input`,this._inputEl.tabIndex=-1,this._inputEl.setAttribute(`aria-hidden`,`true`),this.replaceChildren(this._buttonEl,this._inputEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._inputEl.addEventListener(`change`,()=>{this._pending=!1;let e=parseCssColor(this._inputEl.value);e!==null&&(this.rgba={...e,alpha:this._rgba.alpha}),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e),this._renderSwatch(),this._renderSensitivity()}attributeChangedCallback(e){if(this._initialized){if(e===`rgba`){let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e);return}if(e===`dialog`){this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return}this._renderSensitivity()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._choose()}_choose(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._inputEl.value=formatHex(this._rgba),this._inputEl.click())}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_renderSwatch(){this._swatchEl.style.backgroundColor=formatCssColor(this._rgba),this._swatchEl.dataset.translucent=String(this._rgba.alpha<1);let e=describeColor(this._rgba);this._swatchEl.setAttribute(`aria-label`,e),this._buttonEl.setAttribute(`aria-label`,e)}};customElements.define(`gtk-color-dialog-button`,GtkColorDialogButton);function rgbaEqual(e,t){return e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha}function scaleRound(e,t){return Math.min(t,Math.max(0,Math.floor(e*t+.5)))}function describeColor(e){let t=[`Red ${scaleRound(e.red,100)}%`,`Green ${scaleRound(e.green,100)}%`,`Blue ${scaleRound(e.blue,100)}%`];return e.alpha<1&&t.push(`Alpha ${scaleRound(e.alpha,100)}%`),t.join(`, `)}function formatHex(e){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`}function formatCssColor(e){let t=formatHex(e);return e.alpha<1?`${t}${Math.round(e.alpha*255).toString(16).padStart(2,`0`)}`:t}const Yt=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i;function parseCssColor(e){let t=document.createElement(`span`);t.style.color=``,t.style.color=e.trim();let n=t.style.color;if(n===``)return null;let r=Yt.exec(n);if(r===null)return null;let i=r[4];return{red:Number(r[1])/255,green:Number(r[2])/255,blue:Number(r[3])/255,alpha:i===void 0?1:i.endsWith(`%`)?Number.parseFloat(i)/100:Number(i)}}const Xt=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Xt,t.textContent=e.item.label,t};function attachRubberBand(e){let t=null,n=null,r=null,stop=()=>{t?.remove(),t=null,n=null,r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),r=null};e.host.addEventListener(`pointerdown`,i=>{if(i.button!==0||!e.enabled())return;let a=i.target;a!==null&&e.rows().some(e=>e===a||e.contains(a))||(n={x:i.clientX,y:i.clientY},r=i.pointerId,e.host.setPointerCapture(i.pointerId),t=document.createElement(`div`),t.className=`adw-rubberband`,t.setAttribute(`aria-hidden`,`true`),e.surface.appendChild(t))}),e.host.addEventListener(`pointermove`,r=>{if(n===null||t===null)return;let i=e.surface.getBoundingClientRect(),a=Math.min(n.x,r.clientX),o=Math.min(n.y,r.clientY),s=Math.abs(r.clientX-n.x),c=Math.abs(r.clientY-n.y);t.style.left=`${a-i.left}px`,t.style.top=`${o-i.top}px`,t.style.width=`${s}px`,t.style.height=`${c}px`;let l=[];e.rows().forEach((e,t)=>{let n=e.getBoundingClientRect();n.right>=a&&n.left<=a+s&&n.bottom>=o&&n.top<=o+c&&l.push(t)}),e.selectPositions(l)});for(let t of[`pointerup`,`pointercancel`,`lostpointercapture`])e.host.addEventListener(t,stop)}const Zt=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&Zt.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends HTMLElement{_listEl;_rows=[];_state=new ListViewState;_factory=defaultListItemFactory;_initialized=!1;static get observedAttributes(){return[`model`,`selection-mode`,`show-separators`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get factory(){return this._factory}set factory(e){this._factory=typeof e==`function`?e:defaultListItemFactory,this._renderRows()}get selected(){return this._state.selection}set selected(e){let t=typeof e==`number`?[e]:e??[];this._state.setSelection(t)}get selectionMode(){return normalizeListSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get singleClickActivate(){return this.hasAttribute(`single-click-activate`)}set singleClickActivate(e){this.toggleAttribute(`single-click-activate`,!!e)}get enableRubberband(){return this.hasAttribute(`enable-rubberband`)}set enableRubberband(e){this.toggleAttribute(`enable-rubberband`,!!e)}get tabBehavior(){return normalizeListTabBehavior$1(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(this._viewClass,`view`),this._listEl=document.createElement(`div`),this._listEl.className=`adw-list-view-rows`,this.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._listEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectionMode(this.selectionMode),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribeSelection(()=>this._onSelectionChanged()),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._rows,select:e=>this._selectRow(e,{})}),attachRubberBand({host:this,surface:this._listEl,enabled:()=>this.enableRubberband&&this._state.selectionMode===`multiple`,rows:()=>this._rows,selectPositions:e=>this._state.setSelection(e,!0)}),this._applyAttributes(),this._renderRows())}attributeChangedCallback(e){if(this._initialized){if(e===`model`){this._state.setModel(parseListModel(this.getAttribute(`model`)));return}e===`selection-mode`&&this._state.setSelectionMode(this.selectionMode),this._applyAttributes(),(e===`selection-mode`||e===`tab-behavior`)&&this._renderRows()}}_applyAttributes(){let e=this.orientation;this.classList.toggle(`separators`,this.showSeparators),this.classList.toggle(`horizontal`,e===`horizontal`);let t=this._state.selectionMode!==`none`;this.setAttribute(`role`,t?`listbox`:`list`),this._state.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}get _viewClass(){return`adw-list-view`}get _rowClass(){return`adw-list-view-row`}_renderRows(){if(this._initialized){this._listEl.replaceChildren(),this._rows=[];for(let e=0;e<this._state.count;e++){let t=this._createRow(e);t!==null&&(this._listEl.appendChild(t),this._rows.push(t))}this._syncSelectedStates()}}_createRow(e){let t=this._state.itemContext(e);if(t===null)return null;let n=document.createElement(`div`);return n.className=`${this._rowClass} activatable`,n.setAttribute(`role`,this._state.selectionMode===`none`?`listitem`:`option`),n.tabIndex=this.tabBehavior===`all`?0:-1,n.appendChild(this._factory(t)),n.addEventListener(`click`,e=>{this._selectRow(n,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),this.singleClickActivate&&this._activateRow(n)}),n.addEventListener(`dblclick`,()=>{this.singleClickActivate||this._activateRow(n)}),n.addEventListener(`pointerenter`,()=>{this.singleClickActivate&&this._selectRow(n,{})}),n.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.key===` `?this._selectRow(n,{modify:e.ctrlKey,extend:e.shiftKey}):this._activateRow(n))}),n}_selectRow(e,t){let n=this._rows.indexOf(e);n<0||this._state.selectItem(n,t)}_activateRow(e){let t=this._rows.indexOf(e);t<0||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{position:t}}))}_onSelectionChanged(){this._syncSelectedStates(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:this._state.selection}}))}_syncSelectedStates(){let e=new Set(this._state.selection),t=this.tabBehavior!==`all`,n=e.size>0?Math.min(...e):0;this._rows.forEach((r,i)=>{let a=e.has(i);r.classList.toggle(`selected`,a),this._state.selectionMode===`none`?r.removeAttribute(`aria-selected`):r.setAttribute(`aria-selected`,String(a)),t&&(r.tabIndex=i===n?0:-1)})}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._rows.splice(e.position,e.removed))t.remove();let t=this._rows[e.position]??null,n=[];for(let r=0;r<e.added;r++){let i=this._createRow(e.position+r);i!==null&&(this._listEl.insertBefore(i,t),n.push(i))}this._rows.splice(e.position,0,...n),this._syncSelectedStates()}};customElements.define(`gtk-list-view`,GtkListView);var GtkColumnView=class extends GtkListView{_headerEl;_columns=[];_factories={};_sorter=null;_dragged=null;static get observedAttributes(){return[`model`,`columns`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`show-row-separators`,`show-column-separators`,`reorderable`]}get columns(){return this._columns.map(e=>({...e}))}set columns(e){this._columns=normalizeColumnViewColumns(e),this._renderHeader(),this._renderRows()}get columnFactories(){return this._factories}set columnFactories(e){this._factories=e??{},this._renderRows()}get sorter(){return this._sorter===null?null:{...this._sorter}}set sorter(e){this._applySorter(e)}get showRowSeparators(){return this.hasAttribute(`show-row-separators`)}set showRowSeparators(e){this.toggleAttribute(`show-row-separators`,!!e)}get showColumnSeparators(){return this.hasAttribute(`show-column-separators`)}set showColumnSeparators(e){this.toggleAttribute(`show-column-separators`,!!e)}get reorderable(){return this.hasAttribute(`reorderable`)}set reorderable(e){this.toggleAttribute(`reorderable`,!!e)}connectedCallback(){let e=this._headerEl===void 0;e&&(this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-column-view-header`,this._headerEl.setAttribute(`role`,`row`)),super.connectedCallback(),e&&this.insertBefore(this._headerEl,this.firstChild),this._renderHeader(),this._renderRows()}attributeChangedCallback(e){if(e===`columns`){this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._renderHeader(),this._renderRows();return}super.attributeChangedCallback(e)}_applyAttributes(){super._applyAttributes(),this.classList.toggle(`separators`,this.showRowSeparators),this.classList.toggle(`column-separators`,this.showColumnSeparators),this.setAttribute(`role`,`grid`),this.removeAttribute(`aria-multiselectable`),this.classList.remove(`horizontal`),this._headerEl!==void 0&&this._applyTracks(this._headerEl)}get _viewClass(){return`adw-column-view`}get _rowClass(){return`adw-column-view-row`}_createRow(e){let t=super._createRow(e);if(t===null)return null;t.setAttribute(`role`,`row`),t.replaceChildren();let n=this._state.itemContext(e);if(n!==null)for(let e of this._columns)e.visible!==!1&&t.appendChild(this._createCell(e,n));return this._applyTracks(t),t}_createCell(e,t){let n=document.createElement(`div`);n.className=`adw-column-view-cell`,n.setAttribute(`role`,`gridcell`);let r=this._factories[e.id??e.key];if(r!==void 0)n.appendChild(r(t));else{let r=document.createElement(`span`);r.className=Xt,r.textContent=listItemField(t.item,e.key),n.appendChild(r)}return n}_renderHeader(){if(this._headerEl!==void 0){this._headerEl.replaceChildren();for(let e of this._columns)e.visible!==!1&&this._headerEl.appendChild(this._createHeaderCell(e));this._applyTracks(this._headerEl)}}_createHeaderCell(e){let t=e.id??e.key,n=document.createElement(`button`);n.type=`button`,n.className=`adw-column-view-header-cell`,n.setAttribute(`role`,`columnheader`),n.dataset.columnId=t;let r=document.createElement(`span`);if(r.className=`adw-column-view-header-title`,r.textContent=e.title??e.key,n.appendChild(r),e.sortable===!0){let r=this._sorter!==null&&this._sorter.column===t,i=createGtkImage(`go-down`,`adw-column-view-sort-indicator`);i.classList.toggle(`ascending`,r&&!this._sorter.descending),i.classList.toggle(`descending`,r&&this._sorter.descending),i.hidden=!r,n.appendChild(i),n.setAttribute(`aria-sort`,r?this._sorter.descending?`descending`:`ascending`:`none`),n.addEventListener(`click`,()=>this._applySorter(columnViewSort(this._sorter,e)))}else n.disabled=!0;return this.reorderable&&this._makeDraggable(n,t),n}_makeDraggable(e,t){e.draggable=!0,e.addEventListener(`dragstart`,e=>{this._dragged=t,e.dataTransfer?.setData(`text/plain`,t)}),e.addEventListener(`dragover`,e=>e.preventDefault()),e.addEventListener(`drop`,e=>{e.preventDefault();let n=this._columns.findIndex(e=>(e.id??e.key)===this._dragged),r=this._columns.findIndex(e=>(e.id??e.key)===t);if(this._dragged=null,n<0||r<0||n===r)return;let i=this._columns.splice(n,1);this._columns.splice(r,0,...i),this._renderHeader(),this._renderRows()})}_applySorter(e){let t=e===null&&this._sorter===null||e!==null&&this._sorter!==null&&e.column===this._sorter.column&&e.descending===this._sorter.descending;this._sorter=e===null?null:{...e},!t&&(this._renderHeader(),this.dispatchEvent(new CustomEvent(`notify::sorter`,{bubbles:!0,detail:{sorter:this.sorter}})))}_applyTracks(e){e.style.gridTemplateColumns=dataGridTrackTemplate(columnViewTracks(this._columns))}};customElements.define(`gtk-column-view`,GtkColumnView);var GtkDropDown=class extends HTMLElement{_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`model`,`selected`,`enable-search`,`disabled`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}get enableSearch(){return this.hasAttribute(`enable-search`)}set enableSearch(e){e?this.setAttribute(`enable-search`,``):this.removeAttribute(`enable-search`)}get active(){return this._popoverEl?.open??!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-drop-down`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-drop-down-button`,this._buttonEl.setAttribute(`aria-haspopup`,`listbox`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-drop-down-label`,this._buttonEl.append(this._labelEl,createGtkImage(`go-down`,`adw-drop-down-arrow`)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._state.count===0||(this._popoverEl.open=!this._popoverEl.open)}),this._buttonEl.addEventListener(`keydown`,e=>this._onButtonKeyDown(e)),this._popoverEl=document.createElement(`gtk-popover`),this._popoverEl.classList.add(`adw-drop-down-popover`),this._popoverEl.setAttribute(`role`,`listbox`),this._popoverEl.setAttribute(`menu`,``),this._listEl=document.createElement(`div`),this._listEl.className=`adw-drop-down-list`,this._popoverEl.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._buttonEl,this._popoverEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`)));let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._popoverEl.addEventListener(`keydown`,e=>this._onPopoverTypeAhead(e)),this._renderAll()}attributeChangedCallback(e,t,n){if(!(!this._initialized||!this._buttonEl))if(e===`model`)this._state.setModel(parseListModel(n));else if(e===`selected`){let e=Number.parseInt(n??``,10);Number.isNaN(e)||this._selectIndex(e,{fromAttr:!0})}else e===`enable-search`?this._renderPopover():e===`disabled`&&(this._buttonEl.disabled=this.hasAttribute(`disabled`),this.hasAttribute(`disabled`)&&this._popoverEl.popdown())}_selectIndex(e,t={}){if(!this._state.hasIndex(e))return;let n=t.fromUser?this._state.select(e):this._state.setSelectedIndex(e);if(this._updateLabel(),this._updateSelectedStates(),!t.fromAttr&&this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),n){let n=this._state.model[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),t.fromUser&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{index:e,value:n?.value??``,label:n?.label??``}}))}}_onPopoverToggled(e){if(this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e)if(this._filter(``),this._searchEl)this._searchEl.value=``,this._searchEl.focus();else{let e=this._visibleItems();(e[this._state.selectedIndex]??e[0])?.focus()}}_onButtonKeyDown(e){this.hasAttribute(`disabled`)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `?(e.preventDefault(),this._state.count>0&&this._popoverEl.popup()):e.key.length===1&&!this._popoverEl.open&&this._typeAhead(e.key))}_onPopoverTypeAhead(e){this._searchEl||e.key.length===1&&this._typeAhead(e.key)}_typeAhead(e){this._typeAheadBuffer+=e.toLowerCase(),this._typeAheadTimer&&clearTimeout(this._typeAheadTimer),this._typeAheadTimer=setTimeout(()=>this._typeAheadBuffer=``,800);let t=this._state.model.findIndex(e=>e.label.toLowerCase().startsWith(this._typeAheadBuffer));t<0||(this._popoverEl.open?this._itemButtons[t]?.focus():this._selectIndex(t,{fromUser:!0}))}_filter(e){let t=e.trim().toLowerCase(),n=this._state.model;this._itemButtons.forEach((e,r)=>{e.hidden=!(t.length===0||(n[r]?.label.toLowerCase().includes(t)??!1))})}_visibleItems(){return this._itemButtons.filter(e=>!e.hidden)}_renderAll(){this._buttonEl.disabled=this.hasAttribute(`disabled`),this.classList.toggle(`disabled`,this.hasAttribute(`disabled`)),this._renderPopover(),this._updateLabel()}_updateLabel(){this._labelEl&&(this._labelEl.textContent=this._state.selectedLabel)}_updateSelectedStates(){this._itemButtons.forEach((e,t)=>{let n=t===this._state.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,String(n))})}_renderPopover(){if(this._listEl.replaceChildren(),this._itemButtons=[],this._searchEl=null,this.enableSearch)this._searchEl=document.createElement(`input`),this._searchEl.type=`text`,this._searchEl.className=`adw-drop-down-search adw-entry`,this._searchEl.placeholder=`Search…`,this._searchEl.setAttribute(`aria-label`,`Search`),this._searchEl.addEventListener(`input`,()=>this._filter(this._searchEl?.value??``)),this._popoverEl.insertBefore(this._searchEl,this._listEl);else{let e=this._popoverEl.querySelector(`.adw-drop-down-search`);e&&e.remove()}for(let e of this._state.model){let t=this._createItem(e);this._listEl.appendChild(t),this._itemButtons.push(t)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}_createItem(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-popover-item adw-drop-down-item`,t.setAttribute(`role`,`option`),t.tabIndex=-1;let n=document.createElement(`span`);n.className=`adw-drop-down-item-label`,n.textContent=e.label;let r=document.createElement(`span`);return r.className=`adw-drop-down-item-check`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r),t.addEventListener(`click`,()=>{let e=this._itemButtons.indexOf(t);e<0||(this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus())}),t}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._itemButtons.splice(e.position,e.removed))t.remove();let t=this._itemButtons[e.position]??null,n=[],r=this._state.model;for(let i=0;i<e.added;i++){let a=r[e.position+i];if(!a)continue;let o=this._createItem(a);this._listEl.insertBefore(o,t),n.push(o)}this._itemButtons.splice(e.position,0,...n),this._updateSelectedStates(),this._updateLabel(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`gtk-drop-down`,GtkDropDown);const Qt=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends HTMLElement{_canvas;_context=null;_initialized=!1;_drawFunc=null;_width=-1;_height=-1;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`content-width`,`content-height`]}get contentWidth(){return intAttribute(this,`content-width`)}set contentWidth(e){this._write(`content-width`,String(glibClamp(Math.trunc(e)||0,0,Qt)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Qt)))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get drawFunc(){return this._drawFunc}set drawFunc(e){this.setDrawFunc(e)}setDrawFunc(e){this._drawFunc=e,this.queueDraw()}queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-drawing-area-canvas`,this._context=this._canvas.getContext(`2d`),this.replaceChildren(this._canvas),this._publishSize(),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}attributeChangedCallback(e){this._initialized&&((e===`content-width`||e===`content-height`)&&this._publishSize(),this._notify(e),(e===`content-width`||e===`content-height`)&&this.queueDraw())}_publishSize(){let e=[[`--adw-drawing-width`,this.contentWidth],[`--adw-drawing-height`,this.contentHeight]];for(let[t,n]of e)n>0?this.style.setProperty(t,`${n}px`):this.style.removeProperty(t)}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._allocated(e?e.inlineSize:t.contentRect.width,e?e.blockSize:t.contentRect.height)}}),this._resize.observe(this))}_allocated(e,t){let n=e!==this._width||t!==this._height;this._width=e,this._height=t,n&&this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:e,height:t}})),this._draw()}_draw(){if(!this._canvas||this._width<0)return;let e=this._width,t=this._height,n=this._devicePixelRatio(),r=Math.round(e*n),i=Math.round(t*n);this._canvas.width!==r&&(this._canvas.width=r),this._canvas.height!==i&&(this._canvas.height=i),this._scale=n;let a=this._context;a&&(a.setTransform(n,0,0,n,0,0),a.clearRect(0,0,e,t),this._drawFunc&&this._drawFunc(this,a,e,t))}_devicePixelRatio(){return typeof globalThis>`u`?1:globalThis.devicePixelRatio||1}_notify(e){let t=e===`content-width`?this.contentWidth:this.contentHeight;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}get allocation(){return{width:this._width,height:this._height}}get pixelScale(){return this._scale}};customElements.define(`gtk-drawing-area`,GtkDrawingArea);const $t=new WeakMap;var V=class GtkDragIcon extends HTMLElement{_pointerX=0;_pointerY=0;_dragging=!1;_onDragOver=null;_onDragEnd=null;_transfer=null;static get observedAttributes(){return[]}static getForDrag(e){let t=e.dataTransfer,n=t===null?void 0:$t.get(t);if(n!==void 0)return n;let r=document.querySelector(`gtk-drag-icon`),i=r instanceof GtkDragIcon&&!r.dragging?r:null,a=i??document.createElement(`gtk-drag-icon`);return i===null&&document.body.appendChild(a),t!==null&&$t.set(t,a),a.beginDrag(e),a}static createWidgetForValue(e){if(typeof e==`string`){let t=document.createElement(`gtk-label`);return t.setAttribute(`label`,e),t}if(e===null)return null;let t=document.createElement(`div`);t.className=`adw-drag-icon-swatch`;let n=e.alpha??1;return t.style.backgroundColor=`rgba(${Math.round(e.red*255)}, ${Math.round(e.green*255)}, ${Math.round(e.blue*255)}, ${n})`,t}get child(){return this.firstElementChild}set child(e){this.child!==e&&(this.replaceChildren(),e!==null&&this.appendChild(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}setChild(e){this.child=e,e!==null&&this._render()}connectedCallback(){this.style.pointerEvents=`none`,this._dragging&&this._observe()}disconnectedCallback(){this._unobserve()}beginDrag(e){let t=e.dataTransfer;if(t!==null)try{let e=document.createElement(`canvas`);e.width=1,e.height=1,t.setDragImage(e,0,0)}catch{}this._pointerX=e.clientX,this._pointerY=e.clientY,this._transfer=t,this._dragging=!0,this._observe(),this._render()}endDrag(){this._dragging=!1,this._transfer=null,this._unobserve(),this.hidden=!0}get dragging(){return this._dragging}_observe(){this._onDragOver===null&&(this._onDragOver=e=>{this._pointerX=e.clientX,this._pointerY=e.clientY,this._render()},this._onDragEnd=e=>{(e.dataTransfer===null||e.dataTransfer===this._transfer)&&this.endDrag()},document.addEventListener(`dragover`,this._onDragOver),document.addEventListener(`dragend`,this._onDragEnd))}_unobserve(){this._onDragOver!==null&&document.removeEventListener(`dragover`,this._onDragOver),this._onDragEnd!==null&&document.removeEventListener(`dragend`,this._onDragEnd),this._onDragOver=null,this._onDragEnd=null}_render(){this.hidden=!this._dragging,this._dragging&&(this.style.left=`0px`,this.style.top=`0px`,this.style.transform=`translate3d(${Math.round(this._pointerX)}px, ${Math.round(this._pointerY)}px, 0)`)}};customElements.define(`gtk-drag-icon`,V);var GtkEditableLabel=class extends HTMLElement{_label;_entry;_initialized=!1;_grace=null;static get observedAttributes(){return[`text`,`editable`,`editing`]}get text(){return this.getAttribute(`text`)??``}set text(e){this.setAttribute(`text`,e??``)}get editable(){let e=this.getAttribute(`editable`);return e===null?!0:e!==`false`}set editable(e){e?this.removeAttribute(`editable`):this.setAttribute(`editable`,`false`)}get editing(){return this.hasAttribute(`editing`)}set editing(e){this.toggleAttribute(`editing`,!!e)}startEditing(){this.editable&&(this.editing=!0)}stopEditing(e=!1){this.editing&&=(e&&this.setAttribute(`text`,this._entry.value),!1)}get entry(){return this._entry}connectedCallback(){this._initialized||(this._initialized=!0,this._label=document.createElement(`span`),this._label.className=`adw-editable-label-label`,this._label.addEventListener(`click`,()=>this.startEditing()),this._entry=document.createElement(`input`),this._entry.className=`adw-editable-label-entry`,this._entry.type=`text`,this._entry.tabIndex=-1,this._entry.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),this.stopEditing(!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.stopEditing(!1))}),this.replaceChildren(this._label,this._entry),this.addEventListener(`keydown`,e=>{this.editing||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),this.startEditing())}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||(this._grace!==null&&clearTimeout(this._grace),this._grace=setTimeout(()=>{this._grace=null,this.editing&&this.stopEditing(!0)},100))}),this._render())}disconnectedCallback(){this._grace!==null&&clearTimeout(this._grace),this._grace=null}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`text`:this.editing||this._render();break;case`editable`:n===`false`&&this.stopEditing(!1);break;case`editing`:this._render(),this.editing?this._entry.focus():this.focus(),this.dispatchEvent(new CustomEvent(`notify::editing`,{bubbles:!0,detail:{editing:this.editing}}));break}}_render(){let e=this.editing;this.classList.toggle(`editing`,e),this._label.hidden=e,this._entry.hidden=!e,this._label.textContent=this.text,this._entry.value=this.text,e?this.removeAttribute(`tabindex`):this.setAttribute(`tabindex`,`0`)}};customElements.define(`gtk-editable-label`,GtkEditableLabel);function row(e,t,n=``){return{text:e,name:t,keywords:n===``?[]:n.split(` `)}}const H=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>H.includes(e))}const en=[row(`😀`,`grinning face`,`smile happy joy grin`),row(`😃`,`grinning face with big eyes`,`smile happy joy`),row(`😄`,`grinning face with smiling eyes`,`smile happy joy`),row(`😁`,`beaming face with smiling eyes`,`smile happy`),row(`😂`,`face with tears of joy`,`laugh joy cry`),row(`🤣`,`rolling on the floor laughing`,`laugh rofl joy`),row(`🙂`,`slightly smiling face`,`smile`),row(`😉`,`winking face`,`wink joke flirt`),row(`😊`,`smiling face with smiling eyes`,`blush happy`),row(`😇`,`smiling face with halo`,`angel innocent`),row(`🥰`,`smiling face with hearts`,`love affection`),row(`😍`,`smiling face with heart-eyes`,`love crush`),row(`😘`,`face blowing a kiss`,`kiss love`),row(`😗`,`kissing face`,`kiss love`),row(`☺️`,`smiling face`,`smile happy`),row(`😋`,`face savoring food`,`yum delicious tasty`),row(`😛`,`face with tongue`,`tongue silly`),row(`🤪`,`zany face`,`crazy goofy wild`),row(`😟`,`worried face`,`worried sad`),row(`🙁`,`slightly frowning face`,`sad frown`),row(`☹️`,`frowning face`,`sad frown`),row(`😮`,`face with open mouth`,`surprised wow`),row(`😲`,`astonished face`,`surprised wow`),row(`😳`,`flushed face`,`blush embarrassed`),row(`🥺`,`pleading face`,`please puppy`),row(`😦`,`frowning face with open mouth`,`frown disappointed`),row(`😨`,`fearful face`,`fear scared`),row(`😰`,`anxious face with sweat`,`nervous anxious`),row(`😢`,`crying face`,`cry sad tear`),row(`😭`,`loudly crying face`,`cry sad sob`),row(`😶`,`face without mouth`,`silent speechless`),row(`😏`,`smirking face`,`smirk`),row(`😒`,`unamused face`,`meh unhappy`),row(`🙄`,`face with rolling eyes`,`eyeroll annoyed`),row(`😬`,`grimacing face`,`grimace awkward`),row(`🤥`,`lying face`,`liar pinocchio`),row(`😎`,`smiling face with sunglasses`,`cool sunglasses`),row(`🤓`,`nerd face`,`nerd geek glasses`),row(`🧐`,`face with monocle`,`fancy monocle`),row(`🧑`,`person`,`adult human`),row(`👨`,`man`,`adult male`),row(`👩`,`woman`,`adult female`),row(`👧`,`girl`,`child female`),row(`👦`,`boy`,`child male`),row(`👶`,`baby`,`child infant`),row(`👶🏻`,`child: light skin tone`,`child skin tone`),row(`🧑‍💻`,`technologist`,`coder computer`),row(`👷`,`construction worker`,`builder work`),row(`🕵️`,`detective`,`spy sleuth`),row(`🤴`,`prince`,`crown royal`),row(`👸`,`princess`,`crown royal`),row(`👰`,`person with veil`,`bride wedding`),row(`🤵`,`person in tuxedo`,`formal groom`),row(`🎅`,`Santa Claus`,`christmas santa`),row(`🤶`,`Mrs. Claus`,`christmas santa`),row(`🦸`,`superhero`,`hero power`),row(`🦹`,`supervillain`,`villain power`),row(`🧙`,`mage`,`wizard magic`),row(`🧚`,`fairy`,`magic wings`),row(`🧛`,`vampire`,`dracula horror`),row(`🧜`,`merperson`,`mermaid merman`),row(`🧝`,`elf`,`fantasy pointy`),row(`🧟`,`zombie`,`undead horror`),row(`💆`,`person getting massage`,`spa head`),row(`💇`,`person getting haircut`,`barber salon`),row(`🚶`,`person walking`,`walk pedestrian`),row(`🏃`,`person running`,`run marathon`),row(`💃`,`woman dancing`,`dance ballet`),row(`👪`,`family`,`parents child`),row(`🧑‍🤝‍🧑`,`people holding hands`,`family couple`)],tn=[row(`👋`,`waving hand`,`wave hello goodbye`),row(`✋️`,`raised hand`,`stop highfive`),row(`👍`,`thumbs up`,`like yes approve`),row(`👎`,`thumbs down`,`dislike no`),row(`👌`,`OK hand`,`ok perfect`),row(`👏`,`clapping hands`,`applause praise`),row(`👐`,`open hands`,`hug open`),row(`🙌`,`raising hands`,`celebrate praise`),row(`🙏`,`folded hands`,`pray thanks`),row(`🤝`,`handshake`,`deal agreement`),row(`🤘`,`sign of the horns`,`rock metal`),row(`👈`,`backhand index pointing left`,`point direction`),row(`👉`,`backhand index pointing right`,`point direction`),row(`☝️`,`index pointing up`,`point one`),row(`✍️`,`writing hand`,`write pen`),row(`🤞`,`crossed fingers`,`luck hope`),row(`💪`,`flexed biceps`,`muscle strong`),row(`🧠`,`brain`,`mind smart`),row(`👀`,`eyes`,`look see watch`),row(`🧣`,`ear`,`hear listen`),row(`👃`,`nose`,`smell`),row(`🦰`,`red hair`,`ginger hair`),row(`🛀`,`bathing`,`bath shower`),row(`🛍`,`shower`,`bath clean`),row(`🦽`,`probing cane`,`blind accessibility`),row(`🦼`,`motorized wheelchair`,`accessibility`),row(`🦯`,`person with white cane`,`blind accessibility`),row(`🏋️`,`weight lifting`,`gym sport`),row(`👫`,`woman and man holding hands`,`couple family`),row(`👬`,`men holding hands`,`couple`),row(`👭`,`women holding hands`,`couple`),row(`💏`,`kiss`,`love couple`),row(`💑`,`couple with heart`,`love wedding`),row(`👮`,`police officer`,`cop law`),row(`👷`,`person with skullcap`,`worker`),row(`🥷`,`ninja`,`martialarts`),row(`🧗`,`person climbing`,`sport`),row(`🤸`,`person cartwheeling`,`gymnastics`),row(`🤼`,`people wrestling`,`sport wrestle`),row(`👯`,`people with bunny ears`,`costume`),row(`🧕`,`woman with headscarf`,`hijab clothing`),row(`👞`,`man’s shoe`,`clothing`),row(`👕`,`t-shirt`,`clothing shirt`),row(`👖`,`jeans`,`clothing trousers`),row(`👔`,`necktie`,`clothing formal`),row(`👗`,`dress`,`clothing`),row(`👘`,`kimono`,`clothing`),row(`🥻`,`sari`,`clothing`),row(`👙`,`bikini`,`clothing swimsuit`),row(`👚`,`woman’s clothes`,`clothing dress`),row(`🩱`,`one-piece swimsuit`,`clothing swimsuit`),row(`👑`,`woman’s hat`,`clothing`),row(`👒`,`glasses`,`clothing eyewear`),row(`🎩`,`top hat`,`clothing`),row(`🎓`,`graduation cap`,`clothing education`),row(`🧢`,`billed cap`,`clothing hat`),row(`👜`,`running shoe`,`clothing sneaker`),row(`👡`,`woman’s heel`,`clothing shoe`),row(`🛠️`,`hammer and wrench`,`tool repair`)],nn=[row(`🐒`,`monkey`,`animal primate`),row(`🦍`,`gorilla`,`animal ape`),row(`🐕`,`dog`,`animal pet`),row(`🐶`,`dog face`,`animal pet`),row(`🐩`,`poodle`,`dog animal`),row(`🐺`,`wolf`,`animal`),row(`🦊`,`fox`,`animal`),row(`🐱`,`cat face`,`animal pet`),row(`🦁`,`lion`,`animal cat`),row(`🐯`,`tiger face`,`animal cat`),row(`🐅`,`tiger`,`animal`),row(`🐆`,`leopard`,`animal cat`),row(`🐴`,`horse face`,`animal`),row(`🦄`,`unicorn`,`animal fantasy`),row(`ᾬ`,`unicorn face`,`animal fantasy`),row(`🦓`,`zebra`,`animal`),row(`🦌`,`deer`,`animal`),row(`🐮`,`cow face`,`animal`),row(`🐷`,`pig face`,`animal`),row(`🐪`,`camel`,`animal desert`),row(`🦒`,`giraffe`,`animal`),row(`🐘`,`elephant`,`animal`),row(`🦛`,`rhinoceros`,`animal`),row(`🐰`,`rabbit face`,`animal pet`),row(`🐻`,`bear`,`animal`),row(`🐨`,`koala`,`animal`),row(`🐼`,`panda`,`animal`),row(`🦥`,`sloth`,`animal`),row(`🦦`,`otter`,`animal`),row(`🦘`,`kangaroo`,`animal`),row(`🐔`,`chicken`,`bird animal`),row(`🐧`,`penguin`,`bird animal`),row(`🦆`,`duck`,`bird animal`),row(`🦉`,`owl`,`bird animal`),row(`🐸`,`frog`,`animal`),row(`🐢`,`turtle`,`animal reptile`),row(`🐍`,`snake`,`animal reptile`),row(`🐳`,`dragon face`,`animal fantasy`),row(`🦖`,`T-Rex`,`animal dinosaur`),row(`🐬`,`dolphin`,`animal sea`),row(`🦈`,`shark`,`animal sea`),row(`🐙`,`octopus`,`animal sea`),row(`🐛`,`bug`,`animal insect`),row(`🦋`,`butterfly`,`animal insect`),row(`🕷️`,`spider`,`animal insect`),row(`🌸`,`cherry blossom`,`flower spring`),row(`🌺`,`hibiscus`,`flower`),row(`🌻`,`sunflower`,`flower sun`),row(`🌷`,`tulip`,`flower`),row(`🌱`,`seedling`,`plant nature`),row(`🌲`,`evergreen tree`,`plant nature`),row(`🌳`,`deciduous tree`,`plant nature`),row(`🌴`,`palm tree`,`plant nature`),row(`🌵`,`cactus`,`plant`),row(`🍀`,`four leaf clover`,`plant luck`),row(`🍁`,`maple leaf`,`plant autumn`),row(`🍂`,`fallen leaf`,`plant autumn`),row(`🍃`,`leaf fluttering in wind`,`plant wind`)],rn=[row(`🍇`,`grapes`,`fruit`),row(`🍈`,`melon`,`fruit`),row(`🍉`,`watermelon`,`fruit`),row(`🍊`,`tangerine`,`fruit citrus`),row(`🍋`,`lemon`,`fruit citrus`),row(`🍌`,`banana`,`fruit`),row(`🍍`,`pineapple`,`fruit`),row(`🍎`,`red apple`,`fruit`),row(`🍐`,`pear`,`fruit`),row(`🍑`,`peach`,`fruit`),row(`🍒`,`cherries`,`fruit`),row(`🍓`,`strawberry`,`fruit`),row(`🥝`,`kiwi fruit`,`fruit`),row(`🍏`,`tomato`,`fruit vegetable`),row(`🥐`,`croissant`,`food bread`),row(`🥖`,`flatbread`,`food bread`),row(`🥨`,`pretzel`,`food`),row(`🥯`,`bagel`,`food bread`),row(`🥞`,`pancakes`,`food breakfast`),row(`🧀`,`cheese wedge`,`food dairy`),row(`🍖`,`meat on bone`,`food`),row(`🍗`,`poultry leg`,`food chicken`),row(`🥩`,`cut of meat`,`food`),row(`🥓`,`bacon`,`food`),row(`🍔`,`hamburger`,`food`),row(`🍟`,`french fries`,`food`),row(`🍕`,`pizza`,`food`),row(`🌭`,`hot dog`,`food`),row(`🥪`,`sandwich`,`food lunch`),row(`🌮`,`taco`,`food`),row(`🌯`,`burrito`,`food`),row(`🥗`,`green salad`,`food vegetable`),row(`🍿`,`popcorn`,`food snack`),row(`🍣`,`sushi`,`food japanese`),row(`🍤`,`fish cake with swirl`,`food`),row(`🍥`,`soft ice cream`,`food dessert`),row(`🍦`,`soft serve`,`food dessert`),row(`🍨`,`ice cream`,`food dessert`),row(`🎂`,`birthday cake`,`food dessert`),row(`🧁`,`cupcake`,`food dessert`),row(`🥧`,`pie`,`food dessert`),row(`🍫`,`chocolate bar`,`food dessert`),row(`🍬`,`candy`,`food sweet`),row(`🍭`,`lollipop`,`food sweet`),row(`☕`,`hot beverage`,`drink coffee tea`),row(`🫖`,`teapot`,`drink tea`),row(`🍶`,`teacup without handle`,`drink tea`),row(`🍷`,`wine glass`,`drink`),row(`🍸`,`cocktail glass`,`drink`),row(`🍺`,`beer mug`,`drink`),row(`🥂`,`clinking glasses`,`drink cheers`),row(`🥢`,`chopsticks`,`food utensil`),row(`🍴`,`fork and knife`,`food utensil`),row(`🥄`,`spoon`,`food utensil`)],an=[row(`🌍`,`globe showing Europe-Africa`,`world earth`),row(`🌎`,`globe showing Americas`,`world earth`),row(`🌏`,`globe showing Asia-Australia`,`world earth`),row(`🗺️`,`world map`,`map`),row(`⛰️`,`mountain`,`travel nature`),row(`🌋`,`volcano`,`travel nature`),row(`🏕️`,`camping`,`travel nature`),row(`🏖️`,`beach with umbrella`,`travel sea`),row(`🏜`,`desert`,`travel nature`),row(`🏝️`,`desert island`,`travel sea`),row(`🏞️`,`national park`,`travel nature`),row(`🏟️`,`stadium`,`travel sport`),row(`🏛️`,`classical building`,`travel`),row(`🏗️`,`buildings`,`travel`),row(`🏠`,`house`,`home building`),row(`🏡`,`house with garden`,`home`),row(`🏢`,`office building`,`work`),row(`🏤`,`post office`,`building`),row(`🏥`,`hospital`,`building health`),row(`🏨`,`hotel`,`travel building`),row(`🏪`,`convenience store`,`building shop`),row(`🏫`,`school`,`building education`),row(`🏯`,`castle`,`building`),row(`⛪`,`church`,`building religion`),row(`⛩️`,`shinto torii gate`,`japan`),row(`🛑`,`fountain`,`building`),row(`🗼️`,`tower`,`building`),row(`🗽`,`Statue of Liberty`,`travel usa`),row(`🗛️`,`Mount Rushmore`,`travel usa`),row(`🧲`,`carousel horse`,`travel fair`),row(`🚀`,`rocket`,`travel space`),row(`🛸`,`flying saucer`,`travel space`),row(`🛎️`,`bellhop bell`,`travel hotel`),row(`🧳`,`luggage`,`travel`),row(`🧭`,`compass`,`travel navigate`),row(`⌛️`,`hourglass done`,`time`),row(`⏰`,`alarm clock`,`time`),row(`🚂`,`locomotive`,`travel train`),row(`🚆`,`train`,`travel`),row(`🚇`,`metro`,`travel subway`),row(`🚉`,`station`,`travel`),row(`🚌`,`bus`,`travel`),row(`🚑`,`ambulance`,`emergency`),row(`🚓`,`police car`,`emergency`),row(`🚕`,`taxi`,`travel`),row(`🚗`,`automobile`,`travel car`),row(`🚙`,`sport utility vehicle`,`car`),row(`🚲`,`bicycle`,`vehicle`),row(`🛴`,`kick scooter`,`vehicle`),row(`⛺`,`tent`,`travel camping`)],on=[row(`🎃`,`jack-o-lantern`,`halloween pumpkin`),row(`🎄`,`Christmas tree`,`christmas`),row(`🎆`,`fireworks`,`celebration`),row(`✨`,`sparkles`,`celebration magic`),row(`🎈`,`balloon`,`party`),row(`🎉`,`party popper`,`party celebration`),row(`🎊`,`confetti ball`,`party`),row(`🎁`,`wrapped gift`,`present birthday`),row(`🎗️`,`reminder ribbon`,`awareness`),row(`🎫`,`ticket`,`event`),row(`🏆`,`trophy`,`award win`),row(`🥇`,`1st place medal`,`award win`),row(`🎾`,`tennis`,`sport`),row(`🏈`,`American football`,`sport`),row(`🏑`,`field hockey`,`sport`),row(`🏒`,`ice hockey`,`sport`),row(`🎳`,`bowling`,`sport`),row(`🏐`,`volleyball`,`sport`),row(`🥎`,`lacrosse`,`sport`),row(`⚽`,`soccer ball`,`sport football`),row(`⚾`,`baseball`,`sport`),row(`🏊`,`swimming`,`sport`),row(`🎿`,`skis`,`sport winter`),row(`⛷️`,`skier`,`sport winter`),row(`🛹`,`skateboard`,`sport`),row(`🎽`,`running shirt`,`sport`),row(`🎯`,`bullseye`,`sport game target`),row(`🎱`,`pool 8 ball`,`game`),row(`🎲`,`game die`,`game dice`),row(`🃏`,`joker`,`game cards`),row(`🕹️`,`joystick`,`game`),row(`🎮`,`video game`,`game`),row(`🧩`,`puzzle piece`,`game`),row(`🧸`,`teddy bear`,`toy`),row(`🪅`,`pinata`,`toy party`),row(`🪆`,`nesting dolls`,`toy`),row(`🎭`,`performing arts`,`theatre`),row(`🎼`,`musical score`,`music`),row(`🎤`,`microphone`,`music sing`),row(`🎧`,`headphones`,`music listen`),row(`🎸`,`guitar`,`music`),row(`🥁`,`drum`,`music`),row(`🎨`,`artist palette`,`art paint`),row(`🖌️`,`paintbrush`,`art paint`),row(`🧵`,`thread`,`sew`),row(`🪡`,`sewing needle`,`sew`)],sn=[row(`🧱`,`brick`,`object build`),row(`🪑`,`shovel`,`object tool`),row(`🪩`,`mirror ball`,`object`),row(`🧯`,`fire extinguisher`,`object safety`),row(`🛠️`,`hammer and wrench`,`tool`),row(`⚒️`,`hammer and pick`,`tool`),row(`🔧`,`wrench`,`tool`),row(`🪛`,`screwdriver`,`tool`),row(`⚙️`,`gear`,`tool cog`),row(`🗜️`,`clamp`,`tool`),row(`🔒`,`locked with key`,`object security`),row(`🔓`,`unlocked`,`object security`),row(`🔑`,`key`,`object`),row(`🗝️`,`old key`,`object`),row(`🔨`,`hammer`,`tool`),row(`🔫`,`water pistol`,`object toy`),row(`🪓`,`carpentry saw`,`tool`),row(`💡`,`light bulb`,`object idea`),row(`🔦`,`flashlight`,`object`),row(`🔬`,`microscope`,`object lab`),row(`🔭`,`telescope`,`object`),row(`💻`,`laptop`,`object computer`),row(`🖥️`,`desktop computer`,`object computer`),row(`🖨️`,`printer`,`object office`),row(`⌨️`,`keyboard`,`object computer`),row(`🖱️`,`computer mouse`,`object computer`),row(`💾`,`floppy disk`,`object`),row(`📚`,`books`,`object reading`),row(`📓`,`notebook`,`object writing`),row(`📊`,`bar chart`,`object data`),row(`📋`,`clipboard`,`object office`),row(`📌`,`pushpin`,`object office`),row(`📎`,`paperclip`,`object office`),row(`📏`,`straight ruler`,`object office`),row(`✂️`,`scissors`,`object office`),row(`🗑️`,`card file box`,`object office`),row(`🗒️`,`file cabinet`,`object office`),row(`🗓️`,`wastebasket`,`object office`),row(`🧼`,`window`,`object house`),row(`🛙`,`elevator`,`object building`),row(`🛝`,`radio`,`object`),row(`🛞`,`video camera`,`object record`),row(`⚯`,`white flag`,`object surrender`)],cn=[row(`🔠`,`input latin letters`,`symbol text`),row(`🔡`,`lowercase`,`symbol text`),row(`🔢`,`uppercase`,`symbol text`),row(`🅰️`,`A button`,`symbol letter`),row(`🆎`,`AB button`,`symbol letters`),row(`🆑️`,`CL button`,`symbol`),row(`🆒️`,`COOL button`,`symbol`),row(`🆓️`,`FREE button`,`symbol`),row(`🆔️`,`ID button`,`symbol`),row(`🆕️`,`NEW button`,`symbol`),row(`🆖️`,`OK button`,`symbol`),row(`🆗️`,`SOS button`,`symbol`),row(`🆘️`,`VS button`,`symbol`),row(`🆙️`,`UP button`,`symbol`),row(`🔴`,`red circle`,`symbol shape`),row(`🟠`,`orange circle`,`symbol shape`),row(`🟡`,`yellow circle`,`symbol shape`),row(`🟢`,`green circle`,`symbol shape`),row(`🔵`,`blue circle`,`symbol shape`),row(`🟣`,`purple circle`,`symbol shape`),row(`⚪`,`black circle`,`symbol shape`),row(`⚫`,`white circle`,`symbol shape`),row(`🟧`,`red square`,`symbol shape`),row(`🟨`,`yellow square`,`symbol shape`),row(`🟩`,`green square`,`symbol shape`),row(`🟦`,`blue square`,`symbol shape`),row(`🟪`,`purple square`,`symbol shape`),row(`⬛`,`black large square`,`symbol shape`),row(`⬜`,`white large square`,`symbol shape`),row(`🔶`,`large orange diamond`,`symbol shape`),row(`🔷`,`large blue diamond`,`symbol shape`),row(`🔺`,`red triangle pointed up`,`symbol shape`),row(`🔻`,`red triangle pointed down`,`symbol shape`),row(`▶️`,`black right-pointing triangle`,`symbol shape`),row(`◀️`,`black left-pointing triangle`,`symbol shape`),row(`▲️`,`black up-pointing triangle`,`symbol shape`),row(`▼️`,`black down-pointing triangle`,`symbol shape`),row(`❓`,`red question mark`,`symbol`),row(`❗`,`red exclamation mark`,`symbol`),row(`⁉️`,`red exclamation question mark`,`symbol`),row(`💤`,`zzz`,`symbol sleep`),row(`♻`,`recycling symbol`,`symbol green`),row(`☮`,`information`,`symbol info`),row(`⚠️`,`warning`,`symbol caution`),row(`✔️`,`check mark button`,`symbol done yes`),row(`✖️`,`multiply`,`symbol no`),row(`➕`,`plus`,`symbol math`),row(`➖`,`minus`,`symbol math`),row(`➗`,`divide`,`symbol math`),row(`🚫`,`prohibited`,`symbol no`),row(`🚳`,`no bicycles`,`symbol no`),row(`🚭`,`no smoking`,`symbol no`),row(`🚯`,`no littering`,`symbol no`),row(`🚱`,`non-potable water`,`symbol no`),row(`🔞`,`no one under eighteen`,`symbol age`),row(`🏁`,`chequered flag`,`symbol sport`),row(`🚩`,`triangular flag`,`symbol`),row(`🎌`,`crossed flags`,`symbol`),row(`🏴`,`black flag`,`symbol`),row(`🏳️`,`white flag`,`symbol surrender`),row(`🏳‍🌈`,`rainbow flag`,`symbol pride`)],ln=[row(`🇦🇨`,`flag: Bolivia`,`flag country`),row(`🇧🇷`,`flag: Brazil`,`flag country`),row(`🇩🇪`,`flag: Germany`,`flag country deutschland`),row(`🇫🇷`,`flag: France`,`flag country`),row(`🇮🇳`,`flag: United Kingdom`,`flag country britain uk`),row(`🇯🇵`,`flag: Japan`,`flag country japan`),row(`🇳🇱`,`flag: United States`,`flag country usa`),row(`🇸🇪`,`flag: Sweden`,`flag country`),row(`🇸🇰`,`flag: Denmark`,`flag country`),row(`🇹🇷`,`flag: Turkey`,`flag country`),row(`🇺🇸`,`flag: Spain`,`flag country`)],U=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:en},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:tn},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:nn},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:rn},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:an},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:on},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:sn},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:cn},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:ln}];[...U.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:U.find(t=>t.id===e)?.tooltip??``}var GtkEmojiChooser=class extends GtkPopover{_built=!1;_entry;_listEl;_emptyEl;_sections=new Map;_entryOf=new WeakMap;_recent=[];_ctrl=!1;connectedCallback(){if(super.connectedCallback(),this._built)return;this._built=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`);let e=document.createElement(`div`);e.className=`emoji-picker-root`,e.appendChild(this._buildSearchbar()),this._listEl=document.createElement(`div`),this._listEl.className=`emoji-list`,this._emptyEl=this._buildEmptyPage();let t=document.createElement(`div`);t.className=`emoji-stack`,t.append(this._listEl,this._emptyEl),e.appendChild(t),this.replaceChildren(e);let n=document.createElement(`div`);n.className=`emoji-flowbox emoji-recent-box`,n.dataset.section=`recent`,this._listEl.appendChild(n),this._sections.set(`recent`,{id:`recent`,heading:null,box:n,button:null,empty:!0}),this._buildSections(),this._buildToolbar(e),this._renderRecents(),this._listEl.addEventListener(`scroll`,()=>this._markSection(this._currentSection())),this.addEventListener(`keydown`,e=>this._ctrl=e.ctrlKey),this.addEventListener(`keyup`,e=>this._ctrl=e.ctrlKey),this.subscribe(e=>{e&&(this._entry.value=``,this._filter(),this._listEl.scrollTop=0,this._markSection(`recent`))}),this._markSection(`recent`)}get recentEmoji(){return[...this._recent]}pick(e,t=!1){this._activate(e,null,t)}_buildSearchbar(){let e=document.createElement(`div`);e.className=`emoji-searchbar`;let t=createGtkImage(`edit-find`,`emoji-search-icon`);return this._entry=document.createElement(`input`),this._entry.type=`search`,this._entry.className=`emoji-search-entry`,this._entry.placeholder=`Search emoji`,this._entry.setAttribute(`aria-label`,`Search emoji`),this._entry.addEventListener(`input`,()=>this._filter()),this._entry.addEventListener(`keydown`,e=>{if(e.key===`Enter`){e.preventDefault(),this._activateFirstResult();return}e.ctrlKey&&(e.key===`n`||e.key===`p`)&&(e.preventDefault(),this._scrollSection(e.key===`n`?1:-1))}),e.append(t,this._entry),e}_buildEmptyPage(){let e=document.createElement(`div`);e.className=`emoji-empty`,e.hidden=!0,e.appendChild(createGtkImage(`edit-find`,`emoji-empty-icon`));let t=document.createElement(`div`);t.className=`emoji-empty-title`,t.textContent=`No Results Found`;let n=document.createElement(`div`);return n.className=`emoji-empty-hint`,n.textContent=`Try a different search`,e.append(t,n),e}_buildSections(){for(let e of U){let t=document.createElement(`div`);t.className=`emoji-heading`,t.textContent=e.heading;let n=document.createElement(`div`);n.className=`emoji-flowbox`,n.dataset.section=e.id;for(let t of e.entries)n.appendChild(this._emojiButton(t));this._listEl.append(t,n),this._sections.set(e.id,{id:e.id,heading:t,box:n,button:null,empty:!0})}}_buildToolbar(e){let t=document.createElement(`div`);t.className=`emoji-toolbar`;let n=[[`recent`,this._sectionButton(`recent`,createGtkImage(`emoji-recent`,`emoji-section-icon`),emojiTooltip(`recent`))],[`people`,this._sectionButton(`people`,createGtkImage(`emoji-people`,`emoji-section-icon`),emojiTooltip(`people`))],[`body`,this._sectionButton(`body`,createGtkImage(`emoji-body`,`emoji-section-icon`),emojiTooltip(`body`))],[`nature`,this._sectionButton(`nature`,createGtkImage(`emoji-nature`,`emoji-section-icon`),emojiTooltip(`nature`))],[`food`,this._sectionButton(`food`,createGtkImage(`emoji-food`,`emoji-section-icon`),emojiTooltip(`food`))],[`travel`,this._sectionButton(`travel`,createGtkImage(`emoji-travel`,`emoji-section-icon`),emojiTooltip(`travel`))],[`activities`,this._sectionButton(`activities`,createGtkImage(`emoji-activities`,`emoji-section-icon`),emojiTooltip(`activities`))],[`objects`,this._sectionButton(`objects`,createGtkImage(`emoji-objects`,`emoji-section-icon`),emojiTooltip(`objects`))],[`symbols`,this._sectionButton(`symbols`,createGtkImage(`emoji-symbols`,`emoji-section-icon`),emojiTooltip(`symbols`))],[`flags`,this._sectionButton(`flags`,createGtkImage(`emoji-flags`,`emoji-section-icon`),emojiTooltip(`flags`))]];for(let[e,t]of n){t.addEventListener(`click`,()=>this._scrollTo(e));let n=this._sections.get(e);n!==void 0&&this._sections.set(e,{...n,button:t})}t.append(...n.map(([,e])=>e)),e.appendChild(t)}_sectionButton(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`emoji-section`,r.dataset.section=e,r.title=n,r.setAttribute(`aria-label`,n),r.appendChild(t),r}_emojiButton(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`emoji`,t.textContent=e.text,t.title=e.name,t.setAttribute(`aria-label`,e.name),this._entryOf.set(t,e),t.addEventListener(`click`,n=>{if(this._closeVariations(),n.detail>1&&hasVariations(e)){this._showVariations(e,t);return}this._activate(e,t)}),t}_matches(e,t){if(t.length===0)return!0;let n=`${e.name} ${e.keywords.join(` `)}`.toLowerCase().split(/\s+/);return t.every(e=>n.some(t=>t.startsWith(e)))}_filter(){let e=this._entry.value.toLowerCase().split(/\s+/).filter(e=>e.length>0);for(let t of this._sections.values()){let n=0;for(let r of t.box.querySelectorAll(`.emoji`)){let t=this._entryOf.get(r),i=t!==void 0&&this._matches(t,e);r.hidden=!i,i&&(n+=1)}t.empty=n===0,t.heading!==null&&(t.heading.hidden=t.empty),t.id!==`recent`&&(t.box.hidden=t.empty)}let t=[...this._sections.values()].every(e=>e.empty);this._listEl.hidden=t,this._emptyEl.hidden=!t,this._markSection(this._currentSection())}_activate(e,t,n=!1){!n&&t?.parentElement?.dataset.section!==`recent`&&this._remember(e),this.dispatchEvent(new CustomEvent(`emoji-picked`,{bubbles:!0,detail:{text:e.text}})),this._ctrl||this.popdown()}_remember(e){this._recent=[e,...this._recent.filter(t=>t.text!==e.text)].slice(0,21),this._renderRecents()}_renderRecents(){let e=this._sections.get(`recent`);if(e===void 0)return;e.box.replaceChildren(...this._recent.map(e=>this._emojiButton(e)));let t=this._recent.length===0;e.box.hidden=t,e.empty=t,e.button!==null&&(e.button.disabled=t)}_showVariations(e,t){this._closeVariations();let n=document.createElement(`div`);n.className=`emoji-variations`;let r=document.createElement(`div`);r.className=`emoji-variations-row`;let i=[...e.text].filter(e=>!H.includes(e)).join(``);for(let t of[i,...H.map(e=>i+e)]){let n=document.createElement(`button`);n.type=`button`,n.className=`emoji`,n.textContent=t,n.addEventListener(`click`,r=>{r.stopPropagation(),this._closeVariations(),this._activate({...e,text:t},n)}),r.appendChild(n)}n.appendChild(r),t.insertAdjacentElement(`afterend`,n)}_closeVariations(){for(let e of this.querySelectorAll(`.emoji-variations`))e.remove()}_scrollTo(e){let t=this._sections.get(e);if(t===void 0||t.empty)return;let n=t.heading??t.box;this._listEl.scrollTo({top:n.offsetTop-6,behavior:`smooth`}),this._markSection(e)}_scrollSection(e){let t=[...this._sections.values()].filter(e=>!e.empty);if(t.length===0)return;let n=t.findIndex(e=>e.id===this._currentSection()),r=t[Math.min(Math.max((n<0?0:n)+e,0),t.length-1)];this._scrollTo(r.id)}_activateFirstResult(){for(let e of this._sections.values()){if(e.empty)continue;let t=[...e.box.querySelectorAll(`.emoji`)].find(e=>!e.hidden);if(t!==void 0){this._activate(this._entryOf.get(t)??{text:t.textContent??``,name:``,keywords:[]},t);return}}}_sectionAt(e){let t=`recent`;for(let n of this._sections.values())if(!(n.empty||n.box.hidden)){if(e<(n.heading??n.box).offsetTop-6)break;t=n.id}return t}_currentSection(){return this._sectionAt(this._listEl.scrollTop)}_markSection(e){for(let t of this._sections.values())t.button?.classList.toggle(`checked`,t.id===e)}};customElements.define(`gtk-emoji-chooser`,GtkEmojiChooser);var GtkEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`value`,`placeholder-text`,`placeholder`,`width-request`,`type`,`disabled`,`maxlength`]}get value(){return this._input?this._input.value:this.getAttribute(`value`)??``}set value(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`value`,t)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(x,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get textLength(){return entryTextLength(this.value)}placeholderAttribute(){return this.getAttribute(`placeholder-text`)??this.getAttribute(`placeholder`)??``}applyWidthRequest(){let e=Number(this.getAttribute(`width-request`)??-1);this.style.minWidth=Number.isFinite(e)&&e>0?`${e}px`:``}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.maxLength=Number(this.getAttribute(`maxlength`)??0);let e=document.createElement(`input`);e.className=`adw-entry`,e.type=this.getAttribute(`type`)||`text`,e.value=clampEntryText(this.getAttribute(`value`)??``,this._maxLength),e.placeholder=this.placeholderAttribute(),this.applyWidthRequest(),e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t)}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this.replaceChildren(e)}disconnectedCallback(){}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}if(e===`width-request`){this.applyWidthRequest();return}this._input&&(e===`value`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`||e===`placeholder`?this._input.placeholder=this.placeholderAttribute():e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`gtk-entry`,GtkEntry);const un={left:`start`,right:`end`,center:`center`,fill:`justify`},dn=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends HTMLElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...dn]}get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e??``)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get justify(){return normalizeLabelJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get xalign(){return normalizeLabelXalign$1(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeLabelYalign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get wrapMode(){return normalizeLabelWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get ellipsize(){return normalizeLabelEllipsize(this.getAttribute(`ellipsize`))}set ellipsize(e){this.setAttribute(`ellipsize`,e)}get lines(){return normalizeLabelLines(this.getAttribute(`lines`))}set lines(e){this.setAttribute(`lines`,String(e))}get widthChars(){return normalizeLabelWidthChars(this.getAttribute(`width-chars`))}set widthChars(e){this.setAttribute(`width-chars`,String(e))}get maxWidthChars(){return normalizeLabelMaxWidthChars(this.getAttribute(`max-width-chars`))}set maxWidthChars(e){this.setAttribute(`max-width-chars`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}getText(){return labelDisplayText(this.label,this.useMarkup,this.useUnderline)}connectedCallback(){this._render(),this._resizes=new ResizeObserver(()=>this._remeasure()),this._resizes.observe(this),document.fonts?.ready.then(()=>this._remeasure())}disconnectedCallback(){this._resizes?.disconnect(),this._resizes=null}_remeasure(){if(!this._wrapSpan||!this.isConnected)return;this._wrapSpan.style.width=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.width=e===null?``:`${e}px`}attributeChangedCallback(e,t,n){this._render();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`label`?t??``:e===`justify`?normalizeLabelJustify(t):e===`xalign`?normalizeLabelXalign$1(t):e===`yalign`?normalizeLabelYalign(t):e===`wrap-mode`?normalizeLabelWrapMode(t):e===`ellipsize`?normalizeLabelEllipsize(t):e===`lines`?normalizeLabelLines(t):e===`width-chars`?normalizeLabelWidthChars(t):e===`max-width-chars`?normalizeLabelMaxWidthChars(t):t!==null}_render(){let e=this.getText(),t=this.wrap,n=this.ellipsize,r=n!==`none`;t||r?this._renderSpan(e,r):this._renderSingleLine(e),this.style.setProperty(`--gtk-label-xalign`,String(this.xalign)),this.style.textAlign=un[this.justify],this.style.setProperty(`--gtk-label-align-items`,labelYalignAlignItems(this.yalign));let i=labelEllipsizeOverflowValue(n);i===`ellipsis`?this.style.setProperty(`--gtk-label-ellipsize-overflow`,i):this.style.removeProperty(`--gtk-label-ellipsize-overflow`);let a=labelEffectiveLines(this.lines,n);a===null?this.style.removeProperty(`--gtk-label-lines`):this.style.setProperty(`--gtk-label-lines`,String(a));let o=labelWidthCharsExtent(this.widthChars,this.maxWidthChars);o.minCh===null?this._wroteMinWidth&&this.style.removeProperty(`min-width`):this.style.minWidth=`${o.minCh}ch`,o.maxCh===null?this._wroteMaxWidth&&this.style.removeProperty(`max-width`):this.style.maxWidth=`${o.maxCh}ch`,this._wroteMinWidth=o.minCh!==null,this._wroteMaxWidth=o.maxCh!==null}_renderSingleLine(e){this._wrapSpan?.remove(),this._wrapSpan=null,this.textContent!==e&&(this.textContent=e)}_renderSpan(e,t){this._wrapSpan||(this.textContent=``,this._wrapSpan=document.createElement(`span`),this._wrapSpan.className=`adw-label-text`,this.appendChild(this._wrapSpan)),this._wrapSpan.classList.toggle(`adw-label-clamp`,t),this._wrapSpan.textContent!==e&&(this._wrapSpan.textContent=e),this._remeasure()}};function measuredWrapWidth(e){let t=document.createRange();t.selectNodeContents(e);let n=0;for(let e of t.getClientRects())n=Math.max(n,e.width);return n>0?Math.ceil(n):null}customElements.define(`gtk-label`,GtkLabel);let fn=0;var GtkExpander=class extends HTMLElement{_box;_titleEl;_arrowEl;_labelEl;_labelSection;_contentEl;_initialized=!1;static get observedAttributes(){return[`expanded`,`label`,`use-markup`,`use-underline`,`resize-toplevel`]}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get label(){return this.labelWidget===null?this.getAttribute(`label`):null}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get resizeToplevel(){return this.hasAttribute(`resize-toplevel`)}set resizeToplevel(e){this.toggleAttribute(`resize-toplevel`,!!e)}get child(){return this._contentEl?.firstElementChild??null}get labelWidget(){return this._labelSection?.firstElementChild??null}connectedCallback(){this._initialized||(this._initialized=!0,this._arrowEl=createGtkImage(`pan-end`,`adw-expander-arrow`),this._labelEl=document.createElement(`gtk-label`),this._labelSection=document.createElement(`div`),this._labelSection.className=`adw-expander-label`,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-expander-title`,this._titleEl.setAttribute(`role`,`button`),this._titleEl.append(this._arrowEl,this._labelEl,this._labelSection),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-content`,this._box=document.createElement(`div`),this._box.className=`adw-expander-box`,this._box.append(this._titleEl,this._contentEl),bindSlottedChildren(this,[{name:`label-widget`,into:this._labelSection},{name:`label`,into:this._labelSection},{name:`child`,into:this._contentEl},{into:this._contentEl}]).install(this._box),bindEmptySections(this._labelSection),this._titleEl.addEventListener(`click`,()=>this._activate()),attachRowActivation({row:this._titleEl,activatable:()=>!0}),this._titleEl.addEventListener(`keydown`,this._onKeyDown),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._detail(e)}})))}_detail(e){switch(e){case`expanded`:return this.expanded;case`label`:return this.label;case`use-markup`:return this.useMarkup;case`use-underline`:return this.useUnderline;default:return this.resizeToplevel}}_activate(){this.expanded=!this.expanded,this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{expanded:this.expanded}}))}_onKeyDown=e=>{if(!this.useUnderline||!e.altKey||e.ctrlKey||e.metaKey)return;let t=this._mnemonic();t===null||(e.key.length===1?e.key.toUpperCase():``)!==t||(e.preventDefault(),this._activate())};_mnemonic(){let e=[...this.getAttribute(`label`)??``];for(let t=0;t<e.length;t+=1){if(e[t]!==`_`)continue;let n=e[t+1];if(n===void 0)return null;if(t+=1,n!==`_`)return n.toUpperCase()}return null}_render(){this._arrowEl.classList.toggle(`checked`,this.expanded),this.classList.toggle(`expanded`,this.expanded),this._titleEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.hidden=!this.expanded;let e=this.labelWidget;this._labelEl.hidden=e!==null||this.label===null,e===null&&(this._labelEl.setAttribute(`label`,labelDisplayText(this.label??``,this.useMarkup,this.useUnderline)),this._labelEl.toggleAttribute(`use-markup`,this.useMarkup),this._labelEl.toggleAttribute(`use-underline`,this.useUnderline));let t=this.child;t===null?this._titleEl.removeAttribute(`aria-controls`):this._titleEl.getAttribute(`aria-controls`)===null&&(t.id===``&&(t.id=`gtk-expander-content-${fn++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends HTMLElement{_resize=null;_mutations=null;connectedCallback(){this._resize=new ResizeObserver(()=>this._size()),this._resize.observe(this),this._mutations=new MutationObserver(()=>{this._observeChildren(),this._size()}),this._mutations.observe(this,{childList:!0}),this._observeChildren(),this._size()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}put(e,t,n){e.parentNode!==this&&this.append(e),this.move(e,t,n)}move(e,t,n){e.style.left=`${t}px`,e.style.top=`${n}px`}_observeChildren(){if(this._resize!==null)for(let e of this.children)e instanceof HTMLElement&&this._resize.observe(e)}_size(){let e=0,t=0;for(let n of this.children)n instanceof HTMLElement&&(e=Math.max(e,n.offsetLeft+n.offsetWidth),t=Math.max(t,n.offsetTop+n.offsetHeight));let n=`${e}px`,r=`${t}px`;this.style.minWidth!==n&&(this.style.minWidth=n),this.style.minHeight!==r&&(this.style.minHeight=r)}};customElements.define(`gtk-fixed`,GtkFixed);var GtkFlowBoxChild=class extends HTMLElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`gridcell`),this.tabIndex=0)}get child(){return this._contentsEl.firstElementChild}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}};customElements.define(`gtk-flow-box-child`,GtkFlowBoxChild);var GtkFlowBox=class extends HTMLElement{_children=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`homogeneous`,`min-children-per-line`,`max-children-per-line`,`row-spacing`,`column-spacing`,`orientation`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}get minChildrenPerLine(){return count(this.getAttribute(`min-children-per-line`),0)}set minChildrenPerLine(e){this.setAttribute(`min-children-per-line`,String(e))}get maxChildrenPerLine(){return Math.max(1,count(this.getAttribute(`max-children-per-line`),7))}set maxChildrenPerLine(e){this.setAttribute(`max-children-per-line`,String(e))}get rowSpacing(){return count(this.getAttribute(`row-spacing`),0)}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnSpacing(){return count(this.getAttribute(`column-spacing`),0)}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get cells(){return this._children}get selectedChildren(){return[...this._selection]}set selectedChildren(e){for(let t of typeof e==`number`?[e]:e??[])this.selectChild(this._children[t]??null)}get selectedChildElements(){return this._selection.map(e=>this._children[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._children,step:(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r},crossAxis:{orientation:()=>this.orientation===`horizontal`?`vertical`:`horizontal`,step:(e,t,n)=>visualStep(e,t,n,this.orientation)},select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectChildren()).observe(this,{childList:!0}),this._applyAttributes(),this._collectChildren())}attributeChangedCallback(){this._initialized&&(this._applyAttributes(),this._syncChildren())}selectChild(e){let t=listBoxSelectRow(this._selection,this._anchor,e===null?null:this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)&&t.anchor===this._anchor||(this._selection=t.selection,this._anchor=t.anchor,this._emitSelection(e))}unselectChild(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._children.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedChildElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`homogeneous`,this.homogeneous),this.classList.toggle(`vertical`,this.orientation===`vertical`),this.style.setProperty(`--adw-flow-box-row-spacing`,`${this.rowSpacing}px`),this.style.setProperty(`--adw-flow-box-column-spacing`,`${this.columnSpacing}px`),this.style.setProperty(`--adw-flow-box-max-children-per-line`,String(this.maxChildrenPerLine)),this.minChildrenPerLine>0?this.style.setProperty(`--adw-flow-box-min-children-per-line`,String(this.minChildrenPerLine)):this.style.removeProperty(`--adw-flow-box-min-children-per-line`);let e=this.selectionMode!==`none`;this.setAttribute(`role`,`grid`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`),e?this.removeAttribute(`aria-readonly`):this.setAttribute(`aria-readonly`,`true`)}_collectChildren(){let e=[...this.querySelectorAll(`:scope > gtk-flow-box-child`)];e.length===this._children.length&&e.every((e,t)=>e===this._children[t])||(this._children=e,this._selection=this._selection.filter(e=>e<this._children.length),this._anchor>=this._children.length&&(this._anchor=-1),this._syncChildren())}_syncChildren(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._children.forEach((n,r)=>{let i=t.has(r);n.classList.toggle(`selected`,i),n.classList.toggle(`activatable`,e),e?n.setAttribute(`aria-selected`,String(i)):n.removeAttribute(`aria-selected`)})}_onClick(e){let t=this._childAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._childAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._childAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_childAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-flow-box-child`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode,t);same$1(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._children.indexOf(e))?e:null))}_activate(e){this.dispatchEvent(new CustomEvent(`child-activated`,{bubbles:!0,detail:{child:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}_emitSelection(e){this._syncChildren(),this.dispatchEvent(new CustomEvent(`selected-children-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`child-selected`,{bubbles:!0,detail:{child:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-children`,{bubbles:!0,detail:{selectedChildren:[...this._selection]}}))}};const visualStep=(e,t,n,r)=>{if(e.length<2)return null;let i=r===`vertical`,alongLine=e=>i?e.offsetLeft:e.offsetTop,acrossLine=e=>i?e.offsetTop:e.offsetLeft,a=e[t],o=alongLine(a),s=acrossLine(a),c=n>0?o+1:o-1,l=null,u=1/0;for(let t=0;t<e.length;t++){let n=e[t];if(alongLine(n)!==c)continue;let r=Math.abs(acrossLine(n)-s);(l===null||r<u)&&(l=t,u=r)}if(l!==null)return l;let d=t+n;return d<0||d>=e.length?null:alongLine(e[d])===o?d:null};function same$1(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}__name(same$1,`same`);function count(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)&&n>=0?n:t}customElements.define(`gtk-flow-box`,GtkFlowBox);const W={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},pn=[{word:`Thin`,set:{weight:100}},{word:`UltraLight`,set:{weight:200}},{word:`Light`,set:{weight:300}},{word:`SemiLight`,set:{weight:350}},{word:`Book`,set:{weight:375}},{word:`Medium`,set:{weight:500}},{word:`SemiBold`,set:{weight:600}},{word:`Bold`,set:{weight:700}},{word:`UltraBold`,set:{weight:800}},{word:`Heavy`,set:{weight:900}},{word:`Black`,set:{weight:1e3}},{word:`Italic`,set:{slant:`italic`}},{word:`Oblique`,set:{slant:`oblique`}},{word:`Condensed`,set:{width:`condensed`}},{word:`Expanded`,set:{width:`expanded`}}];function parseFontDescription(e){let t={...W,family:``},n=e.trim().split(/\s+/).filter(e=>e!==``);for(let e=n.length;e>0;e--){let r=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(n[e-1]);if(r!==null){t.size=Number(r[1]),t.absolute=r[2]===`px`,n.length=e-1;break}}let r=[];for(let e of n){let n=pn.find(t=>t.word.toLowerCase()===e.toLowerCase());if(n===void 0){r.push(e);continue}Object.assign(t,n.set)}return t.family=r.join(` `),t}function formatFontDescription(e){let t=[];for(let{word:n,set:r}of pn)Object.entries(r).every(([t,n])=>e[t]===n)&&!t.includes(n)&&t.push(n);let n=`${e.size}${e.absolute?`px`:``}`;return[e.family,...t,n].filter(e=>e!==``).join(` `)}function fontDescriptionEqual(e,t){return e.family===t.family&&e.slant===t.slant&&e.weight===t.weight&&e.width===t.width&&e.size===t.size&&e.absolute===t.absolute}function formatFontSize(e,t){return`${Number(e.toPrecision(4))}${t?`px`:``}`}function cssFontParts(e,t){return{fontFamily:e.family===``?`sans-serif`:`"${e.family}"`,fontWeight:String(e.weight),fontStyle:e.slant,fontStretch:e.width,fontSize:t?`${e.size}${e.absolute?`px`:`pt`}`:``}}function cssFontShorthand(e,t){let n=cssFontParts(e,t),r=[];return n.fontStyle!==`normal`&&r.push(n.fontStyle),n.fontWeight!==`400`&&r.push(n.fontWeight),n.fontStretch!==`normal`&&r.push(n.fontStretch),n.fontSize!==``&&r.push(n.fontSize),r.length>0&&r.push(``),`${r.join(` `)}${n.fontFamily}`.trim()}function cssFontFeatureTags(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>`"${e}"`)}var GtkSeparator=class extends HTMLElement{static get observedAttributes(){return[`orientation`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`separator`),this._render()}attributeChangedCallback(){this.isConnected&&this._render()}_render(){let e=this.orientation;this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e)}};customElements.define(`gtk-separator`,GtkSeparator);const mn=[`family`,`face`,`font`,`features`],hn=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends HTMLElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...W};_dialog=null;_features=``;_language=null;_pending=!1;_initialized=!1;static get observedAttributes(){return[`font-desc`,`font-features`,`language`,`level`,`use-font`,`use-size`,`dialog`,`disabled`]}get fontDesc(){return{...this._desc}}set fontDesc(e){let t=typeof e==`string`?parseFontDescription(e):e;fontDescriptionEqual(t,this._desc)||(this._desc={...t},this._render(),this.dispatchEvent(new CustomEvent(`notify::font-desc`,{bubbles:!0,detail:{fontDesc:this.fontDesc}})))}get fontFeatures(){return this._features}set fontFeatures(e){this._features!==e&&(this._features=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::font-features`,{bubbles:!0,detail:{value:e}})))}get language(){return this._language}set language(e){this._language!==e&&(this._language=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::language`,{bubbles:!0,detail:{value:e}})))}get level(){let e=this.getAttribute(`level`);return mn.find(t=>t===e)??`font`}set level(e){this.setAttribute(`level`,e)}get useFont(){return this.hasAttribute(`use-font`)}set useFont(e){this.toggleAttribute(`use-font`,!!e)}get useSize(){return this.hasAttribute(`use-size`)}set useSize(e){this.toggleAttribute(`use-size`,!!e)}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._labelEl=document.createElement(`span`),this._labelEl.className=`font-button-label`,this._sizeLabelEl=document.createElement(`span`),this._sizeLabelEl.className=`font-button-size-label`;let e=document.createElement(`gtk-separator`);e.setAttribute(`orientation`,`vertical`),this._sizeBoxEl=document.createElement(`span`),this._sizeBoxEl.className=`font-button-size`,this._sizeBoxEl.append(e,this._sizeLabelEl),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button font`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.append(this._labelEl,this._sizeBoxEl),this._selectEl=document.createElement(`select`),this._selectEl.className=`font-button-chooser`,this._selectEl.addEventListener(`change`,()=>this._choose()),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`font-button-popover`),this._dockEl.replaceChildren(this._selectEl),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._dockEl.subscribe(e=>{e||(this._pending=!1),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});for(let e of[`font-desc`,`font-features`,`language`]){let t=this.getAttribute(e);t!==null&&(e===`font-desc`?this.fontDesc=t:e===`font-features`?this.fontFeatures=t:this.language=t)}this._render()}attributeChangedCallback(e){if(this._initialized)switch(e){case`font-desc`:{let e=this.getAttribute(`font-desc`);e!==null&&(this.fontDesc=e);return}case`font-features`:this.fontFeatures=this.getAttribute(`font-features`)??``;return;case`language`:this.language=this.getAttribute(`language`);return;case`dialog`:this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return;case`disabled`:this._renderSensitivity();return;default:this._render()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._openChooser()}_openChooser(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._selectEl.replaceChildren(...this._options()),this._dockEl.popup())}_options(){let e=new Set;for(let t of document.fonts)t.family&&e.add(t.family);this._desc.family!==``&&e.add(this._desc.family);let t=[],n=new Set,add=e=>{let r=formatFontDescription(e);if(n.has(r))return;n.add(r);let i=document.createElement(`option`);i.value=r,i.textContent=r,t.push(i)};add(this._desc);for(let t of[...e].sort())for(let{weight:e,slant:n}of hn){let r={...this._desc,family:t,weight:e,slant:n};document.fonts.check(cssFontShorthand(r,!0))&&add(r)}return t}_choose(){let e=parseFontDescription(this._selectEl.value),t=this.level;t===`family`?this.fontDesc={...W,family:e.family}:t===`face`?this.fontDesc={...e,size:this._desc.size,absolute:this._desc.absolute}:this.fontDesc=e,this._pending=!1,this._dockEl.popdown(),this._renderSensitivity()}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_render(){if(!this._initialized)return;let e=this.level,t=this._faceName(),n=[this._desc.family===``?`None`:this._desc.family];e!==`family`&&t!==``&&n.push(t),this._labelEl.textContent=n.join(` `),this._sizeBoxEl.hidden=e===`family`||e===`face`,this._sizeBoxEl.hidden||(this._sizeLabelEl.textContent=formatFontSize(this._desc.size,this._desc.absolute));let r=this._labelEl.style;if(this.useFont){let e=cssFontParts(this._desc,this.useSize);r.fontFamily=e.fontFamily,r.fontWeight=e.fontWeight,r.fontStyle=e.fontStyle,r.fontStretch=e.fontStretch,r.fontSize=e.fontSize,r.fontFeatureSettings=``;for(let e of cssFontFeatureTags(this._features))if(r.fontFeatureSettings=e,r.fontFeatureSettings!==``)break;this._labelEl.lang=this._language??this._dialog?.language??``}else r.fontFamily=``,r.fontWeight=``,r.fontStyle=``,r.fontStretch=``,r.fontSize=``,r.fontFeatureSettings=``,this._labelEl.lang=``;this._renderSensitivity()}_faceName(){let e=cssFontShorthand(this._desc,!0);if(this._desc.family===``||!document.fonts.check(e))return``;let t=[];return this._desc.slant===`italic`?t.push(`Italic`):this._desc.slant===`oblique`&&t.push(`Oblique`),this._desc.weight!==400&&t.push(this._desc.weight>=700?`Bold`:`Light`),this._desc.width===`condensed`?t.push(`Condensed`):this._desc.width===`expanded`&&t.push(`Expanded`),t.join(` `)}};customElements.define(`gtk-font-dialog-button`,GtkFontDialogButton);function normalizeLabelXalign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):0}var GtkFrame=class extends HTMLElement{_mutations=null;static get observedAttributes(){return[`label`,`label-xalign`]}_labelEl=null;_writingLabel=!1;get label(){return this.getAttribute(`label`)}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get labelXalign(){return normalizeLabelXalign(this.getAttribute(`label-xalign`))}set labelXalign(e){this.setAttribute(`label-xalign`,String(e))}get labelWidget(){let e=this.querySelector(`[slot="label-widget"]`);return e===null?this._labelEl?.parentNode===this?this._labelEl:null:e}set labelWidget(e){let t=this.querySelector(`[slot="label-widget"]`);t!==null&&(t.removeAttribute(`slot`),t.remove()),e!==null&&(e.setAttribute(`slot`,`label-widget`),this.prepend(e),this._sync())}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this},{name:`label-widget`,into:this}]),this._mutations=new MutationObserver(()=>this._sync()),this._mutations.observe(this,{childList:!0}),this.setAttribute(`role`,`group`),this._sync()}disconnectedCallback(){this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=e===`label-xalign`?String(normalizeLabelXalign(n)):n;r!==(e===`label-xalign`?String(normalizeLabelXalign(t)):t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_sync(){let e=this.querySelector(`[slot="label-widget"]`),t=this.getAttribute(`label`);e===null&&t!==null?(this._labelEl===null&&(this._labelEl=document.createElement(`gtk-label`),this._labelEl.addEventListener(`notify::label`,e=>{this._writingLabel&&e.stopPropagation()})),this._writingLabel=!0,this._labelEl.setAttribute(`label`,t),this._writingLabel=!1,this._labelEl.parentNode!==this&&this.prepend(this._labelEl)):this._labelEl?.parentNode===this&&this._labelEl.remove();let n=this.labelWidget;n!==null&&(n.classList.add(`adw-frame-label`),n.style.alignSelf=labelYalignAlignItems(this.labelXalign))}};customElements.define(`gtk-frame`,GtkFrame);const G=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...G];let n=t.split(/[\s,|]+/).filter(e=>G.includes(e));return G.filter(e=>n.includes(e))}function booleanAttribute$1(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}__name(booleanAttribute$1,`booleanAttribute`);var GtkGLArea=class extends HTMLElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...G];_needsRender=!0;_haveBuffers=!1;_width=0;_height=0;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`auto-render`,`has-depth-buffer`,`has-stencil-buffer`,`allowed-apis`]}get autoRender(){return booleanAttribute$1(this,`auto-render`,!0)}set autoRender(e){this.autoRender!==!!e&&this._write(`auto-render`,String(!!e))}get hasDepthBuffer(){return booleanAttribute$1(this,`has-depth-buffer`,!1)}set hasDepthBuffer(e){this.hasDepthBuffer!==!!e&&this._write(`has-depth-buffer`,String(!!e))}get hasStencilBuffer(){return booleanAttribute$1(this,`has-stencil-buffer`,!1)}set hasStencilBuffer(e){this.hasStencilBuffer!==!!e&&this._write(`has-stencil-buffer`,String(!!e))}get allowedApis(){return[...this._allowedApis]}set allowedApis(e){if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=G.filter(t=>e.includes(t)),this._write(`allowed-apis`,this._allowedApis.join(` `))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get api(){return this._context===null?`gl`:`gles`}get context(){return this._context}get error(){return this._error}setError(e){let t=e===null?null:typeof e==`string`?e:e.message;this._error!==t&&(this._error=t,this._renderMessage(),this._queueDraw())}makeCurrent(){return this._context}queueRender(){this._needsRender=!0,this._queueDraw()}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.hasAttribute(`allowed-apis`)&&(this._allowedApis=parseApis(this)),this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-gl-area-canvas`,this.replaceChildren(this._canvas),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}_queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}attributeChangedCallback(e){if(this._initialized){switch(e){case`auto-render`:this.autoRender&&this._queueDraw();break;case`has-depth-buffer`:case`has-stencil-buffer`:this._haveBuffers=!1;break;case`allowed-apis`:if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=parseApis(this);break;default:break}this._notify(e)}}_notify(e){let t=e===`allowed-apis`?this.allowedApis.join(` `):e===`auto-render`?this.autoRender:e===`has-depth-buffer`?this.hasDepthBuffer:this.hasStencilBuffer;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0],n=e?e.inlineSize:t.contentRect.width,r=e?e.blockSize:t.contentRect.height;n===this._width&&r===this._height||(this._width=n,this._height=r,this._needsResize=!0,this._queueDraw())}}),this._resize.observe(this))}_draw(){if(!this._canvas)return;let e=typeof globalThis>`u`?1:globalThis.devicePixelRatio||1;this._scale=e;let t=Math.round(this._width*e),n=Math.round(this._height*e);if(t===0||n===0)return;if(this._error!==null){this._renderMessage();return}let r=this._context??this._createContext();r!==null&&(this.makeCurrent(),this.attachBuffers(r),this.hasDepthBuffer?r.enable?.(r.DEPTH_TEST):r.disable?.(r.DEPTH_TEST),(this._needsRender||this.autoRender)&&(this._needsResize&&(this._needsResize=!1,this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:t,height:n}}))),this.dispatchEvent(new CustomEvent(`render`,{bubbles:!0,detail:{context:r}}))),this._needsRender=!1)}attachBuffers(e=this._context){e!==null&&(this.hasStencilBuffer?e.enable?.(e.STENCIL_TEST):e.disable?.(e.STENCIL_TEST),this._haveBuffers=!0)}_createContext(){let e=this.allowedApis;if(e.length===0)return null;let t={context:null};if(this.dispatchEvent(new CustomEvent(`create-context`,{bubbles:!0,detail:t})),t.context!==null)return this._context=t.context,this._context;let n={preserveDrawingBuffer:!0,depth:this.hasDepthBuffer,stencil:this.hasStencilBuffer},r=e.includes(`gles`)?[`webgl2`,`webgl`]:[`webgl`];for(let e of r){let t=this._canvas.getContext(e,n);if(t!==null)return this._context=t,t}return null}_renderMessage(){if(this._error===null){this._messageEl?.remove(),this._messageEl=null;return}this._messageEl||(this._messageEl=document.createElement(`div`),this._messageEl.className=`adw-gl-area-error`,this.append(this._messageEl)),this._messageEl.textContent=this._error}get viewport(){return{width:Math.round(this._width*this._scale),height:Math.round(this._height*this._scale)}}get pixelScale(){return this._scale}};customElements.define(`gtk-gl-area`,GtkGLArea);function booleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var GtkGraphicsOffload=class extends HTMLElement{_childEl;_initialized=!1;static get observedAttributes(){return[`enabled`,`black-background`]}get child(){return this._childEl?.firstElementChild??null}get enabled(){return this.getAttribute(`enabled`)===`disabled`?`disabled`:`enabled`}set enabled(e){this.enabled!==e&&this.setAttribute(`enabled`,e)}get blackBackground(){return booleanAttribute(this,`black-background`,!1)}set blackBackground(e){this.blackBackground!==!!e&&this.setAttribute(`black-background`,String(!!e))}connectedCallback(){this._initialized||(this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-graphics-offload-child`,bindSlottedChildren(this,[{into:this._childEl}]).install(this._childEl),this.replaceChildren(this._childEl),this._render())}attributeChangedCallback(e){this._initialized&&((e===`enabled`||e===`black-background`)&&this._render(),this._notify(e))}_render(){let e=this.enabled!==`disabled`;this.style.willChange=e?`transform`:``,this.style.backgroundColor=this.blackBackground?`#000000`:``}_notify(e){let t=e===`enabled`?this.enabled:this.blackBackground;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}};customElements.define(`gtk-graphics-offload`,GtkGraphicsOffload);var GtkGrid=class extends HTMLElement{static get observedAttributes(){return[`column-spacing`,`row-spacing`,`column-homogeneous`,`row-homogeneous`,`orientation`]}get columnSpacing(){return normalizeBoxSpacing(this.getAttribute(`column-spacing`))}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get rowSpacing(){return normalizeBoxSpacing(this.getAttribute(`row-spacing`))}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnHomogeneous(){return this.hasAttribute(`column-homogeneous`)}set columnHomogeneous(e){this.toggleAttribute(`column-homogeneous`,!!e)}get rowHomogeneous(){return this.hasAttribute(`row-homogeneous`)}set rowHomogeneous(e){this.toggleAttribute(`row-homogeneous`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`column-spacing`||e===`row-spacing`?normalizeBoxSpacing(t):e===`orientation`?normalizeBoxOrientation(t):t!==null}_sync(){this.style.rowGap=`${this.rowSpacing}px`,this.style.columnGap=`${this.columnSpacing}px`,this.style.gridAutoRows=this.rowHomogeneous?`1fr`:``,this.style.gridAutoColumns=this.columnHomogeneous?`1fr`:``,this.style.gridAutoFlow=this.orientation===`vertical`?`row`:`column`}};customElements.define(`gtk-grid`,GtkGrid);function cssPixels(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}var GtkGridView=class extends GtkListView{_observer=null;static get observedAttributes(){return[`model`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`,`min-columns`,`max-columns`]}get minColumns(){return this._columnBound(`min-columns`,1)}set minColumns(e){this.setAttribute(`min-columns`,String(e))}get maxColumns(){return this._columnBound(`max-columns`,7)}set maxColumns(e){this.setAttribute(`max-columns`,String(e))}connectedCallback(){super.connectedCallback(),this._observer===null&&(this._observer=new ResizeObserver(()=>this._applyColumns()),this._observer.observe(this),this._applyColumns())}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){super.attributeChangedCallback(e),this._applyColumns()}get _viewClass(){return`adw-grid-view`}get _rowClass(){return`adw-grid-view-child`}_renderRows(){super._renderRows(),this._applyColumns()}_columnBound(e,t){let n=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(n)&&n>=1?n:t}_applyColumns(){let e=this._rows[0];if(e===void 0)return;let t=cssPixels(globalThis.getComputedStyle(e).minWidth,120),n=cssPixels(globalThis.getComputedStyle(this._listEl).columnGap,6),r=gridViewColumns(Math.round(this.getBoundingClientRect().width),t,n,this.minColumns,this.maxColumns);this._listEl.style.gridTemplateColumns=`repeat(${r}, 1fr)`}};customElements.define(`gtk-grid-view`,GtkGridView);var GtkHeaderBar=class extends HTMLElement{_initialized=!1;_handle;_box;_startBox;_endBox;_startControls=null;_endControls=null;_titleLabel=null;_centre=null;_centreObserver=null;static get observedAttributes(){return[`decoration-layout`,`show-title-buttons`]}get decorationLayout(){return this.getAttribute(`decoration-layout`)}set decorationLayout(e){e===null?this.removeAttribute(`decoration-layout`):this._write(`decoration-layout`,e)}get showTitleButtons(){return this.getAttribute(`show-title-buttons`)!==`false`}set showTitleButtons(e){this._write(`show-title-buttons`,String(e))}get titleWidget(){return this._centre}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followCentre();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startBox=document.createElement(`div`),this._startBox.className=`adw-gtk-header-bar-start`,this._endBox=document.createElement(`div`),this._endBox.className=`adw-gtk-header-bar-end`,this._box=document.createElement(`div`),this._box.className=`adw-gtk-header-bar-box`,this._box.append(this._startBox,this._endBox),this._handle=document.createElement(`div`),this._handle.className=`adw-gtk-header-bar-handle`,this._handle.appendChild(this._box),this._renderTitleButtons(),bindSlottedChildren(this,[{name:`start`,into:this._startBox},{name:`title`,into:this._box},{name:`title-widget`,into:this._box},{name:`end`,consume:e=>this._endBox.prepend(e)},{into:this._startBox}]).install(this._handle),this._followCentre()}disconnectedCallback(){this._centreObserver?.disconnect(),this._centreObserver=null}attributeChangedCallback(e){this._initialized&&(e===`show-title-buttons`?this._renderTitleButtons():this._bindDecorationLayout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`show-title-buttons`?this.showTitleButtons:this.decorationLayout}_renderTitleButtons(){if(!this.showTitleButtons){this._startControls?.remove(),this._endControls?.remove(),this._startControls=null,this._endControls=null;return}this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._startBox.prepend(this._startControls),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._endBox.appendChild(this._endControls)),this._bindDecorationLayout()}_bindDecorationLayout(){for(let e of[this._startControls,this._endControls]){if(e===null)continue;let t=this.decorationLayout;t===null?e.removeAttribute(`decoration-layout`):e.setAttribute(`decoration-layout`,t)}}_followCentre(){this._centreObserver?.disconnect(),this._centreObserver=new MutationObserver(()=>this._syncCentre()),this._centreObserver.observe(this._box,{childList:!0});let e=this.closest(`gtk-window, adw-window`);e!==null&&this._centreObserver.observe(e,{attributes:!0,attributeFilter:[`title`]}),this._syncCentre()}_centreChild(){for(let e of this._box.children)if(!(e===this._startBox||e===this._endBox||e===this._titleLabel)&&e instanceof HTMLElement)return e;return null}_syncCentre(){this._centre=this._centreChild(),this._centre===null?this._titleLabel===null?this._constructTitleLabel():this._updateTitle():this._dropTitleLabel()}_constructTitleLabel(){let e=document.createElement(`gtk-label`);e.className=`title adw-gtk-header-bar-title`,this._titleLabel=e,this._box.appendChild(e),this._updateTitle()}_dropTitleLabel(){this._titleLabel?.remove(),this._titleLabel=null}_updateTitle(){let e=this._titleLabel;if(e===null)return;let t=this.closest(`gtk-window, adw-window`)?.getAttribute(`title`)??document.title;t===``?e.removeAttribute(`label`):e.setAttribute(`label`,t)}};customElements.define(`gtk-header-bar`,GtkHeaderBar);var GtkLinkButton=class extends GtkButton{_wired=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`uri`,`visited`]}get uri(){return this.getAttribute(`uri`)??``}set uri(e){this.setAttribute(`uri`,e)}get visited(){return this.hasAttribute(`visited`)}set visited(e){this.toggleAttribute(`visited`,!!e)}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>this._activateLink()))}attributeChangedCallback(e){e===`uri`&&this.isConnected&&(this.visited=!1),super.attributeChangedCallback(),e===`visited`&&this.isConnected&&this.dispatchEvent(new CustomEvent(`notify::visited`,{bubbles:!0,detail:{visited:this.visited}}))}_activateLink(){let e=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;let{uri:t}=this;t!==``&&(this.launch(t),this.visited=!0)}launch(e){globalThis.open(e,`_blank`,`noopener`)}decorate(e){e.classList.add(`link`),e.classList.toggle(`visited`,this.visited);let t=(this.getAttribute(`label`)??``).trim();(this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`))===null&&t!==``&&this.uri!==``&&this.uri!==t&&(e.title=this.uri)}};customElements.define(`gtk-link-button`,GtkLinkButton);const gn=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return gn.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return De.includes(e)?e:`word-char`}function normalizeAlignment(e,t){let n=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function normalizeCount(e){let t=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}var GtkInscription=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`markup`,`min-chars`,`min-lines`,`nat-chars`,`nat-lines`,`text`,`text-overflow`,`wrap-mode`,`xalign`,`yalign`]}get text(){return this.getAttribute(`text`)??``}set text(e){this._write(`text`,e)}get markup(){return this.getAttribute(`markup`)??``}set markup(e){this._write(`markup`,e)}get minChars(){let e=this.getAttribute(`min-chars`);return e===null?3:normalizeCount(e)}set minChars(e){this._write(`min-chars`,String(e))}get natChars(){return normalizeCount(this.getAttribute(`nat-chars`))}set natChars(e){this._write(`nat-chars`,String(e))}get minLines(){let e=this.getAttribute(`min-lines`);return e===null?1:normalizeCount(e)}set minLines(e){this._write(`min-lines`,String(e))}get natLines(){return normalizeCount(this.getAttribute(`nat-lines`))}set natLines(e){this._write(`nat-lines`,String(e))}get textOverflow(){return normalizeInscriptionOverflow(this.getAttribute(`text-overflow`))}set textOverflow(e){this._write(`text-overflow`,e)}get wrapMode(){return normalizeInscriptionWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this._write(`wrap-mode`,e)}get xalign(){return normalizeAlignment(this.getAttribute(`xalign`),0)}set xalign(e){this._write(`xalign`,String(e))}get yalign(){return normalizeAlignment(this.getAttribute(`yalign`),.5)}set yalign(e){this._write(`yalign`,String(e))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`text`:return this.text;case`markup`:return this.markup;case`min-chars`:return this.minChars;case`nat-chars`:return this.natChars;case`min-lines`:return this.minLines;case`nat-lines`:return this.natLines;case`text-overflow`:return this.textOverflow;case`wrap-mode`:return this.wrapMode;case`xalign`:return this.xalign;default:return this.yalign}}_render(){let e=this.text,t=this.markup;this.textContent=e||!t?e:labelDisplayText(t,!0,!1);let n=this.minChars,r=this.natChars;if(n===0&&r===0)this.style.setProperty(`--gtk-inscription-min-ch`,`auto`),this.style.setProperty(`--gtk-inscription-width`,`auto`);else{let{minCh:e,maxCh:t}=labelWidthCharsExtent(n,r);this.style.setProperty(`--gtk-inscription-min-ch`,`${e}ch`),this.style.setProperty(`--gtk-inscription-width`,`${t}ch`)}let i=this.minLines,a=this.natLines;this.style.setProperty(`--gtk-inscription-min-lh`,i===0&&a===0?`auto`:`${i}lh`),this.style.setProperty(`--gtk-inscription-height`,i===0&&a===0?`auto`:`${Math.max(i,a)}lh`),this.style.setProperty(`--gtk-inscription-xalign`,String(this.xalign)),this.style.setProperty(`--gtk-inscription-align-items`,labelYalignAlignItems(this.yalign));let o=this.textOverflow;this.style.setProperty(`--gtk-inscription-text-overflow`,labelEllipsizeOverflowValue(o===`clip`?`none`:`end`)),this.classList.toggle(`clip`,o===`clip`),this.classList.toggle(`ellipsized`,o!==`clip`)}};customElements.define(`gtk-inscription`,GtkInscription);const _n=[[`low`,.25],[`high`,.75],[`full`,1]];function levelClassFor(e,t){for(let n=0;n<e.length;n++){let[r,i]=e[n];if(t>i)continue;let a=n===0?null:e[n-1][1];if(a===null||a<t)return r}return null}function numberAttribute(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)?r:n}var GtkLevelBar=class extends HTMLElement{_trough;_initialized=!1;_offsets=_n.map(e=>[...e]);static get observedAttributes(){return[`value`,`min-value`,`max-value`,`mode`,`inverted`,`orientation`,`disabled`]}get value(){return numberAttribute(this,`value`,0)}set value(e){this._write(`value`,String(e))}get minValue(){return numberAttribute(this,`min-value`,0)}set minValue(e){this._write(`min-value`,String(e))}get maxValue(){return numberAttribute(this,`max-value`,1)}set maxValue(e){this._write(`max-value`,String(e))}get mode(){return this.getAttribute(`mode`)===`discrete`?`discrete`:`continuous`}set mode(e){this._write(`mode`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this._write(`orientation`,e)}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}addOffsetValue(e,t){if(t<this.minValue||t>this.maxValue)return;let n=this._offsets.findIndex(([t])=>t===e);n!==-1&&this._offsets[n][1]===t||(n!==-1&&this._offsets.splice(n,1),this._offsets.push([e,t]),this._offsets.sort((e,t)=>e[1]-t[1]),this._render(),this.dispatchEvent(new CustomEvent(`offset-changed`,{bubbles:!0,detail:{name:e}})))}removeOffsetValue(e){let t=this._offsets.findIndex(([t])=>t===e);t!==-1&&(this._offsets.splice(t,1),this._render())}offsetValue(e){return this._offsets.find(([t])=>t===e)?.[1]??null}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-level-bar-trough`,this.replaceChildren(this._trough),this.setAttribute(`role`,`meter`),this._render()}attributeChangedCallback(e){if(!(!this._initialized||e===`disabled`)){if(e===`min-value`&&this.value<this.minValue){this._write(`value`,String(this.minValue)),this._notify(e);return}if(e===`max-value`&&(this._clampOffsets(),this.value>this.maxValue)){this._write(`value`,String(this.maxValue)),this._notify(e);return}this._render(),this._notify(e)}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_clampOffsets(){for(let e=0;e<this._offsets.length;e++){let[t,n]=this._offsets[e];n<this.minValue?this._offsets[e]=[t,this.minValue]:n>this.maxValue&&(this._offsets[e]=[t,this.maxValue])}}_property(e){switch(e){case`value`:return this.value;case`min-value`:return this.minValue;case`max-value`:return this.maxValue;case`mode`:return this.mode;case`inverted`:return this.inverted;default:return this.orientation}}_render(){if(!this._trough)return;let e=this.mode===`discrete`,t=this.orientation===`vertical`;this.classList.toggle(`continuous`,!e),this.classList.toggle(`discrete`,e),this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t);let n=this.minValue,r=this.maxValue,i=this.value,a=e?Math.max(1,Math.round(r)-Math.round(n)):1,o=levelClassFor(this._offsets,i);if(this._trough.replaceChildren(),e){let e=Math.min(a,Math.max(0,Math.round(i)-Math.round(n)));for(let t=0;t<a;t++){let n=this.inverted?t>=a-e:t<e;this._trough.append(this._block(n?`filled`:`empty`,n?o:null))}}else{let e=this._block(`empty`,null),t=this._block(`filled`,o);t.style.setProperty(`--level-fraction`,String(r>n?(i-n)/(r-n):0)),t.hidden=i===0,this._trough.append(e,t)}this.setAttribute(`aria-valuemin`,String(n)),this.setAttribute(`aria-valuemax`,String(r)),this.setAttribute(`aria-valuenow`,String(i))}_block(e,t){let n=document.createElement(`span`);return n.className=`adw-level-bar-block ${e}`,e===`filled`&&t&&n.classList.add(t),n}};customElements.define(`gtk-level-bar`,GtkLevelBar);var GtkListBoxRow=class extends HTMLElement{_contentsEl;_activation;_initialized=!1;static get observedAttributes(){return[`activatable`,`selectable`]}get activatable(){return this.getAttribute(`activatable`)!==`false`}set activatable(e){this.setAttribute(`activatable`,String(!!e))}get selectable(){return this.getAttribute(`selectable`)!==`false`}set selectable(e){this.setAttribute(`selectable`,String(!!e))}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}get child(){return this._contentsEl.firstElementChild}connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-list-box-row-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`listitem`),this._claimed?this._syncActivation():this.syncClasses(!0))}claim(){this._claimed=!0}release(){this._claimed=!1,this.syncClasses(!1)}_canSelect=!0;_claimed=!1;attributeChangedCallback(){this._initialized&&this.syncClasses(this._canSelect)}syncClasses(e){this._canSelect=e,this.classList.toggle(`activatable`,this.activatable||this.selectable&&e),this._syncActivation()}_syncActivation(){this._activation??=attachRowActivation({row:this,activatable:()=>this.classList.contains(`activatable`),activate:()=>this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}),this._claimed||this._activation.sync()}};customElements.define(`gtk-list-box-row`,GtkListBoxRow);const vn=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&vn.has(e)?e:`all`}var GtkListBox=class extends HTMLElement{_rows=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`show-separators`,`tab-behavior`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get tabBehavior(){return normalizeListTabBehavior(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get rows(){return this._rows}get selectedRows(){return[...this._selection]}set selectedRows(e){for(let t of typeof e==`number`?[e]:e??[])this.selectRow(this._rows[t]??null)}get selectedRowElements(){return this._selection.map(e=>this._rows[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows,select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectRows()).observe(this,{childList:!0}),this._applyAttributes(),this._collectRows())}attributeChangedCallback(e){this._initialized&&(this._applyAttributes(),e===`selection-mode`&&this._syncRows(),e===`tab-behavior`&&this._syncTabIndexes())}selectRow(e){let t=e===null?null:this._rows.indexOf(e),n=listBoxSelectRow(this._selection,this._anchor,t,this._rows.length,this.selectionMode,e===null||e.selectable);same(n.selection,this._selection)&&n.anchor===this._anchor||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(e))}unselectRow(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode);same(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._rows.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedRowElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`separators`,this.showSeparators);let e=this.selectionMode!==`none`;this.setAttribute(`role`,e?`listbox`:`list`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}_collectRows(){let e=[...this.querySelectorAll(`:scope > gtk-list-box-row`)];if(!(e.length===this._rows.length&&e.every((e,t)=>e===this._rows[t]))){for(let t of this._rows)e.includes(t)||t.release();for(let t of e)t.claim();this._rows=e,this._selection=this._selection.filter(e=>e<this._rows.length),this._anchor>=this._rows.length&&(this._anchor=-1),this._syncRows()}}_syncRows(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._rows.forEach((n,r)=>{n.syncClasses(e),n.selectable&&e?n.setAttribute(`aria-selected`,String(t.has(r))):n.removeAttribute(`aria-selected`)}),this._syncTabIndexes()}_syncTabIndexes(){let e=this.tabBehavior!==`all`,t=this._selection.length>0?this._selection[0]:0;this._rows.forEach((n,r)=>{n.tabIndex=e?r===t?0:-1:n.classList.contains(`activatable`)?0:-1})}_onClick(e){let t=this._rowAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._rowAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._rowAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_rowAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-list-box-row`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode,t,e.selectable);same(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._rows.indexOf(e))?e:null))}_activate(e){e.activatable&&(this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{row:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})))}_emitSelection(e){this._syncRows(),this.dispatchEvent(new CustomEvent(`selected-rows-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`row-selected`,{bubbles:!0,detail:{row:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-rows`,{bubbles:!0,detail:{selectedRows:[...this._selection]}}))}};function same(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}customElements.define(`gtk-list-box`,GtkListBox);function volumeIconFor(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));return t===0?`audio-volume-muted-symbolic`:t===1?`audio-volume-high-symbolic`:Math.trunc((t-0)/.5)+2===2?`audio-volume-low-symbolic`:`audio-volume-medium-symbolic`}function mediaTimeToString(e,t=!1,n=!1){let r=Math.trunc(e);t&&r++;let i=r%60;r-=i;let a=r%3600/60;r-=a*60;let o=r/3600;return o>0||n?t?`-${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:t?`-${a}:${String(i).padStart(2,`0`)}`:`${a}:${String(i).padStart(2,`0`)}`}var GtkMediaControls=class extends HTMLElement{_initialized=!1;_playButton;_timeLabel;_seekScale;_durationLabel;_volumeButton;_volumeIcon;_volumePopover;_volumeScale;_media=null;_seeking=!1;_volume=1;connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-media-controls-box`,this._playButton=document.createElement(`button`),this._playButton.className=`adw-media-controls-button adw-flat`,this._playButton.type=`button`,this._playButton.title=`Play`,this._playButton.setAttribute(`aria-label`,`Play`),this._playButton.addEventListener(`click`,()=>this._togglePlay());let t=document.createElement(`div`);t.className=`adw-media-controls-time-box`,this._timeLabel=document.createElement(`span`),this._timeLabel.className=`adw-media-controls-time-label`,this._seekScale=document.createElement(`input`),this._seekScale.className=`adw-media-controls-seek-scale`,this._seekScale.type=`range`,this._seekScale.min=`0`,this._seekScale.max=`10`,this._seekScale.step=`1`,this._seekScale.value=`0`,this._seekScale.setAttribute(`aria-label`,`Position`),this._seekScale.addEventListener(`input`,()=>this._onSeekInput()),this._durationLabel=document.createElement(`span`),this._durationLabel.className=`adw-media-controls-duration-label`,t.append(this._timeLabel,this._seekScale,this._durationLabel),this._volumeButton=document.createElement(`button`),this._volumeButton.className=`adw-media-controls-button adw-media-controls-volume-button adw-flat`,this._volumeButton.type=`button`,this._volumeButton.setAttribute(`aria-label`,`Volume`),this._volumeButton.addEventListener(`click`,()=>this._toggleVolumePopover()),this._volumeIcon=document.createElement(`span`),this._volumeIcon.className=`adw-media-controls-volume-icon`,this._volumePopover=document.createElement(`gtk-popover`),this._volumePopover.className=`adw-media-controls-volume-popover`,this._volumeScale=document.createElement(`input`),this._volumeScale.className=`adw-media-controls-volume-scale`,this._volumeScale.type=`range`,this._volumeScale.min=`0`,this._volumeScale.max=`1`,this._volumeScale.step=`0.1`,this._volumeScale.value=`1`,this._volumeScale.setAttribute(`aria-label`,`Volume`),this._volumeScale.addEventListener(`input`,()=>this._onVolumeInput()),this._volumePopover.append(this._volumeScale),this._volumePopover.addEventListener(`click`,e=>e.stopPropagation()),this._volumeButton.append(this._volumeIcon,this._volumePopover),e.append(this._playButton,t,this._volumeButton),this.replaceChildren(e),this._renderVolume(),this._adoptMedia()}get media(){return this._media}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get volume(){return this._volume}set volume(e){this._setVolume(e)}get sensitive(){return this._media!=null}_togglePlay(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}_onSeekInput(){this._seeking=!0,this._media&&(this._media.currentTime=Number.parseFloat(this._seekScale.value)),this._seeking=!1,this._updateTimestamp()}_onVolumeInput(){this._setVolume(Number.parseFloat(this._volumeScale.value))}_setVolume(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));this._volume=t,this._media&&(this._media.volume=t),this._renderVolume()}_renderVolume(){this._volumeScale&&(this._volumeScale.value=String(this._volume));let e=document.createElement(`gtk-image`);e.setAttribute(`icon-name`,volumeIconFor(this._volume)),this._volumeIcon?.replaceChildren(e)}_toggleVolumePopover(){this._volumePopover&&(this._volumePopover.hidden=!this._volumePopover.hidden)}_adoptMedia(){let e=this.getAttribute(`for`),t=e?this.ownerDocument.getElementById(e):null,n=(t instanceof HTMLVideoElement?t:null)??this.closest(`gtk-video`)?.querySelector(`video`)??null;if(n===this._media){this._render();return}if(this._media&&this._detachMedia(),this._media=n,n){this._mediaListeners=[[`timeupdate`,()=>this._updateTimestamp()],[`durationchange`,()=>this._updateDuration()],[`play`,()=>this._updatePlaying(!0)],[`pause`,()=>this._updatePlaying(!1)],[`seeked`,()=>this._updateTimestamp()]];for(let[e,t]of this._mediaListeners)n.addEventListener(e,t);this._setVolume(n.volume)}this._render()}_mediaListeners=[];_detachMedia(){if(this._media)for(let[e,t]of this._mediaListeners)this._media.removeEventListener(e,t);this._mediaListeners=[]}_updateTimestamp(){if(!this._initialized)return;let e=this.timestamp,t=this.duration;!this._seeking&&t>0&&(this._seekScale.value=String(e)),this._timeLabel.textContent=mediaTimeToString(e),this._durationLabel.textContent=mediaTimeToString(t>e?t-e:0,!0),this._durationLabel.hidden=t<=0}_updateDuration(){this._initialized&&(this._seekScale.max=String(this.duration>0?this.duration:10),this._updateTimestamp())}_updatePlaying(e){if(!this._initialized)return;let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,e?`media-playback-pause-symbolic`:`media-playback-start-symbolic`),this._playButton.replaceChildren(t),this._playButton.title=e?`Pause`:`Play`,this._playButton.setAttribute(`aria-label`,e?`Pause`:`Play`)}_render(){if(!this._initialized)return;let e=this._media??null,t=e!==null;this.classList.toggle(`insensitive`,!t),this._playButton.disabled=!t,this._seekScale.disabled=!t,this._volumeButton.disabled=!t,this._volumeScale.disabled=!t,this._updateDuration(),this._updateTimestamp(),this._updatePlaying(t&&!e.paused)}};customElements.define(`gtk-media-controls`,GtkMediaControls);const yn={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_model=[];_actions=null;_menuTitle=``;_initialized=!1;_menuView;static get observedAttributes(){return[`icon-name`,`menu-title`,`menu-model`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuModel(){return this._model}set menuModel(e){this._model=this._acceptMenu(e),this._initialized&&this._renderMenu()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,D),n;let r=menuRefusals(n,D);if(r.length===0)return n;console.error(`${D.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._initialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??this._menuTitle}set menuTitle(e){this._menuTitle=e??``,this.setAttribute(`menu-title`,this._menuTitle)}get direction(){let e=this.getAttribute(`direction`);return isSplitButtonDirection(e)?e:`down`}set direction(e){this.setAttribute(`direction`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-menu-button`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-menu-button-button`,this._buttonEl.setAttribute(`aria-haspopup`,`menu`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._popoverEl=document.createElement(`gtk-popover`),this._popoverEl.classList.add(`adw-menu-button-popover`),this._popoverEl.setAttribute(`role`,`menu`),this._popoverEl.setAttribute(`menu`,``),this._popoverEl.setAttribute(`align`,`end`),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._menuView=new PopoverMenuView(this._popoverEl,`adw-menu-button`,e=>{let t=menuItemAt(this._model,e);t!==null&&(this._popoverEl.popdown(),this._buttonEl.focus(),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._model.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._model.length===0&&(this._model=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1)}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e?this._menuView.focusableRows[0]?.focus():this._menuView.reset()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._buttonEl.disabled=e,e&&this._popoverEl.popdown(),this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`circular`,this.hasAttribute(`circular`)),this._popoverEl.position=yn[Je(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createGtkImage(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.getAttribute(`menu-title`)??this._menuTitle),this._menuView.render(),this._model.length===0&&this._popoverEl.popdown()}};customElements.define(`gtk-menu-button`,GtkMenuButton);const bn=[`top`,`bottom`,`left`,`right`],xn=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends HTMLElement{_current=null;_initialized=!1;_initializedChildren=new WeakSet;_header;_tabs;_observer=null;_tabNodes=[];_menu=null;static get observedAttributes(){return[`page`,`tab-pos`,`show-tabs`,`show-border`,`scrollable`,`enable-popup`,`group-name`]}get page(){return this._current?this._pages().indexOf(this._current):-1}set page(e){this.setCurrentPage(e)}get tabPos(){let e=this.getAttribute(`tab-pos`);return e!==null&&bn.includes(e)?e:`top`}set tabPos(e){this._write(`tab-pos`,e)}get showTabs(){return this._flag(`show-tabs`,!0)}set showTabs(e){this._write(`show-tabs`,e?``:`false`)}get showBorder(){return this._flag(`show-border`,!0)}set showBorder(e){this._write(`show-border`,e?``:`false`)}get scrollable(){return this._flag(`scrollable`,!1)}set scrollable(e){this._write(`scrollable`,e?``:`false`)}get enablePopup(){return this._flag(`enable-popup`,!1)}set enablePopup(e){this._write(`enable-popup`,e?``:`false`)}get groupName(){return this.getAttribute(`group-name`)}set groupName(e){this._write(`group-name`,e)}get currentPage(){return this._current}get nPages(){return this._pages().length}getNthPage(e){let t=this._pages();return t[e<0?t.length-1:e]??null}pageNum(e){return this._pages().indexOf(e)}getPage(e){return this._pages().includes(e)?this._page(e):null}setPage(e){let t=this._pages().indexOf(e);return t===-1?!1:this.setCurrentPage(t)}nextPage(){return this._searchPage(1)}prevPage(){return this._searchPage(-1)}setCurrentPage(e){let t=this._pages(),n=t[e<0?t.length-1:e];return n?this._switchTo(n):!1}appendPage(e,t){return this.insertPage(e,-1,t)}insertPage(e,t,n){let r=t<0?this._pages().length:t;return n!=null&&e.setAttribute(`tab-label`,n),this._initChild(e),this.insertBefore(e,this._pages()[r]??null),this.dispatchEvent(new CustomEvent(`page-added`,{bubbles:!0,detail:{position:r,nPages:this._pages().length}})),this._current||this._switchTo(e),this._render(),r}removePage(e){let t=this._pages().indexOf(e);return t===-1?!1:(e===this._current&&(this._current=null),e.remove(),this.dispatchEvent(new CustomEvent(`page-removed`,{bubbles:!0,detail:{position:t,nPages:this._pages().length}})),this._current||this._takeOver(t),this._render(),!0)}refresh(){this._render()}connectedCallback(){if(this._initialized)this._observer=new MutationObserver(e=>this._onMutations(e));else{this._initialized=!0,this._header=document.createElement(`div`),this._header.className=`adw-notebook-header`,this._tabs=document.createElement(`div`),this._tabs.className=`adw-notebook-tabs`,this._tabs.setAttribute(`role`,`tablist`),this._header.appendChild(this._tabs);for(let e of this._pages())this._initChild(e)}this._header.parentNode!==this&&this.prepend(this._header),this._observer?.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...xn,`hidden`]}),this._current||this._switchTo(this._firstVisible()),this.addEventListener(`contextmenu`,this._onContextMenu),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this.removeEventListener(`contextmenu`,this._onContextMenu),this._closeMenu()}attributeChangedCallback(e){if(this._initialized){if(e===`page`){let t=this.getAttribute(e);t!==null&&this.setCurrentPage(Number.parseInt(t,10));return}this._render(),this._notify(e)}}_switchTo(e){let t=this._pages().indexOf(e);if(t===-1||!this._page(e).visible||this._current===e)return!1;let n=new CustomEvent(`switch-page`,{bubbles:!0,cancelable:!0,detail:{page:t,child:e}});return this.dispatchEvent(n),n.defaultPrevented?!1:(this._current=e,this._render(),this._notify(`page`),!0)}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){switch(e){case`page`:return this.page;case`tab-pos`:return this.tabPos;case`show-tabs`:return this.showTabs;case`show-border`:return this.showBorder;case`scrollable`:return this.scrollable;case`enable-popup`:return this.enablePopup;default:return this.groupName}}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_pages(){return Array.from(this.children).filter(e=>e!==this._header)}_page(e){return{tabLabel:e.getAttribute(`tab-label`),menuLabel:e.getAttribute(`menu-label`),tabFill:e.getAttribute(`tab-fill`)!==`false`,tabExpand:e.hasAttribute(`tab-expand`),reorderable:e.hasAttribute(`reorderable`),detachable:e.hasAttribute(`detachable`),visible:!e.hasAttribute(`hidden`),child:e}}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-notebook-page`))}_firstVisible(){return this._pages().find(e=>this._page(e).visible)??null}_searchPage(e){let t=this._pages(),n=this._current?t.indexOf(this._current):-1;for(let r=n+e;r>=0&&r<t.length;r+=e)if(this._switchTo(t[r]))return!0;return!1}_takeOver(e){let t=this._pages();for(let n of[...t.slice(e),...t.slice(0,e)])if(this._switchTo(n))return!0;return!1}_onMutations(e){let t=new Set(this._pages()),n=e.filter(e=>e.target===this||t.has(e.target));if(n.length===0)return;let r=0,i=0,a=[];for(let e of n){if(e.type===`childList`){for(let t of Array.from(e.removedNodes))t===this._current&&(this._current=null),i+=1;for(let t of Array.from(e.addedNodes))!(t instanceof HTMLElement)||t===this._header||(this._initChild(t),r+=1);continue}let t=e.attributeName;if(t===`hidden`){(!this._current||!this._page(this._current).visible)&&this._switchTo(this._firstVisible());continue}t&&xn.includes(t)&&a.push(e.target)}(r>0||i>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{added:r,removed:i}}));for(let e of a)this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}}));this._render()}_effectiveTabPos(){let e=this.tabPos;return this.getAttribute(`dir`)===`rtl`?e===`left`?`right`:e===`right`?`left`:e:e}_render(){if(!this._initialized)return;let e=this._pages();e.length!==this._tabNodes.length&&(this._tabs.replaceChildren(),this._tabNodes=e.map(()=>this._buildTab()),this._tabs.append(...this._tabNodes));let t=this._current?e.indexOf(this._current):-1,n=0;e.forEach((e,r)=>{let i=this._tabNodes[r];if(!i)return;let a=this._page(e),o=r===t;a.visible&&(n+=1);let s=a.tabLabel??`Page ${n}`;i.textContent!==s&&(i.textContent=s),i.classList.toggle(`active`,o),i.classList.toggle(`expand`,a.tabExpand),i.classList.toggle(`fill`,a.tabFill),i.classList.toggle(`reorderable`,a.reorderable);let c=!a.visible;i.hidden!==c&&(i.hidden=c),i.setAttribute(`aria-selected`,String(o)),e.classList.toggle(`visible-page`,o),o?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)});let r=!this.showTabs;this._header.hidden!==r&&(this._header.hidden=r);let i=this._effectiveTabPos();this.getAttribute(`data-tab-pos`)!==i&&this.setAttribute(`data-tab-pos`,i),this.classList.toggle(`frame`,this.showBorder)}_buildTab(){let e=document.createElement(`button`);return e.type=`button`,e.className=`adw-notebook-tab`,e.setAttribute(`role`,`tab`),e.addEventListener(`click`,()=>{let t=this._tabNodes.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&this._switchTo(n)}),e}_onContextMenu=e=>{if(!this.enablePopup)return;e.preventDefault(),this._closeMenu();let t=document.createElement(`div`);t.className=`adw-notebook-menu`,t.setAttribute(`role`,`listbox`);let n=0;for(let e of this._pages()){let r=this._page(e);r.visible&&(n+=1);let i=document.createElement(`button`);i.type=`button`,i.className=`adw-notebook-menu-item`,i.setAttribute(`role`,`option`),i.textContent=r.menuLabel??r.tabLabel??`Page ${n}`,i.hidden=!r.visible,i.setAttribute(`aria-selected`,String(e===this._current)),i.addEventListener(`click`,()=>{this._switchTo(e),this._closeMenu()}),t.appendChild(i)}this.appendChild(t),this._menu=t};_closeMenu(){this._menu?.remove(),this._menu=null}};customElements.define(`gtk-notebook`,GtkNotebook);const Sn=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends HTMLElement{_childEl;_layerEl;_initialized=!1;_resize=null;_mutations=null;static get observedAttributes(){return[]}get child(){return this._childEl?.firstElementChild??null}get overlayLayer(){return this._layerEl}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-overlay-child`,this._layerEl=document.createElement(`div`),this._layerEl.className=`adw-overlay-layer`,bindSlottedChildren(this,[{into:this._childEl},{name:`overlay`,into:this._layerEl}]).install(this._childEl,this._layerEl),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._syncEdgeClasses()),this._resize.observe(this._layerEl),this._mutations=new MutationObserver(()=>this._syncEdgeClasses()),this._mutations.observe(this._layerEl,{childList:!0,attributes:!0,subtree:!0}),this._syncEdgeClasses())}_syncEdgeClasses(){let e=this.matches(`:dir(rtl)`);for(let t of this._layerEl.children){let n=t.getAttribute(`halign`),r=t.getAttribute(`valign`),i={left:e?n===`end`:n===`start`,right:e?n===`start`:n===`end`,top:r===`start`,bottom:r===`end`};for(let e of Sn)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const K=25.4,q=[{name:`na_letter`,displayName:`US Letter`,width:8.5*K,height:11*K},{name:`na_legal`,displayName:`US Legal`,width:8.5*K,height:14*K},{name:`iso_a4`,displayName:`A4`,width:210,height:297},{name:`iso_a5`,displayName:`A5`,width:148,height:210},{name:`roc_16k`,displayName:`ROC 16k`,width:7.75*K,height:10.75*K},{name:`iso_b5`,displayName:`B5`,width:176,height:250},{name:`jis_b5`,displayName:`JB5`,width:182,height:257},{name:`na_number-10`,displayName:`#10 Envelope`,width:4.125*K,height:9.5*K},{name:`iso_dl`,displayName:`DL Envelope`,width:110,height:220},{name:`jpn_chou3`,displayName:`Choukei 3 Envelope`,width:120,height:235},{name:`na_ledger`,displayName:`Tabloid`,width:11*K,height:17*K},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],Cn=new Set([`na_letter`,`na_legal`,`iso_a4`]);function doubleToString(e,t){let n=t===`inch`?e.toFixed(2):e.toFixed(1);return n.includes(`.`)&&(n=n.replace(/0+$/,``),n.endsWith(`.`)&&(n=n.slice(0,-1))),n}function defaultMargins(e){return{top:.25*K,bottom:(Cn.has(e.name)?.56:.25)*K,left:.25*K,right:.25*K}}function defaultPageSetup(){let e=q.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return q.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??q[2]}function pageSetupEquals(e,t){return e.paperSize===t.paperSize&&e.margins.top===t.margins.top&&e.margins.bottom===t.margins.bottom&&e.margins.left===t.margins.left&&e.margins.right===t.margins.right}function orientedSize(e,t=`mm`){let n=paperSizeOf(e),r=e.orientation===`landscape`||e.orientation===`reverse-landscape`,i=r?n.height:n.width,a=r?n.width:n.height;return t===`mm`?{width:i,height:a}:{width:i/K,height:a/K}}function unitLabel(e){return e===`mm`?`mm`:`inch`}function paperSizeLabel(e,t=`mm`){let{width:n,height:r}=orientedSize(e,t);return`${doubleToString(n,t)} × ${doubleToString(r,t)} ${unitLabel(t)}`}function paperMarginsTooltip(e,t=`mm`){let inUnit=e=>t===`mm`?e:e/K,shown=e=>`${doubleToString(inUnit(e),t)} ${unitLabel(t)}`,{margins:n}=e;return[`Margins:`,` Left: ${shown(n.left)}`,` Right: ${shown(n.right)}`,` Top: ${shown(n.top)}`,` Bottom: ${shown(n.bottom)}`].join(`
7
- `)}const wn={name:`Any Printer`,location:`For portable documents`},Tn=[[`portrait`,`Portrait`],[`reverse-portrait`,`Reverse portrait`],[`landscape`,`Landscape`],[`reverse-landscape`,`Reverse landscape`]];var GtkPageSetupUnixDialog=class extends AdwDialog{_built=!1;static get observedAttributes(){return[...AdwDialog.observedAttributes]}_printerEl;_paperEl;_sizeLabelEl;_radios=new Map;_printers=[];_setups=[];_lastSetup=null;_printSettings=null;_unit=`mm`;get unit(){return this._unit}set unit(e){this._unit=e,this._built&&this._renderSetup()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._built&&this._renderSetup()}get pageSetup(){return{...this._current(),orientation:this._orientation()}}set pageSetup(e){let t=this._setups.findIndex(t=>pageSetupEquals(t,e));t<0?(this._setups.push(e),this._paperEl.selected=this._setups.length-1):this._paperEl.selected!==t&&(this._paperEl.selected=t),this._setOrientation(e.orientation),this._built&&this._renderSetup()}get printSettings(){return this._printSettings}set printSettings(e){this._printSettings=e;let t=e?.[`format-for-printer`];if(t===void 0)return;let n=this._printerRows().findIndex(e=>e.name===t);n>=0&&(this._printerEl.selected=n)}connectedCallback(){if(this._built){super.connectedCallback();return}super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Page Setup`),this._fillPaperSizes();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderSetup();let t=this._setups.findIndex(e=>e.paperSize===defaultPageSetup().paperSize);t>=0&&this._paperEl.selected!==t&&(this._paperEl.selected=t,this._renderSetup()),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&this._renderSetup()}_build(){let e=document.createElement(`div`);e.className=`adw-page-setup-grid`,this._printerEl=this._dropDown(`printer`,`_Format for:`),this._printerEl.addEventListener(`notify::selected`,()=>this._printerChanged()),e.append(this._label(`_Format for:`),this._printerEl),this._paperEl=this._dropDown(`paper`,`_Paper size:`),this._paperEl.addEventListener(`notify::selected`,()=>this._paperChanged()),e.append(this._label(`_Paper size:`),this._paperEl),this._sizeLabelEl=document.createElement(`div`),this._sizeLabelEl.className=`adw-page-setup-size-label`,this._sizeLabelEl.setAttribute(`aria-live`,`polite`),e.append(this._sizeLabelEl),e.append(this._label(`_Orientation:`));for(let[t,n]of Tn){let r=document.createElement(`adw-radio`);r.className=`adw-page-setup-orientation`,r.setAttribute(`label`,n),r.setAttribute(`name`,`adw-page-setup-orientation`),r.setAttribute(`value`,t),r.addEventListener(`notify::checked`,()=>this._orientationChanged()),this._radios.set(t,r),e.appendChild(r)}return e.appendChild(this._actions()),e}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-page-setup-${e}`,n.setAttribute(`aria-label`,t.replace(`_`,``)),n}_label(e){let t=document.createElement(`div`);return t.className=`adw-page-setup-label`,t.textContent=e.replace(`_`,``),t}_actions(){let e=document.createElement(`div`);e.className=`adw-page-setup-actions`;let t=document.createElement(`button`);t.type=`button`,t.className=`adw-page-setup-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6));let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-page-setup-apply suggested-action`,n.textContent=`Apply`,n.addEventListener(`click`,()=>this._respond(-5)),e.append(t,n),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),this.close()}_printerRows(){return[wn,...this._printers]}_fillPaperSizes(){this._setups=q.map(e=>({paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}))}_current(){return this._setups[this._paperEl.selected]??defaultPageSetup()}_orientation(){for(let[e,t]of this._radios)if(t.checked)return e;return`portrait`}_setOrientation(e){let t=this._radios.get(e);t!==void 0&&(t.checked=!0)}_renderSetup(){let e=this._printerRows();this._printerEl.setAttribute(`model`,JSON.stringify(e.map(e=>e.name))),this._printerEl.selected>=e.length&&(this._printerEl.selected=0);let t=[...this._setups.map(e=>paperSizeOf(e).displayName),`Manage Custom Sizes…`];this._paperEl.setAttribute(`model`,JSON.stringify(t)),this._paperEl.selected>=t.length&&(this._paperEl.selected=0);let n=this._current();this._sizeLabelEl.textContent=paperSizeLabel(n,this._unit),this._sizeLabelEl.title=paperMarginsTooltip(n,this._unit)}_printerChanged(){let e=this._printerRows()[this._printerEl.selected];(e===void 0||e.name===wn.name)&&this._fillPaperSizes(),this._renderSetup(),this._printSettings!==null&&(this._printSettings={"format-for-printer":e?.name})}_paperChanged(){let e=this._paperEl.selected;if(e>=this._setups.length){let e=this._lastSetup??defaultPageSetup();this._setups.push(e),this._paperEl.selected=this._setups.length-1,this._renderSetup();return}this._lastSetup=this._setups[e]??null,this._renderSetup()}_orientationChanged(){this._built&&(this._setups[this._paperEl.selected]={...this._current(),orientation:this._orientation()},this._renderSetup())}};customElements.define(`gtk-page-setup-unix-dialog`,GtkPageSetupUnixDialog);function computePanedPosition(e){let{allocation:t,startRequest:n,endRequest:r,resizeStart:i,resizeEnd:a,shrinkStart:o,shrinkEnd:s}=e,c=o?0:n,l=t;s||(l=Math.max(1,l-r)),l=Math.max(c,l);let u;return u=e.positionSet?e.lastAllocation>0?i&&!a?e.startChildSize+t-e.lastAllocation:!i&&a?e.startChildSize:t*(e.startChildSize/e.lastAllocation)+.5:e.startChildSize:i&&!a?Math.max(0,t-r):!i&&a?n:n+r===0?t*.5+.5:t*(n/(n+r))+.5,u=Math.trunc(u),{min:c,max:l,position:glibClamp(u,c,l)}}var GtkPaned=class extends HTMLElement{_startEl;_handleEl;_endEl;_initialized=!1;_position=-1;_positionSet=!1;_minPosition=0;_maxPosition=2**53-1;_lastAllocation=0;_dragPos=0;_dragging=!1;_resize=null;static get observedAttributes(){return[`orientation`,`position`,`position-set`,`resize-start-child`,`resize-end-child`,`shrink-start-child`,`shrink-end-child`,`wide-handle`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get position(){return this._position}set position(e){this.setPosition(e)}get positionSet(){return this._positionSet}get minPosition(){return this._minPosition}get maxPosition(){return this._maxPosition}get wideHandle(){return this.hasAttribute(`wide-handle`)}set wideHandle(e){this.toggleAttribute(`wide-handle`,!!e)}get startChild(){return this._startEl?.firstElementChild??null}get endChild(){return this._endEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-paned-child`,this._handleEl=document.createElement(`div`),this._handleEl.className=`adw-paned-handle separator`,this._handleEl.setAttribute(`role`,`separator`),this._handleEl.tabIndex=0,this._endEl=document.createElement(`div`),this._endEl.className=`adw-paned-child`,bindSlottedChildren(this,[{into:this._startEl},{name:`start`,into:this._startEl},{name:`end`,into:this._endEl}],()=>this._observe()).install(this._startEl,this._handleEl,this._endEl),this._handleEl.addEventListener(`pointerdown`,this._onPointerDown),this._handleEl.addEventListener(`keydown`,this._onKeyDown);let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e),this._observe(),this._layout()}disconnectedCallback(){this._dragging=!1,this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e){if(this._initialized){if(e===`position`){let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e);return}e!==`position-set`&&(this._layout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}}_property(e){switch(e){case`orientation`:return this.orientation;case`resize-start-child`:return this.getAttribute(`resize-start-child`)!==`false`;case`resize-end-child`:return this.getAttribute(`resize-end-child`)!==`false`;case`shrink-start-child`:return this.getAttribute(`shrink-start-child`)!==`false`;case`shrink-end-child`:return this.getAttribute(`shrink-end-child`)!==`false`;case`wide-handle`:return this.wideHandle;default:return this.getAttribute(e)}}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._layout()),this._resize.observe(this));for(let e of[this._startEl,this._endEl]){let t=e.firstElementChild;t&&this._resize.observe(t)}}setPosition(e){if(Number.isFinite(e)){if(e<0){this._positionSet&&(this._positionSet=!1,this._notify(`position-set`,{positionSet:!1})),this._position=-1,this._layout();return}this._positionSet||(this._positionSet=!0,this._notify(`position-set`,{positionSet:!0})),this._position!==e&&(this._position=e,this._notify(`position`,{position:e}),this._layout())}}_layout(){if(!this._startEl)return;let e=this.orientation===`horizontal`,t=this._handleEl.getBoundingClientRect(),n=e?t.width:t.height,r=Math.max(1,(e?this.clientWidth:this.clientHeight)-n),i=computePanedPosition({allocation:r,startRequest:this._sizeRequest(this._startEl,e),endRequest:this._sizeRequest(this._endEl,e),resizeStart:this.getAttribute(`resize-start-child`)!==`false`,resizeEnd:this.getAttribute(`resize-end-child`)!==`false`,shrinkStart:this.getAttribute(`shrink-start-child`)!==`false`,shrinkEnd:this.getAttribute(`shrink-end-child`)!==`false`,positionSet:this._positionSet,startChildSize:this._position<0?0:this._position,lastAllocation:this._lastAllocation}),a=Math.floor(i.position);a!==this._position&&(this._position=a,this._notify(`position`,{position:a})),i.min!==this._minPosition&&(this._minPosition=i.min,this._notify(`min-position`,{minPosition:i.min})),i.max!==this._maxPosition&&(this._maxPosition=i.max,this._notify(`max-position`,{maxPosition:i.max})),this._lastAllocation=r,this._startEl.style.flexBasis=`${Math.max(1,a)}px`,this._startEl.style.flexGrow=`0`,this._endEl.style.flexGrow=this.getAttribute(`resize-end-child`)===`false`?`0`:`1`,this._applyMinimum(this._startEl,`shrink-start-child`,e),this._applyMinimum(this._endEl,`shrink-end-child`,e);let o=a!==0,s=a!==r;this._startEl.hidden=!o,this._endEl.hidden=!s,this._handleEl.hidden=!o||!s,this.classList.toggle(`horizontal`,e),this.classList.toggle(`vertical`,!e),this._handleEl.classList.toggle(`wide`,this.wideHandle),this._handleEl.setAttribute(`aria-orientation`,this.orientation),this._handleEl.setAttribute(`aria-valuemin`,`0`),this._handleEl.setAttribute(`aria-valuemax`,String(e?this.clientWidth:this.clientHeight)),this._handleEl.setAttribute(`aria-valuenow`,String(a))}_sizeRequest(e,t){let n=e.style.flexGrow,r=e.style.flexShrink,i=e.style.flexBasis;e.style.flex=`none`;let a=t?e.offsetWidth:e.offsetHeight;return e.style.flexGrow=n,e.style.flexShrink=r,e.style.flexBasis=i,a}_applyMinimum(e,t,n){let r=this.getAttribute(t)!==`false`;e.style.minWidth=n&&r?`0`:``,e.style.minHeight=n?``:r?`0`:``}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}get _isRtl(){return this.orientation===`horizontal`&&this.matches(`:dir(rtl)`)}_onPointerDown=e=>{if(e.button!==0||this._handleEl.hidden)return;this._dragging=!0,this._handleEl.setPointerCapture(e.pointerId);let t=this.orientation===`horizontal`,n=this._handleEl.getBoundingClientRect(),r=t?e.clientX:e.clientY,i=t?n.left:n.top;this._dragPos=r-i-(this.wideHandle?0:6),this._handleEl.addEventListener(`pointermove`,this._onPointerMove),this._handleEl.addEventListener(`pointerup`,this._onPointerUp),this._handleEl.addEventListener(`pointercancel`,this._onPointerUp)};_onPointerMove=e=>{if(!this._dragging)return;let t=this.orientation===`horizontal`,n=(t?e.clientX:e.clientY)-this._dragPos,r=t?this._handleEl.offsetWidth:this._handleEl.offsetHeight,i=this._isRtl?(t?this.clientWidth:this.clientHeight)-n-r:n;this.setPosition(glibClamp(Math.round(i),this._minPosition,this._maxPosition))};_onPointerUp=e=>{this._dragging&&(this._dragging=!1,this._handleEl.hasPointerCapture(e.pointerId)&&this._handleEl.releasePointerCapture(e.pointerId),this._handleEl.removeEventListener(`pointermove`,this._onPointerMove),this._handleEl.removeEventListener(`pointerup`,this._onPointerUp),this._handleEl.removeEventListener(`pointercancel`,this._onPointerUp))};_onKeyDown=e=>{if(e.altKey||e.metaKey||e.shiftKey)return;if(e.key===`Escape`){this.dispatchEvent(new CustomEvent(`cancel-position`,{bubbles:!0,detail:{}}));return}if(e.key===`Enter`||e.key===` `){this.dispatchEvent(new CustomEvent(`accept-position`,{bubbles:!0,detail:{}}));return}let t=0,n=null;switch(e.key){case`ArrowLeft`:t=e.ctrlKey?-75:-1;break;case`ArrowRight`:t=e.ctrlKey?75:1;break;case`ArrowUp`:t=e.ctrlKey?-75:-1;break;case`ArrowDown`:t=e.ctrlKey?75:1;break;case`PageUp`:t=-75;break;case`PageDown`:t=75;break;case`Home`:n=`start`;break;case`End`:n=`end`;break;default:return}e.preventDefault();let r;n===`start`?r=this._minPosition:n===`end`?r=this._maxPosition:(this._isRtl&&(t=-t),r=this._position+t),this.setPosition(glibClamp(r,this._minPosition,this._maxPosition))}};customElements.define(`gtk-paned`,GtkPaned);var GtkPasswordEntry=class extends GtkEntry{_entry=new EntryRowState;_password=new PasswordEntryRowState(this._entry);_toggle;_peekIcon;_capsLock;static get observedAttributes(){return[...GtkEntry.observedAttributes,`show-peek-icon`]}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}connectedCallback(){super.connectedCallback(),this._input.type=`password`,this._input.autocomplete=`new-password`,this._capsLock=document.createElement(`span`),this._capsLock.className=`adw-password-entry-caps-lock`,this._capsLock.textContent=`⇪`,this._capsLock.setAttribute(`role`,`alert`),this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only adw-password-entry-peek`,this._peekIcon=createGtkImage(null,`adw-password-entry-peek-icon`),this._toggle.append(this._peekIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this._toggle.addEventListener(`mousedown`,e=>e.preventDefault());let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock),this._input.addEventListener(`focus`,()=>{this._entry.setEditing(!0),this._passwordChanged()}),this._input.addEventListener(`blur`,()=>{this._entry.setEditing(!1),this._passwordChanged()}),this.replaceChildren(this._capsLock,this._input,this._toggle),this._toggle.hidden=!this.hasAttribute(`show-peek-icon`),this._applyPassword(this._password.state),this._password.subscribe(e=>{this._applyPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`show-peek-icon`&&this._toggle&&(this._toggle.hidden=n===null)}_passwordChanged(){this._applyPassword(this._password.state)}_applyPassword(e){this._input.type=e.revealed?`text`:`password`,this._peekIcon.dataset.iconName=e.peekIconName,this._peekIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`),this._capsLock.dataset.iconName=e.indicatorIconName,this._capsLock.title=e.indicatorTooltip,this._capsLock.setAttribute(`aria-label`,e.indicatorTooltip),this._capsLock.hidden=!this._entry.state.indicatorVisible}};customElements.define(`gtk-password-entry`,GtkPasswordEntry);const En=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return En.includes(e)?e:`contain`}var GtkPicture=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`alternative-text`,`can-shrink`,`content-fit`,`isolate-contents`,`keep-aspect-ratio`]}get alternativeText(){return this.getAttribute(`alternative-text`)??``}set alternativeText(e){this._write(`alternative-text`,e)}get canShrink(){return!this.hasAttribute(`can-shrink`)||this.getAttribute(`can-shrink`)!==`false`}set canShrink(e){this._toggle(`can-shrink`,e,!0)}get contentFit(){return normalizePictureContentFit(this.getAttribute(`content-fit`))}set contentFit(e){this._write(`content-fit`,e)}get isolateContents(){return!this.hasAttribute(`isolate-contents`)||this.getAttribute(`isolate-contents`)!==`false`}set isolateContents(e){this._toggle(`isolate-contents`,e,!0)}get keepAspectRatio(){return this.contentFit!==`fill`}set keepAspectRatio(e){this.contentFit=e?`contain`:`fill`}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}_toggle(e,t,n){let r=t?``:`false`;if(n){t?this.removeAttribute(e):this._write(e,r);return}this._write(e,r)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`img`),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),e===`content-fit`&&(t===`fill`||n===`fill`)&&this.dispatchEvent(new CustomEvent(`notify::keep-aspect-ratio`,{bubbles:!0,detail:{"keep-aspect-ratio":this.keepAspectRatio}})),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`alternative-text`:return this.alternativeText;case`can-shrink`:return this.canShrink;case`isolate-contents`:return this.isolateContents;case`keep-aspect-ratio`:return this.keepAspectRatio;default:return this.contentFit}}_render(){this.style.setProperty(`--gtk-picture-content-fit`,this.contentFit),this.classList.toggle(`can-shrink`,this.canShrink),this.classList.toggle(`isolated`,this.isolateContents),this.alternativeText?this.setAttribute(`aria-label`,this.alternativeText):this.removeAttribute(`aria-label`)}};customElements.define(`gtk-picture`,GtkPicture);const J=`main`;var GtkPopoverMenu=class extends GtkPopover{_model=[];_actions=null;_menuView;_menuInitialized=!1;static get observedAttributes(){return[...GtkPopover.observedAttributes,`menu-model`,`menu-title`,`visible-submenu`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,D),this._menuInitialized&&this._renderMenu()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._menuInitialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??``}set menuTitle(e){this.setAttribute(`menu-title`,e??``)}get visibleSubmenu(){let e=this._openPageLabel();return e===null?J:e}set visibleSubmenu(e){this.openSubmenu(e)}connectedCallback(){super.connectedCallback(),!this._menuInitialized&&(this._menuInitialized=!0,this.classList.add(`adw-popover-menu`),this.setAttribute(`role`,`menu`),this.setAttribute(`menu`,``),this._menuView=new PopoverMenuView(this,`adw-popover-menu`,e=>this._activate(e)),this._menuView.setActions(this._actions),this._model.length===0&&(this._model=this._parseMenuAttr()),this._renderMenu(),this.subscribe(e=>{e?this._menuView.focusableRows[0]?.focus():this._menuView.reset()}))}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),this._menuInitialized){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}if(e===`menu-title`){this._menuView.setTitle(this.menuTitle),this._menuView.render();return}e===`visible-submenu`&&this._navigate(n??J)}}openSubmenu(e){this._navigate(e)}_navigate(e){let t=this.visibleSubmenu;if(!this._showPage(e))return;let n=this.visibleSubmenu;this._reflectSubmenu(),n!==t&&this.dispatchEvent(new CustomEvent(`notify::visible-submenu`,{bubbles:!0,detail:{visibleSubmenu:n}}))}_showPage(e){if(e===J||e.length===0)this._menuView.reset();else{let t=this._findSubmenu(e);if(t===null)return!1;this._menuView.setMenuModel(this._model),this._menuView.showPage(t)}return this._menuView.render(),!0}closeSubmenus(){this.openSubmenu(J)}_openPageLabel(){let e=this._menuView.page;if(e.length===0)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind!==`item`?t.label:null}_findSubmenu(e){let walk=(t,n)=>{for(let[r,i]of t.entries()){if(i.kind===`item`)continue;let t=[...n,r];if(i.label===e)return t;let a=walk(i.items,t);if(a!==null)return a}return null};return walk(this._model,[])}_reflectSubmenu(){let e=this.visibleSubmenu;this.getAttribute(`visible-submenu`)!==e&&this.setAttribute(`visible-submenu`,e)}_activate(e){let t=menuItemAt(this._model,e);this.popdown(),this.anchor?.focus(),t!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}}))}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.menuTitle),this._menuView.render(),this._model.length===0&&this.popdown()}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,D);if(t.length===0)return e;console.error(`${D.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-menu`,GtkPopoverMenu);var GtkPopoverBin=class extends HTMLElement{_model=[];_popover=null;_actions=null;_initialized=!1;_longPressTimer=null;static get observedAttributes(){return[`menu-model`,`handle-input`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,D),this._adoptPopover(this._buildPopover()),this._notifyModel()}get popoverElement(){return this._popover}set popoverElement(e){this._model=[],this._adoptPopover(e),this._notifyModel()}get handleInput(){return this.hasAttribute(`handle-input`)}set handleInput(e){this.toggleAttribute(`handle-input`,!!e)}get actions(){return this._actions}set actions(e){this._actions=e??null,this._popover!==null&&(this._popover.actions=this._actions)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-bin`),this.addEventListener(`contextmenu`,e=>this._onContextMenu(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._wireGestures(),this._model.length===0&&(this._model=this._parseMenuAttr()),this._model.length>0&&this._adoptPopover(this._buildPopover()))}disconnectedCallback(){this._cancelLongPress()}attributeChangedCallback(e){if(this._initialized){if(e===`handle-input`){this.handleInput||this._cancelLongPress();return}e===`menu-model`&&(this._model=this._parseMenuAttr(),this._adoptPopover(this._model.length>0?this._buildPopover():null),this._notifyModel())}}popup(){this.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._popover;e!==null&&(e.open=!0)}popdown(){this._popover?.popdown()}get childElement(){let e=this.firstElementChild;return e===null||e===this._popover?null:e}_wireGestures(){this.addEventListener(`pointerdown`,e=>{!this.handleInput||this._popover===null||(this._cancelLongPress(),e.pointerType===`touch`&&(this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._popupAt(e)},500)))}),this.addEventListener(`pointerup`,()=>this._cancelLongPress()),this.addEventListener(`pointercancel`,()=>this._cancelLongPress())}_cancelLongPress(){this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null)}_onContextMenu(e){!this.handleInput||this._popover===null||(e.preventDefault(),this._popupAt(e))}_popupAt(e){let t=this._popover;t!==null&&(t.open=!0)}_onKeyDown(e){e.key!==`ContextMenu`&&e.key!==`F10`||e.shiftKey||this._popover!==null&&(e.preventDefault(),this.popup())}_buildPopover(){if(this._model.length===0)return null;let e=document.createElement(`gtk-popover-menu`);return e.setAttribute(`position`,`bottom`),e.setAttribute(`align`,`start`),e.menuModel=this._model,e.actions=this._actions,e.anchor=this,e}_adoptPopover(e){let t=this._popover;t!==null&&t!==e&&(t.popdown(),t.remove()),this._popover=e;let n=this.childElement;if(e===null){n?.classList.remove(`has-open-popup`);return}e.subscribe(e=>{n?.classList.toggle(`has-open-popup`,e)}),this.appendChild(e)}_notifyModel(){this.dispatchEvent(new CustomEvent(`notify::menu-model`,{bubbles:!0,detail:{menuModel:this._model,popover:this._popover}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,D);if(t.length===0)return e;console.error(`${D.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-bin`,GtkPopoverBin);var GtkPopoverMenuBar=class extends HTMLElement{_model=[];_actions=null;_items=[];_active=null;_initialized=!1;static get observedAttributes(){return[`menu-model`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,D),this._initialized&&this._rebuild()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._initialized&&this._rebuild()}get activeItem(){return this._active?.button??null}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-menu-bar`),this.setAttribute(`role`,`menubar`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointerleave`,()=>{this._active!==null&&!this._active.popover.open&&this._setActive(null,!1)}),this._model.length===0&&(this._model=this._parseMenuAttr()),this._rebuild())}attributeChangedCallback(e){!this._initialized||e!==`menu-model`||(this._model=this._parseMenuAttr(),this._rebuild())}selectFirst(){this._setActive(this._items[0]??null,!0)}popup(){this.selectFirst()}_setActive(e,t){let n=e!==this._active,r=this._active!==null&&this._active.popover.open;r&&n&&this._active?.popover.popdown(),n&&(this._active?.button.classList.remove(`selected`),this._active=e,e?.button.classList.add(`selected`)),this._active!==null&&(t||r&&n?this._active.popover.open=!0:n&&this.matches(`:focus-within`)&&this._active.button.focus())}_onKeyDown(e){this._active?.popover.open!==!0&&(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),this._move(e.key===`ArrowRight`?1:-1)))}_move(e){let t=this._items.length;if(t===0)return;let n=(this._active===null?-1:this._items.indexOf(this._active))+e;n<0&&(n=t-1),n>=t&&(n=0),this._setActive(this._items[n],!1)}_rebuild(){this._items=[],this._active=null;let e=[];this._model.forEach((t,n)=>{t.kind===`submenu`&&e.push(this._buildItem(t,[n]))}),this._items=e,this.replaceChildren(...e.map(e=>e.root))}_focusFirstRow(e){e.querySelector(`.adw-popover-item:not([hidden]):not([disabled])`)?.focus()}_buildItem(e,t){let n=document.createElement(`div`);n.className=`adw-popover-menu-bar-item`,n.setAttribute(`role`,`none`);let r=document.createElement(`button`);r.type=`button`,r.className=`adw-popover-menu-bar-button`,r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),r.setAttribute(`aria-expanded`,`false`);let i=document.createElement(`span`);i.className=`adw-popover-menu-bar-label`,i.textContent=e.label,r.appendChild(i);let a=document.createElement(`gtk-popover-menu`);a.setAttribute(`position`,`bottom`),a.setAttribute(`align`,`start`),a.menuModel=e.items,a.actions=this._actions,a.anchor=r,r.setAttribute(`aria-controls`,`popover`);let o={node:e,path:t,root:n,button:r,popover:a};return a.subscribe(e=>{if(r.setAttribute(`aria-expanded`,String(e)),e){for(let e of this._items)e.root.classList.toggle(`active`,e===o);this._focusFirstRow(a)}else o.root.classList.remove(`active`),this._active===o&&(this._active=null)}),a.addEventListener(`menu-item-activated`,e=>{e.stopPropagation();let n=e.detail;this._activate(o,[...t,...n.path])}),r.addEventListener(`click`,()=>this._setActive(o,!0)),n.addEventListener(`pointerenter`,()=>this._setActive(o,!1)),n.append(r,a),o}_activate(e,t){let n=menuItemAt(this._model,t);e.popover.popdown(),e.button.focus(),n!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t]}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,D);if(t.length>0){console.error(`${D.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}for(let[t,n]of e.entries())n.kind!==`submenu`&&console.warn(`Don't know how to handle this item: top-level entry ${t} is a ${n.kind}.`);return e}};customElements.define(`gtk-popover-menu-bar`,GtkPopoverMenuBar);const Dn=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],On=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],kn=[`All sheets`,`Even sheets`,`Odd sheets`],An=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],jn={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...jn};_pageSetup=defaultPageSetup();_printerListEl;_switcherEl;_panelEl;_tabPages=new Map;_tab=`General`;_currentPage=-1;_supportSelection=!1;_hasSelection=!1;_manual=new Set;_range=`all`;_printAt=`now`;_printButton;_previewButton;_conflictsEl;_capabilityControls=new Map;_collateCheck;_reverseCheck;_copiesInput;_paperDrop;_orientationDrop;_pageRangeInput;_selectionRadio;_currentPageRadio;_rangeRadios=new Map;_atInput=null;static get observedAttributes(){return[...AdwDialog.observedAttributes,`current-page`,`embed-page-setup`,`has-selection`,`manual-capabilities`,`support-selection`]}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this._built&&this._renderPrint()}get embedPageSetup(){return this.hasAttribute(`embed-page-setup`)}set embedPageSetup(e){this.toggleAttribute(`embed-page-setup`,e),this._built&&this._renderPrint()}get hasSelection(){return this._hasSelection}set hasSelection(e){this._hasSelection=e,this._built&&this._renderPrint()}get supportSelection(){return this.hasAttribute(`support-selection`)}set supportSelection(e){this.toggleAttribute(`support-selection`,e),this._built&&this._renderPrint()}get manualCapabilities(){return[...this._manual]}set manualCapabilities(e){this._manual=new Set(e.filter(e=>Dn.includes(e))),this._built&&this._renderPrint()}get selectedPrinter(){return this._selected===null?null:{...this._selected}}get pageSetup(){return{...this._pageSetup}}set pageSetup(e){this._pageSetup=e,this._built&&this._renderPrint()}get printSettings(){return{...this._settings}}set printSettings(e){this._settings={...jn,...e},this._built&&this._renderPrint()}get range(){return this._range}set range(e){if(this._range=e,!this._built)return;let t=this._rangeRadios.get(e);t!==void 0&&(t.checked=!0),this._renderPrint()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._selected=null,this._built&&this._renderPrint()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-print-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Print`),this._readManual();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderPrint(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&(e===`manual-capabilities`&&this._readManual(),this._renderPrint())}_readManual(){this._manual=new Set((this.getAttribute(`manual-capabilities`)??``).split(`|`).map(e=>e.trim()).filter(e=>Dn.includes(e)))}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl)}_build(){let e=document.createElement(`div`);return e.className=`adw-print-root`,this._panelEl=document.createElement(`div`),this._panelEl.className=`adw-print-panel`,this._panelEl.setAttribute(`role`,`tabpanel`),e.append(this._panelEl,this._buildConflicts(),this._buildActions()),this._renderPanel(),e}_renderPanel(){for(let e of On){let t=this._tabPages.get(e);t===void 0&&(t=document.createElement(`div`),t.className=`adw-print-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.tab=e,t.appendChild(this._buildTab(e)),this._tabPages.set(e,t),this._panelEl.appendChild(t)),t.hidden=e!==this._tab}}_buildTab(e){switch(e){case`General`:return this._buildGeneral();case`Page Setup`:return this._buildPageSetup();case`Job`:return this._buildJob();case`Image Quality`:case`Color`:case`Finishing`:return this._buildOptionsPage(e);case`Advanced`:return this._buildOptionsPage(e)}}_buildGeneral(){let e=document.createElement(`div`);e.className=`adw-print-columns`,this._printerListEl=document.createElement(`div`),this._printerListEl.className=`adw-print-printer-list`,this._printerListEl.setAttribute(`role`,`radiogroup`),this._printerListEl.setAttribute(`aria-label`,`Printer`),e.appendChild(this._frame(this._printerListEl));let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Range`),r=n.body;for(let[e,t]of[[`all`,`All Pages`],[`current`,`Current Page`],[`selection`,`Selection`]]){let n=this._radio(t,`adw-print-range-${e}`);n.addEventListener(`notify::checked`,()=>{n.checked&&(this._range=e,(e===`current`||e===`selection`)&&this._renderPrint())}),e===`current`&&(this._currentPageRadio=n),e===`selection`&&(this._selectionRadio=n),this._rangeRadios.set(e,n),r.appendChild(n)}let i=this._radio(`Pages:`,`adw-print-range-pages`);i.addEventListener(`notify::checked`,()=>{i.checked&&(this._range=`pages`,this._pageRangeInput.focus())}),this._pageRangeInput=document.createElement(`input`),this._pageRangeInput.type=`text`,this._pageRangeInput.className=`adw-print-page-range-entry`,this._pageRangeInput.title=`Specify one or more page ranges, e.g. 1–3, 7, 11`,this._pageRangeInput.setAttribute(`aria-label`,`Pages`),this._pageRangeInput.addEventListener(`focus`,()=>{this._range=`pages`,i.checked=!0}),this._rangeRadios.set(`pages`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`,a.append(i,this._pageRangeInput),r.appendChild(a),t.appendChild(n.group);let o=this._group(`Copies`),s=o.body,c=document.createElement(`div`);c.className=`adw-print-grid-row`;let l=document.createElement(`div`);l.className=`adw-print-label`,l.textContent=`Copies:`,this._copiesInput=document.createElement(`input`),this._copiesInput.type=`number`,this._copiesInput.min=`1`,this._copiesInput.className=`adw-print-copies`,this._copiesInput.value=this._settings.copies??`1`,this._copiesInput.setAttribute(`aria-label`,`Copies`),this._copiesInput.addEventListener(`input`,()=>{this._settings={...this._settings,copies:this._copiesInput.value},this._renderPrint()}),c.append(l,this._copiesInput),s.appendChild(c),this._collateCheck=this._check(`Collate`,`adw-print-collate`),this._reverseCheck=this._check(`Reverse`,`adw-print-reverse`);for(let e of[this._collateCheck,this._reverseCheck])e.addEventListener(`notify::checked`,()=>this._renderPrint());s.append(this._collateCheck,this._reverseCheck);let u=this._buildCollatePreview(),d=document.createElement(`div`);return d.className=`adw-print-grid-row`,d.appendChild(u),s.appendChild(d),t.appendChild(o.group),e.appendChild(t),e}_buildCollatePreview(){let e=document.createElement(`div`);return e.className=`adw-print-collate-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`A visualization of the effect of the collate and reverse options on the page ordering`),e.dataset.columnA=`2`,e.dataset.columnB=`1`,e}_buildPageSetup(){let e=document.createElement(`div`);e.className=`adw-print-columns`;let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Layout`),r=n.body;r.appendChild(this._labelledRow(`Two-sided:`,this._dropDown(kn,`Two-sided`)));let i=document.createElement(`input`);i.type=`number`,i.min=`10`,i.max=`400`,i.className=`adw-print-scale`,i.value=this._settings.scale??`100`,i.setAttribute(`aria-label`,`Scale in percent`),i.addEventListener(`input`,()=>{this._settings={...this._settings,scale:i.value},this._renderPrint()}),this._capabilityControls.set(`scale`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`;let o=document.createElement(`div`);o.className=`adw-print-label`,o.textContent=`Scale:`;let s=document.createElement(`span`);s.className=`adw-print-label`,s.textContent=`%`,a.append(o,i,s),r.appendChild(a),t.appendChild(n.group);let c=this._group(`Paper`),l=c.body,u=q.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(An.map(e=>e[0].toUpperCase()+e.slice(1)),`Orientation`),l.appendChild(this._labelledRow(`Paper size:`,this._paperDrop)),l.appendChild(this._labelledRow(`Orientation:`,this._orientationDrop)),t.appendChild(c.group),this._paperDrop.addEventListener(`notify::selected`,()=>{this.embedPageSetup&&this._paperChanged(this._paperDrop.selected)}),this._orientationDrop.addEventListener(`notify::selected`,()=>{if(!this.embedPageSetup)return;let e=An[this._orientationDrop.selected]??`portrait`;this._pageSetup={...this._pageSetup,orientation:e},this._settings={...this._settings,orientation:e},this._renderPrint()}),e.append(t,this._buildSheetPreview()),e}_buildSheetPreview(){let e=document.createElement(`div`);e.className=`adw-print-sheet-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Page layout preview`);let t=document.createElement(`div`);t.className=`adw-print-paper`;let n=paperSizeOf(this._pageSetup),r=this._pageSetup.orientation===`landscape`||this._pageSetup.orientation===`reverse-landscape`;t.style.aspectRatio=r?`${n.height} / ${n.width}`:`${n.width} / ${n.height}`;let i=document.createElement(`div`);i.className=`adw-print-number-up`,i.dataset.cells=`1`,t.appendChild(i),e.appendChild(t);let a=document.createElement(`div`);return a.className=`adw-print-sheet-caption`,a.textContent=`${orientedSize(this._pageSetup).width.toFixed(1)} mm × ${orientedSize(this._pageSetup).height.toFixed(1)} mm`,e.appendChild(a),e}_buildJob(){let e=document.createElement(`div`);e.className=`adw-print-column`;let t=this._group(`Job Details`);t.body.appendChild(this._optionsGrid(`Job Details`));let n=this._group(`Print Document`),r=n.body;for(let[e,t]of[[`now`,`Now`],[`at`,`At:`],[`hold`,`On hold`]]){let n=this._radio(t,`adw-print-at`);if(n.addEventListener(`notify::checked`,()=>{n.checked&&(this._printAt=e,this._atInput!==null&&(this._atInput.disabled=e!==`at`),e===`at`&&this._atInput?.focus())}),r.appendChild(n),e===`at`){this._atInput=document.createElement(`input`),this._atInput.type=`text`,this._atInput.className=`adw-print-at-entry`,this._atInput.setAttribute(`aria-label`,`Print at`),this._atInput.disabled=!0,this._atInput.addEventListener(`input`,()=>{this._settings={...this._settings,"print-at":this._atInput.value}});let e=document.createElement(`div`);e.className=`adw-print-grid-row`,e.appendChild(this._atInput),r.appendChild(e)}}let i=this._group(`Add Cover Page`);return i.body.appendChild(this._optionsGrid(`Cover Page`)),e.append(t.group,n.group,i.group),e}_buildOptionsPage(e){let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._optionsGrid(e);if(e===`Advanced`){let e=document.createElement(`div`);return e.className=`adw-print-advanced`,e.appendChild(n),t.appendChild(e),t}return t.appendChild(n),t}_optionsGrid(e){let t=document.createElement(`div`);return t.className=`adw-print-options-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e),t.dataset.empty=`true`,t}_buildConflicts(){return this._conflictsEl=document.createElement(`div`),this._conflictsEl.className=`adw-print-conflicts`,this._conflictsEl.hidden=!0,this._conflictsEl.append(createGtkImage(`dialog-warning`,`adw-print-conflicts-icon`),(()=>{let e=document.createElement(`span`);return e.className=`adw-print-conflicts-label`,e.textContent=`Some of the settings in the dialog conflict`,e})()),this._conflictsEl}_buildActions(){let e=document.createElement(`div`);e.className=`adw-print-actions`,this._previewButton=document.createElement(`button`),this._previewButton.type=`button`,this._previewButton.className=`adw-print-preview`,this._previewButton.textContent=`Preview`,this._previewButton.addEventListener(`click`,()=>this._respond(-10));let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6)),this._printButton=document.createElement(`button`),this._printButton.type=`button`,this._printButton.className=`adw-print-print suggested-action`,this._printButton.textContent=`Print`,this._printButton.addEventListener(`click`,()=>this._respond(-5)),e.append(this._previewButton,t,this._printButton),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),e!==-5&&this.close()}_group(e){let t=document.createElement(`div`);t.className=`adw-print-group`;let n=document.createElement(`div`);n.className=`adw-print-group-title`,n.textContent=e;let r=document.createElement(`div`);return r.className=`adw-print-group-body`,t.append(n,r),{group:t,body:r}}_labelledRow(e,t,n){let r=document.createElement(`div`);r.className=`adw-print-grid-row`;let i=document.createElement(`div`);return i.className=`adw-print-label`,i.textContent=e,r.append(i,t),n!==void 0&&this._capabilityControls.set(n,t),r}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-print-dropdown`,n.setAttribute(`model`,JSON.stringify([...e])),n.setAttribute(`aria-label`,t),n}_radio(e,t){let n=document.createElement(`adw-radio`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n.setAttribute(`value`,e),n}_check(e,t){let n=document.createElement(`gtk-check-button`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n}_frame(e){let t=document.createElement(`div`);return t.className=`adw-print-frame`,t.appendChild(e),t}_printerChanged(e){this._selected=e,e!==null&&(this._settings={...this._settings,"format-for-printer":e.name}),this._renderPrint()}_paperChanged(e){let t=q[e];t!==void 0&&(this._pageSetup={...this._pageSetup,paperSize:t.name,margins:defaultMargins(t)},this._renderPrint())}_capabilities(){let e=new Set(this._manual);for(let t of this._selected?.capabilities??[])e.add(t);return e}_renderPrint(){let e=this._capabilities();this._switcherEl.replaceChildren(...On.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=e,t.classList.toggle(`checked`,e===this._tab),t.setAttribute(`aria-selected`,String(e===this._tab)),t.addEventListener(`click`,()=>{this._tab=e,this._renderPanel(),this._renderPrint()}),t})),this._printerListEl.replaceChildren(...this._printers.map(e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-print-printer-row`,t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e===this._selected)),t.classList.toggle(`checked`,e===this._selected),t.appendChild(e.iconName===void 0?createGtkImage(`printer`,`adw-print-printer-icon`):createGtkImage(e.iconName,`adw-print-printer-icon`));let n=document.createElement(`span`);n.className=`adw-print-printer-text`;let r=document.createElement(`span`);if(r.className=`adw-print-printer-name`,r.textContent=e.name,n.appendChild(r),e.location!==void 0){let t=document.createElement(`span`);t.className=`adw-print-printer-location`,t.textContent=e.location,n.appendChild(t)}return t.appendChild(n),t.addEventListener(`click`,()=>this._printerChanged(e)),t})),this._selectionRadio.hidden=!this.supportSelection,this._selectionRadio.classList.toggle(`insensitive`,!this.supportSelection||!this._hasSelection),this._selectionRadio.setAttribute(`aria-disabled`,String(!this.supportSelection||!this._hasSelection)),this._currentPageRadio.classList.toggle(`insensitive`,this._currentPage===-1),this._currentPageRadio.setAttribute(`aria-disabled`,String(this._currentPage===-1));for(let[t,n]of this._capabilityControls)n.toggleAttribute(`disabled`,!e.has(t));let t=Number.parseInt(this._copiesInput.value,10),n=this._copiesInput.value!==``&&Number.isFinite(t)&&t>1;this._collateCheck.toggleAttribute(`disabled`,!n||!e.has(`collate`)),this._reverseCheck.toggleAttribute(`disabled`,!e.has(`reverse`)),this._copiesInput.toggleAttribute(`disabled`,!e.has(`copies`)),this._paperDrop.toggleAttribute(`disabled`,!this.embedPageSetup),this._orientationDrop.toggleAttribute(`disabled`,!this.embedPageSetup);let r=this._collateCheck.checked,i=this._reverseCheck.checked,a=this.contentArea.querySelector(`.adw-print-collate-preview`);a!==null&&(a.dataset.columnA=String(r?i?1:2:i?2:1),a.dataset.columnB=String(r?i?2:1:i?1:2),a.dataset.secondColumn=String(n));let o=this._selected!==null&&(this._selected.acceptsJobs??!0);this._printButton.toggleAttribute(`disabled`,!o),this._previewButton.hidden=!e.has(`preview`);let s=this.contentArea.querySelector(`.adw-print-paper`);if(s!==null){let e=paperSizeOf(this._pageSetup),t=this._pageSetup.orientation===`reverse-portrait`;s.style.aspectRatio=`${this._pageSetup.orientation===`landscape`||t?`${e.height} / ${e.width}`:`${e.width} / ${e.height}`}`}let c=this.contentArea.querySelector(`.adw-print-number-up`);c!==null&&(c.dataset.cells=`1`),this._conflictsEl.hidden=!0}};customElements.define(`gtk-print-unix-dialog`,GtkPrintUnixDialog);var GtkProgressBar=class extends HTMLElement{_trough;_progress;_text;_initialized=!1;static get observedAttributes(){return[`fraction`,`pulsing`,`show-text`,`text`,`inverted`,`osd`,`disabled`]}get fraction(){let e=Number.parseFloat(this.getAttribute(`fraction`)??``);return Number.isFinite(e)?glibClamp(e,0,1):0}set fraction(e){this.setAttribute(`fraction`,String(e))}get pulsing(){return this.hasAttribute(`pulsing`)}set pulsing(e){this.toggleAttribute(`pulsing`,!!e)}get showText(){return this.hasAttribute(`show-text`)}set showText(e){this.toggleAttribute(`show-text`,!!e)}get text(){let e=this.getAttribute(`text`);return e===null?`${Math.round(this.fraction*100)}%`:e}set text(e){this.setAttribute(`text`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get osd(){return this.hasAttribute(`osd`)}set osd(e){this.toggleAttribute(`osd`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}pulse(){this.pulsing=!0}connectedCallback(){this._initialized||(this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-progress-bar-trough`,this._progress=document.createElement(`span`),this._progress.className=`adw-progress-bar-progress`,this._trough.appendChild(this._progress),this._text=document.createElement(`span`),this._text.className=`adw-progress-bar-text`,this.replaceChildren(this._trough,this._text),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-valuemin`,`0`),this.setAttribute(`aria-valuemax`,`1`),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.fraction,t=this.pulsing,n=!t&&e===0;this._trough.classList.toggle(`empty`,n),this._progress.style.width=t||n?``:`${e*100}%`,this._text.textContent=this.text,this._text.hidden=!this.showText,t?this.removeAttribute(`aria-valuenow`):this.setAttribute(`aria-valuenow`,String(e))}};customElements.define(`gtk-progress-bar`,GtkProgressBar);const Mn=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`swing-right`,`swing-left`,`swing-up`,`swing-down`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`],Nn=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Pn=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Fn=new Set([`swing-right`,`swing-left`]),In=new Set([`swing-up`,`swing-down`]),Ln=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Rn={"slide-left":`slide-right`,"slide-right":`slide-left`,"swing-left":`swing-right`,"swing-right":`swing-left`,"fade-slide-left":`fade-slide-right`,"fade-slide-right":`fade-slide-left`};var GtkRevealer=class extends HTMLElement{_clipEl;_initialized=!1;_position=0;_target=0;_frame=0;_startedAt=0;_naturalWidth=0;_naturalHeight=0;_resize=null;static get observedAttributes(){return[`reveal-child`,`transition-type`,`transition-duration`]}get revealChild(){return this.hasAttribute(`reveal-child`)}set revealChild(e){this.toggleAttribute(`reveal-child`,!!e)}get childRevealed(){return this._position===this._target?this.revealChild:!this.revealChild}get transitionType(){let e=this.getAttribute(`transition-type`);return Mn.includes(e)?e:`slide-down`}set transitionType(e){this.setAttribute(`transition-type`,e)}get transitionDuration(){let e=Number.parseFloat(this.getAttribute(`transition-duration`)??``);return Number.isFinite(e)&&e>=0?e:250}set transitionDuration(e){this.setAttribute(`transition-duration`,String(e))}get child(){return this._clipEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observeChild(),this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._clipEl=document.createElement(`div`),this._clipEl.className=`adw-revealer-clip`,bindSlottedChildren(this,[{name:`child`,into:this._clipEl},{into:this._clipEl}],()=>this._observeChild()).install(this._clipEl),this._observeChild(),this._animate(this.revealChild),this._render()}disconnectedCallback(){this._finish(),this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`reveal-child`){if(!this._animate(n!==null))return;this.dispatchEvent(new CustomEvent(`notify::reveal-child`,{bubbles:!0,detail:{revealChild:this.revealChild}}));return}this._render();let r=e===`transition-duration`?{transitionDuration:this.transitionDuration}:{transitionType:this.transitionType};this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:r}))}_observeChild(){this._resize?.disconnect(),this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._naturalWidth=e?e.inlineSize:t.contentRect.width,this._naturalHeight=e?e.blockSize:t.contentRect.height}this._render()}),this._resize.observe(this._clipEl);let e=this._clipEl.firstElementChild;e&&this._resize.observe(e)}_animate(e){let t=+!!e;if(this._target===t)return!1;this._target=t;let n=this.effectiveTransition,r=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(this.transitionDuration===0||n===`none`||r||!this.isConnected)return this._finish(),this._setPosition(t),!0;let i=this._position;return this._startedAt=performance.now(),this._frame===0&&(this._frame=requestAnimationFrame(()=>this._tick(i))),!0}_tick(e){this._frame=0;let t=this.transitionDuration,n=performance.now()-this._startedAt,r=t<=0?1:Math.min(1,n/t),i=easeOutCubic(r);this._setPosition(e+i*(this._target-e)),r<1&&(this._frame=requestAnimationFrame(()=>this._tick(e)))}_finish(){this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0)}get effectiveTransition(){let e=this.transitionType;return this.matches(`:dir(rtl)`)?Rn[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?Nn:Pn,r=e===`horizontal`?Fn:In;return n.has(t)?this._position:r.has(t)?Math.sin(Math.PI*this._position/2):1}_setPosition(e){this._position=e,this._render(),this._position===this._target&&this.dispatchEvent(new CustomEvent(`notify::child-revealed`,{bubbles:!0,detail:{childRevealed:this.childRevealed}}))}_render(){let e=this._clipEl.firstElementChild;e&&this._naturalHeight===0&&(this._naturalWidth=e.offsetWidth,this._naturalHeight=e.offsetHeight);let t=this._position,n=this._scale(`horizontal`),r=this._scale(`vertical`),i=this.effectiveTransition;if(this._clipEl.style.width=n<1?`${Math.ceil(this._naturalWidth*n)}px`:``,this._clipEl.style.height=r<1?`${Math.ceil(this._naturalHeight*r)}px`:``,e){let a=this._naturalWidth,o=this._naturalHeight,s=a*n,c=o*r,l=2*Math.max(s,c),u=90*(1-t),d=``;switch(i){case`slide-right`:case`fade-slide-right`:d=`translateX(${s-a}px)`;break;case`slide-down`:case`fade-slide-down`:d=`translateY(${c-o}px)`;break;case`swing-right`:d=`translate(0, ${c/2}px) perspective(${l}px) rotateY(${u}deg) translate(0, ${-o/2}px)`;break;case`swing-left`:d=`translate(${s}px, ${c/2}px) perspective(${l}px) rotateY(${-u}deg) translate(${-a}px, ${-o/2}px)`;break;case`swing-down`:d=`translate(${s/2}px, 0) perspective(${l}px) rotateX(${-u}deg) translate(${-a/2}px, 0)`;break;case`swing-up`:d=`translate(${s/2}px, ${c}px) perspective(${l}px) rotateX(${u}deg) translate(${-a/2}px, ${-o}px)`;break;default:break}e.style.transform=d,e.style.transformOrigin=d===``?``:`0 0`,e.style.opacity=Ln.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const zn=[`left`,`right`,`top`,`bottom`];function seededRange(e,t){let n=normalizeAdjustment(parseAdjustment(e));if(t===null)return n;let r=Number.parseFloat(t);return Number.isFinite(r)?{...n,value:r}:n}function formatScaleValue(e,t){let n=e.toFixed(t);return n.startsWith(`-`)&&Number.parseFloat(n)===0?n.slice(1):n}var GtkScale=class extends HTMLElement{_range=new SpinState;_trough;_highlight;_fill;_slider;_value;_initialized=!1;_pointerId=null;static get observedAttributes(){return[`adjustment`,`digits`,`disabled`,`draw-value`,`fill-level`,`has-origin`,`inverted`,`orientation`,`restrict-to-fill-level`,`round-digits`,`show-fill-level`,`value`,`value-pos`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._setValue(e,!1)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get drawValue(){return this.hasAttribute(`draw-value`)}set drawValue(e){this.toggleAttribute(`draw-value`,!!e)}get valuePos(){let e=this.getAttribute(`value-pos`);return zn.includes(e)?e:`top`}set valuePos(e){this.setAttribute(`value-pos`,e)}get hasOrigin(){return!this.hasAttribute(`has-origin`)||this.getAttribute(`has-origin`)!==`false`}set hasOrigin(e){this.toggleAttribute(`has-origin`,!!e)}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):1}set digits(e){this.setAttribute(`digits`,String(e))}get fillLevel(){let e=Number.parseFloat(this.getAttribute(`fill-level`)??``);return Number.isFinite(e)?e:0}set fillLevel(e){this.setAttribute(`fill-level`,String(e))}get showFillLevel(){return this.hasAttribute(`show-fill-level`)}set showFillLevel(e){this.toggleAttribute(`show-fill-level`,!!e)}get restrictToFillLevel(){return this.hasAttribute(`restrict-to-fill-level`)}set restrictToFillLevel(e){this.toggleAttribute(`restrict-to-fill-level`,!!e)}get slider(){return this._slider}connectedCallback(){this._initialized||(this._initialized=!0,this._range.configure(seededRange(this.getAttribute(`adjustment`),this.getAttribute(`value`))),this._trough=document.createElement(`span`),this._trough.className=`adw-scale-trough`,this._highlight=document.createElement(`span`),this._highlight.className=`adw-scale-highlight`,this._fill=document.createElement(`span`),this._fill.className=`adw-scale-fill`,this._slider=document.createElement(`span`),this._slider.className=`adw-scale-slider`,this._trough.append(this._fill,this._highlight,this._slider),this._value=document.createElement(`span`),this._value.className=`adw-scale-value`,this.replaceChildren(this._trough,this._value),this.setAttribute(`role`,`slider`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this._trough.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this._value.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointermove`,e=>this._onPointerMove(e)),this.addEventListener(`pointerup`,e=>this._onPointerUp(e)),this.addEventListener(`pointercancel`,e=>this._onPointerUp(e)),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render())}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_setValue(e,t){let n=e;this.restrictToFillLevel&&(n=Math.min(n,Math.max(this.adjustment.lower,this.fillLevel)));let r=Number.parseInt(this.getAttribute(`round-digits`)??``,10);if(Number.isFinite(r)&&r!==-1){let e=10**r;n=Math.floor(n*e+.5)/e}return t?this._range.setValueInteractive(n):this._range.setValue(n)}_valueAtCoord(e){let t=this.adjustment,n=this.orientation===`horizontal`?this._trough.clientWidth:this._trough.clientHeight,r=n===0?1:glibClamp(e/n,0,1);return this._shouldInvert()&&(r=1-r),t.lower+r*(t.upper-t.lower-t.pageSize)}_shouldInvert(){let e=this.closest(`[dir="rtl"]`)!==null;return this.orientation===`horizontal`?this.inverted?!e:e:this.inverted}_onPointerDown(e){if(this.hasAttribute(`disabled`)||e.button!==0)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._pointerId=e.pointerId,this.focus(),this._setValue(this._valueAtCoord(n),!0);try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}_onPointerMove(e){if(this._pointerId!==e.pointerId)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._setValue(this._valueAtCoord(n),!0)}_onPointerUp(e){this._pointerId===e.pointerId&&(this._pointerId=null,this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId))}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=this.adjustment,n=e.ctrlKey,r=null;switch(e.key){case`ArrowLeft`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowRight`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`ArrowDown`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowUp`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`PageUp`:r=this.value+t.pageIncrement;break;case`PageDown`:r=this.value-t.pageIncrement;break;case`Home`:r=t.lower;break;case`End`:r=t.upper-t.pageSize;break;case`+`:case`=`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`-`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;default:return}e.preventDefault(),this._setValue(r,!0)}_render(){if(!this._trough)return;let e=this.orientation,t=this.adjustment,n=t.upper-t.lower-t.pageSize,r=n===0?0:(t.value-t.lower)/n,i=glibClamp(this._shouldInvert()?1-r:r,0,1);this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e),e===`horizontal`?this._slider.style.left=`${i*100}%`:this._slider.style.bottom=`${i*100}%`,this._slider.style.top=``,this._slider.style.right=``;let a=this.hasOrigin;this._highlight.hidden=!a,a&&(e===`horizontal`?(this._highlight.style.right=``,this._highlight.style.width=`${i*100}%`):(this._highlight.style.width=``,this._highlight.style.height=`${i*100}%`));let o=this.showFillLevel;if(this._fill.hidden=!o,o){let r=glibClamp((this.fillLevel-t.lower)/(n||1),0,1);e===`horizontal`?this._fill.style.width=`${r*100}%`:this._fill.style.height=`${r*100}%`}this._value.textContent=formatScaleValue(t.value,this.digits),this._value.hidden=!this.drawValue;let s=this.valuePos;this._value.classList.toggle(`left`,s===`left`),this._value.classList.toggle(`right`,s===`right`),this._value.classList.toggle(`top`,s===`top`),this._value.classList.toggle(`bottom`,s===`bottom`),this.classList.toggle(`value-top`,s===`top`),this.classList.toggle(`value-right`,s===`right`),this.classList.toggle(`value-bottom`,s===`bottom`),this.classList.toggle(`value-left`,s===`left`),this.setAttribute(`aria-valuemin`,String(t.lower)),this.setAttribute(`aria-valuemax`,String(t.upper-t.pageSize)),this.setAttribute(`aria-valuenow`,String(t.value)),this.setAttribute(`aria-valuetext`,this._value.textContent??``),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-scale`,GtkScale);const Bn={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends HTMLElement{_state=new SpinState;_buttonEl;_glyph;_dockEl;_rangeEl;_minusEl;_plusEl;_icons=[];_initialized=!1;_syncing=!1;static get observedAttributes(){return[`value`,`icons`,`adjustment`,`has-frame`,`orientation`]}get value(){return this._state.value}set value(e){this._applyValue(e)}get active(){return this._buttonEl?.classList.contains(`checked`)??!1}get icons(){return[...this._icons]}set icons(e){this.setAttribute(`icons`,JSON.stringify(e))}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._glyph=createGtkImage(`image-missing`,`scale-button-glyph`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button scale-button-icon flat`,this._buttonEl.setAttribute(`aria-expanded`,`false`),this._buttonEl.appendChild(this._glyph),this._minusEl=this._stepButton(`list-remove-symbolic`,`Decrease`),this._plusEl=this._stepButton(`list-add-symbolic`,`Increase`),this._rangeEl=document.createElement(`input`),this._rangeEl.type=`range`,this._rangeEl.className=`scale-button-range`,this._rangeEl.addEventListener(`input`,()=>{this._syncing||this._applyValue(Number(this._rangeEl.value))});let e=document.createElement(`div`);e.className=`scale-button-box`,e.append(this._minusEl,this._rangeEl,this._plusEl),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`scale-popup`),this._dockEl.replaceChildren(e),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this._toggleDock()),this._minusEl.addEventListener(`click`,()=>this._step(-1)),this._plusEl.addEventListener(`click`,()=>this._step(1)),this._dockEl.subscribe(e=>this._renderDock(e)),this.addEventListener(`wheel`,e=>{e.deltaY!==0&&(e.preventDefault(),this._applyValue(this._state.value-Math.sign(e.deltaY)*this._state.adjustment.stepIncrement))},{passive:!1}),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._icons=parseIcons(this.getAttribute(`icons`)),this._syncAdjustment(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._syncAdjustment();return}if(e===`icons`){this._icons=parseIcons(this.getAttribute(`icons`)),this._render(),this.dispatchEvent(new CustomEvent(`notify::icons`,{bubbles:!0}));return}if(e===`value`){let e=this.getAttribute(`value`);if(e===null||e.trim()===``)return;let t=Number(e);Number.isFinite(t)&&this._applyValue(t);return}this._render()}}_applyValue(e){let t=this._state.setValue(e);if(this._render(),!t)return;let n=this._state.value;this.setAttribute(`value`,String(n)),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:n}})),this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:n}}))}_syncAdjustment(){let e=parseAdjustment(this.getAttribute(`adjustment`)),t={...Bn,...e},n=this.getAttribute(`value`),r=n===null||n.trim()===``?NaN:Number(n);t.value=Number.isFinite(r)?r:this._state.value,this._state.configure(t),this._render(),this.dispatchEvent(new CustomEvent(`notify::adjustment`,{bubbles:!0}))}_render(){if(!this._initialized)return;let e=this._state.value,[t,n]=adjustmentRange(this._state.adjustment),r=selectIcon(this._icons,e,t,n);this._glyph.getAttribute(`icon-name`)!==r&&this._glyph.setAttribute(`icon-name`,r),this._buttonEl.setAttribute(`aria-label`,r),this._syncing=!0,this._rangeEl.min=String(t),this._rangeEl.max=String(n),this._rangeEl.step=String(this._state.adjustment.stepIncrement),this._rangeEl.value=String(e),this._rangeEl.setAttribute(`aria-valuemin`,String(t)),this._rangeEl.setAttribute(`aria-valuemax`,String(n)),this._rangeEl.setAttribute(`aria-valuenow`,String(e)),this._syncing=!1,this._minusEl.disabled=!(t<e),this._plusEl.disabled=!(e<n),this._buttonEl.classList.toggle(`flat`,!this.hasFrame),this.classList.toggle(`horizontal`,this.orientation===`horizontal`),this.classList.toggle(`vertical`,this.orientation===`vertical`)}_stepButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-button scale-button-step flat`,n.setAttribute(`aria-label`,t),n.appendChild(createGtkImage(e)),n}_toggleDock(){this.active?this._dock(`popdown`):this._dock(`popup`)}_dock(e){let t=e===`popup`;this.active!==t&&(this._buttonEl.classList.toggle(`checked`,t),this._buttonEl.setAttribute(`aria-expanded`,String(t)),t?(this._dockEl.popup(),this._rangeEl.focus()):(this._dockEl.popdown(),this._buttonEl.focus()),this.dispatchEvent(new CustomEvent(e,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:t}})))}_renderDock(e){this._dock(e?`popup`:`popdown`)}_step(e){this._applyValue(this._state.value+e*this._state.adjustment.pageIncrement)}_onKeyDown(e){if(e.key===`Escape`){if(!this.active)return;e.preventDefault(),this._dock(`popdown`);return}e.target===this._buttonEl&&(e.key!==` `&&e.key!==`Enter`&&e.key!==`Return`||(e.preventDefault(),this._toggleDock()))}};customElements.define(`gtk-scale-button`,GtkScaleButton);function selectIcon(e,t,n,r){let i=e[0];if(i===void 0||i===``)return`image-missing`;if(e.length===1)return i;if(e.length===2)return t<(r-n)/2+n?i:e[1]??i;if(t===n)return i;if(t===r)return e[1]??i;let a=(r-n)/(e.length-2);return e[Math.floor((t-n)/a)+2]??i}function parseIcons(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var GtkSearchBar=class extends HTMLElement{_box;_center;_close;_initialized=!1;_capture=null;_onCapturedKey=e=>this._captureKey(e);_onInput=()=>this._revealFromTyping();static get observedAttributes(){return[`search-mode-enabled`,`show-close-button`]}get searchModeEnabled(){return this.hasAttribute(`search-mode-enabled`)}set searchModeEnabled(e){this.toggleAttribute(`search-mode-enabled`,!!e)}get showCloseButton(){return this.hasAttribute(`show-close-button`)}set showCloseButton(e){this.toggleAttribute(`show-close-button`,!!e)}get keyCaptureWidget(){return this._capture}set keyCaptureWidget(e){this._capture!==e&&(this._capture?.removeEventListener(`keydown`,this._onCapturedKey,!0),this._capture=e,this._capture?.addEventListener(`keydown`,this._onCapturedKey,!0))}get entry(){return this.querySelector(`input, textarea`)}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`search`),this._center=document.createElement(`div`),this._center.className=`adw-search-bar-center`,this._center.append(...this.childNodes),this._close=document.createElement(`button`),this._close.className=`adw-search-bar-close`,this._close.type=`button`,this._close.setAttribute(`aria-label`,`Close search`),this._close.addEventListener(`click`,()=>this.searchModeEnabled=!1),this._box=document.createElement(`div`),this._box.className=`adw-search-bar-box`,this._box.append(this._center,this._close),this.replaceChildren(this._box),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(this.searchModeEnabled=!1)}),this._render())}disconnectedCallback(){this.keyCaptureWidget=null}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`search-mode-enabled`){this._applyReveal(),this.dispatchEvent(new CustomEvent(`notify::search-mode-enabled`,{bubbles:!0,detail:{searchModeEnabled:this.searchModeEnabled}}));return}e===`show-close-button`&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::show-close-button`,{bubbles:!0,detail:{showCloseButton:this.showCloseButton}})))}}_render(){let e=this.searchModeEnabled;this.classList.toggle(`revealed`,e),this._box.inert=!e,this._close.hidden=!this.showCloseButton}_applyReveal(){this._render();let e=this.entry;e!==null&&(this.searchModeEnabled?e.focus():e.value=``)}_revealFromTyping(){this.searchModeEnabled||(this.searchModeEnabled=!0,this.entry?.focus())}_captureKey(e){if(e.defaultPrevented||e.ctrlKey||e.altKey||e.metaKey||e.key.length!==1)return;let t=this.entry;if(this.searchModeEnabled=!0,t===null)return;e.preventDefault(),t.focus();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;t.setRangeText(e.key,n,r,`end`)}};customElements.define(`gtk-search-bar`,GtkSearchBar);var GtkSearchEntry=class extends GtkEntry{_searchIcon;_clear;_clearIcon;_timeout=null;static get observedAttributes(){return[...GtkEntry.observedAttributes,`search-delay`]}get searchDelay(){let e=Number.parseInt(this.getAttribute(`search-delay`)??``,10);return Number.isFinite(e)&&e>=0?e:150}set searchDelay(e){this.setAttribute(`search-delay`,String(e))}get _empty(){return this._input?this._input.value===``:this.getAttribute(`value`)===``}connectedCallback(){super.connectedCallback(),this._searchIcon=createGtkImage(`system-search-symbolic`,`adw-search-entry-icon`),this._clear=document.createElement(`button`),this._clear.type=`button`,this._clear.className=`adw-button flat circular icon-only adw-search-entry-clear`,this._clearIcon=createGtkImage(`edit-clear-symbolic`,`adw-search-entry-clear-icon`),this._clear.append(this._clearIcon),this._clear.title=`Clear Entry`,this._clear.setAttribute(`aria-label`,`Clear Entry`),this._clear.addEventListener(`click`,()=>{this._input.value=``,this._onChanged(),this._input.focus()}),this._clear.addEventListener(`mousedown`,e=>e.preventDefault()),this.replaceChildren(this._searchIcon,this._input,this._clear),this.setAttribute(`role`,`searchbox`),this._input.addEventListener(`input`,()=>this._onChanged()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._render()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`search-delay`&&this._clear&&this._cancel()}disconnectedCallback(){this._cancel(),super.disconnectedCallback()}_onChanged(){if(this._cancel(),this._empty){this._render(),this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:``}}));return}this._render();let e=this.searchDelay;this._timeout=globalThis.setTimeout(()=>{this._timeout=null,this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:this._input.value}}))},e)}_cancel(){this._timeout!==null&&(clearTimeout(this._timeout),this._timeout=null)}_onKeyDown(e){switch(e.key){case`Escape`:e.preventDefault(),this.dispatchEvent(new CustomEvent(`stop-search`,{bubbles:!0}));break;case`g`:if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),this.dispatchEvent(new CustomEvent(e.shiftKey?`previous-match`:`next-match`,{bubbles:!0}));break;default:return}}_render(){this._clear&&(this._clear.hidden=this._empty)}};customElements.define(`gtk-search-entry`,GtkSearchEntry);const Vn=[`always`,`never`,`automatic`,`external`],Hn=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return Vn.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Hn.find(t=>t===e)??`top-left`}function sizeRequest(e){if(e===null)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:null}const Un=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssMin:`minWidth`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssMin:`minHeight`,end:`top`,farEnd:`bottom`}];function resolveScrollKey(e){switch(e.key){case`ArrowLeft`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!0}:null;case`ArrowRight`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!0}:null;case`ArrowUp`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!1}:null;case`ArrowDown`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!1}:null;case`PageUp`:return{scroll:`page-backward`,horizontal:e.ctrlKey};case`PageDown`:return{scroll:`page-forward`,horizontal:e.ctrlKey};case`Home`:return{scroll:`start`,horizontal:e.ctrlKey};case`End`:return{scroll:`end`,horizontal:e.ctrlKey};default:return null}}var GtkScrolledWindow=class extends HTMLElement{_viewport;_bars=null;_shading=null;_observer=null;_hoverable=null;_fadeTimer=null;_built=!1;static get observedAttributes(){return[`hscrollbar-policy`,`vscrollbar-policy`,`window-placement`,`has-frame`,`min-content-width`,`min-content-height`,`max-content-width`,`max-content-height`,`overlay-scrolling`,`propagate-natural-width`,`propagate-natural-height`]}get hscrollbarPolicy(){return normalizePolicy(this.getAttribute(`hscrollbar-policy`))}set hscrollbarPolicy(e){this.setAttribute(`hscrollbar-policy`,e)}get vscrollbarPolicy(){return normalizePolicy(this.getAttribute(`vscrollbar-policy`))}set vscrollbarPolicy(e){this.setAttribute(`vscrollbar-policy`,e)}get windowPlacement(){return normalizeCorner(this.getAttribute(`window-placement`))}set windowPlacement(e){this.setAttribute(`window-placement`,e)}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get overlayScrolling(){return this.getAttribute(`overlay-scrolling`)!==`false`}set overlayScrolling(e){this.toggleAttribute(`overlay-scrolling`,!!e)}get minContentWidth(){return sizeRequest(this.getAttribute(`min-content-width`))}set minContentWidth(e){this._writeSizeRequest(`min-content-width`,e)}get minContentHeight(){return sizeRequest(this.getAttribute(`min-content-height`))}set minContentHeight(e){this._writeSizeRequest(`min-content-height`,e)}get maxContentWidth(){return sizeRequest(this.getAttribute(`max-content-width`))}set maxContentWidth(e){this._writeSizeRequest(`max-content-width`,e)}get maxContentHeight(){return sizeRequest(this.getAttribute(`max-content-height`))}set maxContentHeight(e){this._writeSizeRequest(`max-content-height`,e)}get propagateNaturalWidth(){return this.hasAttribute(`propagate-natural-width`)}set propagateNaturalWidth(e){this.toggleAttribute(`propagate-natural-width`,!!e)}get propagateNaturalHeight(){return this.hasAttribute(`propagate-natural-height`)}set propagateNaturalHeight(e){this.toggleAttribute(`propagate-natural-height`,!!e)}hscrollbar(){return this._bars?.horizontal??null}vscrollbar(){return this._bars?.vertical??null}get viewport(){return this._viewport}connectedCallback(){if(!this._built){this._built=!0,this._viewport=document.createElement(`gtk-viewport`);let e=document.createElement(`gtk-scrollbar`),t=document.createElement(`gtk-scrollbar`);e.setAttribute(`orientation`,`horizontal`),t.setAttribute(`orientation`,`vertical`),this._bars={horizontal:e,vertical:t},bindSlottedChildren(this,[{into:this._viewport}]).install(this._viewport,t,e),this.setAttribute(`role`,`generic`),this._viewport.addEventListener(`value-changed`,this._onViewportValue);for(let n of[e,t])n.addEventListener(`value-changed`,this._onBarValue),n.addEventListener(`pointerenter`,this._onIndicatorOver),n.addEventListener(`pointerleave`,this._onIndicatorOut);this._observer=new ResizeObserver(()=>this._sync()),this._observer.observe(this._viewport),this._shading=new AdwScrollShading(this,{onOvershoot:e=>this._edgeOvershot(e)}),this._shading.connect()}this._releaseHoverable(),this._hoverable=matchMedia(`(hover: hover)`),this._hoverable.addEventListener(`change`,this._onHoverableChange),this.addEventListener(`keydown`,this._onKeyDown),this._sync()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this._releaseHoverable()}attributeChangedCallback(e,t,n){!this._built||!this.isConnected||(this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._normalized(e,n)}})),this._sync())}_normalized(e,t){switch(e){case`hscrollbar-policy`:return normalizePolicy(t);case`vscrollbar-policy`:return normalizePolicy(t);case`window-placement`:return normalizeCorner(t);case`overlay-scrolling`:return t!==`false`;case`has-frame`:return t!==null;case`propagate-natural-width`:case`propagate-natural-height`:return t!==null;default:return sizeRequest(t)}}_writeSizeRequest(e,t){t===null?this.removeAttribute(e):this.setAttribute(e,String(Math.max(0,Math.trunc(t))))}get _useIndicators(){return this.overlayScrolling&&(this._hoverable?.matches??!0)}_sync(){let e=this._bars;if(e===null||!this._viewport.isConnected||!e.vertical.isConnected)return;let t=this.windowPlacement,n=this._useIndicators;this.classList.toggle(`frame`,this.hasFrame),this.classList.toggle(t,!0);for(let e of Hn)e!==t&&this.classList.toggle(e,!1);this.classList.toggle(`overlay-scrolling`,n),this.style.minWidth=this._size(`min-content-width`),this.style.minHeight=this._size(`min-content-height`),this.style.maxWidth=this._size(`max-content-width`),this.style.maxHeight=this._size(`max-content-height`);for(let t of Un){let r=e[t.bar],i=normalizePolicy(this.getAttribute(t.policy)),a=this._adjustment(t.key);r.hidden=!(i===`always`||i===`automatic`&&a.upper-a.lower>a.pageSize),r.classList.toggle(`overlay-indicator`,n),r.adjustment=a,this._viewport.style[t.cssMin]=this.hasAttribute(t.natural)?`max-content`:i===`never`?`min-content`:``}n||this._clearFade()}_size(e){let t=sizeRequest(this.getAttribute(e));return t===null?``:`${t}px`}_adjustment(e){return this._viewport[e]}_mayScroll(e){let t=this._bars;if(t===null)return null;let n=e?t.horizontal:t.vertical;return n.hidden?normalizePolicy(this.getAttribute(e?`hscrollbar-policy`:`vscrollbar-policy`))===`external`?n:null:n}_onViewportValue=e=>{let t=this._bars;if(t===null)return;let n=e.detail;for(let e of Un){let r=n[e.key];t[e.bar].adjustment=r;let i=r.upper-r.pageSize;r.value<=r.lower?this._edgeReached(e.end):r.value>=i&&this._edgeReached(e.farEnd)}this._fadeIn()};_onBarValue=e=>{let t=e.currentTarget,n=e.detail.adjustment;t.hidden||this._viewport.scrollAxis(t.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`,n.value)};_edgeReached(e){this.dispatchEvent(new CustomEvent(`edge-reached`,{bubbles:!0,detail:{pos:e}}))}_edgeOvershot(e){e!==0&&this.dispatchEvent(new CustomEvent(`edge-overshot`,{bubbles:!0,detail:{pos:e<0?`top`:`bottom`}}))}_onKeyDown=e=>{if(e.key===`Tab`&&e.ctrlKey){let t=e.shiftKey?`backward`:`forward`;this.dispatchEvent(new CustomEvent(`move-focus-out`,{bubbles:!0,detail:{directionType:t}}));return}let t=resolveScrollKey(e);if(t===null)return;let n=this._mayScroll(t.horizontal);n!==null&&(e.preventDefault(),n.scrollBy(t.scroll),this.dispatchEvent(new CustomEvent(`scroll-child`,{bubbles:!0,detail:{scroll:t.scroll,horizontal:t.horizontal}})))};_fadeIn(){let e=this._bars;if(!(e===null||!this._useIndicators)){for(let t of[e.horizontal,e.vertical])t.style.setProperty(`--adw-indicator-opacity`,`1`);this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=setTimeout(()=>this._fadeOut(),2e3)}}_fadeOut(){this._fadeTimer=null;let e=this._bars;if(!(e===null||!this._useIndicators))for(let t of[e.horizontal,e.vertical])t.classList.contains(`hovering`)||t.style.setProperty(`--adw-indicator-opacity`,`0`)}_clearFade(){this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=null;let e=this._bars;if(e!==null)for(let t of[e.horizontal,e.vertical])t.style.removeProperty(`--adw-indicator-opacity`)}_onIndicatorOver=e=>{e.currentTarget.classList.add(`hovering`),this._fadeIn()};_onIndicatorOut=e=>{e.currentTarget.classList.remove(`hovering`)};_onHoverableChange=()=>{this._sync()};_releaseHoverable(){this._hoverable?.removeEventListener(`change`,this._onHoverableChange),this._hoverable=null}};customElements.define(`gtk-scrolled-window`,GtkScrolledWindow);const Wn=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends HTMLElement{_trough;_slider;_observer=null;_built=!1;_adjustment=null;_grabPosition=0;_grabDelta=0;_zoom=!1;_dragging=!1;static get observedAttributes(){return[`orientation`,`adjustment`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._adjustment??Wn}set adjustment(e){let t=e==null?null:typeof e==`string`?parseAdjustment(e):e;this._adjustment=t===null?null:normalizeAdjustment(t,this._adjustment??void 0),this._built&&(this._render(),this._notify(`adjustment`,{adjustment:this.adjustment}))}get value(){return this.adjustment.value}set value(e){let t=this._adjustment;if(t===null)return;let n=clampAdjustmentValue(t,e);n!==t.value&&(this._adjustment={...t,value:n},this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{adjustment:this._adjustment}})))}scrollBy(e){if(typeof e!=`string`)return;let t=this.adjustment;switch(e){case`step-forward`:this.value=t.value+t.stepIncrement;break;case`step-backward`:this.value=t.value-t.stepIncrement;break;case`page-forward`:this.value=t.value+t.pageIncrement;break;case`page-backward`:this.value=t.value-t.pageIncrement;break;case`start`:this.value=t.lower;break;case`end`:this.value=t.upper;break}}scrollByWheel(e,t){let n=t===1?48:100,r=n===0?0:e/n;this.scrollBy(r>=0?`page-forward`:`page-backward`)}get _troughLength(){return this.orientation===`vertical`?this._trough.clientHeight:this._trough.clientWidth}connectedCallback(){this._built||(this._built=!0,this._trough=document.createElement(`div`),this._trough.className=`adw-scrollbar-trough`,this._slider=document.createElement(`div`),this._slider.className=`adw-scrollbar-slider`,this._trough.appendChild(this._slider),this.replaceChildren(this._trough),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wheel`,this._onWheel,{passive:!0}),this.tabIndex=0,this._observer=new ResizeObserver(()=>this._render()),this._observer.observe(this._trough),this.setAttribute(`role`,`scrollbar`)),this.hasAttribute(`adjustment`)&&(this.adjustment=this.getAttribute(`adjustment`)),this._render()}attributeChangedCallback(e,t,n){if(!(!this._built||!this.isConnected)){if(e===`adjustment`){this.adjustment=n;return}this._notify(`orientation`,{orientation:this.orientation}),this._render()}}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}_onPointerDown=e=>{if(!this.hasAttribute(`tabindex`))return;this.focus();let t=this._coordinate(e),n=e.target===this._slider;this._grabPosition=this._sliderPosition(),this._grabDelta=t-this._grabPosition,this._setZoom(n&&e.shiftKey),this._dragging=n,this._capture(e.pointerId),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerEnd),this.addEventListener(`pointercancel`,this._onPointerEnd),!n&&(e.button===0&&!e.shiftKey?this.value=this._coordinateValue(t+this._sliderSize()/2):(e.button===1||e.button===0&&e.shiftKey)&&this.scrollBy(this._coordinateValue(t)>this.value?`page-forward`:`page-backward`))};_onPointerMove=e=>{if(!this._dragging)return;this._setZoom(e.shiftKey);let t=this._coordinate(e),n=this._zoom?this._zoomFactor():1;this.value=this._coordinateValue(this._grabPosition+n*(t-(this._grabDelta+this._grabPosition)))};_onPointerEnd=e=>{this._endDrag(e.pointerId)};_endDrag(e){this._dragging=!1,this._setZoom(!1),e!==void 0&&this.hasPointerCapture(e)&&this.releasePointerCapture(e),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerEnd),this.removeEventListener(`pointercancel`,this._onPointerEnd)}_capture(e){try{this.setPointerCapture(e)}catch{}}_onKeyDown=e=>{let t=resolveRangeKey(e,this.orientation===`vertical`);t!==null&&(e.preventDefault(),this.scrollBy(t))};_onWheel=e=>{e.target!==this&&e.target!==this._trough||this.scrollByWheel(e.deltaY,e.deltaMode)};_setZoom(e){this._zoom!==e&&(this._zoom=e,this.classList.toggle(`fine-tune`,e))}_zoomFactor(){let e=this.adjustment,t=e.upper-e.lower-e.pageSize,n=t<=0?1:Math.min(1,this._troughLength/t);return n===1?.25:n}_render(){if(!this._built)return;let e=this.adjustment,t=this.orientation===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),this.setAttribute(`aria-orientation`,this.orientation),this.removeAttribute(`aria-disabled`),this.removeAttribute(`disabled`);let n=this._troughLength,r=e.upper-e.lower,i=r-e.pageSize;if(r===0)this._slider.style.removeProperty(`--adw-scrollbar-size`);else{let t=Math.min(n,n*(e.pageSize/r));this._slider.style.setProperty(`--adw-scrollbar-size`,`${t}px`)}let a=this._sliderSize(),o=Math.max(0,n-a),s=i===0?0:o*((e.value-e.lower)/i);this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this._slider.style.setProperty(`--adw-scrollbar-position`,`${s}px`)}_sliderPosition(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-position`))||0}_sliderSize(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-size`))||0}_coordinateValue(e){let t=this.adjustment,n=Math.max(1,this._troughLength-this._sliderSize()),r=Math.min(1,Math.max(0,e/n));return t.lower+r*(t.upper-t.pageSize-t.lower)}_coordinate(e){let t=this._trough.getBoundingClientRect();return this.orientation===`vertical`?e.clientY-t.top:e.clientX-t.left}};function resolveRangeKey(e,t){switch(e.key){case`ArrowRight`:return t?null:`step-forward`;case`ArrowLeft`:return t?null:`step-backward`;case`ArrowDown`:return t?`step-forward`:null;case`ArrowUp`:return t?`step-backward`:null;case`PageDown`:return`page-forward`;case`PageUp`:return`page-backward`;case`Home`:return`start`;case`End`:return`end`;default:return null}}customElements.define(`gtk-scrollbar`,GtkScrollbar);const Y=1e-10,Gn=[`always`,`if-valid`];var GtkSpinButton=class extends HTMLElement{_range=new SpinState;_input;_down;_up;_initialized=!1;_edited=!1;_vertical=null;_initialTimer=null;_repeatTimer=null;_timerCalls=0;_timerStep=0;static get observedAttributes(){return[`adjustment`,`climb-rate`,`digits`,`disabled`,`numeric`,`orientation`,`snap-to-ticks`,`update-policy`,`value`,`wrap`]}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._range.setValue(e),this._render()}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):0}set digits(e){this.setAttribute(`digits`,String(e))}get numeric(){return this.hasAttribute(`numeric`)}set numeric(e){this.toggleAttribute(`numeric`,!!e)}get snapToTicks(){return this.hasAttribute(`snap-to-ticks`)}set snapToTicks(e){this.toggleAttribute(`snap-to-ticks`,!!e)}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get updatePolicy(){let e=this.getAttribute(`update-policy`);return Gn.includes(e)?e:`always`}set updatePolicy(e){this.setAttribute(`update-policy`,e)}get climbRate(){let e=Number.parseFloat(this.getAttribute(`climb-rate`)??``);return Number.isFinite(e)&&e>0?e:0}set climbRate(e){this.setAttribute(`climb-rate`,String(e))}get text(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`))),t=this.getAttribute(`value`),n=t===null?NaN:Number.parseFloat(t);this._range.configure(Number.isFinite(n)?{...e,value:n}:e),this._input=document.createElement(`input`),this._input.className=`adw-spin-button-text`,this._input.type=`text`,this._input.inputMode=`decimal`,this._input.autocomplete=`off`,this._input.spellcheck=!1,this._down=document.createElement(`button`),this._down.type=`button`,this._down.className=`adw-button image-button down`,this._down.append(createGtkImage(`value-decrease-symbolic`)),this._down.setAttribute(`aria-label`,`Decrease`),this._up=document.createElement(`button`),this._up.type=`button`,this._up.className=`adw-button image-button up`,this._up.append(createGtkImage(`value-increase-symbolic`)),this._up.setAttribute(`aria-label`,`Increase`),this._down.addEventListener(`click`,()=>this._spin(-this._range.adjustment.stepIncrement)),this._up.addEventListener(`click`,()=>this._spin(this._range.adjustment.stepIncrement)),this._hold(this._down,-1),this._hold(this._up,1),this._input.addEventListener(`input`,()=>{this._edited=!0,this.numeric&&this._rejectNonNumeric()}),this._input.addEventListener(`change`,()=>this._update()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.setAttribute(`role`,`spinbutton`),this.replaceChildren(this._input,this._down,this._up),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_spin(e){let t=this.adjustment,n=t.value+e,r=!1;e>0?this.wrap?Math.abs(t.value-t.upper)<Y?(n=t.lower,r=!0):n>t.upper&&(n=t.upper):n=Math.min(n,t.upper):e<0&&(this.wrap?Math.abs(t.value-t.lower)<Y?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>Y&&this._range.setValueInteractive(n),r&&this.dispatchEvent(new CustomEvent(`wrapped`,{bubbles:!0}))}_update(){let e=this.adjustment,t=Number.parseFloat(this._input.value),n=this._input.value.trim()!==``&&Number.isNaN(t);if(this.updatePolicy===`always`){let r=glibClamp(n||!Number.isFinite(t)?e.value:t,e.lower,e.upper-e.pageSize);this._commit(this.snapToTicks?snapAdjustmentValue(e,r):r);return}if(n||!Number.isFinite(t)||t<e.lower||t>e.upper){this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:this._range.value}}));return}this._commit(this.snapToTicks?snapAdjustmentValue(e,t):t)}_commit(e){this._range.setValue(e),this._edited=!1,this._render()}_rejectNonNumeric(){let e=this.digits,t=!1,n=!1,r=``;for(let i of this._input.value){if(i===`-`||i===`+`){if(t||r!==``)return this._resetText();t=!0,r+=i;continue}if(i===`.`){if(!e||n)return this._resetText();n=!0,r+=i;continue}if(i<`0`||i>`9`)return this._resetText();r+=i}r!==this._input.value&&(this._input.value=r)}_resetText(){this._input.value=this._formatted()}_hold(e,t){let begin=e=>{e.button!==0||this.hasAttribute(`disabled`)||(this._timerStep=this._range.adjustment.stepIncrement,this._timerCalls=0,this._spin(t*this._timerStep),this._initialTimer=globalThis.setTimeout(()=>{this._initialTimer=null,this._spin(t*this._timerStep),this._repeatTimer=globalThis.setInterval(()=>this._tick(t),50)},500))},end=()=>this._stopHold();e.addEventListener(`pointerdown`,begin),e.addEventListener(`pointerup`,end),e.addEventListener(`pointerleave`,end),e.addEventListener(`pointercancel`,end)}_tick(e){this._spin(e*this._timerStep);let t=this._range.adjustment;this.climbRate>0&&this._timerStep<t.pageIncrement&&(this._timerCalls<5?this._timerCalls+=1:(this._timerCalls=0,this._timerStep+=this.climbRate))}_stopHold(){this._initialTimer!==null&&(clearTimeout(this._initialTimer),this._initialTimer=null),this._repeatTimer!==null&&(clearInterval(this._repeatTimer),this._repeatTimer=null),this._timerCalls=0,this._timerStep=0}_onKeyDown(e){let t=this._range.adjustment,n=t.stepIncrement,r=t.pageIncrement,i=null;switch(e.key){case`ArrowUp`:i=n;break;case`ArrowDown`:i=-n;break;case`PageUp`:i=r;break;case`PageDown`:i=-r;break;case`Enter`:{let e=this._edited;this._update(),e||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}));return}default:return}e.preventDefault(),this._spin(i)}_formatted(){return formatScaleValue(this._range.value,this.digits)}_render(){if(!this._input)return;let e=this.adjustment,t=this.getAttribute(`orientation`)===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),t!==this._vertical&&(this._vertical=t,t?this.replaceChildren(this._up,this._input,this._down):this.replaceChildren(this._input,this._down,this._up)),this._input.disabled=this.hasAttribute(`disabled`),this._input.size=10,document.activeElement!==this._input&&this._input.value!==this._formatted()&&(this._input.value=this._formatted()),this._up.disabled=!this.wrap&&e.upper-e.value<=Y,this._down.disabled=!this.wrap&&e.value-e.lower<=Y,this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-spin-button`,GtkSpinButton);const Kn=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`spinning`,`disabled`]}get spinning(){return this.hasAttribute(`spinning`)}set spinning(e){this.toggleAttribute(`spinning`,!!e)}start(){this.spinning=!0,this.setAttribute(`aria-busy`,`true`)}stop(){this.spinning=!1,this.setAttribute(`aria-busy`,`false`)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0;let e=document.createElementNS(Kn,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(Kn,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(Kn,`path`);n.setAttribute(`d`,`M 1 8 A 7 7 0 0 1 8 1`),n.setAttribute(`class`,`adw-spinner-arc`),e.append(t,n),this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`spinning`&&this.dispatchEvent(new CustomEvent(`notify::spinning`,{bubbles:!0,detail:{spinning:this.spinning}})))}_render(){this.classList.toggle(`checked`,this.spinning)}};customElements.define(`gtk-spinner`,GtkSpinner);const qn=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`slide-left-right`,`slide-up-down`,`over-up`,`over-down`,`over-left`,`over-right`,`under-up`,`under-down`,`under-left`,`under-right`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left`,`rotate-right`,`rotate-left-right`],Jn=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Yn={"slide-left":`slide-right`,"slide-right":`slide-left`,"rotate-left":`rotate-right`,"rotate-right":`rotate-left`,"over-left":`over-right`,"over-right":`over-left`,"under-left":`under-right`,"under-right":`under-left`};function simpleTransitionType(e,t){switch(t){case`slide-left-right`:return e?`slide-right`:`slide-left`;case`rotate-left-right`:return e?`rotate-right`:`rotate-left`;case`slide-up-down`:return e?`slide-down`:`slide-up`;case`over-up-down`:return e?`under-down`:`over-up`;case`over-down-up`:return e?`under-up`:`over-down`;case`over-left-right`:return e?`under-right`:`over-left`;case`over-right-left`:return e?`under-left`:`over-right`;default:return t}}const Xn=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends HTMLElement{_visible=null;_lastVisible=null;_initialized=!1;_initializedChildren=new WeakSet;_observer=null;_timer=null;_running=!1;static get observedAttributes(){return[`visible-child-name`,`transition-type`,`transition-duration`,`hhomogeneous`,`vhomogeneous`,`interpolate-size`]}get visibleChildName(){return this.getAttribute(`visible-child-name`)}set visibleChildName(e){this._write(`visible-child-name`,e)}get visibleChild(){return this._visible}set visibleChild(e){this.setVisibleChild(e)}get transitionType(){let e=this.getAttribute(`transition-type`);return e!==null&&qn.includes(e)?e:`none`}set transitionType(e){this._write(`transition-type`,e)}get transitionDuration(){return this._duration()}set transitionDuration(e){this._write(`transition-duration`,String(e))}get hhomogeneous(){return this._flag(`hhomogeneous`,!0)}set hhomogeneous(e){this._write(`hhomogeneous`,e?``:`false`)}get vhomogeneous(){return this._flag(`vhomogeneous`,!0)}set vhomogeneous(e){this._write(`vhomogeneous`,e?``:`false`)}get interpolateSize(){return this.hasAttribute(`interpolate-size`)}set interpolateSize(e){this.toggleAttribute(`interpolate-size`,!!e)}get transitionRunning(){return this.hasAttribute(`transition-running`)}get pages(){return this._children().map(e=>this._page(e))}getChildByName(e){return this._children().find(t=>this._page(t).name===e)??null}getPage(e){return this._children().includes(e)?this._page(e):null}isSelected(e){return this._visible===e}addTitled(e,t,n){return t!==null&&e.setAttribute(`name`,t),n!=null&&e.setAttribute(`title`,n),this.addChild(e)}addNamed(e,t){return this.addTitled(e,t)}addChild(e){return this.appendChild(e),this._initChild(e),this._initialized&&!this._visible&&!e.hasAttribute(`hidden`)&&this._show(e),e}removePage(e){e.remove()}setVisibleChild(e,t){return e?this._children().includes(e)?this._show(e,t):!1:this._show(this._firstVisible(),t)}setVisibleChildName(e){if(e===null)return!1;let t=this._children().find(t=>this._page(t).name===e);return t?this._show(t):!1}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`);for(let e of this._children())this._initChild(e);this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Xn,`hidden`]}),this._visible||this._show(this._firstVisible()),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._timer!==null&&clearTimeout(this._timer),this._timer=null,this._initialized=!1}attributeChangedCallback(e){if(this._initialized){if(e===`visible-child-name`){this.setVisibleChildName(this.getAttribute(`visible-child-name`));return}this._render(),this._notify(e)}}_property(e){switch(e){case`transition-type`:return this.transitionType;case`transition-duration`:return this.transitionDuration;case`hhomogeneous`:return this.hhomogeneous;case`vhomogeneous`:return this.vhomogeneous;case`interpolate-size`:return this.interpolateSize;default:return this.visibleChildName}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_duration(){let e=this.getAttribute(`transition-duration`);if(e===null)return 200;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}_children(){return Array.from(this.children)}_page(e){return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),needsAttention:e.hasAttribute(`needs-attention`),visible:!e.hasAttribute(`hidden`),child:e}}_firstVisible(){return this._children().find(e=>this._page(e).visible)??null}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){for(let e of Array.from(a.removedNodes))e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1;for(let e of Array.from(a.addedNodes))e instanceof HTMLElement&&(this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e)));continue}let e=a.attributeName;if(e){if(e===`hidden`){this._show(this._firstVisible());continue}Xn.includes(e)&&(i=!0)}}if((n>0||t>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{position:r===-1?this._children().length:r,removed:n,added:t}})),i){for(let t of e){if(t.type!==`attributes`)continue;let e=t.target;this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}})),e===this._visible&&t.attributeName===`name`&&(this._write(`visible-child-name`,this._nameOrNull(this._page(e).name)),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})))}this._render()}}_nameOrNull(e){return e===``?null:e}_show(e,t){if(!e)return!1;let n=this._page(e);if(!n.visible||this._visible===e)return!1;let r=this._visible;if(this._visible=e,this._write(`visible-child-name`,this._nameOrNull(n.name)),this._lastVisible=r,this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{"visible-child":e}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})),r){let t=Math.min(this._children().indexOf(r),this._children().indexOf(e));this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:t,nItems:2}}))}else this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:this._children().indexOf(e),nItems:1}}));return this._startTransition(r,t??this.transitionType),!0}_startTransition(e,t){this._timer!==null&&(clearTimeout(this._timer),this._timer=null);let n=this._effectiveType(t);if(Jn.has(n)&&!e?n=`none`:Jn.has(n)&&e&&(n=simpleTransitionType(this._newChildFirst(e),n)),n===`none`||!e||this._duration()===0){this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),this._lastVisible=null,this._render();return}this.dataset.transitionType=n,this._running=!0,this.setAttribute(`transition-running`,``),this.classList.add(`transitioning`),this._render(),this.dispatchEvent(new CustomEvent(`transition-start`,{bubbles:!0,detail:{duration:this._duration()}})),this._timer=setTimeout(()=>{this._timer=null,this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),delete this.dataset.transitionType,this._lastVisible=null,this._render(),this.dispatchEvent(new CustomEvent(`transition-end`,{bubbles:!0}))},this._duration())}_newChildFirst(e){let t=this._children();return t.indexOf(this._visible)<t.indexOf(e)}_effectiveType(e){let t=e;return t!==`none`&&(this._reducedMotion()?t=this.hhomogeneous&&this.vhomogeneous?`crossfade`:`none`:this.getAttribute(`dir`)===`rtl`&&(t=Yn[t]??t)),t}_reducedMotion(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}_render(){if(this._initialized){for(let e of this._children()){let t=e===this._visible;e.classList.toggle(`visible-page`,t),e.classList.toggle(`transitioning-in`,t&&this._running),e.classList.toggle(`transitioning-out`,!t&&e===this._lastVisible&&this._running),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}this.style.setProperty(`--stack-transition-duration`,`${this._duration()}ms`)}}};customElements.define(`gtk-stack`,GtkStack);var GtkStackSidebar=class extends HTMLElement{_stack=null;_list;_initialized=!1;_rows=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this._list=document.createElement(`div`),this._list.className=`adw-stack-sidebar-list navigation-sidebar`,this._list.setAttribute(`role`,`listbox`),this._list.setAttribute(`aria-label`,`Sidebar`),this.replaceChildren(this._list),this.classList.add(`sidebar`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){!this._initialized||e!==`stack`||this.setStack(n===null?null:this._resolve(n))}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_pages(){return this._stack?.pages??[]}_visible(e){return e.visible&&e.title!==null}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._rows.length&&(this._list.replaceChildren(),this._rows=e.map(()=>this._buildRow()),this._list.append(...this._rows));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._rows[n];if(!r)return;let i=r.querySelector(`.adw-stack-sidebar-title`);i&&(i.textContent=e.title??``),r.hidden=!this._visible(e),r.classList.toggle(`needs-attention`,e.needsAttention),r.classList.toggle(`selected`,n===t),r.setAttribute(`aria-selected`,String(n===t))})}_buildRow(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-sidebar-row`,e.setAttribute(`role`,`link`);let t=document.createElement(`span`);return t.className=`adw-stack-sidebar-title`,e.appendChild(t),e.addEventListener(`click`,()=>this._onRowActivated(e)),e}_onRowActivated(e){let t=this._rows.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}};customElements.define(`gtk-stack-sidebar`,GtkStackSidebar);var GtkStackSwitcher=class extends HTMLElement{_stack=null;_initialized=!1;_nodes=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`,`orientation`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.getAttribute(`orientation`)!==e&&this.setAttribute(`orientation`,e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this.setAttribute(`role`,`tablist`),this.classList.add(`linked`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`orientation`){this._render(),this.dispatchEvent(new CustomEvent(`notify::orientation`,{bubbles:!0,detail:{orientation:this.orientation}}));return}this.setStack(n===null?null:this._resolve(n))}}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_visible(e){return e.visible&&(e.title!==null||e.iconName!==null)}_pages(){return this._stack?.pages??[]}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._nodes.length&&(this.replaceChildren(),this._nodes=e.map(()=>this._buildButton()),this.append(...this._nodes.map(e=>e.button)));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._nodes[n];if(!r)return;r.button.hidden=!this._visible(e),r.button.classList.toggle(`active`,n===t),r.button.setAttribute(`aria-selected`,String(n===t)),r.button.classList.toggle(`needs-attention`,e.needsAttention);let i=e.iconName!==null,a=e.title!==null;r.icon.hidden=!i,r.label.hidden=!a,r.label.textContent=e.title??``,r.button.dataset.buttonMode=i?a?`both`:`icon`:`text`,i?(r.icon.setAttribute(`icon-name`,e.iconName),this.title=e.title??``):(r.icon.removeAttribute(`icon-name`),this.removeAttribute(`title`))}),this._render()}_buildButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-switcher-button`,e.setAttribute(`role`,`tab`);let t=document.createElement(`span`);t.className=`adw-stack-switcher-icon`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);return n.className=`adw-stack-switcher-title`,e.append(t,n),e.addEventListener(`click`,()=>this._onToggled(e)),{button:e,label:n,icon:t}}_onToggled(e){let t=this._nodes.findIndex(t=>t.button===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}_render(){this.setAttribute(`aria-orientation`,this.orientation)}};customElements.define(`gtk-stack-switcher`,GtkStackSwitcher);var GtkText=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`text`,`editable`,`placeholder-text`,`max-length`,`visibility`,`propagate-text-width`]}get text(){return this._input?this._input.value:this.getAttribute(`text`)??``}set text(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`text`,t),this._resizeToText()}get editable(){return readBooleanAttribute(this,`editable`,!0)}set editable(e){writeBooleanAttribute(this,`editable`,e,!0)}get placeholderText(){return this.getAttribute(`placeholder-text`)??``}set placeholderText(e){this.setAttribute(`placeholder-text`,e??``)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(x,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get visibility(){return readBooleanAttribute(this,`visibility`,!0)}set visibility(e){writeBooleanAttribute(this,`visibility`,e,!0)}get propagateTextWidth(){return readBooleanAttribute(this,`propagate-text-width`,!1)}set propagateTextWidth(e){writeBooleanAttribute(this,`propagate-text-width`,e,!1)}get textLength(){return entryTextLength(this.text)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._maxLength=Number(this.getAttribute(`max-length`)??0);let e=document.createElement(`input`);e.className=`adw-text`,e.type=this.visibility?`text`:`password`,e.value=clampEntryText(this.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderText,e.readOnly=!this.editable,e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._resizeToText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{text:e.value}}))}),this._input=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){if(!this._initialized){e===`max-length`&&(this._maxLength=Number(n??0));return}e===`text`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`?this._input.placeholder=n??``:e===`max-length`?(this._maxLength=Number(n??0),this._input.value=clampEntryText(this._input.value,this._maxLength)):e===`editable`?this._input.readOnly=!this.editable:e===`visibility`&&(this._input.type=this.visibility?`text`:`password`),this._resizeToText(),this._reflectReadOnly()}_render(){this._resizeToText(),this._reflectReadOnly()}_reflectReadOnly(){this.classList.toggle(`read-only`,!this.editable)}_resizeToText(){let e=this.propagateTextWidth;this.classList.toggle(`propagate-text-width`,e),this._input&&e&&(this._input.size=Math.max(1,entryTextLength(this._input.value)))}};function readBooleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`}function writeBooleanAttribute(e,t,n,r){n===r?e.removeAttribute(t):e.setAttribute(t,n?`true`:`false`)}customElements.define(`gtk-text`,GtkText);const Zn=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Zn.includes(e??``)?e:`none`}const Qn={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends HTMLElement{_area;_initialized=!1;static get observedAttributes(){return[`text`,`editable`,`wrap-mode`,`justification`,`monospace`,`accepts-tab`,`cursor-visible`,`top-margin`,`bottom-margin`,`left-margin`,`right-margin`]}get text(){return this._area?this._area.value:this.getAttribute(`text`)??this._seedText()}set text(e){this._area?this._area.value=e??``:this.setAttribute(`text`,e??``)}get editable(){return this._bool(`editable`,!0)}set editable(e){this._setBool(`editable`,e,!0)}get wrapMode(){return normalizeWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get justification(){return normalizeLabelJustify(this.getAttribute(`justification`))}set justification(e){this.setAttribute(`justification`,e)}get monospace(){return this._bool(`monospace`,!1)}set monospace(e){this._setBool(`monospace`,e,!1)}get acceptsTab(){return this._bool(`accepts-tab`,!0)}set acceptsTab(e){this._setBool(`accepts-tab`,e,!0)}get cursorVisible(){return this._bool(`cursor-visible`,!0)}set cursorVisible(e){this._setBool(`cursor-visible`,e,!0)}get topMargin(){return this._margin(`top-margin`)}set topMargin(e){this.setAttribute(`top-margin`,String(e))}get bottomMargin(){return this._margin(`bottom-margin`)}set bottomMargin(e){this.setAttribute(`bottom-margin`,String(e))}get leftMargin(){return this._margin(`left-margin`)}set leftMargin(e){this.setAttribute(`left-margin`,String(e))}get rightMargin(){return this._margin(`right-margin`)}set rightMargin(e){this.setAttribute(`right-margin`,String(e))}get textarea(){return this._area}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`textarea`);e.className=`adw-text-view`,e.value=this.getAttribute(`text`)??this._seedText(),e.spellcheck=!1,e.addEventListener(`input`,()=>this._emitChanged()),e.addEventListener(`keydown`,t=>{if(t.key!==`Tab`||!this.acceptsTab)return;t.preventDefault();let n=e.selectionStart??e.value.length,r=e.selectionEnd??n;e.setRangeText(` `,n,r,`end`),this._emitChanged()}),this._area=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(e===`text`?this._area.value=n??``:e===`editable`&&(this._area.readOnly=!this.editable),this._render())}_render(){let e=this.wrapMode,t=this._area;t.style.whiteSpace=Qn[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=un[this.justification],t.style.caretColor=this.cursorVisible?``:`transparent`,this.classList.toggle(`monospace`,this.monospace),t.style.setProperty(`--adw-text-view-margin-top`,`${this.topMargin}px`),t.style.setProperty(`--adw-text-view-margin-end`,`${this.rightMargin}px`),t.style.setProperty(`--adw-text-view-margin-bottom`,`${this.bottomMargin}px`),t.style.setProperty(`--adw-text-view-margin-start`,`${this.leftMargin}px`)}_seedText(){return this.textContent}_emitChanged(){this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:{text:this._area.value}}))}_bool(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBool(e,t,n){t===n?this.removeAttribute(e):this.setAttribute(e,t?`true`:`false`)}_margin(e){let t=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(t)?Math.max(0,t):0}};customElements.define(`gtk-text-view`,GtkTextView);var GtkToggleButton=class extends GtkButton{static signals={...GtkButton.signals,toggled:`toggled`,"notify::active":`notify::active`};_wired=!1;_groupNext=null;_groupPrev=null;_reflectingGroup=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`active`,`group`]}get active(){return this.hasAttribute(`active`)}set active(e){let t=!!e;this.active!==t&&(t&&this._grouped&&this._clearGroup(),this.toggleAttribute(`active`,t))}set group(e){this._reflectingGroup=!0,e===null||e.id===``?this.removeAttribute(`group`):this.setAttribute(`group`,e.id),this._reflectingGroup=!1,this._setGroup(e)}get _grouped(){return this._groupNext!==null||this._groupPrev!==null}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>{this.active&&this._grouped||(this.active=!this.active)}),this.hasAttribute(`group`)&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)))}attributeChangedCallback(e){e===`group`&&!this._reflectingGroup&&this.isConnected&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)),super.attributeChangedCallback(),!(e!==`active`||!this.isConnected)&&(this.active&&this._grouped&&this._clearGroup(),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_setGroup(e){if(e===this){console.error(`<gtk-toggle-button> cannot be its own group; the group is unchanged.`);return}if(e===null)this._groupPrev&&(this._groupPrev._groupNext=this._groupNext),this._groupNext&&(this._groupNext._groupPrev=this._groupPrev),this._groupNext=null,this._groupPrev=null;else{if(this._groupNext===e)return;if(this._groupPrev=null,e._groupPrev){let t=e._groupPrev;t._groupNext=this,this._groupPrev=t}e._groupPrev=this,this._groupNext=e}this.dispatchEvent(new CustomEvent(`notify::group`,{bubbles:!0}))}_clearGroup(){let e=this._groupFirst();for(let t=e;t!==null;t=t._groupNext)t!==this&&(t.active=!1)}_groupFirst(e=0){let t=this._groupPrev;return t===null||e>1024?this:t._groupFirst(e+1)}decorate(e){e.classList.toggle(`checked`,this.active),e.setAttribute(`aria-pressed`,String(this.active))}};customElements.define(`gtk-toggle-button`,GtkToggleButton);function resolveGroupTarget(e,t){if(e===null||e===``)return null;let n=document.getElementById(e);return n===null?(console.error(`<gtk-toggle-button group="${e}"> names no element; the group is unchanged.`),null):(n instanceof GtkToggleButton||customElements.upgrade(n),!(n instanceof GtkToggleButton)||n===t?(console.error(`<gtk-toggle-button group="${e}"> names no other toggle button; the group is unchanged.`),null):n)}var GtkTreeExpander=class extends HTMLElement{_ornaments=[];_expandTimer=null;_initialized=!1;static get observedAttributes(){return[`hide-expander`,`indent-for-depth`,`indent-for-icon`,`depth`,`expandable`,`expanded`]}get hideExpander(){return this.hasAttribute(`hide-expander`)}set hideExpander(e){this.toggleAttribute(`hide-expander`,!!e)}get indentForDepth(){return this.getAttribute(`indent-for-depth`)!==`false`}set indentForDepth(e){this.setAttribute(`indent-for-depth`,String(!!e))}get indentForIcon(){return this.getAttribute(`indent-for-icon`)!==`false`}set indentForIcon(e){this.setAttribute(`indent-for-icon`,String(!!e))}get depth(){let e=Number.parseInt(this.getAttribute(`depth`)??``,10);return Number.isFinite(e)&&e>0?e:0}set depth(e){this.setAttribute(`depth`,String(e))}get expandable(){return this.hasAttribute(`expandable`)}set expandable(e){this.toggleAttribute(`expandable`,!!e)}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get layout(){return treeExpanderLayout({depth:this.depth,expandable:this.expandable,expanded:this.expanded},{hideExpander:this.hideExpander,indentForDepth:this.indentForDepth,indentForIcon:this.indentForIcon})}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`tabindex`)||(this.tabIndex=0),this._wire()),this.setAttribute(`role`,`button`),this._render()}_wire(){this.addEventListener(`keydown`,e=>{let t=treeExpanderAction(e.key,{ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,rtl:globalThis.getComputedStyle(this).direction===`rtl`});t!==`none`&&(e.preventDefault(),this.expanded=treeExpanderExpanded(this.expanded,t))}),this.addEventListener(`dragenter`,()=>{this.expanded||this._expandTimer!==null||(this._expandTimer=setTimeout(()=>{this._expandTimer=null,this.expanded=!0},500))});for(let e of[`dragleave`,`drop`])this.addEventListener(e,()=>this._cancelExpandTimer())}disconnectedCallback(){this._cancelExpandTimer()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`expanded`&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}})))}_cancelExpandTimer(){this._expandTimer!==null&&(clearTimeout(this._expandTimer),this._expandTimer=null)}_render(){for(let e of this._ornaments)e.remove();this._ornaments=[];let e=this.layout,t=this.firstChild;for(let n=0;n<e.indents;n++){let e=document.createElement(`span`);e.className=`adw-tree-expander-indent`,e.setAttribute(`aria-hidden`,`true`),this.insertBefore(e,t),this._ornaments.push(e)}if(e.expander===`none`)this.removeAttribute(`aria-expanded`);else{let n=createGtkImage(`go-next`,`adw-tree-expander-icon`);n.classList.toggle(`expanded`,e.expander===`expanded`),n.addEventListener(`click`,e=>{e.stopPropagation(),this.expanded=!this.expanded}),this.insertBefore(n,t),this._ornaments.push(n),this.setAttribute(`aria-expanded`,String(e.expander===`expanded`))}this.setAttribute(`aria-level`,String(e.level))}};customElements.define(`gtk-tree-expander`,GtkTreeExpander);var GtkVideo=class extends HTMLElement{_initialized=!1;_overlayIcon;_controlsRevealer;_media=null;mediaListeners=[];_hideTimer=null;_hasStream=!1;_error=null;_ended=!1;_playing=!1;static get observedAttributes(){return[`autoplay`,`graphics-offload`,`loop`]}get autoplay(){return this.hasAttribute(`autoplay`)}set autoplay(e){this._write(`autoplay`,!!e),this._syncMedia()}get loop(){return this.hasAttribute(`loop`)}set loop(e){this._write(`loop`,!!e),this._syncMedia()}get graphicsOffload(){return this.hasAttribute(`graphics-offload`)}set graphicsOffload(e){this._write(`graphics-offload`,!!e)}get media(){return this._media}get playing(){return this._playing}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get controlsRevealed(){return this._controlsRevealer?.classList.contains(`revealed`)??!1}_write(e,t){this.toggleAttribute(e,t)}connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0,this._overlayIcon=document.createElement(`button`),this._overlayIcon.className=`adw-video-overlay-icon osd circular`,this._overlayIcon.type=`button`,this._overlayIcon.setAttribute(`aria-label`,`Play`),this._overlayIcon.title=`Play`,this._overlayIcon.addEventListener(`click`,()=>this._overlayClicked()),this._controlsRevealer=document.createElement(`div`),this._controlsRevealer.className=`adw-video-controls-revealer`,this._wrap(),this._adoptMedia(),this.addEventListener(`pointermove`,this._onPointerMove)}_wrap(){let e=this.querySelector(`:scope > video`),t=[...this.children].filter(t=>t!==e),n=document.createElement(`div`);n.className=`adw-video-surface`,this.replaceChildren(n),e&&n.appendChild(e),n.append(this._overlayIcon),this._controlsRevealer.append(...t),n.append(this._controlsRevealer)}_adoptMedia(){let e=this.querySelector(`:scope > .adw-video-surface > video`)??null;if(e===this._media){this._syncMedia(),this._updateOverlayIcon();return}if(this._media&&this._detachMedia(this._media),this._media=e,this._hasStream=e!==null,e){let onPlay=()=>this._updatePlaying(!0),onPause=()=>this._updatePlaying(!1),onEnded=()=>{this._ended=!0,this._updateOverlayIcon()},onError=()=>{this._error=e.error?.message??`Playback failed`,this._updateOverlayIcon()},onMetadata=()=>{this._ended=!1,this._error=null,this._updateOverlayIcon()},onPrepared=()=>{this.autoplay&&e.play().catch(()=>{})};this.mediaListeners=[[`play`,onPlay],[`pause`,onPause],[`ended`,onEnded],[`error`,onError],[`loadedmetadata`,onMetadata],[`loadeddata`,onPrepared]];for(let[t,n]of this.mediaListeners)e.addEventListener(t,n)}this._syncMedia(),this._updateOverlayIcon()}_detachMedia(e){for(let[t,n]of this.mediaListeners)e.removeEventListener(t,n);this.mediaListeners=[]}_syncMedia(){this._media&&(this._media.loop=this.loop,this._media.autoplay=!1,this.classList.toggle(`graphics-offload`,this.graphicsOffload))}_overlayClicked(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}revealControls(){this._controlsRevealer&&(this._controlsRevealer.classList.add(`revealed`),this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>this._hideControls(),3e3))}_hideControls(){this._hideTimer=null,this._controlsRevealer?.classList.remove(`revealed`)}_onPointerMove=()=>{this.revealControls()};attributeChangedCallback(e){this._initialized&&(e===`graphics-offload`&&this._syncMedia(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`autoplay`:return this.autoplay;case`loop`:return this.loop;default:return this.graphicsOffload}}_updatePlaying(e){this._playing=e,this._overlayIcon&&(this._overlayIcon.hidden=e),this.classList.toggle(`playing`,e),this.dispatchEvent(new CustomEvent(`notify::playing`,{bubbles:!0,detail:{playing:e}}))}_updateOverlayIcon(){if(!this._overlayIcon)return;let e,t=null;this._hasStream?this._error===null?e=this._ended?`media-playlist-repeat-symbolic`:`media-playback-start-symbolic`:(e=`dialog-error-symbolic`,t=this._error):e=`media-eject-symbolic`;let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,e),this._overlayIcon.replaceChildren(n),t?this._overlayIcon.title=t:this._overlayIcon.title=``,this._overlayIcon.classList.toggle(`error`,this._error!==null)}disconnectedCallback(){this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=null}};customElements.define(`gtk-video`,GtkVideo);const $n=[`horizontal`,`vertical`];function axisAdjustment(e,t){let n=t===`vertical`,r=n?e.clientHeight:e.clientWidth,i=n?e.scrollHeight:e.scrollWidth;return normalizeAdjustment({value:n?e.scrollTop:e.scrollLeft,lower:0,upper:Math.max(i,r),stepIncrement:r*.1,pageIncrement:r*.9,pageSize:r})}var GtkViewport=class extends HTMLElement{_observer=null;_watch=null;static get observedAttributes(){return[`scroll-to-focus`]}get hadjustment(){return axisAdjustment(this,`horizontal`)}get vadjustment(){return axisAdjustment(this,`vertical`)}get scrollToFocus(){return this.getAttribute(`scroll-to-focus`)!==`false`}set scrollToFocus(e){this.setAttribute(`scroll-to-focus`,e?`true`:`false`)}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`scroll`,this._announce,{passive:!0}),this._observe(),this._bindFocus()}disconnectedCallback(){this.removeEventListener(`scroll`,this._announce),this.removeEventListener(`focusin`,this._onFocusIn)}_observe(){if(this._observer===null){this._observer=new ResizeObserver(()=>this._announce()),this._observer.observe(this);for(let e of this.children)this._observer.observe(e);this._watch=new MutationObserver(()=>{for(let e of this.children)this._observer?.observe(e);this._announce()}),this._watch.observe(this,{childList:!0})}}attributeChangedCallback(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this.scrollToFocus}})),this.isConnected&&this._bindFocus()}scrollAxis(e,t){let n=axisAdjustment(this,e),r=clampAdjustmentValue(n,t);r!==n.value&&(e===`vertical`?this.scrollTop=r:this.scrollLeft=r,this._announce())}scrollTo(e,t){if(!(e instanceof Element)&&e!==null){Element.prototype.scrollTo.call(this,e,t);return}let n=e;if(n!==null&&n!==this&&typeof n.scrollIntoView==`function`){n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),this._announce();return}for(let e of $n){let t=axisAdjustment(this,e),n=clampAdjustmentValue(t,t.value);n!==t.value&&(e===`vertical`?this.scrollTop=n:this.scrollLeft=n)}this._announce()}get adjustments(){return{hadjustment:this.hadjustment,vadjustment:this.vadjustment}}_announce=()=>{this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:this.adjustments}))};_bindFocus(){this.removeEventListener(`focusin`,this._onFocusIn),this.scrollToFocus&&this.addEventListener(`focusin`,this._onFocusIn)}_onFocusIn=e=>{let t=e.target;!(t instanceof Element)||t===this||this.scrollTo(t)}};customElements.define(`gtk-viewport`,GtkViewport);const er={"double-click":{attribute:`double-click-action`,fallback:`toggle-maximize`},"middle-click":{attribute:`middle-click-action`,fallback:`none`},"right-click":{attribute:`right-click-action`,fallback:`menu`}},tr={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},nr=new Set([`none`,`toggle-maximize`,`lower`,`minimize`,`menu`]);function gestureOf(e,t){switch(e){case 0:return t>1?`double-click`:null;case 1:return`middle-click`;case 2:return`right-click`;default:return null}}var GtkWindowHandle=class extends HTMLElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=er[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:nr.has(r)?r:`none`}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this._drag=null}_perform(e,t,n){let r=this.actionFor(e),i=r===`none`?null:tr[r],a={action:r,gesture:e,windowAction:i,x:t,y:n};this.dispatchEvent(new CustomEvent(`titlebar-action`,{bubbles:!0,detail:a})),i!==null&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:a}))}_onClick=e=>{this._drag=null;let t=gestureOf(e.button,e.detail);t!==null&&this._perform(t,e.clientX,e.clientY)};_onPointerDown=e=>{e.detail>1||(this._drag={pointerId:e.pointerId,x:e.clientX,y:e.clientY})};_onPointerMove=e=>{let t=this._drag;t===null||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)<=1||(this._drag=null,this.dispatchEvent(new CustomEvent(`window-move`,{bubbles:!0,detail:{x:e.clientX,y:e.clientY}})))}};customElements.define(`gtk-window-handle`,GtkWindowHandle);var AdwCard=class extends HTMLElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends HTMLElement{_captionEl;_scrollEl;_tableEl;_columns=[];_rows=[];_initialized=!1;static get observedAttributes(){return[`columns`,`rows`,`caption`,`interactive`]}get columns(){return this._columns}set columns(e){this._columns=normalizeDataGridColumns(e),this._initialized&&this._render()}get rows(){return this._rows}set rows(e){this._rows=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._render()}get caption(){return this.getAttribute(`caption`)??``}set caption(e){e?this.setAttribute(`caption`,e):this.removeAttribute(`caption`)}get interactive(){return this.hasAttribute(`interactive`)}set interactive(e){e?this.setAttribute(`interactive`,``):this.removeAttribute(`interactive`)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-data-grid`),this._captionEl=document.createElement(`div`),this._captionEl.className=`adw-data-grid-caption`,this._captionEl.hidden=!0,this._scrollEl=document.createElement(`div`),this._scrollEl.className=`adw-data-grid-scroll`,this._tableEl=document.createElement(`div`),this._tableEl.className=`adw-data-grid-table`,this._tableEl.setAttribute(`role`,`table`),this._scrollEl.appendChild(this._tableEl),this._columns.length===0&&(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns)),this._rows.length===0&&(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[])),this.replaceChildren(this._captionEl,this._scrollEl),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`columns`?(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns),this._render()):e===`rows`?(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[]),this._render()):e===`caption`?this._renderCaption():e===`interactive`&&this._render())}_parseJsonAttr(e,t){let n=this.getAttribute(e);if(!n)return t(void 0);try{return t(JSON.parse(n))}catch{return t(void 0)}}_renderCaption(){let e=this.getAttribute(`caption`)??``;this._captionEl.textContent=e,this._captionEl.hidden=e.length===0}_trackTemplate(){return dataGridTrackTemplate(dataGridTracks(this._columns))}_columnClasses(e){return dataGridColumnClasses(e).join(` `)}_render(){if(!this._tableEl||(this._renderCaption(),this._tableEl.style.gridTemplateColumns=this._trackTemplate(),this._tableEl.replaceChildren(),this._columns.length===0))return;let e=document.createElement(`div`);e.className=`adw-data-grid-row header`,e.setAttribute(`role`,`row`);for(let t of this._columns){let n=document.createElement(`div`);n.className=`${this._columnClasses(t)} header-cell`,n.setAttribute(`role`,`columnheader`),n.textContent=t.label??t.key,e.appendChild(n)}this._tableEl.appendChild(e);let t=this.hasAttribute(`interactive`);this._rows.forEach((e,n)=>{let r=normalizeDataGridVariant(e.variant),i=document.createElement(`div`);if(i.className=`adw-data-grid-row variant-${r}`,i.setAttribute(`role`,`row`),r===`section`){let t=this._columns[0]?.key??``,n=document.createElement(`div`);n.className=`adw-data-grid-cell align-start section-cell`,n.setAttribute(`role`,`cell`),n.style.gridColumn=`1 / -1`,n.textContent=dataGridCellText(e[t]),i.appendChild(n)}else for(let t of this._columns){let n=document.createElement(`div`);n.className=this._columnClasses(t),n.setAttribute(`role`,`cell`),n.textContent=dataGridCellText(e[t.key]),i.appendChild(n)}dataGridRowInteractive(r,e.interactive,t)&&(i.classList.add(`interactive`),i.tabIndex=0,i.addEventListener(`click`,()=>this._activate(n,e)),i.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this._activate(n,e))})),this._tableEl.appendChild(i)})}_activate(e,t){this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{index:e,row:t}}))}};customElements.define(`adw-data-grid`,AdwDataGrid);var AdwShortcutsSection=class extends HTMLElement{_initialized=!1;_bodyEl;_titleEl;static get observedAttributes(){return[`title`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get items(){return[...this._bodyEl.children]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-shortcuts-section-title`,this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-shortcuts-section-body`,this.setAttribute(`role`,`group`),bindSlottedChildren(this,[{into:this._bodyEl}]).install(this._titleEl,this._bodyEl),this._render())}attributeChangedCallback(e){this._initialized&&e===`title`&&this._render()}_render(){let e=this.title;this._titleEl.textContent=e,this._titleEl.hidden=e.length===0}};customElements.define(`adw-shortcuts-section`,AdwShortcutsSection);const rr=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends HTMLElement{_initialized=!1;_titleEl;_subtitleEl;_labelEl;static get observedAttributes(){return[`title`,`subtitle`,`accelerator`,`action-name`,`direction`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get subtitle(){return this.getAttribute(`subtitle`)??``}set subtitle(e){this.setAttribute(`subtitle`,e)}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){e?this.setAttribute(`accelerator`,e):this.removeAttribute(`accelerator`)}get actionName(){return this.getAttribute(`action-name`)??``}set actionName(e){e?this.setAttribute(`action-name`,e):this.removeAttribute(`action-name`)}get direction(){let e=this.getAttribute(`direction`);return e&&rr.includes(e)?e:`none`}set direction(e){this.setAttribute(`direction`,e)}get hasAccelerator(){return this.accelerator.length>0}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`listitem`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-shortcuts-item-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-shortcuts-item-subtitle`,this._labelEl=document.createElement(`adw-shortcut-label`),this._labelEl.className=`adw-shortcuts-item-label`,this.replaceChildren(this._titleEl,this._subtitleEl,this._labelEl),this._render())}attributeChangedCallback(e){this._initialized&&(e===`direction`||e===`accelerator`||e===`action-name`?this._render():e===`title`?this._titleEl.textContent=this.title:e===`subtitle`&&this._renderSubtitle())}_render(){this._titleEl.textContent=this.title,this._renderSubtitle(),this._labelEl.setAttribute(`accelerator`,this.accelerator),this._labelEl.hidden=!this.hasAccelerator;let e=this.direction;if(e!==`none`){let t=getComputedStyle(this).direction;this.hidden=t!==e}else this.hidden=!1}_renderSubtitle(){let e=this.subtitle;this._subtitleEl.textContent=e,this._subtitleEl.hidden=e.length===0}};if(customElements.define(`adw-shortcuts-item`,AdwShortcutsItem),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
3
+ `)}const l={developers:`Code by`,designers:`Design by`,artists:`Artwork by`,documenters:`Documentation by`,translators:`Translated by`};function creditsSections(e={}){return[{title:l.developers,people:e.developers??[]},{title:l.designers,people:e.designers??[]},{title:l.artists,people:e.artists??[]},{title:l.documenters,people:e.documenters??[]},{title:l.translators,people:translatorCreditsPeople(e.translatorCredits)},...e.creditSections??[]].filter(e=>e.people.length>0).map(e=>({title:e.title,people:e.people.map(parseCreditPerson)}))}const u={dialogTitle:`About`,whatsNewRow:`What’s _New`,detailsRow:`_Details`,websiteRow:`_Website`,supportRow:`_Support Questions`,issueRow:`_Report an Issue`,troubleshootingRow:`_Troubleshooting`,creditsRow:`_Credits`,legalRow:`_Legal`,acknowledgementsRow:`_Acknowledgements`,whatsNewPage:`What’s New`,detailsPage:`Details`,troubleshootingPage:`Troubleshooting`,creditsPage:`Credits`,legalPage:`Legal`,acknowledgementsPage:`Acknowledgements`};function aboutDialogVisibility(e={}){let t=(e.website??``).length>0,n=(e.comments??``).length>0,r=(e.releaseNotes??``).length>0,i=e.hasCustomLinks??!1,a=n||i,o=t&&n||i,s=(e.supportUrl??``).length>0,c=(e.issueUrl??``).length>0,l=(e.debugInfo??``).length>0,u=e.hasCredits??!1,d=e.hasLegal??!1,f=e.hasAcknowledgements??!1;return{appIcon:(e.applicationIcon??``).length>0,appName:(e.applicationName??``).length>0,developerName:(e.developerName??``).length>0,version:(e.version??``).length>0,detailsGroup:t||n||o||r,whatsNewRow:r,detailsRow:n||o,websiteRow:t&&!a,supportGroup:s||c||l,supportRow:s,issueRow:c,troubleshootingRow:l,creditsLegalGroup:u||d||f,creditsRow:u,legalRow:d,acknowledgementsRow:f,commentsLabel:n,linksGroup:o,detailsWebsiteRow:t&&a}}function legalSectionVisible(e,t,n){let r=licenseText(t,n);return e.length>0||r!==null&&r.length>0}const d=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],f={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function isAdwAccentColorName(e){return d.includes(e)}function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}const p=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*(?:[,/]\s*[\d.]+%?\s*)?\)$/i;function parseAdwRgb(e){let t=e.trim(),n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);if(n)return parseAdwRgb(`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`);let r=parseHex(t);if(r)return{red:r[0],green:r[1],blue:r[2]};let i=p.exec(t);if(!i)return null;let a=[i[1],i[2],i[3]].map(Number);return a.some(e=>!Number.isFinite(e)||e<0||e>255)?null:{red:a[0]/255,green:a[1]/255,blue:a[2]/255}}function formatAdwRgb(e){return toHex(e.red,e.green,e.blue)}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function nearestAccent(e){let[,t,n]=linearToOklab(toLinear(e.red),toLinear(e.green),toLinear(e.blue)),r=Math.hypot(t,n),i=Math.atan2(n,t)*180/Math.PI%360;return i<0&&(i+=360),r<.04?`slate`:i>345?`pink`:i>280?`purple`:i>230?`blue`:i>175?`teal`:i>115?`green`:i>75.5?`yellow`:i>35?`orange`:i>10?`red`:`pink`}function adwaitaAccentBgColor(e){return f[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(f[e],t)}function deriveRowLabels(e){let t=e.title??``,n=e.subtitle??``;return{title:t,titleVisible:stringIsNotEmpty(t),subtitle:n,subtitleVisible:stringIsNotEmpty(n)}}var ActionRowState=class{constructor(){this._title=``,this._subtitle=``,this._activatableWidget=null,this._activatable=!1,this._widgetSensitive=!0}get state(){return{...deriveRowLabels({title:this._title,subtitle:this._subtitle}),activatable:this._activatable}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}get activatableWidget(){return this._activatableWidget}setActivatableWidget(e,t=!0){return e===this._activatableWidget?!1:(this._activatableWidget=e,this._widgetSensitive=t,e!==null&&(this._activatable=t),!0)}setActivatableWidgetSensitive(e){if(this._activatableWidget===null)return!1;let t=!!e;return t===this._widgetSensitive?!1:(this._widgetSensitive=t,this.setActivatable(t))}get activatable(){return this._activatable}setActivatable(e){let t=!!e;return t===this._activatable?!1:(this._activatable=t,!0)}activate(){return this._activatableWidget}},SwitchRowState=class{constructor(){this._active=!1}get active(){return this._active}setActive(e){let t=!!e;return t===this._active?!1:(this._active=t,!0)}activate(){return this.setActive(!this._active)}},ButtonRowState=class{constructor(){this._title=``,this._startIconName=``,this._endIconName=``}get state(){return{title:this._title,titleVisible:stringIsNotEmpty(this._title),startIconName:this._startIconName,startIconVisible:stringIsNotEmpty(this._startIconName),endIconName:this._endIconName,endIconVisible:stringIsNotEmpty(this._endIconName),activatable:!0}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get startIconName(){return this._startIconName}setStartIconName(e){let t=e??``;return t===this._startIconName?!1:(this._startIconName=t,!0)}get endIconName(){return this._endIconName}setEndIconName(e){let t=e??``;return t===this._endIconName?!1:(this._endIconName=t,!0)}},WindowTitleState=class{constructor(){this._title=``,this._subtitle=``}get state(){return deriveRowLabels({title:this._title,subtitle:this._subtitle})}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}};const m={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0},g={...m,value:NaN};function finite(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function adjustmentRange(e){return[e.lower,Math.max(e.lower,e.upper-e.pageSize)]}function clampAdjustmentValue(e,t){let[n,r]=adjustmentRange(e);return typeof t!=`number`||Number.isNaN(t)?n:Math.min(r,Math.max(n,t))}function snapAdjustmentValue(e,t){let n=clampAdjustmentValue(e,t),[r,i]=adjustmentRange(e),a=(i-r)/e.stepIncrement,o=Math.floor(a+Math.max(1,Math.abs(a))*1e-12),s=Math.min(o,Math.max(0,Math.round((n-r)/e.stepIncrement)));return Math.min(i,Math.max(r,r+s*e.stepIncrement))}function normalizeAdjustment(e,t=g){let n=e??{},r=finite(n.lower,t.lower),i=Math.max(r,finite(n.upper,t.upper)),a=finite(n.stepIncrement,t.stepIncrement),o=a>0?a:t.stepIncrement>0?t.stepIncrement:m.stepIncrement,s=t.pageIncrement===t.stepIncrement,c=finite(n.pageIncrement,s?o:t.pageIncrement),l={value:0,lower:r,upper:i,stepIncrement:o,pageIncrement:c>0?c:o,pageSize:Math.max(0,finite(n.pageSize,t.pageSize))};return l.value=clampAdjustmentValue(l,typeof n.value==`number`?n.value:t.value),l}const _=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function parseAdjustment(e){if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!=`object`||!t||Array.isArray(t))return{};let n=t,r={};for(let e of _){let t=n[e];typeof t==`number`&&(r[e]=t)}return r}var SpinState=class{constructor(){this._adjustment=normalizeAdjustment(),this._valueSet=!1,this._listeners=new Set,this._rangeListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeChanged(e){return this._rangeListeners.add(e),()=>{this._rangeListeners.delete(e)}}_emit(e){let t={value:this._adjustment.value,interactive:e};for(let e of[...this._listeners])e(t)}_emitChanged(){let e=this._adjustment;for(let t of[...this._rangeListeners])t(e)}_bump(e){let t=clampAdjustmentValue(this._adjustment,this._adjustment.value+e);return t===this._adjustment.value?!1:(this._valueSet=!0,this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}get adjustment(){return{...this._adjustment}}get value(){return this._adjustment.value}configure(e){let t=this._adjustment,n=normalizeAdjustment(e,this._valueSet?t:{...t,value:NaN});typeof e?.value==`number`&&Number.isFinite(e.value)&&(this._valueSet=!0);let r=n.lower!==t.lower||n.upper!==t.upper||n.stepIncrement!==t.stepIncrement||n.pageIncrement!==t.pageIncrement||n.pageSize!==t.pageSize,i=n.value!==t.value;return!r&&!i?!1:(this._adjustment=n,r&&this._emitChanged(),i&&this._emit(!1),!0)}setValue(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!1),!0)}setValueInteractive(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}increment(){return this._bump(this._adjustment.stepIncrement)}decrement(){return this._bump(-this._adjustment.stepIncrement)}};const ee=[`light`,`dark`,`no-preference`],v=`system`;function isAdwSystemColorScheme(e){return typeof e==`string`&&ee.includes(e)}function appearanceFromMeta(e){let t=e(`adw-accent`)?.trim().toLowerCase(),n=e(`adw-color-scheme`)?.trim().toLowerCase();return{...t&&(t===`system`||isAdwAccentColorName(t))?{accent:t}:{},...isAdwSystemColorScheme(n)?{colorScheme:n}:{}}}const te=[{fg:`#cfe1f5`,start:`#83b6ec`,stop:`#337fdc`},{fg:`#caeaf2`,start:`#7ad9f1`,stop:`#0f9ac8`},{fg:`#cef8d8`,start:`#8de6b1`,stop:`#29ae74`},{fg:`#e6f9d7`,start:`#b5e98a`,stop:`#6ab85b`},{fg:`#f9f4e1`,start:`#f8e359`,stop:`#d29d09`},{fg:`#ffead1`,start:`#ffcb62`,stop:`#d68400`},{fg:`#ffe5c5`,start:`#ffa95a`,stop:`#ed5b00`},{fg:`#f8d2ce`,start:`#f78773`,stop:`#e62d42`},{fg:`#fac7de`,start:`#e973ab`,stop:`#e33b6a`},{fg:`#e7c2e8`,start:`#cb78d4`,stop:`#9945b5`},{fg:`#d5d2f5`,start:`#9e91e8`,stop:`#7a59ca`},{fg:`#f2eade`,start:`#e3cf9c`,stop:`#b08952`},{fg:`#e5d6ca`,start:`#be916d`,stop:`#785336`},{fg:`#d8d7d3`,start:`#c0bfbc`,stop:`#6e6d71`}];function*utf8Bytes(e){for(let t of e){let e=t.codePointAt(0)??0;e>=55296&&e<=57343&&(e=65533),e<128?yield e:e<2048?(yield 192|e>>6,yield 128|e&63):e<65536?(yield 224|e>>12,yield 128|e>>6&63,yield 128|e&63):(yield 240|e>>18,yield 128|e>>12&63,yield 128|e>>6&63,yield 128|e&63)}}function gStrHash(e){let t=5381;for(let n of utf8Bytes(e)){if(n===0)break;t=Math.imul(t,33)+(n>127?n-256:n)>>>0}return t>>>0}function avatarInitials(e){let t=gStrStrip((e??``).toUpperCase()).normalize(`NFC`);if(t.length===0)return``;let n=firstCodePoint(t),r=t.lastIndexOf(` `);return r<0?n:n+firstCodePoint(t.slice(r+1))}function firstCodePoint(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function avatarColorClass(e){return e?gStrHash(e)%14+1:null}function avatarColor(e){let t=avatarColorClass(e);return te[(t??1)-1]}function avatarMode(e){return e.hasCustomImage?`image`:e.showInitials&&e.text.length>0?`initials`:`icon`}function avatarMaxFontSize(e){return e/1.4142-Math.max(e*.4-5,0)}function avatarFontSize(e,t){let n=avatarMaxFontSize(e);return t.width>0?glibClamp(t.height*(n/t.width),0,n):n}function avatarIconSize(e){return Math.trunc(e/2)}const ne=[`suggested-action`],re={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:re.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?ne:[]}function bannerButtonVisible(e){return typeof e==`string`&&e.length>0}function bannerButtonText(e){return stripMnemonic(e)}const ie=new Set([`none`,`single`,`browse`,`multiple`]);function normalizeBoxSelectionMode(e){return typeof e==`string`&&ie.has(e)?e:`single`}function normalize(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function spanBetween(e,t,n){let r=Math.max(0,Math.min(e,t)),i=Math.min(n-1,Math.max(e,t)),a=[];for(let e=r;e<=i;e++)a.push(e);return a}function isLiveAnchor(e,t){return Number.isInteger(e)&&e>=0&&e<t}function listBoxSelect(e,t,n,r,i,a={},o=!0){let s=normalize(e,r),unchanged=()=>({selection:s,anchor:t});if(i===`none`||!o||!Number.isInteger(n)||n<0||n>=r)return unchanged();let c=new Set(s);if(i===`browse`)return{selection:[n],anchor:n};if(i===`single`){let e=c.has(n);return{selection:a.modify===!0&&e?[]:[n],anchor:a.modify===!0&&e?-1:n}}return a.extend===!0?isLiveAnchor(t,r)?{selection:spanBetween(t,n,r),anchor:t}:{selection:[n],anchor:n}:a.modify===!0?(c.has(n)?c.delete(n):c.add(n),{selection:normalize(c,r),anchor:t}):{selection:[n],anchor:n}}function listBoxSelectRow(e,t,n,r,i,a=!0){let o=normalize(e,r);return i===`none`?{selection:o,anchor:t}:n===null?{selection:[],anchor:-1}:!a||!Number.isInteger(n)||n<0||n>=r||o.includes(n)?{selection:o,anchor:t}:i===`multiple`?{selection:normalize([...o,n],r),anchor:n}:{selection:[n],anchor:n}}function listBoxUnselectRow(e,t,n,r,i){let a=normalize(e,r);return i===`none`||!a.includes(n)?{selection:a,anchor:t}:{selection:i===`multiple`?a.filter(e=>e!==n):[],anchor:t}}function listBoxSelectAll(e,t){return t!==`multiple`||e<=0?null:Array.from({length:e},(e,t)=>t)}function listBoxUnselectAll(e,t){return t===`browse`||t===`none`||e.length===0?null:[]}function normalizeBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e));return Number.isFinite(t)&&t>0?t:0}function normalizeBoxOrientation(e){return e===`vertical`?`vertical`:`horizontal`}const ae=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(e){let t=e.trim();if(!t)return null;let n=splitTopLevel(t);if(n){let e=parseBreakpointCondition(n.left),t=parseBreakpointCondition(n.right);return!e||!t?null:{op:n.op,left:e,right:t}}if(t.startsWith(`(`)&&t.endsWith(`)`))return parseBreakpointCondition(t.slice(1,-1));let r=ae.exec(t);return r?{bound:r[1].toLowerCase(),dimension:r[2].toLowerCase(),value:Number.parseFloat(r[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t,n=!1){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t,this._applied=n}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}},BreakpointBinState=class{constructor(){this._breakpoints=[],this._current=null,this._hasChild=!0}add(e){let t=this._breakpoints.length;return this._breakpoints.push({index:t,condition:parseBreakpointCondition(e.condition),setters:e.setters}),t}setHasChild(e){this._hasChild=e}get current(){return this._current?.index??null}get length(){return this._breakpoints.length}evaluate(e){if(!this._hasChild)return null;let t=null;for(let n=this._breakpoints.length-1;n>=0;n--){let r=this._breakpoints[n];if(r.condition&&evaluateBreakpointCondition(r.condition,e)){t=r;break}}if(t===this._current)return null;let n=this._current;return this._current=t,{from:n?.index??null,to:t?.index??null,writes:transitionWrites(n,t)}}inherit(e){if(e===null){this._current=null;return}let t=this._breakpoints[e];if(!t)throw RangeError(`BreakpointBinState.inherit: no breakpoint at index ${e}; ${this._breakpoints.length} added.`);this._current=t}};function transitionWrites(e,t){let n=[];if(e)for(let r of e.setters)t?.setters.some(e=>e.object===r.object&&e.property===r.property)||n.push({object:r.object,property:r.property,value:r.originalValue});if(t)for(let e of t.setters)n.push({object:e.object,property:e.property,value:e.value});return n}const oe=`image-text-button`;function buttonContentIconIsEmpty(e){return e.length===0}function buttonContentIconName(e){return buttonContentIconIsEmpty(e)?`image-missing`:e}function buttonContentLabelText(e,t){return t?stripMnemonic(e):e}const se=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],ce={flat:`flat`,suggested:`suggested-action`,"suggested-action":`suggested-action`,destructive:`destructive-action`,"destructive-action":`destructive-action`,circular:`circular`,pill:`pill`};function buttonStyleClass(e){return e?ce[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return se.filter(e=>t.has(e))}const y=9999;function calendarIsLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function calendarDaysInMonth(e,t){let n=glibClamp(Math.trunc(t),1,12);return n===2?calendarIsLeapYear(e)?29:28:[0,31,28,31,30,31,30,31,31,30,31,30,31][n]}function calendarWeekStart(e,t){let n=(t+e-1)%7;return n<0||n>6?0:n}function calendarDays(e,t,n){let r=glibClamp(Math.trunc(t),1,12),i=glibClamp(Math.trunc(e),1,y),a=glibClamp(Math.trunc(n),0,6),o=calendarDaysInMonth(i,r),s=r===1?12:r-1,c=r===1?i-1:i,l=calendarDaysInMonth(c,s),u=(weekdayOfWeek(i,r,1)-a+7)%7;u===0&&(u=7);let d=[],f=l-u+1;for(let e=0;e<u;e++)d.push({date:{year:c,month:s,day:f},month:`previous`}),f+=1;let p=Math.trunc(u/7),m=u%7;for(let e=1;e<=o;e++)d.push({date:{year:i,month:r,day:e},month:`current`}),m+=1,m===7&&(p+=1,m=0);f=1;let g=r===12?1:r+1,_=r===12?i+1:i;for(;p<=5;p++){for(;m<=6;m++)d.push({date:{year:_,month:g,day:f},month:`next`}),f+=1;m=0}return d}function weekdayOfWeek(e,t,n){return((daysFromCivil(e,t,n)+4)%7+7)%7}function daysFromCivil(e,t,n){let r=t<=2?e-1:e,i=Math.floor((r>=0?r:r-399)/400),a=r-i*400,o=Math.floor((153*(t+(t>2?-3:9))+2)/5)+n-1,s=a*365+Math.floor(a/4)-Math.floor(a/100)+o;return i*146097+s-719468}function civilFromDays(e){let t=e+719468,n=Math.floor((t>=0?t:t-146096)/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=i+n*400,o=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),s=Math.floor((5*o+2)/153),c=o-Math.floor((153*s+2)/5)+1,l=s+(s<10?3:-9);return{year:a+ +(l<=2),month:l,day:c}}function calendarWeekNumber(e){let t=glibClamp(Math.trunc(e.year),1,y),n=glibClamp(Math.trunc(e.month),1,12),r=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(t,n)),i=thursdayOfWeek(daysFromCivil(t,n,r),weekdayOfWeek(t,n,r)),a=civilFromDays(i).year;return 1+Math.round((i-thursdayOfJanuaryFirst(a))/7)}function thursdayOfWeek(e,t){return e-(t+6)%7+3}function thursdayOfJanuaryFirst(e){return thursdayOfWeek(daysFromCivil(e,1,4),weekdayOfWeek(e,1,4))}function calendarNavigationButtons(e){let t=glibClamp(Math.trunc(e.year),1,y),n=glibClamp(Math.trunc(e.month),1,12),r=t===1,i=t===y;return{previousMonth:!r||n!==1,nextMonth:!i||n!==12,previousYear:!r,nextYear:!i}}function calendarStep(e,t){let n=glibClamp(Math.trunc(e.year),1,y),r=glibClamp(Math.trunc(e.month),1,12),i=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(n,r));if(t===`previous-year`||t===`next-year`){let e=n+(t===`next-year`?1:-1);return{year:glibClamp(e,1,y),month:r,day:Math.min(i,calendarDaysInMonth(e,r))}}let a=t===`next-month`?1:-1,o=glibClamp(n*12+(r-1)+a,12,119999),s=Math.floor(o/12),c=o%12+1;return{year:s,month:c,day:Math.min(i,calendarDaysInMonth(s,c))}}function calendarSelectDay(e,t,n=!0){let r=glibClamp(Math.trunc(t.year),1,y),i=glibClamp(Math.trunc(t.month),1,12),a={year:r,month:i,day:glibClamp(Math.trunc(t.day),1,calendarDaysInMonth(r,i))},o=e.day!==a.day;return{date:a,dayChanged:o,monthChanged:e.month!==a.month,yearChanged:e.year!==a.year,emitDaySignal:n&&o}}function calendarMarkDay(e,t,n){let r=Math.trunc(t);if(r<1||r>31||e[r-1]===!0===n)return e;let i=e.slice();return i[r-1]=n,i}function calendarDayIsMarked(e,t){let n=Math.trunc(t);return n<1||n>31?!1:e[n-1]===!0}function calendarClearMarks(){return Array.from({length:31},()=>!1)}const le=.35;function clamp(e,t,n){return e>n?n:e<t?t:e}function swipeSlope(e){let t=e===`touchpad`?.997:.998;return t/(1-t)/1e3}function swipeVelocityThreshold(e){return e===`touchpad`?.6:.3}function swipeClosestPointIndex(e,t){let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);return n}function swipeNextPointIndex(e,t){for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t)<2**-52||e[n]>t)return n;return-1}function swipePreviousPointIndex(e,t){for(let n=e.length-1;n>=0;n--)if(Math.abs(e[n]-t)<2**-52||e[n]<t)return n;return-1}function swipeBounds(e,t,n){if(e.length===0)return{lower:0,upper:0};if(n)return{lower:e[0],upper:e[e.length-1]};let r=swipeClosestPointIndex(e,t),i,a;return Math.abs(e[r]-t)<.005?(i=r,a=r):(i=swipePreviousPointIndex(e,t),a=swipeNextPointIndex(e,t)),{lower:e[Math.max(i-1,0)],upper:e[Math.min(a+1,e.length-1)]}}function swipeEndProgress(e){let{points:t,progress:n,velocity:r,source:i}=e;if(e.cancelled===!0)return e.cancelProgress??n;if(t.length===0)return n;let{lower:a,upper:o}=swipeBounds(t,e.initialProgress,e.allowLongSwipes);if(Math.abs(r)<swipeVelocityThreshold(i))return clamp(t[swipeClosestPointIndex(t,n)],a,o);let s=swipeSlope(i),c;if(Math.abs(r)>2){let e=s/2/le,t=Math.abs(r)-2+e;c=le*t*t-le*e*e+s*2}else c=Math.abs(r)*s;return t[swipeProjectedPointIndex(t,clamp(c*Math.sign(r)+n,a,o),e.initialProgress,r)]}function swipeProjectedPointIndex(e,t,n,r){let i=swipeClosestPointIndex(e,n),a=swipePreviousPointIndex(e,t),o=swipeNextPointIndex(e,t);if((r>0?a:o)===i){let e=r>0?o:a;if(e>=0)return e}return swipeClosestPointIndex(e,t)}var SwipeTracker=class{constructor(e){this._options=e,this._history=[],this._initialProgress=0,this._progress=0,this._cancelled=!1}get progress(){return this._progress}get initialProgress(){return this._initialProgress}prepare(e){this._initialProgress=e,this._progress=e,this._cancelled=!1}record(e,t){this._trimHistory(t),this._history.push({delta:e,time:t})}advance(e,t){if(!(t>0))return this._progress;let{lower:n,upper:r}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress=clamp(this._progress+e/t,n,r),this._progress}reset(){this._history.length=0,this._initialProgress=0,this._progress=0,this._cancelled=!1}cancel(){this._cancelled=!0}end(e,t=`touch`){this._trimHistory(e);let n=this._velocity(),r=swipeEndProgress({points:this._options.points(),initialProgress:this._initialProgress,progress:this._progress,velocity:n,allowLongSwipes:this._options.allowLongSwipes(),source:t,cancelled:this._cancelled,cancelProgress:this._options.cancelProgress?.()??this._initialProgress});return this.reset(),{velocity:n,to:r}}_trimHistory(e){let t=e-150,n=0;for(;n<this._history.length&&this._history[n].time<t;)n++;n>0&&this._history.splice(0,n)}_velocity(){if(this._history.length<2)return 0;let e=this._history[0].time,t=this._history[this._history.length-1].time;if(e===t)return 0;let n=0;for(let e=1;e<this._history.length;e++)n+=this._history[e].delta;let r=n/(t-e),{lower:i,upper:a}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress<=i&&r<0||this._progress>=a&&r>0?0:r}};function approx(e,t){return Math.abs(e-t)<2**-52}function carouselSnapPoints(e){let t=0;return e.map(e=>{let n=t+e-1;return t+=e,n})}function carouselPageAllocation(e,t){let n=0;for(let r of t){let t=r.expand?e:glibClamp(r.natural,r.minimum??0,e);n=Math.max(n,t)}return{pageSize:n,leadingInset:(e-n)/2}}function carouselRange(e,t=0){let n=e.length>0?e[e.length-1]:0;return{lower:0,upper:Math.max(0,t+n)}}function carouselClampPosition(e,t,n=0){let r=carouselRange(t,n);return glibClamp(e,r.lower,r.upper)}function carouselClosestSnapPoint(e,t){return t.length===0?-1:swipeClosestPointIndex(t,e)}function carouselPageAtPosition(e,t){return carouselClosestSnapPoint(carouselClampPosition(e,t),t)}function cRound(e){return Math.sign(e)*Math.round(Math.abs(e))}function carouselNavigateTarget(e,t,n){if(t<=0)return null;let r=cRound(e);return n===`back`?r>0?r-1:null:r<t-1?r+1:null}function carouselWheelStep(e){if(e.source===`touchpad`)return 0;let t=e.source===`mouse`,n=0;return(e.orientation===`vertical`||t)&&(e.deltaY>0?n=1:e.deltaY<0&&(n=-1)),e.orientation===`horizontal`&&n===0&&(e.deltaX>0?n=1:e.deltaX<0&&(n=-1)),n}function carouselReorderShift(e){let{closestPoint:t,oldPoint:n,newPoint:r,size:i}=e;return approx(t,n)?r-n:(approx(n,t)||n>t)&&(approx(t,r)||t>r)?i:(approx(r,t)||r>t)&&(approx(t,n)||t>n)?-i:0}function nthPageDiagnostic(e,t){return`adw_carousel_get_nth_page: assertion 'n < adw_carousel_get_n_pages (self)' failed (n = ${e}, n_pages = ${t})`}function positionDiagnostic(e,t){return`${e}: assertion 'position >= -1' failed (position = ${t})`}function unknownPageDiagnostic(e){return`AdwCarousel: no page with id '${e}'`}function nonFiniteDiagnostic(e,t){return`AdwCarousel: ${e} must be a finite double (got ${t})`}var CarouselState=class{constructor(e={}){this._children=[],this._position=0,this._wheelLockedAt=null,this._settledPage=null,this._listeners=new Set,this._pageChangedListeners=new Set,this._diagnostics=[],this._orientation=e.orientation??`horizontal`,this._interactive=e.interactive??!0,this._allowScrollWheel=e.allowScrollWheel??!0,this._allowMouseDrag=e.allowMouseDrag??!0,this._allowLongSwipes=e.allowLongSwipes??!1,this._spacing=e.spacing??0,this._revealDuration=e.revealDuration??0,this._now=e.now??(()=>Date.now()),this._onScrollTo=e.onScrollTo,this._animateScroll=e.animateScroll??!1}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}onPageChanged(e){return this._pageChangedListeners.add(e),()=>{this._pageChangedListeners.delete(e)}}_emit(e,t){let n={position:this._position,nPages:this.nPages,page:this.pageAt(this._position),interactive:t,reason:e};for(let e of[...this._listeners])e(n)}get nPages(){let e=0;for(let t of this._children)t.removing||e++;return e}get ids(){return this._children.filter(e=>!e.removing).map(e=>e.id)}get position(){return this._position}get sizes(){return this._children.map(e=>e.size)}get snapPoints(){return carouselSnapPoints(this.sizes)}get range(){return carouselRange(this.snapPoints)}_visibleSnapPoints(){return this.snapPoints.filter((e,t)=>!this._children[t].removing)}pageAt(e){return carouselPageAtPosition(e,this._visibleSnapPoints())}indexOf(e){let t=0;for(let n of this._children)if(!n.removing){if(n.id===e)return t;t++}return-1}snapPointOf(e){let t=this._nthLink(e);return t<0?void 0:this.snapPoints[t]}_nthLink(e){let t=e;for(let e=0;e<this._children.length;e++)if(!this._children[e].removing&&t--===0)return e;return-1}_closestChildIndex(e,t,n){let r=this.snapPoints,i=[],a=[];this._children.forEach((e,o)=>{e.adding&&!t||e.removing&&!n||(i.push(o),a.push(r[o]))});let o=carouselClosestSnapPoint(e,a);return o<0?-1:i[o]}_updateShiftPositionFlag(e){let t=this._closestChildIndex(this._position,!1,!0);t<0||(this._children[e].shiftPosition=t>=e)}_updateShiftFlags(){this._children.forEach((e,t)=>{(e.adding||e.removing)&&this._updateShiftPositionFlag(t)})}setPosition(e,t=!1){if(!Number.isFinite(e))return this._diagnostics.push(nonFiniteDiagnostic(`position`,e)),!1;let n=carouselClampPosition(e,this.snapPoints),r=n!==this._position;return this._position=n,this._updateShiftFlags(),this._emit(`position`,t),r}scrollTo(e,t={}){let n=this.nPages;if(!Number.isInteger(e)||e<0||e>=n)return this._diagnostics.push(nthPageDiagnostic(e,n)),!1;let r=t.interactive??!1,i=t.animate??this._animateScroll,a=this.snapPointOf(e);return this._onScrollTo?.({index:e,position:a,interactive:r,animate:i}),i||(this.setPosition(a,r),this.settle()),!0}settle(){let e=this.pageAt(this._position);this._settledPage=e;for(let t of[...this._pageChangedListeners])t(e)}settleIfArrived(e=.01){let t=this.pageAt(this._position),n=this.snapPointOf(t);return n===void 0||Math.abs(this._position-n)>=e?(this._settledPage=null,!1):this._settledPage===t?!1:(this.settle(),!0)}navigate(e){if(!this._interactive)return!1;let t=carouselNavigateTarget(this._position,this.nPages,e);return t===null?!1:this.scrollTo(t,{interactive:!0})}handleWheel(e){if(!this._allowScrollWheel||this._wheelLockedAt!==null&&this._now()-this._wheelLockedAt<150||!this._interactive)return 0;let t=this.nPages;if(t===0)return 0;let n=carouselWheelStep({...e,orientation:this._orientation});if(n===0)return 0;let r=glibClamp(this.pageAt(this._position)+n,0,t-1);return this.scrollTo(r,{interactive:!0}),this._wheelLockedAt=this._now(),n}insertPage(e,t=-1){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_insert`,t)),!1;let n={id:e,size:0,adding:!0,removing:!1,shiftPosition:!1},r=t>=0?this._nthLink(t):-1,i=r<0?this._children.length:r;return this._children.splice(i,0,n),this._updateShiftPositionFlag(i),this._emit(`n-pages`,!1),!0}removePage(e){let t=this._children.findIndex(t=>t.id===e&&!t.removing);if(t<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let n=this._children[t];return n.removing=!0,this._updateShiftPositionFlag(t),n.adding&&this._children.splice(t,1),this._emit(`n-pages`,!1),!0}reorderPage(e,t){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_reorder`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;if(t===n)return!1;let r=this._closestChildIndex(this._position,!0,!0),i=this.snapPoints,a=r<0?0:i[r],o=i[n],s=this.nPages,c=t<0||t>s?s:t;if(n===s-1&&c===s)return!1;let l;l=c===s?-1:c>n?this._nthLink(c+1):this._nthLink(c);let u;u=l>=0?c>n?i[l-1]:i[l]:i[i.length-1];let[d]=this._children.splice(n,1);l<0?this._children.push(d):this._children.splice(l>n?l-1:l,0,d);let f=carouselReorderShift({closestPoint:a,oldPoint:o,newPoint:u,size:d.size});return f===0?(this._emit(`geometry`,!1),!0):(this._position=carouselClampPosition(this._position+f,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0)}setPageSize(e,t){if(!Number.isFinite(t))return this._diagnostics.push(nonFiniteDiagnostic(`size of page '${e}'`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let r=this._children[n],i=t-r.size,a=r.shiftPosition&&i!==0;return r.size=t,r.removing&&t<=0?this._children.splice(n,1):r.adding&&t>=1&&(r.adding=!1),a?(this._position=carouselClampPosition(this._position+i,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0):(this._emit(`geometry`,!1),!0)}skipReveal(e){let t=this._children.find(t=>t.id===e);return!t||!t.adding&&!t.removing?!1:this.setPageSize(e,+!t.removing)}get orientation(){return this._orientation}setOrientation(e){return e===this._orientation?!1:(this._orientation=e,this._emit(`geometry`,!1),!0)}get interactive(){return this._interactive}setInteractive(e){let t=!!e;return t===this._interactive?!1:(this._interactive=t,!0)}get allowScrollWheel(){return this._allowScrollWheel}setAllowScrollWheel(e){let t=!!e;return t===this._allowScrollWheel?!1:(this._allowScrollWheel=t,!0)}get allowMouseDrag(){return this._allowMouseDrag}setAllowMouseDrag(e){let t=!!e;return t===this._allowMouseDrag?!1:(this._allowMouseDrag=t,!0)}get allowLongSwipes(){return this._allowLongSwipes}setAllowLongSwipes(e){let t=!!e;return t===this._allowLongSwipes?!1:(this._allowLongSwipes=t,!0)}get spacing(){return this._spacing}setSpacing(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`spacing`,e)),!1):e===this._spacing?!1:(this._spacing=e,this._emit(`geometry`,!1),!0)}get revealDuration(){return this._revealDuration}setRevealDuration(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`reveal-duration`,e)),!1):e===this._revealDuration?!1:(this._revealDuration=e,!0)}pageDistance(e){return e+this._spacing}get diagnostics(){return this._diagnostics}};function resolveCheckState(e,t){return t?`indeterminate`:e?`checked`:`unchecked`}var RadioGroupState=class{constructor(){this._selected=new Map,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){for(let t of[...this._listeners])t(e)}selected(e){return this._selected.get(e)??null}select(e,t){let n=this._selected.get(e);return n===t?!1:(this._selected.set(e,t),this._emit({name:e,selected:t,deselected:n??null}),!0)}};function adwLerp(e,t,n){return e*(1-n)+t*n}function inverseLerp(e,t,n){return(n-e)/(t-e)}function easeOutCubic(e){let t=e-1;return t*t*t+1}function easeInOutSine(e){return-.5*(Math.cos(Math.PI*e)-1)}const b={maximumSize:600,tighteningThreshold:400};function clampThresholds(e){let t=Math.max(Math.min(e.tighteningThreshold,e.maximumSize),e.childMin),n=Math.max(t,e.maximumSize);return{lower:t,max:n,upper:t+3*(n-t)}}function childSizeFrom(e,t,n){let{lower:r,max:i,upper:a}=t;return e<0?Math.min(n,Math.ceil(i)):e<=r?e:e>=a?Math.ceil(i):Math.floor(adwLerp(r,i,easeOutCubic(inverseLerp(r,a,e))))}const x=[`small`,`medium`,`large`];function clampAllocate(e,t){let n=clampThresholds(t),r=Math.ceil(n.max),i=Math.ceil(n.lower),a=childSizeFrom(e,n,t.childNat);return{childSize:a,childMaximum:r,lowerThreshold:i,sizeClass:a>=r?`large`:a<=i?`small`:`medium`,offset:Math.trunc((e-a)/2)}}function normalizeClampSize(e,t){let n=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(n)?Math.max(0,Math.trunc(n)):t}const ue={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:ue.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const de=[`undershoot-top`,`undershoot-bottom`],fe=[`raised`,`border`];function toolbarViewClasses(e){let t=[];return e.topBarStyle===`flat`&&!e.extendContentToTopEdge&&e.topBarHeight>0&&t.push(`undershoot-top`),e.bottomBarStyle===`flat`&&!e.extendContentToBottomEdge&&e.bottomBarHeight>0&&t.push(`undershoot-bottom`),{view:t,topBar:toolbarBarStyleClasses(e.topBarStyle),bottomBar:toolbarBarStyleClasses(e.bottomBarStyle)}}function spinnerGeometry(e,t){let n=Math.min(Math.floor(Math.min(e,t)/2),64/2),r=n*2;return{radius:n,diameter:r,lineWidth:r/8,centerX:Math.round(e/2),centerY:Math.round(t/2)}}function resolveSpinnerSize(e){let t=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(t)?Math.max(t,16):16}function resolvePageTitle(e,t){return e??t}const pe=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return pe.test(t)?t:``}function nameNotFoundDiagnostic(e){return`Child name '${e}' not found in AdwViewStack`}function duplicateNameDiagnostic(e){return`While adding page: duplicate child name in AdwViewStack: ${e}`}var ViewStackState=class{constructor(){this._pages=[],this._visibleIndex=-1,this._listeners=new Set,this._diagnostics=[],this._pagesView=null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t=this._pageAt(this._visibleIndex),n={index:this._visibleIndex,name:t?.name??``,title:t?.title??``,page:t,interactive:e};for(let e of[...this._listeners])e(n)}_pageAt(e){return e>=0&&e<this._pages.length?this._pages[e]:void 0}_firstVisibleIndex(){return this._pages.findIndex(e=>e.visible)}_record(e){return{name:e.name,title:resolvePageTitle(e.title,e.name),icon:normalizeIconName(e.icon),content:e.content,visible:e.visible??!0,badgeNumber:Number.isFinite(e.badgeNumber)?Math.trunc(e.badgeNumber):0,needsAttention:e.needsAttention===!0,useUnderline:e.useUnderline===!0,startsSection:e.startsSection===!0,sectionTitle:e.sectionTitle??``}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}get count(){return this._pages.length}indexOfName(e){return this._pages.findIndex(t=>t.name===e)}isSelected(e){return!Number.isInteger(e)||e<0||e>=this._pages.length?!1:e===this._visibleIndex}addPage(e){return this._insertRecord(this._record(e),this._pages.length)}insertPage(e,t){return!Number.isInteger(t)||t<0||t>this._pages.length?null:this._insertRecord(this._record(e),t)}_insertRecord(e,t){return this.indexOfName(e.name)>=0&&this._diagnostics.push(duplicateNameDiagnostic(e.name)),this._pages.splice(t,0,e),this._pagesView=null,this._visibleIndex<0?(e.visible&&(this._visibleIndex=t,this._emit(!1)),e):(t<=this._visibleIndex&&(this._visibleIndex+=1),e)}movePage(e,t){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||e>=this._pages.length||t<0||t>=this._pages.length||e===t)return!1;let[n]=this._pages.splice(e,1);if(this._pages.splice(t,0,n),this._pagesView=null,this._visibleIndex===e)this._visibleIndex=t;else{let n=this._visibleIndex;n>e&&--n,n>=t&&(n+=1),this._visibleIndex=n}return!0}removePage(e){let t=this.indexOfName(e);return t<0?!1:(this._pages.splice(t,1),this._pagesView=null,t===this._visibleIndex?this._visibleIndex=-1:t<this._visibleIndex&&--this._visibleIndex,!0)}get visibleIndex(){return this._visibleIndex}setVisibleIndex(e,t=!0){return!Number.isInteger(e)||e<0||e>=this._pages.length||e===this._visibleIndex||!this._pages[e].visible?!1:(this._visibleIndex=e,this._emit(t),!0)}get visibleName(){return this._pageAt(this._visibleIndex)?.name??``}setVisibleName(e,t=!0){if(e==null)return!1;let n=this.indexOfName(e);return n<0?(this._diagnostics.push(nameNotFoundDiagnostic(e)),!1):this.setVisibleIndex(n,t)}get visiblePage(){return this._pageAt(this._visibleIndex)}get visibleTitle(){return this._pageAt(this._visibleIndex)?.title??``}setPageVisible(e,t){let n=this.indexOfName(e);if(n<0)return this._diagnostics.push(nameNotFoundDiagnostic(e)),!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(r.visible=i,this._visibleIndex<0&&i?(this._visibleIndex=n,this._emit(!1),!0):this._visibleIndex===n&&!i?(this._visibleIndex=this._firstVisibleIndex(),this._emit(!1),!0):!1)}get duplicateNames(){let e=new Set,t=[];for(let n of this._pages)e.has(n.name)?t.includes(n.name)||t.push(n.name):e.add(n.name);return t}get diagnostics(){return this._diagnostics}};function tabsRevealed(e){return e.autohide?e.nPages>1||e.nPinnedPages>=1||e.isTransferringPage:!0}function tabCloseVisible(e){return e.pinned?!1:e.hovering&&e.fullyVisible||e.selected||e.dragging}function tabTooltip(e){return e.tooltip===``?e.title:e.tooltip}function tabSearchMatches(e,t){if(t===``)return!0;let n=foldForSearch(t);return[e.title,e.tooltip,e.keyword].some(e=>e===``?!1:foldForSearch(e).includes(n))}function foldForSearch(e){return e.normalize(`NFKC`).toLocaleLowerCase()}function tabIconState(e,t){let n=e.indicatorIcon,r=e.icon;return!e.loading&&e.pinned&&r===null&&(r=t),{icon:r,spinner:e.loading,iconVisible:(r!==null||e.loading)&&(!e.pinned||n===null),indicatorVisible:n!==null}}function isDescendantOfPage(e,t,n){let r=t;for(;r!==null&&r!==n;)r=e.find(e=>e.id===r)?.parentId??null;return r===n}function successorAfterClose(e,t,n){if(t!==n)return n;let r=e.findIndex(e=>e.id===t);if(r<0)return n;let i=e[r].parentId;if(i!==null&&r>0){let t=e[r-1];if(isDescendantOfPage(e,t.id,i))return t.id;let n=e.find(e=>e.id===i);if(n&&t.pinned&&n.pinned)return n.id}return r<e.length-1?e[r+1].id:r>0?e[r-1].id:null}function assertionDiagnostic(e,t){return`${e}: assertion '${t}' failed`}var TabViewState=class{constructor(e={}){this._stack=new ViewStackState,this._selectionListeners=new Set,this._pagesListeners=new Set,this._diagnostics=[],this._selectedId=null,this._deferSelection=!1,this._deferredSelection=null,this._pagesSource=null,this._pagesView=null,this._handlers=e,this._stack.subscribe(e=>{let t=this._selectedId,n=e.page?.content?.id??null;this._selectedId=n;let r={selectedId:n,selectedIndex:e.index,previousId:t,interactive:e.interactive};this._deferSelection?this._deferredSelection=r:this._emitSelection(r)})}subscribe(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}subscribePages(e){return this._pagesListeners.add(e),()=>{this._pagesListeners.delete(e)}}_emitSelection(e){for(let t of[...this._selectionListeners])t(e)}_emitPages(e){for(let t of[...this._pagesListeners])t(e)}_flushDeferredSelection(){let e=this._deferredSelection;e&&(this._deferredSelection=null,this._emitSelection(e))}get pages(){let e=this._stack.pages;return(this._pagesSource!==e||this._pagesView===null)&&(this._pagesSource=e,this._pagesView=Object.freeze(e.map(e=>e.content))),this._pagesView}get nPages(){return this._stack.count}get nPinnedPages(){let e=this.pages.findIndex(e=>!e.pinned);return e<0?this.pages.length:e}getNthPage(e){return!Number.isInteger(e)||e<0||e>=this.nPages?null:this.pages[e]}getPagePosition(e){return this._stack.indexOfName(e)}getPage(e){return this._recordOf(e)}isClosing(e){return this._recordOf(e)?.closing??!1}get diagnostics(){return this._diagnostics}get selectedId(){return this._stack.visiblePage?.content?.id??null}get selectedIndex(){return this._stack.visibleIndex}get selectedPage(){return this._stack.visiblePage?.content??null}setSelectedPage(e,t=!0){if(e!==null&&typeof e!=`string`)return this.pages.includes(e)?this.setSelectedPage(e.id,t):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1);let n=typeof e==`string`?e:null;if(n===null)return this.nPages>0&&this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`ADW_IS_TAB_PAGE (selected_page)`)),!1;let r=this.getPagePosition(n);return r<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1):this._stack.setVisibleIndex(r,t)}selectNthPage(e){return this._stack.setVisibleIndex(e,!0)}selectPreviousPage(){let e=this.selectedIndex;return e<=0?!1:this._stack.setVisibleIndex(e-1,!0)}selectNextPage(){let e=this.selectedIndex;return e<0||e>=this.nPages-1?!1:this._stack.setVisibleIndex(e+1,!0)}selectFirstPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage(t?0:this.nPinnedPages);return n===e&&!t&&(n=this.getNthPage(0)),!n||n===e?!1:this.setSelectedPage(n.id)}selectLastPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage((t?this.nPinnedPages:this.nPages)-1);return n===e&&t&&(n=this.getNthPage(this.nPages-1)),!n||n===e?!1:this.setSelectedPage(n.id)}cycleNextPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectNextPage()?!0:this._stack.setVisibleIndex(0,!0)}cyclePreviousPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectPreviousPage()?!0:this._stack.setVisibleIndex(this.nPages-1,!0)}addPage(e,t=null){if(t===null)return this._insert(e,this.nPages,!1,null);let n=this.getPagePosition(t);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_add_page`,`page_belongs_to_this_view (self, parent)`)),-1;let r=this.pages[n].pinned?this.nPinnedPages-1:n;do if(r++,r>=this.nPages)break;while(isDescendantOfPage(this.pages,this.pages[r].id,t));return this._insert(e,r,!1,t)}insertPage(e,t){return!Number.isInteger(t)||t<this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position >= self->n_pinned_pages`)),-1):t>this.nPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position <= self->n_pages`)),-1):this._insert(e,t,!1,null)}prependPage(e){return this._insert(e,this.nPinnedPages,!1,null)}appendPage(e){return this._insert(e,this.nPages,!1,null)}insertPinnedPage(e,t){return!Number.isInteger(t)||t<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position >= 0`)),-1):t>this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position <= self->n_pinned_pages`)),-1):this._insert(e,t,!0,null)}prependPinnedPage(e){return this._insert(e,0,!0,null)}appendPinnedPage(e){return this._insert(e,this.nPinnedPages,!0,null)}_insert(e,t,n,r){if(this.getPagePosition(e.id)>=0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`page id '${e.id}' is unique`)),-1;let i={id:e.id,title:e.title??``,tooltip:e.tooltip??``,keyword:e.keyword??``,icon:e.icon??null,indicatorIcon:e.indicatorIcon??null,loading:e.loading??!1,needsAttention:e.needsAttention??!1,pinned:n,parentId:r,closing:!1,content:e.content};return this._deferSelection=!0,this._stack.insertPage({name:i.id,content:i},t),this._deferSelection=!1,this._emitPages({kind:`attached`,id:i.id,position:t,previousPosition:-1}),this._flushDeferredSelection(),t}setPagePinned(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_page_pinned`,`page_belongs_to_this_view (self, page)`)),-1;let r=this._recordAt(n),i=!!t;if(r.pinned===i)return-1;let a=i?this.nPinnedPages:this.nPinnedPages-1;return r.pinned=i,n!==a&&this._stack.movePage(n,a),this._emitPages({kind:`pinned`,id:e,position:a,previousPosition:n}),a}closePage(e){let t=this._recordOf(e);if(!t)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page`,`page_belongs_to_this_view (self, page)`)),!1;if(t.closing)return!1;t.closing=!0;let n=this._handlers.onClosePage?this._handlers.onClosePage(t):!t.pinned;return n!==`defer`&&this.closePageFinish(e,n),!0}closePageFinish(e,t){let n=this._recordOf(e);return n?n.closing?(n.closing=!1,t?this.detachPage(e)!==null:!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page->closing`)),!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page_belongs_to_this_view (self, page)`)),!1)}detachPage(e){let t=this.getPagePosition(e);if(t<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_detach_page`,`page_belongs_to_this_view (self, page)`)),null;let n=this._recordAt(t),r=successorAfterClose(this.pages,e,this.selectedId);r!==null&&r!==this.selectedId&&this.setSelectedPage(r,!1);let i=this.selectedId===e;this._stack.removePage(e);for(let t of this._records())t.parentId===e&&(t.parentId=n.parentId);return i&&(this._selectedId=null,this._emitSelection({selectedId:null,selectedIndex:-1,previousId:e,interactive:!1})),this._emitPages({kind:`detached`,id:e,position:t,previousPosition:t}),n}closeOtherPages(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_other_pages`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>=0;e--)e!==t&&this.closePage(n[e])}closePagesBefore(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_before`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=t-1;e>=0;e--)this.closePage(n[e])}closePagesAfter(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_after`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>t;e--)this.closePage(n[e])}reorderPage(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, page)`)),!1;let r=this.pages[n].pinned,i=r?0:this.nPinnedPages,a=r?this.nPinnedPages:this.nPages;return!Number.isInteger(t)||t<i||t>=a?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,r?`position < self->n_pinned_pages`:`position >= self->n_pinned_pages`)),!1):n===t?!1:(this._stack.movePage(n,t),this._emitPages({kind:`reordered`,id:e,position:t,previousPosition:n}),!0)}reorderBackward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t<=(this.pages[t].pinned?0:this.nPinnedPages)?!1:this.reorderPage(e,t-1)}reorderForward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t>=(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1?!1:this.reorderPage(e,t+1)}reorderFirst(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,this.pages[t].pinned?0:this.nPinnedPages)}reorderLast(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1)}_reorderMissing(e){return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, '${e}')`)),!1}setPageTitle(e,t){return this._update(e,e=>{let n=t??``;return e.title===n?!1:(e.title=n,!0)})}setPageTooltip(e,t){return this._update(e,e=>{let n=t??``;return e.tooltip===n?!1:(e.tooltip=n,!0)})}setPageKeyword(e,t){return this._update(e,e=>{let n=t??``;return e.keyword===n?!1:(e.keyword=n,!0)})}setPageIcon(e,t){return this._update(e,e=>e.icon===t?!1:(e.icon=t,!0))}setPageIndicatorIcon(e,t){return this._update(e,e=>e.indicatorIcon===t?!1:(e.indicatorIcon=t,!0))}setPageLoading(e,t){return this._update(e,e=>{let n=!!t;return e.loading===n?!1:(e.loading=n,!0)})}setPageNeedsAttention(e,t){return this._update(e,e=>{let n=!!t;return e.needsAttention===n?!1:(e.needsAttention=n,!0)})}_update(e,t){let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_page_set_property`,`ADW_IS_TAB_PAGE (self)`)),!1):t(this._recordAt(n))?(this._emitPages({kind:`updated`,id:e,position:n,previousPosition:n}),!0):!1}_records(){return this._stack.pages.map(e=>e.content)}_recordAt(e){return this._stack.pages[e].content}_recordOf(e){let t=this.getPagePosition(e);return t<0?null:this._recordAt(t)}};const me=new Set([`normal`,`section`,`subtotal`,`total`]);function dataGridTracks(e){let t=e.some(e=>e.width!==void 0||e.flex!==void 0);return e.map((e,n)=>e.width===void 0?e.flex===void 0?!t&&n===0?{kind:`slack`}:{kind:`auto`}:{kind:`flex`,weight:e.flex}:{kind:`fixed`,css:e.width})}function dataGridTrackTemplate(e){return e.map(e=>{switch(e.kind){case`fixed`:return e.css;case`flex`:return`${e.weight}fr`;case`slack`:return`minmax(0px, 1fr)`;case`auto`:return`auto`}}).join(` `)}function dataGridColumnAlign(e){return e.align??(e.numeric?`end`:`start`)}function dataGridColumnClasses(e){let t=[`adw-data-grid-cell`,`align-${dataGridColumnAlign(e)}`];return e.numeric&&t.push(`numeric`),e.monospace&&t.push(`mono`),t}function dataGridCellText(e){return e==null?``:String(e)}function normalizeDataGridVariant(e){return typeof e==`string`&&me.has(e)?e:`normal`}function normalizeDataGridColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>({key:String(e.key),label:e.label===void 0?void 0:String(e.label),align:e.align,width:e.width===void 0?void 0:String(e.width),flex:typeof e.flex==`number`?e.flex:void 0,monospace:e.monospace===!0,numeric:e.numeric===!0})):[]}function dataGridRowInteractive(e,t,n){return e===`normal`&&t!==!1&&(t===!0||n)}var AdwAlertResponses=class{constructor(e=``,t=``){this._responses=[],this._defaultResponse=null,this._closeResponse=`close`,this._heading=e??``,this._body=t??``}get heading(){return this._heading}set heading(e){this._heading=e??``}get body(){return this._body}set body(e){this._body=e??``}addResponse(e,t,n={}){let r=this._responses.find(t=>t.id===e);if(r){r.label=t,n.appearance!==void 0&&(r.appearance=n.appearance),n.enabled!==void 0&&(r.enabled=n.enabled);return}this._responses.push({id:e,label:t,appearance:n.appearance??`default`,enabled:n.enabled??!0})}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}hasResponse(e){return this._responses.some(t=>t.id===e)}setResponseAppearance(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.appearance=t)}getResponseAppearance(e){return this._responses.find(t=>t.id===e)?.appearance??`default`}setResponseEnabled(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.enabled=t)}getResponseEnabled(e){return this._responses.find(t=>t.id===e)?.enabled??!0}get responses(){return this._responses}get defaultResponse(){return this._defaultResponse}set defaultResponse(e){this._defaultResponse=e}get closeResponse(){return this._closeResponse}set closeResponse(e){this._closeResponse=e||`close`}get usesActionSheet(){return this._responses.length>3}orderResponses(){let e=this._responses.find(e=>e.id===this._defaultResponse)??this._responses[0],t=this._responses.filter(t=>t!==e);return{ok:e,cancel:t[t.length-1],neutral:t.length>=2?t[0]:void 0}}resolveById(e){return e!=null&&this.hasResponse(e)?e:this._closeResponse}resolveLabel(e){return e==null?this._closeResponse:this.resolveById(this._responses.find(t=>t.label===e)?.id)}};function resolveBottomSheetClose(e,t){let n=!!t.open,r=!!t.canClose;switch(e){case`drag-handle`:return`ignored`;case`swipe`:return n&&r?`close`:`ignored`;case`dimming`:return n?r?`close`:`close-attempt`:`ignored`;case`close-button`:return r?n?`close`:`delegate`:`close-attempt`;case`escape`:return r&&n?`close`:`close-attempt`}}function resolveBottomSheetOpen(e,t){if(e===`drag-handle`)return`ignored`;let n=resolveBottomSheetChrome(t);return n.layer!==`bottom-bar`||!n.surfaceVisible||n.bottomBarInert?`ignored`:`open`}function resolveBottomSheetChrome(e){let t=!!e.open,n=!!e.hasBottomBar,r=e.revealBottomBar??!0;return{layer:t||!n?`sheet`:`bottom-bar`,surfaceVisible:t||n&&r,bottomBarInert:!e.canOpen,dimmed:t&&(e.modal??!0)}}var BottomSheetPresentation=class{constructor(e={}){this._open=!1,this._canClose=!0,this._canOpen=!0,this._hasBottomBar=!1,this._revealBottomBar=!0,this._modal=!0,this._hasBeenOpen=!1,this._listeners=new Set,this._onClosing=e.onClosing,this._onClosed=e.onClosed}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._open)}get open(){return this._open}get canClose(){return this._canClose}get hasBeenOpen(){return this._hasBeenOpen}get canOpen(){return this._canOpen}get hasBottomBar(){return this._hasBottomBar}get revealBottomBar(){return this._revealBottomBar}get modal(){return this._modal}get chrome(){return resolveBottomSheetChrome(this)}setCanClose(e){let t=!!e;return t===this._canClose?!1:(this._canClose=t,!0)}setCanOpen(e){let t=!!e;return t===this._canOpen?!1:(this._canOpen=t,!0)}setHasBottomBar(e){let t=!!e;return t===this._hasBottomBar?!1:(this._hasBottomBar=t,!0)}setModal(e){let t=!!e;return t===this._modal?!1:(this._modal=t,!0)}setRevealBottomBar(e){let t=!!e;return t===this._revealBottomBar?!1:(this._revealBottomBar=t,!0)}setOpen(e){let t=!!e;return this._open===t?(!this._hasBeenOpen&&!t&&(this._onClosing?.(),this._onClosed?.()),!1):(this._open=t,t&&(this._hasBeenOpen=!0),!t&&(this._onClosing?.(),this._open!==t)?!1:(this._emit(),!0))}requestClose(e){let t=resolveBottomSheetClose(e,this);return t===`close`&&this.setOpen(!1),t}requestOpen(e){let t=resolveBottomSheetOpen(e,this);return t===`open`&&this.setOpen(!0),t}finishClose(){return this._open?!1:(this._onClosed?.(),!0)}};const S=65535,he=`Apply`;function entryTextLength(e){return[...e??``].length}function clampEntryText(e,t){let n=e??``;if(!Number.isFinite(t)||t<=0)return n;let r=``,i=0;for(let e of n){if(i>=t)break;r+=e,i++}return r}var EntryRowState=class{constructor(){this._text=``,this._maxLength=0,this._editing=!1,this._editable=!0,this._showApplyButton=!1,this._showIndicator=!1,this._textChanged=!1,this._activatesDefault=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_update(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){let e=entryTextLength(this._text),t=e===0&&!(this._editing&&this._editable)&&!this._textChanged;return{text:this._text,textLength:e,empty:t,editing:this._editing,editable:this._editable,textChanged:this._textChanged,editIconVisible:!this._textChanged&&(!this._editing||!this._editable),editIconSensitive:this._editable,indicatorVisible:this._editing&&this._showIndicator,applyButtonVisible:this._textChanged,emptyTarget:+!t}}get text(){return this._text}setText(e){let t=clampEntryText(e??``,this._maxLength);return t===this._text?!1:(this._text=t,this._latchAndUpdate(),!0)}_latchAndUpdate(){this._showApplyButton&&this._editing&&(this._textChanged=!0),this._update()}get textLength(){return entryTextLength(this._text)}get maxLength(){return this._maxLength}setMaxLength(e){let t=Number.isFinite(e)?Math.min(S,Math.max(0,Math.trunc(e))):0;if(t===this._maxLength)return!1;this._maxLength=t;let n=clampEntryText(this._text,t);return n!==this._text&&(this._text=n,this._latchAndUpdate()),!0}get editing(){return this._editing}setEditing(e){let t=!!e;return t===this._editing?!1:(this._editing=t,this._update(),!0)}get editable(){return this._editable}setEditable(e){let t=!!e;return t===this._editable?!1:(this._editable=t,this._update(),!0)}get showApplyButton(){return this._showApplyButton}setShowApplyButton(e){let t=!!e;return t===this._showApplyButton?!1:(this._showApplyButton=t,!t&&this._textChanged&&(this._textChanged=!1,this._update()),!0)}setShowIndicator(e){this._showIndicator=!!e,this._update()}get activatesDefault(){return this._activatesDefault}setActivatesDefault(e){let t=!!e;return t===this._activatesDefault?!1:(this._activatesDefault=t,!0)}get textChanged(){return this._textChanged}apply(){this._textChanged=!1,this._update()}activate(){return this._textChanged?(this.apply(),{signal:`apply`}):{signal:`entry-activated`,activateDefault:this._activatesDefault}}},PasswordEntryRowState=class{constructor(e){this._revealed=!1,this._capsLockOn=!1,this._listeners=new Set,this._entry=e}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){return{revealed:this._revealed,capsLockOn:this._capsLockOn,peekIconName:this._revealed?`view-conceal-symbolic`:`view-reveal-symbolic`,peekLabel:this._revealed?`Hide Password`:`Show Password`,indicatorIconName:`caps-lock-symbolic`,indicatorTooltip:`Caps Lock is on`}}get revealed(){return this._revealed}setRevealed(e){let t=!!e;return t===this._revealed?!1:(this._revealed=t,this._pushIndicator(),this._emit(),!0)}togglePeek(){return this.setRevealed(!this._revealed)}get capsLockOn(){return this._capsLockOn}setCapsLockOn(e){let t=!!e;return t===this._capsLockOn?!1:(this._capsLockOn=t,this._pushIndicator(),this._emit(),!0)}_pushIndicator(){this._entry.setShowIndicator(!this._revealed&&this._capsLockOn)}};function gridColumns(e,t=1){if(e.length===0)return 0;let n=e[0],r=1;for(;r<e.length&&Math.abs(e[r]-n)<=t;)r++;return r}function gridNavigate(e,t,n,r){if(n<=0||t<0||t>=n)return null;let i=Math.max(1,Math.floor(r)),a;switch(e){case`ArrowLeft`:a=t-1;break;case`ArrowRight`:a=t+1;break;case`ArrowUp`:a=t-i;break;case`ArrowDown`:a=t+i;break;case`Home`:a=0;break;case`End`:a=n-1;break;default:return null}return a<0||a>=n||a===t?null:a}var AdwToast=class{constructor(e=``,t={}){this.title=e,this.timeout=t.timeout??5e3,this.buttonLabel=t.buttonLabel??``}get hasButton(){return this.buttonLabel.length>0}},AdwToastQueue=class{constructor(e){this._pending=[],this._current=null,this._timer=null,this._scheduler=e.scheduler,this._handlers={onShow:e.onShow,onHide:e.onHide}}get current(){return this._current}get showing(){return this._current!==null}get pending(){return this._pending.length}add(e){this._current===null?this._show(e):this._pending.push(e)}dismiss(){if(this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e);let t=this._pending.shift();t&&this._show(t)}clear(){if(this._pending.length=0,this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e)}_show(e){this._current=e,this._handlers.onShow(e),e.timeout>0&&(this._timer=this._scheduler.schedule(()=>{this._current===e&&this.dismiss()},e.timeout))}_clearTimer(){this._timer!==null&&(this._scheduler.cancel(this._timer),this._timer=null)}};function normalizeComboOptions(e){return Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return{value:e,label:e};let t=e?.value===void 0?String(e?.label??``):String(e.value);return{value:t,label:e?.label===void 0?t:String(e.label)}}):[]}function parseListModel(e){if(!e)return[];try{return normalizeComboOptions(JSON.parse(e))}catch{return[]}}function clampListSelection(e,t){return Number.isFinite(e)&&e>=0&&e<t?e:t===0?-1:0}function sameItem(e,t){return e!==void 0&&t!==void 0&&e.value===t.value&&e.label===t.label}function listItemsChanged(e,t){let n=e??[],r=t??[],i=Math.min(n.length,r.length),a=0;for(;a<i&&sameItem(n[a],r[a]);)a++;let o=0;for(;o<i-a&&sameItem(n[n.length-1-o],r[r.length-1-o]);)o++;let s=n.length-a-o,c=r.length-a-o;return s===0&&c===0?null:{position:a,removed:s,added:c}}const ge=new Set([`none`,`single`,`multiple`]);function normalizeListSelectionMode(e){return typeof e==`string`&&ge.has(e)?e:`single`}function normalizeSelection(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function listViewSelect(e,t,n,r,i,a={}){let o=normalizeSelection(e,r);if(i===`none`)return{selection:[],anchor:t};if(!Number.isInteger(n)||n<0||n>=r)return{selection:o,anchor:t};let s=new Set(o);if(i===`multiple`&&a.extend&&t>=0&&t<r){let e=Math.min(t,n),i=Math.max(t,n),o=[];for(let t=e;t<=i;t++)o.push(t);if(a.modify)if(s.has(t))for(let e of o)s.add(e);else for(let e of o)s.delete(e);else{s.clear();for(let e of o)s.add(e)}return{selection:normalizeSelection(s,r),anchor:n}}return a.modify?s.has(n)?i===`multiple`&&s.delete(n):(i===`multiple`||s.clear(),s.add(n)):(s.clear(),s.add(n)),{selection:normalizeSelection(s,r),anchor:n}}function listViewSelectAll(e,t){return t===`multiple`?Array.from({length:e},(e,t)=>t):[]}var ListViewState=class{constructor(){this._model=[],this._selection=[],this._anchor=-1,this._mode=`single`,this._itemListeners=new Set,this._selectionListeners=new Set}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.delete(e)}}subscribeSelection(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}get model(){return this._model.map(e=>({value:e.value,label:e.label}))}get count(){return this._model.length}get selection(){return[...this._selection]}get selectionMode(){return this._mode}setModel(e){let t=Array.isArray(e)?e:[],n=listItemsChanged(this._model,t);this._model=t.map(e=>({value:e.value,label:e.label}));let r=normalizeSelection(this._selection,this._model.length),i=r.length!==this._selection.length;if(this._selection=r,this._anchor>=this._model.length&&(this._anchor=-1),n)for(let e of[...this._itemListeners])e(n);i&&this._emitSelection(!1)}setSelectionMode(e){e!==this._mode&&(this._mode=e,e===`none`&&this._selection.length>0?(this._selection=[],this._emitSelection(!1)):e===`single`&&this._selection.length>1&&(this._selection=this._selection.includes(this._anchor)?[this._anchor]:[this._selection[0]],this._emitSelection(!1)))}isSelected(e){return this._selection.includes(e)}selectItem(e,t={},n=!0){let r=listViewSelect(this._selection,this._anchor,e,this._model.length,this._mode,t);return this._anchor=r.anchor,this._applySelection(r.selection,n)}selectAll(e=!1){return this._applySelection(listViewSelectAll(this._model.length,this._mode),e)}unselectAll(e=!1){return this._applySelection([],e)}setSelection(e,t=!1){let n=normalizeSelection(e,this._model.length),r=this._mode===`none`?[]:this._mode===`single`?n.slice(0,1):n;return r.length>0&&(this._anchor=r[r.length-1]),this._applySelection(r,t)}itemContext(e){let t=this._model[e];return t===void 0?null:{item:{value:t.value,label:t.label},position:e,selected:this.isSelected(e)}}_applySelection(e,t){return e.length===this._selection.length&&e.every((e,t)=>e===this._selection[t])?!1:(this._selection=e,this._emitSelection(t),!0)}_emitSelection(e){let t={selection:[...this._selection],interactive:e};for(let e of[...this._selectionListeners])e(t)}};function gridViewColumns(e,t,n,r=1,i=7){let a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(i)),s=Math.floor((e+n)/Math.max(1,t+n));return Math.min(Math.max(s,a),Math.max(a,o))}function listItemField(e,t){return t===`value`?e.value:e.label}function normalizeColumnViewColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>{let t=e.key===`value`?`value`:`label`;return{key:t,title:e.title===void 0?t:String(e.title),id:e.id===void 0?t:String(e.id),expand:e.expand===!0,fixedWidth:typeof e.fixedWidth==`number`?e.fixedWidth:-1,visible:e.visible!==!1,sortable:e.sortable===!0}}):[]}function parseColumnViewColumns(e){if(!e)return[];try{return normalizeColumnViewColumns(JSON.parse(e))}catch{return[]}}function columnViewSort(e,t){if(t.sortable!==!0)return e;let n=t.id??t.key;return e!==null&&e.column===n?{column:n,descending:!e.descending}:{column:n,descending:!1}}function columnViewTracks(e){return e.filter(e=>e.visible!==!1).map(e=>{let t=e.fixedWidth??-1;return t>0?{kind:`fixed`,css:`${t}px`}:e.expand===!0?{kind:`flex`,weight:1}:{kind:`auto`}})}const _e={indents:0,expander:`none`,level:1};function treeExpanderLayout(e,t={}){if(!e)return _e;let n=t.indentForDepth!==!1,r=t.indentForIcon!==!1,i=t.hideExpander===!0,a=n?Math.max(0,Math.floor(e.depth)):0,o=e.expandable&&!i;return!o&&r&&a++,{indents:a,expander:o?e.expanded?`expanded`:`collapsed`:`none`,level:a+1}}function treeExpanderAction(e,t={}){if(e===`+`||e===`*`)return`expand`;if(e===`-`||e===`/`)return`collapse`;if(e===` `&&t.ctrlKey===!0)return`toggle`;if(t.shiftKey!==!0)return`none`;let n=t.rtl===!0;return e===`ArrowRight`?n?`collapse`:`expand`:e===`ArrowLeft`?n?`expand`:`collapse`:`none`}function treeExpanderExpanded(e,t){switch(t){case`expand`:return!0;case`collapse`:return!1;case`toggle`:return!e;case`none`:return e}}var ExpanderState=class{constructor(){this._expanded=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._expanded)}get expanded(){return this._expanded}setExpanded(e){let t=!!e;return t===this._expanded?!1:(this._expanded=t,this._emit(),!0)}toggle(){return this.setExpanded(!this._expanded)}expand(){return this.setExpanded(!0)}collapse(){return this.setExpanded(!1)}},ComboState=class{constructor(){this._options=[],this._selected=0,this._listeners=new Set,this._itemListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.delete(e)}}_emit(e){let t={selected:this._selected,value:this.selectedValue,label:this.selectedLabel,interactive:e};for(let e of[...this._listeners])e(t)}_setIndex(e,t){return e===this._selected?!1:(this._selected=e,this._emit(t),!0)}get model(){return this._options.map(e=>({value:e.value,label:e.label}))}setModel(e){let t=this._options,n=Array.isArray(e)?e:[],r=listItemsChanged(t,n);if(this._options=n.map(e=>({value:e.value,label:e.label})),this._selected=clampListSelection(this._selected,n.length),r)for(let e of[...this._itemListeners])e(r);this._emit(!1)}get selectedIndex(){return this._selected}get presentsChooser(){return this._options.length>1}setSelectedIndex(e){return this._setIndex(Number.isFinite(e)?e:0,!1)}get selectedValue(){return this._options[this._selected]?.value??``}get selectedLabel(){return this._options[this._selected]?.label??``}setSelectedValue(e){let t=this._options.findIndex(t=>t.value===e);return t>=0?this.setSelectedIndex(t):!1}hasIndex(e){return Number.isFinite(e)&&e>=0&&e<this._options.length}select(e){return!this.hasIndex(e)||e===this._selected?!1:this._setIndex(e,!0)}get count(){return this._options.length}},ToggleGroupState=class{constructor(){this._labels=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e={selected:this._selected,value:this.selectedValue};for(let t of[...this._listeners])t(e)}get labels(){return this._labels}setLabels(e){this._labels=Array.isArray(e)?e:[],this._selected>=this._labels.length&&(this._selected=0)}get selected(){return this._selected}setSelected(e){let t=Number.isFinite(e)?e:0;return t===this._selected||t<0||t>=this._labels.length?!1:(this._selected=t,this._emit(),!0)}get selectedValue(){return this._labels[this._selected]??``}get count(){return this._labels.length}};function keptToggles(e){let t=new Set,n=[];for(let r of e){let e=r.name??null;e!==null&&t.has(e)||(e!==null&&t.add(e),n.push(r))}return n}function toggleIndexOfName(e,t){return e.indexOf(t)}const ve=new Map([[`µ`,`μ`],[`ß`,`ss`],[`ʼn`,`ʼn`],[`ſ`,`s`],[`ǰ`,`ǰ`],[`ͅ`,`ι`],[`ΐ`,`ΐ`],[`ΰ`,`ΰ`],[`ς`,`σ`],[`ϐ`,`β`],[`ϑ`,`θ`],[`ϕ`,`φ`],[`ϖ`,`π`],[`ϰ`,`κ`],[`ϱ`,`ρ`],[`ϵ`,`ε`],[`և`,`եւ`],[`ᲀ`,`в`],[`ᲁ`,`д`],[`ᲂ`,`о`],[`ᲃ`,`с`],[`ᲄ`,`т`],[`ᲅ`,`т`],[`ᲆ`,`ъ`],[`ᲇ`,`ѣ`],[`ᲈ`,`ꙋ`],[`ẖ`,`ẖ`],[`ẗ`,`ẗ`],[`ẘ`,`ẘ`],[`ẙ`,`ẙ`],[`ẚ`,`aʾ`],[`ẛ`,`ṡ`],[`ὐ`,`ὐ`],[`ὒ`,`ὒ`],[`ὔ`,`ὔ`],[`ὖ`,`ὖ`],[`ᾀ`,`ἀι`],[`ᾁ`,`ἁι`],[`ᾂ`,`ἂι`],[`ᾃ`,`ἃι`],[`ᾄ`,`ἄι`],[`ᾅ`,`ἅι`],[`ᾆ`,`ἆι`],[`ᾇ`,`ἇι`],[`ᾐ`,`ἠι`],[`ᾑ`,`ἡι`],[`ᾒ`,`ἢι`],[`ᾓ`,`ἣι`],[`ᾔ`,`ἤι`],[`ᾕ`,`ἥι`],[`ᾖ`,`ἦι`],[`ᾗ`,`ἧι`],[`ᾠ`,`ὠι`],[`ᾡ`,`ὡι`],[`ᾢ`,`ὢι`],[`ᾣ`,`ὣι`],[`ᾤ`,`ὤι`],[`ᾥ`,`ὥι`],[`ᾦ`,`ὦι`],[`ᾧ`,`ὧι`],[`ᾲ`,`ὰι`],[`ᾳ`,`αι`],[`ᾴ`,`άι`],[`ᾶ`,`ᾶ`],[`ᾷ`,`ᾶι`],[`ι`,`ι`],[`ῂ`,`ὴι`],[`ῃ`,`ηι`],[`ῄ`,`ήι`],[`ῆ`,`ῆ`],[`ῇ`,`ῆι`],[`ῒ`,`ῒ`],[`ΐ`,`ΐ`],[`ῖ`,`ῖ`],[`ῗ`,`ῗ`],[`ῢ`,`ῢ`],[`ΰ`,`ΰ`],[`ῤ`,`ῤ`],[`ῦ`,`ῦ`],[`ῧ`,`ῧ`],[`ῲ`,`ὼι`],[`ῳ`,`ωι`],[`ῴ`,`ώι`],[`ῶ`,`ῶ`],[`ῷ`,`ῶι`],[`ff`,`ff`],[`fi`,`fi`],[`fl`,`fl`],[`ffi`,`ffi`],[`ffl`,`ffl`],[`ſt`,`st`],[`st`,`st`],[`ﬓ`,`մն`],[`ﬔ`,`մե`],[`ﬕ`,`մի`],[`ﬖ`,`վն`],[`ﬗ`,`մխ`]]);function foldCherokee(e){if(e>=43888&&e<=43967)return String.fromCodePoint(e-43888+5024);if(e>=5112&&e<=5117)return String.fromCodePoint(e-8)}const defaultCaseFolder=e=>{let t=``;for(let n of e.toLowerCase()){let e=n.codePointAt(0);if(e<181){t+=n;continue}t+=ve.get(n)??foldCherokee(e)??n}return t},ye=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),be=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),xe=/[A-Za-z_:]/,Se=/[A-Za-z0-9._:-]/,C=/[ \t\r\n]/;function escapeMarkup(e){let t=``;for(let n of e)switch(n){case`&`:t+=`&amp;`;break;case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`'`:t+=`&#39;`;break;case`"`:t+=`&#34;`;break;default:{let e=n.codePointAt(0);t+=e>=1&&e<=8||e>=11&&e<=12||e>=14&&e<=31||e===127?`&#x${e.toString(16)};`:n}}return t}function passthroughEnd(e,t){return e.startsWith(`<!--`,t)?{terminator:`-->`}:e.startsWith(`<![CDATA[`,t)?{terminator:`]]>`}:e.startsWith(`<!`,t)||e.startsWith(`<?`,t)?{terminator:`>`}:null}function readEntity(e,t){let n=e.indexOf(`;`,t);if(n<0)return null;let r=e.slice(t+1,n);if(r.length===0)return null;if(r.startsWith(`#`)){let e=r[1]===`x`||r[1]===`X`,t=e?r.slice(2):r.slice(1);if(t.length===0||!(e?/^[0-9a-fA-F]+$/:/^[0-9]+$/).test(t))return null;let i=Number.parseInt(t,e?16:10);return i<=0||i>1114111||i>=55296&&i<=57343?null:{value:String.fromCodePoint(i),next:n+1}}let i=be.get(r);return i===void 0?null:{value:i,next:n+1}}function readTag(e,t){let n=t+1,r=e[n]===`/`;if(r&&(n+=1),n>=e.length||!xe.test(e[n]))return null;let i=n;for(;n<e.length&&Se.test(e[n]);)n+=1;let a=e.slice(i,n),o=!1,s=!1;for(;n<e.length;){for(;n<e.length&&C.test(e[n]);)n+=1;let t=e[n];if(t===void 0)return null;if(t===`>`)return{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+1};if(t===`/`)return r||e[n+1]!==`>`?null:(s=!0,{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+2});if(r||!xe.test(t))return null;for(;n<e.length&&Se.test(e[n]);)n+=1;for(;n<e.length&&C.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&C.test(e[n]);)n+=1;let i=e[n];if(i!==`"`&&i!==`'`)return null;let c=e.indexOf(i,n+1);if(c<0)return null;n=c+1,o=!0}return null}function stripMarkup(e){let t=``,n=[],r=0;for(;r<e.length;){let i=e[r];if(i===`&`){let n=readEntity(e,r);if(!n)return null;t+=n.value,r=n.next;continue}if(i!==`<`){t+=i,r+=1;continue}let a=passthroughEnd(e,r);if(a){let t=e.indexOf(a.terminator,r+2);if(t<0)return null;r=t+a.terminator.length;continue}let o=readTag(e,r);if(!o||!ye.has(o.name)||o.hasAttributes&&o.name!==`span`)return null;if(o.closing){if(n.pop()!==o.name)return null}else o.selfClosing||n.push(o.name);r=o.next}return n.length===0?t:null}function makeComparable(e,t={},n=defaultCaseFolder){let r=n(e??``);return(t.useMarkup??!0)&&(r=stripMarkup(r)??r),(t.allowUnderline??!0)&&(t.useUnderline??!1)&&(r=stripMnemonic(r)),r}function displayedLabelText(e,t){let n=e??``;return t?stripMarkup(n)??n:n}function derivePreferencesGroupHeader(e){let t=e.useMarkup??!0,n=stringIsNotEmpty(displayedLabelText(e.title,t)),r=stringIsNotEmpty(displayedLabelText(e.description,t)),i=e.hasHeaderSuffix??!1;return{titleVisible:n,descriptionVisible:r,headerVisible:n||r||i,singleLine:!r&&(i||n),listboxVisible:(e.rowCount??0)>0}}function countVisiblePages(e){let t=0;for(let n of e)n.visible!==!1&&(t+=1);return t}function collectSearchRows(e){let t=[];for(let n of e)if(n.visible!==!1){for(let e of n.groups)if(e.visible!==!1)for(let r of e.rows)r.visible!==!1&&r.title!==``&&t.push({page:n,group:e,row:r})}return t}function rowMatchesQuery(e,t,n=defaultCaseFolder){let r=n(t??``),i={useMarkup:e.useMarkup,useUnderline:e.useUnderline};return makeComparable(e.title,{...i,allowUnderline:!0},n).includes(r)?!0:e.isActionRow?makeComparable(e.subtitle,{...i,allowUnderline:!1},n).includes(r):!1}function createSearchRowSubtitle(e){let t=e.groupTitle??null;t===``&&(t=null);let n=null;return e.pageTitle!==void 0&&e.pageTitle!==null&&(n=e.pageUseUnderline?stripMnemonic(e.pageTitle):e.pageTitle,(e.rowUseMarkup??!0)&&(n=escapeMarkup(n)),n===``&&(n=null)),t===null?n:e.nVisiblePages<=1?t:`${n??e.untitledPageLabel??`Untitled page`} → ${t}`}function searchPreferences(e,t,n={}){let r=n.fold??defaultCaseFolder,i=countVisiblePages(e),a=[];for(let{page:o,group:s,row:c}of collectSearchRows(e))rowMatchesQuery(c,t,r)&&a.push({title:c.title,subtitle:createSearchRowSubtitle({groupTitle:s.title,pageTitle:o.title??``,pageUseUnderline:o.useUnderline,rowUseMarkup:c.useMarkup,nVisiblePages:i,untitledPageLabel:n.untitledPageLabel}),useMarkup:c.useMarkup??!0,useUnderline:c.useUnderline??!1,page:o,group:s,row:c});return a}const Ce=[`left`,`right`,`center`,`fill`];function labelDisplayText(e,t,n){let r=e??``,i=t?stripMarkup(r)??r:r;return n?stripMnemonic(i):i}function normalizeLabelXalign$1(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}__name(normalizeLabelXalign$1,`normalizeLabelXalign`);function normalizeLabelJustify(e){return Ce.includes(e)?e:`left`}function normalizeLabelYalign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}function labelYalignAlignItems(e){return e<.25?`flex-start`:e>.75?`flex-end`:`center`}const we=[`none`,`start`,`middle`,`end`];function normalizeLabelEllipsize(e){return we.includes(e)?e:`none`}function labelEllipsizeOverflowValue(e){return e===`none`?`clip`:`ellipsis`}const Te=[`word`,`char`,`word-char`];function normalizeLabelWrapMode(e){return Te.includes(e)?e:`word`}function normalizeLabelCharCount(e,t){let n=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(n)?Math.max(t,Math.trunc(n)):t}function normalizeLabelWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelMaxWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelLines(e){return normalizeLabelCharCount(e,-1)}function labelEffectiveLines(e,t){return t===`none`?null:e>0?e:1}function labelWidthCharsExtent(e,t){return{minCh:e>=0?e:null,maxCh:t>=0?Math.max(e,t):null}}const Ee=`Back`;function describeNavigationDiagnostic(e){switch(e.code){case`duplicate-tag`:return`Duplicate page tag in AdwNavigationView: ${e.tag}`;case`already-in-stack`:return e.tag===void 0?`Page '${e.title}' is already in navigation stack`:`Page with the tag '${e.tag}' is already in navigation stack`;case`tag-not-found`:return`No page with the tag '${e.tag}' found in AdwNavigationView`;case`not-in-stack`:return`Page '${e.title}' is not in the navigation stack`}}var NavigationViewState=class{constructor(e={}){this._registry=new Map,this._tags=new Map,this._stack=[],this._listeners=new Set,this._pendingRemoval=null,this._animateTransitions=e.animateTransitions??!0,this._popOnEscape=e.popOnEscape??!0,this._onDiagnostic=e.onDiagnostic??null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get stack(){return[...this._stack]}get depth(){return this._stack.length}get pages(){return[...this._registry.keys()]}get visiblePage(){return this._stack.length===0?null:this._stack[this._stack.length-1]}get visiblePageTag(){let e=this.visiblePage;return e===null?null:this.tagOf(e)}get animateTransitions(){return this._animateTransitions}get popOnEscape(){return this._popOnEscape}setAnimateTransitions(e){let t=!!e;return t===this._animateTransitions?!1:(this._animateTransitions=t,!0)}setPopOnEscape(e){let t=!!e;return t===this._popOnEscape?!1:(this._popOnEscape=t,!0)}isRegistered(e){return this._registry.has(e)}isInStack(e){return this._stack.includes(e)}isRemoveOnPop(e){return this._registry.get(e)?.removeOnPop===!0}tagOf(e){return this._registry.get(e)?.tag??null}titleOf(e){return this._registry.get(e)?.title??``}canPopOf(e){return this._registry.get(e)?.canPop??!0}findPage(e){return this._tags.get(e)??null}getPreviousPage(e){let t=this._stack.indexOf(e);return t<=0?null:this._stack[t-1]}add(e,t={}){let n=this._registry.get(e);return n===void 0?this._addPage(e,t,!0):n.removeOnPop&&this._stack.includes(e)?(n.removeOnPop=!1,!0):(n.tag!==null&&this._diagnose({code:`duplicate-tag`,tag:n.tag}),!1)}remove(e){let t=this._registry.get(e);return t===void 0?!1:(this._pendingRemoval===e&&(this._pendingRemoval=null),this._stack.includes(e)?(t.removeOnPop=!0,!0):(this._unregister(e),!0))}setTag(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=t??null;return r===n.tag?!1:r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(n.tag!==null&&this._tags.delete(n.tag),n.tag=r,r!==null&&this._tags.set(r,e),!0)}setTitle(e,t){if(typeof t!=`string`)return!1;let n=this._registry.get(e);return n===void 0||n.title===t?!1:(n.title=t,!0)}setCanPop(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=!!t;return r===n.canPop?!1:(n.canPop=r,!0)}push(e,t={}){return this._maybeAddPage(e,t)?this._pushToStack(e,`push`,this._animateTransitions,!1):!1}pushByTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this._pushToStack(t,`push`,this._animateTransitions,!0)}pop(){let e=this.visiblePage;if(e===null)return!1;let t=this.getPreviousPage(e);return t===null?!1:(this._popFromStack(t,this._animateTransitions),!0)}popToPage(e){return e===this.visiblePage?!1:this._stack.includes(e)?(this._popFromStack(e,this._animateTransitions),!0):(this._diagnose({code:`not-in-stack`,title:this.titleOf(e)}),!1)}popToTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this.popToPage(t)}replace(e,t){let n=this.visiblePage,r=n,i=n!==null,a=!1,o=[],s=new Set;for(let t of e)t!=null&&s.add(t);for(let e=this._stack.length-1;e>=0;e--){let t=this._stack[e],n=this._registry.get(t);n===void 0||!n.removeOnPop||s.has(t)||(t===r&&(a=n.tag!==null,r=null),this._unregister(t)&&o.push(t))}this._stack.length=0;let c=new Set;for(let n of e)if(n!=null){if(c.has(n)){this._diagnose({code:`already-in-stack`,title:this.titleOf(n)});continue}this._maybeAddPage(n,t?.(n)??{})&&(c.add(n),this._stack.push(n))}let l=this.visiblePage,u;u=l===null?r===null?{animate:!1,tagNotify:i&&a,removeAfterTransition:null}:this._beginSwitch(r,null,!0,!1,o):r===l?{animate:!1,tagNotify:!1,removeAfterTransition:null}:this._beginSwitch(r,l,!0,!1,o),this._emitChange(`replace`,n,!0,[],o,u)}replaceWithTags(e){let t=e.map(e=>{let t=this.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this.replace(t)}finishTransition(){let e=this._resolvePendingRemoval();return e===null?[]:[e]}canGoBack(){let e=this.visiblePage;return e===null||!this.canPopOf(e)?!1:this.getPreviousPage(e)!==null}backButtonTooltip(e=Ee){if(!this.canGoBack())return null;let t=this.getPreviousPage(this.visiblePage);if(t===null)return null;let n=this.titleOf(t);return n.length>0?n:e}popFromShortcut(){let e=this.visiblePage;return e===null?`propagate`:this.canPopOf(e)?this.pop()?`stop`:`propagate`:`stop`}popFromEscape(){return this._popOnEscape?this.popFromShortcut():`propagate`}_diagnose(e){this._onDiagnostic?.(e)}_emit(e){for(let t of[...this._listeners])t(e)}_emitChange(e,t,n,r,i,a){let o=this.visiblePage;this._emit({stack:[...this._stack],visiblePage:o,visiblePageTag:o===null?null:this.tagOf(o),previousVisiblePage:t,reason:e,popped:[...r],removed:[...i],removeAfterTransition:a.removeAfterTransition,animate:a.animate,pop:n,tagNotify:a.tagNotify})}_addPage(e,t,n){let r=t.tag??null;return r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(this._registry.set(e,{tag:r,title:t.title??``,canPop:t.canPop===void 0?!0:!!t.canPop,removeOnPop:!1}),r!==null&&this._tags.set(r,e),n&&this._stack.length===0&&this._pushToStack(e,`add`,!1,!1),!0)}_maybeAddPage(e,t){if(this._registry.has(e))return!0;let n=t.tag??null;if(n!==null&&this._tags.has(n))return this._diagnose({code:`duplicate-tag`,tag:n}),!1;if(!this._addPage(e,t,!1))return!1;let r=this._registry.get(e);return r!==void 0&&(r.removeOnPop=!0),!0}_pushToStack(e,t,n,r){if(this._stack.includes(e))return this._diagnose(r?{code:`already-in-stack`,tag:this.tagOf(e)}:{code:`already-in-stack`,title:this.titleOf(e)}),!1;let i=this.visiblePage,a=[];this._stack.push(e);let o=this._beginSwitch(i,e,!1,n,a);return this._emitChange(t,i,!1,[],a,o),!0}_popFromStack(e,t){let n=this.visiblePage;if(e===n)return;let r=this._stack.indexOf(e),i=this._stack.slice(r+1).reverse();this._stack.length=r+1;let a=[],o=this._beginSwitch(n,e,!0,t,a);for(let e of i)e!==n&&this._registry.get(e)?.removeOnPop===!0&&this._unregister(e)&&a.push(e);this._emitChange(`pop`,n,!0,i,a,o)}_beginSwitch(e,t,n,r,i){if(this._pendingRemoval!==null&&this._pendingRemoval!==e){let e=this._resolvePendingRemoval();e!==null&&i.push(e)}let a=null;return n&&e!==null&&this._registry.get(e)?.removeOnPop===!0&&!this._stack.includes(e)&&(a=e,this._pendingRemoval=e),{animate:r&&e!==null,tagNotify:e!==null&&this.tagOf(e)!==null||t!==null&&this.tagOf(t)!==null,removeAfterTransition:a}}_resolvePendingRemoval(){let e=this._pendingRemoval;if(e===null)return null;if(this._pendingRemoval=null,this._stack.includes(e)){let t=this._registry.get(e);return t!==void 0&&(t.removeOnPop=!0),null}return this._unregister(e)?e:null}_unregister(e){let t=this._registry.get(e);return t===void 0?!1:(t.tag!==null&&this._tags.get(t.tag)===e&&this._tags.delete(t.tag),this._registry.delete(e),!0)}};function clampSidebarSelection(e,t){return!Number.isInteger(e)||e<0||e>=t?-1:e}function adjustSidebarSelection(e,t,n,r,i,a){if(t===0&&n>0)return clampSidebarSelection(0,n);let o=e>>>0,s=r>>>0;return s<=o&&s+i>o?-1:s<=o?clampSidebarSelection(o+a-i>>>0,n):e}function flattenSidebarItems(e,t){let n=[],r=[],i=0;return e.forEach((e,a)=>{r.push(i),e.items.forEach((e,r)=>{let o=i+r;t&&!t(e,o)||n.push({index:o,sectionIndex:a,sectionItemIndex:r,item:e,titleVisible:stringIsNotEmpty(e.title),subtitleVisible:stringIsNotEmpty(e.subtitle),iconVisible:stringIsNotEmpty(e.iconName)})}),i+=e.items.length}),{items:n,sectionFirstIndex:r}}function deriveSidebarHeaders(e,t){let n=[],r=null;for(let i of t){if(r===i.sectionIndex)continue;let t=r===null;r=i.sectionIndex;let a=e[i.sectionIndex]?.title??``;t&&a.length===0||n.push({sectionIndex:i.sectionIndex,kind:a.length>0?`title`:`separator`,title:a,first:t})}return n}var SidebarState=class{constructor(){this._mode=`sidebar`,this._sections=[],this._filter=null,this._selected=-1,this._items=[],this._sectionFirstIndex=[],this._visibleItems=[],this._headers=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={selected:this._selected,previous:e,item:this.selectedItem,interactive:t};for(let e of[...this._listeners])e(n)}_applySelected(e,t){if(e===this._selected)return!1;let n=this._selected;return this._selected=e,this._emit(n,t),!0}_invalidate(){let e=flattenSidebarItems(this._sections),t=this._filter;this._items=e.items,this._sectionFirstIndex=e.sectionFirstIndex,this._visibleItems=t?this._items.filter(e=>t(e.item,e.index)):this._items,this._headers=deriveSidebarHeaders(this._sections,this._visibleItems)}get mode(){return this._mode}setMode(e){return e===this._mode?!1:(this._mode=e,!0)}get selectionVisible(){return this._mode===`sidebar`}get sections(){return this._sections}setSections(e){let t=this.count;this._sections=[...e],this._invalidate();let n=adjustSidebarSelection(adjustSidebarSelection(this._selected,t,0,0,t,0),0,this.count,0,0,this.count);this._applySelected(n,!1)}insertSection(e,t){let n=this.count,r=this._sections.length,i=Number.isInteger(t)&&t>=0&&t<r?t:r;this._sections.splice(i,0,e),this._invalidate();let a=this._sectionFirstIndex[i]??0,o=adjustSidebarSelection(this._selected,n,this.count,a,0,e.items.length);return this._applySelected(o,!1),i}removeSectionAt(e){let t=this.sectionAt(e);if(!t)return!1;let n=this.count,r=this._sectionFirstIndex[e]??0,i=t.items.length;return this._sections.splice(e,1),this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,n,this.count,r,i,0),!1),!0}removeAllSections(){let e=this.count;this._sections=[],this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,e,0,0,e,0),!1)}refresh(){this._invalidate()}sectionAt(e){if(!(!Number.isInteger(e)||e<0))return this._sections[e]}sectionFirstIndex(e){return this._sectionFirstIndex[e]??0}get count(){return this._items.length}get items(){return this._items}itemAt(e){if(!(!Number.isInteger(e)||e<0))return this._items[e]?.item}get filter(){return this._filter}setFilter(e){e!==this._filter&&(this._filter=e,this._invalidate())}get visibleItems(){return this._visibleItems}get headers(){return this._headers}get isEmpty(){return this._visibleItems.length===0}get selected(){return this._selected}get selectedItem(){return this.itemAt(this._selected)}setSelected(e){return this._applySelected(clampSidebarSelection(e,this.count),!1)}activate(e){let t=this._visibleItems.find(t=>t.index===e);return!t||t.item.visible===!1||t.item.enabled===!1?{index:e,activated:!1,selectionChanged:!1}:{index:e,activated:!0,selectionChanged:this._applySelected(clampSidebarSelection(e,this.count),!0)}}};const De=1200,Oe=Math.PI*.35,ke=Math.PI*.015,w=Math.PI*.9,Ae=Math.PI*.9,je=Math.PI*.7,T=Math.PI*1.1,Me=Math.PI*1.35,E=Ae+T+Me-je;53*Math.PI*2/E;const Ne=T-je/2;function normalizeSpinnerAngle(e){let t=e;for(;t<0;)t+=Math.PI*2;for(;t>Math.PI*2;)t-=Math.PI*2;return t}function spinnerArcStart(e){let t=e%E,n=t>T?1:easeInOutSine(t/T);return adwLerp(ke,w,n)-t*w/E}function spinnerArcEnd(e){let t=e%E,n=T-je,r;return r=t<n?0:t>E-Ae?1:easeInOutSine((t-n)/Me),adwLerp(0,w-ke,r)-t*w/E}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+Oe),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+Oe),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=De*53;return(e%t+t)%t/De*Math.PI*2}const Pe={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},Fe=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],Ie={hyper:{default:`Hyper`,apple:`Hyper`},super:{default:`Super`,apple:`Super`},control:{default:`Ctrl`,apple:`⌃`},alt:{default:`Alt`,apple:`⌥`},shift:{default:`Shift`,apple:`⇧`},meta:{default:`Meta`,apple:`⌘`}},Le={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},Re={exclam:`!`,quotedbl:`"`,numbersign:`#`,dollar:`$`,percent:`%`,ampersand:`&`,apostrophe:`'`,parenleft:`(`,parenright:`)`,asterisk:`*`,plus:`+`,comma:`,`,minus:`-`,period:`.`,slash:`/`,colon:`:`,semicolon:`;`,less:`<`,equal:`=`,greater:`>`,question:`?`,at:`@`,bracketleft:`[`,backslash:`\\`,bracketright:`]`,asciicircum:`^`,underscore:`_`,grave:"`",braceleft:`{`,bar:`|`,braceright:`}`,asciitilde:`~`},ze={Left:{default:`←`},Up:{default:`↑`},Right:{default:`→`},Down:{default:`↓`},space:{default:`␣`},Return:{default:`⏎`},Page_Up:{default:`Page_Up`},Page_Down:{default:`Page_Down`},Escape:{apple:`⎋`},Tab:{apple:`⇥`},BackSpace:{apple:`⌫`},Delete:{apple:`⌦`}};function parseAccelerator(e,t=`default`){let n=new Set,r=e;for(;r.startsWith(`<`);){let e=r.indexOf(`>`);if(e===-1)return null;let i=r.slice(1,e).toLowerCase();if(r=r.slice(e+1),i===`release`)continue;let a=Pe[i];if(!a)return null;n.add(a===`primary`?t===`apple`?`meta`:`control`:a)}return r.length===0?null:{modifiers:n,key:r}}function keycapForKey(e,t){let n=/^([A-Za-z]+)_([LR])$/.exec(e);if(n&&Le[n[1]]){let e=Le[n[1]];return{label:Ie[e][t],sideMarker:n[2]}}let r=ze[e];if(r){let e=t===`apple`?r.apple??r.default:r.default;if(e)return{label:e}}let i=/^KP_(.+)$/.exec(e);if(i){let e=printableFor(i[1]);if(e)return{label:`KP ${e.toUpperCase()}`}}let a=printableFor(e);return a?{label:a===`\\`?`Backslash`:a.toUpperCase()}:{label:e.length===1?e.toUpperCase():e}}function printableFor(e){if(e.length===1){let t=e.codePointAt(0)??0;return t>32&&t<127?e:null}return Re[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of Fe)n.modifiers.has(e)&&r.push({label:Ie[e][t]});return r.push(keycapForKey(n.key,t)),r}function accessibleFor(e){return e.map(e=>e.sideMarker?`${e.label} ${e.sideMarker}`:e.label).join(`+`)}function parseShortcutLabel(e,t={}){let{disabledText:n=``,direction:r=`ltr`,platform:i=`default`}=t;if(e.length===0)return{nodes:[{kind:`disabled`,text:n}],accessibleLabel:n,error:null};let a=[],o=``,s=null,combination=e=>{for(let t of e.split(`&`)){let e=shortcutKeycaps(t,i);if(!e)return s=t,!1;a.push({kind:`keys`,keys:e}),o+=accessibleFor(e)}return!0},sequence=e=>{let t=r===`rtl`?`←`:`→`,n=e.split(`+`);for(let[e,r]of n.entries())if(e>0&&(a.push({kind:`separator`,text:t}),o+=t),!combination(r))return!1;return!0},range=e=>{let t=e.indexOf(`...`);return t===-1?sequence(e):sequence(e.slice(0,t))?(a.push({kind:`separator`,text:`⋯`}),o+=`…`,sequence(e.slice(t+3))):!1};for(let[t,n]of e.split(` `).entries())if(t>0&&(a.push({kind:`separator`,text:`/`}),o+=` `),!range(n))break;return{nodes:a,accessibleLabel:o,error:s}}const Be=[`px`,`pt`,`sp`];function adwLengthToPx(e,t,n=96){switch(e){case`pt`:return t*n/72;case`sp`:return t*n/96;default:return t}}function normalizeLengthUnit(e,t){return Be.includes(e)?e:t}function isSidebarAtVisualStart(e,t=`ltr`){return e===`start`==(t!==`rtl`)}function fractionOf(e){return e.sidebarWidthFraction??.25}function resolveSidebarBounds(e,t=0,n={}){let r=e.sidebarWidthUnit??`sp`,i=e.dpi??96,a=n.ceil?Math.ceil:Math.trunc,o=adwLengthToPx(r,e.minSidebarWidth??180,i),s=adwLengthToPx(r,e.maxSidebarWidth??280,i),c=a(Math.max(t,o));return{min:c,max:a(Math.max(c,s))}}function resolveOverlaySidebarWidth(e){let t=resolveSidebarBounds(e,e.sidebarChildMin??0,{ceil:!0});if(e.collapsed)return glibClamp(e.totalWidth,t.min,t.max);let n=glibClamp(Math.trunc(e.totalWidth*fractionOf(e)),t.min,t.max);return Math.min(n,e.totalWidth-(e.contentMin??0))}function layoutOverlaySplitView(e){let{totalWidth:t,showProgress:n,collapsed:r}=e,i=e.sidebarWidth,a=isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`),o=i,s=Math.trunc(i*n),c=s>i,l={shieldVisible:r&&n>0,sidebarPainted:n>0,shadowProgress:1-Math.min(n,+!!r),shadowSide:a?`left`:`right`};return r?(c&&(o=s),{sidebar:{x:a?c?0:s-i:t-s,width:o},content:{x:0,width:t},...l}):(c&&(o=s,s=i),a?{sidebar:{x:s-i,width:o},content:{x:s,width:t-s},...l}:{sidebar:{x:t-(c?o:s),width:o},content:{x:0,width:t-s},...l})}function tagsConflict(e,t){return e==null||t==null?!1:e===t}function resolveNavigationStack(e){let{hasSidebar:t,hasContent:n,showContent:r}=e,i=e.sidebarPosition===`end`;if(e.changingPage&&t&&n)return r?i?{stack:[`content`],transition:`pop`,page:`sidebar`}:{stack:[`sidebar`,`content`],transition:`push`,page:`content`}:i?{stack:[`content`,`sidebar`],transition:`push`,page:`sidebar`}:{stack:[`sidebar`],transition:`pop`,page:`content`};let a=[];return i?(n&&a.push(`content`),t&&(!r||!n)&&a.push(`sidebar`)):(t&&a.push(`sidebar`),n&&(r||!t)&&a.push(`content`)),{stack:a,transition:`replace`,page:null}}function resolveNavigationAction(e){if(e.action===`pop`)return e.showContent&&e.hasSidebar&&e.hasContent?{kind:`set-show-content`,showContent:!1}:{kind:`delegate`};let{tag:t}=e;return e.contentTag!==null&&e.contentTag!==void 0&&t===e.contentTag?e.showContent&&e.collapsed?{kind:`already-in-stack`,tag:t}:{kind:`set-show-content`,showContent:!0}:e.sidebarTag!==null&&e.sidebarTag!==void 0&&t===e.sidebarTag?{kind:`already-in-stack`,tag:t}:{kind:`delegate`}}const D={alreadyInStack:e=>`Page with the tag '${e}' is already in the navigation stack`,notFound:e=>`No page with the tag '${e}' found in AdwNavigationSplitView`,sidebarCollision:e=>`Trying to add sidebar with the tag '${e}' to AdwNavigationSplitView, but content already has the same tag`,contentCollision:e=>`Trying to add content with the tag '${e}' to AdwNavigationSplitView, but sidebar already has the same tag`,sidebarTagCollision:e=>`Trying to set the sidebar's tag to '${e}', but the content already has the same tag`,contentTagCollision:e=>`Trying to set the content's tag to '${e}', but the sidebar already has the same tag`};var NavigationSplitViewState=class{constructor(e={}){this._sidebar=null,this._content=null,this._sidebarTag=null,this._contentTag=null,this._listeners=new Set,this._sidebarPosition=e.sidebarPosition??`start`,this._collapsed=e.collapsed??!1,this._showContent=e.showContent??!1,this._handlers={onCritical:e.onCritical,onDelegate:e.onDelegate}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t,n=!1){let r={property:e,interactive:n,plan:t};for(let e of[...this._listeners])e(r)}_critical(e){this._handlers.onCritical?.(e)}_plan(e=!1){return resolveNavigationStack({hasSidebar:this._sidebar!==null,hasContent:this._content!==null,sidebarPosition:this._sidebarPosition,showContent:this._showContent,changingPage:e})}get collapsed(){return this._collapsed}get showContent(){return this._showContent}get sidebarPosition(){return this._sidebarPosition}get sidebar(){return this._sidebar}get content(){return this._content}get sidebarTag(){return this._sidebarTag}get contentTag(){return this._contentTag}get stack(){return this._plan()}get visiblePane(){let{stack:e}=this._plan();return e[e.length-1]??null}setSidebar(e){if(e===this._sidebar)return!1;let t=e?.tag??null;return tagsConflict(t,this._contentTag)?(this._critical(D.sidebarCollision(t)),!1):(this._sidebar=e,this._sidebarTag=t,this._emit(`sidebar`,this._plan()),!0)}setContent(e){if(e===this._content)return!1;let t=e?.tag??null;return tagsConflict(this._sidebarTag,t)?(this._critical(D.contentCollision(t)),!1):(this._content=e,this._contentTag=t,this._emit(`content`,this._plan()),!0)}setTag(e,t){return e===`sidebar`?(this._sidebarTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(D.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(D.contentTagCollision(t)),this._contentTag=null,!1):!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`,this._plan()),!0)}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._emit(`collapsed`,this._plan()),!0)}setShowContent(e,t=!1){let n=!!e;if(n===this._showContent)return!1;this._showContent=n;let r=this._collapsed&&this._sidebar!==null&&this._content!==null;return this._emit(`show-content`,this._plan(r),t),!0}push(e){return this._runAction(resolveNavigationAction({action:`push`,tag:e,sidebarTag:this._sidebarTag,contentTag:this._contentTag,showContent:this._showContent,collapsed:this._collapsed}),`push`,e)}pop(){return this._runAction(resolveNavigationAction({action:`pop`,hasSidebar:this._sidebar!==null,hasContent:this._content!==null,showContent:this._showContent}),`pop`)}_runAction(e,t,n){switch(e.kind){case`set-show-content`:return this.setShowContent(e.showContent,!0),e;case`already-in-stack`:return this._critical(D.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(D.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const Ve={animate(e){return e.onValue(e.to),e.onDone(),{cancel:()=>{}}}};var OverlaySplitViewState=class{constructor(e={}){this._swipeActive=!1,this._animation=null,this._listeners=new Set,this._showSidebar=e.showSidebar??!0,this._collapsed=e.collapsed??!1,this._pinSidebar=e.pinSidebar??!1,this._sidebarPosition=e.sidebarPosition??`start`,this._enableShowGesture=e.enableShowGesture??!0,this._enableHideGesture=e.enableHideGesture??!0,this._showProgress=+!!this._showSidebar,this._animator=e.animator??Ve}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t=!1){let n={property:e,showSidebar:this._showSidebar,collapsed:this._collapsed,showProgress:this._showProgress,shieldVisible:this.shieldVisible,interactive:t};for(let e of[...this._listeners])e(n)}get showSidebar(){return this._showSidebar}get collapsed(){return this._collapsed}get pinSidebar(){return this._pinSidebar}get sidebarPosition(){return this._sidebarPosition}get enableShowGesture(){return this._enableShowGesture}get enableHideGesture(){return this._enableHideGesture}get showProgress(){return this._showProgress}get shieldVisible(){return this._collapsed&&this._showProgress>0}get sidebarPainted(){return this._showProgress>0}get sidebarFocusable(){return!this._collapsed||this._showSidebar}get contentFocusable(){return!this._collapsed||!this._showSidebar}setShowSidebar(e,t={}){let n=!!e;if(n===this._showSidebar)return!1;this._showSidebar=n;let r=+!!n,i=t.animate??!0;return i||(this._cancelAnimation(),this._showProgress=r),this._emit(`show-sidebar`,t.interactive??!1),i&&!this._swipeActive&&this._startAnimation(r,t.velocity??0),!0}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._pinSidebar||this.setShowSidebar(!t,{animate:!1}),this._emit(`collapsed`),!0)}setPinSidebar(e){let t=!!e;return t===this._pinSidebar?!1:(this._pinSidebar=t,this._emit(`pin-sidebar`),!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`),!0)}setEnableShowGesture(e){let t=!!e;return t===this._enableShowGesture?!1:(this._enableShowGesture=t,!0)}setEnableHideGesture(e){let t=!!e;return t===this._enableHideGesture?!1:(this._enableHideGesture=t,!0)}setShowProgress(e){this._showProgress=e,this._emit(`show-progress`)}escape(){return this._showProgress<2**-52||!this._collapsed?!1:(this.setShowSidebar(!1,{interactive:!0}),!0)}dismissShield(){return this.setShowSidebar(!1,{interactive:!0})}get swipeActive(){return this._swipeActive}beginSwipe(){this._cancelAnimation(),this._swipeActive=!0}endSwipe(e,t=0){if(!this._swipeActive)return{kind:`animate`,to:this._showProgress};this._swipeActive=!1;let n=resolveSwipeRelease({to:e,showSidebar:this._showSidebar});return n.kind===`animate`?this._startAnimation(n.to,t):this.setShowSidebar(n.showSidebar,{velocity:t,interactive:!0}),n}get snapPoints(){return resolveSwipeSnapPoints({showProgress:this._showProgress,enableShowGesture:this._enableShowGesture,enableHideGesture:this._enableHideGesture,swipeActive:this._swipeActive})}_cancelAnimation(){this._animation?.cancel(),this._animation=null}_startAnimation(e,t){this._cancelAnimation();let n=!1,r=this._animator.animate({from:this._showProgress,to:e,velocity:t,clamp:e<.5,onValue:e=>this.setShowProgress(e),onDone:()=>{n=!0,this._animation=null}});n||(this._animation=r)}};function resolveSwipeSnapPoints(e){let t=e.showProgress>0||e.enableShowGesture||e.swipeActive,n=e.showProgress<1||e.enableHideGesture||e.swipeActive;return t&&n?[0,1]:[+!!t]}function resolveSwipeStart(e){let t=Math.abs(e.showProgress-1)<2**-52||e.showProgress>1,n=Math.abs(e.showProgress)<2**-52||e.showProgress<0;return!(t&&!e.collapsed&&e.direction===`forward`||n&&!e.enableShowGesture||t&&!e.enableHideGesture)}function resolveSwipeRelease(e){return e.to>0===e.showSidebar?{kind:`animate`,to:e.to}:{kind:`set-show-sidebar`,showSidebar:e.to>0}}function swipeCancelProgress(e){let t=e<0?-Math.round(-e):Math.round(e);return t===0?0:t}function resolveSwipeArea(e){if(!e.isDrag)return{x:0,y:0,width:0,height:0};let t=Math.max(Math.trunc(e.sidebarWidth*e.showProgress),32);return{x:isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`)?0:e.totalWidth-t,y:0,width:t,height:e.totalHeight}}const He=[`action-disabled`,`action-missing`,`macos-menubar`],Ue=[`horizontal-buttons`,`circular-buttons`,`inline-buttons`],We=[`ltr`,`rtl`,`none`],str=e=>typeof e==`string`?e:void 0;function oneOf(e,t){return typeof t==`string`&&e.includes(t)?t:void 0}function put(e,t,n){n!==void 0&&(e[t]=n)}function normalizeMenuModel(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=normalizeEntry(n);e!==null&&t.push(e)}return t}function normalizeEntry(e){if(typeof e==`string`)return{kind:`item`,label:e};if(typeof e!=`object`||!e)return null;let t=e;if(Array.isArray(t.items)&&(t.kind===`section`||t.kind===`submenu`)){let{items:e,kind:n,...r}=t;return normalizeEntry({...r,[n]:e})}if(Array.isArray(t.section)){let e={kind:`section`,items:normalizeMenuModel(t.section)},n=e;return put(n,`label`,str(t.label)),put(n,`displayHint`,oneOf(Ue,t.displayHint)),put(n,`textDirection`,oneOf(We,t.textDirection)),e}if(Array.isArray(t.submenu)){let e={kind:`submenu`,label:str(t.label)??``,items:normalizeMenuModel(t.submenu)},n=e;return put(n,`icon`,str(t.icon)),put(n,`submenuAction`,str(t.submenuAction)),put(n,`macosSpecial`,str(t.macosSpecial)),e}let n=str(t.label),r={kind:`item`,label:n??``},i=r;return put(i,`action`,str(t.action)||void 0),put(i,`icon`,str(t.icon)),put(i,`verbIcon`,str(t.verbIcon)),put(i,`accel`,str(t.accel)),put(i,`hiddenWhen`,oneOf(He,t.hiddenWhen)),put(i,`custom`,str(t.custom)),put(i,`id`,str(t.id)),t.useMarkup===!0&&(i.useMarkup=!0),n===void 0&&Object.keys(r).length===2?null:r}function parseMenuModel(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?normalizeMenuModel(t):[]}function menuNodeAt(e,t){if(!Array.isArray(t)||t.length===0)return null;let n=e,r=null;for(let e of t){if(!Number.isInteger(e)||e<0||e>=n.length)return null;r=n[e],n=r.kind===`item`?[]:r.items}return r}function menuItemAt(e,t){let n=menuNodeAt(e,t);return n!==null&&n.kind===`item`?n:null}function flattenMenu(e,t=[]){let n=[],r=!1;return e.forEach((e,i)=>{let a=[...t,i];if(e.kind===`section`){let t=flattenMenu(e.items,a);if(t.length===0)return;n.push({...t[0],separated:n.length>0}),n.push(...t.slice(1)),r=!0;return}n.push({node:e,path:a,separated:r&&n.length>0}),r=!1}),n}function parseDetailedAction(e){if(typeof e!=`string`||e.length===0)return null;let t=e.indexOf(`::`);if(t>0)return{name:e.slice(0,t),target:e.slice(t+2)};let n=e.indexOf(`(`);return n>0&&e.endsWith(`)`)?{name:e.slice(0,n),target:unquote(e.slice(n+1,-1))}:{name:e}}function unquote(e){let t=e[0];if(!(e.length>=2&&(t===`'`||t===`"`)&&e[e.length-1]===t))return e;let n=e.slice(1,-1),r=``;for(let e=0;e<n.length;e+=1){let i=n[e],a=n[e+1];if(i===`\\`&&(a===t||a===`\\`)){r+=a,e+=1;continue}r+=i}return r}function resolveMenuItemState(e,t){let n=parseDetailedAction(e.action);if(t===void 0)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!0,!0)};if(n===null)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!1,!0)};let r=t?.[n.name];if(r===void 0)return{sensitive:!1,toggled:!1,role:`normal`,visible:visibility(e,!1,!1)};let i=r.enabled!==!1,a=`normal`,o=!1;return n.target!==void 0&&r.state!==void 0?(a=`radio`,o=r.state===n.target):(r.state===`true`||r.state===`false`)&&(a=`check`,o=r.state===`true`),{sensitive:i,toggled:o,role:a,visible:visibility(e,!0,i)}}function visibility(e,t,n){switch(e.hiddenWhen){case`action-missing`:return t;case`action-disabled`:return n;case`macos-menubar`:return!0;default:return!0}}const O={name:`adwaita-web`,custom:!1};function menuRefusals(e,t,n=[]){let r=[];return e.forEach((e,i)=>{let a=[...n,i];if(e.kind===`item`){e.custom!==void 0&&!t.custom&&r.push({path:a,what:`custom`,message:`menu item custom="${e.custom}" names an application widget, which ${t.name} cannot host: it has no gtk_popover_menu_add_child. Give the item a label and an action, or keep this menu on GTK.`});return}r.push(...menuRefusals(e.items,t,a))}),r}function assertMenuRenderable(e,t){let n=menuRefusals(e,t);if(n.length===0)return;let r=n.map(e=>` [${e.path.join(`.`)}] ${e.message}`);throw Error(`${t.name} cannot render this menu:\n${r.join(`
4
+ `)}`)}const Ge={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},Ke=[`none`,`up`,`down`,`left`,`right`];function splitButtonStyleClasses(e,t){let n=[];return t!==null&&t.length>0&&n.push(`image-button`),e!==null&&e.length>0&&n.push(`text-button`),n}function resolveDropdownTooltip(e){return typeof e==`string`&&e.length>0?{text:e,markup:!0}:{text:`More Options`,markup:!1}}function splitButtonArrowIcon(e){return Ge[e]??Ge.down}function splitButtonPopupDirection(e){return e===`none`||!Ke.includes(e)?`down`:e}const qe=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&Ke.includes(e)}function splitButtonRootState(e,t){return{active:e.active||t.active||e.keyboardActivating||t.keyboardActivating,checked:e.checked||t.checked}}const menuKey=e=>e===null?``:JSON.stringify(e);function internalContent(e){return Object.freeze({adwInternalContent:e})}function derivedPopover(){return Object.freeze({adwDerivedPopover:!0})}var SplitButtonState=class{constructor(){this._mode=`empty`,this._label=null,this._iconName=null,this._child=null,this._useUnderline=!1,this._menuModel=null,this._popover=null,this._direction=`down`,this._dropdownTooltip=``,this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={mode:this._mode,label:this._label,iconName:this._iconName,child:this._child,styleClasses:this.styleClasses,dropdownEnabled:this.dropdownEnabled,open:this._open,notified:e,interactive:t};for(let e of[...this._listeners])e(n)}get mode(){return this._mode}get label(){return this._label}setLabel(e){if(typeof e!=`string`||e===this._label)return!1;let t=[];return this._iconName!==null&&t.push(`icon-name`),this._child!==null&&t.push(`child`),this._child=this._mode===`label`?this._child:internalContent(`label`),this._mode=`label`,this._label=e,this._iconName=null,t.push(`label`),this._emit(t,!1),!0}get iconName(){return this._iconName}setIconName(e){if(typeof e!=`string`||e===this._iconName)return!1;let t=[];return this._label!==null&&t.push(`label`),this._child!==null&&t.push(`child`),this._child=this._mode===`icon`?this._child:internalContent(`icon`),this._mode=`icon`,this._iconName=e,this._label=null,t.push(`icon-name`),this._emit(t,!1),!0}get child(){return this._child}setChild(e){let t=e??null;if(t===this._child)return!1;let n=[];return this._label!==null&&n.push(`label`),this._iconName!==null&&n.push(`icon-name`),this._mode=t===null?`empty`:`child`,this._child=t,this._label=null,this._iconName=null,n.push(`child`),this._emit(n,!1),!0}get styleClasses(){return splitButtonStyleClasses(this._label,this._iconName)}get useUnderline(){return this._useUnderline}setUseUnderline(e){let t=!!e;return t===this._useUnderline?!1:(this._useUnderline=t,this._emit([`use-underline`],!1),!0)}get menuModel(){return this._menuModel}setMenuModel(e){let t=normalizeMenuModel(e),n=t.length>0?t:null;if(menuKey(n)===menuKey(this._menuModel))return!1;let r=n===null?null:derivedPopover(),i=[];return r!==this._popover&&i.push(`popover`),i.push(`menu-model`),this._menuModel=n,this._popover=r,this.dropdownEnabled||(this._open=!1),this._emit(i,!1),!0}get popover(){return this._popover}setPopover(e){let t=e??null;if(t===this._popover)return!1;let n=[];return this._menuModel!==null&&n.push(`menu-model`),n.push(`popover`),this._menuModel=null,this._popover=t,this.dropdownEnabled||(this._open=!1),this._emit(n,!1),!0}get dropdownEnabled(){return this._menuModel!==null||this._popover!==null}get direction(){return this._direction}setDirection(e){return!isSplitButtonDirection(e)||e===this._direction?!1:(this._direction=e,this._emit([`direction`],!1),!0)}get arrowIcon(){return splitButtonArrowIcon(this._direction)}get dropdownTooltip(){return this._dropdownTooltip}setDropdownTooltip(e){return typeof e!=`string`||e===this._dropdownTooltip?!1:(this._dropdownTooltip=e,this._emit([`dropdown-tooltip`],!1),!0)}get open(){return this._open}_setOpen(e,t){return e&&!this.dropdownEnabled||e===this._open?!1:(this._open=e,this._emit([],t),!0)}openMenu(){return this._setOpen(!0,!1)}closeMenu(){return this._setOpen(!1,!1)}toggleMenu(){return this._setOpen(!this._open,!0)}activateMenuItem(e){if(this._menuModel===null)return null;let t=menuItemAt(this._menuModel,e);return t===null?null:(this._setOpen(!1,!0),t)}};const Je=[`narrow`,`wide`],Ye=[`labels`,`icons`,`both`];function isViewSwitcherPolicy(e){return e===`narrow`||e===`wide`}function isInlineViewSwitcherDisplayMode(e){return e===`labels`||e===`icons`||e===`both`}function createViewSwitcherPage(e){return{name:e.name,title:e.title??null,iconName:e.iconName??null,visible:e.visible??!0,useUnderline:e.useUnderline??!1,badgeNumber:normalizeBadgeNumber(e.badgeNumber),needsAttention:e.needsAttention??!1,startsSection:e.startsSection??!1,sectionTitle:e.sectionTitle??null}}function viewSwitcherPageFromStackPage(e){return createViewSwitcherPage({name:e.name,title:e.title,iconName:e.icon.length>0?e.icon:null,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention,useUnderline:e.useUnderline,startsSection:e.startsSection,sectionTitle:e.sectionTitle})}function viewSwitcherPagesFromStack(e){return e.map(e=>viewSwitcherPageFromStackPage(e))}function viewSwitcherSidebarSections(e){let t=[];for(let n of e)t.length===0||n.startsSection===!0?t.push({title:n.sectionTitle??``,pages:[n]}):t[t.length-1].pages.push(n);return t}function isViewSwitcherButtonVisible(e){return e.visible&&(isPresent(e.title)||isPresent(e.iconName))}function viewSwitcherIconName(e){return isPresent(e)&&e.length>0?e:`image-missing`}function viewSwitcherLabel(e){return isPresent(e.title)?e.useUnderline?stripMnemonic(e.title):e.title:``}function viewSwitcherBadgeLabel(e){let t=normalizeBadgeNumber(e);return t>999?`999+`:t===0?``:String(t)}const k={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=k){let r=normalizeBadgeNumber(t),i=e?n.attentionRequested:``,a=``;return r>999?a=n.badgeOverflow:r>0&&(a=n.badge(r)),i&&a?`${a} ${i}`:i||a}function inlineToggleTooltip(e,t){return t===`icons`?viewSwitcherLabel(e):``}function shouldRevealViewSwitcherBar(e,t){if(!e)return!1;let n=0;for(let e of t)if(e.visible&&(n++,n>1))return!0;return!1}function viewSwitcherButtonOrientation(e){return e===`wide`?`horizontal`:`vertical`}function buildViewSwitcherButtons(e,t,n,r=k){let i=viewSwitcherButtonOrientation(n);return e.map((e,n)=>({pageIndex:n,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),visible:isViewSwitcherButtonVisible(e),selected:n===t,orientation:i,badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,r)}))}function buildInlineToggles(e,t,n=k){let r=t!==`labels`,i=t!==`icons`,a=[];return e.forEach((e,o)=>{e.visible&&a.push({toggleIndex:a.length,pageIndex:o,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),showIcon:r,showLabel:i,tooltip:inlineToggleTooltip(e,t),badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,n)})}),a}function toggleIndexForPage(e,t){if(!Number.isInteger(t)||t<0||t>=e.length||!e[t].visible)return-1;let n=0;for(let r=0;r<t;r++)e[r].visible&&n++;return n}var ViewSwitcherDragSwitch=class{constructor(e){this._timers=new Map,this._scheduler=e.scheduler,this._onSwitch=e.onSwitch,this._delay=e.delay??500}enter(e,t){if(!Number.isInteger(e)||e<0||e===t||this._timers.has(e))return!1;let n=this._scheduler.schedule(()=>{this._timers.delete(e),this._onSwitch(e)},this._delay);return this._timers.set(e,n),!0}leave(e){let t=this._timers.get(e);t!==void 0&&(this._timers.delete(e),this._scheduler.cancel(t))}cancel(){for(let e of this._timers.values())this._scheduler.cancel(e);this._timers.clear()}get pending(){return[...this._timers.keys()].sort((e,t)=>e-t)}},ViewSwitcherState=class{constructor(e={}){this._pages=[],this._pagesView=null,this._stack=new ViewStackState,this._listeners=new Set,this._drag=e.scheduler?new ViewSwitcherDragSwitch({scheduler:e.scheduler,delay:e.dragSwitchDelay,onSwitch:e=>{this.setSelected(e)}}):null,this._subscribeStack()}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}setPages(e){let t=this.selected,n=t>=0?this.selectedName:null;this._pages=e.map(e=>createViewSwitcherPage(e)),this._pagesView=null;let r=new ViewStackState;for(let e of this._pages)r.addPage({name:e.name,title:e.title,visible:e.visible});if(n!==null){let e=r.indexOfName(n);e>=0&&r.setVisibleIndex(e,!1)}this._stack=r,this._subscribeStack(),this._drag?.cancel(),(this.selected!==t||this.selectedName!==(n??``))&&this._emit(!1)}get selected(){return this._stack.visibleIndex}get selectedName(){return this._stack.visibleName}get selectedPage(){return this._pages[this.selected]}get count(){return this._pages.length}setSelected(e,t=!0){return this._stack.setVisibleIndex(e,t)}selectName(e,t=!0){return this._stack.setVisibleName(e,t)}setPageVisible(e,t){let n=this._pages.findIndex(t=>t.name===e);if(n<0)return!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(this._pages[n]={...r,visible:i},this._pagesView=null,this._stack.setPageVisible(e,i))}dragEnter(e){this._drag?.enter(e,this.selected)}dragLeave(e){this._drag?.leave(e)}cancelDrag(){this._drag?.cancel()}get pendingDragSwitches(){return this._drag?.pending??[]}get diagnostics(){return this._stack.diagnostics}_subscribeStack(){this._stack.subscribe(e=>this._emit(e.interactive))}_emit(e){let t=this.selectedPage,n={selected:this.selected,name:t?.name??``,title:t?viewSwitcherLabel(t):``,interactive:e};for(let e of[...this._listeners])e(n)}},ViewSwitcherBarState=class{constructor(){this._reveal=!1,this._revealed=!1,this._pages=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get reveal(){return this._reveal}get revealed(){return this._revealed}setReveal(e){let t=!!e;return t===this._reveal?!1:(this._reveal=t,this._refresh(),!0)}setPages(e){return this._pages=e,this._refresh()}_refresh(){let e=shouldRevealViewSwitcherBar(this._reveal,this._pages);if(e===this._revealed)return!1;this._revealed=e;let t={reveal:this._reveal,revealed:this._revealed};for(let e of[...this._listeners])e(t);return!0}};function isPresent(e){return e!=null}function normalizeBadgeNumber(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function scrollMaxValue(e){return e.upper-e.pageSize}function isScrolledFromStart(e){return e.value>e.lower}function isScrolledFromEnd(e){return e.value<scrollMaxValue(e)}const Xe=[`undershoot-top`,`undershoot-bottom`,`undershoot-start`,`undershoot-end`];function scrollUndershootClasses(e){let t=[],{vertical:n,horizontal:r}=e;return n&&(isScrolledFromStart(n)&&t.push(`undershoot-top`),isScrolledFromEnd(n)&&t.push(`undershoot-bottom`)),r&&(isScrolledFromStart(r)&&t.push(`undershoot-start`),isScrolledFromEnd(r)&&t.push(`undershoot-end`)),t}function overshootDistance(e,t){let n=scrollMaxValue(t);return e<t.lower?e-t.lower:e>n?e-n:0}function accumulateOvershoot(e,t,n){let r=n.lower-100,i=scrollMaxValue(n)+100;return Math.min(Math.max(e+t,r),i)}var PopoverState=class{constructor(){this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={open:this._open,interactive:e};for(let e of[...this._listeners])e(t)}_setOpen(e,t){return e===this._open?!1:(this._open=e,this._emit(t),!0)}get open(){return this._open}popup(){return this._setOpen(!0,!1)}popdown(){return this._setOpen(!1,!1)}toggle(){return this._setOpen(!this._open,!0)}dismiss(){return this._setOpen(!1,!0)}};function resolvePopoverKey(e,t){if(e===`Escape`)return{action:`close`,index:-1};let n=Number.isFinite(t.itemCount)?Math.max(0,Math.trunc(t.itemCount)):0;if(n===0)return{action:`none`,index:-1};let r=t.currentIndex,i=Number.isFinite(r)&&r>=0&&r<n?Math.trunc(r):-1,a=t.hasSearch===!0&&i<0;switch(e){case`ArrowDown`:return{action:`focus`,index:i<0?0:(i+1)%n};case`ArrowUp`:return{action:`focus`,index:i<0?n-1:(i-1+n)%n};case`Home`:return a?{action:`none`,index:-1}:{action:`focus`,index:0};case`End`:return a?{action:`none`,index:-1}:{action:`focus`,index:n-1};case`Enter`:case` `:return i<0?{action:`none`,index:-1}:{action:`activate`,index:i};default:return{action:`none`,index:-1}}}const Ze=[`none`,`fill`,`spread`],Qe=[`minimum`,`natural`],$e=[`start-to-end`,`end-to-start`];function normalizeWrapBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?0:t}function normalizeWrapBoxAlign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function normalizeWrapBoxJustify(e){return Ze.includes(e)?e:`none`}function normalizeWrapPolicy(e){return Qe.includes(e)?e:`natural`}function normalizeNaturalLineLength(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?-1:Math.trunc(t)}function normalizeWrapBoxLengthUnit(e){return normalizeLengthUnit(e,`px`)}function normalizeWrapBoxPackDirection(e){return $e.includes(e)?e:`start-to-end`}function wrapBoxLengthToPx(e,t,n=96){return e<0?-1:adwLengthToPx(t,e,n)}function resolveWrapBoxLine(e){let t=e.lastLine&&!e.justifyLastLine?`none`:e.justify;if(t===`none`)return{justify:`none`,growChildren:!1,growGaps:!1,align:e.align};let n=t===`spread`&&e.childrenInLine>1;return{justify:t,growChildren:!n,growGaps:n,align:0}}function wrapPolicyFlexShrink(e){return+(e===`minimum`)}function resolveWrapBoxChildOrder(e){let{children:t,child:n,op:r}=e,i=e.sibling??null;if(i!==null&&i===n)return null;let a=t.indexOf(n);if(r===`insert-after`&&a!==-1||r===`reorder-after`&&a===-1)return null;let o=a===-1?[...t]:t.filter((e,t)=>t!==a);if(i===null)return[n,...o];let s=o.indexOf(i);return s===-1?null:[...o.slice(0,s+1),n,...o.slice(s+1)]}new Set(`ADC.AND.ASL.BCC.BCS.BEQ.BIT.BMI.BNE.BPL.BRK.BVC.BVS.CLC.CLD.CLI.CLV.CMP.CPX.CPY.DEC.DEX.DEY.EOR.INC.INX.INY.JMP.JSR.LDA.LDX.LDY.LSR.NOP.ORA.PHA.PHP.PLA.PLP.ROL.ROR.RTI.RTS.SBC.SEC.SED.SEI.STA.STX.STY.TAX.TAY.TSX.TXA.TXS.TYA`.split(`.`));const et=`--accent-bg-color`,tt=`--accent-color`;function isAdwaitaDark(e){return e.closest(`.theme-dark`)?!0:e.closest(`.theme-light`)?!1:globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}const A=new WeakSet;function hasAppChosenAccent(e){return A.has(e)}function writeAdwaitaAccent(e,t,n){t.style.setProperty(et,adwaitaAccentBgColor(e)),t.style.setProperty(tt,adwaitaAccentColor(e,n))}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement;A.add(n),writeAdwaitaAccent(e,n,t.dark??isAdwaitaDark(n))}function clearAdwaitaAccent(e=document.documentElement){A.delete(e),e.style.removeProperty(et),e.style.removeProperty(tt)}let j={},nt=!1,M=null,rt=!1;function readSystemAccent(){if(typeof CSS>`u`||!CSS.supports(`color`,`AccentColor`))return null;let e=document.createElement(`span`);e.style.color=`AccentColor`,e.style.display=`none`,document.documentElement.append(e);let t=getComputedStyle(e).color;e.remove();let n=parseAdwRgb(t);return n?{accent:nearestAccent(n),accentRgb:formatAdwRgb(n)}:null}function resolve(){if(j.accent&&j.accent!==v)return{accent:j.accent,source:`handoff`};let e=j.accentRgb?parseAdwRgb(j.accentRgb):null;if(e)return{accent:nearestAccent(e),source:`handoff`};if(j.accent===v){let e=readSystemAccent();if(e)return{accent:e.accent,source:`system`}}return null}function syncScheme(e){let t=j.colorScheme,n=t===`dark`?`theme-dark`:t===`light`?`theme-light`:null;n!==M&&(M&&e.classList.remove(M),M=null,n&&!e.classList.contains(`theme-dark`)&&!e.classList.contains(`theme-light`)&&(e.classList.add(n),M=n))}function sync(){let e=document.documentElement;if(syncScheme(e),hasAppChosenAccent(e))return;let t=resolve();t?(writeAdwaitaAccent(t.accent,e,isAdwaitaDark(e)),nt=!0):nt&&=(clearAdwaitaAccent(e),!1)}const isHandoffMeta=e=>e.nodeName===`META`&&e.getAttribute(`name`)?.startsWith(`adw-`)===!0;function touchesHandoffMeta(e){return e.type===`attributes`?isHandoffMeta(e.target)||e.attributeName===`name`&&e.oldValue?.startsWith(`adw-`)===!0:[...e.addedNodes,...e.removedNodes].some(isHandoffMeta)}function readMetaHandoff(){j=appearanceFromMeta(e=>document.head.querySelector(`meta[name="${e}"]`)?.getAttribute(`content`)??null)}function followDesktopAppearance(){rt||typeof document>`u`||(rt=!0,readMetaHandoff(),sync(),new MutationObserver(e=>{e.some(touchesHandoffMeta)&&(readMetaHandoff(),sync())}).observe(document.head,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`content`,`name`],attributeOldValue:!0}),globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).addEventListener(`change`,sync),globalThis.addEventListener(`focus`,()=>{j.accent===v&&sync()}))}function observeAdaptiveSize(e,t){let n=new ResizeObserver(e=>{let n=e[e.length-1];if(!n)return;let r=n.borderBoxSize?.[0];t(r?{width:r.inlineSize,height:r.blockSize}:{width:n.contentRect.width,height:n.contentRect.height})});return n.observe(e),()=>n.disconnect()}function addBreakpoints(e,t){return observeAdaptiveSize(e,e=>{for(let n of t)n.evaluate(e)})}function bindBreakpointSetter(e,t,n,r=!1){return t?addBreakpoints(e,[new AdwBreakpoint(t,{onApply:()=>n(!0),onUnapply:()=>n(!1)},r)]):()=>{}}const it=`adw-scroll-shaded`,N=`--adw-overshoot`,at=[`overshoot-top`,`overshoot-bottom`],P=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:P.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:P.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return P.has(t.overflowY)||P.has(t.overflowX)}function wheelDeltaPx(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}var AdwScrollShading=class{_root;_mutations=null;_resize=null;_unclamped=new WeakMap;_settleTimers=new WeakMap;_shaded=new Set;_pendingScan=0;_undershootEdges={top:!0,bottom:!0};_onOvershoot;constructor(e,t={}){this._root=e,this._onOvershoot=t.onOvershoot??null}setUndershootEdges(e){if(!(e.top===this._undershootEdges.top&&e.bottom===this._undershootEdges.bottom)){this._undershootEdges={...e};for(let e of this._shaded)this._update(e)}}connect(){this._mutations||(this._root.addEventListener(`scroll`,this._onScroll,{capture:!0,passive:!0}),this._root.addEventListener(`wheel`,this._onWheel,{capture:!0,passive:!0}),this._mutations=new MutationObserver(()=>this._scheduleRefresh()),this._mutations.observe(this._root,{childList:!0,subtree:!0}),this._resize=new ResizeObserver(()=>this._scheduleRefresh()),this._resize.observe(this._root),this.refresh())}disconnect(){this._root.removeEventListener(`scroll`,this._onScroll,{capture:!0}),this._root.removeEventListener(`wheel`,this._onWheel,{capture:!0}),this._mutations?.disconnect(),this._mutations=null,this._resize?.disconnect(),this._resize=null,this._pendingScan&&cancelAnimationFrame(this._pendingScan),this._pendingScan=0;for(let e of this._shaded)this._clear(e);this._shaded.clear()}_scheduleRefresh(){this._pendingScan||=requestAnimationFrame(()=>{this._pendingScan=0,this.refresh()})}refresh(){let e=new Set;isScroller(this._root)&&e.add(this._root);for(let t of this._root.querySelectorAll(`*`))isScroller(t)&&e.add(t);for(let t of this._shaded)e.has(t)||this._clear(t);this._shaded=e;for(let t of e)this._update(t)}_clear(e){e.classList.remove(it,...Xe,...at),e.style.removeProperty(N)}_update(e){e.classList.add(it);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of Xe){let r=(n!==`undershoot-top`||this._undershootEdges.top)&&(n!==`undershoot-bottom`||this._undershootEdges.bottom);e.classList.toggle(n,r&&t.includes(n))}}_onScroll=e=>{let t=e.target;t instanceof HTMLElement&&this._shaded.has(t)&&this._update(t)};_onWheel=e=>{let t=e.target instanceof HTMLElement?this._scrollerFor(e.target):null;if(!t)return;let{vertical:n}=adjustmentsOf(t);if(!n)return;let r=this._unclamped.get(t)??n.value,i=accumulateOvershoot(overshootDistance(r,n)===0?n.value:r,wheelDeltaPx(e,n.pageSize),n);this._unclamped.set(t,i),this._applyOvershoot(t,overshootDistance(i,n)),clearTimeout(this._settleTimers.get(t)),this._settleTimers.set(t,setTimeout(()=>{this._unclamped.set(t,t.scrollTop),this._applyOvershoot(t,0)},50))};_applyOvershoot(e,t){e.classList.toggle(`overshoot-top`,t<0),e.classList.toggle(`overshoot-bottom`,t>0),t===0?e.style.removeProperty(N):e.style.setProperty(N,`${Math.abs(t)}px`),this._onOvershoot?.(t)}_scrollerFor(e){for(let t=e;t;t=t.parentElement){if(this._shaded.has(t))return t;if(t===this._root)break}return null}};const F={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0};({...F}),{...F},{...F},{...F},{...F},{...F},{...F};const withDay=e=>{let t=Array.from({length:31},()=>!1);for(let n of e)t[n-1]=!0;return t};withDay([]),withDay([14]),withDay([14]),withDay([14]),withDay([]),withDay([]),withDay([1]),withDay([1]),withDay([31]),withDay([31]),withDay([]),withDay([31]);const I={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};({...I}),{...I},{...I},{...I},{...I},{...I};const L={active:!1,checked:!1,keyboardActivating:!1};({...L}),{...L},{...L},{...L},{...L},{...L};const ot=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...ot],[...ot],Math.PI*.015,Math.PI*.35,Math.PI*.015,Math.PI*.9;const attributeOf=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),st=new WeakMap;function bindSlottedChildren(e,t,n){let r=new Map,i=[],a=null;for(let e of t){let t=e.claims;e.name!==void 0&&r.set(e.name,e),t!==void 0&&i.push([t,e]),e.name===void 0&&t===void 0&&(a=e)}let o=new Set,s=null,slotFor=e=>{if(o.has(e))return null;let t=e instanceof Element?e.getAttribute(`slot`)??``:``;if(t!==``)return r.get(t)??null;for(let[t,n]of i)if(t(e))return n;return a},route=t=>{let n=slotFor(t);return n===null?null:`into`in n?(n.into.appendChild(t),n):(n.consume(t),t.parentNode===e&&e.removeChild(t),n)},c={slots:t,slotFor,install(...t){for(let t of Array.from(e.childNodes))route(t);o=new Set(t),e.replaceChildren(...t),s?.disconnect(),s=new MutationObserver(t=>{for(let r of t)if(r.target===e)for(let e of r.addedNodes){let t=route(e);t!==null&&n?.(e,t)}}),s.observe(e,{childList:!0})}};return st.set(e,c),c}function booleanAttribute$2(e,t){return e===null?t:e!==`false`}__name(booleanAttribute$2,`booleanAttribute`);const R=`adw-icon--`;var GtkImage=class extends HTMLElement{static get observedAttributes(){return[`icon-name`,`size`]}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get resolvedIconName(){return normalizeIconName(this.getAttribute(`icon-name`))}get size(){let e=Number.parseFloat(this.getAttribute(`size`)??``);return Number.isFinite(e)&&e>0?e:null}set size(e){e===null?this.removeAttribute(`size`):this.setAttribute(`size`,String(e))}connectedCallback(){this._render()}attributeChangedCallback(){this._render()}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(R));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${R}image-missing`):this.classList.add(`${R}${t}`),this.setAttribute(`aria-hidden`,`true`);let n=this.size;if(n===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${n}px`;this.style.width=e,this.style.height=e,this.style.setProperty(`mask-size`,e),this.style.setProperty(`-webkit-mask-size`,e)}}};function createGtkImage(e,...t){let n=document.createElement(`gtk-image`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`gtk-image`,GtkImage);const ct=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);var AdwModalSurface=class{_init;_previouslyFocused=null;constructor(e){this._init=e,e.surface.setAttribute(`role`,e.role),e.surface.setAttribute(`aria-modal`,`true`),e.surface.hasAttribute(`tabindex`)||(e.surface.tabIndex=-1),e.host.addEventListener(`keydown`,e=>this._onKeyDown(e))}focusables(){return Array.from(this._init.surface.querySelectorAll(ct)).filter(e=>!e.hasAttribute(`disabled`)&&!e.hidden&&e.getClientRects().length>0)}present(){let e=document.activeElement;this._previouslyFocused=e instanceof HTMLElement&&e!==this._init.host?e:null;let t=this.focusables(),n=this._init.initialFocus?.(t);((n&&t.includes(n)?n:void 0)??t[0]??this._init.surface).focus()}dismiss(){let e=this._previouslyFocused;this._previouslyFocused=null,e&&e.isConnected&&e.focus()}_onKeyDown(e){if(!this._init.isOpen())return;if(e.key===`Escape`){e.stopPropagation(),this._init.onEscape();return}if(e.key!==`Tab`)return;e.stopPropagation();let t=this.focusables();if(t.length===0){e.preventDefault(),this._init.surface.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||i===this._init.surface||i===this._init.host)?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||i===this._init.host)&&(e.preventDefault(),n.focus())}};function rowLabel(e){return stripMnemonic(u[e])}var AdwAboutDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_sheetEl;_modal;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-url`,`open`]}get applicationName(){return this.getAttribute(`application-name`)??``}set applicationName(e){this.setAttribute(`application-name`,e)}get applicationIcon(){return this.getAttribute(`application-icon`)??``}set applicationIcon(e){this.setAttribute(`application-icon`,e)}get developerName(){return this.getAttribute(`developer-name`)??``}set developerName(e){this.setAttribute(`developer-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get supportUrl(){return this.getAttribute(`support-url`)??``}set supportUrl(e){this.setAttribute(`support-url`,e)}get issueUrl(){return this.getAttribute(`issue-url`)??``}set issueUrl(e){this.setAttribute(`issue-url`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get developers(){return this._developers}set developers(e){this._developers=[...e],this._initialized&&this._render()}get designers(){return this._designers}set designers(e){this._designers=[...e],this._initialized&&this._render()}get artists(){return this._artists}set artists(e){this._artists=[...e],this._initialized&&this._render()}get documenters(){return this._documenters}set documenters(e){this._documenters=[...e],this._initialized&&this._render()}present(){this.open=!0}close(){this.open=!1}connectedCallback(){this._initialized||(this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-about-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this.close()),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-about-dialog-sheet`,this._sheetEl.setAttribute(`aria-label`,u.dialogTitle),this.replaceChildren(this._scrimEl,this._sheetEl),this._modal=new AdwModalSurface({host:this,surface:this._sheetEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this.close()}),this._render())}attributeChangedCallback(e,t,n){if(this._initialized&&t!==n){if(e===`open`){this._syncOpen(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open||this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}));return}this._render()}}_syncOpen(){this.classList.toggle(`open`,this.open),this.open?(this._navView.replace?.([`main`]),this._scrollEl.scrollTop=0,this._updateHeaderTitle(),this._modal.present()):this._modal.dismiss()}_creditsSections(){return creditsSections({developers:this._developers,designers:this._designers,artists:this._artists,documenters:this._documenters})}_hasLegal(){let e=this.license.length>0?o.CUSTOM:o.UNKNOWN;return legalSectionVisible(this.copyright,e,this.license)}_render(){let e=this._creditsSections(),t=aboutDialogVisibility({applicationIcon:this.applicationIcon,applicationName:this.applicationName,developerName:this.developerName,version:this.version,comments:this.comments,website:this.website,supportUrl:this.supportUrl,issueUrl:this.issueUrl,hasCredits:e.length>0,hasLegal:this._hasLegal()});this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(t)),t.detailsRow&&this._navView.append(this._buildDetailsPage(t)),t.creditsRow&&this._navView.append(this._buildCreditsPage(e)),t.legalRow&&this._navView.append(this._buildLegalPage()),this._sheetEl.replaceChildren(this._navView),this.classList.toggle(`open`,this.open)}_buildPage(e,t,n,r=t){let i=document.createElement(`adw-navigation-page`);i.setAttribute(`title`,t),i.setAttribute(`tag`,e);let a=document.createElement(`adw-header-bar`);if(a.setAttribute(`title`,r),n){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-button flat circular adw-about-dialog-close`,e.setAttribute(`aria-label`,`Close`),e.addEventListener(`click`,()=>this.close());let endApply=()=>{let t=a.endSection??null;t&&t.appendChild(e)};queueMicrotask(endApply)}let o=document.createElement(`div`);o.className=`adw-about-dialog-scroll`;let s=document.createElement(`div`);s.className=`adw-about-dialog-clamp`;let c=document.createElement(`div`);c.className=`adw-about-dialog-page-body`,s.appendChild(c),o.appendChild(s);let l=document.createElement(`div`);return l.className=`adw-about-dialog-toolbar-view`,l.append(a,o),i.appendChild(l),e===`main`&&(this._scrollEl=o,this._mainToolbarEl=l,l.classList.add(`main-page`),o.addEventListener(`scroll`,()=>this._updateHeaderTitle())),{page:i,body:c,header:a}}_buildMainPage(e){let{page:t,body:n}=this._buildPage(`main`,u.dialogTitle,!0,this.applicationName);if(e.appIcon&&n.appendChild(createGtkImage(this.applicationIcon,`adw-about-dialog-icon`)),e.appName){let e=document.createElement(`span`);e.className=`adw-about-dialog-name`,e.textContent=this.applicationName,n.appendChild(e)}if(e.developerName){let e=document.createElement(`span`);e.className=`adw-about-dialog-developer`,e.textContent=this.developerName,n.appendChild(e)}if(e.version){let e=document.createElement(`span`);e.className=`adw-about-dialog-version`,e.textContent=this.version,n.appendChild(e)}let r=[];e.detailsRow&&r.push(this._buildNavRow(rowLabel(`detailsRow`),`details`)),e.websiteRow&&r.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website));let i=[];e.supportRow&&i.push(this._buildLinkRow(rowLabel(`supportRow`),this.supportUrl)),e.issueRow&&i.push(this._buildLinkRow(rowLabel(`issueRow`),this.issueUrl));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.detailsGroup&&n.appendChild(this._buildGroup(`details`,r)),e.supportGroup&&n.appendChild(this._buildGroup(`support`,i)),e.creditsLegalGroup&&n.appendChild(this._buildGroup(`credits-legal`,a)),t}_buildGroup(e,t,n){let r=document.createElement(`adw-preferences-group`);e!==null&&r.setAttribute(`data-group`,e),n!==void 0&&r.setAttribute(`title`,n);for(let e of t)r.appendChild(e);let i=document.createElement(`div`);return i.className=`adw-about-dialog-rows`,i.appendChild(r),i}_buildNavRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>{this._navView.push?.(t)}),n}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}_buildDetailsPage(e){let{page:t,body:n}=this._buildPage(`details`,u.detailsPage,!1);if(e.commentsLabel){let e=document.createElement(`p`);e.className=`adw-about-dialog-comments`,e.textContent=this.comments,n.appendChild(e)}if(e.linksGroup){let t=[];e.detailsWebsiteRow&&t.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website)),n.appendChild(this._buildGroup(`links`,t))}return t}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``),n.classList.add(`adw-about-dialog-link-row`);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>this._activateLink(t)),n}_buildCreditsPage(e){let{page:t,body:n}=this._buildPage(`credits`,u.creditsPage,!1);for(let t of e){let e=t.people.map(e=>this._buildCreditRow(e));n.appendChild(this._buildGroup(null,e,t.title??void 0))}return t}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;t.setAttribute(`activatable`,``),t.classList.add(`adw-about-dialog-link-row`);let r=createGtkImage(`go-next`,`adw-about-dialog-chevron`);r.setAttribute(`slot`,`suffix`),t.appendChild(r),t.addEventListener(`activated`,()=>this._activateLink(n))}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,u.legalPage,!1);if(this.copyright){let e=document.createElement(`p`);e.className=`adw-about-dialog-copyright`,e.textContent=this.copyright,t.appendChild(e)}if(this.license){let e=document.createElement(`p`);if(e.className=`adw-about-dialog-license`,this.licenseUrl){let t=document.createElement(`a`);t.href=this.licenseUrl,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(this.licenseUrl)}),e.appendChild(t)}else e.textContent=this.license;t.appendChild(e)}return e}_updateHeaderTitle(){!this._scrollEl||!this._mainToolbarEl||this._mainToolbarEl.classList.toggle(`scrolled`,this._scrollEl.scrollTop>0)}};customElements.define(`adw-about-dialog`,AdwAboutDialog);function bindEmptySections(...e){let derive=()=>{for(let t of e)t.hidden=t.childElementCount===0},t=new MutationObserver(derive);for(let n of e)t.observe(n,{childList:!0});derive()}function applyRowTooltip(e,t){let n=e.getAttribute(`tooltip-text`)??``;for(let e of t)n?(e.getAttribute(`title`)!==n&&e.setAttribute(`title`,n),e.hasAttribute(z)||e.setAttribute(z,``)):(e.removeAttribute(`title`),e.removeAttribute(z))}const z=`data-row-tooltip`;function attachRowActivation(e){let{row:t,activatable:n}=e,r=e.activate??(()=>t.click());t.addEventListener(`keydown`,e=>{e.target===t&&n()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r()))});let sync=()=>{n()?t.tabIndex=0:t.removeAttribute(`tabindex`)};return sync(),{sync}}function applyRowLineClamp(e){let{titleEl:t,subtitleEl:n,textContainerEl:r,getTitleLines:i,getSubtitleLines:a}=e,o=i(),s=a(),c=o>0,l=s>0,u=c||l;r.classList.toggle(`adw-row-clamp`,u),c?t.style.setProperty(`--adw-row-title-lines`,String(o)):t.style.removeProperty(`--adw-row-title-lines`),l?n.style.setProperty(`--adw-row-subtitle-lines`,String(s)):n.style.removeProperty(`--adw-row-subtitle-lines`),u?r.style.setProperty(`--adw-row-ellipsize-overflow`,`ellipsis`):r.style.removeProperty(`--adw-row-ellipsize-overflow`)}function parseRowLinesAttribute(e){if(e===null||e===``)return 0;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}const lt=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends HTMLElement{_titleEl;_subtitleEl;_suffixEl;_prefixEl;_textEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;_activation;static get observedAttributes(){return[`title`,`subtitle`,`activatable`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}get activatableWidget(){return this._state.activatableWidget}set activatableWidget(e){this._state.setActivatableWidget(e,e?isSensitive(e):!0)&&(this._observeSensitivity(e),this._syncActivatable())}get activatable(){return this._state.activatable}connectedCallback(){if(this._initialized){this._observeSensitivity(this._state.activatableWidget);return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),bindEmptySections(this._prefixEl,this._suffixEl),this._adoptAttributes(),this._render(),this.addEventListener(`click`,e=>this._onClick(e)),this._activation=attachRowActivation({row:this,activatable:()=>this._state.activatable})}_adoptAttributes(){this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._state.setActivatable(this.hasAttribute(`activatable`)),this._applyLineClamping()}disconnectedCallback(){this._sensitivityObserver?.disconnect(),this._sensitivityObserver=null}attributeChangedCallback(){this._initialized&&(this._adoptAttributes(),this._render())}_onClick(e){if(!this._state.activatable)return;let t=this._state.activate();t&&e.target instanceof Node&&t.contains(e.target)||(t?.click(),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0})))}_observeSensitivity(e){if(this._sensitivityObserver?.disconnect(),!e){this._sensitivityObserver=null;return}this._sensitivityObserver??=new MutationObserver(()=>{let e=this._state.activatableWidget;e&&this._state.setActivatableWidgetSensitive(isSensitive(e))&&this._syncActivatable()}),this._sensitivityObserver.observe(e,{attributeFilter:lt})}_syncActivatable(){this.toggleAttribute(`activatable`,this._state.activatable),this._initialized&&this._render()}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r,this.classList.toggle(`activatable`,this._state.activatable),applyRowTooltip(this,[this._prefixEl,this._textEl,this._suffixEl]),this._activation?.sync()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-action-row`,AdwActionRow);var AdwAlertResponse=class extends HTMLElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_modal;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;static get observedAttributes(){return[`heading`,`body`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`open`,`prefer-wide-layout`]}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,e)}get body(){return this.getAttribute(`body`)??``}set body(e){this.setAttribute(`body`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get headingUseMarkup(){return this.hasAttribute(`heading-use-markup`)}set headingUseMarkup(e){e?this.setAttribute(`heading-use-markup`,``):this.removeAttribute(`heading-use-markup`)}get bodyUseMarkup(){return this.hasAttribute(`body-use-markup`)}set bodyUseMarkup(e){e?this.setAttribute(`body-use-markup`,``):this.removeAttribute(`body-use-markup`)}get preferWideLayout(){return this.hasAttribute(`prefer-wide-layout`)}set preferWideLayout(e){e?this.setAttribute(`prefer-wide-layout`,``):this.removeAttribute(`prefer-wide-layout`)}get defaultResponse(){return this._model.defaultResponse}set defaultResponse(e){this.setDefaultResponse(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.setCloseResponse(e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-alert-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._dismiss()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-alert-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`alertdialog`,isOpen:()=>this.open,onEscape:()=>this._dismiss(),initialFocus:e=>this._initialFocusTarget(e)});let e=document.createElement(`div`);e.className=`adw-alert-dialog-message`,this._headingEl=document.createElement(`h2`),this._headingEl.className=`adw-alert-dialog-heading`,this._bodyEl=document.createElement(`p`),this._bodyEl.className=`adw-alert-dialog-body`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-alert-dialog-child`,e.append(this._headingEl,this._bodyEl,this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{into:this._childEl}]).install(this._scrimEl,this._dialogEl),bindEmptySections(this._childEl),this._model.heading=this.heading,this._model.body=this.body;let t=this.getAttribute(`close-response`);t!==null&&(this._model.closeResponse=t),this._model.defaultResponse=this.getAttribute(`default-response`),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.addResponse(t,(e.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(t,n),booleanAttribute$2(e.getAttribute(`enabled`),!0)||this.setResponseEnabled(t,!1)}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`heading`?(this._model.heading=this.heading,this.dispatchEvent(new CustomEvent(`notify::heading`,{bubbles:!0,detail:{heading:this.heading}}))):e===`body`?(this._model.body=this.body,this.dispatchEvent(new CustomEvent(`notify::body`,{bubbles:!0,detail:{body:this.body}}))):e===`close-response`?n!==null&&this.setCloseResponse(n):e===`default-response`?this.setDefaultResponse(n):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._modal.dismiss()))}present(e){this.open=!0}addResponse(e,t){if(this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to add a response with id '${e}', but such a response already exists`);return}let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button adw-alert-dialog-response`,n.textContent=t,n.addEventListener(`click`,()=>this._activateResponse(e)),this._model.addResponse(e,t),this._buttons.set(e,n),this._responseAreaEl&&this._responseAreaEl.appendChild(n),this._render()}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}removeResponse(e){if(!this._model.hasResponse(e))return;this._buttons.get(e)?.remove(),this._buttons.delete(e);let t=this._model.responses.filter(t=>t.id!==e),n=new AdwAlertResponses(this._model.heading,this._model.body);for(let e of t)n.addResponse(e.id,e.label,{appearance:e.appearance,enabled:e.enabled});n.closeResponse=this._model.closeResponse,n.defaultResponse=this._model.defaultResponse===e?null:this._model.defaultResponse,this._model=n,this._render()}hasResponse(e){return this._model.hasResponse(e)}getResponseLabel(e){return this._model.responses.find(t=>t.id===e)?.label??null}setResponseLabel(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}getResponseAppearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}setResponseAppearance(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseAppearance(e,t),n.classList.toggle(`suggested-action`,t===`suggested`),n.classList.toggle(`destructive-action`,t===`destructive`))}getResponseEnabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}setResponseEnabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}setDefaultResponse(e){this._model.defaultResponse=e,this._render()}setCloseResponse(e){this._model.closeResponse=e}_activateResponse(e){this._model.getResponseEnabled(e)&&(this._blockCloseResponse=!0,this.open=!1,this._blockCloseResponse=!1,this._emitResponse(this._model.resolveById(e)))}_dismiss(){this.open&&(this.open=!1,!this._blockCloseResponse&&this._emitResponse(this._model.resolveById(null)))}_emitResponse(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{response:e}}))}_initialFocusTarget(e){return e.find(e=>this._childEl.contains(e))??this._defaultResponseButton()}_defaultResponseButton(){let e=this._model.defaultResponse,t=this._model.responses.find(e=>e.enabled)?.id;return(e!==null&&this._model.getResponseEnabled(e)?this._buttons.get(e):void 0)??(t?this._buttons.get(t):void 0)}_render(){this.classList.toggle(`open`,this.open);let e=this.heading;this.headingUseMarkup?this._headingEl.innerHTML=e:this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?this._bodyEl.innerHTML=t:this._bodyEl.textContent=t,this._bodyEl.hidden=t.length===0;let n=this.preferWideLayout&&this._model.responses.length<=2;this._responseAreaEl.classList.toggle(`horizontal`,n);let r=this._model.defaultResponse;for(let e of this._model.responses){let t=e.id===r&&e.appearance==="default";this._buttons.get(e.id)?.classList.toggle(`default-response`,t)}}};customElements.define(`adw-alert-response`,AdwAlertResponse),customElements.define(`adw-alert-dialog`,AdwAlertDialog);var AdwWindow=class extends HTMLElement{_initialized=!1;_contentEl;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];static get observedAttributes(){return[`width`,`height`,`default-width`,`default-height`]}get contentArea(){return this._contentEl}get content(){return this._contentEl.firstElementChild}set content(e){e&&this._contentEl.appendChild(e)}get breakpoints(){return this._breakpoints}get currentBreakpoint(){return this._breakpoints.find(e=>e.applied)??null}get dialogs(){return this._openDialogs=this._openDialogs.filter(e=>e.isConnected),this._openDialogs}get visibleDialog(){let e=this.dialogs;return e.length>0?e[e.length-1]:null}addBreakpoint(e){let t=new AdwBreakpoint(e,{onApply:()=>this.dataset.breakpoint=e,onUnapply:()=>{this.dataset.breakpoint===e&&delete this.dataset.breakpoint}});return this._breakpoints.push(t),this._bindBreakpoints(),t}connectedCallback(){this._buildOnce(),this._bindBreakpoints()}disconnectedCallback(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}attributeChangedCallback(e){(e===`width`||e===`height`||e===`default-width`||e===`default-height`)&&this._applySizeRequest()}_buildOnce(){this._initialized||(this._initialized=!0,this._applySizeRequest(),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-window-content`,bindSlottedChildren(this,[{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._contentEl),this.addEventListener(`notify::open`,e=>{let t=e.target;t!==this&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}_bindBreakpoints(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._initialized&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this,this._breakpoints))}_applySizeRequest(){let e=this.getAttribute(`default-width`)??this.getAttribute(`width`),t=this.getAttribute(`default-height`)??this.getAttribute(`height`);this.style.width=e?`${e}px`:`360px`,this.style.height=t?`${t}px`:`200px`}};customElements.define(`adw-window`,AdwWindow);var AdwApplicationWindow=class extends AdwWindow{_menubarEl=null;_model=[];static get observedAttributes(){return[...AdwWindow.observedAttributes,`show-menubar`,`menu-model`]}get showMenubar(){return this.hasAttribute(`show-menubar`)}set showMenubar(e){e?this.setAttribute(`show-menubar`,``):this.removeAttribute(`show-menubar`)}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),this._renderMenubar()}get menubar(){return this._menubarEl}connectedCallback(){super.connectedCallback(),this._buildMenubar()}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`))),(e===`show-menubar`||e===`menu-model`)&&this._renderMenubar()}_buildMenubar(){this._menubarEl||(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this.contentArea.prepend(this._menubarEl),this._renderMenubar())}_renderMenubar(){let e=this._menubarEl;if(e!==null){e.replaceChildren(),e.hidden=!this.showMenubar||this._model.length===0;for(let t of flattenMenu(this._model)){let n=t.node;if(n.kind===`submenu`){let t=document.createElement(`gtk-menu-button`);t.setAttribute(`menu-title`,n.label),t.menuModel=n.items,e.appendChild(t);continue}let r=document.createElement(`gtk-button`);r.setAttribute(`label`,n.label??``),r.setAttribute(`flat`,``),r.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t.path]}}))}),e.appendChild(r)}}}};customElements.define(`adw-application-window`,AdwApplicationWindow);var AdwAvatar=class extends HTMLElement{_textEl;_iconEl;_imageEl;_initialized=!1;static get observedAttributes(){return[`text`,`size`,`show-initials`,`icon`,`custom-image`]}connectedCallback(){this._initialized||(this._initialized=!0,this._textEl=document.createElement(`span`),this._textEl.className=`adw-avatar-text`,this._iconEl=createGtkImage(null,`adw-avatar-icon`),this._imageEl=document.createElement(`img`),this._imageEl.className=`adw-avatar-custom-image`,this._imageEl.alt=``,this.replaceChildren(this._textEl,this._iconEl,this._imageEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=parseFloat(this.getAttribute(`size`)||`48`);this.style.width=`${e}px`,this.style.height=`${e}px`;let t=this.getAttribute(`text`)??``,n=this.getAttribute(`custom-image`)??``,r=avatarMode({hasCustomImage:n.length>0,showInitials:this.hasAttribute(`show-initials`),text:t});if(this._imageEl.hidden=r!==`image`,r===`image`)this._imageEl.getAttribute(`src`)!==n&&(this._imageEl.src=n),this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.hidden=!0;else if(r===`initials`){let{fg:n,start:r,stop:i}=avatarColor(t);this.style.backgroundImage=`linear-gradient(${r}, ${i})`,this.style.color=n,this._textEl.textContent=avatarInitials(t),this._textEl.hidden=!1,this._iconEl.hidden=!0,this._applyFontSize(e)}else this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.iconName=this.getAttribute(`icon`)??`avatar-default`,this._iconEl.size=avatarIconSize(e),this._iconEl.hidden=!1}_applyFontSize(e){let t=avatarMaxFontSize(e);this._textEl.style.fontSize=`${t}px`;let{width:n,height:r}=this._textEl.getBoundingClientRect();this._textEl.style.fontSize=`${avatarFontSize(e,{width:n,height:r})}px`}};customElements.define(`adw-avatar`,AdwAvatar);var AdwBanner=class extends HTMLElement{_titleEl;_button;_initialized=!1;static get observedAttributes(){return[`title`,`button-label`,`revealed`,`use-markup`,`button-style`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-banner-title`,this._button=document.createElement(`button`),this._button.className=`adw-banner-button`,this._button.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`button-clicked`,{bubbles:!0}))}),this.replaceChildren(this._titleEl,this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.getAttribute(`title`)??``;this.hasAttribute(`use-markup`)?this._titleEl.innerHTML=e:this._titleEl.textContent=e;let t=this.getAttribute(`button-label`)??``;this._button.textContent=bannerButtonText(t),this._button.hidden=!bannerButtonVisible(t);let n=bannerButtonStyleClasses(parseBannerButtonStyle(this.getAttribute(`button-style`)));for(let e of ne)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends HTMLElement{_observer=null;get child(){return this.lastElementChild}set child(e){this.setChild(e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._enforceSingleChild(),this._observer??=new MutationObserver(()=>this._enforceSingleChild()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){this._observer?.disconnect()}_enforceSingleChild(){let e=this.lastElementChild;if(e!==null)for(let t of Array.from(this.children)){if(t===e)break;t.remove()}}setChild(e){if(e!==null&&e.parentElement!==null&&e.parentElement!==this)throw Error(`AdwBin.setChild: the child already has a parent.`);if(e===this.child)return;let t=this.child;e===null?t?.remove():this.replaceChildren(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}}))}};customElements.define(`adw-bin`,AdwBin);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheetBottomBar=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_sheetBodyEl;_bottomBarEl;_dragHandleEl;_pendingBottomBar=null;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`can-open`,`reveal-bottom-bar`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._state.modal}set modal(e){this._setBoolAttr(`modal`,e)}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get canOpen(){return this._state.canOpen}set canOpen(e){this._setBoolAttr(`can-open`,e)}get revealBottomBar(){return this._state.revealBottomBar}set revealBottomBar(e){this._setBoolAttr(`reveal-bottom-bar`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}get bottomBar(){return this._initialized?this._bottomBarEl.firstChild:this._pendingBottomBar}setBottomBar(e){if(this._state.setHasBottomBar(e!==null),!this._initialized){this._pendingBottomBar=e;return}e?this._bottomBarEl.replaceChildren(e):this._bottomBarEl.replaceChildren(),this._render()}requestOpen(e){return this._state.requestOpen(e)}requestClose(e){let t=this._state.requestClose(e);return t===`close-attempt`?this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0})):t===`delegate`&&this.dispatchEvent(new CustomEvent(`sheet.close`,{bubbles:!0})),t}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`,this._dimmingEl=document.createElement(`div`),this._dimmingEl.className=`adw-bottom-sheet-dimming`,this._dimmingEl.addEventListener(`click`,()=>this.requestClose(`dimming`)),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-bottom-sheet-sheet`,this._dragHandleEl=document.createElement(`div`),this._dragHandleEl.className=`adw-bottom-sheet-drag-handle`,this._dragHandleEl.setAttribute(`aria-hidden`,`true`),this._sheetBodyEl=document.createElement(`div`),this._sheetBodyEl.className=`adw-bottom-sheet-sheet-body`,this._bottomBarEl=document.createElement(`button`),this._bottomBarEl.type=`button`,this._bottomBarEl.className=`adw-bottom-sheet-bottom-bar`,this._bottomBarEl.addEventListener(`click`,()=>this.requestOpen(`bottom-bar`)),this._sheetEl.append(this._bottomBarEl,this._dragHandleEl,this._sheetBodyEl);let layer=(e,t)=>({claims:t=>t instanceof Element&&t.localName===e,consume:e=>{for(let n of Array.from(e.childNodes))t.appendChild(n)}});bindSlottedChildren(this,[{name:`sheet`,into:this._sheetBodyEl},{name:`bottom-bar`,into:this._bottomBarEl},{name:`content`,into:this._contentEl},layer(`adw-bottom-sheet-sheet`,this._sheetBodyEl),layer(`adw-bottom-sheet-bottom-bar`,this._bottomBarEl),layer(`adw-bottom-sheet-content`,this._contentEl),{into:this._contentEl}],(e,t)=>{!(`into`in t)||t.into!==this._bottomBarEl||(this._state.setHasBottomBar(!0),this._render())}).install(this._contentEl,this._dimmingEl,this._sheetEl),this._pendingBottomBar&&this._bottomBarEl.replaceChildren(this._pendingBottomBar),this._pendingBottomBar=null,this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(!this.open&&!this._sheetEl.contains(e.target)||(e.stopPropagation(),this.requestClose(`escape`)))}),this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._state.setCanOpen(this._boolAttr(`can-open`,!0)),this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._state.setHasBottomBar(this._bottomBarEl.childNodes.length>0),this._state.setOpen(this._boolAttr(`open`,!1)),this._state.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}),this._render()}attributeChangedCallback(e,t,n){if(!this._reflecting&&t!==n){if(e===`open`){this._state.setOpen(this._boolAttr(`open`,!1));return}e===`modal`&&this._state.setModal(this._boolAttr(`modal`,!0)),e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),e===`can-open`&&this._state.setCanOpen(this._boolAttr(`can-open`,!0)),e===`reveal-bottom-bar`&&this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open,t=this._state.chrome,n=t.layer===`bottom-bar`;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this._state.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this.classList.toggle(`showing-bottom-bar`,n&&t.surfaceVisible),this._dimmingEl.classList.toggle(`visible`,t.dimmed),this._bottomBarEl.hidden=!n,this._bottomBarEl.classList.toggle(`inert`,t.bottomBarInert),this._sheetBodyEl.hidden=n,this._dragHandleEl.hidden=!this.showDragHandle||n}_reflectOpen(e){this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1}_boolAttr(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBoolAttr(e,t){t?this.setAttribute(e,``):this.setAttribute(e,`false`)}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet-bottom-bar`,AdwBottomSheetBottomBar),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);function parseBreakpoints(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return console.error("<adw-breakpoint-bin>: `breakpoints` is not JSON; no breakpoint is applied."),[]}return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{condition:t,setters:n}=e;return typeof t==`string`?[{condition:t,setters:Array.isArray(n)?n:[]}]:[]}):[]}var AdwBreakpointBin=class extends HTMLElement{_state=new BreakpointBinState;_dispose;_applied=null;_pendingSync=!1;_originals=new Map;static get observedAttributes(){return[`breakpoints`]}get currentBreakpoint(){return this._state.current}get currentBreakpointAttribute(){let e=this._state.current;return e===null?null:String(e)}get child(){return this.firstElementChild}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._syncSizing(),this._pendingSync=!0,this._observe()}disconnectedCallback(){this._dispose?.(),this._dispose=void 0}attributeChangedCallback(e){e!==`breakpoints`||!this.isConnected||(this._originals.clear(),this._syncBreakpoints())}_syncBreakpoints(){this._pendingSync=!1;let e=parseBreakpoints(this.getAttribute(`breakpoints`));this._state=new BreakpointBinState;for(let t of e){let e=[];for(let n of t.setters){if(typeof n?.target!=`string`||typeof n.property!=`string`)continue;let t=this.querySelector(n.target);if(t===null)continue;let r=`${n.target}\u0000${n.property}\u0000${n.value}`;this._originals.has(r)||this._originals.set(r,t.getAttribute(n.property)),e.push({object:t,property:n.property,value:n.value,originalValue:this._originals.get(r)??null})}this._state.add({condition:t.condition,setters:e})}this._state.inherit(this._applied),this._state.setHasChild(this.child!==null),this._write(this._state.current),this._syncSizing()}_observe(){this._dispose?.(),this._dispose=observeAdaptiveSize(this,e=>{this._pendingSync&&this._syncBreakpoints(),this._state.setHasChild(this.child!==null);let t=this._state.evaluate(e);t!==null&&(this._emit(t.from,`breakpoint-unapply`),this._perform(t.writes),this._write(t.to),this._emit(t.to,`breakpoint-apply`),this.dispatchEvent(new CustomEvent(`notify::current-breakpoint`,{bubbles:!0,detail:{currentBreakpoint:this.currentBreakpointAttribute}})))})}_perform(e){for(let t of e)t.value===null?t.object.removeAttribute(t.property):t.object.setAttribute(t.property,String(t.value))}_write(e){this._applied=e}_emit(e,t){e!==null&&this.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:{index:e}}))}_syncSizing(){let e=this._state.length>0;this.style.minWidth=e?`0px`:``,this.style.minHeight=e?`0px`:``,e&&(this.style.overflow=`hidden`)}};customElements.define(`adw-breakpoint-bin`,AdwBreakpointBin);var AdwButtonContent=class extends HTMLElement{_boxEl;_iconEl;_labelEl;_initialized=!1;_styledHost=null;static get observedAttributes(){return[`icon-name`,`label`,`use-underline`,`can-shrink`]}connectedCallback(){this._initialized||(this._initialized=!0,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-button-content-box`,this._iconEl=createGtkImage(null),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-button-content-label`,this._boxEl.append(this._iconEl,this._labelEl),this.replaceChildren(this._boxEl),this._render()),this._root()}disconnectedCallback(){this._unroot()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}_hostButton(){let e=this.parentElement?.closest(`button, .adw-button`)??null;if(!e)return null;let t=e.parentElement;return t?.matches(`adw-split-button, .adw-split-button`)?t:e}_root(){let e=this._hostButton();e!==this._styledHost&&(this._unroot(),e&&(e.classList.add(oe),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(oe),this._styledHost=null}_render(){this._iconEl.iconName=buttonContentIconName(this.getAttribute(`icon-name`)??``),this._iconEl.hidden=!1;let e=this.getAttribute(`label`)??``;this._labelEl.textContent=buttonContentLabelText(e,this.hasAttribute(`use-underline`)),this._labelEl.hidden=e.length===0,this.classList.toggle(`can-shrink`,this.hasAttribute(`can-shrink`))}};customElements.define(`adw-button-content`,AdwButtonContent);var AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`,`tooltip-text`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createGtkImage(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createGtkImage(null,`end`),this._contentsEl.append(this._startIconEl,this._titleEl,this._endIconEl),this.replaceChildren(this._contentsEl),this._initialized=!0,this._render(),this.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0}))}),attachRowActivation({row:this,activatable:()=>!0}))}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._state.setTitle(this.getAttribute(`title`)),this._state.setStartIconName(this.getAttribute(`start-icon-name`)),this._state.setEndIconName(this.getAttribute(`end-icon-name`));let e=this._state.state;this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._paintIcon(this._startIconEl,e.startIconName,e.startIconVisible),this._paintIcon(this._endIconEl,e.endIconName,e.endIconVisible),this.classList.toggle(`activatable`,!0),applyRowTooltip(this,[this._contentsEl])}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);function attachSwipeDrag(e){let t=new SwipeTracker({points:e.points,allowLongSwipes:e.allowLongSwipes,cancelProgress:e.cancelProgress}),n=null,r=0,i=0,a=0,o=0,s=0,c=`none`,l=null,u=!1,axisOffset=(t,n)=>e.orientation===`vertical`?n:t,progressOffset=(e,t)=>-axisOffset(e,t),release=()=>{let r=n;n=null,c=`none`,t.reset(),globalThis.removeEventListener(`pointermove`,onMove,!0),globalThis.removeEventListener(`pointerup`,onFinish,!0),globalThis.removeEventListener(`pointercancel`,onCancel,!0),globalThis.removeEventListener(`lostpointercapture`,onLostCapture,!0),r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),l!==null&&(e.host.style.scrollSnapType=l.scrollSnapType,e.host.style.scrollBehavior=l.scrollBehavior,e.host.style.userSelect=l.userSelect,l=null)},claimAllowed=t=>{let n=e.points();if(n.length===0)return!1;let a=n[0],c=n[n.length-1];if(Math.abs(a-c)<2**-52)return!1;let l=e.progress(),u=t<0&&(Math.abs(l-a)<2**-52||l<a),d=t>0&&(Math.abs(l-c)<2**-52||l>c);return u||d?!1:e.claimable===void 0?!0:e.claimable({x:r,y:i})||e.claimable({x:o,y:s})},claim=()=>{c=`scrolling`,n!==null&&e.host.setPointerCapture(n),l={scrollSnapType:e.host.style.scrollSnapType,scrollBehavior:e.host.style.scrollBehavior,userSelect:e.host.style.userSelect},e.host.style.scrollSnapType=`none`,e.host.style.scrollBehavior=`auto`,e.host.style.userSelect=`none`},arm=()=>{globalThis.addEventListener(`pointermove`,onMove,!0),globalThis.addEventListener(`pointerup`,onFinish,!0),globalThis.addEventListener(`pointercancel`,onCancel,!0),globalThis.addEventListener(`lostpointercapture`,onLostCapture,!0)};e.host.addEventListener(`pointerdown`,t=>{if(u=!1,n!==null){if(t.pointerId!==n)return;release()}t.pointerType!==`mouse`||t.button!==0||e.enabled()&&t.target?.closest(`select, textarea, input[type="range"], [contenteditable=""], [contenteditable="true"]`)===null&&(n=t.pointerId,r=t.clientX,i=t.clientY,o=t.clientX,s=t.clientY,a=0,c=`pending`,arm())});function onMove(l){if(n!==l.pointerId)return;o=l.clientX,s=l.clientY;let u=l.clientX-r,d=l.clientY-i,f=progressOffset(u,d),p=f-a;a=f;let m=Math.trunc(l.timeStamp);if(t.record(p,m),!(l.buttons&1)){release();return}if(c===`pending`){if(Math.abs(d)>Math.abs(u)!=(e.orientation===`vertical`)){release();return}if(Math.hypot(u,d)<16)return;if(!claimAllowed(f)){release();return}t.prepare(e.progress()),claim(),a=f;return}c===`scrolling`&&(l.preventDefault(),e.onUpdate(t.advance(p,e.pitch())))}function finish(r,i){if(n!==r.pointerId)return;if(c!==`scrolling`){release();return}i&&t.cancel();let{to:a,velocity:o}=t.end(Math.trunc(r.timeStamp));release(),u=!0,e.onEnd(a,o)}function onFinish(e){finish(e,!1)}function onCancel(e){finish(e,!0)}function onLostCapture(e){finish(e,!1)}return e.host.addEventListener(`click`,e=>{u&&(u=!1,e.stopPropagation(),e.preventDefault())},{capture:!0}),{get dragging(){return c===`scrolling`}}}function wheelSource(e){if(e.deltaMode!==0)return`mouse`;let t=Math.abs(e.deltaY),n=Math.abs(e.deltaX);if(n>0&&t>0)return`touchpad`;let r=Math.max(n,t);return!Number.isInteger(r)||r<40?`touchpad`:`mouse`}var AdwCarousel=class extends HTMLElement{_state=new CarouselState({animateScroll:!0,onScrollTo:e=>this._performScroll(e)});_trackEl;_slots=new Map;_nextPageId=0;_scrollRaf=0;_initialized=!1;_pendingPosition=null;_pendingLayout;_layoutObserver;_pendingInteractive=null;_scrollTargetId=null;_drag;static get observedAttributes(){return[`allow-scroll-wheel`,`allow-mouse-drag`,`allow-long-swipes`,`interactive`,`spacing`,`position`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e)),this._state.onPageChanged(e=>{this.dispatchEvent(new CustomEvent(`page-changed`,{bubbles:!0,detail:{index:e}}))})}get nPages(){return this._state.nPages}get position(){return this._state.position}set position(e){this._scrollToPosition(e)}get currentPage(){return this._state.pageAt(this._state.position)}get allowMouseDrag(){return this._state.allowMouseDrag}set allowMouseDrag(e){this.setAttribute(`allow-mouse-drag`,e?`true`:`false`)}get allowScrollWheel(){return this._state.allowScrollWheel}set allowScrollWheel(e){this.setAttribute(`allow-scroll-wheel`,e?`true`:`false`)}get allowLongSwipes(){return this._state.allowLongSwipes}set allowLongSwipes(e){this.toggleAttribute(`allow-long-swipes`,e)}get interactive(){return this._state.interactive}set interactive(e){this.setAttribute(`interactive`,e?`true`:`false`)}get spacing(){return this._state.spacing}set spacing(e){this.setAttribute(`spacing`,String(e))}connectedCallback(){this._initialized||this._build(),this._observeLayout()}_build(){this._initialized=!0,this._trackEl=document.createElement(`div`),this._trackEl.className=`adw-carousel-track`,this._trackEl.style.setProperty(`scroll-behavior`,`smooth`),this._applyAttribute(`allow-scroll-wheel`,this.getAttribute(`allow-scroll-wheel`)),this._applyAttribute(`allow-mouse-drag`,this.getAttribute(`allow-mouse-drag`)),this._applyAttribute(`allow-long-swipes`,this.getAttribute(`allow-long-swipes`)),this._applyAttribute(`interactive`,this.getAttribute(`interactive`)),this._applyAttribute(`spacing`,this.getAttribute(`spacing`));let e=Array.from(this.children).filter(e=>e instanceof HTMLElement);this.replaceChildren(this._trackEl);for(let t of e)this._insert(t,-1);this._trackEl.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._trackEl.addEventListener(`wheel`,this._onWheel,{passive:!1}),this._drag=attachSwipeDrag({host:this._trackEl,orientation:`horizontal`,enabled:()=>this._state.interactive&&this._state.allowMouseDrag,pitch:()=>this._distance(),points:()=>this._state.snapPoints,progress:()=>this._state.position,allowLongSwipes:()=>this._state.allowLongSwipes,cancelProgress:()=>{let e=this._state.snapPoints;return e[carouselClosestSnapPoint(this._state.position,e)]??this._state.position},onUpdate:e=>{let t=this._distance();t>0&&(this._trackEl.scrollLeft=e*t)},onEnd:e=>{let t=this._distance();t>0&&this._trackEl.scrollTo({left:e*t})}}),this._applyAttribute(`position`,this.getAttribute(`position`))}attributeChangedCallback(e,t,n){this._initialized&&this._applyAttribute(e,n)}disconnectedCallback(){this._cancelPendingPosition(),this._layoutObserver?.disconnect(),this._layoutObserver=void 0}_observeLayout(){this._layoutObserver||(this._layoutObserver=new ResizeObserver(()=>{this._allocatePages()&&this._applyScrollFromModel()}),this._layoutObserver.observe(this._trackEl,{box:`border-box`}))}_applyAttribute(e,t){switch(e){case`allow-scroll-wheel`:this._state.setAllowScrollWheel(t!==`false`);return;case`allow-mouse-drag`:this._state.setAllowMouseDrag(t!==`false`);return;case`allow-long-swipes`:this._state.setAllowLongSwipes(t!==null&&t!==`false`),this._applySnapStop();return;case`interactive`:this._state.setInteractive(t!==`false`);return;case`spacing`:{let e=t===null?0:Number.parseFloat(t);Number.isFinite(e)&&this._state.setSpacing(Math.max(0,e)),this._trackEl.style.columnGap=`${this._state.spacing}px`;return}case`position`:t!==null&&this._positionWhenMeasurable(Number.parseFloat(t))}}_positionWhenMeasurable(e){if(Number.isFinite(e)){if(this._trackEl.clientWidth>0){this._cancelPendingPosition(),this._scrollInstantly(e);return}this._pendingPosition=e,!this._pendingLayout&&(this._pendingLayout=new ResizeObserver(()=>{if(this._trackEl.clientWidth<=0)return;let e=this._pendingPosition;this._cancelPendingPosition(),e!==null&&this._scrollInstantly(e)}),this._pendingLayout.observe(this._trackEl))}}_scrollInstantly(e){let t=this._trackEl.style.getPropertyValue(`scroll-behavior`);this._trackEl.style.setProperty(`scroll-behavior`,`auto`);try{this._scrollToPosition(e)}finally{t?this._trackEl.style.setProperty(`scroll-behavior`,t):this._trackEl.style.removeProperty(`scroll-behavior`)}}_cancelPendingPosition(){this._pendingLayout?.disconnect(),this._pendingLayout=void 0,this._pendingPosition=null}_scrollToPosition(e){if(!Number.isFinite(e))return;let t=this._state.pageAt(e);t>=0&&this.scrollToPage(t)}insertPage(e,t=-1){return this._initialized?this._insert(e,t):(this.appendChild(e),!0)}appendPage(e){return this.insertPage(e,-1)}prependPage(e){return this.insertPage(e,0)}removePage(e){let t=this._idOf(e);return t===null||!this._state.removePage(t)?!1:(this._state.skipReveal(t),this._syncTrack(),!0)}reorderPage(e,t){let n=this._idOf(e);return n===null||!this._state.reorderPage(n,t)?!1:(this._syncTrack(),!0)}scrollToPage(e){this._state.scrollTo(e)}navigate(e){return this._state.navigate(e)}_insert(e,t){let n=`page-${this._nextPageId++}`;if(!this._state.insertPage(n,t))return!1;let r=document.createElement(`div`);return r.className=`adw-carousel-page`,r.appendChild(e),this._slots.set(n,r),this._state.skipReveal(n),this._syncTrack(),!0}_idOf(e){for(let[t,n]of this._slots)if(n.contains(e))return t;return null}_syncTrack(){let e=this._state.ids,t=new Set(e);for(let[e,n]of this._slots)t.has(e)||(n.remove(),this._slots.delete(e));e.forEach((e,t)=>{let n=this._slots.get(e);n&&this._trackEl.children[t]!==n&&this._trackEl.insertBefore(n,this._trackEl.children[t]??null)}),this._applySnapStop(),this._allocatePages(),this._applyScrollFromModel()}_allocatePages(){let e=[...this._slots.values()];if(e.length===0)return!1;let t=e[0].getBoundingClientRect().width;this._trackEl.style.removeProperty(`padding-inline`);for(let t of e)t.style.removeProperty(`flex-basis`);let n=this._trackEl.clientWidth;if(!(n>0))return!1;let{pageSize:r,leadingInset:i}=carouselPageAllocation(n,e.map(e=>({natural:e.firstElementChild?.getBoundingClientRect().width??0})));if(!(r>0))return!1;for(let t of e)t.style.flexBasis=`${r}px`;return i>0&&(this._trackEl.style.paddingInline=`${i}px`),Math.round(r)!==Math.round(t)}_applyScrollFromModel(){let e=this._distance();e>0&&this._trackEl.scrollTo({left:this._restorePosition()*e,behavior:`instant`})}_restorePosition(){if(this._scrollTargetId===null)return this._state.position;let e=this._state.ids.indexOf(this._scrollTargetId);return e<0?this._state.position:this._state.snapPointOf(e)??this._state.position}_applySnapStop(){let e=this._state.allowLongSwipes?`normal`:`always`;for(let t of this._slots.values())t.style.setProperty(`scroll-snap-stop`,e)}_distance(){let e=this._trackEl?.firstElementChild;return e?this._state.pageDistance(e.getBoundingClientRect().width):0}_performScroll(e){if(!this._trackEl)return;let t=this._distance();t>0&&(this._pendingInteractive=e.interactive,this._scrollTargetId=this._state.ids[e.index]??null,this._trackEl.scrollTo({left:e.index*t}))}_onScroll=()=>{this._scrollRaf||=requestAnimationFrame(()=>{this._scrollRaf=0,this._updatePositionFromScroll()})};_onWheel=e=>{if(this._drag?.dragging===!0){e.preventDefault();return}this._state.handleWheel({deltaX:e.deltaX,deltaY:e.deltaY,source:wheelSource(e)})!==0&&e.preventDefault()};_updatePositionFromScroll(){let e=this._distance();if(!(e>0))return;let t=this._trackEl.scrollLeft/e;this._state.setPosition(t,this._pendingInteractive??!0)&&this._state.settleIfArrived()&&(this._pendingInteractive=null,this._scrollTargetId=null)}_onStateChange(e){if(e.reason===`n-pages`){this.dispatchEvent(new CustomEvent(`notify::n-pages`,{bubbles:!0,detail:{nPages:e.nPages}}));return}e.reason===`position`&&this.dispatchEvent(new CustomEvent(`notify::position`,{bubbles:!0,detail:{position:e.position,page:e.page,interactive:e.interactive}}))}},AdwCarouselIndicator=class extends HTMLElement{_carousel=null;_initialized=!1;static get observedAttributes(){return[`for`,`carousel`]}get carousel(){return this._carousel}set carousel(e){e!==this._carousel&&(this._detach(),this._carousel=e,this._attach())}connectedCallback(){this._initialized=!0,this._carousel||this._resolveForAttr(),this._attach(),this._render()}disconnectedCallback(){this._detach()}attributeChangedCallback(e){(e===`for`||e===`carousel`)&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`carousel`)??this.getAttribute(`for`);if(!e)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);t instanceof AdwCarousel&&(this._carousel=t)}_attach(){!this._carousel||!this._initialized||(this._carousel.addEventListener(`notify::position`,this._onChange),this._carousel.addEventListener(`notify::n-pages`,this._onChange),this._render())}_detach(){this._carousel&&(this._carousel.removeEventListener(`notify::position`,this._onChange),this._carousel.removeEventListener(`notify::n-pages`,this._onChange))}_onChange=()=>{this._render()};nPages(){return this._carousel?.nPages??0}position(){return this._carousel?.position??0}currentPage(){return this._carousel?.currentPage??-1}goTo(e){this._carousel?.scrollToPage(e)}},AdwCarouselIndicatorDots=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-dot`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}},AdwCarouselIndicatorLines=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-line`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}};function renderIndicator(e,t,n,r,i,a){if(e.childElementCount!==n){let r=[];for(let e=0;e<n;e++){let n=document.createElement(`button`);n.type=`button`,n.className=t,n.setAttribute(`aria-label`,`Page ${e+1}`),n.addEventListener(`click`,()=>a(e)),r.push(n)}e.replaceChildren(...r)}Array.from(e.children).forEach((e,t)=>{let n=Math.max(0,1-Math.abs(r-t)),a=e;a.style.setProperty(`--adw-carousel-progress`,n.toFixed(3)),a.classList.toggle(`active`,t===i),a.setAttribute(`aria-current`,t===i?`true`:`false`)})}customElements.define(`adw-carousel`,AdwCarousel),customElements.define(`adw-carousel-indicator-dots`,AdwCarouselIndicatorDots),customElements.define(`adw-carousel-indicator-lines`,AdwCarouselIndicatorLines);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._allocate()}_allocate(){let e={maximumSize:normalizeClampSize(this.getAttribute(`maximum-size`),b.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),b.tighteningThreshold),childMin:0,childNat:0},t=this.clientWidth,n=Array.from(this.children);if(t<=0){for(let e of n){e.style.maxWidth=``,e.style.marginInline=``;for(let t of x)e.classList.remove(t)}return}let{childSize:r,sizeClass:i}=clampAllocate(t,e);for(let e of n){e.style.maxWidth=`${r}px`,e.style.marginInline=`auto`;for(let t of x)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const ut={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`,`unit`,`orientation`,`hscroll-policy`,`vscroll-policy`]}get maximumSize(){return normalizeClampSize(this.getAttribute(`maximum-size`),b.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),b.tighteningThreshold)}set tighteningThreshold(e){this.setAttribute(`tightening-threshold`,String(e))}get unit(){return normalizeLengthUnit(this.getAttribute(`unit`),`sp`)}set unit(e){this.setAttribute(`unit`,e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._applyOverflow(),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._applyOverflow(),this._allocate()}_applyOverflow(){let e=this.getAttribute(`hscroll-policy`),t=this.getAttribute(`vscroll-policy`);this.style.overflowX=e===null?`auto`:ut[e]??`auto`,this.style.overflowY=t===null?`auto`:ut[t]??`auto`}_allocate(){let e=this.orientation===`vertical`,t=this.unit,n=e?this.clientHeight:this.clientWidth,r={maximumSize:adwLengthToPx(t,this.maximumSize),tighteningThreshold:adwLengthToPx(t,this.tighteningThreshold),childMin:0,childNat:0};for(let t of Array.from(this.children)){if(n<=0){t.style.maxWidth=``,t.style.maxHeight=``,t.style.marginInline=``,t.style.marginBlock=``;for(let e of x)t.classList.remove(e);continue}let{childSize:i,sizeClass:a}=clampAllocate(n,r);e?(t.style.maxWidth=``,t.style.maxHeight=`${i}px`,t.style.marginInline=``,t.style.marginBlock=`auto`):(t.style.maxWidth=`${i}px`,t.style.maxHeight=``,t.style.marginInline=`auto`,t.style.marginBlock=``);for(let e of x)t.classList.toggle(e,e===a)}}};customElements.define(`adw-clamp-scrollable`,AdwClampScrollable);function stringListSlot(e){return{name:`model`,consume:t=>e(parseListModel(t instanceof Element?t.getAttribute(`strings`):null))}}var AdwComboRow=class extends HTMLElement{_select;_valueEl;_textEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`model`,`selected`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&(this.selected=t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._select=document.createElement(`select`),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(e,this._valueEl,this._select),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10)),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribe(e=>{this._valueEl.textContent=e.label,this._select.selectedIndex!==e.selected&&(this._select.selectedIndex=e.selected),this._syncChooser(),e.interactive&&(this.setAttribute(`selected`,String(e.selected)),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected}})))}),this._select.addEventListener(`change`,()=>{this._state.select(this._select.selectedIndex)}),this._renderOptions(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`model`?this._state.setModel(parseListModel(n)):e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_createOption(e){let t=document.createElement(`option`);return t.value=e.value,t.textContent=e.label,t}_applyItemsChanged(e){if(!this._initialized)return;for(let t=0;t<e.removed;t++)this._select.remove(e.position);let t=this._select.options[e.position]??null,n=this._state.model;for(let r=0;r<e.added;r++){let i=n[e.position+r];i&&this._select.insertBefore(this._createOption(i),t)}}_renderOptions(){this._initialized&&(this._select.replaceChildren(...this._state.model.map(e=>this._createOption(e))),this._select.selectedIndex=this._state.selectedIndex,this._valueEl.textContent=this._state.selectedLabel,this._syncChooser())}_syncChooser(){let e=this._state.presentsChooser;this.dataset.presentsChooser=e?`true`:`false`,this._select.disabled=!e}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible,applyRowTooltip(this,[this._textEl,this._valueEl,this._select]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-combo-row`,AdwComboRow);const dt=[`auto`,`floating`,`bottom-sheet`];var AdwDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_boxEl;_headerEl;_titleEl;_closeBtn;_contentEl;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`,`content-height`,`presentation-mode`,`show-header`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?360:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}get contentHeight(){let e=Number.parseInt(this.getAttribute(`content-height`)??``,10);return Number.isNaN(e)?0:e}set contentHeight(e){e>0?this.setAttribute(`content-height`,String(e)):this.removeAttribute(`content-height`)}get presentationMode(){let e=this.getAttribute(`presentation-mode`);return e&&dt.includes(e)?e:`auto`}set presentationMode(e){this.setAttribute(`presentation-mode`,e)}get contentArea(){return this._contentEl}present(e){this.isConnected||(e??document.body).appendChild(this),this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-dialog`),this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-dialog-box`,this._boxEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._boxEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-dialog-header`;let e=document.createElement(`div`);e.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let t=document.createElement(`div`);t.className=`adw-dialog-header-side adw-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),t.appendChild(this._closeBtn),this._headerEl.append(e,this._titleEl,t),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`,this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),bindSlottedChildren(this,[{into:this._contentEl}]).install(this._scrimEl),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._onClosed()))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_onClosed(){this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss()}decorateHeader(e){}_render(){this.classList.toggle(`open`,this.open);let e=this.title;this._titleEl.textContent=e;let t=e.length>0||this.hasAttribute(`show-header`);this._headerEl.hidden=!t,this.dataset.presentation=this.presentationMode,this._boxEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let n=this.contentHeight;n>0?this._boxEl.style.setProperty(`--adw-dialog-content-height`,`${n}px`):this._boxEl.style.removeProperty(`--adw-dialog-content-height`);let r=!this.canClose;this._closeBtn.disabled=r,this._closeBtn.classList.toggle(`locked`,r),this.decorateHeader(this._headerEl)}};customElements.define(`adw-dialog`,AdwDialog);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_slots;_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`,`tooltip-text`]}get _classPrefix(){return`adw-entry-row`}get text(){return this._state.text}set text(e){this._state.setText(e??``)}get textLength(){return this._state.textLength}get maxLength(){return this._state.maxLength}set maxLength(e){this._state.setMaxLength(e)}get editable(){return this._state.editable}set editable(e){this._state.setEditable(e)}get showApplyButton(){return this._state.showApplyButton}set showApplyButton(e){this._state.setShowApplyButton(e)}get activatesDefault(){return this._state.activatesDefault}set activatesDefault(e){this._state.setActivatesDefault(e)}get editing(){return this._state.editing}connectedCallback(){this._initialized||(this._initialized=!0,this._build(),this._state.setMaxLength(Number.parseInt(this.getAttribute(`max-length`)??``,10)),this._state.setEditable(this.getAttribute(`editable`)!==`false`),this._state.setShowApplyButton(booleanAttribute$2(this.getAttribute(`show-apply-button`),!1)),this._state.setActivatesDefault(booleanAttribute$2(this.getAttribute(`activates-default`),!1)),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._slots.install(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),applyRowTooltip(this,this._tooltipParts()),this._state.subscribe(e=>this._onStateChanged(e)))}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`title`:this._renderTitle();break;case`text`:this._state.setText(n??``);break;case`editable`:this._state.setEditable(n!==`false`);break;case`max-length`:this._state.setMaxLength(Number.parseInt(n??``,10));break;case`show-apply-button`:this._state.setShowApplyButton(booleanAttribute$2(n,!1));break;case`activates-default`:this._state.setActivatesDefault(booleanAttribute$2(n,!1));break;case`tooltip-text`:applyRowTooltip(this,this._tooltipParts());break}}_tooltipParts(){return[this._prefixes,this._area,this._suffixes]}addSuffix(e){this._suffixes.append(e),setPartVisible(this._suffixes,!0)}addPrefix(e){this._prefixes.prepend(e),setPartVisible(this._prefixes,!0)}setShowIndicator(e){this._state.setShowIndicator(e)}setIndicatorIconName(e){this._indicator.dataset.iconName=e}setIndicatorTooltip(e){this._indicator.title=e,this._indicator.setAttribute(`aria-label`,e)}apply(){this._state.apply(),this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}))}grabFocusWithoutSelecting(){return this._input.focus(),this._state.editing}_onConnected(){}_build(){let e=this._classPrefix;this._prefixes=document.createElement(`div`),this._prefixes.className=`${e}-prefixes`,this._suffixes=document.createElement(`div`),this._suffixes.className=`${e}-suffixes`,this._emptyTitle=document.createElement(`span`),this._emptyTitle.className=`adw-row-title ${e}-empty-title`,this._title=document.createElement(`span`),this._title.className=`adw-row-title ${e}-title`,this._input=document.createElement(`input`),this._input.className=`${e}-input`,this._input.type=`text`,this._input.addEventListener(`input`,()=>{this._state.setText(this._input.value),this._input.value!==this._state.text&&(this._input.value=this._state.text)}),this._input.addEventListener(`focus`,()=>this._state.setEditing(!0)),this._input.addEventListener(`blur`,()=>this._state.setEditing(!1)),this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._activate())}),this._area=document.createElement(`div`),this._area.className=`${e}-text`,this._area.append(this._emptyTitle,this._title,this._input),this._indicator=document.createElement(`span`),this._indicator.className=`${e}-indicator`,this._indicator.setAttribute(`role`,`img`),this._indicator.textContent=`⇪`,this._applyButton=document.createElement(`button`),this._applyButton.type=`button`,this._applyButton.className=`adw-button suggested-action circular icon-only ${e}-apply`,this._applyButton.dataset.iconName=`adw-entry-apply-symbolic`,this._applyButton.title=he,this._applyButton.setAttribute(`aria-label`,he),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createGtkImage(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this._slots=bindSlottedChildren(this,[{name:`prefix`,consume:e=>this.addPrefix(e)},{name:`suffix`,claims:e=>e instanceof Element,consume:e=>this.addSuffix(e)}]),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_maybeFocus(e){let t=e.target;(t===this||t===this._area||t===this._emptyTitle||t===this._title||t===this._editIcon||t===this._indicator||t===this._prefixes||t===this._suffixes)&&this._input.focus()}_activate(){let e=this._state.activate();if(e.signal===`apply`){this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}));return}e.activateDefault&&this.closest(`form`)?.requestSubmit(),this.dispatchEvent(new CustomEvent(`entry-activated`,{bubbles:!0}))}_renderTitle(){let e=this.getAttribute(`title`)??``;this._emptyTitle.textContent=e,this._title.textContent=e}_render(e){this._input.value!==e.text&&(this._input.value=e.text),this._input.readOnly=!e.editable,this.classList.toggle(`focused`,e.editing),this.classList.toggle(`empty`,e.empty),setPartVisible(this._emptyTitle,e.emptyTarget===0),setPartVisible(this._title,e.emptyTarget===1),setPartVisible(this._editIcon,e.editIconVisible),this._editIcon.classList.toggle(`disabled`,!e.editIconSensitive),this._editIcon.setAttribute(`aria-disabled`,String(!e.editIconSensitive)),setPartVisible(this._indicator,e.indicatorVisible),setPartVisible(this._applyButton,e.applyButtonVisible),this.setAttribute(`text-length`,String(e.textLength))}_onStateChanged(e){if(this._render(e),e.text!==this._lastText){this._lastText=e.text;let t={text:e.text};this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:t})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:t}))}e.textLength!==this._lastLength&&(this._lastLength=e.textLength,this.dispatchEvent(new CustomEvent(`notify::text-length`,{bubbles:!0,detail:{textLength:e.textLength}})))}};customElements.define(`adw-entry-row`,AdwEntryRow);var GtkSwitch=class extends HTMLElement{_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`state`,`disabled`,`unfocusable`]}get unfocusable(){return this.hasAttribute(`unfocusable`)}set unfocusable(e){this.toggleAttribute(`unfocusable`,!!e)}get active(){return this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e),this.state=this.active}get state(){return this.hasAttribute(`state`)}set state(e){this.toggleAttribute(`state`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.classList.add(`adw-switch`),this._input=document.createElement(`input`),this._input.type=`checkbox`,this._slider=document.createElement(`span`),this._slider.className=`adw-switch-slider`,this.replaceChildren(this._input,this._slider),this.active&&(this.state=!0),this._input.addEventListener(`change`,()=>{this.active=this._input.checked}),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&(this.active=!this.active)}),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`active`?this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})):e===`state`&&this.dispatchEvent(new CustomEvent(`notify::state`,{bubbles:!0,detail:{state:this.state}})))}_render(){let e=this.disabled;this._input.checked=this.active,this._input.disabled=e,this.unfocusable?this._input.tabIndex=-1:this._input.removeAttribute(`tabindex`),this.classList.toggle(`checked`,this.state),this.classList.toggle(`disabled`,e)}};customElements.define(`gtk-switch`,GtkSwitch);var AdwExpanderRow=class extends HTMLElement{_headerEl;_titleEl;_subtitleEl;_enableSwitch;_chevronEl;_contentEl;_prefixEl;_suffixEl;_state=new ExpanderState;_initialized=!1;_reflectingEnable=!1;constructor(){super(),this._state.subscribe(e=>{e?this.setAttribute(`expanded`,``):this.removeAttribute(`expanded`),this._initialized&&this._render()})}static get observedAttributes(){return[`title`,`subtitle`,`expanded`,`enable-expansion`,`show-enable-switch`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get expanded(){return this._state.expanded}set expanded(e){this._state.setExpanded(e)}get enableExpansion(){return!this.hasAttribute(`enable-expansion`)||this.getAttribute(`enable-expansion`)!==`false`}set enableExpansion(e){this.setAttribute(`enable-expansion`,e?`true`:`false`)}get contentSection(){return this._contentEl}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._enableSwitch=document.createElement(`gtk-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createGtkImage(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`,this._headerEl.append(this._prefixEl,e,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl},{into:this._contentEl}]).install(this._headerEl,this._contentEl),bindEmptySections(this._prefixEl,this._suffixEl),this._headerEl.addEventListener(`click`,e=>{this._enableSwitch.contains(e.target)||this._state.toggle()&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}}))}),attachRowActivation({row:this._headerEl,activatable:()=>!0}),this._enableSwitch.addEventListener(`notify::active`,e=>{if(e.stopPropagation(),this._reflectingEnable)return;let t=this._enableSwitch.active;this.setAttribute(`enable-expansion`,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`notify::enable-expansion`,{bubbles:!0,detail:{enableExpansion:t}}))}),this._state.setExpanded(this.hasAttribute(`expanded`)),this._render()}attributeChangedCallback(e){this._initialized&&(e===`expanded`&&this._state.setExpanded(this.hasAttribute(`expanded`)),this._render())}_render(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible;let t=this.hasAttribute(`show-enable-switch`);this._enableSwitch.hidden=!t,this._reflectingEnable=!0,this._enableSwitch.active=this.enableExpansion,this._reflectingEnable=!1,this.classList.toggle(`expanded`,this.expanded),this._headerEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.classList.toggle(`expanded`,this.expanded),applyRowTooltip(this,[this._headerEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-expander-row`,AdwExpanderRow);var AdwWindowTitle=class extends HTMLElement{_titleEl;_subtitleEl;_state=new WindowTitleState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-window-title-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-window-title-subtitle`,this.replaceChildren(this._titleEl,this._subtitleEl),this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`title`?this._state.setTitle(n):this._state.setSubtitle(n))&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:e===`title`?this._state.title:this._state.subtitle}})))}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-window-title`,AdwWindowTitle);var AdwHeaderBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;_titleEl=null;_page=null;_window=null;_pageObserver=null;static get observedAttributes(){return[`title`,`subtitle`]}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized){this._followPage(),this._renderTitle();return}this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`,bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`title-widget`,into:this._centerEl},{name:`end`,into:this._endEl}],(e,t)=>{`into`in t&&t.into===this._centerEl&&this._dropDerivedTitle()}).install(this._startEl,this._centerEl,this._endEl),this._centerEl.childElementCount===0&&(this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl)),this._followPage(),this._renderTitle()}disconnectedCallback(){this._pageObserver?.disconnect(),this._pageObserver=null,this._page=null,this._window=null}_followPage(){this._page=this.closest(`adw-navigation-page`),this._window=this.closest(`adw-window, adw-application-window`),this._pageObserver??=new MutationObserver(()=>this._renderTitle());for(let e of[this._page,this._window])e!==null&&this._pageObserver.observe(e,{attributes:!0,attributeFilter:[`title`]})}attributeChangedCallback(){this._initialized&&this._renderTitle()}_dropDerivedTitle(){this._titleEl?.remove(),this._titleEl=null}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e)??(e===`title`?this._page?.getAttribute(`title`)??this._window?.getAttribute(`title`)??null:null);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const ft={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createGtkImage(viewSwitcherIconName(e),t)}function applySwitcherIcon(e,t){e.iconName=viewSwitcherIconName(t)}function readSwitcherPage(e){let t=Number.parseInt(e.getAttribute(`badge-number`)??``,10);return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),visible:!e.hasAttribute(`hidden`),useUnderline:e.hasAttribute(`use-underline`),badgeNumber:Number.isNaN(t)?0:t,needsAttention:e.hasAttribute(`needs-attention`)}}function applyIndicator(e,t,n){e.textContent=t,e.classList.toggle(`needs-attention`,n&&t.length===0),e.hidden=t.length===0&&!n}function applyDescription(e,t){t?e.setAttribute(`aria-description`,t):e.removeAttribute(`aria-description`)}const pt={horizontal:{previous:`ArrowLeft`,next:`ArrowRight`},vertical:{previous:`ArrowUp`,next:`ArrowDown`}},adjacentStep=(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r};function attachRovingFocus(e){let keysOf=e=>pt[typeof e==`function`?e():e];e.host.addEventListener(`keydown`,t=>{let{previous:n,next:r}=keysOf(e.orientation),i=e.crossAxis===void 0?null:keysOf(e.crossAxis.orientation);if(t.altKey||t.ctrlKey||t.metaKey)return;let a=e.items(),o=a.findIndex(e=>e===t.target||e.contains(t.target));if(o<0)return;let s=e.step??adjacentStep,c;if(t.key===n)c=s(a,o,-1);else if(t.key===r)c=s(a,o,1);else if(i!==null&&t.key===i.previous)c=e.crossAxis.step(a,o,-1);else if(i!==null&&t.key===i.next)c=e.crossAxis.step(a,o,1);else if(t.key===`Home`)c=0;else if(t.key===`End`)c=a.length-1;else return;t.preventDefault();let l=c===null?void 0:a[c];l===void 0||l===a[o]||(e.select(l),l.focus())})}var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=ft;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_groupEl;_pagesEl;_panels=[];_toggles=[];_displayMode=`labels`;_initialized=!1;_declared=[];_pageObserver;static get observedAttributes(){return[`active`,`display-mode`,`flat`,`round`,`osd`]}constructor(){super()}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get activeToggle(){return toggleIndexForPage(this._state.pages,this._state.selected)}get displayMode(){return this._displayMode}set displayMode(e){this.setAttribute(`display-mode`,e)}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._rebuildToggles(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`)),t=this.getAttribute(`active`);if(this._groupEl=document.createElement(`div`),this._groupEl.className=`adw-inline-view-switcher-group`,this._groupEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._toggles,select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-inline-view-switcher-pages`,this._panels=e.map(e=>{let t=document.createElement(`div`);t.className=`adw-inline-view-switcher-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.name=e.getAttribute(`name`)??``;for(let n of Array.from(e.childNodes))t.appendChild(n);return this._pagesEl.appendChild(t),t}),this.replaceChildren(this._groupEl,this._pagesEl),this._displayMode=this._readDisplayModeAttr(),this._initialized=!0,this._declared=e,this._watchPages(),this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._rebuildToggles()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._rebuildToggles())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive();return}if(e===`display-mode`){let e=this._readDisplayModeAttr();if(e===this._displayMode)return;this._displayMode=e,this._rebuildToggles(),this.dispatchEvent(new CustomEvent(`notify::display-mode`,{bubbles:!0,detail:{displayMode:e}}));return}this._applyStyleClasses()}}_readDisplayModeAttr(){let e=this.getAttribute(`display-mode`);return e===null?`labels`:isInlineViewSwitcherDisplayMode(e)?e:this._displayMode}_rebuildToggles(){if(!this._initialized)return;let e=buildInlineToggles(this._state.pages,this._displayMode);this._groupEl.replaceChildren(),this._toggles=e.map(e=>{let t=document.createElement(`button`);if(t.type=`button`,t.className=`adw-inline-view-switcher-toggle`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e.pageIndex),t.dataset.toggleIndex=String(e.toggleIndex),e.showIcon&&t.appendChild(createSwitcherIcon(e.iconName,`adw-inline-view-switcher-icon`)),e.showLabel){let n=document.createElement(`span`);n.className=`adw-inline-view-switcher-label`,n.textContent=e.label,t.appendChild(n)}let n=document.createElement(`span`);return n.className=`adw-inline-view-switcher-indicator`,n.setAttribute(`aria-hidden`,`true`),applyIndicator(n,e.badgeLabel,e.needsAttention),t.appendChild(n),e.tooltip&&(t.title=e.tooltip),e.showLabel||t.setAttribute(`aria-label`,e.tooltip||e.iconName),applyDescription(t,e.description),t.addEventListener(`click`,()=>{this._state.setSelected(e.pageIndex)}),t.addEventListener(`dragenter`,n=>{t.contains(n.relatedTarget)||this._state.dragEnter(e.pageIndex)}),t.addEventListener(`dragleave`,n=>{t.contains(n.relatedTarget)||this._state.dragLeave(e.pageIndex)}),this._groupEl.appendChild(t),t}),this._render()}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.selected,name:e.name,toggleIndex:this.activeToggle,interactive:e.interactive}}))}_render(){if(!this._initialized)return;this._applyStyleClasses();let e=this.activeToggle;this._toggles.forEach((t,n)=>{let r=n===e&&e!==-1;t.classList.toggle(`active`,r),t.setAttribute(`aria-selected`,String(r)),t.tabIndex=r?0:-1});let t=this._state.selected;this._panels.forEach((e,n)=>{let r=n===t;e.classList.toggle(`active-view`,r),e.hidden=!r}),this._reflectActive()}_applyStyleClasses(){for(let e of[`flat`,`round`,`osd`]){let t=this.hasAttribute(e);this.classList.toggle(e,t),this._groupEl?.classList.toggle(e,t)}for(let e of Ye)this._groupEl.classList.toggle(e,e===this._displayMode)}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-stack-page`,AdwViewStackPage),customElements.define(`adw-inline-view-switcher`,AdwInlineViewSwitcher);var AdwMultiLayoutView=class extends HTMLElement{_layouts=[];_children=new Map;_slots=new Map;_current=null;_acceptingSlots=!1;_observer=null;static get observedAttributes(){return[`layout-name`]}get layoutName(){return this._current?.name??null}set layoutName(e){e!==null&&this.setAttribute(`layout-name`,e)}get layout(){return this._current?.content??null}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._observer?.disconnect(),this._observer=new MutationObserver(()=>this._rebuild()),this._observer.observe(this,{childList:!0}),this._rebuild()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){!this.isConnected||e!==`layout-name`||this._setLayoutByName(this.getAttribute(`layout-name`))}getChild(e){return this._children.get(e)??null}getLayoutByName(e){return this._layouts.find(t=>t.name===e)?.content??null}registerSlot(e,t){if(this._acceptingSlots&&this._slots.get(e)!==t){if(this._slots.has(e)){console.warn(`Duplicate slot ID in AdwLayout ${this.layoutName}: ${e}`);return}this._slots.set(e,t)}}_rebuild(){if(this.isConnected){this._observer?.disconnect();try{this._readAuthoredTree()}finally{this.isConnected&&this._observer?.observe(this,{childList:!0})}}}_readAuthoredTree(){let e=[];for(let t of Array.from(this.children)){let n=t.getAttribute(`name`);if(n!==null){e.push({name:n,content:t});continue}let r=t.getAttribute(`slot`);r===null||r===``||(this._children.has(r)&&console.warn(`While adding child: duplicate slot ${r} in AdwMultiLayoutView; kept the first`),this._children.set(r,t))}this._layouts=e;let t=this.getAttribute(`layout-name`);t===null?this._setLayout(e[0]??null):this._setLayoutByName(t)}_setLayout(e){if(e===this._current){e!==null&&this._mount(e);return}this._current=e,e===null?this._destroy():this._mount(e),this.dispatchEvent(new CustomEvent(`notify::layout`,{bubbles:!0,detail:{layout:this.layoutName}})),this.dispatchEvent(new CustomEvent(`notify::layout-name`,{bubbles:!0,detail:{layoutName:this.layoutName}}))}_setLayoutByName(e){if(e===null)return;let t=this._layouts.find(t=>t.name===e);if(t===void 0){console.error(`Layout name '${e}' not found in AdwMultiLayoutView`);return}this._setLayout(t)}_destroy(){this._slots.clear(),this.replaceChildren()}_mount(e){for(this._destroy(),this._acceptingSlots=!0,this.appendChild(e.content);;){let t=this._slots.size;for(let t of e.content.querySelectorAll(`adw-layout-slot`)){let e=t.getAttribute(`id`);e!==null&&e!==``&&!this._slots.has(e)&&this.registerSlot(e,t)}for(let[e,t]of this._children)this._parent(e,t);if(this._slots.size===t)break}this._acceptingSlots=!1}_parent(e,t){let n=this._slots.get(e);n!==void 0&&t.parentElement!==n&&(this._mirrorVisible(n,t),n.appendChild(t))}_mirrorVisible(e,t){let apply=()=>{e.toggleAttribute(`hidden`,t.hidden===!0)};apply(),new MutationObserver(apply).observe(t,{attributes:!0,attributeFilter:[`hidden`]})}};customElements.define(`adw-multi-layout-view`,AdwMultiLayoutView);var AdwLayoutSlot=class extends HTMLElement{_registered=!1;static get observedAttributes(){return[`id`]}get slotId(){return this.getAttribute(`id`)}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`contents`,this._register()}disconnectedCallback(){this._registered=!1}attributeChangedCallback(e){!this.isConnected||e!==`id`||(this._registered&&console.warn("<adw-layout-slot>: `id` is construct-only upstream; re-registering the slot."),this._register())}_register(){let e=this.slotId;if(e===null||e===``){console.error("<adw-layout-slot> created without an `id` — libadwaita refuses this with g_error.");return}let t=this.closest(`adw-multi-layout-view`);t instanceof AdwMultiLayoutView&&t.registerSlot(e,this),this._registered=!0}};customElements.define(`adw-layout-slot`,AdwLayoutSlot);function readPageProps(e){return{tag:e.tag,title:e.title,canPop:e.canPop}}var AdwNavigationPage=class extends HTMLElement{_syncing=!1;static get observedAttributes(){return[`title`,`tag`,`can-pop`,`no-back-button`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get tag(){return this.getAttribute(`tag`)}set tag(e){e===null?this.removeAttribute(`tag`):this.setAttribute(`tag`,e)}get canPop(){return this.getAttribute(`can-pop`)!==`false`}set canPop(e){this.setAttribute(`can-pop`,e?`true`:`false`)}attributeChangedCallback(e,t){if(this._syncing)return;let n=this.closest(`adw-navigation-view`);n instanceof AdwNavigationView&&n.syncPageProperty(this,e,t)}revertAttribute(e,t){this._syncing=!0,t===null?this.removeAttribute(e):this.setAttribute(e,t),this._syncing=!1}},AdwNavigationView=class extends HTMLElement{_pagesEl;_backButtons=new WeakMap;_initialized=!1;_diagnose=e=>{console.warn(`[adw-navigation-view] ${describeNavigationDiagnostic(e)}`)};_state=new NavigationViewState({onDiagnostic:this._diagnose});static get observedAttributes(){return[`animate-transitions`,`pop-on-escape`]}get animateTransitions(){return this.getAttribute(`animate-transitions`)!==`false`}set animateTransitions(e){this.setAttribute(`animate-transitions`,e?`true`:`false`)}get popOnEscape(){return this.getAttribute(`pop-on-escape`)!==`false`}set popOnEscape(e){this.setAttribute(`pop-on-escape`,e?`true`:`false`)}get visiblePage(){return this._state.visiblePage}get visiblePageTag(){return this._state.visiblePageTag}get depth(){return this._state.depth}get navigationStack(){return this._state.stack}get pages(){return this._state.pages}get canGoBack(){return this._state.canGoBack()}get backButtonTooltip(){return this._state.backButtonTooltip()}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-navigation-page`));this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-navigation-view-pages`;for(let t of e)t.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(t);this.replaceChildren(this._pagesEl),this._state.subscribe(e=>this._onChange(e)),this._state.setAnimateTransitions(this.animateTransitions),this._state.setPopOnEscape(this.popOnEscape),this.addEventListener(`keydown`,this._onKeyDown);for(let t of e)this._state.add(t,readPageProps(t));for(let t of e)this._state.isRegistered(t)||this._detach(t);this._syncClasses(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`pop-on-escape`){this._state.setPopOnEscape(this.popOnEscape);return}this._state.setAnimateTransitions(this.animateTransitions),this._syncClasses()}}syncPageProperty(e,t,n){this._state.isRegistered(e)&&(t===`tag`?(this._state.setTag(e,e.tag),this._state.tagOf(e)!==e.tag&&e.revertAttribute(`tag`,n)):t===`title`?this._state.setTitle(e,e.title):t===`can-pop`&&this._state.setCanPop(e,e.canPop),this._render())}addPage(e){let t=this._state.add(e,readPageProps(e));return this._render(),t}removePage(e){let t=this._state.remove(e);return t&&!this._state.isRegistered(e)&&this._detach(e),this._render(),t}push(e){if(typeof e==`string`)return this.pushByTag(e);let t=this._state.push(e,readPageProps(e));return this._render(),t}pushByTag(e){let t=this._state.pushByTag(e);return this._render(),t}pop(){let e=this._state.pop();return this._render(),e}popToPage(e){let t=this._state.popToPage(e);return this._render(),t}popToTag(e){let t=this._state.popToTag(e);return this._render(),t}replace(e){let t=e.map(e=>{if(typeof e!=`string`)return e??null;let t=this._state.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this._state.replace(t,readPageProps),this._render()}replaceWithTags(e){this._state.replaceWithTags(e),this._render()}findPage(e){return this._state.findPage(e)}getPreviousPage(e){return this._state.getPreviousPage(e)}_onChange(e){for(let t of e.removed)this._detach(t);for(let e of this._state.finishTransition())this._detach(e);if(this._render(),e.reason===`add`||e.reason===`push`)this._dispatch(`pushed`,e.visiblePage);else if(e.reason===`pop`)for(let t of e.popped)this._dispatch(`popped`,t);else this._dispatch(`replaced`,null);e.previousVisiblePage!==e.visiblePage&&this._dispatch(`notify::visible-page`,e.visiblePage)}_dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{page:t,tag:t?.tag??null}}))}_onKeyDown=e=>{if(e.defaultPrevented)return;let t;if(e.key===`Escape`)t=this._state.popFromEscape();else if(e.altKey&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){let n=getComputedStyle(this).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key!==n)return;t=this._state.popFromShortcut()}else return;t===`stop`&&(e.preventDefault(),e.stopPropagation())};_syncClasses(){this.classList.toggle(`animated`,this.animateTransitions)}_render(){let e=this._state.visiblePage;for(let t of this._state.pages){this._attach(t);let n=t===e;t.classList.toggle(`visible-page`,n),t.hidden=!n,n||this._removeBackButton(t)}e&&this._syncBackButton(e)}_attach(e){e.parentNode!==this._pagesEl&&(e.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(e))}_detach(e){this._removeBackButton(e),e.classList.remove(`visible-page`),e.parentNode===this._pagesEl&&this._pagesEl.removeChild(e)}_syncBackButton(e){if(!this._state.canGoBack()||e.hasAttribute(`no-back-button`)){this._removeBackButton(e);return}let t=this._state.backButtonTooltip()??Ee,n=this._backButtons.get(e);if(n){n.setAttribute(`tooltip`,t);return}let r=e.querySelector(`adw-header-bar`);if(!r)return;let i=r.startSection??null;if(!i)return;let a=document.createElement(`gtk-button`);a.classList.add(`adw-navigation-back-button`),a.setAttribute(`icon`,`go-previous`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,t),a.addEventListener(`click`,()=>this.pop()),i.insertBefore(a,i.firstChild),this._backButtons.set(e,a)}_removeBackButton(e){let t=this._backButtons.get(e);t&&(t.parentNode&&t.parentNode.removeChild(t),this._backButtons.delete(e))}};customElements.define(`adw-navigation-view`,AdwNavigationView),customElements.define(`adw-navigation-page`,AdwNavigationPage);var AdwNavigationSplitView=class extends HTMLElement{_sidebarEl;_contentEl;_initialized=!1;_disposeBreakpoint;_breakpointApplied=!1;_state=new NavigationSplitViewState;_reflecting=!1;static get observedAttributes(){return[`collapsed`,`show-content`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`breakpoint`]}get collapsed(){return this._initialized?this._state.collapsed:this.hasAttribute(`collapsed`)}set collapsed(e){this.toggleAttribute(`collapsed`,e)}get showContent(){return this._initialized?this._state.showContent:this.hasAttribute(`show-content`)}set showContent(e){this.toggleAttribute(`show-content`,e)}get sidebarPosition(){return this.getAttribute(`sidebar-position`)===`end`?`end`:`start`}set sidebarPosition(e){this.setAttribute(`sidebar-position`,e)}get sidebarTag(){return this._state.sidebarTag}get contentTag(){return this._state.contentTag}push(e){return this._state.push(e)}pop(){return this._state.pop()}connectedCallback(){this._buildOnce(),this._reflectShowContent(),this._syncWidth(),this._syncClasses(),this._syncBreakpoint()}_buildOnce(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`,bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl}],(e,t)=>this._mountPane(t.name===`sidebar`?`sidebar`:`content`)).install(this._sidebarEl,this._contentEl),this._state=new NavigationSplitViewState({sidebarPosition:this.sidebarPosition,collapsed:this.hasAttribute(`collapsed`),showContent:this.hasAttribute(`show-content`),onCritical:e=>console.error(e),onDelegate:(e,t)=>{let n={tag:t,handled:!1};return this.dispatchEvent(new CustomEvent(`navigation-${e}`,{bubbles:!0,detail:n})),n.handled}}),this._mountPane(`sidebar`),this._mountPane(`content`),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()}))}_mountPane(e){let t=e===`sidebar`?this._sidebarEl:this._contentEl,n=Array.from(t.children),r=n.length>0?{tag:this._tagOf(n)}:null;e===`sidebar`?this._state.setSidebar(r):this._state.setContent(r)}_tagOf(e){for(let t of e){let e=t.getAttribute(`tag`);if(e!==null)return e}return null}_reflectShowContent(){if(this._reflecting)return;let e=this._state.showContent;if(this.hasAttribute(`show-content`)!==e){this._reflecting=!0;try{this.toggleAttribute(`show-content`,e)}finally{this._reflecting=!1}}}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0}attributeChangedCallback(e){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}if(e===`min-sidebar-width`||e===`max-sidebar-width`){this._syncWidth();return}e===`collapsed`&&this._state.setCollapsed(this.hasAttribute(`collapsed`)),e===`show-content`&&this._state.setShowContent(this.hasAttribute(`show-content`)),e===`sidebar-position`&&this._state.setSidebarPosition(this.sidebarPosition),this._syncClasses(),this._syncWidth()}}_syncWidth(){if(this.collapsed){this._sidebarEl.style.minWidth=``,this._sidebarEl.style.maxWidth=``;return}let e=resolveSidebarBounds({minSidebarWidth:this._widthAttr(`min-sidebar-width`,180),maxSidebarWidth:this._widthAttr(`max-sidebar-width`,280)},0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`}_widthAttr(e,t){let n=this.getAttribute(e);if(n===null)return t;let r=parseFloat(n);return Number.isFinite(r)?r:t}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-content`,e.showContent),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,isSidebarAtVisualStart(e.sidebarPosition,this._direction)),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed);let{stack:t}=e.stack,n=t[t.length-1]??null;this._sidebarEl&&(this._sidebarEl.dataset.paneVisible=String(!e.collapsed||n===`sidebar`)),this._contentEl&&(this._contentEl.dataset.paneVisible=String(!e.collapsed||n===`content`))}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}};customElements.define(`adw-navigation-split-view`,AdwNavigationSplitView);const mt={animate(e){let t=0,n=!1,r=performance.now(),step=i=>{if(n)return;let a=Math.min((i-r)/250,1),o=1-(1-a)*(1-a);if(e.onValue(e.from+(e.to-e.from)*o),a<1){t=requestAnimationFrame(step);return}e.onValue(e.to),e.onDone()};return t=requestAnimationFrame(step),{cancel(){n=!0,t&&cancelAnimationFrame(t)}}}};function readTriStateAttr(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var AdwOverlaySplitView=class extends HTMLElement{static signals={"notify::show-sidebar":`notify::show-sidebar`};_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_breakpointApplied=!1;_state=new OverlaySplitViewState;_notifiedShowSidebar=null;_reflecting=!1;_measuredWidth=0;_resizeObserver;_swipePointer=null;_swipeOrigin={x:0,progress:0};static get observedAttributes(){return[`show-sidebar`,`collapsed`,`pin-sidebar`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`sidebar-width-fraction`,`enable-show-gesture`,`enable-hide-gesture`,`breakpoint`]}get showSidebar(){return this._state.showSidebar}set showSidebar(e){this.setAttribute(`show-sidebar`,e?``:`false`)}get collapsed(){return this._state.collapsed}set collapsed(e){e?this.setAttribute(`collapsed`,``):this.removeAttribute(`collapsed`)}get minSidebarWidth(){return parseFloat(this.getAttribute(`min-sidebar-width`)||`180`)}get maxSidebarWidth(){return parseFloat(this.getAttribute(`max-sidebar-width`)||`280`)}get sidebarWidthFraction(){return parseFloat(this.getAttribute(`sidebar-width-fraction`)||`0.25`)}connectedCallback(){this._buildOnce(),this._bindToDocument(),this._reflectShowSidebar(),this._syncClasses(),this._syncSidebarWidth(),this._syncBreakpoint()}_buildOnce(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._sidebarEl,this._contentEl,this._backdropEl),this._state=new OverlaySplitViewState({collapsed:this.hasAttribute(`collapsed`),showSidebar:readTriStateAttr(this,`show-sidebar`,!0),pinSidebar:this.hasAttribute(`pin-sidebar`),sidebarPosition:this.getAttribute(`sidebar-position`)===`end`?`end`:`start`,enableShowGesture:readTriStateAttr(this,`enable-show-gesture`,!0),enableHideGesture:readTriStateAttr(this,`enable-hide-gesture`,!0),animator:mt}),this._state.subscribe(()=>{this._reflectShowSidebar(),this._syncClasses()}),this.addEventListener(`keydown`,this._onKeyDown),this._bindSwipe())}_bindToDocument(){this._resizeObserver?.disconnect(),this._resizeObserver=new ResizeObserver(e=>{let t=e[e.length-1];if(!t)return;let n=t.borderBoxSize?.[0];this._measuredWidth=n?n.inlineSize:t.contentRect.width,this._syncSidebarWidth(),this._syncClasses()}),this._resizeObserver.observe(this),this._measuredWidth=this.offsetWidth}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_onKeyDown=e=>{e.key!==`Escape`||e.defaultPrevented||this._state.escape()&&e.preventDefault()};attributeChangedCallback(e,t,n){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}this._readAttribute(e),(e===`min-sidebar-width`||e===`max-sidebar-width`||e===`sidebar-width-fraction`||e===`collapsed`)&&this._syncSidebarWidth(),this._syncClasses()}}_readAttribute(e){let t=this._state;if(e===`pin-sidebar`&&t.setPinSidebar(this.hasAttribute(`pin-sidebar`)),e===`sidebar-position`){let e=this.getAttribute(`sidebar-position`);t.setSidebarPosition(e===`end`?`end`:`start`)}e===`show-sidebar`&&t.setShowSidebar(readTriStateAttr(this,`show-sidebar`,!0)),e===`enable-show-gesture`&&t.setEnableShowGesture(readTriStateAttr(this,`enable-show-gesture`,!0)),e===`enable-hide-gesture`&&t.setEnableHideGesture(readTriStateAttr(this,`enable-hide-gesture`,!0)),e===`collapsed`&&t.setCollapsed(this.hasAttribute(`collapsed`)),this._reflectShowSidebar()}_reflectShowSidebar(){if(this._reflecting)return;let e=this._state.showSidebar?``:`false`;if(this.getAttribute(`show-sidebar`)!==e){this._reflecting=!0;try{this.setAttribute(`show-sidebar`,e)}finally{this._reflecting=!1}}this._notifyShowSidebar()}_notifyShowSidebar(){let e=this._state.showSidebar,t=this._notifiedShowSidebar;this._notifiedShowSidebar=e,!(t===null||t===e)&&this.dispatchEvent(new CustomEvent(`notify::show-sidebar`,{bubbles:!0,detail:{showSidebar:e}}))}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}openSidebar(){this.showSidebar=!0,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!0}}))}hideSidebar(){this.showSidebar=!1,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!1}}))}toggleSidebar(){this.showSidebar=!this.showSidebar,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:this.showSidebar}}))}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}get _widthSpec(){return{minSidebarWidth:this.minSidebarWidth,maxSidebarWidth:this.maxSidebarWidth,sidebarWidthFraction:this.sidebarWidthFraction}}get _sidebarWidth(){return resolveOverlaySidebarWidth({...this._widthSpec,totalWidth:this._measuredWidth,collapsed:this._state.collapsed})}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-sidebar`,e.showSidebar);let t=isSidebarAtVisualStart(e.sidebarPosition,this._direction);this.classList.toggle(`sidebar-start`,e.sidebarPosition===`start`),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,t),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._sidebarEl?.classList.toggle(`overlay-pane`,e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed),this._backdropEl&&(this._backdropEl.hidden=!e.shieldVisible),this._sidebarEl?.setAttribute(`aria-hidden`,String(!e.sidebarFocusable)),this._contentEl?.setAttribute(`aria-hidden`,String(!e.contentFocusable)),this._syncGeometry()}_syncGeometry(){let e=this._sidebarEl;if(!e)return;if(this._measuredWidth<=0){for(let t of[`left`,`marginLeft`,`marginRight`,`width`,`minWidth`,`maxWidth`,`opacity`,`pointerEvents`])e.style[t]=``;this._backdropEl&&(this._backdropEl.style.opacity=``);return}let t=this._state,n=this._sidebarWidth,r=layoutOverlaySplitView({totalWidth:this._measuredWidth,sidebarWidth:n,showProgress:t.showProgress,collapsed:t.collapsed,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=isSidebarAtVisualStart(t.sidebarPosition,this._direction);if(e.style.width=`${r.sidebar.width}px`,t.collapsed)e.style.marginLeft=``,e.style.marginRight=``,e.style.insetInlineStart=``,e.style.left=`${r.sidebar.x}px`;else{e.style.left=``;let r=n-Math.trunc(n*Math.min(t.showProgress,1));e.style.marginLeft=i?`${-r}px`:``,e.style.marginRight=i?``:`${-r}px`}e.style.opacity=t.showProgress<=0?`0`:`1`,e.style.pointerEvents=t.sidebarPainted?``:`none`,this._backdropEl&&(this._backdropEl.style.opacity=String(1-r.shadowProgress))}_syncSidebarWidth(){if(!this._sidebarEl)return;let e=resolveSidebarBounds(this._widthSpec,0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`,this._syncGeometry()}_bindSwipe(){this.addEventListener(`pointerdown`,e=>{if(this._swipePointer!==null||e.button!==0)return;let t=this._state,n=this.getBoundingClientRect(),r=resolveSwipeArea({isDrag:!0,sidebarWidth:this._sidebarWidth,showProgress:t.showProgress,totalWidth:n.width,totalHeight:n.height,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=e.clientX-n.left,a=e.clientY-n.top;i<r.x||i>r.x+r.width||a<r.y||a>r.y+r.height||(this._swipePointer=e.pointerId,this._swipeOrigin={x:e.clientX,progress:t.showProgress})}),this.addEventListener(`pointermove`,e=>{if(e.pointerId!==this._swipePointer)return;let t=this._state,n=this._sidebarWidth||1,r=isSidebarAtVisualStart(t.sidebarPosition,this._direction),i=(e.clientX-this._swipeOrigin.x)/n*(r?1:-1);if(!t.swipeActive){if(!resolveSwipeStart({showProgress:t.showProgress,collapsed:t.collapsed,direction:i>=0?`forward`:`back`,enableShowGesture:t.enableShowGesture,enableHideGesture:t.enableHideGesture})){this._swipePointer=null;return}t.beginSwipe();try{this.setPointerCapture(e.pointerId)}catch{}}t.setShowProgress(this._swipeOrigin.progress+i)});let release=(e,t)=>{if(e.pointerId!==this._swipePointer)return;this._swipePointer=null;let n=this._state;if(!n.swipeActive)return;this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId);let r=resolveSwipeSnapPoints({showProgress:n.showProgress,enableShowGesture:n.enableShowGesture,enableHideGesture:n.enableHideGesture,swipeActive:!0}),i=t?swipeCancelProgress(n.showProgress):r.reduce((e,t)=>Math.abs(t-n.showProgress)<Math.abs(e-n.showProgress)?t:e);n.endSwipe(i)};this.addEventListener(`pointerup`,e=>release(e,!1)),this.addEventListener(`pointercancel`,e=>release(e,!0))}};customElements.define(`adw-overlay-split-view`,AdwOverlaySplitView);var AdwPasswordEntryRow=class extends AdwEntryRow{_password=new PasswordEntryRowState(this._state);_toggle;_toggleIcon;static get observedAttributes(){return[...AdwEntryRow.observedAttributes,`revealed`]}get _classPrefix(){return`adw-password-entry-row`}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}_onConnected(){this._input.type=`password`,this._input.autocomplete=`off`,this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only ${this._classPrefix}-toggle`,this._toggleIcon=createGtkImage(null),this._toggle.append(this._toggleIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this.addSuffix(this._toggle);let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock);let e=this._password.state;this.setIndicatorIconName(e.indicatorIconName),this.setIndicatorTooltip(e.indicatorTooltip),this.hasAttribute(`revealed`)&&this._password.setRevealed(this.getAttribute(`revealed`)!==`false`),this._renderPassword(this._password.state),this._password.subscribe(e=>{this._renderPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){if(e!==`revealed`){super.attributeChangedCallback(e,t,n);return}this._initialized&&this._password.setRevealed(n!==null&&n!==`false`)}_renderPassword(e){this._input.type=e.revealed?`text`:`password`,this._toggleIcon.dataset.iconName=e.peekIconName,this._toggleIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`)}};customElements.define(`adw-password-entry-row`,AdwPasswordEntryRow);const ht=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),gt=new Set([...ht,`adw-entry-row`,`adw-password-entry-row`,`adw-expander-row`,`adw-button-row`]);function isVisible(e){return!(e instanceof HTMLElement&&e.hidden)}function groupRows(e){let t=e.querySelector(`:scope > .adw-preferences-group-listbox`);return Array.from((t??e).children).filter(e=>gt.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:ht.has(e.tagName.toLowerCase()),useMarkup:!1,useUnderline:!1,ref:e}}function describeGroup(e){return{title:e.getAttribute(`title`)??``,visible:isVisible(e),rows:groupRows(e).map(describeRow),ref:e}}function describePreferencesPages(e){return Array.from(e.querySelectorAll(`adw-preferences-page`)).map(e=>({name:e.getAttribute(`name`),title:e.getAttribute(`title`)??``,iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),visible:isVisible(e),description:e.getAttribute(`description`)??``,groups:Array.from(e.querySelectorAll(`adw-preferences-group`)).map(describeGroup),ref:e}))}function searchPreferencesDom(e,t,n){return searchPreferences(describePreferencesPages(e),t,n)}var AdwPreferencesPage=class extends HTMLElement{static get observedAttributes(){return[`title`,`icon-name`,`name`,`use-underline`,`open`]}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){this.setAttribute(`icon-name`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get groups(){return Array.from(this.querySelectorAll(`adw-preferences-group`))}},AdwPreferencesDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_titleEl;_bodyEl;_pagesEl;_closeBtn;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?640:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}present(){this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}add(e){this._pagesEl.appendChild(e)}removePage(e){return e.parentNode===this._pagesEl?(this._pagesEl.removeChild(e),!0):!1}get pages(){return Array.from(this._pagesEl.querySelectorAll(`adw-preferences-page`))}search(e,t){return searchPreferencesDom(this._pagesEl,e,t)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-preferences-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-preferences-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation());let e=document.createElement(`div`);e.className=`adw-preferences-dialog-header`;let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let n=document.createElement(`div`);n.className=`adw-preferences-dialog-header-side adw-preferences-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-preferences-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),n.appendChild(this._closeBtn),e.append(t,this._titleEl,n),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`,this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(e,this._bodyEl),bindSlottedChildren(this,[{into:this._pagesEl}]).install(this._scrimEl,this._dialogEl),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():(this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss())))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_render(){this.classList.toggle(`open`,this.open);let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._dialogEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let t=!this.canClose;this._closeBtn.disabled=t,this._closeBtn.classList.toggle(`locked`,t)}};customElements.define(`adw-preferences-page`,AdwPreferencesPage),customElements.define(`adw-preferences-dialog`,AdwPreferencesDialog);function isHeaderSuffix(e){return e instanceof Element&&e.getAttribute(`slot`)===`header-suffix`}var AdwPreferencesGroup=class extends HTMLElement{_headerEl;_titleEl;_descriptionEl;_suffixEl;_listboxEl;_initialized=!1;_observer=null;static get observedAttributes(){return[`title`,`description`]}get description(){return this.getAttribute(`description`)??``}set description(e){e?this.setAttribute(`description`,e):this.removeAttribute(`description`)}addRow(e){isHeaderSuffix(e)?this._suffixEl.appendChild(e):this._listboxEl.appendChild(e),this._renderHeader()}removeRow(e){let t=e.parentNode;return t!==this._listboxEl&&t!==this._suffixEl?!1:(t.removeChild(e),this._renderHeader(),!0)}connectedCallback(){if(this._initialized){this._observeBoxes();return}this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let e=document.createElement(`div`);e.className=`adw-preferences-group-labels`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-group-title`,this._descriptionEl=document.createElement(`span`),this._descriptionEl.className=`adw-preferences-group-description`,e.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`,this._headerEl.append(e,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`,bindSlottedChildren(this,[{name:`header-suffix`,into:this._suffixEl},{into:this._listboxEl}],()=>this._renderHeader()).install(this._headerEl,this._listboxEl),this.setAttribute(`role`,`group`),this._observeBoxes()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeBoxes(){this._observer||(this._observer=new MutationObserver(()=>this._renderHeader()),this._observer.observe(this._listboxEl,{childList:!0}),this._observer.observe(this._suffixEl,{childList:!0}),this._renderHeader())}_renderHeader(){let e=this.getAttribute(`title`)??``,t=this.getAttribute(`description`)??``;this._titleEl.textContent=e,this._descriptionEl.textContent=t;let n=derivePreferencesGroupHeader({title:e,description:t,hasHeaderSuffix:this._suffixEl.childElementCount>0,rowCount:this._listboxEl.childElementCount,useMarkup:!1});this._titleEl.hidden=!n.titleVisible,this._descriptionEl.hidden=!n.descriptionVisible,this._headerEl.hidden=!n.headerVisible,this._headerEl.classList.toggle(`single-line`,n.singleLine),this._listboxEl.hidden=!n.listboxVisible}};customElements.define(`adw-preferences-group`,AdwPreferencesGroup);var AdwPreferencesRow=class extends HTMLElement{_titleEl;_contentEl;_initialized=!1;static get observedAttributes(){return[`title`,`title-selectable`,`use-markup`,`use-underline`,`tooltip-text`]}get title(){return this.getAttribute(`title`)??``}set title(e){e===``?this.removeAttribute(`title`):this.setAttribute(`title`,e)}get titleSelectable(){return this.hasAttribute(`title-selectable`)}set titleSelectable(e){this.toggleAttribute(`title-selectable`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get child(){return this._contentEl?.firstElementChild??null}set child(e){this._contentEl?.replaceChildren(...e===null?[]:[e])}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-preferences-row-content`,bindSlottedChildren(this,[{name:`child`,into:this._contentEl}]).install(this._titleEl,this._contentEl),bindEmptySections(this._contentEl),this.setAttribute(`role`,`listitem`),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}})))}_render(){let e=labelDisplayText(this.title,this.useMarkup,this.useUnderline);this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e),this._titleEl.style.userSelect=this.titleSelectable?`text`:``,applyRowTooltip(this,[this._titleEl,this._contentEl])}};customElements.define(`adw-preferences-row`,AdwPreferencesRow);var AdwShortcutLabel=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`accelerator`,`disabled-text`]}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`img`)),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){this.setAttribute(`accelerator`,e)}get disabledText(){return this.getAttribute(`disabled-text`)??``}set disabledText(e){this.setAttribute(`disabled-text`,e)}_render(){let{nodes:e,accessibleLabel:t,error:n}=parseShortcutLabel(this.accelerator,{disabledText:this.disabledText,direction:this._direction()});this.replaceChildren(...e.map(e=>this._nodeElement(e))),this.setAttribute(`aria-label`,t),n&&console.warn(`adw-shortcut-label: failed to parse ${n}, part of accelerator '${this.accelerator}'`)}_direction(){let e=this.isConnected?getComputedStyle(this).direction:``;return e===`rtl`||e===`ltr`?e:this.closest(`[dir="rtl"]`)?`rtl`:`ltr`}_nodeElement(e){if(e.kind===`separator`||e.kind===`disabled`){let t=document.createElement(`span`);return t.className=e.kind===`disabled`?`dimmed adw-shortcut-label-disabled`:`dimmed`,t.textContent=e.text,t}let t=document.createElement(`span`);t.className=`adw-shortcut-label-keys`,t.setAttribute(`dir`,`ltr`);for(let n of e.keys){let e=document.createElement(`span`);if(e.className=`keycap`,e.textContent=n.label,n.sideMarker){let t=document.createElement(`sub`);t.className=`adw-shortcut-label-side`,t.textContent=n.sideMarker,e.append(t)}t.append(e)}return t}};customElements.define(`adw-shortcut-label`,AdwShortcutLabel);var AdwShortcutsDialog=class extends AdwDialog{get sections(){return[...this.contentArea.children].filter(e=>e.localName===`adw-shortcuts-section`)}connectedCallback(){super.connectedCallback(),this.classList.add(`adw-shortcuts-dialog`)}};customElements.define(`adw-shortcuts-dialog`,AdwShortcutsDialog);const _t=new WeakMap,vt=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`,`enabled`,`visible`,`needs-attention`,`badge-number`]}get enabled(){let e=this.getAttribute(`enabled`);return e===null?!this.hasAttribute(`disabled`):booleanAttribute$2(e,!0)}set enabled(e){this.setAttribute(`enabled`,e?`true`:`false`),this.toggleAttribute(`disabled`,!e)}get visible(){let e=this.getAttribute(`visible`);return e===null?!this.hasAttribute(`hidden`):booleanAttribute$2(e,!0)}set visible(e){this.setAttribute(`visible`,e?`true`:`false`),this.toggleAttribute(`hidden`,!e)}attributeChangedCallback(e,t,n){let r=_t.get(this);if(!r)return;let i=n??``;e===`title`?r.spec.title=i:e===`subtitle`?r.spec.subtitle=i:e===`icon-name`?r.spec.iconName=i:e===`disabled`?r.spec.enabled=n===null:e===`enabled`?r.spec.enabled=booleanAttribute$2(n,!0):e===`hidden`?r.spec.visible=n===null:e===`visible`?r.spec.visible=booleanAttribute$2(n,!0):e===`needs-attention`?r.spec.needsAttention=n===null:e===`badge-number`&&(r.spec.badgeNumber=Number.parseInt(i,10)||0),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=vt.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends HTMLElement{_state=new SidebarState;_listEl;_rows=[];_initialized=!1;_reflecting=!1;static get observedAttributes(){return[`mode`,`selected`]}get selected(){return this._state.selected}set selected(e){this.setAttribute(`selected`,String(e))}get selectedItem(){return this._state.selectedItem}get mode(){return this._state.mode}set mode(e){this.setAttribute(`mode`,e)}get sections(){return this._state.sections}set sections(e){this._state.setSections(e),this._rebuild()}get filter(){return this._state.filter}set filter(e){this._state.setFilter(e),this._rebuild()}connectedCallback(){this._initialized||(this._initialized=!0,this._listEl=document.createElement(`div`),this._listEl.className=`adw-sidebar-list`,this._listEl.setAttribute(`role`,`listbox`),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows.filter(e=>!e.el.hidden&&!e.el.disabled).map(e=>e.el),select:e=>{let t=this._rows.find(t=>t.el===e);t!==void 0&&this._state.setSelected(t.index)}}),this._state.setSections(this._readDeclaredSections()),this._state.setMode(this._readModeAttr()),this.hasAttribute(`selected`)&&this._state.setSelected(this._readSelectedAttr()),this._state.subscribe(e=>this._onSelectionChanged(e)),this.replaceChildren(this._listEl),this._applyMode(),this._rebuild(),this._reflectSelected())}attributeChangedCallback(e){if(!(!this._initialized||this._reflecting)){if(e===`selected`){this._state.setSelected(this._readSelectedAttr()),this._reflectSelected();return}e===`mode`&&this._state.setMode(this._readModeAttr())&&(this._applyMode(),this._applySelection())}}refresh(){this._initialized&&(this._state.refresh(),this._rebuild())}_readDeclaredSections(){let e=[];for(let t of Array.from(this.querySelectorAll(`adw-sidebar-section`))){let n=[];for(let e of Array.from(t.querySelectorAll(`adw-sidebar-item`))){let t={title:e.getAttribute(`title`)??``,subtitle:e.getAttribute(`subtitle`)??``,iconName:e.getAttribute(`icon-name`)??``,enabled:e.enabled,visible:e.visible,badgeNumber:Number.parseInt(e.getAttribute(`badge-number`)??`0`,10)||0,needsAttention:e.hasAttribute(`needs-attention`)};_t.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};vt.set(t,{sidebar:this,spec:r}),e.push(r)}return e}_readModeAttr(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}_readSelectedAttr(){return Number.parseFloat(this.getAttribute(`selected`)??``)}_reflectSelected(){this._reflecting=!0,this.setAttribute(`selected`,String(this._state.selected)),this._reflecting=!1}_onSelectionChanged(e){this._reflectSelected(),this._applySelection(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected,previous:e.previous,interactive:e.interactive}}))}_activate(e){this._state.activate(e).activated&&this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:e}}))}_rebuild(){let e=new Map;for(let t of this._state.headers)e.set(t.sectionIndex,t);let t=[];for(let e of this._state.visibleItems){let n=t[t.length-1];n&&n.sectionIndex===e.sectionIndex?n.items.push(e):t.push({sectionIndex:e.sectionIndex,items:[e]})}this._rows=[];let n=[];for(let r of t){let t=e.get(r.sectionIndex);t&&n.push(this._createHeader(t));let i=document.createElement(`div`);i.className=`adw-sidebar-section`;for(let e of r.items){let t=this._createRow(e);i.appendChild(t),this._rows.push({el:t,index:e.index})}n.push(i)}this._listEl.replaceChildren(...n),this.classList.toggle(`empty`,this._state.isEmpty),this._applySelection()}_createHeader(e){let t=document.createElement(`div`);if(t.className=`adw-sidebar-section-header`,e.kind===`title`){t.classList.add(`has-title`);let n=document.createElement(`span`);n.className=`adw-sidebar-section-heading`,n.textContent=e.title,t.appendChild(n)}else t.classList.add(`separator`);return e.first&&t.classList.add(`first`),t}_createRow(e){let t=e.item,n=document.createElement(`button`);n.type=`button`,n.className=`adw-sidebar-item`,n.setAttribute(`role`,`option`),n.hidden=t.visible===!1,n.disabled=t.enabled===!1;let r=createGtkImage(t.iconName??null,`adw-sidebar-item-icon`);r.hidden=!e.iconVisible,n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-sidebar-item-text`;let a=document.createElement(`span`);a.className=`adw-sidebar-item-title`,a.textContent=t.title,a.hidden=!e.titleVisible,i.appendChild(a);let o=document.createElement(`span`);return o.className=`adw-sidebar-item-subtitle`,o.textContent=t.subtitle??``,o.hidden=!e.subtitleVisible,i.appendChild(o),n.appendChild(i),n.appendChild(this._createIndicator(t)),n.appendChild(createGtkImage(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_createIndicator(e){let t=e.badgeNumber??0,n=e.needsAttention===!0,r=document.createElement(`span`);if(r.className=`indicator`,r.hidden=!n&&t===0,r.classList.toggle(`dot`,t===0),r.classList.toggle(`needs-attention`,n),t>0){let e=document.createElement(`span`);e.className=`numeric`,e.textContent=viewSwitcherBadgeLabel(t),r.appendChild(e)}return r}_applyMode(){let e=this._state.mode===`page`;this.classList.toggle(`page`,e),this.classList.toggle(`mode-sidebar`,!e)}_applySelection(){let e=this._state.selected,t=this._state.selectionVisible;this._rows.forEach((n,r)=>{let i=n.index===e;n.el.classList.toggle(`selected`,i&&t),n.el.setAttribute(`aria-selected`,String(i)),n.el.tabIndex=i||e===-1&&r===0?0:-1})}};customElements.define(`adw-sidebar-item`,AdwSidebarItem),customElements.define(`adw-sidebar-section`,AdwSidebarSection),customElements.define(`adw-sidebar`,AdwSidebar);const yt=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of yt){let r=e.getAttribute(attributeOf(n)),i=r===null?NaN:Number.parseFloat(r);Number.isFinite(i)&&(t[n]=i)}return t}var AdwSpinRow=class extends HTMLElement{_input;_textEl;_controlEl;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`adjustment`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?parseAdjustment(e):e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`)));this._state.configure(e);let t=document.createElement(`div`);t.className=`adw-row-text`,this._textEl=t,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,t.append(this._titleEl,this._subtitleEl);let n=document.createElement(`div`);n.className=`adw-spin-control`,this._controlEl=n;let r=document.createElement(`button`);r.className=`adw-spin-dec`,r.textContent=`−`,r.addEventListener(`click`,()=>this._adjust(-this._state.adjustment.stepIncrement));let i=document.createElement(`input`);i.type=`text`,i.value=this._formatValue(this._state.value),i.addEventListener(`change`,()=>{let e=parseFloat(i.value);Number.isNaN(e)?i.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let a=document.createElement(`button`);a.className=`adw-spin-inc`,a.textContent=`+`,a.addEventListener(`click`,()=>this._adjust(this._state.adjustment.stepIncrement)),n.append(r,i,a),bindSlottedChildren(this,[{name:`adjustment`,consume:e=>this._state.configure(normalizeAdjustment(authoredAdjustment(e)))}]).install(t,n);let o=this.getAttribute(`value`);this._state.setValue(this._roundToStep(o===null?this._state.value:Number.parseFloat(o))),i.value=this._formatValue(this._state.value),this._input=i,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`title`||e===`subtitle`||e===`tooltip-text`||e===`title-lines`||e===`subtitle-lines`){this._renderText();return}if(e===`adjustment`){this._state.configure(parseAdjustment(n));return}this._state.setValue(this._roundToStep(Number.parseFloat(n||`0`)))}}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible,applyRowTooltip(this,[this._textEl,this._controlEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}_adjust(e){this.value=this._state.value+e,this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:this._state.value}}))}_syncValue(){this._input&&(this._input.value=this._formatValue(this._state.value)),this.setAttribute(`value`,String(this._state.value))}_roundToStep(e){if(!Number.isFinite(e))return e;let t=this._countDecimals(this._state.adjustment.stepIncrement);return t>0?parseFloat(e.toFixed(t)):e}_countDecimals(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}_formatValue(e){let t=this._countDecimals(this._state.adjustment.stepIncrement);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);const B=`http://www.w3.org/2000/svg`,V=new Set;let H=0;function tick(e){for(let t of V)t.drawAt(e);H=V.size>0?requestAnimationFrame(tick):0}function startTicking(){H===0&&V.size>0&&(H=requestAnimationFrame(tick))}var AdwSpinner=class extends HTMLElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),V.add(this),this._origin=null,startTicking()}disconnectedCallback(){V.delete(this)}attributeChangedCallback(){this._sync()}drawAt(e){this._origin===null&&(this._origin=e),this._paint(spinnerProgressAt(e-this._origin))}_build(){if(this._svg)return;let e=document.createElementNS(B,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(B,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(B,`circle`);n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-linecap`,`round`),e.append(t,n),this._svg=e,this._track=t,this._arc=n,this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-busy`,`true`),this._sync()}_sync(){let e=this._svg,t=this._track,n=this._arc;if(!e||!t||!n)return;let r=resolveSpinnerSize(this.getAttribute(`size`)),{diameter:i,lineWidth:a}=spinnerGeometry(r,r);this.style.width=`${r}px`,this.style.height=`${r}px`,e.setAttribute(`width`,String(i)),e.setAttribute(`height`,String(i)),e.setAttribute(`viewBox`,`0 0 ${i} ${i}`);let o=(i-a)/2;this._radius=o,this._circumference=2*Math.PI*o;for(let e of[t,n])e.setAttribute(`cx`,String(i/2)),e.setAttribute(`cy`,String(i/2)),e.setAttribute(`r`,String(o)),e.setAttribute(`stroke-width`,String(a));this._paint(this._origin===null?Ne:this._lastProgress)}_lastProgress=Ne;_paint(e){let t=this._arc;if(!t||this._radius<=0)return;this._lastProgress=e;let{end:n,length:r}=spinnerArc(e),i=r*this._radius;t.setAttribute(`stroke-dasharray`,`${i} ${Math.max(this._circumference-i,0)}`),t.setAttribute(`stroke-dashoffset`,String(-n*this._radius))}};customElements.define(`adw-spinner`,AdwSpinner);var PopoverMenuView=class{surface;prefix;onActivate;_model=[];_actions=null;_title=``;_page=[];_openers=new Set;_backRow=null;_key=`[]`;_rows=[];constructor(e,t,n){this.surface=e,this.prefix=t,this.onActivate=n,this.surface.addEventListener(`keydown`,e=>this._onKeyDown(e))}_onKeyDown(e){let t=document.activeElement;if(!(t===null||!this.surface.contains(t))){if(e.key===`ArrowRight`&&this._openers.has(t)){e.preventDefault(),t.click();return}e.key===`ArrowLeft`&&t===this._backRow&&(e.preventDefault(),t.click())}}get rows(){return this._rows}get page(){return this._page}showPage(e){this._page=[...e]}get focusableRows(){return this._rows.filter(e=>!e.hidden&&!e.disabled)}focusPage(e){let t=this.focusableRows;(t[e]??t[0])?.focus()}setMenuModel(e){let t=JSON.stringify(e);t!==this._key&&(this._key=t,this._page=[]),this._model=e}setActions(e){this._actions=e}setTitle(e){this._title=e}reset(){this._page=[]}currentItems(){if(this._page.length===0)return this._model;let e=menuNodeAt(this._model,this._page);return e!==null&&e.kind!==`item`?e.items:this._model}render(){this.surface.replaceChildren(),this._rows=[],this._openers=new Set,this._backRow=null;let e=menuNodeAt(this._model,this._page);this._page.length>0&&e!==null&&e.kind===`submenu`?this.surface.appendChild(this.backRow(e.label)):this._title.length>0&&this.surface.appendChild(this.heading(this._title,`${this.prefix}-title`));let t=``;for(let e of flattenMenu(this.currentItems(),this._page)){e.separated&&this.surface.appendChild(this.separator());let n=e.path.slice(0,-1),r=n.join(`.`);if(r!==t){t=r;let e=this.sectionHeading(n);e!==null&&this.surface.appendChild(this.heading(e,`adw-popover-section-title`))}e.node.kind===`submenu`?this.surface.appendChild(this.submenuRow(e.node.label,e.node.icon,e.path)):this.surface.appendChild(this.itemRow(e.node,e.path))}}sectionHeading(e){if(e.length<=this._page.length)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind===`section`&&t.label!==void 0?t.label:null}heading(e,t){let n=document.createElement(`div`);return n.className=`adw-popover-title ${t}`,n.textContent=e,n}separator(){let e=document.createElement(`div`);return e.className=`adw-popover-separator`,e.setAttribute(`role`,`separator`),e}baseRow(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-popover-item ${e}`,t.tabIndex=-1,this._rows.push(t),t}backRow(e){let t=this.baseRow(`${this.prefix}-item adw-popover-back`);t.setAttribute(`role`,`menuitem`),t.appendChild(createGtkImage(`go-previous`,`${this.prefix}-item-icon`));let n=document.createElement(`span`);return n.className=`${this.prefix}-item-label`,n.textContent=e.length>0?e:`Back`,t.appendChild(n),t.addEventListener(`click`,()=>{this._page=this._page.slice(0,-1),this.render(),this.focusPage(0)}),this._backRow=t,t}submenuRow(e,t,n){let r=this.baseRow(`${this.prefix}-item`);r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),t!==void 0&&t.length>0&&r.appendChild(createGtkImage(t,`${this.prefix}-item-icon`));let i=document.createElement(`span`);return i.className=`${this.prefix}-item-label`,i.textContent=e,r.appendChild(i),r.appendChild(createGtkImage(`go-next`,`adw-popover-item-arrow`)),r.addEventListener(`click`,()=>{this._page=[...n],this.render(),this.focusPage(1)}),this._openers.add(r),r}itemRow(e,t){let n=resolveMenuItemState(e,this._actions??void 0),r=this.baseRow(`${this.prefix}-item`);if(r.hidden=!n.visible,r.disabled=!n.sensitive,n.sensitive||r.setAttribute(`aria-disabled`,`true`),n.role===`normal`)r.setAttribute(`role`,`menuitem`);else{r.setAttribute(`role`,n.role===`check`?`menuitemcheckbox`:`menuitemradio`),r.setAttribute(`aria-checked`,String(n.toggled));let e=document.createElement(`span`);e.className=`adw-popover-item-check ${n.role===`radio`?`radio`:``}`.trim(),r.appendChild(e)}e.icon!==void 0&&e.icon.length>0&&r.appendChild(createGtkImage(e.icon,`${this.prefix}-item-icon`));let i=document.createElement(`span`);if(i.className=`${this.prefix}-item-label`,i.textContent=e.label,r.appendChild(i),e.accel!==void 0&&e.accel.length>0){let t=document.createElement(`span`);t.className=`adw-popover-item-accel`,t.textContent=e.accel,r.appendChild(t)}return r.addEventListener(`click`,()=>{n.sensitive&&this.onActivate(t)}),r}};const bt=[`bottom`,`top`,`start`,`end`],xt=[`start`,`end`],St=[`menu`,`listbox`],Ct=[...St,`dialog`];var GtkPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{if(!this.autohide)return;let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&this.autohide&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`,`autohide`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get autohide(){return this.getAttribute(`autohide`)!==`false`}set autohide(e){this.setAttribute(`autohide`,String(e))}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return bt.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return xt.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return Ct.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden&&!e.disabled)}popup(){this._state.popup()}popdown(){this._state.popdown()}subscribe(e){return this._state.subscribe(t=>e(t.open))}connectedCallback(){this._buildOnce(),this._state.open&&this._bindDocument()}_buildOnce(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover`),this.hasAttribute(`role`)||this.setAttribute(`role`,`menu`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._state.subscribe(e=>this._onStateChange(e.open)),this.hasAttribute(`open`)&&this._state.popup(),this._render())}disconnectedCallback(){this._unbindDocument()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`open`){if(this._reflecting)return;n===null?this._state.popdown():this._state.popup();return}if(e===`role`&&n===null){this.setAttribute(`role`,`menu`);return}this._render()}}_onStateChange(e){e?this._bindDocument():this._unbindDocument(),this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1,this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}_bindDocument(){document.addEventListener(`pointerdown`,this._onDocumentPointerDown),document.addEventListener(`keydown`,this._onDocumentKeyDown,!0)}_unbindDocument(){document.removeEventListener(`pointerdown`,this._onDocumentPointerDown),document.removeEventListener(`keydown`,this._onDocumentKeyDown,!0)}_render(){this.hidden=!this._state.open,this.dataset.position=this.position,this.dataset.align=this.align}_onKeyDown(e){if(!this._state.open||!St.includes(this.popoverRole))return;let t=this.items,n=document.activeElement,r=n===null?-1:t.indexOf(n),i=this.querySelector(`input, textarea`)!==null,{action:a,index:o}=resolvePopoverKey(e.key,{itemCount:t.length,currentIndex:r,hasSearch:i});if(a===`focus`){e.preventDefault(),t[o]?.focus();return}a===`activate`&&(e.preventDefault(),t[o]?.click(),this.dispatchEvent(new CustomEvent(`popover-item-activated`,{bubbles:!0,detail:{index:o}})))}};customElements.define(`gtk-popover`,GtkPopover);const wt={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},Tt={"open-menu-symbolic":`open-menu`,"pan-down-symbolic":`go-down`,"pan-up-symbolic":`go-down`,"pan-start-symbolic":`go-previous`,"pan-end-symbolic":`go-next`},Et={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_menuView;_actions=null;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu-model`,`disabled`,`flat`,`suggested`,`destructive`]}get active(){return this._state.open}get dropdownEnabled(){return this._state.dropdownEnabled}get label(){return this._state.label}set label(e){this.setAttribute(`label`,e??``),this.removeAttribute(`icon-name`)}get iconName(){return this._state.iconName}set iconName(e){this.setAttribute(`icon-name`,e??``),this.removeAttribute(`label`)}get menuModel(){return this._state.menuModel??[]}set menuModel(e){this._state.setMenuModel(this._acceptMenu(e)),this._initialized&&this._render()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,O),n;let r=menuRefusals(n,O);if(r.length===0)return n;console.error(`${O.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._initialized&&this._render()}get dropdownTooltip(){return this._state.dropdownTooltip}set dropdownTooltip(e){this.setAttribute(`dropdown-tooltip`,e??``)}get direction(){return this._state.direction}set direction(e){this.setAttribute(`direction`,e)}get useUnderline(){return this._state.useUnderline}set useUnderline(e){e?this.setAttribute(`use-underline`,``):this.removeAttribute(`use-underline`)}popup(){this._state.openMenu()}popdown(){this._state.closeMenu()}connectedCallback(){this._initialized||(this._initialized=!0,this._inlineLabel=(this.textContent??``).trim(),this.classList.add(`adw-split-button`),this._actionEl=document.createElement(`button`),this._actionEl.type=`button`,this._actionEl.className=`adw-split-button-action`,this._dropdownEl=document.createElement(`button`),this._dropdownEl.type=`button`,this._dropdownEl.className=`adw-split-button-dropdown`,this._dropdownEl.setAttribute(`aria-haspopup`,`menu`),this._arrowEl=createGtkImage(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`gtk-popover`),this._menuEl.classList.add(`adw-split-button-menu`),this._menuEl.setAttribute(`role`,`menu`),this._menuEl.setAttribute(`menu`,``),this._menuEl.setAttribute(`align`,`end`),this.replaceChildren(this._actionEl,this._dropdownEl,this._menuEl),this._menuEl.anchor=this._dropdownEl,this._menuEl.subscribe(e=>{e||(this._state.closeMenu(),this._menuView.reset())}),this._menuView=new PopoverMenuView(this._menuEl,`adw-split-button-menu`,e=>{let t=this._state.activateMenuItem(e);t!==null&&this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,id:t.id??t.label,path:[...e]}}))}),this._menuView.setActions(this._actions),this._actionEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this.dispatchEvent(new CustomEvent(`clicked`,{bubbles:!0}))}),this._dropdownEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this._state.toggleMenu()}),this._syncStateFromAttributes(),this._state.subscribe(e=>this._onStateChange(e)),this._render())}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`label`:case`icon-name`:this._applyContentAttribute(e,n);break;case`use-underline`:this._state.setUseUnderline(n!==null);break;case`direction`:this._state.setDirection(isSplitButtonDirection(n)?n:`down`);break;case`dropdown-tooltip`:this._state.setDropdownTooltip(n??``);break;case`menu-model`:this._state.setMenuModel(this._acceptMenu(parseMenuModel(n),!1));break;default:break}this._render()}}_syncStateFromAttributes(){let e=this.getAttribute(`label`)??(this._inlineLabel.length>0?this._inlineLabel:null),t=this.getAttribute(`icon-name`);e!==null&&this._state.setLabel(e),t!==null&&this._state.setIconName(t),this._state.setUseUnderline(this.hasAttribute(`use-underline`));let n=this.getAttribute(`direction`);isSplitButtonDirection(n)&&this._state.setDirection(n),this._state.setDropdownTooltip(this.getAttribute(`dropdown-tooltip`)??``),this._state.menuModel===null&&this._state.setMenuModel(this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1))}_applyContentAttribute(e,t){if(t!==null){e===`label`?this._state.setLabel(t):this._state.setIconName(t);return}let n=this.getAttribute(e===`label`?`icon-name`:`label`);n===null?this._state.setChild(null):e===`label`?this._state.setIconName(n):this._state.setLabel(n)}_onStateChange(e){for(let t of e.notified)this.dispatchEvent(new CustomEvent(`notify::${t}`,{bubbles:!0}));let t=e.open&&!this._openReflected;e.open!==this._openReflected&&(this._openReflected=e.open,this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.open}}))),this._render(),t&&this._menuView.focusableRows[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._actionEl.disabled=e,this._dropdownEl.disabled=e||!this._state.dropdownEnabled,this.classList.remove(`flat`,`suggested-action`,`destructive-action`);for(let[e,t]of Object.entries(wt))this.hasAttribute(e)&&this.classList.add(t);this._renderContent(),this._renderDropdown(),this._renderMenu()}_renderContent(){let{mode:e,label:t,iconName:n,styleClasses:r}=this._state;this.classList.toggle(`image-button`,r.includes(`image-button`)),this.classList.toggle(`text-button`,r.includes(`text-button`)),this._actionEl.replaceChildren(),this._actionEl.classList.toggle(`icon-only`,e===`icon`),e===`icon`&&n!==null?this._actionEl.appendChild(createGtkImage(n)):e===`label`&&t!==null&&this._actionEl.appendChild(document.createTextNode(t));let i=this.getAttribute(`tooltip`);this._actionEl.title=i??``,e===`icon`?this._actionEl.setAttribute(`aria-label`,i??(n||`Action`)):this._actionEl.removeAttribute(`aria-label`)}_renderDropdown(){let{direction:e,open:t}=this._state,n=splitButtonArrowIcon(e);this._arrowEl.iconName=Tt[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=Et[splitButtonPopupDirection(e)];let{text:r}=resolveDropdownTooltip(this._state.dropdownTooltip);this._dropdownEl.title=r,this._dropdownEl.setAttribute(`aria-label`,r),this._dropdownEl.setAttribute(`aria-expanded`,String(t));let{checked:i}=splitButtonRootState({active:!1,checked:!1,keyboardActivating:!1},{active:!1,checked:t,keyboardActivating:!1});this.classList.toggle(`checked`,i),this.classList.toggle(`active`,t)}_renderMenu(){this._menuEl.open=this._state.open,this._menuView.setMenuModel(this._state.menuModel??[]),this._menuView.render()}};customElements.define(`adw-split-button`,AdwSplitButton);var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`icon-name`,`title`,`description`,`compact`]}connectedCallback(){this._initialized||(this._initialized=!0,this._iconEl=createGtkImage(null,`adw-status-page-icon`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-status-page-title`,this._descEl=document.createElement(`span`),this._descEl.className=`adw-status-page-description`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-status-page-child`,bindSlottedChildren(this,[{name:`child`,into:this._childEl},{into:this._childEl}]).install(this._iconEl,this._titleEl,this._descEl,this._childEl),bindEmptySections(this._childEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){this.hasAttribute(`compact`)&&this.classList.add(`compact`);let e=this.getAttribute(`icon`)??this.getAttribute(`icon-name`);this._iconEl.iconName=e,this._iconEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`title`)??``;this._titleEl.textContent=t,this._titleEl.hidden=!stringIsNotEmpty(t);let n=this.getAttribute(`description`)??``;this._descEl.textContent=n,this._descEl.hidden=!stringIsNotEmpty(n)}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwSwitchRow=class extends HTMLElement{_switchEl;_prefixEl;_textEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get prefixSection(){return this._prefixEl}get active(){return this._initialized?this._state.active:this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-switch-row-prefix`,this._switchEl=document.createElement(`gtk-switch`),this._switchEl.unfocusable=!0,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl}]).install(this._prefixEl,e,this._switchEl),bindEmptySections(this._prefixEl),this._state.setActive(this.hasAttribute(`active`)),this._switchEl.active=this._state.active,this.setAttribute(`role`,`switch`),this.setAttribute(`aria-checked`,String(this._state.active)),this._switchEl.addEventListener(`notify::active`,e=>{e.stopPropagation(),this._apply(this._state.setActive(this._switchEl.active))}),this.addEventListener(`click`,e=>{e.target instanceof Node&&this._switchEl.contains(e.target)||this._apply(this._state.activate())}),attachRowActivation({row:this,activatable:()=>!0}),this._renderText()}attributeChangedCallback(e){this._initialized&&(e===`active`?this._apply(this._state.setActive(this.hasAttribute(`active`))):this._renderText())}_apply(e){e&&(this._switchEl.active=this._state.active,this.toggleAttribute(`active`,this._state.active),this.setAttribute(`aria-checked`,String(this._state.active)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this._state.active}})))}_renderText(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r,applyRowTooltip(this,[this._prefixEl,this._textEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-switch-row`,AdwSwitchRow);const createTabChip=e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-tab`,t.setAttribute(`role`,`tab`);let n=createGtkImage(null,`adw-tab-icon`),r=document.createElement(`adw-spinner`);r.className=`adw-tab-spinner`,r.setAttribute(`size`,`16`),r.hidden=!0;let i=document.createElement(`span`);i.className=`adw-tab-title`;let a=createGtkImage(null,`adw-tab-indicator`),o=document.createElement(`button`);return o.type=`button`,o.className=`adw-tab-close`,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),e.onClose()}),t.append(n,r,i,a,o),t.addEventListener(`click`,()=>e.onSelect()),t.addEventListener(`pointerenter`,()=>e.onHover(!0)),t.addEventListener(`pointerleave`,()=>e.onHover(!1)),{el:t,icon:n,spinner:r,label:i,indicator:a,close:o}},refreshTabChip=(e,t,n)=>{e.label.textContent=t.title,e.el.title=tabTooltip(t),e.el.classList.toggle(`pinned`,t.pinned),e.el.classList.toggle(`needs-attention`,t.needsAttention),e.el.classList.toggle(`closing`,t.closing);let r=tabIconState(t,n);e.icon.iconName=r.icon,e.icon.hidden=!r.iconVisible||r.spinner,e.spinner.hidden=!(r.spinner&&r.iconVisible),e.indicator.iconName=t.indicatorIcon,e.indicator.hidden=!r.indicatorVisible},chipPosition=(e,t)=>t.getBoundingClientRect().left-e.getBoundingClientRect().left+e.scrollLeft,refreshTabChipClose=(e,t,n,r)=>{let i=e.scrollLeft,a=chipPosition(e,t.el),o=a>=i&&a+t.el.offsetWidth<=i+e.clientWidth;t.close.hidden=!tabCloseVisible({hovering:r.hovering,fullyVisible:o,selected:r.selected,dragging:!1,pinned:n.pinned})},scrollChipIntoBar=(e,t)=>{let n=e.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=e.scrollLeft,a=chipPosition(e,t),o=Math.min(r,n-r)/2;a-5<i?e.scrollLeft=a-o:a+r+5>i+n&&(e.scrollLeft=a+r+o-n)},Dt=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends HTMLElement{_boxEl;_startEl;_endEl;_indicatorEl;_chips=new Map;_hovered=new Set;_view=null;_initialized=!1;_preferredAction=null;_dropTypes=[];_dropActions=[];_dropArmed=!1;static get observedAttributes(){return[`view`,`autohide`,`expand-tabs`,`inverted`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}get startActionWidget(){return this._startEl?.firstElementChild??null}set startActionWidget(e){this.startActionWidget!==e&&(this._startEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::start-action-widget`,{bubbles:!0,detail:{widget:e}})))}get endActionWidget(){return this._endEl?.firstElementChild??null}set endActionWidget(e){this.endActionWidget!==e&&(this._endEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::end-action-widget`,{bubbles:!0,detail:{widget:e}})))}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){e?this.setAttribute(`inverted`,``):this.removeAttribute(`inverted`)}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){e?this.setAttribute(`extra-drag-preload`,``):this.removeAttribute(`extra-drag-preload`)}get tabsRevealed(){return tabsRevealed({autohide:this.autohide,nPages:this._view?.nPages??0,nPinnedPages:this._view?.nPinnedPages??0,isTransferringPage:!1})}get isOverflowing(){return this._initialized?this.scrollWidth>this.clientWidth:!1}get extraDragPreferredAction(){return this._preferredAction}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._syncChips(),this._applyRevealed(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._syncChips();return}this._initialized=!0,this.classList.add(`adw-tab-bar`),this.setAttribute(`role`,`tablist`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-tab-bar-start-action`,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-tab-box`,this._indicatorEl=document.createElement(`div`),this._indicatorEl.className=`adw-tab-box-overflow`,this._indicatorEl.hidden=!0,this._boxEl.appendChild(this._indicatorEl),this._endEl=document.createElement(`div`),this._endEl.className=`adw-tab-bar-end-action`,bindSlottedChildren(this,[{name:`start-action-widget`,into:this._startEl},{name:`end-action-widget`,into:this._endEl}]).install(this._startEl,this._boxEl,this._endEl);let e=this.getAttribute(`view`);this.setView(e===null?null:this._resolveView(e)),this._bindView(),this._syncChips(),this._applyRevealed(),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`drop`,this._onDrop)}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`view`:this.setView(n===null?null:this._resolveView(n));return;case`autohide`:this._applyRevealed();break;case`expand-tabs`:case`inverted`:case`extra-drag-preload`:break}(n!==null||e===`view`)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}}))}}setupExtraDropTarget(e,t=[`copy`,`move`]){this._dropTypes=e,this._dropActions=t}_resolveView(e){return document.getElementById(e)??null}_bindView(){this._unbindView();for(let e of Dt)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Dt)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncChips(),this._applyRevealed()};_syncChips(){let e=this._view?.pages??[],t=new Set;e.forEach((e,n)=>{t.add(e.id);let r=this._chips.get(e.id);if(r===void 0){let t=createTabChip({onSelect:()=>this._view?.setSelectedPage(e.id),onClose:()=>this._view?.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshOne(e.id)}});t.el.dataset.pageId=e.id,t.close.tabIndex=-1,this._chips.set(e.id,t),this._boxEl.insertBefore(t.el,this._boxEl.children[n]??null)}else this._boxEl.children[n]!==r.el&&this._boxEl.insertBefore(r.el,this._boxEl.children[n]??null);this._refreshOne(e.id)});for(let[e,n]of this._chips)t.has(e)||(n.el.remove(),this._chips.delete(e),this._hovered.delete(e));this._applyActiveState(),this._boxEl.classList.toggle(`single-tab`,e.length<=1),this._applyOverflow()}_refreshOne(e){let t=this._view?.pages.find(t=>t.id===e),n=this._chips.get(e);t===void 0||n===void 0||(refreshTabChip(n,t,this._view?.getAttribute(`default-icon`)),refreshTabChipClose(this,n,t,{hovering:this._hovered.has(e),selected:this._view?.selectedId===e}))}_applyActiveState(){let e=this._view?.selectedId??null;for(let[t,n]of this._chips){let r=t===e;n.el.classList.toggle(`active`,r),n.el.setAttribute(`aria-selected`,String(r)),n.el.tabIndex=r?0:-1;let i=this._view?.pages.find(e=>e.id===t);i!==void 0&&refreshTabChipClose(this,n,i,{hovering:this._hovered.has(t),selected:r})}if(e===null)return;let t=this._chips.get(e);t!==void 0&&scrollChipIntoBar(this,t.el)}_applyRevealed(){this.hidden=!this.tabsRevealed}_applyOverflow(){this._indicatorEl.hidden=!this.isOverflowing}_onKeyDown(e){let t=this._view;if(t===null)return;let n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?t.cyclePreviousPage():t.cycleNextPage();else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?t.selectPreviousPage():t.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?t.selectFirstPage():t.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let r=Number.parseInt(e.key,10);n=t.selectNthPage(r===0?9:r-1)}else e.key===`ArrowLeft`||e.key===`ArrowRight`?n=e.key===`ArrowLeft`?t.selectPreviousPage():t.selectNextPage():(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?t.selectFirstPage():t.selectLastPage());if(!n)return;e.preventDefault();let r=t.selectedId;r!==null&&this._chips.get(r)?.el.focus({preventScroll:!0})}_onDragOver=e=>{this._dropTypes.length===0||e.dataTransfer===null||[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t))!==void 0&&(e.preventDefault(),e.dataTransfer.dropEffect!==`none`&&(e.dataTransfer.dropEffect=this._dropEffects(e)),this._armHoverValue())};_onDrop=e=>{if(this._dropTypes.length===0||e.dataTransfer===null)return;let t=[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t));if(t===void 0)return;e.preventDefault();let n=this._dropEffects(e),r=this.dispatchEvent(new CustomEvent(`extra-drag-drop`,{bubbles:!0,cancelable:!0,detail:{action:n,data:e.dataTransfer.getData(t)}}));e.dataTransfer.dropEffect=r?n:`none`};_dropEffects(e){let t=this._preferredAction;return t!==null&&this._dropActions.includes(t)?t:this._dropActions[0]??`copy`}_armHoverValue(){if(this._dropArmed)return;this._dropArmed=!0;let e=new CustomEvent(`extra-drag-value`,{bubbles:!0,cancelable:!0,detail:{action:null}});this.dispatchEvent(e);let t=e.detail.action;t!==this._preferredAction&&(this._preferredAction=t,this.dispatchEvent(new CustomEvent(`notify::extra-drag-preferred-action`,{bubbles:!0,detail:{action:t}})))}};customElements.define(`adw-tab-bar`,AdwTabBar);const Ot=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends HTMLElement{_button;_binEl;_labelEl;_indicatorEl;_view=null;_initialized=!1;static get observedAttributes(){return[`view`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._render(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._render();return}this._initialized=!0,this._button=document.createElement(`button`),this._button.type=`button`,this._button.className=`adw-button image-button`,this._button.title=`View Open Tabs`,this._binEl=document.createElement(`span`),this._binEl.className=`adw-tab-button-indicatorbin`;let e=document.createElement(`span`);e.className=`adw-tab-button-plate`,this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-tab-button-label numeric`,this._indicatorEl=document.createElement(`span`),this._indicatorEl.className=`adw-tab-button-indicator`,this._binEl.append(e,this._labelEl),this._button.append(this._binEl,this._indicatorEl),this.replaceChildren(this._button),this.setAttribute(`role`,`button`);let t=this.getAttribute(`view`);this.setView(t===null?null:this._resolveView(t)),this._bindView(),this._render()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){!this._initialized||e!==`view`||this.setView(n===null?null:this._resolveView(n))}_resolveView(e){return document.getElementById(e)??null}_onViewChange=()=>this._render();_bindView(){this._unbindView();for(let e of Ot)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Ot)this._view?.removeEventListener(e,this._onViewChange)}_render(){let e=this._view,t=e?.nPages??0,n=t<100;this._labelEl.textContent=n?String(t):``,this._labelEl.hidden=!n,this._labelEl.classList.toggle(`small`,t>=10),this._binEl.classList.toggle(`overflow`,!n);let r=e?.selectedId??null,i=e?.pages.some(e=>e.needsAttention&&e.id!==r)??!1;this._indicatorEl.classList.toggle(`needs-attention`,i),this._indicatorEl.hidden=!i,this._button.setAttribute(`aria-label`,`View Open Tabs (${t})`)}};customElements.define(`adw-tab-button`,AdwTabButton);var AdwTabOverview=class extends HTMLElement{_childEl;_overviewEl;_headerEl;_startButtonsEl;_endButtonsEl;_titleEl;_searchBtn;_searchEntry;_searchClamp;_searchBar;_menuBtn;_gridEl;_pinnedGridEl;_emptyState;_searchEmptyState;_newTabBtn;_thumbs=new Map;_view=null;_model=[];_searchActive=!1;_initialized=!1;_appliedOpen=!1;_reflecting=!1;static get observedAttributes(){return[`view`,`open`,`inverted`,`enable-search`,`enable-new-tab`,`secondary-menu`,`show-start-title-buttons`,`show-end-title-buttons`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._initialized&&this._syncAll(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}get child(){return this._childEl.firstElementChild}get open(){return this.hasAttribute(`open`)}set open(e){this.setOpen(e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,e)}get enableSearch(){return this.getAttribute(`enable-search`)!==`false`}set enableSearch(e){this.setAttribute(`enable-search`,String(e))}get searchActive(){return this._searchActive}get enableNewTab(){return this.hasAttribute(`enable-new-tab`)}set enableNewTab(e){this.toggleAttribute(`enable-new-tab`,e)}get secondaryMenu(){return this._model}set secondaryMenu(e){let t=normalizeMenuModel(e);assertMenuRenderable(t,O),this._model=t,this._applyMenu()}get showStartTitleButtons(){return this.getAttribute(`show-start-title-buttons`)!==`false`}set showStartTitleButtons(e){this.setAttribute(`show-start-title-buttons`,String(e))}get showEndTitleButtons(){return this.getAttribute(`show-end-title-buttons`)!==`false`}set showEndTitleButtons(e){this.setAttribute(`show-end-title-buttons`,String(e))}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){this.toggleAttribute(`extra-drag-preload`,e)}get extraDragPreferredAction(){return 0}activateOverviewOpen(){return this.open||this._view===null?!1:(this.setOpen(!0),!0)}activateOverviewClose(){return!this.open||this._view===null||this._view.nPages===0?!1:(this.setOpen(!1),!0)}connectedCallback(){if(this._initialized){this._bindView(),this._syncAll();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-tab-overview-child`,this._overviewEl=document.createElement(`div`),this._overviewEl.className=`overview adw-tab-overview-toolbar`,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-header-bar overview-header-bar`,this._startButtonsEl=document.createElement(`div`),this._startButtonsEl.className=`overview-title-buttons start`,this._endButtonsEl=document.createElement(`div`),this._endButtonsEl.className=`overview-title-buttons end`,this._searchBtn=document.createElement(`button`),this._searchBtn.type=`button`,this._searchBtn.className=`adw-button image-button search-button`,this._searchBtn.title=`Search Tabs`,this._searchBtn.appendChild(createGtkImage(`system-search`,`search-button-icon`)),this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-window-title numeric overview-title`,this._menuBtn=document.createElement(`gtk-menu-button`),this._menuBtn.setAttribute(`icon-name`,`view-more`),this._menuBtn.className=`secondary-menu-button`,this._menuBtn.hidden=!0,this._headerEl.append(this._startButtonsEl,this._searchBtn,this._titleEl,this._endButtonsEl,this._menuBtn),this._searchBar=document.createElement(`div`),this._searchBar.className=`adw-search-bar overview-search-bar`,this._searchClamp=document.createElement(`div`),this._searchClamp.className=`adw-clamp overview-search-clamp`,this._searchEntry=document.createElement(`input`),this._searchEntry.type=`search`,this._searchEntry.className=`adw-entry overview-search-entry`,this._searchEntry.placeholder=`Search tabs`,this._searchEntry.setAttribute(`aria-label`,`Search tabs`),this._searchClamp.appendChild(this._searchEntry),this._searchBar.appendChild(this._searchClamp);let e=document.createElement(`div`);e.className=`adw-tab-overview-content`;let t=document.createElement(`div`);t.className=`adw-tab-overview-scroll`,this._pinnedGridEl=this._createGrid(`adw-tab-grid pinned-grid`,`Pinned tabs`),this._gridEl=this._createGrid(`adw-tab-grid`,`Open tabs`),t.append(this._pinnedGridEl,this._gridEl),this._emptyState=document.createElement(`adw-status-page`),this._emptyState.className=`overview-empty-state`,this._emptyState.setAttribute(`icon`,`view-grid`),this._emptyState.setAttribute(`title`,`No Open Tabs`),this._emptyState.hidden=!0,this._searchEmptyState=document.createElement(`adw-status-page`),this._searchEmptyState.className=`overview-search-empty-state`,this._searchEmptyState.setAttribute(`icon`,`system-search`),this._searchEmptyState.setAttribute(`title`,`No Tabs Found`),this._searchEmptyState.setAttribute(`description`,`Try a different search`),this._searchEmptyState.hidden=!0,this._newTabBtn=document.createElement(`button`),this._newTabBtn.type=`button`,this._newTabBtn.className=`adw-button pill suggested-action new-tab-button`,this._newTabBtn.append(createGtkImage(`list-add`,`new-tab-button-icon`),document.createTextNode(`New Tab`)),e.append(t,this._emptyState,this._searchEmptyState,this._newTabBtn),this._overviewEl.append(this._headerEl,this._searchBar,e);let n=Array.from(this.children);this.replaceChildren(this._childEl,this._overviewEl);for(let e of n)this._childEl.appendChild(e);this._searchEntry.addEventListener(`input`,()=>this._onSearchChanged()),this._searchEntry.addEventListener(`keydown`,e=>this._onSearchKeyDown(e)),this._searchBtn.addEventListener(`click`,()=>this._toggleSearchMode()),this._newTabBtn.addEventListener(`click`,()=>this._requestCreateTab()),this.addEventListener(`keydown`,e=>this._onKeyDown(e));let r=this.getAttribute(`view`);this.setView(r===null?this._findView():this._resolveView(r)),r!==null&&this.removeAttribute(`view`);let i=this.getAttribute(`secondary-menu`);i!==null&&(this.secondaryMenu=JSON.parse(i),this.removeAttribute(`secondary-menu`)),this._applyOpen(),this._syncAll()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`view`:this.setView(n===null?this._findView():this._resolveView(n));return;case`open`:this._reflecting||this._applyOpen();return;case`secondary-menu`:if(n===null)return;try{this.secondaryMenu=JSON.parse(n)}catch(e){console.error(`<adw-tab-overview secondary-menu> is not valid JSON: ${String(e)}`)}return;case`enable-new-tab`:this._applyNewTabButton();return;case`inverted`:this._syncGrids();return;case`enable-search`:case`show-start-title-buttons`:case`show-end-title-buttons`:this._applyHeaderBar();return}}_resolveView(e){return document.getElementById(e)??this._findView()}_findView(){return this.querySelector(`adw-tab-view`)}_bindView(){this._unbindView();for(let e of At)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of At)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncAll()};_syncAll(){this._applyTitle(),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton(),this._applyHeaderBar()}_applyTitle(){let e=this._view;this._titleEl.textContent=e===null?``:e.nPages===1?`1 Tab`:`${e.nPages} Tabs`}_syncGrids(){let e=this._view,t=this._searchActive?this._searchEntry.value:``,n=new Set,r=[],i=[];if(e!==null)for(let a of e.pages){if(!tabSearchMatches(a,t)){this._thumbs.get(a.id)?.root.remove(),this._thumbs.delete(a.id);continue}n.add(a.id);let e=this._thumbFor(a.id);this._refreshThumb(e,a),(a.pinned?r:i).push(e.root)}for(let[e,t]of this._thumbs)n.has(e)||(t.root.remove(),this._thumbs.delete(e));this._pinnedGridEl.replaceChildren(...r),this._gridEl.replaceChildren(...i),this._pinnedGridEl.hidden=r.length===0}_applyEmptyStates(){let e=this._pinnedGridEl.childElementCount===0&&this._gridEl.childElementCount===0;this._emptyState.hidden=!(e&&!this._searchActive),this._searchEmptyState.hidden=!(e&&this._searchActive)}_applyNewTabButton(){this._newTabBtn.hidden=!(this.enableNewTab&&!this._searchActive)}_applyHeaderBar(){let e=this._model.length>0;this._headerEl.hidden=!(this.enableSearch||e||this.showStartTitleButtons||this.showEndTitleButtons),this._startButtonsEl.hidden=!this.showStartTitleButtons,this._endButtonsEl.hidden=!this.showEndTitleButtons,this._searchBtn.hidden=!this.enableSearch,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._menuBtn.hidden=!e}_applyMenu(){let e=this._menuBtn;this._model.length>0&&(e.menuModel=this._model),this._applyHeaderBar()}_applyOpen(){let e=this.open;this._overviewEl.hidden=!e,this._childEl.classList.toggle(`background`,e),this._childEl.inert=e,e!==this._appliedOpen&&(this._appliedOpen=e,this._reflecting=!0,e?this.hasAttribute(`open`)||this.setAttribute(`open`,``):this.hasAttribute(`open`)&&(this._searchMode=!1,this._setSearchActive(!1),this._searchEntry.value=``,this.removeAttribute(`open`)),this._reflecting=!1,this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}})))}setOpen(e){this.open!==e&&(this._reflecting=!0,this.toggleAttribute(`open`,e),this._reflecting=!1,this._applyOpen(),e&&this._syncAll())}_searchMode=!1;_toggleSearchMode(){this._searchMode=!this._searchMode,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._searchMode?this._searchEntry.focus():this._stopSearch()}_onSearchChanged(){this._setSearchActive(this._searchEntry.value!==``),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_stopSearch(){this._searchEntry.value=``,this._setSearchActive(!1),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_setSearchActive(e){e!==this._searchActive&&(this._searchActive=e,this.dispatchEvent(new CustomEvent(`notify::search-active`,{bubbles:!0,detail:{searchActive:e}})))}_onSearchKeyDown(e){if(e.key===`Escape`){this._stopSearch(),this._searchMode=!1,this._searchBar.hidden=!this.enableSearch||!this._searchMode;return}e.key===`Enter`&&this._searchActive&&(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault()}_onKeyDown(e){if(!this.open)return;let t=e.target;if(t instanceof Node&&!this._onGridKey(e,t)&&!(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)){if(e.key===`ArrowDown`){if(this._searchBar.contains(t)||this._searchBtn.contains(t)){(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault();return}if(this._menuBtn.contains(t)){(this._focusLastRow(this._pinnedGridEl)||this._focusLastRow(this._gridEl))&&e.preventDefault();return}if(this._newTabBtn.contains(t))return;(this._gridEl.contains(t)||this._pinnedGridEl.contains(t))&&this._newTabBtn.hidden===!1&&(e.preventDefault(),this._newTabBtn.focus());return}this._newTabBtn.contains(t)&&(this._focusLastRow(this._gridEl)||this._focusLastRow(this._pinnedGridEl))&&e.preventDefault()}}_onGridKey(e,t){if(e.altKey||e.ctrlKey||e.metaKey)return!1;let n=[this._pinnedGridEl,this._gridEl].find(e=>e.contains(t));if(n===void 0)return!1;let r=[...n.children].filter(e=>e instanceof HTMLElement),i=r.findIndex(e=>e.contains(t));if(i<0||t instanceof Element&&t.closest(`button`)!==null)return!1;let a=this._view;if(a===null)return!1;if(e.key===`Enter`||e.key===` `){let t=r[i].dataset.pageId;return t===void 0?!1:(e.preventDefault(),a.setSelectedPage(t),this.setOpen(!1),!0)}let o=gridColumns(r.map(e=>e.getBoundingClientRect().top)),s=gridNavigate(e.key,i,r.length,o);if(s===null){let t=[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key);return t&&e.preventDefault(),t}let c=r[s].dataset.pageId;return c===void 0?!1:(e.preventDefault(),a.setSelectedPage(c),r[s].focus(),!0)}_focusFirstRow(e){let t=e.querySelector(`.adw-tab-thumbnail`);return t===null?!1:(t.focus(),!0)}_focusLastRow(e){let t=e.querySelectorAll(`.adw-tab-thumbnail`),n=t[t.length-1];return n===void 0?!1:(n.focus(),!0)}_requestCreateTab(){let e=this._view;if(e===null)return;let t={page:null};if(this.dispatchEvent(new CustomEvent(`create-tab`,{bubbles:!0,detail:t})),t.page===null){console.error("<adw-tab-overview>: the create-tab handler must not leave `detail.page` unset.");return}e.setSelectedPage(t.page.id),this.setOpen(!1),t.page.content?.focus?.()}_createGrid(e,t){let n=document.createElement(`div`);return n.className=e,n.setAttribute(`role`,`grid`),n.setAttribute(`aria-label`,t),n}_thumbFor(e){let t=this._thumbs.get(e);if(t!==void 0)return t;let n=document.createElement(`div`);n.className=`adw-tab-thumbnail`,n.dataset.pageId=e,n.setAttribute(`role`,`gridcell`),n.tabIndex=-1;let r=document.createElement(`div`);r.className=`contents`;let i=document.createElement(`div`);i.className=`thumbnail`;let a=document.createElement(`div`);a.className=`card`;let o=document.createElement(`div`);o.className=`picture`;let s=document.createElement(`span`);s.className=`picture-portrait`,o.appendChild(s);let c=document.createElement(`button`);c.type=`button`,c.className=`tab-close-button adw-button image-button`,c.title=`Close Tab`,c.setAttribute(`aria-label`,`Close Tab`),c.tabIndex=-1,c.appendChild(createGtkImage(`window-close`,`tab-close-icon`));let l=document.createElement(`button`);l.type=`button`,l.className=`tab-unpin-icon`,l.tabIndex=-1,l.title=`Unpin Tab`,l.setAttribute(`aria-label`,`Unpin Tab`),l.dataset.iconName=`adw-tab-unpin-symbolic`;let u=document.createElement(`button`);u.type=`button`,u.className=`tab-indicator adw-button image-button`,u.tabIndex=-1;let d=createGtkImage(null,`tab-indicator-icon`);u.appendChild(d),a.append(o,c,l,u);let f=document.createElement(`div`);f.className=`needs-attention`;let p=document.createElement(`div`);p.className=`gizmo`,f.appendChild(p),i.append(a,f);let m=document.createElement(`div`);m.className=`icon-title-box`;let g=createGtkImage(null,`tab-icon`),_=document.createElement(`span`);_.className=`tab-label`,m.append(g,_),r.append(i,m),n.appendChild(r),n.addEventListener(`click`,()=>{let t=this._view;t!==null&&(t.setSelectedPage(e),this.setOpen(!1))}),n.addEventListener(`auxclick`,t=>{t.button===1&&(t.preventDefault(),this._view?.closePage(e))}),c.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.closePage(e)}),l.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.setPagePinned(e,!1)}),u.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.dispatchEvent(new CustomEvent(`indicator-activated`,{bubbles:!0,detail:{id:e}}))});let ee={root:n,label:_,icon:g,spinner:null,picture:o,portrait:s,closeBtn:c,unpinIcon:l,indicatorBtn:u,indicatorIcon:d,attention:f};return this._thumbs.set(e,ee),ee}_refreshThumb(e,t){if(e.root.title=tabTooltip(t),e.root.setAttribute(`aria-label`,tabTooltip(t)),e.icon.hidden=t.icon===null&&!t.loading,e.root.classList.toggle(`loading`,t.loading),t.loading&&e.spinner===null){let t=document.createElement(`adw-spinner`);t.className=`tab-spinner`,t.setAttribute(`size`,String(kt)),e.icon.replaceWith(t),e.spinner=t}else!t.loading&&e.spinner!==null&&(e.spinner.replaceWith(e.icon),e.spinner=null);e.indicatorBtn.hidden=t.indicatorIcon===null,e.indicatorIcon.iconName=t.indicatorIcon,e.attention.hidden=!t.needsAttention,e.root.classList.toggle(`inverted`,this.inverted),e.closeBtn.hidden=t.pinned,e.unpinIcon.hidden=!t.pinned,e.label.textContent=t.title,e.portrait.textContent=t.title;let n=this._view?.selectedId===t.id;e.root.classList.toggle(`selected`,n),e.root.setAttribute(`aria-selected`,String(n))}};const kt=`16`,At=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const jt=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return jt}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}attributeChangedCallback(e,t,n){let r=this.closest(`adw-tab-view`);r instanceof AdwTabView&&r.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_chips=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected-page`,`autohide`,`expand-tabs`,`no-close`]}constructor(){super(),this._barEl=document.createElement(`div`),this._barEl.className=`adw-tab-bar`,this._barEl.setAttribute(`role`,`tablist`),this._tabBoxEl=document.createElement(`div`),this._tabBoxEl.className=`adw-tab-box`,this._barEl.appendChild(this._tabBoxEl),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-tab-view-pages`,this._state.subscribePages(e=>this._onPagesChange(e)),this._state.subscribe(e=>this._onSelectionChange(e))}get selectedPage(){return this._state.selectedPage}set selectedPage(e){this._state.setSelectedPage(e)}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get noClose(){return this.hasAttribute(`no-close`)}set noClose(e){e?this.setAttribute(`no-close`,``):this.removeAttribute(`no-close`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`selected-page`),t=Array.from(this.children);this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)e.localName===`adw-tab-page`?this._adoptDeclaredPage(e):this.appendPage({id:this._nextId(),content:e});e!==null&&this._applySelectedAttribute(e),this._applyBarVisibility(),this._reflectSelected(),this.addEventListener(`keydown`,e=>this._onKeyDown(e))}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`selected-page`){if(this._reflecting)return;let e=this.getAttribute(`selected-page`);e!==null&&this._applySelectedAttribute(e);return}this._applyBarVisibility()}}syncDeclaredPage(e,t,n){let r=e.dataset.pageId;if(r!==void 0)switch(t){case`title`:this._state.setPageTitle(r,n);return;case`tooltip`:this._state.setPageTooltip(r,n);return;case`icon`:this._state.setPageIcon(r,n);return;case`indicator-icon`:this._state.setPageIndicatorIcon(r,n);return;case`keyword`:this._state.setPageKeyword(r,n);return;case`loading`:this._state.setPageLoading(r,n!==null);return;case`needs-attention`:this._state.setPageNeedsAttention(r,n!==null);return;case`pinned`:this._state.setPagePinned(r,n!==null);return}}get pages(){return this._state.pages}get nPages(){return this._state.nPages}get nPinnedPages(){return this._state.nPinnedPages}get selectedId(){return this._state.selectedId}get selectedIndex(){return this._state.selectedIndex}get selectedContent(){return this._state.selectedPage?.content??null}isClosing(e){return this._state.isClosing(e)}setSelectedPage(e){return this._state.setSelectedPage(e)}selectNthPage(e){return this._state.selectNthPage(e)}selectPreviousPage(){return this._state.selectPreviousPage()}selectNextPage(){return this._state.selectNextPage()}selectFirstPage(){return this._state.selectFirstPage()}selectLastPage(){return this._state.selectLastPage()}cycleNextPage(){return this._state.cycleNextPage()}cyclePreviousPage(){return this._state.cyclePreviousPage()}addPage(e,t=null){return this._state.addPage(this._withPanel(e),t)}insertPage(e,t){return this._state.insertPage(this._withPanel(e),t)}prependPage(e){return this._state.prependPage(this._withPanel(e))}appendPage(e){return this._state.appendPage(this._withPanel(e))}insertPinnedPage(e,t){return this._state.insertPinnedPage(this._withPanel(e),t)}prependPinnedPage(e){return this._state.prependPinnedPage(this._withPanel(e))}appendPinnedPage(e){return this._state.appendPinnedPage(this._withPanel(e))}setPagePinned(e,t){return this._state.setPagePinned(e,t)}closePage(e){return this._state.closePage(e)}closePageFinish(e,t){return this._state.closePageFinish(e,t)}closeOtherPages(e){this._state.closeOtherPages(e)}closePagesBefore(e){this._state.closePagesBefore(e)}closePagesAfter(e){this._state.closePagesAfter(e)}detachPage(e){return this._state.detachPage(e)}reorderPage(e,t){return this._state.reorderPage(e,t)}reorderBackward(e){return this._state.reorderBackward(e)}reorderForward(e){return this._state.reorderForward(e)}reorderFirst(e){return this._state.reorderFirst(e)}reorderLast(e){return this._state.reorderLast(e)}setPageTitle(e,t){return this._state.setPageTitle(e,t)}setPageTooltip(e,t){return this._state.setPageTooltip(e,t)}setPageKeyword(e,t){return this._state.setPageKeyword(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageIndicatorIcon(e,t){return this._state.setPageIndicatorIcon(e,t)}setPageLoading(e,t){return this._state.setPageLoading(e,t)}setPageNeedsAttention(e,t){return this._state.setPageNeedsAttention(e,t)}get diagnostics(){return this._state.diagnostics}_adoptDeclaredPage(e){let t={id:e.getAttribute(`page-id`)??this._nextId(),title:e.getAttribute(`title`),tooltip:e.getAttribute(`tooltip`),icon:e.getAttribute(`icon`),indicatorIcon:e.getAttribute(`indicator-icon`),loading:e.hasAttribute(`loading`),needsAttention:e.hasAttribute(`needs-attention`),content:e};e.hasAttribute(`pinned`)?this.appendPinnedPage(t):this.appendPage(t)}_withPanel(e){let t=e.content??document.createElement(`adw-tab-page`);return t.classList.add(`adw-tab-page`),t.setAttribute(`role`,`tabpanel`),t.dataset.pageId=e.id,{...e,content:t}}_nextId(){return this._generatedIds+=1,`tab-${this._generatedIds}`}_onPagesChange(e){switch(e.kind){case`attached`:{let t=this._state.getPage(e.id);t&&this._insertTab(t,e.position);break}case`detached`:this._tabs.get(e.id)?.remove(),this._tabs.delete(e.id),this._chips.delete(e.id),this._hovered.delete(e.id),this._panels.get(e.id)?.remove(),this._panels.delete(e.id);break;case`reordered`:case`pinned`:this._moveTab(e.id,e.position),this._refreshTab(e.id);break;case`updated`:this._refreshTab(e.id);break}this._applyBarVisibility(),this._applyActiveState(),this.dispatchEvent(new CustomEvent(`page-${e.kind}`,{bubbles:!0,detail:{id:e.id,position:e.position,previousPosition:e.previousPosition}}))}_insertTab(e,t){let n=createTabChip({onSelect:()=>this._state.setSelectedPage(e.id),onClose:()=>this._state.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}});n.el.dataset.pageId=e.id,n.close.tabIndex=-1,this._tabBoxEl.insertBefore(n.el,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n.el),this._chips.set(e.id,n);let r=e.content;r&&(this._panels.set(e.id,r),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null)),this._refreshTab(e.id)}_moveTab(e,t){let n=this._tabs.get(e);n&&(n.remove(),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null));let r=this._panels.get(e);r&&(r.remove(),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null))}_refreshTab(e){let t=this._state.getPage(e),n=this._tabs.get(e);!t||!n||(refreshTabChip(this._chips.get(e),t,this.getAttribute(`default-icon`)),this._refreshCloseVisibility(e))}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._chips.get(e);!t||!n||refreshTabChipClose(this._barEl,n,t,{hovering:this._hovered.has(e),selected:this._state.selectedId===e})}_onSelectionChange(e){this._applyActiveState(),this._scrollSelectedTabIntoBar(),this._reflectSelected(),this.dispatchEvent(new CustomEvent(`notify::selected-page`,{bubbles:!0,detail:{selected:e.selectedIndex,selectedId:e.selectedId,previousId:e.previousId,interactive:e.interactive}}))}_applyActiveState(){let e=this._state.selectedId;for(let t of this._state.pages){let n=t.id===e,r=this._tabs.get(t.id);r&&(r.classList.toggle(`active`,n),r.setAttribute(`aria-selected`,String(n)),r.tabIndex=n?0:-1);let i=t.content;i&&(i.classList.toggle(`active-page`,n),i.hidden=!n),this._refreshCloseVisibility(t.id)}}_scrollSelectedTabIntoBar(){let e=this._state.selectedId,t=e===null?void 0:this._tabs.get(e);t&&scrollChipIntoBar(this._barEl,t)}_applyBarVisibility(){let e=tabsRevealed({autohide:this.autohide,nPages:this._state.nPages,nPinnedPages:this._state.nPinnedPages,isTransferringPage:!1});this._barEl.hidden=!e,this._barEl.classList.toggle(`single-tab`,this._state.nPages<=1)}_reflectSelected(){this._reflecting=!0;let e=this._state.selectedId;e===null?this.removeAttribute(`selected-page`):this.getAttribute(`selected-page`)!==e&&this.setAttribute(`selected-page`,e),this._reflecting=!1}_applySelectedAttribute(e){this._state.setSelectedPage(e)}_onKeyDown(e){let t=e.target instanceof Node&&this._barEl.contains(e.target),n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?this._state.cyclePreviousPage():this._state.cycleNextPage();else if(e.ctrlKey&&e.shiftKey&&(e.key===`PageUp`||e.key===`PageDown`)){let t=this._state.selectedId;t!==null&&(n=e.key===`PageUp`?this._state.reorderBackward(t):this._state.reorderForward(t))}else if(e.ctrlKey&&e.shiftKey&&(e.key===`Home`||e.key===`End`)){let t=this._state.selectedId;t!==null&&(n=e.key===`Home`?this._state.reorderFirst(t):this._state.reorderLast(t))}else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?this._state.selectPreviousPage():this._state.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let t=Number.parseInt(e.key,10);n=this._state.selectNthPage(t===0?9:t-1)}else t&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?n=e.key===`ArrowLeft`?this._state.selectPreviousPage():this._state.selectNextPage():t&&(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage());if(n&&(e.preventDefault(),t)){let e=this._state.selectedId;e!==null&&this._tabs.get(e)?.focus({preventScroll:!0})}}_requestClose(e){return this.dispatchEvent(new CustomEvent(`close-page`,{bubbles:!0,cancelable:!0,detail:{index:this._state.getPagePosition(e.id),id:e.id}}))?!e.pinned:`defer`}};customElements.define(`adw-tab-view`,AdwTabView),customElements.define(`adw-tab-page`,AdwTabPage);const Mt={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=Mt;_currentEl=null;_actions=new WeakMap;constructor(){super(),this._queue=new AdwToastQueue({scheduler:{schedule:(e,t)=>this._scheduler.schedule(e,t),cancel:e=>this._scheduler.cancel(e)},onShow:e=>this._mountToast(e),onHide:()=>this._unmountToast(this._queue.pending>0)})}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-toast-overlay-content`,this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,bindSlottedChildren(this,[{into:e}]).install(e,this._toasts)}get scheduler(){return this._scheduler}set scheduler(e){this._scheduler=e}get currentToast(){return this._queue.current}get pendingToasts(){return this._queue.pending}addToast(e,t={}){this._toasts||this.connectedCallback();let n=typeof t==`number`?{timeout:t/1e3}:t,r=new AdwToast(e,{timeout:(n.timeout??5)*1e3,buttonLabel:n.buttonLabel});n.onAction&&this._actions.set(r,n.onAction),this._queue.add(r)}dismiss(){this._queue.dismiss()}clearToasts(){this._queue.clear()}_mountToast(e){let t=document.createElement(`div`);t.className=`adw-toast`;let n=document.createElement(`div`);n.className=`adw-toast-content-wrapper`;let r=document.createElement(`span`);if(r.className=`adw-toast-title`,r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.hasButton){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.buttonLabel,n.addEventListener(`click`,()=>{this._actions.get(e)?.(),this._queue.dismiss()}),t.appendChild(n)}let i=document.createElement(`button`);i.type=`button`,i.className=`adw-toast-close-button`,i.setAttribute(`aria-label`,`Close`),i.appendChild(createGtkImage(`window-close`)),i.addEventListener(`click`,()=>this._queue.dismiss()),t.appendChild(i),this._toasts.appendChild(t),this._currentEl=t,requestAnimationFrame(()=>{t.classList.add(`visible`)})}_unmountToast(e){let t=this._currentEl;if(this._currentEl=null,t){if(e){t.remove();return}t.classList.remove(`visible`),t.classList.add(`hiding`),t.addEventListener(`transitionend`,()=>t.remove(),{once:!0}),this._scheduler.schedule(()=>{t.parentNode&&t.remove()},300)}}};customElements.define(`adw-toast-overlay`,AdwToastOverlay);var AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`,`tooltip`,`enabled`]}attributeChangedCallback(e,t,n){e===`enabled`&&t!==n&&this.dispatchEvent(new CustomEvent(`toggle-enabled-changed`,{bubbles:!0,composed:!0,detail:{enabled:n!==`false`}}))}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;_stateAttr=`aria-checked`;_names=[];_enabled=[];_toggles=[];static get observedAttributes(){return[`active`,`active-name`,`flat`,`round`,`sensitive`]}get sensitive(){return booleanAttribute$2(this.getAttribute(`sensitive`),!0)}set sensitive(e){this.setAttribute(`sensitive`,e?`true`:`false`)}isToggleEnabled(e){return this._enabled[e]??!1}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}get activeName(){return this._names[this._state.selected]??null}set activeName(e){e===null?this.removeAttribute(`active-name`):this.setAttribute(`active-name`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`)),t=keptToggles(e.map(e=>({el:e,name:e.getAttribute(`name`)}))).map(e=>e.el);t.length<e.length&&console.warn(`[adw-toggle-group] a toggle name already exists; the later toggle is not added`);let n=this.getAttribute(`role`)?.trim()||null;n===null&&this.setAttribute(`role`,`radiogroup`);let r=n===`tablist`,i=r?`tab`:`radio`;this._stateAttr=r?`aria-selected`:`aria-checked`,this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._innerEl.setAttribute(`role`,`none`),this._toggles=t,this._buttons=t.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`,n.setAttribute(`role`,i),this._enabled[t]=booleanAttribute$2(e.getAttribute(`enabled`),!0);let r=e.getAttribute(`label`)??``,a=e.getAttribute(`icon-name`)??``,o=e.getAttribute(`tooltip`)??``;return a&&n.appendChild(createGtkImage(a)),r&&n.appendChild(document.createTextNode(r)),n.title=o,!r&&o?n.setAttribute(`aria-label`,o):a&&!r&&n.setAttribute(`aria-label`,a),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl);for(let e=0;e<this._toggles.length;e++)this._toggles[e].addEventListener(`toggle-enabled-changed`,t=>{let{enabled:n}=t.detail;this._enabled[e]!==n&&(this._enabled[e]=n,this._render())});this._state.setLabels(t.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._names=t.map(e=>e.getAttribute(`name`)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._applyActiveName(),this._render(),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._buttons.filter(e=>!e.disabled),select:e=>this._selectIndex(this._buttons.findIndex(t=>t===e))})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}if(e===`active-name`){this._applyActiveName();return}this._render()}}_applyActiveName(){let e=this.getAttribute(`active-name`);if(e===null)return;let t=toggleIndexOfName(this._names,e);t!==-1&&this._state.setSelected(t)}_readActiveAttr(){let e=Number.parseInt(this.getAttribute(`active`)??`0`,10);if(Number.isNaN(e))return 0;let t=Math.max(0,this._state.count-1);return Math.min(Math.max(e,0),t)}_selectIndex(e){this._enabled[e]&&this._state.setSelected(e)&&(this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}_render(){this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`round`,this.hasAttribute(`round`));let e=this._state.selected,t=this.sensitive;this.toggleAttribute(`disabled`,!t),this._buttons.forEach((n,r)=>{let i=r===e;n.classList.toggle(`active`,i),n.setAttribute(this._stateAttr,String(i)),n.disabled=!t||!this._enabled[r],n.tabIndex=i?0:-1}),this._enabled[e]||this._activateFirstEnabled()}_activateFirstEnabled(){let e=this._enabled.findIndex(e=>e);e!==-1&&(this._state.setSelected(e),this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);var AdwToolbarView=class extends HTMLElement{_topEl;_contentEl;_bottomEl;_initialized=!1;_resize=null;_shading=null;static get observedAttributes(){return[`top-bar-style`,`bottom-bar-style`,`extend-content-to-top-edge`,`extend-content-to-bottom-edge`]}get topBar(){return this._topEl}get contentArea(){return this._contentEl}get bottomBar(){return this._bottomEl}connectedCallback(){this._initialized||(this._initialized=!0,this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`,this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`,bindSlottedChildren(this,[{name:`top`,into:this._topEl},{name:`bottom`,into:this._bottomEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._topEl,this._contentEl,this._bottomEl),bindEmptySections(this._topEl,this._bottomEl)),this._shading=new AdwScrollShading(this._contentEl),this._shading.connect(),this._resize=new ResizeObserver(()=>this._syncClasses()),this._resize.observe(this._topEl),this._resize.observe(this._bottomEl),this._syncClasses()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._shading?.disconnect(),this._shading=null}attributeChangedCallback(){this._initialized&&this._syncClasses()}_syncClasses(){let{view:e,topBar:t,bottomBar:n}=toolbarViewClasses({topBarStyle:parseToolbarStyle(this.getAttribute(`top-bar-style`)),bottomBarStyle:parseToolbarStyle(this.getAttribute(`bottom-bar-style`)),extendContentToTopEdge:this.hasAttribute(`extend-content-to-top-edge`),extendContentToBottomEdge:this.hasAttribute(`extend-content-to-bottom-edge`),topBarHeight:this._topEl.offsetHeight,bottomBarHeight:this._bottomEl.offsetHeight});for(let t of de)this.classList.toggle(t,e.includes(t));for(let e of fe)this._topEl.classList.toggle(e,t.includes(e)),this._bottomEl.classList.toggle(e,n.includes(e));this._shading?.setUndershootEdges({top:e.includes(`undershoot-top`),bottom:e.includes(`undershoot-bottom`)})}};customElements.define(`adw-toolbar-view`,AdwToolbarView);var AdwViewStack=class extends HTMLElement{_state=new ViewStackState;_initialized=!1;static get observedAttributes(){return[`visible-child-name`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e))}get pages(){return this._state.pages}get visibleChildIndex(){return this._state.visibleIndex}selectNthPage(e){return this._state.setVisibleIndex(e)}get visibleChildName(){return this._state.visibleName}set visibleChildName(e){this._state.setVisibleName(e)}get visibleChild(){return this._state.visiblePage?.content??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`visible-child-name`);for(let e of Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`))){let t=e.getAttribute(`name`)??``,n=document.createElement(`div`);n.className=`adw-view-stack-child`,n.dataset.name=t;for(let t of Array.from(e.childNodes))n.appendChild(t);this._state.addPage({name:t,title:e.getAttribute(`title`),icon:e.getAttribute(`icon-name`),content:n,visible:!e.hasAttribute(`hidden`),badgeNumber:e.hasAttribute(`badge-number`)?Number.parseInt(e.getAttribute(`badge-number`)??`0`,10):0,needsAttention:e.hasAttribute(`needs-attention`),useUnderline:e.hasAttribute(`use-underline`),startsSection:e.hasAttribute(`starts-section`),sectionTitle:e.getAttribute(`section-title`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName(),this._emitItemsChanged()}attributeChangedCallback(e,t,n){this._initialized&&e===`visible-child-name`&&n!==null&&n!==this._state.visibleName&&this._state.setVisibleName(n)}add(e,t,n,r){e.classList.add(`adw-view-stack-child`),e.dataset.name=t;let i=this._state.addPage({name:t,title:n,icon:r,content:e});return this.appendChild(e),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),i}addTitled(e,t,n){return this.add(e,t,n)}removePage(e){let t=this._state.pages[this._state.indexOfName(e)]?.content;return this._state.removePage(e)?(t?.remove(),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),!0):!1}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._applyVisibility(),this._emitItemsChanged(),n}_emitItemsChanged(){this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{count:this.pages.length}}))}_onStateChange(e){this._applyVisibility(),this._reflectName(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.index,name:e.name,title:e.title,interactive:e.interactive}}))}_applyVisibility(){let e=this._state.visibleIndex;this._state.pages.forEach((t,n)=>{let r=t.content;if(!r)return;let i=n===e;r.classList.toggle(`active-view`,i),r.hidden=!i})}_reflectName(){if(this._state.visibleIndex<0){this.removeAttribute(`visible-child-name`);return}let e=this._state.visibleName;this.getAttribute(`visible-child-name`)!==e&&this.setAttribute(`visible-child-name`,e)}};customElements.define(`adw-view-stack`,AdwViewStack);var AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=ft;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_barEl;_contentEl;_nodes=[];_declared=[];_pageObserver;_policy=`narrow`;_initialized=!1;static get observedAttributes(){return[`policy`,`active`]}constructor(){super()}get policy(){return this._policy}set policy(e){this.setAttribute(`policy`,e)}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._render(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-switcher-page`)),t=this.getAttribute(`active`);if(this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar`,this._barEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-view-switcher-content`,this._declared=e,this._watchPages(),this._nodes=e.map((e,t)=>this._buildPage(e,t)),this._barEl.append(...this._nodes.map(e=>e.button)),this._contentEl.append(...this._nodes.map(e=>e.body)),this.replaceChildren(this._barEl,this._contentEl),this._policy=this._readPolicyAttr(),this._initialized=!0,this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._render()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._render())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`policy`){let e=this._readPolicyAttr();if(e===this._policy)return;this._policy=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::policy`,{bubbles:!0,detail:{policy:e}}));return}if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive()}}}_buildPage(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-view-switcher-button`,n.setAttribute(`role`,`tab`),n.dataset.pageIndex=String(t);let r=createGtkImage(null,`adw-view-switcher-icon`),i=document.createElement(`span`);i.className=`adw-view-switcher-label`;let a=document.createElement(`span`);a.className=`adw-view-switcher-indicator`,a.setAttribute(`aria-hidden`,`true`),n.append(r,i,a),n.addEventListener(`click`,()=>{this._state.setSelected(t)}),n.addEventListener(`dragenter`,e=>{n.contains(e.relatedTarget)||this._state.dragEnter(t)}),n.addEventListener(`dragleave`,e=>{n.contains(e.relatedTarget)||this._state.dragLeave(t)});let o=document.createElement(`div`);o.className=`adw-view-switcher-page`,o.dataset.name=e.getAttribute(`name`)??``;for(let t of Array.from(e.childNodes))o.appendChild(t);return{button:n,icon:r,label:i,indicator:a,body:o}}_readPolicyAttr(){let e=this.getAttribute(`policy`);return e===null?`narrow`:isViewSwitcherPolicy(e)?e:this._policy}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.selected,name:e.name,title:e.title,interactive:e.interactive}}))}_render(){if(this._initialized){for(let e of Je)this.classList.toggle(e,e===this._policy);buildViewSwitcherButtons(this._state.pages,this._state.selected,this._policy).forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName),n.body.classList.toggle(`active-view`,e.selected),n.body.hidden=!e.selected)}),this._reflectActive()}}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-switcher-page`,AdwViewSwitcherPage),customElements.define(`adw-view-switcher`,AdwViewSwitcher);var AdwViewSwitcherSidebar=class extends HTMLElement{_sidebar;_placeholderEl;_prefixEl;_suffixEl;_stack=null;_filter=null;_initialized=!1;static get observedAttributes(){return[`stack`,`mode`]}get stack(){return this._stack}set stack(e){this.setStack(e===null?null:typeof e==`string`?this._resolveStack(e):e)}setStack(e){e!==null&&this._stack!==e&&(this._unbindStack(),this._stack=e,this._bindStack(),this._populate(),this._syncSelection(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:e}})))}get mode(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}set mode(e){this.setAttribute(`mode`,e)}get filter(){return this._filter}set filter(e){this._filter=e,this._initialized&&(this._sidebar.filter=e,this._applyEmptyState())}get placeholder(){return this._placeholderEl.firstElementChild}set placeholder(e){e===null?this._placeholderEl.replaceChildren():this._placeholderEl.replaceChildren(e),this._applyEmptyState()}get prefixWidget(){return this._prefixEl.firstElementChild}set prefixWidget(e){e===null?this._prefixEl.replaceChildren():this._prefixEl.replaceChildren(e)}get suffixWidget(){return this._suffixEl.firstElementChild}set suffixWidget(e){e===null?this._suffixEl.replaceChildren():this._suffixEl.replaceChildren(e)}connectedCallback(){if(this._initialized){this._bindStack(),this._populate();return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`view-switcher-sidebar-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`view-switcher-sidebar-suffix`,this._placeholderEl=document.createElement(`div`),this._placeholderEl.className=`view-switcher-sidebar-placeholder`,this._placeholderEl.hidden=!0,this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.addEventListener(`activated`,this._onSidebarActivated);let e=document.createElement(`div`);e.className=`view-switcher-sidebar-box`,e.append(this._sidebar,this._placeholderEl),bindSlottedChildren(this,[{name:`placeholder`,into:this._placeholderEl},{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),this._applyMode();let t=this.getAttribute(`stack`);this.setStack(t===null?this._findStack():this._resolveStack(t)),this._applyEmptyState()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){this._initialized&&(e===`stack`?this.setStack(n===null?this._findStack():this._resolveStack(n)):e===`mode`&&this._applyMode())}_resolveStack(e){return document.getElementById(e)??this._findStack()}_findStack(){return this.parentElement?.querySelector(`adw-view-stack`)??null}_bindStack(){this._unbindStack();for(let e of Nt)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of Nt)this._stack?.removeEventListener(e,this._onStackChange)}_onStackChange=()=>{this._populate(),this._syncSelection()};_onSidebarActivated=e=>{e.stopPropagation();let t=e.detail.index,n=this._stack;n!==null&&(n.selectNthPage(t),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:t}})))};_populate(){let e=this._stack;if(e===null){this._sidebar.sections=[],this._applyEmptyState();return}let t=viewSwitcherPagesFromStack(e.pages);this._sidebar.sections=viewSwitcherSidebarSections(t).map(e=>this._toSectionSpec(e)),this._applyEmptyState()}_toSectionSpec(e){let t=e.pages.map(e=>({title:e.title??``,iconName:e.iconName??``,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention}));return{title:e.title,items:t}}_syncSelection(){let e=this._stack;if(e===null)return;let t=e.visibleChildIndex;t<0||this._sidebar.selected!==t&&(this._sidebar.selected=t)}_applyMode(){let e=this.mode===`page`;this.classList.toggle(`page`,e),this._sidebar.mode=this.mode}_applyEmptyState(){let e=this._sidebar.classList.contains(`empty`);this._placeholderEl.hidden=!e,this.classList.toggle(`empty`,e)}};const Nt=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);var AdwViewSwitcherBar=class extends HTMLElement{_barState=new ViewSwitcherBarState;_barEl;_nodes=[];_stack=null;_initialized=!1;_onStackNotify=()=>this._rebuild();static get observedAttributes(){return[`stack`,`reveal`,`revealed`]}constructor(){super(),this._barState.subscribe(()=>this._applyRevealed())}get stack(){return this._stack}set stack(e){this.setStack(this._resolveStack(e))}get reveal(){return this._barState.reveal}set reveal(e){e?this.setAttribute(`reveal`,``):(this.removeAttribute(`reveal`),this.removeAttribute(`revealed`))}get revealed(){return this._barState.revealed}connectedCallback(){this._initialized||(this._initialized=!0,this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar-box`,this._barEl.setAttribute(`role`,`tablist`),this.replaceChildren(this._barEl),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{let t=this._stack;if(!t)return;let n=Number(e.dataset.pageIndex);t.visibleChildIndex!==n&&t.selectNthPage(n)}})),this._barState.setReveal(this._readReveal());let e=this.getAttribute(`stack`);if(e&&!this._stack){this.setStack(this._resolveStack(e));return}this._bindStack(),this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`reveal`||e===`revealed`){this._barState.setReveal(this._readReveal());return}e===`stack`&&this.setStack(this._resolveStack(n))}}setStack(e){this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild()}refresh(){this._rebuild()}_readReveal(){return this.hasAttribute(`reveal`)||this.hasAttribute(`revealed`)}_bindStack(){this._stack?.addEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.addEventListener(`items-changed`,this._onStackNotify)}_unbindStack(){this._stack?.removeEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.removeEventListener(`items-changed`,this._onStackNotify)}_resolveStack(e){return e===null?null:typeof e==`string`?document.getElementById(e)??null:e}_rebuild(){if(!this._initialized)return;let e=this._stack?.pages??[];this._barState.setPages(e);let t=buildViewSwitcherButtons(viewSwitcherPagesFromStack(e),this._stack?.visibleChildIndex??-1,`narrow`);t.length!==this._nodes.length&&(this._barEl.replaceChildren(),this._nodes=t.map(e=>this._buildButton(e.pageIndex)),this._barEl.append(...this._nodes.map(e=>e.button))),t.forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName))}),this._applyRevealed()}_buildButton(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-view-switcher-bar-button`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e);let n=createGtkImage(null,`adw-view-switcher-bar-icon`),r=document.createElement(`span`);r.className=`adw-view-switcher-bar-label`;let i=document.createElement(`span`);return i.className=`adw-view-switcher-bar-indicator`,i.setAttribute(`aria-hidden`,`true`),t.append(n,r,i),t.addEventListener(`click`,()=>{this._stack?.selectNthPage(e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);const Pt=[`child-spacing`,`child-spacing-unit`,`pack-direction`,`align`,`justify`,`justify-last-line`,`line-spacing`,`line-spacing-unit`,`line-homogeneous`,`natural-line-length`,`natural-line-length-unit`,`wrap-reverse`,`wrap-policy`,`orientation`];function alignToJustifyContent(e){return e<.25?`flex-start`:e<.75?`center`:`flex-end`}var AdwWrapBox=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[...Pt]}get childSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`child-spacing`))}set childSpacing(e){this.setAttribute(`child-spacing`,String(e))}get childSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`child-spacing-unit`))}set childSpacingUnit(e){this.setAttribute(`child-spacing-unit`,e)}get lineSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`line-spacing`))}set lineSpacing(e){this.setAttribute(`line-spacing`,String(e))}get lineSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`line-spacing-unit`))}set lineSpacingUnit(e){this.setAttribute(`line-spacing-unit`,e)}get align(){return normalizeWrapBoxAlign(this.getAttribute(`align`))}set align(e){this.setAttribute(`align`,String(e))}get justify(){return normalizeWrapBoxJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get justifyLastLine(){return this.hasAttribute(`justify-last-line`)}set justifyLastLine(e){this.toggleAttribute(`justify-last-line`,!!e)}get wrapPolicy(){return normalizeWrapPolicy(this.getAttribute(`wrap-policy`))}set wrapPolicy(e){this.setAttribute(`wrap-policy`,e)}get packDirection(){return normalizeWrapBoxPackDirection(this.getAttribute(`pack-direction`))}set packDirection(e){this.setAttribute(`pack-direction`,e)}get wrapReverse(){return this.hasAttribute(`wrap-reverse`)}set wrapReverse(e){this.toggleAttribute(`wrap-reverse`,!!e)}get lineHomogeneous(){return this.hasAttribute(`line-homogeneous`)}set lineHomogeneous(e){this.toggleAttribute(`line-homogeneous`,!!e)}get naturalLineLength(){return normalizeNaturalLineLength(this.getAttribute(`natural-line-length`))}set naturalLineLength(e){this.setAttribute(`natural-line-length`,String(e))}get naturalLineLengthUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`natural-line-length-unit`))}set naturalLineLengthUnit(e){this.setAttribute(`natural-line-length-unit`,e)}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get _children(){return[...this.children]}insertChildAfter(e,t=null){return this._applyOrder(`insert-after`,e,t)}reorderChildAfter(e,t=null){return this._applyOrder(`reorder-after`,e,t)}removeAll(){for(let e of this._children)this.removeChild(e)}_applyOrder(e,t,n){let r=resolveWrapBoxChildOrder({children:this._children,child:t,sibling:n,op:e});if(r===null)return!1;let i=r.indexOf(t);return this.insertBefore(t,r[i+1]??null),!0}connectedCallback(){this._initialized||(this._initialized=!0,this._sync())}attributeChangedCallback(e,t,n){if(!this._initialized)return;this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){switch(e){case`child-spacing`:case`line-spacing`:return normalizeWrapBoxSpacing(t);case`child-spacing-unit`:case`line-spacing-unit`:case`natural-line-length-unit`:return normalizeWrapBoxLengthUnit(t);case`align`:return normalizeWrapBoxAlign(t);case`justify`:return normalizeWrapBoxJustify(t);case`wrap-policy`:return normalizeWrapPolicy(t);case`pack-direction`:return normalizeWrapBoxPackDirection(t);case`natural-line-length`:return normalizeNaturalLineLength(t);case`orientation`:return t===`vertical`?`vertical`:`horizontal`;default:return t!==null}}_sync(){let e=this.style,t=this.orientation===`vertical`,n=t?`column`:`row`;e.flexDirection=this.packDirection===`end-to-start`?`${n}-reverse`:n,e.flexWrap=this.wrapReverse?`wrap-reverse`:`wrap`;let r=`${wrapBoxLengthToPx(this.childSpacing,this.childSpacingUnit)}px`,i=`${wrapBoxLengthToPx(this.lineSpacing,this.lineSpacingUnit)}px`;t?(e.rowGap=r,e.columnGap=i):(e.columnGap=r,e.rowGap=i),e.setProperty(`--adw-wrap-box-child-spacing`,r);let a=this.justify,o=this.justifyLastLine,s=this.align,c=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!1,childrenInLine:2}),l=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!0,childrenInLine:2});this.dataset.lineJustify=c.justify,this.dataset.lastLineJustify=l.justify,e.justifyContent=c.growGaps?`space-between`:alignToJustifyContent(c.align),e.alignContent=this.lineHomogeneous?`stretch`:`flex-start`,e.setProperty(`--adw-wrap-box-child-shrink`,String(wrapPolicyFlexShrink(this.wrapPolicy)));let u=wrapBoxLengthToPx(this.naturalLineLength,this.naturalLineLengthUnit),d=u===-1?``:`${u}px`;e.maxWidth=t?``:d,e.maxHeight=t?d:``}};customElements.define(`adw-wrap-box`,AdwWrapBox);const Ft={main:`About`,credits:`Credits`,license:`License`,system:`System`},It=[`credits`,`license`,`system`],Lt=[`unknown`,`custom`,`gpl-2-0`,`gpl-3-0`,`lgpl-2-1`,`lgpl-3-0`,`bsd`,`mit-x11`,`artistic`,`gpl-2-0-only`,`gpl-3-0-only`,`lgpl-2-1-only`,`lgpl-3-0-only`,`agpl-3-0`,`agpl-3-0-only`,`bsd-3`,`apache-2-0`,`mpl-2-0`,`0bsd`];var GtkAboutDialog=class extends AdwDialog{_built=!1;_logo=``;_switcherEl;_stackEl;_pages=new Map;_populated=new Set;_authors=[];_documenters=[];_artists=[];_creditSections=[];static get observedAttributes(){return[...AdwDialog.observedAttributes,`program-name`,`version`,`copyright`,`comments`,`license`,`license-type`,`system-information`,`website`,`website-label`,`translator-credits`,`logo-icon-name`,`wrap-license`]}get programName(){return this.getAttribute(`program-name`)??``}set programName(e){this.setAttribute(`program-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e),this.setAttribute(`license-type`,`custom`)}get licenseType(){let e=this.getAttribute(`license-type`);return e!==null&&Lt.includes(e)?e:`unknown`}set licenseType(e){Lt.includes(e)?this.setAttribute(`license-type`,e):this.removeAttribute(`license-type`)}get systemInformation(){return this.getAttribute(`system-information`)??``}set systemInformation(e){this.setAttribute(`system-information`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get websiteLabel(){return this.getAttribute(`website-label`)??``}set websiteLabel(e){this.setAttribute(`website-label`,e)}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get logoIconName(){return this.getAttribute(`logo-icon-name`)??``}set logoIconName(e){this.setAttribute(`logo-icon-name`,e)}get wrapLicense(){return this.hasAttribute(`wrap-license`)}set wrapLicense(e){this.toggleAttribute(`wrap-license`,e)}get logo(){return this._logo}set logo(e){this._logo=e,this._built&&this._renderLogo()}get authors(){return[...this._authors]}set authors(e){this._authors=[...e],this._creditsChanged()}get documenters(){return[...this._documenters]}set documenters(e){this._documenters=[...e],this._creditsChanged()}get artists(){return[...this._artists]}set artists(e){this._artists=[...e],this._creditsChanged()}addCreditSection(e,t){this._creditSections.push({name:e,people:[...t]}),this._creditsChanged()}_creditsChanged(){this._populated.delete(`credits`),this._built&&this._renderAbout()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-gtk-about-dialog-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),this._switcherEl.setAttribute(`aria-label`,`Pages`),super.connectedCallback(),this._stackEl=document.createElement(`div`),this._stackEl.className=`adw-gtk-about-dialog-stack`,this._stackEl.dataset.transitionType=`crossfade`,this.setAttribute(`title`,`About ${this.programName||document.title}`);let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderAbout(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this._built&&t!==n&&((e===`license`||e===`license-type`||e===`website`)&&this._populated.delete(`license`),e===`system-information`&&this._populated.delete(`system`),(e===`website`||e===`website-label`||e===`license`||e===`license-type`)&&(this._renderMain(),this._populateLicense()),e===`wrap-license`&&this._populateLicense(),e===`system-information`&&this._populateSystem(),this._renderAbout())}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl),this._renderSwitcher()}get visiblePage(){return this._stackEl.dataset.visible??`main`}showPage(e){this._populatePage(e);for(let[t,n]of this._pages)n.hidden=t!==e;this._stackEl.dataset.visible=e,this._renderSwitcher()}_build(){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-box`;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-head`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-logo-slot`,t.appendChild(n),this._renderLogo();let r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-name`,r.textContent=this.programName||document.title,t.appendChild(r);for(let e of[`main`,...It]){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-page`,t.dataset.page=e,t.hidden=e!==`main`,this._pages.set(e,t),this._stackEl.appendChild(t)}return this._renderMain(),t.appendChild(this._stackEl),e.appendChild(t),e}_renderAbout(){this.setAttribute(`title`,`About ${this.programName||document.title}`);for(let e of It){let t=this._pages.get(e);if(t===void 0)continue;let n=this._pageVisible(e);t.hidden!==!n&&(t.hidden=!n,n||this._populated.delete(e))}this._pages.get(this._stackEl.dataset.visible??`main`)?.hidden!==!1&&(this._stackEl.dataset.visible=`main`,this._pages.get(`main`).hidden=!1),this._renderMain(),this._renderSwitcher()}_pageVisible(e){return e===`credits`?this._creditsPeople().length>0:e===`license`?this.licenseType===`custom`&&this.license.length>0:this.systemInformation.length>0}_creditsPeople(){let e=[];this._authors.length>0&&e.push({title:`Created by`,people:this._authors}),this._documenters.length>0&&e.push({title:`Documented by`,people:this._documenters});let t=translatorCreditsPeople(this.translatorCredits);t.length>0&&e.push({title:`Translated by`,people:t}),this._artists.length>0&&e.push({title:`Design by`,people:this._artists});for(let t of this._creditSections)e.push({title:t.name,people:t.people});return e}_visiblePages(){return It.filter(e=>this._pages.get(e)?.hidden===!1)}_renderSwitcher(){if(this._switcherEl===void 0)return;let e=this._visiblePages();this._switcherEl.hidden=e.length===0,this._switcherEl.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-gtk-about-dialog-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=Ft[e],t.classList.toggle(`checked`,this._stackEl.dataset.visible===e),t.setAttribute(`aria-selected`,String(this._stackEl.dataset.visible===e)),t.addEventListener(`click`,()=>this.showPage(e)),t}))}_renderLogo(){let e=this.contentArea.querySelector(`.adw-gtk-about-dialog-logo-slot`);if(e!==null){if(this.logoIconName.length>0){e.replaceChildren(createGtkImage(this.logoIconName,`adw-gtk-about-dialog-logo`));return}if(this._logo.length>0){let t=document.createElement(`img`);t.className=`adw-gtk-about-dialog-logo`,t.src=this._logo,t.alt=``,e.replaceChildren(t);return}e.replaceChildren()}}_renderMain(){let e=this._pages.get(`main`);if(e===void 0)return;let t=[],label=(e,t)=>{let n=document.createElement(`div`);return n.className=t,n.textContent=e,n};this.version.length>0&&t.push(label(this.version,`adw-gtk-about-dialog-version`)),this.comments.length>0&&t.push(label(this.comments,`adw-gtk-about-dialog-comments`)),this.website.length>0?t.push(this.websiteLabel.length>0?this._link(this.websiteLabel,this.website,`adw-gtk-about-dialog-website`):this._link(`Website`,this.website,`adw-gtk-about-dialog-website`)):this.websiteLabel.length>0&&t.push(label(this.websiteLabel,`adw-gtk-about-dialog-website`)),this.copyright.length>0&&t.push(label(this.copyright,`adw-gtk-about-dialog-copyright`));let n=this._licenseMarkup();n!==null&&t.push(n),e.replaceChildren(...t)}_licenseMarkup(){let e=this.licenseType,t=Lt.indexOf(e),n=t>=0?t:o.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==o.CUSTOM&&n!==o.UNKNOWN){let e=s[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
5
+ See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document.createTextNode(` for details.`)),r}return n===o.UNKNOWN||this.license.length===0?null:(this._fillWithLinks(r,this.license),r)}_populateLicense(){let e=this._pages.get(`license`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`,this.wrapLicense&&t.classList.add(`wrap`);let n=this._licenseMarkup();if(n!==null){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-text`,e.replaceChildren(...[...n.childNodes].map(e=>e.cloneNode(!0))),t.appendChild(e)}e.replaceChildren(this._frame(t))}_populateSystem(){let e=this._pages.get(`system`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-text`,this._fillWithLinks(n,this.systemInformation),t.appendChild(n),e.replaceChildren(this._frame(t))}_populateCredits(){let e=this._pages.get(`credits`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-credits-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,Ft.credits);for(let e of this._creditsPeople()){let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-credits-heading`,n.textContent=e.title,t.appendChild(n);for(let n of e.people){let e=parseCreditPerson(n),r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-credits-person`,e.link===null?r.textContent=e.name:r.appendChild(this._link(e.name,e.uri??``,`adw-gtk-about-dialog-credits-link`)),t.appendChild(r)}t.appendChild(document.createElement(`div`))}e.replaceChildren(this._frame(t))}_populatePage(e){this._populated.has(e)||(this._populated.add(e),e===`credits`?this._populateCredits():e===`license`?this._populateLicense():e===`system`&&this._populateSystem())}_frame(e){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-scrolled`;let n=document.createElement(`div`);return n.className=`adw-view`,n.appendChild(e),t.appendChild(n),t}_link(e,t,n){let r=document.createElement(`a`);return r.className=n,r.href=t,r.rel=`noopener noreferrer`,r.textContent=e,r.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(t)}),r}_fillWithLinks(e,t){for(let n of splitLinks(t)){if(n.uri===null){e.appendChild(document.createTextNode(n.text));continue}let t=document.createElement(`a`);t.href=n.uri,t.rel=`noopener noreferrer`,t.textContent=n.text,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n.uri)}),e.appendChild(t)}}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}};function splitLinks(e){let t=[],n=e;for(;n.length>0;){let e=n.indexOf(`<`),r=e<0?-1:n.indexOf(`>`,e),i=n.indexOf(`http://`),a=n.indexOf(`https://`),o=i;(i<0||a>=0&&a<i)&&(o=a);let s=-1;if(o>=0&&(s=`
6
+ >`.split(``).reduce((e,t)=>{if(e>=0)return e;let r=n.indexOf(t,o);return r<0?-1:r},-1),s<0&&(s=n.length)),o>=0&&(e<0||r<0||o<=e+1)&&(e=o,r=s),e<0||r<0){t.push({text:n,uri:null});break}e>0&&t.push({text:n.slice(0,e),uri:null});let c=n[e]===`<`,l=c?n.slice(e+1,r):n.slice(e,r);t.push({text:l,uri:c?`mailto:${l}`:l}),n=n.slice(r+ +!!c)}return t}customElements.define(`gtk-about-dialog`,GtkAboutDialog);var GtkActionBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;static get observedAttributes(){return[`revealed`]}get revealed(){return this.getAttribute(`revealed`)!==`false`}set revealed(e){this.setAttribute(`revealed`,e?`true`:`false`)}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-action-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-action-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-action-bar-end`;let e=this._endEl;bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`end`,consume:t=>e.prepend(t)},{into:this._startEl}]).install(this._startEl,this._centerEl,this._endEl),this._renderRevealed()}attributeChangedCallback(){this._initialized&&this._renderRevealed()}_renderRevealed(){this.hidden=!this.revealed}};customElements.define(`gtk-action-bar`,GtkActionBar);const U={minimize:{className:`minimize`,icon:`window-minimize-symbolic`,label:`Minimize`,action:`minimize`},maximize:{className:`maximize`,icon:`window-maximize-symbolic`,label:`Maximize`,action:`toggle-maximized`},close:{className:`close`,icon:`window-close-symbolic`,label:`Close`,action:`close`}},Rt=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends HTMLElement{_initialized=!1;_empty=!0;_window=null;_windowObserver=null;static get observedAttributes(){return[`decoration-layout`,`side`,`use-native-controls`]}get side(){return this.getAttribute(`side`)===`end`?`end`:`start`}set side(e){this._write(`side`,e)}get useNativeControls(){return this.hasAttribute(`use-native-controls`)}get empty(){return this._empty}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followWindow();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._followWindow()}disconnectedCallback(){this._windowObserver?.disconnect(),this._windowObserver=null,this._window=null}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`side`?this.side:this.hasAttribute(e)}_followWindow(){this._windowObserver?.disconnect(),this._applyEmptyClass(),this._window=this.closest(`gtk-window, adw-window`),this._window!==null&&(this._windowObserver??=new MutationObserver(()=>this._render()),this._windowObserver.observe(this._window,{attributes:!0,attributeFilter:Rt})),this._render()}_isSovereign(e){return!e.hasAttribute(`modal`)&&!e.hasAttribute(`transient-for`)}_windowFlag(e,t){return e.getAttribute(t)!==`false`}_layoutHalf(){let e=this.getAttribute(`decoration-layout`)??this._window?.getAttribute(`decoration-layout`)??`:minimize,maximize,close`;if(e===``)return null;let t=e.indexOf(`:`);return t===-1?e:this.side===`start`?e.slice(0,t):e.slice(t+1)}_render(){this.classList.toggle(`start`,this.side===`start`),this.classList.toggle(`end`,this.side===`end`),this.replaceChildren(),this._applyEmptyClass();let e=this._window;if(e===null){this._setEmpty(!0);return}let t=this._isSovereign(e),n=this._layoutHalf();if(n===null){this._setEmpty(!0);return}let r=!0;for(let i of n.split(`,`)){let n=this._buttonFor(i,e,t);n!==null&&(this.appendChild(n),r=!1)}this._setEmpty(r)}_applyEmptyClass(){this.classList.toggle(`empty`,this._empty)}_buttonFor(e,t,n){if(e===`icon`)return n?this._windowIcon(t):null;if(e===`minimize`)return n?this._controlButton(U.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`);return this._controlButton(e?{...U.maximize,icon:`window-restore-symbolic`,label:`Restore`}:U.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(U.close):null}_windowIcon(e){let t=e.getAttribute(`icon-name`);return t===null||t===``?null:createGtkImage(t,`icon`)}_controlButton(e){let t=document.createElement(`button`);return t.className=`adw-window-controls-button ${e.className}`,t.setAttribute(`aria-label`,e.label),t.title=e.label,t.appendChild(createGtkImage(e.icon)),t.addEventListener(`click`,()=>this.dispatchEvent(new CustomEvent(`window-action`,{bubbles:!0,detail:{action:e.action}}))),t}_setEmpty(e){e!==this._empty&&(this._empty=e,this._applyEmptyClass(),this.dispatchEvent(new CustomEvent(`notify::empty`,{bubbles:!0,detail:{empty:e}})))}};customElements.define(`gtk-window-controls`,GtkWindowControls);var GtkWindow=class extends HTMLElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`]}get title(){return this.getAttribute(`title`)??``}set title(e){this._write(`title`,e)}get decorated(){return this._onByDefault(`decorated`)}set decorated(e){this._write(`decorated`,String(e))}get maximized(){return this._offByDefault(`maximized`)}set maximized(e){this._write(`maximized`,String(e))}get resizable(){return this._onByDefault(`resizable`)}set resizable(e){this._write(`resizable`,String(e))}get deletable(){return this._onByDefault(`deletable`)}set deletable(e){this._write(`deletable`,String(e))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_onByDefault(e){return this.getAttribute(e)!==`false`}_offByDefault(e){return this.hasAttribute(e)}connectedCallback(){if(this._initialized){this._watchTitlebar(),this._render();return}this._initialized=!0,this._titlebar=document.createElement(`div`),this._titlebar.className=`adw-gtk-window-titlebar`,this._content=document.createElement(`div`),this._content.className=`adw-gtk-window-content`,bindSlottedChildren(this,[{name:`titlebar`,into:this._titlebar},...this.extraSlots(),{into:this._content}]).install(...this.strips()),this.addEventListener(`window-action`,e=>this._onWindowAction(e)),this._watchTitlebar(),this._render()}disconnectedCallback(){this._titlebarObserver?.disconnect(),this._titlebarObserver=null}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}extraSlots(){return[]}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){if(e===`default-width`||e===`default-height`){let t=Number.parseFloat(this.getAttribute(e)??``);return Number.isFinite(t)?t:null}return e===`title`||e===`icon-name`||e===`transient-for`?this.getAttribute(e):e===`decorated`||e===`resizable`||e===`deletable`?this._onByDefault(e):this._offByDefault(e)}_render(){this._titlebar.hidden=!this.decorated,this.classList.toggle(`maximized`,this.decorated&&this.maximized),this.classList.toggle(`fullscreen`,this.decorated&&this._offByDefault(`fullscreened`));let e=Number.parseFloat(this.getAttribute(`default-width`)??``),t=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[n,r]of[[`width`,e],[`height`,t]])Number.isFinite(r)&&r>0?this.style.setProperty(n,`${r}px`):this.style.removeProperty(n);let n=this.getAttribute(`title`);n===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,n),this._renderTitlebar()}_renderTitlebar(){if([...this._titlebar.children].some(e=>e!==this._startControls&&e!==this._endControls&&e!==this._titleLabel)){for(let e of[this._startControls,this._endControls,this._titleLabel])e?.remove();this._startControls=null,this._endControls=null,this._titleLabel=null;return}if(!this.decorated)return;this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._titleLabel=document.createElement(`span`),this._titleLabel.className=`adw-gtk-window-title`,this._titlebar.append(this._startControls,this._titleLabel,this._endControls));let e=this.getAttribute(`title`);e===null?this._titleLabel?.removeAttribute(`title`):this._titleLabel?.setAttribute(`title`,e??``)}_onWindowAction(e){let t=e.detail?.action;if(t===`toggle-maximized`){this._write(`maximized`,String(!this._offByDefault(`maximized`)));return}t===`close`&&this.close()}close(){let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented?!1:(this._offByDefault(`hide-on-close`)?this.hidden=!0:this.remove(),!0)}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}};customElements.define(`gtk-window`,GtkWindow);var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static get observedAttributes(){return[...GtkWindow.observedAttributes,`show-menubar`]}get showMenubar(){return this.getAttribute(`show-menubar`)===`true`}set showMenubar(e){this._write(`show-menubar`,String(e))}menubarSection(){if(this._menubar===null){let e=document.createElement(`div`);e.className=`adw-gtk-application-window-menubar`,this._menubar=e}return this._menubar}strips(){return[this._titlebar,this.menubarSection(),this._content]}extraSlots(){return[{name:`menubar`,into:this.menubarSection()}]}connectedCallback(){super.connectedCallback(),this._followMenubar()}disconnectedCallback(){this._menubarObserver?.disconnect(),this._menubarObserver=null}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`show-menubar`&&this._renderMenubar()}_followMenubar(){this._menubarObserver?.disconnect(),this._menubarObserver=new MutationObserver(()=>this._renderMenubar()),this._menubarObserver.observe(this.menubarSection(),{childList:!0}),this._renderMenubar()}_renderMenubar(){let e=this.menubarSection();e.hidden=!this.showMenubar||e.childElementCount===0}};customElements.define(`gtk-application-window`,GtkApplicationWindow);function normalizeAlign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):.5}function normalizeRatio(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,1e-4,1e4):1}var GtkAspectFrame=class extends HTMLElement{static get observedAttributes(){return[`ratio`,`xalign`,`yalign`,`obey-child`]}get ratio(){return normalizeRatio(this.getAttribute(`ratio`))}set ratio(e){this.setAttribute(`ratio`,String(e))}get xalign(){return normalizeAlign(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeAlign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get obeyChild(){let e=this.getAttribute(`obey-child`);return e===null||e!==`false`&&e!==`0`}set obeyChild(e){e?this.setAttribute(`obey-child`,`true`):this.setAttribute(`obey-child`,`false`)}get child(){return this.firstElementChild??null}set child(e){this.firstElementChild!==null&&this.firstElementChild.remove(),e!==null&&this.append(e),this._sync()}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`ratio`?normalizeRatio(t):e===`xalign`||e===`yalign`?normalizeAlign(t):t!==null&&t!==`false`&&t!==`0`}_sync(){let e=this.child;if(e===null)return;let t=e.style;this.obeyChild?t.removeProperty(`aspect-ratio`):t.aspectRatio=String(this.ratio),t.flex=`1 1 auto`,t.maxWidth=`100%`,t.maxHeight=`100%`,this.style.justifyContent=labelYalignAlignItems(this.xalign),this.style.alignItems=labelYalignAlignItems(this.yalign)}};customElements.define(`gtk-aspect-frame`,GtkAspectFrame);const zt=[`orientation`,`spacing`,`homogeneous`];var GtkBox=class extends HTMLElement{static get observedAttributes(){return[...zt]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get spacing(){return normalizeBoxSpacing(this.getAttribute(`spacing`))}set spacing(e){this.setAttribute(`spacing`,String(e))}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}connectedCallback(){this._sync()}attributeChangedCallback(e,t,n){this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`orientation`?normalizeBoxOrientation(t):e===`spacing`?normalizeBoxSpacing(t):t!==null}_sync(){this.style.flexDirection=this.orientation===`vertical`?`column`:`row`,this.style.gap=`${this.spacing}px`}};customElements.define(`gtk-box`,GtkBox);const Bt=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends HTMLElement{static signals={clicked:`click`};_button;_label=``;_initialized=!1;_child=null;static get observedAttributes(){return[`icon`,`icon-name`,`label`,`tooltip`,`tooltip-text`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`,`class`]}get button(){return this._button}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent??``).join(``);this._label=(this.getAttribute(`label`)??e).trim(),this._button=document.createElement(`button`),bindSlottedChildren(this,[{name:`child`,claims:e=>e instanceof Element,consume:e=>{this._child=e,this._render()}}]).install(this._button),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`;let t=[...Bt.filter(e=>this.hasAttribute(e)),...this.classList];e.classList.add(...buttonStyleClasses(t));let n=this._child,r=n?null:this.getAttribute(`icon`)??this.getAttribute(`icon-name`),i=n?``:(this.getAttribute(`label`)??this._label).trim();r&&!i&&e.classList.add(`icon-only`),i&&!r&&e.classList.add(`text-button`),n?e.replaceChildren(n):e.replaceChildren(),r&&e.appendChild(createGtkImage(r)),i&&e.appendChild(document.createTextNode(i));let a=this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`);e.title=a??``,r&&!i?e.setAttribute(`aria-label`,a??r):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Vt=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ht=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],W=[{step:`previous-month`,icon:`go-previous`,tooltip:`Previous Month`},{step:`next-month`,icon:`go-next`,tooltip:`Next Month`},{step:`previous-year`,icon:`go-up`,tooltip:`Previous Year`},{step:`next-year`,icon:`go-down`,tooltip:`Next Year`}];var GtkCalendar=class extends HTMLElement{_headerEl;_monthEl;_yearEl;_arrowEls={};_gridEl;_dayNameEls=[];_weekNumberEls=[];_cellEls=[];_marked=calendarClearMarks();_date;_focus=-1;_initialized=!1;static get observedAttributes(){return[`date`,`year`,`month`,`day`,`show-heading`,`show-day-names`,`show-week-numbers`,`week-start`]}get date(){return toIsoDate(this._date)}set date(e){this.setAttribute(`date`,e)}get year(){return this._date.year}set year(e){this.setAttribute(`year`,String(e))}get month(){return this._date.month-1}set month(e){this.setAttribute(`month`,String(e))}get day(){return this._date.day}set day(e){this.setAttribute(`day`,String(e))}get showHeading(){return this.getAttribute(`show-heading`)!==`false`}set showHeading(e){this.setAttribute(`show-heading`,String(!!e))}get showDayNames(){return this.getAttribute(`show-day-names`)!==`false`}set showDayNames(e){this.setAttribute(`show-day-names`,String(!!e))}get showWeekNumbers(){return this.hasAttribute(`show-week-numbers`)}set showWeekNumbers(e){this.toggleAttribute(`show-week-numbers`,!!e)}get weekStart(){let e=this.getAttribute(`week-start`);if(e!==null){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>=0&&t<=6)return t}return localeWeekStart()}set weekStart(e){this.setAttribute(`week-start`,String(e))}get markedDays(){return this._marked.flatMap((e,t)=>e?[t+1]:[])}constructor(){super(),this._date=today()}connectedCallback(){this._initialized||(this._initialized=!0,this._buildHeader(),this._buildGrid(),this.replaceChildren(this._headerEl,this._gridEl),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._adoptAttributes(),this._render())}attributeChangedCallback(e){if(!this._initialized)return;let t=this._adoptAttributes(e);this._render(),(e===`date`||e===`year`||e===`month`||e===`day`)&&this._emitDaySelected(t)}markDay(e){let t=calendarMarkDay(this._marked,e,!0);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}unmarkDay(e){let t=calendarMarkDay(this._marked,e,!1);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}dayIsMarked(e){return calendarDayIsMarked(this._marked,e)}clearMarks(){this._marked=calendarClearMarks(),this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:[]}}))}get cells(){return calendarDays(this._date.year,this._date.month,this.weekStart)}get selectedDate(){return{...this._date}}_buildHeader(){this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-calendar-header`;let e={previousMonth:{icon:W[0].icon,tooltip:W[0].tooltip},nextMonth:{icon:W[1].icon,tooltip:W[1].tooltip},previousYear:{icon:W[2].icon,tooltip:W[2].tooltip},nextYear:{icon:W[3].icon,tooltip:W[3].tooltip}},button=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.className=`adw-calendar-nav-button flat`,i.title=e[t].tooltip,i.setAttribute(`aria-label`,e[t].tooltip),n&&i.classList.add(`expand`),i.style.justifySelf=r,i.addEventListener(`click`,()=>this._onArrow(t)),i.appendChild(createGtkImage(e[t].icon,`adw-calendar-nav-icon`)),this._arrowEls[t]=i,i};this._monthEl=document.createElement(`span`),this._monthEl.className=`adw-calendar-month`,this._yearEl=document.createElement(`span`),this._yearEl.className=`adw-calendar-year`,this._headerEl.append(button(`previousMonth`,!1,`start`),this._monthEl,button(`nextMonth`,!0,`start`),button(`previousYear`,!1,`center`),this._yearEl,button(`nextYear`,!1,`end`)),this._monthEl.style.flex=`1`,this._yearEl.style.paddingInline=`6px`}_buildGrid(){this._gridEl=document.createElement(`div`),this._gridEl.className=`adw-calendar-grid`;for(let e=0;e<7;e++){let e=document.createElement(`span`);e.className=`adw-calendar-day-name`,this._dayNameEls.push(e),this._gridEl.appendChild(e)}let e=document.createElement(`span`);e.className=`adw-calendar-week-spacer`,e.setAttribute(`aria-hidden`,`true`),this._gridEl.appendChild(e);for(let e=0;e<6;e++){let e=document.createElement(`span`);e.className=`adw-calendar-week-number`,this._weekNumberEls.push(e),this._gridEl.appendChild(e);for(let e=0;e<7;e++){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-calendar-cell day-number`,e.addEventListener(`click`,()=>this._onCellClick(Number(e.dataset.index??`0`))),this._cellEls.push(e),this._gridEl.appendChild(e)}}}_adoptAttributes(e){let t=this.getAttribute(`date`);if(t!==null&&!(e===`year`||e===`month`||e===`day`)){let e=parseIsoDate(t);if(e!==null){let t=calendarSelectDay(this._date,e,!1);return this._date=t.date,t}}let n={year:integer(this.getAttribute(`year`),this._date.year),month:integer(this.getAttribute(`month`),this._date.month-1)+1,day:integer(this.getAttribute(`day`),this._date.day)},r=calendarSelectDay(this._date,n,!1);return this._date=r.date,r}_render(){this._monthEl.textContent=Ht[this._date.month-1],this._yearEl.textContent=String(this._date.year);let e=calendarDays(this._date.year,this._date.month,this.weekStart);e.forEach((e,t)=>{let n=this._cellEls[t];n.dataset.index=String(t),n.textContent=String(e.date.day),n.setAttribute(`aria-label`,`${Ht[e.date.month-1]} ${e.date.day}, ${e.date.year}`),n.classList.toggle(`other-month`,e.month!==`current`)}),this._paintWeekNumbers(e),this._paintStates(),this._paintArrows(),this._paintDayNames(),this._paintVisibility()}_paintWeekNumbers(e){for(let t=0;t<6;t++){let n=e[t*7+6];this._weekNumberEls[t].textContent=String(calendarWeekNumber(n.date))}}_paintStates(){let e=calendarDays(this._date.year,this._date.month,this.weekStart),t=today(),n=t.year===this._date.year&&t.month===this._date.month?t.day:-1;e.forEach((e,t)=>{let r=this._cellEls[t],i=e.month===`current`&&e.date.day===this._date.day,a=e.month===`previous`&&this._date.year===1&&this._date.month===1||e.month===`next`&&this._date.year===9999&&this._date.month===12;r.classList.toggle(`selected`,i),r.classList.toggle(`marked`,e.month===`current`&&calendarDayIsMarked(this._marked,e.date.day)),r.classList.toggle(`today`,e.date.day===n&&e.month===`current`),r.classList.toggle(`focused`,t===this._focus),r.disabled=a,a?r.textContent=``:r.textContent=String(e.date.day)})}_paintArrows(){let e=calendarNavigationButtons(this._date);for(let t of[`previousMonth`,`nextMonth`,`previousYear`,`nextYear`])this._arrowEls[t].disabled=!e[t]}_paintDayNames(){for(let e=0;e<7;e++)this._dayNameEls[e].textContent=Vt[(e+this.weekStart)%7]}_paintVisibility(){this._headerEl.hidden=!this.showHeading;for(let e of this._dayNameEls)e.hidden=!this.showDayNames;for(let e of this._weekNumberEls)e.hidden=!this.showWeekNumbers}_onArrow(e){let t=W.find(t=>arrowNameOf(t.step)===e)?.step;t===void 0||this._arrowEls[e].disabled||this._navigate(t)}_navigate(e){let t=this._date;if(this._date=calendarSelectDay(t,calendarStep(t,e),!1).date,this._focus>=0){let e=this.cells,t=e[this._focus],n=e.findIndex(e=>e.month===t?.month&&e.date.day===t.date.day);this._focus=n>=0?n:-1}this._render(),this.dispatchEvent(new CustomEvent(`notify::date`,{bubbles:!0,detail:{date:this.date}})),this.dispatchEvent(new CustomEvent({"previous-month":`prev-month`,"next-month":`next-month`,"previous-year":`prev-year`,"next-year":`next-year`}[e],{bubbles:!0}))}_emitDaySelected(e){let notify=(e,t)=>this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}));e.dayChanged&&(this.dispatchEvent(new CustomEvent(`day-selected`,{bubbles:!0})),notify(`day`,this._date.day)),e.monthChanged&&notify(`month`,this._date.month-1),e.yearChanged&&notify(`year`,this._date.year),notify(`date`,this.date)}_onCellClick(e){let t=this.cells[e];t!==void 0&&(this._focus=e,t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0))}_selectDate(e,t){let n=calendarSelectDay(this._date,e,t);if(!n.dayChanged&&!n.monthChanged&&!n.yearChanged){this._render();return}this._date=n.date;let r=this.cells.findIndex(e=>e.month===`current`&&e.date.day===this._date.day);r>=0&&(this._focus=r),this._render(),this._emitDaySelected(n)}_onKeyDown(e){let t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]};if(e.ctrlKey){let t={ArrowLeft:`previous-month`,ArrowRight:`next-month`,ArrowUp:`previous-year`,ArrowDown:`next-year`}[e.key];if(t===void 0||(e.preventDefault(),!calendarNavigationButtons(this._date)[arrowNameOf(t)]))return;this._navigate(t);return}if(e.altKey||e.metaKey)return;if(e.key===` `){if(this._focus<0)return;e.preventDefault();let t=this.cells[this._focus];if(t===void 0)return;t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0);return}let n=t[e.key];n!==void 0&&(e.preventDefault(),this._moveFocus(n[0],n[1]))}_moveFocus(e,t){if(this.cells.length===0)return;let n=this._focus<0?-1:Math.trunc(this._focus/7),r=this._focus<0?-1:this._focus%7;t===1?(n>0&&n--,n<0&&(n=5),r<0&&(r=6)):t===-1?(n<5&&n++,r<0&&(r=0)):e===-1?(r>0?r--:n>0&&(r=6,n--),r<0&&(r=6),n<0&&(n=5)):(r<6?r++:n<5&&(r=0,n++),r<0&&(r=0),n<0&&(n=0));let i=n*7+r;this._cellEls[i]?.disabled!==!0&&(this._focus=i,this._paintStates(),this._cellEls[i]?.focus())}};function arrowNameOf(e){switch(e){case`previous-month`:return`previousMonth`;case`next-month`:return`nextMonth`;case`previous-year`:return`previousYear`;default:return`nextYear`}}function localeWeekStart(){let e=globalThis.navigator?.language;if(typeof e!=`string`)return calendarWeekStart(0,0);let t=Intl.Locale;if(t===void 0)return calendarWeekStart(0,0);let n=new t(e).getWeekInfo?.();return n===void 0?calendarWeekStart(0,0):calendarWeekStart(n.firstDay%7,n.firstDay===7?0:1)}function today(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function toIsoDate(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function parseIsoDate(e){let t=/^(-?\d{1,6})-(\d{1,2})-(\d{1,2})$/.exec(e.trim());if(t===null)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31||n<1||n>9999?null:{year:n,month:r,day:i}}function integer(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)?n:t}customElements.define(`gtk-calendar`,GtkCalendar);const Ut={top:0,center:.5,bottom:1};var GtkCenterBox=class extends HTMLElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in Ut?e:`center`}set baselinePosition(e){this.setAttribute(`baseline-position`,e)}get shrinkCenterLast(){let e=this.getAttribute(`shrink-center-last`);return e===null||e!==`false`&&e!==`0`}set shrinkCenterLast(e){e?this.removeAttribute(`shrink-center-last`):this.setAttribute(`shrink-center-last`,`false`)}get startWidget(){return this.querySelector(`[slot="start-widget"]`)}set startWidget(e){this._assign(`start-widget`,e)}get centerWidget(){return this.querySelector(`[slot="center-widget"]`)}set centerWidget(e){this._assign(`center-widget`,e)}get endWidget(){return this.querySelector(`[slot="end-widget"]`)}set endWidget(e){this._assign(`end-widget`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`start-widget`,into:this},{name:`center-widget`,into:this},{name:`end-widget`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`shrink-center-last`?t===null||t!==`false`&&t!==`0`:t!==null&&t in Ut?t:`center`}_assign(e,t){let n=this.querySelector(`[slot="${e}"]`);n!==null&&(n.removeAttribute(`slot`),n.remove()),t!==null&&(t.setAttribute(`slot`,e),this.append(t)),this._sync()}_sync(){let e=this.shrinkCenterLast;for(let t of this.children){let n=t.getAttribute(`slot`),r=n===`center-widget`?!e:n===`start-widget`||n===`end-widget`?e:!1;t.style.flexShrink=String(r?100:1)}this.hasAttribute(`baseline-position`)?this.style.alignItems=labelYalignAlignItems(Ut[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const Wt=new RadioGroupState;var AdwCheckBase=class extends HTMLElement{_input;_indicator;_label;_initialized=!1;get checked(){return this.hasAttribute(`checked`)}set checked(e){this.toggleAttribute(`checked`,!!e)}get indeterminate(){return this.hasAttribute(`indeterminate`)}set indeterminate(e){this.toggleAttribute(`indeterminate`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get label(){return this.getAttribute(`label`)??this._label?.textContent??``}set label(e){this.setAttribute(`label`,e)}connectedCallback(){if(this._initialized){this.onConnected();return}this._initialized=!0;let e=[...this.childNodes];this._input=document.createElement(`input`),this._input.type=this.inputType,this._input.className=`adw-check-input`,this._indicator=document.createElement(`span`),this._indicator.className=`adw-check-indicator`,this._label=document.createElement(`span`),this._label.className=`adw-check-label`;let t=this.getAttribute(`label`);t===null?this._label.append(...e):this._label.textContent=t,this.replaceChildren(this._input,this._indicator,this._label),this._input.addEventListener(`change`,()=>this.activate()),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&this.activate()}),this.onConnected(),this.render()}disconnectedCallback(){this.onDisconnected()}attributeChangedCallback(e){this._initialized&&(e===`label`&&(this._label.textContent=this.getAttribute(`label`)??``),this.render(),e===`checked`&&this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})))}onConnected(){}onDisconnected(){}render(){let e=resolveCheckState(this.checked,this.indeterminate);this._input.checked=e===`checked`,this._input.indeterminate=e===`indeterminate`,this._input.setAttribute(`aria-checked`,e===`indeterminate`?`mixed`:String(e===`checked`)),this._input.disabled=this.disabled,this._label.hidden=this._label.childNodes.length===0}},GtkCheckButton=class extends AdwCheckBase{static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`]}get inputType(){return`checkbox`}activate(){this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`]}get inputType(){return`radio`}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??this.label.trim()}set value(e){this.setAttribute(`value`,e)}activate(){if(this.indeterminate=!1,this.name===``){this.checked=!0;return}Wt.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=Wt.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&Wt.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,GtkCheckButton),customElements.define(`adw-radio`,AdwRadio);const Gt={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends HTMLElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Gt};_pending=!1;_initialized=!1;static get observedAttributes(){return[`rgba`,`dialog`,`disabled`]}get rgba(){return{...this._rgba}}set rgba(e){let t=typeof e==`string`?parseCssColor(e):e;t===null||rgbaEqual(t,this._rgba)||(this._rgba=t,this._renderSwatch(),this.dispatchEvent(new CustomEvent(`notify::rgba`,{bubbles:!0,detail:{rgba:this.rgba}})))}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,e?.title!=null&&(this._inputEl.title=e.title),this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._swatchEl=document.createElement(`span`),this._swatchEl.className=`color-button-swatch`,this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button color icon-only`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.appendChild(this._swatchEl),this._inputEl=document.createElement(`input`),this._inputEl.type=`color`,this._inputEl.className=`color-button-input`,this._inputEl.tabIndex=-1,this._inputEl.setAttribute(`aria-hidden`,`true`),this.replaceChildren(this._buttonEl,this._inputEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._inputEl.addEventListener(`change`,()=>{this._pending=!1;let e=parseCssColor(this._inputEl.value);e!==null&&(this.rgba={...e,alpha:this._rgba.alpha}),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e),this._renderSwatch(),this._renderSensitivity()}attributeChangedCallback(e){if(this._initialized){if(e===`rgba`){let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e);return}if(e===`dialog`){this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return}this._renderSensitivity()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._choose()}_choose(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._inputEl.value=formatHex(this._rgba),this._inputEl.click())}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_renderSwatch(){this._swatchEl.style.backgroundColor=formatCssColor(this._rgba),this._swatchEl.dataset.translucent=String(this._rgba.alpha<1);let e=describeColor(this._rgba);this._swatchEl.setAttribute(`aria-label`,e),this._buttonEl.setAttribute(`aria-label`,e)}};customElements.define(`gtk-color-dialog-button`,GtkColorDialogButton);function rgbaEqual(e,t){return e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha}function scaleRound(e,t){return Math.min(t,Math.max(0,Math.floor(e*t+.5)))}function describeColor(e){let t=[`Red ${scaleRound(e.red,100)}%`,`Green ${scaleRound(e.green,100)}%`,`Blue ${scaleRound(e.blue,100)}%`];return e.alpha<1&&t.push(`Alpha ${scaleRound(e.alpha,100)}%`),t.join(`, `)}function formatHex(e){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`}function formatCssColor(e){let t=formatHex(e);return e.alpha<1?`${t}${Math.round(e.alpha*255).toString(16).padStart(2,`0`)}`:t}const Kt=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i;function parseCssColor(e){let t=document.createElement(`span`);t.style.color=``,t.style.color=e.trim();let n=t.style.color;if(n===``)return null;let r=Kt.exec(n);if(r===null)return null;let i=r[4];return{red:Number(r[1])/255,green:Number(r[2])/255,blue:Number(r[3])/255,alpha:i===void 0?1:i.endsWith(`%`)?Number.parseFloat(i)/100:Number(i)}}const qt=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=qt,t.textContent=e.item.label,t};function attachRubberBand(e){let t=null,n=null,r=null,stop=()=>{t?.remove(),t=null,n=null,r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),r=null};e.host.addEventListener(`pointerdown`,i=>{if(i.button!==0||!e.enabled())return;let a=i.target;a!==null&&e.rows().some(e=>e===a||e.contains(a))||(n={x:i.clientX,y:i.clientY},r=i.pointerId,e.host.setPointerCapture(i.pointerId),t=document.createElement(`div`),t.className=`adw-rubberband`,t.setAttribute(`aria-hidden`,`true`),e.surface.appendChild(t))}),e.host.addEventListener(`pointermove`,r=>{if(n===null||t===null)return;let i=e.surface.getBoundingClientRect(),a=Math.min(n.x,r.clientX),o=Math.min(n.y,r.clientY),s=Math.abs(r.clientX-n.x),c=Math.abs(r.clientY-n.y);t.style.left=`${a-i.left}px`,t.style.top=`${o-i.top}px`,t.style.width=`${s}px`,t.style.height=`${c}px`;let l=[];e.rows().forEach((e,t)=>{let n=e.getBoundingClientRect();n.right>=a&&n.left<=a+s&&n.bottom>=o&&n.top<=o+c&&l.push(t)}),e.selectPositions(l)});for(let t of[`pointerup`,`pointercancel`,`lostpointercapture`])e.host.addEventListener(t,stop)}const Jt=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&Jt.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends HTMLElement{_listEl;_rows=[];_state=new ListViewState;_factory=defaultListItemFactory;_initialized=!1;static get observedAttributes(){return[`model`,`selection-mode`,`show-separators`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get factory(){return this._factory}set factory(e){this._factory=typeof e==`function`?e:defaultListItemFactory,this._renderRows()}get selected(){return this._state.selection}set selected(e){let t=typeof e==`number`?[e]:e??[];this._state.setSelection(t)}get selectionMode(){return normalizeListSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get singleClickActivate(){return this.hasAttribute(`single-click-activate`)}set singleClickActivate(e){this.toggleAttribute(`single-click-activate`,!!e)}get enableRubberband(){return this.hasAttribute(`enable-rubberband`)}set enableRubberband(e){this.toggleAttribute(`enable-rubberband`,!!e)}get tabBehavior(){return normalizeListTabBehavior$1(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(this._viewClass,`view`),this._listEl=document.createElement(`div`),this._listEl.className=`adw-list-view-rows`,this.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._listEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectionMode(this.selectionMode),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribeSelection(()=>this._onSelectionChanged()),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._rows,select:e=>this._selectRow(e,{})}),attachRubberBand({host:this,surface:this._listEl,enabled:()=>this.enableRubberband&&this._state.selectionMode===`multiple`,rows:()=>this._rows,selectPositions:e=>this._state.setSelection(e,!0)}),this._applyAttributes(),this._renderRows())}attributeChangedCallback(e){if(this._initialized){if(e===`model`){this._state.setModel(parseListModel(this.getAttribute(`model`)));return}e===`selection-mode`&&this._state.setSelectionMode(this.selectionMode),this._applyAttributes(),(e===`selection-mode`||e===`tab-behavior`)&&this._renderRows()}}_applyAttributes(){let e=this.orientation;this.classList.toggle(`separators`,this.showSeparators),this.classList.toggle(`horizontal`,e===`horizontal`);let t=this._state.selectionMode!==`none`;this.setAttribute(`role`,t?`listbox`:`list`),this._state.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}get _viewClass(){return`adw-list-view`}get _rowClass(){return`adw-list-view-row`}_renderRows(){if(this._initialized){this._listEl.replaceChildren(),this._rows=[];for(let e=0;e<this._state.count;e++){let t=this._createRow(e);t!==null&&(this._listEl.appendChild(t),this._rows.push(t))}this._syncSelectedStates()}}_createRow(e){let t=this._state.itemContext(e);if(t===null)return null;let n=document.createElement(`div`);return n.className=`${this._rowClass} activatable`,n.setAttribute(`role`,this._state.selectionMode===`none`?`listitem`:`option`),n.tabIndex=this.tabBehavior===`all`?0:-1,n.appendChild(this._factory(t)),n.addEventListener(`click`,e=>{this._selectRow(n,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),this.singleClickActivate&&this._activateRow(n)}),n.addEventListener(`dblclick`,()=>{this.singleClickActivate||this._activateRow(n)}),n.addEventListener(`pointerenter`,()=>{this.singleClickActivate&&this._selectRow(n,{})}),n.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.key===` `?this._selectRow(n,{modify:e.ctrlKey,extend:e.shiftKey}):this._activateRow(n))}),n}_selectRow(e,t){let n=this._rows.indexOf(e);n<0||this._state.selectItem(n,t)}_activateRow(e){let t=this._rows.indexOf(e);t<0||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{position:t}}))}_onSelectionChanged(){this._syncSelectedStates(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:this._state.selection}}))}_syncSelectedStates(){let e=new Set(this._state.selection),t=this.tabBehavior!==`all`,n=e.size>0?Math.min(...e):0;this._rows.forEach((r,i)=>{let a=e.has(i);r.classList.toggle(`selected`,a),this._state.selectionMode===`none`?r.removeAttribute(`aria-selected`):r.setAttribute(`aria-selected`,String(a)),t&&(r.tabIndex=i===n?0:-1)})}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._rows.splice(e.position,e.removed))t.remove();let t=this._rows[e.position]??null,n=[];for(let r=0;r<e.added;r++){let i=this._createRow(e.position+r);i!==null&&(this._listEl.insertBefore(i,t),n.push(i))}this._rows.splice(e.position,0,...n),this._syncSelectedStates()}};customElements.define(`gtk-list-view`,GtkListView);var GtkColumnView=class extends GtkListView{_headerEl;_columns=[];_factories={};_sorter=null;_dragged=null;static get observedAttributes(){return[`model`,`columns`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`show-row-separators`,`show-column-separators`,`reorderable`]}get columns(){return this._columns.map(e=>({...e}))}set columns(e){this._columns=normalizeColumnViewColumns(e),this._renderHeader(),this._renderRows()}get columnFactories(){return this._factories}set columnFactories(e){this._factories=e??{},this._renderRows()}get sorter(){return this._sorter===null?null:{...this._sorter}}set sorter(e){this._applySorter(e)}get showRowSeparators(){return this.hasAttribute(`show-row-separators`)}set showRowSeparators(e){this.toggleAttribute(`show-row-separators`,!!e)}get showColumnSeparators(){return this.hasAttribute(`show-column-separators`)}set showColumnSeparators(e){this.toggleAttribute(`show-column-separators`,!!e)}get reorderable(){return this.hasAttribute(`reorderable`)}set reorderable(e){this.toggleAttribute(`reorderable`,!!e)}connectedCallback(){let e=this._headerEl===void 0;e&&(this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-column-view-header`,this._headerEl.setAttribute(`role`,`row`)),super.connectedCallback(),e&&this.insertBefore(this._headerEl,this.firstChild),this._renderHeader(),this._renderRows()}attributeChangedCallback(e){if(e===`columns`){this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._renderHeader(),this._renderRows();return}super.attributeChangedCallback(e)}_applyAttributes(){super._applyAttributes(),this.classList.toggle(`separators`,this.showRowSeparators),this.classList.toggle(`column-separators`,this.showColumnSeparators),this.setAttribute(`role`,`grid`),this.removeAttribute(`aria-multiselectable`),this.classList.remove(`horizontal`),this._headerEl!==void 0&&this._applyTracks(this._headerEl)}get _viewClass(){return`adw-column-view`}get _rowClass(){return`adw-column-view-row`}_createRow(e){let t=super._createRow(e);if(t===null)return null;t.setAttribute(`role`,`row`),t.replaceChildren();let n=this._state.itemContext(e);if(n!==null)for(let e of this._columns)e.visible!==!1&&t.appendChild(this._createCell(e,n));return this._applyTracks(t),t}_createCell(e,t){let n=document.createElement(`div`);n.className=`adw-column-view-cell`,n.setAttribute(`role`,`gridcell`);let r=this._factories[e.id??e.key];if(r!==void 0)n.appendChild(r(t));else{let r=document.createElement(`span`);r.className=qt,r.textContent=listItemField(t.item,e.key),n.appendChild(r)}return n}_renderHeader(){if(this._headerEl!==void 0){this._headerEl.replaceChildren();for(let e of this._columns)e.visible!==!1&&this._headerEl.appendChild(this._createHeaderCell(e));this._applyTracks(this._headerEl)}}_createHeaderCell(e){let t=e.id??e.key,n=document.createElement(`button`);n.type=`button`,n.className=`adw-column-view-header-cell`,n.setAttribute(`role`,`columnheader`),n.dataset.columnId=t;let r=document.createElement(`span`);if(r.className=`adw-column-view-header-title`,r.textContent=e.title??e.key,n.appendChild(r),e.sortable===!0){let r=this._sorter!==null&&this._sorter.column===t,i=createGtkImage(`go-down`,`adw-column-view-sort-indicator`);i.classList.toggle(`ascending`,r&&!this._sorter.descending),i.classList.toggle(`descending`,r&&this._sorter.descending),i.hidden=!r,n.appendChild(i),n.setAttribute(`aria-sort`,r?this._sorter.descending?`descending`:`ascending`:`none`),n.addEventListener(`click`,()=>this._applySorter(columnViewSort(this._sorter,e)))}else n.disabled=!0;return this.reorderable&&this._makeDraggable(n,t),n}_makeDraggable(e,t){e.draggable=!0,e.addEventListener(`dragstart`,e=>{this._dragged=t,e.dataTransfer?.setData(`text/plain`,t)}),e.addEventListener(`dragover`,e=>e.preventDefault()),e.addEventListener(`drop`,e=>{e.preventDefault();let n=this._columns.findIndex(e=>(e.id??e.key)===this._dragged),r=this._columns.findIndex(e=>(e.id??e.key)===t);if(this._dragged=null,n<0||r<0||n===r)return;let i=this._columns.splice(n,1);this._columns.splice(r,0,...i),this._renderHeader(),this._renderRows()})}_applySorter(e){let t=e===null&&this._sorter===null||e!==null&&this._sorter!==null&&e.column===this._sorter.column&&e.descending===this._sorter.descending;this._sorter=e===null?null:{...e},!t&&(this._renderHeader(),this.dispatchEvent(new CustomEvent(`notify::sorter`,{bubbles:!0,detail:{sorter:this.sorter}})))}_applyTracks(e){e.style.gridTemplateColumns=dataGridTrackTemplate(columnViewTracks(this._columns))}};customElements.define(`gtk-column-view`,GtkColumnView);var GtkDropDown=class extends HTMLElement{_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`model`,`selected`,`enable-search`,`disabled`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}get enableSearch(){return this.hasAttribute(`enable-search`)}set enableSearch(e){e?this.setAttribute(`enable-search`,``):this.removeAttribute(`enable-search`)}get active(){return this._popoverEl?.open??!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-drop-down`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-drop-down-button`,this._buttonEl.setAttribute(`aria-haspopup`,`listbox`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-drop-down-label`,this._buttonEl.append(this._labelEl,createGtkImage(`go-down`,`adw-drop-down-arrow`)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._state.count===0||(this._popoverEl.open=!this._popoverEl.open)}),this._buttonEl.addEventListener(`keydown`,e=>this._onButtonKeyDown(e)),this._popoverEl=document.createElement(`gtk-popover`),this._popoverEl.classList.add(`adw-drop-down-popover`),this._popoverEl.setAttribute(`role`,`listbox`),this._popoverEl.setAttribute(`menu`,``),this._listEl=document.createElement(`div`),this._listEl.className=`adw-drop-down-list`,this._popoverEl.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._buttonEl,this._popoverEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`)));let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._popoverEl.addEventListener(`keydown`,e=>this._onPopoverTypeAhead(e)),this._renderAll()}attributeChangedCallback(e,t,n){if(!(!this._initialized||!this._buttonEl))if(e===`model`)this._state.setModel(parseListModel(n));else if(e===`selected`){let e=Number.parseInt(n??``,10);Number.isNaN(e)||this._selectIndex(e,{fromAttr:!0})}else e===`enable-search`?this._renderPopover():e===`disabled`&&(this._buttonEl.disabled=this.hasAttribute(`disabled`),this.hasAttribute(`disabled`)&&this._popoverEl.popdown())}_selectIndex(e,t={}){if(!this._state.hasIndex(e))return;let n=t.fromUser?this._state.select(e):this._state.setSelectedIndex(e);if(this._updateLabel(),this._updateSelectedStates(),!t.fromAttr&&this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),n){let n=this._state.model[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),t.fromUser&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{index:e,value:n?.value??``,label:n?.label??``}}))}}_onPopoverToggled(e){if(this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e)if(this._filter(``),this._searchEl)this._searchEl.value=``,this._searchEl.focus();else{let e=this._visibleItems();(e[this._state.selectedIndex]??e[0])?.focus()}}_onButtonKeyDown(e){this.hasAttribute(`disabled`)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `?(e.preventDefault(),this._state.count>0&&this._popoverEl.popup()):e.key.length===1&&!this._popoverEl.open&&this._typeAhead(e.key))}_onPopoverTypeAhead(e){this._searchEl||e.key.length===1&&this._typeAhead(e.key)}_typeAhead(e){this._typeAheadBuffer+=e.toLowerCase(),this._typeAheadTimer&&clearTimeout(this._typeAheadTimer),this._typeAheadTimer=setTimeout(()=>this._typeAheadBuffer=``,800);let t=this._state.model.findIndex(e=>e.label.toLowerCase().startsWith(this._typeAheadBuffer));t<0||(this._popoverEl.open?this._itemButtons[t]?.focus():this._selectIndex(t,{fromUser:!0}))}_filter(e){let t=e.trim().toLowerCase(),n=this._state.model;this._itemButtons.forEach((e,r)=>{e.hidden=!(t.length===0||(n[r]?.label.toLowerCase().includes(t)??!1))})}_visibleItems(){return this._itemButtons.filter(e=>!e.hidden)}_renderAll(){this._buttonEl.disabled=this.hasAttribute(`disabled`),this.classList.toggle(`disabled`,this.hasAttribute(`disabled`)),this._renderPopover(),this._updateLabel()}_updateLabel(){this._labelEl&&(this._labelEl.textContent=this._state.selectedLabel)}_updateSelectedStates(){this._itemButtons.forEach((e,t)=>{let n=t===this._state.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,String(n))})}_renderPopover(){if(this._listEl.replaceChildren(),this._itemButtons=[],this._searchEl=null,this.enableSearch)this._searchEl=document.createElement(`input`),this._searchEl.type=`text`,this._searchEl.className=`adw-drop-down-search adw-entry`,this._searchEl.placeholder=`Search…`,this._searchEl.setAttribute(`aria-label`,`Search`),this._searchEl.addEventListener(`input`,()=>this._filter(this._searchEl?.value??``)),this._popoverEl.insertBefore(this._searchEl,this._listEl);else{let e=this._popoverEl.querySelector(`.adw-drop-down-search`);e&&e.remove()}for(let e of this._state.model){let t=this._createItem(e);this._listEl.appendChild(t),this._itemButtons.push(t)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}_createItem(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-popover-item adw-drop-down-item`,t.setAttribute(`role`,`option`),t.tabIndex=-1;let n=document.createElement(`span`);n.className=`adw-drop-down-item-label`,n.textContent=e.label;let r=document.createElement(`span`);return r.className=`adw-drop-down-item-check`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r),t.addEventListener(`click`,()=>{let e=this._itemButtons.indexOf(t);e<0||(this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus())}),t}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._itemButtons.splice(e.position,e.removed))t.remove();let t=this._itemButtons[e.position]??null,n=[],r=this._state.model;for(let i=0;i<e.added;i++){let a=r[e.position+i];if(!a)continue;let o=this._createItem(a);this._listEl.insertBefore(o,t),n.push(o)}this._itemButtons.splice(e.position,0,...n),this._updateSelectedStates(),this._updateLabel(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`gtk-drop-down`,GtkDropDown);const Yt=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends HTMLElement{_canvas;_context=null;_initialized=!1;_drawFunc=null;_width=-1;_height=-1;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`content-width`,`content-height`]}get contentWidth(){return intAttribute(this,`content-width`)}set contentWidth(e){this._write(`content-width`,String(glibClamp(Math.trunc(e)||0,0,Yt)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Yt)))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get drawFunc(){return this._drawFunc}set drawFunc(e){this.setDrawFunc(e)}setDrawFunc(e){this._drawFunc=e,this.queueDraw()}queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-drawing-area-canvas`,this._context=this._canvas.getContext(`2d`),this.replaceChildren(this._canvas),this._publishSize(),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}attributeChangedCallback(e){this._initialized&&((e===`content-width`||e===`content-height`)&&this._publishSize(),this._notify(e),(e===`content-width`||e===`content-height`)&&this.queueDraw())}_publishSize(){let e=[[`--adw-drawing-width`,this.contentWidth],[`--adw-drawing-height`,this.contentHeight]];for(let[t,n]of e)n>0?this.style.setProperty(t,`${n}px`):this.style.removeProperty(t)}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._allocated(e?e.inlineSize:t.contentRect.width,e?e.blockSize:t.contentRect.height)}}),this._resize.observe(this))}_allocated(e,t){let n=e!==this._width||t!==this._height;this._width=e,this._height=t,n&&this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:e,height:t}})),this._draw()}_draw(){if(!this._canvas||this._width<0)return;let e=this._width,t=this._height,n=this._devicePixelRatio(),r=Math.round(e*n),i=Math.round(t*n);this._canvas.width!==r&&(this._canvas.width=r),this._canvas.height!==i&&(this._canvas.height=i),this._scale=n;let a=this._context;a&&(a.setTransform(n,0,0,n,0,0),a.clearRect(0,0,e,t),this._drawFunc&&this._drawFunc(this,a,e,t))}_devicePixelRatio(){return typeof globalThis>`u`?1:globalThis.devicePixelRatio||1}_notify(e){let t=e===`content-width`?this.contentWidth:this.contentHeight;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}get allocation(){return{width:this._width,height:this._height}}get pixelScale(){return this._scale}};customElements.define(`gtk-drawing-area`,GtkDrawingArea);const Xt=new WeakMap;var Zt=class GtkDragIcon extends HTMLElement{_pointerX=0;_pointerY=0;_dragging=!1;_onDragOver=null;_onDragEnd=null;_transfer=null;static get observedAttributes(){return[]}static getForDrag(e){let t=e.dataTransfer,n=t===null?void 0:Xt.get(t);if(n!==void 0)return n;let r=document.querySelector(`gtk-drag-icon`),i=r instanceof GtkDragIcon&&!r.dragging?r:null,a=i??document.createElement(`gtk-drag-icon`);return i===null&&document.body.appendChild(a),t!==null&&Xt.set(t,a),a.beginDrag(e),a}static createWidgetForValue(e){if(typeof e==`string`){let t=document.createElement(`gtk-label`);return t.setAttribute(`label`,e),t}if(e===null)return null;let t=document.createElement(`div`);t.className=`adw-drag-icon-swatch`;let n=e.alpha??1;return t.style.backgroundColor=`rgba(${Math.round(e.red*255)}, ${Math.round(e.green*255)}, ${Math.round(e.blue*255)}, ${n})`,t}get child(){return this.firstElementChild}set child(e){this.child!==e&&(this.replaceChildren(),e!==null&&this.appendChild(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}setChild(e){this.child=e,e!==null&&this._render()}connectedCallback(){this.style.pointerEvents=`none`,this._dragging&&this._observe()}disconnectedCallback(){this._unobserve()}beginDrag(e){let t=e.dataTransfer;if(t!==null)try{let e=document.createElement(`canvas`);e.width=1,e.height=1,t.setDragImage(e,0,0)}catch{}this._pointerX=e.clientX,this._pointerY=e.clientY,this._transfer=t,this._dragging=!0,this._observe(),this._render()}endDrag(){this._dragging=!1,this._transfer=null,this._unobserve(),this.hidden=!0}get dragging(){return this._dragging}_observe(){this._onDragOver===null&&(this._onDragOver=e=>{this._pointerX=e.clientX,this._pointerY=e.clientY,this._render()},this._onDragEnd=e=>{(e.dataTransfer===null||e.dataTransfer===this._transfer)&&this.endDrag()},document.addEventListener(`dragover`,this._onDragOver),document.addEventListener(`dragend`,this._onDragEnd))}_unobserve(){this._onDragOver!==null&&document.removeEventListener(`dragover`,this._onDragOver),this._onDragEnd!==null&&document.removeEventListener(`dragend`,this._onDragEnd),this._onDragOver=null,this._onDragEnd=null}_render(){this.hidden=!this._dragging,this._dragging&&(this.style.left=`0px`,this.style.top=`0px`,this.style.transform=`translate3d(${Math.round(this._pointerX)}px, ${Math.round(this._pointerY)}px, 0)`)}};customElements.define(`gtk-drag-icon`,Zt);var GtkEditableLabel=class extends HTMLElement{_label;_entry;_initialized=!1;_grace=null;static get observedAttributes(){return[`text`,`editable`,`editing`]}get text(){return this.getAttribute(`text`)??``}set text(e){this.setAttribute(`text`,e??``)}get editable(){let e=this.getAttribute(`editable`);return e===null?!0:e!==`false`}set editable(e){e?this.removeAttribute(`editable`):this.setAttribute(`editable`,`false`)}get editing(){return this.hasAttribute(`editing`)}set editing(e){this.toggleAttribute(`editing`,!!e)}startEditing(){this.editable&&(this.editing=!0)}stopEditing(e=!1){this.editing&&=(e&&this.setAttribute(`text`,this._entry.value),!1)}get entry(){return this._entry}connectedCallback(){this._initialized||(this._initialized=!0,this._label=document.createElement(`span`),this._label.className=`adw-editable-label-label`,this._label.addEventListener(`click`,()=>this.startEditing()),this._entry=document.createElement(`input`),this._entry.className=`adw-editable-label-entry`,this._entry.type=`text`,this._entry.tabIndex=-1,this._entry.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),this.stopEditing(!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.stopEditing(!1))}),this.replaceChildren(this._label,this._entry),this.addEventListener(`keydown`,e=>{this.editing||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),this.startEditing())}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||(this._grace!==null&&clearTimeout(this._grace),this._grace=setTimeout(()=>{this._grace=null,this.editing&&this.stopEditing(!0)},100))}),this._render())}disconnectedCallback(){this._grace!==null&&clearTimeout(this._grace),this._grace=null}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`text`:this.editing||this._render();break;case`editable`:n===`false`&&this.stopEditing(!1);break;case`editing`:this._render(),this.editing?this._entry.focus():this.focus(),this.dispatchEvent(new CustomEvent(`notify::editing`,{bubbles:!0,detail:{editing:this.editing}}));break}}_render(){let e=this.editing;this.classList.toggle(`editing`,e),this._label.hidden=e,this._entry.hidden=!e,this._label.textContent=this.text,this._entry.value=this.text,e?this.removeAttribute(`tabindex`):this.setAttribute(`tabindex`,`0`)}};customElements.define(`gtk-editable-label`,GtkEditableLabel);function row(e,t,n=``){return{text:e,name:t,keywords:n===``?[]:n.split(` `)}}const Qt=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>Qt.includes(e))}const $t=[row(`😀`,`grinning face`,`smile happy joy grin`),row(`😃`,`grinning face with big eyes`,`smile happy joy`),row(`😄`,`grinning face with smiling eyes`,`smile happy joy`),row(`😁`,`beaming face with smiling eyes`,`smile happy`),row(`😂`,`face with tears of joy`,`laugh joy cry`),row(`🤣`,`rolling on the floor laughing`,`laugh rofl joy`),row(`🙂`,`slightly smiling face`,`smile`),row(`😉`,`winking face`,`wink joke flirt`),row(`😊`,`smiling face with smiling eyes`,`blush happy`),row(`😇`,`smiling face with halo`,`angel innocent`),row(`🥰`,`smiling face with hearts`,`love affection`),row(`😍`,`smiling face with heart-eyes`,`love crush`),row(`😘`,`face blowing a kiss`,`kiss love`),row(`😗`,`kissing face`,`kiss love`),row(`☺️`,`smiling face`,`smile happy`),row(`😋`,`face savoring food`,`yum delicious tasty`),row(`😛`,`face with tongue`,`tongue silly`),row(`🤪`,`zany face`,`crazy goofy wild`),row(`😟`,`worried face`,`worried sad`),row(`🙁`,`slightly frowning face`,`sad frown`),row(`☹️`,`frowning face`,`sad frown`),row(`😮`,`face with open mouth`,`surprised wow`),row(`😲`,`astonished face`,`surprised wow`),row(`😳`,`flushed face`,`blush embarrassed`),row(`🥺`,`pleading face`,`please puppy`),row(`😦`,`frowning face with open mouth`,`frown disappointed`),row(`😨`,`fearful face`,`fear scared`),row(`😰`,`anxious face with sweat`,`nervous anxious`),row(`😢`,`crying face`,`cry sad tear`),row(`😭`,`loudly crying face`,`cry sad sob`),row(`😶`,`face without mouth`,`silent speechless`),row(`😏`,`smirking face`,`smirk`),row(`😒`,`unamused face`,`meh unhappy`),row(`🙄`,`face with rolling eyes`,`eyeroll annoyed`),row(`😬`,`grimacing face`,`grimace awkward`),row(`🤥`,`lying face`,`liar pinocchio`),row(`😎`,`smiling face with sunglasses`,`cool sunglasses`),row(`🤓`,`nerd face`,`nerd geek glasses`),row(`🧐`,`face with monocle`,`fancy monocle`),row(`🧑`,`person`,`adult human`),row(`👨`,`man`,`adult male`),row(`👩`,`woman`,`adult female`),row(`👧`,`girl`,`child female`),row(`👦`,`boy`,`child male`),row(`👶`,`baby`,`child infant`),row(`👶🏻`,`child: light skin tone`,`child skin tone`),row(`🧑‍💻`,`technologist`,`coder computer`),row(`👷`,`construction worker`,`builder work`),row(`🕵️`,`detective`,`spy sleuth`),row(`🤴`,`prince`,`crown royal`),row(`👸`,`princess`,`crown royal`),row(`👰`,`person with veil`,`bride wedding`),row(`🤵`,`person in tuxedo`,`formal groom`),row(`🎅`,`Santa Claus`,`christmas santa`),row(`🤶`,`Mrs. Claus`,`christmas santa`),row(`🦸`,`superhero`,`hero power`),row(`🦹`,`supervillain`,`villain power`),row(`🧙`,`mage`,`wizard magic`),row(`🧚`,`fairy`,`magic wings`),row(`🧛`,`vampire`,`dracula horror`),row(`🧜`,`merperson`,`mermaid merman`),row(`🧝`,`elf`,`fantasy pointy`),row(`🧟`,`zombie`,`undead horror`),row(`💆`,`person getting massage`,`spa head`),row(`💇`,`person getting haircut`,`barber salon`),row(`🚶`,`person walking`,`walk pedestrian`),row(`🏃`,`person running`,`run marathon`),row(`💃`,`woman dancing`,`dance ballet`),row(`👪`,`family`,`parents child`),row(`🧑‍🤝‍🧑`,`people holding hands`,`family couple`)],en=[row(`👋`,`waving hand`,`wave hello goodbye`),row(`✋️`,`raised hand`,`stop highfive`),row(`👍`,`thumbs up`,`like yes approve`),row(`👎`,`thumbs down`,`dislike no`),row(`👌`,`OK hand`,`ok perfect`),row(`👏`,`clapping hands`,`applause praise`),row(`👐`,`open hands`,`hug open`),row(`🙌`,`raising hands`,`celebrate praise`),row(`🙏`,`folded hands`,`pray thanks`),row(`🤝`,`handshake`,`deal agreement`),row(`🤘`,`sign of the horns`,`rock metal`),row(`👈`,`backhand index pointing left`,`point direction`),row(`👉`,`backhand index pointing right`,`point direction`),row(`☝️`,`index pointing up`,`point one`),row(`✍️`,`writing hand`,`write pen`),row(`🤞`,`crossed fingers`,`luck hope`),row(`💪`,`flexed biceps`,`muscle strong`),row(`🧠`,`brain`,`mind smart`),row(`👀`,`eyes`,`look see watch`),row(`🧣`,`ear`,`hear listen`),row(`👃`,`nose`,`smell`),row(`🦰`,`red hair`,`ginger hair`),row(`🛀`,`bathing`,`bath shower`),row(`🛍`,`shower`,`bath clean`),row(`🦽`,`probing cane`,`blind accessibility`),row(`🦼`,`motorized wheelchair`,`accessibility`),row(`🦯`,`person with white cane`,`blind accessibility`),row(`🏋️`,`weight lifting`,`gym sport`),row(`👫`,`woman and man holding hands`,`couple family`),row(`👬`,`men holding hands`,`couple`),row(`👭`,`women holding hands`,`couple`),row(`💏`,`kiss`,`love couple`),row(`💑`,`couple with heart`,`love wedding`),row(`👮`,`police officer`,`cop law`),row(`👷`,`person with skullcap`,`worker`),row(`🥷`,`ninja`,`martialarts`),row(`🧗`,`person climbing`,`sport`),row(`🤸`,`person cartwheeling`,`gymnastics`),row(`🤼`,`people wrestling`,`sport wrestle`),row(`👯`,`people with bunny ears`,`costume`),row(`🧕`,`woman with headscarf`,`hijab clothing`),row(`👞`,`man’s shoe`,`clothing`),row(`👕`,`t-shirt`,`clothing shirt`),row(`👖`,`jeans`,`clothing trousers`),row(`👔`,`necktie`,`clothing formal`),row(`👗`,`dress`,`clothing`),row(`👘`,`kimono`,`clothing`),row(`🥻`,`sari`,`clothing`),row(`👙`,`bikini`,`clothing swimsuit`),row(`👚`,`woman’s clothes`,`clothing dress`),row(`🩱`,`one-piece swimsuit`,`clothing swimsuit`),row(`👑`,`woman’s hat`,`clothing`),row(`👒`,`glasses`,`clothing eyewear`),row(`🎩`,`top hat`,`clothing`),row(`🎓`,`graduation cap`,`clothing education`),row(`🧢`,`billed cap`,`clothing hat`),row(`👜`,`running shoe`,`clothing sneaker`),row(`👡`,`woman’s heel`,`clothing shoe`),row(`🛠️`,`hammer and wrench`,`tool repair`)],tn=[row(`🐒`,`monkey`,`animal primate`),row(`🦍`,`gorilla`,`animal ape`),row(`🐕`,`dog`,`animal pet`),row(`🐶`,`dog face`,`animal pet`),row(`🐩`,`poodle`,`dog animal`),row(`🐺`,`wolf`,`animal`),row(`🦊`,`fox`,`animal`),row(`🐱`,`cat face`,`animal pet`),row(`🦁`,`lion`,`animal cat`),row(`🐯`,`tiger face`,`animal cat`),row(`🐅`,`tiger`,`animal`),row(`🐆`,`leopard`,`animal cat`),row(`🐴`,`horse face`,`animal`),row(`🦄`,`unicorn`,`animal fantasy`),row(`ᾬ`,`unicorn face`,`animal fantasy`),row(`🦓`,`zebra`,`animal`),row(`🦌`,`deer`,`animal`),row(`🐮`,`cow face`,`animal`),row(`🐷`,`pig face`,`animal`),row(`🐪`,`camel`,`animal desert`),row(`🦒`,`giraffe`,`animal`),row(`🐘`,`elephant`,`animal`),row(`🦛`,`rhinoceros`,`animal`),row(`🐰`,`rabbit face`,`animal pet`),row(`🐻`,`bear`,`animal`),row(`🐨`,`koala`,`animal`),row(`🐼`,`panda`,`animal`),row(`🦥`,`sloth`,`animal`),row(`🦦`,`otter`,`animal`),row(`🦘`,`kangaroo`,`animal`),row(`🐔`,`chicken`,`bird animal`),row(`🐧`,`penguin`,`bird animal`),row(`🦆`,`duck`,`bird animal`),row(`🦉`,`owl`,`bird animal`),row(`🐸`,`frog`,`animal`),row(`🐢`,`turtle`,`animal reptile`),row(`🐍`,`snake`,`animal reptile`),row(`🐳`,`dragon face`,`animal fantasy`),row(`🦖`,`T-Rex`,`animal dinosaur`),row(`🐬`,`dolphin`,`animal sea`),row(`🦈`,`shark`,`animal sea`),row(`🐙`,`octopus`,`animal sea`),row(`🐛`,`bug`,`animal insect`),row(`🦋`,`butterfly`,`animal insect`),row(`🕷️`,`spider`,`animal insect`),row(`🌸`,`cherry blossom`,`flower spring`),row(`🌺`,`hibiscus`,`flower`),row(`🌻`,`sunflower`,`flower sun`),row(`🌷`,`tulip`,`flower`),row(`🌱`,`seedling`,`plant nature`),row(`🌲`,`evergreen tree`,`plant nature`),row(`🌳`,`deciduous tree`,`plant nature`),row(`🌴`,`palm tree`,`plant nature`),row(`🌵`,`cactus`,`plant`),row(`🍀`,`four leaf clover`,`plant luck`),row(`🍁`,`maple leaf`,`plant autumn`),row(`🍂`,`fallen leaf`,`plant autumn`),row(`🍃`,`leaf fluttering in wind`,`plant wind`)],nn=[row(`🍇`,`grapes`,`fruit`),row(`🍈`,`melon`,`fruit`),row(`🍉`,`watermelon`,`fruit`),row(`🍊`,`tangerine`,`fruit citrus`),row(`🍋`,`lemon`,`fruit citrus`),row(`🍌`,`banana`,`fruit`),row(`🍍`,`pineapple`,`fruit`),row(`🍎`,`red apple`,`fruit`),row(`🍐`,`pear`,`fruit`),row(`🍑`,`peach`,`fruit`),row(`🍒`,`cherries`,`fruit`),row(`🍓`,`strawberry`,`fruit`),row(`🥝`,`kiwi fruit`,`fruit`),row(`🍏`,`tomato`,`fruit vegetable`),row(`🥐`,`croissant`,`food bread`),row(`🥖`,`flatbread`,`food bread`),row(`🥨`,`pretzel`,`food`),row(`🥯`,`bagel`,`food bread`),row(`🥞`,`pancakes`,`food breakfast`),row(`🧀`,`cheese wedge`,`food dairy`),row(`🍖`,`meat on bone`,`food`),row(`🍗`,`poultry leg`,`food chicken`),row(`🥩`,`cut of meat`,`food`),row(`🥓`,`bacon`,`food`),row(`🍔`,`hamburger`,`food`),row(`🍟`,`french fries`,`food`),row(`🍕`,`pizza`,`food`),row(`🌭`,`hot dog`,`food`),row(`🥪`,`sandwich`,`food lunch`),row(`🌮`,`taco`,`food`),row(`🌯`,`burrito`,`food`),row(`🥗`,`green salad`,`food vegetable`),row(`🍿`,`popcorn`,`food snack`),row(`🍣`,`sushi`,`food japanese`),row(`🍤`,`fish cake with swirl`,`food`),row(`🍥`,`soft ice cream`,`food dessert`),row(`🍦`,`soft serve`,`food dessert`),row(`🍨`,`ice cream`,`food dessert`),row(`🎂`,`birthday cake`,`food dessert`),row(`🧁`,`cupcake`,`food dessert`),row(`🥧`,`pie`,`food dessert`),row(`🍫`,`chocolate bar`,`food dessert`),row(`🍬`,`candy`,`food sweet`),row(`🍭`,`lollipop`,`food sweet`),row(`☕`,`hot beverage`,`drink coffee tea`),row(`🫖`,`teapot`,`drink tea`),row(`🍶`,`teacup without handle`,`drink tea`),row(`🍷`,`wine glass`,`drink`),row(`🍸`,`cocktail glass`,`drink`),row(`🍺`,`beer mug`,`drink`),row(`🥂`,`clinking glasses`,`drink cheers`),row(`🥢`,`chopsticks`,`food utensil`),row(`🍴`,`fork and knife`,`food utensil`),row(`🥄`,`spoon`,`food utensil`)],rn=[row(`🌍`,`globe showing Europe-Africa`,`world earth`),row(`🌎`,`globe showing Americas`,`world earth`),row(`🌏`,`globe showing Asia-Australia`,`world earth`),row(`🗺️`,`world map`,`map`),row(`⛰️`,`mountain`,`travel nature`),row(`🌋`,`volcano`,`travel nature`),row(`🏕️`,`camping`,`travel nature`),row(`🏖️`,`beach with umbrella`,`travel sea`),row(`🏜`,`desert`,`travel nature`),row(`🏝️`,`desert island`,`travel sea`),row(`🏞️`,`national park`,`travel nature`),row(`🏟️`,`stadium`,`travel sport`),row(`🏛️`,`classical building`,`travel`),row(`🏗️`,`buildings`,`travel`),row(`🏠`,`house`,`home building`),row(`🏡`,`house with garden`,`home`),row(`🏢`,`office building`,`work`),row(`🏤`,`post office`,`building`),row(`🏥`,`hospital`,`building health`),row(`🏨`,`hotel`,`travel building`),row(`🏪`,`convenience store`,`building shop`),row(`🏫`,`school`,`building education`),row(`🏯`,`castle`,`building`),row(`⛪`,`church`,`building religion`),row(`⛩️`,`shinto torii gate`,`japan`),row(`🛑`,`fountain`,`building`),row(`🗼️`,`tower`,`building`),row(`🗽`,`Statue of Liberty`,`travel usa`),row(`🗛️`,`Mount Rushmore`,`travel usa`),row(`🧲`,`carousel horse`,`travel fair`),row(`🚀`,`rocket`,`travel space`),row(`🛸`,`flying saucer`,`travel space`),row(`🛎️`,`bellhop bell`,`travel hotel`),row(`🧳`,`luggage`,`travel`),row(`🧭`,`compass`,`travel navigate`),row(`⌛️`,`hourglass done`,`time`),row(`⏰`,`alarm clock`,`time`),row(`🚂`,`locomotive`,`travel train`),row(`🚆`,`train`,`travel`),row(`🚇`,`metro`,`travel subway`),row(`🚉`,`station`,`travel`),row(`🚌`,`bus`,`travel`),row(`🚑`,`ambulance`,`emergency`),row(`🚓`,`police car`,`emergency`),row(`🚕`,`taxi`,`travel`),row(`🚗`,`automobile`,`travel car`),row(`🚙`,`sport utility vehicle`,`car`),row(`🚲`,`bicycle`,`vehicle`),row(`🛴`,`kick scooter`,`vehicle`),row(`⛺`,`tent`,`travel camping`)],an=[row(`🎃`,`jack-o-lantern`,`halloween pumpkin`),row(`🎄`,`Christmas tree`,`christmas`),row(`🎆`,`fireworks`,`celebration`),row(`✨`,`sparkles`,`celebration magic`),row(`🎈`,`balloon`,`party`),row(`🎉`,`party popper`,`party celebration`),row(`🎊`,`confetti ball`,`party`),row(`🎁`,`wrapped gift`,`present birthday`),row(`🎗️`,`reminder ribbon`,`awareness`),row(`🎫`,`ticket`,`event`),row(`🏆`,`trophy`,`award win`),row(`🥇`,`1st place medal`,`award win`),row(`🎾`,`tennis`,`sport`),row(`🏈`,`American football`,`sport`),row(`🏑`,`field hockey`,`sport`),row(`🏒`,`ice hockey`,`sport`),row(`🎳`,`bowling`,`sport`),row(`🏐`,`volleyball`,`sport`),row(`🥎`,`lacrosse`,`sport`),row(`⚽`,`soccer ball`,`sport football`),row(`⚾`,`baseball`,`sport`),row(`🏊`,`swimming`,`sport`),row(`🎿`,`skis`,`sport winter`),row(`⛷️`,`skier`,`sport winter`),row(`🛹`,`skateboard`,`sport`),row(`🎽`,`running shirt`,`sport`),row(`🎯`,`bullseye`,`sport game target`),row(`🎱`,`pool 8 ball`,`game`),row(`🎲`,`game die`,`game dice`),row(`🃏`,`joker`,`game cards`),row(`🕹️`,`joystick`,`game`),row(`🎮`,`video game`,`game`),row(`🧩`,`puzzle piece`,`game`),row(`🧸`,`teddy bear`,`toy`),row(`🪅`,`pinata`,`toy party`),row(`🪆`,`nesting dolls`,`toy`),row(`🎭`,`performing arts`,`theatre`),row(`🎼`,`musical score`,`music`),row(`🎤`,`microphone`,`music sing`),row(`🎧`,`headphones`,`music listen`),row(`🎸`,`guitar`,`music`),row(`🥁`,`drum`,`music`),row(`🎨`,`artist palette`,`art paint`),row(`🖌️`,`paintbrush`,`art paint`),row(`🧵`,`thread`,`sew`),row(`🪡`,`sewing needle`,`sew`)],on=[row(`🧱`,`brick`,`object build`),row(`🪑`,`shovel`,`object tool`),row(`🪩`,`mirror ball`,`object`),row(`🧯`,`fire extinguisher`,`object safety`),row(`🛠️`,`hammer and wrench`,`tool`),row(`⚒️`,`hammer and pick`,`tool`),row(`🔧`,`wrench`,`tool`),row(`🪛`,`screwdriver`,`tool`),row(`⚙️`,`gear`,`tool cog`),row(`🗜️`,`clamp`,`tool`),row(`🔒`,`locked with key`,`object security`),row(`🔓`,`unlocked`,`object security`),row(`🔑`,`key`,`object`),row(`🗝️`,`old key`,`object`),row(`🔨`,`hammer`,`tool`),row(`🔫`,`water pistol`,`object toy`),row(`🪓`,`carpentry saw`,`tool`),row(`💡`,`light bulb`,`object idea`),row(`🔦`,`flashlight`,`object`),row(`🔬`,`microscope`,`object lab`),row(`🔭`,`telescope`,`object`),row(`💻`,`laptop`,`object computer`),row(`🖥️`,`desktop computer`,`object computer`),row(`🖨️`,`printer`,`object office`),row(`⌨️`,`keyboard`,`object computer`),row(`🖱️`,`computer mouse`,`object computer`),row(`💾`,`floppy disk`,`object`),row(`📚`,`books`,`object reading`),row(`📓`,`notebook`,`object writing`),row(`📊`,`bar chart`,`object data`),row(`📋`,`clipboard`,`object office`),row(`📌`,`pushpin`,`object office`),row(`📎`,`paperclip`,`object office`),row(`📏`,`straight ruler`,`object office`),row(`✂️`,`scissors`,`object office`),row(`🗑️`,`card file box`,`object office`),row(`🗒️`,`file cabinet`,`object office`),row(`🗓️`,`wastebasket`,`object office`),row(`🧼`,`window`,`object house`),row(`🛙`,`elevator`,`object building`),row(`🛝`,`radio`,`object`),row(`🛞`,`video camera`,`object record`),row(`⚯`,`white flag`,`object surrender`)],sn=[row(`🔠`,`input latin letters`,`symbol text`),row(`🔡`,`lowercase`,`symbol text`),row(`🔢`,`uppercase`,`symbol text`),row(`🅰️`,`A button`,`symbol letter`),row(`🆎`,`AB button`,`symbol letters`),row(`🆑️`,`CL button`,`symbol`),row(`🆒️`,`COOL button`,`symbol`),row(`🆓️`,`FREE button`,`symbol`),row(`🆔️`,`ID button`,`symbol`),row(`🆕️`,`NEW button`,`symbol`),row(`🆖️`,`OK button`,`symbol`),row(`🆗️`,`SOS button`,`symbol`),row(`🆘️`,`VS button`,`symbol`),row(`🆙️`,`UP button`,`symbol`),row(`🔴`,`red circle`,`symbol shape`),row(`🟠`,`orange circle`,`symbol shape`),row(`🟡`,`yellow circle`,`symbol shape`),row(`🟢`,`green circle`,`symbol shape`),row(`🔵`,`blue circle`,`symbol shape`),row(`🟣`,`purple circle`,`symbol shape`),row(`⚪`,`black circle`,`symbol shape`),row(`⚫`,`white circle`,`symbol shape`),row(`🟧`,`red square`,`symbol shape`),row(`🟨`,`yellow square`,`symbol shape`),row(`🟩`,`green square`,`symbol shape`),row(`🟦`,`blue square`,`symbol shape`),row(`🟪`,`purple square`,`symbol shape`),row(`⬛`,`black large square`,`symbol shape`),row(`⬜`,`white large square`,`symbol shape`),row(`🔶`,`large orange diamond`,`symbol shape`),row(`🔷`,`large blue diamond`,`symbol shape`),row(`🔺`,`red triangle pointed up`,`symbol shape`),row(`🔻`,`red triangle pointed down`,`symbol shape`),row(`▶️`,`black right-pointing triangle`,`symbol shape`),row(`◀️`,`black left-pointing triangle`,`symbol shape`),row(`▲️`,`black up-pointing triangle`,`symbol shape`),row(`▼️`,`black down-pointing triangle`,`symbol shape`),row(`❓`,`red question mark`,`symbol`),row(`❗`,`red exclamation mark`,`symbol`),row(`⁉️`,`red exclamation question mark`,`symbol`),row(`💤`,`zzz`,`symbol sleep`),row(`♻`,`recycling symbol`,`symbol green`),row(`☮`,`information`,`symbol info`),row(`⚠️`,`warning`,`symbol caution`),row(`✔️`,`check mark button`,`symbol done yes`),row(`✖️`,`multiply`,`symbol no`),row(`➕`,`plus`,`symbol math`),row(`➖`,`minus`,`symbol math`),row(`➗`,`divide`,`symbol math`),row(`🚫`,`prohibited`,`symbol no`),row(`🚳`,`no bicycles`,`symbol no`),row(`🚭`,`no smoking`,`symbol no`),row(`🚯`,`no littering`,`symbol no`),row(`🚱`,`non-potable water`,`symbol no`),row(`🔞`,`no one under eighteen`,`symbol age`),row(`🏁`,`chequered flag`,`symbol sport`),row(`🚩`,`triangular flag`,`symbol`),row(`🎌`,`crossed flags`,`symbol`),row(`🏴`,`black flag`,`symbol`),row(`🏳️`,`white flag`,`symbol surrender`),row(`🏳‍🌈`,`rainbow flag`,`symbol pride`)],cn=[row(`🇦🇨`,`flag: Bolivia`,`flag country`),row(`🇧🇷`,`flag: Brazil`,`flag country`),row(`🇩🇪`,`flag: Germany`,`flag country deutschland`),row(`🇫🇷`,`flag: France`,`flag country`),row(`🇮🇳`,`flag: United Kingdom`,`flag country britain uk`),row(`🇯🇵`,`flag: Japan`,`flag country japan`),row(`🇳🇱`,`flag: United States`,`flag country usa`),row(`🇸🇪`,`flag: Sweden`,`flag country`),row(`🇸🇰`,`flag: Denmark`,`flag country`),row(`🇹🇷`,`flag: Turkey`,`flag country`),row(`🇺🇸`,`flag: Spain`,`flag country`)],ln=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:$t},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:en},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:tn},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:nn},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:rn},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:an},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:on},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:sn},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:cn}];[...ln.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:ln.find(t=>t.id===e)?.tooltip??``}var GtkEmojiChooser=class extends GtkPopover{_built=!1;_entry;_listEl;_emptyEl;_sections=new Map;_entryOf=new WeakMap;_recent=[];_ctrl=!1;connectedCallback(){if(super.connectedCallback(),this._built)return;this._built=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`);let e=document.createElement(`div`);e.className=`emoji-picker-root`,e.appendChild(this._buildSearchbar()),this._listEl=document.createElement(`div`),this._listEl.className=`emoji-list`,this._emptyEl=this._buildEmptyPage();let t=document.createElement(`div`);t.className=`emoji-stack`,t.append(this._listEl,this._emptyEl),e.appendChild(t),this.replaceChildren(e);let n=document.createElement(`div`);n.className=`emoji-flowbox emoji-recent-box`,n.dataset.section=`recent`,this._listEl.appendChild(n),this._sections.set(`recent`,{id:`recent`,heading:null,box:n,button:null,empty:!0}),this._buildSections(),this._buildToolbar(e),this._renderRecents(),this._listEl.addEventListener(`scroll`,()=>this._markSection(this._currentSection())),this.addEventListener(`keydown`,e=>this._ctrl=e.ctrlKey),this.addEventListener(`keyup`,e=>this._ctrl=e.ctrlKey),this.subscribe(e=>{e&&(this._entry.value=``,this._filter(),this._listEl.scrollTop=0,this._markSection(`recent`))}),this._markSection(`recent`)}get recentEmoji(){return[...this._recent]}pick(e,t=!1){this._activate(e,null,t)}_buildSearchbar(){let e=document.createElement(`div`);e.className=`emoji-searchbar`;let t=createGtkImage(`edit-find`,`emoji-search-icon`);return this._entry=document.createElement(`input`),this._entry.type=`search`,this._entry.className=`emoji-search-entry`,this._entry.placeholder=`Search emoji`,this._entry.setAttribute(`aria-label`,`Search emoji`),this._entry.addEventListener(`input`,()=>this._filter()),this._entry.addEventListener(`keydown`,e=>{if(e.key===`Enter`){e.preventDefault(),this._activateFirstResult();return}e.ctrlKey&&(e.key===`n`||e.key===`p`)&&(e.preventDefault(),this._scrollSection(e.key===`n`?1:-1))}),e.append(t,this._entry),e}_buildEmptyPage(){let e=document.createElement(`div`);e.className=`emoji-empty`,e.hidden=!0,e.appendChild(createGtkImage(`edit-find`,`emoji-empty-icon`));let t=document.createElement(`div`);t.className=`emoji-empty-title`,t.textContent=`No Results Found`;let n=document.createElement(`div`);return n.className=`emoji-empty-hint`,n.textContent=`Try a different search`,e.append(t,n),e}_buildSections(){for(let e of ln){let t=document.createElement(`div`);t.className=`emoji-heading`,t.textContent=e.heading;let n=document.createElement(`div`);n.className=`emoji-flowbox`,n.dataset.section=e.id;for(let t of e.entries)n.appendChild(this._emojiButton(t));this._listEl.append(t,n),this._sections.set(e.id,{id:e.id,heading:t,box:n,button:null,empty:!0})}}_buildToolbar(e){let t=document.createElement(`div`);t.className=`emoji-toolbar`;let n=[[`recent`,this._sectionButton(`recent`,createGtkImage(`emoji-recent`,`emoji-section-icon`),emojiTooltip(`recent`))],[`people`,this._sectionButton(`people`,createGtkImage(`emoji-people`,`emoji-section-icon`),emojiTooltip(`people`))],[`body`,this._sectionButton(`body`,createGtkImage(`emoji-body`,`emoji-section-icon`),emojiTooltip(`body`))],[`nature`,this._sectionButton(`nature`,createGtkImage(`emoji-nature`,`emoji-section-icon`),emojiTooltip(`nature`))],[`food`,this._sectionButton(`food`,createGtkImage(`emoji-food`,`emoji-section-icon`),emojiTooltip(`food`))],[`travel`,this._sectionButton(`travel`,createGtkImage(`emoji-travel`,`emoji-section-icon`),emojiTooltip(`travel`))],[`activities`,this._sectionButton(`activities`,createGtkImage(`emoji-activities`,`emoji-section-icon`),emojiTooltip(`activities`))],[`objects`,this._sectionButton(`objects`,createGtkImage(`emoji-objects`,`emoji-section-icon`),emojiTooltip(`objects`))],[`symbols`,this._sectionButton(`symbols`,createGtkImage(`emoji-symbols`,`emoji-section-icon`),emojiTooltip(`symbols`))],[`flags`,this._sectionButton(`flags`,createGtkImage(`emoji-flags`,`emoji-section-icon`),emojiTooltip(`flags`))]];for(let[e,t]of n){t.addEventListener(`click`,()=>this._scrollTo(e));let n=this._sections.get(e);n!==void 0&&this._sections.set(e,{...n,button:t})}t.append(...n.map(([,e])=>e)),e.appendChild(t)}_sectionButton(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`emoji-section`,r.dataset.section=e,r.title=n,r.setAttribute(`aria-label`,n),r.appendChild(t),r}_emojiButton(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`emoji`,t.textContent=e.text,t.title=e.name,t.setAttribute(`aria-label`,e.name),this._entryOf.set(t,e),t.addEventListener(`click`,n=>{if(this._closeVariations(),n.detail>1&&hasVariations(e)){this._showVariations(e,t);return}this._activate(e,t)}),t}_matches(e,t){if(t.length===0)return!0;let n=`${e.name} ${e.keywords.join(` `)}`.toLowerCase().split(/\s+/);return t.every(e=>n.some(t=>t.startsWith(e)))}_filter(){let e=this._entry.value.toLowerCase().split(/\s+/).filter(e=>e.length>0);for(let t of this._sections.values()){let n=0;for(let r of t.box.querySelectorAll(`.emoji`)){let t=this._entryOf.get(r),i=t!==void 0&&this._matches(t,e);r.hidden=!i,i&&(n+=1)}t.empty=n===0,t.heading!==null&&(t.heading.hidden=t.empty),t.id!==`recent`&&(t.box.hidden=t.empty)}let t=[...this._sections.values()].every(e=>e.empty);this._listEl.hidden=t,this._emptyEl.hidden=!t,this._markSection(this._currentSection())}_activate(e,t,n=!1){!n&&t?.parentElement?.dataset.section!==`recent`&&this._remember(e),this.dispatchEvent(new CustomEvent(`emoji-picked`,{bubbles:!0,detail:{text:e.text}})),this._ctrl||this.popdown()}_remember(e){this._recent=[e,...this._recent.filter(t=>t.text!==e.text)].slice(0,21),this._renderRecents()}_renderRecents(){let e=this._sections.get(`recent`);if(e===void 0)return;e.box.replaceChildren(...this._recent.map(e=>this._emojiButton(e)));let t=this._recent.length===0;e.box.hidden=t,e.empty=t,e.button!==null&&(e.button.disabled=t)}_showVariations(e,t){this._closeVariations();let n=document.createElement(`div`);n.className=`emoji-variations`;let r=document.createElement(`div`);r.className=`emoji-variations-row`;let i=[...e.text].filter(e=>!Qt.includes(e)).join(``);for(let t of[i,...Qt.map(e=>i+e)]){let n=document.createElement(`button`);n.type=`button`,n.className=`emoji`,n.textContent=t,n.addEventListener(`click`,r=>{r.stopPropagation(),this._closeVariations(),this._activate({...e,text:t},n)}),r.appendChild(n)}n.appendChild(r),t.insertAdjacentElement(`afterend`,n)}_closeVariations(){for(let e of this.querySelectorAll(`.emoji-variations`))e.remove()}_scrollTo(e){let t=this._sections.get(e);if(t===void 0||t.empty)return;let n=t.heading??t.box;this._listEl.scrollTo({top:n.offsetTop-6,behavior:`smooth`}),this._markSection(e)}_scrollSection(e){let t=[...this._sections.values()].filter(e=>!e.empty);if(t.length===0)return;let n=t.findIndex(e=>e.id===this._currentSection()),r=t[Math.min(Math.max((n<0?0:n)+e,0),t.length-1)];this._scrollTo(r.id)}_activateFirstResult(){for(let e of this._sections.values()){if(e.empty)continue;let t=[...e.box.querySelectorAll(`.emoji`)].find(e=>!e.hidden);if(t!==void 0){this._activate(this._entryOf.get(t)??{text:t.textContent??``,name:``,keywords:[]},t);return}}}_sectionAt(e){let t=`recent`;for(let n of this._sections.values())if(!(n.empty||n.box.hidden)){if(e<(n.heading??n.box).offsetTop-6)break;t=n.id}return t}_currentSection(){return this._sectionAt(this._listEl.scrollTop)}_markSection(e){for(let t of this._sections.values())t.button?.classList.toggle(`checked`,t.id===e)}};customElements.define(`gtk-emoji-chooser`,GtkEmojiChooser);var GtkEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`value`,`placeholder-text`,`placeholder`,`width-request`,`type`,`disabled`,`maxlength`]}get value(){return this._input?this._input.value:this.getAttribute(`value`)??``}set value(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`value`,t)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(S,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get textLength(){return entryTextLength(this.value)}placeholderAttribute(){return this.getAttribute(`placeholder-text`)??this.getAttribute(`placeholder`)??``}applyWidthRequest(){let e=Number(this.getAttribute(`width-request`)??-1);this.style.minWidth=Number.isFinite(e)&&e>0?`${e}px`:``}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.maxLength=Number(this.getAttribute(`maxlength`)??0);let e=document.createElement(`input`);e.className=`adw-entry`,e.type=this.getAttribute(`type`)||`text`,e.value=clampEntryText(this.getAttribute(`value`)??``,this._maxLength),e.placeholder=this.placeholderAttribute(),this.applyWidthRequest(),e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t)}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this.replaceChildren(e)}disconnectedCallback(){}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}if(e===`width-request`){this.applyWidthRequest();return}this._input&&(e===`value`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`||e===`placeholder`?this._input.placeholder=this.placeholderAttribute():e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`gtk-entry`,GtkEntry);const un={left:`start`,right:`end`,center:`center`,fill:`justify`},dn=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends HTMLElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...dn]}get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e??``)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get justify(){return normalizeLabelJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get xalign(){return normalizeLabelXalign$1(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeLabelYalign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get wrapMode(){return normalizeLabelWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get ellipsize(){return normalizeLabelEllipsize(this.getAttribute(`ellipsize`))}set ellipsize(e){this.setAttribute(`ellipsize`,e)}get lines(){return normalizeLabelLines(this.getAttribute(`lines`))}set lines(e){this.setAttribute(`lines`,String(e))}get widthChars(){return normalizeLabelWidthChars(this.getAttribute(`width-chars`))}set widthChars(e){this.setAttribute(`width-chars`,String(e))}get maxWidthChars(){return normalizeLabelMaxWidthChars(this.getAttribute(`max-width-chars`))}set maxWidthChars(e){this.setAttribute(`max-width-chars`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}getText(){return labelDisplayText(this.label,this.useMarkup,this.useUnderline)}connectedCallback(){this._render(),this._resizes=new ResizeObserver(()=>this._remeasure()),this._resizes.observe(this),document.fonts?.ready.then(()=>this._remeasure())}disconnectedCallback(){this._resizes?.disconnect(),this._resizes=null}_remeasure(){if(!this._wrapSpan||!this.isConnected)return;this._wrapSpan.style.width=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.width=e===null?``:`${e}px`}attributeChangedCallback(e,t,n){this._render();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`label`?t??``:e===`justify`?normalizeLabelJustify(t):e===`xalign`?normalizeLabelXalign$1(t):e===`yalign`?normalizeLabelYalign(t):e===`wrap-mode`?normalizeLabelWrapMode(t):e===`ellipsize`?normalizeLabelEllipsize(t):e===`lines`?normalizeLabelLines(t):e===`width-chars`?normalizeLabelWidthChars(t):e===`max-width-chars`?normalizeLabelMaxWidthChars(t):t!==null}_render(){let e=this.getText(),t=this.wrap,n=this.ellipsize,r=n!==`none`;t||r?this._renderSpan(e,r):this._renderSingleLine(e),this.style.setProperty(`--gtk-label-xalign`,String(this.xalign)),this.style.textAlign=un[this.justify],this.style.setProperty(`--gtk-label-align-items`,labelYalignAlignItems(this.yalign));let i=labelEllipsizeOverflowValue(n);i===`ellipsis`?this.style.setProperty(`--gtk-label-ellipsize-overflow`,i):this.style.removeProperty(`--gtk-label-ellipsize-overflow`);let a=labelEffectiveLines(this.lines,n);a===null?this.style.removeProperty(`--gtk-label-lines`):this.style.setProperty(`--gtk-label-lines`,String(a));let o=labelWidthCharsExtent(this.widthChars,this.maxWidthChars);o.minCh===null?this._wroteMinWidth&&this.style.removeProperty(`min-width`):this.style.minWidth=`${o.minCh}ch`,o.maxCh===null?this._wroteMaxWidth&&this.style.removeProperty(`max-width`):this.style.maxWidth=`${o.maxCh}ch`,this._wroteMinWidth=o.minCh!==null,this._wroteMaxWidth=o.maxCh!==null}_renderSingleLine(e){this._wrapSpan?.remove(),this._wrapSpan=null,this.textContent!==e&&(this.textContent=e)}_renderSpan(e,t){this._wrapSpan||(this.textContent=``,this._wrapSpan=document.createElement(`span`),this._wrapSpan.className=`adw-label-text`,this.appendChild(this._wrapSpan)),this._wrapSpan.classList.toggle(`adw-label-clamp`,t),this._wrapSpan.textContent!==e&&(this._wrapSpan.textContent=e),this._remeasure()}};function measuredWrapWidth(e){let t=document.createRange();t.selectNodeContents(e);let n=0;for(let e of t.getClientRects())n=Math.max(n,e.width);return n>0?Math.ceil(n):null}customElements.define(`gtk-label`,GtkLabel);let fn=0;var GtkExpander=class extends HTMLElement{_box;_titleEl;_arrowEl;_labelEl;_labelSection;_contentEl;_initialized=!1;static get observedAttributes(){return[`expanded`,`label`,`use-markup`,`use-underline`,`resize-toplevel`]}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get label(){return this.labelWidget===null?this.getAttribute(`label`):null}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get resizeToplevel(){return this.hasAttribute(`resize-toplevel`)}set resizeToplevel(e){this.toggleAttribute(`resize-toplevel`,!!e)}get child(){return this._contentEl?.firstElementChild??null}get labelWidget(){return this._labelSection?.firstElementChild??null}connectedCallback(){this._initialized||(this._initialized=!0,this._arrowEl=createGtkImage(`pan-end`,`adw-expander-arrow`),this._labelEl=document.createElement(`gtk-label`),this._labelSection=document.createElement(`div`),this._labelSection.className=`adw-expander-label`,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-expander-title`,this._titleEl.setAttribute(`role`,`button`),this._titleEl.append(this._arrowEl,this._labelEl,this._labelSection),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-content`,this._box=document.createElement(`div`),this._box.className=`adw-expander-box`,this._box.append(this._titleEl,this._contentEl),bindSlottedChildren(this,[{name:`label-widget`,into:this._labelSection},{name:`label`,into:this._labelSection},{name:`child`,into:this._contentEl},{into:this._contentEl}]).install(this._box),bindEmptySections(this._labelSection),this._titleEl.addEventListener(`click`,()=>this._activate()),attachRowActivation({row:this._titleEl,activatable:()=>!0}),this._titleEl.addEventListener(`keydown`,this._onKeyDown),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._detail(e)}})))}_detail(e){switch(e){case`expanded`:return this.expanded;case`label`:return this.label;case`use-markup`:return this.useMarkup;case`use-underline`:return this.useUnderline;default:return this.resizeToplevel}}_activate(){this.expanded=!this.expanded,this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{expanded:this.expanded}}))}_onKeyDown=e=>{if(!this.useUnderline||!e.altKey||e.ctrlKey||e.metaKey)return;let t=this._mnemonic();t===null||(e.key.length===1?e.key.toUpperCase():``)!==t||(e.preventDefault(),this._activate())};_mnemonic(){let e=[...this.getAttribute(`label`)??``];for(let t=0;t<e.length;t+=1){if(e[t]!==`_`)continue;let n=e[t+1];if(n===void 0)return null;if(t+=1,n!==`_`)return n.toUpperCase()}return null}_render(){this._arrowEl.classList.toggle(`checked`,this.expanded),this.classList.toggle(`expanded`,this.expanded),this._titleEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.hidden=!this.expanded;let e=this.labelWidget;this._labelEl.hidden=e!==null||this.label===null,e===null&&(this._labelEl.setAttribute(`label`,labelDisplayText(this.label??``,this.useMarkup,this.useUnderline)),this._labelEl.toggleAttribute(`use-markup`,this.useMarkup),this._labelEl.toggleAttribute(`use-underline`,this.useUnderline));let t=this.child;t===null?this._titleEl.removeAttribute(`aria-controls`):this._titleEl.getAttribute(`aria-controls`)===null&&(t.id===``&&(t.id=`gtk-expander-content-${fn++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends HTMLElement{_resize=null;_mutations=null;connectedCallback(){this._resize=new ResizeObserver(()=>this._size()),this._resize.observe(this),this._mutations=new MutationObserver(()=>{this._observeChildren(),this._size()}),this._mutations.observe(this,{childList:!0}),this._observeChildren(),this._size()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}put(e,t,n){e.parentNode!==this&&this.append(e),this.move(e,t,n)}move(e,t,n){e.style.left=`${t}px`,e.style.top=`${n}px`}_observeChildren(){if(this._resize!==null)for(let e of this.children)e instanceof HTMLElement&&this._resize.observe(e)}_size(){let e=0,t=0;for(let n of this.children)n instanceof HTMLElement&&(e=Math.max(e,n.offsetLeft+n.offsetWidth),t=Math.max(t,n.offsetTop+n.offsetHeight));let n=`${e}px`,r=`${t}px`;this.style.minWidth!==n&&(this.style.minWidth=n),this.style.minHeight!==r&&(this.style.minHeight=r)}};customElements.define(`gtk-fixed`,GtkFixed);var GtkFlowBoxChild=class extends HTMLElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`gridcell`),this.tabIndex=0)}get child(){return this._contentsEl.firstElementChild}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}};customElements.define(`gtk-flow-box-child`,GtkFlowBoxChild);var GtkFlowBox=class extends HTMLElement{_children=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`homogeneous`,`min-children-per-line`,`max-children-per-line`,`row-spacing`,`column-spacing`,`orientation`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}get minChildrenPerLine(){return count(this.getAttribute(`min-children-per-line`),0)}set minChildrenPerLine(e){this.setAttribute(`min-children-per-line`,String(e))}get maxChildrenPerLine(){return Math.max(1,count(this.getAttribute(`max-children-per-line`),7))}set maxChildrenPerLine(e){this.setAttribute(`max-children-per-line`,String(e))}get rowSpacing(){return count(this.getAttribute(`row-spacing`),0)}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnSpacing(){return count(this.getAttribute(`column-spacing`),0)}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get cells(){return this._children}get selectedChildren(){return[...this._selection]}set selectedChildren(e){for(let t of typeof e==`number`?[e]:e??[])this.selectChild(this._children[t]??null)}get selectedChildElements(){return this._selection.map(e=>this._children[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._children,step:(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r},crossAxis:{orientation:()=>this.orientation===`horizontal`?`vertical`:`horizontal`,step:(e,t,n)=>visualStep(e,t,n,this.orientation)},select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectChildren()).observe(this,{childList:!0}),this._applyAttributes(),this._collectChildren())}attributeChangedCallback(){this._initialized&&(this._applyAttributes(),this._syncChildren())}selectChild(e){let t=listBoxSelectRow(this._selection,this._anchor,e===null?null:this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)&&t.anchor===this._anchor||(this._selection=t.selection,this._anchor=t.anchor,this._emitSelection(e))}unselectChild(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._children.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedChildElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`homogeneous`,this.homogeneous),this.classList.toggle(`vertical`,this.orientation===`vertical`),this.style.setProperty(`--adw-flow-box-row-spacing`,`${this.rowSpacing}px`),this.style.setProperty(`--adw-flow-box-column-spacing`,`${this.columnSpacing}px`),this.style.setProperty(`--adw-flow-box-max-children-per-line`,String(this.maxChildrenPerLine)),this.minChildrenPerLine>0?this.style.setProperty(`--adw-flow-box-min-children-per-line`,String(this.minChildrenPerLine)):this.style.removeProperty(`--adw-flow-box-min-children-per-line`);let e=this.selectionMode!==`none`;this.setAttribute(`role`,`grid`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`),e?this.removeAttribute(`aria-readonly`):this.setAttribute(`aria-readonly`,`true`)}_collectChildren(){let e=[...this.querySelectorAll(`:scope > gtk-flow-box-child`)];e.length===this._children.length&&e.every((e,t)=>e===this._children[t])||(this._children=e,this._selection=this._selection.filter(e=>e<this._children.length),this._anchor>=this._children.length&&(this._anchor=-1),this._syncChildren())}_syncChildren(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._children.forEach((n,r)=>{let i=t.has(r);n.classList.toggle(`selected`,i),n.classList.toggle(`activatable`,e),e?n.setAttribute(`aria-selected`,String(i)):n.removeAttribute(`aria-selected`)})}_onClick(e){let t=this._childAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._childAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._childAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_childAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-flow-box-child`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode,t);same$1(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._children.indexOf(e))?e:null))}_activate(e){this.dispatchEvent(new CustomEvent(`child-activated`,{bubbles:!0,detail:{child:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}_emitSelection(e){this._syncChildren(),this.dispatchEvent(new CustomEvent(`selected-children-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`child-selected`,{bubbles:!0,detail:{child:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-children`,{bubbles:!0,detail:{selectedChildren:[...this._selection]}}))}};const visualStep=(e,t,n,r)=>{if(e.length<2)return null;let i=r===`vertical`,alongLine=e=>i?e.offsetLeft:e.offsetTop,acrossLine=e=>i?e.offsetTop:e.offsetLeft,a=e[t],o=alongLine(a),s=acrossLine(a),c=n>0?o+1:o-1,l=null,u=1/0;for(let t=0;t<e.length;t++){let n=e[t];if(alongLine(n)!==c)continue;let r=Math.abs(acrossLine(n)-s);(l===null||r<u)&&(l=t,u=r)}if(l!==null)return l;let d=t+n;return d<0||d>=e.length?null:alongLine(e[d])===o?d:null};function same$1(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}__name(same$1,`same`);function count(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)&&n>=0?n:t}customElements.define(`gtk-flow-box`,GtkFlowBox);const pn={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},mn=[{word:`Thin`,set:{weight:100}},{word:`UltraLight`,set:{weight:200}},{word:`Light`,set:{weight:300}},{word:`SemiLight`,set:{weight:350}},{word:`Book`,set:{weight:375}},{word:`Medium`,set:{weight:500}},{word:`SemiBold`,set:{weight:600}},{word:`Bold`,set:{weight:700}},{word:`UltraBold`,set:{weight:800}},{word:`Heavy`,set:{weight:900}},{word:`Black`,set:{weight:1e3}},{word:`Italic`,set:{slant:`italic`}},{word:`Oblique`,set:{slant:`oblique`}},{word:`Condensed`,set:{width:`condensed`}},{word:`Expanded`,set:{width:`expanded`}}];function parseFontDescription(e){let t={...pn,family:``},n=e.trim().split(/\s+/).filter(e=>e!==``);for(let e=n.length;e>0;e--){let r=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(n[e-1]);if(r!==null){t.size=Number(r[1]),t.absolute=r[2]===`px`,n.length=e-1;break}}let r=[];for(let e of n){let n=mn.find(t=>t.word.toLowerCase()===e.toLowerCase());if(n===void 0){r.push(e);continue}Object.assign(t,n.set)}return t.family=r.join(` `),t}function formatFontDescription(e){let t=[];for(let{word:n,set:r}of mn)Object.entries(r).every(([t,n])=>e[t]===n)&&!t.includes(n)&&t.push(n);let n=`${e.size}${e.absolute?`px`:``}`;return[e.family,...t,n].filter(e=>e!==``).join(` `)}function fontDescriptionEqual(e,t){return e.family===t.family&&e.slant===t.slant&&e.weight===t.weight&&e.width===t.width&&e.size===t.size&&e.absolute===t.absolute}function formatFontSize(e,t){return`${Number(e.toPrecision(4))}${t?`px`:``}`}function cssFontParts(e,t){return{fontFamily:e.family===``?`sans-serif`:`"${e.family}"`,fontWeight:String(e.weight),fontStyle:e.slant,fontStretch:e.width,fontSize:t?`${e.size}${e.absolute?`px`:`pt`}`:``}}function cssFontShorthand(e,t){let n=cssFontParts(e,t),r=[];return n.fontStyle!==`normal`&&r.push(n.fontStyle),n.fontWeight!==`400`&&r.push(n.fontWeight),n.fontStretch!==`normal`&&r.push(n.fontStretch),n.fontSize!==``&&r.push(n.fontSize),r.length>0&&r.push(``),`${r.join(` `)}${n.fontFamily}`.trim()}function cssFontFeatureTags(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>`"${e}"`)}var GtkSeparator=class extends HTMLElement{static get observedAttributes(){return[`orientation`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`separator`),this._render()}attributeChangedCallback(){this.isConnected&&this._render()}_render(){let e=this.orientation;this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e)}};customElements.define(`gtk-separator`,GtkSeparator);const hn=[`family`,`face`,`font`,`features`],gn=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends HTMLElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...pn};_dialog=null;_features=``;_language=null;_pending=!1;_initialized=!1;static get observedAttributes(){return[`font-desc`,`font-features`,`language`,`level`,`use-font`,`use-size`,`dialog`,`disabled`]}get fontDesc(){return{...this._desc}}set fontDesc(e){let t=typeof e==`string`?parseFontDescription(e):e;fontDescriptionEqual(t,this._desc)||(this._desc={...t},this._render(),this.dispatchEvent(new CustomEvent(`notify::font-desc`,{bubbles:!0,detail:{fontDesc:this.fontDesc}})))}get fontFeatures(){return this._features}set fontFeatures(e){this._features!==e&&(this._features=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::font-features`,{bubbles:!0,detail:{value:e}})))}get language(){return this._language}set language(e){this._language!==e&&(this._language=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::language`,{bubbles:!0,detail:{value:e}})))}get level(){let e=this.getAttribute(`level`);return hn.find(t=>t===e)??`font`}set level(e){this.setAttribute(`level`,e)}get useFont(){return this.hasAttribute(`use-font`)}set useFont(e){this.toggleAttribute(`use-font`,!!e)}get useSize(){return this.hasAttribute(`use-size`)}set useSize(e){this.toggleAttribute(`use-size`,!!e)}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._labelEl=document.createElement(`span`),this._labelEl.className=`font-button-label`,this._sizeLabelEl=document.createElement(`span`),this._sizeLabelEl.className=`font-button-size-label`;let e=document.createElement(`gtk-separator`);e.setAttribute(`orientation`,`vertical`),this._sizeBoxEl=document.createElement(`span`),this._sizeBoxEl.className=`font-button-size`,this._sizeBoxEl.append(e,this._sizeLabelEl),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button font`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.append(this._labelEl,this._sizeBoxEl),this._selectEl=document.createElement(`select`),this._selectEl.className=`font-button-chooser`,this._selectEl.addEventListener(`change`,()=>this._choose()),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`font-button-popover`),this._dockEl.replaceChildren(this._selectEl),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._dockEl.subscribe(e=>{e||(this._pending=!1),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});for(let e of[`font-desc`,`font-features`,`language`]){let t=this.getAttribute(e);t!==null&&(e===`font-desc`?this.fontDesc=t:e===`font-features`?this.fontFeatures=t:this.language=t)}this._render()}attributeChangedCallback(e){if(this._initialized)switch(e){case`font-desc`:{let e=this.getAttribute(`font-desc`);e!==null&&(this.fontDesc=e);return}case`font-features`:this.fontFeatures=this.getAttribute(`font-features`)??``;return;case`language`:this.language=this.getAttribute(`language`);return;case`dialog`:this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return;case`disabled`:this._renderSensitivity();return;default:this._render()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._openChooser()}_openChooser(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._selectEl.replaceChildren(...this._options()),this._dockEl.popup())}_options(){let e=new Set;for(let t of document.fonts)t.family&&e.add(t.family);this._desc.family!==``&&e.add(this._desc.family);let t=[],n=new Set,add=e=>{let r=formatFontDescription(e);if(n.has(r))return;n.add(r);let i=document.createElement(`option`);i.value=r,i.textContent=r,t.push(i)};add(this._desc);for(let t of[...e].sort())for(let{weight:e,slant:n}of gn){let r={...this._desc,family:t,weight:e,slant:n};document.fonts.check(cssFontShorthand(r,!0))&&add(r)}return t}_choose(){let e=parseFontDescription(this._selectEl.value),t=this.level;t===`family`?this.fontDesc={...pn,family:e.family}:t===`face`?this.fontDesc={...e,size:this._desc.size,absolute:this._desc.absolute}:this.fontDesc=e,this._pending=!1,this._dockEl.popdown(),this._renderSensitivity()}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_render(){if(!this._initialized)return;let e=this.level,t=this._faceName(),n=[this._desc.family===``?`None`:this._desc.family];e!==`family`&&t!==``&&n.push(t),this._labelEl.textContent=n.join(` `),this._sizeBoxEl.hidden=e===`family`||e===`face`,this._sizeBoxEl.hidden||(this._sizeLabelEl.textContent=formatFontSize(this._desc.size,this._desc.absolute));let r=this._labelEl.style;if(this.useFont){let e=cssFontParts(this._desc,this.useSize);r.fontFamily=e.fontFamily,r.fontWeight=e.fontWeight,r.fontStyle=e.fontStyle,r.fontStretch=e.fontStretch,r.fontSize=e.fontSize,r.fontFeatureSettings=``;for(let e of cssFontFeatureTags(this._features))if(r.fontFeatureSettings=e,r.fontFeatureSettings!==``)break;this._labelEl.lang=this._language??this._dialog?.language??``}else r.fontFamily=``,r.fontWeight=``,r.fontStyle=``,r.fontStretch=``,r.fontSize=``,r.fontFeatureSettings=``,this._labelEl.lang=``;this._renderSensitivity()}_faceName(){let e=cssFontShorthand(this._desc,!0);if(this._desc.family===``||!document.fonts.check(e))return``;let t=[];return this._desc.slant===`italic`?t.push(`Italic`):this._desc.slant===`oblique`&&t.push(`Oblique`),this._desc.weight!==400&&t.push(this._desc.weight>=700?`Bold`:`Light`),this._desc.width===`condensed`?t.push(`Condensed`):this._desc.width===`expanded`&&t.push(`Expanded`),t.join(` `)}};customElements.define(`gtk-font-dialog-button`,GtkFontDialogButton);function normalizeLabelXalign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):0}var GtkFrame=class extends HTMLElement{_mutations=null;static get observedAttributes(){return[`label`,`label-xalign`]}_labelEl=null;_writingLabel=!1;get label(){return this.getAttribute(`label`)}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get labelXalign(){return normalizeLabelXalign(this.getAttribute(`label-xalign`))}set labelXalign(e){this.setAttribute(`label-xalign`,String(e))}get labelWidget(){let e=this.querySelector(`[slot="label-widget"]`);return e===null?this._labelEl?.parentNode===this?this._labelEl:null:e}set labelWidget(e){let t=this.querySelector(`[slot="label-widget"]`);t!==null&&(t.removeAttribute(`slot`),t.remove()),e!==null&&(e.setAttribute(`slot`,`label-widget`),this.prepend(e),this._sync())}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this},{name:`label-widget`,into:this}]),this._mutations=new MutationObserver(()=>this._sync()),this._mutations.observe(this,{childList:!0}),this.setAttribute(`role`,`group`),this._sync()}disconnectedCallback(){this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=e===`label-xalign`?String(normalizeLabelXalign(n)):n;r!==(e===`label-xalign`?String(normalizeLabelXalign(t)):t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_sync(){let e=this.querySelector(`[slot="label-widget"]`),t=this.getAttribute(`label`);e===null&&t!==null?(this._labelEl===null&&(this._labelEl=document.createElement(`gtk-label`),this._labelEl.addEventListener(`notify::label`,e=>{this._writingLabel&&e.stopPropagation()})),this._writingLabel=!0,this._labelEl.setAttribute(`label`,t),this._writingLabel=!1,this._labelEl.parentNode!==this&&this.prepend(this._labelEl)):this._labelEl?.parentNode===this&&this._labelEl.remove();let n=this.labelWidget;n!==null&&(n.classList.add(`adw-frame-label`),n.style.alignSelf=labelYalignAlignItems(this.labelXalign))}};customElements.define(`gtk-frame`,GtkFrame);const G=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...G];let n=t.split(/[\s,|]+/).filter(e=>G.includes(e));return G.filter(e=>n.includes(e))}function booleanAttribute$1(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}__name(booleanAttribute$1,`booleanAttribute`);var GtkGLArea=class extends HTMLElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...G];_needsRender=!0;_haveBuffers=!1;_width=0;_height=0;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`auto-render`,`has-depth-buffer`,`has-stencil-buffer`,`allowed-apis`]}get autoRender(){return booleanAttribute$1(this,`auto-render`,!0)}set autoRender(e){this.autoRender!==!!e&&this._write(`auto-render`,String(!!e))}get hasDepthBuffer(){return booleanAttribute$1(this,`has-depth-buffer`,!1)}set hasDepthBuffer(e){this.hasDepthBuffer!==!!e&&this._write(`has-depth-buffer`,String(!!e))}get hasStencilBuffer(){return booleanAttribute$1(this,`has-stencil-buffer`,!1)}set hasStencilBuffer(e){this.hasStencilBuffer!==!!e&&this._write(`has-stencil-buffer`,String(!!e))}get allowedApis(){return[...this._allowedApis]}set allowedApis(e){if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=G.filter(t=>e.includes(t)),this._write(`allowed-apis`,this._allowedApis.join(` `))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get api(){return this._context===null?`gl`:`gles`}get context(){return this._context}get error(){return this._error}setError(e){let t=e===null?null:typeof e==`string`?e:e.message;this._error!==t&&(this._error=t,this._renderMessage(),this._queueDraw())}makeCurrent(){return this._context}queueRender(){this._needsRender=!0,this._queueDraw()}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.hasAttribute(`allowed-apis`)&&(this._allowedApis=parseApis(this)),this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-gl-area-canvas`,this.replaceChildren(this._canvas),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}_queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}attributeChangedCallback(e){if(this._initialized){switch(e){case`auto-render`:this.autoRender&&this._queueDraw();break;case`has-depth-buffer`:case`has-stencil-buffer`:this._haveBuffers=!1;break;case`allowed-apis`:if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=parseApis(this);break;default:break}this._notify(e)}}_notify(e){let t=e===`allowed-apis`?this.allowedApis.join(` `):e===`auto-render`?this.autoRender:e===`has-depth-buffer`?this.hasDepthBuffer:this.hasStencilBuffer;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0],n=e?e.inlineSize:t.contentRect.width,r=e?e.blockSize:t.contentRect.height;n===this._width&&r===this._height||(this._width=n,this._height=r,this._needsResize=!0,this._queueDraw())}}),this._resize.observe(this))}_draw(){if(!this._canvas)return;let e=typeof globalThis>`u`?1:globalThis.devicePixelRatio||1;this._scale=e;let t=Math.round(this._width*e),n=Math.round(this._height*e);if(t===0||n===0)return;if(this._error!==null){this._renderMessage();return}let r=this._context??this._createContext();r!==null&&(this.makeCurrent(),this.attachBuffers(r),this.hasDepthBuffer?r.enable?.(r.DEPTH_TEST):r.disable?.(r.DEPTH_TEST),(this._needsRender||this.autoRender)&&(this._needsResize&&(this._needsResize=!1,this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:t,height:n}}))),this.dispatchEvent(new CustomEvent(`render`,{bubbles:!0,detail:{context:r}}))),this._needsRender=!1)}attachBuffers(e=this._context){e!==null&&(this.hasStencilBuffer?e.enable?.(e.STENCIL_TEST):e.disable?.(e.STENCIL_TEST),this._haveBuffers=!0)}_createContext(){let e=this.allowedApis;if(e.length===0)return null;let t={context:null};if(this.dispatchEvent(new CustomEvent(`create-context`,{bubbles:!0,detail:t})),t.context!==null)return this._context=t.context,this._context;let n={preserveDrawingBuffer:!0,depth:this.hasDepthBuffer,stencil:this.hasStencilBuffer},r=e.includes(`gles`)?[`webgl2`,`webgl`]:[`webgl`];for(let e of r){let t=this._canvas.getContext(e,n);if(t!==null)return this._context=t,t}return null}_renderMessage(){if(this._error===null){this._messageEl?.remove(),this._messageEl=null;return}this._messageEl||(this._messageEl=document.createElement(`div`),this._messageEl.className=`adw-gl-area-error`,this.append(this._messageEl)),this._messageEl.textContent=this._error}get viewport(){return{width:Math.round(this._width*this._scale),height:Math.round(this._height*this._scale)}}get pixelScale(){return this._scale}};customElements.define(`gtk-gl-area`,GtkGLArea);function booleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var GtkGraphicsOffload=class extends HTMLElement{_childEl;_initialized=!1;static get observedAttributes(){return[`enabled`,`black-background`]}get child(){return this._childEl?.firstElementChild??null}get enabled(){return this.getAttribute(`enabled`)===`disabled`?`disabled`:`enabled`}set enabled(e){this.enabled!==e&&this.setAttribute(`enabled`,e)}get blackBackground(){return booleanAttribute(this,`black-background`,!1)}set blackBackground(e){this.blackBackground!==!!e&&this.setAttribute(`black-background`,String(!!e))}connectedCallback(){this._initialized||(this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-graphics-offload-child`,bindSlottedChildren(this,[{into:this._childEl}]).install(this._childEl),this.replaceChildren(this._childEl),this._render())}attributeChangedCallback(e){this._initialized&&((e===`enabled`||e===`black-background`)&&this._render(),this._notify(e))}_render(){let e=this.enabled!==`disabled`;this.style.willChange=e?`transform`:``,this.style.backgroundColor=this.blackBackground?`#000000`:``}_notify(e){let t=e===`enabled`?this.enabled:this.blackBackground;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}};customElements.define(`gtk-graphics-offload`,GtkGraphicsOffload);var GtkGrid=class extends HTMLElement{static get observedAttributes(){return[`column-spacing`,`row-spacing`,`column-homogeneous`,`row-homogeneous`,`orientation`]}get columnSpacing(){return normalizeBoxSpacing(this.getAttribute(`column-spacing`))}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get rowSpacing(){return normalizeBoxSpacing(this.getAttribute(`row-spacing`))}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnHomogeneous(){return this.hasAttribute(`column-homogeneous`)}set columnHomogeneous(e){this.toggleAttribute(`column-homogeneous`,!!e)}get rowHomogeneous(){return this.hasAttribute(`row-homogeneous`)}set rowHomogeneous(e){this.toggleAttribute(`row-homogeneous`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){return e===`column-spacing`||e===`row-spacing`?normalizeBoxSpacing(t):e===`orientation`?normalizeBoxOrientation(t):t!==null}_sync(){this.style.rowGap=`${this.rowSpacing}px`,this.style.columnGap=`${this.columnSpacing}px`,this.style.gridAutoRows=this.rowHomogeneous?`1fr`:``,this.style.gridAutoColumns=this.columnHomogeneous?`1fr`:``,this.style.gridAutoFlow=this.orientation===`vertical`?`row`:`column`}};customElements.define(`gtk-grid`,GtkGrid);function cssPixels(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}var GtkGridView=class extends GtkListView{_observer=null;static get observedAttributes(){return[`model`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`,`min-columns`,`max-columns`]}get minColumns(){return this._columnBound(`min-columns`,1)}set minColumns(e){this.setAttribute(`min-columns`,String(e))}get maxColumns(){return this._columnBound(`max-columns`,7)}set maxColumns(e){this.setAttribute(`max-columns`,String(e))}connectedCallback(){super.connectedCallback(),this._observer===null&&(this._observer=new ResizeObserver(()=>this._applyColumns()),this._observer.observe(this),this._applyColumns())}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){super.attributeChangedCallback(e),this._applyColumns()}get _viewClass(){return`adw-grid-view`}get _rowClass(){return`adw-grid-view-child`}_renderRows(){super._renderRows(),this._applyColumns()}_columnBound(e,t){let n=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(n)&&n>=1?n:t}_applyColumns(){let e=this._rows[0];if(e===void 0)return;let t=cssPixels(globalThis.getComputedStyle(e).minWidth,120),n=cssPixels(globalThis.getComputedStyle(this._listEl).columnGap,6),r=gridViewColumns(Math.round(this.getBoundingClientRect().width),t,n,this.minColumns,this.maxColumns);this._listEl.style.gridTemplateColumns=`repeat(${r}, 1fr)`}};customElements.define(`gtk-grid-view`,GtkGridView);var GtkHeaderBar=class extends HTMLElement{_initialized=!1;_handle;_box;_startBox;_endBox;_startControls=null;_endControls=null;_titleLabel=null;_centre=null;_centreObserver=null;static get observedAttributes(){return[`decoration-layout`,`show-title-buttons`]}get decorationLayout(){return this.getAttribute(`decoration-layout`)}set decorationLayout(e){e===null?this.removeAttribute(`decoration-layout`):this._write(`decoration-layout`,e)}get showTitleButtons(){return this.getAttribute(`show-title-buttons`)!==`false`}set showTitleButtons(e){this._write(`show-title-buttons`,String(e))}get titleWidget(){return this._centre}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followCentre();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startBox=document.createElement(`div`),this._startBox.className=`adw-gtk-header-bar-start`,this._endBox=document.createElement(`div`),this._endBox.className=`adw-gtk-header-bar-end`,this._box=document.createElement(`div`),this._box.className=`adw-gtk-header-bar-box`,this._box.append(this._startBox,this._endBox),this._handle=document.createElement(`div`),this._handle.className=`adw-gtk-header-bar-handle`,this._handle.appendChild(this._box),this._renderTitleButtons(),bindSlottedChildren(this,[{name:`start`,into:this._startBox},{name:`title`,into:this._box},{name:`title-widget`,into:this._box},{name:`end`,consume:e=>this._endBox.prepend(e)},{into:this._startBox}]).install(this._handle),this._followCentre()}disconnectedCallback(){this._centreObserver?.disconnect(),this._centreObserver=null}attributeChangedCallback(e){this._initialized&&(e===`show-title-buttons`?this._renderTitleButtons():this._bindDecorationLayout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`show-title-buttons`?this.showTitleButtons:this.decorationLayout}_renderTitleButtons(){if(!this.showTitleButtons){this._startControls?.remove(),this._endControls?.remove(),this._startControls=null,this._endControls=null;return}this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._startBox.prepend(this._startControls),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._endBox.appendChild(this._endControls)),this._bindDecorationLayout()}_bindDecorationLayout(){for(let e of[this._startControls,this._endControls]){if(e===null)continue;let t=this.decorationLayout;t===null?e.removeAttribute(`decoration-layout`):e.setAttribute(`decoration-layout`,t)}}_followCentre(){this._centreObserver?.disconnect(),this._centreObserver=new MutationObserver(()=>this._syncCentre()),this._centreObserver.observe(this._box,{childList:!0});let e=this.closest(`gtk-window, adw-window`);e!==null&&this._centreObserver.observe(e,{attributes:!0,attributeFilter:[`title`]}),this._syncCentre()}_centreChild(){for(let e of this._box.children)if(!(e===this._startBox||e===this._endBox||e===this._titleLabel)&&e instanceof HTMLElement)return e;return null}_syncCentre(){this._centre=this._centreChild(),this._centre===null?this._titleLabel===null?this._constructTitleLabel():this._updateTitle():this._dropTitleLabel()}_constructTitleLabel(){let e=document.createElement(`gtk-label`);e.className=`title adw-gtk-header-bar-title`,this._titleLabel=e,this._box.appendChild(e),this._updateTitle()}_dropTitleLabel(){this._titleLabel?.remove(),this._titleLabel=null}_updateTitle(){let e=this._titleLabel;if(e===null)return;let t=this.closest(`gtk-window, adw-window`)?.getAttribute(`title`)??document.title;t===``?e.removeAttribute(`label`):e.setAttribute(`label`,t)}};customElements.define(`gtk-header-bar`,GtkHeaderBar);var GtkLinkButton=class extends GtkButton{_wired=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`uri`,`visited`]}get uri(){return this.getAttribute(`uri`)??``}set uri(e){this.setAttribute(`uri`,e)}get visited(){return this.hasAttribute(`visited`)}set visited(e){this.toggleAttribute(`visited`,!!e)}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>this._activateLink()))}attributeChangedCallback(e){e===`uri`&&this.isConnected&&(this.visited=!1),super.attributeChangedCallback(),e===`visited`&&this.isConnected&&this.dispatchEvent(new CustomEvent(`notify::visited`,{bubbles:!0,detail:{visited:this.visited}}))}_activateLink(){let e=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;let{uri:t}=this;t!==``&&(this.launch(t),this.visited=!0)}launch(e){globalThis.open(e,`_blank`,`noopener`)}decorate(e){e.classList.add(`link`),e.classList.toggle(`visited`,this.visited);let t=(this.getAttribute(`label`)??``).trim();(this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`))===null&&t!==``&&this.uri!==``&&this.uri!==t&&(e.title=this.uri)}};customElements.define(`gtk-link-button`,GtkLinkButton);const _n=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return _n.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return Te.includes(e)?e:`word-char`}function normalizeAlignment(e,t){let n=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function normalizeCount(e){let t=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}var GtkInscription=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`markup`,`min-chars`,`min-lines`,`nat-chars`,`nat-lines`,`text`,`text-overflow`,`wrap-mode`,`xalign`,`yalign`]}get text(){return this.getAttribute(`text`)??``}set text(e){this._write(`text`,e)}get markup(){return this.getAttribute(`markup`)??``}set markup(e){this._write(`markup`,e)}get minChars(){let e=this.getAttribute(`min-chars`);return e===null?3:normalizeCount(e)}set minChars(e){this._write(`min-chars`,String(e))}get natChars(){return normalizeCount(this.getAttribute(`nat-chars`))}set natChars(e){this._write(`nat-chars`,String(e))}get minLines(){let e=this.getAttribute(`min-lines`);return e===null?1:normalizeCount(e)}set minLines(e){this._write(`min-lines`,String(e))}get natLines(){return normalizeCount(this.getAttribute(`nat-lines`))}set natLines(e){this._write(`nat-lines`,String(e))}get textOverflow(){return normalizeInscriptionOverflow(this.getAttribute(`text-overflow`))}set textOverflow(e){this._write(`text-overflow`,e)}get wrapMode(){return normalizeInscriptionWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this._write(`wrap-mode`,e)}get xalign(){return normalizeAlignment(this.getAttribute(`xalign`),0)}set xalign(e){this._write(`xalign`,String(e))}get yalign(){return normalizeAlignment(this.getAttribute(`yalign`),.5)}set yalign(e){this._write(`yalign`,String(e))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`text`:return this.text;case`markup`:return this.markup;case`min-chars`:return this.minChars;case`nat-chars`:return this.natChars;case`min-lines`:return this.minLines;case`nat-lines`:return this.natLines;case`text-overflow`:return this.textOverflow;case`wrap-mode`:return this.wrapMode;case`xalign`:return this.xalign;default:return this.yalign}}_render(){let e=this.text,t=this.markup;this.textContent=e||!t?e:labelDisplayText(t,!0,!1);let n=this.minChars,r=this.natChars;if(n===0&&r===0)this.style.setProperty(`--gtk-inscription-min-ch`,`auto`),this.style.setProperty(`--gtk-inscription-width`,`auto`);else{let{minCh:e,maxCh:t}=labelWidthCharsExtent(n,r);this.style.setProperty(`--gtk-inscription-min-ch`,`${e}ch`),this.style.setProperty(`--gtk-inscription-width`,`${t}ch`)}let i=this.minLines,a=this.natLines;this.style.setProperty(`--gtk-inscription-min-lh`,i===0&&a===0?`auto`:`${i}lh`),this.style.setProperty(`--gtk-inscription-height`,i===0&&a===0?`auto`:`${Math.max(i,a)}lh`),this.style.setProperty(`--gtk-inscription-xalign`,String(this.xalign)),this.style.setProperty(`--gtk-inscription-align-items`,labelYalignAlignItems(this.yalign));let o=this.textOverflow;this.style.setProperty(`--gtk-inscription-text-overflow`,labelEllipsizeOverflowValue(o===`clip`?`none`:`end`)),this.classList.toggle(`clip`,o===`clip`),this.classList.toggle(`ellipsized`,o!==`clip`)}};customElements.define(`gtk-inscription`,GtkInscription);const vn=[[`low`,.25],[`high`,.75],[`full`,1]];function levelClassFor(e,t){for(let n=0;n<e.length;n++){let[r,i]=e[n];if(t>i)continue;let a=n===0?null:e[n-1][1];if(a===null||a<t)return r}return null}function numberAttribute(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)?r:n}var GtkLevelBar=class extends HTMLElement{_trough;_initialized=!1;_offsets=vn.map(e=>[...e]);static get observedAttributes(){return[`value`,`min-value`,`max-value`,`mode`,`inverted`,`orientation`,`disabled`]}get value(){return numberAttribute(this,`value`,0)}set value(e){this._write(`value`,String(e))}get minValue(){return numberAttribute(this,`min-value`,0)}set minValue(e){this._write(`min-value`,String(e))}get maxValue(){return numberAttribute(this,`max-value`,1)}set maxValue(e){this._write(`max-value`,String(e))}get mode(){return this.getAttribute(`mode`)===`discrete`?`discrete`:`continuous`}set mode(e){this._write(`mode`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this._write(`orientation`,e)}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}addOffsetValue(e,t){if(t<this.minValue||t>this.maxValue)return;let n=this._offsets.findIndex(([t])=>t===e);n!==-1&&this._offsets[n][1]===t||(n!==-1&&this._offsets.splice(n,1),this._offsets.push([e,t]),this._offsets.sort((e,t)=>e[1]-t[1]),this._render(),this.dispatchEvent(new CustomEvent(`offset-changed`,{bubbles:!0,detail:{name:e}})))}removeOffsetValue(e){let t=this._offsets.findIndex(([t])=>t===e);t!==-1&&(this._offsets.splice(t,1),this._render())}offsetValue(e){return this._offsets.find(([t])=>t===e)?.[1]??null}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-level-bar-trough`,this.replaceChildren(this._trough),this.setAttribute(`role`,`meter`),this._render()}attributeChangedCallback(e){if(!(!this._initialized||e===`disabled`)){if(e===`min-value`&&this.value<this.minValue){this._write(`value`,String(this.minValue)),this._notify(e);return}if(e===`max-value`&&(this._clampOffsets(),this.value>this.maxValue)){this._write(`value`,String(this.maxValue)),this._notify(e);return}this._render(),this._notify(e)}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_clampOffsets(){for(let e=0;e<this._offsets.length;e++){let[t,n]=this._offsets[e];n<this.minValue?this._offsets[e]=[t,this.minValue]:n>this.maxValue&&(this._offsets[e]=[t,this.maxValue])}}_property(e){switch(e){case`value`:return this.value;case`min-value`:return this.minValue;case`max-value`:return this.maxValue;case`mode`:return this.mode;case`inverted`:return this.inverted;default:return this.orientation}}_render(){if(!this._trough)return;let e=this.mode===`discrete`,t=this.orientation===`vertical`;this.classList.toggle(`continuous`,!e),this.classList.toggle(`discrete`,e),this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t);let n=this.minValue,r=this.maxValue,i=this.value,a=e?Math.max(1,Math.round(r)-Math.round(n)):1,o=levelClassFor(this._offsets,i);if(this._trough.replaceChildren(),e){let e=Math.min(a,Math.max(0,Math.round(i)-Math.round(n)));for(let t=0;t<a;t++){let n=this.inverted?t>=a-e:t<e;this._trough.append(this._block(n?`filled`:`empty`,n?o:null))}}else{let e=this._block(`empty`,null),t=this._block(`filled`,o);t.style.setProperty(`--level-fraction`,String(r>n?(i-n)/(r-n):0)),t.hidden=i===0,this._trough.append(e,t)}this.setAttribute(`aria-valuemin`,String(n)),this.setAttribute(`aria-valuemax`,String(r)),this.setAttribute(`aria-valuenow`,String(i))}_block(e,t){let n=document.createElement(`span`);return n.className=`adw-level-bar-block ${e}`,e===`filled`&&t&&n.classList.add(t),n}};customElements.define(`gtk-level-bar`,GtkLevelBar);var GtkListBoxRow=class extends HTMLElement{_contentsEl;_activation;_initialized=!1;static get observedAttributes(){return[`activatable`,`selectable`]}get activatable(){return this.getAttribute(`activatable`)!==`false`}set activatable(e){this.setAttribute(`activatable`,String(!!e))}get selectable(){return this.getAttribute(`selectable`)!==`false`}set selectable(e){this.setAttribute(`selectable`,String(!!e))}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}get child(){return this._contentsEl.firstElementChild}connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-list-box-row-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`listitem`),this._claimed?this._syncActivation():this.syncClasses(!0))}claim(){this._claimed=!0}release(){this._claimed=!1,this.syncClasses(!1)}_canSelect=!0;_claimed=!1;attributeChangedCallback(){this._initialized&&this.syncClasses(this._canSelect)}syncClasses(e){this._canSelect=e,this.classList.toggle(`activatable`,this.activatable||this.selectable&&e),this._syncActivation()}_syncActivation(){this._activation??=attachRowActivation({row:this,activatable:()=>this.classList.contains(`activatable`),activate:()=>this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}),this._claimed||this._activation.sync()}};customElements.define(`gtk-list-box-row`,GtkListBoxRow);const yn=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&yn.has(e)?e:`all`}var GtkListBox=class extends HTMLElement{_rows=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`show-separators`,`tab-behavior`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get tabBehavior(){return normalizeListTabBehavior(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get rows(){return this._rows}get selectedRows(){return[...this._selection]}set selectedRows(e){for(let t of typeof e==`number`?[e]:e??[])this.selectRow(this._rows[t]??null)}get selectedRowElements(){return this._selection.map(e=>this._rows[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows,select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectRows()).observe(this,{childList:!0}),this._applyAttributes(),this._collectRows())}attributeChangedCallback(e){this._initialized&&(this._applyAttributes(),e===`selection-mode`&&this._syncRows(),e===`tab-behavior`&&this._syncTabIndexes())}selectRow(e){let t=e===null?null:this._rows.indexOf(e),n=listBoxSelectRow(this._selection,this._anchor,t,this._rows.length,this.selectionMode,e===null||e.selectable);same(n.selection,this._selection)&&n.anchor===this._anchor||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(e))}unselectRow(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode);same(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._rows.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedRowElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`separators`,this.showSeparators);let e=this.selectionMode!==`none`;this.setAttribute(`role`,e?`listbox`:`list`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}_collectRows(){let e=[...this.querySelectorAll(`:scope > gtk-list-box-row`)];if(!(e.length===this._rows.length&&e.every((e,t)=>e===this._rows[t]))){for(let t of this._rows)e.includes(t)||t.release();for(let t of e)t.claim();this._rows=e,this._selection=this._selection.filter(e=>e<this._rows.length),this._anchor>=this._rows.length&&(this._anchor=-1),this._syncRows()}}_syncRows(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._rows.forEach((n,r)=>{n.syncClasses(e),n.selectable&&e?n.setAttribute(`aria-selected`,String(t.has(r))):n.removeAttribute(`aria-selected`)}),this._syncTabIndexes()}_syncTabIndexes(){let e=this.tabBehavior!==`all`,t=this._selection.length>0?this._selection[0]:0;this._rows.forEach((n,r)=>{n.tabIndex=e?r===t?0:-1:n.classList.contains(`activatable`)?0:-1})}_onClick(e){let t=this._rowAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._rowAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._rowAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_rowAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-list-box-row`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode,t,e.selectable);same(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._rows.indexOf(e))?e:null))}_activate(e){e.activatable&&(this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{row:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})))}_emitSelection(e){this._syncRows(),this.dispatchEvent(new CustomEvent(`selected-rows-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`row-selected`,{bubbles:!0,detail:{row:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-rows`,{bubbles:!0,detail:{selectedRows:[...this._selection]}}))}};function same(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}customElements.define(`gtk-list-box`,GtkListBox);function volumeIconFor(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));return t===0?`audio-volume-muted-symbolic`:t===1?`audio-volume-high-symbolic`:Math.trunc((t-0)/.5)+2===2?`audio-volume-low-symbolic`:`audio-volume-medium-symbolic`}function mediaTimeToString(e,t=!1,n=!1){let r=Math.trunc(e);t&&r++;let i=r%60;r-=i;let a=r%3600/60;r-=a*60;let o=r/3600;return o>0||n?t?`-${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:t?`-${a}:${String(i).padStart(2,`0`)}`:`${a}:${String(i).padStart(2,`0`)}`}var GtkMediaControls=class extends HTMLElement{_initialized=!1;_playButton;_timeLabel;_seekScale;_durationLabel;_volumeButton;_volumeIcon;_volumePopover;_volumeScale;_media=null;_seeking=!1;_volume=1;connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-media-controls-box`,this._playButton=document.createElement(`button`),this._playButton.className=`adw-media-controls-button adw-flat`,this._playButton.type=`button`,this._playButton.title=`Play`,this._playButton.setAttribute(`aria-label`,`Play`),this._playButton.addEventListener(`click`,()=>this._togglePlay());let t=document.createElement(`div`);t.className=`adw-media-controls-time-box`,this._timeLabel=document.createElement(`span`),this._timeLabel.className=`adw-media-controls-time-label`,this._seekScale=document.createElement(`input`),this._seekScale.className=`adw-media-controls-seek-scale`,this._seekScale.type=`range`,this._seekScale.min=`0`,this._seekScale.max=`10`,this._seekScale.step=`1`,this._seekScale.value=`0`,this._seekScale.setAttribute(`aria-label`,`Position`),this._seekScale.addEventListener(`input`,()=>this._onSeekInput()),this._durationLabel=document.createElement(`span`),this._durationLabel.className=`adw-media-controls-duration-label`,t.append(this._timeLabel,this._seekScale,this._durationLabel),this._volumeButton=document.createElement(`button`),this._volumeButton.className=`adw-media-controls-button adw-media-controls-volume-button adw-flat`,this._volumeButton.type=`button`,this._volumeButton.setAttribute(`aria-label`,`Volume`),this._volumeButton.addEventListener(`click`,()=>this._toggleVolumePopover()),this._volumeIcon=document.createElement(`span`),this._volumeIcon.className=`adw-media-controls-volume-icon`,this._volumePopover=document.createElement(`gtk-popover`),this._volumePopover.className=`adw-media-controls-volume-popover`,this._volumeScale=document.createElement(`input`),this._volumeScale.className=`adw-media-controls-volume-scale`,this._volumeScale.type=`range`,this._volumeScale.min=`0`,this._volumeScale.max=`1`,this._volumeScale.step=`0.1`,this._volumeScale.value=`1`,this._volumeScale.setAttribute(`aria-label`,`Volume`),this._volumeScale.addEventListener(`input`,()=>this._onVolumeInput()),this._volumePopover.append(this._volumeScale),this._volumePopover.addEventListener(`click`,e=>e.stopPropagation()),this._volumeButton.append(this._volumeIcon,this._volumePopover),e.append(this._playButton,t,this._volumeButton),this.replaceChildren(e),this._renderVolume(),this._adoptMedia()}get media(){return this._media}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get volume(){return this._volume}set volume(e){this._setVolume(e)}get sensitive(){return this._media!=null}_togglePlay(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}_onSeekInput(){this._seeking=!0,this._media&&(this._media.currentTime=Number.parseFloat(this._seekScale.value)),this._seeking=!1,this._updateTimestamp()}_onVolumeInput(){this._setVolume(Number.parseFloat(this._volumeScale.value))}_setVolume(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));this._volume=t,this._media&&(this._media.volume=t),this._renderVolume()}_renderVolume(){this._volumeScale&&(this._volumeScale.value=String(this._volume));let e=document.createElement(`gtk-image`);e.setAttribute(`icon-name`,volumeIconFor(this._volume)),this._volumeIcon?.replaceChildren(e)}_toggleVolumePopover(){this._volumePopover&&(this._volumePopover.hidden=!this._volumePopover.hidden)}_adoptMedia(){let e=this.getAttribute(`for`),t=e?this.ownerDocument.getElementById(e):null,n=(t instanceof HTMLVideoElement?t:null)??this.closest(`gtk-video`)?.querySelector(`video`)??null;if(n===this._media){this._render();return}if(this._media&&this._detachMedia(),this._media=n,n){this._mediaListeners=[[`timeupdate`,()=>this._updateTimestamp()],[`durationchange`,()=>this._updateDuration()],[`play`,()=>this._updatePlaying(!0)],[`pause`,()=>this._updatePlaying(!1)],[`seeked`,()=>this._updateTimestamp()]];for(let[e,t]of this._mediaListeners)n.addEventListener(e,t);this._setVolume(n.volume)}this._render()}_mediaListeners=[];_detachMedia(){if(this._media)for(let[e,t]of this._mediaListeners)this._media.removeEventListener(e,t);this._mediaListeners=[]}_updateTimestamp(){if(!this._initialized)return;let e=this.timestamp,t=this.duration;!this._seeking&&t>0&&(this._seekScale.value=String(e)),this._timeLabel.textContent=mediaTimeToString(e),this._durationLabel.textContent=mediaTimeToString(t>e?t-e:0,!0),this._durationLabel.hidden=t<=0}_updateDuration(){this._initialized&&(this._seekScale.max=String(this.duration>0?this.duration:10),this._updateTimestamp())}_updatePlaying(e){if(!this._initialized)return;let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,e?`media-playback-pause-symbolic`:`media-playback-start-symbolic`),this._playButton.replaceChildren(t),this._playButton.title=e?`Pause`:`Play`,this._playButton.setAttribute(`aria-label`,e?`Pause`:`Play`)}_render(){if(!this._initialized)return;let e=this._media??null,t=e!==null;this.classList.toggle(`insensitive`,!t),this._playButton.disabled=!t,this._seekScale.disabled=!t,this._volumeButton.disabled=!t,this._volumeScale.disabled=!t,this._updateDuration(),this._updateTimestamp(),this._updatePlaying(t&&!e.paused)}};customElements.define(`gtk-media-controls`,GtkMediaControls);const bn={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_model=[];_actions=null;_menuTitle=``;_initialized=!1;_menuView;static get observedAttributes(){return[`icon-name`,`menu-title`,`menu-model`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuModel(){return this._model}set menuModel(e){this._model=this._acceptMenu(e),this._initialized&&this._renderMenu()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,O),n;let r=menuRefusals(n,O);if(r.length===0)return n;console.error(`${O.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._initialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??this._menuTitle}set menuTitle(e){this._menuTitle=e??``,this.setAttribute(`menu-title`,this._menuTitle)}get direction(){let e=this.getAttribute(`direction`);return isSplitButtonDirection(e)?e:`down`}set direction(e){this.setAttribute(`direction`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-menu-button`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-menu-button-button`,this._buttonEl.setAttribute(`aria-haspopup`,`menu`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._popoverEl=document.createElement(`gtk-popover`),this._popoverEl.classList.add(`adw-menu-button-popover`),this._popoverEl.setAttribute(`role`,`menu`),this._popoverEl.setAttribute(`menu`,``),this._popoverEl.setAttribute(`align`,`end`),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._menuView=new PopoverMenuView(this._popoverEl,`adw-menu-button`,e=>{let t=menuItemAt(this._model,e);t!==null&&(this._popoverEl.popdown(),this._buttonEl.focus(),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._model.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._model.length===0&&(this._model=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1)}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e?this._menuView.focusableRows[0]?.focus():this._menuView.reset()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._buttonEl.disabled=e,e&&this._popoverEl.popdown(),this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`circular`,this.hasAttribute(`circular`)),this._popoverEl.position=bn[qe(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createGtkImage(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.getAttribute(`menu-title`)??this._menuTitle),this._menuView.render(),this._model.length===0&&this._popoverEl.popdown()}};customElements.define(`gtk-menu-button`,GtkMenuButton);const xn=[`top`,`bottom`,`left`,`right`],Sn=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends HTMLElement{_current=null;_initialized=!1;_initializedChildren=new WeakSet;_header;_tabs;_observer=null;_tabNodes=[];_menu=null;static get observedAttributes(){return[`page`,`tab-pos`,`show-tabs`,`show-border`,`scrollable`,`enable-popup`,`group-name`]}get page(){return this._current?this._pages().indexOf(this._current):-1}set page(e){this.setCurrentPage(e)}get tabPos(){let e=this.getAttribute(`tab-pos`);return e!==null&&xn.includes(e)?e:`top`}set tabPos(e){this._write(`tab-pos`,e)}get showTabs(){return this._flag(`show-tabs`,!0)}set showTabs(e){this._write(`show-tabs`,e?``:`false`)}get showBorder(){return this._flag(`show-border`,!0)}set showBorder(e){this._write(`show-border`,e?``:`false`)}get scrollable(){return this._flag(`scrollable`,!1)}set scrollable(e){this._write(`scrollable`,e?``:`false`)}get enablePopup(){return this._flag(`enable-popup`,!1)}set enablePopup(e){this._write(`enable-popup`,e?``:`false`)}get groupName(){return this.getAttribute(`group-name`)}set groupName(e){this._write(`group-name`,e)}get currentPage(){return this._current}get nPages(){return this._pages().length}getNthPage(e){let t=this._pages();return t[e<0?t.length-1:e]??null}pageNum(e){return this._pages().indexOf(e)}getPage(e){return this._pages().includes(e)?this._page(e):null}setPage(e){let t=this._pages().indexOf(e);return t===-1?!1:this.setCurrentPage(t)}nextPage(){return this._searchPage(1)}prevPage(){return this._searchPage(-1)}setCurrentPage(e){let t=this._pages(),n=t[e<0?t.length-1:e];return n?this._switchTo(n):!1}appendPage(e,t){return this.insertPage(e,-1,t)}insertPage(e,t,n){let r=t<0?this._pages().length:t;return n!=null&&e.setAttribute(`tab-label`,n),this._initChild(e),this.insertBefore(e,this._pages()[r]??null),this.dispatchEvent(new CustomEvent(`page-added`,{bubbles:!0,detail:{position:r,nPages:this._pages().length}})),this._current||this._switchTo(e),this._render(),r}removePage(e){let t=this._pages().indexOf(e);return t===-1?!1:(e===this._current&&(this._current=null),e.remove(),this.dispatchEvent(new CustomEvent(`page-removed`,{bubbles:!0,detail:{position:t,nPages:this._pages().length}})),this._current||this._takeOver(t),this._render(),!0)}refresh(){this._render()}connectedCallback(){if(this._initialized)this._observer=new MutationObserver(e=>this._onMutations(e));else{this._initialized=!0,this._header=document.createElement(`div`),this._header.className=`adw-notebook-header`,this._tabs=document.createElement(`div`),this._tabs.className=`adw-notebook-tabs`,this._tabs.setAttribute(`role`,`tablist`),this._header.appendChild(this._tabs);for(let e of this._pages())this._initChild(e)}this._header.parentNode!==this&&this.prepend(this._header),this._observer?.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Sn,`hidden`]}),this._current||this._switchTo(this._firstVisible()),this.addEventListener(`contextmenu`,this._onContextMenu),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this.removeEventListener(`contextmenu`,this._onContextMenu),this._closeMenu()}attributeChangedCallback(e){if(this._initialized){if(e===`page`){let t=this.getAttribute(e);t!==null&&this.setCurrentPage(Number.parseInt(t,10));return}this._render(),this._notify(e)}}_switchTo(e){let t=this._pages().indexOf(e);if(t===-1||!this._page(e).visible||this._current===e)return!1;let n=new CustomEvent(`switch-page`,{bubbles:!0,cancelable:!0,detail:{page:t,child:e}});return this.dispatchEvent(n),n.defaultPrevented?!1:(this._current=e,this._render(),this._notify(`page`),!0)}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){switch(e){case`page`:return this.page;case`tab-pos`:return this.tabPos;case`show-tabs`:return this.showTabs;case`show-border`:return this.showBorder;case`scrollable`:return this.scrollable;case`enable-popup`:return this.enablePopup;default:return this.groupName}}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_pages(){return Array.from(this.children).filter(e=>e!==this._header)}_page(e){return{tabLabel:e.getAttribute(`tab-label`),menuLabel:e.getAttribute(`menu-label`),tabFill:e.getAttribute(`tab-fill`)!==`false`,tabExpand:e.hasAttribute(`tab-expand`),reorderable:e.hasAttribute(`reorderable`),detachable:e.hasAttribute(`detachable`),visible:!e.hasAttribute(`hidden`),child:e}}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-notebook-page`))}_firstVisible(){return this._pages().find(e=>this._page(e).visible)??null}_searchPage(e){let t=this._pages(),n=this._current?t.indexOf(this._current):-1;for(let r=n+e;r>=0&&r<t.length;r+=e)if(this._switchTo(t[r]))return!0;return!1}_takeOver(e){let t=this._pages();for(let n of[...t.slice(e),...t.slice(0,e)])if(this._switchTo(n))return!0;return!1}_onMutations(e){let t=new Set(this._pages()),n=e.filter(e=>e.target===this||t.has(e.target));if(n.length===0)return;let r=0,i=0,a=[];for(let e of n){if(e.type===`childList`){for(let t of Array.from(e.removedNodes))t===this._current&&(this._current=null),i+=1;for(let t of Array.from(e.addedNodes))!(t instanceof HTMLElement)||t===this._header||(this._initChild(t),r+=1);continue}let t=e.attributeName;if(t===`hidden`){(!this._current||!this._page(this._current).visible)&&this._switchTo(this._firstVisible());continue}t&&Sn.includes(t)&&a.push(e.target)}(r>0||i>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{added:r,removed:i}}));for(let e of a)this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}}));this._render()}_effectiveTabPos(){let e=this.tabPos;return this.getAttribute(`dir`)===`rtl`?e===`left`?`right`:e===`right`?`left`:e:e}_render(){if(!this._initialized)return;let e=this._pages();e.length!==this._tabNodes.length&&(this._tabs.replaceChildren(),this._tabNodes=e.map(()=>this._buildTab()),this._tabs.append(...this._tabNodes));let t=this._current?e.indexOf(this._current):-1,n=0;e.forEach((e,r)=>{let i=this._tabNodes[r];if(!i)return;let a=this._page(e),o=r===t;a.visible&&(n+=1);let s=a.tabLabel??`Page ${n}`;i.textContent!==s&&(i.textContent=s),i.classList.toggle(`active`,o),i.classList.toggle(`expand`,a.tabExpand),i.classList.toggle(`fill`,a.tabFill),i.classList.toggle(`reorderable`,a.reorderable);let c=!a.visible;i.hidden!==c&&(i.hidden=c),i.setAttribute(`aria-selected`,String(o)),e.classList.toggle(`visible-page`,o),o?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)});let r=!this.showTabs;this._header.hidden!==r&&(this._header.hidden=r);let i=this._effectiveTabPos();this.getAttribute(`data-tab-pos`)!==i&&this.setAttribute(`data-tab-pos`,i),this.classList.toggle(`frame`,this.showBorder)}_buildTab(){let e=document.createElement(`button`);return e.type=`button`,e.className=`adw-notebook-tab`,e.setAttribute(`role`,`tab`),e.addEventListener(`click`,()=>{let t=this._tabNodes.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&this._switchTo(n)}),e}_onContextMenu=e=>{if(!this.enablePopup)return;e.preventDefault(),this._closeMenu();let t=document.createElement(`div`);t.className=`adw-notebook-menu`,t.setAttribute(`role`,`listbox`);let n=0;for(let e of this._pages()){let r=this._page(e);r.visible&&(n+=1);let i=document.createElement(`button`);i.type=`button`,i.className=`adw-notebook-menu-item`,i.setAttribute(`role`,`option`),i.textContent=r.menuLabel??r.tabLabel??`Page ${n}`,i.hidden=!r.visible,i.setAttribute(`aria-selected`,String(e===this._current)),i.addEventListener(`click`,()=>{this._switchTo(e),this._closeMenu()}),t.appendChild(i)}this.appendChild(t),this._menu=t};_closeMenu(){this._menu?.remove(),this._menu=null}};customElements.define(`gtk-notebook`,GtkNotebook);const Cn=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends HTMLElement{_childEl;_layerEl;_initialized=!1;_resize=null;_mutations=null;static get observedAttributes(){return[]}get child(){return this._childEl?.firstElementChild??null}get overlayLayer(){return this._layerEl}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-overlay-child`,this._layerEl=document.createElement(`div`),this._layerEl.className=`adw-overlay-layer`,bindSlottedChildren(this,[{into:this._childEl},{name:`overlay`,into:this._layerEl}]).install(this._childEl,this._layerEl),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._syncEdgeClasses()),this._resize.observe(this._layerEl),this._mutations=new MutationObserver(()=>this._syncEdgeClasses()),this._mutations.observe(this._layerEl,{childList:!0,attributes:!0,subtree:!0}),this._syncEdgeClasses())}_syncEdgeClasses(){let e=this.matches(`:dir(rtl)`);for(let t of this._layerEl.children){let n=t.getAttribute(`halign`),r=t.getAttribute(`valign`),i={left:e?n===`end`:n===`start`,right:e?n===`start`:n===`end`,top:r===`start`,bottom:r===`end`};for(let e of Cn)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const K=25.4,q=[{name:`na_letter`,displayName:`US Letter`,width:8.5*K,height:11*K},{name:`na_legal`,displayName:`US Legal`,width:8.5*K,height:14*K},{name:`iso_a4`,displayName:`A4`,width:210,height:297},{name:`iso_a5`,displayName:`A5`,width:148,height:210},{name:`roc_16k`,displayName:`ROC 16k`,width:7.75*K,height:10.75*K},{name:`iso_b5`,displayName:`B5`,width:176,height:250},{name:`jis_b5`,displayName:`JB5`,width:182,height:257},{name:`na_number-10`,displayName:`#10 Envelope`,width:4.125*K,height:9.5*K},{name:`iso_dl`,displayName:`DL Envelope`,width:110,height:220},{name:`jpn_chou3`,displayName:`Choukei 3 Envelope`,width:120,height:235},{name:`na_ledger`,displayName:`Tabloid`,width:11*K,height:17*K},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],wn=new Set([`na_letter`,`na_legal`,`iso_a4`]);function doubleToString(e,t){let n=t===`inch`?e.toFixed(2):e.toFixed(1);return n.includes(`.`)&&(n=n.replace(/0+$/,``),n.endsWith(`.`)&&(n=n.slice(0,-1))),n}function defaultMargins(e){return{top:.25*K,bottom:(wn.has(e.name)?.56:.25)*K,left:.25*K,right:.25*K}}function defaultPageSetup(){let e=q.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return q.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??q[2]}function pageSetupEquals(e,t){return e.paperSize===t.paperSize&&e.margins.top===t.margins.top&&e.margins.bottom===t.margins.bottom&&e.margins.left===t.margins.left&&e.margins.right===t.margins.right}function orientedSize(e,t=`mm`){let n=paperSizeOf(e),r=e.orientation===`landscape`||e.orientation===`reverse-landscape`,i=r?n.height:n.width,a=r?n.width:n.height;return t===`mm`?{width:i,height:a}:{width:i/K,height:a/K}}function unitLabel(e){return e===`mm`?`mm`:`inch`}function paperSizeLabel(e,t=`mm`){let{width:n,height:r}=orientedSize(e,t);return`${doubleToString(n,t)} × ${doubleToString(r,t)} ${unitLabel(t)}`}function paperMarginsTooltip(e,t=`mm`){let inUnit=e=>t===`mm`?e:e/K,shown=e=>`${doubleToString(inUnit(e),t)} ${unitLabel(t)}`,{margins:n}=e;return[`Margins:`,` Left: ${shown(n.left)}`,` Right: ${shown(n.right)}`,` Top: ${shown(n.top)}`,` Bottom: ${shown(n.bottom)}`].join(`
7
+ `)}const Tn={name:`Any Printer`,location:`For portable documents`},En=[[`portrait`,`Portrait`],[`reverse-portrait`,`Reverse portrait`],[`landscape`,`Landscape`],[`reverse-landscape`,`Reverse landscape`]];var GtkPageSetupUnixDialog=class extends AdwDialog{_built=!1;static get observedAttributes(){return[...AdwDialog.observedAttributes]}_printerEl;_paperEl;_sizeLabelEl;_radios=new Map;_printers=[];_setups=[];_lastSetup=null;_printSettings=null;_unit=`mm`;get unit(){return this._unit}set unit(e){this._unit=e,this._built&&this._renderSetup()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._built&&this._renderSetup()}get pageSetup(){return{...this._current(),orientation:this._orientation()}}set pageSetup(e){let t=this._setups.findIndex(t=>pageSetupEquals(t,e));t<0?(this._setups.push(e),this._paperEl.selected=this._setups.length-1):this._paperEl.selected!==t&&(this._paperEl.selected=t),this._setOrientation(e.orientation),this._built&&this._renderSetup()}get printSettings(){return this._printSettings}set printSettings(e){this._printSettings=e;let t=e?.[`format-for-printer`];if(t===void 0)return;let n=this._printerRows().findIndex(e=>e.name===t);n>=0&&(this._printerEl.selected=n)}connectedCallback(){if(this._built){super.connectedCallback();return}super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Page Setup`),this._fillPaperSizes();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderSetup();let t=this._setups.findIndex(e=>e.paperSize===defaultPageSetup().paperSize);t>=0&&this._paperEl.selected!==t&&(this._paperEl.selected=t,this._renderSetup()),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&this._renderSetup()}_build(){let e=document.createElement(`div`);e.className=`adw-page-setup-grid`,this._printerEl=this._dropDown(`printer`,`_Format for:`),this._printerEl.addEventListener(`notify::selected`,()=>this._printerChanged()),e.append(this._label(`_Format for:`),this._printerEl),this._paperEl=this._dropDown(`paper`,`_Paper size:`),this._paperEl.addEventListener(`notify::selected`,()=>this._paperChanged()),e.append(this._label(`_Paper size:`),this._paperEl),this._sizeLabelEl=document.createElement(`div`),this._sizeLabelEl.className=`adw-page-setup-size-label`,this._sizeLabelEl.setAttribute(`aria-live`,`polite`),e.append(this._sizeLabelEl),e.append(this._label(`_Orientation:`));for(let[t,n]of En){let r=document.createElement(`adw-radio`);r.className=`adw-page-setup-orientation`,r.setAttribute(`label`,n),r.setAttribute(`name`,`adw-page-setup-orientation`),r.setAttribute(`value`,t),r.addEventListener(`notify::checked`,()=>this._orientationChanged()),this._radios.set(t,r),e.appendChild(r)}return e.appendChild(this._actions()),e}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-page-setup-${e}`,n.setAttribute(`aria-label`,t.replace(`_`,``)),n}_label(e){let t=document.createElement(`div`);return t.className=`adw-page-setup-label`,t.textContent=e.replace(`_`,``),t}_actions(){let e=document.createElement(`div`);e.className=`adw-page-setup-actions`;let t=document.createElement(`button`);t.type=`button`,t.className=`adw-page-setup-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6));let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-page-setup-apply suggested-action`,n.textContent=`Apply`,n.addEventListener(`click`,()=>this._respond(-5)),e.append(t,n),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),this.close()}_printerRows(){return[Tn,...this._printers]}_fillPaperSizes(){this._setups=q.map(e=>({paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}))}_current(){return this._setups[this._paperEl.selected]??defaultPageSetup()}_orientation(){for(let[e,t]of this._radios)if(t.checked)return e;return`portrait`}_setOrientation(e){let t=this._radios.get(e);t!==void 0&&(t.checked=!0)}_renderSetup(){let e=this._printerRows();this._printerEl.setAttribute(`model`,JSON.stringify(e.map(e=>e.name))),this._printerEl.selected>=e.length&&(this._printerEl.selected=0);let t=[...this._setups.map(e=>paperSizeOf(e).displayName),`Manage Custom Sizes…`];this._paperEl.setAttribute(`model`,JSON.stringify(t)),this._paperEl.selected>=t.length&&(this._paperEl.selected=0);let n=this._current();this._sizeLabelEl.textContent=paperSizeLabel(n,this._unit),this._sizeLabelEl.title=paperMarginsTooltip(n,this._unit)}_printerChanged(){let e=this._printerRows()[this._printerEl.selected];(e===void 0||e.name===Tn.name)&&this._fillPaperSizes(),this._renderSetup(),this._printSettings!==null&&(this._printSettings={"format-for-printer":e?.name})}_paperChanged(){let e=this._paperEl.selected;if(e>=this._setups.length){let e=this._lastSetup??defaultPageSetup();this._setups.push(e),this._paperEl.selected=this._setups.length-1,this._renderSetup();return}this._lastSetup=this._setups[e]??null,this._renderSetup()}_orientationChanged(){this._built&&(this._setups[this._paperEl.selected]={...this._current(),orientation:this._orientation()},this._renderSetup())}};customElements.define(`gtk-page-setup-unix-dialog`,GtkPageSetupUnixDialog);function computePanedPosition(e){let{allocation:t,startRequest:n,endRequest:r,resizeStart:i,resizeEnd:a,shrinkStart:o,shrinkEnd:s}=e,c=o?0:n,l=t;s||(l=Math.max(1,l-r)),l=Math.max(c,l);let u;return u=e.positionSet?e.lastAllocation>0?i&&!a?e.startChildSize+t-e.lastAllocation:!i&&a?e.startChildSize:t*(e.startChildSize/e.lastAllocation)+.5:e.startChildSize:i&&!a?Math.max(0,t-r):!i&&a?n:n+r===0?t*.5+.5:t*(n/(n+r))+.5,u=Math.trunc(u),{min:c,max:l,position:glibClamp(u,c,l)}}var GtkPaned=class extends HTMLElement{_startEl;_handleEl;_endEl;_initialized=!1;_position=-1;_positionSet=!1;_minPosition=0;_maxPosition=2**53-1;_lastAllocation=0;_dragPos=0;_dragging=!1;_resize=null;static get observedAttributes(){return[`orientation`,`position`,`position-set`,`resize-start-child`,`resize-end-child`,`shrink-start-child`,`shrink-end-child`,`wide-handle`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get position(){return this._position}set position(e){this.setPosition(e)}get positionSet(){return this._positionSet}get minPosition(){return this._minPosition}get maxPosition(){return this._maxPosition}get wideHandle(){return this.hasAttribute(`wide-handle`)}set wideHandle(e){this.toggleAttribute(`wide-handle`,!!e)}get startChild(){return this._startEl?.firstElementChild??null}get endChild(){return this._endEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-paned-child`,this._handleEl=document.createElement(`div`),this._handleEl.className=`adw-paned-handle separator`,this._handleEl.setAttribute(`role`,`separator`),this._handleEl.tabIndex=0,this._endEl=document.createElement(`div`),this._endEl.className=`adw-paned-child`,bindSlottedChildren(this,[{into:this._startEl},{name:`start`,into:this._startEl},{name:`end`,into:this._endEl}],()=>this._observe()).install(this._startEl,this._handleEl,this._endEl),this._handleEl.addEventListener(`pointerdown`,this._onPointerDown),this._handleEl.addEventListener(`keydown`,this._onKeyDown);let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e),this._observe(),this._layout()}disconnectedCallback(){this._dragging=!1,this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e){if(this._initialized){if(e===`position`){let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e);return}e!==`position-set`&&(this._layout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}}_property(e){switch(e){case`orientation`:return this.orientation;case`resize-start-child`:return this.getAttribute(`resize-start-child`)!==`false`;case`resize-end-child`:return this.getAttribute(`resize-end-child`)!==`false`;case`shrink-start-child`:return this.getAttribute(`shrink-start-child`)!==`false`;case`shrink-end-child`:return this.getAttribute(`shrink-end-child`)!==`false`;case`wide-handle`:return this.wideHandle;default:return this.getAttribute(e)}}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._layout()),this._resize.observe(this));for(let e of[this._startEl,this._endEl]){let t=e.firstElementChild;t&&this._resize.observe(t)}}setPosition(e){if(Number.isFinite(e)){if(e<0){this._positionSet&&(this._positionSet=!1,this._notify(`position-set`,{positionSet:!1})),this._position=-1,this._layout();return}this._positionSet||(this._positionSet=!0,this._notify(`position-set`,{positionSet:!0})),this._position!==e&&(this._position=e,this._notify(`position`,{position:e}),this._layout())}}_layout(){if(!this._startEl)return;let e=this.orientation===`horizontal`,t=this._handleEl.getBoundingClientRect(),n=e?t.width:t.height,r=Math.max(1,(e?this.clientWidth:this.clientHeight)-n),i=computePanedPosition({allocation:r,startRequest:this._sizeRequest(this._startEl,e),endRequest:this._sizeRequest(this._endEl,e),resizeStart:this.getAttribute(`resize-start-child`)!==`false`,resizeEnd:this.getAttribute(`resize-end-child`)!==`false`,shrinkStart:this.getAttribute(`shrink-start-child`)!==`false`,shrinkEnd:this.getAttribute(`shrink-end-child`)!==`false`,positionSet:this._positionSet,startChildSize:this._position<0?0:this._position,lastAllocation:this._lastAllocation}),a=Math.floor(i.position);a!==this._position&&(this._position=a,this._notify(`position`,{position:a})),i.min!==this._minPosition&&(this._minPosition=i.min,this._notify(`min-position`,{minPosition:i.min})),i.max!==this._maxPosition&&(this._maxPosition=i.max,this._notify(`max-position`,{maxPosition:i.max})),this._lastAllocation=r,this._startEl.style.flexBasis=`${Math.max(1,a)}px`,this._startEl.style.flexGrow=`0`,this._endEl.style.flexGrow=this.getAttribute(`resize-end-child`)===`false`?`0`:`1`,this._applyMinimum(this._startEl,`shrink-start-child`,e),this._applyMinimum(this._endEl,`shrink-end-child`,e);let o=a!==0,s=a!==r;this._startEl.hidden=!o,this._endEl.hidden=!s,this._handleEl.hidden=!o||!s,this.classList.toggle(`horizontal`,e),this.classList.toggle(`vertical`,!e),this._handleEl.classList.toggle(`wide`,this.wideHandle),this._handleEl.setAttribute(`aria-orientation`,this.orientation),this._handleEl.setAttribute(`aria-valuemin`,`0`),this._handleEl.setAttribute(`aria-valuemax`,String(e?this.clientWidth:this.clientHeight)),this._handleEl.setAttribute(`aria-valuenow`,String(a))}_sizeRequest(e,t){let n=e.style.flexGrow,r=e.style.flexShrink,i=e.style.flexBasis;e.style.flex=`none`;let a=t?e.offsetWidth:e.offsetHeight;return e.style.flexGrow=n,e.style.flexShrink=r,e.style.flexBasis=i,a}_applyMinimum(e,t,n){let r=this.getAttribute(t)!==`false`;e.style.minWidth=n&&r?`0`:``,e.style.minHeight=n?``:r?`0`:``}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}get _isRtl(){return this.orientation===`horizontal`&&this.matches(`:dir(rtl)`)}_onPointerDown=e=>{if(e.button!==0||this._handleEl.hidden)return;this._dragging=!0,this._handleEl.setPointerCapture(e.pointerId);let t=this.orientation===`horizontal`,n=this._handleEl.getBoundingClientRect(),r=t?e.clientX:e.clientY,i=t?n.left:n.top;this._dragPos=r-i-(this.wideHandle?0:6),this._handleEl.addEventListener(`pointermove`,this._onPointerMove),this._handleEl.addEventListener(`pointerup`,this._onPointerUp),this._handleEl.addEventListener(`pointercancel`,this._onPointerUp)};_onPointerMove=e=>{if(!this._dragging)return;let t=this.orientation===`horizontal`,n=(t?e.clientX:e.clientY)-this._dragPos,r=t?this._handleEl.offsetWidth:this._handleEl.offsetHeight,i=this._isRtl?(t?this.clientWidth:this.clientHeight)-n-r:n;this.setPosition(glibClamp(Math.round(i),this._minPosition,this._maxPosition))};_onPointerUp=e=>{this._dragging&&(this._dragging=!1,this._handleEl.hasPointerCapture(e.pointerId)&&this._handleEl.releasePointerCapture(e.pointerId),this._handleEl.removeEventListener(`pointermove`,this._onPointerMove),this._handleEl.removeEventListener(`pointerup`,this._onPointerUp),this._handleEl.removeEventListener(`pointercancel`,this._onPointerUp))};_onKeyDown=e=>{if(e.altKey||e.metaKey||e.shiftKey)return;if(e.key===`Escape`){this.dispatchEvent(new CustomEvent(`cancel-position`,{bubbles:!0,detail:{}}));return}if(e.key===`Enter`||e.key===` `){this.dispatchEvent(new CustomEvent(`accept-position`,{bubbles:!0,detail:{}}));return}let t=0,n=null;switch(e.key){case`ArrowLeft`:t=e.ctrlKey?-75:-1;break;case`ArrowRight`:t=e.ctrlKey?75:1;break;case`ArrowUp`:t=e.ctrlKey?-75:-1;break;case`ArrowDown`:t=e.ctrlKey?75:1;break;case`PageUp`:t=-75;break;case`PageDown`:t=75;break;case`Home`:n=`start`;break;case`End`:n=`end`;break;default:return}e.preventDefault();let r;n===`start`?r=this._minPosition:n===`end`?r=this._maxPosition:(this._isRtl&&(t=-t),r=this._position+t),this.setPosition(glibClamp(r,this._minPosition,this._maxPosition))}};customElements.define(`gtk-paned`,GtkPaned);var GtkPasswordEntry=class extends GtkEntry{_entry=new EntryRowState;_password=new PasswordEntryRowState(this._entry);_toggle;_peekIcon;_capsLock;static get observedAttributes(){return[...GtkEntry.observedAttributes,`show-peek-icon`]}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}connectedCallback(){super.connectedCallback(),this._input.type=`password`,this._input.autocomplete=`new-password`,this._capsLock=document.createElement(`span`),this._capsLock.className=`adw-password-entry-caps-lock`,this._capsLock.textContent=`⇪`,this._capsLock.setAttribute(`role`,`alert`),this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only adw-password-entry-peek`,this._peekIcon=createGtkImage(null,`adw-password-entry-peek-icon`),this._toggle.append(this._peekIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this._toggle.addEventListener(`mousedown`,e=>e.preventDefault());let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock),this._input.addEventListener(`focus`,()=>{this._entry.setEditing(!0),this._passwordChanged()}),this._input.addEventListener(`blur`,()=>{this._entry.setEditing(!1),this._passwordChanged()}),this.replaceChildren(this._capsLock,this._input,this._toggle),this._toggle.hidden=!this.hasAttribute(`show-peek-icon`),this._applyPassword(this._password.state),this._password.subscribe(e=>{this._applyPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`show-peek-icon`&&this._toggle&&(this._toggle.hidden=n===null)}_passwordChanged(){this._applyPassword(this._password.state)}_applyPassword(e){this._input.type=e.revealed?`text`:`password`,this._peekIcon.dataset.iconName=e.peekIconName,this._peekIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`),this._capsLock.dataset.iconName=e.indicatorIconName,this._capsLock.title=e.indicatorTooltip,this._capsLock.setAttribute(`aria-label`,e.indicatorTooltip),this._capsLock.hidden=!this._entry.state.indicatorVisible}};customElements.define(`gtk-password-entry`,GtkPasswordEntry);const Dn=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return Dn.includes(e)?e:`contain`}var GtkPicture=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`alternative-text`,`can-shrink`,`content-fit`,`isolate-contents`,`keep-aspect-ratio`]}get alternativeText(){return this.getAttribute(`alternative-text`)??``}set alternativeText(e){this._write(`alternative-text`,e)}get canShrink(){return!this.hasAttribute(`can-shrink`)||this.getAttribute(`can-shrink`)!==`false`}set canShrink(e){this._toggle(`can-shrink`,e,!0)}get contentFit(){return normalizePictureContentFit(this.getAttribute(`content-fit`))}set contentFit(e){this._write(`content-fit`,e)}get isolateContents(){return!this.hasAttribute(`isolate-contents`)||this.getAttribute(`isolate-contents`)!==`false`}set isolateContents(e){this._toggle(`isolate-contents`,e,!0)}get keepAspectRatio(){return this.contentFit!==`fill`}set keepAspectRatio(e){this.contentFit=e?`contain`:`fill`}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}_toggle(e,t,n){let r=t?``:`false`;if(n){t?this.removeAttribute(e):this._write(e,r);return}this._write(e,r)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`img`),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),e===`content-fit`&&(t===`fill`||n===`fill`)&&this.dispatchEvent(new CustomEvent(`notify::keep-aspect-ratio`,{bubbles:!0,detail:{"keep-aspect-ratio":this.keepAspectRatio}})),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`alternative-text`:return this.alternativeText;case`can-shrink`:return this.canShrink;case`isolate-contents`:return this.isolateContents;case`keep-aspect-ratio`:return this.keepAspectRatio;default:return this.contentFit}}_render(){this.style.setProperty(`--gtk-picture-content-fit`,this.contentFit),this.classList.toggle(`can-shrink`,this.canShrink),this.classList.toggle(`isolated`,this.isolateContents),this.alternativeText?this.setAttribute(`aria-label`,this.alternativeText):this.removeAttribute(`aria-label`)}};customElements.define(`gtk-picture`,GtkPicture);const J=`main`;var GtkPopoverMenu=class extends GtkPopover{_model=[];_actions=null;_menuView;_menuInitialized=!1;static get observedAttributes(){return[...GtkPopover.observedAttributes,`menu-model`,`menu-title`,`visible-submenu`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,O),this._menuInitialized&&this._renderMenu()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._menuInitialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??``}set menuTitle(e){this.setAttribute(`menu-title`,e??``)}get visibleSubmenu(){let e=this._openPageLabel();return e===null?J:e}set visibleSubmenu(e){this.openSubmenu(e)}connectedCallback(){super.connectedCallback(),!this._menuInitialized&&(this._menuInitialized=!0,this.classList.add(`adw-popover-menu`),this.setAttribute(`role`,`menu`),this.setAttribute(`menu`,``),this._menuView=new PopoverMenuView(this,`adw-popover-menu`,e=>this._activate(e)),this._menuView.setActions(this._actions),this._model.length===0&&(this._model=this._parseMenuAttr()),this._renderMenu(),this.subscribe(e=>{e?this._menuView.focusableRows[0]?.focus():this._menuView.reset()}))}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),this._menuInitialized){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}if(e===`menu-title`){this._menuView.setTitle(this.menuTitle),this._menuView.render();return}e===`visible-submenu`&&this._navigate(n??J)}}openSubmenu(e){this._navigate(e)}_navigate(e){let t=this.visibleSubmenu;if(!this._showPage(e))return;let n=this.visibleSubmenu;this._reflectSubmenu(),n!==t&&this.dispatchEvent(new CustomEvent(`notify::visible-submenu`,{bubbles:!0,detail:{visibleSubmenu:n}}))}_showPage(e){if(e===J||e.length===0)this._menuView.reset();else{let t=this._findSubmenu(e);if(t===null)return!1;this._menuView.setMenuModel(this._model),this._menuView.showPage(t)}return this._menuView.render(),!0}closeSubmenus(){this.openSubmenu(J)}_openPageLabel(){let e=this._menuView.page;if(e.length===0)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind!==`item`?t.label:null}_findSubmenu(e){let walk=(t,n)=>{for(let[r,i]of t.entries()){if(i.kind===`item`)continue;let t=[...n,r];if(i.label===e)return t;let a=walk(i.items,t);if(a!==null)return a}return null};return walk(this._model,[])}_reflectSubmenu(){let e=this.visibleSubmenu;this.getAttribute(`visible-submenu`)!==e&&this.setAttribute(`visible-submenu`,e)}_activate(e){let t=menuItemAt(this._model,e);this.popdown(),this.anchor?.focus(),t!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}}))}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.menuTitle),this._menuView.render(),this._model.length===0&&this.popdown()}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,O);if(t.length===0)return e;console.error(`${O.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-menu`,GtkPopoverMenu);var GtkPopoverBin=class extends HTMLElement{_model=[];_popover=null;_actions=null;_initialized=!1;_longPressTimer=null;static get observedAttributes(){return[`menu-model`,`handle-input`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,O),this._adoptPopover(this._buildPopover()),this._notifyModel()}get popoverElement(){return this._popover}set popoverElement(e){this._model=[],this._adoptPopover(e),this._notifyModel()}get handleInput(){return this.hasAttribute(`handle-input`)}set handleInput(e){this.toggleAttribute(`handle-input`,!!e)}get actions(){return this._actions}set actions(e){this._actions=e??null,this._popover!==null&&(this._popover.actions=this._actions)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-bin`),this.addEventListener(`contextmenu`,e=>this._onContextMenu(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._wireGestures(),this._model.length===0&&(this._model=this._parseMenuAttr()),this._model.length>0&&this._adoptPopover(this._buildPopover()))}disconnectedCallback(){this._cancelLongPress()}attributeChangedCallback(e){if(this._initialized){if(e===`handle-input`){this.handleInput||this._cancelLongPress();return}e===`menu-model`&&(this._model=this._parseMenuAttr(),this._adoptPopover(this._model.length>0?this._buildPopover():null),this._notifyModel())}}popup(){this.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._popover;e!==null&&(e.open=!0)}popdown(){this._popover?.popdown()}get childElement(){let e=this.firstElementChild;return e===null||e===this._popover?null:e}_wireGestures(){this.addEventListener(`pointerdown`,e=>{!this.handleInput||this._popover===null||(this._cancelLongPress(),e.pointerType===`touch`&&(this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._popupAt(e)},500)))}),this.addEventListener(`pointerup`,()=>this._cancelLongPress()),this.addEventListener(`pointercancel`,()=>this._cancelLongPress())}_cancelLongPress(){this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null)}_onContextMenu(e){!this.handleInput||this._popover===null||(e.preventDefault(),this._popupAt(e))}_popupAt(e){let t=this._popover;t!==null&&(t.open=!0)}_onKeyDown(e){e.key!==`ContextMenu`&&e.key!==`F10`||e.shiftKey||this._popover!==null&&(e.preventDefault(),this.popup())}_buildPopover(){if(this._model.length===0)return null;let e=document.createElement(`gtk-popover-menu`);return e.setAttribute(`position`,`bottom`),e.setAttribute(`align`,`start`),e.menuModel=this._model,e.actions=this._actions,e.anchor=this,e}_adoptPopover(e){let t=this._popover;t!==null&&t!==e&&(t.popdown(),t.remove()),this._popover=e;let n=this.childElement;if(e===null){n?.classList.remove(`has-open-popup`);return}e.subscribe(e=>{n?.classList.toggle(`has-open-popup`,e)}),this.appendChild(e)}_notifyModel(){this.dispatchEvent(new CustomEvent(`notify::menu-model`,{bubbles:!0,detail:{menuModel:this._model,popover:this._popover}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,O);if(t.length===0)return e;console.error(`${O.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-bin`,GtkPopoverBin);var GtkPopoverMenuBar=class extends HTMLElement{_model=[];_actions=null;_items=[];_active=null;_initialized=!1;static get observedAttributes(){return[`menu-model`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,O),this._initialized&&this._rebuild()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._initialized&&this._rebuild()}get activeItem(){return this._active?.button??null}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-menu-bar`),this.setAttribute(`role`,`menubar`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointerleave`,()=>{this._active!==null&&!this._active.popover.open&&this._setActive(null,!1)}),this._model.length===0&&(this._model=this._parseMenuAttr()),this._rebuild())}attributeChangedCallback(e){!this._initialized||e!==`menu-model`||(this._model=this._parseMenuAttr(),this._rebuild())}selectFirst(){this._setActive(this._items[0]??null,!0)}popup(){this.selectFirst()}_setActive(e,t){let n=e!==this._active,r=this._active!==null&&this._active.popover.open;r&&n&&this._active?.popover.popdown(),n&&(this._active?.button.classList.remove(`selected`),this._active=e,e?.button.classList.add(`selected`)),this._active!==null&&(t||r&&n?this._active.popover.open=!0:n&&this.matches(`:focus-within`)&&this._active.button.focus())}_onKeyDown(e){this._active?.popover.open!==!0&&(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),this._move(e.key===`ArrowRight`?1:-1)))}_move(e){let t=this._items.length;if(t===0)return;let n=(this._active===null?-1:this._items.indexOf(this._active))+e;n<0&&(n=t-1),n>=t&&(n=0),this._setActive(this._items[n],!1)}_rebuild(){this._items=[],this._active=null;let e=[];this._model.forEach((t,n)=>{t.kind===`submenu`&&e.push(this._buildItem(t,[n]))}),this._items=e,this.replaceChildren(...e.map(e=>e.root))}_focusFirstRow(e){e.querySelector(`.adw-popover-item:not([hidden]):not([disabled])`)?.focus()}_buildItem(e,t){let n=document.createElement(`div`);n.className=`adw-popover-menu-bar-item`,n.setAttribute(`role`,`none`);let r=document.createElement(`button`);r.type=`button`,r.className=`adw-popover-menu-bar-button`,r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),r.setAttribute(`aria-expanded`,`false`);let i=document.createElement(`span`);i.className=`adw-popover-menu-bar-label`,i.textContent=e.label,r.appendChild(i);let a=document.createElement(`gtk-popover-menu`);a.setAttribute(`position`,`bottom`),a.setAttribute(`align`,`start`),a.menuModel=e.items,a.actions=this._actions,a.anchor=r,r.setAttribute(`aria-controls`,`popover`);let o={node:e,path:t,root:n,button:r,popover:a};return a.subscribe(e=>{if(r.setAttribute(`aria-expanded`,String(e)),e){for(let e of this._items)e.root.classList.toggle(`active`,e===o);this._focusFirstRow(a)}else o.root.classList.remove(`active`),this._active===o&&(this._active=null)}),a.addEventListener(`menu-item-activated`,e=>{e.stopPropagation();let n=e.detail;this._activate(o,[...t,...n.path])}),r.addEventListener(`click`,()=>this._setActive(o,!0)),n.addEventListener(`pointerenter`,()=>this._setActive(o,!1)),n.append(r,a),o}_activate(e,t){let n=menuItemAt(this._model,t);e.popover.popdown(),e.button.focus(),n!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t]}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,O);if(t.length>0){console.error(`${O.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}for(let[t,n]of e.entries())n.kind!==`submenu`&&console.warn(`Don't know how to handle this item: top-level entry ${t} is a ${n.kind}.`);return e}};customElements.define(`gtk-popover-menu-bar`,GtkPopoverMenuBar);const On=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],kn=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],An=[`All sheets`,`Even sheets`,`Odd sheets`],jn=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],Mn={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...Mn};_pageSetup=defaultPageSetup();_printerListEl;_switcherEl;_panelEl;_tabPages=new Map;_tab=`General`;_currentPage=-1;_supportSelection=!1;_hasSelection=!1;_manual=new Set;_range=`all`;_printAt=`now`;_printButton;_previewButton;_conflictsEl;_capabilityControls=new Map;_collateCheck;_reverseCheck;_copiesInput;_paperDrop;_orientationDrop;_pageRangeInput;_selectionRadio;_currentPageRadio;_rangeRadios=new Map;_atInput=null;static get observedAttributes(){return[...AdwDialog.observedAttributes,`current-page`,`embed-page-setup`,`has-selection`,`manual-capabilities`,`support-selection`]}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this._built&&this._renderPrint()}get embedPageSetup(){return this.hasAttribute(`embed-page-setup`)}set embedPageSetup(e){this.toggleAttribute(`embed-page-setup`,e),this._built&&this._renderPrint()}get hasSelection(){return this._hasSelection}set hasSelection(e){this._hasSelection=e,this._built&&this._renderPrint()}get supportSelection(){return this.hasAttribute(`support-selection`)}set supportSelection(e){this.toggleAttribute(`support-selection`,e),this._built&&this._renderPrint()}get manualCapabilities(){return[...this._manual]}set manualCapabilities(e){this._manual=new Set(e.filter(e=>On.includes(e))),this._built&&this._renderPrint()}get selectedPrinter(){return this._selected===null?null:{...this._selected}}get pageSetup(){return{...this._pageSetup}}set pageSetup(e){this._pageSetup=e,this._built&&this._renderPrint()}get printSettings(){return{...this._settings}}set printSettings(e){this._settings={...Mn,...e},this._built&&this._renderPrint()}get range(){return this._range}set range(e){if(this._range=e,!this._built)return;let t=this._rangeRadios.get(e);t!==void 0&&(t.checked=!0),this._renderPrint()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._selected=null,this._built&&this._renderPrint()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-print-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Print`),this._readManual();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderPrint(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&(e===`manual-capabilities`&&this._readManual(),this._renderPrint())}_readManual(){this._manual=new Set((this.getAttribute(`manual-capabilities`)??``).split(`|`).map(e=>e.trim()).filter(e=>On.includes(e)))}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl)}_build(){let e=document.createElement(`div`);return e.className=`adw-print-root`,this._panelEl=document.createElement(`div`),this._panelEl.className=`adw-print-panel`,this._panelEl.setAttribute(`role`,`tabpanel`),e.append(this._panelEl,this._buildConflicts(),this._buildActions()),this._renderPanel(),e}_renderPanel(){for(let e of kn){let t=this._tabPages.get(e);t===void 0&&(t=document.createElement(`div`),t.className=`adw-print-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.tab=e,t.appendChild(this._buildTab(e)),this._tabPages.set(e,t),this._panelEl.appendChild(t)),t.hidden=e!==this._tab}}_buildTab(e){switch(e){case`General`:return this._buildGeneral();case`Page Setup`:return this._buildPageSetup();case`Job`:return this._buildJob();case`Image Quality`:case`Color`:case`Finishing`:return this._buildOptionsPage(e);case`Advanced`:return this._buildOptionsPage(e)}}_buildGeneral(){let e=document.createElement(`div`);e.className=`adw-print-columns`,this._printerListEl=document.createElement(`div`),this._printerListEl.className=`adw-print-printer-list`,this._printerListEl.setAttribute(`role`,`radiogroup`),this._printerListEl.setAttribute(`aria-label`,`Printer`),e.appendChild(this._frame(this._printerListEl));let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Range`),r=n.body;for(let[e,t]of[[`all`,`All Pages`],[`current`,`Current Page`],[`selection`,`Selection`]]){let n=this._radio(t,`adw-print-range-${e}`);n.addEventListener(`notify::checked`,()=>{n.checked&&(this._range=e,(e===`current`||e===`selection`)&&this._renderPrint())}),e===`current`&&(this._currentPageRadio=n),e===`selection`&&(this._selectionRadio=n),this._rangeRadios.set(e,n),r.appendChild(n)}let i=this._radio(`Pages:`,`adw-print-range-pages`);i.addEventListener(`notify::checked`,()=>{i.checked&&(this._range=`pages`,this._pageRangeInput.focus())}),this._pageRangeInput=document.createElement(`input`),this._pageRangeInput.type=`text`,this._pageRangeInput.className=`adw-print-page-range-entry`,this._pageRangeInput.title=`Specify one or more page ranges, e.g. 1–3, 7, 11`,this._pageRangeInput.setAttribute(`aria-label`,`Pages`),this._pageRangeInput.addEventListener(`focus`,()=>{this._range=`pages`,i.checked=!0}),this._rangeRadios.set(`pages`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`,a.append(i,this._pageRangeInput),r.appendChild(a),t.appendChild(n.group);let o=this._group(`Copies`),s=o.body,c=document.createElement(`div`);c.className=`adw-print-grid-row`;let l=document.createElement(`div`);l.className=`adw-print-label`,l.textContent=`Copies:`,this._copiesInput=document.createElement(`input`),this._copiesInput.type=`number`,this._copiesInput.min=`1`,this._copiesInput.className=`adw-print-copies`,this._copiesInput.value=this._settings.copies??`1`,this._copiesInput.setAttribute(`aria-label`,`Copies`),this._copiesInput.addEventListener(`input`,()=>{this._settings={...this._settings,copies:this._copiesInput.value},this._renderPrint()}),c.append(l,this._copiesInput),s.appendChild(c),this._collateCheck=this._check(`Collate`,`adw-print-collate`),this._reverseCheck=this._check(`Reverse`,`adw-print-reverse`);for(let e of[this._collateCheck,this._reverseCheck])e.addEventListener(`notify::checked`,()=>this._renderPrint());s.append(this._collateCheck,this._reverseCheck);let u=this._buildCollatePreview(),d=document.createElement(`div`);return d.className=`adw-print-grid-row`,d.appendChild(u),s.appendChild(d),t.appendChild(o.group),e.appendChild(t),e}_buildCollatePreview(){let e=document.createElement(`div`);return e.className=`adw-print-collate-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`A visualization of the effect of the collate and reverse options on the page ordering`),e.dataset.columnA=`2`,e.dataset.columnB=`1`,e}_buildPageSetup(){let e=document.createElement(`div`);e.className=`adw-print-columns`;let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Layout`),r=n.body;r.appendChild(this._labelledRow(`Two-sided:`,this._dropDown(An,`Two-sided`)));let i=document.createElement(`input`);i.type=`number`,i.min=`10`,i.max=`400`,i.className=`adw-print-scale`,i.value=this._settings.scale??`100`,i.setAttribute(`aria-label`,`Scale in percent`),i.addEventListener(`input`,()=>{this._settings={...this._settings,scale:i.value},this._renderPrint()}),this._capabilityControls.set(`scale`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`;let o=document.createElement(`div`);o.className=`adw-print-label`,o.textContent=`Scale:`;let s=document.createElement(`span`);s.className=`adw-print-label`,s.textContent=`%`,a.append(o,i,s),r.appendChild(a),t.appendChild(n.group);let c=this._group(`Paper`),l=c.body,u=q.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(jn.map(e=>e[0].toUpperCase()+e.slice(1)),`Orientation`),l.appendChild(this._labelledRow(`Paper size:`,this._paperDrop)),l.appendChild(this._labelledRow(`Orientation:`,this._orientationDrop)),t.appendChild(c.group),this._paperDrop.addEventListener(`notify::selected`,()=>{this.embedPageSetup&&this._paperChanged(this._paperDrop.selected)}),this._orientationDrop.addEventListener(`notify::selected`,()=>{if(!this.embedPageSetup)return;let e=jn[this._orientationDrop.selected]??`portrait`;this._pageSetup={...this._pageSetup,orientation:e},this._settings={...this._settings,orientation:e},this._renderPrint()}),e.append(t,this._buildSheetPreview()),e}_buildSheetPreview(){let e=document.createElement(`div`);e.className=`adw-print-sheet-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Page layout preview`);let t=document.createElement(`div`);t.className=`adw-print-paper`;let n=paperSizeOf(this._pageSetup),r=this._pageSetup.orientation===`landscape`||this._pageSetup.orientation===`reverse-landscape`;t.style.aspectRatio=r?`${n.height} / ${n.width}`:`${n.width} / ${n.height}`;let i=document.createElement(`div`);i.className=`adw-print-number-up`,i.dataset.cells=`1`,t.appendChild(i),e.appendChild(t);let a=document.createElement(`div`);return a.className=`adw-print-sheet-caption`,a.textContent=`${orientedSize(this._pageSetup).width.toFixed(1)} mm × ${orientedSize(this._pageSetup).height.toFixed(1)} mm`,e.appendChild(a),e}_buildJob(){let e=document.createElement(`div`);e.className=`adw-print-column`;let t=this._group(`Job Details`);t.body.appendChild(this._optionsGrid(`Job Details`));let n=this._group(`Print Document`),r=n.body;for(let[e,t]of[[`now`,`Now`],[`at`,`At:`],[`hold`,`On hold`]]){let n=this._radio(t,`adw-print-at`);if(n.addEventListener(`notify::checked`,()=>{n.checked&&(this._printAt=e,this._atInput!==null&&(this._atInput.disabled=e!==`at`),e===`at`&&this._atInput?.focus())}),r.appendChild(n),e===`at`){this._atInput=document.createElement(`input`),this._atInput.type=`text`,this._atInput.className=`adw-print-at-entry`,this._atInput.setAttribute(`aria-label`,`Print at`),this._atInput.disabled=!0,this._atInput.addEventListener(`input`,()=>{this._settings={...this._settings,"print-at":this._atInput.value}});let e=document.createElement(`div`);e.className=`adw-print-grid-row`,e.appendChild(this._atInput),r.appendChild(e)}}let i=this._group(`Add Cover Page`);return i.body.appendChild(this._optionsGrid(`Cover Page`)),e.append(t.group,n.group,i.group),e}_buildOptionsPage(e){let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._optionsGrid(e);if(e===`Advanced`){let e=document.createElement(`div`);return e.className=`adw-print-advanced`,e.appendChild(n),t.appendChild(e),t}return t.appendChild(n),t}_optionsGrid(e){let t=document.createElement(`div`);return t.className=`adw-print-options-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e),t.dataset.empty=`true`,t}_buildConflicts(){return this._conflictsEl=document.createElement(`div`),this._conflictsEl.className=`adw-print-conflicts`,this._conflictsEl.hidden=!0,this._conflictsEl.append(createGtkImage(`dialog-warning`,`adw-print-conflicts-icon`),(()=>{let e=document.createElement(`span`);return e.className=`adw-print-conflicts-label`,e.textContent=`Some of the settings in the dialog conflict`,e})()),this._conflictsEl}_buildActions(){let e=document.createElement(`div`);e.className=`adw-print-actions`,this._previewButton=document.createElement(`button`),this._previewButton.type=`button`,this._previewButton.className=`adw-print-preview`,this._previewButton.textContent=`Preview`,this._previewButton.addEventListener(`click`,()=>this._respond(-10));let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6)),this._printButton=document.createElement(`button`),this._printButton.type=`button`,this._printButton.className=`adw-print-print suggested-action`,this._printButton.textContent=`Print`,this._printButton.addEventListener(`click`,()=>this._respond(-5)),e.append(this._previewButton,t,this._printButton),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),e!==-5&&this.close()}_group(e){let t=document.createElement(`div`);t.className=`adw-print-group`;let n=document.createElement(`div`);n.className=`adw-print-group-title`,n.textContent=e;let r=document.createElement(`div`);return r.className=`adw-print-group-body`,t.append(n,r),{group:t,body:r}}_labelledRow(e,t,n){let r=document.createElement(`div`);r.className=`adw-print-grid-row`;let i=document.createElement(`div`);return i.className=`adw-print-label`,i.textContent=e,r.append(i,t),n!==void 0&&this._capabilityControls.set(n,t),r}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-print-dropdown`,n.setAttribute(`model`,JSON.stringify([...e])),n.setAttribute(`aria-label`,t),n}_radio(e,t){let n=document.createElement(`adw-radio`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n.setAttribute(`value`,e),n}_check(e,t){let n=document.createElement(`gtk-check-button`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n}_frame(e){let t=document.createElement(`div`);return t.className=`adw-print-frame`,t.appendChild(e),t}_printerChanged(e){this._selected=e,e!==null&&(this._settings={...this._settings,"format-for-printer":e.name}),this._renderPrint()}_paperChanged(e){let t=q[e];t!==void 0&&(this._pageSetup={...this._pageSetup,paperSize:t.name,margins:defaultMargins(t)},this._renderPrint())}_capabilities(){let e=new Set(this._manual);for(let t of this._selected?.capabilities??[])e.add(t);return e}_renderPrint(){let e=this._capabilities();this._switcherEl.replaceChildren(...kn.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=e,t.classList.toggle(`checked`,e===this._tab),t.setAttribute(`aria-selected`,String(e===this._tab)),t.addEventListener(`click`,()=>{this._tab=e,this._renderPanel(),this._renderPrint()}),t})),this._printerListEl.replaceChildren(...this._printers.map(e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-print-printer-row`,t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e===this._selected)),t.classList.toggle(`checked`,e===this._selected),t.appendChild(e.iconName===void 0?createGtkImage(`printer`,`adw-print-printer-icon`):createGtkImage(e.iconName,`adw-print-printer-icon`));let n=document.createElement(`span`);n.className=`adw-print-printer-text`;let r=document.createElement(`span`);if(r.className=`adw-print-printer-name`,r.textContent=e.name,n.appendChild(r),e.location!==void 0){let t=document.createElement(`span`);t.className=`adw-print-printer-location`,t.textContent=e.location,n.appendChild(t)}return t.appendChild(n),t.addEventListener(`click`,()=>this._printerChanged(e)),t})),this._selectionRadio.hidden=!this.supportSelection,this._selectionRadio.classList.toggle(`insensitive`,!this.supportSelection||!this._hasSelection),this._selectionRadio.setAttribute(`aria-disabled`,String(!this.supportSelection||!this._hasSelection)),this._currentPageRadio.classList.toggle(`insensitive`,this._currentPage===-1),this._currentPageRadio.setAttribute(`aria-disabled`,String(this._currentPage===-1));for(let[t,n]of this._capabilityControls)n.toggleAttribute(`disabled`,!e.has(t));let t=Number.parseInt(this._copiesInput.value,10),n=this._copiesInput.value!==``&&Number.isFinite(t)&&t>1;this._collateCheck.toggleAttribute(`disabled`,!n||!e.has(`collate`)),this._reverseCheck.toggleAttribute(`disabled`,!e.has(`reverse`)),this._copiesInput.toggleAttribute(`disabled`,!e.has(`copies`)),this._paperDrop.toggleAttribute(`disabled`,!this.embedPageSetup),this._orientationDrop.toggleAttribute(`disabled`,!this.embedPageSetup);let r=this._collateCheck.checked,i=this._reverseCheck.checked,a=this.contentArea.querySelector(`.adw-print-collate-preview`);a!==null&&(a.dataset.columnA=String(r?i?1:2:i?2:1),a.dataset.columnB=String(r?i?2:1:i?1:2),a.dataset.secondColumn=String(n));let o=this._selected!==null&&(this._selected.acceptsJobs??!0);this._printButton.toggleAttribute(`disabled`,!o),this._previewButton.hidden=!e.has(`preview`);let s=this.contentArea.querySelector(`.adw-print-paper`);if(s!==null){let e=paperSizeOf(this._pageSetup),t=this._pageSetup.orientation===`reverse-portrait`;s.style.aspectRatio=`${this._pageSetup.orientation===`landscape`||t?`${e.height} / ${e.width}`:`${e.width} / ${e.height}`}`}let c=this.contentArea.querySelector(`.adw-print-number-up`);c!==null&&(c.dataset.cells=`1`),this._conflictsEl.hidden=!0}};customElements.define(`gtk-print-unix-dialog`,GtkPrintUnixDialog);var GtkProgressBar=class extends HTMLElement{_trough;_progress;_text;_initialized=!1;static get observedAttributes(){return[`fraction`,`pulsing`,`show-text`,`text`,`inverted`,`osd`,`disabled`]}get fraction(){let e=Number.parseFloat(this.getAttribute(`fraction`)??``);return Number.isFinite(e)?glibClamp(e,0,1):0}set fraction(e){this.setAttribute(`fraction`,String(e))}get pulsing(){return this.hasAttribute(`pulsing`)}set pulsing(e){this.toggleAttribute(`pulsing`,!!e)}get showText(){return this.hasAttribute(`show-text`)}set showText(e){this.toggleAttribute(`show-text`,!!e)}get text(){let e=this.getAttribute(`text`);return e===null?`${Math.round(this.fraction*100)}%`:e}set text(e){this.setAttribute(`text`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get osd(){return this.hasAttribute(`osd`)}set osd(e){this.toggleAttribute(`osd`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}pulse(){this.pulsing=!0}connectedCallback(){this._initialized||(this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-progress-bar-trough`,this._progress=document.createElement(`span`),this._progress.className=`adw-progress-bar-progress`,this._trough.appendChild(this._progress),this._text=document.createElement(`span`),this._text.className=`adw-progress-bar-text`,this.replaceChildren(this._trough,this._text),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-valuemin`,`0`),this.setAttribute(`aria-valuemax`,`1`),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.fraction,t=this.pulsing,n=!t&&e===0;this._trough.classList.toggle(`empty`,n),this._progress.style.width=t||n?``:`${e*100}%`,this._text.textContent=this.text,this._text.hidden=!this.showText,t?this.removeAttribute(`aria-valuenow`):this.setAttribute(`aria-valuenow`,String(e))}};customElements.define(`gtk-progress-bar`,GtkProgressBar);const Nn=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`swing-right`,`swing-left`,`swing-up`,`swing-down`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`],Pn=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Fn=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),In=new Set([`swing-right`,`swing-left`]),Ln=new Set([`swing-up`,`swing-down`]),Rn=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),zn={"slide-left":`slide-right`,"slide-right":`slide-left`,"swing-left":`swing-right`,"swing-right":`swing-left`,"fade-slide-left":`fade-slide-right`,"fade-slide-right":`fade-slide-left`};var GtkRevealer=class extends HTMLElement{_clipEl;_initialized=!1;_position=0;_target=0;_frame=0;_startedAt=0;_naturalWidth=0;_naturalHeight=0;_resize=null;static get observedAttributes(){return[`reveal-child`,`transition-type`,`transition-duration`]}get revealChild(){return this.hasAttribute(`reveal-child`)}set revealChild(e){this.toggleAttribute(`reveal-child`,!!e)}get childRevealed(){return this._position===this._target?this.revealChild:!this.revealChild}get transitionType(){let e=this.getAttribute(`transition-type`);return Nn.includes(e)?e:`slide-down`}set transitionType(e){this.setAttribute(`transition-type`,e)}get transitionDuration(){let e=Number.parseFloat(this.getAttribute(`transition-duration`)??``);return Number.isFinite(e)&&e>=0?e:250}set transitionDuration(e){this.setAttribute(`transition-duration`,String(e))}get child(){return this._clipEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observeChild(),this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._clipEl=document.createElement(`div`),this._clipEl.className=`adw-revealer-clip`,bindSlottedChildren(this,[{name:`child`,into:this._clipEl},{into:this._clipEl}],()=>this._observeChild()).install(this._clipEl),this._observeChild(),this._animate(this.revealChild),this._render()}disconnectedCallback(){this._finish(),this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`reveal-child`){if(!this._animate(n!==null))return;this.dispatchEvent(new CustomEvent(`notify::reveal-child`,{bubbles:!0,detail:{revealChild:this.revealChild}}));return}this._render();let r=e===`transition-duration`?{transitionDuration:this.transitionDuration}:{transitionType:this.transitionType};this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:r}))}_observeChild(){this._resize?.disconnect(),this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._naturalWidth=e?e.inlineSize:t.contentRect.width,this._naturalHeight=e?e.blockSize:t.contentRect.height}this._render()}),this._resize.observe(this._clipEl);let e=this._clipEl.firstElementChild;e&&this._resize.observe(e)}_animate(e){let t=+!!e;if(this._target===t)return!1;this._target=t;let n=this.effectiveTransition,r=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(this.transitionDuration===0||n===`none`||r||!this.isConnected)return this._finish(),this._setPosition(t),!0;let i=this._position;return this._startedAt=performance.now(),this._frame===0&&(this._frame=requestAnimationFrame(()=>this._tick(i))),!0}_tick(e){this._frame=0;let t=this.transitionDuration,n=performance.now()-this._startedAt,r=t<=0?1:Math.min(1,n/t),i=easeOutCubic(r);this._setPosition(e+i*(this._target-e)),r<1&&(this._frame=requestAnimationFrame(()=>this._tick(e)))}_finish(){this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0)}get effectiveTransition(){let e=this.transitionType;return this.matches(`:dir(rtl)`)?zn[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?Pn:Fn,r=e===`horizontal`?In:Ln;return n.has(t)?this._position:r.has(t)?Math.sin(Math.PI*this._position/2):1}_setPosition(e){this._position=e,this._render(),this._position===this._target&&this.dispatchEvent(new CustomEvent(`notify::child-revealed`,{bubbles:!0,detail:{childRevealed:this.childRevealed}}))}_render(){let e=this._clipEl.firstElementChild;e&&this._naturalHeight===0&&(this._naturalWidth=e.offsetWidth,this._naturalHeight=e.offsetHeight);let t=this._position,n=this._scale(`horizontal`),r=this._scale(`vertical`),i=this.effectiveTransition;if(this._clipEl.style.width=n<1?`${Math.ceil(this._naturalWidth*n)}px`:``,this._clipEl.style.height=r<1?`${Math.ceil(this._naturalHeight*r)}px`:``,e){let a=this._naturalWidth,o=this._naturalHeight,s=a*n,c=o*r,l=2*Math.max(s,c),u=90*(1-t),d=``;switch(i){case`slide-right`:case`fade-slide-right`:d=`translateX(${s-a}px)`;break;case`slide-down`:case`fade-slide-down`:d=`translateY(${c-o}px)`;break;case`swing-right`:d=`translate(0, ${c/2}px) perspective(${l}px) rotateY(${u}deg) translate(0, ${-o/2}px)`;break;case`swing-left`:d=`translate(${s}px, ${c/2}px) perspective(${l}px) rotateY(${-u}deg) translate(${-a}px, ${-o/2}px)`;break;case`swing-down`:d=`translate(${s/2}px, 0) perspective(${l}px) rotateX(${-u}deg) translate(${-a/2}px, 0)`;break;case`swing-up`:d=`translate(${s/2}px, ${c}px) perspective(${l}px) rotateX(${u}deg) translate(${-a/2}px, ${-o}px)`;break;default:break}e.style.transform=d,e.style.transformOrigin=d===``?``:`0 0`,e.style.opacity=Rn.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const Bn=[`left`,`right`,`top`,`bottom`];function seededRange(e,t){let n=normalizeAdjustment(parseAdjustment(e));if(t===null)return n;let r=Number.parseFloat(t);return Number.isFinite(r)?{...n,value:r}:n}function formatScaleValue(e,t){let n=e.toFixed(t);return n.startsWith(`-`)&&Number.parseFloat(n)===0?n.slice(1):n}var GtkScale=class extends HTMLElement{_range=new SpinState;_trough;_highlight;_fill;_slider;_value;_initialized=!1;_pointerId=null;static get observedAttributes(){return[`adjustment`,`digits`,`disabled`,`draw-value`,`fill-level`,`has-origin`,`inverted`,`orientation`,`restrict-to-fill-level`,`round-digits`,`show-fill-level`,`value`,`value-pos`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._setValue(e,!1)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get drawValue(){return this.hasAttribute(`draw-value`)}set drawValue(e){this.toggleAttribute(`draw-value`,!!e)}get valuePos(){let e=this.getAttribute(`value-pos`);return Bn.includes(e)?e:`top`}set valuePos(e){this.setAttribute(`value-pos`,e)}get hasOrigin(){return!this.hasAttribute(`has-origin`)||this.getAttribute(`has-origin`)!==`false`}set hasOrigin(e){this.toggleAttribute(`has-origin`,!!e)}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):1}set digits(e){this.setAttribute(`digits`,String(e))}get fillLevel(){let e=Number.parseFloat(this.getAttribute(`fill-level`)??``);return Number.isFinite(e)?e:0}set fillLevel(e){this.setAttribute(`fill-level`,String(e))}get showFillLevel(){return this.hasAttribute(`show-fill-level`)}set showFillLevel(e){this.toggleAttribute(`show-fill-level`,!!e)}get restrictToFillLevel(){return this.hasAttribute(`restrict-to-fill-level`)}set restrictToFillLevel(e){this.toggleAttribute(`restrict-to-fill-level`,!!e)}get slider(){return this._slider}connectedCallback(){this._initialized||(this._initialized=!0,this._range.configure(seededRange(this.getAttribute(`adjustment`),this.getAttribute(`value`))),this._trough=document.createElement(`span`),this._trough.className=`adw-scale-trough`,this._highlight=document.createElement(`span`),this._highlight.className=`adw-scale-highlight`,this._fill=document.createElement(`span`),this._fill.className=`adw-scale-fill`,this._slider=document.createElement(`span`),this._slider.className=`adw-scale-slider`,this._trough.append(this._fill,this._highlight,this._slider),this._value=document.createElement(`span`),this._value.className=`adw-scale-value`,this.replaceChildren(this._trough,this._value),this.setAttribute(`role`,`slider`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this._trough.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this._value.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointermove`,e=>this._onPointerMove(e)),this.addEventListener(`pointerup`,e=>this._onPointerUp(e)),this.addEventListener(`pointercancel`,e=>this._onPointerUp(e)),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render())}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_setValue(e,t){let n=e;this.restrictToFillLevel&&(n=Math.min(n,Math.max(this.adjustment.lower,this.fillLevel)));let r=Number.parseInt(this.getAttribute(`round-digits`)??``,10);if(Number.isFinite(r)&&r!==-1){let e=10**r;n=Math.floor(n*e+.5)/e}return t?this._range.setValueInteractive(n):this._range.setValue(n)}_valueAtCoord(e){let t=this.adjustment,n=this.orientation===`horizontal`?this._trough.clientWidth:this._trough.clientHeight,r=n===0?1:glibClamp(e/n,0,1);return this._shouldInvert()&&(r=1-r),t.lower+r*(t.upper-t.lower-t.pageSize)}_shouldInvert(){let e=this.closest(`[dir="rtl"]`)!==null;return this.orientation===`horizontal`?this.inverted?!e:e:this.inverted}_onPointerDown(e){if(this.hasAttribute(`disabled`)||e.button!==0)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._pointerId=e.pointerId,this.focus(),this._setValue(this._valueAtCoord(n),!0);try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}_onPointerMove(e){if(this._pointerId!==e.pointerId)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._setValue(this._valueAtCoord(n),!0)}_onPointerUp(e){this._pointerId===e.pointerId&&(this._pointerId=null,this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId))}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=this.adjustment,n=e.ctrlKey,r=null;switch(e.key){case`ArrowLeft`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowRight`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`ArrowDown`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowUp`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`PageUp`:r=this.value+t.pageIncrement;break;case`PageDown`:r=this.value-t.pageIncrement;break;case`Home`:r=t.lower;break;case`End`:r=t.upper-t.pageSize;break;case`+`:case`=`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`-`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;default:return}e.preventDefault(),this._setValue(r,!0)}_render(){if(!this._trough)return;let e=this.orientation,t=this.adjustment,n=t.upper-t.lower-t.pageSize,r=n===0?0:(t.value-t.lower)/n,i=glibClamp(this._shouldInvert()?1-r:r,0,1);this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e),e===`horizontal`?this._slider.style.left=`${i*100}%`:this._slider.style.bottom=`${i*100}%`,this._slider.style.top=``,this._slider.style.right=``;let a=this.hasOrigin;this._highlight.hidden=!a,a&&(e===`horizontal`?(this._highlight.style.right=``,this._highlight.style.width=`${i*100}%`):(this._highlight.style.width=``,this._highlight.style.height=`${i*100}%`));let o=this.showFillLevel;if(this._fill.hidden=!o,o){let r=glibClamp((this.fillLevel-t.lower)/(n||1),0,1);e===`horizontal`?this._fill.style.width=`${r*100}%`:this._fill.style.height=`${r*100}%`}this._value.textContent=formatScaleValue(t.value,this.digits),this._value.hidden=!this.drawValue;let s=this.valuePos;this._value.classList.toggle(`left`,s===`left`),this._value.classList.toggle(`right`,s===`right`),this._value.classList.toggle(`top`,s===`top`),this._value.classList.toggle(`bottom`,s===`bottom`),this.classList.toggle(`value-top`,s===`top`),this.classList.toggle(`value-right`,s===`right`),this.classList.toggle(`value-bottom`,s===`bottom`),this.classList.toggle(`value-left`,s===`left`),this.setAttribute(`aria-valuemin`,String(t.lower)),this.setAttribute(`aria-valuemax`,String(t.upper-t.pageSize)),this.setAttribute(`aria-valuenow`,String(t.value)),this.setAttribute(`aria-valuetext`,this._value.textContent??``),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-scale`,GtkScale);const Vn={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends HTMLElement{_state=new SpinState;_buttonEl;_glyph;_dockEl;_rangeEl;_minusEl;_plusEl;_icons=[];_initialized=!1;_syncing=!1;static get observedAttributes(){return[`value`,`icons`,`adjustment`,`has-frame`,`orientation`]}get value(){return this._state.value}set value(e){this._applyValue(e)}get active(){return this._buttonEl?.classList.contains(`checked`)??!1}get icons(){return[...this._icons]}set icons(e){this.setAttribute(`icons`,JSON.stringify(e))}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._glyph=createGtkImage(`image-missing`,`scale-button-glyph`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button scale-button-icon flat`,this._buttonEl.setAttribute(`aria-expanded`,`false`),this._buttonEl.appendChild(this._glyph),this._minusEl=this._stepButton(`list-remove-symbolic`,`Decrease`),this._plusEl=this._stepButton(`list-add-symbolic`,`Increase`),this._rangeEl=document.createElement(`input`),this._rangeEl.type=`range`,this._rangeEl.className=`scale-button-range`,this._rangeEl.addEventListener(`input`,()=>{this._syncing||this._applyValue(Number(this._rangeEl.value))});let e=document.createElement(`div`);e.className=`scale-button-box`,e.append(this._minusEl,this._rangeEl,this._plusEl),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`scale-popup`),this._dockEl.replaceChildren(e),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this._toggleDock()),this._minusEl.addEventListener(`click`,()=>this._step(-1)),this._plusEl.addEventListener(`click`,()=>this._step(1)),this._dockEl.subscribe(e=>this._renderDock(e)),this.addEventListener(`wheel`,e=>{e.deltaY!==0&&(e.preventDefault(),this._applyValue(this._state.value-Math.sign(e.deltaY)*this._state.adjustment.stepIncrement))},{passive:!1}),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._icons=parseIcons(this.getAttribute(`icons`)),this._syncAdjustment(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._syncAdjustment();return}if(e===`icons`){this._icons=parseIcons(this.getAttribute(`icons`)),this._render(),this.dispatchEvent(new CustomEvent(`notify::icons`,{bubbles:!0}));return}if(e===`value`){let e=this.getAttribute(`value`);if(e===null||e.trim()===``)return;let t=Number(e);Number.isFinite(t)&&this._applyValue(t);return}this._render()}}_applyValue(e){let t=this._state.setValue(e);if(this._render(),!t)return;let n=this._state.value;this.setAttribute(`value`,String(n)),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:n}})),this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:n}}))}_syncAdjustment(){let e=parseAdjustment(this.getAttribute(`adjustment`)),t={...Vn,...e},n=this.getAttribute(`value`),r=n===null||n.trim()===``?NaN:Number(n);t.value=Number.isFinite(r)?r:this._state.value,this._state.configure(t),this._render(),this.dispatchEvent(new CustomEvent(`notify::adjustment`,{bubbles:!0}))}_render(){if(!this._initialized)return;let e=this._state.value,[t,n]=adjustmentRange(this._state.adjustment),r=selectIcon(this._icons,e,t,n);this._glyph.getAttribute(`icon-name`)!==r&&this._glyph.setAttribute(`icon-name`,r),this._buttonEl.setAttribute(`aria-label`,r),this._syncing=!0,this._rangeEl.min=String(t),this._rangeEl.max=String(n),this._rangeEl.step=String(this._state.adjustment.stepIncrement),this._rangeEl.value=String(e),this._rangeEl.setAttribute(`aria-valuemin`,String(t)),this._rangeEl.setAttribute(`aria-valuemax`,String(n)),this._rangeEl.setAttribute(`aria-valuenow`,String(e)),this._syncing=!1,this._minusEl.disabled=!(t<e),this._plusEl.disabled=!(e<n),this._buttonEl.classList.toggle(`flat`,!this.hasFrame),this.classList.toggle(`horizontal`,this.orientation===`horizontal`),this.classList.toggle(`vertical`,this.orientation===`vertical`)}_stepButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-button scale-button-step flat`,n.setAttribute(`aria-label`,t),n.appendChild(createGtkImage(e)),n}_toggleDock(){this.active?this._dock(`popdown`):this._dock(`popup`)}_dock(e){let t=e===`popup`;this.active!==t&&(this._buttonEl.classList.toggle(`checked`,t),this._buttonEl.setAttribute(`aria-expanded`,String(t)),t?(this._dockEl.popup(),this._rangeEl.focus()):(this._dockEl.popdown(),this._buttonEl.focus()),this.dispatchEvent(new CustomEvent(e,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:t}})))}_renderDock(e){this._dock(e?`popup`:`popdown`)}_step(e){this._applyValue(this._state.value+e*this._state.adjustment.pageIncrement)}_onKeyDown(e){if(e.key===`Escape`){if(!this.active)return;e.preventDefault(),this._dock(`popdown`);return}e.target===this._buttonEl&&(e.key!==` `&&e.key!==`Enter`&&e.key!==`Return`||(e.preventDefault(),this._toggleDock()))}};customElements.define(`gtk-scale-button`,GtkScaleButton);function selectIcon(e,t,n,r){let i=e[0];if(i===void 0||i===``)return`image-missing`;if(e.length===1)return i;if(e.length===2)return t<(r-n)/2+n?i:e[1]??i;if(t===n)return i;if(t===r)return e[1]??i;let a=(r-n)/(e.length-2);return e[Math.floor((t-n)/a)+2]??i}function parseIcons(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var GtkSearchBar=class extends HTMLElement{_box;_center;_close;_initialized=!1;_capture=null;_onCapturedKey=e=>this._captureKey(e);_onInput=()=>this._revealFromTyping();static get observedAttributes(){return[`search-mode-enabled`,`show-close-button`]}get searchModeEnabled(){return this.hasAttribute(`search-mode-enabled`)}set searchModeEnabled(e){this.toggleAttribute(`search-mode-enabled`,!!e)}get showCloseButton(){return this.hasAttribute(`show-close-button`)}set showCloseButton(e){this.toggleAttribute(`show-close-button`,!!e)}get keyCaptureWidget(){return this._capture}set keyCaptureWidget(e){this._capture!==e&&(this._capture?.removeEventListener(`keydown`,this._onCapturedKey,!0),this._capture=e,this._capture?.addEventListener(`keydown`,this._onCapturedKey,!0))}get entry(){return this.querySelector(`input, textarea`)}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`search`),this._center=document.createElement(`div`),this._center.className=`adw-search-bar-center`,this._center.append(...this.childNodes),this._close=document.createElement(`button`),this._close.className=`adw-search-bar-close`,this._close.type=`button`,this._close.setAttribute(`aria-label`,`Close search`),this._close.addEventListener(`click`,()=>this.searchModeEnabled=!1),this._box=document.createElement(`div`),this._box.className=`adw-search-bar-box`,this._box.append(this._center,this._close),this.replaceChildren(this._box),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(this.searchModeEnabled=!1)}),this._render())}disconnectedCallback(){this.keyCaptureWidget=null}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`search-mode-enabled`){this._applyReveal(),this.dispatchEvent(new CustomEvent(`notify::search-mode-enabled`,{bubbles:!0,detail:{searchModeEnabled:this.searchModeEnabled}}));return}e===`show-close-button`&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::show-close-button`,{bubbles:!0,detail:{showCloseButton:this.showCloseButton}})))}}_render(){let e=this.searchModeEnabled;this.classList.toggle(`revealed`,e),this._box.inert=!e,this._close.hidden=!this.showCloseButton}_applyReveal(){this._render();let e=this.entry;e!==null&&(this.searchModeEnabled?e.focus():e.value=``)}_revealFromTyping(){this.searchModeEnabled||(this.searchModeEnabled=!0,this.entry?.focus())}_captureKey(e){if(e.defaultPrevented||e.ctrlKey||e.altKey||e.metaKey||e.key.length!==1)return;let t=this.entry;if(this.searchModeEnabled=!0,t===null)return;e.preventDefault(),t.focus();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;t.setRangeText(e.key,n,r,`end`)}};customElements.define(`gtk-search-bar`,GtkSearchBar);var GtkSearchEntry=class extends GtkEntry{_searchIcon;_clear;_clearIcon;_timeout=null;static get observedAttributes(){return[...GtkEntry.observedAttributes,`search-delay`]}get searchDelay(){let e=Number.parseInt(this.getAttribute(`search-delay`)??``,10);return Number.isFinite(e)&&e>=0?e:150}set searchDelay(e){this.setAttribute(`search-delay`,String(e))}get _empty(){return this._input?this._input.value===``:this.getAttribute(`value`)===``}connectedCallback(){super.connectedCallback(),this._searchIcon=createGtkImage(`system-search-symbolic`,`adw-search-entry-icon`),this._clear=document.createElement(`button`),this._clear.type=`button`,this._clear.className=`adw-button flat circular icon-only adw-search-entry-clear`,this._clearIcon=createGtkImage(`edit-clear-symbolic`,`adw-search-entry-clear-icon`),this._clear.append(this._clearIcon),this._clear.title=`Clear Entry`,this._clear.setAttribute(`aria-label`,`Clear Entry`),this._clear.addEventListener(`click`,()=>{this._input.value=``,this._onChanged(),this._input.focus()}),this._clear.addEventListener(`mousedown`,e=>e.preventDefault()),this.replaceChildren(this._searchIcon,this._input,this._clear),this.setAttribute(`role`,`searchbox`),this._input.addEventListener(`input`,()=>this._onChanged()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._render()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`search-delay`&&this._clear&&this._cancel()}disconnectedCallback(){this._cancel(),super.disconnectedCallback()}_onChanged(){if(this._cancel(),this._empty){this._render(),this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:``}}));return}this._render();let e=this.searchDelay;this._timeout=globalThis.setTimeout(()=>{this._timeout=null,this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:this._input.value}}))},e)}_cancel(){this._timeout!==null&&(clearTimeout(this._timeout),this._timeout=null)}_onKeyDown(e){switch(e.key){case`Escape`:e.preventDefault(),this.dispatchEvent(new CustomEvent(`stop-search`,{bubbles:!0}));break;case`g`:if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),this.dispatchEvent(new CustomEvent(e.shiftKey?`previous-match`:`next-match`,{bubbles:!0}));break;default:return}}_render(){this._clear&&(this._clear.hidden=this._empty)}};customElements.define(`gtk-search-entry`,GtkSearchEntry);const Hn=[`always`,`never`,`automatic`,`external`],Un=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return Hn.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Un.find(t=>t===e)??`top-left`}function sizeRequest(e){if(e===null)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:null}const Wn=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssMin:`minWidth`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssMin:`minHeight`,end:`top`,farEnd:`bottom`}];function resolveScrollKey(e){switch(e.key){case`ArrowLeft`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!0}:null;case`ArrowRight`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!0}:null;case`ArrowUp`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!1}:null;case`ArrowDown`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!1}:null;case`PageUp`:return{scroll:`page-backward`,horizontal:e.ctrlKey};case`PageDown`:return{scroll:`page-forward`,horizontal:e.ctrlKey};case`Home`:return{scroll:`start`,horizontal:e.ctrlKey};case`End`:return{scroll:`end`,horizontal:e.ctrlKey};default:return null}}var GtkScrolledWindow=class extends HTMLElement{_viewport;_bars=null;_wroteSizes=new Set;_shading=null;_observer=null;_hoverable=null;_fadeTimer=null;_built=!1;static get observedAttributes(){return[`hscrollbar-policy`,`vscrollbar-policy`,`window-placement`,`has-frame`,`min-content-width`,`min-content-height`,`max-content-width`,`max-content-height`,`overlay-scrolling`,`propagate-natural-width`,`propagate-natural-height`]}get hscrollbarPolicy(){return normalizePolicy(this.getAttribute(`hscrollbar-policy`))}set hscrollbarPolicy(e){this.setAttribute(`hscrollbar-policy`,e)}get vscrollbarPolicy(){return normalizePolicy(this.getAttribute(`vscrollbar-policy`))}set vscrollbarPolicy(e){this.setAttribute(`vscrollbar-policy`,e)}get windowPlacement(){return normalizeCorner(this.getAttribute(`window-placement`))}set windowPlacement(e){this.setAttribute(`window-placement`,e)}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get overlayScrolling(){return this.getAttribute(`overlay-scrolling`)!==`false`}set overlayScrolling(e){this.toggleAttribute(`overlay-scrolling`,!!e)}get minContentWidth(){return sizeRequest(this.getAttribute(`min-content-width`))}set minContentWidth(e){this._writeSizeRequest(`min-content-width`,e)}get minContentHeight(){return sizeRequest(this.getAttribute(`min-content-height`))}set minContentHeight(e){this._writeSizeRequest(`min-content-height`,e)}get maxContentWidth(){return sizeRequest(this.getAttribute(`max-content-width`))}set maxContentWidth(e){this._writeSizeRequest(`max-content-width`,e)}get maxContentHeight(){return sizeRequest(this.getAttribute(`max-content-height`))}set maxContentHeight(e){this._writeSizeRequest(`max-content-height`,e)}get propagateNaturalWidth(){return this.hasAttribute(`propagate-natural-width`)}set propagateNaturalWidth(e){this.toggleAttribute(`propagate-natural-width`,!!e)}get propagateNaturalHeight(){return this.hasAttribute(`propagate-natural-height`)}set propagateNaturalHeight(e){this.toggleAttribute(`propagate-natural-height`,!!e)}hscrollbar(){return this._bars?.horizontal??null}vscrollbar(){return this._bars?.vertical??null}get viewport(){return this._viewport}connectedCallback(){if(!this._built){this._built=!0,this._viewport=document.createElement(`gtk-viewport`);let e=document.createElement(`gtk-scrollbar`),t=document.createElement(`gtk-scrollbar`);e.setAttribute(`orientation`,`horizontal`),t.setAttribute(`orientation`,`vertical`),this._bars={horizontal:e,vertical:t},bindSlottedChildren(this,[{into:this._viewport}]).install(this._viewport,t,e),this.setAttribute(`role`,`generic`),this._viewport.addEventListener(`value-changed`,this._onViewportValue);for(let n of[e,t])n.addEventListener(`value-changed`,this._onBarValue),n.addEventListener(`pointerenter`,this._onIndicatorOver),n.addEventListener(`pointerleave`,this._onIndicatorOut);this._observer=new ResizeObserver(()=>this._sync()),this._observer.observe(this._viewport),this._shading=new AdwScrollShading(this,{onOvershoot:e=>this._edgeOvershot(e)}),this._shading.connect()}this._releaseHoverable(),this._hoverable=matchMedia(`(hover: hover)`),this._hoverable.addEventListener(`change`,this._onHoverableChange),this.addEventListener(`keydown`,this._onKeyDown),this._sync()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this._releaseHoverable()}attributeChangedCallback(e,t,n){!this._built||!this.isConnected||(this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._normalized(e,n)}})),this._sync())}_normalized(e,t){switch(e){case`hscrollbar-policy`:return normalizePolicy(t);case`vscrollbar-policy`:return normalizePolicy(t);case`window-placement`:return normalizeCorner(t);case`overlay-scrolling`:return t!==`false`;case`has-frame`:return t!==null;case`propagate-natural-width`:case`propagate-natural-height`:return t!==null;default:return sizeRequest(t)}}_writeSizeRequest(e,t){t===null?this.removeAttribute(e):this.setAttribute(e,String(Math.max(0,Math.trunc(t))))}get _useIndicators(){return this.overlayScrolling&&(this._hoverable?.matches??!0)}_sync(){let e=this._bars;if(e===null||!this._viewport.isConnected||!e.vertical.isConnected)return;let t=this.windowPlacement,n=this._useIndicators;this.classList.toggle(`frame`,this.hasFrame),this.classList.toggle(t,!0);for(let e of Un)e!==t&&this.classList.toggle(e,!1);this.classList.toggle(`overlay-scrolling`,n),this._writeSize(`min-width`,`min-content-width`),this._writeSize(`min-height`,`min-content-height`),this._writeSize(`max-width`,`max-content-width`),this._writeSize(`max-height`,`max-content-height`);for(let t of Wn){let r=e[t.bar],i=normalizePolicy(this.getAttribute(t.policy)),a=this._adjustment(t.key);r.hidden=!(i===`always`||i===`automatic`&&a.upper-a.lower>a.pageSize),r.classList.toggle(`overlay-indicator`,n),r.adjustment=a,this._viewport.style[t.cssMin]=this.hasAttribute(t.natural)?`max-content`:i===`never`?`min-content`:``}n||this._clearFade()}_writeSize(e,t){let n=sizeRequest(this.getAttribute(t));n===null?this._wroteSizes.has(e)&&this.style.removeProperty(e):this.style.setProperty(e,`${n}px`),n===null?this._wroteSizes.delete(e):this._wroteSizes.add(e)}_adjustment(e){return this._viewport[e]}_mayScroll(e){let t=this._bars;if(t===null)return null;let n=e?t.horizontal:t.vertical;return n.hidden?normalizePolicy(this.getAttribute(e?`hscrollbar-policy`:`vscrollbar-policy`))===`external`?n:null:n}_onViewportValue=e=>{let t=this._bars;if(t===null)return;let n=e.detail;for(let e of Wn){let r=n[e.key];t[e.bar].adjustment=r;let i=r.upper-r.pageSize;r.value<=r.lower?this._edgeReached(e.end):r.value>=i&&this._edgeReached(e.farEnd)}this._fadeIn()};_onBarValue=e=>{let t=e.currentTarget,n=e.detail.adjustment;t.hidden||this._viewport.scrollAxis(t.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`,n.value)};_edgeReached(e){this.dispatchEvent(new CustomEvent(`edge-reached`,{bubbles:!0,detail:{pos:e}}))}_edgeOvershot(e){e!==0&&this.dispatchEvent(new CustomEvent(`edge-overshot`,{bubbles:!0,detail:{pos:e<0?`top`:`bottom`}}))}_onKeyDown=e=>{if(e.key===`Tab`&&e.ctrlKey){let t=e.shiftKey?`backward`:`forward`;this.dispatchEvent(new CustomEvent(`move-focus-out`,{bubbles:!0,detail:{directionType:t}}));return}let t=resolveScrollKey(e);if(t===null)return;let n=this._mayScroll(t.horizontal);n!==null&&(e.preventDefault(),n.scrollBy(t.scroll),this.dispatchEvent(new CustomEvent(`scroll-child`,{bubbles:!0,detail:{scroll:t.scroll,horizontal:t.horizontal}})))};_fadeIn(){let e=this._bars;if(!(e===null||!this._useIndicators)){for(let t of[e.horizontal,e.vertical])t.style.setProperty(`--adw-indicator-opacity`,`1`);this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=setTimeout(()=>this._fadeOut(),2e3)}}_fadeOut(){this._fadeTimer=null;let e=this._bars;if(!(e===null||!this._useIndicators))for(let t of[e.horizontal,e.vertical])t.classList.contains(`hovering`)||t.style.setProperty(`--adw-indicator-opacity`,`0`)}_clearFade(){this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=null;let e=this._bars;if(e!==null)for(let t of[e.horizontal,e.vertical])t.style.removeProperty(`--adw-indicator-opacity`)}_onIndicatorOver=e=>{e.currentTarget.classList.add(`hovering`),this._fadeIn()};_onIndicatorOut=e=>{e.currentTarget.classList.remove(`hovering`)};_onHoverableChange=()=>{this._sync()};_releaseHoverable(){this._hoverable?.removeEventListener(`change`,this._onHoverableChange),this._hoverable=null}};customElements.define(`gtk-scrolled-window`,GtkScrolledWindow);const Gn=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends HTMLElement{_trough;_slider;_observer=null;_built=!1;_adjustment=null;_grabPosition=0;_grabDelta=0;_zoom=!1;_dragging=!1;static get observedAttributes(){return[`orientation`,`adjustment`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._adjustment??Gn}set adjustment(e){let t=e==null?null:typeof e==`string`?parseAdjustment(e):e;this._adjustment=t===null?null:normalizeAdjustment(t,this._adjustment??void 0),this._built&&(this._render(),this._notify(`adjustment`,{adjustment:this.adjustment}))}get value(){return this.adjustment.value}set value(e){let t=this._adjustment;if(t===null)return;let n=clampAdjustmentValue(t,e);n!==t.value&&(this._adjustment={...t,value:n},this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{adjustment:this._adjustment}})))}scrollBy(e){if(typeof e!=`string`)return;let t=this.adjustment;switch(e){case`step-forward`:this.value=t.value+t.stepIncrement;break;case`step-backward`:this.value=t.value-t.stepIncrement;break;case`page-forward`:this.value=t.value+t.pageIncrement;break;case`page-backward`:this.value=t.value-t.pageIncrement;break;case`start`:this.value=t.lower;break;case`end`:this.value=t.upper;break}}scrollByWheel(e,t){let n=t===1?48:100,r=n===0?0:e/n;this.scrollBy(r>=0?`page-forward`:`page-backward`)}get _troughLength(){return this.orientation===`vertical`?this._trough.clientHeight:this._trough.clientWidth}connectedCallback(){this._built||(this._built=!0,this._trough=document.createElement(`div`),this._trough.className=`adw-scrollbar-trough`,this._slider=document.createElement(`div`),this._slider.className=`adw-scrollbar-slider`,this._trough.appendChild(this._slider),this.replaceChildren(this._trough),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wheel`,this._onWheel,{passive:!0}),this.tabIndex=0,this._observer=new ResizeObserver(()=>this._render()),this._observer.observe(this._trough),this.setAttribute(`role`,`scrollbar`)),this.hasAttribute(`adjustment`)&&(this.adjustment=this.getAttribute(`adjustment`)),this._render()}attributeChangedCallback(e,t,n){if(!(!this._built||!this.isConnected)){if(e===`adjustment`){this.adjustment=n;return}this._notify(`orientation`,{orientation:this.orientation}),this._render()}}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}_onPointerDown=e=>{if(!this.hasAttribute(`tabindex`))return;this.focus();let t=this._coordinate(e),n=e.target===this._slider;this._grabPosition=this._sliderPosition(),this._grabDelta=t-this._grabPosition,this._setZoom(n&&e.shiftKey),this._dragging=n,this._capture(e.pointerId),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerEnd),this.addEventListener(`pointercancel`,this._onPointerEnd),!n&&(e.button===0&&!e.shiftKey?this.value=this._coordinateValue(t+this._sliderSize()/2):(e.button===1||e.button===0&&e.shiftKey)&&this.scrollBy(this._coordinateValue(t)>this.value?`page-forward`:`page-backward`))};_onPointerMove=e=>{if(!this._dragging)return;this._setZoom(e.shiftKey);let t=this._coordinate(e),n=this._zoom?this._zoomFactor():1;this.value=this._coordinateValue(this._grabPosition+n*(t-(this._grabDelta+this._grabPosition)))};_onPointerEnd=e=>{this._endDrag(e.pointerId)};_endDrag(e){this._dragging=!1,this._setZoom(!1),e!==void 0&&this.hasPointerCapture(e)&&this.releasePointerCapture(e),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerEnd),this.removeEventListener(`pointercancel`,this._onPointerEnd)}_capture(e){try{this.setPointerCapture(e)}catch{}}_onKeyDown=e=>{let t=resolveRangeKey(e,this.orientation===`vertical`);t!==null&&(e.preventDefault(),this.scrollBy(t))};_onWheel=e=>{e.target!==this&&e.target!==this._trough||this.scrollByWheel(e.deltaY,e.deltaMode)};_setZoom(e){this._zoom!==e&&(this._zoom=e,this.classList.toggle(`fine-tune`,e))}_zoomFactor(){let e=this.adjustment,t=e.upper-e.lower-e.pageSize,n=t<=0?1:Math.min(1,this._troughLength/t);return n===1?.25:n}_render(){if(!this._built)return;let e=this.adjustment,t=this.orientation===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),this.setAttribute(`aria-orientation`,this.orientation),this.removeAttribute(`aria-disabled`),this.removeAttribute(`disabled`);let n=this._troughLength,r=e.upper-e.lower,i=r-e.pageSize;if(r===0)this._slider.style.removeProperty(`--adw-scrollbar-size`);else{let t=Math.min(n,n*(e.pageSize/r));this._slider.style.setProperty(`--adw-scrollbar-size`,`${t}px`)}let a=this._sliderSize(),o=Math.max(0,n-a),s=i===0?0:o*((e.value-e.lower)/i);this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this._slider.style.setProperty(`--adw-scrollbar-position`,`${s}px`)}_sliderPosition(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-position`))||0}_sliderSize(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-size`))||0}_coordinateValue(e){let t=this.adjustment,n=Math.max(1,this._troughLength-this._sliderSize()),r=Math.min(1,Math.max(0,e/n));return t.lower+r*(t.upper-t.pageSize-t.lower)}_coordinate(e){let t=this._trough.getBoundingClientRect();return this.orientation===`vertical`?e.clientY-t.top:e.clientX-t.left}};function resolveRangeKey(e,t){switch(e.key){case`ArrowRight`:return t?null:`step-forward`;case`ArrowLeft`:return t?null:`step-backward`;case`ArrowDown`:return t?`step-forward`:null;case`ArrowUp`:return t?`step-backward`:null;case`PageDown`:return`page-forward`;case`PageUp`:return`page-backward`;case`Home`:return`start`;case`End`:return`end`;default:return null}}customElements.define(`gtk-scrollbar`,GtkScrollbar);const Y=1e-10,Kn=[`always`,`if-valid`];var GtkSpinButton=class extends HTMLElement{_range=new SpinState;_input;_down;_up;_initialized=!1;_edited=!1;_vertical=null;_initialTimer=null;_repeatTimer=null;_timerCalls=0;_timerStep=0;static get observedAttributes(){return[`adjustment`,`climb-rate`,`digits`,`disabled`,`numeric`,`orientation`,`snap-to-ticks`,`update-policy`,`value`,`wrap`]}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._range.setValue(e),this._render()}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):0}set digits(e){this.setAttribute(`digits`,String(e))}get numeric(){return this.hasAttribute(`numeric`)}set numeric(e){this.toggleAttribute(`numeric`,!!e)}get snapToTicks(){return this.hasAttribute(`snap-to-ticks`)}set snapToTicks(e){this.toggleAttribute(`snap-to-ticks`,!!e)}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get updatePolicy(){let e=this.getAttribute(`update-policy`);return Kn.includes(e)?e:`always`}set updatePolicy(e){this.setAttribute(`update-policy`,e)}get climbRate(){let e=Number.parseFloat(this.getAttribute(`climb-rate`)??``);return Number.isFinite(e)&&e>0?e:0}set climbRate(e){this.setAttribute(`climb-rate`,String(e))}get text(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`))),t=this.getAttribute(`value`),n=t===null?NaN:Number.parseFloat(t);this._range.configure(Number.isFinite(n)?{...e,value:n}:e),this._input=document.createElement(`input`),this._input.className=`adw-spin-button-text`,this._input.type=`text`,this._input.inputMode=`decimal`,this._input.autocomplete=`off`,this._input.spellcheck=!1,this._down=document.createElement(`button`),this._down.type=`button`,this._down.className=`adw-button image-button down`,this._down.append(createGtkImage(`value-decrease-symbolic`)),this._down.setAttribute(`aria-label`,`Decrease`),this._up=document.createElement(`button`),this._up.type=`button`,this._up.className=`adw-button image-button up`,this._up.append(createGtkImage(`value-increase-symbolic`)),this._up.setAttribute(`aria-label`,`Increase`),this._down.addEventListener(`click`,()=>this._spin(-this._range.adjustment.stepIncrement)),this._up.addEventListener(`click`,()=>this._spin(this._range.adjustment.stepIncrement)),this._hold(this._down,-1),this._hold(this._up,1),this._input.addEventListener(`input`,()=>{this._edited=!0,this.numeric&&this._rejectNonNumeric()}),this._input.addEventListener(`change`,()=>this._update()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.setAttribute(`role`,`spinbutton`),this.replaceChildren(this._input,this._down,this._up),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_spin(e){let t=this.adjustment,n=t.value+e,r=!1;e>0?this.wrap?Math.abs(t.value-t.upper)<Y?(n=t.lower,r=!0):n>t.upper&&(n=t.upper):n=Math.min(n,t.upper):e<0&&(this.wrap?Math.abs(t.value-t.lower)<Y?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>Y&&this._range.setValueInteractive(n),r&&this.dispatchEvent(new CustomEvent(`wrapped`,{bubbles:!0}))}_update(){let e=this.adjustment,t=Number.parseFloat(this._input.value),n=this._input.value.trim()!==``&&Number.isNaN(t);if(this.updatePolicy===`always`){let r=glibClamp(n||!Number.isFinite(t)?e.value:t,e.lower,e.upper-e.pageSize);this._commit(this.snapToTicks?snapAdjustmentValue(e,r):r);return}if(n||!Number.isFinite(t)||t<e.lower||t>e.upper){this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:this._range.value}}));return}this._commit(this.snapToTicks?snapAdjustmentValue(e,t):t)}_commit(e){this._range.setValue(e),this._edited=!1,this._render()}_rejectNonNumeric(){let e=this.digits,t=!1,n=!1,r=``;for(let i of this._input.value){if(i===`-`||i===`+`){if(t||r!==``)return this._resetText();t=!0,r+=i;continue}if(i===`.`){if(!e||n)return this._resetText();n=!0,r+=i;continue}if(i<`0`||i>`9`)return this._resetText();r+=i}r!==this._input.value&&(this._input.value=r)}_resetText(){this._input.value=this._formatted()}_hold(e,t){let begin=e=>{e.button!==0||this.hasAttribute(`disabled`)||(this._timerStep=this._range.adjustment.stepIncrement,this._timerCalls=0,this._spin(t*this._timerStep),this._initialTimer=globalThis.setTimeout(()=>{this._initialTimer=null,this._spin(t*this._timerStep),this._repeatTimer=globalThis.setInterval(()=>this._tick(t),50)},500))},end=()=>this._stopHold();e.addEventListener(`pointerdown`,begin),e.addEventListener(`pointerup`,end),e.addEventListener(`pointerleave`,end),e.addEventListener(`pointercancel`,end)}_tick(e){this._spin(e*this._timerStep);let t=this._range.adjustment;this.climbRate>0&&this._timerStep<t.pageIncrement&&(this._timerCalls<5?this._timerCalls+=1:(this._timerCalls=0,this._timerStep+=this.climbRate))}_stopHold(){this._initialTimer!==null&&(clearTimeout(this._initialTimer),this._initialTimer=null),this._repeatTimer!==null&&(clearInterval(this._repeatTimer),this._repeatTimer=null),this._timerCalls=0,this._timerStep=0}_onKeyDown(e){let t=this._range.adjustment,n=t.stepIncrement,r=t.pageIncrement,i=null;switch(e.key){case`ArrowUp`:i=n;break;case`ArrowDown`:i=-n;break;case`PageUp`:i=r;break;case`PageDown`:i=-r;break;case`Enter`:{let e=this._edited;this._update(),e||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}));return}default:return}e.preventDefault(),this._spin(i)}_formatted(){return formatScaleValue(this._range.value,this.digits)}_render(){if(!this._input)return;let e=this.adjustment,t=this.getAttribute(`orientation`)===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),t!==this._vertical&&(this._vertical=t,t?this.replaceChildren(this._up,this._input,this._down):this.replaceChildren(this._input,this._down,this._up)),this._input.disabled=this.hasAttribute(`disabled`),this._input.size=10,document.activeElement!==this._input&&this._input.value!==this._formatted()&&(this._input.value=this._formatted()),this._up.disabled=!this.wrap&&e.upper-e.value<=Y,this._down.disabled=!this.wrap&&e.value-e.lower<=Y,this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-spin-button`,GtkSpinButton);const qn=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`spinning`,`disabled`]}get spinning(){return this.hasAttribute(`spinning`)}set spinning(e){this.toggleAttribute(`spinning`,!!e)}start(){this.spinning=!0,this.setAttribute(`aria-busy`,`true`)}stop(){this.spinning=!1,this.setAttribute(`aria-busy`,`false`)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0;let e=document.createElementNS(qn,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(qn,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(qn,`path`);n.setAttribute(`d`,`M 1 8 A 7 7 0 0 1 8 1`),n.setAttribute(`class`,`adw-spinner-arc`),e.append(t,n),this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`spinning`&&this.dispatchEvent(new CustomEvent(`notify::spinning`,{bubbles:!0,detail:{spinning:this.spinning}})))}_render(){this.classList.toggle(`checked`,this.spinning)}};customElements.define(`gtk-spinner`,GtkSpinner);const Jn=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`slide-left-right`,`slide-up-down`,`over-up`,`over-down`,`over-left`,`over-right`,`under-up`,`under-down`,`under-left`,`under-right`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left`,`rotate-right`,`rotate-left-right`],Yn=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Xn={"slide-left":`slide-right`,"slide-right":`slide-left`,"rotate-left":`rotate-right`,"rotate-right":`rotate-left`,"over-left":`over-right`,"over-right":`over-left`,"under-left":`under-right`,"under-right":`under-left`};function simpleTransitionType(e,t){switch(t){case`slide-left-right`:return e?`slide-right`:`slide-left`;case`rotate-left-right`:return e?`rotate-right`:`rotate-left`;case`slide-up-down`:return e?`slide-down`:`slide-up`;case`over-up-down`:return e?`under-down`:`over-up`;case`over-down-up`:return e?`under-up`:`over-down`;case`over-left-right`:return e?`under-right`:`over-left`;case`over-right-left`:return e?`under-left`:`over-right`;default:return t}}const Zn=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends HTMLElement{_visible=null;_lastVisible=null;_initialized=!1;_initializedChildren=new WeakSet;_observer=null;_timer=null;_running=!1;static get observedAttributes(){return[`visible-child-name`,`transition-type`,`transition-duration`,`hhomogeneous`,`vhomogeneous`,`interpolate-size`]}get visibleChildName(){return this.getAttribute(`visible-child-name`)}set visibleChildName(e){this._write(`visible-child-name`,e)}get visibleChild(){return this._visible}set visibleChild(e){this.setVisibleChild(e)}get transitionType(){let e=this.getAttribute(`transition-type`);return e!==null&&Jn.includes(e)?e:`none`}set transitionType(e){this._write(`transition-type`,e)}get transitionDuration(){return this._duration()}set transitionDuration(e){this._write(`transition-duration`,String(e))}get hhomogeneous(){return this._flag(`hhomogeneous`,!0)}set hhomogeneous(e){this._write(`hhomogeneous`,e?``:`false`)}get vhomogeneous(){return this._flag(`vhomogeneous`,!0)}set vhomogeneous(e){this._write(`vhomogeneous`,e?``:`false`)}get interpolateSize(){return this.hasAttribute(`interpolate-size`)}set interpolateSize(e){this.toggleAttribute(`interpolate-size`,!!e)}get transitionRunning(){return this.hasAttribute(`transition-running`)}get pages(){return this._children().map(e=>this._page(e))}getChildByName(e){return this._children().find(t=>this._page(t).name===e)??null}getPage(e){return this._children().includes(e)?this._page(e):null}isSelected(e){return this._visible===e}addTitled(e,t,n){return t!==null&&e.setAttribute(`name`,t),n!=null&&e.setAttribute(`title`,n),this.addChild(e)}addNamed(e,t){return this.addTitled(e,t)}addChild(e){return this.appendChild(e),this._initChild(e),this._initialized&&!this._visible&&!e.hasAttribute(`hidden`)&&this._show(e),e}removePage(e){e.remove()}setVisibleChild(e,t){return e?this._children().includes(e)?this._show(e,t):!1:this._show(this._firstVisible(),t)}setVisibleChildName(e){if(e===null)return!1;let t=this._children().find(t=>this._page(t).name===e);return t?this._show(t):!1}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`);for(let e of this._children())this._initChild(e);this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Zn,`hidden`]}),this._visible||this._show(this._firstVisible()),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._timer!==null&&clearTimeout(this._timer),this._timer=null,this._initialized=!1}attributeChangedCallback(e){if(this._initialized){if(e===`visible-child-name`){this.setVisibleChildName(this.getAttribute(`visible-child-name`));return}this._render(),this._notify(e)}}_property(e){switch(e){case`transition-type`:return this.transitionType;case`transition-duration`:return this.transitionDuration;case`hhomogeneous`:return this.hhomogeneous;case`vhomogeneous`:return this.vhomogeneous;case`interpolate-size`:return this.interpolateSize;default:return this.visibleChildName}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_duration(){let e=this.getAttribute(`transition-duration`);if(e===null)return 200;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}_children(){return Array.from(this.children)}_page(e){return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),needsAttention:e.hasAttribute(`needs-attention`),visible:!e.hasAttribute(`hidden`),child:e}}_firstVisible(){return this._children().find(e=>this._page(e).visible)??null}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){for(let e of Array.from(a.removedNodes))e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1;for(let e of Array.from(a.addedNodes))e instanceof HTMLElement&&(this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e)));continue}let e=a.attributeName;if(e){if(e===`hidden`){this._show(this._firstVisible());continue}Zn.includes(e)&&(i=!0)}}if((n>0||t>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{position:r===-1?this._children().length:r,removed:n,added:t}})),i){for(let t of e){if(t.type!==`attributes`)continue;let e=t.target;this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}})),e===this._visible&&t.attributeName===`name`&&(this._write(`visible-child-name`,this._nameOrNull(this._page(e).name)),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})))}this._render()}}_nameOrNull(e){return e===``?null:e}_show(e,t){if(!e)return!1;let n=this._page(e);if(!n.visible||this._visible===e)return!1;let r=this._visible;if(this._visible=e,this._write(`visible-child-name`,this._nameOrNull(n.name)),this._lastVisible=r,this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{"visible-child":e}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})),r){let t=Math.min(this._children().indexOf(r),this._children().indexOf(e));this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:t,nItems:2}}))}else this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:this._children().indexOf(e),nItems:1}}));return this._startTransition(r,t??this.transitionType),!0}_startTransition(e,t){this._timer!==null&&(clearTimeout(this._timer),this._timer=null);let n=this._effectiveType(t);if(Yn.has(n)&&!e?n=`none`:Yn.has(n)&&e&&(n=simpleTransitionType(this._newChildFirst(e),n)),n===`none`||!e||this._duration()===0){this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),this._lastVisible=null,this._render();return}this.dataset.transitionType=n,this._running=!0,this.setAttribute(`transition-running`,``),this.classList.add(`transitioning`),this._render(),this.dispatchEvent(new CustomEvent(`transition-start`,{bubbles:!0,detail:{duration:this._duration()}})),this._timer=setTimeout(()=>{this._timer=null,this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),delete this.dataset.transitionType,this._lastVisible=null,this._render(),this.dispatchEvent(new CustomEvent(`transition-end`,{bubbles:!0}))},this._duration())}_newChildFirst(e){let t=this._children();return t.indexOf(this._visible)<t.indexOf(e)}_effectiveType(e){let t=e;return t!==`none`&&(this._reducedMotion()?t=this.hhomogeneous&&this.vhomogeneous?`crossfade`:`none`:this.getAttribute(`dir`)===`rtl`&&(t=Xn[t]??t)),t}_reducedMotion(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}_render(){if(this._initialized){for(let e of this._children()){let t=e===this._visible;e.classList.toggle(`visible-page`,t),e.classList.toggle(`transitioning-in`,t&&this._running),e.classList.toggle(`transitioning-out`,!t&&e===this._lastVisible&&this._running),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}this.style.setProperty(`--stack-transition-duration`,`${this._duration()}ms`)}}};customElements.define(`gtk-stack`,GtkStack);var GtkStackSidebar=class extends HTMLElement{_stack=null;_list;_initialized=!1;_rows=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this._list=document.createElement(`div`),this._list.className=`adw-stack-sidebar-list navigation-sidebar`,this._list.setAttribute(`role`,`listbox`),this._list.setAttribute(`aria-label`,`Sidebar`),this.replaceChildren(this._list),this.classList.add(`sidebar`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){!this._initialized||e!==`stack`||this.setStack(n===null?null:this._resolve(n))}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_pages(){return this._stack?.pages??[]}_visible(e){return e.visible&&e.title!==null}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._rows.length&&(this._list.replaceChildren(),this._rows=e.map(()=>this._buildRow()),this._list.append(...this._rows));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._rows[n];if(!r)return;let i=r.querySelector(`.adw-stack-sidebar-title`);i&&(i.textContent=e.title??``),r.hidden=!this._visible(e),r.classList.toggle(`needs-attention`,e.needsAttention),r.classList.toggle(`selected`,n===t),r.setAttribute(`aria-selected`,String(n===t))})}_buildRow(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-sidebar-row`,e.setAttribute(`role`,`link`);let t=document.createElement(`span`);return t.className=`adw-stack-sidebar-title`,e.appendChild(t),e.addEventListener(`click`,()=>this._onRowActivated(e)),e}_onRowActivated(e){let t=this._rows.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}};customElements.define(`gtk-stack-sidebar`,GtkStackSidebar);var GtkStackSwitcher=class extends HTMLElement{_stack=null;_initialized=!1;_nodes=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`,`orientation`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.getAttribute(`orientation`)!==e&&this.setAttribute(`orientation`,e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this.setAttribute(`role`,`tablist`),this.classList.add(`linked`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`orientation`){this._render(),this.dispatchEvent(new CustomEvent(`notify::orientation`,{bubbles:!0,detail:{orientation:this.orientation}}));return}this.setStack(n===null?null:this._resolve(n))}}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_visible(e){return e.visible&&(e.title!==null||e.iconName!==null)}_pages(){return this._stack?.pages??[]}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._nodes.length&&(this.replaceChildren(),this._nodes=e.map(()=>this._buildButton()),this.append(...this._nodes.map(e=>e.button)));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._nodes[n];if(!r)return;r.button.hidden=!this._visible(e),r.button.classList.toggle(`active`,n===t),r.button.setAttribute(`aria-selected`,String(n===t)),r.button.classList.toggle(`needs-attention`,e.needsAttention);let i=e.iconName!==null,a=e.title!==null;r.icon.hidden=!i,r.label.hidden=!a,r.label.textContent=e.title??``,r.button.dataset.buttonMode=i?a?`both`:`icon`:`text`,i?(r.icon.setAttribute(`icon-name`,e.iconName),this.title=e.title??``):(r.icon.removeAttribute(`icon-name`),this.removeAttribute(`title`))}),this._render()}_buildButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-switcher-button`,e.setAttribute(`role`,`tab`);let t=document.createElement(`span`);t.className=`adw-stack-switcher-icon`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);return n.className=`adw-stack-switcher-title`,e.append(t,n),e.addEventListener(`click`,()=>this._onToggled(e)),{button:e,label:n,icon:t}}_onToggled(e){let t=this._nodes.findIndex(t=>t.button===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}_render(){this.setAttribute(`aria-orientation`,this.orientation)}};customElements.define(`gtk-stack-switcher`,GtkStackSwitcher);var GtkText=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`text`,`editable`,`placeholder-text`,`max-length`,`visibility`,`propagate-text-width`]}get text(){return this._input?this._input.value:this.getAttribute(`text`)??``}set text(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`text`,t),this._resizeToText()}get editable(){return readBooleanAttribute(this,`editable`,!0)}set editable(e){writeBooleanAttribute(this,`editable`,e,!0)}get placeholderText(){return this.getAttribute(`placeholder-text`)??``}set placeholderText(e){this.setAttribute(`placeholder-text`,e??``)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(S,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get visibility(){return readBooleanAttribute(this,`visibility`,!0)}set visibility(e){writeBooleanAttribute(this,`visibility`,e,!0)}get propagateTextWidth(){return readBooleanAttribute(this,`propagate-text-width`,!1)}set propagateTextWidth(e){writeBooleanAttribute(this,`propagate-text-width`,e,!1)}get textLength(){return entryTextLength(this.text)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._maxLength=Number(this.getAttribute(`max-length`)??0);let e=document.createElement(`input`);e.className=`adw-text`,e.type=this.visibility?`text`:`password`,e.value=clampEntryText(this.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderText,e.readOnly=!this.editable,e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._resizeToText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{text:e.value}}))}),this._input=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){if(!this._initialized){e===`max-length`&&(this._maxLength=Number(n??0));return}e===`text`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`?this._input.placeholder=n??``:e===`max-length`?(this._maxLength=Number(n??0),this._input.value=clampEntryText(this._input.value,this._maxLength)):e===`editable`?this._input.readOnly=!this.editable:e===`visibility`&&(this._input.type=this.visibility?`text`:`password`),this._resizeToText(),this._reflectReadOnly()}_render(){this._resizeToText(),this._reflectReadOnly()}_reflectReadOnly(){this.classList.toggle(`read-only`,!this.editable)}_resizeToText(){let e=this.propagateTextWidth;this.classList.toggle(`propagate-text-width`,e),this._input&&e&&(this._input.size=Math.max(1,entryTextLength(this._input.value)))}};function readBooleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`}function writeBooleanAttribute(e,t,n,r){n===r?e.removeAttribute(t):e.setAttribute(t,n?`true`:`false`)}customElements.define(`gtk-text`,GtkText);const Qn=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Qn.includes(e??``)?e:`none`}const $n={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends HTMLElement{_area;_initialized=!1;static get observedAttributes(){return[`text`,`editable`,`wrap-mode`,`justification`,`monospace`,`accepts-tab`,`cursor-visible`,`top-margin`,`bottom-margin`,`left-margin`,`right-margin`]}get text(){return this._area?this._area.value:this.getAttribute(`text`)??this._seedText()}set text(e){this._area?this._area.value=e??``:this.setAttribute(`text`,e??``)}get editable(){return this._bool(`editable`,!0)}set editable(e){this._setBool(`editable`,e,!0)}get wrapMode(){return normalizeWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get justification(){return normalizeLabelJustify(this.getAttribute(`justification`))}set justification(e){this.setAttribute(`justification`,e)}get monospace(){return this._bool(`monospace`,!1)}set monospace(e){this._setBool(`monospace`,e,!1)}get acceptsTab(){return this._bool(`accepts-tab`,!0)}set acceptsTab(e){this._setBool(`accepts-tab`,e,!0)}get cursorVisible(){return this._bool(`cursor-visible`,!0)}set cursorVisible(e){this._setBool(`cursor-visible`,e,!0)}get topMargin(){return this._margin(`top-margin`)}set topMargin(e){this.setAttribute(`top-margin`,String(e))}get bottomMargin(){return this._margin(`bottom-margin`)}set bottomMargin(e){this.setAttribute(`bottom-margin`,String(e))}get leftMargin(){return this._margin(`left-margin`)}set leftMargin(e){this.setAttribute(`left-margin`,String(e))}get rightMargin(){return this._margin(`right-margin`)}set rightMargin(e){this.setAttribute(`right-margin`,String(e))}get textarea(){return this._area}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`textarea`);e.className=`adw-text-view`,e.value=this.getAttribute(`text`)??this._seedText(),e.spellcheck=!1,e.addEventListener(`input`,()=>this._emitChanged()),e.addEventListener(`keydown`,t=>{if(t.key!==`Tab`||!this.acceptsTab)return;t.preventDefault();let n=e.selectionStart??e.value.length,r=e.selectionEnd??n;e.setRangeText(` `,n,r,`end`),this._emitChanged()}),this._area=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(e===`text`?this._area.value=n??``:e===`editable`&&(this._area.readOnly=!this.editable),this._render())}_render(){let e=this.wrapMode,t=this._area;t.style.whiteSpace=$n[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=un[this.justification],t.style.caretColor=this.cursorVisible?``:`transparent`,this.classList.toggle(`monospace`,this.monospace),t.style.setProperty(`--adw-text-view-margin-top`,`${this.topMargin}px`),t.style.setProperty(`--adw-text-view-margin-end`,`${this.rightMargin}px`),t.style.setProperty(`--adw-text-view-margin-bottom`,`${this.bottomMargin}px`),t.style.setProperty(`--adw-text-view-margin-start`,`${this.leftMargin}px`)}_seedText(){return this.textContent}_emitChanged(){this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:{text:this._area.value}}))}_bool(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBool(e,t,n){t===n?this.removeAttribute(e):this.setAttribute(e,t?`true`:`false`)}_margin(e){let t=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(t)?Math.max(0,t):0}};customElements.define(`gtk-text-view`,GtkTextView);var GtkToggleButton=class extends GtkButton{static signals={...GtkButton.signals,toggled:`toggled`,"notify::active":`notify::active`};_wired=!1;_groupNext=null;_groupPrev=null;_reflectingGroup=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`active`,`group`]}get active(){return this.hasAttribute(`active`)}set active(e){let t=!!e;this.active!==t&&(t&&this._grouped&&this._clearGroup(),this.toggleAttribute(`active`,t))}set group(e){this._reflectingGroup=!0,e===null||e.id===``?this.removeAttribute(`group`):this.setAttribute(`group`,e.id),this._reflectingGroup=!1,this._setGroup(e)}get _grouped(){return this._groupNext!==null||this._groupPrev!==null}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>{this.active&&this._grouped||(this.active=!this.active)}),this.hasAttribute(`group`)&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)))}attributeChangedCallback(e){e===`group`&&!this._reflectingGroup&&this.isConnected&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)),super.attributeChangedCallback(),!(e!==`active`||!this.isConnected)&&(this.active&&this._grouped&&this._clearGroup(),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_setGroup(e){if(e===this){console.error(`<gtk-toggle-button> cannot be its own group; the group is unchanged.`);return}if(e===null)this._groupPrev&&(this._groupPrev._groupNext=this._groupNext),this._groupNext&&(this._groupNext._groupPrev=this._groupPrev),this._groupNext=null,this._groupPrev=null;else{if(this._groupNext===e)return;if(this._groupPrev=null,e._groupPrev){let t=e._groupPrev;t._groupNext=this,this._groupPrev=t}e._groupPrev=this,this._groupNext=e}this.dispatchEvent(new CustomEvent(`notify::group`,{bubbles:!0}))}_clearGroup(){let e=this._groupFirst();for(let t=e;t!==null;t=t._groupNext)t!==this&&(t.active=!1)}_groupFirst(e=0){let t=this._groupPrev;return t===null||e>1024?this:t._groupFirst(e+1)}decorate(e){e.classList.toggle(`checked`,this.active),e.setAttribute(`aria-pressed`,String(this.active))}};customElements.define(`gtk-toggle-button`,GtkToggleButton);function resolveGroupTarget(e,t){if(e===null||e===``)return null;let n=document.getElementById(e);return n===null?(console.error(`<gtk-toggle-button group="${e}"> names no element; the group is unchanged.`),null):(n instanceof GtkToggleButton||customElements.upgrade(n),!(n instanceof GtkToggleButton)||n===t?(console.error(`<gtk-toggle-button group="${e}"> names no other toggle button; the group is unchanged.`),null):n)}var GtkTreeExpander=class extends HTMLElement{_ornaments=[];_expandTimer=null;_initialized=!1;static get observedAttributes(){return[`hide-expander`,`indent-for-depth`,`indent-for-icon`,`depth`,`expandable`,`expanded`]}get hideExpander(){return this.hasAttribute(`hide-expander`)}set hideExpander(e){this.toggleAttribute(`hide-expander`,!!e)}get indentForDepth(){return this.getAttribute(`indent-for-depth`)!==`false`}set indentForDepth(e){this.setAttribute(`indent-for-depth`,String(!!e))}get indentForIcon(){return this.getAttribute(`indent-for-icon`)!==`false`}set indentForIcon(e){this.setAttribute(`indent-for-icon`,String(!!e))}get depth(){let e=Number.parseInt(this.getAttribute(`depth`)??``,10);return Number.isFinite(e)&&e>0?e:0}set depth(e){this.setAttribute(`depth`,String(e))}get expandable(){return this.hasAttribute(`expandable`)}set expandable(e){this.toggleAttribute(`expandable`,!!e)}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get layout(){return treeExpanderLayout({depth:this.depth,expandable:this.expandable,expanded:this.expanded},{hideExpander:this.hideExpander,indentForDepth:this.indentForDepth,indentForIcon:this.indentForIcon})}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`tabindex`)||(this.tabIndex=0),this._wire()),this.setAttribute(`role`,`button`),this._render()}_wire(){this.addEventListener(`keydown`,e=>{let t=treeExpanderAction(e.key,{ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,rtl:globalThis.getComputedStyle(this).direction===`rtl`});t!==`none`&&(e.preventDefault(),this.expanded=treeExpanderExpanded(this.expanded,t))}),this.addEventListener(`dragenter`,()=>{this.expanded||this._expandTimer!==null||(this._expandTimer=setTimeout(()=>{this._expandTimer=null,this.expanded=!0},500))});for(let e of[`dragleave`,`drop`])this.addEventListener(e,()=>this._cancelExpandTimer())}disconnectedCallback(){this._cancelExpandTimer()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`expanded`&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}})))}_cancelExpandTimer(){this._expandTimer!==null&&(clearTimeout(this._expandTimer),this._expandTimer=null)}_render(){for(let e of this._ornaments)e.remove();this._ornaments=[];let e=this.layout,t=this.firstChild;for(let n=0;n<e.indents;n++){let e=document.createElement(`span`);e.className=`adw-tree-expander-indent`,e.setAttribute(`aria-hidden`,`true`),this.insertBefore(e,t),this._ornaments.push(e)}if(e.expander===`none`)this.removeAttribute(`aria-expanded`);else{let n=createGtkImage(`go-next`,`adw-tree-expander-icon`);n.classList.toggle(`expanded`,e.expander===`expanded`),n.addEventListener(`click`,e=>{e.stopPropagation(),this.expanded=!this.expanded}),this.insertBefore(n,t),this._ornaments.push(n),this.setAttribute(`aria-expanded`,String(e.expander===`expanded`))}this.setAttribute(`aria-level`,String(e.level))}};customElements.define(`gtk-tree-expander`,GtkTreeExpander);var GtkVideo=class extends HTMLElement{_initialized=!1;_overlayIcon;_controlsRevealer;_media=null;mediaListeners=[];_hideTimer=null;_hasStream=!1;_error=null;_ended=!1;_playing=!1;static get observedAttributes(){return[`autoplay`,`graphics-offload`,`loop`]}get autoplay(){return this.hasAttribute(`autoplay`)}set autoplay(e){this._write(`autoplay`,!!e),this._syncMedia()}get loop(){return this.hasAttribute(`loop`)}set loop(e){this._write(`loop`,!!e),this._syncMedia()}get graphicsOffload(){return this.hasAttribute(`graphics-offload`)}set graphicsOffload(e){this._write(`graphics-offload`,!!e)}get media(){return this._media}get playing(){return this._playing}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get controlsRevealed(){return this._controlsRevealer?.classList.contains(`revealed`)??!1}_write(e,t){this.toggleAttribute(e,t)}connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0,this._overlayIcon=document.createElement(`button`),this._overlayIcon.className=`adw-video-overlay-icon osd circular`,this._overlayIcon.type=`button`,this._overlayIcon.setAttribute(`aria-label`,`Play`),this._overlayIcon.title=`Play`,this._overlayIcon.addEventListener(`click`,()=>this._overlayClicked()),this._controlsRevealer=document.createElement(`div`),this._controlsRevealer.className=`adw-video-controls-revealer`,this._wrap(),this._adoptMedia(),this.addEventListener(`pointermove`,this._onPointerMove)}_wrap(){let e=this.querySelector(`:scope > video`),t=[...this.children].filter(t=>t!==e),n=document.createElement(`div`);n.className=`adw-video-surface`,this.replaceChildren(n),e&&n.appendChild(e),n.append(this._overlayIcon),this._controlsRevealer.append(...t),n.append(this._controlsRevealer)}_adoptMedia(){let e=this.querySelector(`:scope > .adw-video-surface > video`)??null;if(e===this._media){this._syncMedia(),this._updateOverlayIcon();return}if(this._media&&this._detachMedia(this._media),this._media=e,this._hasStream=e!==null,e){let onPlay=()=>this._updatePlaying(!0),onPause=()=>this._updatePlaying(!1),onEnded=()=>{this._ended=!0,this._updateOverlayIcon()},onError=()=>{this._error=e.error?.message??`Playback failed`,this._updateOverlayIcon()},onMetadata=()=>{this._ended=!1,this._error=null,this._updateOverlayIcon()},onPrepared=()=>{this.autoplay&&e.play().catch(()=>{})};this.mediaListeners=[[`play`,onPlay],[`pause`,onPause],[`ended`,onEnded],[`error`,onError],[`loadedmetadata`,onMetadata],[`loadeddata`,onPrepared]];for(let[t,n]of this.mediaListeners)e.addEventListener(t,n)}this._syncMedia(),this._updateOverlayIcon()}_detachMedia(e){for(let[t,n]of this.mediaListeners)e.removeEventListener(t,n);this.mediaListeners=[]}_syncMedia(){this._media&&(this._media.loop=this.loop,this._media.autoplay=!1,this.classList.toggle(`graphics-offload`,this.graphicsOffload))}_overlayClicked(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}revealControls(){this._controlsRevealer&&(this._controlsRevealer.classList.add(`revealed`),this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>this._hideControls(),3e3))}_hideControls(){this._hideTimer=null,this._controlsRevealer?.classList.remove(`revealed`)}_onPointerMove=()=>{this.revealControls()};attributeChangedCallback(e){this._initialized&&(e===`graphics-offload`&&this._syncMedia(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`autoplay`:return this.autoplay;case`loop`:return this.loop;default:return this.graphicsOffload}}_updatePlaying(e){this._playing=e,this._overlayIcon&&(this._overlayIcon.hidden=e),this.classList.toggle(`playing`,e),this.dispatchEvent(new CustomEvent(`notify::playing`,{bubbles:!0,detail:{playing:e}}))}_updateOverlayIcon(){if(!this._overlayIcon)return;let e,t=null;this._hasStream?this._error===null?e=this._ended?`media-playlist-repeat-symbolic`:`media-playback-start-symbolic`:(e=`dialog-error-symbolic`,t=this._error):e=`media-eject-symbolic`;let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,e),this._overlayIcon.replaceChildren(n),t?this._overlayIcon.title=t:this._overlayIcon.title=``,this._overlayIcon.classList.toggle(`error`,this._error!==null)}disconnectedCallback(){this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=null}};customElements.define(`gtk-video`,GtkVideo);const er=[`horizontal`,`vertical`];function axisAdjustment(e,t){let n=t===`vertical`,r=n?e.clientHeight:e.clientWidth,i=n?e.scrollHeight:e.scrollWidth;return normalizeAdjustment({value:n?e.scrollTop:e.scrollLeft,lower:0,upper:Math.max(i,r),stepIncrement:r*.1,pageIncrement:r*.9,pageSize:r})}var GtkViewport=class extends HTMLElement{_observer=null;_watch=null;static get observedAttributes(){return[`scroll-to-focus`]}get hadjustment(){return axisAdjustment(this,`horizontal`)}get vadjustment(){return axisAdjustment(this,`vertical`)}get scrollToFocus(){return this.getAttribute(`scroll-to-focus`)!==`false`}set scrollToFocus(e){this.setAttribute(`scroll-to-focus`,e?`true`:`false`)}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`scroll`,this._announce,{passive:!0}),this._observe(),this._bindFocus()}disconnectedCallback(){this.removeEventListener(`scroll`,this._announce),this.removeEventListener(`focusin`,this._onFocusIn)}_observe(){if(this._observer===null){this._observer=new ResizeObserver(()=>this._announce()),this._observer.observe(this);for(let e of this.children)this._observer.observe(e);this._watch=new MutationObserver(()=>{for(let e of this.children)this._observer?.observe(e);this._announce()}),this._watch.observe(this,{childList:!0})}}attributeChangedCallback(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this.scrollToFocus}})),this.isConnected&&this._bindFocus()}scrollAxis(e,t){let n=axisAdjustment(this,e),r=clampAdjustmentValue(n,t);r!==n.value&&(e===`vertical`?this.scrollTop=r:this.scrollLeft=r,this._announce())}scrollTo(e,t){if(!(e instanceof Element)&&e!==null){Element.prototype.scrollTo.call(this,e,t);return}let n=e;if(n!==null&&n!==this&&typeof n.scrollIntoView==`function`){n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),this._announce();return}for(let e of er){let t=axisAdjustment(this,e),n=clampAdjustmentValue(t,t.value);n!==t.value&&(e===`vertical`?this.scrollTop=n:this.scrollLeft=n)}this._announce()}get adjustments(){return{hadjustment:this.hadjustment,vadjustment:this.vadjustment}}_announce=()=>{this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:this.adjustments}))};_bindFocus(){this.removeEventListener(`focusin`,this._onFocusIn),this.scrollToFocus&&this.addEventListener(`focusin`,this._onFocusIn)}_onFocusIn=e=>{let t=e.target;!(t instanceof Element)||t===this||this.scrollTo(t)}};customElements.define(`gtk-viewport`,GtkViewport);const tr={"double-click":{attribute:`double-click-action`,fallback:`toggle-maximize`},"middle-click":{attribute:`middle-click-action`,fallback:`none`},"right-click":{attribute:`right-click-action`,fallback:`menu`}},nr={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},rr=new Set([`none`,`toggle-maximize`,`lower`,`minimize`,`menu`]);function gestureOf(e,t){switch(e){case 0:return t>1?`double-click`:null;case 1:return`middle-click`;case 2:return`right-click`;default:return null}}var GtkWindowHandle=class extends HTMLElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=tr[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:rr.has(r)?r:`none`}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this._drag=null}_perform(e,t,n){let r=this.actionFor(e),i=r===`none`?null:nr[r],a={action:r,gesture:e,windowAction:i,x:t,y:n};this.dispatchEvent(new CustomEvent(`titlebar-action`,{bubbles:!0,detail:a})),i!==null&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:a}))}_onClick=e=>{this._drag=null;let t=gestureOf(e.button,e.detail);t!==null&&this._perform(t,e.clientX,e.clientY)};_onPointerDown=e=>{e.detail>1||(this._drag={pointerId:e.pointerId,x:e.clientX,y:e.clientY})};_onPointerMove=e=>{let t=this._drag;t===null||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)<=1||(this._drag=null,this.dispatchEvent(new CustomEvent(`window-move`,{bubbles:!0,detail:{x:e.clientX,y:e.clientY}})))}};customElements.define(`gtk-window-handle`,GtkWindowHandle);var AdwCard=class extends HTMLElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends HTMLElement{_captionEl;_scrollEl;_tableEl;_columns=[];_rows=[];_initialized=!1;static get observedAttributes(){return[`columns`,`rows`,`caption`,`interactive`]}get columns(){return this._columns}set columns(e){this._columns=normalizeDataGridColumns(e),this._initialized&&this._render()}get rows(){return this._rows}set rows(e){this._rows=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._render()}get caption(){return this.getAttribute(`caption`)??``}set caption(e){e?this.setAttribute(`caption`,e):this.removeAttribute(`caption`)}get interactive(){return this.hasAttribute(`interactive`)}set interactive(e){e?this.setAttribute(`interactive`,``):this.removeAttribute(`interactive`)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-data-grid`),this._captionEl=document.createElement(`div`),this._captionEl.className=`adw-data-grid-caption`,this._captionEl.hidden=!0,this._scrollEl=document.createElement(`div`),this._scrollEl.className=`adw-data-grid-scroll`,this._tableEl=document.createElement(`div`),this._tableEl.className=`adw-data-grid-table`,this._tableEl.setAttribute(`role`,`table`),this._scrollEl.appendChild(this._tableEl),this._columns.length===0&&(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns)),this._rows.length===0&&(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[])),this.replaceChildren(this._captionEl,this._scrollEl),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`columns`?(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns),this._render()):e===`rows`?(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[]),this._render()):e===`caption`?this._renderCaption():e===`interactive`&&this._render())}_parseJsonAttr(e,t){let n=this.getAttribute(e);if(!n)return t(void 0);try{return t(JSON.parse(n))}catch{return t(void 0)}}_renderCaption(){let e=this.getAttribute(`caption`)??``;this._captionEl.textContent=e,this._captionEl.hidden=e.length===0}_trackTemplate(){return dataGridTrackTemplate(dataGridTracks(this._columns))}_columnClasses(e){return dataGridColumnClasses(e).join(` `)}_render(){if(!this._tableEl||(this._renderCaption(),this._tableEl.style.gridTemplateColumns=this._trackTemplate(),this._tableEl.replaceChildren(),this._columns.length===0))return;let e=document.createElement(`div`);e.className=`adw-data-grid-row header`,e.setAttribute(`role`,`row`);for(let t of this._columns){let n=document.createElement(`div`);n.className=`${this._columnClasses(t)} header-cell`,n.setAttribute(`role`,`columnheader`),n.textContent=t.label??t.key,e.appendChild(n)}this._tableEl.appendChild(e);let t=this.hasAttribute(`interactive`);this._rows.forEach((e,n)=>{let r=normalizeDataGridVariant(e.variant),i=document.createElement(`div`);if(i.className=`adw-data-grid-row variant-${r}`,i.setAttribute(`role`,`row`),r===`section`){let t=this._columns[0]?.key??``,n=document.createElement(`div`);n.className=`adw-data-grid-cell align-start section-cell`,n.setAttribute(`role`,`cell`),n.style.gridColumn=`1 / -1`,n.textContent=dataGridCellText(e[t]),i.appendChild(n)}else for(let t of this._columns){let n=document.createElement(`div`);n.className=this._columnClasses(t),n.setAttribute(`role`,`cell`),n.textContent=dataGridCellText(e[t.key]),i.appendChild(n)}dataGridRowInteractive(r,e.interactive,t)&&(i.classList.add(`interactive`),i.tabIndex=0,i.addEventListener(`click`,()=>this._activate(n,e)),i.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this._activate(n,e))})),this._tableEl.appendChild(i)})}_activate(e,t){this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{index:e,row:t}}))}};customElements.define(`adw-data-grid`,AdwDataGrid);var AdwShortcutsSection=class extends HTMLElement{_initialized=!1;_bodyEl;_titleEl;static get observedAttributes(){return[`title`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get items(){return[...this._bodyEl.children]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-shortcuts-section-title`,this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-shortcuts-section-body`,this.setAttribute(`role`,`group`),bindSlottedChildren(this,[{into:this._bodyEl}]).install(this._titleEl,this._bodyEl),this._render())}attributeChangedCallback(e){this._initialized&&e===`title`&&this._render()}_render(){let e=this.title;this._titleEl.textContent=e,this._titleEl.hidden=e.length===0}};customElements.define(`adw-shortcuts-section`,AdwShortcutsSection);const ir=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends HTMLElement{_initialized=!1;_titleEl;_subtitleEl;_labelEl;static get observedAttributes(){return[`title`,`subtitle`,`accelerator`,`action-name`,`direction`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get subtitle(){return this.getAttribute(`subtitle`)??``}set subtitle(e){this.setAttribute(`subtitle`,e)}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){e?this.setAttribute(`accelerator`,e):this.removeAttribute(`accelerator`)}get actionName(){return this.getAttribute(`action-name`)??``}set actionName(e){e?this.setAttribute(`action-name`,e):this.removeAttribute(`action-name`)}get direction(){let e=this.getAttribute(`direction`);return e&&ir.includes(e)?e:`none`}set direction(e){this.setAttribute(`direction`,e)}get hasAccelerator(){return this.accelerator.length>0}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`listitem`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-shortcuts-item-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-shortcuts-item-subtitle`,this._labelEl=document.createElement(`adw-shortcut-label`),this._labelEl.className=`adw-shortcuts-item-label`,this.replaceChildren(this._titleEl,this._subtitleEl,this._labelEl),this._render())}attributeChangedCallback(e){this._initialized&&(e===`direction`||e===`accelerator`||e===`action-name`?this._render():e===`title`?this._titleEl.textContent=this.title:e===`subtitle`&&this._renderSubtitle())}_render(){this._titleEl.textContent=this.title,this._renderSubtitle(),this._labelEl.setAttribute(`accelerator`,this.accelerator),this._labelEl.hidden=!this.hasAccelerator;let e=this.direction;if(e!==`none`){let t=getComputedStyle(this).direction;this.hidden=t!==e}else this.hidden=!1}_renderSubtitle(){let e=this.subtitle;this._subtitleEl.textContent=e,this._subtitleEl.hidden=e.length===0}};if(customElements.define(`adw-shortcuts-item`,AdwShortcutsItem),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
8
8
  :root {
9
9
  --icon-go-down: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%201%205%20c%200%20-0.265625%200.105469%20-0.519531%200.292969%20-0.707031%20c%200.390625%20-0.390625%201.023437%20-0.390625%201.414062%200%20l%205.292969%205.292969%20l%205.292969%20-5.292969%20c%200.390625%20-0.390625%201.023437%20-0.390625%201.414062%200%20c%200.1875%200.1875%200.292969%200.441406%200.292969%200.707031%20s%20-0.105469%200.519531%20-0.292969%200.707031%20l%20-6%206%20c%20-0.390625%200.390625%20-1.023437%200.390625%20-1.414062%200%20l%20-6%20-6%20c%20-0.1875%20-0.1875%20-0.292969%20-0.441406%20-0.292969%20-0.707031%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
10
10
  --icon-sidebar-show: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cg%20fill%3D'currentColor'%3E%20%3Cpath%20d%3D'm%206%2013%20v%20-10%20h%20-3%20c%20-0.550781%200%20-1%200.449219%20-1%201%20v%208%20c%200%200.550781%200.449219%201%201%201%20z%20m%200%200'%20fill-opacity%3D'0.34902'%2F%3E%20%3Cpath%20d%3D'm%203%201%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%208%20c%200%201.644531%201.355469%203%203%203%20h%2010%20c%201.644531%200%203%20-1.355469%203%20-3%20v%20-8%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20z%20m%200%202%20h%203%20v%2010%20h%20-3%20c%20-0.570312%200%20-1%20-0.429688%20-1%20-1%20v%20-8%20c%200%20-0.570312%200.429688%20-1%201%20-1%20z%20m%204%200%20h%206%20c%200.570312%200%201%200.429688%201%201%20v%208%20c%200%200.570312%20-0.429688%201%20-1%201%20h%20-6%20z%20m%200%200'%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E");
@@ -2072,7 +2072,8 @@ adw-card,
2072
2072
  box-shadow: inset 6px 0 6px -6px color-mix(in srgb, currentColor 6%, transparent);
2073
2073
  }
2074
2074
 
2075
- adw-window {
2075
+ adw-window,
2076
+ adw-application-window {
2076
2077
  display: flex;
2077
2078
  flex-direction: column;
2078
2079
  background-color: var(--window-bg-color);
@@ -2085,7 +2086,9 @@ adw-window {
2085
2086
  outline: 1px solid rgba(255, 255, 255, 0.07);
2086
2087
  outline-offset: -1px;
2087
2088
  }
2088
- adw-window.maximized, adw-window.fullscreen {
2089
+ adw-window.maximized, adw-window.fullscreen,
2090
+ adw-application-window.maximized,
2091
+ adw-application-window.fullscreen {
2089
2092
  --window-radius: 0px;
2090
2093
  outline: none;
2091
2094
  box-shadow: none;
@@ -2099,6 +2102,11 @@ adw-window.maximized, adw-window.fullscreen {
2099
2102
  min-width: 0;
2100
2103
  }
2101
2104
 
2105
+ .adw-window-content > gtk-box {
2106
+ flex: 1 1 auto;
2107
+ min-height: 0;
2108
+ }
2109
+
2102
2110
  gtk-window,
2103
2111
  gtk-application-window {
2104
2112
  display: flex;
@@ -2240,7 +2248,8 @@ adw-header-bar .adw-header-btn:active {
2240
2248
  }
2241
2249
 
2242
2250
  .devel adw-header-bar,
2243
- adw-window.devel adw-header-bar {
2251
+ adw-window.devel adw-header-bar,
2252
+ adw-application-window.devel adw-header-bar {
2244
2253
  background-image: linear-gradient(to bottom, transparent 0%, var(--headerbar-bg-color) 100%), repeating-linear-gradient(116.565deg, color-mix(in srgb, currentColor 5%, transparent) 0 32px, transparent 32px 64px);
2245
2254
  }
2246
2255
 
@@ -3313,6 +3322,9 @@ adw-toggle-group {
3313
3322
  border-radius: var(--button-radius);
3314
3323
  background-color: var(--button-bg-color);
3315
3324
  }
3325
+ adw-toggle-group[disabled] {
3326
+ background-color: color-mix(in srgb, var(--button-bg-color) var(--disabled-opacity), transparent);
3327
+ }
3316
3328
  adw-toggle-group .adw-toggle-group-inner {
3317
3329
  display: flex;
3318
3330
  align-items: stretch;
@@ -3351,6 +3363,13 @@ adw-toggle-group .adw-toggle:focus-visible {
3351
3363
  outline: 2px solid var(--accent-color);
3352
3364
  outline-offset: 1px;
3353
3365
  }
3366
+ adw-toggle-group .adw-toggle:disabled {
3367
+ opacity: var(--disabled-opacity);
3368
+ cursor: default;
3369
+ }
3370
+ adw-toggle-group .adw-toggle:disabled:hover, adw-toggle-group .adw-toggle:disabled:active {
3371
+ background-color: transparent;
3372
+ }
3354
3373
  adw-toggle-group .adw-toggle.active {
3355
3374
  background-color: var(--active-toggle-bg-color);
3356
3375
  color: var(--active-toggle-fg-color);
@@ -3359,6 +3378,9 @@ adw-toggle-group .adw-toggle.active {
3359
3378
  adw-toggle-group .adw-toggle.active:hover {
3360
3379
  background-color: var(--active-toggle-bg-color);
3361
3380
  }
3381
+ adw-toggle-group .adw-toggle.active:disabled {
3382
+ box-shadow: none;
3383
+ }
3362
3384
  adw-toggle-group.round {
3363
3385
  border-radius: 17px;
3364
3386
  }
@@ -5246,6 +5268,9 @@ adw-preferences-row {
5246
5268
  adw-preferences-row .adw-row-title {
5247
5269
  user-select: none;
5248
5270
  }
5271
+ adw-preferences-row .adw-row-title:has(~ .adw-preferences-row-content[hidden]) {
5272
+ flex: 1 1 auto;
5273
+ }
5249
5274
  adw-preferences-row .adw-preferences-row-content {
5250
5275
  display: flex;
5251
5276
  align-items: center;
@@ -6290,6 +6315,10 @@ adw-combo-row:last-child {
6290
6315
  border-bottom: none;
6291
6316
  }
6292
6317
 
6318
+ [data-row-tooltip] {
6319
+ align-self: stretch;
6320
+ }
6321
+
6293
6322
  .adw-row-text {
6294
6323
  display: flex;
6295
6324
  flex-direction: column;
@@ -6324,7 +6353,10 @@ adw-combo-row:last-child {
6324
6353
  flex-shrink: 0;
6325
6354
  }
6326
6355
 
6327
- adw-action-row {
6356
+ adw-action-row,
6357
+ adw-switch-row,
6358
+ adw-combo-row,
6359
+ adw-spin-row {
6328
6360
  display: flex;
6329
6361
  align-items: center;
6330
6362
  gap: var(--spacing-m);
@@ -6333,46 +6365,90 @@ adw-action-row {
6333
6365
  border-bottom: 1px solid var(--card-shade-color);
6334
6366
  color: var(--card-fg-color);
6335
6367
  }
6336
- adw-action-row:last-child {
6368
+ adw-action-row:last-child,
6369
+ adw-switch-row:last-child,
6370
+ adw-combo-row:last-child,
6371
+ adw-spin-row:last-child {
6337
6372
  border-bottom: none;
6338
6373
  }
6339
- adw-action-row.activatable {
6374
+ adw-action-row.activatable,
6375
+ adw-switch-row.activatable,
6376
+ adw-combo-row.activatable,
6377
+ adw-spin-row.activatable {
6340
6378
  cursor: pointer;
6341
6379
  }
6342
- adw-action-row.activatable:hover {
6380
+ adw-action-row.activatable:hover,
6381
+ adw-switch-row.activatable:hover,
6382
+ adw-combo-row.activatable:hover,
6383
+ adw-spin-row.activatable:hover {
6343
6384
  background-color: var(--button-bg-color);
6344
6385
  }
6345
- adw-action-row.activatable:active {
6386
+ adw-action-row.activatable:active,
6387
+ adw-switch-row.activatable:active,
6388
+ adw-combo-row.activatable:active,
6389
+ adw-spin-row.activatable:active {
6346
6390
  background-color: var(--button-active-color);
6347
6391
  }
6348
6392
  adw-action-row .adw-action-row-prefix,
6349
- adw-action-row .adw-action-row-suffix {
6393
+ adw-action-row .adw-action-row-suffix,
6394
+ adw-action-row .adw-switch-row-prefix,
6395
+ adw-switch-row .adw-action-row-prefix,
6396
+ adw-switch-row .adw-action-row-suffix,
6397
+ adw-switch-row .adw-switch-row-prefix,
6398
+ adw-combo-row .adw-action-row-prefix,
6399
+ adw-combo-row .adw-action-row-suffix,
6400
+ adw-combo-row .adw-switch-row-prefix,
6401
+ adw-spin-row .adw-action-row-prefix,
6402
+ adw-spin-row .adw-action-row-suffix,
6403
+ adw-spin-row .adw-switch-row-prefix {
6350
6404
  display: flex;
6351
6405
  align-items: center;
6352
6406
  gap: var(--spacing-xs);
6353
6407
  flex-shrink: 0;
6354
6408
  }
6355
- adw-action-row .adw-action-row-text {
6356
- display: flex;
6357
- flex-direction: column;
6358
- justify-content: center;
6359
- flex: 1 1 auto;
6360
- min-width: 0;
6361
- }
6362
- adw-action-row .adw-row-title {
6409
+ adw-action-row .adw-row-title,
6410
+ adw-switch-row .adw-row-title,
6411
+ adw-combo-row .adw-row-title,
6412
+ adw-spin-row .adw-row-title {
6363
6413
  font-size: var(--font-size-base);
6364
6414
  color: var(--card-fg-color);
6365
- white-space: nowrap;
6366
- overflow: hidden;
6367
- text-overflow: ellipsis;
6415
+ white-space: normal;
6416
+ overflow-wrap: break-word;
6368
6417
  }
6369
- adw-action-row .adw-row-subtitle {
6418
+ adw-action-row .adw-row-subtitle,
6419
+ adw-switch-row .adw-row-subtitle,
6420
+ adw-combo-row .adw-row-subtitle,
6421
+ adw-spin-row .adw-row-subtitle {
6370
6422
  font-size: var(--font-size-small);
6371
6423
  opacity: var(--dim-opacity);
6372
6424
  color: var(--card-fg-color);
6373
- white-space: nowrap;
6425
+ white-space: normal;
6426
+ overflow-wrap: break-word;
6427
+ }
6428
+ adw-action-row .adw-row-text.adw-row-clamp .adw-row-title,
6429
+ adw-action-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6430
+ adw-switch-row .adw-row-text.adw-row-clamp .adw-row-title,
6431
+ adw-switch-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6432
+ adw-combo-row .adw-row-text.adw-row-clamp .adw-row-title,
6433
+ adw-combo-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6434
+ adw-spin-row .adw-row-text.adw-row-clamp .adw-row-title,
6435
+ adw-spin-row .adw-row-text.adw-row-clamp .adw-row-subtitle {
6436
+ display: -webkit-box;
6437
+ -webkit-box-orient: vertical;
6374
6438
  overflow: hidden;
6375
- text-overflow: ellipsis;
6439
+ text-overflow: var(--adw-row-ellipsize-overflow, ellipsis);
6440
+ }
6441
+ adw-action-row .adw-row-text.adw-row-clamp .adw-row-title,
6442
+ adw-switch-row .adw-row-text.adw-row-clamp .adw-row-title,
6443
+ adw-combo-row .adw-row-text.adw-row-clamp .adw-row-title,
6444
+ adw-spin-row .adw-row-text.adw-row-clamp .adw-row-title {
6445
+ -webkit-line-clamp: var(--adw-row-title-lines, 1);
6446
+ }
6447
+ adw-action-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6448
+ adw-switch-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6449
+ adw-combo-row .adw-row-text.adw-row-clamp .adw-row-subtitle,
6450
+ adw-spin-row .adw-row-text.adw-row-clamp .adw-row-subtitle {
6451
+ -webkit-line-clamp: var(--adw-row-subtitle-lines, 1);
6376
6452
  }
6377
6453
 
6378
6454
  adw-action-row.property .adw-row-title,
@@ -6594,6 +6670,7 @@ adw-button-row .adw-button-row-contents {
6594
6670
  justify-content: center;
6595
6671
  gap: var(--spacing-xs);
6596
6672
  min-width: 0;
6673
+ flex: 1 1 auto;
6597
6674
  }
6598
6675
  adw-button-row .adw-button-row-title {
6599
6676
  font-size: var(--font-size-base);
@@ -6662,9 +6739,28 @@ adw-expander-row .adw-expander-row-header:active {
6662
6739
  adw-expander-row .adw-row-title {
6663
6740
  font-size: var(--font-size-base);
6664
6741
  color: var(--card-fg-color);
6665
- white-space: nowrap;
6742
+ white-space: normal;
6743
+ overflow-wrap: break-word;
6744
+ }
6745
+ adw-expander-row .adw-row-subtitle {
6746
+ font-size: var(--font-size-small);
6747
+ opacity: var(--dim-opacity);
6748
+ color: var(--card-fg-color);
6749
+ white-space: normal;
6750
+ overflow-wrap: break-word;
6751
+ }
6752
+ adw-expander-row .adw-row-text.adw-row-clamp .adw-row-title,
6753
+ adw-expander-row .adw-row-text.adw-row-clamp .adw-row-subtitle {
6754
+ display: -webkit-box;
6755
+ -webkit-box-orient: vertical;
6666
6756
  overflow: hidden;
6667
- text-overflow: ellipsis;
6757
+ text-overflow: var(--adw-row-ellipsize-overflow, ellipsis);
6758
+ }
6759
+ adw-expander-row .adw-row-text.adw-row-clamp .adw-row-title {
6760
+ -webkit-line-clamp: var(--adw-row-title-lines, 1);
6761
+ }
6762
+ adw-expander-row .adw-row-text.adw-row-clamp .adw-row-subtitle {
6763
+ -webkit-line-clamp: var(--adw-row-subtitle-lines, 1);
6668
6764
  }
6669
6765
  adw-expander-row .adw-expander-row-header > .adw-row-text {
6670
6766
  flex: 1;
@@ -10426,14 +10522,20 @@ adw-shortcuts-item + adw-shortcuts-item {
10426
10522
  margin-block: auto;
10427
10523
  }
10428
10524
 
10429
- gtk-box:not([orientation=vertical]) > [hexpand],
10430
- gtk-box[orientation=vertical] > [vexpand] {
10525
+ gtk-box:not([orientation=vertical]) > [hexpand]:not([hexpand=false]),
10526
+ gtk-box[orientation=vertical] > [vexpand]:not([vexpand=false]) {
10431
10527
  flex-grow: 1;
10432
10528
  }
10433
10529
 
10530
+ gtk-box:not([orientation=vertical]) > [hexpand=false],
10531
+ gtk-box[orientation=vertical] > [vexpand=false] {
10532
+ flex-grow: 0;
10533
+ flex-basis: auto;
10534
+ }
10535
+
10434
10536
  [hidden] {
10435
10537
  display: none !important;
10436
- }`,document.head.appendChild(e)}followDesktopAppearance();const ir={system:`Follow system`,light:`Light`,dark:`Dark`},ar={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookWebAppearance=class{settings;_root;constructor(e=document.documentElement){this._root=e;let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`)??null;this.settings=new StorybookSettings(()=>t?.matches??!1),this.settings.subscribe(()=>this._apply()),t?.addEventListener(`change`,()=>this.settings.systemChanged()),this._apply()}_apply(){let e=this.settings.colorScheme;this._root.classList.toggle(`theme-dark`,e===`dark`),this._root.classList.toggle(`theme-light`,e===`light`);let t=this.settings.resolvedAccent;t?applyAdwaitaAccent(t,{target:this._root,dark:this.settings.resolvedDark}):clearAdwaitaAccent(this._root)}};function buildSwatch(e,t,n,r){let i=document.createElement(`input`);return i.type=`radio`,i.name=e,i.value=t,i.title=n,i.setAttribute(`aria-label`,n),i.classList.add(`sb-swatch`,...r),i}function buildAppearanceDialog(e){let t=e.settings,n=document.createElement(`adw-preferences-dialog`);n.setAttribute(`title`,`Appearance`);let i=document.createElement(`adw-preferences-page`),a=document.createElement(`adw-preferences-group`);a.setAttribute(`title`,`Style`);let o=document.createElement(`div`);o.className=`card sb-swatch-card`;let s=new Map;for(let e of r){let n=buildSwatch(`sb-scheme`,e,ir[e],[`sb-swatch--scheme`,`sb-swatch--scheme-${e}`]);n.checked=t.colorScheme===e,n.addEventListener(`change`,()=>{n.checked&&(t.colorScheme=e)}),s.set(e,n),o.append(n)}a.append(o),i.append(a);let c=document.createElement(`adw-preferences-group`);c.setAttribute(`title`,`Accent colour`),c.classList.add(`sb-attached-group`);let l=document.createElement(`adw-switch-row`);l.setAttribute(`title`,`Use a custom accent colour`),l.setAttribute(`subtitle`,`Off follows the desktop, which owns the accent`),l.toggleAttribute(`active`,t.accentMode===`custom`),c.append(l);let u=document.createElement(`div`);u.className=`card sb-swatch-card sb-swatch-card--attached`;let f=new Map;for(let e of d){let n=buildSwatch(`sb-accent`,e,ar[e],[]);n.style.backgroundColor=adwaitaAccentBgColor(e),n.checked=t.accent===e,n.addEventListener(`change`,()=>{n.checked&&(t.accent=e)}),f.set(e,n),u.append(n)}let syncAccentEnabled=e=>{u.classList.toggle(`sb-swatch-card--disabled`,!e);for(let t of f.values())t.disabled=!e};return syncAccentEnabled(t.accentMode===`custom`),l.addEventListener(`notify::active`,()=>{t.accentMode=l.hasAttribute(`active`)?`custom`:`system`}),c.append(u),i.append(c),n.append(i),t.subscribe(e=>{let t=s.get(e.colorScheme);t&&!t.checked&&(t.checked=!0);let n=f.get(e.accent);n&&!n.checked&&(n.checked=!0);let r=e.accentMode===`custom`;l.toggleAttribute(`active`,r),syncAccentEnabled(r)}),n}let or=!1;function injectStorybookStyles(){if(or||typeof document>`u`)return;if(document.getElementById(`adwaita-storybook-style`)){or=!0;return}let e=document.createElement(`style`);e.id=`adwaita-storybook-style`,e.textContent=`
10538
+ }`,document.head.appendChild(e)}followDesktopAppearance();const ar={system:`Follow system`,light:`Light`,dark:`Dark`},or={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookWebAppearance=class{settings;_root;constructor(e=document.documentElement){this._root=e;let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`)??null;this.settings=new StorybookSettings(()=>t?.matches??!1),this.settings.subscribe(()=>this._apply()),t?.addEventListener(`change`,()=>this.settings.systemChanged()),this._apply()}_apply(){let e=this.settings.colorScheme;this._root.classList.toggle(`theme-dark`,e===`dark`),this._root.classList.toggle(`theme-light`,e===`light`);let t=this.settings.resolvedAccent;t?applyAdwaitaAccent(t,{target:this._root,dark:this.settings.resolvedDark}):clearAdwaitaAccent(this._root)}};function buildSwatch(e,t,n,r){let i=document.createElement(`input`);return i.type=`radio`,i.name=e,i.value=t,i.title=n,i.setAttribute(`aria-label`,n),i.classList.add(`sb-swatch`,...r),i}function buildAppearanceDialog(e){let t=e.settings,n=document.createElement(`adw-preferences-dialog`);n.setAttribute(`title`,`Appearance`);let i=document.createElement(`adw-preferences-page`),a=document.createElement(`adw-preferences-group`);a.setAttribute(`title`,`Style`);let o=document.createElement(`div`);o.className=`card sb-swatch-card`;let s=new Map;for(let e of r){let n=buildSwatch(`sb-scheme`,e,ar[e],[`sb-swatch--scheme`,`sb-swatch--scheme-${e}`]);n.checked=t.colorScheme===e,n.addEventListener(`change`,()=>{n.checked&&(t.colorScheme=e)}),s.set(e,n),o.append(n)}a.append(o),i.append(a);let c=document.createElement(`adw-preferences-group`);c.setAttribute(`title`,`Accent colour`),c.classList.add(`sb-attached-group`);let l=document.createElement(`adw-switch-row`);l.setAttribute(`title`,`Use a custom accent colour`),l.setAttribute(`subtitle`,`Off follows the desktop, which owns the accent`),l.toggleAttribute(`active`,t.accentMode===`custom`),c.append(l);let u=document.createElement(`div`);u.className=`card sb-swatch-card sb-swatch-card--attached`;let f=new Map;for(let e of d){let n=buildSwatch(`sb-accent`,e,or[e],[]);n.style.backgroundColor=adwaitaAccentBgColor(e),n.checked=t.accent===e,n.addEventListener(`change`,()=>{n.checked&&(t.accent=e)}),f.set(e,n),u.append(n)}let syncAccentEnabled=e=>{u.classList.toggle(`sb-swatch-card--disabled`,!e);for(let t of f.values())t.disabled=!e};return syncAccentEnabled(t.accentMode===`custom`),l.addEventListener(`notify::active`,()=>{t.accentMode=l.hasAttribute(`active`)?`custom`:`system`}),c.append(u),i.append(c),n.append(i),t.subscribe(e=>{let t=s.get(e.colorScheme);t&&!t.checked&&(t.checked=!0);let n=f.get(e.accent);n&&!n.checked&&(n.checked=!0);let r=e.accentMode===`custom`;l.toggleAttribute(`active`,r),syncAccentEnabled(r)}),n}let sr=!1;function injectStorybookStyles(){if(sr||typeof document>`u`)return;if(document.getElementById(`adwaita-storybook-style`)){sr=!0;return}let e=document.createElement(`style`);e.id=`adwaita-storybook-style`,e.textContent=`
10437
10539
  /* Appearance dialog — round swatches with a selection ring. The web twin of the GTK
10438
10540
  renderer's rules, themselves adapted from Learn6502.
10439
10541
 
@@ -10772,7 +10874,7 @@ gtk-box[orientation=vertical] > [vexpand] {
10772
10874
  background: none;
10773
10875
  cursor: pointer;
10774
10876
  }
10775
- `,document.head.appendChild(e),or=!0}function h(e,t={},n=[]){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);for(let e of n)r.append(e);return r}var StorybookWebApp=class{_controller=new StorybookController(this,e=>this._buildControls(e));_options;_container;_appearance;_listEl;_previewEl;_previewTitle;_controlsGroup;_navSplit;_controlsSplit;_backBtn;_rowByTitle=new Map;constructor(e,t){this._container=e,this._options=t,this._appearance=new StorybookWebAppearance(e)}mount(){injectStorybookStyles(),this._buildUI(),this._observeBreakpoint(),this._exposeGlobal(),this._controller.mount(this._options.stories,this._options.openFirst!==!1)}_observeBreakpoint(){let apply=()=>this._applyBreakpoint();typeof ResizeObserver<`u`?new ResizeObserver(apply).observe(this._navSplit):globalThis.addEventListener?.(`resize`,apply),apply()}_applyBreakpoint(){let e=this._navSplit.clientWidth;if(e===0)return;let t=e<620,n=e<1e3,r=this._navSplit,i=this._controlsSplit;r.collapsed!==t&&(r.collapsed=t),i.collapsed!==n&&(i.collapsed=n),this._navSplit.removeAttribute(`show-content`),this._backBtn.hidden=!0,i.showSidebar=!n}get activeStory(){return this._controller.activeStory}listStories(){return this._controller.listStories()}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}getCurrentStory(){return this._controller.getCurrentStory()}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}renderSidebar(e,t){this._listEl.replaceChildren(),this._rowByTitle.clear();for(let{category:n,stories:r}of e){this._listEl.append(h(`div`,{class:`sb-category`},[n]));for(let{instance:e,name:n}of r){let r=h(`div`,{class:`sb-story-row`,role:`button`,tabindex:`0`},[n]);r.addEventListener(`click`,()=>t(e)),r.addEventListener(`keydown`,n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}),this._listEl.append(r),this._rowByTitle.set(e.meta.title,r)}}}markSelected(e){for(let[t,n]of this._rowByTitle)n.classList.toggle(`selected`,t===e)}setPreviewTitle(e){this._previewTitle.setAttribute(`title`,e)}showPreview(e){this._previewEl.replaceChildren(e.element),this._navSplit.collapsed&&this._navSplit.setAttribute(`show-content`,``)}renderControls(e){let t=this._controlsGroup.querySelector(`.adw-preferences-group-listbox`);if(t){t.replaceChildren();for(let n of e)t.append(n.view)}}_buildControls(e){let t=[],n=e.meta.controls;if(Array.isArray(n))for(let r of n){if(!r?.name||!r?.type){console.warn(`Invalid control configuration:`,r);continue}let n=createControlRow(e,r);n&&t.push(n)}return t}_buildUI(){this._listEl=h(`div`,{class:`sb-sidebar-list navigation-sidebar`});let e=h(`div`,{class:`sb-sidebar-scroll`},[this._listEl]),t=h(`div`,{slot:`sidebar`,class:`sb-sidebar-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[h(`adw-window-title`,{slot:`center`,title:this._options.title??`Stories`})]),e])]);this._previewEl=h(`div`,{class:`sb-preview-scroll`}),this._controlsGroup=h(`adw-preferences-group`,{title:`Controls`});let n=h(`div`,{slot:`sidebar`,class:`sb-controls-scroll`},[h(`div`,{class:`sb-controls-page`},[this._controlsGroup])]),r=h(`adw-overlay-split-view`,{"sidebar-position":`end`,"show-sidebar":``,"min-sidebar-width":`280`,"max-sidebar-width":`360`},[h(`div`,{slot:`content`,class:`sb-preview-pane`},[this._previewEl]),n]);this._controlsSplit=r,this._backBtn=h(`button`,{class:`adw-header-btn sb-back-btn`,slot:`start`,title:`Back to stories`,"aria-label":`Back to stories`}),this._backBtn.append(h(`span`,{class:`adw-icon adw-icon--go-previous`})),this._backBtn.hidden=!0,this._backBtn.addEventListener(`click`,()=>this._navSplit.removeAttribute(`show-content`)),this._previewTitle=h(`adw-window-title`,{slot:`center`,title:`Preview`});let i=h(`button`,{class:`adw-header-btn sb-toggle-controls`,title:`Toggle Controls`,"aria-label":`Toggle Controls`});i.append(h(`span`,{class:`adw-icon adw-icon--sidebar-show`})),i.setAttribute(`slot`,`end`),i.addEventListener(`click`,()=>{r.showSidebar=!r.showSidebar});let a=h(`button`,{class:`adw-header-btn sb-appearance-btn`,slot:`end`,title:`Appearance`,"aria-label":`Appearance`});a.append(h(`span`,{class:`adw-icon adw-icon--preferences-system`}));let o=buildAppearanceDialog(this._appearance);a.addEventListener(`click`,()=>{o.isConnected||this._container.append(o),o.toggleAttribute(`open`,!0)});let s=h(`div`,{slot:`content`,class:`sb-content-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[this._backBtn,this._previewTitle,a,i]),r])]);this._navSplit=h(`adw-navigation-split-view`,{"min-sidebar-width":`220`,"max-sidebar-width":`320`},[t,s]);let c=h(`adw-window`,{class:`sb-window`},[this._navSplit]);this._container.replaceChildren(c),c.style.width=`100%`,c.style.height=`100%`}_exposeGlobal(){globalThis.__storybook={listStories:()=>this.listStories(),openStory:e=>this.openStoryByTitle(e),getCurrentStory:()=>this.getCurrentStory(),setArg:(e,t)=>this.setActiveArg(e,t),getArgs:()=>this.activeStory?.args??null}}};function mountStorybook(e,t){let n=new StorybookWebApp(e,t);return n.mount(),n}const sr=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],cr=[`Blue`,`Teal`,`Green`,`Orange`],X={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},Z={bannerTitle:`You have unsaved changes`,bannerButton:`Save`,darkMode:`Dark mode`,darkModeSubtitle:`Use the dark Adwaita palette`,notifications:`Notifications`,notificationsSubtitle:`Show toasts for events`,accentColor:`Accent color`,name:`Name`,nameValue:`Ada Lovelace`,email:`Email`,emailValue:`ada@example.com`,devices:`Devices`,advanced:`Advanced`,advancedSubtitle:`More options`,save:`Save changes`,delete:`Delete account`},Q={value:3,lower:1,upper:10,step:1},lr=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],ur={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:t.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};function el(e,t={}){let n=document.createElement(e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}const dr={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return ur}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:Z.bannerTitle,"button-label":Z.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:X.appearance});n.append(el(`adw-switch-row`,{title:Z.darkMode,subtitle:Z.darkModeSubtitle}),el(`adw-switch-row`,{title:Z.notifications,subtitle:Z.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:Z.accentColor,model:JSON.stringify([...cr]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:X.account});r.append(el(`adw-entry-row`,{title:Z.name,text:Z.nameValue}),el(`adw-entry-row`,{title:Z.email,text:Z.emailValue}),el(`adw-spin-row`,{title:Z.devices,min:String(Q.lower),max:String(Q.upper),step:String(Q.step),value:String(Q.value)}));let i=el(`adw-expander-row`,{title:Z.advanced,subtitle:Z.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of sr)i.append(e.kind===`switch`?el(`adw-switch-row`,e.active?{title:e.title,active:``}:{title:e.title}):el(`adw-action-row`,{title:e.title}));r.append(i),t.append(r);let a=el(`adw-preferences-group`,{title:X.shortcuts});for(let e of lr){let t=el(`adw-action-row`,{title:e.title}),n=el(`adw-shortcut-label`,{accelerator:e.accelerator,slot:`suffix`});t.append(n),a.append(t)}t.append(a);let o=el(`adw-preferences-group`,{title:X.actions}),s=document.createElement(`div`);s.style.display=`flex`,s.style.gap=`12px`,s.style.margin=`6px 0`;let c=document.createElement(`button`);c.className=`adw-button suggested-action`,c.textContent=Z.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=Z.delete,s.append(c,l),o.append(s),t.append(o),e.append(t),this.addContent(e)}updateArgs(e){this._syncBanner()}_syncBanner(){this._banner?.toggleAttribute(`revealed`,this.args.revealed)}}]},fr={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:t.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:t.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:t.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]},pr={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return fr}initialize(){this._avatar=document.createElement(`adw-avatar`),this._sync(),this.addContent(this._avatar)}updateArgs(e){this._sync()}_sync(){this._avatar&&(this._avatar.setAttribute(`text`,this.args.text),this._avatar.setAttribute(`size`,String(this.args.size)),this._avatar.toggleAttribute(`show-initials`,this.args.showInitials),this._avatar.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)))}}]},mr={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!1}]},hr={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return mr}initialize(){this._banner=document.createElement(`adw-banner`),this._sync();let e=document.createElement(`div`);e.style.cssText=`width:460px;max-width:100%;`,e.append(this._banner),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._banner&&(this._banner.setAttribute(`title`,this.args.title),this._banner.setAttribute(`button-label`,this.args.buttonLabel),this._banner.toggleAttribute(`revealed`,this.args.revealed),this._banner.toggleAttribute(`use-markup`,this.args.useMarkup))}}]},gr=[14,25],_r={title:`Presentation/Calendar`,description:`Gtk.Calendar — a six-by-seven month grid with four navigation arrows. The arrows clamp the way g_date_time_add_months does, so paging from the 31st lands on the 28th, and a marked day is a day NUMBER of the shown month, so it survives a month that has no such day.`,controls:[{name:`showHeading`,label:`Heading`,type:t.BOOLEAN,defaultValue:!0},{name:`showDayNames`,label:`Day names`,type:t.BOOLEAN,defaultValue:!0},{name:`showWeekNumbers`,label:`Week numbers`,type:t.BOOLEAN,defaultValue:!0}]},vr={stories:[class CalendarWebStory extends StoryElement{_calendar=null;_marked=!1;constructor(){super(CalendarWebStory.getMetadata(),`Default`)}static getMetadata(){return _r}initialize(){this._calendar=document.createElement(`gtk-calendar`),this._calendar.setAttribute(`date`,`2026-10-02`),this._apply(),this.addContent(this._calendar)}updateArgs(e){this._apply()}_apply(){if(!this._calendar)return;this._calendar.setAttribute(`show-heading`,String(this.args.showHeading)),this._calendar.setAttribute(`show-day-names`,String(this.args.showDayNames)),this._calendar.toggleAttribute(`show-week-numbers`,this.args.showWeekNumbers);let e=this._calendar;this._marked&&e.clearMarks();for(let t of gr)e.markDay(t);this._marked=!0}}]},yr=[{value:`de`,label:`German`},{value:`fr`,label:`French`},{value:`nl`,label:`Dutch`},{value:`pt`,label:`Portuguese`}],br={title:`Presentation/Column View`,description:`Gtk.ColumnView — a list view with a header and one cell per column. Clicking a sortable header sets the sort and inverts it on the next click; the view itself reorders nothing.`,controls:[{name:`showRowSeparators`,label:`Row separators`,type:t.BOOLEAN,defaultValue:!0},{name:`showColumnSeparators`,label:`Column separators`,type:t.BOOLEAN,defaultValue:!1},{name:`reorderable`,label:`Drag columns to reorder`,type:t.BOOLEAN,defaultValue:!1}]},xr={stories:[class ColumnViewWebStory extends StoryElement{_view=null;constructor(){super(ColumnViewWebStory.getMetadata(),`Default`)}static getMetadata(){return br}initialize(){this._view=document.createElement(`gtk-column-view`),this._view.setAttribute(`model`,JSON.stringify(yr)),this._view.setAttribute(`columns`,JSON.stringify([{key:`label`,id:`name`,title:`Name`,expand:!0,sortable:!0},{key:`value`,id:`code`,title:`Code`}])),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.toggleAttribute(`show-row-separators`,this.args.showRowSeparators),this._view.toggleAttribute(`show-column-separators`,this.args.showColumnSeparators),this._view.toggleAttribute(`reorderable`,this.args.reorderable))}}]},Sr=[`Red`,`Orange`,`Yellow`,`Green`,`Blue`,`Purple`,`Teal`,`Grey`],Cr={title:`Presentation/Flow Box`,description:`Gtk.FlowBox — the same selectable rows a list box holds, reflowed into as many per line as the width fits. HORIZONTAL is the default here, unlike every GtkOrientable list base; the arrows move by visual position, so the cross-line key lands in the same column of the next line.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`Browse`,value:`browse`},{label:`None`,value:`none`}],defaultValue:`multiple`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`maxChildrenPerLine`,label:`Max children per line`,type:t.NUMBER,defaultValue:3},{name:`homogeneous`,label:`Homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`rowSpacing`,label:`Row spacing`,type:t.NUMBER,defaultValue:6}]},wr={stories:[class FlowBoxWebStory extends StoryElement{_box=null;constructor(){super(FlowBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Cr}initialize(){this._box=document.createElement(`gtk-flow-box`),this._box.style.width=`100%`;for(let e of Sr){let t=document.createElement(`gtk-flow-box-child`),n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.setAttribute(`selection-mode`,this.args.selectionMode),this._box.setAttribute(`orientation`,this.args.orientation),this._box.setAttribute(`max-children-per-line`,String(Math.max(1,Math.trunc(this.args.maxChildrenPerLine)))),this._box.toggleAttribute(`homogeneous`,this.args.homogeneous),this._box.setAttribute(`row-spacing`,String(Math.max(0,Math.trunc(this.args.rowSpacing)))))}}]},Tr=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Er=[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`None`,value:`none`}],Dr={title:`Presentation/List View`,description:`Gtk.ListView — one row per item of a list model, each built by a factory. The model is the portable list (ADR 0046); which Gtk.SelectionModel would have wrapped it is the selection mode.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:Er,defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`singleClickActivate`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!1}]},Or=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`],kr={title:`Presentation/Grid View`,description:`Gtk.GridView — the same model and factory as a list view, reflowed into as many equal columns as the width fits, between min-columns and max-columns.`,controls:[{name:`maxColumns`,label:`Max columns`,type:t.NUMBER,defaultValue:4},{name:`minColumns`,label:`Min columns`,type:t.NUMBER,defaultValue:1},{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:Er,defaultValue:`single`}]},Ar={stories:[class GridViewWebStory extends StoryElement{_view=null;constructor(){super(GridViewWebStory.getMetadata(),`Default`)}static getMetadata(){return kr}initialize(){this._view=document.createElement(`gtk-grid-view`),this._view.setAttribute(`model`,JSON.stringify(Or)),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){if(!this._view)return;let e=Math.max(1,this.args.minColumns);this._view.setAttribute(`min-columns`,String(e)),this._view.setAttribute(`max-columns`,String(Math.max(e,this.args.maxColumns))),this._view.setAttribute(`selection-mode`,this.args.selectionMode)}}]},jr=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Mr={title:`Presentation/List Box`,description:`Gtk.ListBox — one row per child you append, with GTK’s four selection modes. Ctrl toggles and Shift extends from the anchor the last Shift-click left behind; activate-on-single-click defaults to TRUE here, unlike Gtk.ListView’s single-click-activate.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`Browse`,value:`browse`},{label:`None`,value:`none`}],defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`activateOnSingleClick`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!0},{name:`tabBehavior`,label:`Tab behaviour`,type:t.SELECT,options:[{label:`All`,value:`all`},{label:`Item`,value:`item`},{label:`Cell`,value:`cell`}],defaultValue:`all`}]},Nr={stories:[class ListBoxWebStory extends StoryElement{_box=null;constructor(){super(ListBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Mr}initialize(){this._box=document.createElement(`gtk-list-box`),this._box.style.width=`100%`;for(let e of jr){let t=document.createElement(`gtk-list-box-row`),n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.setAttribute(`selection-mode`,this.args.selectionMode),this._box.toggleAttribute(`show-separators`,this.args.showSeparators),this._box.setAttribute(`activate-on-single-click`,String(this.args.activateOnSingleClick)),this._box.setAttribute(`tab-behavior`,this.args.tabBehavior))}}]},Pr={stories:[class ListViewWebStory extends StoryElement{_view=null;constructor(){super(ListViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Dr}initialize(){this._view=document.createElement(`gtk-list-view`),this._view.setAttribute(`model`,JSON.stringify(Tr)),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.setAttribute(`selection-mode`,this.args.selectionMode),this._view.toggleAttribute(`show-separators`,this.args.showSeparators),this._view.toggleAttribute(`single-click-activate`,this.args.singleClickActivate))}}]},Fr=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],Ir={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:t.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},Lr={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},Rr={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return Ir}initialize(){this._widget=document.createElement(`adw-shortcut-label`),this._sync(),this.addContent(this._widget)}updateArgs(e){this._sync()}_sync(){this._widget&&(this._widget.setAttribute(`disabled-text`,this.args.disabledText),this._widget.setAttribute(`accelerator`,this.args.accelerator))}},class ShortcutLabelLevelsWebStory extends StoryElement{_widgets=[];constructor(){super(ShortcutLabelLevelsWebStory.getMetadata(),`Default`)}static getMetadata(){return Lr}initialize(){let e=document.createElement(`div`);e.style.display=`grid`,e.style.gridTemplateColumns=`auto auto`,e.style.rowGap=`12px`,e.style.columnGap=`24px`,e.style.alignItems=`center`;for(let t of Fr){let n=document.createElement(`span`);n.className=`dimmed`,n.textContent=t.label,e.append(n);let r=document.createElement(`adw-shortcut-label`);r.style.justifySelf=`end`,r.setAttribute(`disabled-text`,this.args.disabledText),r.setAttribute(`accelerator`,t.accelerator),e.append(r),this._widgets.push(r)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.setAttribute(`disabled-text`,this.args.disabledText)}}]},zr={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:t.RANGE,min:16,max:64,step:4,defaultValue:48}]},Br={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return zr}initialize(){this._spinner=document.createElement(`adw-spinner`),this._spinner.setAttribute(`size`,String(this.args.size)),this.addContent(this._spinner)}updateArgs(e){this._spinner&&this._spinner.setAttribute(`size`,String(this.args.size))}}]},Vr={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Documents you create or open will appear here.`}]},Hr={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return Vr}initialize(){this._page=document.createElement(`adw-status-page`);let e=document.createElement(`gtk-button`);e.setAttribute(`label`,`New Document`),e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),this._page.appendChild(e),this._sync(),this.addContent(this._page)}updateArgs(e){this._sync()}_sync(){this._page&&(this._page.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)),this._page.setAttribute(`title`,this.args.title),this._page.setAttribute(`description`,this.args.description))}}]},Ur={Pictures:[`Holiday`,`Screenshots`],Music:[`Albums`],Notes:[]},Wr={title:`Presentation/Tree Expander`,description:`Gtk.TreeExpander — the indent and the disclosure arrow a tree row wears in front of its contents. A leaf takes one indent in place of the arrow, so its text lines up with its siblings.`,controls:[{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`hideExpander`,label:`Hide the arrow`,type:t.BOOLEAN,defaultValue:!1},{name:`indentForIcon`,label:`Indent leaves by an arrow`,type:t.BOOLEAN,defaultValue:!0}]},Gr=Object.entries(Ur).flatMap(([e,t])=>[{label:e,depth:0,expandable:t.length>0},...t.map(e=>({label:e,depth:1,expandable:!1}))]),Kr={stories:[class TreeExpanderWebStory extends StoryElement{_expanders=[];constructor(){super(TreeExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Wr}initialize(){let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`);for(let t of Gr){let n=document.createElement(`gtk-tree-expander`);n.setAttribute(`depth`,String(t.depth)),n.toggleAttribute(`expandable`,t.expandable);let r=document.createElement(`gtk-label`);r.setAttribute(`label`,t.label),n.appendChild(r),e.appendChild(n),this._expanders.push(n)}this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this.args.expanded;this._expanders.forEach((t,n)=>{t.toggleAttribute(`expanded`,e),t.toggleAttribute(`hide-expander`,this.args.hideExpander),t.setAttribute(`indent-for-icon`,String(this.args.indentForIcon)),Gr[n].depth>0&&(t.hidden=!e)})}}]},qr={title:`Presentation/WindowHandle`,description:`Gtk.WindowHandle — the titlebar strip. Dragging it moves the window; a double click, a middle click and a right click raise the window actions the compositor (or, here, the titlebar settings) names.`,controls:[{name:`action`,label:`Double-click action`,type:t.SELECT,options:[{label:`Toggle maximize`,value:`toggle-maximize`},{label:`Minimize`,value:`minimize`},{label:`Menu`,value:`menu`},{label:`None`,value:`none`}],defaultValue:`toggle-maximize`}]},Jr={stories:[class WindowHandleWebStory extends StoryElement{_handle=null;constructor(){super(WindowHandleWebStory.getMetadata(),`Default`)}static getMetadata(){return qr}initialize(){let e=document.createElement(`gtk-window-handle`),t=document.createElement(`adw-header-bar`),n=document.createElement(`adw-window-title`);n.setAttribute(`title`,`Notes`),t.appendChild(n),e.appendChild(t),this._handle=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._handle;e&&e.setAttribute(`double-click-action`,this.args.action)}}]},Yr={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`3 unread messages`}]},Xr={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return Yr}initialize(){this._windowTitle=document.createElement(`adw-window-title`),this._sync(),this.addContent(this._windowTitle)}updateArgs(e){this._sync()}_sync(){this._windowTitle&&(this._windowTitle.setAttribute(`title`,this.args.title),this._windowTitle.setAttribute(`subtitle`,this.args.subtitle))}}]},Zr={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:t.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$2(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$2,`iconClass`);const Qr={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Zr}initialize(){this._row=document.createElement(`adw-action-row`),this._icon=document.createElement(`span`),this._icon.setAttribute(`slot`,`prefix`),this._icon.className=iconClass$2(this.args.iconName);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`suffix`),e.setAttribute(`icon`,`go-next`),e.setAttribute(`flat`,``),this._row.append(this._icon,e),this._syncRow();let t=document.createElement(`adw-preferences-group`);t.append(this._row);let n=document.createElement(`adw-clamp`);n.setAttribute(`maximum-size`,`400`),n.append(t),this.addContent(n)}updateArgs(e){this._syncRow(),this._icon&&(this._icon.className=iconClass$2(this.args.iconName))}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`activatable`,this.args.activatable))}}]},$r={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:t.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]},ei=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const ti={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return $r}initialize(){this._row=document.createElement(`adw-button-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=iconName$1(this.args.startIconName);e?this._row.setAttribute(`start-icon-name`,e):this._row.removeAttribute(`start-icon-name`),this._applyStyle(this.args.style)}_applyStyle(e){if(this._row){for(let e of ei)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},ni=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],ri={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:1}]},ii={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ri}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`model`,JSON.stringify([...ni])),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.setAttribute(`selected`,String(this.args.selected)))}}]},ai={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:t.BOOLEAN,defaultValue:!0}]},oi={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ai}initialize(){this._row=document.createElement(`adw-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text),this._row.toggleAttribute(`show-apply-button`,this.args.showApplyButton))}}]},si={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:t.BOOLEAN,defaultValue:!1}]},ci={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return si}initialize(){this._row=document.createElement(`adw-expander-row`);let e=document.createElement(`adw-entry-row`);e.setAttribute(`title`,`Host`),e.setAttribute(`text`,`proxy.example.com`);let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,`Use authentication`),this._row.append(e,t),this._syncRow();let n=document.createElement(`adw-preferences-group`);n.append(this._row);let r=document.createElement(`adw-clamp`);r.setAttribute(`maximum-size`,`400`),r.append(n),this.addContent(r)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`expanded`,this.args.expanded),this._row.toggleAttribute(`show-enable-switch`,this.args.showEnableSwitch))}}]},li={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`correct-horse-battery`}]},ui={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return li}initialize(){this._row=document.createElement(`adw-password-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text))}}]},di={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]},fi=[`Europe`,`Americas`,`Asia`,`Oceania`],pi={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return di}initialize(){this._group=document.createElement(`adw-preferences-group`);let e=document.createElement(`button`);e.className=`adw-button flat`,e.textContent=`Sign out`,e.setAttribute(`slot`,`header-suffix`),this._group.append(e);let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,`Display name`),t.setAttribute(`text`,`Grace Hopper`),this._group.append(t);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Sync over Wi-Fi only`),n.setAttribute(`subtitle`,`Avoid using mobile data for backups`),n.setAttribute(`active`,``),this._group.append(n);let r=document.createElement(`adw-combo-row`);r.setAttribute(`title`,`Region`),r.setAttribute(`model`,JSON.stringify(fi)),r.setAttribute(`selected`,`0`),this._group.append(r),this._syncGroup();let i=document.createElement(`adw-clamp`);i.setAttribute(`maximum-size`,`400`),i.append(this._group),this.addContent(i)}updateArgs(e){this._syncGroup()}_syncGroup(){this._group&&(this._group.setAttribute(`title`,this.args.title),this._group.setAttribute(`description`,this.args.description))}}]},mi={title:`Boxed Lists/Preferences Row`,description:`Adw.PreferencesRow — the base of every boxed-list row: a list row with a title that the preferences dialog searches. The title can carry Pango markup and be made selectable.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`A <b>plain</b> preferences row`},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!0},{name:`titleSelectable`,label:`Title selectable`,type:t.BOOLEAN,defaultValue:!1}]},hi={stories:[class PreferencesRowWebStory extends StoryElement{_row=null;constructor(){super(PreferencesRowWebStory.getMetadata(),`Default`)}static getMetadata(){return mi}initialize(){this._row=document.createElement(`adw-preferences-row`),this._sync();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._sync()}_sync(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.toggleAttribute(`use-markup`,this.args.useMarkup),this._row.toggleAttribute(`title-selectable`,this.args.titleSelectable))}}]},gi={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:t.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:0}]},_i={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return gi}initialize(){this._row=document.createElement(`adw-spin-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=this.args.digits;this._row.setAttribute(`adjustment`,JSON.stringify({lower:0,upper:100,pageIncrement:10,stepIncrement:10**-e})),this._row.setAttribute(`value`,String(this.args.value))}}]},vi={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0}]},yi={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return vi}initialize(){this._row=document.createElement(`adw-switch-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`active`,this.args.active))}}]},bi={title:`Drawing/Drag Icon`,description:"Gtk.DragIcon — the widget that follows the pointer while a drag is in flight, and is destroyed with the drag. No application builds one: `get_for_drag` returns the icon a drag is using, and the drag source sets its child. What it takes as that child is the interesting part, because `create_widget_for_value` answers for six kinds of value and a drag source that offers a string gets a label and one that offers a colour gets a swatch. A drag icon takes no input at all, which is the C's own note: 'drag icons do not allow user input'.",controls:[{name:`value`,label:`Value being dragged`,type:t.SELECT,options:[{label:`A string (a Gtk.Label)`,value:`string`},{label:`A GdkRGBA (a colour swatch)`,value:`rgba`},{label:`A content provider only (no icon)`,value:`none`}],defaultValue:`string`},{name:`actions`,label:`Drag actions`,type:t.SELECT,options:[{label:`Copy`,value:`copy`},{label:`Move`,value:`move`}],defaultValue:`copy`}]},xi={stories:[class DragIconWebStory extends StoryElement{_row=null;_hint=null;constructor(){super(DragIconWebStory.getMetadata(),`Default`)}static getMetadata(){return bi}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.alignItems=`center`,e.style.gap=`12px`;let t=document.createElement(`p`);t.className=`dim-label`,this._hint=t,e.append(t),this._row=document.createElement(`div`),this._row.className=`card`,this._row.draggable=!0,this._row.style.display=`flex`,this._row.style.alignItems=`center`,this._row.style.gap=`12px`,this._row.style.padding=`12px`;let n=document.createElement(`span`);n.className=`heading`,n.textContent=`Report.odt`,this._row.append(n),this._row.addEventListener(`dragstart`,e=>this._onDragStart(e)),e.append(this._row),this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_value(){switch(this.args.value){case`rgba`:return{red:.25,green:.55,blue:.95,alpha:1};case`none`:return null;default:return`Report.odt`}}_onDragStart(e){e.dataTransfer!==null&&(e.dataTransfer.effectAllowed=this.args.actions===`move`?`move`:`copy`);let t=this._value();t!==null&&V.getForDrag(e).setChild(V.createWidgetForValue(t))}_apply(){this._hint===null||this._row===null||(this._hint.textContent=this.args.value===`none`?`Drag the row — no icon, because the value has no widget to show`:`Drag the row and watch the pointer`,this._row.title=`Draggable — the icon that follows the pointer is a <gtk-drag-icon>`)}}]},Si={title:`Drawing/Drawing Area`,description:"Gtk.DrawingArea — a blank widget that owns a size and a callback and nothing else: whatever you see is what `set_draw_func` painted. `content-width` and `content-height` are the MINIMUM and natural size at once, so a parent can hand the area more room but never less; at 0 the area has no intrinsic size at all and fills whatever it is given.",controls:[{name:`contentWidth`,label:`Content width`,type:t.RANGE,min:0,max:320,step:16,defaultValue:160},{name:`contentHeight`,label:`Content height`,type:t.RANGE,min:0,max:320,step:16,defaultValue:120},{name:`shape`,label:`Shape`,type:t.SELECT,options:[{label:`Circle`,value:`circle`},{label:`Grid`,value:`grid`},{label:`Crosshair`,value:`crosshair`}],defaultValue:`circle`}]},Ci={stories:[class DrawingAreaWebStory extends StoryElement{_area=null;constructor(){super(DrawingAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return Si}initialize(){this._area=document.createElement(`gtk-drawing-area`),this._area.setDrawFunc((e,t,n,r)=>{switch(t.fillStyle=`currentColor`,t.globalCompositeOperation=`source-over`,t.fillRect(0,0,n,r),t.globalCompositeOperation=`difference`,this.args.shape){case`grid`:for(let e=0;e<n;e+=16)t.fillRect(e,0,8,r);break;case`crosshair`:t.fillRect(n/2-1,0,2,r),t.fillRect(0,r/2-1,n,2);break;default:t.beginPath(),t.arc(n/2,r/2,Math.min(n,r)/2,0,2*Math.PI),t.fill();break}t.globalCompositeOperation=`source-over`}),this._apply(),this.addContent(this._area)}updateArgs(e){this._apply()}_apply(){this._area&&(this._area.setAttribute(`content-width`,String(this.args.contentWidth)),this._area.setAttribute(`content-height`,String(this.args.contentHeight)))}}]},wi={title:`Drawing/GL Area`,description:"Gtk.GLArea — a widget whose contents are drawn on a GPU. GTK emits `::resize` before the first `::render` and the render flag is cleared AFTER the signal, so a handler may queue another frame with `queue_render()`. Here the replica is a `<canvas>` with a real WebGL context: the browser has no desktop GL, so `api` always reports the ES flavour it was given.",controls:[{name:`autoRender`,label:`Auto render`,type:t.BOOLEAN,defaultValue:!0},{name:`hasDepthBuffer`,label:`Depth buffer`,type:t.BOOLEAN,defaultValue:!1},{name:`allowedApis`,label:`Allowed APIs`,type:t.SELECT,options:[{label:`GL and GLES (default)`,value:`gl gles`},{label:`GLES only`,value:`gles`},{label:`GL only`,value:`gl`}],defaultValue:`gl gles`},{name:`spinning`,label:`Spin the triangle`,type:t.BOOLEAN,defaultValue:!0}]},Ti={stories:[class GLAreaWebStory extends StoryElement{_area=null;_readout=null;_frame=0;_program=null;_buffer=null;_angle=0;_renders=0;_viewport=`—`;constructor(){super(GLAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return wi}initialize(){this._area=document.createElement(`gtk-gl-area`),this._area.style.width=`240px`,this._area.style.height=`160px`,this._readout=document.createElement(`div`),this._readout.className=`adw-gl-area-story-readout`,this._area.addEventListener(`resize`,e=>{let{width:t,height:n}=e.detail;this._viewport=`${t} × ${n}`,this._refresh()}),this._area.addEventListener(`render`,e=>{let{context:t}=e.detail;t&&this._draw(t),this._renders+=1,this._refresh()}),this._apply(),this._start();let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`6px`,e.style.alignItems=`center`,e.append(this._area,this._readout),this.addContent(e)}updateArgs(e){this._stop(),this._apply(),this._start()}_apply(){this._area&&(this._area.setAttribute(`auto-render`,String(this.args.autoRender)),this._area.setAttribute(`has-depth-buffer`,String(this.args.hasDepthBuffer)),this._area.setAttribute(`allowed-apis`,this.args.allowedApis))}_start(){if(!this.args.spinning)return;let step=()=>{this._angle+=.05,this._area?.queueRender(),this._frame=requestAnimationFrame(step)};this._frame=requestAnimationFrame(step)}_stop(){this._frame!==0&&cancelAnimationFrame(this._frame),this._frame=0}_draw(e){if(!(e instanceof WebGLRenderingContext))return;this._program||this._build(e);let t=this._program;t!==null&&(e.clearColor(.15,.16,.18,1),e.clear(e.COLOR_BUFFER_BIT),e.useProgram(t),e.uniform1f(e.getUniformLocation(t,`angle`),this._angle),e.bindBuffer(e.ARRAY_BUFFER,this._buffer),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,3))}_build(e){let compile=(t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),r):null},t=e.createProgram(),n=compile(e.VERTEX_SHADER,`
10877
+ `,document.head.appendChild(e),sr=!0}function h(e,t={},n=[]){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);for(let e of n)r.append(e);return r}var StorybookWebApp=class{_controller=new StorybookController(this,e=>this._buildControls(e));_options;_container;_appearance;_listEl;_previewEl;_previewTitle;_controlsGroup;_navSplit;_controlsSplit;_backBtn;_rowByTitle=new Map;constructor(e,t){this._container=e,this._options=t,this._appearance=new StorybookWebAppearance(e)}mount(){injectStorybookStyles(),this._buildUI(),this._observeBreakpoint(),this._exposeGlobal(),this._controller.mount(this._options.stories,this._options.openFirst!==!1)}_observeBreakpoint(){let apply=()=>this._applyBreakpoint();typeof ResizeObserver<`u`?new ResizeObserver(apply).observe(this._navSplit):globalThis.addEventListener?.(`resize`,apply),apply()}_applyBreakpoint(){let e=this._navSplit.clientWidth;if(e===0)return;let t=e<620,n=e<1e3,r=this._navSplit,i=this._controlsSplit;r.collapsed!==t&&(r.collapsed=t),i.collapsed!==n&&(i.collapsed=n),this._navSplit.removeAttribute(`show-content`),this._backBtn.hidden=!0,i.showSidebar=!n}get activeStory(){return this._controller.activeStory}listStories(){return this._controller.listStories()}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}getCurrentStory(){return this._controller.getCurrentStory()}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}renderSidebar(e,t){this._listEl.replaceChildren(),this._rowByTitle.clear();for(let{category:n,stories:r}of e){this._listEl.append(h(`div`,{class:`sb-category`},[n]));for(let{instance:e,name:n}of r){let r=h(`div`,{class:`sb-story-row`,role:`button`,tabindex:`0`},[n]);r.addEventListener(`click`,()=>t(e)),r.addEventListener(`keydown`,n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}),this._listEl.append(r),this._rowByTitle.set(e.meta.title,r)}}}markSelected(e){for(let[t,n]of this._rowByTitle)n.classList.toggle(`selected`,t===e)}setPreviewTitle(e){this._previewTitle.setAttribute(`title`,e)}showPreview(e){this._previewEl.replaceChildren(e.element),this._navSplit.collapsed&&this._navSplit.setAttribute(`show-content`,``)}renderControls(e){let t=this._controlsGroup.querySelector(`.adw-preferences-group-listbox`);if(t){t.replaceChildren();for(let n of e)t.append(n.view)}}_buildControls(e){let t=[],n=e.meta.controls;if(Array.isArray(n))for(let r of n){if(!r?.name||!r?.type){console.warn(`Invalid control configuration:`,r);continue}let n=createControlRow(e,r);n&&t.push(n)}return t}_buildUI(){this._listEl=h(`div`,{class:`sb-sidebar-list navigation-sidebar`});let e=h(`div`,{class:`sb-sidebar-scroll`},[this._listEl]),t=h(`div`,{slot:`sidebar`,class:`sb-sidebar-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[h(`adw-window-title`,{slot:`center`,title:this._options.title??`Stories`})]),e])]);this._previewEl=h(`div`,{class:`sb-preview-scroll`}),this._controlsGroup=h(`adw-preferences-group`,{title:`Controls`});let n=h(`div`,{slot:`sidebar`,class:`sb-controls-scroll`},[h(`div`,{class:`sb-controls-page`},[this._controlsGroup])]),r=h(`adw-overlay-split-view`,{"sidebar-position":`end`,"show-sidebar":``,"min-sidebar-width":`280`,"max-sidebar-width":`360`},[h(`div`,{slot:`content`,class:`sb-preview-pane`},[this._previewEl]),n]);this._controlsSplit=r,this._backBtn=h(`button`,{class:`adw-header-btn sb-back-btn`,slot:`start`,title:`Back to stories`,"aria-label":`Back to stories`}),this._backBtn.append(h(`span`,{class:`adw-icon adw-icon--go-previous`})),this._backBtn.hidden=!0,this._backBtn.addEventListener(`click`,()=>this._navSplit.removeAttribute(`show-content`)),this._previewTitle=h(`adw-window-title`,{slot:`center`,title:`Preview`});let i=h(`button`,{class:`adw-header-btn sb-toggle-controls`,title:`Toggle Controls`,"aria-label":`Toggle Controls`});i.append(h(`span`,{class:`adw-icon adw-icon--sidebar-show`})),i.setAttribute(`slot`,`end`),i.addEventListener(`click`,()=>{r.showSidebar=!r.showSidebar});let a=h(`button`,{class:`adw-header-btn sb-appearance-btn`,slot:`end`,title:`Appearance`,"aria-label":`Appearance`});a.append(h(`span`,{class:`adw-icon adw-icon--preferences-system`}));let o=buildAppearanceDialog(this._appearance);a.addEventListener(`click`,()=>{o.isConnected||this._container.append(o),o.toggleAttribute(`open`,!0)});let s=h(`div`,{slot:`content`,class:`sb-content-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[this._backBtn,this._previewTitle,a,i]),r])]);this._navSplit=h(`adw-navigation-split-view`,{"min-sidebar-width":`220`,"max-sidebar-width":`320`},[t,s]);let c=h(`adw-window`,{class:`sb-window`},[this._navSplit]);this._container.replaceChildren(c),c.style.width=`100%`,c.style.height=`100%`}_exposeGlobal(){globalThis.__storybook={listStories:()=>this.listStories(),openStory:e=>this.openStoryByTitle(e),getCurrentStory:()=>this.getCurrentStory(),setArg:(e,t)=>this.setActiveArg(e,t),getArgs:()=>this.activeStory?.args??null}}};function mountStorybook(e,t){let n=new StorybookWebApp(e,t);return n.mount(),n}const cr=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],lr=[`Blue`,`Teal`,`Green`,`Orange`],X={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},Z={bannerTitle:`You have unsaved changes`,bannerButton:`Save`,darkMode:`Dark mode`,darkModeSubtitle:`Use the dark Adwaita palette`,notifications:`Notifications`,notificationsSubtitle:`Show toasts for events`,accentColor:`Accent color`,name:`Name`,nameValue:`Ada Lovelace`,email:`Email`,emailValue:`ada@example.com`,devices:`Devices`,advanced:`Advanced`,advancedSubtitle:`More options`,save:`Save changes`,delete:`Delete account`},Q={value:3,lower:1,upper:10,step:1},ur=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],dr={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:t.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};function el(e,t={}){let n=document.createElement(e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}const fr={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return dr}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:Z.bannerTitle,"button-label":Z.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:X.appearance});n.append(el(`adw-switch-row`,{title:Z.darkMode,subtitle:Z.darkModeSubtitle}),el(`adw-switch-row`,{title:Z.notifications,subtitle:Z.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:Z.accentColor,model:JSON.stringify([...lr]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:X.account});r.append(el(`adw-entry-row`,{title:Z.name,text:Z.nameValue}),el(`adw-entry-row`,{title:Z.email,text:Z.emailValue}),el(`adw-spin-row`,{title:Z.devices,min:String(Q.lower),max:String(Q.upper),step:String(Q.step),value:String(Q.value)}));let i=el(`adw-expander-row`,{title:Z.advanced,subtitle:Z.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of cr)i.append(e.kind===`switch`?el(`adw-switch-row`,e.active?{title:e.title,active:``}:{title:e.title}):el(`adw-action-row`,{title:e.title}));r.append(i),t.append(r);let a=el(`adw-preferences-group`,{title:X.shortcuts});for(let e of ur){let t=el(`adw-action-row`,{title:e.title}),n=el(`adw-shortcut-label`,{accelerator:e.accelerator,slot:`suffix`});t.append(n),a.append(t)}t.append(a);let o=el(`adw-preferences-group`,{title:X.actions}),s=document.createElement(`div`);s.style.display=`flex`,s.style.gap=`12px`,s.style.margin=`6px 0`;let c=document.createElement(`button`);c.className=`adw-button suggested-action`,c.textContent=Z.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=Z.delete,s.append(c,l),o.append(s),t.append(o),e.append(t),this.addContent(e)}updateArgs(e){this._syncBanner()}_syncBanner(){this._banner?.toggleAttribute(`revealed`,this.args.revealed)}}]},pr={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:t.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:t.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:t.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]},mr={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return pr}initialize(){this._avatar=document.createElement(`adw-avatar`),this._sync(),this.addContent(this._avatar)}updateArgs(e){this._sync()}_sync(){this._avatar&&(this._avatar.setAttribute(`text`,this.args.text),this._avatar.setAttribute(`size`,String(this.args.size)),this._avatar.toggleAttribute(`show-initials`,this.args.showInitials),this._avatar.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)))}}]},hr={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!1}]},gr={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return hr}initialize(){this._banner=document.createElement(`adw-banner`),this._sync();let e=document.createElement(`div`);e.style.cssText=`width:460px;max-width:100%;`,e.append(this._banner),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._banner&&(this._banner.setAttribute(`title`,this.args.title),this._banner.setAttribute(`button-label`,this.args.buttonLabel),this._banner.toggleAttribute(`revealed`,this.args.revealed),this._banner.toggleAttribute(`use-markup`,this.args.useMarkup))}}]},_r=[14,25],vr={title:`Presentation/Calendar`,description:`Gtk.Calendar — a six-by-seven month grid with four navigation arrows. The arrows clamp the way g_date_time_add_months does, so paging from the 31st lands on the 28th, and a marked day is a day NUMBER of the shown month, so it survives a month that has no such day.`,controls:[{name:`showHeading`,label:`Heading`,type:t.BOOLEAN,defaultValue:!0},{name:`showDayNames`,label:`Day names`,type:t.BOOLEAN,defaultValue:!0},{name:`showWeekNumbers`,label:`Week numbers`,type:t.BOOLEAN,defaultValue:!0}]},yr={stories:[class CalendarWebStory extends StoryElement{_calendar=null;_marked=!1;constructor(){super(CalendarWebStory.getMetadata(),`Default`)}static getMetadata(){return vr}initialize(){this._calendar=document.createElement(`gtk-calendar`),this._calendar.setAttribute(`date`,`2026-10-02`),this._apply(),this.addContent(this._calendar)}updateArgs(e){this._apply()}_apply(){if(!this._calendar)return;this._calendar.setAttribute(`show-heading`,String(this.args.showHeading)),this._calendar.setAttribute(`show-day-names`,String(this.args.showDayNames)),this._calendar.toggleAttribute(`show-week-numbers`,this.args.showWeekNumbers);let e=this._calendar;this._marked&&e.clearMarks();for(let t of _r)e.markDay(t);this._marked=!0}}]},br=[{value:`de`,label:`German`},{value:`fr`,label:`French`},{value:`nl`,label:`Dutch`},{value:`pt`,label:`Portuguese`}],xr={title:`Presentation/Column View`,description:`Gtk.ColumnView — a list view with a header and one cell per column. Clicking a sortable header sets the sort and inverts it on the next click; the view itself reorders nothing.`,controls:[{name:`showRowSeparators`,label:`Row separators`,type:t.BOOLEAN,defaultValue:!0},{name:`showColumnSeparators`,label:`Column separators`,type:t.BOOLEAN,defaultValue:!1},{name:`reorderable`,label:`Drag columns to reorder`,type:t.BOOLEAN,defaultValue:!1}]},Sr={stories:[class ColumnViewWebStory extends StoryElement{_view=null;constructor(){super(ColumnViewWebStory.getMetadata(),`Default`)}static getMetadata(){return xr}initialize(){this._view=document.createElement(`gtk-column-view`),this._view.setAttribute(`model`,JSON.stringify(br)),this._view.setAttribute(`columns`,JSON.stringify([{key:`label`,id:`name`,title:`Name`,expand:!0,sortable:!0},{key:`value`,id:`code`,title:`Code`}])),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.toggleAttribute(`show-row-separators`,this.args.showRowSeparators),this._view.toggleAttribute(`show-column-separators`,this.args.showColumnSeparators),this._view.toggleAttribute(`reorderable`,this.args.reorderable))}}]},Cr=[`Red`,`Orange`,`Yellow`,`Green`,`Blue`,`Purple`,`Teal`,`Grey`],wr={title:`Presentation/Flow Box`,description:`Gtk.FlowBox — the same selectable rows a list box holds, reflowed into as many per line as the width fits. HORIZONTAL is the default here, unlike every GtkOrientable list base; the arrows move by visual position, so the cross-line key lands in the same column of the next line.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`Browse`,value:`browse`},{label:`None`,value:`none`}],defaultValue:`multiple`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`maxChildrenPerLine`,label:`Max children per line`,type:t.NUMBER,defaultValue:3},{name:`homogeneous`,label:`Homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`rowSpacing`,label:`Row spacing`,type:t.NUMBER,defaultValue:6}]},Tr={stories:[class FlowBoxWebStory extends StoryElement{_box=null;constructor(){super(FlowBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return wr}initialize(){this._box=document.createElement(`gtk-flow-box`),this._box.style.width=`100%`;for(let e of Cr){let t=document.createElement(`gtk-flow-box-child`),n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.setAttribute(`selection-mode`,this.args.selectionMode),this._box.setAttribute(`orientation`,this.args.orientation),this._box.setAttribute(`max-children-per-line`,String(Math.max(1,Math.trunc(this.args.maxChildrenPerLine)))),this._box.toggleAttribute(`homogeneous`,this.args.homogeneous),this._box.setAttribute(`row-spacing`,String(Math.max(0,Math.trunc(this.args.rowSpacing)))))}}]},Er=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Dr=[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`None`,value:`none`}],Or={title:`Presentation/List View`,description:`Gtk.ListView — one row per item of a list model, each built by a factory. The model is the portable list (ADR 0046); which Gtk.SelectionModel would have wrapped it is the selection mode.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:Dr,defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`singleClickActivate`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!1}]},kr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`],Ar={title:`Presentation/Grid View`,description:`Gtk.GridView — the same model and factory as a list view, reflowed into as many equal columns as the width fits, between min-columns and max-columns.`,controls:[{name:`maxColumns`,label:`Max columns`,type:t.NUMBER,defaultValue:4},{name:`minColumns`,label:`Min columns`,type:t.NUMBER,defaultValue:1},{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:Dr,defaultValue:`single`}]},jr={stories:[class GridViewWebStory extends StoryElement{_view=null;constructor(){super(GridViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ar}initialize(){this._view=document.createElement(`gtk-grid-view`),this._view.setAttribute(`model`,JSON.stringify(kr)),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){if(!this._view)return;let e=Math.max(1,this.args.minColumns);this._view.setAttribute(`min-columns`,String(e)),this._view.setAttribute(`max-columns`,String(Math.max(e,this.args.maxColumns))),this._view.setAttribute(`selection-mode`,this.args.selectionMode)}}]},Mr=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Nr={title:`Presentation/List Box`,description:`Gtk.ListBox — one row per child you append, with GTK’s four selection modes. Ctrl toggles and Shift extends from the anchor the last Shift-click left behind; activate-on-single-click defaults to TRUE here, unlike Gtk.ListView’s single-click-activate.`,controls:[{name:`selectionMode`,label:`Selection`,type:t.SELECT,options:[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`Browse`,value:`browse`},{label:`None`,value:`none`}],defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`activateOnSingleClick`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!0},{name:`tabBehavior`,label:`Tab behaviour`,type:t.SELECT,options:[{label:`All`,value:`all`},{label:`Item`,value:`item`},{label:`Cell`,value:`cell`}],defaultValue:`all`}]},Pr={stories:[class ListBoxWebStory extends StoryElement{_box=null;constructor(){super(ListBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Nr}initialize(){this._box=document.createElement(`gtk-list-box`),this._box.style.width=`100%`;for(let e of Mr){let t=document.createElement(`gtk-list-box-row`),n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.setAttribute(`selection-mode`,this.args.selectionMode),this._box.toggleAttribute(`show-separators`,this.args.showSeparators),this._box.setAttribute(`activate-on-single-click`,String(this.args.activateOnSingleClick)),this._box.setAttribute(`tab-behavior`,this.args.tabBehavior))}}]},Fr={stories:[class ListViewWebStory extends StoryElement{_view=null;constructor(){super(ListViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Or}initialize(){this._view=document.createElement(`gtk-list-view`),this._view.setAttribute(`model`,JSON.stringify(Er)),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.setAttribute(`selection-mode`,this.args.selectionMode),this._view.toggleAttribute(`show-separators`,this.args.showSeparators),this._view.toggleAttribute(`single-click-activate`,this.args.singleClickActivate))}}]},Ir=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],Lr={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:t.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},Rr={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},zr={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return Lr}initialize(){this._widget=document.createElement(`adw-shortcut-label`),this._sync(),this.addContent(this._widget)}updateArgs(e){this._sync()}_sync(){this._widget&&(this._widget.setAttribute(`disabled-text`,this.args.disabledText),this._widget.setAttribute(`accelerator`,this.args.accelerator))}},class ShortcutLabelLevelsWebStory extends StoryElement{_widgets=[];constructor(){super(ShortcutLabelLevelsWebStory.getMetadata(),`Default`)}static getMetadata(){return Rr}initialize(){let e=document.createElement(`div`);e.style.display=`grid`,e.style.gridTemplateColumns=`auto auto`,e.style.rowGap=`12px`,e.style.columnGap=`24px`,e.style.alignItems=`center`;for(let t of Ir){let n=document.createElement(`span`);n.className=`dimmed`,n.textContent=t.label,e.append(n);let r=document.createElement(`adw-shortcut-label`);r.style.justifySelf=`end`,r.setAttribute(`disabled-text`,this.args.disabledText),r.setAttribute(`accelerator`,t.accelerator),e.append(r),this._widgets.push(r)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.setAttribute(`disabled-text`,this.args.disabledText)}}]},Br={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:t.RANGE,min:16,max:64,step:4,defaultValue:48}]},Vr={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return Br}initialize(){this._spinner=document.createElement(`adw-spinner`),this._spinner.setAttribute(`size`,String(this.args.size)),this.addContent(this._spinner)}updateArgs(e){this._spinner&&this._spinner.setAttribute(`size`,String(this.args.size))}}]},Hr={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Documents you create or open will appear here.`}]},Ur={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return Hr}initialize(){this._page=document.createElement(`adw-status-page`);let e=document.createElement(`gtk-button`);e.setAttribute(`label`,`New Document`),e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),this._page.appendChild(e),this._sync(),this.addContent(this._page)}updateArgs(e){this._sync()}_sync(){this._page&&(this._page.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)),this._page.setAttribute(`title`,this.args.title),this._page.setAttribute(`description`,this.args.description))}}]},Wr={Pictures:[`Holiday`,`Screenshots`],Music:[`Albums`],Notes:[]},Gr={title:`Presentation/Tree Expander`,description:`Gtk.TreeExpander — the indent and the disclosure arrow a tree row wears in front of its contents. A leaf takes one indent in place of the arrow, so its text lines up with its siblings.`,controls:[{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`hideExpander`,label:`Hide the arrow`,type:t.BOOLEAN,defaultValue:!1},{name:`indentForIcon`,label:`Indent leaves by an arrow`,type:t.BOOLEAN,defaultValue:!0}]},Kr=Object.entries(Wr).flatMap(([e,t])=>[{label:e,depth:0,expandable:t.length>0},...t.map(e=>({label:e,depth:1,expandable:!1}))]),qr={stories:[class TreeExpanderWebStory extends StoryElement{_expanders=[];constructor(){super(TreeExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Gr}initialize(){let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`);for(let t of Kr){let n=document.createElement(`gtk-tree-expander`);n.setAttribute(`depth`,String(t.depth)),n.toggleAttribute(`expandable`,t.expandable);let r=document.createElement(`gtk-label`);r.setAttribute(`label`,t.label),n.appendChild(r),e.appendChild(n),this._expanders.push(n)}this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this.args.expanded;this._expanders.forEach((t,n)=>{t.toggleAttribute(`expanded`,e),t.toggleAttribute(`hide-expander`,this.args.hideExpander),t.setAttribute(`indent-for-icon`,String(this.args.indentForIcon)),Kr[n].depth>0&&(t.hidden=!e)})}}]},Jr={title:`Presentation/WindowHandle`,description:`Gtk.WindowHandle — the titlebar strip. Dragging it moves the window; a double click, a middle click and a right click raise the window actions the compositor (or, here, the titlebar settings) names.`,controls:[{name:`action`,label:`Double-click action`,type:t.SELECT,options:[{label:`Toggle maximize`,value:`toggle-maximize`},{label:`Minimize`,value:`minimize`},{label:`Menu`,value:`menu`},{label:`None`,value:`none`}],defaultValue:`toggle-maximize`}]},Yr={stories:[class WindowHandleWebStory extends StoryElement{_handle=null;constructor(){super(WindowHandleWebStory.getMetadata(),`Default`)}static getMetadata(){return Jr}initialize(){let e=document.createElement(`gtk-window-handle`),t=document.createElement(`adw-header-bar`),n=document.createElement(`adw-window-title`);n.setAttribute(`title`,`Notes`),t.appendChild(n),e.appendChild(t),this._handle=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._handle;e&&e.setAttribute(`double-click-action`,this.args.action)}}]},Xr={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`3 unread messages`}]},Zr={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return Xr}initialize(){this._windowTitle=document.createElement(`adw-window-title`),this._sync(),this.addContent(this._windowTitle)}updateArgs(e){this._sync()}_sync(){this._windowTitle&&(this._windowTitle.setAttribute(`title`,this.args.title),this._windowTitle.setAttribute(`subtitle`,this.args.subtitle))}}]},Qr={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:t.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$2(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$2,`iconClass`);const $r={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Qr}initialize(){this._row=document.createElement(`adw-action-row`),this._icon=document.createElement(`span`),this._icon.setAttribute(`slot`,`prefix`),this._icon.className=iconClass$2(this.args.iconName);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`suffix`),e.setAttribute(`icon`,`go-next`),e.setAttribute(`flat`,``),this._row.append(this._icon,e),this._syncRow();let t=document.createElement(`adw-preferences-group`);t.append(this._row);let n=document.createElement(`adw-clamp`);n.setAttribute(`maximum-size`,`400`),n.append(t),this.addContent(n)}updateArgs(e){this._syncRow(),this._icon&&(this._icon.className=iconClass$2(this.args.iconName))}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`activatable`,this.args.activatable))}}]},ei={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:t.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]},ti=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const ni={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ei}initialize(){this._row=document.createElement(`adw-button-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=iconName$1(this.args.startIconName);e?this._row.setAttribute(`start-icon-name`,e):this._row.removeAttribute(`start-icon-name`),this._applyStyle(this.args.style)}_applyStyle(e){if(this._row){for(let e of ti)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},ri=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],ii={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:1}]},ai={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ii}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`model`,JSON.stringify([...ri])),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.setAttribute(`selected`,String(this.args.selected)))}}]},oi={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:t.BOOLEAN,defaultValue:!0}]},si={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return oi}initialize(){this._row=document.createElement(`adw-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text),this._row.toggleAttribute(`show-apply-button`,this.args.showApplyButton))}}]},ci={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:t.BOOLEAN,defaultValue:!1}]},li={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ci}initialize(){this._row=document.createElement(`adw-expander-row`);let e=document.createElement(`adw-entry-row`);e.setAttribute(`title`,`Host`),e.setAttribute(`text`,`proxy.example.com`);let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,`Use authentication`),this._row.append(e,t),this._syncRow();let n=document.createElement(`adw-preferences-group`);n.append(this._row);let r=document.createElement(`adw-clamp`);r.setAttribute(`maximum-size`,`400`),r.append(n),this.addContent(r)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`expanded`,this.args.expanded),this._row.toggleAttribute(`show-enable-switch`,this.args.showEnableSwitch))}}]},ui={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`correct-horse-battery`}]},di={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ui}initialize(){this._row=document.createElement(`adw-password-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text))}}]},fi={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]},pi=[`Europe`,`Americas`,`Asia`,`Oceania`],mi={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return fi}initialize(){this._group=document.createElement(`adw-preferences-group`);let e=document.createElement(`button`);e.className=`adw-button flat`,e.textContent=`Sign out`,e.setAttribute(`slot`,`header-suffix`),this._group.append(e);let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,`Display name`),t.setAttribute(`text`,`Grace Hopper`),this._group.append(t);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Sync over Wi-Fi only`),n.setAttribute(`subtitle`,`Avoid using mobile data for backups`),n.setAttribute(`active`,``),this._group.append(n);let r=document.createElement(`adw-combo-row`);r.setAttribute(`title`,`Region`),r.setAttribute(`model`,JSON.stringify(pi)),r.setAttribute(`selected`,`0`),this._group.append(r),this._syncGroup();let i=document.createElement(`adw-clamp`);i.setAttribute(`maximum-size`,`400`),i.append(this._group),this.addContent(i)}updateArgs(e){this._syncGroup()}_syncGroup(){this._group&&(this._group.setAttribute(`title`,this.args.title),this._group.setAttribute(`description`,this.args.description))}}]},hi={title:`Boxed Lists/Preferences Row`,description:`Adw.PreferencesRow — the base of every boxed-list row: a list row with a title that the preferences dialog searches. The title can carry Pango markup and be made selectable.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`A <b>plain</b> preferences row`},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!0},{name:`titleSelectable`,label:`Title selectable`,type:t.BOOLEAN,defaultValue:!1}]},gi={stories:[class PreferencesRowWebStory extends StoryElement{_row=null;constructor(){super(PreferencesRowWebStory.getMetadata(),`Default`)}static getMetadata(){return hi}initialize(){this._row=document.createElement(`adw-preferences-row`),this._sync();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._sync()}_sync(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.toggleAttribute(`use-markup`,this.args.useMarkup),this._row.toggleAttribute(`title-selectable`,this.args.titleSelectable))}}]},_i={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:t.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:0}]},vi={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return _i}initialize(){this._row=document.createElement(`adw-spin-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=this.args.digits;this._row.setAttribute(`adjustment`,JSON.stringify({lower:0,upper:100,pageIncrement:10,stepIncrement:10**-e})),this._row.setAttribute(`value`,String(this.args.value))}}]},yi={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0}]},bi={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return yi}initialize(){this._row=document.createElement(`adw-switch-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`active`,this.args.active))}}]},xi={title:`Drawing/Drag Icon`,description:"Gtk.DragIcon — the widget that follows the pointer while a drag is in flight, and is destroyed with the drag. No application builds one: `get_for_drag` returns the icon a drag is using, and the drag source sets its child. What it takes as that child is the interesting part, because `create_widget_for_value` answers for six kinds of value and a drag source that offers a string gets a label and one that offers a colour gets a swatch. A drag icon takes no input at all, which is the C's own note: 'drag icons do not allow user input'.",controls:[{name:`value`,label:`Value being dragged`,type:t.SELECT,options:[{label:`A string (a Gtk.Label)`,value:`string`},{label:`A GdkRGBA (a colour swatch)`,value:`rgba`},{label:`A content provider only (no icon)`,value:`none`}],defaultValue:`string`},{name:`actions`,label:`Drag actions`,type:t.SELECT,options:[{label:`Copy`,value:`copy`},{label:`Move`,value:`move`}],defaultValue:`copy`}]},Si={stories:[class DragIconWebStory extends StoryElement{_row=null;_hint=null;constructor(){super(DragIconWebStory.getMetadata(),`Default`)}static getMetadata(){return xi}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.alignItems=`center`,e.style.gap=`12px`;let t=document.createElement(`p`);t.className=`dim-label`,this._hint=t,e.append(t),this._row=document.createElement(`div`),this._row.className=`card`,this._row.draggable=!0,this._row.style.display=`flex`,this._row.style.alignItems=`center`,this._row.style.gap=`12px`,this._row.style.padding=`12px`;let n=document.createElement(`span`);n.className=`heading`,n.textContent=`Report.odt`,this._row.append(n),this._row.addEventListener(`dragstart`,e=>this._onDragStart(e)),e.append(this._row),this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_value(){switch(this.args.value){case`rgba`:return{red:.25,green:.55,blue:.95,alpha:1};case`none`:return null;default:return`Report.odt`}}_onDragStart(e){e.dataTransfer!==null&&(e.dataTransfer.effectAllowed=this.args.actions===`move`?`move`:`copy`);let t=this._value();t!==null&&Zt.getForDrag(e).setChild(Zt.createWidgetForValue(t))}_apply(){this._hint===null||this._row===null||(this._hint.textContent=this.args.value===`none`?`Drag the row — no icon, because the value has no widget to show`:`Drag the row and watch the pointer`,this._row.title=`Draggable — the icon that follows the pointer is a <gtk-drag-icon>`)}}]},Ci={title:`Drawing/Drawing Area`,description:"Gtk.DrawingArea — a blank widget that owns a size and a callback and nothing else: whatever you see is what `set_draw_func` painted. `content-width` and `content-height` are the MINIMUM and natural size at once, so a parent can hand the area more room but never less; at 0 the area has no intrinsic size at all and fills whatever it is given.",controls:[{name:`contentWidth`,label:`Content width`,type:t.RANGE,min:0,max:320,step:16,defaultValue:160},{name:`contentHeight`,label:`Content height`,type:t.RANGE,min:0,max:320,step:16,defaultValue:120},{name:`shape`,label:`Shape`,type:t.SELECT,options:[{label:`Circle`,value:`circle`},{label:`Grid`,value:`grid`},{label:`Crosshair`,value:`crosshair`}],defaultValue:`circle`}]},wi={stories:[class DrawingAreaWebStory extends StoryElement{_area=null;constructor(){super(DrawingAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return Ci}initialize(){this._area=document.createElement(`gtk-drawing-area`),this._area.setDrawFunc((e,t,n,r)=>{switch(t.fillStyle=`currentColor`,t.globalCompositeOperation=`source-over`,t.fillRect(0,0,n,r),t.globalCompositeOperation=`difference`,this.args.shape){case`grid`:for(let e=0;e<n;e+=16)t.fillRect(e,0,8,r);break;case`crosshair`:t.fillRect(n/2-1,0,2,r),t.fillRect(0,r/2-1,n,2);break;default:t.beginPath(),t.arc(n/2,r/2,Math.min(n,r)/2,0,2*Math.PI),t.fill();break}t.globalCompositeOperation=`source-over`}),this._apply(),this.addContent(this._area)}updateArgs(e){this._apply()}_apply(){this._area&&(this._area.setAttribute(`content-width`,String(this.args.contentWidth)),this._area.setAttribute(`content-height`,String(this.args.contentHeight)))}}]},Ti={title:`Drawing/GL Area`,description:"Gtk.GLArea — a widget whose contents are drawn on a GPU. GTK emits `::resize` before the first `::render` and the render flag is cleared AFTER the signal, so a handler may queue another frame with `queue_render()`. Here the replica is a `<canvas>` with a real WebGL context: the browser has no desktop GL, so `api` always reports the ES flavour it was given.",controls:[{name:`autoRender`,label:`Auto render`,type:t.BOOLEAN,defaultValue:!0},{name:`hasDepthBuffer`,label:`Depth buffer`,type:t.BOOLEAN,defaultValue:!1},{name:`allowedApis`,label:`Allowed APIs`,type:t.SELECT,options:[{label:`GL and GLES (default)`,value:`gl gles`},{label:`GLES only`,value:`gles`},{label:`GL only`,value:`gl`}],defaultValue:`gl gles`},{name:`spinning`,label:`Spin the triangle`,type:t.BOOLEAN,defaultValue:!0}]},Ei={stories:[class GLAreaWebStory extends StoryElement{_area=null;_readout=null;_frame=0;_program=null;_buffer=null;_angle=0;_renders=0;_viewport=`—`;constructor(){super(GLAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return Ti}initialize(){this._area=document.createElement(`gtk-gl-area`),this._area.style.width=`240px`,this._area.style.height=`160px`,this._readout=document.createElement(`div`),this._readout.className=`adw-gl-area-story-readout`,this._area.addEventListener(`resize`,e=>{let{width:t,height:n}=e.detail;this._viewport=`${t} × ${n}`,this._refresh()}),this._area.addEventListener(`render`,e=>{let{context:t}=e.detail;t&&this._draw(t),this._renders+=1,this._refresh()}),this._apply(),this._start();let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`6px`,e.style.alignItems=`center`,e.append(this._area,this._readout),this.addContent(e)}updateArgs(e){this._stop(),this._apply(),this._start()}_apply(){this._area&&(this._area.setAttribute(`auto-render`,String(this.args.autoRender)),this._area.setAttribute(`has-depth-buffer`,String(this.args.hasDepthBuffer)),this._area.setAttribute(`allowed-apis`,this.args.allowedApis))}_start(){if(!this.args.spinning)return;let step=()=>{this._angle+=.05,this._area?.queueRender(),this._frame=requestAnimationFrame(step)};this._frame=requestAnimationFrame(step)}_stop(){this._frame!==0&&cancelAnimationFrame(this._frame),this._frame=0}_draw(e){if(!(e instanceof WebGLRenderingContext))return;this._program||this._build(e);let t=this._program;t!==null&&(e.clearColor(.15,.16,.18,1),e.clear(e.COLOR_BUFFER_BIT),e.useProgram(t),e.uniform1f(e.getUniformLocation(t,`angle`),this._angle),e.bindBuffer(e.ARRAY_BUFFER,this._buffer),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,3))}_build(e){let compile=(t,n)=>{let r=e.createShader(t);return r?(e.shaderSource(r,n),e.compileShader(r),r):null},t=e.createProgram(),n=compile(e.VERTEX_SHADER,`
10776
10878
  attribute vec2 position;
10777
10879
  uniform float angle;
10778
10880
  void main () {
@@ -10783,8 +10885,8 @@ void main () {
10783
10885
  0.0, 1.0);
10784
10886
  }`),r=compile(e.FRAGMENT_SHADER,`
10785
10887
  precision mediump float;
10786
- void main () { gl_FragColor = vec4 (0.25, 0.55, 0.9, 1.0); }`);if(!t||!n||!r)return;e.attachShader(t,n),e.attachShader(t,r),e.linkProgram(t),this._program=t;let i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-.6,-.6,.6,-.6,0,.6]),e.STATIC_DRAW),this._buffer=i}_refresh(){this._readout&&(this._readout.textContent=`viewport ${this._viewport} device px · ${this._renders} renders`)}}]},Ei={title:`Drawing/Graphics Offload`,description:"Gtk.GraphicsOffload — a wrapper that asks the compositor to take its ONE child as it is, which is worth doing for content that changes every frame. `enabled` says whether it is attempted, and `black-background` paints the letterbox bars. The passthrough itself is the platform's: no browser API hands a surface to a compositor, so the replica carries the enum, the black rectangle and the bin layout, and says plainly which part is missing.",controls:[{name:`enabled`,label:`Enabled`,type:t.SELECT,options:[{label:`Enabled (default)`,value:`enabled`},{label:`Disabled`,value:`disabled`}],defaultValue:`enabled`},{name:`blackBackground`,label:`Black background`,type:t.BOOLEAN,defaultValue:!1},{name:`child`,label:`Child`,type:t.SELECT,options:[{label:`Label`,value:`label`},{label:`Image`,value:`image`},{label:`Row of labels`,value:`box`}],defaultValue:`image`}]},Di={stories:[class GraphicsOffloadWebStory extends StoryElement{_offload=null;constructor(){super(GraphicsOffloadWebStory.getMetadata(),`Default`)}static getMetadata(){return Ei}initialize(){this._offload=document.createElement(`gtk-graphics-offload`),this._offload.style.width=`280px`,this._offload.style.height=`96px`,this._apply();let e=document.createElement(`div`);e.style.display=`flex`,e.style.justifyContent=`center`,e.append(this._offload),this.addContent(e)}updateArgs(e){this._apply()}_apply(){if(!this._offload)return;this._offload.setAttribute(`enabled`,this.args.enabled),this._offload.setAttribute(`black-background`,String(this.args.blackBackground));let e;switch(this.args.child){case`label`:{let t=document.createElement(`gtk-label`);t.setAttribute(`label`,`The child of an offloaded layer`),e=t;break}case`box`:{let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`horizontal`),t.setAttribute(`spacing`,`12`);for(let e of[`One`,`Two`,`Three`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n)}e=t;break}default:{let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,`camera-photo`),t.setAttribute(`pixel-size`,`48`),e=t;break}}this._offload.replaceChildren(e)}}]},Oi={title:`Controls/Check Button`,description:`Gtk.CheckButton — a label beside an indicator, with a third "in between" state for a selection that is only partly made. The browser element spells the two states checked and indeterminate, the words the Adwaita stylesheet selects on; the grouped, single-choice form is Adw.Radio.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Enable networking`},{name:`checked`,label:`Checked`,type:t.BOOLEAN,defaultValue:!0},{name:`indeterminate`,label:`Indeterminate`,type:t.BOOLEAN,defaultValue:!1},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},ki={stories:[class CheckButtonWebStory extends StoryElement{_button=null;constructor(){super(CheckButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Oi}initialize(){this._button=document.createElement(`gtk-check-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.toggleAttribute(`checked`,this.args.checked),this._button.toggleAttribute(`indeterminate`,this.args.indeterminate),this._button.toggleAttribute(`disabled`,this.args.disabled))}}]},Ai=[`Automatic`,`Always`,`Never`,`When busy`],ji={title:`Controls/Drop Down`,description:`Gtk.DropDown — pick one value from a list. The button shows the selection; the list opens in a popover. Adw.ComboRow is the same choice presented as a boxed-list row.`,controls:[{name:`selected`,label:`Selected`,type:t.SELECT,options:Ai.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},Mi={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return ji}initialize(){this._dropDown=document.createElement(`gtk-drop-down`),this._dropDown.setAttribute(`model`,JSON.stringify(Ai)),this._apply(),this.addContent(this._dropDown)}updateArgs(e){this._apply()}_apply(){this._dropDown&&(this._dropDown.setAttribute(`selected`,String(this.args.selected)),this.args.enableSearch?this._dropDown.setAttribute(`enable-search`,``):this._dropDown.removeAttribute(`enable-search`))}}]},Ni={title:`Controls/Entry`,description:`Gtk.Entry — a single-line text field. Libadwaita ships no AdwEntry; the Adwaita look is the GTK entry styled by the stylesheet, which is why the row variants (Entry Row, Password Entry Row) are the widgets with an Adw prefix.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:``},{name:`placeholder`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search files…`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0}]},Pi={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Ni}initialize(){this._entry=document.createElement(`gtk-entry`),this._entry.style.minWidth=`280px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`value`,this.args.text),this._entry.setAttribute(`placeholder`,this.args.placeholder),this.args.editable?this._entry.removeAttribute(`disabled`):this._entry.setAttribute(`disabled`,``))}}]},Fi={title:`Controls/Spinner (GTK)`,description:`Gtk.Spinner — GTK's own busy indicator: a faint ring with a quarter arc turning around it, sized by its allocation. Adw.Spinner is the libadwaita replacement and looks different; under reduced motion GTK swaps this one for a static hourglass, which Adw.Spinner deliberately does not do.`,controls:[{name:`size`,label:`Size (px)`,type:t.RANGE,min:16,max:64,step:4,defaultValue:32},{name:`spinning`,label:`Spinning`,type:t.BOOLEAN,defaultValue:!0},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Ii={stories:[class GtkSpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(GtkSpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return Fi}initialize(){this._spinner=document.createElement(`gtk-spinner`),this._apply(),this.addContent(this._spinner)}updateArgs(e){this._apply()}_apply(){if(!this._spinner)return;let e=String(this.args.size);this._spinner.style.width=`${e}px`,this._spinner.style.height=`${e}px`,this.args.spinning?this._spinner.start():this._spinner.stop(),this._spinner.toggleAttribute(`disabled`,this.args.disabled)}}]},Li={title:`Controls/Level Bar`,description:"Gtk.LevelBar — how full something is, over an interval that need not be 0…1: a password strength meter, a battery. `mode` decides one filled level or one block per unit, and the block takes a class from the nearest OFFSET (low, high, full by default), which is how libadwaita colours it and how an application adds a colour of its own.",controls:[{name:`value`,label:`Value`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.8},{name:`maxValue`,label:`Max value`,type:t.RANGE,min:1,max:5,step:1,defaultValue:5},{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Continuous`,value:`continuous`},{label:`Discrete`,value:`discrete`}],defaultValue:`continuous`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1}]},Ri={stories:[class LevelBarWebStory extends StoryElement{_bar=null;constructor(){super(LevelBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Li}initialize(){this._bar=document.createElement(`gtk-level-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;let e=this.args.orientation===`vertical`;this._bar.setAttribute(`orientation`,e?`vertical`:`horizontal`),this._bar.style.width=e?``:`200px`,this._bar.style.height=e?`120px`:``,this._bar.setAttribute(`max-value`,String(this.args.maxValue)),this._bar.setAttribute(`mode`,this.args.mode),this._bar.setAttribute(`value`,String(this.args.value)),this._bar.toggleAttribute(`inverted`,this.args.inverted)}}]},zi={title:`Controls/Password Entry`,description:`Gtk.PasswordEntry — a field for a secret: masked, no copy, a Caps Lock warning while it has focus, and show-peek-icon for a button that reveals it for one look. Adw.PasswordEntryRow is the boxed-list row built on it. Press the peek button, or Caps Lock on the keyboard, to see both states.`,controls:[{name:`showPeekIcon`,label:`Show peek icon`,type:t.BOOLEAN,defaultValue:!0},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Password`},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Bi={stories:[class PasswordEntryWebStory extends StoryElement{_entry=null;constructor(){super(PasswordEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return zi}initialize(){this._entry=document.createElement(`gtk-password-entry`),this._entry.style.minWidth=`240px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.toggleAttribute(`show-peek-icon`,this.args.showPeekIcon),this._entry.setAttribute(`placeholder`,this.args.placeholderText),this._entry.toggleAttribute(`disabled`,this.args.disabled))}}]},Vi={title:`Controls/Progress Bar`,description:"Gtk.ProgressBar — how much of a long operation is done. `fraction` is 0…1, `pulsing` is the indeterminate mode where the app knows it is busy but not how far along it is, and `osd` is libadwaita's hairline variant for under a header bar. Adw.Spinner is the size-less sibling.",controls:[{name:`fraction`,label:`Fraction`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.4},{name:`pulsing`,label:`Pulsing (indeterminate)`,type:t.BOOLEAN,defaultValue:!1},{name:`showText`,label:`Show text`,type:t.BOOLEAN,defaultValue:!0},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`osd`,label:`OSD (hairline)`,type:t.BOOLEAN,defaultValue:!1}]},Hi={stories:[class ProgressBarWebStory extends StoryElement{_bar=null;constructor(){super(ProgressBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Vi}initialize(){this._bar=document.createElement(`gtk-progress-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.toggleAttribute(`pulsing`,this.args.pulsing),this._bar.setAttribute(`fraction`,String(this.args.fraction)),this._bar.toggleAttribute(`show-text`,this.args.showText),this._bar.toggleAttribute(`inverted`,this.args.inverted),this._bar.toggleAttribute(`osd`,this.args.osd))}}]},Ui={title:`Controls/Scale`,description:`Gtk.Scale — a slider. Gtk.Scale extends Gtk.Range, which is abstract: the range itself has no tag, its adjustment, value, inverted and fill level are this widget’s properties. draw-value shows the number beside the knob at the value-pos you name, and the .value style class dims it.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`valuePos`,label:`Value position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Bottom`,value:`bottom`},{label:`Left`,value:`left`},{label:`Right`,value:`right`}],defaultValue:`top`},{name:`drawValue`,label:`Draw value`,type:t.BOOLEAN,defaultValue:!0},{name:`digits`,label:`Digits`,type:t.NUMBER,defaultValue:0},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`hasOrigin`,label:`Has origin`,type:t.BOOLEAN,defaultValue:!0},{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:40}]},Wi={stories:[class ScaleWebStory extends StoryElement{_scale=null;constructor(){super(ScaleWebStory.getMetadata(),`Default`)}static getMetadata(){return Ui}initialize(){this._scale=document.createElement(`gtk-scale`),this._scale.style.width=`260px`,this._apply(),this.addContent(this._scale)}updateArgs(e){this._apply()}_apply(){this._scale&&(this._scale.setAttribute(`orientation`,this.args.orientation),this._scale.setAttribute(`value-pos`,this.args.valuePos),this._scale.toggleAttribute(`draw-value`,this.args.drawValue),this._scale.setAttribute(`digits`,String(this.args.digits)),this._scale.toggleAttribute(`inverted`,this.args.inverted),this.args.hasOrigin?this._scale.removeAttribute(`has-origin`):this._scale.setAttribute(`has-origin`,`false`),this._scale.setAttribute(`adjustment`,`{"lower":0,"upper":100,"stepIncrement":1,"pageIncrement":10}`),this._scale.setAttribute(`value`,String(this.args.value)))}}]},Gi={title:`Controls/Search Entry`,description:`Gtk.SearchEntry — a field for typing a query. A search glyph leads while it is empty and a clear button follows once it is not, and search-changed waits out search-delay so a filter is not driven by every keystroke. Escape is stop-search, Ctrl+G is next-match.`,controls:[{name:`searchDelay`,label:`Search delay (ms)`,type:t.NUMBER,defaultValue:150},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search…`},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Ki={stories:[class SearchEntryWebStory extends StoryElement{_entry=null;_label=null;constructor(){super(SearchEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Gi}initialize(){this._entry=document.createElement(`gtk-search-entry`),this._entry.style.minWidth=`260px`,this._label=document.createElement(`gtk-label`),this._label.className=`dimmed`,this._label.textContent=`search-changed has not fired yet`,this._entry.addEventListener(`search-changed`,e=>{let{value:t}=e.detail;this._label&&(this._label.textContent=`search-changed: "${t}"`)}),this._apply();let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`12px`,e.append(this._entry,this._label),this.addContent(e)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`search-delay`,String(this.args.searchDelay)),this._entry.setAttribute(`placeholder`,this.args.placeholderText),this._entry.toggleAttribute(`disabled`,this.args.disabled))}}]},qi={title:`Controls/Spin Button`,description:`Gtk.SpinButton — a number field with an arrow either side of it. The range is a Gtk.Adjustment, the typed value is clamped into it (or left alone, under update-policy if-valid), and numeric refuses anything that is not a number. Adw.SpinRow is the boxed-list row that wraps this same widget.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`digits`,label:`Digits`,type:t.NUMBER,defaultValue:0},{name:`numeric`,label:`Numeric`,type:t.BOOLEAN,defaultValue:!1},{name:`snapToTicks`,label:`Snap to ticks`,type:t.BOOLEAN,defaultValue:!1},{name:`wrap`,label:`Wrap`,type:t.BOOLEAN,defaultValue:!1},{name:`updatePolicy`,label:`Update policy`,type:t.SELECT,options:[{label:`Always`,value:`always`},{label:`If valid`,value:`if-valid`}],defaultValue:`always`},{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:5}]},Ji={stories:[class SpinButtonWebStory extends StoryElement{_spin=null;constructor(){super(SpinButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return qi}initialize(){this._spin=document.createElement(`gtk-spin-button`),this._apply(),this.addContent(this._spin)}updateArgs(e){this._apply()}_apply(){this._spin&&(this._spin.setAttribute(`orientation`,this.args.orientation),this._spin.setAttribute(`digits`,String(this.args.digits)),this._spin.toggleAttribute(`numeric`,this.args.numeric),this._spin.toggleAttribute(`snap-to-ticks`,this.args.snapToTicks),this._spin.toggleAttribute(`wrap`,this.args.wrap),this._spin.setAttribute(`update-policy`,this.args.updatePolicy),this._spin.setAttribute(`adjustment`,`{"lower":0,"upper":10,"stepIncrement":1,"pageIncrement":2}`),this._spin.setAttribute(`value`,String(this.args.value)))}}]},Yi={title:`Controls/Switch`,description:`Gtk.Switch — a light switch with two states that are NOT the same thing: active is where the user put it, state is what the switched thing currently is, which is how a change that takes a while looks like a pending one. Adw.SwitchRow is the same control with a title beside it.`,controls:[{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0},{name:`state`,label:`State (the backend)`,type:t.BOOLEAN,defaultValue:!0},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Xi={stories:[class SwitchWebStory extends StoryElement{_switch=null;constructor(){super(SwitchWebStory.getMetadata(),`Default`)}static getMetadata(){return Yi}initialize(){this._switch=document.createElement(`gtk-switch`),this._apply(),this.addContent(this._switch)}updateArgs(e){this._apply()}_apply(){this._switch&&(this._switch.toggleAttribute(`active`,this.args.active),this._switch.toggleAttribute(`state`,this.args.state),this._switch.toggleAttribute(`disabled`,this.args.disabled))}}]},Zi={title:`Layout/Expander`,description:"Gtk.Expander — a title the user clicks to reveal the child below it. The arrow is its own CSS node and `:checked` is set on THAT node, not on the widget, which is what libadwaita's _expanders.scss keys the glyph swap on. `use-underline` marks a mnemonic with `_`, and Alt+that character activates the expander.",controls:[{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!1},{name:`useUnderline`,label:`Label marks a mnemonic`,type:t.BOOLEAN,defaultValue:!1},{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`_More options`},{name:`resizeToplevel`,label:`Resize the toplevel`,type:t.BOOLEAN,defaultValue:!1}]},Qi={stories:[class ExpanderWebStory extends StoryElement{_expander=null;constructor(){super(ExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Zi}initialize(){this._expander=document.createElement(`gtk-expander`),this._expander.style.width=`320px`;let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`),e.style.padding=`12px`;for(let t of[`Notifications`,`Sound`,`Network`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,t),e.appendChild(n)}this._expander.appendChild(e),this._apply(),this.addContent(this._expander)}updateArgs(e){this._apply()}_apply(){this._expander&&(this._expander.toggleAttribute(`use-underline`,this.args.useUnderline),this._expander.setAttribute(`label`,String(this.args.label)),this._expander.toggleAttribute(`resize-toplevel`,this.args.resizeToplevel),this._expander.toggleAttribute(`expanded`,this.args.expanded))}}]},$i={title:`Layout/Overlay`,description:`Gtk.Overlay — widgets stacked on top of one main child. The main child sizes the overlay; every other child is placed by its own halign/valign, which is what gtk_overlay_get_child_position reads and nothing else. Libadwaita ships no Adw.Overlay and gives the node no rule of its own — the .left/.right/.top/.bottom classes it puts on an edge-aligned child are the whole published contract.`,controls:[{name:`halign`,label:`Overlay halign`,type:t.SELECT,options:[{label:`Fill (the default)`,value:`fill`},{label:`Start`,value:`start`},{label:`Center`,value:`center`},{label:`End`,value:`end`}],defaultValue:`end`},{name:`valign`,label:`Overlay valign`,type:t.SELECT,options:[{label:`Fill (the default)`,value:`fill`},{label:`Start`,value:`start`},{label:`Center`,value:`center`},{label:`End`,value:`end`}],defaultValue:`end`},{name:`showLabel`,label:`Label the overlay`,type:t.BOOLEAN,defaultValue:!0}]},ea={stories:[class OverlayWebStory extends StoryElement{_overlay=null;_badge=null;constructor(){super(OverlayWebStory.getMetadata(),`Default`)}static getMetadata(){return $i}initialize(){this._overlay=document.createElement(`gtk-overlay`),this._overlay.style.width=`260px`,this._overlay.style.height=`160px`;let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`Main child — its size is the overlay`),e.classList.add(`dimmed`),this._overlay.appendChild(e),this._badge=document.createElement(`gtk-label`),this._badge.setAttribute(`slot`,`overlay`),this._badge.setAttribute(`label`,`2`),this._badge.classList.add(`osd`),this._overlay.appendChild(this._badge),this._apply(),this.addContent(this._overlay)}updateArgs(e){this._apply()}_apply(){if(!this._badge)return;let align=(e,t)=>{e===`fill`?this._badge?.removeAttribute(t):this._badge?.setAttribute(t,String(e))};align(this.args.halign,`halign`),align(this.args.valign,`valign`),this._badge.hidden=!this.args.showLabel}}]},ta={title:`Layout/Paned`,description:"Gtk.Paned — two children either side of a divider the user drags. With both children resizable and no position set, GTK divides the paned in PROPORTION TO THE TWO SIZE REQUESTS rather than in half, and it draws the divider as the `separator` node a GtkPanedHandle carries. Libadwaita styles that node in _paned.scss: 1px, 5px when `wide-handle`, with the rule as an inset shadow rather than a fill.",controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`wideHandle`,label:`Wide handle`,type:t.BOOLEAN,defaultValue:!1},{name:`resizeStartChild`,label:`Resize the first child`,type:t.BOOLEAN,defaultValue:!0},{name:`resizeEndChild`,label:`Resize the second child`,type:t.BOOLEAN,defaultValue:!0},{name:`shrinkStartChild`,label:`The first child may shrink`,type:t.BOOLEAN,defaultValue:!0},{name:`position`,label:`Position (0 = derive)`,type:t.NUMBER,min:-1,max:400,step:1,defaultValue:-1}]};function pane(e,t){let n=document.createElement(`gtk-box`);n.setAttribute(`orientation`,`vertical`),n.setAttribute(`spacing`,`4`),n.style.padding=`12px`;let r=document.createElement(`gtk-label`);r.setAttribute(`label`,e),n.appendChild(r);let i=document.createElement(`gtk-label`);return i.setAttribute(`label`,`${t}px of size request`),i.classList.add(`dimmed`),n.appendChild(i),n}const na={stories:[class PanedWebStory extends StoryElement{_paned=null;constructor(){super(PanedWebStory.getMetadata(),`Default`)}static getMetadata(){return ta}initialize(){this._paned=document.createElement(`gtk-paned`),this._paned.style.width=`400px`,this._paned.style.height=`140px`,this._paned.appendChild(pane(`First child`,100));let e=pane(`Second child`,300);e.setAttribute(`slot`,`end`),this._paned.appendChild(e),this._apply(),this.addContent(this._paned)}updateArgs(e){this._apply()}_apply(){this._paned&&(this._paned.setAttribute(`orientation`,String(this.args.orientation)),this._paned.toggleAttribute(`wide-handle`,this.args.wideHandle),this._paned.setAttribute(`resize-start-child`,this.args.resizeStartChild?`true`:`false`),this._paned.setAttribute(`resize-end-child`,this.args.resizeEndChild?`true`:`false`),this._paned.setAttribute(`shrink-start-child`,this.args.shrinkStartChild?`true`:`false`),this._paned.setAttribute(`position`,String(this.args.position)))}}]},ra={title:`Layout/Revealer`,description:`Gtk.Revealer — shows and hides its child with an animation. The transition is one of fourteen nicks and it is not only an opacity change: a slide scales the box along one axis while allocating the child at its UNSCALED size, and a swing folds it in with sin (π · pos / 2). Libadwaita styles no revealer node of its own, so everything here is GTK behaviour the browser element ports.`,controls:[{name:`transitionType`,label:`Transition`,type:t.SELECT,options:[{label:`Slide down (the default)`,value:`slide-down`},{label:`Slide up`,value:`slide-up`},{label:`Slide left`,value:`slide-left`},{label:`Slide right`,value:`slide-right`},{label:`Crossfade`,value:`crossfade`},{label:`Fade + slide down`,value:`fade-slide-down`},{label:`Swing down (fold)`,value:`swing-down`},{label:`Swing right (fold)`,value:`swing-right`},{label:`None`,value:`none`}],defaultValue:`slide-down`},{name:`transitionDuration`,label:`Duration (ms)`,type:t.RANGE,min:0,max:800,step:50,defaultValue:250},{name:`revealChild`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},ia={stories:[class RevealerWebStory extends StoryElement{_revealer=null;constructor(){super(RevealerWebStory.getMetadata(),`Default`)}static getMetadata(){return ra}initialize(){this._revealer=document.createElement(`gtk-revealer`);let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`),e.style.padding=`12px`;let t=document.createElement(`gtk-label`);t.setAttribute(`label`,`The revealed child`),e.appendChild(t);let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Use the controls to change the transition`),n.classList.add(`dimmed`),e.appendChild(n),this._revealer.appendChild(e),this._apply(),this.addContent(this._revealer)}updateArgs(e){this._apply()}_apply(){this._revealer&&(this._revealer.setAttribute(`transition-type`,String(this.args.transitionType)),this._revealer.setAttribute(`transition-duration`,String(this.args.transitionDuration)),this._revealer.toggleAttribute(`reveal-child`,this.args.revealChild))}}]},aa={title:`Layout/Scrollbar`,description:`Gtk.Scrollbar — a trough and a slider, positioned by a GtkAdjustment. The slider is page_size over the whole range long and sits at the position over the SCROLLABLE range, which is why the two numbers it is made of do not share a denominator.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`vertical`},{name:`upper`,label:`Adjustment upper`,type:t.NUMBER,defaultValue:400},{name:`pageSize`,label:`Adjustment page size`,type:t.NUMBER,defaultValue:120},{name:`value`,label:`Adjustment value`,type:t.NUMBER,defaultValue:80}]},oa={stories:[class ScrollbarWebStory extends StoryElement{_scrollbar=null;constructor(){super(ScrollbarWebStory.getMetadata(),`Default`)}static getMetadata(){return aa}initialize(){let e=document.createElement(`gtk-scrollbar`);e.style.height=`240px`,e.style.width=`24px`,e.setAttribute(`valign`,`center`),this._scrollbar=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._scrollbar;e&&(e.setAttribute(`orientation`,this.args.orientation),e.adjustment={value:Number(this.args.value),lower:0,upper:Number(this.args.upper),stepIncrement:10,pageIncrement:80,pageSize:Number(this.args.pageSize)})}}]},sa={title:`Layout/ScrolledWindow`,description:`Gtk.ScrolledWindow — one child, two adjustments, and a scrollbar per edge that can actually scroll. The policies decide whether a bar appears, window-placement which edge it takes, and overlay-scrolling turns the bars into the auto-hiding indicators GNOME draws over the content.`,controls:[{name:`hPolicy`,label:`Horizontal policy`,type:t.SELECT,options:[{label:`Automatic`,value:`automatic`},{label:`Always`,value:`always`},{label:`Never`,value:`never`}],defaultValue:`automatic`},{name:`vPolicy`,label:`Vertical policy`,type:t.SELECT,options:[{label:`Automatic`,value:`automatic`},{label:`Always`,value:`always`},{label:`Never`,value:`never`}],defaultValue:`automatic`},{name:`placement`,label:`Window placement`,type:t.SELECT,options:[{label:`Top left`,value:`top-left`},{label:`Top right`,value:`top-right`},{label:`Bottom left`,value:`bottom-left`},{label:`Bottom right`,value:`bottom-right`}],defaultValue:`top-left`},{name:`frame`,label:`Frame`,type:t.BOOLEAN,defaultValue:!1},{name:`overlayScrolling`,label:`Overlay scrolling`,type:t.BOOLEAN,defaultValue:!0}]},ca={stories:[class ScrolledWindowWebStory extends StoryElement{_window=null;constructor(){super(ScrolledWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return sa}initialize(){let e=document.createElement(`gtk-scrolled-window`);e.style.height=`240px`,e.style.width=`260px`;let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`vertical`),t.setAttribute(`spacing`,`8`);for(let e=1;e<=16;e++){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Row ${e}`),t.appendChild(n)}e.appendChild(t),this._window=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._window;e&&(e.setAttribute(`hscrollbar-policy`,this.args.hPolicy),e.setAttribute(`vscrollbar-policy`,this.args.vPolicy),e.setAttribute(`window-placement`,this.args.placement),e.toggleAttribute(`has-frame`,this.args.frame),e.toggleAttribute(`overlay-scrolling`,this.args.overlayScrolling))}}]},la={title:`Layout/Separator`,description:`Gtk.Separator — a one-pixel rule between two groups of widgets. Libadwaita ships no Adw.Separator; it only styles the GTK one, and the .spacer style class turns the rule into an empty 12px gap.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`spacer`,label:`Spacer (draws nothing)`,type:t.BOOLEAN,defaultValue:!1}]},ua={stories:[class SeparatorWebStory extends StoryElement{_box=null;_separator=null;constructor(){super(SeparatorWebStory.getMetadata(),`Default`)}static getMetadata(){return la}initialize(){this._separator=document.createElement(`gtk-separator`),this._box=document.createElement(`gtk-box`),this._box.setAttribute(`spacing`,`12`);for(let e of[`Above`,`Below`]){let t=document.createElement(`gtk-label`);t.setAttribute(`label`,e),e===`Below`&&this._box.appendChild(this._separator),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){if(!this._box||!this._separator)return;let e=this.args.orientation===`vertical`;this._separator.setAttribute(`orientation`,e?`vertical`:`horizontal`),this._box.setAttribute(`orientation`,e?`horizontal`:`vertical`),this._separator.classList.toggle(`spacer`,this.args.spacer)}}]},da={title:`Layout/Breakpoint Bin`,description:`Adw.BreakpointBin gives breakpoints a home without a window: its one child rearranges itself at a size threshold, and the bin applies the LAST breakpoint whose condition holds. Resize the stage to see it.`,controls:[{name:`condition`,label:`Condition`,type:t.SELECT,options:[{label:`max-width: 480px`,value:`max-width: 480px`},{label:`max-width: 320px`,value:`max-width: 320px`},{label:`max-height: 200px`,value:`max-height: 200px`}],defaultValue:`max-width: 480px`},{name:`narrowLabel`,label:`Narrow label`,type:t.TEXT,defaultValue:`Narrow`},{name:`wideLabel`,label:`Wide label`,type:t.TEXT,defaultValue:`Wide`}]},fa={stories:[class BreakpointBinWebStory extends StoryElement{_bin=null;_label=null;constructor(){super(BreakpointBinWebStory.getMetadata(),`Default`)}static getMetadata(){return da}initialize(){this._bin=document.createElement(`adw-breakpoint-bin`),this._bin.style.minWidth=`150px`,this._bin.style.height=`60px`,this._label=document.createElement(`gtk-label`),this._label.id=`narrow`,this._label.classList.add(`title-1`),this._bin.appendChild(this._label),this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){!this._bin||!this._label||(this._label.setAttribute(`label`,this.args.wideLabel),this._bin.setAttribute(`breakpoints`,JSON.stringify([{condition:this.args.condition,setters:[{target:`#narrow`,property:`label`,value:this.args.narrowLabel}]}])))}}]},pa={title:`Layout/Layout Slot`,description:`Adw.LayoutSlot is the named hole a layout of an Adw.MultiLayoutView leaves for a child: it takes the child whose id matches, and its visible property follows that child's. On its own it is a bin, which is what this story shows.`,controls:[{name:`label`,label:`Child title`,type:t.TEXT,defaultValue:`Inbox`},{name:`visible`,label:`Child visible`,type:t.BOOLEAN,defaultValue:!0}]},ma={stories:[class LayoutSlotWebStory extends StoryElement{_view=null;_child=null;constructor(){super(LayoutSlotWebStory.getMetadata(),`Default`)}static getMetadata(){return pa}initialize(){this._child=document.createElement(`adw-navigation-page`),this._child.setAttribute(`tag`,`primary`),this._child.setAttribute(`slot`,`primary`);let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`The child the view inserted here.`),this._child.appendChild(e),this._view=document.createElement(`adw-multi-layout-view`),this._view.style.width=`360px`,this._view.style.height=`120px`;let t=document.createElement(`div`);t.setAttribute(`name`,`only`);let n=document.createElement(`adw-layout-slot`);n.setAttribute(`id`,`primary`),t.appendChild(n),this._view.appendChild(t),this._view.appendChild(this._child),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._child&&(this._child.setAttribute(`title`,this.args.label),this._child.toggleAttribute(`hidden`,!this.args.visible))}}]},ha={title:`Layout/Multi Layout View`,description:`Adw.MultiLayoutView holds one set of children and several arrangements of them: each child has an id, each layout has slots with ids, and switching layouts re-inserts every child into the slot of the SAME id.`,controls:[{name:`layoutName`,label:`Layout`,type:t.SELECT,options:[{label:`wide (split)`,value:`wide`},{label:`narrow (stacked)`,value:`narrow`}],defaultValue:`wide`},{name:`showDetails`,label:`Show the details pane`,type:t.BOOLEAN,defaultValue:!0}]},ga=`primary`,_a=`secondary`;function arrangement(e){let t=document.createElement(`adw-navigation-split-view`);e&&t.setAttribute(`collapsed`,``),t.setAttribute(`min-sidebar-width`,`160`),t.style.width=`420px`,t.style.height=`220px`;for(let[e,n]of[[`sidebar`,_a],[`content`,ga]]){let r=document.createElement(`adw-layout-slot`);r.setAttribute(`id`,n),r.setAttribute(`slot`,e),t.appendChild(r)}return t}var va=class MultiLayoutViewWebStory extends StoryElement{_view=null;_details=null;constructor(){super(MultiLayoutViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ha}initialize(){this._view=document.createElement(`adw-multi-layout-view`),this._view.style.width=`420px`,this._view.style.height=`220px`;for(let[e,t]of[[`wide`,!1],[`narrow`,!0]]){let n=arrangement(t);n.setAttribute(`name`,e),this._view.appendChild(n)}let e=page(`Inbox`,`12 unread`);e.setAttribute(`slot`,ga),this._details=page(`Message`),this._details.setAttribute(`slot`,_a),this._view.appendChild(e),this._view.appendChild(this._details),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){!this._view||!this._details||(this._details.toggleAttribute(`hidden`,!this.args.showDetails),this._view.setAttribute(`layout-name`,this.args.layoutName))}};function page(e,t=``){let n=document.createElement(`adw-navigation-page`);n.setAttribute(`title`,e),n.setAttribute(`tag`,e.toLowerCase());let r=document.createElement(`gtk-box`);r.setAttribute(`orientation`,`vertical`);let i=document.createElement(`adw-action-row`);return i.setAttribute(`title`,e),t!==``&&i.setAttribute(`subtitle`,t),r.appendChild(i),n.appendChild(r),n}const ya={stories:[va]},ba={title:`Text/Editable Label`,description:`Gtk.EditableLabel — a label you click and edit in place. Enter starts editing, Enter commits, Escape discards, and editable=false leaves it a label; the draft lives in the entry, not in the label.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0},{name:`editing`,label:`Editing`,type:t.BOOLEAN,defaultValue:!1}]},xa={stories:[class EditableLabelWebStory extends StoryElement{_label=null;constructor(){super(EditableLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return ba}initialize(){this._label=document.createElement(`gtk-editable-label`),this._label.text=this.args.text,this._apply(),this.addContent(this._label)}updateArgs(e){this._apply()}_apply(){this._label&&(this._label.editing||(this._label.text=this.args.text),this._label.editable=this.args.editable,this._label.editing=this.args.editing)}}]},Sa={title:`Text/Search Bar`,description:`Gtk.SearchBar — the strip that reveals a search entry when search starts. The property IS the revealer's reveal-child, so one boolean decides both whether the strip is shown and whether the search is on; hiding it clears the entry.`,controls:[{name:`searchModeEnabled`,label:`Search mode`,type:t.BOOLEAN,defaultValue:!1},{name:`showCloseButton`,label:`Close button`,type:t.BOOLEAN,defaultValue:!0}]},Ca={stories:[class SearchBarWebStory extends StoryElement{_bar=null;constructor(){super(SearchBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Sa}initialize(){this._bar=document.createElement(`gtk-search-bar`);let e=document.createElement(`gtk-entry`);e.setAttribute(`placeholder-text`,`Search`),this._bar.appendChild(e),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.searchModeEnabled=this.args.searchModeEnabled,this._bar.showCloseButton=this.args.showCloseButton)}}]},wa={title:`Text/Text View`,description:`Gtk.TextView — the multi-line editor. Its text lives in a Gtk.TextBuffer rather than in a property, wrap-mode and justification are Pango's, and accepts-tab defaults to TRUE, which is the opposite of a browser's.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`A text view holds as many lines as it is given.
10787
- Tab inserts a tab character.`},{name:`wrapMode`,label:`Wrap mode`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Char`,value:`char`},{label:`Word`,value:`word`},{label:`Word or char`,value:`word-char`}],defaultValue:`none`},{name:`justification`,label:`Justification`,type:t.SELECT,options:[{label:`Left`,value:`left`},{label:`Right`,value:`right`},{label:`Center`,value:`center`},{label:`Fill`,value:`fill`}],defaultValue:`left`},{name:`monospace`,label:`Monospace`,type:t.BOOLEAN,defaultValue:!1},{name:`acceptsTab`,label:`Tab inserts a tab`,type:t.BOOLEAN,defaultValue:!0},{name:`cursorVisible`,label:`Show cursor`,type:t.BOOLEAN,defaultValue:!0},{name:`topMargin`,label:`Top margin`,type:t.NUMBER,defaultValue:6}]},Ta={stories:[class TextViewWebStory extends StoryElement{_view=null;constructor(){super(TextViewWebStory.getMetadata(),`Default`)}static getMetadata(){return wa}initialize(){this._view=document.createElement(`gtk-text-view`),this._view.text=this.args.text,this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.wrapMode=this.args.wrapMode,this._view.justification=this.args.justification,this._view.monospace=this.args.monospace,this._view.acceptsTab=this.args.acceptsTab,this._view.cursorVisible=this.args.cursorVisible,this._view.topMargin=Number(this.args.topMargin??0))}}]},Ea={title:`Text/Text`,description:`Gtk.Text — the single-line text widget every Gtk.Entry is built on. Standalone it is a field with a placeholder and a length limit; visibility=false masks it, propagate-text-width grows it with its text.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:``},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0},{name:`visibility`,label:`Visible`,type:t.BOOLEAN,defaultValue:!0},{name:`maxLength`,label:`Max length (0 = none)`,type:t.NUMBER,defaultValue:0},{name:`propagateTextWidth`,label:`Grow with text`,type:t.BOOLEAN,defaultValue:!1}]},Da={stories:[class TextWebStory extends StoryElement{_text=null;constructor(){super(TextWebStory.getMetadata(),`Default`)}static getMetadata(){return Ea}initialize(){this._text=document.createElement(`gtk-text`),this._apply(),this.addContent(this._text)}updateArgs(e){this._apply()}_apply(){if(!this._text)return;let e=this._text;e.text=this.args.text,e.placeholderText=this.args.placeholderText,e.editable=this.args.editable,e.visibility=this.args.visibility,e.maxLength=Number(this.args.maxLength??0),e.propagateTextWidth=this.args.propagateTextWidth}}]},Oa={title:`Layout/Aspect Frame`,description:`Gtk.AspectFrame — one child, given a width/height ratio and a place in the space left over. obey-child is TRUE by default and takes the ratio from the child itself, so the story starts with it FALSE or the ratio control would be inert.`,controls:[{name:`ratio`,label:`Ratio`,type:t.RANGE,min:.5,max:3,step:.25,defaultValue:2},{name:`xalign`,label:`Xalign`,type:t.RANGE,min:0,max:1,step:.5,defaultValue:.5},{name:`yalign`,label:`Yalign`,type:t.RANGE,min:0,max:1,step:.5,defaultValue:.5},{name:`obeyChild`,label:`Obey child`,type:t.BOOLEAN,defaultValue:!1}]},ka={stories:[class AspectFrameWebStory extends StoryElement{_frame=null;constructor(){super(AspectFrameWebStory.getMetadata(),`Default`)}static getMetadata(){return Oa}initialize(){this._frame=document.createElement(`gtk-aspect-frame`),this._frame.style.width=`320px`,this._frame.style.height=`180px`;let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`The frame gives this child the ratio above, and puts it where xalign and yalign say.`),e.style.padding=`12px`,this._frame.append(e),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){this._frame&&(this._frame.setAttribute(`ratio`,String(this.args.ratio)),this._frame.setAttribute(`xalign`,String(this.args.xalign)),this._frame.setAttribute(`yalign`,String(this.args.yalign)),this._frame.setAttribute(`obey-child`,String(this.args.obeyChild)))}}]},Aa={title:`Layout/Center Box`,description:`Gtk.CenterBox — three widgets, pinned to the start, the centre and the end, with the space between them going to whichever child can grow. shrink-center-last decides who gives up space first.`,controls:[{name:`shrinkCenterLast`,label:`Shrink center last`,type:t.BOOLEAN,defaultValue:!0},{name:`baselinePosition`,label:`Baseline position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Center`,value:`center`},{label:`Bottom`,value:`bottom`}],defaultValue:`center`}]},ja={stories:[class CenterBoxWebStory extends StoryElement{_box=null;constructor(){super(CenterBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Aa}initialize(){this._box=document.createElement(`gtk-center-box`),this._box.style.padding=`12px`;for(let[e,t]of[[`start-widget`,`Start`],[`center-widget`,`Centre`],[`end-widget`,`End`]]){let n=document.createElement(`gtk-label`);n.setAttribute(`slot`,e),n.setAttribute(`label`,t),this._box.append(n)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.toggleAttribute(`shrink-center-last`,this.args.shrinkCenterLast),this._box.setAttribute(`baseline-position`,this.args.baselinePosition))}}]},Ma={title:`Layout/Fixed`,description:`Gtk.Fixed — children at pixel positions, which is the whole of its API: it declares no property of its own. The two offsets are the arguments of gtk_fixed_put().`,controls:[{name:`offsetX`,label:`Offset x`,type:t.RANGE,min:0,max:80,step:4,defaultValue:24},{name:`offsetY`,label:`Offset y`,type:t.RANGE,min:0,max:80,step:4,defaultValue:16}]},Na={stories:[class FixedWebStory extends StoryElement{_fixed=null;_cells=[];constructor(){super(FixedWebStory.getMetadata(),`Default`)}static getMetadata(){return Ma}initialize(){let e=document.createElement(`gtk-fixed`);this._fixed=e;for(let t of[`at (x, y)`,`at (x + 96, y + 40)`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,t),this._cells.push(n),e.append(n)}this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._fixed;if(e===null)return;let t=this.args.offsetX,n=this.args.offsetY,[r,i]=this._cells;r!==void 0&&e.move(r,t,n),i!==void 0&&e.move(i,t+96,n+40)}}]},Pa={title:`Layout/Frame`,description:`Gtk.Frame — a 1px border with a label embedded in its top edge. GTK draws the label as its own widget above the child, and label-xalign says where across the frame it sits.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Details`},{name:`labelXalign`,label:`Label xalign`,type:t.RANGE,defaultValue:0,min:0,max:1,step:.5}]},Fa={stories:[class FrameWebStory extends StoryElement{_frame=null;constructor(){super(FrameWebStory.getMetadata(),`Default`)}static getMetadata(){return Pa}initialize(){this._frame=document.createElement(`gtk-frame`);let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`A framed region: the label sits in the top edge of the border.`),e.style.padding=`12px`,this._frame.append(e),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){if(!this._frame)return;let e=this.args.label;e===``?this._frame.removeAttribute(`label`):this._frame.setAttribute(`label`,e),this._frame.setAttribute(`label-xalign`,String(this.args.labelXalign))}}]},Ia={title:`Layout/Grid`,description:`Gtk.Grid — a table of cells sized by what is in them, filled row by row. The two spacings are the gap between lines, the two homogeneous flags make every line the same, and a vertical grid attaches down the rows instead of across the columns.`,controls:[{name:`columnSpacing`,label:`Column spacing`,type:t.RANGE,min:0,max:36,step:2,defaultValue:12},{name:`rowSpacing`,label:`Row spacing`,type:t.RANGE,min:0,max:36,step:2,defaultValue:12},{name:`columnHomogeneous`,label:`Column homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`rowHomogeneous`,label:`Row homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`}]},La={stories:[class GridWebStory extends StoryElement{_grid=null;constructor(){super(GridWebStory.getMetadata(),`Default`)}static getMetadata(){return Ia}initialize(){this._grid=document.createElement(`gtk-grid`),this._grid.style.padding=`12px`;for(let e of[`Name`,`Value`,`Unit`,`editable`]){let t=document.createElement(`gtk-label`);t.setAttribute(`label`,e),t.style.padding=`6px`,this._grid.append(t)}this._apply(),this.addContent(this._grid)}updateArgs(e){this._apply()}_apply(){this._grid&&(this._grid.setAttribute(`column-spacing`,String(this.args.columnSpacing)),this._grid.setAttribute(`row-spacing`,String(this.args.rowSpacing)),this._grid.toggleAttribute(`column-homogeneous`,this.args.columnHomogeneous),this._grid.toggleAttribute(`row-homogeneous`,this.args.rowHomogeneous),this._grid.setAttribute(`orientation`,this.args.orientation))}}]},Ra={title:`Buttons/Toggle Button`,description:`Gtk.ToggleButton — a button that stays pressed. It is a Gtk.Button with one more property, active, so every button style class applies; Adw.ToggleGroup is the linked, single-choice form of it.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Mute`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!1},{name:`flat`,label:`Flat`,type:t.BOOLEAN,defaultValue:!1}]},za={stories:[class ToggleButtonWebStory extends StoryElement{_button=null;constructor(){super(ToggleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ra}initialize(){this._button=document.createElement(`gtk-toggle-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.toggleAttribute(`active`,this.args.active),this._button.toggleAttribute(`flat`,this.args.flat))}}]},Ba={title:`Buttons/Color Dialog Button`,description:`Gtk.ColorDialogButton — a button that shows a colour and opens a chooser for it. It is insensitive until a dialog is set, and the swatch announces the channel percentages.`,controls:[{name:`rgba`,label:`Colour`,type:t.TEXT,defaultValue:`#3584e4`},{name:`title`,label:`Dialog title`,type:t.TEXT,defaultValue:`Choose a colour`}]},Va={stories:[class ColorDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(ColorDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ba}initialize(){this._button=document.createElement(`gtk-color-dialog-button`),this._button.setAttribute(`dialog`,``),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){if(!this._button)return;this._button.setAttribute(`rgba`,this.args.rgba);let e=this.args.title.trim();this._button.dialog={title:e===``?null:e}}}]},Ha={title:`Buttons/Font Dialog Button`,description:`Gtk.FontDialogButton — a button that shows a font and opens a chooser for it. At level family the label is the family alone; from font up it is family plus size, and the size box appears.`,controls:[{name:`fontDesc`,label:`Font`,type:t.TEXT,defaultValue:`Sans Bold 12`},{name:`level`,label:`Level`,type:t.SELECT,options:[{label:`Family`,value:`family`},{label:`Face`,value:`face`},{label:`Font`,value:`font`},{label:`Features`,value:`features`}],defaultValue:`font`},{name:`useFont`,label:`Draw in the font`,type:t.BOOLEAN,defaultValue:!0},{name:`useSize`,label:`Draw in the size`,type:t.BOOLEAN,defaultValue:!0}]},Ua={stories:[class FontDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(FontDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ha}initialize(){this._button=document.createElement(`gtk-font-dialog-button`),this._button.setAttribute(`dialog`,``),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`level`,this.args.level),this._button.setAttribute(`font-desc`,this.args.fontDesc),this._button.toggleAttribute(`use-font`,this.args.useFont),this._button.toggleAttribute(`use-size`,this.args.useSize))}}]},Wa={title:`Buttons/Link Button`,description:`Gtk.LinkButton — a button that follows a URI. It is a Gtk.Button with a uri and a visited state: clicking launches the URI and marks the link visited, and pointing it somewhere new un-visits it.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`GNOME`},{name:`uri`,label:`URI`,type:t.TEXT,defaultValue:`https://gnome.org`},{name:`visited`,label:`Visited`,type:t.BOOLEAN,defaultValue:!1}]},Ga={stories:[class LinkButtonWebStory extends StoryElement{_button=null;constructor(){super(LinkButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Wa}initialize(){this._button=document.createElement(`gtk-link-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.setAttribute(`uri`,this.args.uri),this._button.toggleAttribute(`visited`,this.args.visited))}}]},Ka=[`audio-volume-muted-symbolic`,`audio-volume-low-symbolic`,`audio-volume-high-symbolic`],qa={title:`Buttons/Scale Button`,description:`Gtk.ScaleButton — a button whose press opens a scale. The icon follows the value: no list draws image-missing, one name is used throughout, two split the range, three put the first at the bottom and the second at the top and share the interior, five spread it.`,controls:[{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:70},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Vertical`,value:`vertical`},{label:`Horizontal`,value:`horizontal`}],defaultValue:`vertical`},{name:`hasFrame`,label:`Has frame`,type:t.BOOLEAN,defaultValue:!1}]},Ja={stories:[class ScaleButtonWebStory extends StoryElement{_button=null;constructor(){super(ScaleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return qa}initialize(){this._button=document.createElement(`gtk-scale-button`),this._button.setAttribute(`icons`,JSON.stringify(Ka)),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`orientation`,this.args.orientation),this._button.toggleAttribute(`has-frame`,this.args.hasFrame),this._button.setAttribute(`value`,String(this.args.value)))}}]},Ya={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!1}]};function iconName(e){return e.replace(/-symbolic$/,``)}const Xa={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Ya}initialize(){this._content=document.createElement(`adw-button-content`),this._syncContent();let e=document.createElement(`button`);e.className=`adw-button suggested-action pill`,e.append(this._content),this.addContent(e)}updateArgs(e){this._syncContent()}_syncContent(){this._content&&(this._content.setAttribute(`label`,this.args.label),this._content.setAttribute(`icon-name`,iconName(this.args.iconName)),this.args.canShrink?this._content.setAttribute(`can-shrink`,``):this._content.removeAttribute(`can-shrink`))}}]},Za={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:t.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:t.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]},Qa=[`pill`,`circular`,`suggested`,`destructive`,`flat`],$a={pill:`pill`,circular:`circular`,"suggested-action":`suggested`,"destructive-action":`destructive`,flat:`flat`};function button(e){let t=document.createElement(`gtk-button`);return e.label&&t.setAttribute(`label`,e.label),e.icon&&t.setAttribute(`icon`,e.icon),e.variant&&t.setAttribute(e.variant,``),t}const eo={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Za}initialize(){let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center;`,e.append(button({label:`Pill`,variant:`pill`}),button({icon:`list-add`,variant:`circular`}),button({label:`Suggested`,variant:`suggested`}),button({label:`Delete`,variant:`destructive`}),button({label:`Flat`,variant:`flat`})),this._demo=button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}updateArgs(e){this._demo&&this._applyStyle(this.args.style)}_applyStyle(e){if(!this._demo)return;for(let e of Qa)this._demo.removeAttribute(e);let t=$a[e];t&&this._demo.setAttribute(t,``),t===`circular`?(this._demo.setAttribute(`icon`,`list-add`),this._demo.removeAttribute(`label`)):(this._demo.removeAttribute(`icon`),this._demo.setAttribute(`label`,this.args.label))}}]},to=[`Save as…`,`Export`,`Print`],no={title:`Buttons/Menu Button`,description:`Gtk.MenuButton — a button whose only action is to open a menu. Where a Split Button has a primary action beside its arrow, this one has none: every choice lives in the popover.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Hamburger`,value:`open-menu-symbolic`},{label:`More`,value:`view-more-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`open-menu-symbolic`},{name:`menuTitle`,label:`Menu title`,type:t.TEXT,defaultValue:`Document`}]},ro={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return no}initialize(){this._widget=document.createElement(`gtk-menu-button`),this._widget.setAttribute(`menu-model`,JSON.stringify(to.map(e=>({label:e})))),this._apply(),this.addContent(this._widget)}updateArgs(e){this._apply()}_apply(){this._widget&&(this._widget.setAttribute(`icon-name`,this.args.iconName.replace(/-symbolic$/,``)),this._widget.setAttribute(`menu-title`,this.args.menuTitle))}}]},io={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},ao={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]},oo=JSON.stringify([{label:`Save as…`,action:`app.save-as`},{label:`Export`,action:`app.export`},{label:`Print`,action:`app.print`}]);function iconBaseName(e){return e.replace(/-symbolic$/,``)}function splitButton(e,t={}){let n=document.createElement(`adw-split-button`);n.setAttribute(`menu-model`,oo),n.setAttribute(`label`,e.label);let r=e.iconName;return r&&n.setAttribute(`icon-name`,iconBaseName(r)),t.flat&&n.setAttribute(`flat`,``),n}var SplitButtonWebStoryBase=class extends StoryElement{_widget=null;initialize(){this._widget=splitButton(this.args,{flat:this.flat}),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?(this._widget.setAttribute(`icon-name`,iconBaseName(t)),this._widget.removeAttribute(`label`)):(this._widget.removeAttribute(`icon-name`),this._widget.setAttribute(`label`,this.args.label))}};const so={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return io}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return ao}}]},co={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:t.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]},lo=[`flat`,`round`],uo=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],fo={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return co}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of uo){let r=document.createElement(`adw-toggle`);r.setAttribute(`label`,t),r.setAttribute(`icon-name`,n),e.appendChild(r)}e.setAttribute(`active`,String(this.args.active)),this._group=e,this._applyStyle(this.args.style),this.addContent(e)}updateArgs(e){this._group&&(this._group.setAttribute(`active`,String(this.args.active)),this._applyStyle(this.args.style))}_applyStyle(e){if(this._group){for(let e of lo)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},po={title:`Layout/Bin`,description:`Adw.Bin — a widget with exactly one child. It draws nothing of its own and gives the child its whole allocation; setting a new child replaces the old one.`,controls:[{name:`label`,label:`Child label`,type:t.TEXT,defaultValue:`The one child of this bin.`},{name:`swap`,label:`Replace the child`,type:t.BOOLEAN,defaultValue:!1}]},mo={stories:[class BinWebStory extends StoryElement{_bin=null;constructor(){super(BinWebStory.getMetadata(),`Default`)}static getMetadata(){return po}initialize(){this._bin=document.createElement(`adw-bin`),this._bin.style.width=`320px`,this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){if(!this._bin)return;let e=this.args.swap,t=document.createElement(`adw-card`);t.style.padding=`18px`,t.style.boxSizing=`border-box`,t.textContent=e?`The first child was replaced, not stacked.`:this.args.label,this._bin.child=t}}]},ho={title:`Layout/Clamp Scrollable`,description:`Adw.ClampScrollable — a clamp whose child scrolls. The scrollbar stays at the edge of the window while the content is held at a maximum width.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},go=Array.from({length:24},(e,t)=>`Line ${t+1}: held at the clamp's width while it scrolls.`),_o={stories:[class ClampScrollableWebStory extends StoryElement{_clamp=null;constructor(){super(ClampScrollableWebStory.getMetadata(),`Default`)}static getMetadata(){return ho}initialize(){let e=document.createElement(`div`);e.style.padding=`12px 0`;for(let t of go){let n=document.createElement(`div`);n.textContent=t,e.append(n)}this._clamp=document.createElement(`adw-clamp-scrollable`),this._clamp.style.width=`640px`,this._clamp.style.height=`240px`,this._clamp.append(e),this._sync(),this.addContent(this._clamp)}updateArgs(e){this._sync()}_sync(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},vo={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},yo={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return vo}initialize(){let e=document.createElement(`adw-card`);e.style.width=`100%`,e.style.boxSizing=`border-box`,e.style.padding=`18px`,e.textContent=`This content is clamped — it stops growing past the maximum size and stays centred.`,this._clamp=document.createElement(`adw-clamp`),this._clamp.append(e),this._syncClamp(),this.addContent(this._clamp)}updateArgs(e){this._syncClamp()}_syncClamp(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},bo={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:t.BOOLEAN,defaultValue:!0}]},xo={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return bo}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`gtk-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``),this._headerBar=document.createElement(`adw-header-bar`),this._headerBar.style.width=`460px`,this._headerBar.append(e,this._title,t),this._sync(),this.addContent(this._headerBar)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle),this._title.hidden=!this.args.showTitle)}}]},So=[{label:`Cut`},{label:`Copy`},{label:`Paste`},{label:`Delete`,accel:`<Shift>Delete`}],Co={title:`Layout/Popover Bin`,description:'Gtk.PopoverBin — GTK 4.22’s one-child container with a popover, for the place where "any part of this window can offer a menu" is the answer. `menu-model` builds the popover for you, and `handle-input` is what turns a right click or a long press into a popup — a plain click still reaches the child.',controls:[{name:`handleInput`,label:`Right click / long press opens`,type:t.BOOLEAN,defaultValue:!0}]},wo={stories:[class PopoverBinWebStory extends StoryElement{_bin;constructor(){super(PopoverBinWebStory.getMetadata(),`Default`)}static getMetadata(){return Co}initialize(){this._bin=document.createElement(`gtk-popover-bin`);let e=document.createElement(`gtk-button`);e.setAttribute(`label`,`Right-click me`),this._bin.appendChild(e),this._bin.addEventListener(`keydown`,e=>{let t=e;if(t.key===`ContextMenu`&&!t.shiftKey){t.preventDefault(),this._bin.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._bin.querySelector(`gtk-popover-menu`);e.open=!0}}),this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){this._bin&&(this._bin.setAttribute(`menu-model`,JSON.stringify(So)),this._bin.setAttribute(`handle-input`,String(this.args.handleInput)))}}]},To=[{label:`New Window`,accel:`<Control>N`},{section:[{label:`Cut`},{label:`Copy`},{label:`Paste`}],label:`Edit`},{label:`Open With`,submenu:[{label:`Text Editor`},{label:`Web Browser`},{label:`Terminal`}]}],Eo={title:`Layout/Popover Menu`,description:"Gtk.PopoverMenu — a Gtk.Popover whose contents are a menu model instead of a child widget. A submenu swaps the page of the ONE surface rather than opening a second popup beside it, which is why the open page is a named one (`visible-submenu`).",controls:[{name:`menuTitle`,label:`Heading`,type:t.TEXT,defaultValue:`Document`},{name:`position`,label:`Position`,type:t.SELECT,options:[{label:`Bottom`,value:`bottom`},{label:`Top`,value:`top`},{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`bottom`},{name:`align`,label:`Align`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`autohide`,label:`Dismiss on outside click`,type:t.BOOLEAN,defaultValue:!0}]},Do={stories:[class PopoverMenuWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverMenuWebStory.getMetadata(),`Default`)}static getMetadata(){return Eo}initialize(){this._anchor=document.createElement(`button`),this._anchor.textContent=`Open menu`,this._popover=document.createElement(`gtk-popover-menu`),this._popover.setAttribute(`menu-model`,JSON.stringify(To)),this._anchor.appendChild(this._popover),this._apply(),this.addContent(this._anchor)}updateArgs(e){this._apply()}_apply(){this._popover&&(this._popover.setAttribute(`position`,this.args.position),this._popover.setAttribute(`align`,this.args.align),this._popover.setAttribute(`autohide`,String(this.args.autohide)),this._popover.setAttribute(`menu-title`,this.args.menuTitle))}}]},Oo={title:`Layout/Popover`,description:"Gtk.Popover — the bubble-like surface. No model and no menu: it holds whatever widget you put in it, and everything here is about WHERE it appears and WHEN it goes away. `autohide` off is entry completion: the list follows the typing and the caret never leaves.",controls:[{name:`position`,label:`Position`,type:t.SELECT,options:[{label:`Bottom`,value:`bottom`},{label:`Top`,value:`top`},{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`bottom`},{name:`align`,label:`Align`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`autohide`,label:`Dismiss on outside click`,type:t.BOOLEAN,defaultValue:!0}]},ko={stories:[class PopoverWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverWebStory.getMetadata(),`Default`)}static getMetadata(){return Oo}initialize(){this._anchor=document.createElement(`button`),this._anchor.textContent=`Show popover`,this._popover=document.createElement(`gtk-popover`);let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-direction:column;gap:6px;`;for(let t of[`Anything you like`,`in here`]){let n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}this._popover.appendChild(e),this._anchor.appendChild(this._popover),this._anchor.addEventListener(`click`,()=>{this._popover.open=!this._popover.open}),this._apply(),this.addContent(this._anchor)}updateArgs(e){this._apply()}_apply(){this._popover&&(this._popover.setAttribute(`position`,this.args.position),this._popover.setAttribute(`align`,this.args.align),this._popover.setAttribute(`autohide`,String(this.args.autohide)))}}]},Ao={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:t.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:t.BOOLEAN,defaultValue:!0}]},jo={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ao}initialize(){let e=document.createElement(`adw-toolbar-view`);e.style.width=`460px`,e.style.height=`320px`;let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Documents`),n.setAttribute(`subtitle`,`12 items`),t.appendChild(n),e.appendChild(t),this._topBar=t;let r=document.createElement(`adw-status-page`);r.setAttribute(`icon`,`folder-documents`),r.setAttribute(`title`,`Your library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),e.appendChild(r);let i=document.createElement(`div`);i.setAttribute(`slot`,`bottom`),i.className=`adw-action-bar`,i.style.display=`flex`,i.style.alignItems=`center`,i.style.gap=`var(--spacing-xs, 6px)`,i.style.padding=`var(--spacing-xs, 6px)`,i.style.borderTop=`1px solid var(--separator-color, rgba(0, 0, 0, 0.15))`;let a=document.createElement(`gtk-button`);a.setAttribute(`icon`,`list-add`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,`Add`);let o=document.createElement(`gtk-button`);o.setAttribute(`icon`,`list-remove`),o.setAttribute(`flat`,``),o.setAttribute(`tooltip`,`Remove`);let s=document.createElement(`span`);s.textContent=`Selection: none`,s.style.flex=`1 1 auto`,s.style.textAlign=`center`;let c=document.createElement(`gtk-button`);c.setAttribute(`icon`,`send-to`),c.setAttribute(`flat`,``),c.setAttribute(`tooltip`,`Share`),i.append(a,o,s,c),e.appendChild(i),this._bottomBar=i,this._sync(),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._topBar&&(this._topBar.hidden=!this.args.revealTopBars),this._bottomBar&&(this._bottomBar.hidden=!this.args.revealBottomBars)}}]},Mo={title:`Layout/Viewport`,description:`Gtk.Viewport — scrollability for a widget that has none of its own. It has one property, scroll-to-focus: whether a widget that takes the focus is scrolled into view. It is also what a Gtk.ScrolledWindow puts its child in.`,controls:[{name:`scrollToFocus`,label:`Scroll to focus`,type:t.BOOLEAN,defaultValue:!0}]},No={stories:[class ViewportWebStory extends StoryElement{_viewport=null;constructor(){super(ViewportWebStory.getMetadata(),`Default`)}static getMetadata(){return Mo}initialize(){let e=document.createElement(`gtk-viewport`);e.style.height=`240px`,e.style.width=`260px`;let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`vertical`),t.setAttribute(`spacing`,`8`);for(let e=1;e<=16;e++){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Row ${e}`),t.appendChild(n)}let n=document.createElement(`gtk-button`);n.setAttribute(`label`,`Focus me`),t.appendChild(n),e.appendChild(t),this._viewport=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._viewport;e&&e.setAttribute(`scroll-to-focus`,String(this.args.scrollToFocus))}}]},Po={title:`Layout/Application Window`,description:`Adw.ApplicationWindow — an Adw.Window that belongs to a GtkApplication, plus that application’s menubar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showMenubar`,label:`Show menubar`,type:t.BOOLEAN,defaultValue:!0}]},Fo=[{label:`File`,submenu:[{label:`New Window`,action:`app.new-window`},{label:`Quit`,action:`app.quit`}]},{label:`Help`,submenu:[{label:`Keyboard Shortcuts`,action:`app.shortcuts`},{label:`About`,action:`app.about`}]}],Io={stories:[class ApplicationWindowWebStory extends StoryElement{_window=null;_title=null;constructor(){super(ApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Po}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`title`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`adw-header-bar`);t.style.width=`460px`,t.append(e,this._title);let n=document.createElement(`adw-toolbar-view`);n.append(t);let r=document.createElement(`adw-status-page`);r.setAttribute(`title`,`Your Library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),n.append(r);let i=document.createElement(`adw-application-window`);i.setAttribute(`width`,`460`),i.setAttribute(`height`,`260`),i.setAttribute(`menu-model`,JSON.stringify(Fo)),this.applyMenubar(i,this.args.showMenubar),i.append(n),this._window=i,this._sync(),this.addContent(i)}updateArgs(e){this._window&&this.applyMenubar(this._window,this.args.showMenubar),this._sync()}applyMenubar(e,t){t?e.setAttribute(`show-menubar`,``):e.removeAttribute(`show-menubar`)}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle))}}]},Lo={title:`Layout/Window`,description:`Adw.Window — a freeform window with no titlebar area. Use Adw.ToolbarView with Adw.HeaderBar for the top chrome.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`}]},Ro={stories:[class WindowWebStory extends StoryElement{_title=null;constructor(){super(WindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Lo}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`gtk-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``);let n=document.createElement(`adw-header-bar`);n.style.width=`460px`,n.append(e,this._title,t);let r=document.createElement(`adw-status-page`);r.setAttribute(`title`,`Your Library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`);let i=document.createElement(`adw-toolbar-view`);i.append(n,r);let a=document.createElement(`adw-window`);a.append(i),this._sync(),this.addContent(a)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle))}}]},zo={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8}]},Bo=[`Design`,`Adwaita`,`GNOME`,`GTK`,`TypeScript`,`Storybook`,`Wrapping`,`Layout`],Vo={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return zo}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of Bo){let t=document.createElement(`gtk-button`);t.setAttribute(`label`,e),t.setAttribute(`pill`,``),this._wrap.append(t)}this._syncWrap(),this.addContent(this._wrap)}updateArgs(e){this._syncWrap()}_syncWrap(){this._wrap&&(this._wrap.setAttribute(`child-spacing`,String(this.args.childSpacing)),this._wrap.setAttribute(`line-spacing`,String(this.args.lineSpacing)))}}]},Ho=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],Uo={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Ho},Wo={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Ho},Go=[{title:`Welcome`,accent:`color-mix(in srgb, var(--accent-bg-color) 14%, var(--window-bg-color))`},{title:`Discover`,accent:`color-mix(in srgb, #2ec27e 14%, var(--window-bg-color))`},{title:`Get started`,accent:`color-mix(in srgb, #e5a50a 14%, var(--window-bg-color))`}];let Ko=0;function buildPage(e,t){let n=document.createElement(`adw-card`);n.style.cssText=[`width:440px`,`height:260px`,`display:flex`,`align-items:center`,`justify-content:center`,`background-color:${t}`,`color:#ffffff`,`box-sizing:border-box`].join(`;`);let r=document.createElement(`span`);return r.textContent=e,r.style.cssText=`font-size:24pt;font-weight:800;`,n.appendChild(r),n}function syncCarouselArgs(e,t){e.setAttribute(`allow-scroll-wheel`,t.allowScrollWheel?`true`:`false`),e.setAttribute(`allow-long-swipes`,t.allowLongSwipes?`true`:`false`)}var CarouselWebStoryBase=class extends StoryElement{_carousel=null;initialize(){let e=document.createElement(`adw-carousel`);e.id=`adw-carousel-${Ko++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of Go)e.appendChild(buildPage(t.title,t.accent));this._carousel=e;let t=document.createElement(this.indicatorTag());t.setAttribute(`for`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;align-items:center;`,n.append(e,t),this.addContent(n)}updateArgs(e){this._carousel&&syncCarouselArgs(this._carousel,this.args)}};const qo={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return Uo}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return Wo}indicatorTag(){return`adw-carousel-indicator-lines`}}]},Jo={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:t.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]},Yo=[{id:`overview`,title:`Overview`,icon:`view-grid`,body:`A quick summary of your project.`},{id:`activity`,title:`Activity`,icon:`document-edit`,body:`Recent edits and changes.`},{id:`settings`,title:`Settings`,icon:`emblem-system`,body:`Configure how things behave.`}],Xo={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Jo}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of Yo){let a=document.createElement(`adw-view-stack-page`);a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.id=t,o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`display-mode`,this.args.displayMode),this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`display-mode`,this.args.displayMode)}}]},Zo=[{name:`overview`,label:`Overview`,body:`A notebook brings its own tab strip.`},{name:`activity`,label:`Activity`,body:`tab-pos says which edge the strip is on.`},{name:`notes`,label:``,body:`No tab-label: the tab reads "Page 3".`}],Qo={title:`View Switching/Notebook`,description:'Gtk.Notebook — the older page container, a stack that brings its own tab bar. `tab-pos` picks the edge (top, bottom, left, right), `show-tabs` takes the strip away, `show-border` is the bevel around the pages — a CSS class in C — and `page` is the current page by INDEX rather than by name. A GtkNotebookPage is a GObject rather than a widget, so its tab-label and friends live on the page itself, and a page without one gets the number "Page N" as its tab text. `enable-popup` puts the pages in a right-click menu.',controls:[{name:`tabPos`,label:`Tab position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Bottom`,value:`bottom`},{label:`Left`,value:`left`},{label:`Right`,value:`right`}],defaultValue:`top`},{name:`showTabs`,label:`Show tabs`,type:t.BOOLEAN,defaultValue:!0},{name:`showBorder`,label:`Show border`,type:t.BOOLEAN,defaultValue:!0},{name:`enablePopup`,label:`Enable popup (right-click)`,type:t.BOOLEAN,defaultValue:!1}]},$o={stories:[class NotebookWebStory extends StoryElement{_notebook=null;constructor(){super(NotebookWebStory.getMetadata(),`Default`)}static getMetadata(){return Qo}initialize(){let e=document.createElement(`gtk-notebook`);e.style.cssText=`width:480px;height:320px;`;for(let t of Zo){let n=document.createElement(`div`);t.label&&n.setAttribute(`tab-label`,t.label),n.setAttribute(`menu-label`,t.label||t.name),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.setAttribute(`data-gtk-notebook-story`,`heading`),r.textContent=t.label||t.name;let i=document.createElement(`div`);i.setAttribute(`data-gtk-notebook-story`,`body`),i.textContent=t.body,n.append(r,i),e.appendChild(n)}this.addContent(e),this._notebook=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._notebook&&(this._notebook.setAttribute(`tab-pos`,this.args.tabPos),this._notebook.setAttribute(`show-tabs`,this.args.showTabs?``:`false`),this._notebook.setAttribute(`show-border`,this.args.showBorder?``:`false`),this._notebook.toggleAttribute(`enable-popup`,this.args.enablePopup))}}]},es=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,attn:!1,body:`Three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`,attn:!1,body:`Messages marked important.`},{name:`drafts`,title:`Drafts`,icon:`document-edit-symbolic`,attn:!0,body:`One draft needs attention.`},{name:`settings`,title:``,icon:`preferences-system-symbolic`,attn:!1,body:`No row: a title is the row.`}],ts={title:`View Switching/Stack Sidebar`,description:"Gtk.StackSidebar — a vertical list of a Gtk.Stack's pages, the sidebar counterpart of the stack switcher. A row is made of the page's TITLE alone: `update_row` never reads `icon-name`, so the page with only an icon at the end of this story gets no row at all, where the switcher would show an icon button for it. `needs-attention` puts a dot in front of the label.",controls:[{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`}],defaultValue:`slide-left-right`}]},ns={stories:[class StackSidebarWebStory extends StoryElement{_stack=null;constructor(){super(StackSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return ts}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-sidebar-demo`,e.style.flex=`1`;for(let t of es){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),t.title&&n.setAttribute(`title`,t.title),t.icon&&n.setAttribute(`icon-name`,t.icon),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.textContent=t.body,n.appendChild(r),e.appendChild(n)}let t=document.createElement(`gtk-stack-sidebar`);t.setAttribute(`stack`,e.id),t.style.width=`180px`;let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:row;gap:12px;width:480px;height:320px;`,n.append(t,e),this.addContent(n),this._stack=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._stack&&this._stack.setAttribute(`transition-type`,this.args.transitionType)}}]},rs=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,attn:!1,body:`Three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`,attn:!1,body:`Messages marked important.`},{name:`archive`,title:`Archive`,icon:``,attn:!1,body:`Older conversations kept for reference.`},{name:`drafts`,title:``,icon:`document-edit-symbolic`,attn:!0,body:`One draft needs your attention.`}],is={title:`View Switching/Stack Switcher`,description:"Gtk.StackSwitcher — a linked row of toggle buttons, one per page of a Gtk.Stack. A page with a title and no icon gets a label button; one with an icon and no title gets an icon button and puts the title on the switcher as a tooltip; a page with NEITHER is left out of the row entirely. `orientation` turns the row vertical, and `needs-attention` on a page puts a dot on its button.",controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`}],defaultValue:`slide-left-right`}]},as={stories:[class StackSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(StackSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return is}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-switcher-demo`,e.style.flex=`1`;for(let t of rs){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),t.title&&n.setAttribute(`title`,t.title),t.icon&&n.setAttribute(`icon-name`,t.icon),n.setAttribute(`use-underline`,``),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.textContent=t.body,n.appendChild(r),e.appendChild(n)}let t=document.createElement(`gtk-stack-switcher`);t.setAttribute(`stack`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;height:320px;`,n.append(t,e),this.addContent(n),this._switcher=t,this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._switcher)return;this._switcher.setAttribute(`orientation`,this.args.orientation);let e=document.getElementById(`stack-switcher-demo`);e&&e.setAttribute(`transition-type`,this.args.transitionType)}}]},os=[{name:`overview`,title:`Overview`,attn:!1,body:`Three pages, one visible at a time.`},{name:`activity`,title:`Activity`,attn:!1,body:`Switching is animated by transition-type.`},{name:`settings`,title:`Settings`,attn:!0,body:`This page wants your attention.`}],ss={title:`View Switching/Stack`,description:"Gtk.Stack — one visible child out of many, with the animated change between them. `transition-type` picks the animation and `transition-duration` its length; `hhomogeneous` and `vhomogeneous` say whether every page is allocated the same size. A Gtk.StackPage is a GObject rather than a widget, so its title, icon and needs-attention live on the page itself.",controls:[{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`},{label:`Slide up / down`,value:`slide-up-down`},{label:`Over left / right`,value:`over-left-right`},{label:`Rotate left / right`,value:`rotate-left-right`}],defaultValue:`slide-left-right`},{name:`transitionDuration`,label:`Duration (ms)`,type:t.RANGE,min:0,max:600,step:50,defaultValue:200},{name:`interpolateSize`,label:`Interpolate size`,type:t.BOOLEAN,defaultValue:!1},{name:`hhomogeneous`,label:`HHomogeneous`,type:t.BOOLEAN,defaultValue:!0},{name:`vhomogeneous`,label:`VHomogeneous`,type:t.BOOLEAN,defaultValue:!0}]},cs={stories:[class StackWebStory extends StoryElement{_stack=null;constructor(){super(StackWebStory.getMetadata(),`Default`)}static getMetadata(){return ss}initialize(){let e=document.createElement(`gtk-stack`);e.style.flex=`1`;for(let t of os){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),n.setAttribute(`title`,t.title),n.setAttribute(`use-underline`,``),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.setAttribute(`data-gtk-stack-story`,`heading`),r.textContent=t.title;let i=document.createElement(`div`);i.setAttribute(`data-gtk-stack-story`,`body`),i.textContent=t.body,n.append(r,i),e.appendChild(n)}let t=document.createElement(`div`);t.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;height:320px;`,t.appendChild(e),this.addContent(t),this._stack=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._stack&&(this._stack.setAttribute(`transition-type`,this.args.transitionType),this._stack.setAttribute(`transition-duration`,String(this.args.transitionDuration)),this._stack.toggleAttribute(`interpolate-size`,this.args.interpolateSize),this._stack.setAttribute(`hhomogeneous`,this.args.hhomogeneous?``:`false`),this._stack.setAttribute(`vhomogeneous`,this.args.vhomogeneous?``:`false`))}}]},ls={title:`View Switching/Tab Bar`,description:"Adw.TabBar — the tab bar as a widget of its own, bound to an Adw.TabView through its `view`: one chip per page, an action widget on either side, and a strip that can autohide or expand its chips.",controls:[{name:`autohide`,label:`Autohide`,type:t.BOOLEAN,defaultValue:!1},{name:`expandTabs`,label:`Expand tabs`,type:t.BOOLEAN,defaultValue:!1},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`startAction`,label:`Start action`,type:t.BOOLEAN,defaultValue:!0},{name:`endAction`,label:`End action`,type:t.BOOLEAN,defaultValue:!0}]},us=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],ds={stories:[class TabBarWebStory extends StoryElement{_bar=null;_view=null;_startAction=null;_endAction=null;constructor(){super(TabBarWebStory.getMetadata(),`Default`)}static getMetadata(){return ls}initialize(){let e=document.createElement(`adw-tab-view`);e.style.flex=`1`;for(let t of us){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._view=e;let t=document.createElement(`adw-tab-bar`);t.setAttribute(`view`,`tab-bar-story-view`),e.id=`tab-bar-story-view`,this._bar=t,this._startAction=this._actionButton(`list-add-symbolic`,`New page`),this._startAction.slot=`start-action-widget`,t.appendChild(this._startAction),this._endAction=this._actionButton(`view-more-symbolic`,`Menu`),this._endAction.slot=`end-action-widget`,t.appendChild(this._endAction);let n=document.createElement(`div`);n.style.display=`flex`,n.style.flexDirection=`column`,n.style.width=`480px`,n.style.height=`320px`,n.append(t,e),this.addContent(n),this._apply()}updateArgs(e){this._apply()}_actionButton(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button flat image-button`,n.title=t;let r=document.createElement(`gtk-image`);return r.setAttribute(`icon`,e),n.appendChild(r),n}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_apply(){let e=this._bar,t=this._view;e===null||t===null||(e.autohide=this.args.autohide,e.expandTabs=this.args.expandTabs,e.inverted=this.args.inverted,e.view!==t&&(e.view=t),e.startActionWidget=this.args.startAction?this._startAction:null,e.endActionWidget=this.args.endAction?this._endAction:null)}}]},fs={title:`View Switching/Tab Button`,description:`Adw.TabButton — a button that shows how many pages an Adw.TabView holds, and a dot when a page you are not looking at needs attention. From ten pages the number shrinks; at a hundred it becomes a glyph.`,controls:[{name:`pages`,label:`Pages`,type:t.RANGE,min:0,max:100,step:1,defaultValue:3},{name:`needsAttention`,label:`Last page needs attention`,type:t.BOOLEAN,defaultValue:!1}]},ps={stories:[class TabButtonWebStory extends StoryElement{_view=null;_serial=0;constructor(){super(TabButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return fs}initialize(){this._view=document.createElement(`adw-tab-view`),this._view.hidden=!0;let e=document.createElement(`adw-tab-button`),t=document.createElement(`div`);t.append(this._view,e),this.addContent(t),e.view=this._view,this._apply()}updateArgs(e){this._apply()}_apply(){let e=this._view;if(!e)return;let t=this.args.pages;for(;e.nPages<t;)this._serial+=1,e.appendPage({id:`page-${this._serial}`,title:`Page ${e.nPages}`});for(;e.nPages>t;)e.closePage(e.pages[e.nPages-1].id);let n=e.nPages-1;e.pages.forEach((t,r)=>{e.setPageNeedsAttention(t.id,this.args.needsAttention&&r===n)})}}]},ms={title:`View Switching/Tab Overview`,description:`Adw.TabOverview — a grid of tab thumbnails over an Adw.TabView; open it to see every page at once, search them and close or unpin them.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`enableSearch`,label:`Enable search`,type:t.BOOLEAN,defaultValue:!0},{name:`enableNewTab`,label:`Enable new tab`,type:t.BOOLEAN,defaultValue:!1},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1}]},hs=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],gs={stories:[class TabOverviewWebStory extends StoryElement{_overview=null;_view=null;constructor(){super(TabOverviewWebStory.getMetadata(),`Default`)}static getMetadata(){return ms}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let[t,n]of hs.entries()){let r=document.createElement(`adw-tab-page`);r.setAttribute(`title`,n.title),t===0&&r.setAttribute(`pinned`,``),r.appendChild(this._buildPageBody(n.title,n.body)),e.appendChild(r)}this._view=e;let t=document.createElement(`adw-tab-overview`);t.style.width=`480px`,t.style.height=`340px`,t.appendChild(e),t.addEventListener(`create-tab`,t=>{let n=e.appendPage({id:`new-${e.nPages}`,title:`New Page`,content:this._buildPageBody(`New Page`,`Just created.`)});t.detail.page=e.pages[n]}),this._overview=t,this.addContent(t),this._apply()}updateArgs(e){this._apply()}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),t!==``&&n.setAttribute(`description`,t),n}_apply(){let e=this._overview;e!==null&&(e.enableSearch=this.args.enableSearch,e.enableNewTab=this.args.enableNewTab,e.inverted=this.args.inverted,e.setOpen(this.args.open))}}]},_s=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,sectionTitle:`Mail`,badgeNumber:3},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`drafts`,title:`Drafts`,icon:`document-edit-symbolic`},{name:`sent`,title:`Sent`,icon:`mail-send-symbolic`,sectionTitle:`Older`,needsAttention:!0},{name:`archive`,title:`Archive`,icon:`folder-symbolic`},{name:`trash`,title:`Trash`,icon:`user-trash-symbolic`}],vs={title:`View Switching/View Switcher Sidebar`,description:"Adw.ViewSwitcherSidebar — an Adw.Sidebar driven by an Adw.ViewStack, which is the one Adw switcher whose rows can be grouped into sections and carry an unread dot or a badge. `page` collapses it into a page of boxed lists.",controls:[{name:`mode`,label:`Page mode`,type:t.BOOLEAN,defaultValue:!1}]},ys={stories:[class ViewSwitcherSidebarWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return vs}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of _s){let n=document.createElement(`adw-view-stack-page`);n.setAttribute(`name`,t.name),n.setAttribute(`title`,t.title),n.setAttribute(`icon-name`,t.icon),t.sectionTitle&&(n.setAttribute(`starts-section`,``),n.setAttribute(`section-title`,t.sectionTitle)),t.badgeNumber&&n.setAttribute(`badge-number`,String(t.badgeNumber)),t.needsAttention&&n.setAttribute(`needs-attention`,``),n.appendChild(this._buildContent(t.icon,t.title)),e.appendChild(n)}let t=document.createElement(`adw-view-switcher-sidebar`);t.style.width=`200px`,this._switcher=t;let n=document.createElement(`div`);n.style.display=`flex`,n.style.flexDirection=`row`,n.style.width=`480px`,n.style.height=`340px`,n.append(t,e),this.addContent(n),this._apply()}updateArgs(e){this._apply()}_buildContent(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,e.replace(/-symbolic$/,``)),n.setAttribute(`title`,t),n}_apply(){let e=this._switcher;e!==null&&(e.mode=this.args.mode?`page`:`sidebar`)}}]},bs={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:t.BOOLEAN,defaultValue:!1}]},xs=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],Ss={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return bs}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of xs){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._tabView=e,this._applyAutohide(this.args.autohide),this.addContent(e)}updateArgs(e){this._tabView&&this._applyAutohide(this.args.autohide)}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_applyAutohide(e){this._tabView&&(e?this._tabView.setAttribute(`autohide`,``):this._tabView.removeAttribute(`autohide`))}}]},Cs={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:t.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]},ws=[{name:`inbox`,title:`Inbox`,icon:`mail-unread`,description:`You have three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred`,description:`Messages you have marked as important.`},{name:`archive`,title:`Archive`,icon:`folder`,description:`Older conversations kept for reference.`}],Ts={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Cs}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of ws){let a=document.createElement(`adw-view-switcher-page`);a.setAttribute(`name`,t),a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`policy`,this.args.policy),e.style.width=`480px`,this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`policy`,this.args.policy)}}]},Es=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],Ds={title:`View Switching/View Switcher Bar`,description:"Adw.ViewSwitcherBar — the narrow-window switcher, pinned to the bottom of a toolbar view. `reveal` is a REQUEST, not a state: a stack with fewer than two pages stays collapsed however loudly it is asked.",controls:[{name:`reveal`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},Os={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ds}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of Es){let n=document.createElement(`adw-status-page`);n.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),n.setAttribute(`title`,t.title),n.setAttribute(`description`,`The ${t.title.toLowerCase()} page.`);let r=document.createElement(`adw-view-stack-page`);r.setAttribute(`name`,t.name),r.setAttribute(`title`,t.title),r.setAttribute(`icon-name`,t.icon.replace(/-symbolic$/,``)),r.appendChild(n),e.appendChild(r)}let t=document.createElement(`adw-view-switcher-bar`);t.setAttribute(`slot`,`bottom`);let n=document.createElement(`adw-toolbar-view`);n.style.width=`360px`,n.style.height=`360px`,n.append(e,t),this.addContent(n),t.setStack(e),this._bar=t,this._apply()}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.reveal=this.args.reveal)}}]},ks={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$1(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$1,`iconClass`);const As={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return ks}_buildContent(){let e=document.createElement(`adw-bottom-sheet-content`),t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.width=`100%`,t.style.height=`100%`;let n=document.createElement(`gtk-button`);return n.textContent=`Toggle sheet`,n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._sheet&&this._sheet.toggleAttribute(`open`)}),t.append(n),e.append(t),e}_buildSheet(){let e=document.createElement(`adw-bottom-sheet-sheet`),t=document.createElement(`div`);t.style.display=`flex`,t.style.flexDirection=`column`,t.style.gap=`12px`,t.style.margin=`18px 18px 24px`;let n=document.createElement(`span`);n.textContent=`Share track`,n.style.fontSize=`15pt`,n.style.fontWeight=`800`,t.append(n);let r=document.createElement(`adw-preferences-group`);for(let[e,t]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=iconClass$1(t),n.append(i),r.append(n)}return t.append(r),e.append(t),e}initialize(){this._sheet=document.createElement(`adw-bottom-sheet`),this._sheet.style.width=`480px`,this._sheet.style.height=`340px`,this._sheet.append(this._buildContent(),this._buildSheet()),this._sync(),this.addContent(this._sheet)}updateArgs(e){this._sync()}_sync(){this._sheet&&(this._sheet.toggleAttribute(`open`,this.args.open),this._setBool(`modal`,this.args.modal),this._setBool(`can-close`,this.args.canClose))}_setBool(e,t){this._sheet&&(t?this._sheet.setAttribute(e,``):this._sheet.setAttribute(e,`false`))}}]},js={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]};function iconClass(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}const Ms={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return js}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=document.createElement(`adw-action-row`);i.setAttribute(`title`,t),i.setAttribute(`subtitle`,n),i.setAttribute(`activatable`,``);let a=document.createElement(`span`);a.setAttribute(`slot`,`prefix`),a.className=iconClass(r),i.appendChild(a),e.appendChild(i)}let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Mailboxes`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`sidebar`),r.append(t,e),r}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`mail-unread-symbolic`),e.setAttribute(`title`,`All Mail`),e.setAttribute(`description`,`Select a conversation from the list to read it here.`);let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`All Mail`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`content`),r.append(t,e),r}initialize(){this._view=document.createElement(`adw-navigation-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.append(this.buildSidebar(),this.buildContent()),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-content`,this.args.showContent),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Ns={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:t.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:t.BOOLEAN,defaultValue:!0}]},Ps={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ns}initialize(){this._view=document.createElement(`adw-navigation-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._detailTitle=document.createElement(`adw-window-title`),this._detailTitle.setAttribute(`title`,this.args.detailTitle),this._detailTitle.setAttribute(`slot`,`center`),this._detailStatus=document.createElement(`adw-status-page`),this._detailStatus.setAttribute(`icon`,`avatar-default`),this._detailStatus.setAttribute(`title`,this.args.detailTitle),this._detailStatus.setAttribute(`description`,`Mathematician and writer, the first computer programmer.`);let e=document.createElement(`adw-header-bar`);e.setAttribute(`slot`,`top`),e.appendChild(this._detailTitle);let t=document.createElement(`adw-toolbar-view`);t.append(e,this._detailStatus),this._detailPage=document.createElement(`adw-navigation-page`),this._detailPage.setAttribute(`tag`,`detail`),this._detailPage.setAttribute(`title`,this.args.detailTitle),this._detailPage.appendChild(t),this._rootTitle=document.createElement(`adw-window-title`),this._rootTitle.setAttribute(`title`,this.args.rootTitle),this._rootTitle.setAttribute(`slot`,`center`);let n=document.createElement(`gtk-button`);n.setAttribute(`label`,`Open contact`),n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._view?.push(`detail`)});let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;`,r.appendChild(n);let i=document.createElement(`adw-header-bar`);i.setAttribute(`slot`,`top`),i.appendChild(this._rootTitle);let a=document.createElement(`adw-toolbar-view`);a.append(i,r);let o=document.createElement(`adw-navigation-page`);o.setAttribute(`tag`,`root`),o.setAttribute(`title`,this.args.rootTitle),o.appendChild(a),this._view.append(o,this._detailPage),this.addContent(this._view)}updateArgs(e){if(!this._view)return;this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._rootTitle?.setAttribute(`title`,this.args.rootTitle);let t=this.args.detailTitle;this._detailTitle?.setAttribute(`title`,t),this._detailStatus?.setAttribute(`title`,t),this._detailPage?.setAttribute(`title`,t)}}]},Fs={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]},Is=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],Ls={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Fs}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Is){let r=document.createElement(`adw-action-row`);r.setAttribute(`title`,t),r.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=`adw-icon adw-icon--${n}`,r.appendChild(i),e.appendChild(r)}let t=document.createElement(`adw-toolbar-view`);t.classList.add(`sidebar`);let n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`folder-music`),e.setAttribute(`title`,`Your Library`),e.setAttribute(`description`,`Toggle the sidebar to browse sections. Collapse it to overlay the content.`);let t=document.createElement(`adw-toolbar-view`),n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}initialize(){this._view=document.createElement(`adw-overlay-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`;let e=this.buildSidebar();e.setAttribute(`slot`,`sidebar`);let t=this.buildContent();t.setAttribute(`slot`,`content`),this._view.append(e,t),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-sidebar`,this.args.showSidebar),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Rs=[{label:`File`,submenu:[{label:`New Window`,accel:`<Control>N`},{label:`New Tab`,accel:`<Control><Shift>N`},{label:`Open…`,accel:`<Control>O`}]},{label:`Edit`,submenu:[{label:`Undo`,accel:`<Control>Z`},{label:`Redo`,accel:`<Control>Y`}]},{label:`View`,submenu:[{label:`Zoom In`,accel:`<Control>plus`},{label:`Zoom Out`}]},{label:`Help`,submenu:[{label:`Keyboard Shortcuts`},{label:`About`}]}],zs={title:`Navigation/Popover Menu Bar`,description:`Gtk.PopoverMenuBar — a horizontal bar of items that pop up menus when clicked. Clicking an item OPENS its menu; hovering only SELECTS, and the item lights up (.active) exactly while its menu is up. Left and Right walk the bar and wrap.`,controls:[{name:`position`,label:`Menu position`,type:t.SELECT,options:[{label:`Below`,value:`bottom`},{label:`Above`,value:`top`}],defaultValue:`bottom`},{name:`showLast`,label:`Include Help`,type:t.BOOLEAN,defaultValue:!0}]},Bs={stories:[class PopoverMenuBarWebStory extends StoryElement{_bar;constructor(){super(PopoverMenuBarWebStory.getMetadata(),`Default`)}static getMetadata(){return zs}initialize(){this._bar=document.createElement(`gtk-popover-menu-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;let e=this.args.showLast===!1?Rs.slice(0,3):Rs;this._bar.setAttribute(`menu-model`,JSON.stringify(e));for(let e of this._bar.querySelectorAll(`gtk-popover-menu`))e.setAttribute(`position`,this.args.position)}}]},Vs={title:`Media/Image`,description:`Gtk.Image — a symbolic icon, drawn as a CSS-masked box in the surrounding text colour. It takes a NAME, not a file: a name the icon theme cannot resolve draws the missing-image glyph, which is exactly what GTK draws for it. That is why <gtk-picture> is a separate widget — an icon sized by the theme and an image fitted to a box are two different jobs.`,controls:[{name:`iconName`,label:`Icon name`,type:t.TEXT,defaultValue:`avatar-default-symbolic`},{name:`size`,label:`Size (px)`,type:t.RANGE,min:16,max:96,step:8,defaultValue:48},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Hs={stories:[class ImageWebStory extends StoryElement{_image=null;constructor(){super(ImageWebStory.getMetadata(),`Default`)}static getMetadata(){return Vs}initialize(){this._image=document.createElement(`gtk-image`),this._apply(),this.addContent(this._image)}updateArgs(e){this._apply()}_apply(){this._image&&(this._image.setAttribute(`size`,String(this.args.size)),this._image.setAttribute(`icon-name`,this.args.iconName),this._image.toggleAttribute(`disabled`,this.args.disabled))}}]},Us={title:`Media/Inscription`,description:`Gtk.Inscription — text laid out to a size in CHARACTERS and LINES rather than to a size in pixels. It is the widget for text whose extent should be the same everywhere, so it never measures its own content: min-chars/nat-chars and min-lines/nat-lines ARE its size request.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Inscription`},{name:`minChars`,label:`Min chars`,type:t.RANGE,min:0,max:40,step:1,defaultValue:3},{name:`natChars`,label:`Nat chars`,type:t.RANGE,min:0,max:40,step:1,defaultValue:0},{name:`minLines`,label:`Min lines`,type:t.RANGE,min:0,max:6,step:1,defaultValue:1},{name:`natLines`,label:`Nat lines`,type:t.RANGE,min:0,max:6,step:1,defaultValue:0},{name:`wrapMode`,label:`Wrap mode`,type:t.SELECT,options:[{label:`Word`,value:`word`},{label:`Char`,value:`char`},{label:`Word-char (default)`,value:`word-char`}],defaultValue:`word-char`},{name:`textOverflow`,label:`Text overflow`,type:t.SELECT,options:[{label:`Clip (default)`,value:`clip`},{label:`Ellipsize start`,value:`ellipsize-start`},{label:`Ellipsize middle`,value:`ellipsize-middle`},{label:`Ellipsize end`,value:`ellipsize-end`}],defaultValue:`clip`},{name:`xalign`,label:`X align`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:0},{name:`yalign`,label:`Y align`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.5}]},Ws={stories:[class InscriptionWebStory extends StoryElement{_inscription=null;_frame=null;constructor(){super(InscriptionWebStory.getMetadata(),`Default`)}static getMetadata(){return Us}initialize(){this._frame=document.createElement(`div`),this._frame.style.cssText=`width:320px;height:160px;border:1px solid var(--separator-color);display:flex;align-items:stretch;justify-content:stretch;`,this._inscription=document.createElement(`gtk-inscription`),this._frame.appendChild(this._inscription),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){this._inscription&&(this._inscription.setAttribute(`min-chars`,String(this.args.minChars)),this._inscription.setAttribute(`nat-chars`,String(this.args.natChars)),this._inscription.setAttribute(`min-lines`,String(this.args.minLines)),this._inscription.setAttribute(`nat-lines`,String(this.args.natLines)),this._inscription.setAttribute(`text`,this.args.text),this._inscription.setAttribute(`wrap-mode`,this.args.wrapMode),this._inscription.setAttribute(`text-overflow`,this.args.textOverflow),this._inscription.setAttribute(`xalign`,String(this.args.xalign)),this._inscription.setAttribute(`yalign`,String(this.args.yalign)))}}]},Gs={title:`Media/Media Controls`,description:"Gtk.MediaControls — the transport bar: play, position, duration, volume. It owns no playback at all (its one property is an object, `media-stream`), and the bar is INSENSITIVE until a stream is attached. Note which label shows what: the position label shows the elapsed time and the one beside it shows what REMAINS, negatively.",controls:[{name:`sensitive`,label:`Sensitive`,type:t.BOOLEAN,defaultValue:!0}]},Ks={stories:[class MediaControlsWebStory extends StoryElement{_video=null;_controls=null;_media=null;constructor(){super(MediaControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Gs}initialize(){this._video=document.createElement(`gtk-video`),this._controls=document.createElement(`gtk-media-controls`),this._media=document.createElement(`video`),this._media.muted=!0,this._video.append(this._media,this._controls),this._apply(),this.addContent(this._video)}updateArgs(e){this._apply()}_apply(){!this._video||!this._controls||(this._video.style.width=`360px`,this._video.style.height=`203px`,this._controls.style.display=`block`,this._controls.classList.toggle(`insensitive`,!this.args.sensitive),this._controls.volume=1)}}]},qs={title:`Media/Picture`,description:"Gtk.Picture — an image fitted to the box it is given, not sized by itself. `content-fit` picks one of the four fit modes (contain, cover, fill, scale-down), `can-shrink` decides whether it may be smaller than its content, and `alternative-text` is what a screen reader hears.",controls:[{name:`contentFit`,label:`Content fit`,type:t.SELECT,options:[{label:`Contain`,value:`contain`},{label:`Cover`,value:`cover`},{label:`Fill`,value:`fill`},{label:`Scale down`,value:`scale-down`}],defaultValue:`contain`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!0},{name:`alternativeText`,label:`Alternative text`,type:t.TEXT,defaultValue:`A tangerine`},{name:`isolateContents`,label:`Isolate contents`,type:t.BOOLEAN,defaultValue:!0},{name:`keepAspectRatio`,label:`Keep aspect ratio (deprecated)`,type:t.BOOLEAN,defaultValue:!0},{name:`width`,label:`Width (px)`,type:t.RANGE,min:64,max:320,step:16,defaultValue:240}]},Js={stories:[class PictureWebStory extends StoryElement{_picture=null;constructor(){super(PictureWebStory.getMetadata(),`Default`)}static getMetadata(){return qs}initialize(){this._picture=document.createElement(`gtk-picture`);let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`viewBox`,`0 0 320 180`),e.setAttribute(`width`,`320`),e.setAttribute(`height`,`180`),e.innerHTML=`<rect width="320" height="90" fill="rgb(48 64 160)"/><rect y="90" width="320" height="90" fill="rgb(144 192 160)"/>`,this._picture.appendChild(e),this._apply(),this.addContent(this._picture)}updateArgs(e){this._apply()}_apply(){if(!this._picture)return;let e=String(this.args.width);this._picture.style.width=`${e}px`,this._picture.style.height=`${Math.round(Number(e)*2/3)}px`,this.args.keepAspectRatio&&this._picture.toggleAttribute(`keep-aspect-ratio`,!0),this._picture.setAttribute(`content-fit`,this.args.contentFit),this._picture.setAttribute(`can-shrink`,String(this.args.canShrink)),this._picture.setAttribute(`isolate-contents`,String(this.args.isolateContents)),this._picture.setAttribute(`alternative-text`,this.args.alternativeText)}}]},Ys={title:`Media/Video`,description:`Gtk.Video — a play surface with an overlay icon and a controls bar that hides itself three seconds after you stop moving the pointer. The overlay icon is a four-way choice — no stream, error, ended, or ready — and it is only VISIBLE while the video is stopped; there is no pause glyph over the frames.`,controls:[{name:`autoplay`,label:`Autoplay`,type:t.BOOLEAN,defaultValue:!1},{name:`loop`,label:`Loop`,type:t.BOOLEAN,defaultValue:!0},{name:`graphicsOffload`,label:`Graphics offload`,type:t.BOOLEAN,defaultValue:!1},{name:`width`,label:`Width (px)`,type:t.RANGE,min:160,max:480,step:40,defaultValue:320}]},Xs={stories:[class VideoWebStory extends StoryElement{_video=null;_media=null;constructor(){super(VideoWebStory.getMetadata(),`Default`)}static getMetadata(){return Ys}initialize(){this._video=document.createElement(`gtk-video`),this._media=document.createElement(`video`),this._media.muted=!0,this._video.appendChild(this._media),this._apply(),this.addContent(this._video)}updateArgs(e){this._apply()}_apply(){if(!this._video)return;let e=String(this.args.width);this._video.style.width=`${e}px`,this._video.style.height=`${Math.round(Number(e)*9/16)}px`,this._video.toggleAttribute(`autoplay`,this.args.autoplay),this._video.toggleAttribute(`loop`,this.args.loop),this._video.toggleAttribute(`graphics-offload`,this.args.graphicsOffload),this._video.revealControls()}}]},Zs={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:t.NUMBER,min:0,max:3,step:1,defaultValue:0}]},Qs={stories:[class SidebarWebStory extends StoryElement{_sidebar=null;_status=null;items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];constructor(){super(SidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Zs}initialize(){let e=document.createElement(`adw-sidebar-section`);e.setAttribute(`title`,`Mailboxes`);for(let t of this.items){let n=document.createElement(`adw-sidebar-item`);n.setAttribute(`title`,t.title),n.setAttribute(`subtitle`,t.subtitle),n.setAttribute(`icon-name`,t.icon),e.append(n)}this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._sidebar.style.width=`220px`,this._sidebar.append(e),this._sidebar.addEventListener(`notify::selected`,()=>this._syncContent()),this._status=document.createElement(`adw-status-page`),this._status.style.flex=`1 1 auto`;let t=document.createElement(`div`);t.style.display=`flex`,t.style.width=`480px`,t.style.height=`340px`,t.style.border=`1px solid var(--card-shade-color)`,t.style.borderRadius=`var(--card-radius, 12px)`,t.style.overflow=`hidden`;let n=document.createElement(`div`);n.style.width=`1px`,n.style.alignSelf=`stretch`,n.style.backgroundColor=`var(--separator-color, var(--card-shade-color))`,t.append(this._sidebar,n,this._status),this._syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._syncContent())}_syncContent(){if(!this._sidebar||!this._status)return;let e=Number(this._sidebar.selected),t=this.items[e]??this.items[0];this._status.setAttribute(`title`,t.title),this._status.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),this._status.setAttribute(`description`,t.subtitle)}}]},$s={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:t.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`0.11.0`}]},ec={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return $s}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`gtk-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this._dialog=document.createElement(`adw-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){if(!this._dialog)return;let e=this._dialog;e.setAttribute(`application-name`,this.args.applicationName??`Adwaita Storybook`),e.setAttribute(`application-icon`,`application-x-executable`),e.setAttribute(`developer-name`,`A GJSify Project`),e.setAttribute(`version`,this.args.version??`0.11.0`),e.setAttribute(`comments`,`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`),e.setAttribute(`website`,`https://github.com/gjsify/gjsify`),e.setAttribute(`issue-url`,`https://github.com/gjsify/gjsify/issues`),e.setAttribute(`license`,`The MIT License (MIT)`),e.setAttribute(`license-url`,`https://opensource.org/licenses/mit-license.php`),e.setAttribute(`copyright`,`© 2026 The GJSify Project`),e.developers=[`Ada Lovelace`,`Grace Hopper`],e.designers=[`Margaret Hamilton`],e.present()}updateArgs(e){}teardown(){this._dialog&&this._dialog.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},tc={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:t.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:t.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]},nc={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return tc}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-alert-dialog`);e.setAttribute(`heading`,this.args.heading),e.setAttribute(`body`,this.args.body),document.body.appendChild(e),e.addResponse(`cancel`,`Cancel`),e.addResponse(`delete`,`Delete`),e.setResponseAppearance(`delete`,`destructive`),e.setDefaultResponse(`cancel`),e.setCloseResponse(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},rc={title:`Feedback/Dialog`,description:`Adw.Dialog — the generic dialog: arbitrary content over a scrim, anchored as a floating card on a wide window and as a bottom sheet on a narrow one.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Preferences`},{name:`presentation`,label:`Presentation`,type:t.SELECT,options:[{label:`Auto`,value:`auto`},{label:`Floating`,value:`floating`},{label:`Bottom sheet`,value:`bottom-sheet`}],defaultValue:`auto`}]},ic={stories:[class DialogWebStory extends StoryElement{constructor(){super(DialogWebStory.getMetadata(),`Default`)}static getMetadata(){return rc}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-dialog`);e.setAttribute(`title`,this.args.title),e.setAttribute(`presentation-mode`,this.args.presentation);let t=document.createElement(`adw-preferences-group`);t.setAttribute(`title`,`Appearance`);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Dark style`),n.setAttribute(`subtitle`,`Use a dark colour scheme`),n.setAttribute(`active`,``),t.appendChild(n);let r=document.createElement(`adw-preferences-page`);r.setAttribute(`title`,`General`),r.appendChild(t),e.appendChild(r),e.present(),e.addEventListener(`closed`,()=>e.remove(),{once:!0})}updateArgs(e){}}]},ac={title:`Feedback/Emoji Chooser`,description:`Gtk.EmojiChooser — the popover a text widget opens to insert an emoji: a search entry over nine named sections, a toolbar that follows the scroll position, and an emoji-picked signal.`,controls:[{name:`search`,label:`Search`,type:t.TEXT,defaultValue:`smile`}]};function searchEntryOf(e){return e.querySelector(`.emoji-search-entry`)}const oc={stories:[class EmojiChooserWebStory extends StoryElement{_entry=null;_button=null;_chooser=null;constructor(){super(EmojiChooserWebStory.getMetadata(),`Default`)}static getMetadata(){return ac}initialize(){let e=document.createElement(`div`);e.className=`sb-emoji-row`,this._entry=document.createElement(`input`),this._entry.className=`sb-emoji-entry`,this._entry.type=`text`,this._entry.placeholder=`Type a message…`,e.appendChild(this._entry);let t=document.createElement(`div`);t.className=`sb-emoji-anchor`,this._button=document.createElement(`button`),this._button.className=`adw-button flat circular`,this._button.setAttribute(`aria-label`,`Insert an emoji`);let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,`face-smile`),this._button.appendChild(n),this._button.addEventListener(`click`,()=>{this._chooser?.popup(),searchEntryOf(this._chooser)?.focus()}),t.appendChild(this._button),e.appendChild(t),this._chooser=document.createElement(`gtk-emoji-chooser`),this._chooser.setAttribute(`position`,`bottom`),this._chooser.setAttribute(`align`,`end`),this._chooser.anchor=this._button,this._chooser.addEventListener(`emoji-picked`,e=>{let{text:t}=e.detail;this._entry!==null&&(this._entry.value+=t)}),t.appendChild(this._chooser),this.addContent(e),this._applySearch(this.args.search),this._chooser.popup()}_applySearch(e){let t=this._chooser===null?null:searchEntryOf(this._chooser);t!==null&&(t.value=e,t.dispatchEvent(new Event(`input`,{bubbles:!0})))}updateArgs(e){typeof e.search==`string`&&this._applySearch(e.search)}teardown(){this._chooser?.popdown(),this._chooser=null,this._entry=null,this._button=null}}]},sc={title:`Feedback/GTK About Dialog`,description:`Gtk.AboutDialog — GTK's own about window: a dialog-size logo over the program name, with the Credits, License and System pages behind a stack switcher. NOT Adw.AboutDialog, which is a navigation view of preference rows.`,controls:[{name:`programName`,label:`Program name`,type:t.TEXT,defaultValue:`Calculator`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`48.1`},{name:`licenseType`,label:`License type`,type:t.SELECT,options:[{label:`Unknown`,value:`unknown`},{label:`Custom`,value:`custom`},{label:`GPL 3.0`,value:`gpl-3-0`},{label:`MIT`,value:`mit-x11`},{label:`BSD 3-Clause`,value:`bsd-3`},{label:`Apache 2.0`,value:`apache-2-0`},{label:`0BSD`,value:`0bsd`}],defaultValue:`gpl-3-0`},{name:`withCredits`,label:`With credits`,type:t.BOOLEAN,defaultValue:!0}]},cc={stories:[class GtkAboutDialogWebStory extends StoryElement{_dialog=null;_button=null;constructor(){super(GtkAboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return sc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`,this._button=document.createElement(`button`),this._button.textContent=`Show dialog`,this._button.setAttribute(`pill`,``),this._button.setAttribute(`suggested`,``),this._button.addEventListener(`click`,()=>this._present()),e.appendChild(this._button),this._dialog=document.createElement(`gtk-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;if(e===null)return;e.setAttribute(`program-name`,this.args.programName??`Calculator`),e.setAttribute(`version`,this.args.version??`48.1`),e.setAttribute(`logo-icon-name`,`application-x-executable`),e.setAttribute(`comments`,`An arithmetic calculator for the GNOME desktop.`),e.setAttribute(`website`,`https://gitlab.gnome.org/World/gnome-calculator`),e.setAttribute(`website-label`,`GNOME Calculator`),e.setAttribute(`copyright`,`© 2026 The GNOME Project`),e.setAttribute(`system-information`,`GTK 4.24.0
10888
+ void main () { gl_FragColor = vec4 (0.25, 0.55, 0.9, 1.0); }`);if(!t||!n||!r)return;e.attachShader(t,n),e.attachShader(t,r),e.linkProgram(t),this._program=t;let i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-.6,-.6,.6,-.6,0,.6]),e.STATIC_DRAW),this._buffer=i}_refresh(){this._readout&&(this._readout.textContent=`viewport ${this._viewport} device px · ${this._renders} renders`)}}]},Di={title:`Drawing/Graphics Offload`,description:"Gtk.GraphicsOffload — a wrapper that asks the compositor to take its ONE child as it is, which is worth doing for content that changes every frame. `enabled` says whether it is attempted, and `black-background` paints the letterbox bars. The passthrough itself is the platform's: no browser API hands a surface to a compositor, so the replica carries the enum, the black rectangle and the bin layout, and says plainly which part is missing.",controls:[{name:`enabled`,label:`Enabled`,type:t.SELECT,options:[{label:`Enabled (default)`,value:`enabled`},{label:`Disabled`,value:`disabled`}],defaultValue:`enabled`},{name:`blackBackground`,label:`Black background`,type:t.BOOLEAN,defaultValue:!1},{name:`child`,label:`Child`,type:t.SELECT,options:[{label:`Label`,value:`label`},{label:`Image`,value:`image`},{label:`Row of labels`,value:`box`}],defaultValue:`image`}]},Oi={stories:[class GraphicsOffloadWebStory extends StoryElement{_offload=null;constructor(){super(GraphicsOffloadWebStory.getMetadata(),`Default`)}static getMetadata(){return Di}initialize(){this._offload=document.createElement(`gtk-graphics-offload`),this._offload.style.width=`280px`,this._offload.style.height=`96px`,this._apply();let e=document.createElement(`div`);e.style.display=`flex`,e.style.justifyContent=`center`,e.append(this._offload),this.addContent(e)}updateArgs(e){this._apply()}_apply(){if(!this._offload)return;this._offload.setAttribute(`enabled`,this.args.enabled),this._offload.setAttribute(`black-background`,String(this.args.blackBackground));let e;switch(this.args.child){case`label`:{let t=document.createElement(`gtk-label`);t.setAttribute(`label`,`The child of an offloaded layer`),e=t;break}case`box`:{let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`horizontal`),t.setAttribute(`spacing`,`12`);for(let e of[`One`,`Two`,`Three`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,e),t.appendChild(n)}e=t;break}default:{let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,`camera-photo`),t.setAttribute(`pixel-size`,`48`),e=t;break}}this._offload.replaceChildren(e)}}]},ki={title:`Controls/Check Button`,description:`Gtk.CheckButton — a label beside an indicator, with a third "in between" state for a selection that is only partly made. The browser element spells the two states checked and indeterminate, the words the Adwaita stylesheet selects on; the grouped, single-choice form is Adw.Radio.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Enable networking`},{name:`checked`,label:`Checked`,type:t.BOOLEAN,defaultValue:!0},{name:`indeterminate`,label:`Indeterminate`,type:t.BOOLEAN,defaultValue:!1},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Ai={stories:[class CheckButtonWebStory extends StoryElement{_button=null;constructor(){super(CheckButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ki}initialize(){this._button=document.createElement(`gtk-check-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.toggleAttribute(`checked`,this.args.checked),this._button.toggleAttribute(`indeterminate`,this.args.indeterminate),this._button.toggleAttribute(`disabled`,this.args.disabled))}}]},ji=[`Automatic`,`Always`,`Never`,`When busy`],Mi={title:`Controls/Drop Down`,description:`Gtk.DropDown — pick one value from a list. The button shows the selection; the list opens in a popover. Adw.ComboRow is the same choice presented as a boxed-list row.`,controls:[{name:`selected`,label:`Selected`,type:t.SELECT,options:ji.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},Ni={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return Mi}initialize(){this._dropDown=document.createElement(`gtk-drop-down`),this._dropDown.setAttribute(`model`,JSON.stringify(ji)),this._apply(),this.addContent(this._dropDown)}updateArgs(e){this._apply()}_apply(){this._dropDown&&(this._dropDown.setAttribute(`selected`,String(this.args.selected)),this.args.enableSearch?this._dropDown.setAttribute(`enable-search`,``):this._dropDown.removeAttribute(`enable-search`))}}]},Pi={title:`Controls/Entry`,description:`Gtk.Entry — a single-line text field. Libadwaita ships no AdwEntry; the Adwaita look is the GTK entry styled by the stylesheet, which is why the row variants (Entry Row, Password Entry Row) are the widgets with an Adw prefix.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:``},{name:`placeholder`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search files…`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0}]},Fi={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Pi}initialize(){this._entry=document.createElement(`gtk-entry`),this._entry.style.minWidth=`280px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`value`,this.args.text),this._entry.setAttribute(`placeholder`,this.args.placeholder),this.args.editable?this._entry.removeAttribute(`disabled`):this._entry.setAttribute(`disabled`,``))}}]},Ii={title:`Controls/Spinner (GTK)`,description:`Gtk.Spinner — GTK's own busy indicator: a faint ring with a quarter arc turning around it, sized by its allocation. Adw.Spinner is the libadwaita replacement and looks different; under reduced motion GTK swaps this one for a static hourglass, which Adw.Spinner deliberately does not do.`,controls:[{name:`size`,label:`Size (px)`,type:t.RANGE,min:16,max:64,step:4,defaultValue:32},{name:`spinning`,label:`Spinning`,type:t.BOOLEAN,defaultValue:!0},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Li={stories:[class GtkSpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(GtkSpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return Ii}initialize(){this._spinner=document.createElement(`gtk-spinner`),this._apply(),this.addContent(this._spinner)}updateArgs(e){this._apply()}_apply(){if(!this._spinner)return;let e=String(this.args.size);this._spinner.style.width=`${e}px`,this._spinner.style.height=`${e}px`,this.args.spinning?this._spinner.start():this._spinner.stop(),this._spinner.toggleAttribute(`disabled`,this.args.disabled)}}]},Ri={title:`Controls/Level Bar`,description:"Gtk.LevelBar — how full something is, over an interval that need not be 0…1: a password strength meter, a battery. `mode` decides one filled level or one block per unit, and the block takes a class from the nearest OFFSET (low, high, full by default), which is how libadwaita colours it and how an application adds a colour of its own.",controls:[{name:`value`,label:`Value`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.8},{name:`maxValue`,label:`Max value`,type:t.RANGE,min:1,max:5,step:1,defaultValue:5},{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Continuous`,value:`continuous`},{label:`Discrete`,value:`discrete`}],defaultValue:`continuous`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1}]},zi={stories:[class LevelBarWebStory extends StoryElement{_bar=null;constructor(){super(LevelBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ri}initialize(){this._bar=document.createElement(`gtk-level-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;let e=this.args.orientation===`vertical`;this._bar.setAttribute(`orientation`,e?`vertical`:`horizontal`),this._bar.style.width=e?``:`200px`,this._bar.style.height=e?`120px`:``,this._bar.setAttribute(`max-value`,String(this.args.maxValue)),this._bar.setAttribute(`mode`,this.args.mode),this._bar.setAttribute(`value`,String(this.args.value)),this._bar.toggleAttribute(`inverted`,this.args.inverted)}}]},Bi={title:`Controls/Password Entry`,description:`Gtk.PasswordEntry — a field for a secret: masked, no copy, a Caps Lock warning while it has focus, and show-peek-icon for a button that reveals it for one look. Adw.PasswordEntryRow is the boxed-list row built on it. Press the peek button, or Caps Lock on the keyboard, to see both states.`,controls:[{name:`showPeekIcon`,label:`Show peek icon`,type:t.BOOLEAN,defaultValue:!0},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Password`},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Vi={stories:[class PasswordEntryWebStory extends StoryElement{_entry=null;constructor(){super(PasswordEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Bi}initialize(){this._entry=document.createElement(`gtk-password-entry`),this._entry.style.minWidth=`240px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.toggleAttribute(`show-peek-icon`,this.args.showPeekIcon),this._entry.setAttribute(`placeholder`,this.args.placeholderText),this._entry.toggleAttribute(`disabled`,this.args.disabled))}}]},Hi={title:`Controls/Progress Bar`,description:"Gtk.ProgressBar — how much of a long operation is done. `fraction` is 0…1, `pulsing` is the indeterminate mode where the app knows it is busy but not how far along it is, and `osd` is libadwaita's hairline variant for under a header bar. Adw.Spinner is the size-less sibling.",controls:[{name:`fraction`,label:`Fraction`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.4},{name:`pulsing`,label:`Pulsing (indeterminate)`,type:t.BOOLEAN,defaultValue:!1},{name:`showText`,label:`Show text`,type:t.BOOLEAN,defaultValue:!0},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`osd`,label:`OSD (hairline)`,type:t.BOOLEAN,defaultValue:!1}]},Ui={stories:[class ProgressBarWebStory extends StoryElement{_bar=null;constructor(){super(ProgressBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Hi}initialize(){this._bar=document.createElement(`gtk-progress-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.toggleAttribute(`pulsing`,this.args.pulsing),this._bar.setAttribute(`fraction`,String(this.args.fraction)),this._bar.toggleAttribute(`show-text`,this.args.showText),this._bar.toggleAttribute(`inverted`,this.args.inverted),this._bar.toggleAttribute(`osd`,this.args.osd))}}]},Wi={title:`Controls/Scale`,description:`Gtk.Scale — a slider. Gtk.Scale extends Gtk.Range, which is abstract: the range itself has no tag, its adjustment, value, inverted and fill level are this widget’s properties. draw-value shows the number beside the knob at the value-pos you name, and the .value style class dims it.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`valuePos`,label:`Value position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Bottom`,value:`bottom`},{label:`Left`,value:`left`},{label:`Right`,value:`right`}],defaultValue:`top`},{name:`drawValue`,label:`Draw value`,type:t.BOOLEAN,defaultValue:!0},{name:`digits`,label:`Digits`,type:t.NUMBER,defaultValue:0},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`hasOrigin`,label:`Has origin`,type:t.BOOLEAN,defaultValue:!0},{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:40}]},Gi={stories:[class ScaleWebStory extends StoryElement{_scale=null;constructor(){super(ScaleWebStory.getMetadata(),`Default`)}static getMetadata(){return Wi}initialize(){this._scale=document.createElement(`gtk-scale`),this._scale.style.width=`260px`,this._apply(),this.addContent(this._scale)}updateArgs(e){this._apply()}_apply(){this._scale&&(this._scale.setAttribute(`orientation`,this.args.orientation),this._scale.setAttribute(`value-pos`,this.args.valuePos),this._scale.toggleAttribute(`draw-value`,this.args.drawValue),this._scale.setAttribute(`digits`,String(this.args.digits)),this._scale.toggleAttribute(`inverted`,this.args.inverted),this.args.hasOrigin?this._scale.removeAttribute(`has-origin`):this._scale.setAttribute(`has-origin`,`false`),this._scale.setAttribute(`adjustment`,`{"lower":0,"upper":100,"stepIncrement":1,"pageIncrement":10}`),this._scale.setAttribute(`value`,String(this.args.value)))}}]},Ki={title:`Controls/Search Entry`,description:`Gtk.SearchEntry — a field for typing a query. A search glyph leads while it is empty and a clear button follows once it is not, and search-changed waits out search-delay so a filter is not driven by every keystroke. Escape is stop-search, Ctrl+G is next-match.`,controls:[{name:`searchDelay`,label:`Search delay (ms)`,type:t.NUMBER,defaultValue:150},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search…`},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},qi={stories:[class SearchEntryWebStory extends StoryElement{_entry=null;_label=null;constructor(){super(SearchEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Ki}initialize(){this._entry=document.createElement(`gtk-search-entry`),this._entry.style.minWidth=`260px`,this._label=document.createElement(`gtk-label`),this._label.className=`dimmed`,this._label.textContent=`search-changed has not fired yet`,this._entry.addEventListener(`search-changed`,e=>{let{value:t}=e.detail;this._label&&(this._label.textContent=`search-changed: "${t}"`)}),this._apply();let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`12px`,e.append(this._entry,this._label),this.addContent(e)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`search-delay`,String(this.args.searchDelay)),this._entry.setAttribute(`placeholder`,this.args.placeholderText),this._entry.toggleAttribute(`disabled`,this.args.disabled))}}]},Ji={title:`Controls/Spin Button`,description:`Gtk.SpinButton — a number field with an arrow either side of it. The range is a Gtk.Adjustment, the typed value is clamped into it (or left alone, under update-policy if-valid), and numeric refuses anything that is not a number. Adw.SpinRow is the boxed-list row that wraps this same widget.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`digits`,label:`Digits`,type:t.NUMBER,defaultValue:0},{name:`numeric`,label:`Numeric`,type:t.BOOLEAN,defaultValue:!1},{name:`snapToTicks`,label:`Snap to ticks`,type:t.BOOLEAN,defaultValue:!1},{name:`wrap`,label:`Wrap`,type:t.BOOLEAN,defaultValue:!1},{name:`updatePolicy`,label:`Update policy`,type:t.SELECT,options:[{label:`Always`,value:`always`},{label:`If valid`,value:`if-valid`}],defaultValue:`always`},{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:5}]},Yi={stories:[class SpinButtonWebStory extends StoryElement{_spin=null;constructor(){super(SpinButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ji}initialize(){this._spin=document.createElement(`gtk-spin-button`),this._apply(),this.addContent(this._spin)}updateArgs(e){this._apply()}_apply(){this._spin&&(this._spin.setAttribute(`orientation`,this.args.orientation),this._spin.setAttribute(`digits`,String(this.args.digits)),this._spin.toggleAttribute(`numeric`,this.args.numeric),this._spin.toggleAttribute(`snap-to-ticks`,this.args.snapToTicks),this._spin.toggleAttribute(`wrap`,this.args.wrap),this._spin.setAttribute(`update-policy`,this.args.updatePolicy),this._spin.setAttribute(`adjustment`,`{"lower":0,"upper":10,"stepIncrement":1,"pageIncrement":2}`),this._spin.setAttribute(`value`,String(this.args.value)))}}]},Xi={title:`Controls/Switch`,description:`Gtk.Switch — a light switch with two states that are NOT the same thing: active is where the user put it, state is what the switched thing currently is, which is how a change that takes a while looks like a pending one. Adw.SwitchRow is the same control with a title beside it.`,controls:[{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0},{name:`state`,label:`State (the backend)`,type:t.BOOLEAN,defaultValue:!0},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Zi={stories:[class SwitchWebStory extends StoryElement{_switch=null;constructor(){super(SwitchWebStory.getMetadata(),`Default`)}static getMetadata(){return Xi}initialize(){this._switch=document.createElement(`gtk-switch`),this._apply(),this.addContent(this._switch)}updateArgs(e){this._apply()}_apply(){this._switch&&(this._switch.toggleAttribute(`active`,this.args.active),this._switch.toggleAttribute(`state`,this.args.state),this._switch.toggleAttribute(`disabled`,this.args.disabled))}}]},Qi={title:`Layout/Expander`,description:"Gtk.Expander — a title the user clicks to reveal the child below it. The arrow is its own CSS node and `:checked` is set on THAT node, not on the widget, which is what libadwaita's _expanders.scss keys the glyph swap on. `use-underline` marks a mnemonic with `_`, and Alt+that character activates the expander.",controls:[{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!1},{name:`useUnderline`,label:`Label marks a mnemonic`,type:t.BOOLEAN,defaultValue:!1},{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`_More options`},{name:`resizeToplevel`,label:`Resize the toplevel`,type:t.BOOLEAN,defaultValue:!1}]},$i={stories:[class ExpanderWebStory extends StoryElement{_expander=null;constructor(){super(ExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Qi}initialize(){this._expander=document.createElement(`gtk-expander`),this._expander.style.width=`320px`;let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`),e.style.padding=`12px`;for(let t of[`Notifications`,`Sound`,`Network`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,t),e.appendChild(n)}this._expander.appendChild(e),this._apply(),this.addContent(this._expander)}updateArgs(e){this._apply()}_apply(){this._expander&&(this._expander.toggleAttribute(`use-underline`,this.args.useUnderline),this._expander.setAttribute(`label`,String(this.args.label)),this._expander.toggleAttribute(`resize-toplevel`,this.args.resizeToplevel),this._expander.toggleAttribute(`expanded`,this.args.expanded))}}]},ea={title:`Layout/Overlay`,description:`Gtk.Overlay — widgets stacked on top of one main child. The main child sizes the overlay; every other child is placed by its own halign/valign, which is what gtk_overlay_get_child_position reads and nothing else. Libadwaita ships no Adw.Overlay and gives the node no rule of its own — the .left/.right/.top/.bottom classes it puts on an edge-aligned child are the whole published contract.`,controls:[{name:`halign`,label:`Overlay halign`,type:t.SELECT,options:[{label:`Fill (the default)`,value:`fill`},{label:`Start`,value:`start`},{label:`Center`,value:`center`},{label:`End`,value:`end`}],defaultValue:`end`},{name:`valign`,label:`Overlay valign`,type:t.SELECT,options:[{label:`Fill (the default)`,value:`fill`},{label:`Start`,value:`start`},{label:`Center`,value:`center`},{label:`End`,value:`end`}],defaultValue:`end`},{name:`showLabel`,label:`Label the overlay`,type:t.BOOLEAN,defaultValue:!0}]},ta={stories:[class OverlayWebStory extends StoryElement{_overlay=null;_badge=null;constructor(){super(OverlayWebStory.getMetadata(),`Default`)}static getMetadata(){return ea}initialize(){this._overlay=document.createElement(`gtk-overlay`),this._overlay.style.width=`260px`,this._overlay.style.height=`160px`;let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`Main child — its size is the overlay`),e.classList.add(`dimmed`),this._overlay.appendChild(e),this._badge=document.createElement(`gtk-label`),this._badge.setAttribute(`slot`,`overlay`),this._badge.setAttribute(`label`,`2`),this._badge.classList.add(`osd`),this._overlay.appendChild(this._badge),this._apply(),this.addContent(this._overlay)}updateArgs(e){this._apply()}_apply(){if(!this._badge)return;let align=(e,t)=>{e===`fill`?this._badge?.removeAttribute(t):this._badge?.setAttribute(t,String(e))};align(this.args.halign,`halign`),align(this.args.valign,`valign`),this._badge.hidden=!this.args.showLabel}}]},na={title:`Layout/Paned`,description:"Gtk.Paned — two children either side of a divider the user drags. With both children resizable and no position set, GTK divides the paned in PROPORTION TO THE TWO SIZE REQUESTS rather than in half, and it draws the divider as the `separator` node a GtkPanedHandle carries. Libadwaita styles that node in _paned.scss: 1px, 5px when `wide-handle`, with the rule as an inset shadow rather than a fill.",controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`wideHandle`,label:`Wide handle`,type:t.BOOLEAN,defaultValue:!1},{name:`resizeStartChild`,label:`Resize the first child`,type:t.BOOLEAN,defaultValue:!0},{name:`resizeEndChild`,label:`Resize the second child`,type:t.BOOLEAN,defaultValue:!0},{name:`shrinkStartChild`,label:`The first child may shrink`,type:t.BOOLEAN,defaultValue:!0},{name:`position`,label:`Position (0 = derive)`,type:t.NUMBER,min:-1,max:400,step:1,defaultValue:-1}]};function pane(e,t){let n=document.createElement(`gtk-box`);n.setAttribute(`orientation`,`vertical`),n.setAttribute(`spacing`,`4`),n.style.padding=`12px`;let r=document.createElement(`gtk-label`);r.setAttribute(`label`,e),n.appendChild(r);let i=document.createElement(`gtk-label`);return i.setAttribute(`label`,`${t}px of size request`),i.classList.add(`dimmed`),n.appendChild(i),n}const ra={stories:[class PanedWebStory extends StoryElement{_paned=null;constructor(){super(PanedWebStory.getMetadata(),`Default`)}static getMetadata(){return na}initialize(){this._paned=document.createElement(`gtk-paned`),this._paned.style.width=`400px`,this._paned.style.height=`140px`,this._paned.appendChild(pane(`First child`,100));let e=pane(`Second child`,300);e.setAttribute(`slot`,`end`),this._paned.appendChild(e),this._apply(),this.addContent(this._paned)}updateArgs(e){this._apply()}_apply(){this._paned&&(this._paned.setAttribute(`orientation`,String(this.args.orientation)),this._paned.toggleAttribute(`wide-handle`,this.args.wideHandle),this._paned.setAttribute(`resize-start-child`,this.args.resizeStartChild?`true`:`false`),this._paned.setAttribute(`resize-end-child`,this.args.resizeEndChild?`true`:`false`),this._paned.setAttribute(`shrink-start-child`,this.args.shrinkStartChild?`true`:`false`),this._paned.setAttribute(`position`,String(this.args.position)))}}]},ia={title:`Layout/Revealer`,description:`Gtk.Revealer — shows and hides its child with an animation. The transition is one of fourteen nicks and it is not only an opacity change: a slide scales the box along one axis while allocating the child at its UNSCALED size, and a swing folds it in with sin (π · pos / 2). Libadwaita styles no revealer node of its own, so everything here is GTK behaviour the browser element ports.`,controls:[{name:`transitionType`,label:`Transition`,type:t.SELECT,options:[{label:`Slide down (the default)`,value:`slide-down`},{label:`Slide up`,value:`slide-up`},{label:`Slide left`,value:`slide-left`},{label:`Slide right`,value:`slide-right`},{label:`Crossfade`,value:`crossfade`},{label:`Fade + slide down`,value:`fade-slide-down`},{label:`Swing down (fold)`,value:`swing-down`},{label:`Swing right (fold)`,value:`swing-right`},{label:`None`,value:`none`}],defaultValue:`slide-down`},{name:`transitionDuration`,label:`Duration (ms)`,type:t.RANGE,min:0,max:800,step:50,defaultValue:250},{name:`revealChild`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},aa={stories:[class RevealerWebStory extends StoryElement{_revealer=null;constructor(){super(RevealerWebStory.getMetadata(),`Default`)}static getMetadata(){return ia}initialize(){this._revealer=document.createElement(`gtk-revealer`);let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`),e.style.padding=`12px`;let t=document.createElement(`gtk-label`);t.setAttribute(`label`,`The revealed child`),e.appendChild(t);let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Use the controls to change the transition`),n.classList.add(`dimmed`),e.appendChild(n),this._revealer.appendChild(e),this._apply(),this.addContent(this._revealer)}updateArgs(e){this._apply()}_apply(){this._revealer&&(this._revealer.setAttribute(`transition-type`,String(this.args.transitionType)),this._revealer.setAttribute(`transition-duration`,String(this.args.transitionDuration)),this._revealer.toggleAttribute(`reveal-child`,this.args.revealChild))}}]},oa={title:`Layout/Scrollbar`,description:`Gtk.Scrollbar — a trough and a slider, positioned by a GtkAdjustment. The slider is page_size over the whole range long and sits at the position over the SCROLLABLE range, which is why the two numbers it is made of do not share a denominator.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`vertical`},{name:`upper`,label:`Adjustment upper`,type:t.NUMBER,defaultValue:400},{name:`pageSize`,label:`Adjustment page size`,type:t.NUMBER,defaultValue:120},{name:`value`,label:`Adjustment value`,type:t.NUMBER,defaultValue:80}]},sa={stories:[class ScrollbarWebStory extends StoryElement{_scrollbar=null;constructor(){super(ScrollbarWebStory.getMetadata(),`Default`)}static getMetadata(){return oa}initialize(){let e=document.createElement(`gtk-scrollbar`);e.style.height=`240px`,e.style.width=`24px`,e.setAttribute(`valign`,`center`),this._scrollbar=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._scrollbar;e&&(e.setAttribute(`orientation`,this.args.orientation),e.adjustment={value:Number(this.args.value),lower:0,upper:Number(this.args.upper),stepIncrement:10,pageIncrement:80,pageSize:Number(this.args.pageSize)})}}]},ca={title:`Layout/ScrolledWindow`,description:`Gtk.ScrolledWindow — one child, two adjustments, and a scrollbar per edge that can actually scroll. The policies decide whether a bar appears, window-placement which edge it takes, and overlay-scrolling turns the bars into the auto-hiding indicators GNOME draws over the content.`,controls:[{name:`hPolicy`,label:`Horizontal policy`,type:t.SELECT,options:[{label:`Automatic`,value:`automatic`},{label:`Always`,value:`always`},{label:`Never`,value:`never`}],defaultValue:`automatic`},{name:`vPolicy`,label:`Vertical policy`,type:t.SELECT,options:[{label:`Automatic`,value:`automatic`},{label:`Always`,value:`always`},{label:`Never`,value:`never`}],defaultValue:`automatic`},{name:`placement`,label:`Window placement`,type:t.SELECT,options:[{label:`Top left`,value:`top-left`},{label:`Top right`,value:`top-right`},{label:`Bottom left`,value:`bottom-left`},{label:`Bottom right`,value:`bottom-right`}],defaultValue:`top-left`},{name:`frame`,label:`Frame`,type:t.BOOLEAN,defaultValue:!1},{name:`overlayScrolling`,label:`Overlay scrolling`,type:t.BOOLEAN,defaultValue:!0}]},la={stories:[class ScrolledWindowWebStory extends StoryElement{_window=null;constructor(){super(ScrolledWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return ca}initialize(){let e=document.createElement(`gtk-scrolled-window`);e.style.height=`240px`,e.style.width=`260px`;let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`vertical`),t.setAttribute(`spacing`,`8`);for(let e=1;e<=16;e++){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Row ${e}`),t.appendChild(n)}e.appendChild(t),this._window=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._window;e&&(e.setAttribute(`hscrollbar-policy`,this.args.hPolicy),e.setAttribute(`vscrollbar-policy`,this.args.vPolicy),e.setAttribute(`window-placement`,this.args.placement),e.toggleAttribute(`has-frame`,this.args.frame),e.toggleAttribute(`overlay-scrolling`,this.args.overlayScrolling))}}]},ua={title:`Layout/Separator`,description:`Gtk.Separator — a one-pixel rule between two groups of widgets. Libadwaita ships no Adw.Separator; it only styles the GTK one, and the .spacer style class turns the rule into an empty 12px gap.`,controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`spacer`,label:`Spacer (draws nothing)`,type:t.BOOLEAN,defaultValue:!1}]},da={stories:[class SeparatorWebStory extends StoryElement{_box=null;_separator=null;constructor(){super(SeparatorWebStory.getMetadata(),`Default`)}static getMetadata(){return ua}initialize(){this._separator=document.createElement(`gtk-separator`),this._box=document.createElement(`gtk-box`),this._box.setAttribute(`spacing`,`12`);for(let e of[`Above`,`Below`]){let t=document.createElement(`gtk-label`);t.setAttribute(`label`,e),e===`Below`&&this._box.appendChild(this._separator),this._box.appendChild(t)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){if(!this._box||!this._separator)return;let e=this.args.orientation===`vertical`;this._separator.setAttribute(`orientation`,e?`vertical`:`horizontal`),this._box.setAttribute(`orientation`,e?`horizontal`:`vertical`),this._separator.classList.toggle(`spacer`,this.args.spacer)}}]},fa={title:`Layout/Breakpoint Bin`,description:`Adw.BreakpointBin gives breakpoints a home without a window: its one child rearranges itself at a size threshold, and the bin applies the LAST breakpoint whose condition holds. Resize the stage to see it.`,controls:[{name:`condition`,label:`Condition`,type:t.SELECT,options:[{label:`max-width: 480px`,value:`max-width: 480px`},{label:`max-width: 320px`,value:`max-width: 320px`},{label:`max-height: 200px`,value:`max-height: 200px`}],defaultValue:`max-width: 480px`},{name:`narrowLabel`,label:`Narrow label`,type:t.TEXT,defaultValue:`Narrow`},{name:`wideLabel`,label:`Wide label`,type:t.TEXT,defaultValue:`Wide`}]},pa={stories:[class BreakpointBinWebStory extends StoryElement{_bin=null;_label=null;constructor(){super(BreakpointBinWebStory.getMetadata(),`Default`)}static getMetadata(){return fa}initialize(){this._bin=document.createElement(`adw-breakpoint-bin`),this._bin.style.minWidth=`150px`,this._bin.style.height=`60px`,this._label=document.createElement(`gtk-label`),this._label.id=`narrow`,this._label.classList.add(`title-1`),this._bin.appendChild(this._label),this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){!this._bin||!this._label||(this._label.setAttribute(`label`,this.args.wideLabel),this._bin.setAttribute(`breakpoints`,JSON.stringify([{condition:this.args.condition,setters:[{target:`#narrow`,property:`label`,value:this.args.narrowLabel}]}])))}}]},ma={title:`Layout/Layout Slot`,description:`Adw.LayoutSlot is the named hole a layout of an Adw.MultiLayoutView leaves for a child: it takes the child whose id matches, and its visible property follows that child's. On its own it is a bin, which is what this story shows.`,controls:[{name:`label`,label:`Child title`,type:t.TEXT,defaultValue:`Inbox`},{name:`visible`,label:`Child visible`,type:t.BOOLEAN,defaultValue:!0}]},ha={stories:[class LayoutSlotWebStory extends StoryElement{_view=null;_child=null;constructor(){super(LayoutSlotWebStory.getMetadata(),`Default`)}static getMetadata(){return ma}initialize(){this._child=document.createElement(`adw-navigation-page`),this._child.setAttribute(`tag`,`primary`),this._child.setAttribute(`slot`,`primary`);let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`The child the view inserted here.`),this._child.appendChild(e),this._view=document.createElement(`adw-multi-layout-view`),this._view.style.width=`360px`,this._view.style.height=`120px`;let t=document.createElement(`div`);t.setAttribute(`name`,`only`);let n=document.createElement(`adw-layout-slot`);n.setAttribute(`id`,`primary`),t.appendChild(n),this._view.appendChild(t),this._view.appendChild(this._child),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._child&&(this._child.setAttribute(`title`,this.args.label),this._child.toggleAttribute(`hidden`,!this.args.visible))}}]},ga={title:`Layout/Multi Layout View`,description:`Adw.MultiLayoutView holds one set of children and several arrangements of them: each child has an id, each layout has slots with ids, and switching layouts re-inserts every child into the slot of the SAME id.`,controls:[{name:`layoutName`,label:`Layout`,type:t.SELECT,options:[{label:`wide (split)`,value:`wide`},{label:`narrow (stacked)`,value:`narrow`}],defaultValue:`wide`},{name:`showDetails`,label:`Show the details pane`,type:t.BOOLEAN,defaultValue:!0}]},_a=`primary`,va=`secondary`;function arrangement(e){let t=document.createElement(`adw-navigation-split-view`);e&&t.setAttribute(`collapsed`,``),t.setAttribute(`min-sidebar-width`,`160`),t.style.width=`420px`,t.style.height=`220px`;for(let[e,n]of[[`sidebar`,va],[`content`,_a]]){let r=document.createElement(`adw-layout-slot`);r.setAttribute(`id`,n),r.setAttribute(`slot`,e),t.appendChild(r)}return t}var ya=class MultiLayoutViewWebStory extends StoryElement{_view=null;_details=null;constructor(){super(MultiLayoutViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ga}initialize(){this._view=document.createElement(`adw-multi-layout-view`),this._view.style.width=`420px`,this._view.style.height=`220px`;for(let[e,t]of[[`wide`,!1],[`narrow`,!0]]){let n=arrangement(t);n.setAttribute(`name`,e),this._view.appendChild(n)}let e=page(`Inbox`,`12 unread`);e.setAttribute(`slot`,_a),this._details=page(`Message`),this._details.setAttribute(`slot`,va),this._view.appendChild(e),this._view.appendChild(this._details),this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){!this._view||!this._details||(this._details.toggleAttribute(`hidden`,!this.args.showDetails),this._view.setAttribute(`layout-name`,this.args.layoutName))}};function page(e,t=``){let n=document.createElement(`adw-navigation-page`);n.setAttribute(`title`,e),n.setAttribute(`tag`,e.toLowerCase());let r=document.createElement(`gtk-box`);r.setAttribute(`orientation`,`vertical`);let i=document.createElement(`adw-action-row`);return i.setAttribute(`title`,e),t!==``&&i.setAttribute(`subtitle`,t),r.appendChild(i),n.appendChild(r),n}const ba={stories:[ya]},xa={title:`Text/Editable Label`,description:`Gtk.EditableLabel — a label you click and edit in place. Enter starts editing, Enter commits, Escape discards, and editable=false leaves it a label; the draft lives in the entry, not in the label.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0},{name:`editing`,label:`Editing`,type:t.BOOLEAN,defaultValue:!1}]},Sa={stories:[class EditableLabelWebStory extends StoryElement{_label=null;constructor(){super(EditableLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return xa}initialize(){this._label=document.createElement(`gtk-editable-label`),this._label.text=this.args.text,this._apply(),this.addContent(this._label)}updateArgs(e){this._apply()}_apply(){this._label&&(this._label.editing||(this._label.text=this.args.text),this._label.editable=this.args.editable,this._label.editing=this.args.editing)}}]},Ca={title:`Text/Search Bar`,description:`Gtk.SearchBar — the strip that reveals a search entry when search starts. The property IS the revealer's reveal-child, so one boolean decides both whether the strip is shown and whether the search is on; hiding it clears the entry.`,controls:[{name:`searchModeEnabled`,label:`Search mode`,type:t.BOOLEAN,defaultValue:!1},{name:`showCloseButton`,label:`Close button`,type:t.BOOLEAN,defaultValue:!0}]},wa={stories:[class SearchBarWebStory extends StoryElement{_bar=null;constructor(){super(SearchBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ca}initialize(){this._bar=document.createElement(`gtk-search-bar`);let e=document.createElement(`gtk-entry`);e.setAttribute(`placeholder-text`,`Search`),this._bar.appendChild(e),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.searchModeEnabled=this.args.searchModeEnabled,this._bar.showCloseButton=this.args.showCloseButton)}}]},Ta={title:`Text/Text View`,description:`Gtk.TextView — the multi-line editor. Its text lives in a Gtk.TextBuffer rather than in a property, wrap-mode and justification are Pango's, and accepts-tab defaults to TRUE, which is the opposite of a browser's.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`A text view holds as many lines as it is given.
10889
+ Tab inserts a tab character.`},{name:`wrapMode`,label:`Wrap mode`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Char`,value:`char`},{label:`Word`,value:`word`},{label:`Word or char`,value:`word-char`}],defaultValue:`none`},{name:`justification`,label:`Justification`,type:t.SELECT,options:[{label:`Left`,value:`left`},{label:`Right`,value:`right`},{label:`Center`,value:`center`},{label:`Fill`,value:`fill`}],defaultValue:`left`},{name:`monospace`,label:`Monospace`,type:t.BOOLEAN,defaultValue:!1},{name:`acceptsTab`,label:`Tab inserts a tab`,type:t.BOOLEAN,defaultValue:!0},{name:`cursorVisible`,label:`Show cursor`,type:t.BOOLEAN,defaultValue:!0},{name:`topMargin`,label:`Top margin`,type:t.NUMBER,defaultValue:6}]},Ea={stories:[class TextViewWebStory extends StoryElement{_view=null;constructor(){super(TextViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ta}initialize(){this._view=document.createElement(`gtk-text-view`),this._view.text=this.args.text,this._apply(),this.addContent(this._view)}updateArgs(e){this._apply()}_apply(){this._view&&(this._view.wrapMode=this.args.wrapMode,this._view.justification=this.args.justification,this._view.monospace=this.args.monospace,this._view.acceptsTab=this.args.acceptsTab,this._view.cursorVisible=this.args.cursorVisible,this._view.topMargin=Number(this.args.topMargin??0))}}]},Da={title:`Text/Text`,description:`Gtk.Text — the single-line text widget every Gtk.Entry is built on. Standalone it is a field with a placeholder and a length limit; visibility=false masks it, propagate-text-width grows it with its text.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`placeholderText`,label:`Placeholder`,type:t.TEXT,defaultValue:``},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0},{name:`visibility`,label:`Visible`,type:t.BOOLEAN,defaultValue:!0},{name:`maxLength`,label:`Max length (0 = none)`,type:t.NUMBER,defaultValue:0},{name:`propagateTextWidth`,label:`Grow with text`,type:t.BOOLEAN,defaultValue:!1}]},Oa={stories:[class TextWebStory extends StoryElement{_text=null;constructor(){super(TextWebStory.getMetadata(),`Default`)}static getMetadata(){return Da}initialize(){this._text=document.createElement(`gtk-text`),this._apply(),this.addContent(this._text)}updateArgs(e){this._apply()}_apply(){if(!this._text)return;let e=this._text;e.text=this.args.text,e.placeholderText=this.args.placeholderText,e.editable=this.args.editable,e.visibility=this.args.visibility,e.maxLength=Number(this.args.maxLength??0),e.propagateTextWidth=this.args.propagateTextWidth}}]},ka={title:`Layout/Aspect Frame`,description:`Gtk.AspectFrame — one child, given a width/height ratio and a place in the space left over. obey-child is TRUE by default and takes the ratio from the child itself, so the story starts with it FALSE or the ratio control would be inert.`,controls:[{name:`ratio`,label:`Ratio`,type:t.RANGE,min:.5,max:3,step:.25,defaultValue:2},{name:`xalign`,label:`Xalign`,type:t.RANGE,min:0,max:1,step:.5,defaultValue:.5},{name:`yalign`,label:`Yalign`,type:t.RANGE,min:0,max:1,step:.5,defaultValue:.5},{name:`obeyChild`,label:`Obey child`,type:t.BOOLEAN,defaultValue:!1}]},Aa={stories:[class AspectFrameWebStory extends StoryElement{_frame=null;constructor(){super(AspectFrameWebStory.getMetadata(),`Default`)}static getMetadata(){return ka}initialize(){this._frame=document.createElement(`gtk-aspect-frame`),this._frame.style.width=`320px`,this._frame.style.height=`180px`;let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`The frame gives this child the ratio above, and puts it where xalign and yalign say.`),e.style.padding=`12px`,this._frame.append(e),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){this._frame&&(this._frame.setAttribute(`ratio`,String(this.args.ratio)),this._frame.setAttribute(`xalign`,String(this.args.xalign)),this._frame.setAttribute(`yalign`,String(this.args.yalign)),this._frame.setAttribute(`obey-child`,String(this.args.obeyChild)))}}]},ja={title:`Layout/Center Box`,description:`Gtk.CenterBox — three widgets, pinned to the start, the centre and the end, with the space between them going to whichever child can grow. shrink-center-last decides who gives up space first.`,controls:[{name:`shrinkCenterLast`,label:`Shrink center last`,type:t.BOOLEAN,defaultValue:!0},{name:`baselinePosition`,label:`Baseline position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Center`,value:`center`},{label:`Bottom`,value:`bottom`}],defaultValue:`center`}]},Ma={stories:[class CenterBoxWebStory extends StoryElement{_box=null;constructor(){super(CenterBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return ja}initialize(){this._box=document.createElement(`gtk-center-box`),this._box.style.padding=`12px`;for(let[e,t]of[[`start-widget`,`Start`],[`center-widget`,`Centre`],[`end-widget`,`End`]]){let n=document.createElement(`gtk-label`);n.setAttribute(`slot`,e),n.setAttribute(`label`,t),this._box.append(n)}this._apply(),this.addContent(this._box)}updateArgs(e){this._apply()}_apply(){this._box&&(this._box.toggleAttribute(`shrink-center-last`,this.args.shrinkCenterLast),this._box.setAttribute(`baseline-position`,this.args.baselinePosition))}}]},Na={title:`Layout/Fixed`,description:`Gtk.Fixed — children at pixel positions, which is the whole of its API: it declares no property of its own. The two offsets are the arguments of gtk_fixed_put().`,controls:[{name:`offsetX`,label:`Offset x`,type:t.RANGE,min:0,max:80,step:4,defaultValue:24},{name:`offsetY`,label:`Offset y`,type:t.RANGE,min:0,max:80,step:4,defaultValue:16}]},Pa={stories:[class FixedWebStory extends StoryElement{_fixed=null;_cells=[];constructor(){super(FixedWebStory.getMetadata(),`Default`)}static getMetadata(){return Na}initialize(){let e=document.createElement(`gtk-fixed`);this._fixed=e;for(let t of[`at (x, y)`,`at (x + 96, y + 40)`]){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,t),this._cells.push(n),e.append(n)}this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._fixed;if(e===null)return;let t=this.args.offsetX,n=this.args.offsetY,[r,i]=this._cells;r!==void 0&&e.move(r,t,n),i!==void 0&&e.move(i,t+96,n+40)}}]},Fa={title:`Layout/Frame`,description:`Gtk.Frame — a 1px border with a label embedded in its top edge. GTK draws the label as its own widget above the child, and label-xalign says where across the frame it sits.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Details`},{name:`labelXalign`,label:`Label xalign`,type:t.RANGE,defaultValue:0,min:0,max:1,step:.5}]},Ia={stories:[class FrameWebStory extends StoryElement{_frame=null;constructor(){super(FrameWebStory.getMetadata(),`Default`)}static getMetadata(){return Fa}initialize(){this._frame=document.createElement(`gtk-frame`);let e=document.createElement(`gtk-label`);e.setAttribute(`label`,`A framed region: the label sits in the top edge of the border.`),e.style.padding=`12px`,this._frame.append(e),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){if(!this._frame)return;let e=this.args.label;e===``?this._frame.removeAttribute(`label`):this._frame.setAttribute(`label`,e),this._frame.setAttribute(`label-xalign`,String(this.args.labelXalign))}}]},La={title:`Layout/Grid`,description:`Gtk.Grid — a table of cells sized by what is in them, filled row by row. The two spacings are the gap between lines, the two homogeneous flags make every line the same, and a vertical grid attaches down the rows instead of across the columns.`,controls:[{name:`columnSpacing`,label:`Column spacing`,type:t.RANGE,min:0,max:36,step:2,defaultValue:12},{name:`rowSpacing`,label:`Row spacing`,type:t.RANGE,min:0,max:36,step:2,defaultValue:12},{name:`columnHomogeneous`,label:`Column homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`rowHomogeneous`,label:`Row homogeneous`,type:t.BOOLEAN,defaultValue:!1},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`}]},Ra={stories:[class GridWebStory extends StoryElement{_grid=null;constructor(){super(GridWebStory.getMetadata(),`Default`)}static getMetadata(){return La}initialize(){this._grid=document.createElement(`gtk-grid`),this._grid.style.padding=`12px`;for(let e of[`Name`,`Value`,`Unit`,`editable`]){let t=document.createElement(`gtk-label`);t.setAttribute(`label`,e),t.style.padding=`6px`,this._grid.append(t)}this._apply(),this.addContent(this._grid)}updateArgs(e){this._apply()}_apply(){this._grid&&(this._grid.setAttribute(`column-spacing`,String(this.args.columnSpacing)),this._grid.setAttribute(`row-spacing`,String(this.args.rowSpacing)),this._grid.toggleAttribute(`column-homogeneous`,this.args.columnHomogeneous),this._grid.toggleAttribute(`row-homogeneous`,this.args.rowHomogeneous),this._grid.setAttribute(`orientation`,this.args.orientation))}}]},za={title:`Buttons/Toggle Button`,description:`Gtk.ToggleButton — a button that stays pressed. It is a Gtk.Button with one more property, active, so every button style class applies; Adw.ToggleGroup is the linked, single-choice form of it.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Mute`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!1},{name:`flat`,label:`Flat`,type:t.BOOLEAN,defaultValue:!1}]},Ba={stories:[class ToggleButtonWebStory extends StoryElement{_button=null;constructor(){super(ToggleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return za}initialize(){this._button=document.createElement(`gtk-toggle-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.toggleAttribute(`active`,this.args.active),this._button.toggleAttribute(`flat`,this.args.flat))}}]},Va={title:`Buttons/Color Dialog Button`,description:`Gtk.ColorDialogButton — a button that shows a colour and opens a chooser for it. It is insensitive until a dialog is set, and the swatch announces the channel percentages.`,controls:[{name:`rgba`,label:`Colour`,type:t.TEXT,defaultValue:`#3584e4`},{name:`title`,label:`Dialog title`,type:t.TEXT,defaultValue:`Choose a colour`}]},Ha={stories:[class ColorDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(ColorDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Va}initialize(){this._button=document.createElement(`gtk-color-dialog-button`),this._button.setAttribute(`dialog`,``),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){if(!this._button)return;this._button.setAttribute(`rgba`,this.args.rgba);let e=this.args.title.trim();this._button.dialog={title:e===``?null:e}}}]},Ua={title:`Buttons/Font Dialog Button`,description:`Gtk.FontDialogButton — a button that shows a font and opens a chooser for it. At level family the label is the family alone; from font up it is family plus size, and the size box appears.`,controls:[{name:`fontDesc`,label:`Font`,type:t.TEXT,defaultValue:`Sans Bold 12`},{name:`level`,label:`Level`,type:t.SELECT,options:[{label:`Family`,value:`family`},{label:`Face`,value:`face`},{label:`Font`,value:`font`},{label:`Features`,value:`features`}],defaultValue:`font`},{name:`useFont`,label:`Draw in the font`,type:t.BOOLEAN,defaultValue:!0},{name:`useSize`,label:`Draw in the size`,type:t.BOOLEAN,defaultValue:!0}]},Wa={stories:[class FontDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(FontDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ua}initialize(){this._button=document.createElement(`gtk-font-dialog-button`),this._button.setAttribute(`dialog`,``),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`level`,this.args.level),this._button.setAttribute(`font-desc`,this.args.fontDesc),this._button.toggleAttribute(`use-font`,this.args.useFont),this._button.toggleAttribute(`use-size`,this.args.useSize))}}]},Ga={title:`Buttons/Link Button`,description:`Gtk.LinkButton — a button that follows a URI. It is a Gtk.Button with a uri and a visited state: clicking launches the URI and marks the link visited, and pointing it somewhere new un-visits it.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`GNOME`},{name:`uri`,label:`URI`,type:t.TEXT,defaultValue:`https://gnome.org`},{name:`visited`,label:`Visited`,type:t.BOOLEAN,defaultValue:!1}]},Ka={stories:[class LinkButtonWebStory extends StoryElement{_button=null;constructor(){super(LinkButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ga}initialize(){this._button=document.createElement(`gtk-link-button`),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`label`,this.args.label),this._button.setAttribute(`uri`,this.args.uri),this._button.toggleAttribute(`visited`,this.args.visited))}}]},qa=[`audio-volume-muted-symbolic`,`audio-volume-low-symbolic`,`audio-volume-high-symbolic`],Ja={title:`Buttons/Scale Button`,description:`Gtk.ScaleButton — a button whose press opens a scale. The icon follows the value: no list draws image-missing, one name is used throughout, two split the range, three put the first at the bottom and the second at the top and share the interior, five spread it.`,controls:[{name:`value`,label:`Value`,type:t.NUMBER,defaultValue:70},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Vertical`,value:`vertical`},{label:`Horizontal`,value:`horizontal`}],defaultValue:`vertical`},{name:`hasFrame`,label:`Has frame`,type:t.BOOLEAN,defaultValue:!1}]},Ya={stories:[class ScaleButtonWebStory extends StoryElement{_button=null;constructor(){super(ScaleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ja}initialize(){this._button=document.createElement(`gtk-scale-button`),this._button.setAttribute(`icons`,JSON.stringify(qa)),this._apply(),this.addContent(this._button)}updateArgs(e){this._apply()}_apply(){this._button&&(this._button.setAttribute(`orientation`,this.args.orientation),this._button.toggleAttribute(`has-frame`,this.args.hasFrame),this._button.setAttribute(`value`,String(this.args.value)))}}]},Xa={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!1}]};function iconName(e){return e.replace(/-symbolic$/,``)}const Za={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Xa}initialize(){this._content=document.createElement(`adw-button-content`),this._syncContent();let e=document.createElement(`button`);e.className=`adw-button suggested-action pill`,e.append(this._content),this.addContent(e)}updateArgs(e){this._syncContent()}_syncContent(){this._content&&(this._content.setAttribute(`label`,this.args.label),this._content.setAttribute(`icon-name`,iconName(this.args.iconName)),this.args.canShrink?this._content.setAttribute(`can-shrink`,``):this._content.removeAttribute(`can-shrink`))}}]},Qa={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:t.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:t.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]},$a=[`pill`,`circular`,`suggested`,`destructive`,`flat`],eo={pill:`pill`,circular:`circular`,"suggested-action":`suggested`,"destructive-action":`destructive`,flat:`flat`};function button(e){let t=document.createElement(`gtk-button`);return e.label&&t.setAttribute(`label`,e.label),e.icon&&t.setAttribute(`icon`,e.icon),e.variant&&t.setAttribute(e.variant,``),t}const to={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Qa}initialize(){let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center;`,e.append(button({label:`Pill`,variant:`pill`}),button({icon:`list-add`,variant:`circular`}),button({label:`Suggested`,variant:`suggested`}),button({label:`Delete`,variant:`destructive`}),button({label:`Flat`,variant:`flat`})),this._demo=button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}updateArgs(e){this._demo&&this._applyStyle(this.args.style)}_applyStyle(e){if(!this._demo)return;for(let e of $a)this._demo.removeAttribute(e);let t=eo[e];t&&this._demo.setAttribute(t,``),t===`circular`?(this._demo.setAttribute(`icon`,`list-add`),this._demo.removeAttribute(`label`)):(this._demo.removeAttribute(`icon`),this._demo.setAttribute(`label`,this.args.label))}}]},no=[`Save as…`,`Export`,`Print`],ro={title:`Buttons/Menu Button`,description:`Gtk.MenuButton — a button whose only action is to open a menu. Where a Split Button has a primary action beside its arrow, this one has none: every choice lives in the popover.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Hamburger`,value:`open-menu-symbolic`},{label:`More`,value:`view-more-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`open-menu-symbolic`},{name:`menuTitle`,label:`Menu title`,type:t.TEXT,defaultValue:`Document`}]},io={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ro}initialize(){this._widget=document.createElement(`gtk-menu-button`),this._widget.setAttribute(`menu-model`,JSON.stringify(no.map(e=>({label:e})))),this._apply(),this.addContent(this._widget)}updateArgs(e){this._apply()}_apply(){this._widget&&(this._widget.setAttribute(`icon-name`,this.args.iconName.replace(/-symbolic$/,``)),this._widget.setAttribute(`menu-title`,this.args.menuTitle))}}]},ao={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},oo={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]},so=JSON.stringify([{label:`Save as…`,action:`app.save-as`},{label:`Export`,action:`app.export`},{label:`Print`,action:`app.print`}]);function iconBaseName(e){return e.replace(/-symbolic$/,``)}function splitButton(e,t={}){let n=document.createElement(`adw-split-button`);n.setAttribute(`menu-model`,so),n.setAttribute(`label`,e.label);let r=e.iconName;return r&&n.setAttribute(`icon-name`,iconBaseName(r)),t.flat&&n.setAttribute(`flat`,``),n}var SplitButtonWebStoryBase=class extends StoryElement{_widget=null;initialize(){this._widget=splitButton(this.args,{flat:this.flat}),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?(this._widget.setAttribute(`icon-name`,iconBaseName(t)),this._widget.removeAttribute(`label`)):(this._widget.removeAttribute(`icon-name`),this._widget.setAttribute(`label`,this.args.label))}};const co={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ao}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return oo}}]},lo={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:t.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]},uo=[`flat`,`round`],fo=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],po={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return lo}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of fo){let r=document.createElement(`adw-toggle`);r.setAttribute(`label`,t),r.setAttribute(`icon-name`,n),e.appendChild(r)}e.setAttribute(`active`,String(this.args.active)),this._group=e,this._applyStyle(this.args.style),this.addContent(e)}updateArgs(e){this._group&&(this._group.setAttribute(`active`,String(this.args.active)),this._applyStyle(this.args.style))}_applyStyle(e){if(this._group){for(let e of uo)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},mo={title:`Layout/Bin`,description:`Adw.Bin — a widget with exactly one child. It draws nothing of its own and gives the child its whole allocation; setting a new child replaces the old one.`,controls:[{name:`label`,label:`Child label`,type:t.TEXT,defaultValue:`The one child of this bin.`},{name:`swap`,label:`Replace the child`,type:t.BOOLEAN,defaultValue:!1}]},ho={stories:[class BinWebStory extends StoryElement{_bin=null;constructor(){super(BinWebStory.getMetadata(),`Default`)}static getMetadata(){return mo}initialize(){this._bin=document.createElement(`adw-bin`),this._bin.style.width=`320px`,this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){if(!this._bin)return;let e=this.args.swap,t=document.createElement(`adw-card`);t.style.padding=`18px`,t.style.boxSizing=`border-box`,t.textContent=e?`The first child was replaced, not stacked.`:this.args.label,this._bin.child=t}}]},go={title:`Layout/Clamp Scrollable`,description:`Adw.ClampScrollable — a clamp whose child scrolls. The scrollbar stays at the edge of the window while the content is held at a maximum width.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},_o=Array.from({length:24},(e,t)=>`Line ${t+1}: held at the clamp's width while it scrolls.`),vo={stories:[class ClampScrollableWebStory extends StoryElement{_clamp=null;constructor(){super(ClampScrollableWebStory.getMetadata(),`Default`)}static getMetadata(){return go}initialize(){let e=document.createElement(`div`);e.style.padding=`12px 0`;for(let t of _o){let n=document.createElement(`div`);n.textContent=t,e.append(n)}this._clamp=document.createElement(`adw-clamp-scrollable`),this._clamp.style.width=`640px`,this._clamp.style.height=`240px`,this._clamp.append(e),this._sync(),this.addContent(this._clamp)}updateArgs(e){this._sync()}_sync(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},yo={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},bo={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return yo}initialize(){let e=document.createElement(`adw-card`);e.style.width=`100%`,e.style.boxSizing=`border-box`,e.style.padding=`18px`,e.textContent=`This content is clamped — it stops growing past the maximum size and stays centred.`,this._clamp=document.createElement(`adw-clamp`),this._clamp.append(e),this._syncClamp(),this.addContent(this._clamp)}updateArgs(e){this._syncClamp()}_syncClamp(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},xo={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:t.BOOLEAN,defaultValue:!0}]},So={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return xo}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`gtk-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``),this._headerBar=document.createElement(`adw-header-bar`),this._headerBar.style.width=`460px`,this._headerBar.append(e,this._title,t),this._sync(),this.addContent(this._headerBar)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle),this._title.hidden=!this.args.showTitle)}}]},Co=[{label:`Cut`},{label:`Copy`},{label:`Paste`},{label:`Delete`,accel:`<Shift>Delete`}],wo={title:`Layout/Popover Bin`,description:'Gtk.PopoverBin — GTK 4.22’s one-child container with a popover, for the place where "any part of this window can offer a menu" is the answer. `menu-model` builds the popover for you, and `handle-input` is what turns a right click or a long press into a popup — a plain click still reaches the child.',controls:[{name:`handleInput`,label:`Right click / long press opens`,type:t.BOOLEAN,defaultValue:!0}]},To={stories:[class PopoverBinWebStory extends StoryElement{_bin;constructor(){super(PopoverBinWebStory.getMetadata(),`Default`)}static getMetadata(){return wo}initialize(){this._bin=document.createElement(`gtk-popover-bin`);let e=document.createElement(`gtk-button`);e.setAttribute(`label`,`Right-click me`),this._bin.appendChild(e),this._bin.addEventListener(`keydown`,e=>{let t=e;if(t.key===`ContextMenu`&&!t.shiftKey){t.preventDefault(),this._bin.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._bin.querySelector(`gtk-popover-menu`);e.open=!0}}),this._apply(),this.addContent(this._bin)}updateArgs(e){this._apply()}_apply(){this._bin&&(this._bin.setAttribute(`menu-model`,JSON.stringify(Co)),this._bin.setAttribute(`handle-input`,String(this.args.handleInput)))}}]},Eo=[{label:`New Window`,accel:`<Control>N`},{section:[{label:`Cut`},{label:`Copy`},{label:`Paste`}],label:`Edit`},{label:`Open With`,submenu:[{label:`Text Editor`},{label:`Web Browser`},{label:`Terminal`}]}],Do={title:`Layout/Popover Menu`,description:"Gtk.PopoverMenu — a Gtk.Popover whose contents are a menu model instead of a child widget. A submenu swaps the page of the ONE surface rather than opening a second popup beside it, which is why the open page is a named one (`visible-submenu`).",controls:[{name:`menuTitle`,label:`Heading`,type:t.TEXT,defaultValue:`Document`},{name:`position`,label:`Position`,type:t.SELECT,options:[{label:`Bottom`,value:`bottom`},{label:`Top`,value:`top`},{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`bottom`},{name:`align`,label:`Align`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`autohide`,label:`Dismiss on outside click`,type:t.BOOLEAN,defaultValue:!0}]},Oo={stories:[class PopoverMenuWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverMenuWebStory.getMetadata(),`Default`)}static getMetadata(){return Do}initialize(){this._anchor=document.createElement(`button`),this._anchor.textContent=`Open menu`,this._popover=document.createElement(`gtk-popover-menu`),this._popover.setAttribute(`menu-model`,JSON.stringify(Eo)),this._anchor.appendChild(this._popover),this._apply(),this.addContent(this._anchor)}updateArgs(e){this._apply()}_apply(){this._popover&&(this._popover.setAttribute(`position`,this.args.position),this._popover.setAttribute(`align`,this.args.align),this._popover.setAttribute(`autohide`,String(this.args.autohide)),this._popover.setAttribute(`menu-title`,this.args.menuTitle))}}]},ko={title:`Layout/Popover`,description:"Gtk.Popover — the bubble-like surface. No model and no menu: it holds whatever widget you put in it, and everything here is about WHERE it appears and WHEN it goes away. `autohide` off is entry completion: the list follows the typing and the caret never leaves.",controls:[{name:`position`,label:`Position`,type:t.SELECT,options:[{label:`Bottom`,value:`bottom`},{label:`Top`,value:`top`},{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`bottom`},{name:`align`,label:`Align`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`autohide`,label:`Dismiss on outside click`,type:t.BOOLEAN,defaultValue:!0}]},Ao={stories:[class PopoverWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverWebStory.getMetadata(),`Default`)}static getMetadata(){return ko}initialize(){this._anchor=document.createElement(`button`),this._anchor.textContent=`Show popover`,this._popover=document.createElement(`gtk-popover`);let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-direction:column;gap:6px;`;for(let t of[`Anything you like`,`in here`]){let n=document.createElement(`span`);n.textContent=t,e.appendChild(n)}this._popover.appendChild(e),this._anchor.appendChild(this._popover),this._anchor.addEventListener(`click`,()=>{this._popover.open=!this._popover.open}),this._apply(),this.addContent(this._anchor)}updateArgs(e){this._apply()}_apply(){this._popover&&(this._popover.setAttribute(`position`,this.args.position),this._popover.setAttribute(`align`,this.args.align),this._popover.setAttribute(`autohide`,String(this.args.autohide)))}}]},jo={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:t.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:t.BOOLEAN,defaultValue:!0}]},Mo={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return jo}initialize(){let e=document.createElement(`adw-toolbar-view`);e.style.width=`460px`,e.style.height=`320px`;let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Documents`),n.setAttribute(`subtitle`,`12 items`),t.appendChild(n),e.appendChild(t),this._topBar=t;let r=document.createElement(`adw-status-page`);r.setAttribute(`icon`,`folder-documents`),r.setAttribute(`title`,`Your library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),e.appendChild(r);let i=document.createElement(`div`);i.setAttribute(`slot`,`bottom`),i.className=`adw-action-bar`,i.style.display=`flex`,i.style.alignItems=`center`,i.style.gap=`var(--spacing-xs, 6px)`,i.style.padding=`var(--spacing-xs, 6px)`,i.style.borderTop=`1px solid var(--separator-color, rgba(0, 0, 0, 0.15))`;let a=document.createElement(`gtk-button`);a.setAttribute(`icon`,`list-add`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,`Add`);let o=document.createElement(`gtk-button`);o.setAttribute(`icon`,`list-remove`),o.setAttribute(`flat`,``),o.setAttribute(`tooltip`,`Remove`);let s=document.createElement(`span`);s.textContent=`Selection: none`,s.style.flex=`1 1 auto`,s.style.textAlign=`center`;let c=document.createElement(`gtk-button`);c.setAttribute(`icon`,`send-to`),c.setAttribute(`flat`,``),c.setAttribute(`tooltip`,`Share`),i.append(a,o,s,c),e.appendChild(i),this._bottomBar=i,this._sync(),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._topBar&&(this._topBar.hidden=!this.args.revealTopBars),this._bottomBar&&(this._bottomBar.hidden=!this.args.revealBottomBars)}}]},No={title:`Layout/Viewport`,description:`Gtk.Viewport — scrollability for a widget that has none of its own. It has one property, scroll-to-focus: whether a widget that takes the focus is scrolled into view. It is also what a Gtk.ScrolledWindow puts its child in.`,controls:[{name:`scrollToFocus`,label:`Scroll to focus`,type:t.BOOLEAN,defaultValue:!0}]},Po={stories:[class ViewportWebStory extends StoryElement{_viewport=null;constructor(){super(ViewportWebStory.getMetadata(),`Default`)}static getMetadata(){return No}initialize(){let e=document.createElement(`gtk-viewport`);e.style.height=`240px`,e.style.width=`260px`;let t=document.createElement(`gtk-box`);t.setAttribute(`orientation`,`vertical`),t.setAttribute(`spacing`,`8`);for(let e=1;e<=16;e++){let n=document.createElement(`gtk-label`);n.setAttribute(`label`,`Row ${e}`),t.appendChild(n)}let n=document.createElement(`gtk-button`);n.setAttribute(`label`,`Focus me`),t.appendChild(n),e.appendChild(t),this._viewport=e,this._apply(),this.addContent(e)}updateArgs(e){this._apply()}_apply(){let e=this._viewport;e&&e.setAttribute(`scroll-to-focus`,String(this.args.scrollToFocus))}}]},Fo={title:`Layout/Application Window`,description:`Adw.ApplicationWindow — an Adw.Window that belongs to a GtkApplication, plus that application’s menubar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showMenubar`,label:`Show menubar`,type:t.BOOLEAN,defaultValue:!0}]},Io=[{label:`File`,submenu:[{label:`New Window`,action:`app.new-window`},{label:`Quit`,action:`app.quit`}]},{label:`Help`,submenu:[{label:`Keyboard Shortcuts`,action:`app.shortcuts`},{label:`About`,action:`app.about`}]}],Lo={stories:[class ApplicationWindowWebStory extends StoryElement{_window=null;_title=null;constructor(){super(ApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Fo}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`title`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`adw-header-bar`);t.style.width=`460px`,t.append(e,this._title);let n=document.createElement(`adw-toolbar-view`);n.append(t);let r=document.createElement(`adw-status-page`);r.setAttribute(`title`,`Your Library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),n.append(r);let i=document.createElement(`adw-application-window`);i.setAttribute(`width`,`460`),i.setAttribute(`height`,`260`),i.setAttribute(`menu-model`,JSON.stringify(Io)),this.applyMenubar(i,this.args.showMenubar),i.append(n),this._window=i,this._sync(),this.addContent(i)}updateArgs(e){this._window&&this.applyMenubar(this._window,this.args.showMenubar),this._sync()}applyMenubar(e,t){t?e.setAttribute(`show-menubar`,``):e.removeAttribute(`show-menubar`)}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle))}}]},Ro={title:`Layout/Window`,description:`Adw.Window — a freeform window with no titlebar area. Use Adw.ToolbarView with Adw.HeaderBar for the top chrome.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`}]},zo={stories:[class WindowWebStory extends StoryElement{_title=null;constructor(){super(WindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ro}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`gtk-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`gtk-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``);let n=document.createElement(`adw-header-bar`);n.style.width=`460px`,n.append(e,this._title,t);let r=document.createElement(`adw-status-page`);r.setAttribute(`title`,`Your Library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`);let i=document.createElement(`adw-toolbar-view`);i.append(n,r);let a=document.createElement(`adw-window`);a.append(i),this._sync(),this.addContent(a)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle))}}]},Bo={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8}]},Vo=[`Design`,`Adwaita`,`GNOME`,`GTK`,`TypeScript`,`Storybook`,`Wrapping`,`Layout`],Ho={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Bo}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of Vo){let t=document.createElement(`gtk-button`);t.setAttribute(`label`,e),t.setAttribute(`pill`,``),this._wrap.append(t)}this._syncWrap(),this.addContent(this._wrap)}updateArgs(e){this._syncWrap()}_syncWrap(){this._wrap&&(this._wrap.setAttribute(`child-spacing`,String(this.args.childSpacing)),this._wrap.setAttribute(`line-spacing`,String(this.args.lineSpacing)))}}]},Uo=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],Wo={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Uo},Go={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Uo},Ko=[{title:`Welcome`,accent:`color-mix(in srgb, var(--accent-bg-color) 14%, var(--window-bg-color))`},{title:`Discover`,accent:`color-mix(in srgb, #2ec27e 14%, var(--window-bg-color))`},{title:`Get started`,accent:`color-mix(in srgb, #e5a50a 14%, var(--window-bg-color))`}];let qo=0;function buildPage(e,t){let n=document.createElement(`adw-card`);n.style.cssText=[`width:440px`,`height:260px`,`display:flex`,`align-items:center`,`justify-content:center`,`background-color:${t}`,`color:#ffffff`,`box-sizing:border-box`].join(`;`);let r=document.createElement(`span`);return r.textContent=e,r.style.cssText=`font-size:24pt;font-weight:800;`,n.appendChild(r),n}function syncCarouselArgs(e,t){e.setAttribute(`allow-scroll-wheel`,t.allowScrollWheel?`true`:`false`),e.setAttribute(`allow-long-swipes`,t.allowLongSwipes?`true`:`false`)}var CarouselWebStoryBase=class extends StoryElement{_carousel=null;initialize(){let e=document.createElement(`adw-carousel`);e.id=`adw-carousel-${qo++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of Ko)e.appendChild(buildPage(t.title,t.accent));this._carousel=e;let t=document.createElement(this.indicatorTag());t.setAttribute(`for`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;align-items:center;`,n.append(e,t),this.addContent(n)}updateArgs(e){this._carousel&&syncCarouselArgs(this._carousel,this.args)}};const Jo={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return Wo}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return Go}indicatorTag(){return`adw-carousel-indicator-lines`}}]},Yo={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:t.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]},Xo=[{id:`overview`,title:`Overview`,icon:`view-grid`,body:`A quick summary of your project.`},{id:`activity`,title:`Activity`,icon:`document-edit`,body:`Recent edits and changes.`},{id:`settings`,title:`Settings`,icon:`emblem-system`,body:`Configure how things behave.`}],Zo={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Yo}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of Xo){let a=document.createElement(`adw-view-stack-page`);a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.id=t,o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`display-mode`,this.args.displayMode),this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`display-mode`,this.args.displayMode)}}]},Qo=[{name:`overview`,label:`Overview`,body:`A notebook brings its own tab strip.`},{name:`activity`,label:`Activity`,body:`tab-pos says which edge the strip is on.`},{name:`notes`,label:``,body:`No tab-label: the tab reads "Page 3".`}],$o={title:`View Switching/Notebook`,description:'Gtk.Notebook — the older page container, a stack that brings its own tab bar. `tab-pos` picks the edge (top, bottom, left, right), `show-tabs` takes the strip away, `show-border` is the bevel around the pages — a CSS class in C — and `page` is the current page by INDEX rather than by name. A GtkNotebookPage is a GObject rather than a widget, so its tab-label and friends live on the page itself, and a page without one gets the number "Page N" as its tab text. `enable-popup` puts the pages in a right-click menu.',controls:[{name:`tabPos`,label:`Tab position`,type:t.SELECT,options:[{label:`Top`,value:`top`},{label:`Bottom`,value:`bottom`},{label:`Left`,value:`left`},{label:`Right`,value:`right`}],defaultValue:`top`},{name:`showTabs`,label:`Show tabs`,type:t.BOOLEAN,defaultValue:!0},{name:`showBorder`,label:`Show border`,type:t.BOOLEAN,defaultValue:!0},{name:`enablePopup`,label:`Enable popup (right-click)`,type:t.BOOLEAN,defaultValue:!1}]},es={stories:[class NotebookWebStory extends StoryElement{_notebook=null;constructor(){super(NotebookWebStory.getMetadata(),`Default`)}static getMetadata(){return $o}initialize(){let e=document.createElement(`gtk-notebook`);e.style.cssText=`width:480px;height:320px;`;for(let t of Qo){let n=document.createElement(`div`);t.label&&n.setAttribute(`tab-label`,t.label),n.setAttribute(`menu-label`,t.label||t.name),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.setAttribute(`data-gtk-notebook-story`,`heading`),r.textContent=t.label||t.name;let i=document.createElement(`div`);i.setAttribute(`data-gtk-notebook-story`,`body`),i.textContent=t.body,n.append(r,i),e.appendChild(n)}this.addContent(e),this._notebook=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._notebook&&(this._notebook.setAttribute(`tab-pos`,this.args.tabPos),this._notebook.setAttribute(`show-tabs`,this.args.showTabs?``:`false`),this._notebook.setAttribute(`show-border`,this.args.showBorder?``:`false`),this._notebook.toggleAttribute(`enable-popup`,this.args.enablePopup))}}]},ts=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,attn:!1,body:`Three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`,attn:!1,body:`Messages marked important.`},{name:`drafts`,title:`Drafts`,icon:`document-edit-symbolic`,attn:!0,body:`One draft needs attention.`},{name:`settings`,title:``,icon:`preferences-system-symbolic`,attn:!1,body:`No row: a title is the row.`}],ns={title:`View Switching/Stack Sidebar`,description:"Gtk.StackSidebar — a vertical list of a Gtk.Stack's pages, the sidebar counterpart of the stack switcher. A row is made of the page's TITLE alone: `update_row` never reads `icon-name`, so the page with only an icon at the end of this story gets no row at all, where the switcher would show an icon button for it. `needs-attention` puts a dot in front of the label.",controls:[{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`}],defaultValue:`slide-left-right`}]},rs={stories:[class StackSidebarWebStory extends StoryElement{_stack=null;constructor(){super(StackSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return ns}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-sidebar-demo`,e.style.flex=`1`;for(let t of ts){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),t.title&&n.setAttribute(`title`,t.title),t.icon&&n.setAttribute(`icon-name`,t.icon),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.textContent=t.body,n.appendChild(r),e.appendChild(n)}let t=document.createElement(`gtk-stack-sidebar`);t.setAttribute(`stack`,e.id),t.style.width=`180px`;let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:row;gap:12px;width:480px;height:320px;`,n.append(t,e),this.addContent(n),this._stack=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._stack&&this._stack.setAttribute(`transition-type`,this.args.transitionType)}}]},is=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,attn:!1,body:`Three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`,attn:!1,body:`Messages marked important.`},{name:`archive`,title:`Archive`,icon:``,attn:!1,body:`Older conversations kept for reference.`},{name:`drafts`,title:``,icon:`document-edit-symbolic`,attn:!0,body:`One draft needs your attention.`}],as={title:`View Switching/Stack Switcher`,description:"Gtk.StackSwitcher — a linked row of toggle buttons, one per page of a Gtk.Stack. A page with a title and no icon gets a label button; one with an icon and no title gets an icon button and puts the title on the switcher as a tooltip; a page with NEITHER is left out of the row entirely. `orientation` turns the row vertical, and `needs-attention` on a page puts a dot on its button.",controls:[{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Horizontal`,value:`horizontal`},{label:`Vertical`,value:`vertical`}],defaultValue:`horizontal`},{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`}],defaultValue:`slide-left-right`}]},os={stories:[class StackSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(StackSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return as}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-switcher-demo`,e.style.flex=`1`;for(let t of is){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),t.title&&n.setAttribute(`title`,t.title),t.icon&&n.setAttribute(`icon-name`,t.icon),n.setAttribute(`use-underline`,``),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.textContent=t.body,n.appendChild(r),e.appendChild(n)}let t=document.createElement(`gtk-stack-switcher`);t.setAttribute(`stack`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;height:320px;`,n.append(t,e),this.addContent(n),this._switcher=t,this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._switcher)return;this._switcher.setAttribute(`orientation`,this.args.orientation);let e=document.getElementById(`stack-switcher-demo`);e&&e.setAttribute(`transition-type`,this.args.transitionType)}}]},ss=[{name:`overview`,title:`Overview`,attn:!1,body:`Three pages, one visible at a time.`},{name:`activity`,title:`Activity`,attn:!1,body:`Switching is animated by transition-type.`},{name:`settings`,title:`Settings`,attn:!0,body:`This page wants your attention.`}],cs={title:`View Switching/Stack`,description:"Gtk.Stack — one visible child out of many, with the animated change between them. `transition-type` picks the animation and `transition-duration` its length; `hhomogeneous` and `vhomogeneous` say whether every page is allocated the same size. A Gtk.StackPage is a GObject rather than a widget, so its title, icon and needs-attention live on the page itself.",controls:[{name:`transitionType`,label:`Transition type`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Crossfade`,value:`crossfade`},{label:`Slide left / right`,value:`slide-left-right`},{label:`Slide up / down`,value:`slide-up-down`},{label:`Over left / right`,value:`over-left-right`},{label:`Rotate left / right`,value:`rotate-left-right`}],defaultValue:`slide-left-right`},{name:`transitionDuration`,label:`Duration (ms)`,type:t.RANGE,min:0,max:600,step:50,defaultValue:200},{name:`interpolateSize`,label:`Interpolate size`,type:t.BOOLEAN,defaultValue:!1},{name:`hhomogeneous`,label:`HHomogeneous`,type:t.BOOLEAN,defaultValue:!0},{name:`vhomogeneous`,label:`VHomogeneous`,type:t.BOOLEAN,defaultValue:!0}]},ls={stories:[class StackWebStory extends StoryElement{_stack=null;constructor(){super(StackWebStory.getMetadata(),`Default`)}static getMetadata(){return cs}initialize(){let e=document.createElement(`gtk-stack`);e.style.flex=`1`;for(let t of ss){let n=document.createElement(`div`);n.setAttribute(`name`,t.name),n.setAttribute(`title`,t.title),n.setAttribute(`use-underline`,``),t.attn&&n.setAttribute(`needs-attention`,``),n.style.cssText=`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;`;let r=document.createElement(`div`);r.setAttribute(`data-gtk-stack-story`,`heading`),r.textContent=t.title;let i=document.createElement(`div`);i.setAttribute(`data-gtk-stack-story`,`body`),i.textContent=t.body,n.append(r,i),e.appendChild(n)}let t=document.createElement(`div`);t.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;height:320px;`,t.appendChild(e),this.addContent(t),this._stack=e,this._apply()}updateArgs(e){this._apply()}_apply(){this._stack&&(this._stack.setAttribute(`transition-type`,this.args.transitionType),this._stack.setAttribute(`transition-duration`,String(this.args.transitionDuration)),this._stack.toggleAttribute(`interpolate-size`,this.args.interpolateSize),this._stack.setAttribute(`hhomogeneous`,this.args.hhomogeneous?``:`false`),this._stack.setAttribute(`vhomogeneous`,this.args.vhomogeneous?``:`false`))}}]},us={title:`View Switching/Tab Bar`,description:"Adw.TabBar — the tab bar as a widget of its own, bound to an Adw.TabView through its `view`: one chip per page, an action widget on either side, and a strip that can autohide or expand its chips.",controls:[{name:`autohide`,label:`Autohide`,type:t.BOOLEAN,defaultValue:!1},{name:`expandTabs`,label:`Expand tabs`,type:t.BOOLEAN,defaultValue:!1},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1},{name:`startAction`,label:`Start action`,type:t.BOOLEAN,defaultValue:!0},{name:`endAction`,label:`End action`,type:t.BOOLEAN,defaultValue:!0}]},ds=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],fs={stories:[class TabBarWebStory extends StoryElement{_bar=null;_view=null;_startAction=null;_endAction=null;constructor(){super(TabBarWebStory.getMetadata(),`Default`)}static getMetadata(){return us}initialize(){let e=document.createElement(`adw-tab-view`);e.style.flex=`1`;for(let t of ds){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._view=e;let t=document.createElement(`adw-tab-bar`);t.setAttribute(`view`,`tab-bar-story-view`),e.id=`tab-bar-story-view`,this._bar=t,this._startAction=this._actionButton(`list-add-symbolic`,`New page`),this._startAction.slot=`start-action-widget`,t.appendChild(this._startAction),this._endAction=this._actionButton(`view-more-symbolic`,`Menu`),this._endAction.slot=`end-action-widget`,t.appendChild(this._endAction);let n=document.createElement(`div`);n.style.display=`flex`,n.style.flexDirection=`column`,n.style.width=`480px`,n.style.height=`320px`,n.append(t,e),this.addContent(n),this._apply()}updateArgs(e){this._apply()}_actionButton(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button flat image-button`,n.title=t;let r=document.createElement(`gtk-image`);return r.setAttribute(`icon`,e),n.appendChild(r),n}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_apply(){let e=this._bar,t=this._view;e===null||t===null||(e.autohide=this.args.autohide,e.expandTabs=this.args.expandTabs,e.inverted=this.args.inverted,e.view!==t&&(e.view=t),e.startActionWidget=this.args.startAction?this._startAction:null,e.endActionWidget=this.args.endAction?this._endAction:null)}}]},ps={title:`View Switching/Tab Button`,description:`Adw.TabButton — a button that shows how many pages an Adw.TabView holds, and a dot when a page you are not looking at needs attention. From ten pages the number shrinks; at a hundred it becomes a glyph.`,controls:[{name:`pages`,label:`Pages`,type:t.RANGE,min:0,max:100,step:1,defaultValue:3},{name:`needsAttention`,label:`Last page needs attention`,type:t.BOOLEAN,defaultValue:!1}]},ms={stories:[class TabButtonWebStory extends StoryElement{_view=null;_serial=0;constructor(){super(TabButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ps}initialize(){this._view=document.createElement(`adw-tab-view`),this._view.hidden=!0;let e=document.createElement(`adw-tab-button`),t=document.createElement(`div`);t.append(this._view,e),this.addContent(t),e.view=this._view,this._apply()}updateArgs(e){this._apply()}_apply(){let e=this._view;if(!e)return;let t=this.args.pages;for(;e.nPages<t;)this._serial+=1,e.appendPage({id:`page-${this._serial}`,title:`Page ${e.nPages}`});for(;e.nPages>t;)e.closePage(e.pages[e.nPages-1].id);let n=e.nPages-1;e.pages.forEach((t,r)=>{e.setPageNeedsAttention(t.id,this.args.needsAttention&&r===n)})}}]},hs={title:`View Switching/Tab Overview`,description:`Adw.TabOverview — a grid of tab thumbnails over an Adw.TabView; open it to see every page at once, search them and close or unpin them.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`enableSearch`,label:`Enable search`,type:t.BOOLEAN,defaultValue:!0},{name:`enableNewTab`,label:`Enable new tab`,type:t.BOOLEAN,defaultValue:!1},{name:`inverted`,label:`Inverted`,type:t.BOOLEAN,defaultValue:!1}]},gs=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],_s={stories:[class TabOverviewWebStory extends StoryElement{_overview=null;_view=null;constructor(){super(TabOverviewWebStory.getMetadata(),`Default`)}static getMetadata(){return hs}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let[t,n]of gs.entries()){let r=document.createElement(`adw-tab-page`);r.setAttribute(`title`,n.title),t===0&&r.setAttribute(`pinned`,``),r.appendChild(this._buildPageBody(n.title,n.body)),e.appendChild(r)}this._view=e;let t=document.createElement(`adw-tab-overview`);t.style.width=`480px`,t.style.height=`340px`,t.appendChild(e),t.addEventListener(`create-tab`,t=>{let n=e.appendPage({id:`new-${e.nPages}`,title:`New Page`,content:this._buildPageBody(`New Page`,`Just created.`)});t.detail.page=e.pages[n]}),this._overview=t,this.addContent(t),this._apply()}updateArgs(e){this._apply()}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),t!==``&&n.setAttribute(`description`,t),n}_apply(){let e=this._overview;e!==null&&(e.enableSearch=this.args.enableSearch,e.enableNewTab=this.args.enableNewTab,e.inverted=this.args.inverted,e.setOpen(this.args.open))}}]},vs=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`,sectionTitle:`Mail`,badgeNumber:3},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`drafts`,title:`Drafts`,icon:`document-edit-symbolic`},{name:`sent`,title:`Sent`,icon:`mail-send-symbolic`,sectionTitle:`Older`,needsAttention:!0},{name:`archive`,title:`Archive`,icon:`folder-symbolic`},{name:`trash`,title:`Trash`,icon:`user-trash-symbolic`}],ys={title:`View Switching/View Switcher Sidebar`,description:"Adw.ViewSwitcherSidebar — an Adw.Sidebar driven by an Adw.ViewStack, which is the one Adw switcher whose rows can be grouped into sections and carry an unread dot or a badge. `page` collapses it into a page of boxed lists.",controls:[{name:`mode`,label:`Page mode`,type:t.BOOLEAN,defaultValue:!1}]},bs={stories:[class ViewSwitcherSidebarWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return ys}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of vs){let n=document.createElement(`adw-view-stack-page`);n.setAttribute(`name`,t.name),n.setAttribute(`title`,t.title),n.setAttribute(`icon-name`,t.icon),t.sectionTitle&&(n.setAttribute(`starts-section`,``),n.setAttribute(`section-title`,t.sectionTitle)),t.badgeNumber&&n.setAttribute(`badge-number`,String(t.badgeNumber)),t.needsAttention&&n.setAttribute(`needs-attention`,``),n.appendChild(this._buildContent(t.icon,t.title)),e.appendChild(n)}let t=document.createElement(`adw-view-switcher-sidebar`);t.style.width=`200px`,this._switcher=t;let n=document.createElement(`div`);n.style.display=`flex`,n.style.flexDirection=`row`,n.style.width=`480px`,n.style.height=`340px`,n.append(t,e),this.addContent(n),this._apply()}updateArgs(e){this._apply()}_buildContent(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,e.replace(/-symbolic$/,``)),n.setAttribute(`title`,t),n}_apply(){let e=this._switcher;e!==null&&(e.mode=this.args.mode?`page`:`sidebar`)}}]},xs={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:t.BOOLEAN,defaultValue:!1}]},Ss=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],Cs={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return xs}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of Ss){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._tabView=e,this._applyAutohide(this.args.autohide),this.addContent(e)}updateArgs(e){this._tabView&&this._applyAutohide(this.args.autohide)}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_applyAutohide(e){this._tabView&&(e?this._tabView.setAttribute(`autohide`,``):this._tabView.removeAttribute(`autohide`))}}]},ws={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:t.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]},Ts=[{name:`inbox`,title:`Inbox`,icon:`mail-unread`,description:`You have three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred`,description:`Messages you have marked as important.`},{name:`archive`,title:`Archive`,icon:`folder`,description:`Older conversations kept for reference.`}],Es={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return ws}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of Ts){let a=document.createElement(`adw-view-switcher-page`);a.setAttribute(`name`,t),a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`policy`,this.args.policy),e.style.width=`480px`,this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`policy`,this.args.policy)}}]},Ds=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],Os={title:`View Switching/View Switcher Bar`,description:"Adw.ViewSwitcherBar — the narrow-window switcher, pinned to the bottom of a toolbar view. `reveal` is a REQUEST, not a state: a stack with fewer than two pages stays collapsed however loudly it is asked.",controls:[{name:`reveal`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},ks={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Os}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of Ds){let n=document.createElement(`adw-status-page`);n.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),n.setAttribute(`title`,t.title),n.setAttribute(`description`,`The ${t.title.toLowerCase()} page.`);let r=document.createElement(`adw-view-stack-page`);r.setAttribute(`name`,t.name),r.setAttribute(`title`,t.title),r.setAttribute(`icon-name`,t.icon.replace(/-symbolic$/,``)),r.appendChild(n),e.appendChild(r)}let t=document.createElement(`adw-view-switcher-bar`);t.setAttribute(`slot`,`bottom`);let n=document.createElement(`adw-toolbar-view`);n.style.width=`360px`,n.style.height=`360px`,n.append(e,t),this.addContent(n),t.setStack(e),this._bar=t,this._apply()}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.reveal=this.args.reveal)}}]},As={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$1(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$1,`iconClass`);const js={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return As}_buildContent(){let e=document.createElement(`adw-bottom-sheet-content`),t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.width=`100%`,t.style.height=`100%`;let n=document.createElement(`gtk-button`);return n.textContent=`Toggle sheet`,n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._sheet&&this._sheet.toggleAttribute(`open`)}),t.append(n),e.append(t),e}_buildSheet(){let e=document.createElement(`adw-bottom-sheet-sheet`),t=document.createElement(`div`);t.style.display=`flex`,t.style.flexDirection=`column`,t.style.gap=`12px`,t.style.margin=`18px 18px 24px`;let n=document.createElement(`span`);n.textContent=`Share track`,n.style.fontSize=`15pt`,n.style.fontWeight=`800`,t.append(n);let r=document.createElement(`adw-preferences-group`);for(let[e,t]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=iconClass$1(t),n.append(i),r.append(n)}return t.append(r),e.append(t),e}initialize(){this._sheet=document.createElement(`adw-bottom-sheet`),this._sheet.style.width=`480px`,this._sheet.style.height=`340px`,this._sheet.append(this._buildContent(),this._buildSheet()),this._sync(),this.addContent(this._sheet)}updateArgs(e){this._sync()}_sync(){this._sheet&&(this._sheet.toggleAttribute(`open`,this.args.open),this._setBool(`modal`,this.args.modal),this._setBool(`can-close`,this.args.canClose))}_setBool(e,t){this._sheet&&(t?this._sheet.setAttribute(e,``):this._sheet.setAttribute(e,`false`))}}]},Ms={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]};function iconClass(e){return`gtk-image adw-icon--${e.replace(/-symbolic$/,``)}`}const Ns={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ms}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=document.createElement(`adw-action-row`);i.setAttribute(`title`,t),i.setAttribute(`subtitle`,n),i.setAttribute(`activatable`,``);let a=document.createElement(`span`);a.setAttribute(`slot`,`prefix`),a.className=iconClass(r),i.appendChild(a),e.appendChild(i)}let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Mailboxes`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`sidebar`),r.append(t,e),r}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`mail-unread-symbolic`),e.setAttribute(`title`,`All Mail`),e.setAttribute(`description`,`Select a conversation from the list to read it here.`);let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`All Mail`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`content`),r.append(t,e),r}initialize(){this._view=document.createElement(`adw-navigation-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.append(this.buildSidebar(),this.buildContent()),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-content`,this.args.showContent),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Ps={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:t.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:t.BOOLEAN,defaultValue:!0}]},Fs={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ps}initialize(){this._view=document.createElement(`adw-navigation-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._detailTitle=document.createElement(`adw-window-title`),this._detailTitle.setAttribute(`title`,this.args.detailTitle),this._detailTitle.setAttribute(`slot`,`center`),this._detailStatus=document.createElement(`adw-status-page`),this._detailStatus.setAttribute(`icon`,`avatar-default`),this._detailStatus.setAttribute(`title`,this.args.detailTitle),this._detailStatus.setAttribute(`description`,`Mathematician and writer, the first computer programmer.`);let e=document.createElement(`adw-header-bar`);e.setAttribute(`slot`,`top`),e.appendChild(this._detailTitle);let t=document.createElement(`adw-toolbar-view`);t.append(e,this._detailStatus),this._detailPage=document.createElement(`adw-navigation-page`),this._detailPage.setAttribute(`tag`,`detail`),this._detailPage.setAttribute(`title`,this.args.detailTitle),this._detailPage.appendChild(t),this._rootTitle=document.createElement(`adw-window-title`),this._rootTitle.setAttribute(`title`,this.args.rootTitle),this._rootTitle.setAttribute(`slot`,`center`);let n=document.createElement(`gtk-button`);n.setAttribute(`label`,`Open contact`),n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._view?.push(`detail`)});let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;`,r.appendChild(n);let i=document.createElement(`adw-header-bar`);i.setAttribute(`slot`,`top`),i.appendChild(this._rootTitle);let a=document.createElement(`adw-toolbar-view`);a.append(i,r);let o=document.createElement(`adw-navigation-page`);o.setAttribute(`tag`,`root`),o.setAttribute(`title`,this.args.rootTitle),o.appendChild(a),this._view.append(o,this._detailPage),this.addContent(this._view)}updateArgs(e){if(!this._view)return;this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._rootTitle?.setAttribute(`title`,this.args.rootTitle);let t=this.args.detailTitle;this._detailTitle?.setAttribute(`title`,t),this._detailStatus?.setAttribute(`title`,t),this._detailPage?.setAttribute(`title`,t)}}]},Is={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]},Ls=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],Rs={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Is}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Ls){let r=document.createElement(`adw-action-row`);r.setAttribute(`title`,t),r.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=`adw-icon adw-icon--${n}`,r.appendChild(i),e.appendChild(r)}let t=document.createElement(`adw-toolbar-view`);t.classList.add(`sidebar`);let n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`folder-music`),e.setAttribute(`title`,`Your Library`),e.setAttribute(`description`,`Toggle the sidebar to browse sections. Collapse it to overlay the content.`);let t=document.createElement(`adw-toolbar-view`),n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}initialize(){this._view=document.createElement(`adw-overlay-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`;let e=this.buildSidebar();e.setAttribute(`slot`,`sidebar`);let t=this.buildContent();t.setAttribute(`slot`,`content`),this._view.append(e,t),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-sidebar`,this.args.showSidebar),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},zs=[{label:`File`,submenu:[{label:`New Window`,accel:`<Control>N`},{label:`New Tab`,accel:`<Control><Shift>N`},{label:`Open…`,accel:`<Control>O`}]},{label:`Edit`,submenu:[{label:`Undo`,accel:`<Control>Z`},{label:`Redo`,accel:`<Control>Y`}]},{label:`View`,submenu:[{label:`Zoom In`,accel:`<Control>plus`},{label:`Zoom Out`}]},{label:`Help`,submenu:[{label:`Keyboard Shortcuts`},{label:`About`}]}],Bs={title:`Navigation/Popover Menu Bar`,description:`Gtk.PopoverMenuBar — a horizontal bar of items that pop up menus when clicked. Clicking an item OPENS its menu; hovering only SELECTS, and the item lights up (.active) exactly while its menu is up. Left and Right walk the bar and wrap.`,controls:[{name:`position`,label:`Menu position`,type:t.SELECT,options:[{label:`Below`,value:`bottom`},{label:`Above`,value:`top`}],defaultValue:`bottom`},{name:`showLast`,label:`Include Help`,type:t.BOOLEAN,defaultValue:!0}]},Vs={stories:[class PopoverMenuBarWebStory extends StoryElement{_bar;constructor(){super(PopoverMenuBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Bs}initialize(){this._bar=document.createElement(`gtk-popover-menu-bar`),this._apply(),this.addContent(this._bar)}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;let e=this.args.showLast===!1?zs.slice(0,3):zs;this._bar.setAttribute(`menu-model`,JSON.stringify(e));for(let e of this._bar.querySelectorAll(`gtk-popover-menu`))e.setAttribute(`position`,this.args.position)}}]},Hs={title:`Media/Image`,description:`Gtk.Image — a symbolic icon, drawn as a CSS-masked box in the surrounding text colour. It takes a NAME, not a file: a name the icon theme cannot resolve draws the missing-image glyph, which is exactly what GTK draws for it. That is why <gtk-picture> is a separate widget — an icon sized by the theme and an image fitted to a box are two different jobs.`,controls:[{name:`iconName`,label:`Icon name`,type:t.TEXT,defaultValue:`avatar-default-symbolic`},{name:`size`,label:`Size (px)`,type:t.RANGE,min:16,max:96,step:8,defaultValue:48},{name:`disabled`,label:`Disabled`,type:t.BOOLEAN,defaultValue:!1}]},Us={stories:[class ImageWebStory extends StoryElement{_image=null;constructor(){super(ImageWebStory.getMetadata(),`Default`)}static getMetadata(){return Hs}initialize(){this._image=document.createElement(`gtk-image`),this._apply(),this.addContent(this._image)}updateArgs(e){this._apply()}_apply(){this._image&&(this._image.setAttribute(`size`,String(this.args.size)),this._image.setAttribute(`icon-name`,this.args.iconName),this._image.toggleAttribute(`disabled`,this.args.disabled))}}]},Ws={title:`Media/Inscription`,description:`Gtk.Inscription — text laid out to a size in CHARACTERS and LINES rather than to a size in pixels. It is the widget for text whose extent should be the same everywhere, so it never measures its own content: min-chars/nat-chars and min-lines/nat-lines ARE its size request.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Inscription`},{name:`minChars`,label:`Min chars`,type:t.RANGE,min:0,max:40,step:1,defaultValue:3},{name:`natChars`,label:`Nat chars`,type:t.RANGE,min:0,max:40,step:1,defaultValue:0},{name:`minLines`,label:`Min lines`,type:t.RANGE,min:0,max:6,step:1,defaultValue:1},{name:`natLines`,label:`Nat lines`,type:t.RANGE,min:0,max:6,step:1,defaultValue:0},{name:`wrapMode`,label:`Wrap mode`,type:t.SELECT,options:[{label:`Word`,value:`word`},{label:`Char`,value:`char`},{label:`Word-char (default)`,value:`word-char`}],defaultValue:`word-char`},{name:`textOverflow`,label:`Text overflow`,type:t.SELECT,options:[{label:`Clip (default)`,value:`clip`},{label:`Ellipsize start`,value:`ellipsize-start`},{label:`Ellipsize middle`,value:`ellipsize-middle`},{label:`Ellipsize end`,value:`ellipsize-end`}],defaultValue:`clip`},{name:`xalign`,label:`X align`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:0},{name:`yalign`,label:`Y align`,type:t.RANGE,min:0,max:1,step:.05,defaultValue:.5}]},Gs={stories:[class InscriptionWebStory extends StoryElement{_inscription=null;_frame=null;constructor(){super(InscriptionWebStory.getMetadata(),`Default`)}static getMetadata(){return Ws}initialize(){this._frame=document.createElement(`div`),this._frame.style.cssText=`width:320px;height:160px;border:1px solid var(--separator-color);display:flex;align-items:stretch;justify-content:stretch;`,this._inscription=document.createElement(`gtk-inscription`),this._frame.appendChild(this._inscription),this._apply(),this.addContent(this._frame)}updateArgs(e){this._apply()}_apply(){this._inscription&&(this._inscription.setAttribute(`min-chars`,String(this.args.minChars)),this._inscription.setAttribute(`nat-chars`,String(this.args.natChars)),this._inscription.setAttribute(`min-lines`,String(this.args.minLines)),this._inscription.setAttribute(`nat-lines`,String(this.args.natLines)),this._inscription.setAttribute(`text`,this.args.text),this._inscription.setAttribute(`wrap-mode`,this.args.wrapMode),this._inscription.setAttribute(`text-overflow`,this.args.textOverflow),this._inscription.setAttribute(`xalign`,String(this.args.xalign)),this._inscription.setAttribute(`yalign`,String(this.args.yalign)))}}]},Ks={title:`Media/Media Controls`,description:"Gtk.MediaControls — the transport bar: play, position, duration, volume. It owns no playback at all (its one property is an object, `media-stream`), and the bar is INSENSITIVE until a stream is attached. Note which label shows what: the position label shows the elapsed time and the one beside it shows what REMAINS, negatively.",controls:[{name:`sensitive`,label:`Sensitive`,type:t.BOOLEAN,defaultValue:!0}]},qs={stories:[class MediaControlsWebStory extends StoryElement{_video=null;_controls=null;_media=null;constructor(){super(MediaControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Ks}initialize(){this._video=document.createElement(`gtk-video`),this._controls=document.createElement(`gtk-media-controls`),this._media=document.createElement(`video`),this._media.muted=!0,this._video.append(this._media,this._controls),this._apply(),this.addContent(this._video)}updateArgs(e){this._apply()}_apply(){!this._video||!this._controls||(this._video.style.width=`360px`,this._video.style.height=`203px`,this._controls.style.display=`block`,this._controls.classList.toggle(`insensitive`,!this.args.sensitive),this._controls.volume=1)}}]},Js={title:`Media/Picture`,description:"Gtk.Picture — an image fitted to the box it is given, not sized by itself. `content-fit` picks one of the four fit modes (contain, cover, fill, scale-down), `can-shrink` decides whether it may be smaller than its content, and `alternative-text` is what a screen reader hears.",controls:[{name:`contentFit`,label:`Content fit`,type:t.SELECT,options:[{label:`Contain`,value:`contain`},{label:`Cover`,value:`cover`},{label:`Fill`,value:`fill`},{label:`Scale down`,value:`scale-down`}],defaultValue:`contain`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!0},{name:`alternativeText`,label:`Alternative text`,type:t.TEXT,defaultValue:`A tangerine`},{name:`isolateContents`,label:`Isolate contents`,type:t.BOOLEAN,defaultValue:!0},{name:`keepAspectRatio`,label:`Keep aspect ratio (deprecated)`,type:t.BOOLEAN,defaultValue:!0},{name:`width`,label:`Width (px)`,type:t.RANGE,min:64,max:320,step:16,defaultValue:240}]},Ys={stories:[class PictureWebStory extends StoryElement{_picture=null;constructor(){super(PictureWebStory.getMetadata(),`Default`)}static getMetadata(){return Js}initialize(){this._picture=document.createElement(`gtk-picture`);let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`viewBox`,`0 0 320 180`),e.setAttribute(`width`,`320`),e.setAttribute(`height`,`180`),e.innerHTML=`<rect width="320" height="90" fill="rgb(48 64 160)"/><rect y="90" width="320" height="90" fill="rgb(144 192 160)"/>`,this._picture.appendChild(e),this._apply(),this.addContent(this._picture)}updateArgs(e){this._apply()}_apply(){if(!this._picture)return;let e=String(this.args.width);this._picture.style.width=`${e}px`,this._picture.style.height=`${Math.round(Number(e)*2/3)}px`,this.args.keepAspectRatio&&this._picture.toggleAttribute(`keep-aspect-ratio`,!0),this._picture.setAttribute(`content-fit`,this.args.contentFit),this._picture.setAttribute(`can-shrink`,String(this.args.canShrink)),this._picture.setAttribute(`isolate-contents`,String(this.args.isolateContents)),this._picture.setAttribute(`alternative-text`,this.args.alternativeText)}}]},Xs={title:`Media/Video`,description:`Gtk.Video — a play surface with an overlay icon and a controls bar that hides itself three seconds after you stop moving the pointer. The overlay icon is a four-way choice — no stream, error, ended, or ready — and it is only VISIBLE while the video is stopped; there is no pause glyph over the frames.`,controls:[{name:`autoplay`,label:`Autoplay`,type:t.BOOLEAN,defaultValue:!1},{name:`loop`,label:`Loop`,type:t.BOOLEAN,defaultValue:!0},{name:`graphicsOffload`,label:`Graphics offload`,type:t.BOOLEAN,defaultValue:!1},{name:`width`,label:`Width (px)`,type:t.RANGE,min:160,max:480,step:40,defaultValue:320}]},Zs={stories:[class VideoWebStory extends StoryElement{_video=null;_media=null;constructor(){super(VideoWebStory.getMetadata(),`Default`)}static getMetadata(){return Xs}initialize(){this._video=document.createElement(`gtk-video`),this._media=document.createElement(`video`),this._media.muted=!0,this._video.appendChild(this._media),this._apply(),this.addContent(this._video)}updateArgs(e){this._apply()}_apply(){if(!this._video)return;let e=String(this.args.width);this._video.style.width=`${e}px`,this._video.style.height=`${Math.round(Number(e)*9/16)}px`,this._video.toggleAttribute(`autoplay`,this.args.autoplay),this._video.toggleAttribute(`loop`,this.args.loop),this._video.toggleAttribute(`graphics-offload`,this.args.graphicsOffload),this._video.revealControls()}}]},Qs={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:t.NUMBER,min:0,max:3,step:1,defaultValue:0}]},$s={stories:[class SidebarWebStory extends StoryElement{_sidebar=null;_status=null;items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];constructor(){super(SidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Qs}initialize(){let e=document.createElement(`adw-sidebar-section`);e.setAttribute(`title`,`Mailboxes`);for(let t of this.items){let n=document.createElement(`adw-sidebar-item`);n.setAttribute(`title`,t.title),n.setAttribute(`subtitle`,t.subtitle),n.setAttribute(`icon-name`,t.icon),e.append(n)}this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._sidebar.style.width=`220px`,this._sidebar.append(e),this._sidebar.addEventListener(`notify::selected`,()=>this._syncContent()),this._status=document.createElement(`adw-status-page`),this._status.style.flex=`1 1 auto`;let t=document.createElement(`div`);t.style.display=`flex`,t.style.width=`480px`,t.style.height=`340px`,t.style.border=`1px solid var(--card-shade-color)`,t.style.borderRadius=`var(--card-radius, 12px)`,t.style.overflow=`hidden`;let n=document.createElement(`div`);n.style.width=`1px`,n.style.alignSelf=`stretch`,n.style.backgroundColor=`var(--separator-color, var(--card-shade-color))`,t.append(this._sidebar,n,this._status),this._syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._syncContent())}_syncContent(){if(!this._sidebar||!this._status)return;let e=Number(this._sidebar.selected),t=this.items[e]??this.items[0];this._status.setAttribute(`title`,t.title),this._status.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),this._status.setAttribute(`description`,t.subtitle)}}]},ec={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:t.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`0.11.0`}]},tc={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return ec}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`gtk-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this._dialog=document.createElement(`adw-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){if(!this._dialog)return;let e=this._dialog;e.setAttribute(`application-name`,this.args.applicationName??`Adwaita Storybook`),e.setAttribute(`application-icon`,`application-x-executable`),e.setAttribute(`developer-name`,`A GJSify Project`),e.setAttribute(`version`,this.args.version??`0.11.0`),e.setAttribute(`comments`,`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`),e.setAttribute(`website`,`https://github.com/gjsify/gjsify`),e.setAttribute(`issue-url`,`https://github.com/gjsify/gjsify/issues`),e.setAttribute(`license`,`The MIT License (MIT)`),e.setAttribute(`license-url`,`https://opensource.org/licenses/mit-license.php`),e.setAttribute(`copyright`,`© 2026 The GJSify Project`),e.developers=[`Ada Lovelace`,`Grace Hopper`],e.designers=[`Margaret Hamilton`],e.present()}updateArgs(e){}teardown(){this._dialog&&this._dialog.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},nc={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:t.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:t.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]},rc={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return nc}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-alert-dialog`);e.setAttribute(`heading`,this.args.heading),e.setAttribute(`body`,this.args.body),document.body.appendChild(e),e.addResponse(`cancel`,`Cancel`),e.addResponse(`delete`,`Delete`),e.setResponseAppearance(`delete`,`destructive`),e.setDefaultResponse(`cancel`),e.setCloseResponse(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},ic={title:`Feedback/Dialog`,description:`Adw.Dialog — the generic dialog: arbitrary content over a scrim, anchored as a floating card on a wide window and as a bottom sheet on a narrow one.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Preferences`},{name:`presentation`,label:`Presentation`,type:t.SELECT,options:[{label:`Auto`,value:`auto`},{label:`Floating`,value:`floating`},{label:`Bottom sheet`,value:`bottom-sheet`}],defaultValue:`auto`}]},ac={stories:[class DialogWebStory extends StoryElement{constructor(){super(DialogWebStory.getMetadata(),`Default`)}static getMetadata(){return ic}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-dialog`);e.setAttribute(`title`,this.args.title),e.setAttribute(`presentation-mode`,this.args.presentation);let t=document.createElement(`adw-preferences-group`);t.setAttribute(`title`,`Appearance`);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Dark style`),n.setAttribute(`subtitle`,`Use a dark colour scheme`),n.setAttribute(`active`,``),t.appendChild(n);let r=document.createElement(`adw-preferences-page`);r.setAttribute(`title`,`General`),r.appendChild(t),e.appendChild(r),e.present(),e.addEventListener(`closed`,()=>e.remove(),{once:!0})}updateArgs(e){}}]},oc={title:`Feedback/Emoji Chooser`,description:`Gtk.EmojiChooser — the popover a text widget opens to insert an emoji: a search entry over nine named sections, a toolbar that follows the scroll position, and an emoji-picked signal.`,controls:[{name:`search`,label:`Search`,type:t.TEXT,defaultValue:`smile`}]};function searchEntryOf(e){return e.querySelector(`.emoji-search-entry`)}const sc={stories:[class EmojiChooserWebStory extends StoryElement{_entry=null;_button=null;_chooser=null;constructor(){super(EmojiChooserWebStory.getMetadata(),`Default`)}static getMetadata(){return oc}initialize(){let e=document.createElement(`div`);e.className=`sb-emoji-row`,this._entry=document.createElement(`input`),this._entry.className=`sb-emoji-entry`,this._entry.type=`text`,this._entry.placeholder=`Type a message…`,e.appendChild(this._entry);let t=document.createElement(`div`);t.className=`sb-emoji-anchor`,this._button=document.createElement(`button`),this._button.className=`adw-button flat circular`,this._button.setAttribute(`aria-label`,`Insert an emoji`);let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,`face-smile`),this._button.appendChild(n),this._button.addEventListener(`click`,()=>{this._chooser?.popup(),searchEntryOf(this._chooser)?.focus()}),t.appendChild(this._button),e.appendChild(t),this._chooser=document.createElement(`gtk-emoji-chooser`),this._chooser.setAttribute(`position`,`bottom`),this._chooser.setAttribute(`align`,`end`),this._chooser.anchor=this._button,this._chooser.addEventListener(`emoji-picked`,e=>{let{text:t}=e.detail;this._entry!==null&&(this._entry.value+=t)}),t.appendChild(this._chooser),this.addContent(e),this._applySearch(this.args.search),this._chooser.popup()}_applySearch(e){let t=this._chooser===null?null:searchEntryOf(this._chooser);t!==null&&(t.value=e,t.dispatchEvent(new Event(`input`,{bubbles:!0})))}updateArgs(e){typeof e.search==`string`&&this._applySearch(e.search)}teardown(){this._chooser?.popdown(),this._chooser=null,this._entry=null,this._button=null}}]},cc={title:`Feedback/GTK About Dialog`,description:`Gtk.AboutDialog — GTK's own about window: a dialog-size logo over the program name, with the Credits, License and System pages behind a stack switcher. NOT Adw.AboutDialog, which is a navigation view of preference rows.`,controls:[{name:`programName`,label:`Program name`,type:t.TEXT,defaultValue:`Calculator`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`48.1`},{name:`licenseType`,label:`License type`,type:t.SELECT,options:[{label:`Unknown`,value:`unknown`},{label:`Custom`,value:`custom`},{label:`GPL 3.0`,value:`gpl-3-0`},{label:`MIT`,value:`mit-x11`},{label:`BSD 3-Clause`,value:`bsd-3`},{label:`Apache 2.0`,value:`apache-2-0`},{label:`0BSD`,value:`0bsd`}],defaultValue:`gpl-3-0`},{name:`withCredits`,label:`With credits`,type:t.BOOLEAN,defaultValue:!0}]},lc={stories:[class GtkAboutDialogWebStory extends StoryElement{_dialog=null;_button=null;constructor(){super(GtkAboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return cc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`,this._button=document.createElement(`button`),this._button.textContent=`Show dialog`,this._button.setAttribute(`pill`,``),this._button.setAttribute(`suggested`,``),this._button.addEventListener(`click`,()=>this._present()),e.appendChild(this._button),this._dialog=document.createElement(`gtk-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;if(e===null)return;e.setAttribute(`program-name`,this.args.programName??`Calculator`),e.setAttribute(`version`,this.args.version??`48.1`),e.setAttribute(`logo-icon-name`,`application-x-executable`),e.setAttribute(`comments`,`An arithmetic calculator for the GNOME desktop.`),e.setAttribute(`website`,`https://gitlab.gnome.org/World/gnome-calculator`),e.setAttribute(`website-label`,`GNOME Calculator`),e.setAttribute(`copyright`,`© 2026 The GNOME Project`),e.setAttribute(`system-information`,`GTK 4.24.0
10788
10890
  glibc 2.42
10789
10891
  Built with meson 1.6`);let t=this.args.licenseType??`gpl-3-0`;t===`custom`?e.setAttribute(`license`,`Permission is hereby granted, free of charge, to any person obtaining a copy…`):e.removeAttribute(`license`),e.licenseType=t,e.authors=[],e.documenters=[],e.artists=[],e.removeAttribute(`translator-credits`),this.args.withCredits&&(e.authors=[`Ada Lovelace <ada@example.org>`,`Grace Hopper`],e.documenters=[`Barbara Liskov`],e.artists=[`Margaret Hamilton`],e.translatorCredits=`Alan Turing
10790
- Katherine Johnson`,e.addCreditSection(`Reviewed by`,[`Tony Hoare <tony@example.org>`])),e.present()}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null,this._button=null}}]},lc={title:`Feedback/Page Setup Dialog`,description:`Gtk.PageSetupUnixDialog — the page setup dialog Unix platforms have instead of a native one: a printer and a paper size, the chosen sheet's size and margins, and four orientation buttons.`,controls:[{name:`paperSize`,label:`Paper size`,type:t.SELECT,options:[{label:`US Letter`,value:`na_letter`},{label:`US Legal`,value:`na_legal`},{label:`A4`,value:`iso_a4`},{label:`A5`,value:`iso_a5`},{label:`B5`,value:`iso_b5`},{label:`A3`,value:`iso_a3`}],defaultValue:`iso_a4`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Portrait`,value:`portrait`},{label:`Landscape`,value:`landscape`},{label:`Reverse portrait`,value:`reverse-portrait`},{label:`Reverse landscape`,value:`reverse-landscape`}],defaultValue:`landscape`}]},$=.25*25.4;function marginsFor(e){return{top:$,bottom:e===`na_letter`||e===`na_legal`||e===`iso_a4`?14.224:$,left:$,right:$}}const uc={stories:[class PageSetupUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PageSetupUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return lc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`button`);t.textContent=`Page Setup…`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.appendChild(t),this._dialog=document.createElement(`gtk-page-setup-unix-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;if(e===null)return;let t=this.args.paperSize??`iso_a4`;e.pageSetup={paperSize:t,orientation:this.args.orientation??`portrait`,margins:marginsFor(t)},e.present()}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},dc={title:`Feedback/Print Dialog`,description:`Gtk.PrintUnixDialog — the Unix print dialog: seven notebook pages over a printer list, a Range and a Copies group on General, the sheet preview on Page Setup, and the Preview / Cancel / Print action area.`,controls:[{name:`capabilities`,label:`Capabilities`,type:t.TEXT,defaultValue:`copies|collate|reverse|scale|preview|page-set`},{name:`range`,label:`Range`,type:t.SELECT,options:[{label:`All Pages`,value:`all`},{label:`Current Page`,value:`current`},{label:`Selection`,value:`selection`},{label:`Pages`,value:`pages`}],defaultValue:`all`},{name:`copies`,label:`Copies`,type:t.NUMBER,defaultValue:2}]},fc=[{name:`Office Laser`,location:`Building A, floor 2`,acceptsJobs:!0},{name:`Lobby Printer`,location:`Building A, ground floor`,acceptsJobs:!1}],pc={top:6.35,bottom:14.224,left:6.35,right:6.35},mc={stories:[class PrintUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PrintUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return dc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`button`);t.textContent=`Print…`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.appendChild(t),this._dialog=document.createElement(`gtk-print-unix-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;e!==null&&(e.manualCapabilities=String(this.args.capabilities??``).split(`|`).map(e=>e.trim()).filter(e=>e.length>0),e.currentPage=2,e.range=this.args.range??`all`,e.supportSelection=!0,e.hasSelection=!0,e.embedPageSetup=!0,e.pageSetup={paperSize:`iso_a4`,orientation:`portrait`,margins:pc},e.printSettings={copies:String(this.args.copies??1),collate:`0`,reverse:`0`},e.printers=fc,e.present())}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},hc={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:t.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:t.TEXT,defaultValue:`Appearance`}]},gc={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return hc}_buildDialog(){let e=document.createElement(`adw-preferences-dialog`);e.setAttribute(`title`,`Preferences`);let t=document.createElement(`adw-preferences-page`);t.setAttribute(`title`,this.args.pageTitle??`General`),t.setAttribute(`icon-name`,`preferences-system-symbolic`);let n=document.createElement(`adw-preferences-group`);n.setAttribute(`title`,this.args.groupTitle??`Appearance`),n.setAttribute(`description`,`Control how the application looks and behaves.`);let r=document.createElement(`adw-switch-row`);r.setAttribute(`title`,`Dark style`),r.setAttribute(`subtitle`,`Use a dark colour scheme`),r.setAttribute(`active`,``),n.append(r);let i=document.createElement(`adw-combo-row`);i.setAttribute(`title`,`Accent colour`),i.setAttribute(`model`,JSON.stringify([`Blue`,`Teal`,`Green`,`Orange`,`Purple`])),i.setAttribute(`selected`,`0`),n.append(i);let a=document.createElement(`adw-spin-row`);return a.setAttribute(`title`,`Font size`),a.setAttribute(`min`,`8`),a.setAttribute(`max`,`24`),a.setAttribute(`step`,`1`),a.setAttribute(`value`,`12`),n.append(a),t.append(n),e.append(t),e}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`,e.style.minHeight=`200px`;let t=document.createElement(`gtk-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this.addContent(e)}_present(){this._dialog&&this._dialog.remove(),this._dialog=this._buildDialog(),this._dialog.addEventListener(`closed`,()=>{this._dialog?.remove(),this._dialog=null}),document.body.appendChild(this._dialog),requestAnimationFrame(()=>this._dialog?.setAttribute(`open`,``))}updateArgs(e){}teardown(){this._dialog?.remove(),this._dialog=null}}]},_c={title:`Feedback/Shortcuts Dialog`,description:`Adw.ShortcutsDialog — the window that lists an application’s keyboard shortcuts, one titled section at a time.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Keyboard Shortcuts`}]};function item(e,t={}){let n=document.createElement(`adw-shortcuts-item`);n.setAttribute(`title`,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function section(e,t){let n=document.createElement(`adw-shortcuts-section`);return e!==null&&n.setAttribute(`title`,e),n.append(...t),n}const vc={stories:[class ShortcutsDialogWebStory extends StoryElement{constructor(){super(ShortcutsDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return _c}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-shortcuts-dialog`);e.setAttribute(`title`,this.args.title),e.append(section(`General`,[item(`Open Menu`,{accelerator:`F10`}),item(`Preferences`,{"action-name":`app.preferences`}),item(`Quit`,{accelerator:`<Control>q`})]),section(null,[item(`Move Tab Left`,{accelerator:`<Shift><Control>Page_Up`,direction:`ltr`}),item(`Move Tab Left`,{accelerator:`<Shift><Control>Page_Up`,direction:`rtl`})])),e.present(),e.addEventListener(`closed`,()=>e.remove(),{once:!0})}updateArgs(e){}}]},yc={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:t.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:t.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:t.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Undo`}]},bc={stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return yc}initialize(){this._overlay=document.createElement(`adw-toast-overlay`),this._overlay.style.width=`360px`,this._overlay.style.height=`220px`;let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`;let t=document.createElement(`gtk-button`);t.textContent=`Show toast`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._showToast()),e.append(t),this._overlay.append(e),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=this.args.hasButton;this._overlay.addToast(this.args.title,{timeout:this.args.timeout,buttonLabel:e?this.args.buttonLabel:void 0})}updateArgs(e){}}]},xc={title:`Windows/Action Bar`,description:"Gtk.ActionBar — GTK's bottom bar, and the one libadwaita styles but does not own (`actionbar > revealer > box`). `start` appends and `end` PREPENDS, so the first end child sits nearest the edge; `center` is a real placement with no property behind it, because GtkBuilder refuses `center-widget`; and `revealed` slides the whole bar away.",controls:[{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`center`,label:`Centre`,type:t.SELECT,options:[{label:`A label`,value:`label`},{label:`Nothing`,value:`none`}],defaultValue:`label`}]},Sc={stories:[class ActionBarWebStory extends StoryElement{_bar=null;constructor(){super(ActionBarWebStory.getMetadata(),`Default`)}static getMetadata(){return xc}initialize(){this._bar=document.createElement(`gtk-action-bar`);for(let[e,t]of[[`end`,`document-save-symbolic`],[`end`,`document-open-symbolic`],[`start`,`document-print-symbolic`]]){let n=document.createElement(`gtk-button`);n.setAttribute(`slot`,e),n.setAttribute(`icon-name`,t),n.setAttribute(`flat`,``),this._bar.appendChild(n)}let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`8px`,e.style.width=`420px`;let t=document.createElement(`span`);t.textContent=`The bar below is Gtk.ActionBar.`,e.append(t,this._bar),this.addContent(e),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;this._bar.setAttribute(`revealed`,String(this.args.revealed));let e=this._bar.querySelector(`[slot="center"]`);if(this.args.center===`label`&&e===null){let e=document.createElement(`span`);e.setAttribute(`slot`,`center`),e.textContent=`notes.md`,this._bar.appendChild(e)}e?.remove()}}]},Cc={title:`Windows/Application Window`,description:"Gtk.ApplicationWindow — a Gtk.Window that also handles an application menubar. The bar shows only when `show-menubar` is set AND the application HAS one: GTK builds it from the GtkApplication's menu model, and reads the item count before deciding (gtkapplicationwindow.c:400-402). Everything else about the window is the base class.",controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Editor`},{name:`showMenubar`,label:`Show menubar`,type:t.BOOLEAN,defaultValue:!0},{name:`hasMenubar`,label:`The application has one`,type:t.BOOLEAN,defaultValue:!0},{name:`deletable`,label:`Deletable`,type:t.BOOLEAN,defaultValue:!0}]},wc={stories:[class GtkApplicationWindowWebStory extends StoryElement{_window=null;_menubar=null;constructor(){super(GtkApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Cc}initialize(){this._window=document.createElement(`gtk-application-window`),this._window.setAttribute(`default-width`,`460`),this._window.setAttribute(`default-height`,`260`);let e=document.createElement(`gtk-header-bar`);e.setAttribute(`slot`,`titlebar`),this._window.appendChild(e);let t=document.createElement(`span`);t.textContent=`The bar above the content is the application menubar.`,this._window.appendChild(t),this._menubar=document.createElement(`div`);for(let e of[`File`,`Edit`]){let t=document.createElement(`gtk-button`);t.setAttribute(`label`,e),t.setAttribute(`flat`,``),this._menubar.appendChild(t)}this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._window)return;this._window.setAttribute(`title`,this.args.title),this._window.setAttribute(`deletable`,String(this.args.deletable)),this._window.setAttribute(`show-menubar`,String(this.args.showMenubar));let e=this._window.querySelector(`.adw-gtk-application-window-menubar`)?.childElementCount??0;this.args.hasMenubar?e===0&&this._window.appendChild(this._menubar):e>0&&this._menubar.remove()}}]},Tc={title:`Windows/Header Bar`,description:"Gtk.HeaderBar — the titlebar widget: children packed at the start and at the end, the window title in the middle, and the window-frame buttons GTK would otherwise ask the window manager for. `end` PREPENDS, so the first end child sits nearest the edge; a `title` child takes the middle away from the derived title label; and `show-title-buttons` CREATES and REMOVES the two control groups rather than hiding them.",controls:[{name:`titleWidget`,label:`Title widget`,type:t.SELECT,options:[{label:`The window title`,value:`none`},{label:`A custom centre widget`,value:`custom`}],defaultValue:`none`},{name:`showTitleButtons`,label:`Title buttons`,type:t.BOOLEAN,defaultValue:!0},{name:`decorationLayout`,label:`Decoration layout`,type:t.SELECT,options:[{label:`GNOME (menu:minimize,maximize,close)`,value:`menu:minimize,maximize,close`},{label:`Close only`,value:`:close`},{label:`macOS (icon:minimize,maximize)`,value:`icon:minimize,maximize`}],defaultValue:`menu:minimize,maximize,close`}]},Ec={stories:[class GtkHeaderBarWebStory extends StoryElement{_bar=null;_titleLabel=null;constructor(){super(GtkHeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Tc}initialize(){this._bar=document.createElement(`gtk-header-bar`);for(let[e,t]of[[`end`,`open-menu-symbolic`],[`end`,`system-search-symbolic`],[`start`,`go-previous-symbolic`]]){let n=document.createElement(`gtk-button`);n.setAttribute(`slot`,e),n.setAttribute(`icon-name`,t),n.setAttribute(`flat`,``),this._bar.appendChild(n)}this._titleLabel=document.createElement(`span`),this._titleLabel.setAttribute(`slot`,`title`),this._titleLabel.textContent=`Mailboxes`,this.addContent(this._bar),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;this._bar.setAttribute(`decoration-layout`,this.args.decorationLayout),this._bar.setAttribute(`show-title-buttons`,String(this.args.showTitleButtons));let e=this.args.titleWidget===`custom`,t=this._bar.querySelector(`[slot="title"]`)!==null;e&&!t&&this._bar.appendChild(this._titleLabel),!e&&t&&this._titleLabel.remove()}}]},Dc={title:`Windows/Window`,description:"Gtk.Window — a toplevel with a `titlebar` and a `child`, and the properties that decide what its frame shows: `decorated`, `deletable`, `resizable`, `maximized` and `hide-on-close`. The BROWSER replica of this one is an IN-PAGE FRAME, not a toplevel: a browser document has no window to map. The story therefore cancels `close-request`, which is what an application does when it wants to keep the window.",controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Documents`},{name:`decorated`,label:`Decorated`,type:t.BOOLEAN,defaultValue:!0},{name:`deletable`,label:`Deletable`,type:t.BOOLEAN,defaultValue:!0},{name:`resizable`,label:`Resizable`,type:t.BOOLEAN,defaultValue:!0},{name:`maximized`,label:`Maximized`,type:t.BOOLEAN,defaultValue:!1},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!1},{name:`hideOnClose`,label:`Hide on close`,type:t.BOOLEAN,defaultValue:!0}]},Oc={stories:[class GtkWindowWebStory extends StoryElement{_window=null;_bar=null;constructor(){super(GtkWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Dc}initialize(){this._window=document.createElement(`gtk-window`),this._window.setAttribute(`default-width`,`460`),this._window.setAttribute(`default-height`,`280`),this._bar=document.createElement(`gtk-header-bar`),this._bar.setAttribute(`slot`,`titlebar`),this._window.appendChild(this._bar);let e=document.createElement(`span`);e.textContent=`The frame above is a Gtk.HeaderBar.`,this._window.appendChild(e),this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){this._window&&(this._window.setAttribute(`title`,this.args.title),this._window.setAttribute(`decorated`,String(this.args.decorated)),this._window.setAttribute(`deletable`,String(this.args.deletable)),this._window.setAttribute(`resizable`,String(this.args.resizable)),this._window.setAttribute(`maximized`,String(this.args.maximized)),this._window.setAttribute(`modal`,String(this.args.modal)),this._window.setAttribute(`hide-on-close`,String(this.args.hideOnClose)))}}]},kc={title:`Windows/Window Controls`,description:"Gtk.WindowControls — one SIDE of the window frame controls, and the decision table behind them. The decoration layout is split on the first colon; each token of the selected half builds one button or none, because `icon` and `minimize` want a SOVEREIGN window, `maximize` wants a resizable one and `close` wants a deletable one. `empty` is the property that says none of them did.",controls:[{name:`side`,label:`Side`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`decorationLayout`,label:`Decoration layout`,type:t.SELECT,options:[{label:`GNOME (menu:minimize,maximize,close)`,value:`menu:minimize,maximize,close`},{label:`Windows (icon:minimize,maximize,close)`,value:`icon:minimize,maximize,close`},{label:`Close only`,value:`:close`},{label:`macOS (icon:minimize,maximize)`,value:`icon:minimize,maximize`}],defaultValue:`menu:minimize,maximize,close`},{name:`resizable`,label:`Resizable window`,type:t.BOOLEAN,defaultValue:!0},{name:`maximized`,label:`Maximized window`,type:t.BOOLEAN,defaultValue:!1},{name:`modal`,label:`Modal window`,type:t.BOOLEAN,defaultValue:!1}]},Ac=[dr,pr,hr,vr,xr,wr,Ar,Nr,Pr,Rr,Br,Hr,Kr,Xr,Qr,ti,ii,oi,ci,ui,pi,hi,_i,yi,Pi,Mi,Wi,Ji,Bi,Ki,ki,Xi,Hi,Ri,Ii,xi,Ci,Ti,Di,Xa,eo,ro,so,za,Va,Ua,Ga,Ja,fo,mo,_o,yo,xo,Qi,ea,na,ko,Do,wo,ia,oa,ca,ua,fa,ma,ya,xa,Da,Ta,Ca,Fa,ka,ja,La,Na,jo,No,Io,Ro,Vo,qo,Xo,cs,as,ns,$o,ds,ps,gs,ys,Ss,Ts,Os,As,Ms,Ps,Ls,Bs,Qs,Hs,Ws,Js,Xs,Ks,ec,nc,ic,oc,cc,uc,gc,mc,vc,bc,Ec,{stories:[class WindowControlsWebStory extends StoryElement{_window=null;_controls=null;constructor(){super(WindowControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return kc}initialize(){this._window=document.createElement(`gtk-window`),this._window.setAttribute(`title`,`Documents`),this._window.setAttribute(`default-width`,`420`),this._window.setAttribute(`default-height`,`220`);let e=document.createElement(`span`);e.textContent=`A Gtk.WindowControls outside a window draws nothing — that is GTK, not this port.`,this._window.appendChild(e),this._controls=document.createElement(`gtk-window-controls`),this._controls.setAttribute(`slot`,`titlebar`),this._window.appendChild(this._controls),this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){!this._window||!this._controls||(this._controls.setAttribute(`side`,this.args.side===`end`?`end`:`start`),this._controls.setAttribute(`decoration-layout`,this.args.decorationLayout),this._window.setAttribute(`resizable`,String(this.args.resizable)),this._window.setAttribute(`maximized`,String(this.args.maximized)),this._window.setAttribute(`modal`,String(this.args.modal)))}}]},Sc,Oc,wc,Jr];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:Ac});
10892
+ Katherine Johnson`,e.addCreditSection(`Reviewed by`,[`Tony Hoare <tony@example.org>`])),e.present()}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null,this._button=null}}]},uc={title:`Feedback/Page Setup Dialog`,description:`Gtk.PageSetupUnixDialog — the page setup dialog Unix platforms have instead of a native one: a printer and a paper size, the chosen sheet's size and margins, and four orientation buttons.`,controls:[{name:`paperSize`,label:`Paper size`,type:t.SELECT,options:[{label:`US Letter`,value:`na_letter`},{label:`US Legal`,value:`na_legal`},{label:`A4`,value:`iso_a4`},{label:`A5`,value:`iso_a5`},{label:`B5`,value:`iso_b5`},{label:`A3`,value:`iso_a3`}],defaultValue:`iso_a4`},{name:`orientation`,label:`Orientation`,type:t.SELECT,options:[{label:`Portrait`,value:`portrait`},{label:`Landscape`,value:`landscape`},{label:`Reverse portrait`,value:`reverse-portrait`},{label:`Reverse landscape`,value:`reverse-landscape`}],defaultValue:`landscape`}]},$=.25*25.4;function marginsFor(e){return{top:$,bottom:e===`na_letter`||e===`na_legal`||e===`iso_a4`?14.224:$,left:$,right:$}}const dc={stories:[class PageSetupUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PageSetupUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return uc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`button`);t.textContent=`Page Setup…`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.appendChild(t),this._dialog=document.createElement(`gtk-page-setup-unix-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;if(e===null)return;let t=this.args.paperSize??`iso_a4`;e.pageSetup={paperSize:t,orientation:this.args.orientation??`portrait`,margins:marginsFor(t)},e.present()}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},fc={title:`Feedback/Print Dialog`,description:`Gtk.PrintUnixDialog — the Unix print dialog: seven notebook pages over a printer list, a Range and a Copies group on General, the sheet preview on Page Setup, and the Preview / Cancel / Print action area.`,controls:[{name:`capabilities`,label:`Capabilities`,type:t.TEXT,defaultValue:`copies|collate|reverse|scale|preview|page-set`},{name:`range`,label:`Range`,type:t.SELECT,options:[{label:`All Pages`,value:`all`},{label:`Current Page`,value:`current`},{label:`Selection`,value:`selection`},{label:`Pages`,value:`pages`}],defaultValue:`all`},{name:`copies`,label:`Copies`,type:t.NUMBER,defaultValue:2}]},pc=[{name:`Office Laser`,location:`Building A, floor 2`,acceptsJobs:!0},{name:`Lobby Printer`,location:`Building A, ground floor`,acceptsJobs:!1}],mc={top:6.35,bottom:14.224,left:6.35,right:6.35},hc={stories:[class PrintUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PrintUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return fc}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`button`);t.textContent=`Print…`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.appendChild(t),this._dialog=document.createElement(`gtk-print-unix-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){let e=this._dialog;e!==null&&(e.manualCapabilities=String(this.args.capabilities??``).split(`|`).map(e=>e.trim()).filter(e=>e.length>0),e.currentPage=2,e.range=this.args.range??`all`,e.supportSelection=!0,e.hasSelection=!0,e.embedPageSetup=!0,e.pageSetup={paperSize:`iso_a4`,orientation:`portrait`,margins:mc},e.printSettings={copies:String(this.args.copies??1),collate:`0`,reverse:`0`},e.printers=pc,e.present())}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},gc={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:t.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:t.TEXT,defaultValue:`Appearance`}]},_c={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return gc}_buildDialog(){let e=document.createElement(`adw-preferences-dialog`);e.setAttribute(`title`,`Preferences`);let t=document.createElement(`adw-preferences-page`);t.setAttribute(`title`,this.args.pageTitle??`General`),t.setAttribute(`icon-name`,`preferences-system-symbolic`);let n=document.createElement(`adw-preferences-group`);n.setAttribute(`title`,this.args.groupTitle??`Appearance`),n.setAttribute(`description`,`Control how the application looks and behaves.`);let r=document.createElement(`adw-switch-row`);r.setAttribute(`title`,`Dark style`),r.setAttribute(`subtitle`,`Use a dark colour scheme`),r.setAttribute(`active`,``),n.append(r);let i=document.createElement(`adw-combo-row`);i.setAttribute(`title`,`Accent colour`),i.setAttribute(`model`,JSON.stringify([`Blue`,`Teal`,`Green`,`Orange`,`Purple`])),i.setAttribute(`selected`,`0`),n.append(i);let a=document.createElement(`adw-spin-row`);return a.setAttribute(`title`,`Font size`),a.setAttribute(`min`,`8`),a.setAttribute(`max`,`24`),a.setAttribute(`step`,`1`),a.setAttribute(`value`,`12`),n.append(a),t.append(n),e.append(t),e}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`,e.style.minHeight=`200px`;let t=document.createElement(`gtk-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this.addContent(e)}_present(){this._dialog&&this._dialog.remove(),this._dialog=this._buildDialog(),this._dialog.addEventListener(`closed`,()=>{this._dialog?.remove(),this._dialog=null}),document.body.appendChild(this._dialog),requestAnimationFrame(()=>this._dialog?.setAttribute(`open`,``))}updateArgs(e){}teardown(){this._dialog?.remove(),this._dialog=null}}]},vc={title:`Feedback/Shortcuts Dialog`,description:`Adw.ShortcutsDialog — the window that lists an application’s keyboard shortcuts, one titled section at a time.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Keyboard Shortcuts`}]};function item(e,t={}){let n=document.createElement(`adw-shortcuts-item`);n.setAttribute(`title`,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function section(e,t){let n=document.createElement(`adw-shortcuts-section`);return e!==null&&n.setAttribute(`title`,e),n.append(...t),n}const yc={stories:[class ShortcutsDialogWebStory extends StoryElement{constructor(){super(ShortcutsDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return vc}initialize(){let e=document.createElement(`gtk-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-shortcuts-dialog`);e.setAttribute(`title`,this.args.title),e.append(section(`General`,[item(`Open Menu`,{accelerator:`F10`}),item(`Preferences`,{"action-name":`app.preferences`}),item(`Quit`,{accelerator:`<Control>q`})]),section(null,[item(`Move Tab Left`,{accelerator:`<Shift><Control>Page_Up`,direction:`ltr`}),item(`Move Tab Left`,{accelerator:`<Shift><Control>Page_Up`,direction:`rtl`})])),e.present(),e.addEventListener(`closed`,()=>e.remove(),{once:!0})}updateArgs(e){}}]},bc={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:t.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:t.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:t.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Undo`}]},xc={stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return bc}initialize(){this._overlay=document.createElement(`adw-toast-overlay`),this._overlay.style.width=`360px`,this._overlay.style.height=`220px`;let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`;let t=document.createElement(`gtk-button`);t.textContent=`Show toast`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._showToast()),e.append(t),this._overlay.append(e),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=this.args.hasButton;this._overlay.addToast(this.args.title,{timeout:this.args.timeout,buttonLabel:e?this.args.buttonLabel:void 0})}updateArgs(e){}}]},Sc={title:`Windows/Action Bar`,description:"Gtk.ActionBar — GTK's bottom bar, and the one libadwaita styles but does not own (`actionbar > revealer > box`). `start` appends and `end` PREPENDS, so the first end child sits nearest the edge; `center` is a real placement with no property behind it, because GtkBuilder refuses `center-widget`; and `revealed` slides the whole bar away.",controls:[{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`center`,label:`Centre`,type:t.SELECT,options:[{label:`A label`,value:`label`},{label:`Nothing`,value:`none`}],defaultValue:`label`}]},Cc={stories:[class ActionBarWebStory extends StoryElement{_bar=null;constructor(){super(ActionBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Sc}initialize(){this._bar=document.createElement(`gtk-action-bar`);for(let[e,t]of[[`end`,`document-save-symbolic`],[`end`,`document-open-symbolic`],[`start`,`document-print-symbolic`]]){let n=document.createElement(`gtk-button`);n.setAttribute(`slot`,e),n.setAttribute(`icon-name`,t),n.setAttribute(`flat`,``),this._bar.appendChild(n)}let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.gap=`8px`,e.style.width=`420px`;let t=document.createElement(`span`);t.textContent=`The bar below is Gtk.ActionBar.`,e.append(t,this._bar),this.addContent(e),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;this._bar.setAttribute(`revealed`,String(this.args.revealed));let e=this._bar.querySelector(`[slot="center"]`);if(this.args.center===`label`&&e===null){let e=document.createElement(`span`);e.setAttribute(`slot`,`center`),e.textContent=`notes.md`,this._bar.appendChild(e)}e?.remove()}}]},wc={title:`Windows/Application Window`,description:"Gtk.ApplicationWindow — a Gtk.Window that also handles an application menubar. The bar shows only when `show-menubar` is set AND the application HAS one: GTK builds it from the GtkApplication's menu model, and reads the item count before deciding (gtkapplicationwindow.c:400-402). Everything else about the window is the base class.",controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Editor`},{name:`showMenubar`,label:`Show menubar`,type:t.BOOLEAN,defaultValue:!0},{name:`hasMenubar`,label:`The application has one`,type:t.BOOLEAN,defaultValue:!0},{name:`deletable`,label:`Deletable`,type:t.BOOLEAN,defaultValue:!0}]},Tc={stories:[class GtkApplicationWindowWebStory extends StoryElement{_window=null;_menubar=null;constructor(){super(GtkApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return wc}initialize(){this._window=document.createElement(`gtk-application-window`),this._window.setAttribute(`default-width`,`460`),this._window.setAttribute(`default-height`,`260`);let e=document.createElement(`gtk-header-bar`);e.setAttribute(`slot`,`titlebar`),this._window.appendChild(e);let t=document.createElement(`span`);t.textContent=`The bar above the content is the application menubar.`,this._window.appendChild(t),this._menubar=document.createElement(`div`);for(let e of[`File`,`Edit`]){let t=document.createElement(`gtk-button`);t.setAttribute(`label`,e),t.setAttribute(`flat`,``),this._menubar.appendChild(t)}this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._window)return;this._window.setAttribute(`title`,this.args.title),this._window.setAttribute(`deletable`,String(this.args.deletable)),this._window.setAttribute(`show-menubar`,String(this.args.showMenubar));let e=this._window.querySelector(`.adw-gtk-application-window-menubar`)?.childElementCount??0;this.args.hasMenubar?e===0&&this._window.appendChild(this._menubar):e>0&&this._menubar.remove()}}]},Ec={title:`Windows/Header Bar`,description:"Gtk.HeaderBar — the titlebar widget: children packed at the start and at the end, the window title in the middle, and the window-frame buttons GTK would otherwise ask the window manager for. `end` PREPENDS, so the first end child sits nearest the edge; a `title` child takes the middle away from the derived title label; and `show-title-buttons` CREATES and REMOVES the two control groups rather than hiding them.",controls:[{name:`titleWidget`,label:`Title widget`,type:t.SELECT,options:[{label:`The window title`,value:`none`},{label:`A custom centre widget`,value:`custom`}],defaultValue:`none`},{name:`showTitleButtons`,label:`Title buttons`,type:t.BOOLEAN,defaultValue:!0},{name:`decorationLayout`,label:`Decoration layout`,type:t.SELECT,options:[{label:`GNOME (menu:minimize,maximize,close)`,value:`menu:minimize,maximize,close`},{label:`Close only`,value:`:close`},{label:`macOS (icon:minimize,maximize)`,value:`icon:minimize,maximize`}],defaultValue:`menu:minimize,maximize,close`}]},Dc={stories:[class GtkHeaderBarWebStory extends StoryElement{_bar=null;_titleLabel=null;constructor(){super(GtkHeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ec}initialize(){this._bar=document.createElement(`gtk-header-bar`);for(let[e,t]of[[`end`,`open-menu-symbolic`],[`end`,`system-search-symbolic`],[`start`,`go-previous-symbolic`]]){let n=document.createElement(`gtk-button`);n.setAttribute(`slot`,e),n.setAttribute(`icon-name`,t),n.setAttribute(`flat`,``),this._bar.appendChild(n)}this._titleLabel=document.createElement(`span`),this._titleLabel.setAttribute(`slot`,`title`),this._titleLabel.textContent=`Mailboxes`,this.addContent(this._bar),this._apply()}updateArgs(e){this._apply()}_apply(){if(!this._bar)return;this._bar.setAttribute(`decoration-layout`,this.args.decorationLayout),this._bar.setAttribute(`show-title-buttons`,String(this.args.showTitleButtons));let e=this.args.titleWidget===`custom`,t=this._bar.querySelector(`[slot="title"]`)!==null;e&&!t&&this._bar.appendChild(this._titleLabel),!e&&t&&this._titleLabel.remove()}}]},Oc={title:`Windows/Window`,description:"Gtk.Window — a toplevel with a `titlebar` and a `child`, and the properties that decide what its frame shows: `decorated`, `deletable`, `resizable`, `maximized` and `hide-on-close`. The BROWSER replica of this one is an IN-PAGE FRAME, not a toplevel: a browser document has no window to map. The story therefore cancels `close-request`, which is what an application does when it wants to keep the window.",controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Documents`},{name:`decorated`,label:`Decorated`,type:t.BOOLEAN,defaultValue:!0},{name:`deletable`,label:`Deletable`,type:t.BOOLEAN,defaultValue:!0},{name:`resizable`,label:`Resizable`,type:t.BOOLEAN,defaultValue:!0},{name:`maximized`,label:`Maximized`,type:t.BOOLEAN,defaultValue:!1},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!1},{name:`hideOnClose`,label:`Hide on close`,type:t.BOOLEAN,defaultValue:!0}]},kc={stories:[class GtkWindowWebStory extends StoryElement{_window=null;_bar=null;constructor(){super(GtkWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Oc}initialize(){this._window=document.createElement(`gtk-window`),this._window.setAttribute(`default-width`,`460`),this._window.setAttribute(`default-height`,`280`),this._bar=document.createElement(`gtk-header-bar`),this._bar.setAttribute(`slot`,`titlebar`),this._window.appendChild(this._bar);let e=document.createElement(`span`);e.textContent=`The frame above is a Gtk.HeaderBar.`,this._window.appendChild(e),this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){this._window&&(this._window.setAttribute(`title`,this.args.title),this._window.setAttribute(`decorated`,String(this.args.decorated)),this._window.setAttribute(`deletable`,String(this.args.deletable)),this._window.setAttribute(`resizable`,String(this.args.resizable)),this._window.setAttribute(`maximized`,String(this.args.maximized)),this._window.setAttribute(`modal`,String(this.args.modal)),this._window.setAttribute(`hide-on-close`,String(this.args.hideOnClose)))}}]},Ac={title:`Windows/Window Controls`,description:"Gtk.WindowControls — one SIDE of the window frame controls, and the decision table behind them. The decoration layout is split on the first colon; each token of the selected half builds one button or none, because `icon` and `minimize` want a SOVEREIGN window, `maximize` wants a resizable one and `close` wants a deletable one. `empty` is the property that says none of them did.",controls:[{name:`side`,label:`Side`,type:t.SELECT,options:[{label:`Start`,value:`start`},{label:`End`,value:`end`}],defaultValue:`start`},{name:`decorationLayout`,label:`Decoration layout`,type:t.SELECT,options:[{label:`GNOME (menu:minimize,maximize,close)`,value:`menu:minimize,maximize,close`},{label:`Windows (icon:minimize,maximize,close)`,value:`icon:minimize,maximize,close`},{label:`Close only`,value:`:close`},{label:`macOS (icon:minimize,maximize)`,value:`icon:minimize,maximize`}],defaultValue:`menu:minimize,maximize,close`},{name:`resizable`,label:`Resizable window`,type:t.BOOLEAN,defaultValue:!0},{name:`maximized`,label:`Maximized window`,type:t.BOOLEAN,defaultValue:!1},{name:`modal`,label:`Modal window`,type:t.BOOLEAN,defaultValue:!1}]},jc=[fr,mr,gr,yr,Sr,Tr,jr,Pr,Fr,zr,Vr,Ur,qr,Zr,$r,ni,ai,si,li,di,mi,gi,vi,bi,Fi,Ni,Gi,Yi,Vi,qi,Ai,Zi,Ui,zi,Li,Si,wi,Ei,Oi,Za,to,io,co,Ba,Ha,Wa,Ka,Ya,po,ho,vo,bo,So,$i,ta,ra,Ao,Oo,To,aa,sa,la,da,pa,ha,ba,Sa,Oa,Ea,wa,Ia,Aa,Ma,Ra,Pa,Mo,Po,Lo,zo,Ho,Jo,Zo,ls,os,rs,es,fs,ms,_s,bs,Cs,Es,ks,js,Ns,Fs,Rs,Vs,$s,Us,Gs,Ys,Zs,qs,tc,rc,ac,sc,lc,dc,_c,hc,yc,xc,Dc,{stories:[class WindowControlsWebStory extends StoryElement{_window=null;_controls=null;constructor(){super(WindowControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Ac}initialize(){this._window=document.createElement(`gtk-window`),this._window.setAttribute(`title`,`Documents`),this._window.setAttribute(`default-width`,`420`),this._window.setAttribute(`default-height`,`220`);let e=document.createElement(`span`);e.textContent=`A Gtk.WindowControls outside a window draws nothing — that is GTK, not this port.`,this._window.appendChild(e),this._controls=document.createElement(`gtk-window-controls`),this._controls.setAttribute(`slot`,`titlebar`),this._window.appendChild(this._controls),this.addContent(this._window),this._apply()}updateArgs(e){this._apply()}_apply(){!this._window||!this._controls||(this._controls.setAttribute(`side`,this.args.side===`end`?`end`:`start`),this._controls.setAttribute(`decoration-layout`,this.args.decorationLayout),this._window.setAttribute(`resizable`,String(this.args.resizable)),this._window.setAttribute(`maximized`,String(this.args.maximized)),this._window.setAttribute(`modal`,String(this.args.modal)))}}]},Cc,kc,Tc,Yr];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:jc});