@gjsify/example-gtk-adwaita-storybook 0.56.0 → 0.58.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.
@@ -1,10 +1,84 @@
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`],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";
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}:{}}}var UnsupportedGObjectError=class extends Error{constructor(e,t){super(t),this.name=`UnsupportedGObjectError`,this.feature=e}};const ne=new WeakSet;function makeType(e){let t=Object.freeze({name:e});return ne.add(t),t}const re=makeType(`gchararray`),ie=makeType(`gboolean`),ae=makeType(`gint`),oe=makeType(`guint`),se=makeType(`gdouble`),ce=[re,ie,ae,oe,se],v={READABLE:1,WRITABLE:2,READWRITE:3,CONSTRUCT:4,CONSTRUCT_ONLY:8};var y=class ParamSpec{constructor(e,t,n,r,i,a,o,s){this.kind=e,this.name=t,this.nick=n,this.blurb=r,this.flags=i,this.defaultValue=a,this.minimum=o,this.maximum=s}static boolean(e,t,n,r,i){return new ParamSpec(`boolean`,e,t,n,r,i)}static string(e,t,n,r,i){return new ParamSpec(`string`,e,t,n,r,i)}static int(e,t,n,r,i,a,o){return new ParamSpec(`int`,e,t,n,r,o,i,a)}static uint(e,t,n,r,i,a,o){return new ParamSpec(`uint`,e,t,n,r,o,i,a)}static double(e,t,n,r,i,a,o){return new ParamSpec(`double`,e,t,n,r,o,i,a)}get_default_value(){return this.defaultValue}};const b={GTypeName:Symbol(`GType name`),GTypeFlags:Symbol(`GType flags`),interfaces:Symbol(`GType interfaces`),properties:Symbol(`GObject properties`),signals:Symbol(`GObject signals`),requires:Symbol(`GObject interface requires`),template:Symbol(`GTK widget template`),cssName:Symbol(`GTK widget CSS name`),children:Symbol(`GTK widget template children`),internalChildren:Symbol(`GTK widget template internal children`)},le={GTypeName:b.GTypeName,Template:b.template,InternalChildren:b.internalChildren,Properties:b.properties,Signals:b.signals,CssName:b.cssName},ue={Children:b.children,Implements:b.interfaces,Requires:b.requires,GTypeFlags:b.GTypeFlags},de=new WeakMap;function chainOf(e){let t=[];for(let n=e;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=de.get(n);e&&t.push(e)}return t}function chainOfInstance(e){return chainOf(e.constructor)}function typeNameOf(e,t){return t[0]?.typeName??e.constructor.name}function aliasesOf(e){return[e,e.replace(/-/g,`_`),e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]}function findProperty(e,t){for(let n of e)for(let e of n.properties)if(aliasesOf(e.name).includes(t))return e}function findSignal(e,t){for(let n of e)if(Object.prototype.hasOwnProperty.call(n.signals,t))return n.signals[t]}const fe=new WeakMap;let pe=0;function stateOf$2(e){let t=fe.get(e);return t||(t={values:new Map,handlers:new Map,connections:new Map,emissions:[]},fe.set(e,t)),t}__name(stateOf$2,`stateOf`);function parseSignal(e){let t=e.indexOf(`::`);return t===-1?{name:e}:{name:e.slice(0,t),detail:e.slice(t+2)}}function addHandler(e,t,n){let r=stateOf$2(e),i=++pe,a=r.handlers.get(t)??[];return a.push({id:i,handler:n}),r.handlers.set(t,a),r.connections.set(i,()=>{a.splice(a.findIndex(e=>e.id===i),1)}),i}function runHandlers(e,t,n){let r=stateOf$2(e),i={key:t,stopped:!1};r.emissions.push(i);try{for(let{id:a,handler:o}of(r.handlers.get(t)??[]).slice()){if(i.stopped)break;r.connections.has(a)&&o(e,...n)}}finally{r.emissions.pop()}}function stopEmissionByName(e,t){if(typeof e!=`object`||!e)throw TypeError(`GObject.signal_stop_emission_by_name: not a GObject instance`);let n=chainOfInstance(e),r=typeNameOf(e,n),{name:i,detail:a}=parseSignal(t),o;if(i===`notify`&&a!==void 0){let e=findProperty(n,a);e&&(o=`notify::${e.name}`)}else a===void 0&&findSignal(n,i)&&(o=i);if(o===void 0){if(!n[0])throw new UnsupportedGObjectError(`signal_stop_emission_by_name`,`'${t}' on '${r}' is not a signal of a registered class; only those can be stopped.`);console.warn(`signal '${t}' is invalid for instance of type '${r}'`);return}let s=stateOf$2(e).emissions;for(let e=s.length-1;e>=0;e--){let t=s[e];if(t.key===o&&!t.stopped){t.stopped=!0;return}}console.warn(`no emission of signal "${t}" to stop for instance of type '${r}'`)}function connectInstance(e,t,n){let r=chainOfInstance(e),i=typeNameOf(e,r),{name:a,detail:o}=parseSignal(t),foreign=()=>{let a=r[0]?.door;if(!a)throw Error(`No signal '${t}' on object '${i}'`);let o=++pe,s=a.listen(e,t,n);return stateOf$2(e).connections.set(o,s),o};if(a===`notify`){if(o===void 0)throw new UnsupportedGObjectError(`connect("notify")`,`connect('notify') without a property is outside the GObject subset; connect 'notify::<property>' on '${i}'.`);let t=findProperty(r,o);return t?addHandler(e,`notify::${t.name}`,n):foreign()}if(findSignal(r,a)){if(o!==void 0)throw Error(`Signal '${a}' on object '${i}' has no detail`);return addHandler(e,a,n)}return foreign()}function disconnectInstance(e,t){let n=stateOf$2(e),r=n.connections.get(t);if(!r)throw Error(`No handler with id ${t} is connected to ${String(e)}`);n.connections.delete(t),r()}function emitInstance(e,t,...n){let r=chainOfInstance(e),i=typeNameOf(e,r),a=findSignal(r,t);if(a){if(n.length!==a.length)throw Error(`Signal '${t}' on ${i} requires ${a.length} args got ${n.length}`);runHandlers(e,t,n);return}let o=r[0]?.door;if(!o)throw Error(`No signal '${t}' on object '${i}'`);o.dispatch(e,t,n)}function notifyInstance(e,t){let n=chainOfInstance(e),r=findProperty(n,t);if(r){runHandlers(e,`notify::${r.name}`,[r]);return}let i=n[0]?.door;if(!i)throw Error(`No property ${t} on ${typeNameOf(e,n)}`);i.dispatch(e,`notify::${t}`,[])}function generateAccessors(e,t){let{name:n,flags:r}=e,i=r&v.READABLE,a=r&v.WRITABLE,o=t??{configurable:!0,enumerable:!0};return i&&a?!o.get&&!o.set?(o.get=function(){let{values:t}=stateOf$2(this);return t.has(n)||t.set(n,e.get_default_value()),t.get(n)},o.set=function(e){let{values:t}=stateOf$2(this);e!==t.get(n)&&(t.set(n,e),this.notify(n))}):o.get?o.set||=function(){throw Error(`getter defined without setter for property ${n}`)}:o.get=function(){throw Error(`setter defined without getter for property ${n}`)}:i&&!o.get?o.get=function(){throw Error(`missing getter for read-only property ${n}`)}:a&&!o.set&&(o.set=function(){throw Error(`missing setter for write-only property ${n}`)}),o}function checkAccessors(e,t){let{name:n,flags:r}=t;if(r&v.CONSTRUCT_ONLY)return;let[,i,a]=aliasesOf(n),own=t=>Object.getOwnPropertyDescriptor(e,t),o=own(n),s=o,c=n.includes(`-`),l,u;c&&(l=own(i),u=own(a),o??=l,o??=u);let d=r&v.READABLE,f=r&v.WRITABLE;(!o||d&&!o.get||f&&!o.set)&&(o=generateAccessors(t,o)),s||Object.defineProperty(e,n,o),c&&(l||Object.defineProperty(e,i,o),u||Object.defineProperty(e,a,o))}function defineConstructOnly(e,t,n){let{values:r}=stateOf$2(e);r.set(t.name,n);for(let n of new Set(aliasesOf(t.name)))Object.defineProperty(e,n,{get:()=>r.get(t.name),enumerable:!0,configurable:!0})}function bindProperties(e,t,n,r,i=[]){let a=i.includes(`invert-boolean`),o=!1,transfer=(e,t,n,r)=>()=>{if(!o){o=!0;try{let i=e[t];n[r]=a?!i:i}finally{o=!1}}},s=transfer(e,t,n,r),c=[[e,e.connect(`notify::${t}`,s)]];if(i.includes(`bidirectional`)){let i=transfer(n,r,e,t);c.push([n,n.connect(`notify::${r}`,i)])}return i.includes(`sync-create`)&&s(),{unbind(){for(let[e,t]of c.splice(0))e.disconnect(t)}}}function createClosure(e,t,n,r){let i=r??e;if(n)throw new UnsupportedGObjectError(`swapped`,`Unsupported template signal flag "swapped"`);let a=e[t];if(a===void 0)throw Error(`A handler called ${t} was not defined on ${String(e)}`);return a.bind(i)}function scopeOf(e){return{instance:e,handler:(t,n)=>createClosure(e,t,n?.flags?.includes(`swapped`)??!1,n?.object),bind:bindProperties}}function constructRegistered(e,t={}){let n=chainOfInstance(e),r={},i=new Map;for(let[e,a]of Object.entries(t)){let t=findProperty(n,e);t?i.set(t,a):r[e]=a}let a=[];for(let t of[...n].reverse())t.template&&a.push([t,t.door.createFromTree(t.template,scopeOf(e),e)]);for(let t of n)for(let n of t.properties)n.flags&v.CONSTRUCT_ONLY&&defineConstructOnly(e,n,i.has(n)?i.get(n):n.get_default_value());for(let[t,n]of i)t.flags&v.CONSTRUCT_ONLY||(e[t.name]=n);for(let[t,n]of a){for(let r of t.internalChildren){let i=n.objects[r];if(i===void 0)throw Error(`Template of ${t.typeName} has no child object '${r}' for InternalChildren`);e[`_${r.replace(/-/g,`_`)}`]=i}t.door.attach(e,n)}return r}const own=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),x=Symbol(`GIR type`),me={"Gio.Application":[`vfunc_startup`,`vfunc_activate`],"GtkSource.GutterRenderer":[`vfunc_query_data`]};function unlockedVfuncsOf(e){let t=new Set;for(let n=e;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=own(n,x)?n[x]:void 0;if(typeof e==`string`)for(let n of me[e]??[])t.add(n)}return t}function refusal(e,t,n=``){return new UnsupportedGObjectError(t,`GObject.registerClass: ${e} uses '${t}'${n}, which is outside the GObject subset (ADR 0096 § 2).`)}function describeType(e){return e?.name?.toString()??String(e)}let he=0;function registerWith(e,t){let n=t.length===2?t[1]:t[0];if(typeof n!=`function`)throw TypeError(`GObject.registerClass() needs a class`);let r=n,i=r.name||`anonymous class`;if(t.length===2){let e=t[0];for(let t of Object.keys(e))if(!own(le,t))throw refusal(i,t);for(let[t,n]of Object.entries(le))t in e&&(r[n]=e[t])}for(let[e,t]of Object.entries(ue))if(own(r,t))throw refusal(i,e);let a=unlockedVfuncsOf(r);for(let e of[r,r.prototype])for(let t of Object.getOwnPropertyNames(e))if(t.startsWith(`vfunc_`)&&typeof Object.getOwnPropertyDescriptor(e,t)?.value==`function`&&!a.has(t))throw refusal(i,t,` (a virtual function override that UNLOCKED_VFUNCS does not list, ADR 0098 § 1a)`);let declared=e=>own(r,e)?r[e]:void 0,o=declared(b.GTypeName),s=String(o??`Gjs_${r.name||`anonymous_${++he}`}`).replace(/[^a-z0-9+_-]/gi,`_`),c=Object.values(declared(b.properties)??{}).map(e=>{if(!(e instanceof y))throw TypeError(`GObject.registerClass: ${i} declares a property that is not a ParamSpec`);return e}),l={};for(let[e,t]of Object.entries(declared(b.signals)??{})){for(let n of Object.keys(t))if(n!==`param_types`)throw refusal(i,`Signals.${e}.${n}`);let n=t.param_types??[];for(let t of n)if(!ce.includes(t))throw refusal(i,`Signals.${e}.param_types`,` with the type '${describeType(t)}' (only TYPE_STRING, TYPE_BOOLEAN, TYPE_INT, TYPE_UINT and TYPE_DOUBLE)`);l[e]=n}let u=declared(b.template);if(u!==void 0&&(typeof u!=`object`||!u))throw new UnsupportedGObjectError(`Template`,`GObject.registerClass: ${i} has a Template that is not a '?template' value; a string, URI or bytes stay GJS-only (ADR 0096 § 4).`);let d=makeType(s),f={klass:r,typeName:s,gtype:d,properties:c,signals:l,template:u,internalChildren:declared(b.internalChildren)??[],cssName:declared(b.cssName),door:e};Object.defineProperty(r,"$gtype",{get:()=>d,enumerable:!1,configurable:!1});for(let e of c)checkAccessors(r.prototype,e);return installInstanceApi(r.prototype),de.set(r,f),e.register(f.klass,f),f.klass}function registerBaseClass(e,t,n,r=[]){let missing=e=>{throw Error(`No signal '${e}' on object '${t}'`)},i=makeType(t);Object.defineProperty(e,"$gtype",{get:()=>i,enumerable:!1,configurable:!1});for(let t of r)checkAccessors(e.prototype,t);de.set(e,{klass:e,typeName:t,gtype:i,properties:r,signals:n,internalChildren:[],door:{name:t,dispatch:(e,t)=>missing(t),listen:(e,t)=>missing(t),createFromTree:()=>missing(`template`),attach(){},register(){}}})}var GObjectObject$1=class{static{__name(this,`GObjectObject`)}constructor(e){let t=constructRegistered(this,e),n=Object.keys(t)[0];if(n!==void 0)throw Error(`No property ${n} on ${typeNameOf(this,chainOfInstance(this))}`)}notify(e){notifyInstance(this,e)}connect(e,t){return connectInstance(this,e,t)}disconnect(e){disconnectInstance(this,e)}emit(e,...t){emitInstance(this,e,...t)}};function installInstanceApi(e){for(let t of[`notify`,`connect`,`disconnect`,`emit`])typeof e[t]!=`function`&&Object.defineProperty(e,t,{value:GObjectObject$1.prototype[t],writable:!0,configurable:!0,enumerable:!1})}function createGObject(e){return{Object:GObjectObject$1,registerClass:((...t)=>registerWith(e,t)),ParamSpec:y,ParamFlags:v,TYPE_STRING:re,TYPE_BOOLEAN:ie,TYPE_INT:ae,TYPE_UINT:oe,TYPE_DOUBLE:se,GTypeName:b.GTypeName,GTypeFlags:b.GTypeFlags,interfaces:b.interfaces,properties:b.properties,signals:b.signals,requires:b.requires,__gtkTemplate__:b.template,__gtkCssName__:b.cssName,__gtkChildren__:b.children,__gtkInternalChildren__:b.internalChildren,type_ensure(e){if(!ne.has(e))throw TypeError(`GObject.type_ensure: not a GType of this GObject`)},signal_stop_emission_by_name:stopEmissionByName}}function refuse$1(e,t){return new UnsupportedGObjectError(e,`${e} ${t}, which is outside the Gio subset (ADR 0098 § 1).`)}__name(refuse$1,`refuse`);var ActionRegistry=class{constructor(){this._actions=new Map}add(e){this._actions.set(e.name,e)}remove(e){this._actions.delete(e)}lookup_action(e){return this._actions.get(e)??null}has(e){return this._actions.has(e)}list(){return[...this._actions.keys()]}};const ge=new WeakMap;function actionRegistryOf(e,t=!0){let n=ge.get(e);return n===void 0&&t&&(n=new ActionRegistry,ge.set(e,n)),n}function requireAction(e){let t=e;if(typeof t?.name!=`string`||typeof t.activate!=`function`)throw TypeError(`add_action: needs a Gio.Action (a Gio.SimpleAction)`);return t}const _e={add_action(e){actionRegistryOf(this).add(requireAction(e))},lookup_action(e){return actionRegistryOf(this,!1)?.lookup_action(e)??null},remove_action(e){actionRegistryOf(this,!1)?.remove(e)}},ve={has_action(e){return actionRegistryOf(this,!1)?.has(e)??!1},list_actions(){return actionRegistryOf(this,!1)?.list()??[]},activate_action(e,t=null){if(t!==null)throw refuse$1(`activate_action with a parameter`,`needs a GLib.Variant`);actionRegistryOf(this,!1)?.lookup_action(e)?.activate(null)},get_action_enabled(e){return actionRegistryOf(this,!1)?.lookup_action(e)?.enabled??!1}};function installActionMap(e,t=!1){let n=t?{..._e,...ve}:{..._e};for(let[t,r]of Object.entries(n))Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0,enumerable:!1})}const ye=new WeakMap,S=new WeakMap;function applicationOfWindow(e){return S.get(e)??null}function linkWindow(e,t){t===null?S.delete(e):S.set(e,t)}function findActionGroup(e,t,n){for(let r=e;r;r=n(r)){let e=ye.get(r)?.get(t);if(e!==void 0)return e;if(t===`win`){let e=actionRegistryOf(r,!1);if(e!==void 0)return e}if(t===`app`){let e=S.get(r);if(e!==void 0)return e}}return null}function activateWidgetAction(e,t,n,r=null){let i=t.indexOf(`.`);if(i<=0)return!1;let a=findActionGroup(e,t.slice(0,i),n)?.lookup_action(t.slice(i+1));return!a||!a.enabled?!1:(a.activate(r),!0)}const be={NONE:0,FLAGS_NONE:0,DEFAULT_FLAGS:0,IS_SERVICE:1,IS_LAUNCHER:2,HANDLES_OPEN:4,HANDLES_COMMAND_LINE:8,SEND_ENVIRONMENT:16,NON_UNIQUE:32,CAN_OVERRIDE_APP_ID:64,ALLOW_REPLACEMENT:128,REPLACE:256};function isValidApplicationId(e){if(typeof e!=`string`||e.length>255||e===``)return!1;let t=e.split(`.`);return t.length>=2&&t.every(e=>/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(e))}function refuse(e,t){return new UnsupportedGObjectError(e,`${e} ${t}, which is outside the Gio subset (ADR 0098 § 1).`)}const xe=`register.hold.release.mark_busy.unmark_busy.open.set_inactivity_timeout.send_notification.withdraw_notification.register_session.set_option_context_parameter_string.set_option_context_summary.set_option_context_description.add_main_option.add_main_option_entries.add_option_group.set_resource_base_path.get_resource_base_path.set_flags.get_is_remote.get_is_registered.get_dbus_connection.get_dbus_object_path.bind_busy_property.add_action_entries.set_default`.split(`.`),Se=[`is_remote`,`is_registered`,`is_busy`,`resource_base_path`,`inactivity_timeout`,`action_group`],Ce=[`open`,`command-line`,`handle-local-options`,`shutdown`,`name-lost`],we=[`set_accels_for_action`,`get_accels_for_action`,`list_action_descriptions`,`get_actions_for_accel`,`set_menubar`,`get_menubar`,`get_menu_by_id`,`set_app_menu`,`get_app_menu`,`get_menu_by_id`,`inhibit`,`uninhibit`],Te=new WeakMap;let Ee=null;function rememberDefault(e){Ee??=e}function stateOf$1(e){let t=Te.get(e);return t===void 0&&(t={id:null,windows:[],running:!1,resolve:()=>{}},Te.set(e,t)),t}__name(stateOf$1,`stateOf`);function hostOf(e){let t=e.constructor.host;if(t===void 0)throw Error(`Gio.Application: this class has no ApplicationHost; use the Gtk.Application of a port.`);return t}var GioApplicationBase=class extends GObjectObject$1{static{this[x]=`Gio.Application`}static id_is_valid(e){return isValidApplicationId(e)}static get_default(){return Ee}constructor(e){super(e),rememberDefault(this)}get application_id(){return stateOf$1(this).id}set application_id(e){let t=e??null;if(t!==null&&!isValidApplicationId(t))throw Error(`Gio.Application: '${String(t)}' is not a valid application id (g_application_id_is_valid)`);let n=stateOf$1(this);if(n.running)throw Error(`Gio.Application: the application id cannot change while it runs`);n.id!==t&&(n.id=t,this.notify(`application-id`))}get flags(){return 0}set flags(e){if(e!==void 0&&e!==be.NONE)throw refuse(`Gio.ApplicationFlags value ${String(e)}`,`is a flag other than the default`)}get_application_id(){return this.application_id}set_application_id(e){this.application_id=e}get_flags(){return 0}vfunc_startup(){}vfunc_activate(){}run(){throw refuse(`Gio.Application.run()`,`blocks, and a page cannot; use runAsync()`)}connect(e,t){let n=e.split(`::`)[0]??e;if(Ce.includes(n))throw refuse(`the '${n}' signal`,`is not emitted`);return super.connect(e,t)}async runAsync(e=[]){let t=stateOf$1(this);if(t.running)throw Error(`Gio.Application.runAsync(): the application is already running`);let n=hostOf(this);t.running=!0;let r=new Promise(e=>{t.resolve=e}),i,a=!1,body=()=>{try{if(this.vfunc_startup(),this.emit(`startup`),this.emit(`activate`),this.vfunc_activate(),t.running&&t.windows.length===0&&n.requiresWindow)throw Error(`Gio.Application.runAsync(): activate added no window on ${n.name}; a window must be added synchronously by activate (ADR 0098 § 3).`)}catch(e){i=e,a=!0}return t.windows[0]??null};try{await n.start(body)}catch(e){i=e,a=!0}if(a)throw t.running=!1,n.exit(),i;return t.windows.length===0&&this._finish(0),r}quit(){let e=stateOf$1(this);if(e.running){for(let t of e.windows.splice(0))linkWindow(t,null),hostOf(this).detach(t);this._finish(0)}}_finish(e){let t=stateOf$1(this);t.running&&(t.running=!1,t.resolve(e),hostOf(this).exit())}};registerBaseClass(GioApplicationBase,`GApplication`,{startup:[],activate:[]},[y.string(`application-id`,``,``,v.READWRITE|v.CONSTRUCT,null),y.uint(`flags`,``,``,v.READWRITE|v.CONSTRUCT,0,4294967295,0)]),installActionMap(GioApplicationBase.prototype,!0);function refuseMembers(e,t,n){for(let n of t)Object.defineProperty(e,n,{value:()=>{throw refuse(`${n}()`,`is not implemented`)},writable:!0,configurable:!0,enumerable:!1});for(let t of n)Object.defineProperty(e,t,{get(){throw refuse(`the '${t}' property`,`is not implemented`)},configurable:!0,enumerable:!1})}refuseMembers(GioApplicationBase.prototype,xe,Se);function withGtkApplication(e){class GtkApplication extends e{get active_window(){return stateOf$1(this).windows[0]??null}get_active_window(){return this.active_window}get_windows(){return[...stateOf$1(this).windows]}add_window(e){let t=stateOf$1(this);t.windows.includes(e)||(t.windows.unshift(e),linkWindow(e,this))}remove_window(e){let t=stateOf$1(this),n=t.windows.indexOf(e);n!==-1&&(t.windows.splice(n,1),linkWindow(e,null),t.windows.length===0&&this._finish(0))}}return refuseMembers(GtkApplication.prototype,we,[]),GtkApplication}withGtkApplication(GioApplicationBase);const De=[{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 De[(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 Oe=[`suggested-action`],ke={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:ke.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?Oe:[]}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 je=/^(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=je.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}function createBreakpointDriver(e,t){let n=new BreakpointBinState;for(let r of e)n.add({condition:r.condition,setters:r.setters.map(e=>({...e,originalValue:t.read(e.object,e.property)}))});return{evaluate(e){let r=n.evaluate(e);if(r!==null)for(let e of r.writes)t.write(e.object,e.property,e.value)},get current(){return n.current}}}const Me=`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 Ne=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],Pe={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?Pe[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return Ne.filter(e=>t.has(e))}const C=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,C),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,C),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,C),n=glibClamp(Math.trunc(e.month),1,12),r=t===1,i=t===C;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,C),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,C),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,C),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 Fe=.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/Fe,t=Math.abs(r)-2+e;c=Fe*t*t-Fe*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 w={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 T=[`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 Ie={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:Ie.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const Le=[`undershoot-top`,`undershoot-bottom`],Re=[`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}const ze=new Set;function adwaitaColorScheme(){return`light`}function onAdwaitaColorSchemeChanged(e){return ze.add(e),()=>{ze.delete(e)}}function resolvePageTitle(e,t){return e??t}const Be=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return Be.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 Ve=[`action-disabled`,`action-missing`,`macos-menubar`],He=[`horizontal-buttons`,`circular-buttons`,`inline-buttons`],Ue=[`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(He,t.displayHint)),put(n,`textDirection`,oneOf(Ue,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(Ve,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 E={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
+ `)}`)}function menuActionsFor(e,t,n){let r={},visit=e=>{for(let i of e){if(i.kind!==`item`){visit(i.items);continue}let e=parseDetailedAction(i.action)?.name;if(e===void 0||e in r)continue;let a=e.indexOf(`.`),o=a>0?findActionGroup(t,e.slice(0,a),n):null;if(o===null)continue;let s=o.lookup_action(e.slice(a+1));s!==null&&(r[e]={enabled:s.enabled})}};return visit(e),r}function activateMenuItem(e,t,n){let r=parseDetailedAction(e.action);return r===null?!1:activateWidgetAction(t,r.name,n,r.target??null)}const We=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`&&We.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 Ge=65535,Ke=`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(Ge,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 checkPriority(e,t){if(typeof t!=`number`||!Number.isInteger(t))throw TypeError(`${e}: priority has to be an integer, got ${String(t)}`)}function checkCallback(e,t){if(typeof t!=`function`)throw TypeError(`${e}: expected function for callback argument function, got ${String(t)}`)}function runSource(e){try{return!!e()}catch(e){return console.error(`JS ERROR:`,e),!1}}const qe={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function createGLibTimers(e=qe){let t=1,n=new Map,r=new Map,i,schedulePump=()=>{i!==void 0||r.size===0||(i=e.setTimeout(dispatchIdles,0))};function dispatchIdles(){i=void 0;let e=1/0;for(let t of r.values())e=Math.min(e,t.priority);let t=[...r].filter(([,t])=>t.priority===e);try{for(let[e,n]of t)r.has(e)&&(runSource(n.run)||r.delete(e))}finally{schedulePump()}}return{PRIORITY_HIGH:-100,PRIORITY_DEFAULT:0,PRIORITY_HIGH_IDLE:100,PRIORITY_DEFAULT_IDLE:200,PRIORITY_LOW:300,SOURCE_REMOVE:!1,SOURCE_CONTINUE:!0,idle_add(e,n){checkPriority(`GLib.idle_add`,e),checkCallback(`GLib.idle_add`,n);let i=t++;return r.set(i,{priority:e,run:n}),schedulePump(),i},timeout_add(r,i,a){if(checkPriority(`GLib.timeout_add`,r),typeof i!=`number`||!Number.isInteger(i)||i<0)throw TypeError(`GLib.timeout_add: interval has to be a non-negative integer, got ${String(i)}`);checkCallback(`GLib.timeout_add`,a);let o=t++,arm=()=>{n.set(o,e.setTimeout(tick,i))};function tick(){runSource(a)&&n.has(o)?arm():n.delete(o)}return arm(),o},source_remove(t){return n.has(t)?(e.clearTimeout(n.get(t)),n.delete(t),!0):r.delete(t)?!0:(console.warn(`GLib-CRITICAL: Source ID ${String(t)} was not found when attempting to remove it`),!1)}}}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 GtkAdjustment=class{constructor(e){let t=normalizeAdjustment(e);this.value=t.value,this.lower=t.lower,this.upper=t.upper,this.stepIncrement=t.stepIncrement,this.pageIncrement=t.pageIncrement,this.pageSize=t.pageSize}_write(e){let t=normalizeAdjustment(e,this);this.value=t.value,this.lower=t.lower,this.upper=t.upper,this.stepIncrement=t.stepIncrement,this.pageIncrement=t.pageIncrement,this.pageSize=t.pageSize}configure(e,t,n,r,i,a){this._write({value:e,lower:t,upper:n,stepIncrement:r,pageIncrement:i,pageSize:a})}get_value(){return this.value}set_value(e){this._write({value:e})}get_lower(){return this.lower}set_lower(e){this._write({lower:e})}get_upper(){return this.upper}set_upper(e){this._write({upper:e})}get_step_increment(){return this.stepIncrement}set_step_increment(e){this._write({stepIncrement:e})}get_page_increment(){return this.pageIncrement}set_page_increment(e){this._write({pageIncrement:e})}get_page_size(){return this.pageSize}set_page_size(e){this._write({pageSize:e})}get_minimum_increment(){return Math.min(this.stepIncrement,this.pageIncrement)}},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 Je=new Set([`none`,`single`,`multiple`]);function normalizeListSelectionMode(e){return typeof e==`string`&&Je.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 Ye={indents:0,expander:`none`,level:1};function treeExpanderLayout(e,t={}){if(!e)return Ye;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 Xe=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+=Xe.get(n)??foldCherokee(e)??n}return t},Ze=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),Qe=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),$e=/[A-Za-z_:]/,et=/[A-Za-z0-9._:-]/,D=/[ \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=Qe.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||!$e.test(e[n]))return null;let i=n;for(;n<e.length&&et.test(e[n]);)n+=1;let a=e.slice(i,n),o=!1,s=!1;for(;n<e.length;){for(;n<e.length&&D.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||!$e.test(t))return null;for(;n<e.length&&et.test(e[n]);)n+=1;for(;n<e.length&&D.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&D.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||!Ze.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 tt=[`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 tt.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 nt=[`none`,`start`,`middle`,`end`];function normalizeLabelEllipsize(e){return nt.includes(e)?e:`none`}function labelEllipsizeOverflowValue(e){return e===`none`?`clip`:`ellipsis`}const rt=[`word`,`char`,`word-char`];function normalizeLabelWrapMode(e){return rt.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 it=`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=it){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 at=1200,ot=Math.PI*.35,st=Math.PI*.015,O=Math.PI*.9,ct=Math.PI*.9,lt=Math.PI*.7,k=Math.PI*1.1,ut=Math.PI*1.35,A=ct+k+ut-lt;53*Math.PI*2/A;const dt=k-lt/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%A,n=t>k?1:easeInOutSine(t/k);return adwLerp(st,O,n)-t*O/A}function spinnerArcEnd(e){let t=e%A,n=k-lt,r;return r=t<n?0:t>A-ct?1:easeInOutSine((t-n)/ut),adwLerp(0,O-st,r)-t*O/A}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+ot),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+ot),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=at*53;return(e%t+t)%t/at*Math.PI*2}const ft={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},pt=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],mt={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:`⌘`}},ht={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},gt={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:`~`},_t={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=ft[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&&ht[n[1]]){let e=ht[n[1]];return{label:mt[e][t],sideMarker:n[2]}}let r=_t[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 gt[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of pt)n.modifiers.has(e)&&r.push({label:mt[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 vt=[`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 vt.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 j={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(j.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(j.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(j.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(j.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(j.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(j.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const yt={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??yt}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 bt={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},xt=[`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 bt[e]??bt.down}function splitButtonPopupDirection(e){return e===`none`||!xt.includes(e)?`down`:e}const St=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&xt.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)}};function menuAssignments(e,t){let n=[],r=e.props?.[`menu-model`];if(r!==void 0){let i=typeof r==`string`?t?.[r]:void 0;if(i===void 0)throw Error(`${e.tag} menu-model: ${JSON.stringify(r)} names no menu: the file declares [${Object.keys(t??{}).join(`, `)}] (ADR 0097 § 1).`);n.push([`menu-model`,normalizeMenuModel(i)])}for(let[t,r]of Object.entries(e.menuModels??{}))n.push([t,normalizeMenuModel(r)]);return n}const Ct=[`narrow`,`wide`],wt=[`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 Tt={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=Tt){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=Tt){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=Tt){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 Et=[`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 Dt=[`none`,`fill`,`spread`],Ot=[`minimum`,`natural`],kt=[`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 Dt.includes(e)?e:`none`}function normalizeWrapPolicy(e){return Ot.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 kt.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 At=new WeakMap,jt=new WeakMap;function sourceOf(e){let t=e.constructor.source;if(t===void 0)throw Error(`Adw.StyleManager: this class has no StyleSource; use the Adw.StyleManager of a port.`);return t}var StyleManagerBase=class extends GObjectObject$1{static{this[x]=`Adw.StyleManager`}static get_default(){let e=jt.get(this);if(e===void 0){e=new this,jt.set(this,e);let t=sourceOf(e);At.set(e,t.dark()),t.subscribe(()=>{let n=t.dark();At.get(e)!==n&&(At.set(e,n),e.notify(`dark`))})}return e}get dark(){return sourceOf(this).dark()}get_dark(){return this.dark}};registerBaseClass(StyleManagerBase,`AdwStyleManager`,{},[y.boolean(`dark`,``,``,v.READABLE,!1)]);const Mt=`--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 Pt=new WeakSet;function hasAppChosenAccent(e){return Pt.has(e)}function writeAdwaitaAccent(e,t,n){t.style.setProperty(Mt,adwaitaAccentBgColor(e)),t.style.setProperty(Nt,adwaitaAccentColor(e,n))}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement;Pt.add(n),writeAdwaitaAccent(e,n,t.dark??isAdwaitaDark(n))}function clearAdwaitaAccent(e=document.documentElement){Pt.delete(e),e.style.removeProperty(Mt),e.style.removeProperty(Nt)}let M={},Ft=!1,N=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(M.accent&&M.accent!==te)return{accent:M.accent,source:`handoff`};let e=M.accentRgb?parseAdwRgb(M.accentRgb):null;if(e)return{accent:nearestAccent(e),source:`handoff`};if(M.accent===te){let e=readSystemAccent();if(e)return{accent:e.accent,source:`system`}}return null}function syncScheme(e){let t=M.colorScheme,n=t===`dark`?`theme-dark`:t===`light`?`theme-light`:null;n!==N&&(N&&e.classList.remove(N),N=null,n&&!e.classList.contains(`theme-dark`)&&!e.classList.contains(`theme-light`)&&(e.classList.add(n),N=n))}function sync(){let e=document.documentElement;if(syncScheme(e),hasAppChosenAccent(e))return;let t=resolve();t?(writeAdwaitaAccent(t.accent,e,isAdwaitaDark(e)),Ft=!0):Ft&&=(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(){M=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`,()=>{M.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 Lt=`adw-scroll-shaded`,Rt=`--adw-overshoot`,zt=[`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(Lt,...Et,...zt),e.style.removeProperty(Rt)}_update(e){e.classList.add(Lt);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of Et){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(Rt):e.style.setProperty(Rt,`${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};let Bt=0;const idOf=()=>`org.gjsify.vec.App${++Bt}`;function attempt$1(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}__name(attempt$1,`attempt`);const refusedBy=(e,t)=>({row:`refusal`,rule:`${e} is refused, by name`,holds:`subset`,observe(n){let r=new n.Application({application_id:idOf()});return(attempt$1(()=>void t(r))??``).includes(e)},shows:!0});refusedBy(`hold()`,e=>e.hold()),refusedBy(`release()`,e=>e.release()),refusedBy(`open()`,e=>e.open()),refusedBy(`the 'open' signal`,e=>e.connect(`open`,()=>{})),refusedBy(`the 'shutdown' signal`,e=>e.connect(`shutdown`,()=>{})),refusedBy(`the 'command-line' signal`,e=>e.connect(`command-line`,()=>{})),refusedBy(`send_notification()`,e=>e.send_notification());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};function walk(e,t,n){n(e,t),(e.children??[]).forEach((e,r)=>walk(e,`${t} > ${e.tag}[${r}]`,n))}function authoredNodes(e,t=e.tag){let n=[];return walk(e,t,(e,t)=>n.push({node:e,path:t})),n}function constructUsesOf(e){let t=[];return[{tree:e,address:e.tag},...(e.siblings??[]).map((t,n)=>({tree:t,address:`${e.tag} > sibling[${n}] ${t.tag}`}))].forEach(({tree:e,address:n},r)=>{r>0&&t.push({kind:`sibling-object`,path:n}),collectUses(e,n,t)}),t}function collectUses(e,t,n){for(let{node:r,path:i}of authoredNodes(e,t))r.layout!==void 0&&n.push({kind:`layout`,path:i}),r.extensions?.strings!==void 0&&n.push({kind:`strings`,path:i}),r.extensions?.responses!==void 0&&n.push({kind:`responses`,path:i}),r.page!==void 0&&n.push({kind:`page`,path:i}),r.extern===!0&&n.push({kind:`extern`,path:i}),r.signals?.forEach(()=>n.push({kind:`signal`,path:i})),Object.keys(r.bindings??{}).forEach(()=>n.push({kind:`bind`,path:i})),r.breakpoints?.forEach(()=>n.push({kind:`breakpoint`,path:i}))}var UnsupportedConstructError=class extends Error{constructor(e,t){let n=t.map(e=>` ${e.kind} at ${e.path} — ${e.reason}`).join(`
5
+ `);super(`this tree cannot be rendered by ${e}: ${t.length} construct(s) it refuses.\n${n}`),this.name=`UnsupportedConstructError`,this.renderer=e,this.refused=t}};function assertTreeConstructs(e,t,n){let r=[];for(let i of constructUsesOf(n)){let n=t[i.kind];if(n===void 0)throw Error(`${e}'s capabilities declare no row for the construct '${i.kind}'.`);n!==`implemented`&&r.push({...i,reason:n.refused})}if(r.length>0)throw new UnsupportedConstructError(e,r)}function attempt(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}function count$1(e,t){let n={n:0};return e.connect(t,()=>{n.n++}),n}__name(count$1,`count`),[...[`Children`,`Implements`,`Requires`,`GTypeFlags`].map(e=>({row:`registerClass`,rule:`the meta key ${e} is refused at registration, by name`,holds:`subset`,observe(t){let{GObject:n}=t;return(attempt(()=>n.registerClass({GTypeName:`GoVecRefuse${e}`,[e]:[]},class extends n.Object{}))??``).includes(e)},shows:!0}))];const L={active:!1,checked:!1,keyboardActivating:!1};({...L}),{...L},{...L},{...L},{...L},{...L};const Vt=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...Vt],[...Vt],Math.PI*.015,Math.PI*.35,Math.PI*.015,Math.PI*.9;const RADIO=(e,t,n)=>({label:n,action:`${e}::${t}`});RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.sort`,`name`,`Name`);const hostTagOf=e=>{if(!/^(?:Adw|Gtk)[A-Z]\w*$/.test(e))throw Error(`hostTagOf: ${e} is not a GIR class name`);let t=[];for(let n=0;n<e.length;n++){let r=e.charAt(n);if(r>=`A`&&r<=`Z`&&n>0){let r=e.charAt(n-1),i=e.charAt(n+1);(!(r>=`A`&&r<=`Z`)||i>=`a`&&i<=`z`)&&t.push(`-`)}t.push(r.toLowerCase())}return t.join(``)},attributeOf=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),propertyOf=e=>e.replace(/[-_]([a-z0-9])/g,(e,t)=>t.toUpperCase()),Ht={"margin-start":`margin-inline-start`,"margin-end":`margin-inline-end`,"margin-top":`margin-top`,"margin-bottom":`margin-bottom`},Ut=[`hexpand`,`vexpand`],Wt={"width-request":`min-width`,"height-request":`min-height`};function widgetLengthStyle(e,t){let n=Ht[e];if(n!==void 0)return[n,`${Number(t)}px`];let r=Wt[e];if(r!==void 0)return[r,Number(t)<0?null:`${Number(t)}px`]}const Gt=new Map([[`adw-toggle-group`,new Set([`sensitive`])],[`adw-toggle`,new Set([`enabled`])],[`adw-alert-response`,new Set([`enabled`])],[`adw-sidebar-item`,new Set([`enabled`,`visible`])],[`gtk-editable-label`,new Set([`editable`])],[`adw-entry-row`,new Set([`editable`,`show-apply-button`])],[`gtk-text`,new Set([`editable`])],[`gtk-text-view`,new Set([`editable`])],[`adw-navigation-page`,new Set([`can-pop`])],[`gtk-action-bar`,new Set([`revealed`])],[`adw-password-entry-row`,new Set([`revealed`])]]);function isValueBasedBooleanAttr(e,t){let n=Gt.get(e);return n!==void 0&&n.has(t)}const Kt={layout:{refused:`an <adw-…> element is placed by DOM order and slot=, so a layout-manager placement has no door in the markup this package reads (ADR 0092)`},strings:`implemented`,responses:`implemented`,page:`implemented`,extern:`implemented`,signal:`implemented`,bind:`implemented`,breakpoint:`implemented`,"sibling-object":{refused:`the web builder mounts one root element and has no consumer for a second root yet (ADR 0093)`}};function dispatchedSignalsOf(e){return e.constructor.signals??{}}const qt=new WeakSet,Jt=new WeakMap,Yt=new WeakSet;let Xt=0;function hasElementApi(e){return Yt.has(e)}function eventOf(e,t){let n=dispatchedSignalsOf(e),r=n[t]??(t.startsWith(`notify::`)?n[`notify::${attributeOf(t.slice(8))}`]:void 0);if(r===void 0)throw Error(`<${e.localName}> declares no signal '${t}'. It dispatches: ${Object.keys(n).join(`, `)||`none`}.`);return r}function inheritedDescriptor(e,t){for(let n=Object.getPrototypeOf(e);n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e}}function notifyElement(e,t){let n=propertyOf(t);e.dispatchEvent(new CustomEvent(eventOf(e,`notify::${t}`),{bubbles:!0,detail:{[n]:e[n]}}))}function ensureNotifying(e,t){let n=propertyOf(t),r=Jt.get(e)??new Set;if(r.has(n)||(r.add(n),Jt.set(e,r),Object.getOwnPropertyDescriptor(e,n)!==void 0))return;let i=inheritedDescriptor(e,n);if(i?.get===void 0||i.set===void 0)return;let{get:a,set:o}=i,s=eventOf(e,`notify::${t}`);Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){return a.call(this)},set(e){let n=a.call(this),r=!1,mark=e=>{e.target===this&&(r=!0)};this.addEventListener(s,mark);try{o.call(this,e)}finally{this.removeEventListener(s,mark)}!r&&a.call(this)!==n&&notifyElement(this,t)}})}function listenElement(e,t,n){let r=eventOf(e,t),i=t.startsWith(`notify::`);i&&ensureNotifying(e,t.slice(8));let listener=t=>{i&&t.target!==e||n(e,...qt.has(t)?t.detail:[])};return e.addEventListener(r,listener),()=>e.removeEventListener(r,listener)}function dispatchElement(e,t,n){let r=eventOf(e,t),i=new CustomEvent(r,{detail:n,bubbles:r.startsWith(`notify::`)});qt.add(i),e.dispatchEvent(i)}function installElementApi(e){if(typeof e.connect==`function`)return;Yt.add(e);let t=new Map,define=(t,n)=>Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0,enumerable:!1});define(`connect`,(n,r)=>{let i=listenElement(e,n,r),a=++Xt;return t.set(a,i),a}),define(`disconnect`,n=>{let r=t.get(n);if(r===void 0)throw Error(`No handler with id ${n} is connected to <${e.localName}>`);t.delete(n),r()}),define(`emit`,(t,...n)=>dispatchElement(e,t,n)),define(`notify`,t=>notifyElement(e,t))}const Zt=new Set([`connect`,`disconnect`,`emit`,`notify`]);function endpointOf(e){return hasElementApi(e)?new Proxy(e,{get(e,t){if(typeof t!=`string`||Zt.has(t))return Reflect.get(e,t,e);let n=Reflect.get(e,propertyOf(t),e);return typeof n==`function`?n.bind(e):n},set(e,t,n){return Reflect.set(e,typeof t==`string`?propertyOf(t):t,n,e)}}):e}const Qt=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 Qt.set(e,c),c}const R=new Map;function registerTemplateClass(e,t){let n=R.get(e);if(n!==void 0&&n!==t)throw Error(`the template class '${e}' is already registered as <${n}>.`);R.set(e,t)}function templateTagFor(e){let t=R.get(e);if(t===void 0)throw Error(`the tree uses the class '$${e}', which no registerTemplateClass() call registered: adwaita-web cannot build a class it does not know.`);if(customElements.get(t)===void 0)throw Error(`the class '$${e}' is registered as <${t}>, which nothing has defined in the custom element registry, so the element would stay an empty unknown tag.`);return t}function booleanAttribute$2(e,t){return e===null?t:e!==`false`}__name(booleanAttribute$2,`booleanAttribute`);function writeBooleanAttribute$1(e,t,n){n?e.setAttribute(t,`true`):e.setAttribute(t,`false`)}__name(writeBooleanAttribute$1,`writeBooleanAttribute`);function isWritable(e,t){for(let n=e;n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e.set!==void 0||e.writable===!0}return!1}function newRecord(e,t,n){return{placed:[],extended:[],ids:new Map,binds:[],breakpointHosts:[],disposers:[],...e===void 0?{}:{scope:e},...t===void 0?{}:{observeSize:t},...n===void 0?{}:{template:n}}}function bindBreakpoints(e,t,n){let r=createBreakpointDriver((t.breakpoints??[]).map(t=>{if(parseBreakpointCondition(t.condition)===null)throw Error(`<${e.localName}> \`condition ("${t.condition}")\` is not an Adwaita breakpoint condition.`);return{condition:t.condition,setters:t.setters.map(t=>{let r=n.ids.get(t.object);if(r===void 0)throw Error(`<${e.localName}> breakpoint setter \`${t.object}.${t.property}\` names no object: nothing in this tree has the id '${t.object}'.`);return{object:r,property:t.property,value:t.value}})}}),{read(e,t){let n=propertyOf(t),r=e[n];return typeof r==`boolean`&&isWritable(e,n)?{member:r}:{attribute:e.getAttribute(attributeOf(t))}},write(e,t,n){let r=propertyOf(t);if(typeof n==`object`&&n&&`member`in n)e[r]=n.member;else if(typeof n==`object`&&n&&`attribute`in n){let r=n.attribute;r===null?e.removeAttribute(attributeOf(t)):e.setAttribute(attributeOf(t),r)}else typeof n==`boolean`&&isWritable(e,r)?e[r]=n:writeProp(e,t,n)}});n.disposers.push((n.observeSize??observeAdaptiveSize)(e,e=>r.evaluate(e)))}function bindProperty(e,t){if(t.template!==void 0)return bindThroughEngine(e,t.template,t);let{el:n,property:r,source:i,sourceProperty:a,flags:o}=e,s=`<${n.localName}> \`${r}: bind ${i}.${a}\``,c=t.ids.get(i);if(c===void 0)throw Error(`${s} names no object: nothing in this tree has the id '${i}'.`);if(o.length>0)throw Error(`${s} carries ${o.join(`, `)}: adwaita-web binds the plain form only until each flag is verified against GObject.`);let l=`notify::${a}`,u=dispatchedSignalsOf(c),d=u[l];if(d===void 0)throw Error(`${s}: <${c.localName}> dispatches no '${l}', so the target would follow the source once and never again. It dispatches: ${Object.keys(u).join(`, `)||`none`}.`);let f=propertyOf(r),p=propertyOf(a);if(!isWritable(n,f))throw Error(`${s}: <${n.localName}> has no writable property '${f}'.`);let follow=()=>{n[f]=c[p]};follow(),c.addEventListener(d,follow)}function bindThroughEngine(e,t,n){let{el:r,property:i,source:a,sourceProperty:o,flags:s}=e,c=`<${r.localName}> \`${i}: bind ${a}.${o}\``,l=a===`template`?t.instance:n.ids.get(a);if(l===void 0)throw Error(`${c} names no object: nothing in this tree has the id '${a}'.`);let u=[`bidirectional`,`inverted`,`no-sync-create`],d=s.filter(e=>!u.includes(e));if(d.length>0)throw Error(`${c} carries ${d.join(`, `)}, which is not a bind flag.`);if(hasElementApi(r)&&!isWritable(r,propertyOf(i)))throw Error(`${c}: <${r.localName}> has no writable property '${propertyOf(i)}'.`);let f=[];s.includes(`bidirectional`)&&f.push(`bidirectional`),s.includes(`inverted`)&&f.push(`invert-boolean`),s.includes(`no-sync-create`)||f.push(`sync-create`),t.bind(endpointOf(l),o,endpointOf(r),i,f)}function writeProp(e,t,n){let r=attributeOf(t),i=propertyOf(t),a=Ut.find(e=>e===r);a!==void 0&&typeof n==`boolean`?e.setAttribute(a,n?``:`false`):typeof n==`boolean`&&isValueBasedBooleanAttr(e.localName,r)?writeBooleanAttribute$1(e,r,n):n===!1&&isWritable(e,i)?e[i]=!1:typeof n==`boolean`?e.toggleAttribute(r,n):e.setAttribute(r,String(n));let o=widgetLengthStyle(r,n);o!==void 0&&(o[1]===null?e.style.removeProperty(o[0]):e.style.setProperty(o[0],o[1]))}function buildNode(e,t){let n=document.createElement(e.extern===!0?templateTagFor(e.tag):hostTagOf(e.tag));t.template!==void 0&&installElementApi(n),e.id!==void 0&&(n.id=e.id,t.ids.set(e.id,n)),collectNode(n,e,t),writeLook(n,e,t.menus),bindSignals(n,e,t),e.extensions!==void 0&&t.extended.push({el:n,node:e});for(let r of buildChildren(n,e,t))n.append(r);return n}function collectNode(e,t,n){for(let[r,i]of Object.entries(t.bindings??{}))n.binds.push({el:e,property:r,source:i.source,sourceProperty:i.property,flags:i.flags??[]});t.breakpoints!==void 0&&n.breakpointHosts.push({el:e,node:t})}function writeLook(e,t,n){for(let[n,r]of Object.entries(t.props??{}))n!==`menu-model`&&writeProp(e,n,r);for(let[r,i]of menuAssignments(t,n))e[propertyOf(r)]=i;t.styleClasses!==void 0&&t.styleClasses.length>0&&e.classList.add(...t.styleClasses),writeExtensions(e,t)}function buildChildren(e,t,n){let r=[];for(let i of t.children??[]){let t=buildNode(i,n);i.page!==void 0&&writePage(e,t,i),i.slot!==void 0&&(t.setAttribute(`slot`,i.slot),n.placed.push({parent:e,child:t,slot:i.slot})),r.push(t)}return r}function buildTemplateTree(e,t,n){assertTreeConstructs(`adwaita-web`,Kt,e);let r=newRecord(void 0,void 0,t);r.menus=e.menus,e.id!==void 0&&r.ids.set(e.id,n),collectNode(n,e,r),bindSignals(n,e,r);let i=buildChildren(n,e,r);for(let e of r.binds)bindProperty(e,r);for(let e of r.breakpointHosts)bindBreakpoints(e.el,e.node,r);return{children:i,objects:Object.fromEntries(r.ids),finish:()=>writeLook(n,e,e.menus)}}function bindSignals(e,t,n){let r=dispatchedSignalsOf(e);for(let i of t.signals??[]){let t=i.detail===void 0?i.name:`${i.name}::${i.detail}`,a=r[t];if(a===void 0)throw Error(`<${e.localName}> declares no signal '${t}', so the handler '${i.handler}' would never run. It dispatches: ${Object.keys(r).join(`, `)||`none`}.`);if(n.template!==void 0){if(i.flags?.includes(`after`)===!0)throw Error(`the handler '${i.handler}' for '${t}' uses after, which is not in the GObject subset.`);let r=i.object===void 0?void 0:i.object===`template`?n.template.instance:n.ids.get(i.object);if(i.object!==void 0&&r===void 0)throw Error(`the handler '${i.handler}' for '${t}' names the object '${i.object}', which nothing in this tree has.`);e.connect(t,n.template.handler(i.handler,{object:r,flags:i.flags}));continue}if(i.object!==void 0||(i.flags?.length??0)>0)throw Error(`the handler '${i.handler}' for '${t}' uses ${i.object===void 0?``:`an object `}${(i.flags??[]).join(`, `)}: adwaita-web binds plain handlers only until each of those is verified against GTK.`);let o=n.scope?.[i.handler];if(typeof o!=`function`)throw Error(`the tree binds the handler '${i.handler}' for '${t}', and the scope ${n.scope===void 0?"was not given (pass `scope`)":`has no such function`}.`);e.addEventListener(a,e=>o.call(n.scope,e))}}function writeExtensions(e,t){let n=t.extensions?.strings;n!==void 0&&e.setAttribute(`strings`,JSON.stringify(n.map(e=>e.value)));for(let n of t.extensions?.responses??[]){let t=document.createElement(`adw-alert-response`);t.id=n.id,n.appearance!==void 0&&t.setAttribute(`appearance`,n.appearance),n.enabled===!1&&t.setAttribute(`enabled`,`false`),t.textContent=n.label,e.append(t)}}function writePage(e,t,n){let{page:r}=n;if(e.localName===`gtk-notebook`)r?.label!==void 0&&t.setAttribute(`tab-label`,r.label);else if(e.localName===`gtk-stack`)r?.name!==void 0&&t.setAttribute(`name`,r.name),r?.label!==void 0&&t.setAttribute(`title`,r.label);else throw Error(`adwaita-web's shared-tree builder: <${n.tag}> has a page, and <${e.localName}> has no pages.`)}const $t=`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($t));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${$t}image-missing`):this.classList.add(`${$t}${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 en=[`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(en)).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(tn)||e.setAttribute(tn,``)):(e.removeAttribute(`title`),e.removeAttribute(tn))}const tn=`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 nn=[`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:nn})}_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);const rn={name:`adwaita-web`,requiresWindow:!1,start(e){return new Promise(t=>{let go=()=>{e(),t()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,go,{once:!0}):go()})},detach(e){e.remove()},exit(){}};function parentOfElement(e){if(!(e instanceof Element))return null;let t=e.anchor;return t instanceof Element?t:e.parentElement}function menuActionsOfElement(e,t){return menuActionsFor(t,e,parentOfElement)}function activateElementMenuItem(e,t){return activateMenuItem(t,e,parentOfElement)}var GioApplication=class extends GioApplicationBase{static host=rn};withGtkApplication(GioApplication);function defineWindowApplication(e){installActionMap(e),Object.defineProperty(e,"application",{configurable:!0,enumerable:!0,get(){return applicationOfWindow(this)},set(e){let t=applicationOfWindow(this);t!==e&&(t?.remove_window(this),e?.add_window(this))}})}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),defineWindowApplication(AdwApplicationWindow.prototype);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 Oe)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(Me),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(Me),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`),w.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),w.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 T)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 T)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const an={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`),w.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),w.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`:an[e]??`auto`,this.style.overflowY=t===null?`auto`:an[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 T)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 T)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 sn=[`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&&sn.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=Ke,this._applyButton.setAttribute(`aria-label`,Ke),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{static signals={"notify::active":`notify::active`,"notify::state":`notify::state`};_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 cn={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 ln={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=>ln[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=cn;_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 wt)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()??it,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 un={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:un}),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 dn=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),fn=new Set([...dn,`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=>fn.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:dn.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 pn=new WeakMap,mn=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=pn.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=mn.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`)};pn.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};mn.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 hn=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of hn){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 gn=`http://www.w3.org/2000/svg`,z=new Set;let _n=0;function tick(e){for(let t of z)t.drawAt(e);_n=z.size>0?requestAnimationFrame(tick):0}function startTicking(){_n===0&&z.size>0&&(_n=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(),z.add(this),this._origin=null,startTicking()}disconnectedCallback(){z.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(gn,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(gn,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(gn,`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?dt:this._lastProgress)}_lastProgress=dt;_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 vn=[`bottom`,`top`,`start`,`end`],yn=[`start`,`end`],bn=[`menu`,`listbox`],xn=[...bn,`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 vn.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return yn.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return xn.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||!bn.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 Sn={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},Cn={"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`},wn={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,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.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&&(activateElementMenuItem(this,t),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(Sn))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=Cn[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=wn[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;let e=this._state.menuModel??[];this._menuView.setMenuModel(e),this._menuView.setActions(this._actions??menuActionsOfElement(this,e)),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)},Tn=[`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 Tn)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Tn)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 En=[`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 En)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of En)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,E),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 On)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of On)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(Dn)),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 Dn=`16`,On=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const kn=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return kn}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 An={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=An;_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 Le)this.classList.toggle(t,e.includes(t));for(let e of Re)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{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_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}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":e.name}}))}_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=cn;_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 Ct)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 jn)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of jn)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 jn=[`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 Mn=[`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[...Mn]}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),Object.freeze({ALWAYS:0,AUTOMATIC:1,NEVER:2,EXTERNAL:3}),Object.freeze({NONE:0,LTR:1,RTL:2}),Object.freeze({WIDGET:1,TEXT:2,LEFT:3,RIGHT:4,TOP:5,BOTTOM:6});const Nn={main:`About`,credits:`Credits`,license:`License`,system:`System`},Pn=[`credits`,`license`,`system`],Fn=[`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&&Fn.includes(e)?e:`unknown`}set licenseType(e){Fn.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`,...Pn]){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 Pn){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 Pn.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=Nn[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=Fn.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.
6
+ 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`,Nn.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=`
7
+ >`.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 B={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`}},In=[`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:In})),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(B.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`);return this._controlButton(e?{...B.maximize,icon:`window-restore-symbolic`,label:`Restore`}:B.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(B.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),defineWindowApplication(GtkApplicationWindow.prototype);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 Ln=[`orientation`,`spacing`,`homogeneous`];var GtkBox=class extends HTMLElement{static get observedAttributes(){return[...Ln]}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 Rn=[`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=[...Rn.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 zn=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Bn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],V=[{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:V[0].icon,tooltip:V[0].tooltip},nextMonth:{icon:V[1].icon,tooltip:V[1].tooltip},previousYear:{icon:V[2].icon,tooltip:V[2].tooltip},nextYear:{icon:V[3].icon,tooltip:V[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=Bn[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`,`${Bn[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=zn[(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=V.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 Vn={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 Vn?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 Vn?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(Vn[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const Hn=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 active(){return this.checked}set active(e){this.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===`active`&&(this.checked=this.hasAttribute(`active`)),e===`checked`&&(this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active: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 signals={toggled:`toggled`,"notify::active":`notify::active`};static get observedAttributes(){return[`checked`,`active`,`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}Hn.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=Hn.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&Hn.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 Un={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends HTMLElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Un};_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 Wn=/^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=Wn.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 Gn=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Gn,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 Kn=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&Kn.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=Gn,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{static signals={"notify::selected":`notify::selected`,"notify::selected-item":`notify::selected-item`};_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}})),this.dispatchEvent(new CustomEvent(`notify::selected-item`,{bubbles:!0,detail:{"selected-item":n??null}})),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 qn=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,qn)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,qn)))}_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 Jn=new WeakMap;var Yn=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:Jn.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&&Jn.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`,Yn);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 Xn=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>Xn.includes(e))}const Zn=[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`)],Qn=[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`)],$n=[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`)],er=[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`)],tr=[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`)],nr=[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`)],rr=[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`)],ir=[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`)],ar=[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`)],or=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:Zn},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:Qn},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:$n},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:er},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:tr},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:nr},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:rr},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:ir},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:ar}];[...or.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:or.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 or){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=>!Xn.includes(e)).join(``);for(let t of[i,...Xn.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;_announced=``;static signals={changed:`changed`,"notify::text":`notify::text`,activate:`activate`};static get observedAttributes(){return[`value`,`text`,`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._announceText()):this.setAttribute(`value`,t)}get text(){return this.value}set text(e){this.value=e}_announceText(){let e=this._input.value;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:{text:e}})))}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(Ge,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength),this._announceText())}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.getAttribute(`text`)??``,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),this._announceText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this._announced=e.value,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`||e===`text`?(this._input.value=clampEntryText(n??``,this._maxLength),this._announceText()):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 sr={left:`start`,right:`end`,center:`center`,fill:`justify`},cr=[`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[...cr]}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=sr[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 lr=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-${lr++}`),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 ur={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},dr=[{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={...ur,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=dr.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 dr)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 fr=[`family`,`face`,`font`,`features`],pr=[{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={...ur};_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 fr.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 pr){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={...ur,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 H=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...H];let n=t.split(/[\s,|]+/).filter(e=>H.includes(e));return H.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=[...H];_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=H.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 mr=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return mr.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return rt.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 hr=[[`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=hr.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 gr=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&gr.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 _r={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,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.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(),activateElementMenuItem(this,t),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._refreshActions(),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=_r[St(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()}_refreshActions(){this._menuView.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render()}_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 vr=[`top`,`bottom`,`left`,`right`],yr=[`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&&vr.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:[...yr,`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&&yr.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 br=[`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 br)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const U=25.4,W=[{name:`na_letter`,displayName:`US Letter`,width:8.5*U,height:11*U},{name:`na_legal`,displayName:`US Legal`,width:8.5*U,height:14*U},{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*U,height:10.75*U},{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*U,height:9.5*U},{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*U,height:17*U},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],xr=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*U,bottom:(xr.has(e.name)?.56:.25)*U,left:.25*U,right:.25*U}}function defaultPageSetup(){let e=W.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return W.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??W[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/U,height:a/U}}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/U,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(`
8
+ `)}const Sr={name:`Any Printer`,location:`For portable documents`},Cr=[[`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 Cr){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[Sr,...this._printers]}_fillPaperSizes(){this._setups=W.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===Sr.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 wr=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return wr.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 G=`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,E),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?G: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.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render(),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??G)}}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===G||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(G)}_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&&(activateElementMenuItem(this,t),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,E);if(t.length===0)return e;console.error(`${E.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,E),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,E);if(t.length===0)return e;console.error(`${E.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,E),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,E);if(t.length>0){console.error(`${E.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 Tr=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],Er=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],Dr=[`All sheets`,`Even sheets`,`Odd sheets`],Or=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],kr={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...kr};_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=>Tr.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={...kr,...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=>Tr.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 Er){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(Dr,`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=W.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(Or.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=Or[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=W[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(...Er.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 Ar=[`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`],jr=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Mr=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Nr=new Set([`swing-right`,`swing-left`]),Pr=new Set([`swing-up`,`swing-down`]),Fr=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Ir={"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 Ar.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)`)?Ir[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?jr:Mr,r=e===`horizontal`?Nr:Pr;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=Fr.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const Lr=[`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 Lr.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 Rr={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={...Rr,...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 zr=[`always`,`never`,`automatic`,`external`],Br=[`always`,`automatic`,`never`,`external`],Vr=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return zr.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Vr.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 Hr=[{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;_standIn={};_adopted={};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_policy(){return[Br.indexOf(this.hscrollbarPolicy),Br.indexOf(this.vscrollbarPolicy)]}set_policy(e,t){let nick=(e,t)=>{let n=Number.isInteger(e)?Br[e]:void 0;if(n===void 0)throw TypeError(`${e} is not a valid value for enum argument ${t}`);return n},n=nick(e,`hscrollbar_policy`),r=nick(t,`vscrollbar_policy`);this.hscrollbarPolicy=n,this.vscrollbarPolicy=r}get hadjustment(){return this._adopted.hadjustment??this._viewport?.hadjustment??(this._standIn.hadjustment??=new GtkAdjustment)}get vadjustment(){return this._adopted.vadjustment??this._viewport?.vadjustment??(this._standIn.vadjustment??=new GtkAdjustment)}get_hadjustment(){return this.hadjustment}get_vadjustment(){return this.vadjustment}set_hadjustment(e){this._adopted.hadjustment=e}set_vadjustment(e){this._adopted.vadjustment=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 Vr)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 Hr){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 Hr){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 Ur=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??Ur}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 K=1e-10,Wr=[`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 Wr.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)<K?(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)<K?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>K&&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<=K,this._down.disabled=!this.wrap&&e.value-e.lower<=K,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 Gr=`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(Gr,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(Gr,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(Gr,`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 Kr=[`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`],qr=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Jr={"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 Yr=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends HTMLElement{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_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&&Kr.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:[...Yr,`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}Yr.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(qr.has(n)&&!e?n=`none`:qr.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=Jr[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(Ge,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 Xr=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Xr.includes(e??``)?e:`none`}const Zr={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=Zr[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=sr[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 Qr=[`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 Qr){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 $r={"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`}},ei={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},ti=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}=$r[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:ti.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:ei[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);const q=createGLibTimers();q.PRIORITY_HIGH,q.PRIORITY_DEFAULT,q.PRIORITY_HIGH_IDLE,q.PRIORITY_DEFAULT_IDLE,q.PRIORITY_LOW,q.SOURCE_REMOVE,q.SOURCE_CONTINUE,q.idle_add,q.timeout_add,q.source_remove;const J=new WeakMap,ni=new WeakSet,ri=new Map;function tagForTypeName(e){return`gjsify-${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}`}function isElementClass(e){return e.prototype instanceof HTMLElement}function declareSignals(e,t){let n={...e.signals??{}};for(let e of t.properties)n[`notify::${e.name}`]=`notify::${e.name}`;for(let e of Object.keys(t.signals))n[e]=e;Object.defineProperty(e,"signals",{value:n,configurable:!0,writable:!0})}function attachPending(e){let t=J.get(e);if(t!==void 0){J.delete(e);for(let n of t)n.finish(),e.append(...n.children)}}const Y=createGObject({name:`adwaita-web`,dispatch(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);dispatchElement(e,t,n)},listen(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);return listenElement(e,t,n)},createFromTree(e,t,n){return buildTemplateTree(e,t,n)},attach(e,t){let n=J.get(e)??[];n.push(t),J.set(e,n)},register(e,t){if(!isElementClass(e))return;let n=tagForTypeName(t.typeName),r=ri.get(n)??(customElements.get(n)===void 0?void 0:`another class`);if(r!==void 0)throw Error(`GObject.registerClass: ${t.typeName} would be <${n}>, which ${r} already defines. Give the class a distinct GTypeName.`);let i=Object.getPrototypeOf(e);class Constructing extends i{constructor(e){if(super(),ni.has(this))return;ni.add(this);let t=constructRegistered(this,e);for(let[e,r]of Object.entries(t)){let t=propertyOf(e);if(!(t in this))throw Error(`No property ${e} on <${n}>`);this[t]=r}}}Object.setPrototypeOf(e,Constructing),Object.setPrototypeOf(e.prototype,Constructing.prototype);let a=e.prototype,o=a.connectedCallback;Object.defineProperty(a,"connectedCallback",{configurable:!0,writable:!0,value(){attachPending(this),o?.call(this)}}),declareSignals(e,t),customElements.define(n,e),ri.set(n,t.typeName),registerTemplateClass(t.typeName,n)}});Y.Object,Y.registerClass,Y.type_ensure,Y.signal_stop_emission_by_name,Y.ParamSpec,Y.ParamFlags,Y.TYPE_STRING,Y.TYPE_BOOLEAN,Y.TYPE_INT,Y.TYPE_UINT,Y.TYPE_DOUBLE,Y.GTypeName,Y.GTypeFlags,Y.interfaces,Y.properties,Y.signals,Y.requires,Y.__gtkTemplate__,Y.__gtkCssName__,Y.__gtkChildren__,Y.__gtkInternalChildren__;let ii=1;var SignalEmitter=class{constructor(){this.handlers=new Map}connect(e,t){return this.add(e,t,!1)}connect_after(e,t){return this.add(e,t,!0)}checkSignal(e){}add(e,t,n){this.checkSignal(e);let r=ii++;return this.handlers.set(r,{name:e,callback:t,after:n}),r}disconnect(e){if(!this.handlers.delete(e))throw Error(`No signal handler with id ${e} on this object`)}emit(e,...t){let n=Array.from(this.handlers.values()).filter(t=>t.name===e);for(let e of[!1,!0])for(let r of n)r.after===e&&r.callback(this,...t)}},TextIter=class{constructor(e,t){this.source=e,this.offset=t}get utf16Offset(){return this.offset}get_offset(){let e=0,t=this.source.getText(0,this.offset);for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let e=t.charCodeAt(n+1);e>=56320&&e<=57343&&n++}e++}return e}set_offset(e){if(!Number.isInteger(e))throw TypeError(`TextIter.set_offset: ${e} is not an integer`);let t=this.source.getText(),n=0;for(let r=0;e>=0&&r<e&&n<t.length;r++)n+=t.codePointAt(n)>65535?2:1;this.offset=e<0||n>=t.length?this.source.length:n}},TextMark=class{constructor(e){this.name=e}};const ai=new Set([`changed`,`mark-set`,`begin-user-action`,`end-user-action`,`undo`,`redo`,`cursor-moved`,`notify::language`,`notify::style-scheme`,`notify::highlight-syntax`,`notify::cursor-position`,`notify::can-undo`,`notify::can-redo`]);var GtkSourceBuffer=class extends SignalEmitter{constructor(e=``){super(),this.lines=[``],this.lineStarts=[0],this.startsValidTo=1,this.cursor=0,this.bound=0,this.insertMark=new TextMark(`insert`),this.boundMark=new TextMark(`selection_bound`),this.undoStack=[],this.redoStack=[],this.open=null,this.depth=0,this.recording=!0,this.reportedUndo=!1,this.reportedRedo=!1,this.lang=null,this.scheme=null,this.highlight=!0;let{text:t=``,highlightSyntax:n=!0}=typeof e==`string`?{text:e}:e;t!==``&&(this.lines=t.split(`
9
+ `)),this.highlight=n!==!1&&String(n)!==`false`}get text(){return this.lines.join(`
10
+ `)}set text(e){this.recording=!1;try{this.replace(0,this.length,e??``),this.placeCursor(this.length)}finally{this.recording=!0}this.undoStack=[],this.redoStack=[],this.open&&(this.open.edits.length=0),this.syncUndoState()}get length(){return this.offsetOfLine(this.lines.length-1)+this.lines[this.lines.length-1].length}get lineCount(){return this.lines.length}getLine(e){let t=this.lines[e];if(t===void 0)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);return t}getLines(){return[...this.lines]}offsetOfLine(e){if(e<0||e>=this.lines.length)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);for(;this.startsValidTo<=e;){let e=this.startsValidTo-1;this.lineStarts[this.startsValidTo]=this.lineStarts[e]+this.lines[e].length+1,this.startsValidTo++}return this.lineStarts[e]}lineOfOffset(e){this.checkOffset(e);let t=0,n=this.lines.length-1;for(;t<n;){let r=t+n+1>>1;this.offsetOfLine(r)<=e?t=r:n=r-1}return t}getText(e=0,t=this.length){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);return this.text.slice(e,t)}insert(e,t){this.replace(e,e,t)}delete(e,t){if(typeof e==`number`&&typeof t==`number`){this.replace(e,t,``);return}let n=typeof e==`number`?e:this.ownIter(e,`delete`),r=typeof t==`number`?t:this.ownIter(t,`delete`);this.replace(Math.min(n,r),Math.max(n,r),``)}replace(e,t,n){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);let r=this.lineOfOffset(e),i=this.lineOfOffset(t),a=this.offsetOfLine(r),o=this.offsetOfLine(i),s=this.lines.slice(r,i+1).join(`
11
+ `).slice(e-a,t-a);if(s===``&&n===``)return;let c=(this.lines[r].slice(0,e-a)+n+this.lines[i].slice(t-o)).split(`
12
+ `);this.lines.splice(r,i-r+1,...c),this.startsValidTo=Math.min(this.startsValidTo,r+1);let l=this.cursor,shift=r=>r>=t?r-s.length+n.length:r>e?e+n.length:r;this.cursor=shift(this.cursor),this.bound=shift(this.bound);let u={start:e,removedText:s,insertedText:n,firstLine:r,removedLines:i-r+1,insertedLines:c.length};this.record(u,l),this.emit(`changed`,u),this.cursor!==l&&this.emit(`notify::cursor-position`),this.emit(`cursor-moved`)}get cursorPosition(){return this.cursor}get cursor_position(){return new TextIter(this,this.cursor).get_offset()}get selectionBoundPosition(){return this.bound}selectRange(e,t){this.checkOffset(e),this.checkOffset(t),e!==this.cursor&&this.moveInsert(e),t!==this.bound&&this.moveBound(t)}placeCursor(e){this.selectRange(e,e)}moveInsert(e){this.cursor=e,this.emit(`mark-set`,new TextIter(this,e),this.insertMark),this.emit(`cursor-moved`),this.emit(`notify::cursor-position`)}moveBound(e){this.bound=e,this.emit(`mark-set`,new TextIter(this,e),this.boundMark)}get_insert(){return this.insertMark}get_selection_bound(){return this.boundMark}get_start_iter(){return new TextIter(this,0)}get_end_iter(){return new TextIter(this,this.length)}get_selection_bounds(){let e=Math.min(this.cursor,this.bound),t=Math.max(this.cursor,this.bound);return[e!==t,new TextIter(this,e),new TextIter(this,t)]}get_text(e,t,n){let r=this.ownIter(e,`get_text`),i=this.ownIter(t,`get_text`);return this.getText(Math.min(r,i),Math.max(r,i))}move_mark(e,t){let n=this.ownIter(t,`move_mark`);if(e===this.insertMark)this.moveInsert(n);else if(e===this.boundMark)this.moveBound(n);else throw Error(`GtkSource.Buffer.move_mark: only the 'insert' and 'selection_bound' marks exist`)}insert_at_cursor(e,t){if(t!==-1)throw Error(`GtkSource.Buffer.insert_at_cursor: only len -1 is implemented`);this.insert(this.cursor,e)}set_language(e){this.language=e}set_style_scheme(e){this.styleScheme=e}begin_user_action(){this.depth++>0||(this.open={edits:[],before:this.cursor},this.emit(`begin-user-action`))}end_user_action(){if(this.depth===0||--this.depth>0)return;let e=this.open;this.open=null,e&&e.edits.length>0&&this.push(e),this.emit(`end-user-action`)}get can_undo(){return this.undoStack.length>0}get can_redo(){return this.redoStack.length>0}undo(){let e=this.depth===0?this.undoStack.pop():void 0;e&&(this.emit(`undo`),this.applyHistory(()=>{for(let t of[...e.edits].reverse())this.replace(t.start,t.start+t.insertedText.length,t.removedText)}),this.moveInsert(e.before),this.moveBound(e.before),this.redoStack.push(e),this.syncUndoState())}redo(){let e=this.depth===0?this.redoStack.pop():void 0;if(!e)return;this.emit(`redo`),this.applyHistory(()=>{for(let t of e.edits)this.replace(t.start,t.start+t.removedText.length,t.insertedText)});let t=e.edits[e.edits.length-1],n=t.start+t.insertedText.length;this.moveInsert(n),this.moveBound(n),this.undoStack.push(e),this.syncUndoState()}applyHistory(e){this.recording=!1;try{e()}finally{this.recording=!0}}record(e,t){this.recording&&(this.redoStack=[],this.open?this.open.edits.push(e):this.push({edits:[e],before:t}))}push(e){this.undoStack.push(e),this.syncUndoState()}syncUndoState(){let e=this.can_undo,t=this.can_redo,n=e!==this.reportedUndo,r=t!==this.reportedRedo;this.reportedUndo=e,this.reportedRedo=t,n&&this.emit(`notify::can-undo`),r&&this.emit(`notify::can-redo`)}checkSignal(e){if(!ai.has(e))throw Error(`GtkSource.Buffer: signal '${e}' is not implemented`)}ownIter(e,t){if(!(e instanceof TextIter)||e.source!==this)throw TypeError(`GtkSource.Buffer.${t}: the iterator belongs to another buffer`);return e.utf16Offset}get language(){return this.lang}set language(e){e!==this.lang&&(this.lang=e,this.emit(`notify::language`))}get styleScheme(){return this.scheme}set styleScheme(e){e!==this.scheme&&(this.scheme=e,this.emit(`notify::style-scheme`))}get highlightSyntax(){return this.highlight}set highlightSyntax(e){e!==this.highlight&&(this.highlight=e,this.emit(`notify::highlight-syntax`))}checkOffset(e){if(!Number.isInteger(e)||e<0||e>this.length)throw RangeError(`Buffer: offset ${e} is outside 0..${this.length}`)}};function toBoolean(e,t){if(typeof e==`boolean`)return e;if(e===`true`)return!0;if(e===`false`)return!1;throw TypeError(`${t}: ${JSON.stringify(e)} is not a boolean`)}function toNumber(e,t){let n=typeof e==`string`&&e.trim()!==``?Number(e):e;if(typeof n!=`number`||!Number.isFinite(n))throw TypeError(`${t}: ${JSON.stringify(e)} is not a number`);return n}function parseColor(e){let t=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(e.trim());if(!t)return;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``)),n.length===6&&(n+=`ff`);let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return parseInt(n.slice(6,8),16)<<24|r<<16|i<<8|a|0}const oi=[[`margin_start`,`marginStart`,0],[`margin_end`,`marginEnd`,0],[`width_request`,`widthRequest`,-1],[`focusable`,`focusable`,!1],[`focus_on_click`,`focusOnClick`,!0]],si=new Set(oi.map(([e])=>e));function snakeCase(e){return e.replace(/-/g,`_`).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function byteSlice(e,t){if(t<0)return e;let n=0,r=0;for(let i of e){let e=i.codePointAt(0),a=e<128?1:e<2048?2:e<65536?3:4;if(n+a>t)break;n+=a,r+=i.length}return e.slice(0,r)}const ci=new WeakMap;function stateOf(e){let t=ci.get(e);return t===void 0&&(t={owner:null,widget:new Map(oi.map(([e,,t])=>[e,t]))},ci.set(e,t)),t}var li=class GutterRenderer extends GObjectObject$1{static{this[x]=`GtkSource.GutterRenderer`}constructor(e={}){let t={},n={};for(let[r,i]of Object.entries(e))(si.has(snakeCase(r))?t:n)[r]=i;if(super(n),new.target===GutterRenderer)throw TypeError(`Cannot instantiate abstract type GtkSourceGutterRenderer`);for(let[e,n]of Object.entries(t))this[e]=n}get_view(){return stateOf(this).owner?.get_view()??null}get view(){return this.get_view()}queue_draw(){stateOf(this).owner?.queue_draw()}attach(e){stateOf(this).owner=e}widgetProperty(e,t){let n=stateOf(this);return t!==void 0&&n.widget.get(e)!==t&&(n.widget.set(e,t),n.owner?.queue_draw()),n.widget.get(e)}};for(let[e,t]of oi)for(let n of new Set([e,t]))Object.defineProperty(li.prototype,n,{get(){return this.widgetProperty(e)},set(t){this.widgetProperty(e,t)},enumerable:!0});var GutterRendererText=class extends li{constructor(e={}){let{text:t,markup:n,...r}=e;super(r),t!==void 0&&(this.text=t),n!==void 0&&(this.markup=n)}get text(){return this.plain??null}set text(e){this.plain=e,this.marked=null}get markup(){return this.marked??null}set markup(e){this.marked=e,this.plain=null}set_text(e,t){this.text=byteSlice(e,t)}set_markup(e,t){this.markup=byteSlice(e,t)}},GutterLines=class{constructor(e,t,n,r){this.owner=e,this.text=t,this.first=n,this.last=r}get_first(){return this.first}get_last(){return this.last}get_buffer(){return this.text}get_view(){return this.owner}is_cursor(e){return this.text.lineOfOffset(this.text.cursorPosition)===e}},Gutter=class{constructor(e,t,n=()=>{}){this.owner=e,this.window_type=t,this.listener=n,this.placed=[]}get_view(){return this.owner}get view(){return this.owner}insert(e,t){return e.get_view()===null?(e.attach(this),this.placed.push({renderer:e,position:t}),this.sort(),this.queue_draw(),!0):!1}remove(e){let t=this.placed.findIndex(t=>t.renderer===e);t<0||(this.placed.splice(t,1),e.attach(null),this.queue_draw())}reorder(e,t){let n=this.placed.find(t=>t.renderer===e);n!==void 0&&(n.position=t,this.sort(),this.queue_draw())}queue_draw(){this.listener(this)}get renderers(){return this.placed.map(e=>e.renderer)}get positions(){return this.placed.map(e=>e.position)}sort(){this.placed.sort((e,t)=>e.position-t.position)}},GutterSet=class{constructor(e){this.view=e,this.gutters=new Map,this.listener=()=>{}}watch(e){this.listener=e}get(e){if(e!==3&&e!==4)return null;let t=this.gutters.get(e);return t===void 0&&(t=new Gutter(this.view,e,e=>this.listener(e)),this.gutters.set(e,t)),t}};const ui={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},di={b:`bold`,i:`italic`,u:`underline`,s:`strikethrough`};function parseMarkup(e){let t=[],n=[],r=/<(\/?)([a-zA-Z]+)[^>]*>|([^<]+)/g;for(let i=r.exec(e);i!==null;i=r.exec(e)){if(i[3]===void 0){if(i[1]===`/`){let e=n.lastIndexOf(i[2]);e>=0&&n.splice(e,1)}else i[0].endsWith(`/>`)||n.push(i[2]);continue}let e=i[3].replace(/&(amp|lt|gt|quot|apos);/g,(e,t)=>ui[t]),styled=e=>n.some(t=>di[t]===e);t.push({text:e,bold:styled(`bold`),italic:styled(`italic`),underline:styled(`underline`),strikethrough:styled(`strikethrough`)})}return t}const fi={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};var XmlParseError=class extends Error{constructor(e,t){super(`${e} (at offset ${t})`),this.offset=t,this.name=`XmlParseError`}};function decodeEntities(e,t=0){return e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[A-Za-z][A-Za-z0-9]*);/g,(e,n)=>{if(n.startsWith(`#`)){let r=n[1]===`x`?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);if(!(r>=1&&r<=1114111)||r>=55296&&r<=57343)throw new XmlParseError(`invalid character reference ${e}`,t);return String.fromCodePoint(r)}let r=fi[n];if(r===void 0)throw new XmlParseError(`unknown entity ${e}`,t);return r})}const pi=`[A-Za-z_][\\w.:-]*`,mi=RegExp(`\\s+(${pi})\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,`y`);function parseXml(e){let t=0,n=[],r=null,closeElement=e=>{let t=n[n.length-1];if(t)t.children.push(e);else if(r)throw new XmlParseError(`more than one root element`,e.offset);else r=e};for(;t<e.length;){let r=e.indexOf(`<`,t),i=r===-1?e.length:r;if(i>t){let r=e.slice(t,i),a=n[n.length-1];if(a)a.children.push(decodeEntities(r,t));else if(r.trim()!==``)throw new XmlParseError(`text outside the root element`,t)}if(r===-1)break;if(t=r,e.startsWith(`<!--`,t)){let n=e.indexOf(`-->`,t+4);if(n===-1)throw new XmlParseError(`unterminated comment`,t);t=n+3}else if(e.startsWith(`<![CDATA[`,t)){let r=e.indexOf(`]]>`,t+9);if(r===-1)throw new XmlParseError(`unterminated CDATA section`,t);let i=n[n.length-1];if(!i)throw new XmlParseError(`CDATA outside the root element`,t);i.children.push(e.slice(t+9,r)),t=r+3}else if(e.startsWith(`<?`,t)){let n=e.indexOf(`?>`,t+2);if(n===-1)throw new XmlParseError(`unterminated processing instruction`,t);t=n+2}else if(e.startsWith(`<!`,t))if(/^<!DOCTYPE[^[>]*>/i.test(e.slice(t)))t=e.indexOf(`>`,t)+1;else throw new XmlParseError(`unsupported markup declaration`,t);else if(e.startsWith(`</`,t)){let r=RegExp(`</(${pi})\\s*>`,`y`);r.lastIndex=t;let i=r.exec(e);if(!i)throw new XmlParseError(`malformed closing tag`,t);let a=n.pop();if(!a||a.name!==i[1])throw new XmlParseError(`closing tag </${i[1]}> does not match <${a?.name??`nothing`}>`,t);closeElement({name:a.name,attributes:a.attributes,children:a.children,offset:a.offset}),t=r.lastIndex}else{let r=RegExp(`<(${pi})`,`y`);r.lastIndex=t;let i=r.exec(e);if(!i)throw new XmlParseError(`malformed opening tag`,t);let a={},o=r.lastIndex;for(;;){mi.lastIndex=o;let t=mi.exec(e);if(!t)break;if(t[1]in a)throw new XmlParseError(`duplicate attribute ${t[1]}`,o);a[t[1]]=decodeEntities(t[2]??t[3]??``,o),o=mi.lastIndex}let s=/^\s*(\/?)>/.exec(e.slice(o));if(!s)throw new XmlParseError(`malformed attributes on <${i[1]}>`,o);t=o+s[0].length,s[1]===`/`?closeElement({name:i[1],attributes:a,children:[],offset:i.index}):n.push({name:i[1],offset:i.index,attributes:a,children:[]})}}if(n.length>0)throw new XmlParseError(`unclosed element <${n[n.length-1].name}>`,e.length);if(!r)throw new XmlParseError(`no root element`,0);return r}function childElements(e,t){return e.children.filter(e=>typeof e!=`string`&&(t===void 0||e.name===t))}function textContent(e){return e.children.map(e=>typeof e==`string`?e:textContent(e)).join(``)}const hi={stack:[]};function schemeStyleName(e,t){return t.startsWith(`def:`)?t:e.styles.find(e=>e.id===t)?.mapTo??`${e.id}:${t}`}function sameState(e,t){return e.stack.length===t.stack.length?e.stack.every((e,n)=>e===t.stack[n]):!1}var IncrementalHighlighter=class{constructor(e){this.tokenizer=e,this.results=[]}get lineCount(){return this.results.length}tokensOf(e){let t=this.results[e];if(!t)throw RangeError(`IncrementalHighlighter: line ${e} is outside 0..${this.results.length-1}`);return t.tokens}reset(e){this.results=[];let t=hi;for(let n of e){let e=this.tokenizer.tokenize(n,t);this.results.push(e),t=e.state}return e.length===0?null:{first:0,last:e.length-1}}update(e,t){let{first:n,removed:r,inserted:i}=t;if(n<0||r<1||i<1||n+r>this.results.length)throw RangeError(`IncrementalHighlighter: edit ${JSON.stringify(t)} does not fit ${this.results.length} lines`);if(e.length!==this.results.length-r+i)throw RangeError(`IncrementalHighlighter: ${e.length} lines do not match the edit`);let a=this.results[n+r-1].state,o=Array.from({length:i},()=>void 0);this.results.splice(n,r,...o);let s=n,c=n===0?hi:this.results[n-1].state;for(;s<n+i;s++){let t=this.tokenizer.tokenize(e[s],c);this.results[s]=t,c=t.state}let l=n+i-1;for(;!sameState(c,a)&&s<e.length;){a=this.results[s].state;let t=this.tokenizer.tokenize(e[s],c);this.results[s]=t,c=t.state,l=s,s++}return{first:n,last:l}}};const gi=[`id`,`name`,`_name`,`parent-scheme`,`version`],_i=[`name`,`foreground`,`background`,`line-background`,`bold`,`italic`,`strikethrough`,`underline`],asBoolean=e=>e===void 0?void 0:e===`true`;function parseStyleScheme(e){let t=parseXml(e);if(t.name!==`style-scheme`)throw Error(`parseStyleScheme: root element is <${t.name}>, not <style-scheme>`);let n=t.attributes.id;if(n===void 0)throw Error(`parseStyleScheme: <style-scheme> has no id`);let r=[];for(let e of Object.keys(t.attributes))gi.includes(e)||r.push({construct:`attribute ${e}`,where:`style-scheme`});let i=[],a=[],o=[];for(let e of childElements(t))if(e.name===`author`)i.push(textContent(e).trim());else if(e.name===`description`)continue;else if(e.name===`color`){let{name:t,value:n}=e.attributes;t===void 0||n===void 0?r.push({construct:`color without name or value`,where:`style-scheme/color`}):a.push({name:t,value:n})}else if(e.name===`style`){let t=e.attributes.name;if(t===void 0){r.push({construct:`style without name`,where:`style-scheme/style`});continue}let n={};for(let[t,r]of Object.entries(e.attributes))_i.includes(t)||(n[t]=r);let i=e.attributes;o.push({name:t,foreground:i.foreground,background:i.background,lineBackground:i[`line-background`],bold:asBoolean(i.bold),italic:asBoolean(i.italic),strikethrough:asBoolean(i.strikethrough),underline:i.underline,extra:n})}else r.push({construct:`element ${e.name}`,where:`style-scheme`});return{id:n,name:t.attributes.name??t.attributes._name,parentScheme:t.attributes[`parent-scheme`],version:t.attributes.version,authors:i,colors:a,styles:o,unsupported:r}}function resolveStyle(e,t,n){let r=[];for(let t=e;t;){if(r.some(e=>e.id===t?.id))throw Error(`style scheme ${e.id}: parent-scheme loop through ${t.id}`);if(r.push(t),t.parentScheme===void 0)break;if(t=n(t.parentScheme),t===void 0)throw Error(`style scheme ${r[r.length-1].id}: parent-scheme ${r[r.length-1].parentScheme} not found`)}let i=r.findIndex(e=>e.styles.some(e=>e.name===t));if(i===-1)return;let a=r[i].styles.find(e=>e.name===t);if(a===void 0)return;let color=e=>{if(e!==void 0){for(let t of r.slice(i)){let n=t.colors.find(t=>t.name===e);if(n)return n.value}return e}};return{name:t,foundIn:r[i].id,foreground:color(a.foreground),background:color(a.background),lineBackground:color(a.lineBackground),bold:a.bold,italic:a.italic,strikethrough:a.strikethrough,underline:a.underline}}const scheme=(e,t,n)=>`<?xml version="1.0" encoding="UTF-8"?>\n<style-scheme id="${e}" name="${t}" version="1.0">\n${Object.entries(n).map(([e,t])=>` <style name="${e}" ${t}/>`).join(`
13
+ `)}\n</style-scheme>\n`,vi=`Adwaita`,yi=`Adwaita-dark`,bi=scheme(vi,`Adwaita (gjsify fallback)`,{text:`foreground="#2e3436" background="#ffffff"`,selection:`background="#a8c8f0"`,cursor:`foreground="#2e3436"`,"current-line":`background="#f0f0f0"`,"line-numbers":`foreground="#8a8f92" background="#f6f5f4"`,"current-line-number":`foreground="#2e3436" background="#f0f0f0"`,"def:comment":`foreground="#77767b" italic="true"`,"def:shebang":`foreground="#77767b" italic="true"`,"def:doc-comment-element":`foreground="#77767b" italic="true"`,"def:keyword":`foreground="#a51d2d" bold="true"`,"def:statement":`foreground="#a51d2d" bold="true"`,"def:preprocessor":`foreground="#813d9c"`,"def:type":`foreground="#1a5fb4"`,"def:builtin":`foreground="#1a5fb4"`,"def:function":`foreground="#1a5fb4"`,"def:identifier":`foreground="#1a5fb4"`,"def:constant":`foreground="#26a269"`,"def:number":`foreground="#26a269"`,"def:decimal":`foreground="#26a269"`,"def:base-n-integer":`foreground="#26a269"`,"def:floating-point":`foreground="#26a269"`,"def:boolean":`foreground="#26a269"`,"def:string":`foreground="#c64600"`,"def:character":`foreground="#c64600"`,"def:special-char":`foreground="#c64600" bold="true"`,"def:special-constant":`foreground="#c64600"`,"def:operator":`foreground="#5e5c64"`,"def:error":`foreground="#c01c28" underline="error"`,"def:note":`foreground="#813d9c" bold="true"`}),xi=scheme(yi,`Adwaita Dark (gjsify fallback)`,{text:`foreground="#ebebeb" background="#1e1e1e"`,selection:`background="#35516e"`,cursor:`foreground="#ebebeb"`,"current-line":`background="#2a2a2a"`,"line-numbers":`foreground="#8a8a8a" background="#242424"`,"current-line-number":`foreground="#ebebeb" background="#2a2a2a"`,"def:comment":`foreground="#9a9996" italic="true"`,"def:shebang":`foreground="#9a9996" italic="true"`,"def:doc-comment-element":`foreground="#9a9996" italic="true"`,"def:keyword":`foreground="#ff7b63" bold="true"`,"def:statement":`foreground="#ff7b63" bold="true"`,"def:preprocessor":`foreground="#dc8add"`,"def:type":`foreground="#78aeed"`,"def:builtin":`foreground="#78aeed"`,"def:function":`foreground="#78aeed"`,"def:identifier":`foreground="#78aeed"`,"def:constant":`foreground="#8ff0a4"`,"def:number":`foreground="#8ff0a4"`,"def:decimal":`foreground="#8ff0a4"`,"def:base-n-integer":`foreground="#8ff0a4"`,"def:floating-point":`foreground="#8ff0a4"`,"def:boolean":`foreground="#8ff0a4"`,"def:string":`foreground="#ffbe6f"`,"def:character":`foreground="#ffbe6f"`,"def:special-char":`foreground="#ffbe6f" bold="true"`,"def:special-constant":`foreground="#ffbe6f"`,"def:operator":`foreground="#c0bfbc"`,"def:error":`foreground="#ff7b63" underline="error"`,"def:note":`foreground="#dc8add" bold="true"`});var StyleScheme=class{constructor(e,t){this.definition=e,this.lookup=t}get id(){return this.definition.id}get name(){return this.definition.name??this.definition.id}get parentId(){return this.definition.parentScheme}getStyle(e){return resolveStyle(this.definition,e,this.lookup)}};const Si={foreground:-13749194,background:-1,selection:-5715728,lineNumber:-7696494},Ci={foreground:-1315861,background:-14803426,selection:-13282962,lineNumber:-7697782};function paletteOf(e,t){let n=t===`dark`?Ci:Si,color=e=>e===void 0?void 0:parseColor(e),r=e.getStyle(`text`),i=e.getStyle(`selection`),a=e.getStyle(`current-line`),o=e.getStyle(`line-numbers`),s=e.getStyle(`current-line-number`),c=color(r?.foreground)??n.foreground,l=color(r?.background)??n.background,u=color(o?.foreground)??n.lineNumber,d=color(o?.background)??l,f=color(a?.background)??0;return{dark:t===`dark`,foreground:c,background:l,selectionBackground:color(i?.background)??n.selection,currentLineBackground:f,lineNumberForeground:u,lineNumberBackground:d,currentLineNumberForeground:color(s?.foreground)??c,currentLineNumberBackground:color(s?.background)??f}}var wi=class StyleSchemeManager{static getDefault(){return StyleSchemeManager.instance??=new StyleSchemeManager}static get_default(){return StyleSchemeManager.getDefault()}constructor(e=!0){if(this.definitions=new Map,this.fallbacks=new Set,e)for(let e of[bi,xi]){let t=parseStyleScheme(e);this.definitions.set(t.id,t),this.fallbacks.add(t.id)}}get schemeIds(){return[...this.definitions.keys()].sort()}isFallback(e){return this.fallbacks.has(e)}addScheme(e){return this.definitions.set(e.id,e),this.fallbacks.delete(e.id),this.wrap(e)}addSchemeFromXml(e){return this.addScheme(parseStyleScheme(e))}getScheme(e){let t=this.definitions.get(e);return t?this.wrap(t):null}get_scheme(e){return this.getScheme(e)}getDefaultFor(e){return this.getScheme(e===`dark`?yi:vi)}variantOf(e,t){let n=e.id.endsWith(`-dark`);if(n===(t===`dark`))return e;let r=n?e.id.slice(0,-5):`${e.id}-dark`;return this.getScheme(r)??e}wrap(e){return new StyleScheme(e,e=>this.definitions.get(e))}},TokenStyler=class{constructor(e,t){this.language=e,this.scheme=t,this.cache=new Map}styleFor(e){if(this.cache.has(e))return this.cache.get(e);let t=this.scheme.getStyle(schemeStyleName(this.language,e)),n;if(t){let e=t.foreground===void 0?void 0:parseColor(t.foreground),r=t.background===void 0?void 0:parseColor(t.background),i=t.underline!==void 0&&t.underline!==`none`,a=t.bold===!0,o=t.italic===!0,s=t.strikethrough===!0;(e!==void 0||r!==void 0||a||o||i||s)&&(n={foreground:e,background:r,bold:a,italic:o,underline:i,strikethrough:s})}return this.cache.set(e,n),n}runsOf(e){let t=[];for(let n of e){let e=this.styleFor(n.style);e&&n.end>n.start&&t.push({start:n.start,end:n.end,style:e})}return t}},HighlightController=class{constructor(e,t,n=wi.getDefault(),r=`light`){this.buffer=e,this.sink=t,this.schemes=n,this.highlighter=null,this.styler=null,this.handlers=[],this.variant=r,this.handlers.push(e.connect(`changed`,(e,t)=>this.onChanged(t)),e.connect(`notify::language`,()=>this.rebuild()),e.connect(`notify::style-scheme`,()=>this.rebuild()),e.connect(`notify::highlight-syntax`,()=>this.rebuild())),this.rebuild()}get scheme(){let e=this.buffer.styleScheme;return e?this.schemes.variantOf(e,this.variant):this.schemes.getDefaultFor(this.variant)}setColorScheme(e){e!==this.variant&&(this.variant=e,this.rebuild(!1))}dispose(){for(let e of this.handlers.splice(0))this.buffer.disconnect(e)}rebuild(e=!0){let t=this.scheme,n=this.buffer.language;if(t&&this.sink.setPalette(paletteOf(t,this.variant)),!n||!t||!this.buffer.highlightSyntax){this.highlighter=null,this.styler=null,this.sink.clearAll();return}(e||!this.highlighter||this.highlighter.tokenizer!==n.tokenizer)&&(this.highlighter=new IncrementalHighlighter(n.tokenizer),this.highlighter.reset(this.buffer.getLines())),this.styler=new TokenStyler(n.definition,t),this.paint(0,this.buffer.lineCount-1)}onChanged(e){if(this.sink.spliceLines(e.firstLine,e.removedLines,e.insertedLines),!this.highlighter)return;let t=this.highlighter.update(this.buffer.getLines(),{first:e.firstLine,removed:e.removedLines,inserted:e.insertedLines});this.paint(t.first,t.last)}paint(e,t){let{highlighter:n,styler:r}=this;if(!(!n||!r))for(let i=e;i<=t;i++)this.sink.paintLine(i,this.buffer.offsetOfLine(i),r.runsOf(n.tokensOf(i)))}};function leadingWhitespace(e){return/^[ \t]*/.exec(e)[0]}function cellOf(e){if(!(e instanceof GutterRendererText))return{text:``,runs:null};if(e.markup!==null){let t=parseMarkup(e.markup);return{text:t.map(e=>e.text).join(``),runs:t}}return{text:e.text??``,runs:null}}var EditorSession=class extends SignalEmitter{constructor(e,t=wi.getDefault(),n=`light`){super(),this.driver=e,this.schemes=t,this.bufferHandlers=[],this.mirroring=!1,this.fromNative=!1,this.gutters=null,this.props={autoIndent:!1,indentWidth:-1,showLineNumbers:!1,monospace:!1,editable:!0,highlightCurrentLine:!1,cursorVisible:!0,leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0},this.variant=n,e.bind(this),this.attach(new GtkSourceBuffer)}get buffer(){return this.current}set buffer(e){e!==this.current&&(this.attach(e),this.emit(`notify::buffer`))}attach(e){if(this.current){for(let e of this.bufferHandlers.splice(0))this.current.disconnect(e);this.controller.dispose()}this.current=e,this.bufferHandlers.push(e.connect(`changed`,(e,t)=>this.onBufferChanged(t)),e.connect(`mark-set`,()=>this.onBufferCursor())),this.mirroring=!0;try{this.driver.setText(e.text)}finally{this.mirroring=!1}this.controller=new HighlightController(e,this.driver,this.schemes,this.variant),this.driver.setLineCount(e.lineCount),this.driver.setSelection(e.cursorPosition,e.cursorPosition),this.pushLayout()}onBufferChanged(e){if(!this.fromNative){this.mirroring=!0;try{this.driver.replaceRange(e.start,e.start+e.removedText.length,e.insertedText)}finally{this.mirroring=!1}}e.insertedLines!==e.removedLines&&this.driver.setLineCount(this.current.lineCount)}onBufferCursor(){this.fromNative||this.mirroring||this.driver.setSelection(this.current.selectionBoundPosition,this.current.cursorPosition)}bindGutters(e){this.gutters=e,e.watch(e=>{e.window_type===3&&this.driver.invalidateGutter()})}leftRenderers(){let e=this.gutters?.get(3);return{renderers:e?.renderers??[],positions:e?.positions??[]}}metricsOf(e,t){return{position:t,widthRequest:e.width_request,marginStart:e.margin_start,marginEnd:e.margin_end}}gutterColumns(){let{renderers:e,positions:t}=this.leftRenderers();return e.map((e,n)=>this.metricsOf(e,t[n]))}queryGutter(e,t){let{renderers:n,positions:r}=this.leftRenderers();if(n.length===0||this.gutters===null)return[];let i=new GutterLines(this.gutters.view,this.current,e,t);return n.map((n,a)=>{let o=n.vfunc_query_data,s=[];for(let r=e;r<=t;r++)o?.call(n,i,r),s.push(cellOf(n));return{...this.metricsOf(n,r[a]),cells:s}})}onNativeEdit(e,t,n){if(!this.mirroring){this.fromNative=!0,this.current.begin_user_action();try{this.current.replace(e,e+t,n)}finally{this.fromNative=!1,this.current.end_user_action()}if(this.props.autoIndent&&n===`
14
+ `){let t=leadingWhitespace(this.current.getLine(this.current.lineOfOffset(e)));t!==``&&(this.current.insert(e+1,t),this.driver.setSelection(this.current.cursorPosition,this.current.cursorPosition))}}}onNativeSelection(e,t){if(this.mirroring)return;let clamp=e=>Math.min(Math.max(0,e),this.current.length);this.fromNative=!0;try{this.current.selectRange(clamp(t),clamp(e))}finally{this.fromNative=!1}}setProp(e,t,n){this.props[e]!==t&&(this.props[e]=t,this.emit(`notify::${n}`),this.pushLayout())}pushLayout(){let{props:e}=this;this.driver.setLayout({showLineNumbers:e.showLineNumbers,monospace:e.monospace,editable:e.editable,highlightCurrentLine:e.highlightCurrentLine,cursorVisible:e.cursorVisible,leftMargin:e.leftMargin,rightMargin:e.rightMargin,topMargin:e.topMargin,bottomMargin:e.bottomMargin})}get autoIndent(){return this.props.autoIndent}set autoIndent(e){this.setProp(`autoIndent`,e,`auto-indent`)}get indentWidth(){return this.props.indentWidth}set indentWidth(e){this.setProp(`indentWidth`,e,`indent-width`)}get showLineNumbers(){return this.props.showLineNumbers}set showLineNumbers(e){this.setProp(`showLineNumbers`,e,`show-line-numbers`)}get monospace(){return this.props.monospace}set monospace(e){this.setProp(`monospace`,e,`monospace`)}get editable(){return this.props.editable}set editable(e){this.setProp(`editable`,e,`editable`)}get highlightCurrentLine(){return this.props.highlightCurrentLine}set highlightCurrentLine(e){this.setProp(`highlightCurrentLine`,e,`highlight-current-line`)}get cursorVisible(){return this.props.cursorVisible}set cursorVisible(e){this.setProp(`cursorVisible`,e,`cursor-visible`)}get leftMargin(){return this.props.leftMargin}set leftMargin(e){this.setProp(`leftMargin`,e,`left-margin`)}get rightMargin(){return this.props.rightMargin}set rightMargin(e){this.setProp(`rightMargin`,e,`right-margin`)}get topMargin(){return this.props.topMargin}set topMargin(e){this.setProp(`topMargin`,e,`top-margin`)}get bottomMargin(){return this.props.bottomMargin}set bottomMargin(e){this.setProp(`bottomMargin`,e,`bottom-margin`)}setColorScheme(e){this.variant=e,this.controller.setColorScheme(e)}dispose(){for(let e of this.bufferHandlers.splice(0))this.current.disconnect(e);this.controller.dispose()}};function digitCount(e,t=2){return Math.max(t,String(Math.max(1,e)).length)}var LineStore=class{constructor(){this.slots=[]}get(e){return this.slots[e]}set(e,t){for(;this.slots.length<=e;)this.slots.push(void 0);this.slots[e]=t}splice(e,t,n){for(;this.slots.length<e+t;)this.slots.push(void 0);return this.slots.splice(e,t,...Array.from({length:n},()=>void 0)).filter(e=>e!==void 0)}clear(){let e=this.slots.filter(e=>e!==void 0);return this.slots=[],e}};function cssColor(e){let t=(e>>>24&255)/255;return`rgba(${e>>>16&255}, ${e>>>8&255}, ${e&255}, ${t})`}var WebEditorDriver=class{parts;host=null;text=``;caret=0;reported={start:0,end:0};layout=null;runs=new LineStore;scheduled=`none`;numbers=null;listening=[];palette=null;attached=!1;constructor(e){this.parts=e}bind(e){this.host=e}attach(){if(this.listening.length>0)return;this.attached=!0;let{area:e,backdrop:t,gutter:n}=this.parts,on=(e,t,n)=>{e.addEventListener(t,n),this.listening.push(()=>e.removeEventListener(t,n))};on(e,`input`,()=>this.onInput()),on(e,`scroll`,()=>{t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft,n.firstElementChild?.style.setProperty(`transform`,`translateY(${-e.scrollTop}px)`),this.hasColumns&&this.scheduleRender(`gutter`)}),on(e,`select`,()=>this.onSelection()),on(e,`keyup`,()=>this.onSelection()),on(e,`mouseup`,()=>this.onSelection()),on(e,`keydown`,e=>this.onKey(e)),on(e.ownerDocument,`selectionchange`,()=>{e.ownerDocument.activeElement===e&&this.onSelection()}),this.layout&&this.applyLayout(this.layout),this.palette&&this.applyPalette(this.palette),this.scheduleRender()}detach(){this.attached=!1;for(let e of this.listening.splice(0))e()}onInput(){let e=this.parts.area.value,t=this.text,n=0,r=Math.min(t.length,e.length);for(;n<r&&t.charCodeAt(n)===e.charCodeAt(n);)n++;let i=0;for(;i<r-n&&t.charCodeAt(t.length-1-i)===e.charCodeAt(e.length-1-i);)i++;this.text=e,this.host?.onNativeEdit(n,t.length-n-i,e.slice(n,e.length-i)),this.onSelection(),this.scheduleRender()}onSelection(){let{area:e}=this.parts,t=e.selectionStart??0,n=e.selectionEnd??t;t===this.reported.start&&n===this.reported.end||(this.reported={start:t,end:n},this.caret=n,this.host?.onNativeSelection(t,n),this.scheduleRender())}onKey(e){if(!(e.key!==`Tab`||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)&&!this.parts.area.readOnly&&(e.preventDefault(),!this.parts.area.ownerDocument.execCommand(`insertText`,!1,` `))){let{area:e}=this.parts;e.setRangeText(` `,e.selectionStart,e.selectionEnd,`end`),this.onInput()}}setText(e){this.text=e,this.parts.area.value=e,this.runs.clear(),this.scheduleRender()}replaceRange(e,t,n){let{area:r}=this.parts;this.text=this.text.slice(0,e)+n+this.text.slice(t),r.setRangeText(n,e,t,`preserve`),this.scheduleRender()}setSelection(e,t){this.reported={start:e,end:t},this.caret=t,this.parts.area.setSelectionRange(e,t),this.scheduleRender()}setLineCount(){this.scheduleRender()}setLayout(e){this.layout=e,this.attached&&this.applyLayout(e)}applyLayout(e){let{root:t,area:n}=this.parts;n.readOnly=!e.editable,t.classList.toggle(`monospace`,e.monospace),t.classList.toggle(`show-line-numbers`,e.showLineNumbers),t.classList.toggle(`cursor-hidden`,!e.cursorVisible),t.style.setProperty(`--gsv-margin-left`,`${e.leftMargin}px`),t.style.setProperty(`--gsv-margin-right`,`${e.rightMargin}px`),t.style.setProperty(`--gsv-margin-top`,`${e.topMargin}px`),t.style.setProperty(`--gsv-margin-bottom`,`${e.bottomMargin}px`),this.scheduleRender()}setPalette(e){this.palette=e,this.attached&&this.applyPalette(e)}applyPalette(e){let{style:t}=this.parts.root;t.setProperty(`--gsv-fg`,cssColor(e.foreground)),t.setProperty(`--gsv-bg`,cssColor(e.background)),t.setProperty(`--gsv-selection`,cssColor(e.selectionBackground)),t.setProperty(`--gsv-current-line`,cssColor(e.currentLineBackground)),t.setProperty(`--gsv-number-fg`,cssColor(e.lineNumberForeground)),t.setProperty(`--gsv-number-bg`,cssColor(e.lineNumberBackground)),t.setProperty(`--gsv-current-number-fg`,cssColor(e.currentLineNumberForeground)),t.setProperty(`--gsv-current-number-bg`,cssColor(e.currentLineNumberBackground))}invalidateGutter(){this.scheduleRender(`gutter`)}spliceLines(e,t,n){this.runs.splice(e,t,n)}paintLine(e,t,n){this.runs.set(e,n),this.scheduleRender()}clearAll(){this.runs.clear(),this.scheduleRender()}scheduleRender(e=`all`){if(!this.attached)return;let t=this.scheduled;this.scheduled=e===`all`||t===`all`?`all`:`gutter`,t===`none`&&queueMicrotask(()=>{let e=this.scheduled;this.scheduled=`none`,e===`all`?this.render():e===`gutter`&&this.renderGutter()})}hasColumns=!1;render(){let{backdrop:e}=this.parts,t=this.text.split(`
15
+ `),n=this.layout?.highlightCurrentLine===!0,r=this.text.slice(0,this.caret).split(`
16
+ `).length-1,i=[],a=[];t.forEach((e,t)=>{let o=document.createElement(`div`);o.className=n&&t===r?`gsv-line current`:`gsv-line`;let s=0;for(let n of this.runs.get(t)??[]){n.start>s&&o.append(e.slice(s,n.start));let t=document.createElement(`span`);t.textContent=e.slice(n.start,n.end);let{style:r}=n;r.foreground!==void 0&&(t.style.color=cssColor(r.foreground)),r.background!==void 0&&(t.style.backgroundColor=cssColor(r.background)),r.bold&&(t.style.fontWeight=`bold`),r.italic&&(t.style.fontStyle=`italic`);let i=[r.underline?`underline`:``,r.strikethrough?`line-through`:``];t.style.textDecoration=i.filter(Boolean).join(` `),o.append(t),s=n.end}s<e.length&&o.append(e.slice(s)),i.push(o);let c=document.createElement(`div`);c.className=n&&t===r?`gsv-number current`:`gsv-number`,c.textContent=String(t+1),a.push(c)}),e.replaceChildren(...i);let o=document.createElement(`div`);o.className=`gsv-numbers`,o.append(...a),this.numbers=o;let{root:s}=this.parts;s.style.setProperty(`--gsv-gutter-width`,`${digitCount(t.length)+0}ch`),s.style.setProperty(`--gsv-gutter-padding`,`8px`),this.renderGutter()}visibleLines(e){let{area:t,backdrop:n}=this.parts,r=n.firstElementChild,i=r===null?0:r.getBoundingClientRect().height;if(i<=0||t.clientHeight<=0)return[0,e-1];let a=Math.max(0,t.scrollTop-(this.layout?.topMargin??0)),o=Math.min(e-1,Math.floor(a/i));return[o,Math.min(e-1,Math.max(o,Math.ceil((a+t.clientHeight)/i)-1))]}cellElement(e){let t=document.createElement(`div`);if(t.className=`gsv-cell`,e.runs===null)return t.textContent=e.text,t;for(let n of e.runs){let e=document.createElement(`span`);e.textContent=n.text,n.bold&&(e.style.fontWeight=`bold`),n.italic&&(e.style.fontStyle=`italic`);let r=[n.underline?`underline`:``,n.strikethrough?`line-through`:``];e.style.textDecoration=r.filter(Boolean).join(` `),t.append(e)}return t}columnElement(e,t){let n=document.createElement(`div`);n.className=`gsv-column`,n.style.minWidth=`${e.widthRequest}px`,n.style.paddingLeft=`${e.marginStart}px`,n.style.paddingRight=`${e.marginEnd}px`;let r=document.createElement(`div`);return r.style.height=`calc(${t} * 1em * var(--gsv-line-height))`,n.append(r,...e.cells.map(e=>this.cellElement(e))),n}renderGutter(){let{gutter:e,root:t,area:n}=this.parts,r=this.host,i=this.text.split(`
17
+ `).length,[a,o]=this.visibleLines(i),s=r?.queryGutter(a,o)??[];this.hasColumns=s.length>0;let c=this.layout?.showLineNumbers===!0;t.classList.toggle(`has-columns`,this.hasColumns);let l=[];for(let e of s.filter(e=>e.position<0))l.push(this.columnElement(e,a));c&&this.numbers!==null&&l.push(this.numbers);for(let e of s.filter(e=>e.position>=0))l.push(this.columnElement(e,a));let u=document.createElement(`div`);u.className=`gsv-columns`,u.append(...l),u.style.transform=`translateY(${-n.scrollTop}px)`,e.replaceChildren(u)}};const Ti=`gjsify-gtk-source-view-style`;function ensureStyleInjected(){if(typeof document>`u`||document.getElementById(Ti)!==null)return;let e=document.createElement(`style`);e.id=Ti,e.textContent=`
18
+ gtk-source-view {
19
+ display: flex;
20
+ flex: 1 1 auto;
21
+ min-width: 0;
22
+ min-height: 12em;
23
+ height: 100%;
24
+ box-sizing: border-box;
25
+ position: relative;
26
+ overflow: hidden;
27
+ background: var(--gsv-bg, var(--view-bg-color));
28
+ color: var(--gsv-fg, var(--view-fg-color));
29
+ font: inherit;
30
+ --gsv-line-height: 1.4;
31
+ }
32
+ gtk-source-view.monospace { font-family: var(--monospace-font-family, ui-monospace, monospace); }
33
+ gtk-source-view .gsv-gutter {
34
+ display: none;
35
+ flex: none;
36
+ overflow: hidden;
37
+ box-sizing: content-box;
38
+ padding: var(--gsv-margin-top, 0px) 0 0;
39
+ text-align: end;
40
+ line-height: var(--gsv-line-height);
41
+ color: var(--gsv-number-fg);
42
+ background: var(--gsv-number-bg);
43
+ user-select: none;
44
+ }
45
+ gtk-source-view.show-line-numbers .gsv-gutter,
46
+ gtk-source-view.has-columns .gsv-gutter { display: block; }
47
+ gtk-source-view .gsv-columns { display: flex; }
48
+ gtk-source-view .gsv-numbers,
49
+ gtk-source-view .gsv-column { flex: none; box-sizing: content-box; }
50
+ gtk-source-view .gsv-numbers { width: var(--gsv-gutter-width, 2ch); padding: 0 var(--gsv-gutter-padding, 8px); }
51
+ gtk-source-view .gsv-cell { height: calc(1em * var(--gsv-line-height)); white-space: pre; text-align: start; }
52
+ gtk-source-view .gsv-number.current { color: var(--gsv-current-number-fg); background: var(--gsv-current-number-bg); }
53
+ gtk-source-view .gsv-stage { position: relative; flex: 1 1 auto; min-width: 0; }
54
+ gtk-source-view .gsv-backdrop,
55
+ gtk-source-view .gsv-area {
56
+ position: absolute;
57
+ inset: 0;
58
+ margin: 0;
59
+ border: 0;
60
+ box-sizing: border-box;
61
+ padding: var(--gsv-margin-top, 0px) var(--gsv-margin-right, 0px) var(--gsv-margin-bottom, 0px) var(--gsv-margin-left, 0px);
62
+ font: inherit;
63
+ line-height: var(--gsv-line-height);
64
+ white-space: pre;
65
+ tab-size: 8;
66
+ letter-spacing: normal;
67
+ }
68
+ gtk-source-view .gsv-backdrop { overflow: hidden; pointer-events: none; }
69
+ gtk-source-view .gsv-line { min-height: calc(1em * var(--gsv-line-height)); }
70
+ gtk-source-view .gsv-line.current { background: var(--gsv-current-line); }
71
+ gtk-source-view .gsv-area {
72
+ resize: none;
73
+ overflow: auto;
74
+ outline: none;
75
+ background: transparent;
76
+ color: transparent;
77
+ caret-color: var(--gsv-fg, currentColor);
78
+ }
79
+ gtk-source-view.cursor-hidden .gsv-area { caret-color: transparent; }
80
+ gtk-source-view .gsv-area::selection { background: var(--gsv-selection); color: transparent; }
81
+ `,document.head.appendChild(e)}const Ei={"auto-indent":[`autoIndent`,!1,toBoolean],"indent-width":[`indentWidth`,-1,toNumber],"show-line-numbers":[`showLineNumbers`,!1,toBoolean],"highlight-current-line":[`highlightCurrentLine`,!1,toBoolean],monospace:[`monospace`,!1,toBoolean],editable:[`editable`,!0,toBoolean],"cursor-visible":[`cursorVisible`,!0,toBoolean],"left-margin":[`leftMargin`,0,toNumber],"right-margin":[`rightMargin`,0,toNumber],"top-margin":[`topMargin`,0,toNumber],"bottom-margin":[`bottomMargin`,0,toNumber]},Di=[`auto-indent`,`indent-width`,`show-line-numbers`,`highlight-current-line`,`monospace`,`editable`,`cursor-visible`,`left-margin`,`right-margin`,`top-margin`,`bottom-margin`];var GtkSourceView=class extends HTMLElement{static get observedAttributes(){return Di}session;driver;unsubscribe=null;built=!1;gutter=document.createElement(`div`);backdrop=document.createElement(`div`);area=document.createElement(`textarea`);vadj=new GtkAdjustment;hadj=new GtkAdjustment;direction=1;gutters=new GutterSet(this);constructor(){super(),this.gutter.className=`gsv-gutter`,this.backdrop.className=`gsv-backdrop`,this.area.className=`gsv-area`,this.area.wrap=`off`,this.area.spellcheck=!1,this.area.autocapitalize=`off`,this.area.autocomplete=`off`,this.driver=new WebEditorDriver({root:this,area:this.area,backdrop:this.backdrop,gutter:this.gutter}),this.session=new EditorSession(this.driver,void 0,adwaitaColorScheme()),this.session.bindGutters(this.gutters)}syncAdjustments(){let{area:e}=this;this.vadj.configure(e.scrollTop,0,e.scrollHeight,20,e.clientHeight,e.clientHeight),this.hadj.configure(e.scrollLeft,0,e.scrollWidth,20,e.clientWidth,e.clientWidth)}onAreaScroll=()=>this.syncAdjustments();connectedCallback(){if(ensureStyleInjected(),this.area.addEventListener(`scroll`,this.onAreaScroll),!this.built){this.built=!0;let e=document.createElement(`div`);e.className=`gsv-stage`,e.append(this.backdrop,this.area),this.append(this.gutter,e)}this.driver.attach(),this.unsubscribe=onAdwaitaColorSchemeChanged(()=>this.session.setColorScheme(adwaitaColorScheme())),this.session.setColorScheme(adwaitaColorScheme())}disconnectedCallback(){this.area.removeEventListener(`scroll`,this.onAreaScroll),this.unsubscribe?.(),this.unsubscribe=null,this.driver.detach()}attributeChangedCallback(e,t,n){let[r,i,a]=Ei[e],o=n===null?i:n===``&&typeof i==`boolean`?!0:a(n,`GtkSource.View.${r}`);this[r]=o}get buffer(){return this.session.buffer}set buffer(e){this.session.buffer=e}get autoIndent(){return this.session.autoIndent}set autoIndent(e){this.session.autoIndent=toBoolean(e,`GtkSource.View.autoIndent`)}get indentWidth(){return this.session.indentWidth}set indentWidth(e){this.session.indentWidth=toNumber(e,`GtkSource.View.indentWidth`)}get showLineNumbers(){return this.session.showLineNumbers}set showLineNumbers(e){this.session.showLineNumbers=toBoolean(e,`GtkSource.View.showLineNumbers`)}get highlightCurrentLine(){return this.session.highlightCurrentLine}set highlightCurrentLine(e){this.session.highlightCurrentLine=toBoolean(e,`GtkSource.View.highlightCurrentLine`)}get monospace(){return this.session.monospace}set monospace(e){this.session.monospace=toBoolean(e,`GtkSource.View.monospace`)}get editable(){return this.session.editable}set editable(e){this.session.editable=toBoolean(e,`GtkSource.View.editable`)}get cursorVisible(){return this.session.cursorVisible}set cursorVisible(e){this.session.cursorVisible=toBoolean(e,`GtkSource.View.cursorVisible`)}get cursor_visible(){return this.cursorVisible}set cursor_visible(e){this.cursorVisible=e}get_cursor_visible(){return this.cursorVisible}set_cursor_visible(e){this.cursorVisible=e}get_editable(){return this.editable}set_editable(e){this.editable=e}get highlight_current_line(){return this.highlightCurrentLine}set highlight_current_line(e){this.highlightCurrentLine=e}get show_line_numbers(){return this.showLineNumbers}set show_line_numbers(e){this.showLineNumbers=e}get vadjustment(){return this.vadj}get hadjustment(){return this.hadj}get_vadjustment(){return this.vadj}get_hadjustment(){return this.hadj}set_direction(e){if(![0,1,2].includes(e))throw TypeError(`${e} is not a valid value for enum argument dir`);this.direction=e,e===0?this.removeAttribute(`dir`):this.dir=e===2?`rtl`:`ltr`}get_direction(){return this.direction}get_first_child(){return null}get_next_sibling(){return this.nextElementSibling}get_parent(){return this.parentElement}get_gutter(e){return this.gutters.get(e)}get leftMargin(){return this.session.leftMargin}set leftMargin(e){this.session.leftMargin=toNumber(e,`GtkSource.View.leftMargin`)}get rightMargin(){return this.session.rightMargin}set rightMargin(e){this.session.rightMargin=toNumber(e,`GtkSource.View.rightMargin`)}get topMargin(){return this.session.topMargin}set topMargin(e){this.session.topMargin=toNumber(e,`GtkSource.View.topMargin`)}get bottomMargin(){return this.session.bottomMargin}set bottomMargin(e){this.session.bottomMargin=toNumber(e,`GtkSource.View.bottomMargin`)}connect(e,t){return this.session.connect(e,((e,...n)=>t(this,...n)))}disconnect(e){this.session.disconnect(e)}get textarea(){return this.area}};customElements.define(`gtk-source-view`,GtkSourceView);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 Oi=[`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&&Oi.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
82
  :root {
9
83
  --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
84
  --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");
@@ -702,7 +776,7 @@ See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document
702
776
  font-size: var(--font-size-base);
703
777
  }
704
778
 
705
- adw-about-dialog, adw-action-row, adw-alert-dialog, adw-alert-response, adw-application-window, adw-avatar, adw-banner, adw-bin, adw-bottom-sheet, adw-bottom-sheet-bottom-bar, adw-bottom-sheet-content, adw-bottom-sheet-sheet, adw-breakpoint-bin, adw-button-content, adw-button-row, adw-card, adw-carousel, adw-carousel-indicator-dots, adw-carousel-indicator-lines, adw-clamp, adw-clamp-scrollable, adw-combo-row, adw-data-grid, adw-dialog, adw-entry-row, adw-expander-row, adw-header-bar, adw-inline-view-switcher, adw-layout-slot, adw-multi-layout-view, adw-navigation-page, adw-navigation-split-view, adw-navigation-view, adw-overlay-split-view, adw-password-entry-row, adw-preferences-dialog, adw-preferences-group, adw-preferences-page, adw-preferences-row, adw-radio, adw-shortcut-label, adw-shortcuts-dialog, adw-shortcuts-item, adw-shortcuts-section, adw-sidebar, adw-sidebar-item, adw-sidebar-section, adw-source-view, adw-spin-row, adw-spinner, adw-split-button, adw-status-page, adw-switch-row, adw-tab-bar, adw-tab-button, adw-tab-overview, adw-tab-page, adw-tab-view, adw-toast-overlay, adw-toggle, adw-toggle-group, adw-toolbar-view, gtk-notebook, adw-view-stack, adw-view-stack-page, adw-view-switcher, adw-view-switcher-bar, adw-view-switcher-page, adw-view-switcher-sidebar, adw-window, adw-window-title, adw-wrap-box, gtk-about-dialog, gtk-action-bar, gtk-application-window, gtk-aspect-frame, gtk-box, gtk-button, gtk-center-box, gtk-calendar, gtk-check-button, gtk-color-dialog-button, gtk-column-view, gtk-drag-icon, gtk-drawing-area, gtk-drop-down, gtk-editable-label, gtk-emoji-chooser, gtk-entry, gtk-expander, gtk-fixed, gtk-flow-box, gtk-flow-box-child, gtk-font-dialog-button, gtk-frame, gtk-gl-area, gtk-graphics-offload, gtk-grid, gtk-grid-view, gtk-header-bar, gtk-image, gtk-inscription, gtk-label, gtk-level-bar, gtk-link-button, gtk-list-box, gtk-list-box-row, gtk-list-view, gtk-media-controls, gtk-menu-button, gtk-overlay, gtk-page-setup-unix-dialog, gtk-paned, gtk-password-entry, gtk-picture, gtk-popover, gtk-popover-bin, gtk-popover-menu, gtk-popover-menu-bar, gtk-print-unix-dialog, gtk-progress-bar, gtk-revealer, gtk-scale, gtk-scale-button, gtk-scrollbar, gtk-scrolled-window, gtk-search-bar, gtk-search-entry, gtk-separator, gtk-spin-button, gtk-spinner, gtk-stack, gtk-stack-sidebar, gtk-stack-switcher, gtk-switch, gtk-text, gtk-text-view, gtk-toggle-button, gtk-tree-expander, gtk-video, gtk-viewport, gtk-window, gtk-window-controls, gtk-window-handle {
779
+ adw-about-dialog, adw-action-row, adw-alert-dialog, adw-alert-response, adw-application-window, adw-avatar, adw-banner, adw-bin, adw-bottom-sheet, adw-bottom-sheet-bottom-bar, adw-bottom-sheet-content, adw-bottom-sheet-sheet, adw-breakpoint-bin, adw-button-content, adw-button-row, adw-card, adw-carousel, adw-carousel-indicator-dots, adw-carousel-indicator-lines, adw-clamp, adw-clamp-scrollable, adw-combo-row, adw-data-grid, adw-dialog, adw-entry-row, adw-expander-row, adw-header-bar, adw-inline-view-switcher, adw-layout-slot, adw-multi-layout-view, adw-navigation-page, adw-navigation-split-view, adw-navigation-view, adw-overlay-split-view, adw-password-entry-row, adw-preferences-dialog, adw-preferences-group, adw-preferences-page, adw-preferences-row, adw-radio, adw-shortcut-label, adw-shortcuts-dialog, adw-shortcuts-item, adw-shortcuts-section, adw-sidebar, adw-sidebar-item, adw-sidebar-section, adw-source-view, adw-spin-row, adw-spinner, adw-split-button, adw-status-page, adw-switch-row, adw-tab-bar, adw-tab-button, adw-tab-overview, adw-tab-page, adw-tab-view, adw-toast-overlay, adw-toggle, adw-toggle-group, adw-toolbar-view, gtk-notebook, adw-view-stack, adw-view-stack-page, adw-view-switcher, adw-view-switcher-bar, adw-view-switcher-page, adw-view-switcher-sidebar, adw-window, adw-window-title, adw-wrap-box, gtk-about-dialog, gtk-action-bar, gtk-application-window, gtk-aspect-frame, gtk-box, gtk-button, gtk-center-box, gtk-calendar, gtk-check-button, gtk-color-dialog-button, gtk-column-view, gtk-drag-icon, gtk-drawing-area, gtk-drop-down, gtk-editable-label, gtk-emoji-chooser, gtk-entry, gtk-expander, gtk-fixed, gtk-flow-box, gtk-flow-box-child, gtk-font-dialog-button, gtk-frame, gtk-gl-area, gtk-graphics-offload, gtk-grid, gtk-grid-view, gtk-header-bar, gtk-image, gtk-inscription, gtk-label, gtk-level-bar, gtk-link-button, gtk-list-box, gtk-list-box-row, gtk-list-view, gtk-media-controls, gtk-menu-button, gtk-overlay, gtk-page-setup-unix-dialog, gtk-paned, gtk-password-entry, gtk-picture, gtk-popover, gtk-popover-bin, gtk-popover-menu, gtk-popover-menu-bar, gtk-print-unix-dialog, gtk-progress-bar, gtk-revealer, gtk-scale, gtk-scale-button, gtk-scrollbar, gtk-scrolled-window, gtk-search-bar, gtk-search-entry, gtk-separator, gtk-source-view, gtk-spin-button, gtk-spinner, gtk-stack, gtk-stack-sidebar, gtk-stack-switcher, gtk-switch, gtk-text, gtk-text-view, gtk-toggle-button, gtk-tree-expander, gtk-video, gtk-viewport, gtk-window, gtk-window-controls, gtk-window-handle {
706
780
  box-sizing: border-box;
707
781
  color: var(--window-fg-color);
708
782
  font-family: var(--font-family);
@@ -719,7 +793,7 @@ adw-about-dialog, adw-action-row, adw-alert-dialog, adw-alert-response, adw-appl
719
793
  text-shadow: none;
720
794
  }
721
795
 
722
- :where(adw-about-dialog, adw-action-row, adw-alert-dialog, adw-alert-response, adw-application-window, adw-avatar, adw-banner, adw-bin, adw-bottom-sheet, adw-bottom-sheet-bottom-bar, adw-bottom-sheet-content, adw-bottom-sheet-sheet, adw-breakpoint-bin, adw-button-content, adw-button-row, adw-card, adw-carousel, adw-carousel-indicator-dots, adw-carousel-indicator-lines, adw-clamp, adw-clamp-scrollable, adw-combo-row, adw-data-grid, adw-dialog, adw-entry-row, adw-expander-row, adw-header-bar, adw-inline-view-switcher, adw-layout-slot, adw-multi-layout-view, adw-navigation-page, adw-navigation-split-view, adw-navigation-view, adw-overlay-split-view, adw-password-entry-row, adw-preferences-dialog, adw-preferences-group, adw-preferences-page, adw-preferences-row, adw-radio, adw-shortcut-label, adw-shortcuts-dialog, adw-shortcuts-item, adw-shortcuts-section, adw-sidebar, adw-sidebar-item, adw-sidebar-section, adw-source-view, adw-spin-row, adw-spinner, adw-split-button, adw-status-page, adw-switch-row, adw-tab-bar, adw-tab-button, adw-tab-overview, adw-tab-page, adw-tab-view, adw-toast-overlay, adw-toggle, adw-toggle-group, adw-toolbar-view, gtk-notebook, adw-view-stack, adw-view-stack-page, adw-view-switcher, adw-view-switcher-bar, adw-view-switcher-page, adw-view-switcher-sidebar, adw-window, adw-window-title, adw-wrap-box, gtk-about-dialog, gtk-action-bar, gtk-application-window, gtk-aspect-frame, gtk-box, gtk-button, gtk-center-box, gtk-calendar, gtk-check-button, gtk-color-dialog-button, gtk-column-view, gtk-drag-icon, gtk-drawing-area, gtk-drop-down, gtk-editable-label, gtk-emoji-chooser, gtk-entry, gtk-expander, gtk-fixed, gtk-flow-box, gtk-flow-box-child, gtk-font-dialog-button, gtk-frame, gtk-gl-area, gtk-graphics-offload, gtk-grid, gtk-grid-view, gtk-header-bar, gtk-image, gtk-inscription, gtk-label, gtk-level-bar, gtk-link-button, gtk-list-box, gtk-list-box-row, gtk-list-view, gtk-media-controls, gtk-menu-button, gtk-overlay, gtk-page-setup-unix-dialog, gtk-paned, gtk-password-entry, gtk-picture, gtk-popover, gtk-popover-bin, gtk-popover-menu, gtk-popover-menu-bar, gtk-print-unix-dialog, gtk-progress-bar, gtk-revealer, gtk-scale, gtk-scale-button, gtk-scrollbar, gtk-scrolled-window, gtk-search-bar, gtk-search-entry, gtk-separator, gtk-spin-button, gtk-spinner, gtk-stack, gtk-stack-sidebar, gtk-stack-switcher, gtk-switch, gtk-text, gtk-text-view, gtk-toggle-button, gtk-tree-expander, gtk-video, gtk-viewport, gtk-window, gtk-window-controls, gtk-window-handle) :is(gtk-box, gtk-label, adw-button-content) {
796
+ :where(adw-about-dialog, adw-action-row, adw-alert-dialog, adw-alert-response, adw-application-window, adw-avatar, adw-banner, adw-bin, adw-bottom-sheet, adw-bottom-sheet-bottom-bar, adw-bottom-sheet-content, adw-bottom-sheet-sheet, adw-breakpoint-bin, adw-button-content, adw-button-row, adw-card, adw-carousel, adw-carousel-indicator-dots, adw-carousel-indicator-lines, adw-clamp, adw-clamp-scrollable, adw-combo-row, adw-data-grid, adw-dialog, adw-entry-row, adw-expander-row, adw-header-bar, adw-inline-view-switcher, adw-layout-slot, adw-multi-layout-view, adw-navigation-page, adw-navigation-split-view, adw-navigation-view, adw-overlay-split-view, adw-password-entry-row, adw-preferences-dialog, adw-preferences-group, adw-preferences-page, adw-preferences-row, adw-radio, adw-shortcut-label, adw-shortcuts-dialog, adw-shortcuts-item, adw-shortcuts-section, adw-sidebar, adw-sidebar-item, adw-sidebar-section, adw-source-view, adw-spin-row, adw-spinner, adw-split-button, adw-status-page, adw-switch-row, adw-tab-bar, adw-tab-button, adw-tab-overview, adw-tab-page, adw-tab-view, adw-toast-overlay, adw-toggle, adw-toggle-group, adw-toolbar-view, gtk-notebook, adw-view-stack, adw-view-stack-page, adw-view-switcher, adw-view-switcher-bar, adw-view-switcher-page, adw-view-switcher-sidebar, adw-window, adw-window-title, adw-wrap-box, gtk-about-dialog, gtk-action-bar, gtk-application-window, gtk-aspect-frame, gtk-box, gtk-button, gtk-center-box, gtk-calendar, gtk-check-button, gtk-color-dialog-button, gtk-column-view, gtk-drag-icon, gtk-drawing-area, gtk-drop-down, gtk-editable-label, gtk-emoji-chooser, gtk-entry, gtk-expander, gtk-fixed, gtk-flow-box, gtk-flow-box-child, gtk-font-dialog-button, gtk-frame, gtk-gl-area, gtk-graphics-offload, gtk-grid, gtk-grid-view, gtk-header-bar, gtk-image, gtk-inscription, gtk-label, gtk-level-bar, gtk-link-button, gtk-list-box, gtk-list-box-row, gtk-list-view, gtk-media-controls, gtk-menu-button, gtk-overlay, gtk-page-setup-unix-dialog, gtk-paned, gtk-password-entry, gtk-picture, gtk-popover, gtk-popover-bin, gtk-popover-menu, gtk-popover-menu-bar, gtk-print-unix-dialog, gtk-progress-bar, gtk-revealer, gtk-scale, gtk-scale-button, gtk-scrollbar, gtk-scrolled-window, gtk-search-bar, gtk-search-entry, gtk-separator, gtk-source-view, gtk-spin-button, gtk-spinner, gtk-stack, gtk-stack-sidebar, gtk-stack-switcher, gtk-switch, gtk-text, gtk-text-view, gtk-toggle-button, gtk-tree-expander, gtk-video, gtk-viewport, gtk-window, gtk-window-controls, gtk-window-handle) :is(gtk-box, gtk-label, adw-button-content) {
723
797
  color: inherit;
724
798
  font-family: inherit;
725
799
  font-size: inherit;
@@ -1507,6 +1581,12 @@ gtk-separator *::after {
1507
1581
  box-sizing: border-box;
1508
1582
  }
1509
1583
 
1584
+ gtk-source-view *,
1585
+ gtk-source-view *::before,
1586
+ gtk-source-view *::after {
1587
+ box-sizing: border-box;
1588
+ }
1589
+
1510
1590
  gtk-spin-button *,
1511
1591
  gtk-spin-button *::before,
1512
1592
  gtk-spin-button *::after {
@@ -10535,7 +10615,7 @@ gtk-box[orientation=vertical] > [vexpand=false] {
10535
10615
 
10536
10616
  [hidden] {
10537
10617
  display: none !important;
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=`
10618
+ }`,document.head.appendChild(e)}followDesktopAppearance();const ki={system:`Follow system`,light:`Light`,dark:`Dark`},Ai={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,ki[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,Ai[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 ji=!1;function injectStorybookStyles(){if(ji||typeof document>`u`)return;if(document.getElementById(`adwaita-storybook-style`)){ji=!0;return}let e=document.createElement(`style`);e.id=`adwaita-storybook-style`,e.textContent=`
10539
10619
  /* Appearance dialog — round swatches with a selection ring. The web twin of the GTK
10540
10620
  renderer's rules, themselves adapted from Learn6502.
10541
10621
 
@@ -10874,7 +10954,7 @@ gtk-box[orientation=vertical] > [vexpand=false] {
10874
10954
  background: none;
10875
10955
  cursor: pointer;
10876
10956
  }
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,`
10957
+ `,document.head.appendChild(e),ji=!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 Mi=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Ni=[`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},Pi=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],Fi={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 Ii={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return Fi}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([...Ni]),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 Mi)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 Pi){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)}}]},Li={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`}]},Ri={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return Li}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$/,``)))}}]},zi={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}]},Bi={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return zi}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))}}]},Vi=[14,25],Hi={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}]},Ui={stories:[class CalendarWebStory extends StoryElement{_calendar=null;_marked=!1;constructor(){super(CalendarWebStory.getMetadata(),`Default`)}static getMetadata(){return Hi}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 Vi)e.markDay(t);this._marked=!0}}]},Wi=[{value:`de`,label:`German`},{value:`fr`,label:`French`},{value:`nl`,label:`Dutch`},{value:`pt`,label:`Portuguese`}],Gi={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}]},Ki={stories:[class ColumnViewWebStory extends StoryElement{_view=null;constructor(){super(ColumnViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Gi}initialize(){this._view=document.createElement(`gtk-column-view`),this._view.setAttribute(`model`,JSON.stringify(Wi)),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))}}]},qi=[`Red`,`Orange`,`Yellow`,`Green`,`Blue`,`Purple`,`Teal`,`Grey`],Ji={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}]},Yi={stories:[class FlowBoxWebStory extends StoryElement{_box=null;constructor(){super(FlowBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Ji}initialize(){this._box=document.createElement(`gtk-flow-box`),this._box.style.width=`100%`;for(let e of qi){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)))))}}]},Xi=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Zi=[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`None`,value:`none`}],Qi={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:Zi,defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`singleClickActivate`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!1}]},$i=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`],ea={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:Zi,defaultValue:`single`}]},ta={stories:[class GridViewWebStory extends StoryElement{_view=null;constructor(){super(GridViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ea}initialize(){this._view=document.createElement(`gtk-grid-view`),this._view.setAttribute(`model`,JSON.stringify($i)),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)}}]},na=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],ra={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`}]},ia={stories:[class ListBoxWebStory extends StoryElement{_box=null;constructor(){super(ListBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return ra}initialize(){this._box=document.createElement(`gtk-list-box`),this._box.style.width=`100%`;for(let e of na){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))}}]},aa={stories:[class ListViewWebStory extends StoryElement{_view=null;constructor(){super(ListViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Qi}initialize(){this._view=document.createElement(`gtk-list-view`),this._view.setAttribute(`model`,JSON.stringify(Xi)),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))}}]},oa=[{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:``}],sa={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`}]},ca={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`}]},la={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return sa}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 ca}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 oa){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)}}]},ua={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}]},da={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return ua}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))}}]},fa={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.`}]},pa={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return fa}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))}}]},ma={Pictures:[`Holiday`,`Screenshots`],Music:[`Albums`],Notes:[]},ha={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}]},ga=Object.entries(ma).flatMap(([e,t])=>[{label:e,depth:0,expandable:t.length>0},...t.map(e=>({label:e,depth:1,expandable:!1}))]),_a={stories:[class TreeExpanderWebStory extends StoryElement{_expanders=[];constructor(){super(TreeExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return ha}initialize(){let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`);for(let t of ga){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)),ga[n].depth>0&&(t.hidden=!e)})}}]},va={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`}]},ya={stories:[class WindowHandleWebStory extends StoryElement{_handle=null;constructor(){super(WindowHandleWebStory.getMetadata(),`Default`)}static getMetadata(){return va}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)}}]},ba={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`}]},xa={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return ba}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))}}]},Sa={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 Ca={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Sa}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))}}]},wa={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`}]},Ta=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const Ea={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return wa}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 Ta)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},Da=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Oa={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}]},ka={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Oa}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`model`,JSON.stringify([...Da])),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)))}}]},Aa={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}]},ja={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Aa}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))}}]},Ma={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}]},Na={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ma}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))}}]},Pa={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`}]},Fa={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Pa}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))}}]},Ia={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.`}]},La=[`Europe`,`Americas`,`Asia`,`Oceania`],Ra={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return Ia}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(La)),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))}}]},za={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}]},Ba={stories:[class PreferencesRowWebStory extends StoryElement{_row=null;constructor(){super(PreferencesRowWebStory.getMetadata(),`Default`)}static getMetadata(){return za}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))}}]},Va={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}]},Ha={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Va}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))}}]},Ua={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}]},Wa={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ua}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))}}]},Ga={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`}]},Ka={stories:[class DragIconWebStory extends StoryElement{_row=null;_hint=null;constructor(){super(DragIconWebStory.getMetadata(),`Default`)}static getMetadata(){return Ga}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&&Yn.getForDrag(e).setChild(Yn.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>`)}}]},qa={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`}]},Ja={stories:[class DrawingAreaWebStory extends StoryElement{_area=null;constructor(){super(DrawingAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return qa}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)))}}]},Ya={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}]},Xa={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 Ya}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,`
10878
10958
  attribute vec2 position;
10879
10959
  uniform float angle;
10880
10960
  void main () {
@@ -10885,8 +10965,8 @@ void main () {
10885
10965
  0.0, 1.0);
10886
10966
  }`),r=compile(e.FRAGMENT_SHADER,`
10887
10967
  precision mediump float;
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
10968
+ 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`)}}]},Za={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`}]},Qa={stories:[class GraphicsOffloadWebStory extends StoryElement{_offload=null;constructor(){super(GraphicsOffloadWebStory.getMetadata(),`Default`)}static getMetadata(){return Za}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)}}]},$a={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}]},eo={stories:[class CheckButtonWebStory extends StoryElement{_button=null;constructor(){super(CheckButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return $a}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))}}]},to=[`Automatic`,`Always`,`Never`,`When busy`],no={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:to.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},ro={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return no}initialize(){this._dropDown=document.createElement(`gtk-drop-down`),this._dropDown.setAttribute(`model`,JSON.stringify(to)),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`))}}]},io={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}]},ao={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return io}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`,``))}}]},oo={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}]},so={stories:[class GtkSpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(GtkSpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return oo}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)}}]},co={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}]},lo={stories:[class LevelBarWebStory extends StoryElement{_bar=null;constructor(){super(LevelBarWebStory.getMetadata(),`Default`)}static getMetadata(){return co}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)}}]},uo={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}]},fo={stories:[class PasswordEntryWebStory extends StoryElement{_entry=null;constructor(){super(PasswordEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return uo}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))}}]},po={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}]},mo={stories:[class ProgressBarWebStory extends StoryElement{_bar=null;constructor(){super(ProgressBarWebStory.getMetadata(),`Default`)}static getMetadata(){return po}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))}}]},ho={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}]},_o={stories:[class ScaleWebStory extends StoryElement{_scale=null;constructor(){super(ScaleWebStory.getMetadata(),`Default`)}static getMetadata(){return ho}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)))}}]},vo={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}]},yo={stories:[class SearchEntryWebStory extends StoryElement{_entry=null;_label=null;constructor(){super(SearchEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return vo}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))}}]},bo={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}]},xo={stories:[class SpinButtonWebStory extends StoryElement{_spin=null;constructor(){super(SpinButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return bo}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)))}}]},So={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}]},Co={stories:[class SwitchWebStory extends StoryElement{_switch=null;constructor(){super(SwitchWebStory.getMetadata(),`Default`)}static getMetadata(){return So}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))}}]},wo={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}]},To={stories:[class ExpanderWebStory extends StoryElement{_expander=null;constructor(){super(ExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return wo}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))}}]},Eo={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}]},Do={stories:[class OverlayWebStory extends StoryElement{_overlay=null;_badge=null;constructor(){super(OverlayWebStory.getMetadata(),`Default`)}static getMetadata(){return Eo}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}}]},Oo={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 ko={stories:[class PanedWebStory extends StoryElement{_paned=null;constructor(){super(PanedWebStory.getMetadata(),`Default`)}static getMetadata(){return Oo}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)))}}]},Ao={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}]},jo={stories:[class RevealerWebStory extends StoryElement{_revealer=null;constructor(){super(RevealerWebStory.getMetadata(),`Default`)}static getMetadata(){return Ao}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))}}]},Mo={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}]},No={stories:[class ScrollbarWebStory extends StoryElement{_scrollbar=null;constructor(){super(ScrollbarWebStory.getMetadata(),`Default`)}static getMetadata(){return Mo}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)})}}]},Po={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}]},Fo={stories:[class ScrolledWindowWebStory extends StoryElement{_window=null;constructor(){super(ScrolledWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Po}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))}}]},Io={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}]},Lo={stories:[class SeparatorWebStory extends StoryElement{_box=null;_separator=null;constructor(){super(SeparatorWebStory.getMetadata(),`Default`)}static getMetadata(){return Io}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)}}]},Ro={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`}]},zo={stories:[class BreakpointBinWebStory extends StoryElement{_bin=null;_label=null;constructor(){super(BreakpointBinWebStory.getMetadata(),`Default`)}static getMetadata(){return Ro}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}]}])))}}]},Bo={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}]},Vo={stories:[class LayoutSlotWebStory extends StoryElement{_view=null;_child=null;constructor(){super(LayoutSlotWebStory.getMetadata(),`Default`)}static getMetadata(){return Bo}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))}}]},Ho={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}]},Uo=`primary`,Wo=`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`,Wo],[`content`,Uo]]){let r=document.createElement(`adw-layout-slot`);r.setAttribute(`id`,n),r.setAttribute(`slot`,e),t.appendChild(r)}return t}var Go=class MultiLayoutViewWebStory extends StoryElement{_view=null;_details=null;constructor(){super(MultiLayoutViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ho}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`,Uo),this._details=page(`Message`),this._details.setAttribute(`slot`,Wo),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 Ko={stories:[Go]},qo={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}]},Jo={stories:[class EditableLabelWebStory extends StoryElement{_label=null;constructor(){super(EditableLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return qo}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)}}]},Yo={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}]},Xo={stories:[class SearchBarWebStory extends StoryElement{_bar=null;constructor(){super(SearchBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Yo}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)}}]},Zo={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.
10969
+ 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}]},Qo={stories:[class TextViewWebStory extends StoryElement{_view=null;constructor(){super(TextViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Zo}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))}}]},$o={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}]},es={stories:[class TextWebStory extends StoryElement{_text=null;constructor(){super(TextWebStory.getMetadata(),`Default`)}static getMetadata(){return $o}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}}]},ts={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}]},ns={stories:[class AspectFrameWebStory extends StoryElement{_frame=null;constructor(){super(AspectFrameWebStory.getMetadata(),`Default`)}static getMetadata(){return ts}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)))}}]},rs={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`}]},is={stories:[class CenterBoxWebStory extends StoryElement{_box=null;constructor(){super(CenterBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return rs}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))}}]},as={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}]},os={stories:[class FixedWebStory extends StoryElement{_fixed=null;_cells=[];constructor(){super(FixedWebStory.getMetadata(),`Default`)}static getMetadata(){return as}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)}}]},ss={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}]},cs={stories:[class FrameWebStory extends StoryElement{_frame=null;constructor(){super(FrameWebStory.getMetadata(),`Default`)}static getMetadata(){return ss}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))}}]},ls={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`}]},us={stories:[class GridWebStory extends StoryElement{_grid=null;constructor(){super(GridWebStory.getMetadata(),`Default`)}static getMetadata(){return ls}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))}}]},ds={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}]},fs={stories:[class ToggleButtonWebStory extends StoryElement{_button=null;constructor(){super(ToggleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ds}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))}}]},ps={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`}]},ms={stories:[class ColorDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(ColorDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ps}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}}}]},hs={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}]},gs={stories:[class FontDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(FontDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return hs}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))}}]},_s={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}]},vs={stories:[class LinkButtonWebStory extends StoryElement{_button=null;constructor(){super(LinkButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return _s}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))}}]},ys=[`audio-volume-muted-symbolic`,`audio-volume-low-symbolic`,`audio-volume-high-symbolic`],bs={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}]},xs={stories:[class ScaleButtonWebStory extends StoryElement{_button=null;constructor(){super(ScaleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return bs}initialize(){this._button=document.createElement(`gtk-scale-button`),this._button.setAttribute(`icons`,JSON.stringify(ys)),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)))}}]},Ss={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 Cs={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Ss}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`))}}]},ws={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`}]},Ts=[`pill`,`circular`,`suggested`,`destructive`,`flat`],Es={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 Ds={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return ws}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 Ts)this._demo.removeAttribute(e);let t=Es[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))}}]},Os=[`Save as…`,`Export`,`Print`],ks={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`}]},As={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return ks}initialize(){this._widget=document.createElement(`gtk-menu-button`),this._widget.setAttribute(`menu-model`,JSON.stringify(Os.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))}}]},js={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`}]},Ms={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`}]},Ns=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`,Ns),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 Ps={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return js}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return Ms}}]},Fs={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`}]},Is=[`flat`,`round`],Ls=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],Rs={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return Fs}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of Ls){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 Is)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},zs={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}]},Bs={stories:[class BinWebStory extends StoryElement{_bin=null;constructor(){super(BinWebStory.getMetadata(),`Default`)}static getMetadata(){return zs}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}}]},Vs={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}]},Hs=Array.from({length:24},(e,t)=>`Line ${t+1}: held at the clamp's width while it scrolls.`),Us={stories:[class ClampScrollableWebStory extends StoryElement{_clamp=null;constructor(){super(ClampScrollableWebStory.getMetadata(),`Default`)}static getMetadata(){return Vs}initialize(){let e=document.createElement(`div`);e.style.padding=`12px 0`;for(let t of Hs){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)))}}]},Ws={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}]},Gs={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return Ws}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)))}}]},Ks={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}]},qs={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ks}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)}}]},Js=[{label:`Cut`},{label:`Copy`},{label:`Paste`},{label:`Delete`,accel:`<Shift>Delete`}],Ys={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}]},Xs={stories:[class PopoverBinWebStory extends StoryElement{_bin;constructor(){super(PopoverBinWebStory.getMetadata(),`Default`)}static getMetadata(){return Ys}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(Js)),this._bin.setAttribute(`handle-input`,String(this.args.handleInput)))}}]},Zs=[{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`}]}],Qs={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}]},$s={stories:[class PopoverMenuWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverMenuWebStory.getMetadata(),`Default`)}static getMetadata(){return Qs}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(Zs)),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))}}]},ec={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}]},tc={stories:[class PopoverWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverWebStory.getMetadata(),`Default`)}static getMetadata(){return ec}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)))}}]},nc={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}]},rc={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return nc}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)}}]},ic={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}]},ac={stories:[class ViewportWebStory extends StoryElement{_viewport=null;constructor(){super(ViewportWebStory.getMetadata(),`Default`)}static getMetadata(){return ic}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))}}]},oc={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}]},sc=[{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`}]}],cc={stories:[class ApplicationWindowWebStory extends StoryElement{_window=null;_title=null;constructor(){super(ApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return oc}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(sc)),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))}}]},lc={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`}]},uc={stories:[class WindowWebStory extends StoryElement{_title=null;constructor(){super(WindowWebStory.getMetadata(),`Default`)}static getMetadata(){return lc}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))}}]},dc={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}]},fc=[`Design`,`Adwaita`,`GNOME`,`GTK`,`TypeScript`,`Storybook`,`Wrapping`,`Layout`],pc={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return dc}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of fc){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)))}}]},mc=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],hc={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:mc},gc={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:mc},_c=[{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 vc=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-${vc++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of _c)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 yc={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return hc}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return gc}indicatorTag(){return`adw-carousel-indicator-lines`}}]},bc={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`}]},xc=[{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.`}],Sc={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return bc}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of xc){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)}}]},Cc=[{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".`}],wc={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}]},Tc={stories:[class NotebookWebStory extends StoryElement{_notebook=null;constructor(){super(NotebookWebStory.getMetadata(),`Default`)}static getMetadata(){return wc}initialize(){let e=document.createElement(`gtk-notebook`);e.style.cssText=`width:480px;height:320px;`;for(let t of Cc){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))}}]},Ec=[{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.`}],Dc={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`}]},Oc={stories:[class StackSidebarWebStory extends StoryElement{_stack=null;constructor(){super(StackSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Dc}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-sidebar-demo`,e.style.flex=`1`;for(let t of Ec){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)}}]},kc=[{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.`}],Ac={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`}]},jc={stories:[class StackSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(StackSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Ac}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-switcher-demo`,e.style.flex=`1`;for(let t of kc){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)}}]},Mc=[{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.`}],Nc={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}]},Pc={stories:[class StackWebStory extends StoryElement{_stack=null;constructor(){super(StackWebStory.getMetadata(),`Default`)}static getMetadata(){return Nc}initialize(){let e=document.createElement(`gtk-stack`);e.style.flex=`1`;for(let t of Mc){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`))}}]},Fc={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}]},Ic=[{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.`}],Lc={stories:[class TabBarWebStory extends StoryElement{_bar=null;_view=null;_startAction=null;_endAction=null;constructor(){super(TabBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Fc}initialize(){let e=document.createElement(`adw-tab-view`);e.style.flex=`1`;for(let t of Ic){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)}}]},Rc={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}]},zc={stories:[class TabButtonWebStory extends StoryElement{_view=null;_serial=0;constructor(){super(TabButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Rc}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)})}}]},Bc={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}]},Vc=[{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.`}],Hc={stories:[class TabOverviewWebStory extends StoryElement{_overview=null;_view=null;constructor(){super(TabOverviewWebStory.getMetadata(),`Default`)}static getMetadata(){return Bc}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let[t,n]of Vc.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))}}]},Uc=[{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`}],Wc={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}]},Gc={stories:[class ViewSwitcherSidebarWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Wc}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of Uc){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`)}}]},Kc={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}]},qc=[{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.`}],Jc={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Kc}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of qc){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`))}}]},Yc={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`}]},Xc=[{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.`}],Zc={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Yc}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of Xc){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)}}]},Qc=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],$c={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}]},tl={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return $c}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of Qc){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)}}]},nl={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 rl={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return nl}_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`))}}]},il={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 al={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return il}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))}}]},ol={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}]},sl={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ol}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)}}]},cl={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}]},ll=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],ul={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return cl}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of ll){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))}}]},dl=[{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`}]}],fl={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}]},pl={stories:[class PopoverMenuBarWebStory extends StoryElement{_bar;constructor(){super(PopoverMenuBarWebStory.getMetadata(),`Default`)}static getMetadata(){return fl}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?dl.slice(0,3):dl;this._bar.setAttribute(`menu-model`,JSON.stringify(e));for(let e of this._bar.querySelectorAll(`gtk-popover-menu`))e.setAttribute(`position`,this.args.position)}}]},ml={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}]},hl={stories:[class ImageWebStory extends StoryElement{_image=null;constructor(){super(ImageWebStory.getMetadata(),`Default`)}static getMetadata(){return ml}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))}}]},gl={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}]},_l={stories:[class InscriptionWebStory extends StoryElement{_inscription=null;_frame=null;constructor(){super(InscriptionWebStory.getMetadata(),`Default`)}static getMetadata(){return gl}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)))}}]},vl={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}]},yl={stories:[class MediaControlsWebStory extends StoryElement{_video=null;_controls=null;_media=null;constructor(){super(MediaControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return vl}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)}}]},bl={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}]},xl={stories:[class PictureWebStory extends StoryElement{_picture=null;constructor(){super(PictureWebStory.getMetadata(),`Default`)}static getMetadata(){return bl}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)}}]},Sl={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}]},Cl={stories:[class VideoWebStory extends StoryElement{_video=null;_media=null;constructor(){super(VideoWebStory.getMetadata(),`Default`)}static getMetadata(){return Sl}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()}}]},wl={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}]},Tl={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 wl}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)}}]},El={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`}]},Dl={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return El}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}}]},Ol={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.`}]},kl={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Ol}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){}}]},Al={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`}]},jl={stories:[class DialogWebStory extends StoryElement{constructor(){super(DialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Al}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){}}]},Ml={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 Nl={stories:[class EmojiChooserWebStory extends StoryElement{_entry=null;_button=null;_chooser=null;constructor(){super(EmojiChooserWebStory.getMetadata(),`Default`)}static getMetadata(){return Ml}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}}]},Pl={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}]},Fl={stories:[class GtkAboutDialogWebStory extends StoryElement{_dialog=null;_button=null;constructor(){super(GtkAboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Pl}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
10890
10970
  glibc 2.42
10891
10971
  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
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});
10972
+ 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}}]},Il={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 Ll={stories:[class PageSetupUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PageSetupUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Il}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}}]},Rl={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}]},zl=[{name:`Office Laser`,location:`Building A, floor 2`,acceptsJobs:!0},{name:`Lobby Printer`,location:`Building A, ground floor`,acceptsJobs:!1}],Bl={top:6.35,bottom:14.224,left:6.35,right:6.35},Vl={stories:[class PrintUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PrintUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Rl}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:Bl},e.printSettings={copies:String(this.args.copies??1),collate:`0`,reverse:`0`},e.printers=zl,e.present())}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},Hl={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`}]},Ul={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Hl}_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}}]},Wl={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 Gl={stories:[class ShortcutsDialogWebStory extends StoryElement{constructor(){super(ShortcutsDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Wl}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){}}]},Kl={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`}]},ql={stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return Kl}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){}}]},Jl={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`}]},Yl={stories:[class ActionBarWebStory extends StoryElement{_bar=null;constructor(){super(ActionBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Jl}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()}}]},Xl={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}]},Zl={stories:[class GtkApplicationWindowWebStory extends StoryElement{_window=null;_menubar=null;constructor(){super(GtkApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Xl}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()}}]},Ql={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`}]},$l={stories:[class GtkHeaderBarWebStory extends StoryElement{_bar=null;_titleLabel=null;constructor(){super(GtkHeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ql}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()}}]},eu={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}]},tu={stories:[class GtkWindowWebStory extends StoryElement{_window=null;_bar=null;constructor(){super(GtkWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return eu}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)))}}]},nu={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}]},ru=[Ii,Ri,Bi,Ui,Ki,Yi,ta,ia,aa,la,da,pa,_a,xa,Ca,Ea,ka,ja,Na,Fa,Ra,Ba,Ha,Wa,ao,ro,_o,xo,fo,yo,eo,Co,mo,lo,so,Ka,Ja,Xa,Qa,Cs,Ds,As,Ps,fs,ms,gs,vs,xs,Rs,Bs,Us,Gs,qs,To,Do,ko,tc,$s,Xs,jo,No,Fo,Lo,zo,Vo,Ko,Jo,es,Qo,Xo,cs,ns,is,us,os,rc,ac,cc,uc,pc,yc,Sc,Pc,jc,Oc,Tc,Lc,zc,Hc,Gc,Jc,Zc,tl,rl,al,sl,ul,pl,Tl,hl,_l,xl,Cl,yl,Dl,kl,jl,Nl,Fl,Ll,Ul,Vl,Gl,ql,$l,{stories:[class WindowControlsWebStory extends StoryElement{_window=null;_controls=null;constructor(){super(WindowControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return nu}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)))}}]},Yl,tu,Zl,ya];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:ru});