@gjsify/example-gtk-adwaita-storybook 0.64.3-next.263 → 0.64.4
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.
- package/dist/browser-main.js +23 -18
- package/package.json +6 -7
package/dist/browser-main.js
CHANGED
|
@@ -13,12 +13,17 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
|
|
|
13
13
|
`)&&(n=` `),n===`\r`&&(n=r?` `:`
|
|
14
14
|
`,t[e+1]===`
|
|
15
15
|
`&&e++),t[e]!==`&`){i+=n;continue}if(e++,t[e]===`#`){e++;let n=10;t[e]===`x`&&(n=16,e++);let r=strtoul(t,e,n);r.end===e||r.isOverflow?fail(e,`Failed to parse “${t.slice(e,r.end)}”, which should have been a digit inside a character reference (ê for example) — perhaps the digit is too large`):t[r.end]===`;`?isPermittedCharacter(r.value)||fail(e,`Character reference “${t.slice(e,r.end)}” does not encode a permitted character`):fail(e,`Character reference did not end with a semicolon; ${dn}`),i+=String.fromCodePoint(Number(r.value)),e=r.end;continue}let a=fn.find(([n])=>t.startsWith(n,e));if(a!==void 0){i+=a[1],e+=a[0].length-1;continue}t[e]===`;`&&fail(e,`Empty entity “&;” seen; valid entities are: & " < > '`);let o=t.indexOf(`;`,e);o>=0&&fail(e,`Entity name “${t.slice(e,o)}” is not known`),fail(e,`Entity did not end with a semicolon; ${dn}`)}return i}function parseMarkup$1(e,t){try{return scan(e,t),null}catch(t){if(!(t instanceof MarkupFailure))throw t;return{message:t.message,...markupPosition(e,t.at)}}}__name(parseMarkup$1,`parseMarkup`);function scan(e,t){let n=e.length,r=[],i=0,a=0,o=0,s=!0,c=[],l=``,u=``,d=`"`,f=0,p=0,top=()=>r[r.length-1]??``,at=t=>String.fromCodePoint(e.codePointAt(t)),fail=t=>{let n=markupPosition(e,a);throw new MarkupFailure(`Error on line ${n.line} char ${n.character}: ${t}`,a)},skipSpaces=()=>{for(;a<n&&isXmlSpace(e[a]);)a++},nameEnd=()=>{for(;a<n&&!isNameEnd(e[a])&&!isXmlSpace(e[a]);)a++},emitStart=()=>{let e=nameError(top());e!==null&&fail(e);let n=t.start(top(),c);if(n!==null)throw new MarkupFailure(n,a)},emitEnd=()=>{t.end(r.pop())};for(;a<n;)switch(i){case 0:if(skipSpaces(),a===n)break;e[a]!==`<`&&fail(`Document must begin with an element (e.g. <book>)`),a++,i=1,s=!1;break;case 1:e[a]===`?`||e[a]===`!`?(f=a-1,p=1,i=14):e[a]===`/`?(a++,i=11):isNameEnd(e[a])?fail(`“${at(a)}” is not a valid character following a “<” character; it may not begin an element name`):(o=a,i=4);break;case 4:if(nameEnd(),a===n)break;r.push(e.slice(o,a)),c=[],i=7;break;case 7:if(skipSpaces(),a===n)break;e[a]===`/`?(a++,i=3,emitStart()):e[a]===`>`?(a++,i=2,emitStart()):e[a]===`=`?fail(`Odd character “=”, expected a “>” or “/” character to end the start tag of element “${top()}”, or optionally an attribute; perhaps you used an invalid character in an attribute name`):(o=a,i=5);break;case 5:if(nameEnd(),a===n)break;l=e.slice(o,a),i=6;break;case 6:{if(skipSpaces(),a===n)break;let t=nameError(l);t!==null&&fail(t),c.push(l),e[a]!==`=`&&fail(`Odd character “${at(a)}”, expected a “=” after attribute name “${l}” of element “${top()}”`),a++,i=8;break}case 8:if(skipSpaces(),a===n)break;e[a]!==`"`&&e[a]!==`'`&&fail(`Odd character “${at(a)}”, expected an open quote mark after the equals sign when giving value for attribute “${l}” of element “${top()}”`),d=e[a],a++,o=a,i=9;break;case 9:{let t=e.indexOf(d,a);if(t<0){a=n;break}a=t,unescape(e,e.slice(o,t),t,!0),a++,i=7;break}case 3:e[a]!==`>`&&fail(`Odd character “${at(a)}”, expected a “>” character to end the empty-element tag “${top()}”`),a++,i=2,emitEnd();break;case 2:r.length===0?i=0:(o=a,i=10);break;case 10:{let r=e.indexOf(`<`,a);if(r<0){a=n;break}a=r;let s=e.slice(o,r);s.length>0&&t.text(unescape(e,s,r,!1),top()),a++,i=1;break}case 11:isNameEnd(e[a])&&fail(`“${at(a)}” is not a valid character following the characters “</”; “${at(a)}” may not begin an element name`),o=a,i=12;break;case 12:if(nameEnd(),a===n)break;u=e.slice(o,a),i=13;break;case 13:if(skipSpaces(),a===n)break;e[a]!==`>`&&fail(`“${at(a)}” is not a valid character following the close element name “${u}”; the allowed character is “>”`),r.length===0&&fail(`Element “${u}” was closed, no element is currently open`),u!==top()&&fail(`Element “${u}” was closed, but the currently open element is “${top()}”`),a++,i=2,emitEnd();break;case 14:for(;a<n;a++){if(e[a]===`<`&&p++,e[a]!==`>`)continue;p--;let t=e.slice(f,a);if(t[1]===`?`&&t.endsWith(`?`)||t.startsWith(`<!--`)&&t.endsWith(`--`)||t.startsWith(`<![CDATA[`)&&t.endsWith(`]]`)||t.startsWith(`<!DOCTYPE`)&&p===0)break}if(a===n)break;a++,i=2;break}s&&fail(`Document was empty or contained only whitespace`);let m=r.length===0;switch(i){case 1:fail(`Document ended unexpectedly just after an open angle bracket “<”`);break;case 2:case 10:m||fail(`Document ended unexpectedly with elements still open — “${top()}” was the last element opened`);break;case 3:fail(`Document ended unexpectedly, expected to see a close angle bracket ending the tag <${top()}/>`);break;case 4:fail(`Document ended unexpectedly inside an element name`);break;case 5:case 6:fail(`Document ended unexpectedly inside an attribute name`);break;case 7:fail(`Document ended unexpectedly inside an element-opening tag.`);break;case 8:fail(`Document ended unexpectedly after the equals sign following an attribute name; no attribute value`);break;case 9:fail(`Document ended unexpectedly while inside an attribute value`);break;case 11:case 12:case 13:fail(m?`Document ended unexpectedly inside the close tag for an unopened element`:`Document ended unexpectedly inside the close tag for element “${top()}”`);break;case 14:fail(`Document ended unexpectedly inside a comment or processing instruction`);break;case 0:break}}const P={NORMAL:0,HIGH:1},pn=new WeakMap;var Toast=class extends GObjectObject$1{static{this[x]=`Adw.Toast`}get_title(){return this.title}set_title(e){this.title=e}get_timeout(){return this.timeout}set_timeout(e){this.timeout=e}get_priority(){return this.priority}set_priority(e){this.priority=e}get_button_label(){return this.button_label}set_button_label(e){this.button_label=e}get_action_name(){return this.action_name}set_action_name(e){this.action_name=e}get_use_markup(){return this.use_markup}set_use_markup(e){this.use_markup=e}dismiss(){pn.has(this)&&this.emit(`dismissed`)}};registerBaseClass(Toast,`AdwToast`,{"button-clicked":[],dismissed:[]},[g.string(`title`,``,``,m.READWRITE,``),g.uint(`timeout`,``,``,m.READWRITE,0,4294967295,5),g.int(`priority`,``,``,m.READWRITE,P.NORMAL,P.HIGH,P.NORMAL),g.string(`button-label`,``,``,m.READWRITE,null),g.string(`action-name`,``,``,m.READWRITE,null),g.boolean(`use-markup`,``,``,m.READWRITE,!0)]);var ToastOverlayQueue=class{constructor(e){this._queue=[],this._handlers=new Map,this._current=null,this._timer=null,this._options=e}get current(){return this._current}get pending(){return this._queue.length}add_toast(e){let t=pn.get(e);if(t===this){this._current===e?this._startTimer(e):this._bump(e);return}if(t!==void 0)throw Error(`Adding toast '${e.title}', but it has already been added to a different AdwToastOverlay`);if(pn.set(e,this),this._handlers.set(e,e.connect(`dismissed`,()=>this._dismissed(e))),this._current===null)this._show(e);else if(e.priority===P.HIGH){let t=this._current;this._queue.unshift(t),this._hideCurrent(),this._show(e)}else this._queue.push(e)}dismiss_all(){for(let e of this._queue.splice(0))this._disconnect(e),e.dismiss(),pn.delete(e);this._current?.dismiss()}_dismissed(e){if(this._disconnect(e),pn.delete(e),e===this._current){this._hideCurrent();let e=this._queue.shift();e&&this._show(e)}else{let t=this._queue.indexOf(e);t!==-1&&this._queue.splice(t,1)}}_bump(e){if(this._queue.splice(this._queue.indexOf(e),1),e.priority===P.HIGH){this._queue.unshift(e);return}let t=this._queue.findIndex(e=>e.priority!==P.HIGH);this._queue.splice(t===-1?this._queue.length:t,0,e)}_show(e){this._current=e,this._options.onShow(e),this._startTimer(e)}_hideCurrent(){let e=this._current;e!==null&&(this._clearTimer(),this._current=null,this._options.onHide(e))}_startTimer(e){this._clearTimer(),e.timeout>0&&(this._timer=this._options.scheduler.schedule(()=>{this._timer=null,this._current===e&&e.dismiss()},e.timeout*1e3))}_clearTimer(){this._timer!==null&&(this._options.scheduler.cancel(this._timer),this._timer=null)}_disconnect(e){let t=this._handlers.get(e);t!==void 0&&(e.disconnect(t),this._handlers.delete(e))}};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 mn=new Set([`none`,`single`,`multiple`]);function normalizeListSelectionMode(e){return typeof e==`string`&&mn.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 hn={indents:0,expander:`none`,level:1};function treeExpanderLayout(e,t={}){if(!e)return hn;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 gn=[`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 gn.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 _n=[`none`,`start`,`middle`,`end`];function normalizeLabelEllipsize(e){return _n.includes(e)?e:`none`}function labelEllipsizeOverflowValue(e){return e===`none`?`clip`:`ellipsis`}const vn=[`word`,`char`,`word-char`];function normalizeLabelWrapMode(e){return vn.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 yn=[0,1,2],bn=new WeakMap;function syncDirection(e){let t=bn.get(e);t===void 0||!e.isConnected||(t===0?e.removeAttribute(`dir`):e.dir=t===2?`rtl`:`ltr`)}function widgetTreeMembers(){return{set_direction(e){if(!yn.includes(e))throw TypeError(`${e} is not a valid value for enum argument dir`);bn.set(this,e),syncDirection(this)},get_direction(){return bn.get(this)??1},get_visible(){return!this.hasAttribute(`hidden`)},set_visible(e){this.toggleAttribute(`hidden`,!e)},get_first_child(){return this.firstElementChild},get_last_child(){return this.lastElementChild},get_next_sibling(){return this.nextElementSibling},get_prev_sibling(){return this.previousElementSibling},get_parent(){return this.parentElement},add_css_class(e){this.classList.add(e)},remove_css_class(e){this.classList.remove(e)},has_css_class(e){return this.classList.contains(e)},insert_action_group(e,t){insertActionGroup(this,e,t)}}}const xn=`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=xn){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 Sn=1200,Cn=Math.PI*.35,wn=Math.PI*.015,Tn=Math.PI*.9,En=Math.PI*.9,Dn=Math.PI*.7,On=Math.PI*1.1,kn=Math.PI*1.35,F=En+On+kn-Dn;53*Math.PI*2/F;const An=On-Dn/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%F,n=t>On?1:easeInOutSine(t/On);return adwLerp(wn,Tn,n)-t*Tn/F}function spinnerArcEnd(e){let t=e%F,n=On-Dn,r;return r=t<n?0:t>F-En?1:easeInOutSine((t-n)/kn),adwLerp(0,Tn-wn,r)-t*Tn/F}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+Cn),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+Cn),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=Sn*53;return(e%t+t)%t/Sn*Math.PI*2}const jn={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},Mn=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],Nn={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:`⌘`}},Pn={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},Fn={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:`~`},In={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=jn[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&&Pn[n[1]]){let e=Pn[n[1]];return{label:Nn[e][t],sideMarker:n[2]}}let r=In[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 Fn[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of Mn)n.modifiers.has(e)&&r.push({label:Nn[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 Ln=[`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 Ln.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 I={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(I.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(I.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(I.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(I.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(I.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(I.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const Rn={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??Rn}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 zn={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},Bn=[`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 zn[e]??zn.down}function splitButtonPopupDirection(e){return e===`none`||!Bn.includes(e)?`down`:e}const Vn=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&Bn.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 Hn=[`narrow`,`wide`],Un=[`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 Wn={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=Wn){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=Wn){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=Wn){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))}const Gn=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+=Gn.get(n)??foldCherokee(e)??n}return t};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}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 Kn=[`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 qn=[`none`,`fill`,`spread`],Jn=[`minimum`,`natural`],Yn=[`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 qn.includes(e)?e:`none`}function normalizeWrapPolicy(e){return Jn.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 Yn.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(`.`));var WindowMemberState=class{constructor(e,t={}){this._active=!1,this._focus=null,this._notify=e,this._maximized=t.maximized??!1}get active(){return this._active}get maximized(){return this._maximized}get focus(){return this._focus}reportActive(e){return this._active===e?!1:(this._active=e,this._notify(`is-active`),!0)}reportMaximized(e){return this._maximized===e?!1:(this._maximized=e,this._notify(`maximized`),!0)}reportFocus(e){return this._focus===e?!1:(this._focus=e,this._notify(`focus-widget`),!0)}},CloseRequestState=class{constructor(){this._emitting=!1}get emitting(){return this._emitting}close(e){if(!e.realized||this._emitting)return`ignored`;let t;this._emitting=!0;try{e.emit()?t=`handled`:e.hideOnClose?(e.hide(),t=`hidden`):t=`destroyed`}finally{this._emitting=!1}return t===`destroyed`&&e.destroy(),t}};const Xn={DEFAULT:0,FORCE_LIGHT:1,PREFER_LIGHT:2,PREFER_DARK:3,FORCE_DARK:4},Zn=new WeakMap,Qn=new WeakMap,$n=new WeakMap;function refresh(e){if(!Zn.has(e))return;let t=sourceOf(e).dark();Zn.get(e)!==t&&(Zn.set(e,t),e.notify(`dark`))}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=Qn.get(this);if(e===void 0){e=new this,Qn.set(this,e);let t=sourceOf(e);Zn.set(e,t.dark()),t.subscribe(()=>refresh(e))}return e}get dark(){return sourceOf(this).dark()}get_dark(){return this.dark}get system_supports_color_schemes(){return sourceOf(this).supportsColorSchemes?.()??!1}get_system_supports_color_schemes(){return this.system_supports_color_schemes}get color_scheme(){return $n.get(this)??Xn.DEFAULT}set color_scheme(e){if(!Object.values(Xn).includes(e))throw Error(`Adw.StyleManager: ${e} is not an Adw.ColorScheme`);if(e===this.color_scheme)return;$n.set(this,e);let t=e===Xn.FORCE_DARK?!0:e===Xn.FORCE_LIGHT?!1:null;sourceOf(this).force?.(t),this.notify(`color-scheme`),refresh(this)}get_color_scheme(){return this.color_scheme}set_color_scheme(e){this.color_scheme=e}};registerBaseClass(StyleManagerBase,`AdwStyleManager`,{},[g.boolean(`dark`,``,``,m.READABLE,!1),g.boolean(`system-supports-color-schemes`,``,``,m.READABLE,!1),g.int(`color-scheme`,``,``,m.READWRITE,0,4,0)]);const er=`--accent-bg-color`,tr=`--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 nr=new WeakSet;function hasAppChosenAccent(e){return nr.has(e)}function writeAdwaitaAccent(e,t,n){t.style.setProperty(er,adwaitaAccentBgColor(e)),t.style.setProperty(tr,adwaitaAccentColor(e,n))}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement;nr.add(n),writeAdwaitaAccent(e,n,t.dark??isAdwaitaDark(n))}function clearAdwaitaAccent(e=document.documentElement){nr.delete(e),e.style.removeProperty(er),e.style.removeProperty(tr)}let L={},rr=!1,ir=null,ar=!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(L.accent&&L.accent!==ke)return{accent:L.accent,source:`handoff`};let e=L.accentRgb?parseAdwRgb(L.accentRgb):null;if(e)return{accent:nearestAccent(e),source:`handoff`};if(L.accent===ke){let e=readSystemAccent();if(e)return{accent:e.accent,source:`system`}}return null}function syncScheme(e){let t=L.colorScheme,n=t===`dark`?`theme-dark`:t===`light`?`theme-light`:null;n!==ir&&(ir&&e.classList.remove(ir),ir=null,n&&!e.classList.contains(`theme-dark`)&&!e.classList.contains(`theme-light`)&&(e.classList.add(n),ir=n))}function sync(){let e=document.documentElement;if(syncScheme(e),hasAppChosenAccent(e))return;let t=resolve();t?(writeAdwaitaAccent(t.accent,e,isAdwaitaDark(e)),rr=!0):rr&&=(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(){L=appearanceFromMeta(e=>document.head.querySelector(`meta[name="${e}"]`)?.getAttribute(`content`)??null)}function followDesktopAppearance(){ar||typeof document>`u`||(ar=!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`,()=>{L.accent===ke&&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 or=`adw-scroll-shaded`,sr=`--adw-overshoot`,cr=[`overshoot-top`,`overshoot-bottom`],lr=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:lr.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:lr.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return lr.has(t.overflowY)||lr.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(or,...Kn,...cr),e.style.removeProperty(sr)}_update(e){e.classList.add(or);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of Kn){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(sr):e.style.setProperty(sr,`${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 R={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0};({...R}),{...R},{...R},{...R},{...R},{...R},{...R};let ur=0;const idOf=()=>`org.gjsify.vec.App${++ur}`;function attempt$2(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}__name(attempt$2,`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$2(()=>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 z={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};({...z}),{...z},{...z},{...z},{...z},{...z};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 treeNodesOf(e){return[...authoredNodes(e,e.tag),...(e.siblings??[]).flatMap((t,n)=>authoredNodes(t,`${e.tag} > sibling[${n}] ${t.tag}`))]}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.accessibility!==void 0&&n.push({kind:`accessibility`,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(`
|
|
16
|
-
`);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,r){let i=[];for(let r of constructUsesOf(n)){let n=t[r.kind];if(n===void 0)throw Error(`${e}'s capabilities declare no row for the construct '${r.kind}'.`);n!==`implemented`&&i.push({...r,reason:n.refused})}if(r!==void 0&&t.accessibility===`implemented`)for(let{node:e,path:t}of treeNodesOf(n))for(let n of Object.keys(e.accessibility??{}))r.includes(n)||i.push({kind:`accessibility`,path:t,reason:`'${n}' has no accessibility door here; only ${r.join(`, `)} are written`});if(i.length>0)throw new UnsupportedConstructError(e,i)}const dr={0:`NOT_FOUND`,1:`INTERNAL`};function attempt$1(e,t){try{return{ok:t()}}catch(t){let n=t;return typeof n?.matches==`function`&&typeof n.code==`number`&&n.matches(e.Gio.ResourceError,n.code)?{error:dr[n.code]??n.code}:{thrown:String(t)}}}__name(attempt$1,`attempt`),Array.from({length:16},()=>JSON.stringify({error:`NOT_FOUND`}));function plain(e){return Array.isArray(e)?e.map(plain):typeof e==`number`&&(!Number.isFinite(e)||Object.is(e,-0))?Object.is(e,-0)?`-0`:String(e):e}const notString=e=>({throws:`Error`,message:`Expected type string for argument 'string' but got type ${e}`}),notStrv=e=>({throws:`Error`,message:`Expected type utf8 for Argument 'strv' but got type '${e}'`}),badSignature=e=>({throws:`TypeError`,message:`Invalid GVariant signature ${e}`});notString(`number`),notString(`boolean`),notString(`undefined`),notString(`Object`),notString(`Array`),notStrv(`null`),notStrv(`undefined`),notStrv(`number`),notStrv(`Object`),badSignature(`(unexpected character z)`),badSignature(`(unexpected character ))`),badSignature(`(undefined is not a valid type)`),badSignature(`(z is not a valid type)`),badSignature(`(more than one single complete type)`),badSignature(`(more than one single complete type)`),badSignature(`(more than one single complete type)`),badSignature(`for type TUPLE (expected ")")`);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 file=(e,t=!1)=>({uri:`resource:///org/gjsify/icons/icons/${e}`,symbolic:t});file(`16x16/apps/size.png`),file(`48x48/apps/size.png`),file(`scalable/apps/size.svg`),file(`scalable/apps/size.svg`),file(`scalable/apps/size.svg`),file(`16x16@2/apps/size.png`),file(`16x16/apps/sym.png`),file(`scalable/apps/sym-symbolic.svg`,!0),file(`symbolic/apps/only-symbolic.svg`,!0),file(`16x16/apps/arrow-rtl.png`),file(`16x16/apps/arrow.png`),file(`16x16/apps/arrow.png`),file(`16x16/apps/tint.symbolic.png`,!0),file(`16x16/apps/tint.symbolic.png`,!0),file(`24x24/apps/suffix.png`),file(`22x22/apps/packed.png`),file(`loose.svg`),file(`flat.png`),file(`old.xpm`),file(`16x16/apps/size.png`);const B={active:!1,checked:!1,keyboardActivating:!1};({...B}),{...B},{...B},{...B},{...B},{...B};const fr=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...fr],[...fr],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()),pr={"margin-start":`margin-inline-start`,"margin-end":`margin-inline-end`,"margin-top":`margin-top`,"margin-bottom":`margin-bottom`},mr=[`hexpand`,`vexpand`],hr={"width-request":`min-width`,"height-request":`min-height`};function widgetLengthStyle(e,t){let n=pr[e];if(n!==void 0)return[n,`${Number(t)}px`];let r=hr[e];if(r!==void 0)return[r,Number(t)<0?null:`${Number(t)}px`]}const gr=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=gr.get(e);return n!==void 0&&n.has(t)}const _r={layout:`implemented`,accessibility:`implemented`,strings:`implemented`,responses:`implemented`,page:`implemented`,extern:`implemented`,signal:`implemented`,bind:`implemented`,breakpoint:`implemented`,"sibling-object":`implemented`};function dispatchedSignalsOf(e){let t=[];for(let n=e.constructor;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,`signals`)?.value;e!==void 0&&t.unshift(e)}return Object.assign({},...t)}const V=new WeakMap,H=new Set,vr=new WeakMap;let U=null;function isMapped(e){return e.isConnected&&e.checkVisibility()}function depthOf(e){let t=0;for(let n=e.parentElement;n!==null;n=n.parentElement)t++;return t}function recheck(){let e=[];for(let t of H){let n=t.deref();if(n===void 0){H.delete(t);continue}let r=V.get(n);isMapped(n)!==r.mapped&&e.push(n)}if(e.length===0)return;let deepestFirst=e=>e.map(e=>[e,depthOf(e)]).sort((e,t)=>t[1]-e[1]),t=deepestFirst(e.filter(e=>V.get(e).mapped)),n=deepestFirst(e.filter(e=>!V.get(e).mapped));for(let[e]of[...t,...n]){let t=V.get(e);t.mapped=!t.mapped,e.dispatchEvent(new CustomEvent(t.mapped?`map`:`unmap`))}}function observe(){U===null&&(U=new MutationObserver(recheck),U.observe(document,{childList:!0,subtree:!0,attributes:!0}),document.addEventListener(`toggle`,recheck,!0))}function unobserve(){U===null||H.size>0||(U.disconnect(),U=null,document.removeEventListener(`toggle`,recheck,!0))}function watchMapping(e){let t=V.get(e);if(t===void 0||t.listeners===0){t={mapped:isMapped(e),listeners:0},V.set(e,t);let n=new WeakRef(e);vr.set(e,n),H.add(n),observe()}t.listeners++;let n=!0;return()=>{if(!n)return;n=!1;let t=V.get(e);--t.listeners>0||(H.delete(vr.get(e)),vr.delete(e),unobserve())}}const yr=new WeakSet,br=new WeakMap,xr=new WeakSet;let Sr=0;function hasElementApi(e){return xr.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=br.get(e)??new Set;if(r.has(n)||(r.add(n),br.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&¬ifyElement(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,...yr.has(t)?t.detail:[])===!0&&t.cancelable&&(t.preventDefault(),t.stopImmediatePropagation())};e.addEventListener(r,listener);let a=t===`map`||t===`unmap`?watchMapping(e):void 0;return()=>{e.removeEventListener(r,listener),a?.()}}function dispatchElement(e,t,n){let r=eventOf(e,t),i=new CustomEvent(r,{detail:n,bubbles:r.startsWith(`notify::`)});yr.add(i),e.dispatchEvent(i)}function installSensitive(e){if(`sensitive`in e)return;let t=e.constructor.observedAttributes??[],n=`disabled`in e||t.includes(`disabled`);Object.defineProperty(e,"sensitive",{configurable:!0,enumerable:!1,get:()=>n?!e.hasAttribute(`disabled`):e.getAttribute(`aria-disabled`)!==`true`,set:t=>{n?e.toggleAttribute(`disabled`,!t):t?e.removeAttribute(`aria-disabled`):e.setAttribute(`aria-disabled`,`true`)}})}const Cr=new WeakSet,wr=new WeakSet;function hasInstalledVisible(e){if(Cr.has(e))return!0;let t=inheritedDescriptor(e,`visible`)?.get;return t!==void 0&&wr.has(t)}function installVisible(e){if(`visible`in e)return;Cr.add(e);let define=(t,n)=>Object.defineProperty(e,t,{configurable:!0,enumerable:!1,...n}),set=t=>{let n=!e.hidden;e.toggleAttribute(`hidden`,!t),!e.hidden!==n&&`notify::visible`in dispatchedSignalsOf(e)&¬ifyElement(e,`visible`)};define(`visible`,{get:()=>!e.hidden,set}),`get_visible`in e||define(`get_visible`,{value:()=>!e.hidden,writable:!0}),`set_visible`in e||define(`set_visible`,{value:set,writable:!0})}function installElementApi(e){if(typeof e.connect==`function`)return;xr.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=++Sr;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)),define(`get_property`,t=>(eventOf(e,`notify::${t}`),e[propertyOf(t)])),define(`set_property`,(t,n)=>{eventOf(e,`notify::${t}`);let r=propertyOf(t),i=inheritedDescriptor(e,r);if(i!==void 0&&i.get!==void 0&&i.set===void 0)throw Error(`Property '${t}' of <${e.localName}> is read-only`);e[r]=n}),define(`add_css_class`,t=>e.classList.add(t)),define(`remove_css_class`,t=>e.classList.remove(t)),define(`has_css_class`,t=>e.classList.contains(t))}const Tr=new Set([`connect`,`disconnect`,`emit`,`notify`,`get_property`,`set_property`]);function endpointOf(e){return hasElementApi(e)?new Proxy(e,{get(e,t){if(typeof t!=`string`||Tr.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 Er=new WeakMap;function isContent(e){return e instanceof Element?!0:e.nodeType===Node.TEXT_NODE&&(e.textContent??``).trim()!==``}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){let r=[];for(let t of Array.from(e.childNodes)){if(route(t)!==null||t.parentNode!==e||!isContent(t))continue;r.push(t);let n=t instanceof Element?t.getAttribute(`slot`)??``:``;console.warn(`'${n}' is not a valid child type of '${e.localName}'`)}o=new Set(t),e.replaceChildren(...t,...r),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 Er.set(e,c),c}const Dr=new Map;function registerTemplateClass(e,t){let n=Dr.get(e);if(n!==void 0&&n!==t)throw Error(`the template class '${e}' is already registered as <${n}>.`);Dr.set(e,t)}function isTemplateTag(e){for(let t of Dr.values())if(t===e)return!0;return!1}function templateTagFor(e){let t=Dr.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 refuseSiblings(e,t){if((e.siblings?.length??0)!==0)throw Error(`\`${e.tag}\` carries ${e.siblings.length} sibling object(s), and \`${t}\` returns one object so they would be built and lost. Use \`buildWithSiblings\`, which hands them back by id.`)}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=mr.find(e=>e===r);a!==void 0&&typeof n==`boolean`?e.setAttribute(a,n?``:`false`):r===`visible`&&typeof n==`boolean`&&hasInstalledVisible(e)||isTemplateTag(e.localName)&&i in e?e[i]=n: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$1(e,t){let n=document.createElement(e.extern===!0?templateTagFor(e.tag):hostTagOf(e.tag));if(t.template!==void 0&&installElementApi(n),installVisible(n),e.id!==void 0){if(t.ids.has(e.id))throw Error(`Two nodes of this tree carry the id '${e.id}'; GtkBuilder refuses a duplicate id.`);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}__name(buildNode$1,`buildNode`);function collectNode(e,t,n){for(let[r,i]of Object.entries(t.bindings??{}))r===`sensitive`&&installSensitive(e),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),writeAccessibility(e,t)}const Or={label:`aria-label`,description:`aria-description`};function writeAccessibility(e,t){for(let[n,r]of Object.entries(t.accessibility??{}))e.setAttribute(Or[n],String(r.value))}const kr={row:{property:`gridRow`,span:!1},column:{property:`gridColumn`,span:!1},"row-span":{property:`gridRow`,span:!0},"column-span":{property:`gridColumn`,span:!0}};function writeGridCell(e,t,n){let r=n.layout??{};if(e.localName!==`gtk-grid`)throw Error(`layout (${Object.keys(r).join(`, `)}) on \`${n.tag}\` under \`${e.localName}\`: this renderer's only layout manager is the grid, so the placement would be dropped.`);let i={row:0,column:0,"row-span":1,"column-span":1};for(let[e,t]of Object.entries(r)){if(kr[e]===void 0)throw Error(`layout \`${e}\` on \`${n.tag}\` reaches nothing: a grid child takes ${Object.keys(kr).join(`, `)}.`);if(typeof t!=`number`||!Number.isInteger(t))throw Error(`layout \`${e}: ${String(t)}\` on \`${n.tag}\` is not a whole number.`);i[e]=t}t.style.gridRow=`${i.row+1} / span ${i[`row-span`]}`,t.style.gridColumn=`${i.column+1} / span ${i[`column-span`]}`}function buildChildren(e,t,n){let r=[];for(let i of t.children??[]){let t=buildNode$1(i,n);i.layout!==void 0&&writeGridCell(e,t,i),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){refuseSiblings(e,`buildTemplateTree`),assertTreeConstructs(`adwaita-web`,_r,e,Object.keys(Or));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 Ar=new Map;function modifierState(e){return!!e.shiftKey|(e.ctrlKey?4:0)|(e.altKey?8:0)|(e.metaKey?67108864:0)}const jr={setStyles(e){if(typeof document>`u`)return;let t=new Set(e.map(e=>e.owner));for(let[e,n]of Ar)t.has(e)||(n.remove(),Ar.delete(e));for(let{owner:t,css:n,priority:r}of e){let e=Ar.get(t);e||(e=document.createElement(`style`),Ar.set(t,e)),e.dataset.gtkPriority=String(r),e.textContent!==n&&(e.textContent=n),document.head.append(e)}},openUri(e){typeof globalThis>`u`||globalThis.open(e,`_blank`,`noopener`)},fontName(){if(typeof document>`u`||!document.body)return null;let e=getComputedStyle(document.body),t=e.fontFamily.split(`,`)[0]?.trim().replace(/^["']|["']$/g,``),n=Number.parseFloat(e.fontSize);return!t||!Number.isFinite(n)?null:`${t} ${Math.round(n*.75*10)/10}`},listenKeys(e,t){let n=e;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`);let listen=e=>n=>{let r=n;t({key:r.key,keycode:r.keyCode,state:modifierState(r),pressed:e})&&r.preventDefault()},r=listen(!0),i=listen(!1);return n.addEventListener(`keydown`,r),n.addEventListener(`keyup`,i),()=>{n.removeEventListener(`keydown`,r),n.removeEventListener(`keyup`,i)}}},W=createGtkPlatform(jr);W.CssProvider,W.StyleContext,W.Settings;const Mr=W.IconTheme;W.EventControllerKey,W.show_uri;const Nr=new Set;function onIconThemeChanged(e){return Nr.add(e),()=>{Nr.delete(e)}}function hasSymbolic(e){return e===``?!1:getComputedStyle(document.documentElement).getPropertyValue(`--icon-${e}`).trim()!==``}function lookupIcon(e,t={}){if(e==null||e===``)return null;let n=resourceIcon(e,t);if(n!==null)return n;let r=normalizeIconName(e);return r===``?{kind:`missing`}:{kind:`symbolic`,name:r}}const Pr=Mr.get_for_display(null),Fr=new Map;Pr.connect(`changed`,()=>{for(let e of Fr.values())e!==null&&URL.revokeObjectURL(e);Fr.clear();for(let e of Nr)e()});const Ir={".svg":`image/svg+xml`,".png":`image/png`};function resourceUrl(e){let t=Fr.get(e);if(t!==void 0)return t;let n=null,r=Ir[e.slice(e.lastIndexOf(`.`))];if(r===void 0)console.warn(`Gtk.IconTheme: ${e} is not an SVG or a PNG, which is all a browser draws (ADR 0116 § 4).`);else try{let t=resources_lookup_data(e,0).get_data();n=URL.createObjectURL(new Blob([t],{type:r}))}catch(t){console.warn(`Gtk.IconTheme: ${e} cannot be drawn: ${t.message}`)}return Fr.set(e,n),n}function resourceIcon(e,t){let n=lookupResourceIcon(Pr,{names:iconLookupNames(e,t.direction??null),get size(){return t.size??16},scale:t.scale??1,themeHas:e=>hasSymbolic(normalizeIconName(e))});return n===null?null:n.kind===`theme`?{kind:`symbolic`,name:normalizeIconName(n.name)}:{kind:`resource`,name:n.name,path:n.path,url:resourceUrl(n.path),symbolic:n.symbolic}}let G=null;function interceptCopy(e,t){if(!e)return t(),!1;let n=G,r={data:e,wrote:!1};G=r;try{t()}finally{G=n}return r.wrote}const Lr={writeText(e){if(G){G.data.setData(`text/plain`,e),G.wrote=!0;return}return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`navigator.clipboard is not available here`)):navigator.clipboard.writeText(e)}},Rr={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(){},iconTheme:()=>Mr.get_for_display(null),guardUnload(e){e?globalThis.addEventListener(`beforeunload`,confirmUnload):globalThis.removeEventListener(`beforeunload`,confirmUnload)}};function confirmUnload(e){e.preventDefault(),e.returnValue=``}function parentOfElement(e){if(!(e instanceof Element))return null;let t=e.anchor;return t instanceof Element?t:e.parentElement}function activateWidgetAction(e,t,n=null){return activateWidgetAction$1(e,t,parentOfElement,n)}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=Rr};withGtkApplication(GioApplication);const zr=new WeakMap;function followAccelerators(e,t){zr.get(e)?.(),zr.delete(e),t!==null&&zr.set(e,jr.listenKeys(e,t=>dispatchAccelerator(e,t,parentOfElement)))}function defineWindowApplication(e){defineWindowApplicationMembers(e,followAccelerators)}const Br={b:{element:`b`},i:{element:`i`},u:{element:`u`},s:{element:`s`},tt:{element:`span`,style:{"font-family":`monospace`}},big:{element:`span`,style:{"font-size":`larger`}},small:{element:`span`,style:{"font-size":`smaller`}},sub:{element:`sub`},sup:{element:`sup`},markup:{element:`span`,style:{display:`contents`}},span:{element:`span`}},Vr={weight:`font-weight`,style:`font-style`,underline:`text-decoration-line`,strikethrough:`text-decoration-line`,font_family:`font-family`,size:`font-size`},Hr={font_weight:`weight`,font_style:`style`,face:`font_family`,font_size:`size`},Ur={weight:{ultralight:`100`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`bold`,ultrabold:`700`,heavy:`900`},style:{normal:`normal`,oblique:`oblique`,italic:`italic`}};function buildNode(e,t){if(e.kind===`text`)return t.createTextNode(e.text);let n=Br[e.tag];if(n===void 0)return null;let r=t.createElement(n.element);if(n.style!==void 0)for(let[e,t]of Object.entries(n.style))r.style.setProperty(e,t);e.tag===`span`&&applySpanAttributes(r,e.attributes);for(let n of e.children){let e=buildNode(n,t);e!==null&&r.append(e)}return r}function applySpanAttributes(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=Hr[r]??r,a=Vr[t];if(a===void 0)continue;if(t===`underline`){i!==`none`&&n.push(`underline`);continue}if(t===`strikethrough`){i!==`false`&&i!==`none`&&n.push(`line-through`);continue}if(t===`font_family`){let t=sanitizeFontFamily(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`size`){let t=sanitizeFontSize(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`weight`&&/^[0-9]{1,4}$/.test(i)&&+i>=1&&+i<=1e3){e.style.setProperty(a,i);continue}let o=Ur[t]?.[i];o!==void 0&&e.style.setProperty(a,o)}n.length>0&&e.style.setProperty(`text-decoration-line`,n.join(` `))}const Wr=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]);function sanitizeFontFamily(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e!==``){if(!Wr.has(e.toLowerCase())&&!/^["']?[A-Za-z0-9 _-]+["']?$/.test(e))return null;t.push(e)}}return t.length>0?t.join(`, `):null}function sanitizeFontSize(e){let t=e.trim(),n={"xx-small":`xx-small`,"x-small":`x-small`,small:`small`,medium:`medium`,large:`large`,"x-large":`x-large`,"xx-large":`xx-large`,smaller:`smaller`,larger:`larger`}[t];return n===void 0?/^[0-9]+$/.test(t)?`${t/1024}pt`:/^[0-9]+(\.[0-9]+)?pt$/.test(t)||/^[0-9]+(\.[0-9]+)?%$/.test(t)?t:null:n}function renderPangoMarkup(e,t){let n=parsePangoMarkup(t);if(n===null){e.textContent=t;return}let r=e.ownerDocument??document;e.replaceChildren(...n.map(e=>buildNode(e,r)).filter(e=>e!==null))}var WidgetElement=class extends HTMLElement{static signals={map:`map`,unmap:`unmap`};get visible(){return!this.hidden}set visible(e){let t=!this.hidden;this.toggleAttribute(`hidden`,!e),!this.hidden!==t&&`notify::visible`in dispatchedSignalsOf(this)&¬ifyElement(this,`visible`)}get_visible(){return this.visible}set_visible(e){this.visible=e}get_mapped(){return isMapped(this)}};wr.add(Object.getOwnPropertyDescriptor(WidgetElement.prototype,`visible`).get);var TooltipElement=class extends WidgetElement{get tooltip_text(){return this.getAttribute(`tooltip-text`)}set tooltip_text(e){e==null?this.removeAttribute(`tooltip-text`):this.setAttribute(`tooltip-text`,e)}get tooltipText(){return this.tooltip_text}set tooltipText(e){this.tooltip_text=e}get_tooltip_text(){return this.tooltip_text}set_tooltip_text(e){this.tooltip_text=e}};function cssUrl(e){return`url("${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}")`}const Gr=`adw-icon--`;var GtkImage=class extends WidgetElement{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))}_unsubscribe=null;connectedCallback(){this._unsubscribe??=onIconThemeChanged(()=>this._render()),this._render()}disconnectedCallback(){this._unsubscribe?.(),this._unsubscribe=null}attributeChangedCallback(){this._render()}_request(){let measure=()=>{if(this.size!==null)return this.size;let e=this.isConnected?Number.parseFloat(getComputedStyle(this).width):NaN;return Number.isFinite(e)&&e>0?Math.round(e):16};return{get size(){return measure()},scale:Math.max(1,Math.round(globalThis.devicePixelRatio??1)),direction:this.matches(`:dir(rtl)`)?`rtl`:`ltr`}}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(Gr));this.classList.remove(...e);let t=lookupIcon(this.getAttribute(`icon-name`),this._request()),n=t?.kind===`resource`&&t.url===null?{kind:`missing`}:t,r=n?.kind===`resource`&&!n.symbolic?n.url:null,i=n?.kind===`resource`&&n.symbolic?n.url:null;this.classList.toggle(`adw-icon-color`,r!==null),r===null?this.style.removeProperty(`background-image`):this.style.backgroundImage=cssUrl(r),i===null?(this.style.removeProperty(`mask-image`),this.style.removeProperty(`-webkit-mask-image`),this.style.removeProperty(`background-color`)):(this.style.setProperty(`mask-image`,cssUrl(i)),this.style.setProperty(`-webkit-mask-image`,cssUrl(i)),this.style.backgroundColor=`currentColor`),n?.kind===`symbolic`?this.classList.add(`${Gr}${n.name}`):n?.kind===`missing`&&this.classList.add(`${Gr}image-missing`),this.setAttribute(`aria-hidden`,`true`);let a=this.size;if(a===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${a}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 Kr={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends WidgetElement{_toasts;_initialized=!1;_queue;_scheduler=Kr;_currentEl=null;constructor(){super(),this._queue=new ToastOverlayQueue({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,[{name:`child`,into:e},{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}add_toast(e){this._toasts||this.connectedCallback(),this._queue.add_toast(e)}dismiss_all(){this._queue.dismiss_all()}_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`,e.use_markup?renderPangoMarkup(r,e.title):r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.button_label){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.button_label,n.addEventListener(`click`,()=>{e.emit(`button-clicked`),e.action_name&&activateWidgetAction(this,e.action_name),e.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`,()=>e.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);const qr=[`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(qr)).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(C[e])}var AdwAboutDialog=class extends WidgetElement{_initialized=!1;_scrimEl;_sheetEl;_modal;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];_licenseState={...me};_reflecting=!1;_creditSections=[];_acknowledgementSections=[];_legalSections=[];_links=[];_releaseNotesSegments=[];_toastOverlay;static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-type`,`license-url`,`translator-credits`,`release-notes`,`release-notes-version`,`debug-info`,`open`]}static new_from_appdata(e,t){refuseNewFromAppdata()}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._licenseState.license}set license(e){this.setAttribute(`license`,e)}get licenseType(){return this._licenseState.licenseType}set licenseType(e){this.setAttribute(`license-type`,String(e))}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get releaseNotes(){return this.getAttribute(`release-notes`)??``}set releaseNotes(e){this.setAttribute(`release-notes`,e)}get releaseNotesVersion(){return this.getAttribute(`release-notes-version`)??``}set releaseNotesVersion(e){this.setAttribute(`release-notes-version`,e)}get debugInfo(){return this.getAttribute(`debug-info`)??``}set debugInfo(e){this.setAttribute(`debug-info`,e)}add_link(e,t){this._links.push({title:e,url:t}),this._initialized&&this._render()}add_credit_section(e,t){this._creditSections.push({title:e,people:[...t]}),this._initialized&&this._render()}add_acknowledgement_section(e,t){this._acknowledgementSections.push({title:e,people:[...t]}),this._initialized&&this._render()}add_legal_section(e,t,n,r){isLicenseType(n)&&(this._legalSections.push({title:e,copyright:t,licenseType:n,license:r}),this._initialized&&this._render())}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`,C.dialogTitle),this._toastOverlay=document.createElement(`adw-toast-overlay`),this._sheetEl.appendChild(this._toastOverlay),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(t!==n){if(e===`license`||e===`license-type`){this._reflecting||this._applyLicenseAttribute(e,n),this._initialized&&!this._reflecting&&this._render();return}if((e===`release-notes`||e===`release-notes-version`)&&(this._releaseNotesSegments=releaseNotesBuffer({releaseNotes:this.releaseNotes,releaseNotesVersion:this.releaseNotesVersion,version:this.version},C).segments),this._initialized){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()}}}_applyLicenseAttribute(e,t){let n=e===`license`?setLicense(this._licenseState,t??``):setLicenseType(this._licenseState,this._parseLicenseType(t));this._licenseState=n.state,this._reflectLicense();for(let e of n.notify)this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{license:this._licenseState.license,licenseType:this._licenseState.licenseType}}))}_parseLicenseType(e){return e===null?S.UNKNOWN:/^-?\d+$/.test(e.trim())?Number(e):licenseTypeForNick(e.trim())??-1}_reflectLicense(){let{license:e,licenseType:t}=this._licenseState;this._reflecting=!0;try{e.length===0?this.removeAttribute(`license`):this.getAttribute(`license`)!==e&&this.setAttribute(`license`,e);let n=this.getAttribute(`license-type`);t===S.UNKNOWN?n!==null&&this.removeAttribute(`license-type`):(n===null||this._parseLicenseType(n)!==t)&&this.setAttribute(`license-type`,String(t))}finally{this._reflecting=!1}}_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,translatorCredits:this.translatorCredits,creditSections:this._creditSections})}_legalInput(){return{copyright:this.copyright,licenseType:this._licenseState.licenseType,license:this._licenseState.license,legalSections:this._legalSections}}_render(){let e=this._creditsSections(),t=acknowledgementSections(this._acknowledgementSections),n=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,debugInfo:this.debugInfo,releaseNotes:this.releaseNotes,hasCustomLinks:this._links.length>0,hasCredits:e.length>0,hasLegal:legalVisible(this._legalInput()),hasAcknowledgements:t.length>0});this._navView?.remove(),this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(n)),n.whatsNewRow&&this._navView.append(this._buildWhatsNewPage()),n.detailsRow&&this._navView.append(this._buildDetailsPage(n)),n.troubleshootingRow&&this._navView.append(this._buildTroubleshootingPage(),this._buildDebugInfoPage()),n.creditsRow&&this._navView.append(this._buildCreditsPage(e)),n.legalRow&&this._navView.append(this._buildLegalPage()),n.acknowledgementsRow&&this._navView.append(this._buildAcknowledgementsPage(t)),(this._toastOverlay.querySelector(`:scope > .adw-toast-overlay-content`)??this._toastOverlay).appendChild(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`,C.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.whatsNewRow&&r.push(this._buildNavRow(rowLabel(`whatsNewRow`),`whatsnew`)),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)),e.troubleshootingRow&&i.push(this._buildNavRow(rowLabel(`troubleshootingRow`),`troubleshooting`));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.acknowledgementsRow&&a.push(this._buildNavRow(rowLabel(`acknowledgementsRow`),`acknowledgements`)),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`,C.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));for(let e of this._links)t.push(this._buildLinkRow(stripMnemonic(e.title),e.url));n.appendChild(this._buildGroup(`links`,t))}return t}_buildWhatsNewPage(){let{page:e,body:t}=this._buildPage(`whatsnew`,C.whatsNewPage,!1),n=document.createElement(`div`);n.className=`adw-about-dialog-release-notes`;for(let e of this._releaseNotesSegments){let t=document.createElement(`span`);e.tag!==null&&(t.dataset.tag=e.tag),t.textContent=e.text,n.appendChild(t)}return t.appendChild(n),e}_buildTroubleshootingPage(){let{page:e,body:t}=this._buildPage(`troubleshooting`,C.troubleshootingPage,!1),n=document.createElement(`p`);return n.className=`adw-about-dialog-comments`,n.textContent=C.troubleshootingIntro,t.append(n,this._buildGroup(null,[this._buildNavRow(rowLabel(`debugInfoRow`),`debuginfo`)])),e}_buildDebugInfoPage(){let{page:e,body:t}=this._buildPage(`debuginfo`,C.debugInfoPage,!1),n=document.createElement(`pre`);n.className=`adw-about-dialog-debug-info`,n.textContent=this.debugInfo;let r=document.createElement(`button`);return r.type=`button`,r.className=`adw-button pill adw-about-dialog-copy`,r.textContent=rowLabel(`copyText`),r.addEventListener(`click`,()=>this._copyProperty(this.debugInfo)),t.append(n,r),e}_copyProperty(e){e.length!==0&&(Promise.resolve(Lr.writeText(e)).catch(()=>void 0),this._toastOverlay.add_toast(new Toast({title:C.copiedToast})))}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);return n.setAttribute(`title`,e),this._makeLinkRow(n,t),n}_makeLinkRow(e,t){e.setAttribute(`activatable`,``),e.setAttribute(`role`,`link`),e.classList.add(`link`,`adw-about-dialog-link-row`);let n=linkRowTooltip(t);n!==null&&e.setAttribute(`tooltip-text`,n);let r=createGtkImage(linkRowIconName(t),`adw-about-dialog-link-icon`);r.setAttribute(`slot`,`suffix`),r.setAttribute(`aria-hidden`,`true`),e.appendChild(r),e.addEventListener(`activated`,()=>this._activateLink(t))}_buildCreditsPage(e){return this._buildCreditGroupsPage(`credits`,C.creditsPage,e)}_buildAcknowledgementsPage(e){return this._buildCreditGroupsPage(`acknowledgements`,C.acknowledgementsPage,e)}_buildCreditGroupsPage(e,t,n){let{page:r,body:i}=this._buildPage(e,t,!1);for(let e of n){let t=e.people.map(e=>this._buildCreditRow(e));i.appendChild(this._buildGroup(null,t,e.title??void 0))}return r}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;this._makeLinkRow(t,n)}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,C.legalPage,!1),n=this._legalInput(),r=legalSections(n),i=legalSectionVisible(n.copyright,n.licenseType,n.license);for(let[e,a]of r.entries()){if(a.title!==null){let e=document.createElement(`p`);e.className=`adw-about-dialog-legal-title`,e.textContent=a.title,t.appendChild(e)}let r=document.createElement(`p`);r.className=`adw-about-dialog-license`,e===0&&i&&this.licenseUrl&&n.licenseType===S.CUSTOM?(this._renderLegalLabel(r,this.copyright),this.copyright.length>0&&r.append(`
|
|
17
|
-
|
|
18
|
-
`),r.append(this._buildLicenseUrlLink())):this._renderLegalLabel(r,a.markup),a.markup.length>0&&t.appendChild(r)}return e}_buildLicenseUrlLink(){let e=this.licenseUrl,t=document.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,t=>{t.preventDefault(),this._activateLink(e)}),t}_renderLegalLabel(e,t){e.replaceChildren();let n=/<a\s+href="([^\x22]*)">([\s\S]*?)<\/a>/g,r=0,text=t=>{if(t.length===0)return;let n=document.createElement(`span`);renderPangoMarkup(n,t),e.appendChild(n)};for(let i of t.matchAll(n)){text(t.slice(r,i.index)),r=i.index+i[0].length;let n=i[1].replace(/&/g,`&`),a=document.createElement(`a`);renderPangoMarkup(a,i[2]),/^(https?:|mailto:)/i.test(n)&&(a.href=n,a.rel=`noopener noreferrer`,a.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n)})),e.appendChild(a)}text(t.slice(r))}_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(Jr)||e.setAttribute(Jr,``)):(e.removeAttribute(`title`),e.removeAttribute(Jr))}const Jr=`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 Yr=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends TooltipElement{static signals={activated:`activated`};_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}constructor(){super(),installElementApi(this)}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:Yr})}_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 WidgetElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends WidgetElement{static signals={response:`response`,...Object.fromEntries([`heading`,`body`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`prefer-wide-layout`].map(e=>[`notify::${e}`,`notify::${e}`]))};_initialized=!1;_attachedByPresent=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_modal;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;constructor(e){super(),installElementApi(this);for(let[t,n]of Object.entries(e??{})){if(n===void 0)continue;let e=propertyOf(t);if(!(e in this))throw Error(`No property ${t} on <adw-alert-dialog>`);this[e]=n}}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.set_default_response(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.set_close_response(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._responseAreaEl.append(...this._buttons.values()),this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{name:`extra-child`,into:this._childEl},{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);let n=this.getAttribute(`default-response`);n!==null&&(this._model.defaultResponse=n),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.add_response(t,(e.textContent??``).trim()),n!=="default"&&this.set_response_appearance(t,n),booleanAttribute$2(e.getAttribute(`enabled`),!0)||this.set_response_enabled(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.set_close_response(n):e===`default-response`?this.set_default_response(n):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():(this._modal.dismiss(),this._attachedByPresent&&(this._attachedByPresent=!1,this.remove()))))}present(e){this.isConnected||(document.body.appendChild(this),this._attachedByPresent=!0),this.open=!0}add_response(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()}remove_response(e){if(!this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to remove a response with id '${e}', but such a response does not exist`);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()}has_response(e){return this._model.hasResponse(e)}get_response_label(e){return this._model.responses.find(t=>t.id===e)?.label??null}set_response_label(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}get_response_appearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}set_response_appearance(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`))}get_response_enabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}set_response_enabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}get_default_response(){return this._model.defaultResponse}set_default_response(e){this._model.defaultResponse=e,this._render()}get_close_response(){return this._model.closeResponse}set_close_response(e){this._model.closeResponse=e}get_heading(){return this.heading}set_heading(e){this.heading=e}get_body(){return this.body}set_body(e){this.body=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){dispatchElement(this,`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(){if(!this._initialized)return;this.classList.toggle(`open`,this.open);let e=this.heading;this.headingUseMarkup?renderPangoMarkup(this._headingEl,e):this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?renderPangoMarkup(this._bodyEl,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);function requested(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)&&r>=0?r:n}function fillsContainingBlock(e){return[`maximized`,`fullscreened`].some(t=>e.hasAttribute(t)&&e.getAttribute(t)!==`false`)}var AdwWindowFeatures=class{_host;_contentEl=null;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];constructor(e){this._host=e}get contentArea(){return this._contentEl}get content(){return this._contentEl?.firstElementChild??null}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}adopt(e){this._contentEl===null&&(this._contentEl=e,e.classList.add(`adw-window-content`),this._host.addEventListener(`notify::open`,e=>{let t=e.target;t!==this._host&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}addBreakpoint(e){let t=this._host,n=new AdwBreakpoint(e,{onApply:()=>t.dataset.breakpoint=e,onUnapply:()=>{t.dataset.breakpoint===e&&delete t.dataset.breakpoint}});return this._breakpoints.push(n),this.bind(),n}bind(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._contentEl!==null&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this._host,this._breakpoints))}release(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}applySizeRequest(){let e=this._host;e.style.minWidth=`${requested(e,`width-request`,360)}px`,e.style.minHeight=`${requested(e,`height-request`,200)}px`;let t=fillsContainingBlock(e),n=t?null:e.getAttribute(`default-width`)??e.getAttribute(`width`),r=t?null:e.getAttribute(`default-height`)??e.getAttribute(`height`);n?e.style.width=`${n}px`:e.style.removeProperty(`width`),r?e.style.height=`${r}px`:e.style.removeProperty(`height`)}};const Xr={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`}},Zr=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends WidgetElement{_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:Zr})),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(Xr.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`)&&t.getAttribute(`maximized`)!==`false`;return this._controlButton(e?{...Xr.maximize,icon:`window-restore-symbolic`,label:`Restore`}:Xr.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(Xr.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 WidgetElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;_members=new WindowMemberState(e=>this._notifyMember(e));_closing=new CloseRequestState;_syncActive=()=>void this._members.reportActive(this._documentIsActive());_onFocusIn=e=>{e.target instanceof Element&&this._members.reportFocus(e.target)};_onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||t===null&&!document.hasFocus()||this._members.reportFocus(null)};static signals={"close-request":`close-request`,...Object.fromEntries([`application`,`decorated`,`default-height`,`default-width`,`deletable`,`focus-widget`,`fullscreened`,`hide-on-close`,`icon-name`,`is-active`,`maximized`,`modal`,`resizable`,`title`,`transient-for`].map(e=>[`notify::${e}`,`notify::${e}`]))};constructor(){super(),installElementApi(this);let e=this.emit;Object.defineProperty(this,"emit",{configurable:!0,writable:!0,value:(t,...n)=>{if(t===`close-request`)throw Error(`<gtk-window>.emit('close-request') is not supported; call close()`);e(t,...n)}})}static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`,`hidden`]}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 fullscreened(){return this._offByDefault(`fullscreened`)}set fullscreened(e){this._write(`fullscreened`,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)&&this.getAttribute(e)!==`false`}connectedCallback(){if(this._initialized){this._watchActivity(),this._watchTitlebar(),this._render();return}this._initialized=!0,this._watchActivity(),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,[...this.hasTitlebar()?[{name:`titlebar`,into:this._titlebar},{name:`child`,into:this._content}]:[],...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,globalThis.removeEventListener(`focus`,this._syncActive),globalThis.removeEventListener(`blur`,this._syncActive),document.removeEventListener(`visibilitychange`,this._syncActive),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._members.reportActive(!1),this._members.reportFocus(null)}_watchActivity(){globalThis.addEventListener(`focus`,this._syncActive),globalThis.addEventListener(`blur`,this._syncActive),document.addEventListener(`visibilitychange`,this._syncActive),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._syncActive()}_documentIsActive(){return this.isConnected&&!this.hidden&&document.visibilityState!==`hidden`&&document.hasFocus()}_notifyMember(e){let t=e===`is-active`?this._members.active:e===`focus-widget`?this._members.focus:this.maximized;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}hasTitlebar(){return!0}extraSlots(){return[]}attributeChangedCallback(e){if(e===`hidden`){this._syncActive();return}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`)),this.renderFrameSize();let e=this.getAttribute(`title`);e===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,e),this._renderTitlebar()}renderFrameSize(){let e=fillsContainingBlock(this),t=Number.parseFloat(this.getAttribute(`default-width`)??``),n=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[r,i]of[[`width`,t],[`height`,n]])!e&&Number.isFinite(i)&&i>0?this.style.setProperty(r,`${i}px`):this.style.removeProperty(r)}_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||!this.hasTitlebar())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=this._closing.close({realized:this.isConnected,hideOnClose:this._offByDefault(`hide-on-close`),emit:()=>{let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented},hide:()=>void(this.hidden=!0),destroy:()=>this.remove()});return e===`hidden`||e===`destroyed`}present(){this.hidden=!1}get isActive(){return this._members.active}get is_active(){return this._members.active}get focusWidget(){return this.get_focus()}get focus_widget(){return this.get_focus()}set focus_widget(e){this.set_focus(e)}get_focus(){let e=document.activeElement;return e!==null&&e!==this&&this.contains(e)?e:null}set_focus(e){if(e===null){let e=this.get_focus();(e instanceof HTMLElement||e instanceof SVGElement)&&e.blur(),this._members.reportFocus(null);return}if(e===this||!this.contains(e))throw Error(`<gtk-window>.set_focus: the widget is not inside this window`);(e instanceof HTMLElement||e instanceof SVGElement)&&e.focus(),this._members.reportFocus(this.get_focus())}is_maximized(){return this.maximized}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}is_fullscreen(){return this.fullscreened}fullscreen(){this._write(`fullscreened`,`true`)}unfullscreen(){this._write(`fullscreened`,`false`)}};customElements.define(`gtk-window`,GtkWindow),defineWindowApplication(GtkWindow.prototype);var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static signals={...GtkWindow.signals,"notify::show-menubar":`notify::show-menubar`};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),installActionMap(GtkApplicationWindow.prototype);var AdwApplicationWindow=class extends GtkApplicationWindow{_features=new AdwWindowFeatures(this);_model=[];_menubarEl=null;static get observedAttributes(){return[...GtkApplicationWindow.observedAttributes,`width`,`height`,`width-request`,`height-request`,`menu-model`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}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._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`||e===`width-request`||e===`height-request`){this.renderFrameSize();return}super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`)),this._renderMenubar())}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}_followMenubar(){this._menubarEl===null&&(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this._content.prepend(this._menubarEl)),this._renderMenubar()}menubarSection(){return this._menubarEl??super.menubarSection()}_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 WidgetElement{_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 WidgetElement{_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`)?renderPangoMarkup(this._titleEl,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 it)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends WidgetElement{_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 WidgetElement{},AdwBottomSheetSheet=class extends WidgetElement{},AdwBottomSheetBottomBar=class extends WidgetElement{},AdwBottomSheet=class extends WidgetElement{static signals={"notify::open":`notify::open`};_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_modal(){return this.modal}set_modal(e){this.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}constructor(){super(),installElementApi(this)}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 WidgetElement{_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(){bindSlottedChildren(this,[{name:`child`,into:this}]),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 WidgetElement{_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(lt),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(lt),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 TooltipElement{_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 WidgetElement{_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;_pendingScrollPage=null;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`));let t=this._pendingScrollPage;this._pendingScrollPage=null;let n=t?this._idOf(t):null;n!==null&&this._positionWhenMeasurable(this._state.indexOf(n))}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)}scroll_to(e,t){if(!this._initialized){e.parentElement===this&&(this._pendingScrollPage=e);return}let n=this._idOf(e);n!==null&&this._state.scrollTo(this._state.indexOf(n),{animate:t})}get_nth_page(e){if(!this._initialized){let t=this.children[e];return Number.isInteger(e)&&t instanceof HTMLElement?t:null}if(!Number.isInteger(e)||e<0||e>=this._state.nPages)return null;let t=this._state.ids[e],n=t===void 0?null:this._slots.get(t)?.firstElementChild;return n instanceof HTMLElement?n:null}get_n_pages(){return this._initialized?this._state.nPages:this.children.length}get_position(){return this._state.position}_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();if(t>0){if(!e.animate){this._pendingInteractive=null,this._scrollTargetId=null,this._trackEl.scrollTo({left:e.index*t,behavior:`instant`});return}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 WidgetElement{_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 WidgetElement{_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`),mt.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),mt.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 ht)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 ht)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const Qr={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends WidgetElement{_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`),mt.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),mt.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`:Qr[e]??`auto`,this.style.overflowY=t===null?`auto`:Qr[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 ht)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 ht)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 TooltipElement{_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))}set_model(e){this.model=e??[]}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get_selected(){return this.selected}set_selected(e){this.selected=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 $r=[`auto`,`floating`,`bottom-sheet`];var AdwDialog=class extends WidgetElement{_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&&$r.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,[{name:`child`,into:this._contentEl},{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 TooltipElement{_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=Ct,this._applyButton.setAttribute(`aria-label`,Ct),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 WidgetElement{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 TooltipElement{_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 WidgetElement{_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 WidgetElement{_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},{into:this._startEl}],(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 ei={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 ti={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=>ti[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 WidgetElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends WidgetElement{scheduler=ei;_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 Un)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 WidgetElement{_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 WidgetElement{_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 WidgetElement{_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 WidgetElement{static signals={pushed:`pushed`,popped:`popped`,replaced:`replaced`,"notify::visible-page":`notify::visible-page`};_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_visible_page_tag(){return this.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()}constructor(){super(),installElementApi(this)}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}push_by_tag(e){return this.pushByTag(e)}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()??xn,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 WidgetElement{_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 ni={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 WidgetElement{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:ni}),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 ri=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),ii=new Set([...ri,`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=>ii.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:ri.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 WidgetElement{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 WidgetElement{_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(e){this.isConnected||(e??document.body).appendChild(this),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 WidgetElement{_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 TooltipElement{_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.hasAttribute(`role`)||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 WidgetElement{_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 ai=new WeakMap,oi=new WeakMap;var AdwSidebarItem=class extends WidgetElement{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=ai.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 WidgetElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=oi.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends WidgetElement{_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`)};ai.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};oi.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 si=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of si){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 TooltipElement{_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 ci=`http://www.w3.org/2000/svg`,li=new Set;let ui=0;function tick(e){for(let t of li)t.drawAt(e);ui=li.size>0?requestAnimationFrame(tick):0}function startTicking(){ui===0&&li.size>0&&(ui=requestAnimationFrame(tick))}var AdwSpinner=class extends WidgetElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),li.add(this),this._origin=null,startTicking()}disconnectedCallback(){li.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(ci,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(ci,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(ci,`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?An:this._lastProgress)}_lastProgress=An;_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?menuLabelText(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=menuLabelText(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=menuLabelText(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 di=[`bottom`,`top`,`start`,`end`],fi=[`start`,`end`],pi=[`menu`,`listbox`],mi=[...pi,`dialog`];var GtkPopover=class extends WidgetElement{_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 di.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return fi.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return mi.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()}takesChild(){return!0}_buildOnce(){this._initialized||(this._initialized=!0,this.takesChild()&&bindSlottedChildren(this,[{name:`child`,into:this}]),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||!pi.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 hi={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},gi={"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`},_i={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends WidgetElement{_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,k),n;let r=menuRefusals(n,k);if(r.length===0)return n;console.error(`${k.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(hi))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=gi[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=_i[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 WidgetElement{_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 TooltipElement{static signals={"notify::active":`notify::active`};_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)}get_active(){return this.active}set_active(e){this.active=e}constructor(){super(),installElementApi(this)}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)},vi=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends WidgetElement{_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 vi)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of vi)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 yi=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends WidgetElement{_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 yi)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of yi)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 WidgetElement{_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,k),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 xi)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of xi)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 v={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,v),v}_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(bi)),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 bi=`16`,xi=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const Si=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends WidgetElement{static get observedAttributes(){return Si}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 WidgetElement{_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);var AdwToggle=class extends WidgetElement{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 WidgetElement{_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 WidgetElement{_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 _t)this.classList.toggle(t,e.includes(t));for(let e of vt)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 WidgetElement{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)),new MutationObserver(e=>this._onChildrenRemoved(e)).observe(this,{childList:!0})}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(),t&&clearPageMarks(t),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}}))}_onChildrenRemoved(e){let t=!1;for(let n of e)for(let e of n.removedNodes){if(!(e instanceof HTMLElement)||e.parentElement===this)continue;let n=this._state.pages.find(t=>t.content===e);n!==void 0&&(this._state.removePage(n.name),clearPageMarks(e),t=!0)}t&&(this._applyVisibility(),this._reflectName(),this._emitItemsChanged())}_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);function clearPageMarks(e){e.classList.remove(`adw-view-stack-child`,`active-view`),delete e.dataset.name,e.hidden=!1}var AdwViewSwitcherPage=class extends WidgetElement{},AdwViewSwitcher=class extends WidgetElement{scheduler=ei;_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 Hn)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 WidgetElement{_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 Ci)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of Ci)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 Ci=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);var AdwViewSwitcherBar=class extends WidgetElement{_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);var AdwWindow=class extends GtkWindow{_features=new AdwWindowFeatures(this);static get observedAttributes(){return[...GtkWindow.observedAttributes,`width`,`height`,`width-request`,`height-request`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}connectedCallback(){super.connectedCallback(),this._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`||e===`width-request`||e===`height-request`){this.renderFrameSize();return}super.attributeChangedCallback(e)}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}};customElements.define(`adw-window`,AdwWindow);const wi=[`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 WidgetElement{_initialized=!1;static get observedAttributes(){return[...wi]}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 Ti={dark:()=>typeof document<`u`&&isAdwaitaDark(document.documentElement),subscribe(e){if(typeof document>`u`)return()=>{};let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);t?.addEventListener(`change`,e);let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t?.removeEventListener(`change`,e),n.disconnect()}},supportsColorSchemes(){let matches=e=>globalThis.matchMedia?.(e).matches===!0;return matches(`(prefers-color-scheme: dark)`)||matches(`(prefers-color-scheme: light)`)}};Ti.force=e=>{if(typeof document>`u`)return;let t=document.documentElement;t.classList.remove(`theme-dark`,`theme-light`),e!==null&&t.classList.add(e?`theme-dark`:`theme-light`)},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}),Object.freeze({WORD:0,LINE:1});const Ei={main:`About`,credits:`Credits`,license:`License`,system:`System`},Di=[`credits`,`license`,`system`],Oi=[`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&&Oi.includes(e)?e:`unknown`}set licenseType(e){Oi.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`,...Di]){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 Di){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 Di.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=Ei[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=Oi.indexOf(e),n=t>=0?t:S.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==S.CUSTOM&&n!==S.UNKNOWN){let e=pe[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
|
|
19
|
-
|
|
20
|
-
>`.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 WidgetElement{_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);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 WidgetElement{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 K={},ki=new Map([[`gtk-box`,{}],[`gtk-stack`,{}],[`gtk-overlay`,{skip:`.adw-overlay-layer`}],[`gtk-scrolled-window`,{skip:`gtk-scrollbar`}],[`gtk-viewport`,{}],[`adw-bin`,K],[`adw-bottom-sheet`,K],[`adw-breakpoint-bin`,K],[`adw-clamp`,K],[`adw-clamp-scrollable`,K],[`adw-layout-slot`,K],[`adw-multi-layout-view`,K],[`adw-navigation-view`,K],[`adw-overlay-split-view`,K],[`adw-status-page`,K],[`adw-toast-overlay`,K],[`adw-toolbar-view`,K],[`adw-view-stack`,K],[`adw-header-bar`,{horizontalOnly:!0}]]),Ai={horizontal:`hexpand`,vertical:`vexpand`};function vfuncOf(e){let t=ki.get(e.localName);if(t!==void 0)return t;if(typeof customElements.getName==`function`)for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;){let e=customElements.getName(t.constructor),n=e===null?void 0:ki.get(e);if(n!==void 0)return n;t=Object.getPrototypeOf(t)}}function isWidget(e){return e.localName.includes(`-`)||e.hasAttribute(`hexpand`)||e.hasAttribute(`vexpand`)}function isStackPage(e){return e.classList.contains(`adw-view-stack-child`)&&e.parentElement?.localName===`adw-view-stack`}function explicitExpand(e,t){let n=e.getAttribute(Ai[t]);return n===null?void 0:n!==`false`}function computeExpand(e,t){if(e.hasAttribute(`hidden`)&&!isStackPage(e))return!1;let n=explicitExpand(e,t);if(n!==void 0)return n;let r=vfuncOf(e);return r===void 0||r.horizontalOnly&&t===`vertical`?!1:anyChildExpands(e,t,r.skip)}function anyChildExpands(e,t,n){for(let r of e.children)if(!(n!==void 0&&r.matches(n))){if(isWidget(r)){if(computeExpand(r,t))return!0}else if(anyChildExpands(r,t,void 0))return!0}return!1}const ji=[`orientation`,`spacing`,`homogeneous`],Mi={horizontal:`data-computed-hexpand`,vertical:`data-computed-vexpand`};var GtkBox=class extends WidgetElement{_expandObserver=null;static get observedAttributes(){return[...ji]}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(),this._syncComputedExpand(),!this._expandObserver&&(this._expandObserver=new MutationObserver(e=>{e.some(affectsExpand)&&this._syncComputedExpand()}),this._expandObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`hexpand`,`vexpand`,`hidden`]}))}disconnectedCallback(){this._expandObserver?.disconnect(),this._expandObserver=null}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`}_syncComputedExpand(){for(let e of this.children)for(let t of[`horizontal`,`vertical`]){let n=explicitExpand(e,t)===void 0&&computeExpand(e,t);e.toggleAttribute(Mi[t],n)}}};function affectsExpand(e){if(e.type!==`childList`)return!0;let isElement=e=>e.nodeType===Node.ELEMENT_NODE;return[...e.addedNodes].some(isElement)||[...e.removedNodes].some(isElement)}customElements.define(`gtk-box`,GtkBox);const Ni=[`aria-label`,`aria-description`];function forwardAccessibleName(e,t){for(let n of Ni){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}return e.hasAttribute(`aria-label`)}const Pi=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends TooltipElement{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`,...Ni]}get icon_name(){return this.getAttribute(`icon-name`)}set icon_name(e){this.reflect(`icon-name`,e)}get iconName(){return this.icon_name}set iconName(e){this.icon_name=e}reflect(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}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=[...Pi.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??``,!forwardAccessibleName(this,e)&&r&&!i&&e.setAttribute(`aria-label`,a??r),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Fi=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ii=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],q=[{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 WidgetElement{_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:q[0].icon,tooltip:q[0].tooltip},nextMonth:{icon:q[1].icon,tooltip:q[1].tooltip},previousYear:{icon:q[2].icon,tooltip:q[2].tooltip},nextYear:{icon:q[3].icon,tooltip:q[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=Ii[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`,`${Ii[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=Fi[(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=q.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&¬ify(`month`,this._date.month-1),e.yearChanged&¬ify(`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 Li={top:0,center:.5,bottom:1};var GtkCenterBox=class extends WidgetElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in Li?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 Li?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(Li[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const Ri=new RadioGroupState;var AdwCheckBase=class extends WidgetElement{_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,forwardAccessibleName(this,this._input)}},zi=class GtkCheckButton extends AdwCheckBase{static signals={toggled:`toggled`,"notify::active":`notify::active`};static get observedAttributes(){return[`checked`,`active`,`indeterminate`,`disabled`,`label`,`group`,...Ni]}get inputType(){return`checkbox`}set group(e){if(typeof e==`string`){this.setAttribute(`group`,e);return}this.set_group(e)}set_group(e){setCheckGroup(this,e),this.render(),e?.render()}get_active(){return this.checked}set_active(e){this.checked=e}attributeChangedCallback(e){if(e===`checked`&&this.checked)for(let e of checkGroupNeighbours(this))e.checked=!1;e===`group`&&this.isConnected&&this._resolveGroup(),super.attributeChangedCallback(e)}onConnected(){this._resolveGroup()}_resolveGroup(){let e=this.getAttribute(`group`);if(e===null)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);if(!(t instanceof GtkCheckButton))throw Error(`gtk-check-button group="${e}" names no gtk-check-button in this document`);this.set_group(t)}render(){if(this._input===void 0)return;super.render();let e=isRadioCheck(this);this.toggleAttribute(`radio`,e),e?this._input.setAttribute(`role`,`radio`):this._input.removeAttribute(`role`)}activate(){if(!checkActivationFlips(this,this.checked)){this.render();return}this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`,...Ni]}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}Ri.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=Ri.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&Ri.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,zi),customElements.define(`adw-radio`,AdwRadio);const Bi={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends WidgetElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Bi};_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 Vi=/^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=Vi.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 Hi=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Hi,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 Ui=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&Ui.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends WidgetElement{_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=Hi,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 WidgetElement{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_selected(){return this.selected}set_selected(e){this.selected=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 Wi=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends WidgetElement{_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,Wi)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Wi)))}_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 Gi=new WeakMap;var Ki=class GtkDragIcon extends WidgetElement{_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:Gi.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&&Gi.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`,bindSlottedChildren(this,[{name:`child`,into:this}]),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`,Ki);var GtkEditableLabel=class extends WidgetElement{_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 qi=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>qi.includes(e))}const Ji=[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`)],Yi=[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`)],Xi=[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`)],Zi=[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`)],Qi=[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`)],$i=[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`)],ea=[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`)],ta=[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`)],na=[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`)],ra=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:Ji},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:Yi},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:Xi},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:Zi},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:Qi},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:$i},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:ea},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:ta},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:na}];[...ra.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:ra.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;takesChild(){return!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 ra){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=>!qi.includes(e)).join(``);for(let t of[i,...qi.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 WidgetElement{_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(St,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 ia={left:`start`,right:`end`,center:`center`,fill:`justify`},aa=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends WidgetElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...aa]}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)}get_label(){return this.label}set_label(e){this.label=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.maxWidth=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.maxWidth=e===null?``:`min(100%, ${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=ia[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 oa=0;var GtkExpander=class extends WidgetElement{_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-${oa++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends WidgetElement{_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 WidgetElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{name:`child`,into:this._contentsEl},{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 WidgetElement{_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 sa={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},ca=[{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={...sa,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=ca.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 ca)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 WidgetElement{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 la=[`family`,`face`,`font`,`features`],ua=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends WidgetElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...sa};_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 la.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 ua){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={...sa,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 WidgetElement{_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 da=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...da];let n=t.split(/[\s,|]+/).filter(e=>da.includes(e));return da.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 WidgetElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...da];_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=da.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 WidgetElement{_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,[{name:`child`,into:this._childEl},{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 WidgetElement{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 WidgetElement{_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 fa=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return fa.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return vn.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 WidgetElement{_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 pa=[[`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 WidgetElement{_trough;_initialized=!1;_offsets=pa.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 WidgetElement{_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,[{name:`child`,into:this._contentsEl},{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 ma=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&ma.has(e)?e:`all`}var GtkListBox=class extends WidgetElement{_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 WidgetElement{_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 ha={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends WidgetElement{_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,k),n;let r=menuRefusals(n,k);if(r.length===0)return n;console.error(`${k.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=ha[Vn(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 ga=[`top`,`bottom`,`left`,`right`],_a=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends WidgetElement{_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&&ga.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:[..._a,`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&&_a.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 va=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends WidgetElement{_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,[{name:`child`,into:this._childEl},{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 va)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const J=25.4,Y=[{name:`na_letter`,displayName:`US Letter`,width:8.5*J,height:11*J},{name:`na_legal`,displayName:`US Legal`,width:8.5*J,height:14*J},{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*J,height:10.75*J},{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*J,height:9.5*J},{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*J,height:17*J},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],ya=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*J,bottom:(ya.has(e.name)?.56:.25)*J,left:.25*J,right:.25*J}}function defaultPageSetup(){let e=Y.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return Y.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??Y[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/J,height:a/J}}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/J,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(`
|
|
21
|
-
`)}const ba={name:`Any Printer`,location:`For portable documents`},xa=[[`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 xa){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[ba,...this._printers]}_fillPaperSizes(){this._setups=Y.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===ba.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 WidgetElement{_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},{name:`start-child`,into:this._startEl},{name:`end-child`,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 Sa=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return Sa.includes(e)?e:`contain`}var GtkPicture=class extends WidgetElement{_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 Ca=`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,k),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?Ca:e}set visibleSubmenu(e){this.openSubmenu(e)}takesChild(){return!1}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??Ca)}}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===Ca||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(Ca)}_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,k);if(t.length===0)return e;console.error(`${k.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 WidgetElement{_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,k),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`),bindSlottedChildren(this,[{name:`child`,into:this}]),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,k);if(t.length===0)return e;console.error(`${k.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 WidgetElement{_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,k),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=menuLabelText(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,k);if(t.length>0){console.error(`${k.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 wa=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],Ta=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],Ea=[`All sheets`,`Even sheets`,`Odd sheets`],Da=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],Oa={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...Oa};_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=>wa.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={...Oa,...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=>wa.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 Ta){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(Ea,`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=Y.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(Da.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=Da[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=Y[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(...Ta.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 WidgetElement{_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 ka=[`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`],Aa=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),ja=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Ma=new Set([`swing-right`,`swing-left`]),Na=new Set([`swing-up`,`swing-down`]),Pa=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Fa={"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 WidgetElement{_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 ka.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)`)?Fa[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?Aa:ja,r=e===`horizontal`?Ma:Na;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=Pa.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const Ia=[`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 WidgetElement{_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 Ia.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 La={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends WidgetElement{_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={...La,...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 WidgetElement{_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._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),bindSlottedChildren(this,[{name:`child`,into:this._center},{into:this._center}]).install(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 Ra=[`always`,`never`,`automatic`,`external`],za=[`always`,`automatic`,`never`,`external`],Ba=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return Ra.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Ba.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 Va=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssSize:`width`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssSize:`height`,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 WidgetElement{_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[za.indexOf(this.hscrollbarPolicy),za.indexOf(this.vscrollbarPolicy)]}set_policy(e,t){let nick=(e,t)=>{let n=Number.isInteger(e)?za[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 child(){return this._built?this._viewport.firstElementChild:this.firstElementChild}set child(e){this.set_child(e)}get_child(){return this.child}set_child(e){let t=this.child;e!==t&&(this._built?this._viewport.replaceChildren(...e===null?[]:[e]):(t?.remove(),e!==null&&this.appendChild(e)),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}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,[{name:`child`,into:this._viewport},{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 Ba)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 Va){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.cssSize]=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 Va){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 Ha=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends WidgetElement{_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??Ha}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 Ua=1e-10,Wa=[`always`,`if-valid`];var GtkSpinButton=class extends WidgetElement{_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 Wa.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)<Ua?(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)<Ua?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>Ua&&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<=Ua,this._down.disabled=!this.wrap&&e.value-e.lower<=Ua,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 Ga=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends WidgetElement{_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(Ga,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(Ga,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(Ga,`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 Ka=[`name`,`title`,`icon-name`,`needs-attention`,`use-underline`];var GtkStackPage=class extends WidgetElement{static get observedAttributes(){return[...Ka]}get name(){return this.getAttribute(`name`)??``}set name(e){e===null?this.removeAttribute(`name`):this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get needsAttention(){return this.hasAttribute(`needs-attention`)}set needsAttention(e){this.toggleAttribute(`needs-attention`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get visible(){return!this.hasAttribute(`hidden`)}set visible(e){this.toggleAttribute(`hidden`,!e)}get child(){return pageChildOf(this)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}};function pageChildOf(e){let t=Array.from(e.children),n=t.filter(e=>e.getAttribute(`slot`)===`child`),r=n.length>0?n:t;if(r.length>1)throw Error(`<gtk-stack-page name="${e.getAttribute(`name`)??``}"> holds ${r.length} children, and a GtkStackPage has one \`child\`.`);return r[0]??null}customElements.define(`gtk-stack-page`,GtkStackPage);const qa=[`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`],Ja=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Ya={"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 Xa=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends WidgetElement{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&&qa.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(this._adopt(e));this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Xa,`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}_adopt(e){if(e.localName!==`gtk-stack-page`)return e;let t=pageChildOf(e);if(t===null)throw Error(`<gtk-stack-page name="${e.getAttribute(`name`)??``}"> has no child, so the stack would hold a page with nothing to show.`);for(let n of Ka){let r=e.getAttribute(n);r!==null&&t.setAttribute(n,r)}return e.hasAttribute(`hidden`)&&t.setAttribute(`hidden`,``),t.removeAttribute(`slot`),this.replaceChild(t,e),t}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_isPage(e){return e.parentNode===this}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){if(a.target!==this)continue;for(let e of Array.from(a.removedNodes))e instanceof HTMLElement&&e.localName===`gtk-stack-page`||(e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1);for(let e of Array.from(a.addedNodes))if(e instanceof HTMLElement){if(e.localName===`gtk-stack-page`){e.parentElement===this&&this._adopt(e);continue}this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e))}continue}let e=a.attributeName;if(!(!e||!this._isPage(a.target))){if(e===`hidden`){(!this._visible||!this._page(this._visible).visible)&&this._show(this._firstVisible());continue}Xa.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`||!this._isPage(t.target))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(Ja.has(n)&&!e?n=`none`:Ja.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=Ya[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 WidgetElement{_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 WidgetElement{_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 WidgetElement{_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(St,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 Za=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Za.includes(e??``)?e:`none`}const Qa={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends WidgetElement{_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 buffer(){return{cursor_position:this._area?this._area.selectionEnd??this._area.value.length:this.text.length,insert_at_cursor:(e,t=-1)=>{let n=t<0?e:e.slice(0,t),r=this._area;if(!r){this.text+=n;return}let i=r.selectionEnd??r.value.length;r.setRangeText(n,i,i,`end`),this._emitChanged()},set_text:(e,t=-1)=>{this.text=t<0?e:e.slice(0,t),this._area&&this._emitChanged()},get_text:()=>this.text}}get_buffer(){return this.buffer}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=Qa[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=ia[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 WidgetElement{_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()),bindSlottedChildren(this,[{name:`child`,into:this}]),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 WidgetElement{_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 $a=[`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 WidgetElement{_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(){bindSlottedChildren(this,[{name:`child`,into:this}]),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 $a){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 eo={"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`}},to={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},no=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 WidgetElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=eo[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:no.has(r)?r:`none`}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),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:to[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);function extensionsOf(e){return[...e.patterns,...e.suffixes].map(e=>`.${e}`)}function filePickerOptions(e,t){let n=[];for(let t of e.filters){if(t.acceptAll)continue;let e={};for(let n of t.mimeTypes)e[n]=[];let r=extensionsOf(t);r.length>0&&(e[t.mimeTypes[0]??`application/octet-stream`]=r),n.push({description:t.name??``,accept:e})}let r={};return n.length>0&&(r.types=n,r.excludeAcceptAllOption=!e.filters.some(e=>e.acceptAll)),t===`save`&&e.initialName!==null&&(r.suggestedName=e.initialName),r}function inputAccept(e){if(!e||e.acceptAll)return null;let t=[...extensionsOf(e),...e.mimeTypes];return t.length>0?t.join(`,`):null}function writeInWorker(e,t){let n=URL.createObjectURL(new Blob([`onmessage = async (event) => {
|
|
16
|
+
`);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,r){let i=[];for(let r of constructUsesOf(n)){let n=t[r.kind];if(n===void 0)throw Error(`${e}'s capabilities declare no row for the construct '${r.kind}'.`);n!==`implemented`&&i.push({...r,reason:n.refused})}if(r!==void 0&&t.accessibility===`implemented`)for(let{node:e,path:t}of treeNodesOf(n))for(let n of Object.keys(e.accessibility??{}))r.includes(n)||i.push({kind:`accessibility`,path:t,reason:`'${n}' has no accessibility door here; only ${r.join(`, `)} are written`});if(i.length>0)throw new UnsupportedConstructError(e,i)}const dr={0:`NOT_FOUND`,1:`INTERNAL`};function attempt$1(e,t){try{return{ok:t()}}catch(t){let n=t;return typeof n?.matches==`function`&&typeof n.code==`number`&&n.matches(e.Gio.ResourceError,n.code)?{error:dr[n.code]??n.code}:{thrown:String(t)}}}__name(attempt$1,`attempt`),Array.from({length:16},()=>JSON.stringify({error:`NOT_FOUND`}));function plain(e){return Array.isArray(e)?e.map(plain):typeof e==`number`&&(!Number.isFinite(e)||Object.is(e,-0))?Object.is(e,-0)?`-0`:String(e):e}const notString=e=>({throws:`Error`,message:`Expected type string for argument 'string' but got type ${e}`}),notStrv=e=>({throws:`Error`,message:`Expected type utf8 for Argument 'strv' but got type '${e}'`}),badSignature=e=>({throws:`TypeError`,message:`Invalid GVariant signature ${e}`});notString(`number`),notString(`boolean`),notString(`undefined`),notString(`Object`),notString(`Array`),notStrv(`null`),notStrv(`undefined`),notStrv(`number`),notStrv(`Object`),badSignature(`(unexpected character z)`),badSignature(`(unexpected character ))`),badSignature(`(undefined is not a valid type)`),badSignature(`(z is not a valid type)`),badSignature(`(more than one single complete type)`),badSignature(`(more than one single complete type)`),badSignature(`(more than one single complete type)`),badSignature(`for type TUPLE (expected ")")`);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}))];function sheet(e,t=600){return[{css:e,priority:t}]}function probed(e,t={},n=[`wrap`]){return{sheets:sheet(e),tree:{widget:`GtkBox`,classes:n,children:[{widget:`GtkCheckButton`,id:`probe`,...t}]}}}const fr=[`.primary-color-selector checkbutton.primary { min-height: 24px; min-width: 24px; background-clip: content-box; border-radius: 9999px; padding: 6px; box-shadow: inset 0 0 0 3px transparent; }`,`.primary-color-selector checkbutton.primary radio { -gtk-icon-source: none; border: none; background: none; box-shadow: none; min-width: 12px; min-height: 12px; padding: 0; transform: none; }`,`.primary-color-selector checkbutton.primary:checked { box-shadow: inset 0 0 0 3px rgb(0,0,255); }`,`.primary-color-selector checkbutton.primary:disabled { filter: saturate(0.4) brightness(1.05); opacity: 0.7; }`,`.primary-color-selector checkbutton.primary.primary-red { background-color: rgb(255,0,0); }`].join(`
|
|
17
|
+
`);function swatch(e){return{sheets:sheet(fr),tree:{widget:`GtkBox`,classes:[`primary-color-selector`],children:[{widget:`GtkCheckButton`,group:`primary`},{widget:`GtkCheckButton`,id:`swatch`,group:`primary`,classes:[`primary`,`primary-red`],...e}]}}}probed(`.wrap checkbutton { color: rgb(255,0,0); label { color: rgb(0,0,255); } }`),probed(`checkbutton:has(label) { color: rgb(255,0,0); }`),probed(`.wrap checkbutton { display: flex; color: rgb(255,0,0); }`),probed(`.wrap checkbutton { padding-bottom: 16; color: rgb(255,0,0); }`),probed(`.wrap checkbutton {
|
|
18
|
+
colr: rgb(0,0,255);
|
|
19
|
+
padding: 1;
|
|
20
|
+
color: rgb(255,0,0);
|
|
21
|
+
}`),probed(`@media (min-width: 3px) { checkbutton { color: rgb(255,0,0); } }`),probed(`checkbutton.pick { color: rgb(255,0,0); }`,{classes:[`pick`]}),probed(`.wrap checkbutton { color: rgb(255,0,0); }`),probed(`#main-button { color: rgb(255,0,0); }`,{name:`main-button`}),probed(``,{classes:[`pick`]}).tree,probed(`.wrap checkbutton.pick { color: rgb(255,0,0); } checkbutton { color: rgb(0,0,255); }`,{classes:[`pick`]}),probed(`@define-color pick rgb(255,0,0); .wrap checkbutton { color: @pick; }`),probed(`.wrap checkbutton { color: alpha(rgb(255,0,0), 0.5); }`),probed(`:root { --pick: rgb(255,0,0); } .wrap checkbutton { color: var(--pick); }`),swatch({}),swatch({active:!0}),swatch({active:!0,sensitive:!1});const file=(e,t=!1)=>({uri:`resource:///org/gjsify/icons/icons/${e}`,symbolic:t});file(`16x16/apps/size.png`),file(`48x48/apps/size.png`),file(`scalable/apps/size.svg`),file(`scalable/apps/size.svg`),file(`scalable/apps/size.svg`),file(`16x16@2/apps/size.png`),file(`16x16/apps/sym.png`),file(`scalable/apps/sym-symbolic.svg`,!0),file(`symbolic/apps/only-symbolic.svg`,!0),file(`16x16/apps/arrow-rtl.png`),file(`16x16/apps/arrow.png`),file(`16x16/apps/arrow.png`),file(`16x16/apps/tint.symbolic.png`,!0),file(`16x16/apps/tint.symbolic.png`,!0),file(`24x24/apps/suffix.png`),file(`22x22/apps/packed.png`),file(`loose.svg`),file(`flat.png`),file(`old.xpm`),file(`16x16/apps/size.png`);const B={active:!1,checked:!1,keyboardActivating:!1};({...B}),{...B},{...B},{...B},{...B},{...B};const pr=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...pr],[...pr],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()),mr={"margin-start":`margin-inline-start`,"margin-end":`margin-inline-end`,"margin-top":`margin-top`,"margin-bottom":`margin-bottom`},hr=[`hexpand`,`vexpand`],gr={"width-request":`min-width`,"height-request":`min-height`};function widgetLengthStyle(e,t){let n=mr[e];if(n!==void 0)return[n,`${Number(t)}px`];let r=gr[e];if(r!==void 0)return[r,Number(t)<0?null:`${Number(t)}px`]}const _r=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=_r.get(e);return n!==void 0&&n.has(t)}const vr={layout:`implemented`,accessibility:`implemented`,strings:`implemented`,responses:`implemented`,page:`implemented`,extern:`implemented`,signal:`implemented`,bind:`implemented`,breakpoint:`implemented`,"sibling-object":`implemented`};function dispatchedSignalsOf(e){let t=[];for(let n=e.constructor;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,`signals`)?.value;e!==void 0&&t.unshift(e)}return Object.assign({},...t)}const V=new WeakMap,H=new Set,yr=new WeakMap;let U=null;function isMapped(e){return e.isConnected&&e.checkVisibility()}function depthOf(e){let t=0;for(let n=e.parentElement;n!==null;n=n.parentElement)t++;return t}function recheck(){let e=[];for(let t of H){let n=t.deref();if(n===void 0){H.delete(t);continue}let r=V.get(n);isMapped(n)!==r.mapped&&e.push(n)}if(e.length===0)return;let deepestFirst=e=>e.map(e=>[e,depthOf(e)]).sort((e,t)=>t[1]-e[1]),t=deepestFirst(e.filter(e=>V.get(e).mapped)),n=deepestFirst(e.filter(e=>!V.get(e).mapped));for(let[e]of[...t,...n]){let t=V.get(e);t.mapped=!t.mapped,e.dispatchEvent(new CustomEvent(t.mapped?`map`:`unmap`))}}function observe(){U===null&&(U=new MutationObserver(recheck),U.observe(document,{childList:!0,subtree:!0,attributes:!0}),document.addEventListener(`toggle`,recheck,!0))}function unobserve(){U===null||H.size>0||(U.disconnect(),U=null,document.removeEventListener(`toggle`,recheck,!0))}function watchMapping(e){let t=V.get(e);if(t===void 0||t.listeners===0){t={mapped:isMapped(e),listeners:0},V.set(e,t);let n=new WeakRef(e);yr.set(e,n),H.add(n),observe()}t.listeners++;let n=!0;return()=>{if(!n)return;n=!1;let t=V.get(e);--t.listeners>0||(H.delete(yr.get(e)),yr.delete(e),unobserve())}}const br=new WeakSet,xr=new WeakMap,Sr=new WeakSet;let Cr=0;function hasElementApi(e){return Sr.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=xr.get(e)??new Set;if(r.has(n)||(r.add(n),xr.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&¬ifyElement(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,...br.has(t)?t.detail:[])===!0&&t.cancelable&&(t.preventDefault(),t.stopImmediatePropagation())};e.addEventListener(r,listener);let a=t===`map`||t===`unmap`?watchMapping(e):void 0;return()=>{e.removeEventListener(r,listener),a?.()}}function dispatchElement(e,t,n){let r=eventOf(e,t),i=new CustomEvent(r,{detail:n,bubbles:r.startsWith(`notify::`)});br.add(i),e.dispatchEvent(i)}function installSensitive(e){if(`sensitive`in e)return;let t=e.constructor.observedAttributes??[],n=`disabled`in e||t.includes(`disabled`);Object.defineProperty(e,"sensitive",{configurable:!0,enumerable:!1,get:()=>n?!e.hasAttribute(`disabled`):e.getAttribute(`aria-disabled`)!==`true`,set:t=>{n?e.toggleAttribute(`disabled`,!t):t?e.removeAttribute(`aria-disabled`):e.setAttribute(`aria-disabled`,`true`)}})}const wr=new WeakSet,Tr=new WeakSet;function hasInstalledVisible(e){if(wr.has(e))return!0;let t=inheritedDescriptor(e,`visible`)?.get;return t!==void 0&&Tr.has(t)}function installVisible(e){if(`visible`in e)return;wr.add(e);let define=(t,n)=>Object.defineProperty(e,t,{configurable:!0,enumerable:!1,...n}),set=t=>{let n=!e.hidden;e.toggleAttribute(`hidden`,!t),!e.hidden!==n&&`notify::visible`in dispatchedSignalsOf(e)&¬ifyElement(e,`visible`)};define(`visible`,{get:()=>!e.hidden,set}),`get_visible`in e||define(`get_visible`,{value:()=>!e.hidden,writable:!0}),`set_visible`in e||define(`set_visible`,{value:set,writable:!0})}function installElementApi(e){if(typeof e.connect==`function`)return;Sr.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=++Cr;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)),define(`get_property`,t=>(eventOf(e,`notify::${t}`),e[propertyOf(t)])),define(`set_property`,(t,n)=>{eventOf(e,`notify::${t}`);let r=propertyOf(t),i=inheritedDescriptor(e,r);if(i!==void 0&&i.get!==void 0&&i.set===void 0)throw Error(`Property '${t}' of <${e.localName}> is read-only`);e[r]=n}),define(`add_css_class`,t=>e.classList.add(t)),define(`remove_css_class`,t=>e.classList.remove(t)),define(`has_css_class`,t=>e.classList.contains(t))}const Er=new Set([`connect`,`disconnect`,`emit`,`notify`,`get_property`,`set_property`]);function endpointOf(e){return hasElementApi(e)?new Proxy(e,{get(e,t){if(typeof t!=`string`||Er.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 Dr=new WeakMap;function isContent(e){return e instanceof Element?!0:e.nodeType===Node.TEXT_NODE&&(e.textContent??``).trim()!==``}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){let r=[];for(let t of Array.from(e.childNodes)){if(route(t)!==null||t.parentNode!==e||!isContent(t))continue;r.push(t);let n=t instanceof Element?t.getAttribute(`slot`)??``:``;console.warn(`'${n}' is not a valid child type of '${e.localName}'`)}o=new Set(t),e.replaceChildren(...t,...r),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 Dr.set(e,c),c}const Or=new Map;function registerTemplateClass(e,t){let n=Or.get(e);if(n!==void 0&&n!==t)throw Error(`the template class '${e}' is already registered as <${n}>.`);Or.set(e,t)}function isTemplateTag(e){for(let t of Or.values())if(t===e)return!0;return!1}function templateTagFor(e){let t=Or.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 refuseSiblings(e,t){if((e.siblings?.length??0)!==0)throw Error(`\`${e.tag}\` carries ${e.siblings.length} sibling object(s), and \`${t}\` returns one object so they would be built and lost. Use \`buildWithSiblings\`, which hands them back by id.`)}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=hr.find(e=>e===r);a!==void 0&&typeof n==`boolean`?e.setAttribute(a,n?``:`false`):r===`visible`&&typeof n==`boolean`&&hasInstalledVisible(e)||isTemplateTag(e.localName)&&i in e?e[i]=n: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$1(e,t){let n=document.createElement(e.extern===!0?templateTagFor(e.tag):hostTagOf(e.tag));if(t.template!==void 0&&installElementApi(n),installVisible(n),e.id!==void 0){if(t.ids.has(e.id))throw Error(`Two nodes of this tree carry the id '${e.id}'; GtkBuilder refuses a duplicate id.`);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}__name(buildNode$1,`buildNode`);function collectNode(e,t,n){for(let[r,i]of Object.entries(t.bindings??{}))r===`sensitive`&&installSensitive(e),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),writeAccessibility(e,t)}const kr={label:`aria-label`,description:`aria-description`};function writeAccessibility(e,t){for(let[n,r]of Object.entries(t.accessibility??{}))e.setAttribute(kr[n],String(r.value))}const Ar={row:{property:`gridRow`,span:!1},column:{property:`gridColumn`,span:!1},"row-span":{property:`gridRow`,span:!0},"column-span":{property:`gridColumn`,span:!0}};function writeGridCell(e,t,n){let r=n.layout??{};if(e.localName!==`gtk-grid`)throw Error(`layout (${Object.keys(r).join(`, `)}) on \`${n.tag}\` under \`${e.localName}\`: this renderer's only layout manager is the grid, so the placement would be dropped.`);let i={row:0,column:0,"row-span":1,"column-span":1};for(let[e,t]of Object.entries(r)){if(Ar[e]===void 0)throw Error(`layout \`${e}\` on \`${n.tag}\` reaches nothing: a grid child takes ${Object.keys(Ar).join(`, `)}.`);if(typeof t!=`number`||!Number.isInteger(t))throw Error(`layout \`${e}: ${String(t)}\` on \`${n.tag}\` is not a whole number.`);i[e]=t}t.style.gridRow=`${i.row+1} / span ${i[`row-span`]}`,t.style.gridColumn=`${i.column+1} / span ${i[`column-span`]}`}function buildChildren(e,t,n){let r=[];for(let i of t.children??[]){let t=buildNode$1(i,n);i.layout!==void 0&&writeGridCell(e,t,i),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){refuseSiblings(e,`buildTemplateTree`),assertTreeConstructs(`adwaita-web`,vr,e,Object.keys(kr));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 jr=new Map;function modifierState(e){return!!e.shiftKey|(e.ctrlKey?4:0)|(e.altKey?8:0)|(e.metaKey?67108864:0)}const Mr={setStyles(e){if(typeof document>`u`)return;let t=new Set(e.map(e=>e.owner));for(let[e,n]of jr)t.has(e)||(n.remove(),jr.delete(e));for(let{owner:t,css:n,priority:r}of e){let e=jr.get(t);e||(e=document.createElement(`style`),jr.set(t,e)),e.dataset.gtkPriority=String(r),e.textContent!==n&&(e.textContent=n),document.head.append(e)}},openUri(e){typeof globalThis>`u`||globalThis.open(e,`_blank`,`noopener`)},fontName(){if(typeof document>`u`||!document.body)return null;let e=getComputedStyle(document.body),t=e.fontFamily.split(`,`)[0]?.trim().replace(/^["']|["']$/g,``),n=Number.parseFloat(e.fontSize);return!t||!Number.isFinite(n)?null:`${t} ${Math.round(n*.75*10)/10}`},listenKeys(e,t){let n=e;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`);let listen=e=>n=>{let r=n;t({key:r.key,keycode:r.keyCode,state:modifierState(r),pressed:e})&&r.preventDefault()},r=listen(!0),i=listen(!1);return n.addEventListener(`keydown`,r),n.addEventListener(`keyup`,i),()=>{n.removeEventListener(`keydown`,r),n.removeEventListener(`keyup`,i)}}},W=createGtkPlatform(Mr);W.CssProvider,W.StyleContext,W.Settings;const Nr=W.IconTheme;W.EventControllerKey,W.show_uri;const Pr=new Set;function onIconThemeChanged(e){return Pr.add(e),()=>{Pr.delete(e)}}function hasSymbolic(e){return e===``?!1:getComputedStyle(document.documentElement).getPropertyValue(`--icon-${e}`).trim()!==``}function lookupIcon(e,t={}){if(e==null||e===``)return null;let n=resourceIcon(e,t);if(n!==null)return n;let r=normalizeIconName(e);return r===``?{kind:`missing`}:{kind:`symbolic`,name:r}}const Fr=Nr.get_for_display(null),Ir=new Map;Fr.connect(`changed`,()=>{for(let e of Ir.values())e!==null&&URL.revokeObjectURL(e);Ir.clear();for(let e of Pr)e()});const Lr={".svg":`image/svg+xml`,".png":`image/png`};function resourceUrl(e){let t=Ir.get(e);if(t!==void 0)return t;let n=null,r=Lr[e.slice(e.lastIndexOf(`.`))];if(r===void 0)console.warn(`Gtk.IconTheme: ${e} is not an SVG or a PNG, which is all a browser draws (ADR 0116 § 4).`);else try{let t=resources_lookup_data(e,0).get_data();n=URL.createObjectURL(new Blob([t],{type:r}))}catch(t){console.warn(`Gtk.IconTheme: ${e} cannot be drawn: ${t.message}`)}return Ir.set(e,n),n}function resourceIcon(e,t){let n=lookupResourceIcon(Fr,{names:iconLookupNames(e,t.direction??null),get size(){return t.size??16},scale:t.scale??1,themeHas:e=>hasSymbolic(normalizeIconName(e))});return n===null?null:n.kind===`theme`?{kind:`symbolic`,name:normalizeIconName(n.name)}:{kind:`resource`,name:n.name,path:n.path,url:resourceUrl(n.path),symbolic:n.symbolic}}let G=null;function interceptCopy(e,t){if(!e)return t(),!1;let n=G,r={data:e,wrote:!1};G=r;try{t()}finally{G=n}return r.wrote}const Rr={writeText(e){if(G){G.data.setData(`text/plain`,e),G.wrote=!0;return}return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`navigator.clipboard is not available here`)):navigator.clipboard.writeText(e)}},zr={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(){},iconTheme:()=>Nr.get_for_display(null),guardUnload(e){e?globalThis.addEventListener(`beforeunload`,confirmUnload):globalThis.removeEventListener(`beforeunload`,confirmUnload)}};function confirmUnload(e){e.preventDefault(),e.returnValue=``}function parentOfElement(e){if(!(e instanceof Element))return null;let t=e.anchor;return t instanceof Element?t:e.parentElement}function activateWidgetAction(e,t,n=null){return activateWidgetAction$1(e,t,parentOfElement,n)}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=zr};withGtkApplication(GioApplication);const Br=new WeakMap;function followAccelerators(e,t){Br.get(e)?.(),Br.delete(e),t!==null&&Br.set(e,Mr.listenKeys(e,t=>dispatchAccelerator(e,t,parentOfElement)))}function defineWindowApplication(e){defineWindowApplicationMembers(e,followAccelerators)}const Vr={b:{element:`b`},i:{element:`i`},u:{element:`u`},s:{element:`s`},tt:{element:`span`,style:{"font-family":`monospace`}},big:{element:`span`,style:{"font-size":`larger`}},small:{element:`span`,style:{"font-size":`smaller`}},sub:{element:`sub`},sup:{element:`sup`},markup:{element:`span`,style:{display:`contents`}},span:{element:`span`}},Hr={weight:`font-weight`,style:`font-style`,underline:`text-decoration-line`,strikethrough:`text-decoration-line`,font_family:`font-family`,size:`font-size`},Ur={font_weight:`weight`,font_style:`style`,face:`font_family`,font_size:`size`},Wr={weight:{ultralight:`100`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`bold`,ultrabold:`700`,heavy:`900`},style:{normal:`normal`,oblique:`oblique`,italic:`italic`}};function buildNode(e,t){if(e.kind===`text`)return t.createTextNode(e.text);let n=Vr[e.tag];if(n===void 0)return null;let r=t.createElement(n.element);if(n.style!==void 0)for(let[e,t]of Object.entries(n.style))r.style.setProperty(e,t);e.tag===`span`&&applySpanAttributes(r,e.attributes);for(let n of e.children){let e=buildNode(n,t);e!==null&&r.append(e)}return r}function applySpanAttributes(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=Ur[r]??r,a=Hr[t];if(a===void 0)continue;if(t===`underline`){i!==`none`&&n.push(`underline`);continue}if(t===`strikethrough`){i!==`false`&&i!==`none`&&n.push(`line-through`);continue}if(t===`font_family`){let t=sanitizeFontFamily(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`size`){let t=sanitizeFontSize(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`weight`&&/^[0-9]{1,4}$/.test(i)&&+i>=1&&+i<=1e3){e.style.setProperty(a,i);continue}let o=Wr[t]?.[i];o!==void 0&&e.style.setProperty(a,o)}n.length>0&&e.style.setProperty(`text-decoration-line`,n.join(` `))}const Gr=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]);function sanitizeFontFamily(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e!==``){if(!Gr.has(e.toLowerCase())&&!/^["']?[A-Za-z0-9 _-]+["']?$/.test(e))return null;t.push(e)}}return t.length>0?t.join(`, `):null}function sanitizeFontSize(e){let t=e.trim(),n={"xx-small":`xx-small`,"x-small":`x-small`,small:`small`,medium:`medium`,large:`large`,"x-large":`x-large`,"xx-large":`xx-large`,smaller:`smaller`,larger:`larger`}[t];return n===void 0?/^[0-9]+$/.test(t)?`${t/1024}pt`:/^[0-9]+(\.[0-9]+)?pt$/.test(t)||/^[0-9]+(\.[0-9]+)?%$/.test(t)?t:null:n}function renderPangoMarkup(e,t){let n=parsePangoMarkup(t);if(n===null){e.textContent=t;return}let r=e.ownerDocument??document;e.replaceChildren(...n.map(e=>buildNode(e,r)).filter(e=>e!==null))}var WidgetElement=class extends HTMLElement{static signals={map:`map`,unmap:`unmap`};get visible(){return!this.hidden}set visible(e){let t=!this.hidden;this.toggleAttribute(`hidden`,!e),!this.hidden!==t&&`notify::visible`in dispatchedSignalsOf(this)&¬ifyElement(this,`visible`)}get_visible(){return this.visible}set_visible(e){this.visible=e}get_mapped(){return isMapped(this)}};Tr.add(Object.getOwnPropertyDescriptor(WidgetElement.prototype,`visible`).get);var TooltipElement=class extends WidgetElement{get tooltip_text(){return this.getAttribute(`tooltip-text`)}set tooltip_text(e){e==null?this.removeAttribute(`tooltip-text`):this.setAttribute(`tooltip-text`,e)}get tooltipText(){return this.tooltip_text}set tooltipText(e){this.tooltip_text=e}get_tooltip_text(){return this.tooltip_text}set_tooltip_text(e){this.tooltip_text=e}};function cssUrl(e){return`url("${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}")`}const Kr=`adw-icon--`;var GtkImage=class extends WidgetElement{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))}_unsubscribe=null;connectedCallback(){this._unsubscribe??=onIconThemeChanged(()=>this._render()),this._render()}disconnectedCallback(){this._unsubscribe?.(),this._unsubscribe=null}attributeChangedCallback(){this._render()}_request(){let measure=()=>{if(this.size!==null)return this.size;let e=this.isConnected?Number.parseFloat(getComputedStyle(this).width):NaN;return Number.isFinite(e)&&e>0?Math.round(e):16};return{get size(){return measure()},scale:Math.max(1,Math.round(globalThis.devicePixelRatio??1)),direction:this.matches(`:dir(rtl)`)?`rtl`:`ltr`}}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(Kr));this.classList.remove(...e);let t=lookupIcon(this.getAttribute(`icon-name`),this._request()),n=t?.kind===`resource`&&t.url===null?{kind:`missing`}:t,r=n?.kind===`resource`&&!n.symbolic?n.url:null,i=n?.kind===`resource`&&n.symbolic?n.url:null;this.classList.toggle(`adw-icon-color`,r!==null),r===null?this.style.removeProperty(`background-image`):this.style.backgroundImage=cssUrl(r),i===null?(this.style.removeProperty(`mask-image`),this.style.removeProperty(`-webkit-mask-image`),this.style.removeProperty(`background-color`)):(this.style.setProperty(`mask-image`,cssUrl(i)),this.style.setProperty(`-webkit-mask-image`,cssUrl(i)),this.style.backgroundColor=`currentColor`),n?.kind===`symbolic`?this.classList.add(`${Kr}${n.name}`):n?.kind===`missing`&&this.classList.add(`${Kr}image-missing`),this.setAttribute(`aria-hidden`,`true`);let a=this.size;if(a===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${a}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 qr={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends WidgetElement{_toasts;_initialized=!1;_queue;_scheduler=qr;_currentEl=null;constructor(){super(),this._queue=new ToastOverlayQueue({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,[{name:`child`,into:e},{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}add_toast(e){this._toasts||this.connectedCallback(),this._queue.add_toast(e)}dismiss_all(){this._queue.dismiss_all()}_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`,e.use_markup?renderPangoMarkup(r,e.title):r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.button_label){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.button_label,n.addEventListener(`click`,()=>{e.emit(`button-clicked`),e.action_name&&activateWidgetAction(this,e.action_name),e.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`,()=>e.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);const Jr=[`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(Jr)).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(C[e])}var AdwAboutDialog=class extends WidgetElement{_initialized=!1;_scrimEl;_sheetEl;_modal;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];_licenseState={...me};_reflecting=!1;_creditSections=[];_acknowledgementSections=[];_legalSections=[];_links=[];_releaseNotesSegments=[];_toastOverlay;static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-type`,`license-url`,`translator-credits`,`release-notes`,`release-notes-version`,`debug-info`,`open`]}static new_from_appdata(e,t){refuseNewFromAppdata()}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._licenseState.license}set license(e){this.setAttribute(`license`,e)}get licenseType(){return this._licenseState.licenseType}set licenseType(e){this.setAttribute(`license-type`,String(e))}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get releaseNotes(){return this.getAttribute(`release-notes`)??``}set releaseNotes(e){this.setAttribute(`release-notes`,e)}get releaseNotesVersion(){return this.getAttribute(`release-notes-version`)??``}set releaseNotesVersion(e){this.setAttribute(`release-notes-version`,e)}get debugInfo(){return this.getAttribute(`debug-info`)??``}set debugInfo(e){this.setAttribute(`debug-info`,e)}add_link(e,t){this._links.push({title:e,url:t}),this._initialized&&this._render()}add_credit_section(e,t){this._creditSections.push({title:e,people:[...t]}),this._initialized&&this._render()}add_acknowledgement_section(e,t){this._acknowledgementSections.push({title:e,people:[...t]}),this._initialized&&this._render()}add_legal_section(e,t,n,r){isLicenseType(n)&&(this._legalSections.push({title:e,copyright:t,licenseType:n,license:r}),this._initialized&&this._render())}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`,C.dialogTitle),this._toastOverlay=document.createElement(`adw-toast-overlay`),this._sheetEl.appendChild(this._toastOverlay),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(t!==n){if(e===`license`||e===`license-type`){this._reflecting||this._applyLicenseAttribute(e,n),this._initialized&&!this._reflecting&&this._render();return}if((e===`release-notes`||e===`release-notes-version`)&&(this._releaseNotesSegments=releaseNotesBuffer({releaseNotes:this.releaseNotes,releaseNotesVersion:this.releaseNotesVersion,version:this.version},C).segments),this._initialized){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()}}}_applyLicenseAttribute(e,t){let n=e===`license`?setLicense(this._licenseState,t??``):setLicenseType(this._licenseState,this._parseLicenseType(t));this._licenseState=n.state,this._reflectLicense();for(let e of n.notify)this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{license:this._licenseState.license,licenseType:this._licenseState.licenseType}}))}_parseLicenseType(e){return e===null?S.UNKNOWN:/^-?\d+$/.test(e.trim())?Number(e):licenseTypeForNick(e.trim())??-1}_reflectLicense(){let{license:e,licenseType:t}=this._licenseState;this._reflecting=!0;try{e.length===0?this.removeAttribute(`license`):this.getAttribute(`license`)!==e&&this.setAttribute(`license`,e);let n=this.getAttribute(`license-type`);t===S.UNKNOWN?n!==null&&this.removeAttribute(`license-type`):(n===null||this._parseLicenseType(n)!==t)&&this.setAttribute(`license-type`,String(t))}finally{this._reflecting=!1}}_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,translatorCredits:this.translatorCredits,creditSections:this._creditSections})}_legalInput(){return{copyright:this.copyright,licenseType:this._licenseState.licenseType,license:this._licenseState.license,legalSections:this._legalSections}}_render(){let e=this._creditsSections(),t=acknowledgementSections(this._acknowledgementSections),n=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,debugInfo:this.debugInfo,releaseNotes:this.releaseNotes,hasCustomLinks:this._links.length>0,hasCredits:e.length>0,hasLegal:legalVisible(this._legalInput()),hasAcknowledgements:t.length>0});this._navView?.remove(),this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(n)),n.whatsNewRow&&this._navView.append(this._buildWhatsNewPage()),n.detailsRow&&this._navView.append(this._buildDetailsPage(n)),n.troubleshootingRow&&this._navView.append(this._buildTroubleshootingPage(),this._buildDebugInfoPage()),n.creditsRow&&this._navView.append(this._buildCreditsPage(e)),n.legalRow&&this._navView.append(this._buildLegalPage()),n.acknowledgementsRow&&this._navView.append(this._buildAcknowledgementsPage(t)),(this._toastOverlay.querySelector(`:scope > .adw-toast-overlay-content`)??this._toastOverlay).appendChild(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`,C.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.whatsNewRow&&r.push(this._buildNavRow(rowLabel(`whatsNewRow`),`whatsnew`)),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)),e.troubleshootingRow&&i.push(this._buildNavRow(rowLabel(`troubleshootingRow`),`troubleshooting`));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.acknowledgementsRow&&a.push(this._buildNavRow(rowLabel(`acknowledgementsRow`),`acknowledgements`)),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`,C.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));for(let e of this._links)t.push(this._buildLinkRow(stripMnemonic(e.title),e.url));n.appendChild(this._buildGroup(`links`,t))}return t}_buildWhatsNewPage(){let{page:e,body:t}=this._buildPage(`whatsnew`,C.whatsNewPage,!1),n=document.createElement(`div`);n.className=`adw-about-dialog-release-notes`;for(let e of this._releaseNotesSegments){let t=document.createElement(`span`);e.tag!==null&&(t.dataset.tag=e.tag),t.textContent=e.text,n.appendChild(t)}return t.appendChild(n),e}_buildTroubleshootingPage(){let{page:e,body:t}=this._buildPage(`troubleshooting`,C.troubleshootingPage,!1),n=document.createElement(`p`);return n.className=`adw-about-dialog-comments`,n.textContent=C.troubleshootingIntro,t.append(n,this._buildGroup(null,[this._buildNavRow(rowLabel(`debugInfoRow`),`debuginfo`)])),e}_buildDebugInfoPage(){let{page:e,body:t}=this._buildPage(`debuginfo`,C.debugInfoPage,!1),n=document.createElement(`pre`);n.className=`adw-about-dialog-debug-info`,n.textContent=this.debugInfo;let r=document.createElement(`button`);return r.type=`button`,r.className=`adw-button pill adw-about-dialog-copy`,r.textContent=rowLabel(`copyText`),r.addEventListener(`click`,()=>this._copyProperty(this.debugInfo)),t.append(n,r),e}_copyProperty(e){e.length!==0&&(Promise.resolve(Rr.writeText(e)).catch(()=>void 0),this._toastOverlay.add_toast(new Toast({title:C.copiedToast})))}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);return n.setAttribute(`title`,e),this._makeLinkRow(n,t),n}_makeLinkRow(e,t){e.setAttribute(`activatable`,``),e.setAttribute(`role`,`link`),e.classList.add(`link`,`adw-about-dialog-link-row`);let n=linkRowTooltip(t);n!==null&&e.setAttribute(`tooltip-text`,n);let r=createGtkImage(linkRowIconName(t),`adw-about-dialog-link-icon`);r.setAttribute(`slot`,`suffix`),r.setAttribute(`aria-hidden`,`true`),e.appendChild(r),e.addEventListener(`activated`,()=>this._activateLink(t))}_buildCreditsPage(e){return this._buildCreditGroupsPage(`credits`,C.creditsPage,e)}_buildAcknowledgementsPage(e){return this._buildCreditGroupsPage(`acknowledgements`,C.acknowledgementsPage,e)}_buildCreditGroupsPage(e,t,n){let{page:r,body:i}=this._buildPage(e,t,!1);for(let e of n){let t=e.people.map(e=>this._buildCreditRow(e));i.appendChild(this._buildGroup(null,t,e.title??void 0))}return r}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;this._makeLinkRow(t,n)}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,C.legalPage,!1),n=this._legalInput(),r=legalSections(n),i=legalSectionVisible(n.copyright,n.licenseType,n.license);for(let[e,a]of r.entries()){if(a.title!==null){let e=document.createElement(`p`);e.className=`adw-about-dialog-legal-title`,e.textContent=a.title,t.appendChild(e)}let r=document.createElement(`p`);r.className=`adw-about-dialog-license`,e===0&&i&&this.licenseUrl&&n.licenseType===S.CUSTOM?(this._renderLegalLabel(r,this.copyright),this.copyright.length>0&&r.append(`
|
|
22
|
+
|
|
23
|
+
`),r.append(this._buildLicenseUrlLink())):this._renderLegalLabel(r,a.markup),a.markup.length>0&&t.appendChild(r)}return e}_buildLicenseUrlLink(){let e=this.licenseUrl,t=document.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,t=>{t.preventDefault(),this._activateLink(e)}),t}_renderLegalLabel(e,t){e.replaceChildren();let n=/<a\s+href="([^\x22]*)">([\s\S]*?)<\/a>/g,r=0,text=t=>{if(t.length===0)return;let n=document.createElement(`span`);renderPangoMarkup(n,t),e.appendChild(n)};for(let i of t.matchAll(n)){text(t.slice(r,i.index)),r=i.index+i[0].length;let n=i[1].replace(/&/g,`&`),a=document.createElement(`a`);renderPangoMarkup(a,i[2]),/^(https?:|mailto:)/i.test(n)&&(a.href=n,a.rel=`noopener noreferrer`,a.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n)})),e.appendChild(a)}text(t.slice(r))}_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(Yr)||e.setAttribute(Yr,``)):(e.removeAttribute(`title`),e.removeAttribute(Yr))}const Yr=`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 Xr=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends TooltipElement{static signals={activated:`activated`};_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}constructor(){super(),installElementApi(this)}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:Xr})}_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 WidgetElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends WidgetElement{static signals={response:`response`,...Object.fromEntries([`heading`,`body`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`prefer-wide-layout`].map(e=>[`notify::${e}`,`notify::${e}`]))};_initialized=!1;_attachedByPresent=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_modal;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;constructor(e){super(),installElementApi(this);for(let[t,n]of Object.entries(e??{})){if(n===void 0)continue;let e=propertyOf(t);if(!(e in this))throw Error(`No property ${t} on <adw-alert-dialog>`);this[e]=n}}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.set_default_response(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.set_close_response(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._responseAreaEl.append(...this._buttons.values()),this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{name:`extra-child`,into:this._childEl},{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);let n=this.getAttribute(`default-response`);n!==null&&(this._model.defaultResponse=n),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.add_response(t,(e.textContent??``).trim()),n!=="default"&&this.set_response_appearance(t,n),booleanAttribute$2(e.getAttribute(`enabled`),!0)||this.set_response_enabled(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.set_close_response(n):e===`default-response`?this.set_default_response(n):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():(this._modal.dismiss(),this._attachedByPresent&&(this._attachedByPresent=!1,this.remove()))))}present(e){this.isConnected||(document.body.appendChild(this),this._attachedByPresent=!0),this.open=!0}add_response(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()}remove_response(e){if(!this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to remove a response with id '${e}', but such a response does not exist`);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()}has_response(e){return this._model.hasResponse(e)}get_response_label(e){return this._model.responses.find(t=>t.id===e)?.label??null}set_response_label(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}get_response_appearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}set_response_appearance(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`))}get_response_enabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}set_response_enabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}get_default_response(){return this._model.defaultResponse}set_default_response(e){this._model.defaultResponse=e,this._render()}get_close_response(){return this._model.closeResponse}set_close_response(e){this._model.closeResponse=e}get_heading(){return this.heading}set_heading(e){this.heading=e}get_body(){return this.body}set_body(e){this.body=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){dispatchElement(this,`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(){if(!this._initialized)return;this.classList.toggle(`open`,this.open);let e=this.heading;this.headingUseMarkup?renderPangoMarkup(this._headingEl,e):this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?renderPangoMarkup(this._bodyEl,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);function requested(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)&&r>=0?r:n}function fillsContainingBlock(e){return[`maximized`,`fullscreened`].some(t=>e.hasAttribute(t)&&e.getAttribute(t)!==`false`)}var AdwWindowFeatures=class{_host;_contentEl=null;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];constructor(e){this._host=e}get contentArea(){return this._contentEl}get content(){return this._contentEl?.firstElementChild??null}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}adopt(e){this._contentEl===null&&(this._contentEl=e,e.classList.add(`adw-window-content`),this._host.addEventListener(`notify::open`,e=>{let t=e.target;t!==this._host&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}addBreakpoint(e){let t=this._host,n=new AdwBreakpoint(e,{onApply:()=>t.dataset.breakpoint=e,onUnapply:()=>{t.dataset.breakpoint===e&&delete t.dataset.breakpoint}});return this._breakpoints.push(n),this.bind(),n}bind(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._contentEl!==null&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this._host,this._breakpoints))}release(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}applySizeRequest(){let e=this._host;e.style.minWidth=`${requested(e,`width-request`,360)}px`,e.style.minHeight=`${requested(e,`height-request`,200)}px`;let t=fillsContainingBlock(e),n=t?null:e.getAttribute(`default-width`)??e.getAttribute(`width`),r=t?null:e.getAttribute(`default-height`)??e.getAttribute(`height`);n?e.style.width=`${n}px`:e.style.removeProperty(`width`),r?e.style.height=`${r}px`:e.style.removeProperty(`height`)}};const Zr={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`}},Qr=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends WidgetElement{_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:Qr})),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(Zr.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`)&&t.getAttribute(`maximized`)!==`false`;return this._controlButton(e?{...Zr.maximize,icon:`window-restore-symbolic`,label:`Restore`}:Zr.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(Zr.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 WidgetElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;_members=new WindowMemberState(e=>this._notifyMember(e));_closing=new CloseRequestState;_syncActive=()=>void this._members.reportActive(this._documentIsActive());_onFocusIn=e=>{e.target instanceof Element&&this._members.reportFocus(e.target)};_onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||t===null&&!document.hasFocus()||this._members.reportFocus(null)};static signals={"close-request":`close-request`,...Object.fromEntries([`application`,`decorated`,`default-height`,`default-width`,`deletable`,`focus-widget`,`fullscreened`,`hide-on-close`,`icon-name`,`is-active`,`maximized`,`modal`,`resizable`,`title`,`transient-for`].map(e=>[`notify::${e}`,`notify::${e}`]))};constructor(){super(),installElementApi(this);let e=this.emit;Object.defineProperty(this,"emit",{configurable:!0,writable:!0,value:(t,...n)=>{if(t===`close-request`)throw Error(`<gtk-window>.emit('close-request') is not supported; call close()`);e(t,...n)}})}static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`,`hidden`]}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 fullscreened(){return this._offByDefault(`fullscreened`)}set fullscreened(e){this._write(`fullscreened`,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)&&this.getAttribute(e)!==`false`}connectedCallback(){if(this._initialized){this._watchActivity(),this._watchTitlebar(),this._render();return}this._initialized=!0,this._watchActivity(),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,[...this.hasTitlebar()?[{name:`titlebar`,into:this._titlebar},{name:`child`,into:this._content}]:[],...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,globalThis.removeEventListener(`focus`,this._syncActive),globalThis.removeEventListener(`blur`,this._syncActive),document.removeEventListener(`visibilitychange`,this._syncActive),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._members.reportActive(!1),this._members.reportFocus(null)}_watchActivity(){globalThis.addEventListener(`focus`,this._syncActive),globalThis.addEventListener(`blur`,this._syncActive),document.addEventListener(`visibilitychange`,this._syncActive),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._syncActive()}_documentIsActive(){return this.isConnected&&!this.hidden&&document.visibilityState!==`hidden`&&document.hasFocus()}_notifyMember(e){let t=e===`is-active`?this._members.active:e===`focus-widget`?this._members.focus:this.maximized;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}hasTitlebar(){return!0}extraSlots(){return[]}attributeChangedCallback(e){if(e===`hidden`){this._syncActive();return}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`)),this.renderFrameSize();let e=this.getAttribute(`title`);e===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,e),this._renderTitlebar()}renderFrameSize(){let e=fillsContainingBlock(this),t=Number.parseFloat(this.getAttribute(`default-width`)??``),n=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[r,i]of[[`width`,t],[`height`,n]])!e&&Number.isFinite(i)&&i>0?this.style.setProperty(r,`${i}px`):this.style.removeProperty(r)}_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||!this.hasTitlebar())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=this._closing.close({realized:this.isConnected,hideOnClose:this._offByDefault(`hide-on-close`),emit:()=>{let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented},hide:()=>void(this.hidden=!0),destroy:()=>this.remove()});return e===`hidden`||e===`destroyed`}present(){this.hidden=!1}get isActive(){return this._members.active}get is_active(){return this._members.active}get focusWidget(){return this.get_focus()}get focus_widget(){return this.get_focus()}set focus_widget(e){this.set_focus(e)}get_focus(){let e=document.activeElement;return e!==null&&e!==this&&this.contains(e)?e:null}set_focus(e){if(e===null){let e=this.get_focus();(e instanceof HTMLElement||e instanceof SVGElement)&&e.blur(),this._members.reportFocus(null);return}if(e===this||!this.contains(e))throw Error(`<gtk-window>.set_focus: the widget is not inside this window`);(e instanceof HTMLElement||e instanceof SVGElement)&&e.focus(),this._members.reportFocus(this.get_focus())}is_maximized(){return this.maximized}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}is_fullscreen(){return this.fullscreened}fullscreen(){this._write(`fullscreened`,`true`)}unfullscreen(){this._write(`fullscreened`,`false`)}};customElements.define(`gtk-window`,GtkWindow),defineWindowApplication(GtkWindow.prototype);var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static signals={...GtkWindow.signals,"notify::show-menubar":`notify::show-menubar`};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),installActionMap(GtkApplicationWindow.prototype);var AdwApplicationWindow=class extends GtkApplicationWindow{_features=new AdwWindowFeatures(this);_model=[];_menubarEl=null;static get observedAttributes(){return[...GtkApplicationWindow.observedAttributes,`width`,`height`,`width-request`,`height-request`,`menu-model`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}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._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`||e===`width-request`||e===`height-request`){this.renderFrameSize();return}super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`)),this._renderMenubar())}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}_followMenubar(){this._menubarEl===null&&(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this._content.prepend(this._menubarEl)),this._renderMenubar()}menubarSection(){return this._menubarEl??super.menubarSection()}_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 WidgetElement{_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 WidgetElement{_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`)?renderPangoMarkup(this._titleEl,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 it)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends WidgetElement{_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 WidgetElement{},AdwBottomSheetSheet=class extends WidgetElement{},AdwBottomSheetBottomBar=class extends WidgetElement{},AdwBottomSheet=class extends WidgetElement{static signals={"notify::open":`notify::open`};_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_modal(){return this.modal}set_modal(e){this.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}constructor(){super(),installElementApi(this)}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 WidgetElement{_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(){bindSlottedChildren(this,[{name:`child`,into:this}]),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 WidgetElement{_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(lt),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(lt),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 TooltipElement{_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 WidgetElement{_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;_pendingScrollPage=null;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`));let t=this._pendingScrollPage;this._pendingScrollPage=null;let n=t?this._idOf(t):null;n!==null&&this._positionWhenMeasurable(this._state.indexOf(n))}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)}scroll_to(e,t){if(!this._initialized){e.parentElement===this&&(this._pendingScrollPage=e);return}let n=this._idOf(e);n!==null&&this._state.scrollTo(this._state.indexOf(n),{animate:t})}get_nth_page(e){if(!this._initialized){let t=this.children[e];return Number.isInteger(e)&&t instanceof HTMLElement?t:null}if(!Number.isInteger(e)||e<0||e>=this._state.nPages)return null;let t=this._state.ids[e],n=t===void 0?null:this._slots.get(t)?.firstElementChild;return n instanceof HTMLElement?n:null}get_n_pages(){return this._initialized?this._state.nPages:this.children.length}get_position(){return this._state.position}_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();if(t>0){if(!e.animate){this._pendingInteractive=null,this._scrollTargetId=null,this._trackEl.scrollTo({left:e.index*t,behavior:`instant`});return}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 WidgetElement{_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 WidgetElement{_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`),mt.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),mt.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 ht)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 ht)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const $r={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends WidgetElement{_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`),mt.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),mt.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`:$r[e]??`auto`,this.style.overflowY=t===null?`auto`:$r[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 ht)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 ht)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 TooltipElement{_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))}set_model(e){this.model=e??[]}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get_selected(){return this.selected}set_selected(e){this.selected=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 ei=[`auto`,`floating`,`bottom-sheet`];var AdwDialog=class extends WidgetElement{_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&&ei.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,[{name:`child`,into:this._contentEl},{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 TooltipElement{_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=Ct,this._applyButton.setAttribute(`aria-label`,Ct),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 WidgetElement{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 TooltipElement{_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 WidgetElement{_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 WidgetElement{_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},{into:this._startEl}],(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 ti={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 ni={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=>ni[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 WidgetElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends WidgetElement{scheduler=ti;_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 Un)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 WidgetElement{_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 WidgetElement{_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 WidgetElement{_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 WidgetElement{static signals={pushed:`pushed`,popped:`popped`,replaced:`replaced`,"notify::visible-page":`notify::visible-page`};_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_visible_page_tag(){return this.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()}constructor(){super(),installElementApi(this)}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}push_by_tag(e){return this.pushByTag(e)}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()??xn,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 WidgetElement{_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 ri={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 WidgetElement{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:ri}),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 ii=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),ai=new Set([...ii,`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=>ai.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:ii.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 WidgetElement{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 WidgetElement{_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(e){this.isConnected||(e??document.body).appendChild(this),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 WidgetElement{_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 TooltipElement{_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.hasAttribute(`role`)||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 WidgetElement{_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 oi=new WeakMap,si=new WeakMap;var AdwSidebarItem=class extends WidgetElement{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=oi.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 WidgetElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=si.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends WidgetElement{_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`)};oi.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};si.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 ci=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of ci){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 TooltipElement{_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 li=`http://www.w3.org/2000/svg`,ui=new Set;let di=0;function tick(e){for(let t of ui)t.drawAt(e);di=ui.size>0?requestAnimationFrame(tick):0}function startTicking(){di===0&&ui.size>0&&(di=requestAnimationFrame(tick))}var AdwSpinner=class extends WidgetElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),ui.add(this),this._origin=null,startTicking()}disconnectedCallback(){ui.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(li,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(li,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(li,`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?An:this._lastProgress)}_lastProgress=An;_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?menuLabelText(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=menuLabelText(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=menuLabelText(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 fi=[`bottom`,`top`,`start`,`end`],pi=[`start`,`end`],mi=[`menu`,`listbox`],hi=[...mi,`dialog`];var GtkPopover=class extends WidgetElement{_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 fi.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return pi.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return hi.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()}takesChild(){return!0}_buildOnce(){this._initialized||(this._initialized=!0,this.takesChild()&&bindSlottedChildren(this,[{name:`child`,into:this}]),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||!mi.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 gi={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},_i={"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`},vi={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends WidgetElement{_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,k),n;let r=menuRefusals(n,k);if(r.length===0)return n;console.error(`${k.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(gi))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=_i[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=vi[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 WidgetElement{_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 TooltipElement{static signals={"notify::active":`notify::active`};_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)}get_active(){return this.active}set_active(e){this.active=e}constructor(){super(),installElementApi(this)}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)},yi=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends WidgetElement{_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 yi)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of yi)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 bi=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends WidgetElement{_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 bi)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of bi)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 WidgetElement{_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,k),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 Si)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of Si)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 v={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,v),v}_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(xi)),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 xi=`16`,Si=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const Ci=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends WidgetElement{static get observedAttributes(){return Ci}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 WidgetElement{_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);var AdwToggle=class extends WidgetElement{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 WidgetElement{_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 WidgetElement{_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 _t)this.classList.toggle(t,e.includes(t));for(let e of vt)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 WidgetElement{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)),new MutationObserver(e=>this._onChildrenRemoved(e)).observe(this,{childList:!0})}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(),t&&clearPageMarks(t),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}}))}_onChildrenRemoved(e){let t=!1;for(let n of e)for(let e of n.removedNodes){if(!(e instanceof HTMLElement)||e.parentElement===this)continue;let n=this._state.pages.find(t=>t.content===e);n!==void 0&&(this._state.removePage(n.name),clearPageMarks(e),t=!0)}t&&(this._applyVisibility(),this._reflectName(),this._emitItemsChanged())}_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);function clearPageMarks(e){e.classList.remove(`adw-view-stack-child`,`active-view`),delete e.dataset.name,e.hidden=!1}var AdwViewSwitcherPage=class extends WidgetElement{},AdwViewSwitcher=class extends WidgetElement{scheduler=ti;_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 Hn)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 WidgetElement{_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 wi)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of wi)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 wi=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);var AdwViewSwitcherBar=class extends WidgetElement{_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);var AdwWindow=class extends GtkWindow{_features=new AdwWindowFeatures(this);static get observedAttributes(){return[...GtkWindow.observedAttributes,`width`,`height`,`width-request`,`height-request`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}connectedCallback(){super.connectedCallback(),this._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`||e===`width-request`||e===`height-request`){this.renderFrameSize();return}super.attributeChangedCallback(e)}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}};customElements.define(`adw-window`,AdwWindow);const Ti=[`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 WidgetElement{_initialized=!1;static get observedAttributes(){return[...Ti]}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 Ei={dark:()=>typeof document<`u`&&isAdwaitaDark(document.documentElement),subscribe(e){if(typeof document>`u`)return()=>{};let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);t?.addEventListener(`change`,e);let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t?.removeEventListener(`change`,e),n.disconnect()}},supportsColorSchemes(){let matches=e=>globalThis.matchMedia?.(e).matches===!0;return matches(`(prefers-color-scheme: dark)`)||matches(`(prefers-color-scheme: light)`)}};Ei.force=e=>{if(typeof document>`u`)return;let t=document.documentElement;t.classList.remove(`theme-dark`,`theme-light`),e!==null&&t.classList.add(e?`theme-dark`:`theme-light`)},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}),Object.freeze({WORD:0,LINE:1});const Di={main:`About`,credits:`Credits`,license:`License`,system:`System`},Oi=[`credits`,`license`,`system`],ki=[`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&&ki.includes(e)?e:`unknown`}set licenseType(e){ki.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`,...Oi]){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 Oi){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 Oi.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=Di[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=ki.indexOf(e),n=t>=0?t:S.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==S.CUSTOM&&n!==S.UNKNOWN){let e=pe[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
|
|
24
|
+
See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document.createTextNode(` for details.`)),r}return n===S.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`,Di.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=`
|
|
25
|
+
>`.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 WidgetElement{_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);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 WidgetElement{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 K={},Ai=new Map([[`gtk-box`,{}],[`gtk-stack`,{}],[`gtk-overlay`,{skip:`.adw-overlay-layer`}],[`gtk-scrolled-window`,{skip:`gtk-scrollbar`}],[`gtk-viewport`,{}],[`adw-bin`,K],[`adw-bottom-sheet`,K],[`adw-breakpoint-bin`,K],[`adw-clamp`,K],[`adw-clamp-scrollable`,K],[`adw-layout-slot`,K],[`adw-multi-layout-view`,K],[`adw-navigation-view`,K],[`adw-overlay-split-view`,K],[`adw-status-page`,K],[`adw-toast-overlay`,K],[`adw-toolbar-view`,K],[`adw-view-stack`,K],[`adw-header-bar`,{horizontalOnly:!0}]]),ji={horizontal:`hexpand`,vertical:`vexpand`};function vfuncOf(e){let t=Ai.get(e.localName);if(t!==void 0)return t;if(typeof customElements.getName==`function`)for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;){let e=customElements.getName(t.constructor),n=e===null?void 0:Ai.get(e);if(n!==void 0)return n;t=Object.getPrototypeOf(t)}}function isWidget(e){return e.localName.includes(`-`)||e.hasAttribute(`hexpand`)||e.hasAttribute(`vexpand`)}function isStackPage(e){return e.classList.contains(`adw-view-stack-child`)&&e.parentElement?.localName===`adw-view-stack`}function explicitExpand(e,t){let n=e.getAttribute(ji[t]);return n===null?void 0:n!==`false`}function computeExpand(e,t){if(e.hasAttribute(`hidden`)&&!isStackPage(e))return!1;let n=explicitExpand(e,t);if(n!==void 0)return n;let r=vfuncOf(e);return r===void 0||r.horizontalOnly&&t===`vertical`?!1:anyChildExpands(e,t,r.skip)}function anyChildExpands(e,t,n){for(let r of e.children)if(!(n!==void 0&&r.matches(n))){if(isWidget(r)){if(computeExpand(r,t))return!0}else if(anyChildExpands(r,t,void 0))return!0}return!1}const Mi=[`orientation`,`spacing`,`homogeneous`],Ni={horizontal:`data-computed-hexpand`,vertical:`data-computed-vexpand`};var GtkBox=class extends WidgetElement{_expandObserver=null;static get observedAttributes(){return[...Mi]}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(),this._syncComputedExpand(),!this._expandObserver&&(this._expandObserver=new MutationObserver(e=>{e.some(affectsExpand)&&this._syncComputedExpand()}),this._expandObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`hexpand`,`vexpand`,`hidden`]}))}disconnectedCallback(){this._expandObserver?.disconnect(),this._expandObserver=null}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`}_syncComputedExpand(){for(let e of this.children)for(let t of[`horizontal`,`vertical`]){let n=explicitExpand(e,t)===void 0&&computeExpand(e,t);e.toggleAttribute(Ni[t],n)}}};function affectsExpand(e){if(e.type!==`childList`)return!0;let isElement=e=>e.nodeType===Node.ELEMENT_NODE;return[...e.addedNodes].some(isElement)||[...e.removedNodes].some(isElement)}customElements.define(`gtk-box`,GtkBox);const Pi=[`aria-label`,`aria-description`];function forwardAccessibleName(e,t){for(let n of Pi){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}return e.hasAttribute(`aria-label`)}const Fi=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends TooltipElement{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`,...Pi]}get icon_name(){return this.getAttribute(`icon-name`)}set icon_name(e){this.reflect(`icon-name`,e)}get iconName(){return this.icon_name}set iconName(e){this.icon_name=e}reflect(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}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=[...Fi.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??``,!forwardAccessibleName(this,e)&&r&&!i&&e.setAttribute(`aria-label`,a??r),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Ii=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Li=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],q=[{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 WidgetElement{_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:q[0].icon,tooltip:q[0].tooltip},nextMonth:{icon:q[1].icon,tooltip:q[1].tooltip},previousYear:{icon:q[2].icon,tooltip:q[2].tooltip},nextYear:{icon:q[3].icon,tooltip:q[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=Li[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`,`${Li[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=Ii[(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=q.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&¬ify(`month`,this._date.month-1),e.yearChanged&¬ify(`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 Ri={top:0,center:.5,bottom:1};var GtkCenterBox=class extends WidgetElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in Ri?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 Ri?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(Ri[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const zi=new RadioGroupState;var AdwCheckBase=class extends WidgetElement{_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,forwardAccessibleName(this,this._input)}},Bi=class GtkCheckButton extends AdwCheckBase{static signals={toggled:`toggled`,"notify::active":`notify::active`};static get observedAttributes(){return[`checked`,`active`,`indeterminate`,`disabled`,`label`,`group`,...Pi]}get inputType(){return`checkbox`}set group(e){if(typeof e==`string`){this.setAttribute(`group`,e);return}this.set_group(e)}set_group(e){setCheckGroup(this,e),this.render(),e?.render()}get_active(){return this.checked}set_active(e){this.checked=e}attributeChangedCallback(e){if(e===`checked`&&this.checked)for(let e of checkGroupNeighbours(this))e.checked=!1;e===`group`&&this.isConnected&&this._resolveGroup(),super.attributeChangedCallback(e)}onConnected(){this._resolveGroup()}_resolveGroup(){let e=this.getAttribute(`group`);if(e===null)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);if(!(t instanceof GtkCheckButton))throw Error(`gtk-check-button group="${e}" names no gtk-check-button in this document`);this.set_group(t)}render(){if(this._input===void 0)return;super.render();let e=isRadioCheck(this);this.toggleAttribute(`radio`,e),e?this._input.setAttribute(`role`,`radio`):this._input.removeAttribute(`role`)}activate(){if(!checkActivationFlips(this,this.checked)){this.render();return}this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`,...Pi]}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}zi.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=zi.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&zi.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,Bi),customElements.define(`adw-radio`,AdwRadio);const Vi={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends WidgetElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Vi};_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 Hi=/^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=Hi.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 Ui=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Ui,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 Wi=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&Wi.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends WidgetElement{_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=Ui,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 WidgetElement{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_selected(){return this.selected}set_selected(e){this.selected=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 Gi=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends WidgetElement{_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,Gi)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Gi)))}_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 Ki=new WeakMap;var qi=class GtkDragIcon extends WidgetElement{_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:Ki.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&&Ki.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`,bindSlottedChildren(this,[{name:`child`,into:this}]),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`,qi);var GtkEditableLabel=class extends WidgetElement{_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 Ji=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>Ji.includes(e))}const Yi=[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`)],Xi=[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`)],Zi=[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`)],Qi=[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`)],$i=[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`)],ea=[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`)],ta=[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`)],na=[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`)],ra=[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`)],ia=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:Yi},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:Xi},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:Zi},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:Qi},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:$i},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:ea},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:ta},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:na},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:ra}];[...ia.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:ia.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;takesChild(){return!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 ia){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=>!Ji.includes(e)).join(``);for(let t of[i,...Ji.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 WidgetElement{_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(St,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 aa={left:`start`,right:`end`,center:`center`,fill:`justify`},oa=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends WidgetElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...oa]}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)}get_label(){return this.label}set_label(e){this.label=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.maxWidth=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.maxWidth=e===null?``:`min(100%, ${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=aa[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 sa=0;var GtkExpander=class extends WidgetElement{_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-${sa++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends WidgetElement{_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 WidgetElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{name:`child`,into:this._contentsEl},{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 WidgetElement{_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 ca={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},la=[{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={...ca,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=la.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 la)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 WidgetElement{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 ua=[`family`,`face`,`font`,`features`],da=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends WidgetElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...ca};_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 ua.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 da){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={...ca,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 WidgetElement{_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 fa=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...fa];let n=t.split(/[\s,|]+/).filter(e=>fa.includes(e));return fa.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 WidgetElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...fa];_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=fa.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 WidgetElement{_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,[{name:`child`,into:this._childEl},{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 WidgetElement{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 WidgetElement{_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 pa=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return pa.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return vn.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 WidgetElement{_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 ma=[[`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 WidgetElement{_trough;_initialized=!1;_offsets=ma.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 WidgetElement{_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,[{name:`child`,into:this._contentsEl},{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 ha=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&ha.has(e)?e:`all`}var GtkListBox=class extends WidgetElement{_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 WidgetElement{_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 ga={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends WidgetElement{_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,k),n;let r=menuRefusals(n,k);if(r.length===0)return n;console.error(`${k.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=ga[Vn(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 _a=[`top`,`bottom`,`left`,`right`],va=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends WidgetElement{_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&&_a.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:[...va,`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&&va.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 ya=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends WidgetElement{_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,[{name:`child`,into:this._childEl},{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 ya)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const J=25.4,Y=[{name:`na_letter`,displayName:`US Letter`,width:8.5*J,height:11*J},{name:`na_legal`,displayName:`US Legal`,width:8.5*J,height:14*J},{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*J,height:10.75*J},{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*J,height:9.5*J},{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*J,height:17*J},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],ba=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*J,bottom:(ba.has(e.name)?.56:.25)*J,left:.25*J,right:.25*J}}function defaultPageSetup(){let e=Y.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return Y.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??Y[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/J,height:a/J}}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/J,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(`
|
|
26
|
+
`)}const xa={name:`Any Printer`,location:`For portable documents`},Sa=[[`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 Sa){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[xa,...this._printers]}_fillPaperSizes(){this._setups=Y.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===xa.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 WidgetElement{_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},{name:`start-child`,into:this._startEl},{name:`end-child`,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 Ca=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return Ca.includes(e)?e:`contain`}var GtkPicture=class extends WidgetElement{_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 wa=`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,k),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?wa:e}set visibleSubmenu(e){this.openSubmenu(e)}takesChild(){return!1}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??wa)}}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===wa||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(wa)}_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,k);if(t.length===0)return e;console.error(`${k.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 WidgetElement{_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,k),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`),bindSlottedChildren(this,[{name:`child`,into:this}]),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,k);if(t.length===0)return e;console.error(`${k.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 WidgetElement{_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,k),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=menuLabelText(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,k);if(t.length>0){console.error(`${k.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 Ta=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],Ea=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],Da=[`All sheets`,`Even sheets`,`Odd sheets`],Oa=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],ka={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...ka};_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=>Ta.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={...ka,...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=>Ta.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 Ea){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(Da,`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=Y.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(Oa.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=Oa[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=Y[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(...Ea.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 WidgetElement{_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 Aa=[`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`],ja=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Ma=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Na=new Set([`swing-right`,`swing-left`]),Pa=new Set([`swing-up`,`swing-down`]),Fa=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Ia={"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 WidgetElement{_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 Aa.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)`)?Ia[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?ja:Ma,r=e===`horizontal`?Na:Pa;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=Fa.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const La=[`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 WidgetElement{_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 La.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 Ra={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends WidgetElement{_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={...Ra,...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 WidgetElement{_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._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),bindSlottedChildren(this,[{name:`child`,into:this._center},{into:this._center}]).install(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 za=[`always`,`never`,`automatic`,`external`],Ba=[`always`,`automatic`,`never`,`external`],Va=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return za.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Va.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 Ha=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssSize:`width`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssSize:`height`,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 WidgetElement{_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[Ba.indexOf(this.hscrollbarPolicy),Ba.indexOf(this.vscrollbarPolicy)]}set_policy(e,t){let nick=(e,t)=>{let n=Number.isInteger(e)?Ba[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 child(){return this._built?this._viewport.firstElementChild:this.firstElementChild}set child(e){this.set_child(e)}get_child(){return this.child}set_child(e){let t=this.child;e!==t&&(this._built?this._viewport.replaceChildren(...e===null?[]:[e]):(t?.remove(),e!==null&&this.appendChild(e)),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}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,[{name:`child`,into:this._viewport},{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 Va)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 Ha){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.cssSize]=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 Ha){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 Ua=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends WidgetElement{_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??Ua}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 Wa=1e-10,Ga=[`always`,`if-valid`];var GtkSpinButton=class extends WidgetElement{_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 Ga.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)<Wa?(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)<Wa?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>Wa&&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<=Wa,this._down.disabled=!this.wrap&&e.value-e.lower<=Wa,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 Ka=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends WidgetElement{_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(Ka,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(Ka,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(Ka,`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 qa=[`name`,`title`,`icon-name`,`needs-attention`,`use-underline`];var GtkStackPage=class extends WidgetElement{static get observedAttributes(){return[...qa]}get name(){return this.getAttribute(`name`)??``}set name(e){e===null?this.removeAttribute(`name`):this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get needsAttention(){return this.hasAttribute(`needs-attention`)}set needsAttention(e){this.toggleAttribute(`needs-attention`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get visible(){return!this.hasAttribute(`hidden`)}set visible(e){this.toggleAttribute(`hidden`,!e)}get child(){return pageChildOf(this)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}};function pageChildOf(e){let t=Array.from(e.children),n=t.filter(e=>e.getAttribute(`slot`)===`child`),r=n.length>0?n:t;if(r.length>1)throw Error(`<gtk-stack-page name="${e.getAttribute(`name`)??``}"> holds ${r.length} children, and a GtkStackPage has one \`child\`.`);return r[0]??null}customElements.define(`gtk-stack-page`,GtkStackPage);const Ja=[`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`],Ya=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Xa={"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 Za=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends WidgetElement{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&&Ja.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(this._adopt(e));this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Za,`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}_adopt(e){if(e.localName!==`gtk-stack-page`)return e;let t=pageChildOf(e);if(t===null)throw Error(`<gtk-stack-page name="${e.getAttribute(`name`)??``}"> has no child, so the stack would hold a page with nothing to show.`);for(let n of qa){let r=e.getAttribute(n);r!==null&&t.setAttribute(n,r)}return e.hasAttribute(`hidden`)&&t.setAttribute(`hidden`,``),t.removeAttribute(`slot`),this.replaceChild(t,e),t}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_isPage(e){return e.parentNode===this}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){if(a.target!==this)continue;for(let e of Array.from(a.removedNodes))e instanceof HTMLElement&&e.localName===`gtk-stack-page`||(e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1);for(let e of Array.from(a.addedNodes))if(e instanceof HTMLElement){if(e.localName===`gtk-stack-page`){e.parentElement===this&&this._adopt(e);continue}this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e))}continue}let e=a.attributeName;if(!(!e||!this._isPage(a.target))){if(e===`hidden`){(!this._visible||!this._page(this._visible).visible)&&this._show(this._firstVisible());continue}Za.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`||!this._isPage(t.target))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(Ya.has(n)&&!e?n=`none`:Ya.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=Xa[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 WidgetElement{_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 WidgetElement{_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 WidgetElement{_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(St,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 Qa=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Qa.includes(e??``)?e:`none`}const $a={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends WidgetElement{_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 buffer(){return{cursor_position:this._area?this._area.selectionEnd??this._area.value.length:this.text.length,insert_at_cursor:(e,t=-1)=>{let n=t<0?e:e.slice(0,t),r=this._area;if(!r){this.text+=n;return}let i=r.selectionEnd??r.value.length;r.setRangeText(n,i,i,`end`),this._emitChanged()},set_text:(e,t=-1)=>{this.text=t<0?e:e.slice(0,t),this._area&&this._emitChanged()},get_text:()=>this.text}}get_buffer(){return this.buffer}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=$a[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=aa[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 WidgetElement{_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()),bindSlottedChildren(this,[{name:`child`,into:this}]),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 WidgetElement{_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 eo=[`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 WidgetElement{_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(){bindSlottedChildren(this,[{name:`child`,into:this}]),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 eo){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 to={"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`}},no={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},ro=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 WidgetElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=to[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:ro.has(r)?r:`none`}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),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:no[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);function extensionsOf(e){return[...e.patterns,...e.suffixes].map(e=>`.${e}`)}function filePickerOptions(e,t){let n=[];for(let t of e.filters){if(t.acceptAll)continue;let e={};for(let n of t.mimeTypes)e[n]=[];let r=extensionsOf(t);r.length>0&&(e[t.mimeTypes[0]??`application/octet-stream`]=r),n.push({description:t.name??``,accept:e})}let r={};return n.length>0&&(r.types=n,r.excludeAcceptAllOption=!e.filters.some(e=>e.acceptAll)),t===`save`&&e.initialName!==null&&(r.suggestedName=e.initialName),r}function inputAccept(e){if(!e||e.acceptAll)return null;let t=[...extensionsOf(e),...e.mimeTypes];return t.length>0?t.join(`,`):null}function writeInWorker(e,t){let n=URL.createObjectURL(new Blob([`onmessage = async (event) => {
|
|
22
27
|
const { handle, data } = event.data;
|
|
23
28
|
let access = null;
|
|
24
29
|
try {
|
|
@@ -32,18 +37,18 @@ See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document
|
|
|
32
37
|
} finally {
|
|
33
38
|
if (access) access.close();
|
|
34
39
|
}
|
|
35
|
-
};`],{type:`text/javascript`})),r=new Worker(n);return new Promise((n,i)=>{r.onmessage=e=>{e.data.ok?n():i(Error(e.data.message))},r.onerror=e=>i(Error(e.message||`the write worker failed`)),r.postMessage({handle:e,data:t})}).finally(()=>{r.terminate(),URL.revokeObjectURL(n)})}function concat(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}async function openWriter(e,t){if(t.canStreamWrite(e)){let t=await e.createWritable();return{write:e=>t.write(e),close:()=>t.close()}}let n=[];return{write:async e=>void n.push(e.slice()),close:()=>writeInWorker(e,concat(n))}}function handleFor(e,t){return{basename:e.name,read:async()=>new Uint8Array(await(await e.getFile()).arrayBuffer()),openWriter:()=>openWriter(e,t)}}async function freeName(e,t){let n=t.lastIndexOf(`.`),r=n>0?t.slice(0,n):t,i=n>0?t.slice(n):``;for(let n=1;;n++){let a=n===1?t:`${r} (${n})${i}`;try{await e.getFileHandle(a)}catch{return a}}}async function copyIntoOpfs(e,t,n){let r=await e.getFileHandle(await freeName(e,t.name),{create:!0}),i=await openWriter(r,n);return await i.write(new Uint8Array(await t.arrayBuffer())),await i.close(),r}function isAbort(e){return e?.name===`AbortError`}function dialogRejection(e){if(e instanceof GLibError)return e;if(isAbort(e))return dismissedError();let t=e;return t&&typeof t.message==`string`?dialogFailedError(`${t.name??`Error`}: ${t.message}`):dialogFailedError(String(e))}function createWebFileChooserDriver(e){let run=async(t,n)=>{if(!e.isActive())throw dialogFailedError(`Gtk.FileDialog.${t}() needs a user activation (a click or a key press)`);try{if(e.showSaveFilePicker&&e.showOpenFilePicker){let r=filePickerOptions(n,t),i=t===`open`?(await e.showOpenFilePicker(r))[0]:await e.showSaveFilePicker(r);if(!i)throw dismissedError();return handleFor(i,e)}let r=await e.opfsRoot(),i=await e.choose(t,n,r);if(i===null)throw dismissedError();return`upload`in i?handleFor(await copyIntoOpfs(r,i.upload,e),e):handleFor(await r.getFileHandle(i.name,{create:t===`save`}),e)}catch(e){throw dialogRejection(e)}};return{open:e=>run(`open`,e),save:e=>run(`save`,e)}}function el$1(e,t={},n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return n!==void 0&&(r.textContent=n),r}__name(el$1,`el`);function sameFilter(e,t){return JSON.stringify(e)===JSON.stringify(t)}function presentOpfsDialog(e,t,n){let r=t.filters,i=t.defaultFilter?r.findIndex(e=>sameFilter(e,t.defaultFilter)):0,a=r[Math.max(i,0)]??t.defaultFilter,o=el$1(`adw-dialog`,{title:t.title??(e===`open`?`Open File`:`Save File`),"content-width":`720`,"content-height":`480`}),s=el$1(`adw-overlay-split-view`,{breakpoint:`max-width: 560px`}),c=el$1(`div`,{slot:`sidebar`}),l=el$1(`gtk-list-box`,{class:`navigation-sidebar`,"selection-mode":`browse`});l.append(el$1(`gtk-list-box-row`,{},`Origin Storage`)),c.append(l);let u=el$1(`adw-toolbar-view`),d=el$1(`gtk-list-box`,{"selection-mode":`single`,"activate-on-single-click":`false`}),f=el$1(`p`,{class:`dimmed`,hidden:``},`No files`),p=el$1(`div`,{slot:`bottom`,class:`toolbar`}),m=null;r.length>0&&(m=el$1(`gtk-drop-down`),m.model=r.map((e,t)=>e.name??`Filter ${t+1}`),m.selected=Math.max(i,0),p.append(m));let g=null;e===`save`&&(g=el$1(`gtk-entry`,{"placeholder-text":`Name`}),g.style.flex=`1`,g.value=t.initialName??``,p.append(g));let _=null;e===`open`&&(_=el$1(`gtk-button`,{label:`Upload…`}),p.append(_));let v=el$1(`div`);v.style.flex=`1`;let ee=el$1(`gtk-button`,{label:e===`open`?`Open`:`Save`,suggested:``});p.append(v,ee),u.append(d,f,p),s.append(c,u),o.append(s);let y=null,refill=async()=>{o.removeAttribute(`data-ready`);let e=[];for await(let[t,r]of n.entries())r.kind===`file`&&(!a||fileFilterAccepts(a,t))&&e.push(t);e.sort((e,t)=>e.localeCompare(t)),d.replaceChildren(...e.map(e=>el$1(`gtk-list-box-row`,{"data-name":e},e))),y=null,f.hidden=e.length>0,o.setAttribute(`data-ready`,``)};return new Promise(t=>{let n=!1,finish=e=>{n||(n=!0,t(e),o.forceClose(),o.remove())},acceptCurrent=()=>{if(e===`open`){y!==null&&finish({name:y});return}let t=g.value.trim();t!==``&&!t.includes(`/`)&&t!==`.`&&t!==`..`&&finish({name:t})};d.addEventListener(`row-selected`,e=>{y=e.detail.row?.dataset.name??null,g&&y!==null&&(g.value=y)}),d.addEventListener(`row-activated`,e=>{y=e.detail.row.dataset.name??null,g&&y!==null&&(g.value=y),acceptCurrent()}),g?.addEventListener(`activate`,acceptCurrent),ee.addEventListener(`click`,acceptCurrent),m?.addEventListener(`notify::selected`,e=>{a=r[e.detail.selected]??null,refill()}),_?.addEventListener(`click`,()=>{let e=document.createElement(`input`);e.type=`file`;let t=inputAccept(a);t!==null&&(e.accept=t),e.addEventListener(`change`,()=>{let t=e.files?.[0];t&&finish({upload:t})}),e.addEventListener(`cancel`,()=>finish(null)),e.click()}),o.addEventListener(`closed`,()=>finish(null)),o.present(),refill()})}function browserFileChooserEnv(){let e=typeof globalThis>`u`?{}:globalThis,t=`showSaveFilePicker`in e&&`showOpenFilePicker`in e;return{showOpenFilePicker:t?t=>e.showOpenFilePicker(t):void 0,showSaveFilePicker:t?t=>e.showSaveFilePicker(t):void 0,isActive:()=>typeof navigator<`u`&&navigator.userActivation?navigator.userActivation.isActive:!0,opfsRoot:async()=>{if(typeof navigator>`u`||typeof navigator.storage?.getDirectory!=`function`)throw Error(`this browser has neither the File System Access pickers nor an Origin Private File System`);return navigator.storage.getDirectory()},choose:presentOpfsDialog,canStreamWrite:e=>typeof e.createWritable==`function`}}registerFileChooserDriver(createWebFileChooserDriver(browserFileChooserEnv())),createAppInfo(
|
|
36
|
-
`)} }`)}}function inheritStyles(e,t){if(!t||
|
|
37
|
-
`)),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}const
|
|
40
|
+
};`],{type:`text/javascript`})),r=new Worker(n);return new Promise((n,i)=>{r.onmessage=e=>{e.data.ok?n():i(Error(e.data.message))},r.onerror=e=>i(Error(e.message||`the write worker failed`)),r.postMessage({handle:e,data:t})}).finally(()=>{r.terminate(),URL.revokeObjectURL(n)})}function concat(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}async function openWriter(e,t){if(t.canStreamWrite(e)){let t=await e.createWritable();return{write:e=>t.write(e),close:()=>t.close()}}let n=[];return{write:async e=>void n.push(e.slice()),close:()=>writeInWorker(e,concat(n))}}function handleFor(e,t){return{basename:e.name,read:async()=>new Uint8Array(await(await e.getFile()).arrayBuffer()),openWriter:()=>openWriter(e,t)}}async function freeName(e,t){let n=t.lastIndexOf(`.`),r=n>0?t.slice(0,n):t,i=n>0?t.slice(n):``;for(let n=1;;n++){let a=n===1?t:`${r} (${n})${i}`;try{await e.getFileHandle(a)}catch{return a}}}async function copyIntoOpfs(e,t,n){let r=await e.getFileHandle(await freeName(e,t.name),{create:!0}),i=await openWriter(r,n);return await i.write(new Uint8Array(await t.arrayBuffer())),await i.close(),r}function isAbort(e){return e?.name===`AbortError`}function dialogRejection(e){if(e instanceof GLibError)return e;if(isAbort(e))return dismissedError();let t=e;return t&&typeof t.message==`string`?dialogFailedError(`${t.name??`Error`}: ${t.message}`):dialogFailedError(String(e))}function createWebFileChooserDriver(e){let run=async(t,n)=>{if(!e.isActive())throw dialogFailedError(`Gtk.FileDialog.${t}() needs a user activation (a click or a key press)`);try{if(e.showSaveFilePicker&&e.showOpenFilePicker){let r=filePickerOptions(n,t),i=t===`open`?(await e.showOpenFilePicker(r))[0]:await e.showSaveFilePicker(r);if(!i)throw dismissedError();return handleFor(i,e)}let r=await e.opfsRoot(),i=await e.choose(t,n,r);if(i===null)throw dismissedError();return`upload`in i?handleFor(await copyIntoOpfs(r,i.upload,e),e):handleFor(await r.getFileHandle(i.name,{create:t===`save`}),e)}catch(e){throw dialogRejection(e)}};return{open:e=>run(`open`,e),save:e=>run(`save`,e)}}function el$1(e,t={},n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return n!==void 0&&(r.textContent=n),r}__name(el$1,`el`);function sameFilter(e,t){return JSON.stringify(e)===JSON.stringify(t)}function presentOpfsDialog(e,t,n){let r=t.filters,i=t.defaultFilter?r.findIndex(e=>sameFilter(e,t.defaultFilter)):0,a=r[Math.max(i,0)]??t.defaultFilter,o=el$1(`adw-dialog`,{title:t.title??(e===`open`?`Open File`:`Save File`),"content-width":`720`,"content-height":`480`}),s=el$1(`adw-overlay-split-view`,{breakpoint:`max-width: 560px`}),c=el$1(`div`,{slot:`sidebar`}),l=el$1(`gtk-list-box`,{class:`navigation-sidebar`,"selection-mode":`browse`});l.append(el$1(`gtk-list-box-row`,{},`Origin Storage`)),c.append(l);let u=el$1(`adw-toolbar-view`),d=el$1(`gtk-list-box`,{"selection-mode":`single`,"activate-on-single-click":`false`}),f=el$1(`p`,{class:`dimmed`,hidden:``},`No files`),p=el$1(`div`,{slot:`bottom`,class:`toolbar`}),m=null;r.length>0&&(m=el$1(`gtk-drop-down`),m.model=r.map((e,t)=>e.name??`Filter ${t+1}`),m.selected=Math.max(i,0),p.append(m));let g=null;e===`save`&&(g=el$1(`gtk-entry`,{"placeholder-text":`Name`}),g.style.flex=`1`,g.value=t.initialName??``,p.append(g));let _=null;e===`open`&&(_=el$1(`gtk-button`,{label:`Upload…`}),p.append(_));let v=el$1(`div`);v.style.flex=`1`;let ee=el$1(`gtk-button`,{label:e===`open`?`Open`:`Save`,suggested:``});p.append(v,ee),u.append(d,f,p),s.append(c,u),o.append(s);let y=null,refill=async()=>{o.removeAttribute(`data-ready`);let e=[];for await(let[t,r]of n.entries())r.kind===`file`&&(!a||fileFilterAccepts(a,t))&&e.push(t);e.sort((e,t)=>e.localeCompare(t)),d.replaceChildren(...e.map(e=>el$1(`gtk-list-box-row`,{"data-name":e},e))),y=null,f.hidden=e.length>0,o.setAttribute(`data-ready`,``)};return new Promise(t=>{let n=!1,finish=e=>{n||(n=!0,t(e),o.forceClose(),o.remove())},acceptCurrent=()=>{if(e===`open`){y!==null&&finish({name:y});return}let t=g.value.trim();t!==``&&!t.includes(`/`)&&t!==`.`&&t!==`..`&&finish({name:t})};d.addEventListener(`row-selected`,e=>{y=e.detail.row?.dataset.name??null,g&&y!==null&&(g.value=y)}),d.addEventListener(`row-activated`,e=>{y=e.detail.row.dataset.name??null,g&&y!==null&&(g.value=y),acceptCurrent()}),g?.addEventListener(`activate`,acceptCurrent),ee.addEventListener(`click`,acceptCurrent),m?.addEventListener(`notify::selected`,e=>{a=r[e.detail.selected]??null,refill()}),_?.addEventListener(`click`,()=>{let e=document.createElement(`input`);e.type=`file`;let t=inputAccept(a);t!==null&&(e.accept=t),e.addEventListener(`change`,()=>{let t=e.files?.[0];t&&finish({upload:t})}),e.addEventListener(`cancel`,()=>finish(null)),e.click()}),o.addEventListener(`closed`,()=>finish(null)),o.present(),refill()})}function browserFileChooserEnv(){let e=typeof globalThis>`u`?{}:globalThis,t=`showSaveFilePicker`in e&&`showOpenFilePicker`in e;return{showOpenFilePicker:t?t=>e.showOpenFilePicker(t):void 0,showSaveFilePicker:t?t=>e.showSaveFilePicker(t):void 0,isActive:()=>typeof navigator<`u`&&navigator.userActivation?navigator.userActivation.isActive:!0,opfsRoot:async()=>{if(typeof navigator>`u`||typeof navigator.storage?.getDirectory!=`function`)throw Error(`this browser has neither the File System Access pickers nor an Origin Private File System`);return navigator.storage.getDirectory()},choose:presentOpfsDialog,canStreamWrite:e=>typeof e.createWritable==`function`}}registerFileChooserDriver(createWebFileChooserDriver(browserFileChooserEnv())),createAppInfo(Mr);const X=createGdk(Rr);X.Display,X.Clipboard,X.ContentProvider,X.ContentFormats,X.AppLaunchContext;const{KEY_space:io,KEY_a:ao,KEY_d:oo,KEY_e:so,KEY_q:co,KEY_s:lo,KEY_w:uo,KEY_Return:fo,KEY_Escape:po,KEY_Left:mo,KEY_Up:ho,KEY_Right:_o,KEY_Down:vo}=O,Z=createGLibTimers();Z.PRIORITY_HIGH,Z.PRIORITY_DEFAULT,Z.PRIORITY_HIGH_IDLE,Z.PRIORITY_DEFAULT_IDLE,Z.PRIORITY_LOW,Z.SOURCE_REMOVE,Z.SOURCE_CONTINUE,Z.idle_add,Z.timeout_add,Z.source_remove;const yo=new Set;function splitSelectorList(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`||a===`[`?n++:a===`)`||a===`]`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}function rulesOf(e){try{return e.cssRules}catch{return null}}function copyRules(e,t,n,r){for(let i of Array.from(e))if(i instanceof CSSStyleRule){let e=splitSelectorList(i.selectorText).filter(e=>t.test(e));if(e.length===0)continue;let a=e.map(e=>e.replace(new RegExp(t.source,`g`),n)).join(`, `);r.push(`${a} { ${i.style.cssText} }`)}else if(`cssRules`in i){let e=[];if(copyRules(i.cssRules,t,n,e),e.length===0)continue;let a=i.cssText.slice(0,i.cssText.indexOf(`{`)).trim();r.push(`${a} { ${e.join(`
|
|
41
|
+
`)} }`)}}function inheritStyles(e,t){if(!t||yo.has(e))return;yo.add(e);let n=RegExp(`(?<![\\w-])${t}(?![\\w-])`),r=[],i=[...Array.from(document.styleSheets),...document.adoptedStyleSheets];for(let t of i){let i=rulesOf(t);i&©Rules(i,n,e,r)}if(r.length===0)return;let a=new CSSStyleSheet;a.replaceSync(r.join(`
|
|
42
|
+
`)),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}const bo=new WeakMap,xo=new WeakSet,So=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=bo.get(e);if(t!==void 0){bo.delete(e);for(let n of t)n.finish(),e.append(...n.children)}}const Q=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=bo.get(e)??[];n.push(t),bo.set(e,n)},register(e,t){if(!isElementClass(e))return;let n=tagForTypeName(t.typeName),r=So.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),a=typeof customElements.getName==`function`?customElements.getName(i):null;class Constructing extends i{constructor(e){if(super(),xo.has(this))return;xo.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 o=e.prototype;for(let[e,t]of Object.entries({...widgetDisplayMembers(X),...widgetTreeMembers(),...widgetControllerMembers(Mr)}))e in o||Object.defineProperty(o,e,{value:t,writable:!0,configurable:!0});let s=o.connectedCallback;Object.defineProperty(o,"connectedCallback",{configurable:!0,writable:!0,value(){attachPending(this),syncDirection(this),inheritStyles(n,a),s?.call(this)}}),declareSignals(e,t),customElements.define(n,e),So.set(n,t.typeName),registerTemplateClass(t.typeName,n)}});Q.Object,Q.registerClass,Q.type_ensure,Q.signal_stop_emission_by_name,Q.ParamSpec,Q.ParamFlags,Q.Value,Q.TYPE_STRING,Q.TYPE_BOOLEAN,Q.TYPE_INT,Q.TYPE_UINT,Q.TYPE_DOUBLE,Q.GTypeName,Q.GTypeFlags,Q.interfaces,Q.properties,Q.signals,Q.requires,Q.__gtkTemplate__,Q.__gtkCssName__,Q.__gtkChildren__,Q.__gtkInternalChildren__;let Co=1;var SignalEmitter=class{constructor(){this.handlers=new Map,this.emissions=[]}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=Co++;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`)}classHandler(e,t){}emit(e,...t){this.run(e,t,!1)}emitHandled(e,...t){return this.run(e,t,!0)}run(e,t,n){let r=Array.from(this.handlers).filter(([,t])=>t.name===e),i={name:e,stopped:!1};this.emissions.push(i);let a=!1,stage=e=>{for(let[o,s]of r){if(i.stopped)return!0;if(s.after!==e||!this.handlers.has(o))continue;let r=s.callback(this,...t);if(n&&r)return a=!0,!0}return i.stopped};try{if(stage(!1))return a;let r=this.classHandler(e,t);return n&&r?!0:(i.stopped||stage(!0),a)}finally{this.emissions.splice(this.emissions.lastIndexOf(i),1)}}[b](e){for(let t=this.emissions.length-1;t>=0;t--){let n=this.emissions[t];if(n.name===e&&!n.stopped){n.stopped=!0;return}}console.warn(`no emission of signal "${e}" to stop`)}},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 wo=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(`
|
|
38
43
|
`)),this.highlight=n!==!1&&String(n)!==`false`}get text(){return this.lines.join(`
|
|
39
44
|
`)}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(`
|
|
40
45
|
`).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(`
|
|
41
|
-
`);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)}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`)}classHandler(e,t){e===`mark-set`&&t[1]===this.insertMark&&(this.emit(`cursor-moved`),this.emit(`notify::cursor-position`))}checkSignal(e){if(!Co.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 wo=[[`margin_start`,`marginStart`,0],[`margin_end`,`marginEnd`,0],[`width_request`,`widthRequest`,-1],[`focusable`,`focusable`,!1],[`focus_on_click`,`focusOnClick`,!0]],To=new Set(wo.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 Eo=new WeakMap;function stateOf(e){let t=Eo.get(e);return t===void 0&&(t={owner:null,widget:new Map(wo.map(([e,,t])=>[e,t]))},Eo.set(e,t)),t}var Do=class GutterRenderer extends GObjectObject$1{static{this[x]=`GtkSource.GutterRenderer`}constructor(e={}){let t={},n={};for(let[r,i]of Object.entries(e))(To.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 wo)for(let n of new Set([e,t]))Object.defineProperty(Do.prototype,n,{get(){return this.widgetProperty(e)},set(t){this.widgetProperty(e,t)},enumerable:!0});var GutterRendererText=class extends Do{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=()=>{},r=()=>{}){this.owner=e,this.window_type=t,this.listener=n,this.guard=r,this.placed=[]}get_view(){return this.owner}get view(){return this.owner}insert(e,t){return e.get_view()===null?(this.guard(this),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=()=>{},this.guard=()=>{}}watch(e,t=()=>{}){this.listener=e,this.guard=t}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),e=>this.guard(e)),this.gutters.set(e,t)),t}};const Oo={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},ko={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)=>Oo[t]),styled=e=>n.some(t=>ko[t]===e);t.push({text:e,bold:styled(`bold`),italic:styled(`italic`),underline:styled(`underline`),strikethrough:styled(`strikethrough`)})}return t}const Ao={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=Ao[n];if(r===void 0)throw new XmlParseError(`unknown entity ${e}`,t);return r})}const jo=`[A-Za-z_][\\w.:-]*`,Mo=RegExp(`\\s+(${jo})\\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(`</(${jo})\\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(`<(${jo})`,`y`);r.lastIndex=t;let i=r.exec(e);if(!i)throw new XmlParseError(`malformed opening tag`,t);let a={},o=r.lastIndex;for(;;){Mo.lastIndex=o;let t=Mo.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=Mo.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 No={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=No;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?No: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 Po=[`id`,`name`,`_name`,`parent-scheme`,`version`],Fo=[`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))Po.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))Fo.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(`
|
|
42
|
-
`)}\n</style-scheme>\n`,
|
|
46
|
+
`);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)}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`)}classHandler(e,t){e===`mark-set`&&t[1]===this.insertMark&&(this.emit(`cursor-moved`),this.emit(`notify::cursor-position`))}checkSignal(e){if(!wo.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 To=[[`margin_start`,`marginStart`,0],[`margin_end`,`marginEnd`,0],[`width_request`,`widthRequest`,-1],[`focusable`,`focusable`,!1],[`focus_on_click`,`focusOnClick`,!0]],Eo=new Set(To.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 Do=new WeakMap;function stateOf(e){let t=Do.get(e);return t===void 0&&(t={owner:null,widget:new Map(To.map(([e,,t])=>[e,t]))},Do.set(e,t)),t}var Oo=class GutterRenderer extends GObjectObject$1{static{this[x]=`GtkSource.GutterRenderer`}constructor(e={}){let t={},n={};for(let[r,i]of Object.entries(e))(Eo.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 To)for(let n of new Set([e,t]))Object.defineProperty(Oo.prototype,n,{get(){return this.widgetProperty(e)},set(t){this.widgetProperty(e,t)},enumerable:!0});var GutterRendererText=class extends Oo{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=()=>{},r=()=>{}){this.owner=e,this.window_type=t,this.listener=n,this.guard=r,this.placed=[]}get_view(){return this.owner}get view(){return this.owner}insert(e,t){return e.get_view()===null?(this.guard(this),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=()=>{},this.guard=()=>{}}watch(e,t=()=>{}){this.listener=e,this.guard=t}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),e=>this.guard(e)),this.gutters.set(e,t)),t}};const ko={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},Ao={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)=>ko[t]),styled=e=>n.some(t=>Ao[t]===e);t.push({text:e,bold:styled(`bold`),italic:styled(`italic`),underline:styled(`underline`),strikethrough:styled(`strikethrough`)})}return t}const jo={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=jo[n];if(r===void 0)throw new XmlParseError(`unknown entity ${e}`,t);return r})}const Mo=`[A-Za-z_][\\w.:-]*`,No=RegExp(`\\s+(${Mo})\\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(`</(${Mo})\\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(`<(${Mo})`,`y`);r.lastIndex=t;let i=r.exec(e);if(!i)throw new XmlParseError(`malformed opening tag`,t);let a={},o=r.lastIndex;for(;;){No.lastIndex=o;let t=No.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=No.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 Po={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=Po;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?Po: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 Fo=[`id`,`name`,`_name`,`parent-scheme`,`version`],Io=[`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))Fo.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))Io.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(`
|
|
47
|
+
`)}\n</style-scheme>\n`,Lo=`Adwaita`,Ro=`Adwaita-dark`,zo=scheme(Lo,`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"`}),Bo=scheme(Ro,`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 Vo={foreground:-13749194,background:-1,selection:-5715728,lineNumber:-7696494},Ho={foreground:-1315861,background:-14803426,selection:-13282962,lineNumber:-7697782};function paletteOf(e,t){let n=t===`dark`?Ho:Vo,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 Uo=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[zo,Bo]){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`?Ro:Lo)}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=Uo.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=Uo.getDefault(),n=`light`){super(),this.driver=e,this.schemes=t,this.bufferHandlers=[],this.mirroring=!1,this.fromNative=!1,this.gutters=null,this.defaultRan=!1,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;let t=this.driver.gutterSides??[3];e.watch(()=>this.driver.invalidateGutter(),e=>{if(!t.includes(e.window_type))throw Error(`GtkSource.Gutter: this platform does not paint the ${e.window_type===4?`RIGHT`:`LEFT`} gutter (ADR 0103)`)})}renderersOf(e){let t=this.gutters?.get(e);return{renderers:t?.renderers??[],positions:t?.positions??[]}}metricsOf(e,t){return{position:t,widthRequest:e.width_request,marginStart:e.margin_start,marginEnd:e.margin_end}}gutterColumns(e=3){let{renderers:t,positions:n}=this.renderersOf(e);return t.map((e,t)=>this.metricsOf(e,n[t]))}queryGutter(e,t,n=3){let{renderers:r,positions:i}=this.renderersOf(n);if(r.length===0||this.gutters===null)return[];let a=new GutterLines(this.gutters.view,this.current,e,t);return r.map((n,r)=>{let o=n.vfunc_query_data,s=[];for(let r=e;r<=t;r++)o?.call(n,a,r),s.push(cellOf(n));return{...this.metricsOf(n,i[r]),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===`
|
|
43
48
|
`){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}(this.current.cursorPosition!==clamp(t)||this.current.selectionBoundPosition!==clamp(e))&&this.onBufferCursor()}onNativeExtendSelection(e,t){let n=this.current,r=Math.min(Math.max(0,t),n.length),i=new TextIter(n,r),a=new TextIter(n,r);this.defaultRan=!1;let o=this.emitHandled(`extend-selection`,e,new TextIter(n,r),i,a);return this.defaultRan?null:o?[i.utf16Offset,a.utf16Offset]:[r,r]}onNativeCopy(){return this.defaultRan=!1,this.emit(`copy-clipboard`),this.defaultRan}classHandler(e){if(!(e!==`extend-selection`&&e!==`copy-clipboard`))return e===`copy-clipboard`&&this.driver.copySelection?.(),this.defaultRan=!0,!0}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;gutterSides=[3,4];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;for(let t of[n,this.parts.rightGutter])t.firstElementChild?.style.setProperty(`transform`,`translateY(${-e.scrollTop}px)`);(this.hasColumns||this.hasRightColumns)&&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,`mousedown`,e=>this.onMouseDown(e)),on(e,`copy`,e=>{let t=!1,n=interceptCopy(e.clipboardData,()=>{t=this.host?.onNativeCopy()??!1});(!t||n)&&e.preventDefault()}),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())}onMouseDown(e){if(e.button!==0||e.detail!==2&&e.detail!==3)return;let{area:t}=this.parts,n=this.host?.onNativeExtendSelection(e.detail===2?0:1,t.selectionStart??0);n&&(e.preventDefault(),t.setSelectionRange(n[0],n[1]),this.onSelection())}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;hasRightColumns=!1;render(){let{backdrop:e}=this.parts,t=this.text.split(`
|
|
44
49
|
`),n=this.layout?.highlightCurrentLine===!0,r=this.text.slice(0,this.caret).split(`
|
|
45
50
|
`).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,rightGutter:t,root:n,area:r}=this.parts,i=this.host,a=this.text.split(`
|
|
46
|
-
`).length,[o,s]=this.visibleLines(a),c=i?.queryGutter(o,s)??[];this.hasColumns=c.length>0;let l=this.layout?.showLineNumbers===!0;n.classList.toggle(`has-columns`,this.hasColumns);let u=[];for(let e of c.filter(e=>e.position<0))u.push(this.columnElement(e,o));l&&this.numbers!==null&&u.push(this.numbers);for(let e of c.filter(e=>e.position>=0))u.push(this.columnElement(e,o));let d=document.createElement(`div`);d.className=`gsv-columns`,d.append(...u),d.style.transform=`translateY(${-r.scrollTop}px)`,e.replaceChildren(d);let f=i?.queryGutter(o,s,4)??[];this.hasRightColumns=f.length>0,n.classList.toggle(`has-right-columns`,this.hasRightColumns);let p=document.createElement(`div`);p.className=`gsv-columns`,p.append(...f.map(e=>this.columnElement(e,o))),p.style.transform=`translateY(${-r.scrollTop}px)`,t.replaceChildren(p)}};const
|
|
51
|
+
`).length,[o,s]=this.visibleLines(a),c=i?.queryGutter(o,s)??[];this.hasColumns=c.length>0;let l=this.layout?.showLineNumbers===!0;n.classList.toggle(`has-columns`,this.hasColumns);let u=[];for(let e of c.filter(e=>e.position<0))u.push(this.columnElement(e,o));l&&this.numbers!==null&&u.push(this.numbers);for(let e of c.filter(e=>e.position>=0))u.push(this.columnElement(e,o));let d=document.createElement(`div`);d.className=`gsv-columns`,d.append(...u),d.style.transform=`translateY(${-r.scrollTop}px)`,e.replaceChildren(d);let f=i?.queryGutter(o,s,4)??[];this.hasRightColumns=f.length>0,n.classList.toggle(`has-right-columns`,this.hasRightColumns);let p=document.createElement(`div`);p.className=`gsv-columns`,p.append(...f.map(e=>this.columnElement(e,o))),p.style.transform=`translateY(${-r.scrollTop}px)`,t.replaceChildren(p)}};const Wo=`gjsify-gtk-source-view-style`;function ensureStyleInjected(){if(typeof document>`u`||document.getElementById(Wo)!==null)return;let e=document.createElement(`style`);e.id=Wo,e.textContent=`
|
|
47
52
|
gtk-source-view {
|
|
48
53
|
display: flex;
|
|
49
54
|
flex: 1 1 auto;
|
|
@@ -109,7 +114,7 @@ gtk-source-view .gsv-area {
|
|
|
109
114
|
}
|
|
110
115
|
gtk-source-view.cursor-hidden .gsv-area { caret-color: transparent; }
|
|
111
116
|
gtk-source-view .gsv-area::selection { background: var(--gsv-selection); color: transparent; }
|
|
112
|
-
`,document.head.appendChild(e)}const Wo={"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]},Go=[`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 WidgetElement{static get observedAttributes(){return Go}session;driver;unsubscribe=null;built=!1;gutter=document.createElement(`div`);rightGutter=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.rightGutter.className=`gsv-gutter gsv-gutter-right`,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,rightGutter:this.rightGutter}),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.rightGutter)}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]=Wo[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)))}connect_after(e,t){return this.session.connect_after(e,((e,...n)=>t(this,...n)))}[b](e){this.session[b](e)}disconnect(e){this.session.disconnect(e)}get textarea(){return this.area}};customElements.define(`gtk-source-view`,GtkSourceView);var AdwCard=class extends WidgetElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends WidgetElement{_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_columns(){return this.columns}set_columns(e){this.columns=e}get_rows(){return this.rows}set_rows(e){this.rows=e}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 WidgetElement{_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 Ko=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends WidgetElement{_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&&Ko.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";
|
|
117
|
+
`,document.head.appendChild(e)}const Go={"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]},Ko=[`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 WidgetElement{static get observedAttributes(){return Ko}session;driver;unsubscribe=null;built=!1;gutter=document.createElement(`div`);rightGutter=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.rightGutter.className=`gsv-gutter gsv-gutter-right`,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,rightGutter:this.rightGutter}),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.rightGutter)}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]=Go[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)))}connect_after(e,t){return this.session.connect_after(e,((e,...n)=>t(this,...n)))}[b](e){this.session[b](e)}disconnect(e){this.session.disconnect(e)}get textarea(){return this.area}};customElements.define(`gtk-source-view`,GtkSourceView);var AdwCard=class extends WidgetElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends WidgetElement{_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_columns(){return this.columns}set_columns(e){this.columns=e}get_rows(){return this.rows}set_rows(e){this.rows=e}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 WidgetElement{_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 qo=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends WidgetElement{_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&&qo.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";
|
|
113
118
|
:root {
|
|
114
119
|
--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");
|
|
115
120
|
--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");
|
|
@@ -10806,7 +10811,7 @@ gtk-box[orientation=vertical] > [vexpand=false] {
|
|
|
10806
10811
|
|
|
10807
10812
|
[hidden] {
|
|
10808
10813
|
display: none !important;
|
|
10809
|
-
}`,document.head.appendChild(e)}followDesktopAppearance();const
|
|
10814
|
+
}`,document.head.appendChild(e)}followDesktopAppearance();const Jo={system:`Follow system`,light:`Light`,dark:`Dark`},Yo={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,Jo[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 d=new Map;for(let e of Se){let n=buildSwatch(`sb-accent`,e,Yo[e],[]);n.style.backgroundColor=adwaitaAccentBgColor(e),n.checked=t.accent===e,n.addEventListener(`change`,()=>{n.checked&&(t.accent=e)}),d.set(e,n),u.append(n)}let syncAccentEnabled=e=>{u.classList.toggle(`sb-swatch-card--disabled`,!e);for(let t of d.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=d.get(e.accent);n&&!n.checked&&(n.checked=!0);let r=e.accentMode===`custom`;l.toggleAttribute(`active`,r),syncAccentEnabled(r)}),n}let Xo=!1;function injectStorybookStyles(){if(Xo||typeof document>`u`)return;if(document.getElementById(`adwaita-storybook-style`)){Xo=!0;return}let e=document.createElement(`style`);e.id=`adwaita-storybook-style`,e.textContent=`
|
|
10810
10815
|
/* Appearance dialog — round swatches with a selection ring. The web twin of the GTK
|
|
10811
10816
|
renderer's rules, themselves adapted from Learn6502.
|
|
10812
10817
|
|
|
@@ -11145,7 +11150,7 @@ gtk-box[orientation=vertical] > [vexpand=false] {
|
|
|
11145
11150
|
background: none;
|
|
11146
11151
|
cursor: pointer;
|
|
11147
11152
|
}
|
|
11148
|
-
`,document.head.appendChild(e),Yo=!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%`,c.style.minWidth=`0`,c.style.minHeight=`0`}_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 Xo=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Zo=[`Blue`,`Teal`,`Green`,`Orange`],Qo={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},$={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`},$o={value:3,lower:1,upper:10,step:1},es=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],ts={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 ns={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return ts}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:$.bannerTitle,"button-label":$.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:Qo.appearance});n.append(el(`adw-switch-row`,{title:$.darkMode,subtitle:$.darkModeSubtitle}),el(`adw-switch-row`,{title:$.notifications,subtitle:$.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:$.accentColor,model:JSON.stringify([...Zo]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:Qo.account});r.append(el(`adw-entry-row`,{title:$.name,text:$.nameValue}),el(`adw-entry-row`,{title:$.email,text:$.emailValue}),el(`adw-spin-row`,{title:$.devices,min:String($o.lower),max:String($o.upper),step:String($o.step),value:String($o.value)}));let i=el(`adw-expander-row`,{title:$.advanced,subtitle:$.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of Xo)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:Qo.shortcuts});for(let e of es){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:Qo.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=$.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=$.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)}}]},rs={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`}]},is={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return rs}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$/,``)))}}]},as={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}]},os={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return as}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))}}]},ss=[14,25],cs={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}]},ls={stories:[class CalendarWebStory extends StoryElement{_calendar=null;_marked=!1;constructor(){super(CalendarWebStory.getMetadata(),`Default`)}static getMetadata(){return cs}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 ss)e.markDay(t);this._marked=!0}}]},us=[{value:`de`,label:`German`},{value:`fr`,label:`French`},{value:`nl`,label:`Dutch`},{value:`pt`,label:`Portuguese`}],ds={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}]},fs={stories:[class ColumnViewWebStory extends StoryElement{_view=null;constructor(){super(ColumnViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ds}initialize(){this._view=document.createElement(`gtk-column-view`),this._view.setAttribute(`model`,JSON.stringify(us)),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))}}]},ps=[`Red`,`Orange`,`Yellow`,`Green`,`Blue`,`Purple`,`Teal`,`Grey`],ms={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}]},hs={stories:[class FlowBoxWebStory extends StoryElement{_box=null;constructor(){super(FlowBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return ms}initialize(){this._box=document.createElement(`gtk-flow-box`),this._box.style.width=`100%`;for(let e of ps){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)))))}}]},gs=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],_s=[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`None`,value:`none`}],vs={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:_s,defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`singleClickActivate`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!1}]},ys=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`],bs={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:_s,defaultValue:`single`}]},xs={stories:[class GridViewWebStory extends StoryElement{_view=null;constructor(){super(GridViewWebStory.getMetadata(),`Default`)}static getMetadata(){return bs}initialize(){this._view=document.createElement(`gtk-grid-view`),this._view.setAttribute(`model`,JSON.stringify(ys)),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)}}]},Ss=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],Cs={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`}]},ws={stories:[class ListBoxWebStory extends StoryElement{_box=null;constructor(){super(ListBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Cs}initialize(){this._box=document.createElement(`gtk-list-box`),this._box.style.width=`100%`;for(let e of Ss){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))}}]},Ts={stories:[class ListViewWebStory extends StoryElement{_view=null;constructor(){super(ListViewWebStory.getMetadata(),`Default`)}static getMetadata(){return vs}initialize(){this._view=document.createElement(`gtk-list-view`),this._view.setAttribute(`model`,JSON.stringify(gs)),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))}}]},Es=[{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:``}],Ds={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`}]},Os={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`}]},ks={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return Ds}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 Os}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 Es){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)}}]},As={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}]},js={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return As}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))}}]},Ms={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.`}]},Ns={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return Ms}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))}}]},Ps={Pictures:[`Holiday`,`Screenshots`],Music:[`Albums`],Notes:[]},Fs={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}]},Is=Object.entries(Ps).flatMap(([e,t])=>[{label:e,depth:0,expandable:t.length>0},...t.map(e=>({label:e,depth:1,expandable:!1}))]),Ls={stories:[class TreeExpanderWebStory extends StoryElement{_expanders=[];constructor(){super(TreeExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Fs}initialize(){let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`);for(let t of Is){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)),Is[n].depth>0&&(t.hidden=!e)})}}]},Rs={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`}]},zs={stories:[class WindowHandleWebStory extends StoryElement{_handle=null;constructor(){super(WindowHandleWebStory.getMetadata(),`Default`)}static getMetadata(){return Rs}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)}}]},Bs={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`}]},Vs={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return Bs}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))}}]},Hs={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 Us={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Hs}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))}}]},Ws={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`}]},Gs=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const Ks={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ws}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 Gs)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},qs=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Js={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}]},Ys={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Js}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`model`,JSON.stringify([...qs])),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)))}}]},Xs={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}]},Zs={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Xs}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))}}]},Qs={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}]},$s={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Qs}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))}}]},ec={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`}]},tc={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ec}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))}}]},nc={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.`}]},rc=[`Europe`,`Americas`,`Asia`,`Oceania`],ic={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return nc}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(rc)),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))}}]},ac={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}]},oc={stories:[class PreferencesRowWebStory extends StoryElement{_row=null;constructor(){super(PreferencesRowWebStory.getMetadata(),`Default`)}static getMetadata(){return ac}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))}}]},sc={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}]},cc={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return sc}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))}}]},lc={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}]},uc={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return lc}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))}}]},dc={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`}]},fc={stories:[class DragIconWebStory extends StoryElement{_row=null;_hint=null;constructor(){super(DragIconWebStory.getMetadata(),`Default`)}static getMetadata(){return dc}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&&Ki.getForDrag(e).setChild(Ki.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>`)}}]},pc={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`}]},mc={stories:[class DrawingAreaWebStory extends StoryElement{_area=null;constructor(){super(DrawingAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return pc}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)))}}]},hc={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}]},gc={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 hc}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,`
|
|
11153
|
+
`,document.head.appendChild(e),Xo=!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%`,c.style.minWidth=`0`,c.style.minHeight=`0`}_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 Zo=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Qo=[`Blue`,`Teal`,`Green`,`Orange`],$o={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},$={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`},es={value:3,lower:1,upper:10,step:1},ts=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],ns={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 rs={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return ns}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:$.bannerTitle,"button-label":$.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:$o.appearance});n.append(el(`adw-switch-row`,{title:$.darkMode,subtitle:$.darkModeSubtitle}),el(`adw-switch-row`,{title:$.notifications,subtitle:$.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:$.accentColor,model:JSON.stringify([...Qo]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:$o.account});r.append(el(`adw-entry-row`,{title:$.name,text:$.nameValue}),el(`adw-entry-row`,{title:$.email,text:$.emailValue}),el(`adw-spin-row`,{title:$.devices,min:String(es.lower),max:String(es.upper),step:String(es.step),value:String(es.value)}));let i=el(`adw-expander-row`,{title:$.advanced,subtitle:$.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of Zo)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:$o.shortcuts});for(let e of ts){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:$o.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=$.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=$.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)}}]},is={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`}]},as={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return is}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$/,``)))}}]},os={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}]},ss={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return os}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))}}]},cs=[14,25],ls={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}]},us={stories:[class CalendarWebStory extends StoryElement{_calendar=null;_marked=!1;constructor(){super(CalendarWebStory.getMetadata(),`Default`)}static getMetadata(){return ls}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 cs)e.markDay(t);this._marked=!0}}]},ds=[{value:`de`,label:`German`},{value:`fr`,label:`French`},{value:`nl`,label:`Dutch`},{value:`pt`,label:`Portuguese`}],fs={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}]},ps={stories:[class ColumnViewWebStory extends StoryElement{_view=null;constructor(){super(ColumnViewWebStory.getMetadata(),`Default`)}static getMetadata(){return fs}initialize(){this._view=document.createElement(`gtk-column-view`),this._view.setAttribute(`model`,JSON.stringify(ds)),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))}}]},ms=[`Red`,`Orange`,`Yellow`,`Green`,`Blue`,`Purple`,`Teal`,`Grey`],hs={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}]},gs={stories:[class FlowBoxWebStory extends StoryElement{_box=null;constructor(){super(FlowBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return hs}initialize(){this._box=document.createElement(`gtk-flow-box`),this._box.style.width=`100%`;for(let e of ms){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)))))}}]},_s=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],vs=[{label:`Single`,value:`single`},{label:`Multiple`,value:`multiple`},{label:`None`,value:`none`}],ys={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:vs,defaultValue:`single`},{name:`showSeparators`,label:`Separators`,type:t.BOOLEAN,defaultValue:!0},{name:`singleClickActivate`,label:`Activate on single click`,type:t.BOOLEAN,defaultValue:!1}]},bs=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`],xs={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:vs,defaultValue:`single`}]},Ss={stories:[class GridViewWebStory extends StoryElement{_view=null;constructor(){super(GridViewWebStory.getMetadata(),`Default`)}static getMetadata(){return xs}initialize(){this._view=document.createElement(`gtk-grid-view`),this._view.setAttribute(`model`,JSON.stringify(bs)),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)}}]},Cs=[`Documents`,`Downloads`,`Music`,`Pictures`,`Videos`],ws={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`}]},Ts={stories:[class ListBoxWebStory extends StoryElement{_box=null;constructor(){super(ListBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return ws}initialize(){this._box=document.createElement(`gtk-list-box`),this._box.style.width=`100%`;for(let e of Cs){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))}}]},Es={stories:[class ListViewWebStory extends StoryElement{_view=null;constructor(){super(ListViewWebStory.getMetadata(),`Default`)}static getMetadata(){return ys}initialize(){this._view=document.createElement(`gtk-list-view`),this._view.setAttribute(`model`,JSON.stringify(_s)),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))}}]},Ds=[{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:``}],Os={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`}]},ks={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`}]},As={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return Os}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 ks}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 Ds){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)}}]},js={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}]},Ms={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return js}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))}}]},Ns={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.`}]},Ps={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return Ns}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))}}]},Fs={Pictures:[`Holiday`,`Screenshots`],Music:[`Albums`],Notes:[]},Is={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}]},Ls=Object.entries(Fs).flatMap(([e,t])=>[{label:e,depth:0,expandable:t.length>0},...t.map(e=>({label:e,depth:1,expandable:!1}))]),Rs={stories:[class TreeExpanderWebStory extends StoryElement{_expanders=[];constructor(){super(TreeExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Is}initialize(){let e=document.createElement(`gtk-box`);e.setAttribute(`orientation`,`vertical`),e.setAttribute(`spacing`,`6`);for(let t of Ls){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)),Ls[n].depth>0&&(t.hidden=!e)})}}]},zs={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`}]},Bs={stories:[class WindowHandleWebStory extends StoryElement{_handle=null;constructor(){super(WindowHandleWebStory.getMetadata(),`Default`)}static getMetadata(){return zs}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)}}]},Vs={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`}]},Hs={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return Vs}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))}}]},Us={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 Ws={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Us}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))}}]},Gs={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`}]},Ks=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const qs={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Gs}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 Ks)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},Js=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Ys={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}]},Xs={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ys}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`model`,JSON.stringify([...Js])),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)))}}]},Zs={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}]},Qs={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Zs}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))}}]},$s={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}]},ec={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return $s}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))}}]},tc={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`}]},nc={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return tc}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))}}]},rc={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.`}]},ic=[`Europe`,`Americas`,`Asia`,`Oceania`],ac={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return rc}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(ic)),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))}}]},oc={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}]},sc={stories:[class PreferencesRowWebStory extends StoryElement{_row=null;constructor(){super(PreferencesRowWebStory.getMetadata(),`Default`)}static getMetadata(){return oc}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))}}]},cc={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}]},lc={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return cc}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))}}]},uc={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}]},dc={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return uc}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))}}]},fc={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`}]},pc={stories:[class DragIconWebStory extends StoryElement{_row=null;_hint=null;constructor(){super(DragIconWebStory.getMetadata(),`Default`)}static getMetadata(){return fc}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&&qi.getForDrag(e).setChild(qi.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>`)}}]},mc={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`}]},hc={stories:[class DrawingAreaWebStory extends StoryElement{_area=null;constructor(){super(DrawingAreaWebStory.getMetadata(),`Default`)}static getMetadata(){return mc}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)))}}]},gc={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}]},_c={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 gc}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,`
|
|
11149
11154
|
attribute vec2 position;
|
|
11150
11155
|
uniform float angle;
|
|
11151
11156
|
void main () {
|
|
@@ -11156,8 +11161,8 @@ void main () {
|
|
|
11156
11161
|
0.0, 1.0);
|
|
11157
11162
|
}`),r=compile(e.FRAGMENT_SHADER,`
|
|
11158
11163
|
precision mediump float;
|
|
11159
|
-
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`)}}]},_c={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`}]},vc={stories:[class GraphicsOffloadWebStory extends StoryElement{_offload=null;constructor(){super(GraphicsOffloadWebStory.getMetadata(),`Default`)}static getMetadata(){return _c}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)}}]},yc={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}]},bc={stories:[class CheckButtonWebStory extends StoryElement{_button=null;constructor(){super(CheckButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return yc}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))}}]},xc=[`Automatic`,`Always`,`Never`,`When busy`],Sc={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:xc.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},Cc={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return Sc}initialize(){this._dropDown=document.createElement(`gtk-drop-down`),this._dropDown.setAttribute(`model`,JSON.stringify(xc)),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`))}}]},wc={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}]},Tc={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return wc}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`,``))}}]},Ec={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}]},Dc={stories:[class GtkSpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(GtkSpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return Ec}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)}}]},Oc={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}]},kc={stories:[class LevelBarWebStory extends StoryElement{_bar=null;constructor(){super(LevelBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Oc}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)}}]},Ac={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}]},jc={stories:[class PasswordEntryWebStory extends StoryElement{_entry=null;constructor(){super(PasswordEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Ac}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))}}]},Mc={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}]},Nc={stories:[class ProgressBarWebStory extends StoryElement{_bar=null;constructor(){super(ProgressBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Mc}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))}}]},Pc={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}]},Fc={stories:[class ScaleWebStory extends StoryElement{_scale=null;constructor(){super(ScaleWebStory.getMetadata(),`Default`)}static getMetadata(){return Pc}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)))}}]},Ic={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}]},Lc={stories:[class SearchEntryWebStory extends StoryElement{_entry=null;_label=null;constructor(){super(SearchEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Ic}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))}}]},Rc={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}]},zc={stories:[class SpinButtonWebStory extends StoryElement{_spin=null;constructor(){super(SpinButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Rc}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)))}}]},Bc={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}]},Vc={stories:[class SwitchWebStory extends StoryElement{_switch=null;constructor(){super(SwitchWebStory.getMetadata(),`Default`)}static getMetadata(){return Bc}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))}}]},Hc={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}]},Uc={stories:[class ExpanderWebStory extends StoryElement{_expander=null;constructor(){super(ExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Hc}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))}}]},Wc={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}]},Gc={stories:[class OverlayWebStory extends StoryElement{_overlay=null;_badge=null;constructor(){super(OverlayWebStory.getMetadata(),`Default`)}static getMetadata(){return Wc}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}}]},Kc={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 qc={stories:[class PanedWebStory extends StoryElement{_paned=null;constructor(){super(PanedWebStory.getMetadata(),`Default`)}static getMetadata(){return Kc}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)))}}]},Jc={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}]},Yc={stories:[class RevealerWebStory extends StoryElement{_revealer=null;constructor(){super(RevealerWebStory.getMetadata(),`Default`)}static getMetadata(){return Jc}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))}}]},Xc={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}]},Zc={stories:[class ScrollbarWebStory extends StoryElement{_scrollbar=null;constructor(){super(ScrollbarWebStory.getMetadata(),`Default`)}static getMetadata(){return Xc}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)})}}]},Qc={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}]},$c={stories:[class ScrolledWindowWebStory extends StoryElement{_window=null;constructor(){super(ScrolledWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Qc}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))}}]},tl={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}]},nl={stories:[class SeparatorWebStory extends StoryElement{_box=null;_separator=null;constructor(){super(SeparatorWebStory.getMetadata(),`Default`)}static getMetadata(){return tl}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)}}]},rl={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`}]},il={stories:[class BreakpointBinWebStory extends StoryElement{_bin=null;_label=null;constructor(){super(BreakpointBinWebStory.getMetadata(),`Default`)}static getMetadata(){return rl}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}]}])))}}]},al={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}]},ol={stories:[class LayoutSlotWebStory extends StoryElement{_view=null;_child=null;constructor(){super(LayoutSlotWebStory.getMetadata(),`Default`)}static getMetadata(){return al}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))}}]},sl={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}]},cl=`primary`,ll=`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`,ll],[`content`,cl]]){let r=document.createElement(`adw-layout-slot`);r.setAttribute(`id`,n),r.setAttribute(`slot`,e),t.appendChild(r)}return t}var ul=class MultiLayoutViewWebStory extends StoryElement{_view=null;_details=null;constructor(){super(MultiLayoutViewWebStory.getMetadata(),`Default`)}static getMetadata(){return sl}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`,cl),this._details=page(`Message`),this._details.setAttribute(`slot`,ll),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 dl={stories:[ul]},fl={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}]},pl={stories:[class EditableLabelWebStory extends StoryElement{_label=null;constructor(){super(EditableLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return fl}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)}}]},ml={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}]},hl={stories:[class SearchBarWebStory extends StoryElement{_bar=null;constructor(){super(SearchBarWebStory.getMetadata(),`Default`)}static getMetadata(){return ml}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)}}]},gl={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.
|
|
11160
|
-
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}]},_l={stories:[class TextViewWebStory extends StoryElement{_view=null;constructor(){super(TextViewWebStory.getMetadata(),`Default`)}static getMetadata(){return gl}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))}}]},vl={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}]},yl={stories:[class TextWebStory extends StoryElement{_text=null;constructor(){super(TextWebStory.getMetadata(),`Default`)}static getMetadata(){return vl}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}}]},bl={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}]},xl={stories:[class AspectFrameWebStory extends StoryElement{_frame=null;constructor(){super(AspectFrameWebStory.getMetadata(),`Default`)}static getMetadata(){return bl}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)))}}]},Sl={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`}]},Cl={stories:[class CenterBoxWebStory extends StoryElement{_box=null;constructor(){super(CenterBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Sl}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))}}]},wl={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}]},Tl={stories:[class FixedWebStory extends StoryElement{_fixed=null;_cells=[];constructor(){super(FixedWebStory.getMetadata(),`Default`)}static getMetadata(){return wl}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)}}]},El={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}]},Dl={stories:[class FrameWebStory extends StoryElement{_frame=null;constructor(){super(FrameWebStory.getMetadata(),`Default`)}static getMetadata(){return El}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))}}]},Ol={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`}]},kl={stories:[class GridWebStory extends StoryElement{_grid=null;constructor(){super(GridWebStory.getMetadata(),`Default`)}static getMetadata(){return Ol}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))}}]},Al={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}]},jl={stories:[class ToggleButtonWebStory extends StoryElement{_button=null;constructor(){super(ToggleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Al}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))}}]},Ml={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`}]},Nl={stories:[class ColorDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(ColorDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ml}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}}}]},Pl={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}]},Fl={stories:[class FontDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(FontDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Pl}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))}}]},Il={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}]},Ll={stories:[class LinkButtonWebStory extends StoryElement{_button=null;constructor(){super(LinkButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Il}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))}}]},Rl=[`audio-volume-muted-symbolic`,`audio-volume-low-symbolic`,`audio-volume-high-symbolic`],zl={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}]},Bl={stories:[class ScaleButtonWebStory extends StoryElement{_button=null;constructor(){super(ScaleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return zl}initialize(){this._button=document.createElement(`gtk-scale-button`),this._button.setAttribute(`icons`,JSON.stringify(Rl)),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)))}}]},Vl={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 Hl={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Vl}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`))}}]},Ul={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`}]},Wl=[`pill`,`circular`,`suggested`,`destructive`,`flat`],Gl={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 Kl={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Ul}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 Wl)this._demo.removeAttribute(e);let t=Gl[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))}}]},ql=[`Save as…`,`Export`,`Print`],Jl={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`}]},Yl={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Jl}initialize(){this._widget=document.createElement(`gtk-menu-button`),this._widget.setAttribute(`menu-model`,JSON.stringify(ql.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))}}]},Xl={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`}]},Zl={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`}]},Ql=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`,Ql),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 $l={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Xl}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return Zl}}]},eu={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`}]},tu=[`flat`,`round`],nu=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],ru={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return eu}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of nu){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 tu)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},iu={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}]},au={stories:[class BinWebStory extends StoryElement{_bin=null;constructor(){super(BinWebStory.getMetadata(),`Default`)}static getMetadata(){return iu}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}}]},ou={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}]},su=Array.from({length:24},(e,t)=>`Line ${t+1}: held at the clamp's width while it scrolls.`),cu={stories:[class ClampScrollableWebStory extends StoryElement{_clamp=null;constructor(){super(ClampScrollableWebStory.getMetadata(),`Default`)}static getMetadata(){return ou}initialize(){let e=document.createElement(`div`);e.style.padding=`12px 0`;for(let t of su){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)))}}]},lu={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}]},uu={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return lu}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)))}}]},du={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}]},fu={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return du}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)}}]},pu=[{label:`Cut`},{label:`Copy`},{label:`Paste`},{label:`Delete`,accel:`<Shift>Delete`}],mu={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}]},hu={stories:[class PopoverBinWebStory extends StoryElement{_bin;constructor(){super(PopoverBinWebStory.getMetadata(),`Default`)}static getMetadata(){return mu}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(pu)),this._bin.setAttribute(`handle-input`,String(this.args.handleInput)))}}]},gu=[{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`}]}],_u={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}]},vu={stories:[class PopoverMenuWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverMenuWebStory.getMetadata(),`Default`)}static getMetadata(){return _u}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(gu)),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))}}]},yu={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}]},bu={stories:[class PopoverWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverWebStory.getMetadata(),`Default`)}static getMetadata(){return yu}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)))}}]},xu={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}]},Su={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return xu}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)}}]},Cu={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}]},wu={stories:[class ViewportWebStory extends StoryElement{_viewport=null;constructor(){super(ViewportWebStory.getMetadata(),`Default`)}static getMetadata(){return Cu}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))}}]},Tu={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}]},Eu=[{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`}]}],Du={stories:[class ApplicationWindowWebStory extends StoryElement{_window=null;_title=null;constructor(){super(ApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Tu}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(Eu)),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))}}]},Ou={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`}]},ku={stories:[class WindowWebStory extends StoryElement{_title=null;constructor(){super(WindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ou}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))}}]},Au={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}]},ju=[`Design`,`Adwaita`,`GNOME`,`GTK`,`TypeScript`,`Storybook`,`Wrapping`,`Layout`],Mu={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Au}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of ju){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)))}}]},Nu=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],Pu={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Nu},Fu={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Nu},Iu=[{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 Lu=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-${Lu++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of Iu)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 Ru={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return Pu}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return Fu}indicatorTag(){return`adw-carousel-indicator-lines`}}]},zu={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`}]},Bu=[{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.`}],Vu={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return zu}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of Bu){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)}}]},Hu=[{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".`}],Uu={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}]},Wu={stories:[class NotebookWebStory extends StoryElement{_notebook=null;constructor(){super(NotebookWebStory.getMetadata(),`Default`)}static getMetadata(){return Uu}initialize(){let e=document.createElement(`gtk-notebook`);e.style.cssText=`width:480px;height:320px;`;for(let t of Hu){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))}}]},Gu=[{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.`}],Ku={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`}]},qu={stories:[class StackSidebarWebStory extends StoryElement{_stack=null;constructor(){super(StackSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ku}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-sidebar-demo`,e.style.flex=`1`;for(let t of Gu){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)}}]},Ju=[{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.`}],Yu={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`}]},Xu={stories:[class StackSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(StackSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Yu}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-switcher-demo`,e.style.flex=`1`;for(let t of Ju){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)}}]},Zu=[{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.`}],Qu={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}]},$u={stories:[class StackWebStory extends StoryElement{_stack=null;constructor(){super(StackWebStory.getMetadata(),`Default`)}static getMetadata(){return Qu}initialize(){let e=document.createElement(`gtk-stack`);e.style.flex=`1`;for(let t of Zu){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`))}}]},ed={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}]},td=[{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.`}],nd={stories:[class TabBarWebStory extends StoryElement{_bar=null;_view=null;_startAction=null;_endAction=null;constructor(){super(TabBarWebStory.getMetadata(),`Default`)}static getMetadata(){return ed}initialize(){let e=document.createElement(`adw-tab-view`);e.style.flex=`1`;for(let t of td){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)}}]},rd={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}]},id={stories:[class TabButtonWebStory extends StoryElement{_view=null;_serial=0;constructor(){super(TabButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return rd}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)})}}]},ad={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}]},od=[{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.`}],sd={stories:[class TabOverviewWebStory extends StoryElement{_overview=null;_view=null;constructor(){super(TabOverviewWebStory.getMetadata(),`Default`)}static getMetadata(){return ad}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let[t,n]of od.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))}}]},cd=[{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`}],ld={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}]},ud={stories:[class ViewSwitcherSidebarWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return ld}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of cd){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`)}}]},dd={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}]},fd=[{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.`}],pd={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return dd}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of fd){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`))}}]},md={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`}]},hd=[{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.`}],gd={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return md}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of hd){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)}}]},_d=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],vd={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}]},yd={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return vd}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of _d){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)}}]},bd={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 xd={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return bd}_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`))}}]},Sd={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 Cd={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Sd}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))}}]},wd={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}]},Td={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return wd}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)}}]},Ed={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}]},Dd=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],Od={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ed}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Dd){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))}}]},kd=[{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`}]}],Ad={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}]},jd={stories:[class PopoverMenuBarWebStory extends StoryElement{_bar;constructor(){super(PopoverMenuBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Ad}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?kd.slice(0,3):kd;this._bar.setAttribute(`menu-model`,JSON.stringify(e));for(let e of this._bar.querySelectorAll(`gtk-popover-menu`))e.setAttribute(`position`,this.args.position)}}]},Md={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}]},Nd={stories:[class ImageWebStory extends StoryElement{_image=null;constructor(){super(ImageWebStory.getMetadata(),`Default`)}static getMetadata(){return Md}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))}}]},Pd={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}]},Fd={stories:[class InscriptionWebStory extends StoryElement{_inscription=null;_frame=null;constructor(){super(InscriptionWebStory.getMetadata(),`Default`)}static getMetadata(){return Pd}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)))}}]},Id={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}]},Ld={stories:[class MediaControlsWebStory extends StoryElement{_video=null;_controls=null;_media=null;constructor(){super(MediaControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Id}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)}}]},Rd={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}]},zd={stories:[class PictureWebStory extends StoryElement{_picture=null;constructor(){super(PictureWebStory.getMetadata(),`Default`)}static getMetadata(){return Rd}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)}}]},Bd={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}]},Vd={stories:[class VideoWebStory extends StoryElement{_video=null;_media=null;constructor(){super(VideoWebStory.getMetadata(),`Default`)}static getMetadata(){return Bd}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()}}]},Hd={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}]},Ud={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 Hd}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)}}]},Wd={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`}]},Gd={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Wd}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}}]},Kd={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.`}]},qd={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Kd}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.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,`destructive`),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},Jd={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`}]},Yd={stories:[class DialogWebStory extends StoryElement{constructor(){super(DialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Jd}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){}}]},Xd={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 Zd={stories:[class EmojiChooserWebStory extends StoryElement{_entry=null;_button=null;_chooser=null;constructor(){super(EmojiChooserWebStory.getMetadata(),`Default`)}static getMetadata(){return Xd}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}}]},Qd={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}]},$d={stories:[class GtkAboutDialogWebStory extends StoryElement{_dialog=null;_button=null;constructor(){super(GtkAboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Qd}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
|
|
11164
|
+
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`)}}]},vc={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`}]},yc={stories:[class GraphicsOffloadWebStory extends StoryElement{_offload=null;constructor(){super(GraphicsOffloadWebStory.getMetadata(),`Default`)}static getMetadata(){return vc}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)}}]},bc={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}]},xc={stories:[class CheckButtonWebStory extends StoryElement{_button=null;constructor(){super(CheckButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return bc}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))}}]},Sc=[`Automatic`,`Always`,`Never`,`When busy`],Cc={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:Sc.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},wc={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return Cc}initialize(){this._dropDown=document.createElement(`gtk-drop-down`),this._dropDown.setAttribute(`model`,JSON.stringify(Sc)),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`))}}]},Tc={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}]},Ec={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Tc}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`,``))}}]},Dc={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}]},Oc={stories:[class GtkSpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(GtkSpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return Dc}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)}}]},kc={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}]},Ac={stories:[class LevelBarWebStory extends StoryElement{_bar=null;constructor(){super(LevelBarWebStory.getMetadata(),`Default`)}static getMetadata(){return kc}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)}}]},jc={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}]},Mc={stories:[class PasswordEntryWebStory extends StoryElement{_entry=null;constructor(){super(PasswordEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return jc}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))}}]},Nc={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}]},Pc={stories:[class ProgressBarWebStory extends StoryElement{_bar=null;constructor(){super(ProgressBarWebStory.getMetadata(),`Default`)}static getMetadata(){return Nc}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))}}]},Fc={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}]},Ic={stories:[class ScaleWebStory extends StoryElement{_scale=null;constructor(){super(ScaleWebStory.getMetadata(),`Default`)}static getMetadata(){return Fc}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)))}}]},Lc={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}]},Rc={stories:[class SearchEntryWebStory extends StoryElement{_entry=null;_label=null;constructor(){super(SearchEntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Lc}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))}}]},zc={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}]},Bc={stories:[class SpinButtonWebStory extends StoryElement{_spin=null;constructor(){super(SpinButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return zc}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)))}}]},Vc={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}]},Hc={stories:[class SwitchWebStory extends StoryElement{_switch=null;constructor(){super(SwitchWebStory.getMetadata(),`Default`)}static getMetadata(){return Vc}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))}}]},Uc={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}]},Wc={stories:[class ExpanderWebStory extends StoryElement{_expander=null;constructor(){super(ExpanderWebStory.getMetadata(),`Default`)}static getMetadata(){return Uc}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))}}]},Gc={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}]},Kc={stories:[class OverlayWebStory extends StoryElement{_overlay=null;_badge=null;constructor(){super(OverlayWebStory.getMetadata(),`Default`)}static getMetadata(){return Gc}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}}]},qc={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 Jc={stories:[class PanedWebStory extends StoryElement{_paned=null;constructor(){super(PanedWebStory.getMetadata(),`Default`)}static getMetadata(){return qc}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)))}}]},Yc={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}]},Xc={stories:[class RevealerWebStory extends StoryElement{_revealer=null;constructor(){super(RevealerWebStory.getMetadata(),`Default`)}static getMetadata(){return Yc}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))}}]},Zc={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}]},Qc={stories:[class ScrollbarWebStory extends StoryElement{_scrollbar=null;constructor(){super(ScrollbarWebStory.getMetadata(),`Default`)}static getMetadata(){return Zc}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)})}}]},$c={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}]},tl={stories:[class ScrolledWindowWebStory extends StoryElement{_window=null;constructor(){super(ScrolledWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return $c}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))}}]},nl={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}]},rl={stories:[class SeparatorWebStory extends StoryElement{_box=null;_separator=null;constructor(){super(SeparatorWebStory.getMetadata(),`Default`)}static getMetadata(){return nl}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)}}]},il={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`}]},al={stories:[class BreakpointBinWebStory extends StoryElement{_bin=null;_label=null;constructor(){super(BreakpointBinWebStory.getMetadata(),`Default`)}static getMetadata(){return il}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}]}])))}}]},ol={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}]},sl={stories:[class LayoutSlotWebStory extends StoryElement{_view=null;_child=null;constructor(){super(LayoutSlotWebStory.getMetadata(),`Default`)}static getMetadata(){return ol}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))}}]},cl={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}]},ll=`primary`,ul=`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`,ul],[`content`,ll]]){let r=document.createElement(`adw-layout-slot`);r.setAttribute(`id`,n),r.setAttribute(`slot`,e),t.appendChild(r)}return t}var dl=class MultiLayoutViewWebStory extends StoryElement{_view=null;_details=null;constructor(){super(MultiLayoutViewWebStory.getMetadata(),`Default`)}static getMetadata(){return cl}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`,ll),this._details=page(`Message`),this._details.setAttribute(`slot`,ul),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 fl={stories:[dl]},pl={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}]},ml={stories:[class EditableLabelWebStory extends StoryElement{_label=null;constructor(){super(EditableLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return pl}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)}}]},hl={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}]},gl={stories:[class SearchBarWebStory extends StoryElement{_bar=null;constructor(){super(SearchBarWebStory.getMetadata(),`Default`)}static getMetadata(){return hl}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)}}]},_l={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.
|
|
11165
|
+
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}]},vl={stories:[class TextViewWebStory extends StoryElement{_view=null;constructor(){super(TextViewWebStory.getMetadata(),`Default`)}static getMetadata(){return _l}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))}}]},yl={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}]},bl={stories:[class TextWebStory extends StoryElement{_text=null;constructor(){super(TextWebStory.getMetadata(),`Default`)}static getMetadata(){return yl}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}}]},xl={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}]},Sl={stories:[class AspectFrameWebStory extends StoryElement{_frame=null;constructor(){super(AspectFrameWebStory.getMetadata(),`Default`)}static getMetadata(){return xl}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)))}}]},Cl={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`}]},wl={stories:[class CenterBoxWebStory extends StoryElement{_box=null;constructor(){super(CenterBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return Cl}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))}}]},Tl={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}]},El={stories:[class FixedWebStory extends StoryElement{_fixed=null;_cells=[];constructor(){super(FixedWebStory.getMetadata(),`Default`)}static getMetadata(){return Tl}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)}}]},Dl={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}]},Ol={stories:[class FrameWebStory extends StoryElement{_frame=null;constructor(){super(FrameWebStory.getMetadata(),`Default`)}static getMetadata(){return Dl}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))}}]},kl={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`}]},Al={stories:[class GridWebStory extends StoryElement{_grid=null;constructor(){super(GridWebStory.getMetadata(),`Default`)}static getMetadata(){return kl}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))}}]},jl={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}]},Ml={stories:[class ToggleButtonWebStory extends StoryElement{_button=null;constructor(){super(ToggleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return jl}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))}}]},Nl={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`}]},Pl={stories:[class ColorDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(ColorDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Nl}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}}}]},Fl={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}]},Il={stories:[class FontDialogButtonWebStory extends StoryElement{_button=null;constructor(){super(FontDialogButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Fl}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))}}]},Ll={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}]},Rl={stories:[class LinkButtonWebStory extends StoryElement{_button=null;constructor(){super(LinkButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Ll}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))}}]},zl=[`audio-volume-muted-symbolic`,`audio-volume-low-symbolic`,`audio-volume-high-symbolic`],Bl={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}]},Vl={stories:[class ScaleButtonWebStory extends StoryElement{_button=null;constructor(){super(ScaleButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Bl}initialize(){this._button=document.createElement(`gtk-scale-button`),this._button.setAttribute(`icons`,JSON.stringify(zl)),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)))}}]},Hl={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 Ul={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Hl}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`))}}]},Wl={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`}]},Gl=[`pill`,`circular`,`suggested`,`destructive`,`flat`],Kl={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 ql={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Wl}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 Gl)this._demo.removeAttribute(e);let t=Kl[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))}}]},Jl=[`Save as…`,`Export`,`Print`],Yl={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`}]},Xl={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Yl}initialize(){this._widget=document.createElement(`gtk-menu-button`),this._widget.setAttribute(`menu-model`,JSON.stringify(Jl.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))}}]},Zl={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`}]},Ql={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`}]},$l=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`,$l),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 eu={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Zl}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return Ql}}]},tu={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`}]},nu=[`flat`,`round`],ru=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],iu={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return tu}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of ru){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 nu)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},au={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}]},ou={stories:[class BinWebStory extends StoryElement{_bin=null;constructor(){super(BinWebStory.getMetadata(),`Default`)}static getMetadata(){return au}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}}]},su={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}]},cu=Array.from({length:24},(e,t)=>`Line ${t+1}: held at the clamp's width while it scrolls.`),lu={stories:[class ClampScrollableWebStory extends StoryElement{_clamp=null;constructor(){super(ClampScrollableWebStory.getMetadata(),`Default`)}static getMetadata(){return su}initialize(){let e=document.createElement(`div`);e.style.padding=`12px 0`;for(let t of cu){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)))}}]},uu={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}]},du={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return uu}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)))}}]},fu={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}]},pu={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return fu}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)}}]},mu=[{label:`Cut`},{label:`Copy`},{label:`Paste`},{label:`Delete`,accel:`<Shift>Delete`}],hu={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}]},gu={stories:[class PopoverBinWebStory extends StoryElement{_bin;constructor(){super(PopoverBinWebStory.getMetadata(),`Default`)}static getMetadata(){return hu}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(mu)),this._bin.setAttribute(`handle-input`,String(this.args.handleInput)))}}]},_u=[{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`}]}],vu={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}]},yu={stories:[class PopoverMenuWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverMenuWebStory.getMetadata(),`Default`)}static getMetadata(){return vu}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(_u)),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))}}]},bu={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}]},xu={stories:[class PopoverWebStory extends StoryElement{_anchor;_popover;constructor(){super(PopoverWebStory.getMetadata(),`Default`)}static getMetadata(){return bu}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)))}}]},Su={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}]},Cu={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Su}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)}}]},wu={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}]},Tu={stories:[class ViewportWebStory extends StoryElement{_viewport=null;constructor(){super(ViewportWebStory.getMetadata(),`Default`)}static getMetadata(){return wu}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))}}]},Eu={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}]},Du=[{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`}]}],Ou={stories:[class ApplicationWindowWebStory extends StoryElement{_window=null;_title=null;constructor(){super(ApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return Eu}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(Du)),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))}}]},ku={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`}]},Au={stories:[class WindowWebStory extends StoryElement{_title=null;constructor(){super(WindowWebStory.getMetadata(),`Default`)}static getMetadata(){return ku}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))}}]},ju={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}]},Mu=[`Design`,`Adwaita`,`GNOME`,`GTK`,`TypeScript`,`Storybook`,`Wrapping`,`Layout`],Nu={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return ju}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of Mu){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)))}}]},Pu=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],Fu={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Pu},Iu={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Pu},Lu=[{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 Ru=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-${Ru++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of Lu)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 zu={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return Fu}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return Iu}indicatorTag(){return`adw-carousel-indicator-lines`}}]},Bu={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`}]},Vu=[{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.`}],Hu={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Bu}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of Vu){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)}}]},Uu=[{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".`}],Wu={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}]},Gu={stories:[class NotebookWebStory extends StoryElement{_notebook=null;constructor(){super(NotebookWebStory.getMetadata(),`Default`)}static getMetadata(){return Wu}initialize(){let e=document.createElement(`gtk-notebook`);e.style.cssText=`width:480px;height:320px;`;for(let t of Uu){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))}}]},Ku=[{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.`}],qu={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`}]},Ju={stories:[class StackSidebarWebStory extends StoryElement{_stack=null;constructor(){super(StackSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return qu}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-sidebar-demo`,e.style.flex=`1`;for(let t of Ku){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)}}]},Yu=[{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.`}],Xu={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`}]},Zu={stories:[class StackSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(StackSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Xu}initialize(){let e=document.createElement(`gtk-stack`);e.id=`stack-switcher-demo`,e.style.flex=`1`;for(let t of Yu){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)}}]},Qu=[{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.`}],$u={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}]},ed={stories:[class StackWebStory extends StoryElement{_stack=null;constructor(){super(StackWebStory.getMetadata(),`Default`)}static getMetadata(){return $u}initialize(){let e=document.createElement(`gtk-stack`);e.style.flex=`1`;for(let t of Qu){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`))}}]},td={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}]},nd=[{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.`}],rd={stories:[class TabBarWebStory extends StoryElement{_bar=null;_view=null;_startAction=null;_endAction=null;constructor(){super(TabBarWebStory.getMetadata(),`Default`)}static getMetadata(){return td}initialize(){let e=document.createElement(`adw-tab-view`);e.style.flex=`1`;for(let t of nd){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)}}]},id={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}]},ad={stories:[class TabButtonWebStory extends StoryElement{_view=null;_serial=0;constructor(){super(TabButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return id}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)})}}]},od={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}]},sd=[{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.`}],cd={stories:[class TabOverviewWebStory extends StoryElement{_overview=null;_view=null;constructor(){super(TabOverviewWebStory.getMetadata(),`Default`)}static getMetadata(){return od}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let[t,n]of sd.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))}}]},ld=[{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`}],ud={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}]},dd={stories:[class ViewSwitcherSidebarWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherSidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return ud}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of ld){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`)}}]},fd={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}]},pd=[{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.`}],md={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return fd}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of pd){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`))}}]},hd={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`}]},gd=[{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.`}],_d={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return hd}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of gd){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)}}]},vd=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],yd={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}]},bd={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return yd}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of vd){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)}}]},xd={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 Sd={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return xd}_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`))}}]},Cd={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 wd={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Cd}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))}}]},Td={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}]},Ed={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Td}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)}}]},Dd={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}]},Od=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],kd={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Dd}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Od){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))}}]},Ad=[{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`}]}],jd={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}]},Md={stories:[class PopoverMenuBarWebStory extends StoryElement{_bar;constructor(){super(PopoverMenuBarWebStory.getMetadata(),`Default`)}static getMetadata(){return jd}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?Ad.slice(0,3):Ad;this._bar.setAttribute(`menu-model`,JSON.stringify(e));for(let e of this._bar.querySelectorAll(`gtk-popover-menu`))e.setAttribute(`position`,this.args.position)}}]},Nd={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}]},Pd={stories:[class ImageWebStory extends StoryElement{_image=null;constructor(){super(ImageWebStory.getMetadata(),`Default`)}static getMetadata(){return Nd}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))}}]},Fd={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}]},Id={stories:[class InscriptionWebStory extends StoryElement{_inscription=null;_frame=null;constructor(){super(InscriptionWebStory.getMetadata(),`Default`)}static getMetadata(){return Fd}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)))}}]},Ld={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}]},Rd={stories:[class MediaControlsWebStory extends StoryElement{_video=null;_controls=null;_media=null;constructor(){super(MediaControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Ld}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)}}]},zd={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}]},Bd={stories:[class PictureWebStory extends StoryElement{_picture=null;constructor(){super(PictureWebStory.getMetadata(),`Default`)}static getMetadata(){return zd}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)}}]},Vd={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}]},Hd={stories:[class VideoWebStory extends StoryElement{_video=null;_media=null;constructor(){super(VideoWebStory.getMetadata(),`Default`)}static getMetadata(){return Vd}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()}}]},Ud={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}]},Wd={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 Ud}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)}}]},Gd={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`}]},Kd={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Gd}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}}]},qd={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.`}]},Jd={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return qd}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.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,`destructive`),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},Yd={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`}]},Xd={stories:[class DialogWebStory extends StoryElement{constructor(){super(DialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Yd}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){}}]},Zd={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 Qd={stories:[class EmojiChooserWebStory extends StoryElement{_entry=null;_button=null;_chooser=null;constructor(){super(EmojiChooserWebStory.getMetadata(),`Default`)}static getMetadata(){return Zd}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}}]},$d={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}]},ef={stories:[class GtkAboutDialogWebStory extends StoryElement{_dialog=null;_button=null;constructor(){super(GtkAboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return $d}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
|
|
11161
11166
|
glibc 2.42
|
|
11162
11167
|
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
|
|
11163
|
-
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}}]},ef={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`}]},tf=.25*25.4;function marginsFor(e){return{top:tf,bottom:e===`na_letter`||e===`na_legal`||e===`iso_a4`?14.224:tf,left:tf,right:tf}}const nf={stories:[class PageSetupUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PageSetupUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return ef}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}}]},rf={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}]},af=[{name:`Office Laser`,location:`Building A, floor 2`,acceptsJobs:!0},{name:`Lobby Printer`,location:`Building A, ground floor`,acceptsJobs:!1}],of={top:6.35,bottom:14.224,left:6.35,right:6.35},sf={stories:[class PrintUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PrintUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return rf}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:of},e.printSettings={copies:String(this.args.copies??1),collate:`0`,reverse:`0`},e.printers=af,e.present())}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},cf={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`}]},lf={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return cf}_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}}]},uf={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 df={stories:[class ShortcutsDialogWebStory extends StoryElement{constructor(){super(ShortcutsDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return uf}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){}}]},ff={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`}]},pf={stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return ff}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=new Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}}]},mf={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`}]},hf={stories:[class ActionBarWebStory extends StoryElement{_bar=null;constructor(){super(ActionBarWebStory.getMetadata(),`Default`)}static getMetadata(){return mf}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()}}]},gf={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}]},_f={stories:[class GtkApplicationWindowWebStory extends StoryElement{_window=null;_menubar=null;constructor(){super(GtkApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return gf}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()}}]},vf={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`}]},yf={stories:[class GtkHeaderBarWebStory extends StoryElement{_bar=null;_titleLabel=null;constructor(){super(GtkHeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return vf}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()}}]},bf={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}]},xf={stories:[class GtkWindowWebStory extends StoryElement{_window=null;_bar=null;constructor(){super(GtkWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return bf}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)))}}]},Sf={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}]},Cf=[ns,is,os,ls,fs,hs,xs,ws,Ts,ks,js,Ns,Ls,Vs,Us,Ks,Ys,Zs,$s,tc,ic,oc,cc,uc,Tc,Cc,Fc,zc,jc,Lc,bc,Vc,Nc,kc,Dc,fc,mc,gc,vc,Hl,Kl,Yl,$l,jl,Nl,Fl,Ll,Bl,ru,au,cu,uu,fu,Uc,Gc,qc,bu,vu,hu,Yc,Zc,$c,nl,il,ol,dl,pl,yl,_l,hl,Dl,xl,Cl,kl,Tl,Su,wu,Du,ku,Mu,Ru,Vu,$u,Xu,qu,Wu,nd,id,sd,ud,pd,gd,yd,xd,Cd,Td,Od,jd,Ud,Nd,Fd,zd,Vd,Ld,Gd,qd,Yd,Zd,$d,nf,lf,sf,df,pf,yf,{stories:[class WindowControlsWebStory extends StoryElement{_window=null;_controls=null;constructor(){super(WindowControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Sf}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)))}}]},hf,xf,_f,zs];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:Cf});
|
|
11168
|
+
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}}]},tf={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`}]},nf=.25*25.4;function marginsFor(e){return{top:nf,bottom:e===`na_letter`||e===`na_legal`||e===`iso_a4`?14.224:nf,left:nf,right:nf}}const rf={stories:[class PageSetupUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PageSetupUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return tf}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}}]},af={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}]},of=[{name:`Office Laser`,location:`Building A, floor 2`,acceptsJobs:!0},{name:`Lobby Printer`,location:`Building A, ground floor`,acceptsJobs:!1}],sf={top:6.35,bottom:14.224,left:6.35,right:6.35},cf={stories:[class PrintUnixDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PrintUnixDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return af}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:sf},e.printSettings={copies:String(this.args.copies??1),collate:`0`,reverse:`0`},e.printers=of,e.present())}updateArgs(e){}teardown(){this._dialog?.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},lf={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`}]},uf={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return lf}_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}}]},df={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 ff={stories:[class ShortcutsDialogWebStory extends StoryElement{constructor(){super(ShortcutsDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return df}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){}}]},pf={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`}]},mf={stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return pf}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=new Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}}]},hf={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`}]},gf={stories:[class ActionBarWebStory extends StoryElement{_bar=null;constructor(){super(ActionBarWebStory.getMetadata(),`Default`)}static getMetadata(){return hf}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()}}]},_f={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}]},vf={stories:[class GtkApplicationWindowWebStory extends StoryElement{_window=null;_menubar=null;constructor(){super(GtkApplicationWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return _f}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()}}]},yf={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`}]},bf={stories:[class GtkHeaderBarWebStory extends StoryElement{_bar=null;_titleLabel=null;constructor(){super(GtkHeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return yf}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()}}]},xf={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}]},Sf={stories:[class GtkWindowWebStory extends StoryElement{_window=null;_bar=null;constructor(){super(GtkWindowWebStory.getMetadata(),`Default`)}static getMetadata(){return xf}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)))}}]},Cf={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}]},wf=[rs,as,ss,us,ps,gs,Ss,Ts,Es,As,Ms,Ps,Rs,Hs,Ws,qs,Xs,Qs,ec,nc,ac,sc,lc,dc,Ec,wc,Ic,Bc,Mc,Rc,xc,Hc,Pc,Ac,Oc,pc,hc,_c,yc,Ul,ql,Xl,eu,Ml,Pl,Il,Rl,Vl,iu,ou,lu,du,pu,Wc,Kc,Jc,xu,yu,gu,Xc,Qc,tl,rl,al,sl,fl,ml,bl,vl,gl,Ol,Sl,wl,Al,El,Cu,Tu,Ou,Au,Nu,zu,Hu,ed,Zu,Ju,Gu,rd,ad,cd,dd,md,_d,bd,Sd,wd,Ed,kd,Md,Wd,Pd,Id,Bd,Hd,Rd,Kd,Jd,Xd,Qd,ef,rf,uf,cf,ff,mf,bf,{stories:[class WindowControlsWebStory extends StoryElement{_window=null;_controls=null;constructor(){super(WindowControlsWebStory.getMetadata(),`Default`)}static getMetadata(){return Cf}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)))}}]},gf,Sf,vf,Bs];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:wf});
|