monowind 0.2.9 → 0.2.10

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/cdn.js CHANGED
@@ -952,39 +952,38 @@ input:where([type='button'], [type='reset'], [type='submit']),
952
952
  `;if(t.includes(`@import`)||(t=`@import "tailwindcss";${t}`),Z.end(`Reading Stylesheets`,{size:t.length,changed:vi!==t}),vi!==t){vi=t,Z.start(`Compile CSS`);try{gi=await fi(t,{base:`/`,loadStylesheet:Ci,loadModule:wi})}finally{Z.end(`Compile CSS`),Z.end(`Create compiler`)}_i.clear()}}async function Ci(e,t){function n(){if(e===`tailwindcss`)return{path:`virtual:tailwindcss/index.css`,base:t,content:pi.index};if(e===`tailwindcss/preflight`||e===`tailwindcss/preflight.css`||e===`./preflight.css`)return{path:`virtual:tailwindcss/preflight.css`,base:t,content:pi.preflight};if(e===`tailwindcss/theme`||e===`tailwindcss/theme.css`||e===`./theme.css`)return{path:`virtual:tailwindcss/theme.css`,base:t,content:pi.theme};if(e===`tailwindcss/utilities`||e===`tailwindcss/utilities.css`||e===`./utilities.css`)return{path:`virtual:tailwindcss/utilities.css`,base:t,content:pi.utilities};throw Error(`The browser build does not support @import for "${e}"`)}try{let r=n();return Z.hit(`Loaded stylesheet`,{id:e,base:t,size:r.content.length}),r}catch(n){throw Z.hit(`Failed to load stylesheet`,{id:e,base:t,error:n.message??n}),n}}async function wi(){throw Error(`The browser build does not support plugins or config files.`)}async function Ti(e){if(!gi)return;let t=new Set;Z.start(`Collect classes`);for(let e of document.querySelectorAll(`[class]`))for(let n of e.classList)_i.has(n)||(_i.add(n),t.add(n));Z.end(`Collect classes`,{count:t.size}),(t.size!==0||e!==`incremental`)&&(Z.start(`Build utilities`),yi.textContent=gi.build(Array.from(t)),Z.end(`Build utilities`))}function Ei(e){async function t(){if(!gi&&e!==`full`)return;let t=xi++;Z.start(`Build #${t} (${e})`),e===`full`&&await Si(),Z.start(`Build`),await Ti(e),Z.end(`Build`),Z.end(`Build #${t} (${e})`)}bi=bi.then(t).catch(e=>Z.error(e))}var Di=new MutationObserver(()=>Ei(`full`));function Oi(e){Di.observe(e,{attributes:!0,attributeFilter:[`type`],characterData:!0,subtree:!0,childList:!0})}new MutationObserver(e=>{let t=0,n=0;for(let r of e){for(let e of r.addedNodes)e.nodeType===Node.ELEMENT_NODE&&e.tagName===`STYLE`&&e.getAttribute(`type`)===hi&&(Oi(e),t++);for(let e of r.addedNodes)e.nodeType===1&&e!==yi&&n++;r.type===`attributes`&&n++}if(t>0)return Ei(`full`);if(n>0)return Ei(`incremental`)}).observe(document.documentElement,{attributes:!0,attributeFilter:[`class`],childList:!0,subtree:!0}),Ei(`full`),document.head.append(yi)})();var e=new Map,t=new Set;function n(n,r){let i=n.toLowerCase().trim();e.has(i)&&console.warn(`[monowind] registerBorderGlyphs: replacing "${i}" (last registration wins).`),e.set(i,r);for(let e of t)e()}function r(t){if(t)return e.get(t.toLowerCase().trim())}function i(e){return t.add(e),()=>t.delete(e)}function a(e){switch(e){case 1:case 2:case 3:return`h`;case 4:case 8:case 12:return`v`;case 5:return`tl`;case 6:return`tr`;case 9:return`bl`;case 10:return`br`;case 7:return`teeDown`;case 11:return`teeUp`;case 13:return`teeRight`;case 14:return`teeLeft`;case 15:return`cross`;default:return null}}var o=[` `,`─`,`─`,`─`,`│`,`┌`,`┐`,`┬`,`│`,`└`,`┘`,`┴`,`│`,`├`,`┤`,`┼`],s=[` `,`═`,`═`,`═`,`║`,`╔`,`╗`,`╦`,`║`,`╚`,`╝`,`╩`,`║`,`╠`,`╣`,`╬`];function c(e){let t={};for(let n=1;n<16;n++){let r=a(n);r&&!(r in t)&&(t[r]=e[n])}return t}var l=e=>c(Array.from({length:16},()=>e));n(`default`,{}),n(`rounded`,{solid:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`}});var u={...l(`+`),h:`-`,v:`|`};n(`ascii`,{solid:{...u,scrollTrack:`|`,scrollThumb:`#`},double:{...u,h:`=`},dashed:u,dotted:{...u,h:`.`,v:`:`}});var d=c(o);n(`single`,{double:d,dashed:d,dotted:d}),n(`cp437`,{dashed:d,dotted:d});function f(e){return{track:e?.solid?.scrollTrack??`░`,thumb:e?.solid?.scrollThumb??`█`}}n(`blocks`,{solid:l(`█`),double:l(`█`),dashed:l(`▒`),dotted:l(`░`)});var p=new WeakMap;function m(e,t){let n=p.get(e);n||p.set(e,n=new Set),!n.has(t)&&(n.add(t),console.warn(`[monowind] ${t}`,h(e)))}function h(e){if(!globalThis.process?.versions?.node)return e;let t=e.id?`#${e.id}`:``,n=e.classList.length?`.${Array.from(e.classList).join(`.`)}`:``;return`<${e.tagName.toLowerCase()}${t}${n}>`}var g=new Map,_=new Set;function v(e){let t=e.tag.toLowerCase();if(!t.includes(`-`)){console.warn(`[monowind] registerLeafRenderer: "${e.tag}" is not a custom-element tag name (needs a hyphen); ignored.`);return}g.has(t)&&console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`),g.set(t,{...e,tag:t}),w()}function y(){w()}function b(e){return g.get(e.toLowerCase())}function x(){let e=new Set;for(let t of g.values())for(let n of t.observedAttributes??[])e.add(n.toLowerCase());return[...e]}function S(e){return _.add(e),()=>_.delete(e)}function C(e,t){try{return e.render(t)}catch(n){return m(t,`<${e.tag}> renderer threw; rendering nothing. ${String(n)}`),null}}function w(){for(let e of _)e()}var T=new WeakMap,E=[],D=new Map;function O(e,t,n){let r=T.get(e);T.set(e,t);let i=D.get(e);if(i){if(t!==i.toValue){let n=te(i);return D.delete(e),E.push({el:e,from:n,to:t}),n}let n=te(i);return n===i.toValue&&D.delete(e),n}return r!==void 0&&r!==t&&n.transitionDuration.split(`,`).some(e=>parseFloat(e)>0)?(E.push({el:e,from:r,to:t}),r):t}function ee(e){let t=!1;for(let n=E.length-1;n>=0;n--){let{el:r,from:i,to:a}=E[n];if(!r.isConnected){E.splice(n,1);continue}if(!e.contains(r))continue;E.splice(n,1),t=!0;let o=re(getComputedStyle(r),`background-color`),s=oe(i),c=oe(a);o&&s&&c&&D.set(r,{from:s,to:c,toValue:a,start:performance.now()+o.delay,duration:o.duration,easing:o.easing})}return t}function k(){let e=performance.now();for(let[t,n]of D)(!t.isConnected||e>=n.start+n.duration)&&D.delete(t);return D.size>0}function te(e){let t=(performance.now()-e.start)/e.duration;if(t>=1)return e.toValue;let n=t<=0?0:e.easing(t);return ce(se(e.from,e.to,n))}var ne={ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]};function re(e,t){let n=e.transitionProperty.split(`,`).map(e=>e.trim()),r=-1;for(let e=0;e<n.length;e++)(n[e]===t||n[e]===`all`)&&(r=e);if(r<0)return null;let i=e=>{let t=e.split(`,`).map(e=>e.trim());return t[r%t.length]??``},a=A(i(e.transitionDuration));return a<=0?null:{duration:a*1e3,delay:A(i(e.transitionDelay))*1e3,easing:ie(i(e.transitionTimingFunction))}}function A(e){let t=parseFloat(e);return Number.isFinite(t)?e.endsWith(`ms`)?t/1e3:t:0}function ie(e){if(e===`linear`)return e=>e;let t=ne[e];if(t)return ae(...t);let n=e.match(/^cubic-bezier\(([^)]+)\)$/);if(n){let[e,t,r,i]=n[1].split(`,`).map(e=>parseFloat(e));if([e,t,r,i].every(e=>Number.isFinite(e)))return ae(e,t,r,i)}return e=>e}function ae(e,t,n,r){let i=(e,t,n)=>3*e*n*(1-n)*(1-n)+3*t*n*n*(1-n)+n*n*n;return a=>{let o=0,s=1;for(let t=0;t<24;t++){let t=(o+s)/2;i(e,n,t)<a?o=t:s=t}return i(t,r,(o+s)/2)}}function oe(e){if(e===``||e===`transparent`)return{r:0,g:0,b:0,a:0,legacy:!0};let t=e.match(/^rgba?\(([^)]+)\)$/);if(t){let e=t[1].split(/[\s,/]+/).map(e=>parseFloat(e));return e.length<3||e.some(e=>!Number.isFinite(e))?null:{r:e[0]/255,g:e[1]/255,b:e[2]/255,a:e[3]??1,legacy:!0}}if(t=e.match(/^color\(srgb ([^)]+)\)$/),t){let e=t[1].split(/[\s/]+/).map(e=>parseFloat(e));return e.length<3||e.slice(0,3).some(e=>!Number.isFinite(e))?null:{r:e[0],g:e[1],b:e[2],a:e[3]??1,legacy:!1}}if(t=e.match(/^okl(ch|ab)\(([^)]+)\)$/),t){let e=t[1]===`ch`,n=t[2].replaceAll(`none`,`0`).split(/[\s/]+/).map(e=>parseFloat(e));if(n.length<3||n.some(e=>!Number.isFinite(e)))return null;let[r,i,a]=n;return{...fe(r,e?i*Math.cos(a*Math.PI/180):i,e?i*Math.sin(a*Math.PI/180):a),a:n[3]??1,legacy:!1}}return null}function se(e,t,n){let r=e.a+(t.a-e.a)*n,i=(i,a)=>{let o=i*e.a+(a*t.a-i*e.a)*n;return r===0?0:o/r};if(e.legacy&&t.legacy)return{r:i(e.r,t.r),g:i(e.g,t.g),b:i(e.b,t.b),a:r,legacy:!0};let a=de(e.r,e.g,e.b),o=de(t.r,t.g,t.b);return{...fe(i(a.l,o.l),i(a.a,o.a),i(a.b,o.b)),a:r,legacy:!1}}function ce(e){let t=e=>Math.round(Math.min(1,Math.max(0,e))*255),n=Math.round(Math.min(1,Math.max(0,e.a))*1e3)/1e3;return`rgba(${t(e.r)}, ${t(e.g)}, ${t(e.b)}, ${n})`}function le(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function ue(e){return e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055}function de(e,t,n){let r=le(e),i=le(t),a=le(n),o=Math.cbrt(.4122214708*r+.5363325363*i+.0514459929*a),s=Math.cbrt(.2119034982*r+.6806995451*i+.1073969566*a),c=Math.cbrt(.0883024619*r+.2817188376*i+.6299787005*a);return{l:.2104542553*o+.793617785*s-.0040720468*c,a:1.9779984951*o-2.428592205*s+.4505937099*c,b:.0259040371*o+.7827717662*s-.808675766*c}}function fe(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return{r:ue(4.0767416621*r-3.3077115913*i+.2309699292*a),g:ue(-1.2684380046*r+2.6097574011*i-.3413193965*a),b:ue(-.0041960863*r-.7034186147*i+1.707614701*a)}}function pe(e,t,n){let i=e.border;if(i.top===0&&i.right===0&&i.bottom===0&&i.left===0)return;let a=Math.max(i.top,i.right,i.bottom,i.left);for(let o=0;o<a;o++){let a={top:o<i.top,right:o<i.right,bottom:o<i.bottom,left:o<i.left},s={x:t.x+(a.left?o:0),y:t.y+(a.top?o:0),width:t.width-(a.left?o:0)-(a.right?o:0),height:t.height-(a.top?o:0)-(a.bottom?o:0)};s.width<=0||s.height<=0||me(n,e.borderStyle,e.borderColor,s,a,r(e.glyphSet))}}function me(e,t,n,r,i,a){let o=ve(t.top,a),s=ve(t.right,a),c=ve(t.bottom,a),l=ve(t.left,a),u=(e,t,n)=>n(ve(e===t?e:`solid`,a)),{x:d,y:f,width:p,height:m}=r,h=p>=2&&m>=2,g=d+ +!!i.left,_=d+p-+!!i.right,v=f+ +!!i.top,y=f+m-+!!i.bottom;if(i.top&&_>g&&e.push({glyph:o.h,x:g,y:f,length:_-g,color:n.top}),i.bottom&&m>+!!i.top&&_>g&&e.push({glyph:c.h,x:g,y:f+m-1,length:_-g,color:n.bottom}),i.left)for(let t=v;t<y;t++)e.push({glyph:l.v,x:d,y:t,length:1,color:n.left});if(i.right&&p>+!!i.left)for(let t=v;t<y;t++)e.push({glyph:s.v,x:d+p-1,y:t,length:1,color:n.right});h&&(i.top&&i.left&&e.push({glyph:u(t.top,t.left,e=>e.tl),x:d,y:f,length:1,color:n.top}),i.top&&i.right&&e.push({glyph:u(t.top,t.right,e=>e.tr),x:d+p-1,y:f,length:1,color:n.top}),i.bottom&&i.left&&e.push({glyph:u(t.bottom,t.left,e=>e.bl),x:d,y:f+m-1,length:1,color:n.bottom}),i.bottom&&i.right&&e.push({glyph:u(t.bottom,t.right,e=>e.br),x:d+p-1,y:f+m-1,length:1,color:n.bottom}))}function he(e,t){return e.style.position!==`static`||(t.style.display===`flex`||t.style.display===`grid`)&&e.style.zIndex!==null}function ge(e){if(e.children.length<=1)return e.children;let t=null,n=null,r=null,i=null;for(let a of e.children)he(a,e)?(a.style.zIndex??0)<0?(t??=[]).push(a):(i??=[]).push(a):a.inlineBox?(r??=[]).push(a):(n??=[]).push(a);return t&&t.length>1&&t.sort((e,t)=>(e.style.zIndex??0)-(t.style.zIndex??0)),i&&i.length>1&&i.sort((e,t)=>(e.style.zIndex??0)-(t.style.zIndex??0)),!t&&n&&!r&&!i?n:!t&&!n&&r&&!i?r:!t&&!n&&!r&&i?i:[...t??[],...n??[],...r??[],...i??[]]}function _e(e,t,n){let r=ve(e,n);return t===`h`?r.h:r.v}function j(e,t,n,r,i,c){let l=(t?8:0)|(n?4:0)|(r?2:0)|!!i;if(c){let t=a(l),n=t&&c[e]?.[t];if(n)return n}return(e===`double`?s:o)[l]}function ve(e,t){let n=(n,r,i,a)=>j(e,n,r,i,a,t),r={h:n(!1,!1,!0,!0),v:n(!0,!0,!1,!1),tl:n(!1,!0,!1,!0),tr:n(!1,!0,!0,!1),bl:n(!0,!1,!1,!0),br:n(!0,!1,!0,!1)};return e===`dashed`?{h:`╌`,v:`╎`,...M(r),...N(t,e)}:e===`dotted`?{h:`┄`,v:`┊`,...M(r),...N(t,e)}:r}function M(e){let{h:t,v:n,...r}=e;return r}function N(e,t){let n=e?.[t],r={};return n?.h&&(r.h=n.h),n?.v&&(r.v=n.v),r}function ye(e,t,n,r){let i=e.map(e=>e.spanned?!1:n===`between`?e.beforeOccupied&&e.afterOccupied:n!==`around`||e.beforeOccupied||e.afterOccupied),a=[];for(let n=0;n<e.length;n++)if(a.push({start:e[n].start,end:e[n].end,covered:i[n]}),n+1<e.length){let r=t===`intersection`?!1:t===`none`?i[n]||i[n+1]:i[n]&&i[n+1];a.push({start:e[n].end,end:e[n+1].start,covered:r})}let o=[];for(let e of a){if(!e.covered)continue;let t=o[o.length-1];t&&t.end===e.start?t.end=e.end:o.push({start:e.start,end:e.end})}if(r===`overlap-join`){let t=new Map,n=new Map;for(let r=0;r+1<e.length;r++){let i=e[r].end,a=e[r+1].start-i;a<=0||(n.set(i,i+Math.ceil(a/2)),t.set(e[r+1].start,i+Math.floor(a/2)))}return o.map(e=>{let r=t.get(e.start),i=n.get(e.end);return{start:r??e.start,end:i??e.end,startHalf:r!==void 0,endHalf:i!==void 0}})}return o.map(e=>({start:e.start+r,end:e.end-r})).filter(e=>e.end>e.start)}function be(e){let t=[],n=e.border.left+e.padding.left,r=e.border.top+e.padding.top,i=(e,t)=>({line:t.bandStart+Math.floor((t.bandSize-e.width)/2),start:t.start,end:t.end,startHalf:t.startHalf===!0,endHalf:t.endHalf===!0}),a=e.ruleX?e.vertical.map(t=>i(e.ruleX,t)):[],o=e.ruleY?e.horizontal.map(t=>i(e.ruleY,t)):[],s=e.ruleX?.width??0,c=e.ruleY?.width??0,l=(e,t,n,r)=>e.some(e=>n>=e.line&&n<e.line+t&&(e.start<r&&e.end>r||e.end===r&&!e.endHalf||e.start===r&&!e.startHalf)),u=(e,t)=>o.some(n=>t>=n.line&&t<n.line+c&&e>=n.start&&e<n.end);if(e.ruleX){let i=_e(e.ruleX.style,`v`,e.glyphs);for(let o of a){for(let a=0;a<s;a++)for(let s=o.start;s<o.end;s++)u(o.line+a,s)||t.push({glyph:i,x:n+o.line+a,y:r+s,length:1,color:e.ruleX.color});xe(e,t,`x`,o.line,o.start,o.end)}}if(e.ruleY){let i=e.ruleY.style===`double`&&e.ruleX?.style===`double`;for(let u of o){for(let d=0;d<c;d++){let f=u.line+d;for(let d=u.start;d<u.end;d++){let u=l(a,s,d,f),p=l(a,s,d,f+1);t.push({glyph:u||p?j(i?`double`:`solid`,u,p,l(o,c,f,d),l(o,c,f,d+1),e.glyphs):_e(e.ruleY.style,`h`,e.glyphs),x:n+d,y:r+f,length:1,color:e.ruleY.color})}}xe(e,t,`y`,u.line,u.start,u.end)}}return t}function xe(e,t,n,r,i,a){let o=n===`x`?e.ruleX:e.ruleY,s=e.border.left+e.padding.left,c=e.border.top+e.padding.top,l=s+e.contentWidth+e.padding.right+e.border.right,u=c+e.contentHeight+e.padding.bottom+e.border.bottom,d=(n,r,i,a,s,c,l,u)=>{let d=o.style===`double`&&i===`double`?`double`:`solid`;t.push({glyph:j(d,s,c,l,u,e.glyphs),x:n,y:r,length:1,color:a})};if(n===`x`)for(let t=0;t<o.width;t++){let n=s+r+t;i<=0&&e.padding.top===0&&e.border.top>0&&d(n,e.border.top-1,e.borderStyle.top,e.borderColor.top,!1,!0,!0,!0),a>=e.contentHeight&&e.padding.bottom===0&&e.border.bottom>0&&d(n,u-e.border.bottom,e.borderStyle.bottom,e.borderColor.bottom,!0,!1,!0,!0)}else for(let t=0;t<o.width;t++){let n=c+r+t;i<=0&&e.padding.left===0&&e.border.left>0&&d(e.border.left-1,n,e.borderStyle.left,e.borderColor.left,!0,!0,!1,!0),a>=e.contentWidth&&e.padding.right===0&&e.border.right>0&&d(l-e.border.right,n,e.borderStyle.right,e.borderColor.right,!0,!0,!0,!1)}}function Se(e){return(e>=0?Math.floor(e+.5):-Math.floor(-e+.5))||0}function Ce(e,t){return t<=0?0:Se(e/(.25*t))}function P(e,t){return Se(t*e/100)}function F(e,t){let n=t.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).letterSpacing)||0,i=t.ownerDocument.createRange();i.selectNodeContents(t);let a=i.getBoundingClientRect().height,o=Math.max(0,a-n.height),s=Math.max(0,n.height-a),c=n.width/100,l=Math.ceil(c*64-1e-6)/64;return{width:l,height:n.height,letterSpacing:r,gridLetterSpacing:r+(l-c),inkOverhang:o,backgroundGap:s}}function I(){return parseFloat(getComputedStyle(document.documentElement).fontSize)||16}var L=[[4352,4447],[9001,9002],[11904,11929],[11931,12019],[12032,12245],[12272,12287],[12288,12350],[12353,12438],[12441,12543],[12549,12591],[12593,12686],[12688,12773],[12783,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510],[94176,94180],[94192,94193],[94208,100343],[100352,101589],[101631,101640],[110576,110590],[110592,110882],[110898,110898],[110928,110930],[110933,110933],[110948,110951],[110960,111355],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[131072,196605],[196608,262141]];function we(e){let t=0,n=L.length;for(;t<n;){let r=t+n>>1,[i,a]=L[r];if(e<i)n=r;else if(e>a)t=r+1;else return!0}return!1}var Te=/^\p{Extended_Pictographic}/u,R=/^\p{Emoji_Presentation}/u,Ee=/^\p{Regional_Indicator}/u,De=/^\p{Regional_Indicator}\p{Regional_Indicator}/u,Oe=/^[\p{Default_Ignorable_Code_Point}\p{Cc}\p{Cf}]+$/u,ke=`︎`,Ae=`️`,je=`‍`,Me=`⃣`;function Ne(e){let t=e.codePointAt(0);return t===void 0?0:t<128&&e.length===1?t<32||t===127?0:1:Te.test(e)?e.includes(ke)?1:e.includes(Ae)||e.includes(je)||R.test(e)?2:1:e.includes(Me)?2:Ee.test(e)?De.test(e)?2:1:we(t)||R.test(e)?2:+!Oe.test(e)}var Pe=/^[\x00-\x7f]*$/,Fe;function Ie(e){return Pe.test(e)?e.split(``):(Fe===void 0&&(Fe=typeof Intl.Segmenter==`function`?new Intl.Segmenter(void 0,{granularity:`grapheme`}):null),Fe?Array.from(Fe.segment(e),e=>e.segment):Array.from(e))}function Le(e,t){let n=Ne(e);return n===0?0:n+t}function Re(e,t=0){let n=[];for(let r of Ie(e)){n.push(Le(r,t));for(let e=1;e<r.length;e++)n.push(0)}return n}function ze(e){let t=0;for(let n of Ie(e))t+=Ne(n);return t}function Be(e,t,n={}){return Ue(e,t,n).length}function Ve(e,t){return t.endsWith(`
953
953
  `)&&e.pop(),e}function He(e){let t=[],n=0;for(let r=0;r<=e.length;r++)(r===e.length||e[r]===`
954
954
  `)&&(t.push({start:n,end:r}),n=r+1);return Ve(t,e)}function Ue(e,t,n={}){if(!/[^ \t\r\f]/.test(e))return[];let r=[],i=0,a=n.firstLineIndent??0;for(let o=0;o<=e.length;o++)(o===e.length||e[o]===`
955
- `)&&(r.push(...Qe(e,i,o,t,n,a)),a=0,i=o+1);return Ve(r,e)}function We(e,t,n){if(!n)return t-e;let r=0;for(let i=e;i<t;i++)r+=n[i]??1;return r}function Ge(e,t,n,r,i=0){return n<=t?0:We(t,n,r)-Math.min(i,Ke(e,n-1,r))}function Ke(e,t,n){if(!n)return 0;let r=t;for(;r>0&&n[r]===0;)r--;let i=Math.max(1,Ne(e.slice(r,t+1)));return Math.max(0,(n[r]??1)-i)}function qe(e,t={}){let{advances:n,tracking:r=0}=t,i=0;for(let t of Ze(e,0,e.length))for(let a of Ye(e,t.start,t.end))i=Math.max(i,Ge(e,a.start,a.end,n,r));return i}function Je(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===``&&(t(r,n),n++)}function Ye(e,t,n){let r=[],i=t;for(let a=t;a<n;a++){if(e[a]===``){a>i&&r.push({start:i,end:a}),r.push({start:a,end:a+1}),i=a+1;continue}if(e[a]!==`-`)continue;let o=a===t;for(;a+1<n&&e[a+1]===`-`;)a++;let s=a+1;!o&&s<n&&(r.push({start:i,end:s}),i=s)}return r.push({start:i,end:n}),r}var Xe=/[ \t\r\n\f]/;function Ze(e,t,n){let r=[],i=t;for(;i<n;){for(;i<n&&Xe.test(e[i]);)i++;if(i>=n)break;let t=i;for(;i<n&&!Xe.test(e[i]);)i++;r.push({start:t,end:i})}return r}function Qe(e,t,n,r,{advances:i,tracking:a=0},o=0){let s=Ze(e,t,n);if(s.length===0)return[{start:t,end:t}];if(r<=0)return[{start:s[0].start,end:s[s.length-1].end}];let c=[],l=null,u=0,d=Math.max(0,o),f=()=>r-d;for(let t of s){let n=!1;for(let r of Ye(e,t.start,t.end)){let t=r.start,o=r.end,s=l!==null&&!n?t-1:t,p=u+We(s,o,i),m=Math.min(a,Ke(e,o-1,i));if(l!==null&&p-m<=f())l.end=o,u=p;else{for(l!==null&&(c.push(l),d=0);;){let n=t;for(;n<o&&Ge(e,t,n+1,i,a)<=f();)n++;if(n===o||n===t)break;c.push({start:t,end:n}),d=0,t=n}l={start:t,end:o},u=We(t,o,i)}n=!0}}return l!==null&&c.push(l),c}function $e(e,t){let n=e.row.map(e=>e.node.localRect).sort((e,t)=>e.x-t.x),r=[];for(let e=1;e<n.length;e++){let i=n[e-1].x+n[e-1].width-t,a=n[e].x-t;a>i&&r.push({start:i,end:a})}return r}function et(e,t,n,r,i){if(e.style.ruleBreak!==`intersection`)return[{start:0,end:i}];let a=[t[n-1],t[n]].flatMap(e=>$e(e,r)).sort((e,t)=>e.start-t.start),o=(e,t)=>({start:e,end:t,spanned:!1,beforeOccupied:!0,afterOccupied:!0}),s=[],c=0;for(let e of a)e.start>c&&s.push(o(c,e.start)),c=Math.max(c,e.end);return c<i&&s.push(o(c,i)),ye(s,`intersection`,`all`,e.style.ruleInset===`overlap-join`?`overlap-join`:0)}function tt(e,t){return typeof t!=`number`||t<=0?e:e.map(e=>({...e,start:e.start+t,end:e.end-t})).filter(e=>e.end>e.start)}function nt(e,t,n,i,a,o,s){let c=$n(e.style,`x`,t),l=$n(e.style,`y`,n),u=ft(e).map(e=>{let n=X(e.style.margin,t);return{node:e,base:dt(e,t,s),grow:e.style.flexGrow,shrink:e.style.flexShrink,min:ht(e,t,s),max:tr(e.style.maxWidth,t),margin:n}}),d=[];if(e.style.flexWrap===`wrap`){let n=[],r=0;for(let e of u){let i=Math.max(0,J(e.base,e.min,e.max))+(e.margin.left??0)+(e.margin.right??0),a=n.length===0?i:r+c+i;n.length>0&&a>t&&(d.push(n),n=[],r=0),n.push(e),r=n.length===1?i:r+c+i}n.length>0&&d.push(n),e.style.wrapReverse&&d.reverse()}else d.push(u);let f=a.left+o.left,p=a.top+o.top,m=d.map(e=>{let n=c*Math.max(0,e.length-1),r=e.reduce((e,t)=>e+(t.margin.left??0)+(t.margin.right??0),0),a=Math.max(0,t-n-r),o=e.some(e=>e.margin.left===null||e.margin.right===null),l=e.reduce((e,t)=>e+t.base,0),u=o&&l<=a?e.map(e=>Math.max(0,J(e.base,e.min,e.max))):ct(e,a);for(let n=0;n<e.length;n++)q(e[n].node,t,i,0,0,`fill`,s,{width:u[n]});return{row:e,widths:u,availableForItems:a,height:e.reduce((e,t)=>Math.max(e,t.node.localRect.height),0)}}),h=m.map(e=>e.height),g=l*Math.max(0,m.length-1),_;if(e.style.flexWrap===`nowrap`)i===void 0?Number.isFinite(n)&&(h[0]=Math.max(n,h[0]??0)):h[0]=i,_=[0];else{let t=h.reduce((e,t)=>e+t,0),r=Number.isFinite(n)?Math.max(0,n-t-g):0,i=pt(e.style);if(i===`stretch`&&r>0){let e=z(Array.from({length:m.length},()=>1),r);for(let t=0;t<h.length;t++)h[t]+=e[t];_=st(`start`,h,0)}else _=st(i===`stretch`?`start`:i,h,r)}for(let r=0;r<m.length;r++){let{row:a,widths:o,availableForItems:u}=m[r],d=h[r],g=_[r]+r*l;for(let r=0;r<a.length;r++){let c=a[r].node,l=lt(c,e),u=a[r].margin,f=u.top===null||u.bottom===null,p=c.style.height!==void 0&&c.style.height.kind!==`auto`;if(l===`stretch`&&!f&&!p&&d!==c.localRect.height){let e=u.top??0,a=u.bottom??0,l=Number.isFinite(n)?n:void 0,f=J(Math.max(0,d-e-a),tr(c.style.minHeight,l)??0,tr(c.style.maxHeight,l));if(f===c.localRect.height)continue;q(c,t,i,0,0,`fill`,s,{width:o[r],height:f})}}let v=o.reduce((e,t)=>e+t,0),y=Math.max(0,u-v),b=a.reduce((e,t)=>e+ +(t.margin.left===null)+ +(t.margin.right===null),0),x=Array.from({length:a.length},()=>0),S=Array.from({length:a.length},()=>0),C;if(b>0&&y>0){let e=z(Array.from({length:b},()=>1),y),t=0;for(let n=0;n<a.length;n++)a[n].margin.left===null&&(x[n]=e[t++]),a[n].margin.right===null&&(S[n]=e[t++]);C=st(`start`,o,0)}else C=st(mt(e.style),o,y);let w=0;for(let t=0;t<a.length;t++){let n=a[t],r=n.node,i=n.margin.left??0,o=n.margin.right??0;w+=x[t]+i,r.localRect={...r.localRect,x:f+C[t]+t*c+w,y:p+g+at(r,e.style.alignItems,d,n.margin)},w+=S[t]+o}}let v=h.reduce((e,t)=>e+t,0)+g,y=Number.isFinite(n)?Math.max(n,v):v;if(e.style.ruleX||e.style.ruleY){let n=[],i=[];for(let r=0;r<m.length;r++){let a=_[r]+r*l;for(let e of $e(m[r],f))n.push({bandStart:e.start,bandSize:e.end-e.start,start:a,end:a+h[r]});if(r>0){let n=_[r-1]+(r-1)*l+h[r-1];if(a>n)for(let o of et(e,m,r,f,t))i.push({bandStart:n,bandSize:a-n,...o})}}e.decorationRuns=be({glyphs:r(e.style.glyphSet),ruleX:e.style.ruleX,ruleY:e.style.ruleY,vertical:tt(n,e.style.ruleInset),horizontal:tt(i,e.style.ruleInset),contentWidth:t,contentHeight:y,border:a,borderStyle:e.style.borderStyle,borderColor:e.style.borderColor,padding:o})}return rt(e,a,o,t,y),y}function rt(e,t,n,r,i){for(let a of e.children)K(a.style)&&(a.staticSlot={kind:`flex`,direction:e.style.flexDirection,originX:t.left+n.left,originY:t.top+n.top,innerWidth:r,innerHeight:i})}function it(e,t,n,i,a,o,s){let c=$n(e.style,`y`,n),l=ft(e).map(r=>{let a=X(r.style.margin,t),o=Math.max(0,t-(a.left??0)-(a.right??0)),c=lt(r,e)===`stretch`;q(r,o,i&&Number.isFinite(n)?n:void 0,0,0,c?`fill`:`shrink`,s);let l=Number.isFinite(n)?n:void 0,u=r.style.flexBasis,d=u===void 0||u.kind===`auto`?r.unclampedHeight:u.kind===`cells`?u.value:u.kind===`percent`&&l!==void 0?P(u.value,l):r.unclampedHeight,f=r.style.minHeight===`auto`?r.style.overflow.y===`visible`?r.localRect.height:0:void 0;return{node:r,base:d,grow:r.style.flexGrow,shrink:r.style.flexShrink,min:f??tr(r.style.minHeight,l)??0,max:tr(r.style.maxHeight,l),margin:a}}),u=c*Math.max(0,l.length-1),d=l.reduce((e,t)=>e+(t.margin.top??0)+(t.margin.bottom??0),0),f=Number.isFinite(n),p=l.reduce((e,t)=>e+t.base,0),m=f?Math.max(0,n-u-d):p,h=i?m:Math.max(m,p),g=l.some(e=>e.margin.top===null||e.margin.bottom===null),_=f&&!(f&&g&&p<=h)?ct(l,h):l.map(e=>Math.max(0,J(e.base,e.min,e.max)));for(let n=0;n<l.length;n++)if(_[n]!==l[n].node.localRect.height){let r=l[n],i=Math.max(0,t-(r.margin.left??0)-(r.margin.right??0)),a=lt(r.node,e)===`stretch`;q(r.node,i,_[n],0,0,a?`fill`:`shrink`,s,{height:_[n]})}let v=_.reduce((e,t)=>e+t,0),y=Math.max(0,h-v),b=l.reduce((e,t)=>e+ +(t.margin.top===null)+ +(t.margin.bottom===null),0),x=Array.from({length:l.length},()=>0),S=Array.from({length:l.length},()=>0),C;if(b>0&&y>0){let e=z(Array.from({length:b},()=>1),y),t=0;for(let n=0;n<l.length;n++)l[n].margin.top===null&&(x[n]=e[t++]),l[n].margin.bottom===null&&(S[n]=e[t++]);C=st(`start`,_,0)}else C=st(mt(e.style),_,y);let w=a.left+o.left,T=a.top+o.top,E=0;for(let n=0;n<l.length;n++){let r=l[n],i=r.node,a=r.margin.top??0,o=r.margin.bottom??0;E+=x[n]+a,i.localRect={...i.localRect,x:w+ot(i,e.style.alignItems,t,r.margin),y:T+C[n]+n*c+E},E+=S[n]+o}let D=v+u+d,O=f?Math.max(n,D):D;if(e.style.ruleY&&l.length>1){let n=[],i=l.map(e=>e.node.localRect).slice().sort((e,t)=>e.y-t.y);for(let e=1;e<i.length;e++){let r=i[e-1].y+i[e-1].height-T,a=i[e].y-T-r;a>0&&n.push({bandStart:r,bandSize:a,start:0,end:t})}e.decorationRuns=be({glyphs:r(e.style.glyphSet),ruleX:null,ruleY:e.style.ruleY,vertical:[],horizontal:tt(n,e.style.ruleInset),contentWidth:t,contentHeight:O,border:a,borderStyle:e.style.borderStyle,borderColor:e.style.borderColor,padding:o})}return rt(e,a,o,t,O),O}function at(e,t,n,r){let i=e.style.alignSelf===`auto`?t:e.style.alignSelf,a=r.top??0,o=r.bottom??0,s=n-e.localRect.height,c=r.top===null&&r.bottom===null,l=r.top===null&&r.bottom!==null,u=r.bottom===null&&r.top!==null;return c?Math.floor(s/2):l?s-o:u?a:a+ut(i,n,e.localRect.height)}function ot(e,t,n,r){let i=e.style.alignSelf===`auto`?t:e.style.alignSelf,a=r.left??0,o=r.right??0,s=n-e.localRect.width,c=r.left===null&&r.right===null,l=r.left===null&&r.right!==null,u=r.right===null&&r.left!==null;return c?Math.floor(s/2):l?s-o:u?a:a+ut(i,n,e.localRect.width)}function st(e,t,n){let r=t.length;if(r===0)return[];let i=[],a=0;if(e===`space-between`&&r>1){let e=Math.floor(n/(r-1)),o=n-e*(r-1);for(let n=0;n<r;n++)i.push(a),a+=t[n]+e+ +(n<o);return i}if((e===`space-around`||e===`space-evenly`)&&n>0){let o=z(Array.from({length:r+1},(t,n)=>e===`space-evenly`||n===0||n===r?1:2),n);for(let e=0;e<r;e++)a+=o[e],i.push(a),a+=t[e];return i}e===`center`?a=Math.floor(n/2):e===`end`&&(a=n);for(let e=0;e<r;e++)i.push(a),a+=t[e];return i}function ct(e,t){let n=e.length,r=(t,n)=>Math.max(0,J(t,e[n].min??0,e[n].max)),i=e.map(e=>e.base),a=t>=i.reduce((e,t,n)=>e+r(t,n),0),o=Array.from({length:n},()=>0),s=Array.from({length:n},()=>!1);for(let t=0;t<n;t++){let n=r(i[t],t);((a?e[t].grow:e[t].shrink)===0||a&&i[t]>n||!a&&i[t]<n)&&(o[t]=n,s[t]=!0)}for(;;){let c=[];for(let e=0;e<n;e++)s[e]||c.push(e);if(c.length===0)break;let l=o.reduce((e,t,n)=>s[n]?e+t:e,0),u=c.reduce((e,t)=>e+i[t],0),d=t-l-u,f=a?Math.max(0,d):Math.max(0,-d),p=z(c.map(t=>a?e[t].grow:i[t]*e[t].shrink),f),m=c.map((e,t)=>i[e]+(a?p[t]:-p[t])),h=c.map((e,t)=>r(m[t],e)),g=h.reduce((e,t,n)=>e+(t-m[n]),0);if(g===0){for(let e=0;e<c.length;e++)o[c[e]]=h[e];break}for(let e=0;e<c.length;e++){let t=h[e]-m[e];(g>0?t>0:t<0)&&(o[c[e]]=h[e],s[c[e]]=!0)}}return o}function z(e,t){let n=e.reduce((e,t)=>e+t,0);if(n===0||t<=0)return e.map(()=>0);let r=e.map(e=>e/n*t),i=r.map(Math.floor),a=t-i.reduce((e,t)=>e+t,0);if(a>0){let e=r.map((e,t)=>[t,e-Math.floor(e)]).sort((e,t)=>t[1]===e[1]?e[0]-t[0]:t[1]-e[1]);for(let[t]of e){if(a<=0)break;i[t]+=1,--a}}return i}function lt(e,t){return e.style.alignSelf===`auto`?t.style.alignItems:e.style.alignSelf}function ut(e,t,n){return e===`center`?Math.max(0,Math.floor((t-n)/2)):e===`end`?Math.max(0,t-n):0}function dt(e,t,n){let r=e.style.flexBasis,i=e.style.width;return r!==void 0&&r.kind!==`auto`?dr(r,t,e,n):i!==void 0&&i.kind!==`auto`?dr(i,t,e,n):fr(e,n)}function ft(e){let t=e.children.filter(e=>!K(e.style)).sort((e,t)=>e.style.order-t.style.order);return e.style.flexReverse&&t.reverse(),t}function pt(e){return e.wrapReverse?e.alignContent===`start`?`end`:e.alignContent===`end`?`start`:e.alignContent:e.alignContent}function mt(e){let t=e.justifyContent===`stretch`?`start`:e.justifyContent;return e.flexReverse?t===`start`?`end`:t===`end`?`start`:t:t}function ht(e,t,n){return e.style.minWidth===`auto`?e.style.overflow.x===`visible`?hr(e,n):0:tr(e.style.minWidth,t)??0}function gt(e){return e===`auto`||e===`scroll`}function _t(e){return e.children.filter(e=>e.inlineBox)}function vt(e){return{right:e.scrollbarSize.y+e.scrollbarInset.x,bottom:e.scrollbarSize.x+e.scrollbarInset.y}}function B(e){if(e.scrollbarWidth===`none`)return{right:0,bottom:0};let t=vt(e);return{right:e.overflow.y===`scroll`?t.right:0,bottom:e.overflow.x===`scroll`?t.bottom:0}}function yt(){return{display:`block`,flexDirection:`row`,flexReverse:!1,flexWrap:`nowrap`,wrapReverse:!1,flexGrow:0,flexShrink:0,flexBasis:void 0,order:0,justifyContent:`stretch`,alignContent:`stretch`,alignItems:`stretch`,alignSelf:`auto`,justifyItems:`stretch`,justifySelf:`auto`,gridTemplateColumns:{kind:`none`},gridTemplateRows:{kind:`none`},gridAutoColumns:[xt()],gridAutoRows:[xt()],gridAutoFlow:{direction:`row`,dense:!1},gridTemplateAreas:null,gridColumnStart:{kind:`auto`},gridColumnEnd:{kind:`auto`},gridRowStart:{kind:`auto`},gridRowEnd:{kind:`auto`},width:void 0,height:void 0,minWidth:`auto`,minHeight:`auto`,maxWidth:void 0,maxHeight:void 0,padding:bt(),margin:{top:0,right:0,bottom:0,left:0},position:`static`,insets:{top:null,right:null,bottom:null,left:null},gapX:0,gapY:0,border:bt(),borderStyle:{top:`solid`,right:`solid`,bottom:`solid`,left:`solid`},overflow:{x:`visible`,y:`visible`},scrollbarWidth:`auto`,scrollbarSize:{x:1,y:1},scrollbarInset:{x:0,y:0},overscroll:{x:!0,y:!0},scrollbarColor:null,whiteSpace:`normal`,tabSize:8,lineGap:0,tracking:0,textOverflow:`clip`,color:void 0,backgroundColor:void 0,backgroundClear:!1,fontWeight:`400`,fontStyle:`normal`,textDecorationLine:`none`,borderColor:{top:void 0,right:void 0,bottom:void 0,left:void 0},textAlignBlocked:!1,textAlign:`start`,textIndent:0,tableRole:`none`,tableLayout:`auto`,borderCollapse:!1,borderSpacingX:0,borderSpacingY:0,captionSide:`top`,verticalAlign:`start`,glyphSet:null,opacity:1,zIndex:null,latticeBorder:null,ruleX:null,ruleY:null,ruleBreak:`normal`,ruleInset:0,ruleVisibilityItems:`normal`,columnCount:null,columnWidth:null,columnFill:`balance`,columnSpan:!1,breakBeforeColumn:!1,breakAfterColumn:!1,breakInsideAvoid:!1}}function bt(){return{top:0,right:0,bottom:0,left:0}}function xt(){return{min:{kind:`auto`},max:{kind:`auto`}}}function St(e,t,n,i,a,o){let s=e.style,c=Number.isFinite(n)?n:void 0,l=e.subgrid?.cols,u=e.subgrid?.rows,d=l?l.gap:$n(s,`x`,t),f=u?u.gap:$n(s,`y`,c),p=Mt(e,t,c,d,f,e.subgrid?{col:e.subgrid.colSpan,row:e.subgrid.rowSpan}:void 0),{children:m,placed:h,colLines:g,rowLines:_,colTracks:v,rowTracks:y,colCollapsed:b,rowCollapsed:x}=p,S=m.map(e=>X(e.style.margin,t)),C=m.map(e=>e.style.justifySelf===`auto`?s.justifyItems:e.style.justifySelf),w=m.map(Ct),T=l?Tt(l):Kt(v,b,Et(p,w,S,o),t,d,s.justifyContent===`stretch`),E=l?l.positions:qt(T,t,s.justifyContent),D=[];for(let e=0;e<m.length;e++){let t=m[e],n=h.items[e],r=Yt(E,T.sizes,n.col.start,n.col.span),i=S[e],a=Math.max(0,r-It(i)),s=w[e];if(s.cols||s.rows){let e=s.cols?wt(E,T,d,n.col.start,n.col.span,Ot(t,`cols`,i,r)):void 0;t.subgrid={colSpan:n.col.span,rowSpan:n.row.span,cols:e,rows:void 0}}else t.subgrid=void 0;let c=C[e],l=i.left===null||i.right===null,u=t.style.width!==void 0&&t.style.width.kind!==`auto`;s.cols?q(t,r,void 0,0,0,`fill`,o,{width:a}):c===`stretch`&&!l&&!u?q(t,r,void 0,0,0,`fill`,o,{width:J(a,t.style.minWidth===`auto`?t.style.overflow.x===`visible`?hr(t,o):0:tr(t.style.minWidth,r)??0,nr(t.style.maxWidth,r,t,o))}):q(t,a,void 0,0,0,`shrink`,o),D.push(t.localRect.width)}let O=u?Tt(u):Kt(y,x,Dt(p,w,S),c??`max-content`,f,s.alignContent===`stretch`),ee=Jt(O),k=u?u.positions:qt(O,c??ee,s.alignContent),te=i.left+a.left,ne=i.top+a.top;for(let t=0;t<m.length;t++){let n=m[t],r=h.items[t],i=S[t],a=Yt(E,T.sizes,r.col.start,r.col.span),s=Yt(k,O.sizes,r.row.start,r.row.span),c=Math.max(0,s-Lt(i)),l=lt(n,e),u=i.top===null||i.bottom===null,d=n.style.height!==void 0&&n.style.height.kind!==`auto`;if(w[t].rows)n.subgrid.rows=wt(k,O,f,r.row.start,r.row.span,Ot(n,`rows`,i,a)),q(n,a,s,0,0,`fill`,o,{width:D[t],height:c});else if(l===`stretch`&&!u&&!d){let e=J(c,n.style.minHeight===`auto`?n.style.overflow.y===`visible`?n.localRect.height:0:tr(n.style.minHeight,s)??0,tr(n.style.maxHeight,s));e!==n.localRect.height&&q(n,a,s,0,0,`fill`,o,{width:D[t],height:e})}else n.style.height?.kind===`percent`&&q(n,a,s,0,0,`fill`,o,{width:D[t]});n.localRect={...n.localRect,x:te+E[r.col.start]+Xt(C[t],i.left,i.right,a,n.localRect.width),y:ne+k[r.row.start]+Xt(l,i.top,i.bottom,s,n.localRect.height)}}let re=Number.isFinite(n)?Math.max(n,ee):ee;if(s.ruleX||s.ruleY){let n=T.sizes.length,o=O.sizes.length,c=Array.from({length:n},()=>Array.from({length:o},()=>!1)),l=Array.from({length:Math.max(0,n-1)},()=>Array.from({length:o},()=>!1)),u=Array.from({length:Math.max(0,o-1)},()=>Array.from({length:n},()=>!1));for(let e of h.items)for(let t=e.col.start;t<e.col.start+e.col.span&&t<n;t++)for(let r=e.row.start;r<e.row.start+e.row.span&&r<o;r++)c[t][r]=!0,t+1<e.col.start+e.col.span&&t<n-1&&(l[t][r]=!0),r+1<e.row.start+e.row.span&&r<o-1&&(u[r][t]=!0);let d=(e,t,n,r,i,a)=>t.map((t,o)=>({start:t,end:t+n[o],spanned:r[e]?.[o]??!1,beforeOccupied:i(o),afterOccupied:a(o)})),f=(e,t,n)=>{let r=[];for(let i=1;i<e.length;i++){let a=e[i-1]+t[i-1],o=e[i]-a;if(!(o<=0))for(let e of ye(n(i-1),s.ruleBreak,s.ruleVisibilityItems,s.ruleInset))r.push({bandStart:a,bandSize:o,...e})}return r},p=f(E,T.sizes,e=>d(e,k,O.sizes,l,t=>c[e]?.[t]??!1,t=>c[e+1]?.[t]??!1)),m=f(k,O.sizes,e=>d(e,E,T.sizes,u,t=>c[t]?.[e]??!1,t=>c[t]?.[e+1]??!1));e.decorationRuns=be({glyphs:r(s.glyphSet),ruleX:s.ruleX,ruleY:s.ruleY,vertical:p,horizontal:m,contentWidth:t,contentHeight:re,border:i,borderStyle:s.borderStyle,borderColor:s.borderColor,padding:a})}let A=e.children.filter(e=>K(e.style));if(A.length>0){let e=K(s)?{x:i.left,y:i.top,width:a.left+t+a.right,height:a.top+re+a.bottom}:{x:te,y:ne,width:t,height:re};for(let n of A){let r=At(n.style.gridColumnStart,n.style.gridColumnEnd,g,h.colOrigin,E,T.sizes,-a.left,t+a.right),i=At(n.style.gridRowStart,n.style.gridRowEnd,_,h.rowOrigin,k,O.sizes,-a.top,re+a.bottom);n.staticSlot={kind:`grid`,area:{x:te+r.start,y:ne+i.start,width:Math.max(0,r.end-r.start),height:Math.max(0,i.end-i.start)},staticArea:e}}}return re}function Ct(e){let t=e.style.display===`grid`;return{cols:t&&e.style.gridTemplateColumns.kind===`subgrid`,rows:t&&e.style.gridTemplateRows.kind===`subgrid`}}function wt(e,t,n,r,i,a){let o=e[r]+a.start,s=t.sizes.slice(r,r+i);return s[0]=Math.max(0,s[0]-a.start),s[i-1]=Math.max(0,s[i-1]-a.end),{positions:Array.from({length:i},(t,n)=>n===0?0:e[r+n]-o),sizes:s,gapBefore:Array.from({length:i},(e,n)=>n===0?0:t.gapBefore[r+n]),gap:n}}function Tt(e){return{sizes:e.sizes,gapBefore:e.gapBefore,limits:e.sizes}}function Et(e,t,n,r){let i=[];return e.children.forEach((a,o)=>{let s=e.placed.items[o],c=n[o];if(t[o].cols){let e=Ot(a,`cols`,c,0);for(let t of kt(a,`cols`,s,e,r))i.push({...t,start:t.start+s.col.start});return}i.push({start:s.col.start,span:s.col.span,min:mr(a,`min`,r)+It(c),max:mr(a,`max`,r)+It(c)})}),i}function Dt(e,t,n){let r=[];return e.children.forEach((i,a)=>{let o=e.placed.items[a],s=n[a];if(t[a].rows){let e=Ot(i,`rows`,s,0);for(let t of kt(i,`rows`,o,e))r.push({...t,start:t.start+o.row.start});return}let c=i.localRect.height+Lt(s),l=i.style.minHeight===`auto`&&i.style.overflow.y!==`visible`?Lt(s):c;r.push({start:o.row.start,span:o.row.span,min:l,max:c})}),r}function Ot(e,t,n,r){let{border:i,padding:a}=e.style;return t===`cols`?{start:(n.left??0)+i.left+Y(a.left,r),end:(n.right??0)+i.right+Y(a.right,r)}:{start:(n.top??0)+i.top+Y(a.top,r),end:(n.bottom??0)+i.bottom+Y(a.bottom,r)}}function kt(e,t,n,r,i){let a=t===`cols`?n.col.span:n.row.span,o=Mt(e,void 0,void 0,0,0,{col:n.col.span,row:n.row.span}),s=[];if(o.children.forEach((e,n)=>{let c=o.placed.items[n],l=t===`cols`?c.col:c.row,u=l.start===0,d=l.start+l.span===a,f=(u?r.start:0)+(d?r.end:0),p=X(e.style.margin,0);if(Ct(e)[t]){let n=Ot(e,t,p,0),a=kt(e,t,c,{start:n.start+(u?r.start:0),end:n.end+(d?r.end:0)},i);for(let e of a)s.push({...e,start:e.start+l.start});return}if(t===`cols`)s.push({start:l.start,span:l.span,min:mr(e,`min`,i)+It(p)+f,max:mr(e,`max`,i)+It(p)+f});else{let t=e.localRect.height+Lt(p)+f;s.push({start:l.start,span:l.span,min:t,max:t})}}),s.length===0){let e=r.start+r.end;s.push({start:0,span:a,min:e,max:e})}return s}function At(e,t,n,r,i,a,o,s){let c=Ut(e,`start`,n),l=Ut(t,`end`,n);c!==null&&l!==null?c>l?[c,l]=[l,c]:c===l&&(l=null):c!==null&&t.kind===`span`?l=Wt(c,t,1,n):l!==null&&e.kind===`span`&&(c=Wt(l,e,-1,n));let u=i.length,d=e=>{if(e===null)return;let t=e-r;return t<0||t>u||u===0?void 0:t},f=e=>e===u?i[u-1]+a[u-1]:i[e],p=e=>e===0?i[0]:i[e-1]+a[e-1],m=d(c),h=d(l);return{start:m===void 0?o:f(m),end:h===void 0?s:p(h)}}function jt(e,t){let n=t.gridIntrinsic.get(e);if(n!==void 0)return n;let r=e.style,i=Math.max(typeof r.gapX==`number`?r.gapX:0,r.ruleX?.width??0),a=Mt(e,void 0,void 0,i,0,e.subgrid?{col:e.subgrid.colSpan,row:e.subgrid.rowSpan}:void 0),o=a.children.map(Ct),s=a.children.map(e=>X(e.style.margin,0)),c=Kt(a.colTracks,a.colCollapsed,Et(a,o,s,t),`min-content`,i,!1),l=c.gapBefore.reduce((e,t)=>e+t,0),u={min:c.sizes.reduce((e,t)=>e+t,0)+l,max:c.limits.reduce((e,t)=>e+t,0)+l};return t.gridIntrinsic.set(e,u),u}function Mt(e,t,n,r,i,a){let o=e.style,s=Ft(e),c=o.gridTemplateColumns.kind===`subgrid`&&a!==void 0,l=o.gridTemplateRows.kind===`subgrid`&&a!==void 0,u=c?Nt(a.col):Rt(o.gridTemplateColumns,t,r),d=l?Nt(a.row):Rt(o.gridTemplateRows,n,i),f=o.gridTemplateAreas,p=[...u.tracks],m=[...d.tracks];if(f){c||Bt(p,u.lineNames,f.columns,o.gridAutoColumns),l||Bt(m,d.lineNames,f.rows,o.gridAutoRows);for(let[e,t]of f.areas)u.lineNames[Math.min(t.colStart,p.length)].push(`${e}-start`),u.lineNames[Math.min(t.colEnd,p.length)].push(`${e}-end`),d.lineNames[Math.min(t.rowStart,m.length)].push(`${e}-start`),d.lineNames[Math.min(t.rowEnd,m.length)].push(`${e}-end`)}let h={explicitCount:p.length,names:u.lineNames},g={explicitCount:m.length,names:d.lineNames},_=Gt(s.map(e=>({col:V(e.style.gridColumnStart,e.style.gridColumnEnd,h),row:V(e.style.gridRowStart,e.style.gridRowEnd,g)})),p.length,m.length,o.gridAutoFlow);return c&&Pt(_,`col`,p.length),l&&Pt(_,`row`,m.length),{children:s,placed:_,colLines:h,rowLines:g,colTracks:Vt(p,_.colOrigin,_.colCount,o.gridAutoColumns),rowTracks:Vt(m,_.rowOrigin,_.rowCount,o.gridAutoRows),colCollapsed:Ht(u,_.colOrigin,_.colCount,_.items.map(e=>e.col)),rowCollapsed:Ht(d,_.rowOrigin,_.rowCount,_.items.map(e=>e.row))}}function Nt(e){return{tracks:Array.from({length:e},()=>xt()),lineNames:Array.from({length:e+1},()=>[])}}function Pt(e,t,n){let r=t===`col`?e.colOrigin:e.rowOrigin;for(let i of e.items){let e=i[t],a=Math.min(Math.max(e.start+r,0),n-1),o=Math.min(Math.max(e.start+r+e.span,a+1),n);e.start=a,e.span=o-a}t===`col`?(e.colOrigin=0,e.colCount=n):(e.rowOrigin=0,e.rowCount=n)}function Ft(e){return e.children.filter(e=>!K(e.style)&&!e.inlineBox).sort((e,t)=>e.style.order-t.style.order)}function It(e){return(e.left??0)+(e.right??0)}function Lt(e){return(e.top??0)+(e.bottom??0)}function Rt(e,t,n){if(e.kind!==`tracks`)return{tracks:[],lineNames:[[]]};let r=(e.lineNames??Array.from({length:e.tracks.length+1},()=>[])).map(e=>[...e]);if(!e.autoRepeat)return{tracks:e.tracks,lineNames:r};let{index:i,tracks:a,mode:o}=e.autoRepeat,s=1;if(t!==void 0){let e=a.reduce((e,n)=>{let r=zt(n.min,t)??zt(n.max,t)??1;return e+Math.max(1,r)},0);s=Math.max(1,Math.floor((t+n)/(e+n*a.length)))}let c=[];for(let e=0;e<s;e++)c.push(...a);let l=[...e.tracks.slice(0,i),...c,...e.tracks.slice(i)],u=e.autoRepeat.lineNames??Array.from({length:a.length+1},()=>[]),d=r.slice(0,i),f=[...e.autoRepeat.leadingNames??[]];for(let e=0;e<s;e++){f.push(...u[0]);for(let e=0;e<a.length;e++)d.push(f),f=[...u[e+1]]}return d.push([...f,...r[i]]),d.push(...r.slice(i+1)),o===`auto-fit`?{tracks:l,lineNames:d,autoFit:{start:i,end:i+c.length}}:{tracks:l,lineNames:d}}function zt(e,t){if(e.kind===`cells`)return e.value;if(e.kind===`percent`&&t!==void 0)return P(e.value,t);if(e.kind===`math`){let n=[];for(let r of e.args){let e=zt(r,t);if(e===void 0)return;n.push(e)}return e.fn===`min`?Math.min(...n):Math.max(...n)}}function Bt(e,t,n,r){for(let i=e.length;i<n;i++)e.push(r[(i-e.length)%r.length]),t.push([])}function Vt(e,t,n,r){let i=[];for(let a=0;a<n;a++){let n=a+t;if(n>=0&&n<e.length)i.push(e[n]);else{let t=n<0?n:n-e.length;i.push(r[(t%r.length+r.length)%r.length])}}return i}function Ht(e,t,n,r){let i=Array.from({length:n},()=>!1);if(!e.autoFit)return i;for(let a=e.autoFit.start;a<e.autoFit.end;a++){let e=a-t;e<0||e>=n||r.some(t=>e>=t.start&&e<t.start+t.span)||(i[e]=!0)}return i}function Ut(e,t,n){if(e.kind===`line`)return e.value>0?e.value-1:n.explicitCount+1+e.value;if(e.kind!==`name`)return null;if(e.nth===void 0){let r=`${e.name}-${t}`,i=n.names.findIndex(e=>e.includes(r));if(i!==-1)return i}let r=e.nth??1,i=n.explicitCount,a=0;if(r>0){for(let t=0;t<=i;t++)if(n.names[t].includes(e.name)&&++a===r)return t;return i+(r-a)}for(let t=i;t>=0;t--)if(n.names[t].includes(e.name)&&++a===-r)return t;return-(-r-a)}function Wt(e,t,n,r){if(t.name===void 0)return e+n*t.value;let i=t.value,a=e;for(;i>0;)a+=n,(!(a>=0&&a<=r.explicitCount)||r.names[a].includes(t.name))&&i--;return a}function V(e,t,n){let r=Ut(e,`start`,n),i=Ut(t,`end`,n);if(r!==null&&i!==null)return r===i?{start:r,span:1}:{start:Math.min(r,i),span:Math.abs(i-r)};if(r!==null)return{start:r,span:(t.kind===`span`?Wt(r,t,1,n):r+1)-r};if(i!==null){let t=e.kind===`span`?Wt(i,e,-1,n):i-1;return{start:t,span:i-t}}return{start:null,span:e.kind===`span`?e.value:t.kind===`span`?t.value:1}}function Gt(e,t,n,r){let i=r.direction===`row`,a=e.map(e=>i?e.row:e.col),o=e.map(e=>i?e.col:e.row),s=i?t:n,c=i?n:t,l=0,u=Math.max(s,1);for(let t=0;t<e.length;t++){let e=o[t];e.start!==null&&(l=Math.min(l,e.start),u=Math.max(u,e.start+e.span))}for(let t=0;t<e.length;t++){let e=o[t];e.start===null&&(u=Math.max(u,l+e.span))}let d=0;for(let t=0;t<e.length;t++){let e=a[t];e.start!==null&&(d=Math.min(d,e.start))}let f=new Set,p=(e,t,n,r)=>{for(let i=e;i<e+n;i++)for(let e=t;e<t+r;e++)if(f.has(`${i}:${e}`))return!1;return!0},m=(e,t,n,r)=>{for(let i=e;i<e+n;i++)for(let e=t;e<t+r;e++)f.add(`${i}:${e}`)},h=e.map(()=>null);for(let t=0;t<e.length;t++){let e=a[t],n=o[t];e.start!==null&&n.start!==null&&(h[t]={major:e.start,minor:n.start},m(e.start,n.start,e.span,n.span))}let g=new Map;for(let t=0;t<e.length;t++){let e=a[t],n=o[t];if(e.start===null||n.start!==null)continue;let i=r.dense?l:Math.max(l,g.get(e.start)??l);for(;!p(e.start,i,e.span,n.span);)i++;h[t]={major:e.start,minor:i},m(e.start,i,e.span,n.span),r.dense||g.set(e.start,i+n.span),u=Math.max(u,i+n.span)}let _=d,v=l;for(let t=0;t<e.length;t++){if(h[t]!==null)continue;let e=a[t],n=o[t];if(r.dense&&(_=d,v=l),n.start!==null){for(n.start<v&&_++;!p(_,n.start,e.span,n.span);)_++;h[t]={major:_,minor:n.start},m(_,n.start,e.span,n.span),v=n.start+n.span}else{let r=_,i=v;for(;;){if(i+n.span>u){r++,i=l;continue}if(p(r,i,e.span,n.span))break;i++}h[t]={major:r,minor:i},m(r,i,e.span,n.span),_=r,v=i+n.span}}let y=Math.max(c,d);for(let t=0;t<e.length;t++)y=Math.max(y,h[t].major+a[t].span);let b=e.map((e,t)=>{let n={start:h[t].major-d,span:a[t].span},r={start:h[t].minor-l,span:o[t].span};return i?{col:r,row:n}:{col:n,row:r}}),x=y-d,S=u-l;return i?{items:b,colOrigin:l,colCount:S,rowOrigin:d,rowCount:x}:{items:b,colOrigin:d,colCount:x,rowOrigin:l,rowCount:S}}function Kt(e,t,n,r,i,a){let o=typeof r==`number`?r:void 0,s=e.map((e,n)=>{if(t[n])return{base:0,limit:0,baseIntrinsic:!1,limitKind:`fixed`,frFactor:0,collapsed:!0};let r=zt(e.min,o),i=r??0,a=r===void 0,s=e.max;if(s.kind===`fr`)return{base:i,limit:null,baseIntrinsic:a,limitKind:`fr`,frFactor:s.value,collapsed:!1};let c=zt(s,o);return c===void 0?{base:i,limit:null,baseIntrinsic:a,limitKind:s.kind===`min-content`?`intrinsic-min`:`intrinsic-max`,frFactor:0,collapsed:!1}:{base:i,limit:c,baseIntrinsic:a,limitKind:`fixed`,frFactor:0,collapsed:!1}}),c=s.map((e,t)=>t===0||e.collapsed?0:s.slice(0,t).some(e=>!e.collapsed)?i:0),l=(e,t)=>{let n=0;for(let r=e+1;r<e+t;r++)n+=c[r];return n},u=e=>e.collapsed?0:e.limitKind===`fixed`?e.limit:Math.max(e.base,e.limit??e.base),d=[...n].sort((e,t)=>e.span-t.span);for(let e of d){let t=[],n=!1;for(let r=e.start;r<e.start+e.span;r++){let e=s[r];e!==void 0&&(e.limitKind===`fr`&&(n=!0),t.push(e))}if(t.length===0)continue;let r=l(e.start,e.span);if(n){let n=t.filter(e=>e.limitKind===`fr`&&e.baseIntrinsic&&!e.collapsed);if(n.length===0)continue;let i=t.reduce((e,t)=>e+t.base,0)+r,a=e.min-i;if(a>0){let e=n.reduce((e,t)=>e+t.frFactor,0),t=z(n.map(t=>e>0?t.frFactor:1),a);n.forEach((e,n)=>{e.base+=t[n]})}continue}let i=t.filter(e=>e.baseIntrinsic&&!e.collapsed);if(i.length>0){let n=t.reduce((e,t)=>e+t.base,0)+r,a=e.min-n;if(a>0){let e=z(i.map(()=>1),a);i.forEach((t,n)=>{t.base+=e[n]})}}for(let[n,i]of[[`intrinsic-min`,e.min],[`intrinsic-max`,e.max]]){let e=t.filter(e=>e.limitKind===n&&!e.collapsed);if(e.length===0)continue;let a=i-(t.reduce((e,t)=>e+u(t),0)+r);if(a>0){let t=z(e.map(()=>1),a);e.forEach((e,n)=>{e.limit=u(e)+t[n]})}}}for(let e of s)e.collapsed||(e.limitKind===`fixed`?e.base=Math.min(e.base,e.limit):e.limitKind!==`fr`&&(e.limit=Math.max(e.base,e.limit??e.base)));if(o===void 0){let e=s.filter(e=>e.limitKind===`fr`&&!e.collapsed);if(e.length>0){let t=0;for(let n of e)n.frFactor>0&&(t=Math.max(t,n.base/n.frFactor));for(let e of n){let n=0,r=l(e.start,e.span);for(let t=e.start;t<e.start+e.span;t++){let e=s[t];e===void 0||e.collapsed||(e.limitKind===`fr`?n+=e.frFactor:r+=u(e))}n<=0||(t=Math.max(t,(e.max-r)/Math.max(n,1)))}for(let n of e){let e=Math.max(n.base,Se(n.frFactor*t));n.limit=e,r===`max-content`&&(n.base=e)}}if(r===`max-content`)for(let e of s)!e.collapsed&&e.limitKind!==`fr`&&(e.base=u(e))}else{let e=c.reduce((e,t)=>e+t,0),t=o-e-s.reduce((e,t)=>e+t.base,0);for(;!(t<=0);){let e=s.filter(e=>!e.collapsed&&e.limitKind!==`fr`&&e.base<u(e));if(e.length===0)break;let n=z(e.map(()=>1),t),r=0;if(e.forEach((e,t)=>{let i=Math.min(n[t],u(e)-e.base);e.base+=i,r+=i}),t-=r,r===0)break}let n=s.filter(e=>e.limitKind===`fr`);if(n.length>0){let t=Math.max(0,o-e-s.reduce((e,t)=>e+(t.limitKind===`fr`?0:t.base),0)),r=n,i=t,a=n.reduce((e,t)=>e+t.frFactor,0);for(a<1&&(i=Math.floor(i*a));;){let e=z(r.map(e=>e.frFactor),i),t=r.filter((t,n)=>e[n]<t.base);if(t.length===0){r.forEach((t,n)=>{t.base=Math.max(t.base,e[n])});break}for(let e of t)i-=e.base;if(i=Math.max(0,i),r=r.filter(e=>!t.includes(e)),r.length===0)break}}if(a){let t=o-e-s.reduce((e,t)=>e+t.base,0),n=s.filter(e=>!e.collapsed&&e.limitKind===`intrinsic-max`);if(t>0&&n.length>0){let e=z(n.map(()=>1),t);n.forEach((t,n)=>{t.base+=e[n]})}}}return{sizes:s.map(e=>e.base),gapBefore:c,limits:s.map(e=>u(e))}}function qt(e,t,n){let{sizes:r,gapBefore:i}=e,a=Math.max(0,t-Jt(e)),o=st(n===`stretch`?`start`:n,r,a),s=[],c=0;for(let e=0;e<r.length;e++)c+=i[e],s.push(o[e]+c);return s}function Jt(e){return e.sizes.reduce((e,t)=>e+t,0)+e.gapBefore.reduce((e,t)=>e+t,0)}function Yt(e,t,n,r){let i=n+r-1;return e[n]===void 0||e[i]===void 0?0:e[i]+t[i]-e[n]}function Xt(e,t,n,r,i){let a=t??0,o=n??0,s=r-i;return t===null&&n===null?Math.floor(s/2):t===null?s-o:n===null?a:a+ut(e,r,i+a+o)}function Zt(e,t,n){let r=e.columnWidth===null?null:Math.max(1,Math.floor((t+n)/(e.columnWidth+n)));return e.columnCount!==null&&r!==null?Math.max(1,Math.min(e.columnCount,r)):r===null?Math.max(1,e.columnCount??1):r}function Qt(e,t,n){let r=Zt(e,t,n),i=Math.max(1,Math.floor((t-(r-1)*n)/r)),a=Math.max(0,t-(r*i+(r-1)*n));return Array.from({length:r},(e,t)=>i+ +(t<a))}function $t(e,t){let n=Math.max(typeof e.gapX==`number`?e.gapX:0,e.ruleX?.width??0);return e.columnCount===null?Math.max(e.columnWidth??1,t):e.columnCount*t+(e.columnCount-1)*n}function en(e,t){return e===void 0?t:t===void 0?e:Math.min(e,t)}function tn(e,t,n){for(;e<t;){let r=e+t>>1;n(r)?t=r:e=r+1}return e}function H(e,t,n){let r=Zt(e,t,n),i=Math.max(1,Math.floor((t-(r-1)*n)/r));return{count:r,width:i,leftover:Math.max(0,t-(r*i+(r-1)*n))}}function U(e,t,n){return e===`all`?!0:e===`around`?t||n:t&&n}function nn(e,t,n,r){let i=Zn(e,Math.max(1,t.width-e.style.tracking)),{heights:a,textOffsets:o}=Qn(e,i),s=e.style.lineGap,c=G(a.map(e=>e+s)),l;if(e.style.columnFill===`auto`&&r!==void 0)l=Math.max(1,r);else{let e=tn(c.reduce((e,t)=>Math.max(e,t.rows-s),1),Math.max(1,c.reduce((e,t)=>e+t.rows,0)-s),e=>W(c,s,e).columns<=t.count);l=r===void 0?e:Math.max(1,Math.min(e,r))}let u=W(c,s,l);return{spans:i,lineY:u.top,textY:u.top.map((e,t)=>e+o[t]),lineX:u.column.map(e=>e*(t.width+n)),totalRows:u.maxUsed,columnCount:t.count,columnWidth:t.width,gap:n,columnsUsed:i.length>0?u.columns:0}}function W(e,t,n,r=`truncate`){let i=0,a=0,o=0,s=[],c=[];for(let l=0;l<e.length;l++){let u=e[l],d=r===`glue`||l===0||a>0?u.pre:0;a>0&&(u.forced||a+d+u.rows+u.post-t>n)&&(r===`truncate`&&(d=0),i+=1,a=0);let f=u.rows/u.lines;if(u.lines>1&&u.rows-t>n){for(let e=0;e<u.lines;e++)a>0&&a+d+f-t>n&&(r===`truncate`&&(d=0),i+=1,a=0),s.push(i),c.push(a+d),a+=d+f,d=0,o=Math.max(o,a-t);a+=u.post,u.post>0&&(o=Math.max(o,a));continue}for(let e=0;e<u.lines;e++)s.push(i),c.push(a+d+e*f);a+=d+u.rows+u.post,o=Math.max(o,a-(u.post>0?0:t))}return{columns:i+1,maxUsed:o,column:s,top:c}}function G(e){return e.map(e=>({rows:e,pre:0,post:0,forced:!1,lines:1}))}var rn=null;function an(){if(rn!==null)return rn;let e=document.createElement(`div`);e.style.cssText=`position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1`,e.innerHTML=`<div style="margin:0;padding:0 0 20px 0">aaaaaa aaaaaa aaaaaa</div><div style="margin:0"><span>bbbbbb</span> bbbbbb</div>`,document.body.appendChild(e);let t=e.getBoundingClientRect().top,n=e.querySelector(`span`).getBoundingClientRect();return e.remove(),rn=!(n.width>0&&n.top-t>=10),rn}function on(e,t,n,i){let a=e.style;if(!a.ruleX)return;let o=t.columnCount*t.columnWidth+(t.columnCount-1)*t.gap,s=t.ruleSegments??[{start:0,end:t.totalRows,columns:t.columnsUsed}],c=[];for(let e of s){let n=Math.min(e.columns,t.columnCount);for(let r=0;r<t.columnCount-1;r++)U(a.ruleVisibilityItems,r<n,r+1<n)&&c.push({bandStart:(r+1)*t.columnWidth+r*t.gap,bandSize:t.gap,start:e.start,end:e.end})}e.decorationRuns=be({glyphs:r(a.glyphSet),ruleX:a.ruleX,ruleY:null,vertical:tt(c,a.ruleInset),horizontal:[],contentWidth:o,contentHeight:t.totalRows,border:n,borderStyle:a.borderStyle,borderColor:a.borderColor,padding:i})}function sn(e,t){let n=e.style,r=n.padding;return e.text!==``&&e.children.length===0&&n.display===`block`&&n.position===`static`&&!n.columnSpan&&n.whiteSpace===`normal`&&n.lineGap===t.lineGap&&n.border.top===0&&n.border.right===0&&n.border.bottom===0&&n.border.left===0&&r.top===0&&r.right===0&&r.bottom===0&&r.left===0&&n.backgroundColor===void 0&&!n.backgroundClear&&n.overflow.x===`visible`&&n.overflow.y===`visible`&&(n.width===void 0||n.width.kind===`auto`)&&(n.height===void 0||n.height.kind===`auto`)&&(n.minWidth===`auto`||n.minWidth===0||n.minWidth===void 0)&&(n.minHeight===`auto`||n.minHeight===0||n.minHeight===void 0)&&n.maxWidth===void 0&&n.maxHeight===void 0}function cn(e,t,n,r,i,a,o){let s=e.style,c=$n(s,`x`,n),l=H(s,n,c);a.right+=l.leftover;let u=s.lineGap,d=i.left+a.left,f=i.top+a.top,p=n-l.leftover,m=[[]],h=[];for(let e of t)e.style.columnSpan?(h[m.length-1]=e,m.push([])):m[m.length-1].push(e);let g=m.length>1,_=g?`glue`:`truncate`,v=[],y=0,b=0;for(let e=0;e<m.length;e++){let t=m[e],n=0;if(t.length>0){let i=t.map(e=>({node:e,spans:Zn(e,Math.max(1,l.width-e.style.tracking)),margin:X(e.style.margin,l.width),pre:0,post:0})),a=[],o=null,h=null,x=!1;for(let e of i){let{node:t,spans:n,margin:r}=e,i=o===null?r.top??0:ar(o,r.top??0),s=i;_===`glue`&&h!==null?(s=0,h.post=i,a[a.length-1].post=i):e.pre=i;let c=x||t.style.breakBeforeColumn;if(t.style.breakInsideAvoid&&n.length>0)a.push({rows:n.length*(1+u),pre:s,post:0,forced:c,lines:n.length});else for(let e=0;e<n.length;e++)a.push({rows:1+u,pre:e>0?0:s,post:0,forced:e===0&&c,lines:1});n.length>0&&(o=r.bottom??0,h=e),x=t.style.breakAfterColumn}n=o??0;let S;if(s.columnFill===`auto`&&r!==void 0)S=Math.max(1,r);else{let e=tn(1,Math.max(1,W(a,u,1/0,_).maxUsed),e=>W(a,u,e,_).columns<=l.count);S=r===void 0?e:Math.max(1,Math.min(e,r))}let C=W(a,u,S,_);for(let e=0,t=0;e<i.length;e++){let{node:n,spans:r,margin:a,pre:o,post:s}=i[e],u=[],m=[];for(let e=0;e<r.length;e++,t++)u.push(y+C.top[t]),m.push(C.column[t]*(l.width+c));delete n.decorationRuns,n.multicolGeometry={spans:r,lineY:u,textY:u,lineX:m,totalRows:y+C.maxUsed,columnCount:l.count,columnWidth:l.width,gap:c,columnsUsed:C.columns},n.multicolFlow=g?{top:o,right:a.right,bottom:s,left:a.left}:a,n.localRect={x:d,y:f,width:p,height:C.maxUsed},n.resolvedPadding={top:0,right:0,bottom:0,left:0}}a.length>0&&(v.push({start:y,end:y+C.maxUsed,columns:C.columns}),b=Math.max(b,C.columns),y+=C.maxUsed+(e<m.length-1?u:0))}let i=h[e];if(i){let e=X(i.style.margin,p),t=(e.left??0)+(e.right??0);q(i,Math.max(0,p-t),void 0,0,0,`fill`,o);let r=ir(e,p,i.localRect.width),a=(e.top??0)+n;y+=a,i.localRect={...i.localRect,x:d+r,y:f+y},i.multicolFlowSpan={top:a,right:0,bottom:e.bottom??0,left:r},y+=i.localRect.height+(e.bottom??0)}}let x=y;for(let t of e.children){if(!K(t.style))continue;let e=X(t.style.margin,n);t.staticSlot={kind:`block`,x:d+(e.left??0),y:f+(e.top??0)}}return e.multicolGeometry={spans:[],lineY:[],textY:[],lineX:[],totalRows:x,columnCount:l.count,columnWidth:l.width,gap:c,columnsUsed:b,...g?{ruleSegments:v,nativeBalance:!0}:{}},x}function ln(e,t,n,i,a,o,s){let c=e.style,l=en(n,i),u=e.children.filter(e=>!K(e.style)),d=u.filter(e=>!e.style.columnSpan),f=u.reduce((e,t,n)=>!t.style.columnSpan&&(n===0||u[n-1].style.columnSpan)?e+1:e,0);if(d.length>0&&d.every(e=>sn(e,c))&&(d.length===u.length||c.columnFill===`balance`&&l===void 0&&(an()||f<=1&&d.every(e=>(e.style.margin.top===0||e.style.margin.top===null)&&(e.style.margin.bottom===0||e.style.margin.bottom===null)))))return cn(e,u,t,l,a,o,s);let p=$n(c,`x`,t),m=Qt(c,t,p),h=m.length,g=[];{let e=0;for(let t of m)g.push(e),e+=t+p}let _=e=>e<h?g[e]:g[h-1]+(e-h+1)*(m[h-1]+p),v=e=>m[Math.min(e,h-1)],y=m[h-1],b=a.left+o.left,x=a.top+o.top,S=[],C=0,w=[],T=[],E=!1,D=(e,t)=>{let r=0,i=0,a=null,o=0,c=e=>{if(t)for(let t of T){if(t.index!==e)continue;let n=a===null?t.margin.top??0:ar(a,t.margin.top??0);t.child.staticSlot={kind:`block`,x:b+_(r)+(t.margin.left??0),y:x+C+i+n}}};for(let l=0;l<w.length;l++){let u=w[l];c(l);let d=a===null?l===0?u.margin.top??0:0:ar(a,u.margin.top??0),f=u.node.localRect.height;if(a!==null&&(u.breakBefore||i+d+f>e)&&(r+=1,i=0,a=null,d=0),t){let e=u.node,t=v(r);if(t!==y){let r=(u.margin.left??0)+(u.margin.right??0);q(e,Math.max(0,t-r),n,0,0,`fill`,s)}e.localRect={...e.localRect,x:b+_(r)+ir(u.margin,t,e.localRect.width),y:x+C+i+d}}i+=d+u.node.localRect.height,o=Math.max(o,i),a=u.margin.bottom??0}return c(w.length),{columns:r+1,maxUsed:o}},O=()=>{if(w.length===0){for(let e of T)e.child.staticSlot={kind:`block`,x:b+(e.margin.left??0),y:x+C+(e.margin.top??0)};T=[];return}let e=l===void 0?void 0:Math.max(1,l-C),t=c.columnFill===`auto`&&e!==void 0,r;if(t)r=e;else{let t=tn(1,D(1/0,!1).maxUsed,e=>D(e,!1).columns<=h);r=e===void 0?t:Math.min(t,e)}let i=D(r,!0),a=t&&n!==void 0?Math.max(i.maxUsed,r):i.maxUsed;if(c.ruleX)for(let e=0;e<h-1;e++){let t=Math.min(i.columns,h);U(c.ruleVisibilityItems,e<t,e+1<t)&&S.push({bandStart:g[e]+m[e],bandSize:p,start:C,end:C+a})}C+=a,w=[],T=[]};for(let r of e.children){if(K(r.style)){T.push({child:r,margin:X(r.style.margin,t),index:w.length});continue}if(r.style.columnSpan){O(),E=!1;let e=X(r.style.margin,t),i=(e.left??0)+(e.right??0);q(r,Math.max(0,t-i),n,0,0,`fill`,s),C+=e.top??0,r.localRect={...r.localRect,x:b+ir(e,t,r.localRect.width),y:x+C},C+=r.localRect.height+(e.bottom??0);continue}let e=X(r.style.margin,y),i=(e.left??0)+(e.right??0);q(r,Math.max(0,y-i),n,0,0,`fill`,s),w.push({node:r,margin:e,breakBefore:E||r.style.breakBeforeColumn}),E=r.style.breakAfterColumn}return O(),c.ruleX&&S.length>0&&(e.decorationRuns=be({glyphs:r(c.glyphSet),ruleX:c.ruleX,ruleY:null,vertical:tt(S,c.ruleInset),horizontal:[],contentWidth:t,contentHeight:C,border:a,borderStyle:c.borderStyle,borderColor:c.borderColor,padding:o})),C}function un(e,t){e.hidden.push(t),t.style.tableRole!==`column`&&t.style.tableRole!==`column-group`&&m(t.source,`Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).`)}function dn(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isNaN(n)?1:t===`colspan`?Math.min(1e3,Math.max(1,n)):Math.min(65534,Math.max(0,n))}function fn(e,t,n){let r=(t,r)=>{let i=t.style.width,a=i&&i.kind!==`auto`&&i.kind!==`percent`?dr(i,0,t,n):void 0,o=i&&i.kind===`percent`?i.value:void 0;for(let t=0;t<r;t++)e.colFixed.push(a),e.colPercent.push(o)};if(t.style.tableRole===`column`){r(t,pn(t.source));return}let i=t.children.filter(e=>e.style.tableRole===`column`);if(i.length===0)r(t,pn(t.source));else for(let e of i)r(e,pn(e.source));for(let n of t.children)n.style.tableRole!==`column`&&un(e,n)}function pn(e){let t=Number.parseInt(e.getAttribute(`span`)??``,10);return Number.isNaN(t)?1:Math.min(1e3,Math.max(1,t))}function mn(e,t){let n={caption:null,rows:[],rowGroups:[],groupEnds:[],cells:[],columnCount:0,colFixed:[],colPercent:[],hidden:[]},r=[],i=[],a=[];for(let o of e.children){if(K(o.style))continue;let e=o.style.tableRole;if(e===`row`)i.push({row:o,group:null});else if(e===`header-group`||e===`row-group`||e===`footer-group`){let t=e===`header-group`?r:e===`footer-group`?a:i;for(let e of o.children)K(e.style)||(e.style.tableRole===`row`?t.push({row:e,group:o}):un(n,e))}else e===`caption`?n.caption===null?n.caption=o:un(n,o):e===`column`||e===`column-group`?(fn(n,o,t),n.hidden.push(o)):un(n,o)}let o=[...r,...i,...a],s=0;for(let e=0;e<o.length;e++){n.rows.push(o[e].row),n.rowGroups.push(o[e].group);let t=o[e+1]?.group;if(!(e+1<o.length&&(o[e].group===t||o[e].group===null&&t===null))){for(let t=s;t<=e;t++)n.groupEnds.push(e+1);s=e+1}}return hn(n),n}function hn(e){let t=[];for(let n=0;n<e.rows.length;n++){let r=e.rows[n],i=0;for(let a of r.children){if(K(a.style))continue;if(a.style.tableRole!==`cell`){un(e,a);continue}for(;(t[i]??0)>n;)i++;let o=dn(a.source,`colspan`),s=dn(a.source,`rowspan`),c=e.groupEnds[n],l=Math.max(1,Math.min(s===0?c-n:s,c-n));for(let e=i;e<i+o;e++)t[e]=Math.max(t[e]??0,n+l);e.cells.push({node:a,rowNode:r,row:n,col:i,rowSpan:l,colSpan:o}),i+=o}}e.columnCount=Math.max(t.length,e.colFixed.length)}function gn(e,t,n){let r=e.style,i=hr(e,n),a;if(t===`min`)a=i;else{let t=r.width!==void 0&&r.width.kind!==`auto`&&r.width.kind!==`percent`?dr(r.width,0,e,n):void 0;a=t===void 0?fr(e,n):Math.max(i,t)}let o=typeof r.minWidth==`number`?r.minWidth:0,s=typeof r.maxWidth==`number`?r.maxWidth:void 0;return Math.max(0,J(a,o,s))}function _n(e){let t=e.style.width;return t&&t.kind===`percent`?t.value:void 0}function vn(e,t,n){let r=e.columnCount,i=Array.from({length:r},()=>0),a=Array.from({length:r},()=>0),o=Array.from({length:r},()=>void 0);for(let t=0;t<r;t++)e.colFixed[t]!==void 0&&(a[t]=e.colFixed[t]),o[t]=e.colPercent[t];let s=[];for(let t of e.cells){if(t.colSpan>1){s.push(t);continue}i[t.col]=Math.max(i[t.col],gn(t.node,`min`,n)),a[t.col]=Math.max(a[t.col],gn(t.node,`max`,n));let e=_n(t.node);e!==void 0&&(o[t.col]=Math.max(o[t.col]??0,e))}s.sort((e,t)=>e.colSpan-t.colSpan);for(let e of s){let r=e.col,o=e.col+e.colSpan,s=Tn(t,r,o),c=a.slice(r,o);for(let t of[`min`,`max`]){let l=t===`min`?i:a,u=l.slice(r,o).reduce((e,t)=>e+t,0)+s,d=gn(e.node,t,n)-u;if(d<=0)continue;let f=z(c.some(e=>e>0)?c:c.map(()=>1),d);for(let e=r;e<o;e++)l[e]+=f[e-r]}}for(let e=0;e<r;e++)a[e]=Math.max(a[e],i[e]);return{min:i,max:a,percent:o}}function yn(e,t){let n=e.min.length,r=e.min.slice(),i=[],a=[];for(let t=0;t<n;t++)(e.percent[t]===void 0?a:i).push(t);if(i.length>0){let n=i.reduce((t,n)=>t+e.percent[n],0),o=Math.max(100,n);for(let n of i){let i=Math.round(t*e.percent[n]/o);r[n]=Math.max(e.min[n],i)}let s=a.reduce((t,n)=>t+e.min[n],0),c=i.reduce((e,t)=>e+r[t],0)-(t-s);if(c>0){let t=i.map(t=>r[t]-e.min[t]),n=z(t,Math.min(c,t.reduce((e,t)=>e+t,0)));i.forEach((e,t)=>r[e]-=n[t])}}let o=t-r.reduce((e,t)=>e+t,0);if(o>0&&a.length>0){let t=a.map(t=>e.max[t]-e.min[t]),n=t.reduce((e,t)=>e+t,0),i=z(t,Math.min(o,n));a.forEach((e,t)=>r[e]+=i[t]),o-=Math.min(o,n)}if(o>0){let t=a.length>0?a:i;if(t.length>0){let n=t.map(t=>e.max[t]),i=z(n.some(e=>e>0)?n:n.map(()=>1),o);t.forEach((e,t)=>r[e]+=i[t])}}return r}function bn(e,t,n){let r=e.columnCount,i=Array.from({length:r},()=>void 0);for(let n=0;n<r;n++)e.colFixed[n]===void 0?e.colPercent[n]!==void 0&&(i[n]=Math.max(0,Math.round(t*e.colPercent[n]/100))):i[n]=e.colFixed[n];for(let r of e.cells){if(r.row!==0)continue;let e=r.node.style,a;if(e.width&&e.width.kind===`percent`?a=Math.max(0,Math.round(t*e.width.value/100)):e.width&&e.width.kind!==`auto`&&(a=dr(e.width,0,r.node,n)),a===void 0)continue;let o=z(Array.from({length:r.colSpan},()=>1),a);for(let e=0;e<r.colSpan;e++){let t=r.col+e;i[t]===void 0&&(i[t]=o[e])}}let a=i.reduce((e,t)=>e+(t??0),0),o=i.filter(e=>e===void 0).length;if(o>0){let e=z(Array.from({length:o},()=>1),Math.max(0,t-a)),n=0;for(let t=0;t<r;t++)i[t]===void 0&&(i[t]=e[n++])}return i.map(e=>e??0)}var xn={double:3,solid:2,dashed:1,dotted:0};function Sn(e){for(let{border:t,side:n}of e)if(t?.hidden[n])return null;let t=null;for(let{border:n,side:r}of e){if(!n)continue;let e=n.width[r];if(e<=0)continue;let i=n.style[r];(t===null||e>t.width||e===t.width&&xn[i]>xn[t.style])&&(t={width:e,style:i,color:n.color[r]})}return t}function Cn(e,t){let n=t.columnCount,r=t.rows.length,i=e.style.borderCollapse,a={collapsed:i,vLines:Array.from({length:n+1},()=>0),hLines:Array.from({length:r+1},()=>0),spacingX:i?0:e.style.borderSpacingX,spacingY:i?0:e.style.borderSpacingY,vSegments:[],hSegments:[]};if(!i||n===0||r===0)return a;let o=Array.from({length:r},()=>Array.from({length:n},()=>void 0));for(let e of t.cells)for(let t=e.row;t<e.row+e.rowSpan;t++)for(let n=e.col;n<e.col+e.colSpan;n++)o[t][n]=e;let s=e.style.latticeBorder;for(let e=0;e<=n;e++){let i=[];for(let a=0;a<r;a++){let r=e>0?o[a][e-1]:void 0,c=e<n?o[a][e]:void 0;if(r!==void 0&&r===c){i.push(null);continue}let l=[];r&&r.col+r.colSpan===e&&l.push({border:r.node.style.latticeBorder,side:`right`}),c&&c.col===e&&l.push({border:c.node.style.latticeBorder,side:`left`});let u=e===0?`left`:e===n?`right`:null;if(u){l.push({border:t.rows[a].style.latticeBorder,side:u});let e=t.rowGroups[a];e&&l.push({border:e.style.latticeBorder,side:u}),l.push({border:s,side:u})}i.push(Sn(l))}a.vSegments.push(i),a.vLines[e]=i.reduce((e,t)=>Math.max(e,t?.width??0),0)}for(let e=0;e<=r;e++){let i=[];for(let a=0;a<n;a++){let n=e>0?o[e-1][a]:void 0,c=e<r?o[e][a]:void 0;if(n!==void 0&&n===c){i.push(null);continue}let l=[];n&&n.row+n.rowSpan===e&&l.push({border:n.node.style.latticeBorder,side:`bottom`}),c&&c.row===e&&l.push({border:c.node.style.latticeBorder,side:`top`}),e>0&&l.push({border:t.rows[e-1].style.latticeBorder,side:`bottom`}),e<r&&l.push({border:t.rows[e].style.latticeBorder,side:`top`});let u=e>0?t.rowGroups[e-1]:null,d=e<r?t.rowGroups[e]:null;u&&u!==d&&l.push({border:u.style.latticeBorder,side:`bottom`}),d&&d!==u&&l.push({border:d.style.latticeBorder,side:`top`}),e===0&&l.push({border:s,side:`top`}),e===r&&l.push({border:s,side:`bottom`}),i.push(Sn(l))}a.hSegments.push(i),a.hLines[e]=i.reduce((e,t)=>Math.max(e,t?.width??0),0)}return a}function wn(e,t){return e.collapsed?e.vLines.reduce((e,t)=>e+t,0):(t+1)*e.spacingX}function Tn(e,t,n){if(!e.collapsed)return e.spacingX*(n-t-1);let r=0;for(let i=t+1;i<n;i++)r+=e.vLines[i];return r}function En(e,t,n){if(!e.collapsed)return e.spacingY*(n-t-1);let r=0;for(let i=t+1;i<n;i++)r+=e.hLines[i];return r}function Dn(e,t){let n=t.tableData.get(e);if(n)return n;let r=mn(e,t),i=Cn(e,r),a={structure:r,chrome:i,bounds:vn(r,i,t),chromeX:wn(i,r.columnCount)};return t.tableData.set(e,a),a}function On(e,t){let{structure:n,bounds:r,chromeX:i}=Dn(e,t),a=r.min.reduce((e,t)=>e+t,0)+i,o=r.max.reduce((e,t)=>e+t,0)+i;return n.caption&&(a=Math.max(a,hr(n.caption,t)),o=Math.max(o,fr(n.caption,t))),{min:a,max:o}}function kn(e,t,n){let r=e.style,{bounds:i,chromeX:a}=Dn(e,n),{min:o,max:s}=On(e,n),c=r.border.left+r.border.right+Y(r.padding.left,t)+Y(r.padding.right,t)+B(r).right,l=i.max.reduce((e,t)=>e+t,0),u=0,d=0;for(let e=0;e<i.max.length;e++){let t=i.percent[e];t===void 0?d+=i.max[e]:u+=t}if(u>=100)l=1/0;else if(u>0){for(let e=0;e<i.max.length;e++){let t=i.percent[e];t!==void 0&&t>0&&(l=Math.max(l,Math.ceil(i.max[e]*100/t)))}l=Math.max(l,Math.ceil(d*100/(100-u)))}let f=Math.max(l+a,s)+c;return Math.max(o+c,Math.min(f,t))}function An(e,t,n,i,a,o){let{structure:s,chrome:c,bounds:l}=Dn(e,o),u=s.columnCount,d=s.rows.length,f=i.left+a.left,p=i.top+a.top;for(let e of s.hidden)e.tableHidden=!0,e.localRect={x:0,y:0,width:0,height:0},e.resolvedPadding={top:0,right:0,bottom:0,left:0},e.unclampedHeight=0;let m=Math.max(0,t-wn(c,u)),h=e.style,g=h.tableLayout===`fixed`&&h.width!==void 0&&h.width.kind!==`auto`?bn(s,m,o):yn(l,m),_=[],v=0;for(let e=0;e<u;e++)v+=c.collapsed?c.vLines[e]:c.spacingX,_.push(v),v+=g[e];let y=v+(c.collapsed?c.vLines[u]??0:c.spacingX),b=0;s.caption&&(q(s.caption,t,void 0,f,p,`fill`,o),b=s.caption.localRect.height);let x=new Map,S=new Map;for(let e of s.cells){let t=e.col+e.colSpan,n=g.slice(e.col,t).reduce((e,t)=>e+t,0)+Tn(c,e.col,t);S.set(e,n),q(e.node,n,void 0,0,0,`fill`,o,{width:n}),x.set(e,e.node.localRect.height)}let C=c.collapsed?c.hLines.reduce((e,t)=>e+t,0):(d+1)*c.spacingY,w=n===void 0?void 0:Math.max(0,n-b-C),T=e=>e!==void 0&&e.kind===`percent`&&w!==void 0?P(e.value,w):0,E=Array.from({length:d},()=>0),D=Array.from({length:d},()=>!1);for(let e=0;e<d;e++){let t=s.rows[e].style.height;t!==void 0&&t.kind===`cells`&&(E[e]=t.value);let n=T(t);n>0&&(E[e]=Math.max(E[e],n),D[e]=!0)}for(let e of s.cells)if(e.rowSpan===1){let t=T(e.node.style.height);t>0&&(D[e.row]=!0),E[e.row]=Math.max(E[e.row],x.get(e),t)}let O=s.cells.filter(e=>e.rowSpan>1).sort((e,t)=>e.rowSpan-t.rowSpan);for(let e of O){let t=e.row+e.rowSpan,n=E.slice(e.row,t).reduce((e,t)=>e+t,0)+En(c,e.row,t),r=x.get(e)-n;if(r<=0)continue;let i=z(Array.from({length:e.rowSpan},()=>1),r);for(let n=e.row;n<t;n++)E[n]+=i[n-e.row]}if(n!==void 0&&d>0){let e=n-b-C-E.reduce((e,t)=>e+t,0);if(e>0){let t=[];for(let e=0;e<d;e++)D[e]||t.push(e);let n=t.length>0?t:Array.from({length:d},(e,t)=>t),r=z(n.map(()=>1),e);n.forEach((e,t)=>E[e]+=r[t])}}let ee=s.caption&&e.style.captionSide===`top`?b:0,k=[],te=ee;for(let e=0;e<d;e++)te+=c.collapsed?c.hLines[e]:c.spacingY,k.push(te),te+=E[e];let ne=d>0?te+(c.collapsed?c.hLines[d]??0:c.spacingY):ee,re=new Map;for(let e=0;e<d;e++){let t=s.rowGroups[e];t&&!re.has(t)&&re.set(t,k[e])}for(let[e,t]of re){let n=t;for(let t=0;t<d;t++)s.rowGroups[t]===e&&(n=k[t]+E[t]);e.localRect={x:f,y:p+t,width:y,height:n-t},e.resolvedPadding={top:0,right:0,bottom:0,left:0},e.unclampedHeight=n-t}for(let e=0;e<d;e++){let t=s.rows[e],n=s.rowGroups[e],r=n?re.get(n):void 0;t.localRect={x:r===void 0?f:0,y:r===void 0?p+k[e]:k[e]-r,width:y,height:E[e]},t.resolvedPadding={top:0,right:0,bottom:0,left:0},t.unclampedHeight=E[e]}for(let e of s.cells){let t=e.row+e.rowSpan,n=E.slice(e.row,t).reduce((e,t)=>e+t,0)+En(c,e.row,t);e.node.children.some(e=>!K(e.style)&&e.style.height?.kind===`percent`)&&n!==x.get(e)&&q(e.node,S.get(e),n,0,0,`fill`,o,{width:S.get(e),height:n}),jn(e.node,n-(e.node.naturalContentHeight??e.node.localRect.height)),e.node.localRect={x:_[e.col],y:0,width:e.node.localRect.width,height:n}}for(let t of e.children)K(t.style)&&(t.staticSlot={kind:`block`,x:f,y:p});return s.caption&&e.style.captionSide===`bottom`&&(s.caption.localRect.y=p+ne),c.collapsed&&u>0&&d>0&&(e.decorationRuns=Mn(c,s,g,E,_,k,f,p,r(e.style.glyphSet))),e.style.captionSide===`bottom`?ne+b:ne}function jn(e,t){if(t<=0)return;let n=e.style.verticalAlign,r=n===`center`?Math.floor(t/2):n===`end`?t:0;if(!e.children.some(e=>!K(e.style)&&!e.inlineBox)){e.resolvedPadding.top+=r,e.resolvedPadding.bottom+=t-r;return}if(!(r<=0))for(let t of e.children)t.inlineBox||(K(t.style)?t.staticSlot?.kind===`block`&&(t.staticSlot.y+=r):t.localRect.y+=r)}function Mn(e,t,n,r,i,a,o,s,c){let l=t.columnCount,u=t.rows.length,d=[],f=t=>t<l?i[t]-e.vLines[t]:i[l-1]+n[l-1],p=t=>t<u?a[t]-e.hLines[t]:a[u-1]+r[u-1];for(let t=0;t<=l;t++){let n=e.vSegments[t];for(let e=0;e<u;e++){let i=n[e];if(!i)continue;let l=_e(i.style,`v`,c);for(let n=0;n<i.width;n++)for(let c=a[e];c<a[e]+r[e];c++)d.push({glyph:l,x:o+f(t)+n,y:s+c,length:1,color:i.color})}}for(let t=0;t<=u;t++){let r=e.hSegments[t];for(let e=0;e<l;e++){let a=r[e];if(!a)continue;let l=_e(a.style,`h`,c);for(let r=0;r<a.width;r++)d.push({glyph:l,x:o+i[e],y:s+p(t)+r,length:n[e],color:a.color})}}for(let t=0;t<=l;t++)if(!(e.vLines[t]<=0))for(let n=0;n<=u;n++){if(e.hLines[n]<=0)continue;let r=n>0?e.vSegments[t][n-1]:null,i=n<u?e.vSegments[t][n]:null,a=t>0?e.hSegments[n][t-1]:null,m=t<l?e.hSegments[n][t]:null,h=[r,i,a,m].filter(e=>e!==null);if(h.length===0)continue;let g=h.every(e=>e.style===`double`)?`double`:`solid`,_=h.reduce((e,t)=>t.width>e.width||t.width===e.width&&xn[t.style]>xn[e.style]?t:e),v=j(g,r!==null,i!==null,a!==null,m!==null,c);for(let r=0;r<e.vLines[t];r++)for(let i=0;i<e.hLines[n];i++)d.push({glyph:v,x:o+f(t)+r,y:s+p(n)+i,length:1,color:_.color})}return d}function Nn(e){return e.position===`absolute`||e.position===`fixed`?`absolute`:e.position===`relative`||e.position===`sticky`?`relative`:`static`}function Pn(e,t,n,r,i){for(let a of e.children){let o=Nn(a.style);if(o===`relative`){let t=e.localRect.width-e.style.border.left-e.style.border.right-e.resolvedPadding.left-e.resolvedPadding.right,n=e.localRect.height-e.style.border.top-e.style.border.bottom-e.resolvedPadding.top-e.resolvedPadding.bottom;a.localRect.x+=Fn(a.style.insets.left,a.style.insets.right,t),a.localRect.y+=Fn(a.style.insets.top,a.style.insets.bottom,n)}else o===`absolute`&&Ln(a,e,t,n,r,i);Pn(a,t+a.localRect.x,n+a.localRect.y,[...r,{node:a,absX:t+a.localRect.x,absY:n+a.localRect.y}],i)}}function Fn(e,t,n){return e===null?t===null?0:-Y(t,n):Y(e,n)}function In(e,t){if(!t)for(let t=e.length-1;t>0;t--){let n=e[t];if(!Gn(n.node.style))continue;let r=n.node.style.border;return{x:n.absX+r.left,y:n.absY+r.top,width:Math.max(0,n.node.localRect.width-r.left-r.right),height:Math.max(0,n.node.localRect.height-r.top-r.bottom)}}let n=e[0];return{x:n.absX,y:n.absY,width:n.node.localRect.width,height:n.node.localRect.height}}function Ln(e,t,n,r,i,a){let o=e.style,s=o.position===`fixed`,c=e.staticSlot,l=c?.kind===`grid`&&!s&&Gn(t.style)?{x:n+c.area.x,y:r+c.area.y,width:c.area.width,height:c.area.height}:In(i,s),u=o.insets.left===null?null:Y(o.insets.left,l.width),d=o.insets.right===null?null:Y(o.insets.right,l.width),f=o.insets.top===null?null:Y(o.insets.top,l.height),p=o.insets.bottom===null?null:Y(o.insets.bottom,l.height),m=X(o.margin,l.width),h=m.left??0,g=m.right??0,_=m.top??0,v=m.bottom??0,y=o.width===void 0||o.width.kind===`auto`,b=o.height===void 0||o.height.kind===`auto`,x=nr(o.minWidth,l.width,e,a)??0,S=nr(o.maxWidth,l.width,e,a),C={};if(!y)C.width=J(dr(o.width,l.width,e,a),x,S);else if(u!==null&&d!==null)C.width=J(Math.max(0,l.width-u-d-h-g),x,S);else{let t=Math.max(0,l.width-(u??0)-(d??0)-h-g);C.width=J(Math.min(fr(e,a),Math.max(hr(e,a),t)),x,S)}f!==null&&p!==null&&b&&(C.height=J(Math.max(0,l.height-f-p-_-v),tr(o.minHeight,l.height)??0,tr(o.maxHeight,l.height))),q(e,l.width,l.height,0,0,`shrink`,a,C);let w=e.localRect.width,T=e.localRect.height,E;if(u!==null&&d!==null){let e=Math.max(0,l.width-u-d-w-h-g),t=m.left===null&&m.right===null;E=l.x+u+h+(t?Math.floor(e/2):m.left===null?e:0)}else E=u===null?d===null?Hn(e,t,n,w):l.x+l.width-d-w-g:l.x+u+h;let D;if(f!==null&&p!==null){let e=Math.max(0,l.height-f-p-T-_-v),t=m.top===null&&m.bottom===null;D=l.y+f+_+(t?Math.floor(e/2):m.top===null?e:0)}else D=f===null?p===null?Un(e,t,r,T):l.y+l.height-p-T-v:l.y+f+_;e.localRect={...e.localRect,x:E-n,y:D-r}}function Rn(e,t,n){return st(e,[n],Math.max(0,t-n))[0]}function zn(e,t,n,r){return ut(lt(e,t),n,r)}function Bn(e,t,n,r,i){let a=X(e.style.margin,n.innerWidth),[o,s,c,l]=r===`x`?[a.left??0,a.right??0,n.innerWidth,n.direction===`row`]:[a.top??0,a.bottom??0,n.innerHeight,n.direction===`column`],u=i+o+s;return(l?Rn(mt(t.style),c,u):zn(e,t,c,u))+o}function Vn(e,t,n,r,i){let a=X(e.style.margin,n.width),o=e.style.justifySelf===`auto`?t.style.justifyItems:e.style.justifySelf,[s,c,l,u]=r===`x`?[a.left??0,a.right??0,n.width,o]:[a.top??0,a.bottom??0,n.height,lt(e,t)];return ut(u,l,i+s+c)+s}function Hn(e,t,n,r){let i=e.staticSlot;return i===void 0?n:i.kind===`block`?n+i.x:i.kind===`grid`?n+i.staticArea.x+Vn(e,t,i.staticArea,`x`,r):n+i.originX+Bn(e,t,i,`x`,r)}function Un(e,t,n,r){let i=e.staticSlot;return i===void 0?n:i.kind===`block`?n+i.y:i.kind===`grid`?n+i.staticArea.y+Vn(e,t,i.staticArea,`y`,r):n+i.originY+Bn(e,t,i,`y`,r)}function Wn(e,t){let n=Kn();q(e,t,void 0,0,0,`fill`,n),Pn(e,0,0,[{node:e,absX:0,absY:0}],n);let r=e.localRect.height,i=sr(e),{overflow:a}=e.style;return a.x===`visible`&&(e.localRect.width=Math.max(e.localRect.width,i.x)),a.y===`visible`&&(e.localRect.height=Math.max(r,i.y)),{height:r}}function K(e){return e.position===`absolute`||e.position===`fixed`}function Gn(e){return e.position!==`static`}function Kn(){return{maxContent:new WeakMap,minContent:new WeakMap,gridIntrinsic:new WeakMap,tableData:new WeakMap}}function q(e,t,n,r,i,a,o,s){let c=e.style,l=s?.height;delete e.decorationRuns,delete e.multicolGeometry,delete e.multicolFlow,delete e.multicolFlowSpan,delete e.textExtent;let u=nr(c.minWidth,t,e,o)??0,d=nr(c.maxWidth,t,e,o),f=tr(c.minHeight,n)??0,p=tr(c.maxHeight,n),m=B(c),h=vt(c);s?.gutter?.right&&(m.right=h.right),s?.gutter?.bottom&&(m.bottom=h.bottom);let g={top:Y(c.padding.top,t),right:Y(c.padding.right,t)+m.right,bottom:Y(c.padding.bottom,t)+m.bottom,left:Y(c.padding.left,t)};e.resolvedPadding=g;let _=s?.width??J(or(c,t,a,e,o),u,d),v=ur(c,n),y=_r(_,l??v??(f>0?f:void 0)??1/0,c.border,g),b=l!==void 0||v!==void 0,x=p===void 0?void 0:Math.max(0,p-c.border.top-c.border.bottom-g.top-g.bottom),S=Jn(e),C=(t,n)=>{let r=n&&Number.isFinite(t)?t:void 0;return S?qn(e,y.width,t,r,x,g,o):c.display===`flex`&&c.flexDirection===`row`?nt(e,y.width,t,r,c.border,g,o):c.display===`flex`?it(e,y.width,t,n,c.border,g,o):c.display===`grid`?St(e,y.width,t,c.border,g,o):c.display===`table`?An(e,y.width,r,c.border,g,o):c.display===`multicol`?ln(e,y.width,r,x,c.border,g,o):rr(e,y.width,r,c.border,g,o)},w=C(y.height,b);if(!S&&(c.display===`flex`||c.display===`grid`)&&!b&&p!==void 0){let e=c.border.top+c.border.bottom+g.top+g.bottom,t=J(w+e,f,p)-e;t<w&&(w=C(Math.max(0,t),!0))}let T=w+c.border.top+c.border.bottom+g.top+g.bottom,E=l??v??T;e.unclampedHeight=E,e.naturalContentHeight=T;let D=J(E,f,p),O=e.multicolGeometry;if(O){let t=D-c.border.top-c.border.bottom-g.top-g.bottom;t>O.totalRows&&(g.bottom+=t-O.totalRows),on(e,O,c.border,g)}if(e.localRect={x:r,y:i,width:_,height:D},gt(c.overflow.x)||gt(c.overflow.y)){let l=sr(e),u=Math.max(0,l.x-c.border.left-g.left),d=Math.max(0,l.y-c.border.top-g.top),f=Math.max(0,_-c.border.left-c.border.right-g.left-g.right),p=Math.max(0,D-c.border.top-c.border.bottom-g.top-g.bottom);if(e.scrollRange={sizeX:u,sizeY:d,maxX:gt(c.overflow.x)?Math.max(0,u-f):0,maxY:gt(c.overflow.y)?Math.max(0,d-p):0},c.scrollbarWidth!==`none`){let l=s?.gutter??{right:!1,bottom:!1},u=l.right||c.overflow.y===`auto`&&e.scrollRange.maxY>0,d=l.bottom||c.overflow.x===`auto`&&e.scrollRange.maxX>0;if(u!==l.right||d!==l.bottom){q(e,t,n,r,i,a,o,{...s,gutter:{right:u,bottom:d}});return}}e.scrollGutterCells={right:m.right,bottom:m.bottom}}else delete e.scrollRange,delete e.scrollGutterCells}function qn(e,t,n,r,i,a,o){let s=e.style,c;if(e.text){let l=_t(e);Je(e.text,(n,r)=>{let i=l[r];q(i,t,void 0,0,0,`shrink`,o),e.advances[n]=Math.max(1,i.localRect.width)});let u,d;if(s.display===`multicol`){let n=$n(s,`x`,t),o=H(s,t,n);a.right+=o.leftover;let c=nn(e,o,n,en(r,i));e.multicolGeometry=c,u=c,d=c.lineX}else u=Xn(e,t);if(c=u.totalRows,e.textExtent={width:u.spans.reduce((t,n)=>Math.max(t,Ge(e.text,n.start,n.end,e.advances,s.tracking)),0),rows:u.totalRows},Yn(e,u,t,n,a),l.length>0){let t=e=>u.spans.findIndex(t=>e>=t.start&&e<t.end);Je(e.text,(n,r)=>{let i=t(n);if(i===-1)return;let o=u.spans[i];l[r].localRect={...l[r].localRect,x:s.border.left+a.left+(d?.[i]??0)+We(o.start,n,e.advances),y:s.border.top+a.top+u.lineY[i]}})}}else c=e.intrinsicHeight;for(let n of e.children){if(n.inlineBox)continue;let e=X(n.style.margin,t);n.staticSlot={kind:`block`,x:s.border.left+a.left+(e.left??0),y:s.border.top+a.top+(e.top??0)}}return c}function Jn(e){return e.children.some(e=>!K(e.style)&&!e.inlineBox)?!1:e.text!==``||e.style.display!==`flex`&&e.style.display!==`grid`}function J(e,t,n){return Math.max(t,n===void 0?e:Math.min(e,n))}function Yn(e,t,n,r,i){let a=e.style;if(a.display!==`flex`&&a.display!==`grid`||t.spans.length===0)return;let o=a.display===`flex`&&a.flexDirection===`column`,s=t.spans.reduce((t,n)=>Math.max(t,Ge(e.text,n.start,n.end,e.advances,a.tracking)),0),c=Math.max(0,n-s);if(c>0){let e=a.display===`grid`?ut(a.justifyItems,n,s):o?ut(a.alignItems,n,s):st(mt(a),[s],c)[0];e>0&&(i.left+=e,i.right+=c-e)}if(Number.isFinite(r)){let e=Math.max(0,r-t.totalRows);if(e>0){let n=a.display===`grid`||!o?ut(a.alignItems,r,t.totalRows):st(mt(a),[t.totalRows],e)[0];n>0&&(i.top+=n,i.bottom+=e-n)}}}function Xn(e,t){let n=Zn(e,t),{heights:r,textOffsets:i}=Qn(e,n),a=[],o=[],s=0;for(let t=0;t<n.length;t++)a.push(s),o.push(s+i[t]),s+=r[t]+(t<n.length-1?e.style.lineGap:0);return{spans:n,lineY:a,textY:o,totalRows:s}}function Zn(e,t){return e.style.whiteSpace===`normal`?Ue(e.text,t,{advances:e.advances,tracking:e.style.tracking,firstLineIndent:e.style.textIndent}):He(e.text)}function Qn(e,t){let n=_t(e),r=[],i=[],a=0;for(let o of t){let t=1,s=0;for(let r=o.start;r<o.end;r++){if(e.text[r]!==``)continue;let i=n[a];t=Math.max(t,i.localRect.height),i.style.verticalAlign===`end`?s=Math.max(s,i.localRect.height-1):i.style.verticalAlign===`center`&&m(i.source,`vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom.`),a++}r.push(t),i.push(Math.min(s,t-1))}return{heights:r,textOffsets:i}}function $n(e,t,n){let r=Y(t===`x`?e.gapX:e.gapY,n),i=t===`x`?e.ruleX:e.ruleY;return Math.max(r,i?.width??0)}function Y(e,t){return typeof e==`number`?e:t===void 0||!Number.isFinite(t)?0:P(e.percent,t)}function X(e,t){let n=e=>e===null?null:Y(e,t);return{top:n(e.top),right:n(e.right),bottom:n(e.bottom),left:n(e.left)}}function er(e){return typeof e==`number`?e:0}function tr(e,t){if(e!==void 0&&typeof e!=`string`)return typeof e==`number`?e:t===void 0?void 0:P(e.percent,t)}function nr(e,t,n,r){return e===`min-content`||e===`max-content`||e===`fit-content`?dr({kind:e},t,n,r):tr(e,t)}function rr(e,t,n,r,i,a){let o=r.left+i.left,s=r.top+i.top,c=s,l=null;for(let r of e.children){let e=X(r.style.margin,t),i=e.top??0,s=e.bottom??0,u=e.left??0,d=e.right??0;if(K(r.style)){r.staticSlot={kind:`block`,x:o+u,y:c+(l===null?i:ar(l,i))};continue}q(r,Math.max(0,t-u-d),n,0,0,`fill`,a);let f=ir(e,t,r.localRect.width);c+=l===null?i:ar(l,i),r.localRect={...r.localRect,x:o+f,y:c},c+=r.localRect.height,l=s}return l!==null&&(c+=l),c-s}function ir(e,t,n){let r=t-n;return e.left===null&&e.right===null?Math.floor(r/2):e.left===null?r-(e.right??0):e.left}function ar(e,t){return e>=0&&t>=0?Math.max(e,t):e<=0&&t<=0?Math.min(e,t):e+t}function or(e,t,n,r,i){let a=e.width;if(e.display===`table`){if(!r.children.some(e=>!K(e.style)&&!e.inlineBox))return a!==void 0&&a.kind!==`auto`?dr(a,t,r,i):Math.min(t,fr(r,i));if(a!==void 0&&a.kind!==`auto`){let e=dr(a,t,r,i);return Math.max(e,lr(r,t,i))}return kn(r,t,i)}return a!==void 0&&a.kind!==`auto`?dr(a,t,r,i):n===`shrink`?Math.min(t,fr(r,i)):t}function sr(e){let t=0,n=0;for(let r of e.children){if(r.style.position===`fixed`)continue;let e=cr(r);t=Math.max(t,r.localRect.x+e.x),n=Math.max(n,r.localRect.y+e.y)}if(e.textExtent){let{border:r}=e.style,i=e.resolvedPadding;t=Math.max(t,r.left+i.left+e.textExtent.width),n=Math.max(n,r.top+i.top+e.textExtent.rows)}return{x:t,y:n}}function cr(e){let{width:t,height:n}=e.localRect,r=e.style.overflow.x!==`visible`,i=e.style.overflow.y!==`visible`;if(r&&i)return{x:t,y:n};let a=sr(e);return{x:r?t:Math.max(t,a.x),y:i?n:Math.max(n,a.y)}}function lr(e,t,n){let r=e.style;return On(e,n).min+r.border.left+r.border.right+Y(r.padding.left,t)+Y(r.padding.right,t)+B(r).right}function ur(e,t){if(e.height?.kind===`cells`)return e.height.value;if(e.height?.kind===`percent`&&t!=null)return P(e.height.value,t)}function dr(e,t,n,r){switch(e.kind){case`cells`:return e.value;case`percent`:return P(e.value,t);case`min-content`:return hr(n,r);case`max-content`:return fr(n,r);case`fit-content`:return Math.min(fr(n,r),Math.max(hr(n,r),t));case`auto`:return fr(n,r)}}function fr(e,t){let n=t.maxContent.get(e);if(n!==void 0)return n;let r=e.style,i=pr(e,t)+r.border.left+r.border.right+er(r.padding.left)+er(r.padding.right)+B(r).right;return t.maxContent.set(e,i),i}function pr(e,t){let n=e.children.filter(e=>!K(e.style)&&!e.inlineBox);if(n.length===0)return e.style.display===`multicol`?$t(e.style,e.intrinsicWidth):e.intrinsicWidth;if(e.style.display===`grid`)return jt(e,t).max;if(e.style.display===`table`)return On(e,t).max;if(e.style.display===`flex`&&e.style.flexDirection===`row`){let r=Math.max(er(e.style.gapX),e.style.ruleX?.width??0)*Math.max(0,n.length-1);return n.reduce((e,n)=>e+mr(n,`max`,t),0)+r}let r=n.reduce((e,n)=>Math.max(e,mr(n,`max`,t)),0);return e.style.display===`multicol`?$t(e.style,r):r}function mr(e,t,n){let r=e.style,i;r.width!==void 0&&r.width.kind!==`auto`&&r.width.kind!==`percent`&&(i=dr(r.width,0,e,n)),i===void 0&&(i=t===`min`?hr(e,n):fr(e,n));let a=typeof r.minWidth==`number`?r.minWidth:0,o=typeof r.maxWidth==`number`?r.maxWidth:void 0;return Math.max(0,J(i,a,o))}function hr(e,t){let n=t.minContent.get(e);if(n!==void 0)return n;let r=e.style,i=gr(e,t)+r.border.left+r.border.right+er(r.padding.left)+er(r.padding.right)+B(r).right;return t.minContent.set(e,i),i}function gr(e,t){let n=e.children.filter(e=>!K(e.style)&&!e.inlineBox);if(n.length===0)return!e.text||e.style.whiteSpace!==`normal`?e.intrinsicWidth:qe(e.text,{advances:e.advances,tracking:e.style.tracking});if(e.style.display===`grid`)return jt(e,t).min;if(e.style.display===`table`)return On(e,t).min;if(e.style.display===`flex`&&e.style.flexDirection===`row`&&e.style.flexWrap===`nowrap`){let r=Math.max(er(e.style.gapX),e.style.ruleX?.width??0)*Math.max(0,n.length-1);return n.reduce((e,n)=>e+mr(n,`min`,t),0)+r}return n.reduce((e,n)=>Math.max(e,mr(n,`min`,t)),0)}function _r(e,t,n,r){return{width:Math.max(0,e-n.left-n.right-r.left-r.right),height:Math.max(0,t-n.top-n.bottom-r.top-r.bottom)}}function vr(e){return wr(e,{}).grid.map(e=>e.join(``).trimEnd()).join(`
956
- `)}function yr(e,t={}){let{grid:n,paints:r}=wr(e,t);return{segments:n.map((e,n)=>br(e,r[n],t.boxed)),cells:n}}function br(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a===``)continue;let o=t[i],s=1;for(;e[i+s]===``;)s++;if(n&&(a.length>1||a.charCodeAt(0)>=128)&&n(a,s,o)){r.push({text:a,cells:s,box:!0,...o});continue}let c=r[r.length-1];c&&!c.box&&xr(c,o)?c.text+=a:r.push({text:a,...o})}return r}function xr(e,t){return e.color===t?.color&&e.backgroundColor===t?.backgroundColor&&e.fontWeight===t?.fontWeight&&e.fontStyle===t?.fontStyle&&e.textDecorationLine===t?.textDecorationLine&&e.opacity===t?.opacity&&e.selected===t?.selected}function Sr(e,t){e.selected?(t.color=e.backgroundColor??`var(--mw-bg, canvas)`,t.backgroundColor=e.color??`var(--mw-fg, canvastext)`):(e.color!==void 0&&(t.color=e.color),e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor)),e.fontWeight!==void 0&&(t.fontWeight=e.fontWeight),e.fontStyle!==void 0&&(t.fontStyle=e.fontStyle),e.textDecorationLine!==void 0&&(t.textDecoration=e.textDecorationLine),e.opacity!==void 0&&(t.opacity=e.opacity)}function Cr(e){return e.color===void 0&&e.backgroundColor===void 0&&e.fontWeight===void 0&&e.fontStyle===void 0&&e.textDecorationLine===void 0&&e.opacity===void 0&&e.selected===void 0}function wr(e,t){let n=Math.max(0,e.localRect.width),r=Math.max(0,e.localRect.height),i=Array.from({length:r},()=>Array.from({length:n},()=>` `)),a=Array.from({length:r},()=>Array.from({length:n},()=>void 0)),o=Array.from({length:r},()=>Array.from({length:n},()=>void 0)),s=(e,t)=>e>=0&&e<n&&t>=0&&t<r,c=(e,t)=>{let n=o[t][e];if(n)for(let e=0;e<n.cells;e++)i[t][n.x+e]=` `,o[t][n.x+e]=void 0},l=(e,t,n)=>{let r=a[t][e];a[t][e]=r?{...r,...n}:n};return Er(e,0,0,t,(e,t,n,a,u=1)=>{if(t<0||t>=r)return;if(u===1){if(!s(e,t))return;c(e,t),i[t][e]=n,l(e,t,a);return}let d=s(e,t)&&s(e+u-1,t);for(let r=0;r<u;r++)s(e+r,t)&&(c(e+r,t),i[t][e+r]=d?r===0?n:``:` `,d&&(o[t][e+r]={x:e,cells:u}),l(e+r,t,a))}),{grid:i,paints:a}}function Tr(e){let t={};return e.color&&(t.color=e.color),e.backgroundColor&&(t.backgroundColor=e.backgroundColor),e.fontWeight!==`400`&&e.fontWeight!==`normal`&&e.fontWeight!==``&&(t.fontWeight=e.fontWeight),e.fontStyle!==`normal`&&e.fontStyle!==``&&(t.fontStyle=e.fontStyle),e.textDecorationLine!==`none`&&e.textDecorationLine!==``&&(t.textDecorationLine=e.textDecorationLine),t}function Er(e,t,n,i,a,o=1){if(e.tableHidden)return;let s=t+e.localRect.x,c=n+e.localRect.y,l=e.style,u=e=>o>=1?e:{...e,opacity:String(Math.round(o*1e3)/1e3)};if(l.backgroundColor!==void 0||l.backgroundClear){let t=l.backgroundColor===void 0?{backgroundColor:void 0}:u({backgroundColor:l.backgroundColor});for(let n=0;n<e.localRect.height;n++)for(let r=0;r<e.localRect.width;r++)a(s+r,c+n,` `,t)}let d=[];pe(l,{x:s,y:c,width:e.localRect.width,height:e.localRect.height},d);for(let e of d){let t=u(e.color===void 0?void 0:{color:e.color});for(let n=0;n<e.length;n++)a(e.x+n,e.y,e.glyph,t)}if(e.decorationRuns)for(let t of e.decorationRuns){let e=u(t.color===void 0?void 0:{color:t.color});for(let n=0;n<t.length;n++)a(s+t.x+n,c+t.y,t.glyph,e)}let p=e.scrollGutterCells,m=l.overflow.x!==`visible`,h=l.overflow.y!==`visible`,g=s-(e.scroll?.x??0),_=c-(e.scroll?.y??0),v=a;if(m||h){let t=s+l.border.left,n=c+l.border.top,r=s+e.localRect.width-l.border.right-(p?.right??0),i=c+e.localRect.height-l.border.bottom-(p?.bottom??0),o=(e,a)=>m&&(e<t||e>=r)||h&&(a<n||a>=i);v=(e,t,n,r,i=1)=>{if(i===1){o(e,t)||a(e,t,n,r);return}let s=!0;for(let n=0;n<i;n++)o(e+n,t)&&(s=!1);if(s)a(e,t,n,r,i);else for(let n=0;n<i;n++)o(e+n,t)||a(e+n,t,` `,r)}}if(!e.children.some(e=>!e.inlineBox&&e.style.position!==`absolute`&&e.style.position!==`fixed`)&&e.text){let t=u(Tr(l)),n=e.inlineElements?.map(e=>u(Tr(e))),r=i.selection?.get(e);Dr(e,g,_,(i,a,o,s)=>{let c=e.charInline?.[i]??-1,l=c>=0?e.inlineElements[c]:void 0,d=l?n[c]:t;if(r&&i>=r.start&&i<r.end&&(d={...d,selected:!0}),e.text[i]===`⁠`){l?.backgroundColor&&v(o,s,` `,u({backgroundColor:l.backgroundColor}));return}let f=a===1?e.text[i]:e.text.slice(i,i+a),p=Ne(f);p>0&&v(o,s,f,d,p)},(e,n)=>v(e,n,`…`,t))}for(let t of ge(e))Er(t,g,_,i,v,o*t.style.opacity);let y=e.scrollRange;if(y&&p&&(p.right>0||p.bottom>0)){let{track:t,thumb:n}=f(r(l.glyphSet)),i=e=>u(e?{color:e}:void 0),o=i(l.scrollbarColor?.track??l.color),d=i(l.scrollbarColor?.thumb??l.color),p=jr(e,s,c);if(p.y){let{col:r,row:i,thick:s,len:c}=p.y,{at:l,len:u}=Mr(c,y.sizeY,y.maxY,e.scroll?.y??0);for(let e=0;e<s;e++)for(let s=0;s<c;s++){let c=s>=l&&s<l+u;a(r+e,i+s,c?n:t,c?d:o)}}if(p.x){let{col:r,row:i,thick:s,len:c}=p.x,{at:l,len:u}=Mr(c,y.sizeX,y.maxX,e.scroll?.x??0);for(let e=0;e<s;e++)for(let s=0;s<c;s++){let c=s>=l&&s<l+u;a(r+s,i+e,c?n:t,c?d:o)}}}}function Dr(e,t,n,r,i){let a=e.style,o=e.resolvedPadding,s=t+a.border.left+o.left,c=n+a.border.top+o.top,l=e.localRect.width-a.border.left-a.border.right-o.left-o.right,u=e.multicolGeometry,{spans:d,textY:f}=u??Xn(e,l),p=u?Math.max(1,u.columnWidth-a.tracking):l;for(let t=0;t<d.length;t++){let n=d[t],o=c+f[t],l=t===0?a.textIndent:0,m=a.whiteSpace!==`normal`&&a.overflow.x===`clip`?Nr(e.text,n,p-l,e.advances,a):{end:n.end,ellipsis:!1},h=Ge(e.text,n.start,n.end,e.advances,a.tracking),g=Math.max(0,p-l-h),_=a.textAlign===`end`?g:a.textAlign===`center`?Math.floor(g/2):0,v=s+(u?.lineX[t]??0)+_+l,y=e.advances;for(let t=n.start;t<m.end;){let n=We(t,t+1,y),i=1;if(y)for(;t+i<m.end&&y[t+i]===0;)i++;if(e.text[t]!==``&&n>0){let a=e.inlineElements?.[e.charInline?.[t]??-1]?.insets,s=a?a.left??(a.right===null?0:-a.right):0,c=a?a.top??(a.bottom===null?0:-a.bottom):0;r(t,i,v+s,o+c,n)}v+=n,t+=i}m.ellipsis&&i?.(v,o)}}function Or(e,t,n,r,i){let a=e.multicolGeometry;if(!a)return!1;let o=e.style,s=e.resolvedPadding,c=r-(t+o.border.left+s.left),l=i-(n+o.border.top+s.top),{lineX:u,lineY:d}=a;for(let e=0;e<d.length;e++){if(c<u[e]||c>=u[e]+a.columnWidth)continue;let t=(e+1<d.length&&u[e+1]===u[e]?d[e+1]:void 0)??d[e]+1+o.lineGap;if(l>=d[e]&&l<t)return!0}return!1}function kr(e,t,n,r,i){let a=null;return Dr(e,t-(e.scroll?.x??0),n-(e.scroll?.y??0),(e,t,n,o,s)=>{a===null&&o===i&&r>=n&&r<n+s&&(a=e)}),a}function Ar(e,t,n){let r=e.inlineElements;if(!r||!e.charInline)return[];let i=r.map((e,t)=>r.flatMap((n,r)=>r===t||n.element.contains(e.element)?[r]:[])),a=r.map(()=>new Map);return Dr(e,t-(e.scroll?.x??0),n-(e.scroll?.y??0),(t,n,r,o,s)=>{let c=e.charInline[t]??-1;if(!(c<0))for(let e of i[c]){let t=a[e].get(o);t?(t.x0=Math.min(t.x0,r),t.x1=Math.max(t.x1,r+s)):a[e].set(o,{x0:r,x1:r+s})}}),r.flatMap((e,t)=>[...a[t]].sort(([e],[t])=>e-t).map(([t,n])=>({element:e.element,rect:{x:n.x0,y:t,width:n.x1-n.x0,height:1}})))}function jr(e,t,n){let r=e.scrollGutterCells;if(!r)return{};let{border:i,scrollbarSize:a,scrollbarInset:o}=e.style,s=n+i.top,c=t+i.left,l=n+e.localRect.height-i.bottom,u=t+e.localRect.width-i.right,d=r.bottom>0?l-r.bottom:l-o.y,f=r.right>0?u-r.right:u-o.x,p={};return r.right>0&&(p.y={col:u-r.right,row:s+o.y,thick:Math.min(a.y,r.right),len:Math.max(0,d-s-o.y)}),r.bottom>0&&(p.x={col:c+o.x,row:l-r.bottom,thick:Math.min(a.x,r.bottom),len:Math.max(0,f-c-o.x)}),p}function Mr(e,t,n,r){let i=t>0?Math.min(1,e/t):1,a=Math.max(1,Math.round(i*e));return n>0&&(a=Math.max(1,Math.min(a,e-n))),{at:n>0?Math.round(Math.min(r,n)/n*(e-a)):0,len:a}}function Nr(e,t,n,r,i){let{textOverflow:a,tracking:o}=i;if(Ge(e,t.start,t.end,r,o)<=n)return{end:t.end,ellipsis:!1};let s=a===`ellipsis`?n-1:n,c=t.start;for(;c<t.end&&Ge(e,t.start,c+1,r,o)<=s;)c++;return{end:c,ellipsis:a===`ellipsis`&&n>0}}function Pr(e,t,n){let r=[],i=e,a=e.localRect.x,o=e.localRect.y;for(;;){let e=null;for(let r of ge(i)){if(r.tableHidden)continue;let i=a+r.localRect.x,s=o+r.localRect.y;(r.multicolFlow?Or(r,i,s,t,n):t>=i&&t<i+r.localRect.width&&n>=s&&n<s+r.localRect.height)&&(e=r)}if(!e)return r;r.push({node:e,x:a+e.localRect.x,y:o+e.localRect.y}),a+=e.localRect.x-(e.scroll?.x??0),o+=e.localRect.y-(e.scroll?.y??0),i=e}}function Fr(e){return e.closest?.(`[inert]`)!=null}function Ir(e,t,n){let r=[];for(let i of Pr(e,t,n)){if(Fr(i.node.source))break;r.push(i.node.source)}return r}function*Lr(e,t,n,r){if(e<=0||t<=0)return;let i=Math.max(0,Math.min(n,e-1)),a=Math.max(0,Math.min(r,t-1));yield{x:i,y:a,edge:`self`};for(let e=i-1;e>=0;e--)yield{x:e,y:a,edge:`end`};for(let t=i+1;t<e;t++)yield{x:t,y:a,edge:`start`};for(let n=1;n<t;n++){if(a-n>=0)for(let t=e-1;t>=0;t--)yield{x:t,y:a-n,edge:`end`};if(a+n<t)for(let t=0;t<e;t++)yield{x:t,y:a+n,edge:`start`}}}var Rr={ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`};function zr(e){return Rr[e]??null}function Br(e,t,n){let r=null,i=null;for(let a of n){let n=Hr(e,t,a.rect);n&&(!i||Vr(n,i))&&(r=a,i=n)}return r?.element??null}function Vr(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}function Hr(e,t,n){let r=e===`up`||e===`down`,[i,a,o]=r?[`y`,`x`,`height`]:[`x`,`y`,`width`],s=t[i]+t[o],c=n[i]+n[o],l=e===`down`||e===`right`?n[i]-s:t[i]-c;if(l<0)return null;let u=r?`width`:`height`,d=Math.min(t[a]+t[u],n[a]+n[u])-Math.max(t[a],n[a]);return d>0?[0,l,0]:[1,l,-d]}function Ur(e){let t=[],n=(e,r,i,a)=>{if(e.tableHidden)return;let o=r+e.localRect.x,s=i+e.localRect.y;!a&&Gr(e.source)&&t.push({element:e.source,rect:{x:o,y:s,width:e.localRect.width,height:e.localRect.height}});for(let n of Ar(e,o,s))Gr(n.element)&&t.push(n);let c=e.scroll?.x??0,l=e.scroll?.y??0;for(let t of e.children)n(t,o-c,s-l,!1)};return n(e,0,0,!0),t}function Wr(e,t){let n=null;for(let{element:r,rect:i}of e)if(r===t){if(!n)n={...i};else{let e=Math.max(n.x+n.width,i.x+i.width),t=Math.max(n.y+n.height,i.y+i.height);n.x=Math.min(n.x,i.x),n.y=Math.min(n.y,i.y),n.width=e-n.x,n.height=t-n.y}}return n}function Gr(e){let t=e.tabIndex;return typeof t!=`number`||t<0?!1:!e.matches(`:disabled`)&&!Fr(e)}var Kr=new Set([`text`,`search`,`url`,`tel`,`email`,`password`]),qr=new Set([`checkbox`,`button`,`submit`,`reset`,`image`,`file`]);function Jr(e,t,n=!1){let r=e.tagName;if(r===`TEXTAREA`||e.closest(`[contenteditable]:not([contenteditable='false'])`))return!0;if(r===`INPUT`){let n=e.type;return n===`radio`?!0:Kr.has(n)?t===`ArrowLeft`||t===`ArrowRight`:!qr.has(n)}if(r===`SELECT`){let t=e,r=Number(t.size)||Number(t.getAttribute(`size`))||0;return t.multiple||r>1||n}return!1}function Yr(e,t,n,r){let i=e.ownerDocument,a=i.createRange();a.setStart(e,t),a.collapse(!0);let o=i.createRange();return o.setStart(n,r),o.collapse(!0),a.compareBoundaryPoints(a.START_TO_START,o)}function Xr(e){let t=b(e.source.tagName)?.selectionTarget?.(e.source)??null;return t&&t.textContent===e.text?t:null}function Zr(e,t){let n=t,r=null;for(let t of $r(e)){if(n<=t.data.length)return[t,n];n-=t.data.length,r=[t,t.data.length]}return r}function Qr(e,t,n){if(!e.contains(t))return null;let r=e.ownerDocument.createRange();return r.selectNodeContents(e),r.setEnd(t,n),r.toString().length}function*$r(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=t.nextNode();for(;n;)yield n,n=t.nextNode()}function ei(e,t,n){if(!e.charSource){let r=Xr(e);return(r&&Qr(r,t,n))??0}let r=_t(e).findIndex(e=>e.source.contains(t));if(r>=0){let t=-1;for(let n=0;n<=r;n++)t=e.text.indexOf(``,t+1);if(t>=0)return t}let i=e.charSource??[],a=0,o=i.length;for(;a<o;){let e=a+o>>1,r=i[e];Yr(r.node,r.offset,t,n)<=0?a=e+1:o=e}if(a===0)return 0;let s=i[a-1];return t===s.node&&n<s.offset+s.length?s.index+(n-s.offset):s.index+s.length}function ti(e,t){if(!e.charSource){let n=Xr(e),r=n&&Zr(n,t);return r&&{node:r[0],offset:r[1]}}let n=e.charSource??[],r=0,i=n.length;for(;r<i;){let e=r+i>>1;n[e].index<=t?r=e+1:i=e}let a=n[r-1];if(!a)return null;let o=t-a.index;return o<=a.length?{node:a.node,offset:a.offset+o}:null}function ni(e,t=[]){try{let n=e.ownerDocument.getSelection();if(!n)return null;if(n.getComposedRanges)return n.getComposedRanges({shadowRoots:[e,...t]})[0]??null;let r=e.getSelection?.();return!r||r.rangeCount===0?null:r.getRangeAt(0)}catch{return null}}function ri(e,t,n){let{startContainer:r,endContainer:i}=n;return t.contains(r)&&t.contains(i)?`grid`:ii(e,r)&&ii(e,i)?`light`:`outside`}function ii(e,t){for(let n=t;n;){if(e.contains(n))return!0;let t=n.getRootNode();n=t instanceof ShadowRoot&&t.host!==e?t.host:null}return!1}function ai(e){let t=[],n=e=>{let r=Xr(e)?.getRootNode();r instanceof ShadowRoot&&t.push(r);for(let t of e.children)n(t)};return n(e),t}function oi(e,t){let n=t.startContainer.getRootNode();if(!(n instanceof ShadowRoot)||n.host===e.source)return null;let r=null,i=e=>{if(!r){if(e.source===n.host)r=e;else for(let t of e.children)i(t)}};if(i(e),!r)return null;let a=r,o=ei(a,t.startContainer,t.startOffset),s=ei(a,t.endContainer,t.endOffset);return{leaf:a,start:Math.min(o,s),end:Math.max(o,s)}}function si(e,t){let n=oi(e,t);if(n){let{leaf:e,start:t,end:r}=n;return r>t?new Map([[e,{start:t,end:r}]]):new Map}let r=e.source.ownerDocument.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset);let i=new Map,a=e=>{if(!e.tableHidden&&r.intersectsNode(e.source)){if(hi(e)){let{text:t}=e,n=0,a=t.length;e.charSource&&(e.source.contains(r.startContainer)&&(n=ei(e,r.startContainer,r.startOffset)),e.source.contains(r.endContainer)&&(a=ei(e,r.endContainer,r.endOffset))),a>n&&i.set(e,{start:n,end:a})}for(let t of e.children)a(t)}};return a(e),i}function ci(e,t){let n=oi(e,t);if(n)return n.leaf.text.slice(n.start,n.end);let r=e.source.ownerDocument.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset);let i=[];return li(e,r,i),_i(i)}function li(e,t,n){if(e.tableHidden||!t.intersectsNode(e.source))return;let r=pi(e);if(r&&n.push({breaks:r}),e.style.tableRole===`row`)ui(e,t,n);else if(e.style.display===`table`){let r=fi(e);for(let r of e.children)r.style.tableRole===`row`||di(r)||li(r,t,n);let i=!1;for(let e of r)t.intersectsNode(e.source)&&(i&&n.push({text:`
957
- `}),li(e,t,n),i=!0)}else{hi(e)&&n.push({text:gi(e,t)});for(let r of e.children)r.inlineBox||li(r,t,n)}r&&n.push({breaks:r})}function ui(e,t,n){let r=!1;for(let i of e.children)i.style.tableRole!==`cell`||i.tableHidden||t.intersectsNode(i.source)&&(r&&n.push({text:` `}),li(i,t,n),r=!0)}function di(e){let t=e.style.tableRole;return t===`header-group`||t===`row-group`||t===`footer-group`}function fi(e){let t=[];for(let n of e.children)if(n.style.tableRole===`row`)t.push(n);else if(di(n))for(let e of n.children)e.style.tableRole===`row`&&t.push(e);return t}function pi(e){if(e.inlineBox)return 0;let t=e.style.tableRole;return t===`row`||t===`cell`||di(e)||t===`column`||t===`column-group`?0:e.source.tagName===`P`?2:1}function mi(e){let t=[],n=e.charSource??[];if(n.length>0){let e=n[0],r=n[n.length-1];t.push({start:{node:e.node,offset:e.offset},end:{node:r.node,offset:r.offset+r.length}})}for(let n of _t(e)){let e=n.source.parentNode;if(!e)continue;let r=Array.prototype.indexOf.call(e.childNodes,n.source);t.push({start:{node:e,offset:r},end:{node:e,offset:r+1}})}if(t.length===0)return null;let r=(e,t)=>Yr(e.node,e.offset,t.node,t.offset)<0,{start:i,end:a}=t[0];for(let e of t.slice(1))r(e.start,i)&&(i=e.start),r(a,e.end)&&(a=e.end);return{start:i,end:a}}function hi(e){return e.text.length!==0&&!e.children.some(e=>!e.inlineBox&&e.style.position!==`absolute`&&e.style.position!==`fixed`)}function gi(e,t){let{text:n}=e,r=0,i=n.length;e.charSource&&(e.source.contains(t.startContainer)&&(r=ei(e,t.startContainer,t.startOffset)),e.source.contains(t.endContainer)&&(i=ei(e,t.endContainer,t.endOffset)));let a=n.slice(r,i);i===n.length&&a.endsWith(`
958
- `)&&(a=a.slice(0,-1));let o=_t(e),s=n.slice(0,r).split(``).length-1;return a=a.replaceAll(``,()=>{let e=o[s++];if(!e||!t.intersectsNode(e.source))return``;let n=[];return li(e,t,n),_i(n)}),a.replaceAll(`⁠`,``)}function _i(e){let t=``,n=0;for(let r of e){if(`breaks`in r){n=Math.max(n,r.breaks);continue}r.text.length!==0&&(t.length>0&&n>0&&(t+=`
959
- `.repeat(n)),n=0,t+=r.text)}return t}var vi=new Map;function yi(e,t){let{text:n}=e;if(t<0||t>=n.length||bi(n[t]))return null;let r=t;for(;r>0&&!bi(n[r-1]);)r--;let i=t;for(;i<n.length&&!bi(n[i]);)i++;let a=xi(e.source.closest?.(`[lang]`)?.getAttribute(`lang`)??``);if(!a)return null;for(let e of a.segment(n.slice(r,i))){let n=r+e.index,i=n+e.segment.length;if(t>=n&&t<i)return{start:n,end:i}}return null}function bi(e){return e===`
960
- `||e===``||e===`⁠`}function xi(e){let t=vi.get(e);return t===void 0&&(t=Z(e)??Z(``),vi.set(e,t)),t}function Z(e){if(typeof Intl.Segmenter!=`function`)return null;try{return new Intl.Segmenter(e||void 0,{granularity:`word`})}catch{return null}}var Si=[{range:/^[\u2580-\u2590\u2594-\u259F]$/,reference:`█`},{range:/^[\u2500-\u257F]$/,reference:`│`}],Ci=/^[\u2591-\u2593]$/,wi=class{#e=new Map;#t=new Map;#n;#r={style:`normal`,weight:`400`,size:`16px`,family:`monospace`};#i={width:0,height:0,letterSpacing:0};#a=1;#o;constructor(e){this.#o=e}configure(e,t){let n=typeof devicePixelRatio==`number`&&devicePixelRatio||1;(e.style!==this.#r.style||e.weight!==this.#r.weight||e.size!==this.#r.size||e.family!==this.#r.family||t.width!==this.#i.width||t.height!==this.#i.height||t.letterSpacing!==this.#i.letterSpacing||n!==this.#a)&&(this.#r={...e},this.#i={...t},this.#a=n,this.#e.clear(),this.#t.clear())}invalidate(){this.#e.clear(),this.#t.clear()}box(e,t,n){let r=n?.fontWeight??this.#r.weight,i=n?.fontStyle??this.#r.style,a=`${i}|${r}|${e}`,o=this.#e.get(a);return o===void 0&&(o=this.#s(e,t,`${i} ${r} ${this.#r.size} ${this.#r.family}`),document.fonts?.status!==`loading`&&this.#e.set(a,o)),o}#s(e,t,n){let r=this.#u(),{width:i,height:a,letterSpacing:o}=this.#i;if(!r||i<=0||a<=0)return null;r.font=n;let s=Si.find(t=>t.range.test(e));if(s)return this.#c(s.reference,r,n);if(Ci.test(e))return this.#c(`█`,r,n)?this.#c(e,r,n,!0):null;let c=r.measureText(e),l=c.width+o,u=t*i;if(Math.abs(l-u)<=.01*i)return null;let d=l>0?u/l:1,f=c.actualBoundingBoxLeft+c.actualBoundingBoxRight,p=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent;return f>0&&(d=Math.min(d,u/f)),p>0&&(d=Math.min(d,a/p)),{scale:Math.round(d*1e3)/1e3}}shift(e,t){let n=(e.period??0)*this.#a;return n?(n-t*this.#i.height*this.#a%n)%n/this.#a:0}#c(e,t,n,r=!1){let i=`${e}|${n}`,a=this.#t.get(i);if(a!==void 0)return a;let{width:o,height:s,letterSpacing:c}=this.#i,l=t.measureText(e),u=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent,d=u<s-.05,f=Math.abs(l.width+c-o)>.01*o;if(a=null,(d||f)&&u>0){let t=(s+3)/u,i,o=r?this.#l(e,n):null;if(o){let e=o*this.#a,n=Math.ceil(t*e-1e-6);t=n/e,i=n/this.#a}let c=l.fontBoundingBoxAscent,d=l.fontBoundingBoxDescent;if(a={scale:Math.round(t*1e3)/1e3},i&&(a.period=i),Number.isFinite(c+d)){let n=t*(2*l.actualBoundingBoxAscent-c+d)-3;if(this.#o){let t=this.#o(e,a.scale,n)-l.actualBoundingBoxAscent*a.scale;n-=2*(t+1.5)}a.lineHeight=Math.round(n*100)/100}}return this.#t.set(i,a),a}#l(e,t){let n=parseFloat(this.#r.size)||16,r=Math.ceil(n*2*4),i=document.createElement(`canvas`);i.width=i.height=r;let a=i.getContext(`2d`);if(!a||typeof a.getImageData!=`function`)return null;a.scale(4,4),a.font=t,a.textBaseline=`top`,a.fillText(e,n/2,n/2);let o=a.getImageData(0,0,r,r).data,s=[],c=0;for(let e of[.25,.375,.5,.625,.75]){let t=Math.round((n/2+this.#i.width*e)*4),i=[];for(let e=0;e<r;e++)i.push(o[(e*r+t)*4+3]);let a=i.findIndex(e=>e>0),l=i.length-1;for(;l>a&&i[l]===0;)l--;if(a<0||l-a<8)continue;let u=i.slice(a,l+1),d=u.reduce((e,t)=>e+t,0)/u.length,f=u.map(e=>e-d),p=f.reduce((e,t)=>e+t*t,0);p>c&&(c=p,s=f)}if(c===0)return null;let l=e=>{let t=0;for(let n=0;n+e<s.length;n++)t+=s[n]*s[n+e];return t/c},u=l(1),d=!1;for(let e=2;e<=s.length/2;e++){let t=l(e);if(d&&t<u&&u>.3)return(e-1)/4;d=t>u,u=t}return null}#u(){if(this.#n===void 0)try{let e=document.createElement(`canvas`).getContext(`2d`);this.#n=e&&typeof e.measureText==`function`?e:null}catch{this.#n=null}return this.#n}},Ti=new WeakMap,Ei=new WeakMap;function Di(e){return Fi(e,!0)!==null}function Oi(e,t,n={}){let r=n.glyphs,i={};r&&(i.boxed=(e,t,n)=>r.box(e,t,n)!==null),n.selection&&(i.selection=n.selection);let{segments:a,cells:o}=yr(e,i),s=Li(a);if(Ti.get(t)===s)return!0;let c=Ei.get(t),l=new Set;if(c&&c.rows.length===a.length)for(let e=0;e<a.length;e++)Ni(t,c.rows[e].nodes,a[e])||l.add(e);if((l.size>0||!c||c.rows.length!==a.length)&&n.holdStructural&&Di(t))return!1;if(Ti.set(t,s),!c||c.rows.length!==a.length){let e=document.createDocumentFragment(),n=[];for(let t=0;t<a.length;t++){let{nodes:i,units:o}=ki(a[t],r,t);for(let t of i)e.appendChild(t);let s=t<a.length-1?document.createTextNode(`
961
- `):null;s&&e.appendChild(s),n.push({nodes:i,segments:a[t],newline:s,units:o})}Ei.set(t,{rows:n,cells:o});let i=Fi(t,!1);return t.replaceChildren(e),i&&Ii(t,i),!0}let u=l.size>0?Fi(t,!1):null;for(let e=0;e<a.length;e++){let n=a[e],i=c.rows[e];if(l.has(e)){let a=ki(n,r,e);for(let e of a.nodes)t.insertBefore(e,i.newline);for(let e of i.nodes)e.remove();i.nodes=a.nodes,i.segments=n,i.units=a.units;continue}for(let t=0;t<n.length;t++){let a=n[t];Cr(a)||Mi(a,i.segments[t])||ji(i.nodes[t],a,r,e)}i.segments=n}return c.cells=o,u&&Ii(t,u),!0}function ki(e,t,n){let r=[],i=0;for(let a of e){if(i+=a.text.length,Cr(a)&&!a.box){r.push(document.createTextNode(a.text));continue}let e=document.createElement(`span`);ji(e,a,t,n),e.textContent=a.text,r.push(e)}return{nodes:r,units:i}}function Ai(e,t,n){return Ei.get(e)?.cells[n]?.[t]}function ji(e,t,n,r){if(e.style.cssText=``,delete e.dataset.shade,Sr(t,e.style),!t.box)return;let i=t.cells??1,a=n?.box(t.text,i,t),o=e.style;o.display=`inline-block`,o.padding=`0`,o.width=`calc(${i} * var(--mw-cw, 1ch))`,o.height=`var(--mw-ch, 1lh)`,o.overflow=`hidden`,o.verticalAlign=`top`,o.textAlign=`center`,a&&a.scale!==1&&(o.fontSize=`${Math.round(a.scale*1e3)/10}%`),a?.lineHeight!==void 0&&(o.lineHeight=`${a.lineHeight}px`),a?.period&&n&&(e.dataset.shade=t.text,o.paddingTop=`var(--mw-phase)`,o.setProperty(`--mw-phase`,`${n.shift(a,r)}px`),o.setProperty(`--mw-period`,`${a.period}px`))}function Mi(e,t){return xr(e,t)&&e.box===t.box&&e.cells===t.cells}function Ni(e,t,n){if(t.length!==n.length)return!1;for(let r=0;r<n.length;r++){let i=t[r],a=n[r];if((Cr(a)&&!a.box)!==(i.nodeType===Node.TEXT_NODE)||i.textContent!==a.text||i.parentNode!==e)return!1}return!0}function Pi(e,t,n){let r=Ei.get(e);if(!r||r.rows.length===0)return 0;let i=Math.max(0,Math.min(n,r.rows.length-1)),a=0;for(let e=0;e<i;e++)a+=r.rows[e].units+1;let o=r.cells[i],s=Math.max(0,Math.min(t,o.length));for(let e=0;e<s;e++)a+=o[e].length;return a}function Fi(e,t){try{let n=e.ownerDocument.getSelection();if(!n)return null;let r=e.getRootNode();if(!(r instanceof ShadowRoot))return null;let i=ni(r);if(!i)return null;let a=Qr(e,i.startContainer,i.startOffset),o=Qr(e,i.endContainer,i.endOffset);return a===null||o===null||a===o&&!t?null:{start:a,end:o,backward:n.direction===`backward`}}catch{return null}}function Ii(e,t){try{let n=Zr(e,t.start),r=Zr(e,t.end);if(!n||!r)return;let i=e.getRootNode().getSelection?.()??e.ownerDocument.getSelection();t.backward?i?.setBaseAndExtent(r[0],r[1],n[0],n[1]):i?.setBaseAndExtent(n[0],n[1],r[0],r[1])}catch{}}function Li(e){let t=[];for(let n of e){for(let e of n)t.push(e.text,e.color??``,e.backgroundColor??``,e.fontWeight??``,e.fontStyle??``,e.textDecorationLine??``,e.opacity??``,e.selected?`s`:``,e.box?`b${e.cells}`:``);t.push(`
962
- `)}return t.join(``)}function Ri(e){let t=new Set;Bi(e,!0,t);for(let n of Array.from(e.source.querySelectorAll(`[data-mw-inline-inset]`)))if(!t.has(n)){n.removeAttribute(`data-mw-inline-inset`);let e=n.style;for(let t of[`--mw-it`,`--mw-ir`,`--mw-ib`,`--mw-il`])e.removeProperty(t)}}function Q(e,t,n){e.style.getPropertyValue(t)!==n&&e.style.setProperty(t,n)}function zi(e,t){e.style.getPropertyValue(t)!==``&&e.style.removeProperty(t)}function $(e,t,n){e.hasAttribute(t)!==n&&(n?e.setAttribute(t,``):e.removeAttribute(t))}function Bi(e,t,n){if(e.inlineElements)for(let{element:t,tracking:r,padLeft:i,padRight:a,insets:o}of e.inlineElements){let e=t;Q(e,`--mw-ls`,String(r)),i>0?Q(e,`--mw-ipl`,String(i)):zi(e,`--mw-ipl`),a>0?Q(e,`--mw-ipr`,String(a)):zi(e,`--mw-ipr`),o&&(n.add(t),Hi(e,o))}if(t?Vi(e):Ui(e),!e.tableHidden)for(let t of ge(e)){let r=t.source;t.style.zIndex!==null&&he(t,e)&&!t.inlineBox?Q(r,`--mw-z`,String(t.style.zIndex)):zi(r,`--mw-z`),Bi(t,!1,n)}}function Vi(e){let t=e.source,n=e.text.length>0,{whiteSpace:r,textAlignBlocked:i,textIndent:a}=e.style;$(t,`data-mw-leaf`,n),$(t,`data-mw-nowrap`,n&&r!==`normal`),$(t,`data-mw-pre`,n&&r===`pre`),$(t,`data-mw-text-align-blocked`,n&&i),n?Q(t,`--mw-ti`,String(a)):zi(t,`--mw-ti`)}function Hi(e,t){$(e,`data-mw-inline-inset`,!0);let n=(t,n)=>{n===null?zi(e,t):Q(e,t,String(n))};n(`--mw-it`,t.top),n(`--mw-ir`,t.right),n(`--mw-ib`,t.bottom),n(`--mw-il`,t.left)}function Ui(e){let t=e.source,n=e.localRect,r=e.resolvedPadding,{border:i,textAlignBlocked:a,overflow:o,whiteSpace:s,tracking:c,lineGap:l}=e.style,u=e.multicolFlow,d=e.multicolFlowSpan;$(t,`data-mw-laid-out`,!e.inlineBox&&!u&&!d),$(t,`data-mw-inline-box`,!!e.inlineBox),$(t,`data-mw-multicol-flow`,!!u),$(t,`data-mw-multicol-flow-span`,!!d);let f=u??d;f?(Q(t,`--mw-mt`,String(f.top??0)),Q(t,`--mw-mr`,String(f.right??0)),Q(t,`--mw-mb`,String(f.bottom??0)),Q(t,`--mw-ml`,String(f.left??0))):(zi(t,`--mw-mt`),zi(t,`--mw-mr`),zi(t,`--mw-mb`),zi(t,`--mw-ml`)),$(t,`data-mw-vbottom`,!!e.inlineBox&&e.style.verticalAlign===`end`),Q(t,`--mw-ls`,String(c)),Q(t,`--mw-lh`,String(l+1)),Q(t,`--mw-lhs`,String(-l/2)),$(t,`data-mw-nowrap`,s!==`normal`);let p=u||d?void 0:e.multicolGeometry;if($(t,`data-mw-multicol`,!!p),$(t,`data-mw-multicol-balance`,!!p?.nativeBalance),p?(Q(t,`--mw-colc`,String(p.columnCount)),Q(t,`--mw-colg`,String(p.gap))):(zi(t,`--mw-colc`),zi(t,`--mw-colg`)),$(t,`data-mw-pre`,s===`pre`),Q(t,`--mw-x`,String(n.x)),Q(t,`--mw-y`,String(n.y)),Q(t,`--mw-w`,String(n.width)),Q(t,`--mw-h`,String(n.height)),$(t,`data-mw-clip`,o.x===`clip`||o.y===`clip`),$(t,`data-mw-scroll`,e.scrollRange!==void 0),e.scrollRange){let{maxX:n,maxY:r}=e.scrollRange;Q(t,`--mw-se-x`,String(n>0?n+e.localRect.width:1)),Q(t,`--mw-se-y`,String(r>0?r+e.localRect.height:1))}else zi(t,`--mw-se-x`),zi(t,`--mw-se-y`);Q(t,`--mw-pt`,String(r.top)),Q(t,`--mw-pr`,String(r.right)),Q(t,`--mw-pb`,String(r.bottom)),Q(t,`--mw-pl`,String(r.left)),Q(t,`--mw-bt`,String(i.top)),Q(t,`--mw-br`,String(i.right)),Q(t,`--mw-bb`,String(i.bottom)),Q(t,`--mw-bl`,String(i.left)),Q(t,`--mw-ti`,String(e.style.textIndent)),$(t,`data-mw-text-align-blocked`,a),$(t,`data-mw-dropped-text`,!!e.droppedText),$(t,`data-mw-table-hidden`,!!e.tableHidden)}function Wi(e,t,n){let r=getComputedStyle(e),i=parseFloat(r.fontSize)||t,a=pa(e)?e.computedStyleMap():null,o=e.getAttribute(`class`)??``,s=e.style;ca(e,o,s);let c=(e,r,i)=>ja(a,e,r,o,i,s,n,t)??Na(a,e,r,o,i,s,n,t)??Ca(r,t),l=r.display||ia[e.tagName]||``,u=aa[l]??`none`,d=r.columnCount&&r.columnCount!==`auto`?Math.max(1,Math.floor(Number(r.columnCount)||1)):null,f=r.columnWidth&&r.columnWidth!==`auto`?parseFloat(r.columnWidth):NaN,p=Number.isFinite(f)?Math.max(1,Ce(f,t)):null,m=l===`flex`||l===`inline-flex`?`flex`:l===`grid`||l===`inline-grid`?`grid`:l===`table`||l===`inline-table`?`table`:l===`none`||ra(e,r)?`none`:d!==null||p!==null?`multicol`:`block`,h={kind:`none`},g={kind:`none`},_=[xt()],v=[xt()],y={direction:`row`,dense:!1},b=null;if(m===`grid`){if(a)h=Ia(a.get(`grid-template-columns`)?.toString()??``,t),g=Ia(a.get(`grid-template-rows`)?.toString()??``,t);else{e.setAttribute(`data-mw-degrid`,``);try{h=Ia(r.getPropertyValue(`grid-template-columns`),t),g=Ia(r.getPropertyValue(`grid-template-rows`),t)}finally{e.removeAttribute(`data-mw-degrid`)}}_=Ba(r.getPropertyValue(`grid-auto-columns`),t),v=Ba(r.getPropertyValue(`grid-auto-rows`),t),y=Ka(r.getPropertyValue(`grid-auto-flow`)),b=za(r.getPropertyValue(`grid-template-areas`))}let x=`auto`,S=!1,C=0,w=0;if(m===`table`&&(x=r.tableLayout===`fixed`?`fixed`:`auto`,S=r.borderCollapse===`collapse`,!S)){let e=r.borderSpacing.split(` `);C=Ce(parseFloat(e[0]??``)||0,t),w=Ce(parseFloat(e[1]??e[0]??``)||0,t)}let T={display:m,tableRole:u,tableLayout:x,borderCollapse:S,borderSpacingX:C,borderSpacingY:w,captionSide:r.captionSide===`bottom`?`bottom`:`top`,verticalAlign:u===`cell`||l.startsWith(`inline-`)?oa(e,r):`start`,flexDirection:r.flexDirection.startsWith(`column`)?`column`:`row`,flexReverse:r.flexDirection.endsWith(`-reverse`),flexWrap:r.flexWrap.startsWith(`wrap`)?`wrap`:`nowrap`,wrapReverse:r.flexWrap===`wrap-reverse`,flexGrow:Number(r.flexGrow)||0,flexShrink:r.flexShrink===``?1:Number(r.flexShrink)||0,flexBasis:Pa(r.flexBasis,t),order:Number(r.order)||0,justifyContent:ma(r.justifyContent),alignContent:ma(r.alignContent),alignItems:ha(r.alignItems),alignSelf:ga(r.alignSelf),justifyItems:ha(r.justifyItems),justifySelf:ga(r.justifySelf),gridTemplateColumns:h,gridTemplateRows:g,gridAutoColumns:_,gridAutoRows:v,gridAutoFlow:y,gridTemplateAreas:b,gridColumnStart:Ga(r.getPropertyValue(`grid-column-start`)),gridColumnEnd:Ga(r.getPropertyValue(`grid-column-end`)),gridRowStart:Ga(r.getPropertyValue(`grid-row-start`)),gridRowEnd:Ga(r.getPropertyValue(`grid-row-end`)),width:Da(a,r.width,`width`,t,o,s,n),height:Da(a,r.height,`height`,t,o,s,n),minWidth:c(`min-width`,r.minWidth,`min-w`)??`auto`,minHeight:c(`min-height`,r.minHeight,`min-h`)??`auto`,maxWidth:c(`max-width`,r.maxWidth,`max-w`),maxHeight:c(`max-height`,r.maxHeight,`max-h`),padding:qa(r,t),margin:_a(r,a,o,s,t),position:ba(r.position),insets:xa(r,a,o,s,t),gapX:wa(r.columnGap===`normal`||r.columnGap===``?m===`multicol`?`${i}px`:`0px`:r.columnGap,t),gapY:wa(r.rowGap===`normal`?`0px`:r.rowGap,t),border:Ja(r),borderStyle:{top:Sa(r.borderTopStyle),right:Sa(r.borderRightStyle),bottom:Sa(r.borderBottomStyle),left:Sa(r.borderLeftStyle)},overflow:na(r),scrollbarWidth:Qi(e,r),scrollbarColor:$i(r.scrollbarColor),overscroll:{x:(r.overscrollBehaviorX||`auto`)===`auto`,y:(r.overscrollBehaviorY||`auto`)===`auto`},scrollbarSize:{x:ea(r.getPropertyValue(`--mw-scrollbar-size-x`)),y:ea(r.getPropertyValue(`--mw-scrollbar-size-y`))},scrollbarInset:{x:ea(r.getPropertyValue(`--mw-scrollbar-inset-x`),0),y:ea(r.getPropertyValue(`--mw-scrollbar-inset-y`),0)},...sa(e,r,t),lineGap:ya(r.lineHeight,i),tracking:va(r.letterSpacing,i,n?.letterSpacing??0),color:r.color,fontWeight:r.fontWeight,fontStyle:r.fontStyle,backgroundColor:qi(e,r.backgroundColor,r),backgroundClear:r.getPropertyValue(`--mw-bg-clear`).trim()===`1`,borderColor:{top:r.borderTopColor,right:r.borderRightColor,bottom:r.borderBottomColor,left:r.borderLeftColor},opacity:Ta(r.opacity),glyphSet:r.getPropertyValue(`--mw-border-glyphs`).trim()||null,zIndex:r.zIndex===`auto`||r.zIndex===``?null:Number(r.zIndex)||0,latticeBorder:null,ruleX:m===`flex`||m===`grid`||m===`multicol`?ua(r,`x`):null,ruleY:m===`flex`||m===`grid`?ua(r,`y`):null,ruleBreak:la(r,`--mw-rule-break`,[`none`,`intersection`],`normal`),ruleInset:r.getPropertyValue(`--mw-rule-inset`).trim()===`overlap-join`?`overlap-join`:Math.max(0,Se(parseFloat(r.getPropertyValue(`--mw-rule-inset`))||0)),ruleVisibilityItems:la(r,`--mw-rule-visibility-items`,[`all`,`around`,`between`],`normal`),columnCount:d,columnWidth:p,columnFill:r.columnFill===`auto`?`auto`:`balance`,columnSpan:r.columnSpan===`all`,breakBeforeColumn:r.breakBefore===`column`,breakAfterColumn:r.breakAfter===`column`,breakInsideAvoid:r.breakInside===`avoid`||r.breakInside===`avoid-column`};return Gi(T,r),T}function Gi(e,t){t.borderCollapse===`collapse`&&(e.display===`table`||e.tableRole===`cell`||e.tableRole===`row`||e.tableRole===`row-group`||e.tableRole===`header-group`||e.tableRole===`footer-group`)&&(e.latticeBorder={width:e.border,style:e.borderStyle,color:e.borderColor,hidden:{top:t.borderTopStyle===`hidden`,right:t.borderRightStyle===`hidden`,bottom:t.borderBottomStyle===`hidden`,left:t.borderLeftStyle===`hidden`}},e.border=bt(),e.display===`table`&&(e.padding=bt()))}function Ki(e){if(!e)return!0;let t=e.trim().toLowerCase();return t===``||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`currentcolor`}function qi(e,t,n){let r=O(e,Ki(t)?``:t,n);return r===``?void 0:r}function Ji(e){return e===`hidden`||e===`clip`}var Yi=new WeakMap,Xi=null;function Zi(e){if(Xi!==null)return Xi;if(!e.body)return!0;let t=e.createElement(`div`);return t.style.cssText=`position: absolute; width: 0; height: 0; overflow: auto`,e.body.appendChild(t),Xi=getComputedStyle(t).scrollbarWidth!==`none`,t.remove(),Xi}function Qi(e,t){if(!Zi(e.ownerDocument))return`auto`;if(e.hasAttribute(`data-mw-scroll`)){let t=Yi.get(e);if(t!==void 0)return t}let n=t.scrollbarWidth===`none`?`none`:`auto`;return Yi.set(e,n),n}function $i(e){let t=(e??``).trim();if(!t||t===`auto`)return null;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r===`(`)n++;else if(r===`)`)n--;else if(r===` `&&n===0)return{thumb:t.slice(0,e),track:t.slice(e+1).trim()}}return null}function ea(e,t=1){return Math.max(t,Math.floor(Number(e)||t))}function ta(e){return Ji(e)?`clip`:e===`auto`||e===`scroll`?e:`visible`}function na(e){let t=ta(e.overflowX||e.overflow),n=ta(e.overflowY||e.overflow);return t!==`visible`&&n===`visible`&&(n=`auto`),n!==`visible`&&t===`visible`&&(t=`auto`),{x:t,y:n}}function ra(e,t){if(t.position!==`absolute`&&t.position!==`fixed`)return!1;let n=t.clip.replace(/\s/g,``);return n===`rect(0px,0px,0px,0px)`||n===`rect(0,0,0,0)`||!b(e.tagName)&&(Ji(t.overflow)||Ji(t.overflowX))&&parseFloat(t.width)<=1&&parseFloat(t.height)<=1}var ia={TABLE:`table`,THEAD:`table-header-group`,TBODY:`table-row-group`,TFOOT:`table-footer-group`,TR:`table-row`,TD:`table-cell`,TH:`table-cell`,CAPTION:`table-caption`,COL:`table-column`,COLGROUP:`table-column-group`},aa={"table-header-group":`header-group`,"table-row-group":`row-group`,"table-footer-group":`footer-group`,"table-row":`row`,"table-cell":`cell`,"table-caption":`caption`,"table-column":`column`,"table-column-group":`column-group`};function oa(e,t){let n=t.verticalAlign||e.getAttribute(`valign`)?.toLowerCase()||(e.tagName===`TD`||e.tagName===`TH`?`middle`:`baseline`);return n===`top`?`start`:n===`middle`?`center`:n===`bottom`?`end`:`start`}function sa(e,t,n){return{whiteSpace:t.whiteSpace===`pre`?`pre`:t.whiteSpace===`nowrap`?`nowrap`:`normal`,tabSize:Math.max(1,Math.floor(parseFloat(t.tabSize))||8),textOverflow:t.textOverflow===`ellipsis`?`ellipsis`:`clip`,textDecorationLine:t.textDecorationLine,textAlignBlocked:da(e,t),textAlign:fa(e,t),textIndent:Ea(t,n)}}function ca(e,t,n){(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t)||/(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t)||n.fontSize!==``)&&m(e,`font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.`)}function la(e,t,n,r){let i=e.getPropertyValue(t).trim();return n.includes(i)?i:r}function ua(e,t){let n=Se(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`))||0);if(n<=0)return null;let r=e.getPropertyValue(`--mw-rule-${t}-color`).trim();return{width:n,style:Sa(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),color:r&&r!==`currentcolor`&&r!==`currentColor`?r:e.color}}function da(e,t){return t.textAlign===`justify`||e.getAttribute(`align`)?.toLowerCase()===`justify`}function fa(e,t){let n=t.textAlign||e.getAttribute(`align`)?.toLowerCase()||``;return n===`right`||n===`end`?`end`:n===`center`||n.endsWith(`-center`)?`center`:`start`}function pa(e){return typeof e.computedStyleMap==`function`}function ma(e){switch(e){case`center`:return`center`;case`flex-end`:case`end`:case`right`:return`end`;case`space-between`:return`space-between`;case`space-around`:return`space-around`;case`space-evenly`:return`space-evenly`;case`normal`:case`stretch`:case``:return`stretch`;default:return`start`}}function ha(e){switch(e){case`center`:return`center`;case`flex-end`:case`end`:return`end`;case`stretch`:case`normal`:case``:return`stretch`;default:return`start`}}function ga(e){return e===`auto`||e===``||e===`normal`?`auto`:ha(e)}function _a(e,t,n,r,i){let a=(a,o,s)=>{if(t){let e=t.get(a)?.toString().trim();if(e===`auto`||t.get(o)?.toString().trim()===`auto`)return null;if(e?.endsWith(`%`)){let t=parseFloat(e);if(Number.isFinite(t)&&t!==0)return{percent:t}}}else if(s.test(n)||r.getPropertyValue(a)===`auto`)return null;let c=e.getPropertyValue(a);if(c===`auto`)return null;let l=wa(c,i);if(l!==0)return l;let u=e.getPropertyValue(o);return u===`auto`?null:wa(u,i)};return{top:a(`margin-top`,`margin-block-start`,/(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),right:a(`margin-right`,`margin-inline-end`,/(?:^|[\s:.[!])(?:m|mx|mr|me)-auto\b/),bottom:a(`margin-bottom`,`margin-block-end`,/(?:^|[\s:.[!])(?:m|my|mb)-auto\b/),left:a(`margin-left`,`margin-inline-start`,/(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)}}function va(e,t,n){let r=(e===`normal`?0:parseFloat(e)||0)-n;return r<=0?0:Math.floor(r/(.025*t)+1e-6)}function ya(e,t){if(!e||e===`normal`||t<=0)return 0;let n=parseFloat(e);return Number.isFinite(n)?Math.max(0,Math.floor(n/t+1e-6)-1):0}function ba(e){switch(e){case`relative`:case`absolute`:case`fixed`:case`sticky`:return e;default:return`static`}}function xa(e,t,n,r,i){let a=(a,o)=>{if(t){let e=t.get(a)?.toString().trim();return!e||e===`auto`?null:wa(e,i)}let s=r[a];if(s)return s===`auto`?null:wa(s,i);if(!o.test(n))return null;let c=e.getPropertyValue(a);return!c||c===`auto`?null:wa(c,i)};return{top:a(`top`,/(?:^|[\s:.[!])-?(?:top|inset|inset-y)-/),right:a(`right`,/(?:^|[\s:.[!])-?(?:right|end|inset|inset-x)-/),bottom:a(`bottom`,/(?:^|[\s:.[!])-?(?:bottom|inset|inset-y)-/),left:a(`left`,/(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)}}function Sa(e){switch(e){case`double`:return`double`;case`dashed`:return`dashed`;case`dotted`:return`dotted`;default:return`solid`}}function Ca(e,t){if(!e||e===`none`||e===`auto`)return;if(e===`min-content`||e===`max-content`||e===`fit-content`)return e;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{percent:t}:void 0}let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):void 0}function wa(e,t){if(!e||e===`auto`||e===`none`)return 0;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)&&t!==0?{percent:t}:0}let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):0}function Ta(e){let t=parseFloat(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):1}function Ea(e,t){let n=e.textIndent;if(!n||n.endsWith(`%`))return 0;let r=parseFloat(n);return Number.isFinite(r)?Math.max(0,Ce(r,t)):0}function Da(e,t,n,r,i,a,o){let s=Oa(n===`width`?a.width:a.height);if(s!==null)return{kind:`cells`,value:Aa(s,n,o,r)};let c=ja(e,n,t,i,n===`width`?`w`:`h`,a,o,r);if(c!==void 0)return{kind:`cells`,value:c};let l=n===`width`?`w`:`h`,u=ka(i,l)??ka(i,`size`);if(u!==null){let i=parseFloat(e?String(e.get(n)??``):t),a=Number.isFinite(i)&&Math.abs(i-u)<=u*.3;if(a||!Number.isFinite(i))return{kind:`cells`,value:Aa(a?i:u,n,o,r)}}if(e){let t=e.get(n);if(t==null)return;let i=t.toString().trim();if(i===`auto`)return{kind:`auto`};let a=Fa(i);if(a)return a;if(i.endsWith(`%`))return{kind:`percent`,value:parseFloat(i)};if(i.endsWith(`px`))return{kind:`cells`,value:Ce(parseFloat(i),r)};if(i.endsWith(`rem`))return{kind:`cells`,value:Se(parseFloat(i)/.25)};let s=Oa(i);if(s!==null)return{kind:`cells`,value:Aa(s,n,o,r)}}let d=n===`width`?a.width:a.height;if(d){if(d===`auto`)return{kind:`auto`};let e=Fa(d);if(e)return e;if(d.endsWith(`%`))return{kind:`percent`,value:parseFloat(d)};let t=parseFloat(d);if(Number.isFinite(t))return{kind:`cells`,value:Ce(t,r)}}let f=`(?:^|[\\s:.[!])(?:${l}|size)-`;if(RegExp(`${f}min\\b`).test(i))return{kind:`min-content`};if(RegExp(`${f}max\\b`).test(i))return{kind:`max-content`};if(RegExp(`${f}fit\\b`).test(i))return{kind:`fit-content`};let p=RegExp(`${f}(\\d+)/(\\d+)(?![\\w./])`).exec(i);if(p)return{kind:`percent`,value:100*Number(p[1])/Number(p[2])};if(RegExp(`${f}full(?![\\w-])`).test(i))return{kind:`percent`,value:100};let m=RegExp(`${f}\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);if(m)return{kind:`percent`,value:Number(m[1])};let h=RegExp(`${f}(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);if(h)return{kind:`cells`,value:Se(Number(h[1]))};if(!new RegExp(f).test(i)||t===`auto`)return{kind:`auto`};if(t.endsWith(`%`))return{kind:`percent`,value:parseFloat(t)};let g=parseFloat(t);if(Number.isFinite(g))return{kind:`cells`,value:Ce(g,r)}}function Oa(e){let t=/^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());if(!t||typeof window>`u`)return null;let n=parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=t[2],i=window.innerHeight,a=window.innerWidth,o=r.endsWith(`h`)?i:r.endsWith(`min`)?Math.min(a,i):r.endsWith(`max`)?Math.max(a,i):r===`vb`?i:a;return n/100*o}function ka(e,t){if(typeof window>`u`)return null;let n=RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);if(n){let e=n[1];return e===`screen`?t.includes(`h`)?window.innerHeight:window.innerWidth:e.endsWith(`h`)?window.innerHeight:window.innerWidth}let r=RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);return r?Oa(r[1]):null}function Aa(e,t,n,r){let i=t===`width`?n?.width:n?.height;return i&&i>0?Math.max(0,Math.floor(e/i)):Ce(e,r)}function ja(e,t,n,r,i,a,o,s){let c=t.endsWith(`width`)?`width`:`height`,l=a.getPropertyValue(t).trim(),u=l.startsWith(`calc(`);if(!u&&!r.includes(`-[calc(`))return;let d=RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r),f=u?l:d?.[1]?.replaceAll(`_`,` `);if(!f)return;let p=Ma(f,c,o,s);if(!p||p.unitless)return;let m=Math.max(0,Se(p.cells));if(u)return m;let h=(e?String(e.get(t)??``):n).trim(),g=parseFloat(h);return(Number.isFinite(g)?Math.abs(g-p.px)<=Math.abs(p.px)*.3:h===``)?m:void 0}function Ma(e,t,n,r){let i=e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);if(!i||i.join(``).replace(/\s+/g,``)!==e.replace(/\s+/g,``))return null;let a=0,o=()=>i[a],s=()=>i[a++],c=(e,t)=>({cells:e,px:t,unitless:!1}),l=e=>{let i=/^--spacing\(\s*(-?[\d.]+)\s*\)$/.exec(e);if(i){let e=parseFloat(i[1]);return c(e,e*r/4)}let a=/^([\d.]+)([a-z%]*)$/.exec(e);if(!a)return null;let o=parseFloat(a[1]),s=a[2];if(!Number.isFinite(o))return null;if(s===``)return{cells:o,px:o,unitless:!0};if(s===`px`)return c(o/(r/4),o);if(s===`rem`)return c(o*4,o*r);let l=Oa(e);return l===null?null:c(Aa(l,t,n,r),l)},u=(e,t,n)=>{if(e===`+`||e===`-`){if(t.unitless!==n.unitless)return null;let r=e===`+`?1:-1;return{cells:t.cells+r*n.cells,px:t.px+r*n.px,unitless:t.unitless}}if(e===`*`){if(!t.unitless&&!n.unitless)return null;let[e,r]=t.unitless?[t,n]:[n,t];return{cells:r.cells*e.cells,px:r.px*e.px,unitless:r.unitless&&e.unitless}}return!n.unitless||n.px===0?null:{cells:t.cells/n.cells,px:t.px/n.px,unitless:t.unitless}},d=()=>{let e=s();if(e===void 0)return null;if(e===`-`){let e=d();return e&&{cells:-e.cells,px:-e.px,unitless:e.unitless}}return e===`calc`?s()===`(`?f():null:e===`(`?f():l(e)},f=()=>{let e=m();return s()===`)`?e:null},p=()=>{let e=d();for(;e&&(o()===`*`||o()===`/`);){let t=s(),n=d();e=n?u(t,e,n):null}return e},m=()=>{let e=p();for(;e&&(o()===`+`||o()===`-`);){let t=s(),n=p();e=n?u(t,e,n):null}return e},h=m();return a===i.length?h:null}function Na(e,t,n,r,i,a,o,s){let c=t.endsWith(`width`)?`width`:`height`,l=Oa(a.getPropertyValue(t))??Oa(e?.get(t)?.toString().trim()??``);if(l!==null)return Aa(l,c,o,s);let u=ka(r,i);if(u===null)return;let d=(e?String(e.get(t)??``):n).trim(),f=parseFloat(d),p=Number.isFinite(f)&&Math.abs(f-u)<=u*.3;if(p||d===``)return Aa(p?f:u,c,o,s)}function Pa(e,t){if(!e||e===`auto`||e===`content`)return;let n=Fa(e);if(n)return n;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{kind:`percent`,value:t}:void 0}let r=parseFloat(e);return Number.isFinite(r)?{kind:`cells`,value:Ce(r,t)}:void 0}function Fa(e){if(e===`min-content`)return{kind:`min-content`};if(e===`max-content`)return{kind:`max-content`};if(e===`fit-content`)return{kind:`fit-content`}}function Ia(e,t){let n=e.trim();if(!n||n===`none`)return{kind:`none`};if(n===`subgrid`||n.startsWith(`subgrid `))return{kind:`subgrid`};let r=[],i=[],a=[],o=e=>{i.push(a),a=[],r.push(e)},s;for(let e of Wa(n)){let n=Ra(e);if(n){a.push(...n);continue}let i=e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);if(i){let e=La(i[2].trim(),t);if(e.tracks.length===0)continue;let n=i[1];if(n===`auto-fill`||n===`auto-fit`){s||(s={index:r.length,tracks:e.tracks,mode:n},e.lineNames.some(e=>e.length>0)&&(s.lineNames=e.lineNames),a.length>0&&(s.leadingNames=a),a=[]);continue}let c=Math.max(0,Math.floor(Number(n)||0));for(let t=0;t<c;t++){a.push(...e.lineNames[0]);for(let t=0;t<e.tracks.length;t++)o(e.tracks[t]),a.push(...e.lineNames[t+1])}continue}o(Va(e,t))}if(i.push(a),r.length===0&&!s)return{kind:`none`};let c={kind:`tracks`,tracks:r};return i.some(e=>e.length>0)&&(c.lineNames=i),s&&(c.autoRepeat=s),c}function La(e,t){let n=[],r=[],i=[];for(let a of Wa(e)){let e=Ra(a);if(e){i.push(...e);continue}r.push(i),i=[],n.push(Va(a,t))}return r.push(i),{tracks:n,lineNames:r}}function Ra(e){let t=e.match(/^\[(.*)\]$/s);return t?t[1].split(/\s+/).filter(e=>e!==``):null}function za(e){let t=[];for(let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)){let e=(n[1]??n[2]??``).trim().split(/\s+/).filter(e=>e!==``);if(e.length===0)return null;t.push(e)}if(t.length===0)return null;let n=t[0].length;if(t.some(e=>e.length!==n))return null;let r=new Map;t.forEach((e,t)=>{e.forEach((e,n)=>{if(/^\.+$/.test(e))return;let i=r.get(e);i?(i.colStart=Math.min(i.colStart,n),i.colEnd=Math.max(i.colEnd,n+1),i.rowStart=Math.min(i.rowStart,t),i.rowEnd=Math.max(i.rowEnd,t+1)):r.set(e,{colStart:n,colEnd:n+1,rowStart:t,rowEnd:t+1})})});for(let[e,n]of r)for(let r=n.rowStart;r<n.rowEnd;r++)for(let i=n.colStart;i<n.colEnd;i++)if(t[r][i]!==e)return null;return{columns:n,rows:t.length,areas:r}}function Ba(e,t){let n=Wa(e.trim()).filter(e=>e!==``&&!e.startsWith(`[`)).map(e=>Va(e,t));return n.length>0?n:[xt()]}function Va(e,t){let n=e.match(/^minmax\((.*)\)$/s);if(n){let e=Ua(n[1]).map(e=>e.trim());return e.length===2?{min:Ha(e[0],t),max:Ha(e[1],t)}:{min:{kind:`auto`},max:{kind:`auto`}}}let r=Ha(e,t);return r.kind===`fr`?{min:{kind:`auto`},max:r}:{min:r,max:r}}function Ha(e,t){if(e===`auto`||e.startsWith(`fit-content`))return{kind:`auto`};if(e===`min-content`)return{kind:`min-content`};if(e===`max-content`)return{kind:`max-content`};let n=e.match(/^(min|max)\((.*)\)$/s);if(n){let e=Ua(n[2]).map(e=>Ha(e.trim(),t)),r=e.every(e=>e.kind===`cells`||e.kind===`percent`||e.kind===`math`);return e.length>0&&r?{kind:`math`,fn:n[1],args:e}:{kind:`auto`}}if(e.endsWith(`fr`)){let t=parseFloat(e);return Number.isFinite(t)&&t>=0?{kind:`fr`,value:t}:{kind:`auto`}}if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{kind:`percent`,value:t}:{kind:`auto`}}let r=parseFloat(e);return Number.isFinite(r)?{kind:`cells`,value:e.endsWith(`rem`)?Se(r/.25):Ce(r,t)}:{kind:`auto`}}function Ua(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.filter(e=>e.trim()!==``)}function Wa(e){let t=[],n=0,r=-1;for(let i=0;i<e.length;i++){let a=e[i];a===`(`||a===`[`?n++:(a===`)`||a===`]`)&&n--,/\s/.test(a)&&n===0?(r!==-1&&t.push(e.slice(r,i)),r=-1):r===-1&&(r=i)}return r!==-1&&t.push(e.slice(r)),t}function Ga(e){let t=e.trim();if(!t||t===`auto`)return{kind:`auto`};let n=!1,r,i;for(let e of t.split(/\s+/))e===`span`?n=!0:/^-?\d+$/.test(e)?r=Number(e):i=e;if(n){let e=r??1;return e<1?{kind:`auto`}:i===void 0?{kind:`span`,value:e}:{kind:`span`,value:e,name:i}}return i===void 0?r!==void 0&&r!==0?{kind:`line`,value:r}:{kind:`auto`}:r===0?{kind:`auto`}:r===void 0?{kind:`name`,name:i}:{kind:`name`,name:i,nth:r}}function Ka(e){return{direction:e.includes(`column`)?`column`:`row`,dense:e.includes(`dense`)}}function qa(e,t){return{top:wa(e.getPropertyValue(`padding-top`),t),right:wa(e.getPropertyValue(`padding-right`),t),bottom:wa(e.getPropertyValue(`padding-bottom`),t),left:wa(e.getPropertyValue(`padding-left`),t)}}function Ja(e){let t=(t,n)=>e.getPropertyValue(n)===`none`?0:Se(parseFloat(e.getPropertyValue(t))||0);return{top:t(`border-top-width`,`border-top-style`),right:t(`border-right-width`,`border-right-style`),bottom:t(`border-bottom-width`,`border-bottom-style`),left:t(`border-left-width`,`border-left-style`)}}function Ya(e,t,n,r){let i=Wi(e,t,n);if(i.display===`none`)return null;let a=b(e.tagName);if(a)return $a(e,i,a);let o=Array.from(e.children),s=o.map(io),c={rootFontSizePx:t,cellMetrics:n,textareaWidths:r};if(!s.includes(`block`)||bo(e.tagName))return Qa(e,i,o,s,c);let l=[];for(let e=0;e<o.length;e++){if(s[e]===`none`)continue;let i=Ya(o[e],t,n,r);i&&l.push(i)}let u={source:e,style:i,children:l,text:``,intrinsicWidth:0,intrinsicHeight:0,localRect:{x:0,y:0,width:0,height:0},unclampedHeight:0,resolvedPadding:bt()};return xo(e,u),u}function Xa(e,t,n,r){let i=Array.from(e.childNodes).filter(e=>!(e instanceof Element&&e.hasAttribute(`data-mw-probe`))),a=i.filter(e=>e instanceof Element),o=a.map(io);return o.includes(`block`)||!vo(e)&&!o.includes(`inline`)?null:Qa(e,Za(e,t),a,o,{rootFontSizePx:t,cellMetrics:n,textareaWidths:r},i)}function Za(e,t){let n=getComputedStyle(e),r={...yt(),...sa(e,n,t)};return na(n).x===`clip`&&(r.overflow={...r.overflow,x:`clip`}),r}function Qa(e,t,n,r,i,a){let{rootFontSizePx:o,cellMetrics:s,textareaWidths:c}=i,l=e.tagName,u=bo(l),d=ao(e,t.tracking,{rootFontSizePx:o,rootLetterSpacingPx:s?.letterSpacing??0,cellMetrics:s,textareaWidths:c,preserve:t.whiteSpace===`pre`,tabSize:t.tabSize},a),f=d.chars.join(``),{advances:p,charInline:m}=po(d);if(d.boxes.length>0){let e=Kn();Je(f,(t,n)=>{p[t]=Math.max(1,fr(d.boxes[n],e))})}let h=ho(f,p,t.tracking);if(u&&h===0){if(l===`INPUT`)h=Number(e.size)||20;else if(l===`TEXTAREA`)h=Number(e.cols)||20;else{let t=e,n=e=>e?.label||e?.textContent||``,r=getComputedStyle(e).getPropertyValue(`field-sizing`)===`content`?[n(t.selectedOptions[0])]:Array.from(t.options,n);h=Math.max(1,...r.map(e=>ze(e.trim())))}}let g=f.length>0?go(f):0,_;if(l===`TEXTAREA`){let n=e,r=n.value??``,i=c?.get(n),a=+!!r.endsWith(`
963
- `),o=i!==void 0&&i>0?Be(r,i,{advances:Re(r)})+a:r===``?0:r.split(/\r\n?|\n/).length,s=getComputedStyle(e).getPropertyValue(`field-sizing`)===`content`?1:Number(n.rows)||2,l=Math.max(s,o);_=l+Math.max(0,l-1)*t.lineGap}else _=u?Math.max(1,g):g;let v=new Map,y=[];for(let t of d.boxes)t.source.parentElement===e?v.set(t.source,t):y.push(t);let b=[];for(let e=0;e<n.length;e++){let t=n[e],i=v.get(t);if(i)b.push(i);else if(r[e]===`out-of-flow`){let e=Ya(t,o,s,c);e&&b.push(e)}}y.length>0&&(b.push(...y),b.sort((e,t)=>e.source.compareDocumentPosition(t.source)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1));let x={source:e,style:t,children:b,text:f,intrinsicWidth:h,intrinsicHeight:_,localRect:{x:0,y:0,width:h,height:_},unclampedHeight:0,resolvedPadding:bt()};(p.some(e=>e!==1)||d.boxes.length>0)&&(x.advances=p),d.inlineElements.length>0&&(x.inlineElements=d.inlineElements,x.charInline=m);let S=mo(d);return S.length>0&&(x.charSource=S),x}function $a(e,t,n){let r=C(n,e),i=r?.lines??[],a=i.join(`
964
- `);t.whiteSpace=`pre`,(t.width===void 0||t.width.kind===`auto`)&&(t.width={kind:`max-content`});let o=Re(a,t.tracking),s=ho(a,o,t.tracking),c=i.length,l={source:e,style:t,children:[],text:a,intrinsicWidth:s,intrinsicHeight:c,localRect:{x:0,y:0,width:s,height:c},unclampedHeight:0,resolvedPadding:bt()};o.some(e=>e!==1)&&(l.advances=o);let u=r?.runs??[];if(u.length>0&&a.length>0){let t=[0];for(let e of i)t.push(t[t.length-1]+e.length+1);let n=Array.from({length:a.length},()=>-1);l.inlineElements=u.map(t=>({element:e,tracking:0,padLeft:0,padRight:0,insets:null,color:t.paint.color,backgroundColor:t.paint.backgroundColor,fontWeight:t.paint.fontWeight??``,fontStyle:t.paint.fontStyle??``,textDecorationLine:t.paint.textDecorationLine??``})),u.forEach((e,r)=>{let a=i[e.line];if(a===void 0)return;let o=Math.max(0,e.start),s=Math.min(a.length,e.end);for(let i=o;i<s;i++)n[t[e.line]+i]=r}),l.charInline=n}return l}var eo=new Set(`A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR`.split(`.`));function to(e,t){return t||(eo.has(e.tagName)?`inline`:`block`)}function no(e,t){let n=to(e,t);return n===`inline`||n===`contents`}function ro(e,t){let n=to(e,t);return n.startsWith(`inline`)&&n!==`inline`}function io(e){let t=getComputedStyle(e);return t.display===`none`?`none`:t.position===`absolute`||t.position===`fixed`?`out-of-flow`:b(e.tagName)?`block`:no(e,t.display)||ro(e,t.display)?`inline`:`block`}function ao(e,t,n,r){let i={chars:[],advances:[],sourceNode:[],sourceOffset:[],inlineIndex:[],inlineElements:[],boxes:[]};return r?so(r,t,n,i):oo(e,t,n,i),n.preserve?i:uo(i)}function oo(e,t,n,r){bo(e.tagName)||so(Array.from(e.childNodes),t,n,r)}function so(e,t,n,r){let i=()=>{let e=0;for(let t=r.chars.length-1;t>=0&&r.chars[t]!==`
955
+ `)&&(r.push(...Qe(e,i,o,t,n,a)),a=0,i=o+1);return Ve(r,e)}function We(e,t,n){if(!n)return t-e;let r=0;for(let i=e;i<t;i++)r+=n[i]??1;return r}function Ge(e,t,n,r,i=0){return n<=t?0:We(t,n,r)-Math.min(i,Ke(e,n-1,r))}function Ke(e,t,n){if(!n)return 0;let r=t;for(;r>0&&n[r]===0;)r--;let i=Math.max(1,Ne(e.slice(r,t+1)));return Math.max(0,(n[r]??1)-i)}function qe(e,t={}){let{advances:n,tracking:r=0}=t,i=0;for(let t of Ze(e,0,e.length))for(let a of Ye(e,t.start,t.end))i=Math.max(i,Ge(e,a.start,a.end,n,r));return i}function Je(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===``&&(t(r,n),n++)}function Ye(e,t,n){let r=[],i=t;for(let a=t;a<n;a++){if(e[a]===``){a>i&&r.push({start:i,end:a}),r.push({start:a,end:a+1}),i=a+1;continue}if(e[a]!==`-`)continue;let o=a===t;for(;a+1<n&&e[a+1]===`-`;)a++;let s=a+1;!o&&s<n&&(r.push({start:i,end:s}),i=s)}return r.push({start:i,end:n}),r}var Xe=/[ \t\r\n\f]/;function Ze(e,t,n){let r=[],i=t;for(;i<n;){for(;i<n&&Xe.test(e[i]);)i++;if(i>=n)break;let t=i;for(;i<n&&!Xe.test(e[i]);)i++;r.push({start:t,end:i})}return r}function Qe(e,t,n,r,{advances:i,tracking:a=0},o=0){let s=Ze(e,t,n);if(s.length===0)return[{start:t,end:t}];if(r<=0)return[{start:s[0].start,end:s[s.length-1].end}];let c=[],l=null,u=0,d=Math.max(0,o),f=()=>r-d;for(let t of s){let n=!1;for(let r of Ye(e,t.start,t.end)){let t=r.start,o=r.end,s=l!==null&&!n?t-1:t,p=u+We(s,o,i),m=Math.min(a,Ke(e,o-1,i));if(l!==null&&p-m<=f())l.end=o,u=p;else{for(l!==null&&(c.push(l),d=0);;){let n=t;for(;n<o&&Ge(e,t,n+1,i,a)<=f();)n++;if(n===o||n===t)break;c.push({start:t,end:n}),d=0,t=n}l={start:t,end:o},u=We(t,o,i)}n=!0}}return l!==null&&c.push(l),c}function $e(e,t){let n=e.row.map(e=>e.node.localRect).sort((e,t)=>e.x-t.x),r=[];for(let e=1;e<n.length;e++){let i=n[e-1].x+n[e-1].width-t,a=n[e].x-t;a>i&&r.push({start:i,end:a})}return r}function et(e,t,n,r,i){if(e.style.ruleBreak!==`intersection`)return[{start:0,end:i}];let a=[t[n-1],t[n]].flatMap(e=>$e(e,r)).sort((e,t)=>e.start-t.start),o=(e,t)=>({start:e,end:t,spanned:!1,beforeOccupied:!0,afterOccupied:!0}),s=[],c=0;for(let e of a)e.start>c&&s.push(o(c,e.start)),c=Math.max(c,e.end);return c<i&&s.push(o(c,i)),ye(s,`intersection`,`all`,e.style.ruleInset===`overlap-join`?`overlap-join`:0)}function tt(e,t){return typeof t!=`number`||t<=0?e:e.map(e=>({...e,start:e.start+t,end:e.end-t})).filter(e=>e.end>e.start)}function nt(e,t,n,i,a,o,s){let c=$n(e.style,`x`,t),l=$n(e.style,`y`,n),u=ft(e).map(e=>{let n=X(e.style.margin,t);return{node:e,base:dt(e,t,s),grow:e.style.flexGrow,shrink:e.style.flexShrink,min:ht(e,t,s),max:tr(e.style.maxWidth,t),margin:n}}),d=[];if(e.style.flexWrap===`wrap`){let n=[],r=0;for(let e of u){let i=Math.max(0,J(e.base,e.min,e.max))+(e.margin.left??0)+(e.margin.right??0),a=n.length===0?i:r+c+i;n.length>0&&a>t&&(d.push(n),n=[],r=0),n.push(e),r=n.length===1?i:r+c+i}n.length>0&&d.push(n),e.style.wrapReverse&&d.reverse()}else d.push(u);let f=a.left+o.left,p=a.top+o.top,m=d.map(e=>{let n=c*Math.max(0,e.length-1),r=e.reduce((e,t)=>e+(t.margin.left??0)+(t.margin.right??0),0),a=Math.max(0,t-n-r),o=e.some(e=>e.margin.left===null||e.margin.right===null),l=e.reduce((e,t)=>e+t.base,0),u=o&&l<=a?e.map(e=>Math.max(0,J(e.base,e.min,e.max))):ct(e,a);for(let n=0;n<e.length;n++)q(e[n].node,t,i,0,0,`fill`,s,{width:u[n]});return{row:e,widths:u,availableForItems:a,height:e.reduce((e,t)=>Math.max(e,t.node.localRect.height),0)}}),h=m.map(e=>e.height),g=l*Math.max(0,m.length-1),_;if(e.style.flexWrap===`nowrap`)i===void 0?Number.isFinite(n)&&(h[0]=Math.max(n,h[0]??0)):h[0]=i,_=[0];else{let t=h.reduce((e,t)=>e+t,0),r=Number.isFinite(n)?Math.max(0,n-t-g):0,i=pt(e.style);if(i===`stretch`&&r>0){let e=z(Array.from({length:m.length},()=>1),r);for(let t=0;t<h.length;t++)h[t]+=e[t];_=st(`start`,h,0)}else _=st(i===`stretch`?`start`:i,h,r)}for(let r=0;r<m.length;r++){let{row:a,widths:o,availableForItems:u}=m[r],d=h[r],g=_[r]+r*l;for(let r=0;r<a.length;r++){let c=a[r].node,l=lt(c,e),u=a[r].margin,f=u.top===null||u.bottom===null,p=c.style.height!==void 0&&c.style.height.kind!==`auto`;if(l===`stretch`&&!f&&!p&&d!==c.localRect.height){let e=u.top??0,a=u.bottom??0,l=Number.isFinite(n)?n:void 0,f=J(Math.max(0,d-e-a),tr(c.style.minHeight,l)??0,tr(c.style.maxHeight,l));if(f===c.localRect.height)continue;q(c,t,i,0,0,`fill`,s,{width:o[r],height:f})}}let v=o.reduce((e,t)=>e+t,0),y=Math.max(0,u-v),b=a.reduce((e,t)=>e+ +(t.margin.left===null)+ +(t.margin.right===null),0),x=Array.from({length:a.length},()=>0),S=Array.from({length:a.length},()=>0),C;if(b>0&&y>0){let e=z(Array.from({length:b},()=>1),y),t=0;for(let n=0;n<a.length;n++)a[n].margin.left===null&&(x[n]=e[t++]),a[n].margin.right===null&&(S[n]=e[t++]);C=st(`start`,o,0)}else C=st(mt(e.style),o,y);let w=0;for(let t=0;t<a.length;t++){let n=a[t],r=n.node,i=n.margin.left??0,o=n.margin.right??0;w+=x[t]+i,r.localRect={...r.localRect,x:f+C[t]+t*c+w,y:p+g+at(r,e.style.alignItems,d,n.margin)},w+=S[t]+o}}let v=h.reduce((e,t)=>e+t,0)+g,y=Number.isFinite(n)?Math.max(n,v):v;if(e.style.ruleX||e.style.ruleY){let n=[],i=[];for(let r=0;r<m.length;r++){let a=_[r]+r*l;for(let e of $e(m[r],f))n.push({bandStart:e.start,bandSize:e.end-e.start,start:a,end:a+h[r]});if(r>0){let n=_[r-1]+(r-1)*l+h[r-1];if(a>n)for(let o of et(e,m,r,f,t))i.push({bandStart:n,bandSize:a-n,...o})}}e.decorationRuns=be({glyphs:r(e.style.glyphSet),ruleX:e.style.ruleX,ruleY:e.style.ruleY,vertical:tt(n,e.style.ruleInset),horizontal:tt(i,e.style.ruleInset),contentWidth:t,contentHeight:y,border:a,borderStyle:e.style.borderStyle,borderColor:e.style.borderColor,padding:o})}return rt(e,a,o,t,y),y}function rt(e,t,n,r,i){for(let a of e.children)K(a.style)&&(a.staticSlot={kind:`flex`,direction:e.style.flexDirection,originX:t.left+n.left,originY:t.top+n.top,innerWidth:r,innerHeight:i})}function it(e,t,n,i,a,o,s){let c=$n(e.style,`y`,n),l=ft(e).map(r=>{let a=X(r.style.margin,t),o=Math.max(0,t-(a.left??0)-(a.right??0)),c=lt(r,e)===`stretch`;q(r,o,i&&Number.isFinite(n)?n:void 0,0,0,c?`fill`:`shrink`,s);let l=Number.isFinite(n)?n:void 0,u=r.style.flexBasis,d=u===void 0||u.kind===`auto`?r.unclampedHeight:u.kind===`cells`?u.value:u.kind===`percent`&&l!==void 0?P(u.value,l):r.unclampedHeight,f=r.style.minHeight===`auto`?r.style.overflow.y===`visible`?r.localRect.height:0:void 0;return{node:r,base:d,grow:r.style.flexGrow,shrink:r.style.flexShrink,min:f??tr(r.style.minHeight,l)??0,max:tr(r.style.maxHeight,l),margin:a}}),u=c*Math.max(0,l.length-1),d=l.reduce((e,t)=>e+(t.margin.top??0)+(t.margin.bottom??0),0),f=Number.isFinite(n),p=l.reduce((e,t)=>e+t.base,0),m=f?Math.max(0,n-u-d):p,h=i?m:Math.max(m,p),g=l.some(e=>e.margin.top===null||e.margin.bottom===null),_=f&&!(f&&g&&p<=h)?ct(l,h):l.map(e=>Math.max(0,J(e.base,e.min,e.max)));for(let n=0;n<l.length;n++)if(_[n]!==l[n].node.localRect.height){let r=l[n],i=Math.max(0,t-(r.margin.left??0)-(r.margin.right??0)),a=lt(r.node,e)===`stretch`;q(r.node,i,_[n],0,0,a?`fill`:`shrink`,s,{height:_[n]})}let v=_.reduce((e,t)=>e+t,0),y=Math.max(0,h-v),b=l.reduce((e,t)=>e+ +(t.margin.top===null)+ +(t.margin.bottom===null),0),x=Array.from({length:l.length},()=>0),S=Array.from({length:l.length},()=>0),C;if(b>0&&y>0){let e=z(Array.from({length:b},()=>1),y),t=0;for(let n=0;n<l.length;n++)l[n].margin.top===null&&(x[n]=e[t++]),l[n].margin.bottom===null&&(S[n]=e[t++]);C=st(`start`,_,0)}else C=st(mt(e.style),_,y);let w=a.left+o.left,T=a.top+o.top,E=0;for(let n=0;n<l.length;n++){let r=l[n],i=r.node,a=r.margin.top??0,o=r.margin.bottom??0;E+=x[n]+a,i.localRect={...i.localRect,x:w+ot(i,e.style.alignItems,t,r.margin),y:T+C[n]+n*c+E},E+=S[n]+o}let D=v+u+d,O=f?Math.max(n,D):D;if(e.style.ruleY&&l.length>1){let n=[],i=l.map(e=>e.node.localRect).slice().sort((e,t)=>e.y-t.y);for(let e=1;e<i.length;e++){let r=i[e-1].y+i[e-1].height-T,a=i[e].y-T-r;a>0&&n.push({bandStart:r,bandSize:a,start:0,end:t})}e.decorationRuns=be({glyphs:r(e.style.glyphSet),ruleX:null,ruleY:e.style.ruleY,vertical:[],horizontal:tt(n,e.style.ruleInset),contentWidth:t,contentHeight:O,border:a,borderStyle:e.style.borderStyle,borderColor:e.style.borderColor,padding:o})}return rt(e,a,o,t,O),O}function at(e,t,n,r){let i=e.style.alignSelf===`auto`?t:e.style.alignSelf,a=r.top??0,o=r.bottom??0,s=n-e.localRect.height,c=r.top===null&&r.bottom===null,l=r.top===null&&r.bottom!==null,u=r.bottom===null&&r.top!==null;return c?Math.floor(s/2):l?s-o:u?a:a+ut(i,n,e.localRect.height)}function ot(e,t,n,r){let i=e.style.alignSelf===`auto`?t:e.style.alignSelf,a=r.left??0,o=r.right??0,s=n-e.localRect.width,c=r.left===null&&r.right===null,l=r.left===null&&r.right!==null,u=r.right===null&&r.left!==null;return c?Math.floor(s/2):l?s-o:u?a:a+ut(i,n,e.localRect.width)}function st(e,t,n){let r=t.length;if(r===0)return[];let i=[],a=0;if(e===`space-between`&&r>1){let e=Math.floor(n/(r-1)),o=n-e*(r-1);for(let n=0;n<r;n++)i.push(a),a+=t[n]+e+ +(n<o);return i}if((e===`space-around`||e===`space-evenly`)&&n>0){let o=z(Array.from({length:r+1},(t,n)=>e===`space-evenly`||n===0||n===r?1:2),n);for(let e=0;e<r;e++)a+=o[e],i.push(a),a+=t[e];return i}e===`center`?a=Math.floor(n/2):e===`end`&&(a=n);for(let e=0;e<r;e++)i.push(a),a+=t[e];return i}function ct(e,t){let n=e.length,r=(t,n)=>Math.max(0,J(t,e[n].min??0,e[n].max)),i=e.map(e=>e.base),a=t>=i.reduce((e,t,n)=>e+r(t,n),0),o=Array.from({length:n},()=>0),s=Array.from({length:n},()=>!1);for(let t=0;t<n;t++){let n=r(i[t],t);((a?e[t].grow:e[t].shrink)===0||a&&i[t]>n||!a&&i[t]<n)&&(o[t]=n,s[t]=!0)}for(;;){let c=[];for(let e=0;e<n;e++)s[e]||c.push(e);if(c.length===0)break;let l=o.reduce((e,t,n)=>s[n]?e+t:e,0),u=c.reduce((e,t)=>e+i[t],0),d=t-l-u,f=a?Math.max(0,d):Math.max(0,-d),p=z(c.map(t=>a?e[t].grow:i[t]*e[t].shrink),f),m=c.map((e,t)=>i[e]+(a?p[t]:-p[t])),h=c.map((e,t)=>r(m[t],e)),g=h.reduce((e,t,n)=>e+(t-m[n]),0);if(g===0){for(let e=0;e<c.length;e++)o[c[e]]=h[e];break}for(let e=0;e<c.length;e++){let t=h[e]-m[e];(g>0?t>0:t<0)&&(o[c[e]]=h[e],s[c[e]]=!0)}}return o}function z(e,t){let n=e.reduce((e,t)=>e+t,0);if(n===0||t<=0)return e.map(()=>0);let r=e.map(e=>e/n*t),i=r.map(Math.floor),a=t-i.reduce((e,t)=>e+t,0);if(a>0){let e=r.map((e,t)=>[t,e-Math.floor(e)]).sort((e,t)=>t[1]===e[1]?e[0]-t[0]:t[1]-e[1]);for(let[t]of e){if(a<=0)break;i[t]+=1,--a}}return i}function lt(e,t){return e.style.alignSelf===`auto`?t.style.alignItems:e.style.alignSelf}function ut(e,t,n){return e===`center`?Math.max(0,Math.floor((t-n)/2)):e===`end`?Math.max(0,t-n):0}function dt(e,t,n){let r=e.style.flexBasis,i=e.style.width;return r!==void 0&&r.kind!==`auto`?fr(r,t,e,n):i!==void 0&&i.kind!==`auto`?fr(i,t,e,n):pr(e,n)}function ft(e){let t=e.children.filter(e=>!K(e.style)).sort((e,t)=>e.style.order-t.style.order);return e.style.flexReverse&&t.reverse(),t}function pt(e){return e.wrapReverse?e.alignContent===`start`?`end`:e.alignContent===`end`?`start`:e.alignContent:e.alignContent}function mt(e){let t=e.justifyContent===`stretch`?`start`:e.justifyContent;return e.flexReverse?t===`start`?`end`:t===`end`?`start`:t:t}function ht(e,t,n){return e.style.minWidth===`auto`?e.style.overflow.x===`visible`?gr(e,n):0:tr(e.style.minWidth,t)??0}function gt(e){return e===`auto`||e===`scroll`}function _t(e){return e.children.filter(e=>e.inlineBox)}function vt(e){return{right:e.scrollbarSize.y+e.scrollbarInset.x,bottom:e.scrollbarSize.x+e.scrollbarInset.y}}function B(e){if(e.scrollbarWidth===`none`)return{right:0,bottom:0};let t=vt(e);return{right:e.overflow.y===`scroll`?t.right:0,bottom:e.overflow.x===`scroll`?t.bottom:0}}function yt(){return{display:`block`,flexDirection:`row`,flexReverse:!1,flexWrap:`nowrap`,wrapReverse:!1,flexGrow:0,flexShrink:0,flexBasis:void 0,order:0,justifyContent:`stretch`,alignContent:`stretch`,alignItems:`stretch`,alignSelf:`auto`,justifyItems:`stretch`,justifySelf:`auto`,gridTemplateColumns:{kind:`none`},gridTemplateRows:{kind:`none`},gridAutoColumns:[xt()],gridAutoRows:[xt()],gridAutoFlow:{direction:`row`,dense:!1},gridTemplateAreas:null,gridColumnStart:{kind:`auto`},gridColumnEnd:{kind:`auto`},gridRowStart:{kind:`auto`},gridRowEnd:{kind:`auto`},width:void 0,height:void 0,minWidth:`auto`,minHeight:`auto`,maxWidth:void 0,maxHeight:void 0,padding:bt(),margin:{top:0,right:0,bottom:0,left:0},position:`static`,insets:{top:null,right:null,bottom:null,left:null},gapX:0,gapY:0,border:bt(),borderStyle:{top:`solid`,right:`solid`,bottom:`solid`,left:`solid`},overflow:{x:`visible`,y:`visible`},scrollbarWidth:`auto`,scrollbarSize:{x:1,y:1},scrollbarInset:{x:0,y:0},overscroll:{x:!0,y:!0},scrollbarColor:null,whiteSpace:`normal`,tabSize:8,lineGap:0,tracking:0,textOverflow:`clip`,color:void 0,backgroundColor:void 0,backgroundClear:!1,fontWeight:`400`,fontStyle:`normal`,textDecorationLine:`none`,borderColor:{top:void 0,right:void 0,bottom:void 0,left:void 0},textAlignBlocked:!1,textAlign:`start`,textIndent:0,tableRole:`none`,tableLayout:`auto`,borderCollapse:!1,borderSpacingX:0,borderSpacingY:0,captionSide:`top`,verticalAlign:`start`,glyphSet:null,opacity:1,zIndex:null,latticeBorder:null,ruleX:null,ruleY:null,ruleBreak:`normal`,ruleInset:0,ruleVisibilityItems:`normal`,columnCount:null,columnWidth:null,columnFill:`balance`,columnSpan:!1,breakBeforeColumn:!1,breakAfterColumn:!1,breakInsideAvoid:!1}}function bt(){return{top:0,right:0,bottom:0,left:0}}function xt(){return{min:{kind:`auto`},max:{kind:`auto`}}}function St(e,t,n,i,a,o){let s=e.style,c=Number.isFinite(n)?n:void 0,l=e.subgrid?.cols,u=e.subgrid?.rows,d=l?l.gap:$n(s,`x`,t),f=u?u.gap:$n(s,`y`,c),p=Mt(e,t,c,d,f,e.subgrid?{col:e.subgrid.colSpan,row:e.subgrid.rowSpan}:void 0),{children:m,placed:h,colLines:g,rowLines:_,colTracks:v,rowTracks:y,colCollapsed:b,rowCollapsed:x}=p,S=m.map(e=>X(e.style.margin,t)),C=m.map(e=>e.style.justifySelf===`auto`?s.justifyItems:e.style.justifySelf),w=m.map(Ct),T=l?Tt(l):Kt(v,b,Et(p,w,S,o),t,d,s.justifyContent===`stretch`),E=l?l.positions:qt(T,t,s.justifyContent),D=[];for(let e=0;e<m.length;e++){let t=m[e],n=h.items[e],r=Yt(E,T.sizes,n.col.start,n.col.span),i=S[e],a=Math.max(0,r-It(i)),s=w[e];if(s.cols||s.rows){let e=s.cols?wt(E,T,d,n.col.start,n.col.span,Ot(t,`cols`,i,r)):void 0;t.subgrid={colSpan:n.col.span,rowSpan:n.row.span,cols:e,rows:void 0}}else t.subgrid=void 0;let c=C[e],l=i.left===null||i.right===null,u=t.style.width!==void 0&&t.style.width.kind!==`auto`;s.cols?q(t,r,void 0,0,0,`fill`,o,{width:a}):c===`stretch`&&!l&&!u?q(t,r,void 0,0,0,`fill`,o,{width:J(a,t.style.minWidth===`auto`?t.style.overflow.x===`visible`?gr(t,o):0:tr(t.style.minWidth,r)??0,nr(t.style.maxWidth,r,t,o))}):q(t,a,void 0,0,0,`shrink`,o),D.push(t.localRect.width)}let O=u?Tt(u):Kt(y,x,Dt(p,w,S),c??`max-content`,f,s.alignContent===`stretch`),ee=Jt(O),k=u?u.positions:qt(O,c??ee,s.alignContent),te=i.left+a.left,ne=i.top+a.top;for(let t=0;t<m.length;t++){let n=m[t],r=h.items[t],i=S[t],a=Yt(E,T.sizes,r.col.start,r.col.span),s=Yt(k,O.sizes,r.row.start,r.row.span),c=Math.max(0,s-Lt(i)),l=lt(n,e),u=i.top===null||i.bottom===null,d=n.style.height!==void 0&&n.style.height.kind!==`auto`;if(w[t].rows)n.subgrid.rows=wt(k,O,f,r.row.start,r.row.span,Ot(n,`rows`,i,a)),q(n,a,s,0,0,`fill`,o,{width:D[t],height:c});else if(l===`stretch`&&!u&&!d){let e=J(c,n.style.minHeight===`auto`?n.style.overflow.y===`visible`?n.localRect.height:0:tr(n.style.minHeight,s)??0,tr(n.style.maxHeight,s));e!==n.localRect.height&&q(n,a,s,0,0,`fill`,o,{width:D[t],height:e})}else n.style.height?.kind===`percent`&&q(n,a,s,0,0,`fill`,o,{width:D[t]});n.localRect={...n.localRect,x:te+E[r.col.start]+Xt(C[t],i.left,i.right,a,n.localRect.width),y:ne+k[r.row.start]+Xt(l,i.top,i.bottom,s,n.localRect.height)}}let re=Number.isFinite(n)?Math.max(n,ee):ee;if(s.ruleX||s.ruleY){let n=T.sizes.length,o=O.sizes.length,c=Array.from({length:n},()=>Array.from({length:o},()=>!1)),l=Array.from({length:Math.max(0,n-1)},()=>Array.from({length:o},()=>!1)),u=Array.from({length:Math.max(0,o-1)},()=>Array.from({length:n},()=>!1));for(let e of h.items)for(let t=e.col.start;t<e.col.start+e.col.span&&t<n;t++)for(let r=e.row.start;r<e.row.start+e.row.span&&r<o;r++)c[t][r]=!0,t+1<e.col.start+e.col.span&&t<n-1&&(l[t][r]=!0),r+1<e.row.start+e.row.span&&r<o-1&&(u[r][t]=!0);let d=(e,t,n,r,i,a)=>t.map((t,o)=>({start:t,end:t+n[o],spanned:r[e]?.[o]??!1,beforeOccupied:i(o),afterOccupied:a(o)})),f=(e,t,n)=>{let r=[];for(let i=1;i<e.length;i++){let a=e[i-1]+t[i-1],o=e[i]-a;if(!(o<=0))for(let e of ye(n(i-1),s.ruleBreak,s.ruleVisibilityItems,s.ruleInset))r.push({bandStart:a,bandSize:o,...e})}return r},p=f(E,T.sizes,e=>d(e,k,O.sizes,l,t=>c[e]?.[t]??!1,t=>c[e+1]?.[t]??!1)),m=f(k,O.sizes,e=>d(e,E,T.sizes,u,t=>c[t]?.[e]??!1,t=>c[t]?.[e+1]??!1));e.decorationRuns=be({glyphs:r(s.glyphSet),ruleX:s.ruleX,ruleY:s.ruleY,vertical:p,horizontal:m,contentWidth:t,contentHeight:re,border:i,borderStyle:s.borderStyle,borderColor:s.borderColor,padding:a})}let A=e.children.filter(e=>K(e.style));if(A.length>0){let e=K(s)?{x:i.left,y:i.top,width:a.left+t+a.right,height:a.top+re+a.bottom}:{x:te,y:ne,width:t,height:re};for(let n of A){let r=At(n.style.gridColumnStart,n.style.gridColumnEnd,g,h.colOrigin,E,T.sizes,-a.left,t+a.right),i=At(n.style.gridRowStart,n.style.gridRowEnd,_,h.rowOrigin,k,O.sizes,-a.top,re+a.bottom);n.staticSlot={kind:`grid`,area:{x:te+r.start,y:ne+i.start,width:Math.max(0,r.end-r.start),height:Math.max(0,i.end-i.start)},staticArea:e}}}return re}function Ct(e){let t=e.style.display===`grid`;return{cols:t&&e.style.gridTemplateColumns.kind===`subgrid`,rows:t&&e.style.gridTemplateRows.kind===`subgrid`}}function wt(e,t,n,r,i,a){let o=e[r]+a.start,s=t.sizes.slice(r,r+i);return s[0]=Math.max(0,s[0]-a.start),s[i-1]=Math.max(0,s[i-1]-a.end),{positions:Array.from({length:i},(t,n)=>n===0?0:e[r+n]-o),sizes:s,gapBefore:Array.from({length:i},(e,n)=>n===0?0:t.gapBefore[r+n]),gap:n}}function Tt(e){return{sizes:e.sizes,gapBefore:e.gapBefore,limits:e.sizes}}function Et(e,t,n,r){let i=[];return e.children.forEach((a,o)=>{let s=e.placed.items[o],c=n[o];if(t[o].cols){let e=Ot(a,`cols`,c,0);for(let t of kt(a,`cols`,s,e,r))i.push({...t,start:t.start+s.col.start});return}i.push({start:s.col.start,span:s.col.span,min:hr(a,`min`,r)+It(c),max:hr(a,`max`,r)+It(c)})}),i}function Dt(e,t,n){let r=[];return e.children.forEach((i,a)=>{let o=e.placed.items[a],s=n[a];if(t[a].rows){let e=Ot(i,`rows`,s,0);for(let t of kt(i,`rows`,o,e))r.push({...t,start:t.start+o.row.start});return}let c=i.localRect.height+Lt(s),l=i.style.minHeight===`auto`&&i.style.overflow.y!==`visible`?Lt(s):c;r.push({start:o.row.start,span:o.row.span,min:l,max:c})}),r}function Ot(e,t,n,r){let{border:i,padding:a}=e.style;return t===`cols`?{start:(n.left??0)+i.left+Y(a.left,r),end:(n.right??0)+i.right+Y(a.right,r)}:{start:(n.top??0)+i.top+Y(a.top,r),end:(n.bottom??0)+i.bottom+Y(a.bottom,r)}}function kt(e,t,n,r,i){let a=t===`cols`?n.col.span:n.row.span,o=Mt(e,void 0,void 0,0,0,{col:n.col.span,row:n.row.span}),s=[];if(o.children.forEach((e,n)=>{let c=o.placed.items[n],l=t===`cols`?c.col:c.row,u=l.start===0,d=l.start+l.span===a,f=(u?r.start:0)+(d?r.end:0),p=X(e.style.margin,0);if(Ct(e)[t]){let n=Ot(e,t,p,0),a=kt(e,t,c,{start:n.start+(u?r.start:0),end:n.end+(d?r.end:0)},i);for(let e of a)s.push({...e,start:e.start+l.start});return}if(t===`cols`)s.push({start:l.start,span:l.span,min:hr(e,`min`,i)+It(p)+f,max:hr(e,`max`,i)+It(p)+f});else{let t=e.localRect.height+Lt(p)+f;s.push({start:l.start,span:l.span,min:t,max:t})}}),s.length===0){let e=r.start+r.end;s.push({start:0,span:a,min:e,max:e})}return s}function At(e,t,n,r,i,a,o,s){let c=Ut(e,`start`,n),l=Ut(t,`end`,n);c!==null&&l!==null?c>l?[c,l]=[l,c]:c===l&&(l=null):c!==null&&t.kind===`span`?l=Wt(c,t,1,n):l!==null&&e.kind===`span`&&(c=Wt(l,e,-1,n));let u=i.length,d=e=>{if(e===null)return;let t=e-r;return t<0||t>u||u===0?void 0:t},f=e=>e===u?i[u-1]+a[u-1]:i[e],p=e=>e===0?i[0]:i[e-1]+a[e-1],m=d(c),h=d(l);return{start:m===void 0?o:f(m),end:h===void 0?s:p(h)}}function jt(e,t){let n=t.gridIntrinsic.get(e);if(n!==void 0)return n;let r=e.style,i=Math.max(typeof r.gapX==`number`?r.gapX:0,r.ruleX?.width??0),a=Mt(e,void 0,void 0,i,0,e.subgrid?{col:e.subgrid.colSpan,row:e.subgrid.rowSpan}:void 0),o=a.children.map(Ct),s=a.children.map(e=>X(e.style.margin,0)),c=Kt(a.colTracks,a.colCollapsed,Et(a,o,s,t),`min-content`,i,!1),l=c.gapBefore.reduce((e,t)=>e+t,0),u={min:c.sizes.reduce((e,t)=>e+t,0)+l,max:c.limits.reduce((e,t)=>e+t,0)+l};return t.gridIntrinsic.set(e,u),u}function Mt(e,t,n,r,i,a){let o=e.style,s=Ft(e),c=o.gridTemplateColumns.kind===`subgrid`&&a!==void 0,l=o.gridTemplateRows.kind===`subgrid`&&a!==void 0,u=c?Nt(a.col):Rt(o.gridTemplateColumns,t,r),d=l?Nt(a.row):Rt(o.gridTemplateRows,n,i),f=o.gridTemplateAreas,p=[...u.tracks],m=[...d.tracks];if(f){c||Bt(p,u.lineNames,f.columns,o.gridAutoColumns),l||Bt(m,d.lineNames,f.rows,o.gridAutoRows);for(let[e,t]of f.areas)u.lineNames[Math.min(t.colStart,p.length)].push(`${e}-start`),u.lineNames[Math.min(t.colEnd,p.length)].push(`${e}-end`),d.lineNames[Math.min(t.rowStart,m.length)].push(`${e}-start`),d.lineNames[Math.min(t.rowEnd,m.length)].push(`${e}-end`)}let h={explicitCount:p.length,names:u.lineNames},g={explicitCount:m.length,names:d.lineNames},_=Gt(s.map(e=>({col:V(e.style.gridColumnStart,e.style.gridColumnEnd,h),row:V(e.style.gridRowStart,e.style.gridRowEnd,g)})),p.length,m.length,o.gridAutoFlow);return c&&Pt(_,`col`,p.length),l&&Pt(_,`row`,m.length),{children:s,placed:_,colLines:h,rowLines:g,colTracks:Vt(p,_.colOrigin,_.colCount,o.gridAutoColumns),rowTracks:Vt(m,_.rowOrigin,_.rowCount,o.gridAutoRows),colCollapsed:Ht(u,_.colOrigin,_.colCount,_.items.map(e=>e.col)),rowCollapsed:Ht(d,_.rowOrigin,_.rowCount,_.items.map(e=>e.row))}}function Nt(e){return{tracks:Array.from({length:e},()=>xt()),lineNames:Array.from({length:e+1},()=>[])}}function Pt(e,t,n){let r=t===`col`?e.colOrigin:e.rowOrigin;for(let i of e.items){let e=i[t],a=Math.min(Math.max(e.start+r,0),n-1),o=Math.min(Math.max(e.start+r+e.span,a+1),n);e.start=a,e.span=o-a}t===`col`?(e.colOrigin=0,e.colCount=n):(e.rowOrigin=0,e.rowCount=n)}function Ft(e){return e.children.filter(e=>!K(e.style)&&!e.inlineBox).sort((e,t)=>e.style.order-t.style.order)}function It(e){return(e.left??0)+(e.right??0)}function Lt(e){return(e.top??0)+(e.bottom??0)}function Rt(e,t,n){if(e.kind!==`tracks`)return{tracks:[],lineNames:[[]]};let r=(e.lineNames??Array.from({length:e.tracks.length+1},()=>[])).map(e=>[...e]);if(!e.autoRepeat)return{tracks:e.tracks,lineNames:r};let{index:i,tracks:a,mode:o}=e.autoRepeat,s=1;if(t!==void 0){let e=a.reduce((e,n)=>{let r=zt(n.min,t)??zt(n.max,t)??1;return e+Math.max(1,r)},0);s=Math.max(1,Math.floor((t+n)/(e+n*a.length)))}let c=[];for(let e=0;e<s;e++)c.push(...a);let l=[...e.tracks.slice(0,i),...c,...e.tracks.slice(i)],u=e.autoRepeat.lineNames??Array.from({length:a.length+1},()=>[]),d=r.slice(0,i),f=[...e.autoRepeat.leadingNames??[]];for(let e=0;e<s;e++){f.push(...u[0]);for(let e=0;e<a.length;e++)d.push(f),f=[...u[e+1]]}return d.push([...f,...r[i]]),d.push(...r.slice(i+1)),o===`auto-fit`?{tracks:l,lineNames:d,autoFit:{start:i,end:i+c.length}}:{tracks:l,lineNames:d}}function zt(e,t){if(e.kind===`cells`)return e.value;if(e.kind===`percent`&&t!==void 0)return P(e.value,t);if(e.kind===`math`){let n=[];for(let r of e.args){let e=zt(r,t);if(e===void 0)return;n.push(e)}return e.fn===`min`?Math.min(...n):Math.max(...n)}}function Bt(e,t,n,r){for(let i=e.length;i<n;i++)e.push(r[(i-e.length)%r.length]),t.push([])}function Vt(e,t,n,r){let i=[];for(let a=0;a<n;a++){let n=a+t;if(n>=0&&n<e.length)i.push(e[n]);else{let t=n<0?n:n-e.length;i.push(r[(t%r.length+r.length)%r.length])}}return i}function Ht(e,t,n,r){let i=Array.from({length:n},()=>!1);if(!e.autoFit)return i;for(let a=e.autoFit.start;a<e.autoFit.end;a++){let e=a-t;e<0||e>=n||r.some(t=>e>=t.start&&e<t.start+t.span)||(i[e]=!0)}return i}function Ut(e,t,n){if(e.kind===`line`)return e.value>0?e.value-1:n.explicitCount+1+e.value;if(e.kind!==`name`)return null;if(e.nth===void 0){let r=`${e.name}-${t}`,i=n.names.findIndex(e=>e.includes(r));if(i!==-1)return i}let r=e.nth??1,i=n.explicitCount,a=0;if(r>0){for(let t=0;t<=i;t++)if(n.names[t].includes(e.name)&&++a===r)return t;return i+(r-a)}for(let t=i;t>=0;t--)if(n.names[t].includes(e.name)&&++a===-r)return t;return-(-r-a)}function Wt(e,t,n,r){if(t.name===void 0)return e+n*t.value;let i=t.value,a=e;for(;i>0;)a+=n,(!(a>=0&&a<=r.explicitCount)||r.names[a].includes(t.name))&&i--;return a}function V(e,t,n){let r=Ut(e,`start`,n),i=Ut(t,`end`,n);if(r!==null&&i!==null)return r===i?{start:r,span:1}:{start:Math.min(r,i),span:Math.abs(i-r)};if(r!==null)return{start:r,span:(t.kind===`span`?Wt(r,t,1,n):r+1)-r};if(i!==null){let t=e.kind===`span`?Wt(i,e,-1,n):i-1;return{start:t,span:i-t}}return{start:null,span:e.kind===`span`?e.value:t.kind===`span`?t.value:1}}function Gt(e,t,n,r){let i=r.direction===`row`,a=e.map(e=>i?e.row:e.col),o=e.map(e=>i?e.col:e.row),s=i?t:n,c=i?n:t,l=0,u=Math.max(s,1);for(let t=0;t<e.length;t++){let e=o[t];e.start!==null&&(l=Math.min(l,e.start),u=Math.max(u,e.start+e.span))}for(let t=0;t<e.length;t++){let e=o[t];e.start===null&&(u=Math.max(u,l+e.span))}let d=0;for(let t=0;t<e.length;t++){let e=a[t];e.start!==null&&(d=Math.min(d,e.start))}let f=new Set,p=(e,t,n,r)=>{for(let i=e;i<e+n;i++)for(let e=t;e<t+r;e++)if(f.has(`${i}:${e}`))return!1;return!0},m=(e,t,n,r)=>{for(let i=e;i<e+n;i++)for(let e=t;e<t+r;e++)f.add(`${i}:${e}`)},h=e.map(()=>null);for(let t=0;t<e.length;t++){let e=a[t],n=o[t];e.start!==null&&n.start!==null&&(h[t]={major:e.start,minor:n.start},m(e.start,n.start,e.span,n.span))}let g=new Map;for(let t=0;t<e.length;t++){let e=a[t],n=o[t];if(e.start===null||n.start!==null)continue;let i=r.dense?l:Math.max(l,g.get(e.start)??l);for(;!p(e.start,i,e.span,n.span);)i++;h[t]={major:e.start,minor:i},m(e.start,i,e.span,n.span),r.dense||g.set(e.start,i+n.span),u=Math.max(u,i+n.span)}let _=d,v=l;for(let t=0;t<e.length;t++){if(h[t]!==null)continue;let e=a[t],n=o[t];if(r.dense&&(_=d,v=l),n.start!==null){for(n.start<v&&_++;!p(_,n.start,e.span,n.span);)_++;h[t]={major:_,minor:n.start},m(_,n.start,e.span,n.span),v=n.start+n.span}else{let r=_,i=v;for(;;){if(i+n.span>u){r++,i=l;continue}if(p(r,i,e.span,n.span))break;i++}h[t]={major:r,minor:i},m(r,i,e.span,n.span),_=r,v=i+n.span}}let y=Math.max(c,d);for(let t=0;t<e.length;t++)y=Math.max(y,h[t].major+a[t].span);let b=e.map((e,t)=>{let n={start:h[t].major-d,span:a[t].span},r={start:h[t].minor-l,span:o[t].span};return i?{col:r,row:n}:{col:n,row:r}}),x=y-d,S=u-l;return i?{items:b,colOrigin:l,colCount:S,rowOrigin:d,rowCount:x}:{items:b,colOrigin:d,colCount:x,rowOrigin:l,rowCount:S}}function Kt(e,t,n,r,i,a){let o=typeof r==`number`?r:void 0,s=e.map((e,n)=>{if(t[n])return{base:0,limit:0,baseIntrinsic:!1,limitKind:`fixed`,frFactor:0,collapsed:!0};let r=zt(e.min,o),i=r??0,a=r===void 0,s=e.max;if(s.kind===`fr`)return{base:i,limit:null,baseIntrinsic:a,limitKind:`fr`,frFactor:s.value,collapsed:!1};let c=zt(s,o);return c===void 0?{base:i,limit:null,baseIntrinsic:a,limitKind:s.kind===`min-content`?`intrinsic-min`:`intrinsic-max`,frFactor:0,collapsed:!1}:{base:i,limit:c,baseIntrinsic:a,limitKind:`fixed`,frFactor:0,collapsed:!1}}),c=s.map((e,t)=>t===0||e.collapsed?0:s.slice(0,t).some(e=>!e.collapsed)?i:0),l=(e,t)=>{let n=0;for(let r=e+1;r<e+t;r++)n+=c[r];return n},u=e=>e.collapsed?0:e.limitKind===`fixed`?e.limit:Math.max(e.base,e.limit??e.base),d=[...n].sort((e,t)=>e.span-t.span);for(let e of d){let t=[],n=!1;for(let r=e.start;r<e.start+e.span;r++){let e=s[r];e!==void 0&&(e.limitKind===`fr`&&(n=!0),t.push(e))}if(t.length===0)continue;let r=l(e.start,e.span);if(n){let n=t.filter(e=>e.limitKind===`fr`&&e.baseIntrinsic&&!e.collapsed);if(n.length===0)continue;let i=t.reduce((e,t)=>e+t.base,0)+r,a=e.min-i;if(a>0){let e=n.reduce((e,t)=>e+t.frFactor,0),t=z(n.map(t=>e>0?t.frFactor:1),a);n.forEach((e,n)=>{e.base+=t[n]})}continue}let i=t.filter(e=>e.baseIntrinsic&&!e.collapsed);if(i.length>0){let n=t.reduce((e,t)=>e+t.base,0)+r,a=e.min-n;if(a>0){let e=z(i.map(()=>1),a);i.forEach((t,n)=>{t.base+=e[n]})}}for(let[n,i]of[[`intrinsic-min`,e.min],[`intrinsic-max`,e.max]]){let e=t.filter(e=>e.limitKind===n&&!e.collapsed);if(e.length===0)continue;let a=i-(t.reduce((e,t)=>e+u(t),0)+r);if(a>0){let t=z(e.map(()=>1),a);e.forEach((e,n)=>{e.limit=u(e)+t[n]})}}}for(let e of s)e.collapsed||(e.limitKind===`fixed`?e.base=Math.min(e.base,e.limit):e.limitKind!==`fr`&&(e.limit=Math.max(e.base,e.limit??e.base)));if(o===void 0){let e=s.filter(e=>e.limitKind===`fr`&&!e.collapsed);if(e.length>0){let t=0;for(let n of e)n.frFactor>0&&(t=Math.max(t,n.base/n.frFactor));for(let e of n){let n=0,r=l(e.start,e.span);for(let t=e.start;t<e.start+e.span;t++){let e=s[t];e===void 0||e.collapsed||(e.limitKind===`fr`?n+=e.frFactor:r+=u(e))}n<=0||(t=Math.max(t,(e.max-r)/Math.max(n,1)))}for(let n of e){let e=Math.max(n.base,Se(n.frFactor*t));n.limit=e,r===`max-content`&&(n.base=e)}}if(r===`max-content`)for(let e of s)!e.collapsed&&e.limitKind!==`fr`&&(e.base=u(e))}else{let e=c.reduce((e,t)=>e+t,0),t=o-e-s.reduce((e,t)=>e+t.base,0);for(;!(t<=0);){let e=s.filter(e=>!e.collapsed&&e.limitKind!==`fr`&&e.base<u(e));if(e.length===0)break;let n=z(e.map(()=>1),t),r=0;if(e.forEach((e,t)=>{let i=Math.min(n[t],u(e)-e.base);e.base+=i,r+=i}),t-=r,r===0)break}let n=s.filter(e=>e.limitKind===`fr`);if(n.length>0){let t=Math.max(0,o-e-s.reduce((e,t)=>e+(t.limitKind===`fr`?0:t.base),0)),r=n,i=t,a=n.reduce((e,t)=>e+t.frFactor,0);for(a<1&&(i=Math.floor(i*a));;){let e=z(r.map(e=>e.frFactor),i),t=r.filter((t,n)=>e[n]<t.base);if(t.length===0){r.forEach((t,n)=>{t.base=Math.max(t.base,e[n])});break}for(let e of t)i-=e.base;if(i=Math.max(0,i),r=r.filter(e=>!t.includes(e)),r.length===0)break}}if(a){let t=o-e-s.reduce((e,t)=>e+t.base,0),n=s.filter(e=>!e.collapsed&&e.limitKind===`intrinsic-max`);if(t>0&&n.length>0){let e=z(n.map(()=>1),t);n.forEach((t,n)=>{t.base+=e[n]})}}}return{sizes:s.map(e=>e.base),gapBefore:c,limits:s.map(e=>u(e))}}function qt(e,t,n){let{sizes:r,gapBefore:i}=e,a=Math.max(0,t-Jt(e)),o=st(n===`stretch`?`start`:n,r,a),s=[],c=0;for(let e=0;e<r.length;e++)c+=i[e],s.push(o[e]+c);return s}function Jt(e){return e.sizes.reduce((e,t)=>e+t,0)+e.gapBefore.reduce((e,t)=>e+t,0)}function Yt(e,t,n,r){let i=n+r-1;return e[n]===void 0||e[i]===void 0?0:e[i]+t[i]-e[n]}function Xt(e,t,n,r,i){let a=t??0,o=n??0,s=r-i;return t===null&&n===null?Math.floor(s/2):t===null?s-o:n===null?a:a+ut(e,r,i+a+o)}function Zt(e,t,n){let r=e.columnWidth===null?null:Math.max(1,Math.floor((t+n)/(e.columnWidth+n)));return e.columnCount!==null&&r!==null?Math.max(1,Math.min(e.columnCount,r)):r===null?Math.max(1,e.columnCount??1):r}function Qt(e,t,n){let r=Zt(e,t,n),i=Math.max(1,Math.floor((t-(r-1)*n)/r)),a=Math.max(0,t-(r*i+(r-1)*n));return Array.from({length:r},(e,t)=>i+ +(t<a))}function $t(e,t){let n=Math.max(typeof e.gapX==`number`?e.gapX:0,e.ruleX?.width??0);return e.columnCount===null?Math.max(e.columnWidth??1,t):e.columnCount*t+(e.columnCount-1)*n}function en(e,t){return e===void 0?t:t===void 0?e:Math.min(e,t)}function tn(e,t,n){for(;e<t;){let r=e+t>>1;n(r)?t=r:e=r+1}return e}function H(e,t,n){let r=Zt(e,t,n),i=Math.max(1,Math.floor((t-(r-1)*n)/r));return{count:r,width:i,leftover:Math.max(0,t-(r*i+(r-1)*n))}}function U(e,t,n){return e===`all`?!0:e===`around`?t||n:t&&n}function nn(e,t,n,r){let i=Zn(e,Math.max(1,t.width-e.style.tracking)),{heights:a,textOffsets:o}=Qn(e,i),s=e.style.lineGap,c=G(a.map(e=>e+s)),l;if(e.style.columnFill===`auto`&&r!==void 0)l=Math.max(1,r);else{let e=tn(c.reduce((e,t)=>Math.max(e,t.rows-s),1),Math.max(1,c.reduce((e,t)=>e+t.rows,0)-s),e=>W(c,s,e).columns<=t.count);l=r===void 0?e:Math.max(1,Math.min(e,r))}let u=W(c,s,l);return{spans:i,lineY:u.top,textY:u.top.map((e,t)=>e+o[t]),lineX:u.column.map(e=>e*(t.width+n)),totalRows:u.maxUsed,columnCount:t.count,columnWidth:t.width,gap:n,columnsUsed:i.length>0?u.columns:0}}function W(e,t,n,r=`truncate`){let i=0,a=0,o=0,s=[],c=[];for(let l=0;l<e.length;l++){let u=e[l],d=r===`glue`||l===0||a>0?u.pre:0;a>0&&(u.forced||a+d+u.rows+u.post-t>n)&&(r===`truncate`&&(d=0),i+=1,a=0);let f=u.rows/u.lines;if(u.lines>1&&u.rows-t>n){for(let e=0;e<u.lines;e++)a>0&&a+d+f-t>n&&(r===`truncate`&&(d=0),i+=1,a=0),s.push(i),c.push(a+d),a+=d+f,d=0,o=Math.max(o,a-t);a+=u.post,u.post>0&&(o=Math.max(o,a));continue}for(let e=0;e<u.lines;e++)s.push(i),c.push(a+d+e*f);a+=d+u.rows+u.post,o=Math.max(o,a-(u.post>0?0:t))}return{columns:i+1,maxUsed:o,column:s,top:c}}function G(e){return e.map(e=>({rows:e,pre:0,post:0,forced:!1,lines:1}))}var rn=null;function an(){if(rn!==null)return rn;let e=document.createElement(`div`);e.style.cssText=`position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1`,e.innerHTML=`<div style="margin:0;padding:0 0 20px 0">aaaaaa aaaaaa aaaaaa</div><div style="margin:0"><span>bbbbbb</span> bbbbbb</div>`,document.body.appendChild(e);let t=e.getBoundingClientRect().top,n=e.querySelector(`span`).getBoundingClientRect();return e.remove(),rn=!(n.width>0&&n.top-t>=10),rn}function on(e,t,n,i){let a=e.style;if(!a.ruleX)return;let o=t.columnCount*t.columnWidth+(t.columnCount-1)*t.gap,s=t.ruleSegments??[{start:0,end:t.totalRows,columns:t.columnsUsed}],c=[];for(let e of s){let n=Math.min(e.columns,t.columnCount);for(let r=0;r<t.columnCount-1;r++)U(a.ruleVisibilityItems,r<n,r+1<n)&&c.push({bandStart:(r+1)*t.columnWidth+r*t.gap,bandSize:t.gap,start:e.start,end:e.end})}e.decorationRuns=be({glyphs:r(a.glyphSet),ruleX:a.ruleX,ruleY:null,vertical:tt(c,a.ruleInset),horizontal:[],contentWidth:o,contentHeight:t.totalRows,border:n,borderStyle:a.borderStyle,borderColor:a.borderColor,padding:i})}function sn(e,t){let n=e.style,r=n.padding;return e.text!==``&&e.children.length===0&&n.display===`block`&&n.position===`static`&&!n.columnSpan&&n.whiteSpace===`normal`&&n.lineGap===t.lineGap&&n.border.top===0&&n.border.right===0&&n.border.bottom===0&&n.border.left===0&&r.top===0&&r.right===0&&r.bottom===0&&r.left===0&&n.backgroundColor===void 0&&!n.backgroundClear&&n.overflow.x===`visible`&&n.overflow.y===`visible`&&(n.width===void 0||n.width.kind===`auto`)&&(n.height===void 0||n.height.kind===`auto`)&&(n.minWidth===`auto`||n.minWidth===0||n.minWidth===void 0)&&(n.minHeight===`auto`||n.minHeight===0||n.minHeight===void 0)&&n.maxWidth===void 0&&n.maxHeight===void 0}function cn(e,t,n,r,i,a,o){let s=e.style,c=$n(s,`x`,n),l=H(s,n,c);a.right+=l.leftover;let u=s.lineGap,d=i.left+a.left,f=i.top+a.top,p=n-l.leftover,m=[[]],h=[];for(let e of t)e.style.columnSpan?(h[m.length-1]=e,m.push([])):m[m.length-1].push(e);let g=m.length>1,_=g?`glue`:`truncate`,v=[],y=0,b=0;for(let e=0;e<m.length;e++){let t=m[e],n=0;if(t.length>0){let i=t.map(e=>({node:e,spans:Zn(e,Math.max(1,l.width-e.style.tracking)),margin:X(e.style.margin,l.width),pre:0,post:0})),a=[],o=null,h=null,x=!1;for(let e of i){let{node:t,spans:n,margin:r}=e,i=o===null?r.top??0:or(o,r.top??0),s=i;_===`glue`&&h!==null?(s=0,h.post=i,a[a.length-1].post=i):e.pre=i;let c=x||t.style.breakBeforeColumn;if(t.style.breakInsideAvoid&&n.length>0)a.push({rows:n.length*(1+u),pre:s,post:0,forced:c,lines:n.length});else for(let e=0;e<n.length;e++)a.push({rows:1+u,pre:e>0?0:s,post:0,forced:e===0&&c,lines:1});n.length>0&&(o=r.bottom??0,h=e),x=t.style.breakAfterColumn}n=o??0;let S;if(s.columnFill===`auto`&&r!==void 0)S=Math.max(1,r);else{let e=tn(1,Math.max(1,W(a,u,1/0,_).maxUsed),e=>W(a,u,e,_).columns<=l.count);S=r===void 0?e:Math.max(1,Math.min(e,r))}let C=W(a,u,S,_);for(let e=0,t=0;e<i.length;e++){let{node:n,spans:r,margin:a,pre:o,post:s}=i[e],u=[],m=[];for(let e=0;e<r.length;e++,t++)u.push(y+C.top[t]),m.push(C.column[t]*(l.width+c));delete n.decorationRuns,n.multicolGeometry={spans:r,lineY:u,textY:u,lineX:m,totalRows:y+C.maxUsed,columnCount:l.count,columnWidth:l.width,gap:c,columnsUsed:C.columns},n.multicolFlow=g?{top:o,right:a.right,bottom:s,left:a.left}:a,n.localRect={x:d,y:f,width:p,height:C.maxUsed},n.resolvedPadding={top:0,right:0,bottom:0,left:0}}a.length>0&&(v.push({start:y,end:y+C.maxUsed,columns:C.columns}),b=Math.max(b,C.columns),y+=C.maxUsed+(e<m.length-1?u:0))}let i=h[e];if(i){let e=X(i.style.margin,p),t=(e.left??0)+(e.right??0);q(i,Math.max(0,p-t),void 0,0,0,`fill`,o);let r=ar(e,p,i.localRect.width),a=(e.top??0)+n;y+=a,i.localRect={...i.localRect,x:d+r,y:f+y},i.multicolFlowSpan={top:a,right:0,bottom:e.bottom??0,left:r},y+=i.localRect.height+(e.bottom??0)}}let x=y;for(let t of e.children){if(!K(t.style))continue;let e=X(t.style.margin,n);t.staticSlot={kind:`block`,x:d+(e.left??0),y:f+(e.top??0)}}return e.multicolGeometry={spans:[],lineY:[],textY:[],lineX:[],totalRows:x,columnCount:l.count,columnWidth:l.width,gap:c,columnsUsed:b,...g?{ruleSegments:v,nativeBalance:!0}:{}},x}function ln(e,t,n,i,a,o,s){let c=e.style,l=en(n,i),u=e.children.filter(e=>!K(e.style)),d=u.filter(e=>!e.style.columnSpan),f=u.reduce((e,t,n)=>!t.style.columnSpan&&(n===0||u[n-1].style.columnSpan)?e+1:e,0);if(d.length>0&&d.every(e=>sn(e,c))&&(d.length===u.length||c.columnFill===`balance`&&l===void 0&&(an()||f<=1&&d.every(e=>(e.style.margin.top===0||e.style.margin.top===null)&&(e.style.margin.bottom===0||e.style.margin.bottom===null)))))return cn(e,u,t,l,a,o,s);let p=$n(c,`x`,t),m=Qt(c,t,p),h=m.length,g=[];{let e=0;for(let t of m)g.push(e),e+=t+p}let _=e=>e<h?g[e]:g[h-1]+(e-h+1)*(m[h-1]+p),v=e=>m[Math.min(e,h-1)],y=m[h-1],b=a.left+o.left,x=a.top+o.top,S=[],C=0,w=[],T=[],E=!1,D=(e,t)=>{let r=0,i=0,a=null,o=0,c=e=>{if(t)for(let t of T){if(t.index!==e)continue;let n=a===null?t.margin.top??0:or(a,t.margin.top??0);t.child.staticSlot={kind:`block`,x:b+_(r)+(t.margin.left??0),y:x+C+i+n}}};for(let l=0;l<w.length;l++){let u=w[l];c(l);let d=a===null?l===0?u.margin.top??0:0:or(a,u.margin.top??0),f=u.node.localRect.height;if(a!==null&&(u.breakBefore||i+d+f>e)&&(r+=1,i=0,a=null,d=0),t){let e=u.node,t=v(r);if(t!==y){let r=(u.margin.left??0)+(u.margin.right??0);q(e,Math.max(0,t-r),n,0,0,`fill`,s)}e.localRect={...e.localRect,x:b+_(r)+ar(u.margin,t,e.localRect.width),y:x+C+i+d}}i+=d+u.node.localRect.height,o=Math.max(o,i),a=u.margin.bottom??0}return c(w.length),{columns:r+1,maxUsed:o}},O=()=>{if(w.length===0){for(let e of T)e.child.staticSlot={kind:`block`,x:b+(e.margin.left??0),y:x+C+(e.margin.top??0)};T=[];return}let e=l===void 0?void 0:Math.max(1,l-C),t=c.columnFill===`auto`&&e!==void 0,r;if(t)r=e;else{let t=tn(1,D(1/0,!1).maxUsed,e=>D(e,!1).columns<=h);r=e===void 0?t:Math.min(t,e)}let i=D(r,!0),a=t&&n!==void 0?Math.max(i.maxUsed,r):i.maxUsed;if(c.ruleX)for(let e=0;e<h-1;e++){let t=Math.min(i.columns,h);U(c.ruleVisibilityItems,e<t,e+1<t)&&S.push({bandStart:g[e]+m[e],bandSize:p,start:C,end:C+a})}C+=a,w=[],T=[]};for(let r of e.children){if(K(r.style)){T.push({child:r,margin:X(r.style.margin,t),index:w.length});continue}if(r.style.columnSpan){O(),E=!1;let e=X(r.style.margin,t),i=(e.left??0)+(e.right??0);q(r,Math.max(0,t-i),n,0,0,`fill`,s),C+=e.top??0,r.localRect={...r.localRect,x:b+ar(e,t,r.localRect.width),y:x+C},C+=r.localRect.height+(e.bottom??0);continue}let e=X(r.style.margin,y),i=(e.left??0)+(e.right??0);q(r,Math.max(0,y-i),n,0,0,`fill`,s),w.push({node:r,margin:e,breakBefore:E||r.style.breakBeforeColumn}),E=r.style.breakAfterColumn}return O(),c.ruleX&&S.length>0&&(e.decorationRuns=be({glyphs:r(c.glyphSet),ruleX:c.ruleX,ruleY:null,vertical:tt(S,c.ruleInset),horizontal:[],contentWidth:t,contentHeight:C,border:a,borderStyle:c.borderStyle,borderColor:c.borderColor,padding:o})),C}function un(e,t){e.hidden.push(t),t.style.tableRole!==`column`&&t.style.tableRole!==`column-group`&&m(t.source,`Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).`)}function dn(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isNaN(n)?1:t===`colspan`?Math.min(1e3,Math.max(1,n)):Math.min(65534,Math.max(0,n))}function fn(e,t,n){let r=(t,r)=>{let i=t.style.width,a=i&&i.kind!==`auto`&&i.kind!==`percent`?fr(i,0,t,n):void 0,o=i&&i.kind===`percent`?i.value:void 0;for(let t=0;t<r;t++)e.colFixed.push(a),e.colPercent.push(o)};if(t.style.tableRole===`column`){r(t,pn(t.source));return}let i=t.children.filter(e=>e.style.tableRole===`column`);if(i.length===0)r(t,pn(t.source));else for(let e of i)r(e,pn(e.source));for(let n of t.children)n.style.tableRole!==`column`&&un(e,n)}function pn(e){let t=Number.parseInt(e.getAttribute(`span`)??``,10);return Number.isNaN(t)?1:Math.min(1e3,Math.max(1,t))}function mn(e,t){let n={caption:null,rows:[],rowGroups:[],groupEnds:[],cells:[],columnCount:0,colFixed:[],colPercent:[],hidden:[]},r=[],i=[],a=[];for(let o of e.children){if(K(o.style))continue;let e=o.style.tableRole;if(e===`row`)i.push({row:o,group:null});else if(e===`header-group`||e===`row-group`||e===`footer-group`){let t=e===`header-group`?r:e===`footer-group`?a:i;for(let e of o.children)K(e.style)||(e.style.tableRole===`row`?t.push({row:e,group:o}):un(n,e))}else e===`caption`?n.caption===null?n.caption=o:un(n,o):e===`column`||e===`column-group`?(fn(n,o,t),n.hidden.push(o)):un(n,o)}let o=[...r,...i,...a],s=0;for(let e=0;e<o.length;e++){n.rows.push(o[e].row),n.rowGroups.push(o[e].group);let t=o[e+1]?.group;if(!(e+1<o.length&&(o[e].group===t||o[e].group===null&&t===null))){for(let t=s;t<=e;t++)n.groupEnds.push(e+1);s=e+1}}return hn(n),n}function hn(e){let t=[];for(let n=0;n<e.rows.length;n++){let r=e.rows[n],i=0;for(let a of r.children){if(K(a.style))continue;if(a.style.tableRole!==`cell`){un(e,a);continue}for(;(t[i]??0)>n;)i++;let o=dn(a.source,`colspan`),s=dn(a.source,`rowspan`),c=e.groupEnds[n],l=Math.max(1,Math.min(s===0?c-n:s,c-n));for(let e=i;e<i+o;e++)t[e]=Math.max(t[e]??0,n+l);e.cells.push({node:a,rowNode:r,row:n,col:i,rowSpan:l,colSpan:o}),i+=o}}e.columnCount=Math.max(t.length,e.colFixed.length)}function gn(e,t,n){let r=e.style,i=gr(e,n),a;if(t===`min`)a=i;else{let t=r.width!==void 0&&r.width.kind!==`auto`&&r.width.kind!==`percent`?fr(r.width,0,e,n):void 0;a=t===void 0?pr(e,n):Math.max(i,t)}let o=typeof r.minWidth==`number`?r.minWidth:0,s=typeof r.maxWidth==`number`?r.maxWidth:void 0;return Math.max(0,J(a,o,s))}function _n(e){let t=e.style.width;return t&&t.kind===`percent`?t.value:void 0}function vn(e,t,n){let r=e.columnCount,i=Array.from({length:r},()=>0),a=Array.from({length:r},()=>0),o=Array.from({length:r},()=>void 0);for(let t=0;t<r;t++)e.colFixed[t]!==void 0&&(a[t]=e.colFixed[t]),o[t]=e.colPercent[t];let s=[];for(let t of e.cells){if(t.colSpan>1){s.push(t);continue}i[t.col]=Math.max(i[t.col],gn(t.node,`min`,n)),a[t.col]=Math.max(a[t.col],gn(t.node,`max`,n));let e=_n(t.node);e!==void 0&&(o[t.col]=Math.max(o[t.col]??0,e))}s.sort((e,t)=>e.colSpan-t.colSpan);for(let e of s){let r=e.col,o=e.col+e.colSpan,s=Tn(t,r,o),c=a.slice(r,o);for(let t of[`min`,`max`]){let l=t===`min`?i:a,u=l.slice(r,o).reduce((e,t)=>e+t,0)+s,d=gn(e.node,t,n)-u;if(d<=0)continue;let f=z(c.some(e=>e>0)?c:c.map(()=>1),d);for(let e=r;e<o;e++)l[e]+=f[e-r]}}for(let e=0;e<r;e++)a[e]=Math.max(a[e],i[e]);return{min:i,max:a,percent:o}}function yn(e,t){let n=e.min.length,r=e.min.slice(),i=[],a=[];for(let t=0;t<n;t++)(e.percent[t]===void 0?a:i).push(t);if(i.length>0){let n=i.reduce((t,n)=>t+e.percent[n],0),o=Math.max(100,n);for(let n of i){let i=Math.round(t*e.percent[n]/o);r[n]=Math.max(e.min[n],i)}let s=a.reduce((t,n)=>t+e.min[n],0),c=i.reduce((e,t)=>e+r[t],0)-(t-s);if(c>0){let t=i.map(t=>r[t]-e.min[t]),n=z(t,Math.min(c,t.reduce((e,t)=>e+t,0)));i.forEach((e,t)=>r[e]-=n[t])}}let o=t-r.reduce((e,t)=>e+t,0);if(o>0&&a.length>0){let t=a.map(t=>e.max[t]-e.min[t]),n=t.reduce((e,t)=>e+t,0),i=z(t,Math.min(o,n));a.forEach((e,t)=>r[e]+=i[t]),o-=Math.min(o,n)}if(o>0){let t=a.length>0?a:i;if(t.length>0){let n=t.map(t=>e.max[t]),i=z(n.some(e=>e>0)?n:n.map(()=>1),o);t.forEach((e,t)=>r[e]+=i[t])}}return r}function bn(e,t,n){let r=e.columnCount,i=Array.from({length:r},()=>void 0);for(let n=0;n<r;n++)e.colFixed[n]===void 0?e.colPercent[n]!==void 0&&(i[n]=Math.max(0,Math.round(t*e.colPercent[n]/100))):i[n]=e.colFixed[n];for(let r of e.cells){if(r.row!==0)continue;let e=r.node.style,a;if(e.width&&e.width.kind===`percent`?a=Math.max(0,Math.round(t*e.width.value/100)):e.width&&e.width.kind!==`auto`&&(a=fr(e.width,0,r.node,n)),a===void 0)continue;let o=z(Array.from({length:r.colSpan},()=>1),a);for(let e=0;e<r.colSpan;e++){let t=r.col+e;i[t]===void 0&&(i[t]=o[e])}}let a=i.reduce((e,t)=>e+(t??0),0),o=i.filter(e=>e===void 0).length;if(o>0){let e=z(Array.from({length:o},()=>1),Math.max(0,t-a)),n=0;for(let t=0;t<r;t++)i[t]===void 0&&(i[t]=e[n++])}return i.map(e=>e??0)}var xn={double:3,solid:2,dashed:1,dotted:0};function Sn(e){for(let{border:t,side:n}of e)if(t?.hidden[n])return null;let t=null;for(let{border:n,side:r}of e){if(!n)continue;let e=n.width[r];if(e<=0)continue;let i=n.style[r];(t===null||e>t.width||e===t.width&&xn[i]>xn[t.style])&&(t={width:e,style:i,color:n.color[r]})}return t}function Cn(e,t){let n=t.columnCount,r=t.rows.length,i=e.style.borderCollapse,a={collapsed:i,vLines:Array.from({length:n+1},()=>0),hLines:Array.from({length:r+1},()=>0),spacingX:i?0:e.style.borderSpacingX,spacingY:i?0:e.style.borderSpacingY,vSegments:[],hSegments:[]};if(!i||n===0||r===0)return a;let o=Array.from({length:r},()=>Array.from({length:n},()=>void 0));for(let e of t.cells)for(let t=e.row;t<e.row+e.rowSpan;t++)for(let n=e.col;n<e.col+e.colSpan;n++)o[t][n]=e;let s=e.style.latticeBorder;for(let e=0;e<=n;e++){let i=[];for(let a=0;a<r;a++){let r=e>0?o[a][e-1]:void 0,c=e<n?o[a][e]:void 0;if(r!==void 0&&r===c){i.push(null);continue}let l=[];r&&r.col+r.colSpan===e&&l.push({border:r.node.style.latticeBorder,side:`right`}),c&&c.col===e&&l.push({border:c.node.style.latticeBorder,side:`left`});let u=e===0?`left`:e===n?`right`:null;if(u){l.push({border:t.rows[a].style.latticeBorder,side:u});let e=t.rowGroups[a];e&&l.push({border:e.style.latticeBorder,side:u}),l.push({border:s,side:u})}i.push(Sn(l))}a.vSegments.push(i),a.vLines[e]=i.reduce((e,t)=>Math.max(e,t?.width??0),0)}for(let e=0;e<=r;e++){let i=[];for(let a=0;a<n;a++){let n=e>0?o[e-1][a]:void 0,c=e<r?o[e][a]:void 0;if(n!==void 0&&n===c){i.push(null);continue}let l=[];n&&n.row+n.rowSpan===e&&l.push({border:n.node.style.latticeBorder,side:`bottom`}),c&&c.row===e&&l.push({border:c.node.style.latticeBorder,side:`top`}),e>0&&l.push({border:t.rows[e-1].style.latticeBorder,side:`bottom`}),e<r&&l.push({border:t.rows[e].style.latticeBorder,side:`top`});let u=e>0?t.rowGroups[e-1]:null,d=e<r?t.rowGroups[e]:null;u&&u!==d&&l.push({border:u.style.latticeBorder,side:`bottom`}),d&&d!==u&&l.push({border:d.style.latticeBorder,side:`top`}),e===0&&l.push({border:s,side:`top`}),e===r&&l.push({border:s,side:`bottom`}),i.push(Sn(l))}a.hSegments.push(i),a.hLines[e]=i.reduce((e,t)=>Math.max(e,t?.width??0),0)}return a}function wn(e,t){return e.collapsed?e.vLines.reduce((e,t)=>e+t,0):(t+1)*e.spacingX}function Tn(e,t,n){if(!e.collapsed)return e.spacingX*(n-t-1);let r=0;for(let i=t+1;i<n;i++)r+=e.vLines[i];return r}function En(e,t,n){if(!e.collapsed)return e.spacingY*(n-t-1);let r=0;for(let i=t+1;i<n;i++)r+=e.hLines[i];return r}function Dn(e,t){let n=t.tableData.get(e);if(n)return n;let r=mn(e,t),i=Cn(e,r),a={structure:r,chrome:i,bounds:vn(r,i,t),chromeX:wn(i,r.columnCount)};return t.tableData.set(e,a),a}function On(e,t){let{structure:n,bounds:r,chromeX:i}=Dn(e,t),a=r.min.reduce((e,t)=>e+t,0)+i,o=r.max.reduce((e,t)=>e+t,0)+i;return n.caption&&(a=Math.max(a,gr(n.caption,t)),o=Math.max(o,pr(n.caption,t))),{min:a,max:o}}function kn(e,t,n){let r=e.style,{bounds:i,chromeX:a}=Dn(e,n),{min:o,max:s}=On(e,n),c=r.border.left+r.border.right+Y(r.padding.left,t)+Y(r.padding.right,t)+B(r).right,l=i.max.reduce((e,t)=>e+t,0),u=0,d=0;for(let e=0;e<i.max.length;e++){let t=i.percent[e];t===void 0?d+=i.max[e]:u+=t}if(u>=100)l=1/0;else if(u>0){for(let e=0;e<i.max.length;e++){let t=i.percent[e];t!==void 0&&t>0&&(l=Math.max(l,Math.ceil(i.max[e]*100/t)))}l=Math.max(l,Math.ceil(d*100/(100-u)))}let f=Math.max(l+a,s)+c;return Math.max(o+c,Math.min(f,t))}function An(e,t,n,i,a,o){let{structure:s,chrome:c,bounds:l}=Dn(e,o),u=s.columnCount,d=s.rows.length,f=i.left+a.left,p=i.top+a.top;for(let e of s.hidden)e.tableHidden=!0,e.localRect={x:0,y:0,width:0,height:0},e.resolvedPadding={top:0,right:0,bottom:0,left:0},e.unclampedHeight=0;let m=Math.max(0,t-wn(c,u)),h=e.style,g=h.tableLayout===`fixed`&&h.width!==void 0&&h.width.kind!==`auto`?bn(s,m,o):yn(l,m),_=[],v=0;for(let e=0;e<u;e++)v+=c.collapsed?c.vLines[e]:c.spacingX,_.push(v),v+=g[e];let y=v+(c.collapsed?c.vLines[u]??0:c.spacingX),b=0;s.caption&&(q(s.caption,t,void 0,f,p,`fill`,o),b=s.caption.localRect.height);let x=new Map,S=new Map;for(let e of s.cells){let t=e.col+e.colSpan,n=g.slice(e.col,t).reduce((e,t)=>e+t,0)+Tn(c,e.col,t);S.set(e,n),q(e.node,n,void 0,0,0,`fill`,o,{width:n}),x.set(e,e.node.localRect.height)}let C=c.collapsed?c.hLines.reduce((e,t)=>e+t,0):(d+1)*c.spacingY,w=n===void 0?void 0:Math.max(0,n-b-C),T=e=>e!==void 0&&e.kind===`percent`&&w!==void 0?P(e.value,w):0,E=Array.from({length:d},()=>0),D=Array.from({length:d},()=>!1);for(let e=0;e<d;e++){let t=s.rows[e].style.height;t!==void 0&&t.kind===`cells`&&(E[e]=t.value);let n=T(t);n>0&&(E[e]=Math.max(E[e],n),D[e]=!0)}for(let e of s.cells)if(e.rowSpan===1){let t=T(e.node.style.height);t>0&&(D[e.row]=!0),E[e.row]=Math.max(E[e.row],x.get(e),t)}let O=s.cells.filter(e=>e.rowSpan>1).sort((e,t)=>e.rowSpan-t.rowSpan);for(let e of O){let t=e.row+e.rowSpan,n=E.slice(e.row,t).reduce((e,t)=>e+t,0)+En(c,e.row,t),r=x.get(e)-n;if(r<=0)continue;let i=z(Array.from({length:e.rowSpan},()=>1),r);for(let n=e.row;n<t;n++)E[n]+=i[n-e.row]}if(n!==void 0&&d>0){let e=n-b-C-E.reduce((e,t)=>e+t,0);if(e>0){let t=[];for(let e=0;e<d;e++)D[e]||t.push(e);let n=t.length>0?t:Array.from({length:d},(e,t)=>t),r=z(n.map(()=>1),e);n.forEach((e,t)=>E[e]+=r[t])}}let ee=s.caption&&e.style.captionSide===`top`?b:0,k=[],te=ee;for(let e=0;e<d;e++)te+=c.collapsed?c.hLines[e]:c.spacingY,k.push(te),te+=E[e];let ne=d>0?te+(c.collapsed?c.hLines[d]??0:c.spacingY):ee,re=new Map;for(let e=0;e<d;e++){let t=s.rowGroups[e];t&&!re.has(t)&&re.set(t,k[e])}for(let[e,t]of re){let n=t;for(let t=0;t<d;t++)s.rowGroups[t]===e&&(n=k[t]+E[t]);e.localRect={x:f,y:p+t,width:y,height:n-t},e.resolvedPadding={top:0,right:0,bottom:0,left:0},e.unclampedHeight=n-t}for(let e=0;e<d;e++){let t=s.rows[e],n=s.rowGroups[e],r=n?re.get(n):void 0;t.localRect={x:r===void 0?f:0,y:r===void 0?p+k[e]:k[e]-r,width:y,height:E[e]},t.resolvedPadding={top:0,right:0,bottom:0,left:0},t.unclampedHeight=E[e]}for(let e of s.cells){let t=e.row+e.rowSpan,n=E.slice(e.row,t).reduce((e,t)=>e+t,0)+En(c,e.row,t);e.node.children.some(e=>!K(e.style)&&e.style.height?.kind===`percent`)&&n!==x.get(e)&&q(e.node,S.get(e),n,0,0,`fill`,o,{width:S.get(e),height:n}),jn(e.node,n-(e.node.naturalContentHeight??e.node.localRect.height)),e.node.localRect={x:_[e.col],y:0,width:e.node.localRect.width,height:n}}for(let t of e.children)K(t.style)&&(t.staticSlot={kind:`block`,x:f,y:p});return s.caption&&e.style.captionSide===`bottom`&&(s.caption.localRect.y=p+ne),c.collapsed&&u>0&&d>0&&(e.decorationRuns=Mn(c,s,g,E,_,k,f,p,r(e.style.glyphSet))),e.style.captionSide===`bottom`?ne+b:ne}function jn(e,t){if(t<=0)return;let n=e.style.verticalAlign,r=n===`center`?Math.floor(t/2):n===`end`?t:0;if(!e.children.some(e=>!K(e.style)&&!e.inlineBox)){e.resolvedPadding.top+=r,e.resolvedPadding.bottom+=t-r;return}if(!(r<=0))for(let t of e.children)t.inlineBox||(K(t.style)?t.staticSlot?.kind===`block`&&(t.staticSlot.y+=r):t.localRect.y+=r)}function Mn(e,t,n,r,i,a,o,s,c){let l=t.columnCount,u=t.rows.length,d=[],f=t=>t<l?i[t]-e.vLines[t]:i[l-1]+n[l-1],p=t=>t<u?a[t]-e.hLines[t]:a[u-1]+r[u-1];for(let t=0;t<=l;t++){let n=e.vSegments[t];for(let e=0;e<u;e++){let i=n[e];if(!i)continue;let l=_e(i.style,`v`,c);for(let n=0;n<i.width;n++)for(let c=a[e];c<a[e]+r[e];c++)d.push({glyph:l,x:o+f(t)+n,y:s+c,length:1,color:i.color})}}for(let t=0;t<=u;t++){let r=e.hSegments[t];for(let e=0;e<l;e++){let a=r[e];if(!a)continue;let l=_e(a.style,`h`,c);for(let r=0;r<a.width;r++)d.push({glyph:l,x:o+i[e],y:s+p(t)+r,length:n[e],color:a.color})}}for(let t=0;t<=l;t++)if(!(e.vLines[t]<=0))for(let n=0;n<=u;n++){if(e.hLines[n]<=0)continue;let r=n>0?e.vSegments[t][n-1]:null,i=n<u?e.vSegments[t][n]:null,a=t>0?e.hSegments[n][t-1]:null,m=t<l?e.hSegments[n][t]:null,h=[r,i,a,m].filter(e=>e!==null);if(h.length===0)continue;let g=h.every(e=>e.style===`double`)?`double`:`solid`,_=h.reduce((e,t)=>t.width>e.width||t.width===e.width&&xn[t.style]>xn[e.style]?t:e),v=j(g,r!==null,i!==null,a!==null,m!==null,c);for(let r=0;r<e.vLines[t];r++)for(let i=0;i<e.hLines[n];i++)d.push({glyph:v,x:o+f(t)+r,y:s+p(n)+i,length:1,color:_.color})}return d}function Nn(e){return e.position===`absolute`||e.position===`fixed`?`absolute`:e.position===`relative`||e.position===`sticky`?`relative`:`static`}function Pn(e,t,n,r,i){for(let a of e.children){let o=Nn(a.style);if(o===`relative`){let t=e.localRect.width-e.style.border.left-e.style.border.right-e.resolvedPadding.left-e.resolvedPadding.right,n=e.localRect.height-e.style.border.top-e.style.border.bottom-e.resolvedPadding.top-e.resolvedPadding.bottom;a.localRect.x+=Fn(a.style.insets.left,a.style.insets.right,t),a.localRect.y+=Fn(a.style.insets.top,a.style.insets.bottom,n)}else o===`absolute`&&Ln(a,e,t,n,r,i);Pn(a,t+a.localRect.x,n+a.localRect.y,[...r,{node:a,absX:t+a.localRect.x,absY:n+a.localRect.y}],i)}}function Fn(e,t,n){return e===null?t===null?0:-Y(t,n):Y(e,n)}function In(e,t){if(!t)for(let t=e.length-1;t>0;t--){let n=e[t];if(!Gn(n.node.style))continue;let r=n.node.style.border;return{x:n.absX+r.left,y:n.absY+r.top,width:Math.max(0,n.node.localRect.width-r.left-r.right),height:Math.max(0,n.node.localRect.height-r.top-r.bottom)}}let n=e[0];return{x:n.absX,y:n.absY,width:n.node.localRect.width,height:n.node.localRect.height}}function Ln(e,t,n,r,i,a){let o=e.style,s=o.position===`fixed`,c=e.staticSlot,l=c?.kind===`grid`&&!s&&Gn(t.style)?{x:n+c.area.x,y:r+c.area.y,width:c.area.width,height:c.area.height}:In(i,s),u=o.insets.left===null?null:Y(o.insets.left,l.width),d=o.insets.right===null?null:Y(o.insets.right,l.width),f=o.insets.top===null?null:Y(o.insets.top,l.height),p=o.insets.bottom===null?null:Y(o.insets.bottom,l.height),m=X(o.margin,l.width),h=m.left??0,g=m.right??0,_=m.top??0,v=m.bottom??0,y=o.width===void 0||o.width.kind===`auto`,b=o.height===void 0||o.height.kind===`auto`,x=nr(o.minWidth,l.width,e,a)??0,S=nr(o.maxWidth,l.width,e,a),C={};if(!y)C.width=J(fr(o.width,l.width,e,a),x,S);else if(u!==null&&d!==null)C.width=J(Math.max(0,l.width-u-d-h-g),x,S);else{let t=Math.max(0,l.width-(u??0)-(d??0)-h-g);C.width=J(Math.min(pr(e,a),Math.max(gr(e,a),t)),x,S)}f!==null&&p!==null&&b&&(C.height=J(Math.max(0,l.height-f-p-_-v),tr(o.minHeight,l.height)??0,tr(o.maxHeight,l.height))),q(e,l.width,l.height,0,0,`shrink`,a,C);let w=e.localRect.width,T=e.localRect.height,E;if(u!==null&&d!==null){let e=Math.max(0,l.width-u-d-w-h-g),t=m.left===null&&m.right===null;E=l.x+u+h+(t?Math.floor(e/2):m.left===null?e:0)}else E=u===null?d===null?Hn(e,t,n,w):l.x+l.width-d-w-g:l.x+u+h;let D;if(f!==null&&p!==null){let e=Math.max(0,l.height-f-p-T-_-v),t=m.top===null&&m.bottom===null;D=l.y+f+_+(t?Math.floor(e/2):m.top===null?e:0)}else D=f===null?p===null?Un(e,t,r,T):l.y+l.height-p-T-v:l.y+f+_;e.localRect={...e.localRect,x:E-n,y:D-r}}function Rn(e,t,n){return st(e,[n],Math.max(0,t-n))[0]}function zn(e,t,n,r){return ut(lt(e,t),n,r)}function Bn(e,t,n,r,i){let a=X(e.style.margin,n.innerWidth),[o,s,c,l]=r===`x`?[a.left??0,a.right??0,n.innerWidth,n.direction===`row`]:[a.top??0,a.bottom??0,n.innerHeight,n.direction===`column`],u=i+o+s;return(l?Rn(mt(t.style),c,u):zn(e,t,c,u))+o}function Vn(e,t,n,r,i){let a=X(e.style.margin,n.width),o=e.style.justifySelf===`auto`?t.style.justifyItems:e.style.justifySelf,[s,c,l,u]=r===`x`?[a.left??0,a.right??0,n.width,o]:[a.top??0,a.bottom??0,n.height,lt(e,t)];return ut(u,l,i+s+c)+s}function Hn(e,t,n,r){let i=e.staticSlot;return i===void 0?n:i.kind===`block`?n+i.x:i.kind===`grid`?n+i.staticArea.x+Vn(e,t,i.staticArea,`x`,r):n+i.originX+Bn(e,t,i,`x`,r)}function Un(e,t,n,r){let i=e.staticSlot;return i===void 0?n:i.kind===`block`?n+i.y:i.kind===`grid`?n+i.staticArea.y+Vn(e,t,i.staticArea,`y`,r):n+i.originY+Bn(e,t,i,`y`,r)}function Wn(e,t){let n=Kn();q(e,t,void 0,0,0,`fill`,n),Pn(e,0,0,[{node:e,absX:0,absY:0}],n);let r=e.localRect.height,i=cr(e),{overflow:a}=e.style;return a.x===`visible`&&(e.localRect.width=Math.max(e.localRect.width,i.x)),a.y===`visible`&&(e.localRect.height=Math.max(r,i.y)),{height:r}}function K(e){return e.position===`absolute`||e.position===`fixed`}function Gn(e){return e.position!==`static`}function Kn(){return{maxContent:new WeakMap,minContent:new WeakMap,gridIntrinsic:new WeakMap,tableData:new WeakMap}}function q(e,t,n,r,i,a,o,s){let c=e.style,l=s?.height;delete e.decorationRuns,delete e.multicolGeometry,delete e.multicolFlow,delete e.multicolFlowSpan,delete e.flow,delete e.textExtent;let u=nr(c.minWidth,t,e,o)??0,d=nr(c.maxWidth,t,e,o),f=tr(c.minHeight,n)??0,p=tr(c.maxHeight,n),m=B(c),h=vt(c);s?.gutter?.right&&(m.right=h.right),s?.gutter?.bottom&&(m.bottom=h.bottom);let g={top:Y(c.padding.top,t),right:Y(c.padding.right,t)+m.right,bottom:Y(c.padding.bottom,t)+m.bottom,left:Y(c.padding.left,t)};e.resolvedPadding=g;let _=s?.width??J(sr(c,t,a,e,o),u,d),v=dr(c,n),y=vr(_,l??v??(f>0?f:void 0)??1/0,c.border,g),b=l!==void 0||v!==void 0,x=p===void 0?void 0:Math.max(0,p-c.border.top-c.border.bottom-g.top-g.bottom),S=Jn(e),C=(t,n)=>{let r=n&&Number.isFinite(t)?t:void 0;return S?qn(e,y.width,t,r,x,g,o):c.display===`flex`&&c.flexDirection===`row`?nt(e,y.width,t,r,c.border,g,o):c.display===`flex`?it(e,y.width,t,n,c.border,g,o):c.display===`grid`?St(e,y.width,t,c.border,g,o):c.display===`table`?An(e,y.width,r,c.border,g,o):c.display===`multicol`?ln(e,y.width,r,x,c.border,g,o):rr(e,y.width,r,c.border,g,o)},w=C(y.height,b);if(!S&&(c.display===`flex`||c.display===`grid`)&&!b&&p!==void 0){let e=c.border.top+c.border.bottom+g.top+g.bottom,t=J(w+e,f,p)-e;t<w&&(w=C(Math.max(0,t),!0))}let T=w+c.border.top+c.border.bottom+g.top+g.bottom,E=l??v??T;e.unclampedHeight=E,e.naturalContentHeight=T;let D=J(E,f,p),O=e.multicolGeometry;if(O){let t=D-c.border.top-c.border.bottom-g.top-g.bottom;t>O.totalRows&&(g.bottom+=t-O.totalRows),on(e,O,c.border,g)}if(e.localRect={x:r,y:i,width:_,height:D},gt(c.overflow.x)||gt(c.overflow.y)){let l=cr(e),u=Math.max(0,l.x-c.border.left-g.left),d=Math.max(0,l.y-c.border.top-g.top),f=Math.max(0,_-c.border.left-c.border.right-g.left-g.right),p=Math.max(0,D-c.border.top-c.border.bottom-g.top-g.bottom);if(e.scrollRange={sizeX:u,sizeY:d,maxX:gt(c.overflow.x)?Math.max(0,u-f):0,maxY:gt(c.overflow.y)?Math.max(0,d-p):0},c.scrollbarWidth!==`none`){let l=s?.gutter??{right:!1,bottom:!1},u=l.right||c.overflow.y===`auto`&&e.scrollRange.maxY>0,d=l.bottom||c.overflow.x===`auto`&&e.scrollRange.maxX>0;if(u!==l.right||d!==l.bottom){q(e,t,n,r,i,a,o,{...s,gutter:{right:u,bottom:d}});return}}e.scrollGutterCells={right:m.right,bottom:m.bottom}}else delete e.scrollRange,delete e.scrollGutterCells}function qn(e,t,n,r,i,a,o){let s=e.style,c;if(e.text){let l=_t(e);Je(e.text,(n,r)=>{let i=l[r];q(i,t,void 0,0,0,`shrink`,o),e.advances[n]=Math.max(1,i.localRect.width)});let u,d;if(s.display===`multicol`){let n=$n(s,`x`,t),o=H(s,t,n);a.right+=o.leftover;let c=nn(e,o,n,en(r,i));e.multicolGeometry=c,u=c,d=c.lineX}else u=Xn(e,t);if(c=u.totalRows,e.textExtent={width:u.spans.reduce((t,n)=>Math.max(t,Ge(e.text,n.start,n.end,e.advances,s.tracking)),0),rows:u.totalRows},Yn(e,u,t,n,a),l.length>0){let t=e=>u.spans.findIndex(t=>e>=t.start&&e<t.end);Je(e.text,(n,r)=>{let i=t(n);if(i===-1)return;let o=u.spans[i];l[r].localRect={...l[r].localRect,x:s.border.left+a.left+(d?.[i]??0)+We(o.start,n,e.advances),y:s.border.top+a.top+u.lineY[i]}})}}else c=e.intrinsicHeight;for(let n of e.children){if(n.inlineBox)continue;let e=X(n.style.margin,t);n.staticSlot={kind:`block`,x:s.border.left+a.left+(e.left??0),y:s.border.top+a.top+(e.top??0)}}return c}function Jn(e){return e.children.some(e=>!K(e.style)&&!e.inlineBox)?!1:e.text!==``||e.style.display!==`flex`&&e.style.display!==`grid`}function J(e,t,n){return Math.max(t,n===void 0?e:Math.min(e,n))}function Yn(e,t,n,r,i){let a=e.style;if(a.display!==`flex`&&a.display!==`grid`||t.spans.length===0)return;let o=a.display===`flex`&&a.flexDirection===`column`,s=t.spans.reduce((t,n)=>Math.max(t,Ge(e.text,n.start,n.end,e.advances,a.tracking)),0),c=Math.max(0,n-s);if(c>0){let e=a.display===`grid`?ut(a.justifyItems,n,s):o?ut(a.alignItems,n,s):st(mt(a),[s],c)[0];e>0&&(i.left+=e,i.right+=c-e)}if(Number.isFinite(r)){let e=Math.max(0,r-t.totalRows);if(e>0){let n=a.display===`grid`||!o?ut(a.alignItems,r,t.totalRows):st(mt(a),[t.totalRows],e)[0];n>0&&(i.top+=n,i.bottom+=e-n)}}}function Xn(e,t){let n=Zn(e,t),{heights:r,textOffsets:i}=Qn(e,n),a=[],o=[],s=0;for(let t=0;t<n.length;t++)a.push(s),o.push(s+i[t]),s+=r[t]+(t<n.length-1?e.style.lineGap:0);return{spans:n,lineY:a,textY:o,totalRows:s}}function Zn(e,t){return e.style.whiteSpace===`normal`?Ue(e.text,t,{advances:e.advances,tracking:e.style.tracking,firstLineIndent:e.style.textIndent}):He(e.text)}function Qn(e,t){let n=_t(e),r=[],i=[],a=0;for(let o of t){let t=1,s=0;for(let r=o.start;r<o.end;r++){if(e.text[r]!==``)continue;let i=n[a];t=Math.max(t,i.localRect.height),i.style.verticalAlign===`end`?s=Math.max(s,i.localRect.height-1):i.style.verticalAlign===`center`&&m(i.source,`vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom.`),a++}r.push(t),i.push(Math.min(s,t-1))}return{heights:r,textOffsets:i}}function $n(e,t,n){let r=Y(t===`x`?e.gapX:e.gapY,n),i=t===`x`?e.ruleX:e.ruleY;return Math.max(r,i?.width??0)}function Y(e,t){return typeof e==`number`?e:t===void 0||!Number.isFinite(t)?0:P(e.percent,t)}function X(e,t){let n=e=>e===null?null:Y(e,t);return{top:n(e.top),right:n(e.right),bottom:n(e.bottom),left:n(e.left)}}function er(e){return typeof e==`number`?e:0}function tr(e,t){if(e!==void 0&&typeof e!=`string`)return typeof e==`number`?e:t===void 0?void 0:P(e.percent,t)}function nr(e,t,n,r){return e===`min-content`||e===`max-content`||e===`fit-content`?fr({kind:e},t,n,r):tr(e,t)}function rr(e,t,n,r,i,a){let o=r.left+i.left,s=r.top+i.top,c=s,l=null;for(let r of e.children){let e=X(r.style.margin,t),i=e.top??0,s=e.bottom??0,u=e.left??0,d=e.right??0;if(K(r.style)){r.staticSlot={kind:`block`,x:o+u,y:c+(l===null?i:or(l,i))};continue}q(r,Math.max(0,t-u-d),n,0,0,`fill`,a);let f=ar(e,t,r.localRect.width);c+=l===null?i:or(l,i),r.localRect={...r.localRect,x:o+f,y:c},c+=r.localRect.height,l=s}return l!==null&&(c+=l),e.children.some(e=>e.anonymous)&&ir(e,o,s),c-s}function ir(e,t,n){let r=e.style.lineGap,i=n,a;for(let n of e.children){if(K(n.style))continue;let{x:e,y:o,height:s}=n.localRect;n.anonymous?(a?.flow&&(a.flow.bottom=o-i),i=o+s+r):(n.flow={top:o+r/2-i,right:0,bottom:0,left:e-t},i=o+r/2+s),a=n}}function ar(e,t,n){let r=t-n;return e.left===null&&e.right===null?Math.floor(r/2):e.left===null?r-(e.right??0):e.left}function or(e,t){return e>=0&&t>=0?Math.max(e,t):e<=0&&t<=0?Math.min(e,t):e+t}function sr(e,t,n,r,i){let a=e.width;if(e.display===`table`){if(!r.children.some(e=>!K(e.style)&&!e.inlineBox))return a!==void 0&&a.kind!==`auto`?fr(a,t,r,i):Math.min(t,pr(r,i));if(a!==void 0&&a.kind!==`auto`){let e=fr(a,t,r,i);return Math.max(e,ur(r,t,i))}return kn(r,t,i)}return a!==void 0&&a.kind!==`auto`?fr(a,t,r,i):n===`shrink`?Math.min(t,pr(r,i)):t}function cr(e){let t=0,n=0;for(let r of e.children){if(r.style.position===`fixed`)continue;let e=lr(r);t=Math.max(t,r.localRect.x+e.x),n=Math.max(n,r.localRect.y+e.y)}if(e.textExtent){let{border:r}=e.style,i=e.resolvedPadding;t=Math.max(t,r.left+i.left+e.textExtent.width),n=Math.max(n,r.top+i.top+e.textExtent.rows)}return{x:t,y:n}}function lr(e){let{width:t,height:n}=e.localRect,r=e.style.overflow.x!==`visible`,i=e.style.overflow.y!==`visible`;if(r&&i)return{x:t,y:n};let a=cr(e);return{x:r?t:Math.max(t,a.x),y:i?n:Math.max(n,a.y)}}function ur(e,t,n){let r=e.style;return On(e,n).min+r.border.left+r.border.right+Y(r.padding.left,t)+Y(r.padding.right,t)+B(r).right}function dr(e,t){if(e.height?.kind===`cells`)return e.height.value;if(e.height?.kind===`percent`&&t!=null)return P(e.height.value,t)}function fr(e,t,n,r){switch(e.kind){case`cells`:return e.value;case`percent`:return P(e.value,t);case`min-content`:return gr(n,r);case`max-content`:return pr(n,r);case`fit-content`:return Math.min(pr(n,r),Math.max(gr(n,r),t));case`auto`:return pr(n,r)}}function pr(e,t){let n=t.maxContent.get(e);if(n!==void 0)return n;let r=e.style,i=mr(e,t)+r.border.left+r.border.right+er(r.padding.left)+er(r.padding.right)+B(r).right;return t.maxContent.set(e,i),i}function mr(e,t){let n=e.children.filter(e=>!K(e.style)&&!e.inlineBox);if(n.length===0)return e.style.display===`multicol`?$t(e.style,e.intrinsicWidth):e.intrinsicWidth;if(e.style.display===`grid`)return jt(e,t).max;if(e.style.display===`table`)return On(e,t).max;if(e.style.display===`flex`&&e.style.flexDirection===`row`){let r=Math.max(er(e.style.gapX),e.style.ruleX?.width??0)*Math.max(0,n.length-1);return n.reduce((e,n)=>e+hr(n,`max`,t),0)+r}let r=n.reduce((e,n)=>Math.max(e,hr(n,`max`,t)),0);return e.style.display===`multicol`?$t(e.style,r):r}function hr(e,t,n){let r=e.style,i;r.width!==void 0&&r.width.kind!==`auto`&&r.width.kind!==`percent`&&(i=fr(r.width,0,e,n)),i===void 0&&(i=t===`min`?gr(e,n):pr(e,n));let a=typeof r.minWidth==`number`?r.minWidth:0,o=typeof r.maxWidth==`number`?r.maxWidth:void 0;return Math.max(0,J(i,a,o))}function gr(e,t){let n=t.minContent.get(e);if(n!==void 0)return n;let r=e.style,i=_r(e,t)+r.border.left+r.border.right+er(r.padding.left)+er(r.padding.right)+B(r).right;return t.minContent.set(e,i),i}function _r(e,t){let n=e.children.filter(e=>!K(e.style)&&!e.inlineBox);if(n.length===0)return!e.text||e.style.whiteSpace!==`normal`?e.intrinsicWidth:qe(e.text,{advances:e.advances,tracking:e.style.tracking});if(e.style.display===`grid`)return jt(e,t).min;if(e.style.display===`table`)return On(e,t).min;if(e.style.display===`flex`&&e.style.flexDirection===`row`&&e.style.flexWrap===`nowrap`){let r=Math.max(er(e.style.gapX),e.style.ruleX?.width??0)*Math.max(0,n.length-1);return n.reduce((e,n)=>e+hr(n,`min`,t),0)+r}return n.reduce((e,n)=>Math.max(e,hr(n,`min`,t)),0)}function vr(e,t,n,r){return{width:Math.max(0,e-n.left-n.right-r.left-r.right),height:Math.max(0,t-n.top-n.bottom-r.top-r.bottom)}}function yr(e){return Tr(e,{}).grid.map(e=>e.join(``).trimEnd()).join(`
956
+ `)}function br(e,t={}){let{grid:n,paints:r}=Tr(e,t);return{segments:n.map((e,n)=>xr(e,r[n],t.boxed)),cells:n}}function xr(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a===``)continue;let o=t[i],s=1;for(;e[i+s]===``;)s++;if(n&&(a.length>1||a.charCodeAt(0)>=128)&&n(a,s,o)){r.push({text:a,cells:s,box:!0,...o});continue}let c=r[r.length-1];c&&!c.box&&Sr(c,o)?c.text+=a:r.push({text:a,...o})}return r}function Sr(e,t){return e.color===t?.color&&e.backgroundColor===t?.backgroundColor&&e.fontWeight===t?.fontWeight&&e.fontStyle===t?.fontStyle&&e.textDecorationLine===t?.textDecorationLine&&e.opacity===t?.opacity&&e.selected===t?.selected}function Cr(e,t){e.selected?(t.color=e.backgroundColor??`var(--mw-bg, canvas)`,t.backgroundColor=e.color??`var(--mw-fg, canvastext)`):(e.color!==void 0&&(t.color=e.color),e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor)),e.fontWeight!==void 0&&(t.fontWeight=e.fontWeight),e.fontStyle!==void 0&&(t.fontStyle=e.fontStyle),e.textDecorationLine!==void 0&&(t.textDecoration=e.textDecorationLine),e.opacity!==void 0&&(t.opacity=e.opacity)}function wr(e){return e.color===void 0&&e.backgroundColor===void 0&&e.fontWeight===void 0&&e.fontStyle===void 0&&e.textDecorationLine===void 0&&e.opacity===void 0&&e.selected===void 0}function Tr(e,t){let n=Math.max(0,e.localRect.width),r=Math.max(0,e.localRect.height),i=Array.from({length:r},()=>Array.from({length:n},()=>` `)),a=Array.from({length:r},()=>Array.from({length:n},()=>void 0)),o=Array.from({length:r},()=>Array.from({length:n},()=>void 0)),s=(e,t)=>e>=0&&e<n&&t>=0&&t<r,c=(e,t)=>{let n=o[t][e];if(n)for(let e=0;e<n.cells;e++)i[t][n.x+e]=` `,o[t][n.x+e]=void 0},l=(e,t,n)=>{let r=a[t][e];a[t][e]=r?{...r,...n}:n};return Dr(e,0,0,t,(e,t,n,a,u=1)=>{if(t<0||t>=r)return;if(u===1){if(!s(e,t))return;c(e,t),i[t][e]=n,l(e,t,a);return}let d=s(e,t)&&s(e+u-1,t);for(let r=0;r<u;r++)s(e+r,t)&&(c(e+r,t),i[t][e+r]=d?r===0?n:``:` `,d&&(o[t][e+r]={x:e,cells:u}),l(e+r,t,a))}),{grid:i,paints:a}}function Er(e){let t={};return e.color&&(t.color=e.color),e.backgroundColor&&(t.backgroundColor=e.backgroundColor),e.fontWeight!==`400`&&e.fontWeight!==`normal`&&e.fontWeight!==``&&(t.fontWeight=e.fontWeight),e.fontStyle!==`normal`&&e.fontStyle!==``&&(t.fontStyle=e.fontStyle),e.textDecorationLine!==`none`&&e.textDecorationLine!==``&&(t.textDecorationLine=e.textDecorationLine),t}function Dr(e,t,n,i,a,o=1){if(e.tableHidden)return;let s=t+e.localRect.x,c=n+e.localRect.y,l=e.style,u=e=>o>=1?e:{...e,opacity:String(Math.round(o*1e3)/1e3)};if(l.backgroundColor!==void 0||l.backgroundClear){let t=l.backgroundColor===void 0?{backgroundColor:void 0}:u({backgroundColor:l.backgroundColor});for(let n=0;n<e.localRect.height;n++)for(let r=0;r<e.localRect.width;r++)a(s+r,c+n,` `,t)}let d=[];pe(l,{x:s,y:c,width:e.localRect.width,height:e.localRect.height},d);for(let e of d){let t=u(e.color===void 0?void 0:{color:e.color});for(let n=0;n<e.length;n++)a(e.x+n,e.y,e.glyph,t)}if(e.decorationRuns)for(let t of e.decorationRuns){let e=u(t.color===void 0?void 0:{color:t.color});for(let n=0;n<t.length;n++)a(s+t.x+n,c+t.y,t.glyph,e)}let p=s-(e.scroll?.x??0),m=c-(e.scroll?.y??0),h=a,g=kr(e,s,c);if(g){let{x0:e,y0:t,x1:n,y1:r}=g,i=(i,a)=>i<e||i>=n||a<t||a>=r;h=(e,t,n,r,o=1)=>{if(o===1){i(e,t)||a(e,t,n,r);return}let s=!0;for(let n=0;n<o;n++)i(e+n,t)&&(s=!1);if(s)a(e,t,n,r,o);else for(let n=0;n<o;n++)i(e+n,t)||a(e+n,t,` `,r)}}if(!e.children.some(e=>!e.inlineBox&&e.style.position!==`absolute`&&e.style.position!==`fixed`)&&e.text){let t=u(Er(l)),n=e.inlineElements?.map(e=>u(Er(e))),r=i.selection?.get(e);Or(e,p,m,(i,a,o,s)=>{let c=e.charInline?.[i]??-1,l=c>=0?e.inlineElements[c]:void 0,d=l?n[c]:t;if(r&&i>=r.start&&i<r.end&&(d={...d,selected:!0}),e.text[i]===`⁠`){l?.backgroundColor&&h(o,s,` `,u({backgroundColor:l.backgroundColor}));return}let f=a===1?e.text[i]:e.text.slice(i,i+a),p=Ne(f);p>0&&h(o,s,f,d,p)},(e,n)=>h(e,n,`…`,t))}for(let t of ge(e))Dr(t,p,m,i,h,o*t.style.opacity);let _=e.scrollRange,v=e.scrollGutterCells;if(_&&v&&(v.right>0||v.bottom>0)){let{track:t,thumb:n}=f(r(l.glyphSet)),i=e=>u(e?{color:e}:void 0),o=i(l.scrollbarColor?.track??l.color),d=i(l.scrollbarColor?.thumb??l.color),p=Nr(e,s,c);if(p.y){let{col:r,row:i,thick:s,len:c}=p.y,{at:l,len:u}=Pr(c,_.sizeY,_.maxY,e.scroll?.y??0);for(let e=0;e<s;e++)for(let s=0;s<c;s++){let c=s>=l&&s<l+u;a(r+e,i+s,c?n:t,c?d:o)}}if(p.x){let{col:r,row:i,thick:s,len:c}=p.x,{at:l,len:u}=Pr(c,_.sizeX,_.maxX,e.scroll?.x??0);for(let e=0;e<s;e++)for(let s=0;s<c;s++){let c=s>=l&&s<l+u;a(r+s,i+e,c?n:t,c?d:o)}}}}function Or(e,t,n,r,i){let a=e.style,o=e.resolvedPadding,s=t+a.border.left+o.left,c=n+a.border.top+o.top,l=e.localRect.width-a.border.left-a.border.right-o.left-o.right,u=e.multicolGeometry,{spans:d,textY:f}=u??Xn(e,l),p=u?Math.max(1,u.columnWidth-a.tracking):l;for(let t=0;t<d.length;t++){let n=d[t],o=c+f[t],l=t===0?a.textIndent:0,m=a.whiteSpace!==`normal`&&a.overflow.x===`clip`?Fr(e.text,n,p-l,e.advances,a):{end:n.end,ellipsis:!1},h=Ge(e.text,n.start,n.end,e.advances,a.tracking),g=Math.max(0,p-l-h),_=a.textAlign===`end`?g:a.textAlign===`center`?Math.floor(g/2):0,v=s+(u?.lineX[t]??0)+_+l,y=e.advances;for(let t=n.start;t<m.end;){let n=We(t,t+1,y),i=1;if(y)for(;t+i<m.end&&y[t+i]===0;)i++;if(e.text[t]!==``&&n>0){let a=e.inlineElements?.[e.charInline?.[t]??-1]?.insets,s=a?a.left??(a.right===null?0:-a.right):0,c=a?a.top??(a.bottom===null?0:-a.bottom):0;r(t,i,v+s,o+c,n)}v+=n,t+=i}m.ellipsis&&i?.(v,o)}}function kr(e,t,n){let{overflow:r,border:i}=e.style,a=r.x!==`visible`,o=r.y!==`visible`;if(!a&&!o)return null;let s=e.scrollGutterCells,{width:c,height:l}=e.localRect;return{x0:a?t+i.left:-1/0,y0:o?n+i.top:-1/0,x1:a?t+c-i.right-(s?.right??0):1/0,y1:o?n+l-i.bottom-(s?.bottom??0):1/0}}function Ar(e,t,n,r,i){let a=e.multicolGeometry;if(!a)return!1;let o=e.style,s=e.resolvedPadding,c=r-(t+o.border.left+s.left),l=i-(n+o.border.top+s.top),{lineX:u,lineY:d}=a;for(let e=0;e<d.length;e++){if(c<u[e]||c>=u[e]+a.columnWidth)continue;let t=(e+1<d.length&&u[e+1]===u[e]?d[e+1]:void 0)??d[e]+1+o.lineGap;if(l>=d[e]&&l<t)return!0}return!1}function jr(e,t,n,r,i){let a=null;return Or(e,t-(e.scroll?.x??0),n-(e.scroll?.y??0),(e,t,n,o,s)=>{a===null&&o===i&&r>=n&&r<n+s&&(a=e)}),a}function Mr(e,t,n){let r=e.inlineElements;if(!r||!e.charInline)return[];let i=r.map((e,t)=>r.flatMap((n,r)=>r===t||n.element.contains(e.element)?[r]:[])),a=r.map(()=>new Map);return Or(e,t-(e.scroll?.x??0),n-(e.scroll?.y??0),(t,n,r,o,s)=>{let c=e.charInline[t]??-1;if(!(c<0))for(let e of i[c]){let t=a[e].get(o);t?(t.x0=Math.min(t.x0,r),t.x1=Math.max(t.x1,r+s)):a[e].set(o,{x0:r,x1:r+s})}}),r.flatMap((e,t)=>[...a[t]].sort(([e],[t])=>e-t).map(([t,n])=>({element:e.element,rect:{x:n.x0,y:t,width:n.x1-n.x0,height:1}})))}function Nr(e,t,n){let r=e.scrollGutterCells;if(!r)return{};let{border:i,scrollbarSize:a,scrollbarInset:o}=e.style,s=n+i.top,c=t+i.left,l=n+e.localRect.height-i.bottom,u=t+e.localRect.width-i.right,d=r.bottom>0?l-r.bottom:l-o.y,f=r.right>0?u-r.right:u-o.x,p={};return r.right>0&&(p.y={col:u-r.right,row:s+o.y,thick:Math.min(a.y,r.right),len:Math.max(0,d-s-o.y)}),r.bottom>0&&(p.x={col:c+o.x,row:l-r.bottom,thick:Math.min(a.x,r.bottom),len:Math.max(0,f-c-o.x)}),p}function Pr(e,t,n,r){let i=t>0?Math.min(1,e/t):1,a=Math.max(1,Math.round(i*e));return n>0&&(a=Math.max(1,Math.min(a,e-n))),{at:n>0?Math.round(Math.min(r,n)/n*(e-a)):0,len:a}}function Fr(e,t,n,r,i){let{textOverflow:a,tracking:o}=i;if(Ge(e,t.start,t.end,r,o)<=n)return{end:t.end,ellipsis:!1};let s=a===`ellipsis`?n-1:n,c=t.start;for(;c<t.end&&Ge(e,t.start,c+1,r,o)<=s;)c++;return{end:c,ellipsis:a===`ellipsis`&&n>0}}function Ir(e,t,n){let{width:r,height:i}=e.localRect,a=e.textExtent;if(a){let{border:t,overflow:n}=e.style,o=e.resolvedPadding;n.x===`visible`&&(r=Math.max(r,t.left+o.left+a.width)),n.y===`visible`&&(i=Math.max(i,t.top+o.top+a.rows))}return{x:t,y:n,width:r,height:i}}function Lr(e,t,n){let r=[],i=e,a=e.localRect.x,o=e.localRect.y;for(;;){let e=null;for(let r of ge(i)){if(r.tableHidden)continue;let i=a+r.localRect.x,s=o+r.localRect.y;(r.multicolFlow?Ar(r,i,s,t,n):Rr(Ir(r,i,s),t,n))&&(e=r)}if(!e)return r;let s=a+e.localRect.x,c=o+e.localRect.y;r.push({node:e,x:s,y:c});let l=kr(e,s,c);if(l&&(t<l.x0||t>=l.x1||n<l.y0||n>=l.y1))return r;a=s-(e.scroll?.x??0),o=c-(e.scroll?.y??0),i=e}}function Rr(e,t,n){return t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height}function zr(e){return e.closest?.(`[inert]`)!=null}function Br(e,t,n){let r=[];for(let i of Lr(e,t,n)){if(zr(i.node.source))break;i.node.anonymous||r.push(i.node.source)}return r}function Vr(e,t,n){let r=(e,t,n)=>e>0?-Math.ceil(e/n):t>0?Math.ceil(t/n):0;return{x:r(e.left-t.x,t.x-e.right,n.width),y:r(e.top-t.y,t.y-e.bottom,n.height)}}function*Hr(e,t,n,r){if(e<=0||t<=0)return;let i=Math.max(0,Math.min(n,e-1)),a=Math.max(0,Math.min(r,t-1));yield{x:i,y:a,edge:`self`};for(let e=i-1;e>=0;e--)yield{x:e,y:a,edge:`end`};for(let t=i+1;t<e;t++)yield{x:t,y:a,edge:`start`};for(let n=1;n<t;n++){if(a-n>=0)for(let t=e-1;t>=0;t--)yield{x:t,y:a-n,edge:`end`};if(a+n<t)for(let t=0;t<e;t++)yield{x:t,y:a+n,edge:`start`}}}var Ur={ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`};function Wr(e){return Ur[e]??null}function Gr(e,t,n){let r=null,i=null;for(let a of n){let n=qr(e,t,a.rect);n&&(!i||Kr(n,i))&&(r=a,i=n)}return r?.element??null}function Kr(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}function qr(e,t,n){let r=e===`up`||e===`down`,[i,a,o]=r?[`y`,`x`,`height`]:[`x`,`y`,`width`],s=t[i]+t[o],c=n[i]+n[o],l=e===`down`||e===`right`?n[i]-s:t[i]-c;if(l<0)return null;let u=r?`width`:`height`,d=Math.min(t[a]+t[u],n[a]+n[u])-Math.max(t[a],n[a]);return d>0?[0,l,0]:[1,l,-d]}function Jr(e){let t=[],n=(e,r,i,a)=>{if(e.tableHidden)return;let o=r+e.localRect.x,s=i+e.localRect.y;!a&&!e.anonymous&&Xr(e.source)&&t.push({element:e.source,rect:{x:o,y:s,width:e.localRect.width,height:e.localRect.height}});for(let n of Mr(e,o,s))Xr(n.element)&&t.push(n);let c=e.scroll?.x??0,l=e.scroll?.y??0;for(let t of e.children)n(t,o-c,s-l,!1)};return n(e,0,0,!0),t}function Yr(e,t){let n=null;for(let{element:r,rect:i}of e)if(r===t){if(!n)n={...i};else{let e=Math.max(n.x+n.width,i.x+i.width),t=Math.max(n.y+n.height,i.y+i.height);n.x=Math.min(n.x,i.x),n.y=Math.min(n.y,i.y),n.width=e-n.x,n.height=t-n.y}}return n}function Xr(e){let t=e.tabIndex;return typeof t!=`number`||t<0?!1:!e.matches(`:disabled`)&&!zr(e)}var Zr=new Set([`text`,`search`,`url`,`tel`,`email`,`password`]),Qr=new Set([`checkbox`,`button`,`submit`,`reset`,`image`,`file`]);function $r(e,t,n=!1){let r=e.tagName;if(r===`TEXTAREA`||e.closest(`[contenteditable]:not([contenteditable='false'])`))return!0;if(r===`INPUT`){let n=e.type;return n===`radio`?!0:Zr.has(n)?t===`ArrowLeft`||t===`ArrowRight`:!Qr.has(n)}if(r===`SELECT`){let t=e,r=Number(t.size)||Number(t.getAttribute(`size`))||0;return t.multiple||r>1||n}return!1}function ei(e,t,n,r){let i=e.ownerDocument,a=i.createRange();a.setStart(e,t),a.collapse(!0);let o=i.createRange();return o.setStart(n,r),o.collapse(!0),a.compareBoundaryPoints(a.START_TO_START,o)}function ti(e){let t=b(e.source.tagName)?.selectionTarget?.(e.source)??null;return t&&t.textContent===e.text?t:null}function ni(e,t){let n=t,r=null;for(let t of ii(e)){if(n<=t.data.length)return[t,n];n-=t.data.length,r=[t,t.data.length]}return r}function ri(e,t,n){if(!e.contains(t))return null;let r=e.ownerDocument.createRange();return r.selectNodeContents(e),r.setEnd(t,n),r.toString().length}function*ii(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=t.nextNode();for(;n;)yield n,n=t.nextNode()}function ai(e,t,n){if(!e.charSource){let r=ti(e);return(r&&ri(r,t,n))??0}let r=_t(e).findIndex(e=>e.source.contains(t));if(r>=0){let t=-1;for(let n=0;n<=r;n++)t=e.text.indexOf(``,t+1);if(t>=0)return t}let i=e.charSource??[],a=0,o=i.length;for(;a<o;){let e=a+o>>1,r=i[e];ei(r.node,r.offset,t,n)<=0?a=e+1:o=e}if(a===0)return 0;let s=i[a-1];return t===s.node&&n<s.offset+s.length?s.index+(n-s.offset):s.index+s.length}function oi(e,t){if(!e.charSource){let n=ti(e),r=n&&ni(n,t);return r&&{node:r[0],offset:r[1]}}let n=e.charSource??[],r=0,i=n.length;for(;r<i;){let e=r+i>>1;n[e].index<=t?r=e+1:i=e}let a=n[r-1];if(!a)return null;let o=t-a.index;return o<=a.length?{node:a.node,offset:a.offset+o}:null}function si(e,t=[]){try{let n=e.ownerDocument.getSelection();if(!n)return null;if(n.getComposedRanges)return n.getComposedRanges({shadowRoots:[e,...t]})[0]??null;let r=e.getSelection?.();return!r||r.rangeCount===0?null:r.getRangeAt(0)}catch{return null}}function ci(e,t,n){let{startContainer:r,endContainer:i}=n;return t.contains(r)&&t.contains(i)?`grid`:li(e,r)&&li(e,i)?`light`:`outside`}function li(e,t){for(let n=t;n;){if(e.contains(n))return!0;let t=n.getRootNode();n=t instanceof ShadowRoot&&t.host!==e?t.host:null}return!1}function ui(e){let t=[],n=e=>{let r=ti(e)?.getRootNode();r instanceof ShadowRoot&&t.push(r);for(let t of e.children)n(t)};return n(e),t}function di(e,t){let n=t.startContainer.getRootNode();if(!(n instanceof ShadowRoot)||n.host===e.source)return null;let r=null,i=e=>{if(!r){if(e.source===n.host)r=e;else for(let t of e.children)i(t)}};if(i(e),!r)return null;let a=r,o=ai(a,t.startContainer,t.startOffset),s=ai(a,t.endContainer,t.endOffset);return{leaf:a,start:Math.min(o,s),end:Math.max(o,s)}}function fi(e,t){let n=di(e,t);if(n){let{leaf:e,start:t,end:r}=n;return r>t?new Map([[e,{start:t,end:r}]]):new Map}let r=e.source.ownerDocument.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset);let i=new Map,a=e=>{if(!e.tableHidden&&xi(e,r)){if(Si(e)){let{text:t}=e,n=0,a=t.length;e.charSource&&(Z(e,r.startContainer)&&(n=ai(e,r.startContainer,r.startOffset)),Z(e,r.endContainer)&&(a=ai(e,r.endContainer,r.endOffset))),a>n&&i.set(e,{start:n,end:a})}for(let t of e.children)a(t)}};return a(e),i}function pi(e,t){let n=di(e,t);if(n)return n.leaf.text.slice(n.start,n.end);let r=e.source.ownerDocument.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset);let i=[];return mi(e,r,i),wi(i)}function mi(e,t,n){if(e.tableHidden||!xi(e,t))return;let r=vi(e);if(r&&n.push({breaks:r}),e.style.tableRole===`row`)hi(e,t,n);else if(e.style.display===`table`){let r=_i(e);for(let r of e.children)r.style.tableRole===`row`||gi(r)||mi(r,t,n);let i=!1;for(let e of r)t.intersectsNode(e.source)&&(i&&n.push({text:`
957
+ `}),mi(e,t,n),i=!0)}else{Si(e)&&n.push({text:Ci(e,t)});for(let r of e.children)r.inlineBox||mi(r,t,n)}r&&n.push({breaks:r})}function hi(e,t,n){let r=!1;for(let i of e.children)i.style.tableRole!==`cell`||i.tableHidden||t.intersectsNode(i.source)&&(r&&n.push({text:` `}),mi(i,t,n),r=!0)}function gi(e){let t=e.style.tableRole;return t===`header-group`||t===`row-group`||t===`footer-group`}function _i(e){let t=[];for(let n of e.children)if(n.style.tableRole===`row`)t.push(n);else if(gi(n))for(let e of n.children)e.style.tableRole===`row`&&t.push(e);return t}function vi(e){if(e.inlineBox)return 0;let t=e.style.tableRole;return t===`row`||t===`cell`||gi(e)||t===`column`||t===`column-group`?0:e.source.tagName===`P`&&!e.anonymous?2:1}function yi(e){let t=[],n=e.charSource??[];if(n.length>0){let e=n[0],r=n[n.length-1];t.push({start:{node:e.node,offset:e.offset},end:{node:r.node,offset:r.offset+r.length}})}for(let n of _t(e)){let e=n.source.parentNode;if(!e)continue;let r=Array.prototype.indexOf.call(e.childNodes,n.source);t.push({start:{node:e,offset:r},end:{node:e,offset:r+1}})}if(t.length===0)return null;let r=(e,t)=>ei(e.node,e.offset,t.node,t.offset)<0,{start:i,end:a}=t[0];for(let e of t.slice(1))r(e.start,i)&&(i=e.start),r(a,e.end)&&(a=e.end);return{start:i,end:a}}function bi(e){return[...(e.charSource??[]).map(e=>e.node),...(e.inlineElements??[]).map(e=>e.element),...e.children.map(e=>e.source)]}function xi(e,t){return e.anonymous?bi(e).some(e=>t.intersectsNode(e)):t.intersectsNode(e.source)}function Z(e,t){return e.anonymous?e.source===t||bi(e).some(e=>e===t||e.contains(t)):e.source.contains(t)}function Si(e){return e.text.length!==0&&!e.children.some(e=>!e.inlineBox&&e.style.position!==`absolute`&&e.style.position!==`fixed`)}function Ci(e,t){let{text:n}=e,r=0,i=n.length;e.charSource&&(Z(e,t.startContainer)&&(r=ai(e,t.startContainer,t.startOffset)),Z(e,t.endContainer)&&(i=ai(e,t.endContainer,t.endOffset)));let a=n.slice(r,i);i===n.length&&a.endsWith(`
958
+ `)&&(a=a.slice(0,-1));let o=_t(e),s=n.slice(0,r).split(``).length-1;return a=a.replaceAll(``,()=>{let e=o[s++];if(!e||!t.intersectsNode(e.source))return``;let n=[];return mi(e,t,n),wi(n)}),a.replaceAll(`⁠`,``)}function wi(e){let t=``,n=0;for(let r of e){if(`breaks`in r){n=Math.max(n,r.breaks);continue}r.text.length!==0&&(t.length>0&&n>0&&(t+=`
959
+ `.repeat(n)),n=0,t+=r.text)}return t}var Ti=new Map;function Ei(e,t){let{text:n}=e;if(t<0||t>=n.length||Di(n[t]))return null;let r=t;for(;r>0&&!Di(n[r-1]);)r--;let i=t;for(;i<n.length&&!Di(n[i]);)i++;let a=Oi(e.source.closest?.(`[lang]`)?.getAttribute(`lang`)??``);if(!a)return null;for(let e of a.segment(n.slice(r,i))){let n=r+e.index,i=n+e.segment.length;if(t>=n&&t<i)return{start:n,end:i}}return null}function Di(e){return e===`
960
+ `||e===``||e===`⁠`}function Oi(e){let t=Ti.get(e);return t===void 0&&(t=ki(e)??ki(``),Ti.set(e,t)),t}function ki(e){if(typeof Intl.Segmenter!=`function`)return null;try{return new Intl.Segmenter(e||void 0,{granularity:`word`})}catch{return null}}var Ai=[{range:/^[\u2580-\u2590\u2594-\u259F]$/,reference:`█`},{range:/^[\u2500-\u257F]$/,reference:`│`}],ji=/^[\u2591-\u2593]$/,Mi=class{#e=new Map;#t=new Map;#n;#r={style:`normal`,weight:`400`,size:`16px`,family:`monospace`};#i={width:0,height:0,letterSpacing:0};#a=1;#o;constructor(e){this.#o=e}configure(e,t){let n=typeof devicePixelRatio==`number`&&devicePixelRatio||1;(e.style!==this.#r.style||e.weight!==this.#r.weight||e.size!==this.#r.size||e.family!==this.#r.family||t.width!==this.#i.width||t.height!==this.#i.height||t.letterSpacing!==this.#i.letterSpacing||n!==this.#a)&&(this.#r={...e},this.#i={...t},this.#a=n,this.#e.clear(),this.#t.clear())}invalidate(){this.#e.clear(),this.#t.clear()}box(e,t,n){let r=n?.fontWeight??this.#r.weight,i=n?.fontStyle??this.#r.style,a=`${i}|${r}|${e}`,o=this.#e.get(a);return o===void 0&&(o=this.#s(e,t,`${i} ${r} ${this.#r.size} ${this.#r.family}`),document.fonts?.status!==`loading`&&this.#e.set(a,o)),o}#s(e,t,n){let r=this.#u(),{width:i,height:a,letterSpacing:o}=this.#i;if(!r||i<=0||a<=0)return null;r.font=n;let s=Ai.find(t=>t.range.test(e));if(s)return this.#c(s.reference,r,n);if(ji.test(e))return this.#c(`█`,r,n)?this.#c(e,r,n,!0):null;let c=r.measureText(e),l=c.width+o,u=t*i;if(Math.abs(l-u)<=.01*i)return null;let d=l>0?u/l:1,f=c.actualBoundingBoxLeft+c.actualBoundingBoxRight,p=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent;return f>0&&(d=Math.min(d,u/f)),p>0&&(d=Math.min(d,a/p)),{scale:Math.round(d*1e3)/1e3}}shift(e,t){let n=(e.period??0)*this.#a;if(!n)return 0;let r=(n-t*this.#i.height*this.#a%n)%n,i=n-r,a=e.reach;return(a&&r>a.above*this.#a&&i<=a.below*this.#a?-i:r)/this.#a}#c(e,t,n,r=!1){let i=`${e}|${n}`,a=this.#t.get(i);if(a!==void 0)return a;let{width:o,height:s,letterSpacing:c}=this.#i,l=t.measureText(e),u=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent,d=u<s-.05,f=Math.abs(l.width+c-o)>.01*o;if(a=null,(d||f)&&u>0){let t=(s+3)/u,i,o=r?this.#l(e,n):null;if(o){let e=o*this.#a,n=Math.ceil(t*e-1e-6);t=n/e,i=n/this.#a}let c=l.fontBoundingBoxAscent,d=l.fontBoundingBoxDescent;if(a={scale:Math.round(t*1e3)/1e3},i&&(a.period=i),Number.isFinite(c+d)){let n=t*(2*l.actualBoundingBoxAscent-c+d)-3;if(this.#o){let t=this.#o(e,a.scale,n)-l.actualBoundingBoxAscent*a.scale;n-=2*(t+1.5)}if(a.lineHeight=Math.round(n*100)/100,i){let e=(c+d)*t,r=(n-e)/2;a.reach={above:Math.round(-r*100)/100,below:Math.round((r+e-s)*100)/100}}}}return this.#t.set(i,a),a}#l(e,t){let n=parseFloat(this.#r.size)||16,r=Math.ceil(n*2*4),i=document.createElement(`canvas`);i.width=i.height=r;let a=i.getContext(`2d`);if(!a||typeof a.getImageData!=`function`)return null;a.scale(4,4),a.font=t,a.textBaseline=`top`,a.fillText(e,n/2,n/2);let o=a.getImageData(0,0,r,r).data,s=[],c=0;for(let e of[.25,.375,.5,.625,.75]){let t=Math.round((n/2+this.#i.width*e)*4),i=[];for(let e=0;e<r;e++)i.push(o[(e*r+t)*4+3]);let a=i.findIndex(e=>e>0),l=i.length-1;for(;l>a&&i[l]===0;)l--;if(a<0||l-a<8)continue;let u=i.slice(a,l+1),d=u.reduce((e,t)=>e+t,0)/u.length,f=u.map(e=>e-d),p=f.reduce((e,t)=>e+t*t,0);p>c&&(c=p,s=f)}if(c===0)return null;let l=e=>{let t=0;for(let n=0;n+e<s.length;n++)t+=s[n]*s[n+e];return t/c},u=l(1),d=!1;for(let e=2;e<=s.length/2;e++){let t=l(e);if(d&&t<u&&u>.3)return(e-1)/4;d=t>u,u=t}return null}#u(){if(this.#n===void 0)try{let e=document.createElement(`canvas`).getContext(`2d`);this.#n=e&&typeof e.measureText==`function`?e:null}catch{this.#n=null}return this.#n}},Ni=new WeakMap,Pi=new WeakMap;function Fi(e){return Ui(e,!0)!==null}function Ii(e,t,n={}){let r=n.glyphs,i={};r&&(i.boxed=(e,t,n)=>r.box(e,t,n)!==null),n.selection&&(i.selection=n.selection);let{segments:a,cells:o}=br(e,i),s=Gi(a);if(Ni.get(t)===s)return!0;let c=Pi.get(t),l=new Set;if(c&&c.rows.length===a.length)for(let e=0;e<a.length;e++)Vi(t,c.rows[e].nodes,a[e])||l.add(e);if((l.size>0||!c||c.rows.length!==a.length)&&n.holdStructural&&Fi(t))return!1;if(Ni.set(t,s),!c||c.rows.length!==a.length){let e=document.createDocumentFragment(),n=[];for(let t=0;t<a.length;t++){let{nodes:i,units:o}=Li(a[t],r,t);for(let t of i)e.appendChild(t);let s=t<a.length-1?document.createTextNode(`
961
+ `):null;s&&e.appendChild(s),n.push({nodes:i,segments:a[t],newline:s,units:o})}Pi.set(t,{rows:n,cells:o});let i=Ui(t,!1);return t.replaceChildren(e),i&&Wi(t,i),!0}let u=l.size>0?Ui(t,!1):null;for(let e=0;e<a.length;e++){let n=a[e],i=c.rows[e];if(l.has(e)){let a=Li(n,r,e);for(let e of a.nodes)t.insertBefore(e,i.newline);for(let e of i.nodes)e.remove();i.nodes=a.nodes,i.segments=n,i.units=a.units;continue}for(let t=0;t<n.length;t++){let a=n[t];wr(a)||Bi(a,i.segments[t])||zi(i.nodes[t],a,r,e)}i.segments=n}return c.cells=o,u&&Wi(t,u),!0}function Li(e,t,n){let r=[],i=0;for(let a of e){if(i+=a.text.length,wr(a)&&!a.box){r.push(document.createTextNode(a.text));continue}let e=document.createElement(`span`);zi(e,a,t,n),e.textContent=a.text,r.push(e)}return{nodes:r,units:i}}function Ri(e,t,n){return Pi.get(e)?.cells[n]?.[t]}function zi(e,t,n,r){if(e.style.cssText=``,delete e.dataset.shade,Cr(t,e.style),!t.box)return;let i=t.cells??1,a=n?.box(t.text,i,t),o=e.style;if(o.display=`inline-block`,o.padding=`0`,o.width=`calc(${i} * var(--mw-cw, 1ch))`,o.height=`var(--mw-ch, 1lh)`,o.overflow=`hidden`,o.verticalAlign=`top`,o.textAlign=`center`,a&&a.scale!==1&&(o.fontSize=`${Math.round(a.scale*1e3)/10}%`),a?.lineHeight!==void 0){let i=a.lineHeight;a.period&&n&&(e.dataset.shade=t.text,o.setProperty(`--mw-period`,`${a.period}px`),i+=2*n.shift(a,r)),o.lineHeight=`${i}px`}}function Bi(e,t){return Sr(e,t)&&e.box===t.box&&e.cells===t.cells}function Vi(e,t,n){if(t.length!==n.length)return!1;for(let r=0;r<n.length;r++){let i=t[r],a=n[r];if((wr(a)&&!a.box)!==(i.nodeType===Node.TEXT_NODE)||i.textContent!==a.text||i.parentNode!==e)return!1}return!0}function Hi(e,t,n){let r=Pi.get(e);if(!r||r.rows.length===0)return 0;let i=Math.max(0,Math.min(n,r.rows.length-1)),a=0;for(let e=0;e<i;e++)a+=r.rows[e].units+1;let o=r.cells[i],s=Math.max(0,Math.min(t,o.length));for(let e=0;e<s;e++)a+=o[e].length;return a}function Ui(e,t){try{let n=e.ownerDocument.getSelection();if(!n)return null;let r=e.getRootNode();if(!(r instanceof ShadowRoot))return null;let i=si(r);if(!i)return null;let a=ri(e,i.startContainer,i.startOffset),o=ri(e,i.endContainer,i.endOffset);return a===null||o===null||a===o&&!t?null:{start:a,end:o,backward:n.direction===`backward`}}catch{return null}}function Wi(e,t){try{let n=ni(e,t.start),r=ni(e,t.end);if(!n||!r)return;let i=e.getRootNode().getSelection?.()??e.ownerDocument.getSelection();t.backward?i?.setBaseAndExtent(r[0],r[1],n[0],n[1]):i?.setBaseAndExtent(n[0],n[1],r[0],r[1])}catch{}}function Gi(e){let t=[];for(let n of e){for(let e of n)t.push(e.text,e.color??``,e.backgroundColor??``,e.fontWeight??``,e.fontStyle??``,e.textDecorationLine??``,e.opacity??``,e.selected?`s`:``,e.box?`b${e.cells}`:``);t.push(`
962
+ `)}return t.join(``)}function Ki(e){let t=new Set;Ji(e,!0,t);for(let n of Array.from(e.source.querySelectorAll(`[data-mw-inline-inset]`)))if(!t.has(n)){n.removeAttribute(`data-mw-inline-inset`);let e=n.style;for(let t of[`--mw-it`,`--mw-ir`,`--mw-ib`,`--mw-il`])e.removeProperty(t)}}function Q(e,t,n){e.style.getPropertyValue(t)!==n&&e.style.setProperty(t,n)}function qi(e,t){e.style.getPropertyValue(t)!==``&&e.style.removeProperty(t)}function $(e,t,n){e.hasAttribute(t)!==n&&(n?e.setAttribute(t,``):e.removeAttribute(t))}function Ji(e,t,n){if(e.inlineElements)for(let{element:t,tracking:r,padLeft:i,padRight:a,insets:o}of e.inlineElements){let e=t;Q(e,`--mw-ls`,String(r)),i>0?Q(e,`--mw-ipl`,String(i)):qi(e,`--mw-ipl`),a>0?Q(e,`--mw-ipr`,String(a)):qi(e,`--mw-ipr`),o&&(n.add(t),Xi(e,o))}if(t?Yi(e):e.anonymous||Zi(e),!e.tableHidden)for(let t of ge(e)){if(!t.anonymous){let n=t.source;t.style.zIndex!==null&&he(t,e)&&!t.inlineBox?Q(n,`--mw-z`,String(t.style.zIndex)):qi(n,`--mw-z`)}Ji(t,!1,n)}}function Yi(e){let t=e.source,n=e.text.length>0||e.children.some(e=>e.anonymous),{whiteSpace:r,textAlignBlocked:i,textIndent:a}=e.style;$(t,`data-mw-leaf`,n),$(t,`data-mw-nowrap`,n&&r!==`normal`),$(t,`data-mw-pre`,n&&r===`pre`),$(t,`data-mw-text-align-blocked`,n&&i),n?Q(t,`--mw-ti`,String(a)):qi(t,`--mw-ti`)}function Xi(e,t){$(e,`data-mw-inline-inset`,!0);let n=(t,n)=>{n===null?qi(e,t):Q(e,t,String(n))};n(`--mw-it`,t.top),n(`--mw-ir`,t.right),n(`--mw-ib`,t.bottom),n(`--mw-il`,t.left)}function Zi(e){let t=e.source,n=e.localRect,r=e.resolvedPadding,{border:i,textAlignBlocked:a,overflow:o,whiteSpace:s,tracking:c,lineGap:l}=e.style,u=e.multicolFlow,d=e.multicolFlowSpan;$(t,`data-mw-laid-out`,!e.inlineBox&&!u&&!d&&!e.flow),$(t,`data-mw-inline-box`,!!e.inlineBox),$(t,`data-mw-multicol-flow`,!!u),$(t,`data-mw-multicol-flow-span`,!!d),$(t,`data-mw-flow`,!!e.flow);let f=u??d??e.flow;f?(Q(t,`--mw-mt`,String(f.top??0)),Q(t,`--mw-mr`,String(f.right??0)),Q(t,`--mw-mb`,String(f.bottom??0)),Q(t,`--mw-ml`,String(f.left??0))):(qi(t,`--mw-mt`),qi(t,`--mw-mr`),qi(t,`--mw-mb`),qi(t,`--mw-ml`)),$(t,`data-mw-vbottom`,!!e.inlineBox&&e.style.verticalAlign===`end`),Q(t,`--mw-ls`,String(c)),Q(t,`--mw-lh`,String(l+1)),Q(t,`--mw-lhs`,String(-l/2)),$(t,`data-mw-nowrap`,s!==`normal`);let p=u||d?void 0:e.multicolGeometry;if($(t,`data-mw-multicol`,!!p),$(t,`data-mw-multicol-balance`,!!p?.nativeBalance),p?(Q(t,`--mw-colc`,String(p.columnCount)),Q(t,`--mw-colg`,String(p.gap))):(qi(t,`--mw-colc`),qi(t,`--mw-colg`)),$(t,`data-mw-pre`,s===`pre`),Q(t,`--mw-x`,String(n.x)),Q(t,`--mw-y`,String(n.y)),Q(t,`--mw-w`,String(n.width)),Q(t,`--mw-h`,String(n.height)),$(t,`data-mw-clip`,o.x===`clip`||o.y===`clip`),$(t,`data-mw-scroll`,e.scrollRange!==void 0),e.scrollRange){let{maxX:n,maxY:r}=e.scrollRange;Q(t,`--mw-se-x`,String(n>0?n+e.localRect.width:1)),Q(t,`--mw-se-y`,String(r>0?r+e.localRect.height:1))}else qi(t,`--mw-se-x`),qi(t,`--mw-se-y`);Q(t,`--mw-pt`,String(r.top)),Q(t,`--mw-pr`,String(r.right)),Q(t,`--mw-pb`,String(r.bottom)),Q(t,`--mw-pl`,String(r.left)),Q(t,`--mw-bt`,String(i.top)),Q(t,`--mw-br`,String(i.right)),Q(t,`--mw-bb`,String(i.bottom)),Q(t,`--mw-bl`,String(i.left)),Q(t,`--mw-ti`,String(e.style.textIndent)),$(t,`data-mw-text-align-blocked`,a),$(t,`data-mw-table-hidden`,!!e.tableHidden),$(t,`data-mw-hidden-runs`,e.children.some(e=>e.anonymous&&e.tableHidden))}function Qi(e,t,n){let r=getComputedStyle(e),i=parseFloat(r.fontSize)||t,a=xa(e)?e.computedStyleMap():null,o=e.getAttribute(`class`)??``,s=e.style;ga(e,o,s);let c=(e,r,i)=>za(a,e,r,o,i,s,n,t)??Va(a,e,r,o,i,s,n,t)??ja(r,t),l=r.display||fa[e.tagName]||``,u=pa[l]??`none`,d=r.columnCount&&r.columnCount!==`auto`?Math.max(1,Math.floor(Number(r.columnCount)||1)):null,f=r.columnWidth&&r.columnWidth!==`auto`?parseFloat(r.columnWidth):NaN,p=Number.isFinite(f)?Math.max(1,Ce(f,t)):null,m=l===`flex`||l===`inline-flex`?`flex`:l===`grid`||l===`inline-grid`?`grid`:l===`table`||l===`inline-table`?`table`:l===`none`||da(e,r)?`none`:d!==null||p!==null?`multicol`:`block`,h={kind:`none`},g={kind:`none`},_=[xt()],v=[xt()],y={direction:`row`,dense:!1},b=null;if(m===`grid`){if(a)h=Wa(a.get(`grid-template-columns`)?.toString()??``,t),g=Wa(a.get(`grid-template-rows`)?.toString()??``,t);else{e.setAttribute(`data-mw-degrid`,``);try{h=Wa(r.getPropertyValue(`grid-template-columns`),t),g=Wa(r.getPropertyValue(`grid-template-rows`),t)}finally{e.removeAttribute(`data-mw-degrid`)}}_=Ja(r.getPropertyValue(`grid-auto-columns`),t),v=Ja(r.getPropertyValue(`grid-auto-rows`),t),y=eo(r.getPropertyValue(`grid-auto-flow`)),b=qa(r.getPropertyValue(`grid-template-areas`))}let x=`auto`,S=!1,C=0,w=0;if(m===`table`&&(x=r.tableLayout===`fixed`?`fixed`:`auto`,S=r.borderCollapse===`collapse`,!S)){let e=r.borderSpacing.split(` `);C=Ce(parseFloat(e[0]??``)||0,t),w=Ce(parseFloat(e[1]??e[0]??``)||0,t)}let T={display:m,tableRole:u,tableLayout:x,borderCollapse:S,borderSpacingX:C,borderSpacingY:w,captionSide:r.captionSide===`bottom`?`bottom`:`top`,verticalAlign:u===`cell`||l.startsWith(`inline-`)?ma(e,r):`start`,flexDirection:r.flexDirection.startsWith(`column`)?`column`:`row`,flexReverse:r.flexDirection.endsWith(`-reverse`),flexWrap:r.flexWrap.startsWith(`wrap`)?`wrap`:`nowrap`,wrapReverse:r.flexWrap===`wrap-reverse`,flexGrow:Number(r.flexGrow)||0,flexShrink:r.flexShrink===``?1:Number(r.flexShrink)||0,flexBasis:Ha(r.flexBasis,t),order:Number(r.order)||0,justifyContent:Sa(r.justifyContent),alignContent:Sa(r.alignContent),alignItems:Ca(r.alignItems),alignSelf:wa(r.alignSelf),justifyItems:Ca(r.justifyItems),justifySelf:wa(r.justifySelf),gridTemplateColumns:h,gridTemplateRows:g,gridAutoColumns:_,gridAutoRows:v,gridAutoFlow:y,gridTemplateAreas:b,gridColumnStart:$a(r.getPropertyValue(`grid-column-start`)),gridColumnEnd:$a(r.getPropertyValue(`grid-column-end`)),gridRowStart:$a(r.getPropertyValue(`grid-row-start`)),gridRowEnd:$a(r.getPropertyValue(`grid-row-end`)),width:Fa(a,r.width,`width`,t,o,s,n),height:Fa(a,r.height,`height`,t,o,s,n),minWidth:c(`min-width`,r.minWidth,`min-w`)??`auto`,minHeight:c(`min-height`,r.minHeight,`min-h`)??`auto`,maxWidth:c(`max-width`,r.maxWidth,`max-w`),maxHeight:c(`max-height`,r.maxHeight,`max-h`),padding:to(r,t),margin:Ta(r,a,o,s,t),position:Oa(r.position),insets:ka(r,a,o,s,t),gapX:Ma(r.columnGap===`normal`||r.columnGap===``?m===`multicol`?`${i}px`:`0px`:r.columnGap,t),gapY:Ma(r.rowGap===`normal`?`0px`:r.rowGap,t),border:no(r),borderStyle:{top:Aa(r.borderTopStyle),right:Aa(r.borderRightStyle),bottom:Aa(r.borderBottomStyle),left:Aa(r.borderLeftStyle)},overflow:ua(r),scrollbarWidth:oa(e,r),scrollbarColor:sa(r.scrollbarColor),overscroll:{x:(r.overscrollBehaviorX||`auto`)===`auto`,y:(r.overscrollBehaviorY||`auto`)===`auto`},scrollbarSize:{x:ca(r.getPropertyValue(`--mw-scrollbar-size-x`)),y:ca(r.getPropertyValue(`--mw-scrollbar-size-y`))},scrollbarInset:{x:ca(r.getPropertyValue(`--mw-scrollbar-inset-x`),0),y:ca(r.getPropertyValue(`--mw-scrollbar-inset-y`),0)},...ha(e,r,t),lineGap:Da(r.lineHeight,i),tracking:Ea(r.letterSpacing,i,n?.letterSpacing??0),color:r.color,fontWeight:r.fontWeight,fontStyle:r.fontStyle,backgroundColor:ta(e,r.backgroundColor,r),backgroundClear:r.getPropertyValue(`--mw-bg-clear`).trim()===`1`,borderColor:{top:r.borderTopColor,right:r.borderRightColor,bottom:r.borderBottomColor,left:r.borderLeftColor},opacity:Na(r.opacity),glyphSet:r.getPropertyValue(`--mw-border-glyphs`).trim()||null,zIndex:r.zIndex===`auto`||r.zIndex===``?null:Number(r.zIndex)||0,latticeBorder:null,ruleX:m===`flex`||m===`grid`||m===`multicol`?va(r,`x`):null,ruleY:m===`flex`||m===`grid`?va(r,`y`):null,ruleBreak:_a(r,`--mw-rule-break`,[`none`,`intersection`],`normal`),ruleInset:r.getPropertyValue(`--mw-rule-inset`).trim()===`overlap-join`?`overlap-join`:Math.max(0,Se(parseFloat(r.getPropertyValue(`--mw-rule-inset`))||0)),ruleVisibilityItems:_a(r,`--mw-rule-visibility-items`,[`all`,`around`,`between`],`normal`),columnCount:d,columnWidth:p,columnFill:r.columnFill===`auto`?`auto`:`balance`,columnSpan:r.columnSpan===`all`,breakBeforeColumn:r.breakBefore===`column`,breakAfterColumn:r.breakAfter===`column`,breakInsideAvoid:r.breakInside===`avoid`||r.breakInside===`avoid-column`};return $i(T,r),T}function $i(e,t){t.borderCollapse===`collapse`&&(e.display===`table`||e.tableRole===`cell`||e.tableRole===`row`||e.tableRole===`row-group`||e.tableRole===`header-group`||e.tableRole===`footer-group`)&&(e.latticeBorder={width:e.border,style:e.borderStyle,color:e.borderColor,hidden:{top:t.borderTopStyle===`hidden`,right:t.borderRightStyle===`hidden`,bottom:t.borderBottomStyle===`hidden`,left:t.borderLeftStyle===`hidden`}},e.border=bt(),e.display===`table`&&(e.padding=bt()))}function ea(e){if(!e)return!0;let t=e.trim().toLowerCase();return t===``||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`currentcolor`}function ta(e,t,n){let r=O(e,ea(t)?``:t,n);return r===``?void 0:r}function na(e){return e===`hidden`||e===`clip`}var ra=new WeakMap,ia=null;function aa(e){if(ia!==null)return ia;if(!e.body)return!0;let t=e.createElement(`div`);return t.style.cssText=`position: absolute; width: 0; height: 0; overflow: auto`,e.body.appendChild(t),ia=getComputedStyle(t).scrollbarWidth!==`none`,t.remove(),ia}function oa(e,t){if(!aa(e.ownerDocument))return`auto`;if(e.hasAttribute(`data-mw-scroll`)){let t=ra.get(e);if(t!==void 0)return t}let n=t.scrollbarWidth===`none`?`none`:`auto`;return ra.set(e,n),n}function sa(e){let t=(e??``).trim();if(!t||t===`auto`)return null;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r===`(`)n++;else if(r===`)`)n--;else if(r===` `&&n===0)return{thumb:t.slice(0,e),track:t.slice(e+1).trim()}}return null}function ca(e,t=1){return Math.max(t,Math.floor(Number(e)||t))}function la(e){return na(e)?`clip`:e===`auto`||e===`scroll`?e:`visible`}function ua(e){let t=la(e.overflowX||e.overflow),n=la(e.overflowY||e.overflow);return t!==`visible`&&n===`visible`&&(n=`auto`),n!==`visible`&&t===`visible`&&(t=`auto`),{x:t,y:n}}function da(e,t){if(t.position!==`absolute`&&t.position!==`fixed`)return!1;let n=t.clip.replace(/\s/g,``);return n===`rect(0px,0px,0px,0px)`||n===`rect(0,0,0,0)`||!b(e.tagName)&&(na(t.overflow)||na(t.overflowX))&&parseFloat(t.width)<=1&&parseFloat(t.height)<=1}var fa={TABLE:`table`,THEAD:`table-header-group`,TBODY:`table-row-group`,TFOOT:`table-footer-group`,TR:`table-row`,TD:`table-cell`,TH:`table-cell`,CAPTION:`table-caption`,COL:`table-column`,COLGROUP:`table-column-group`},pa={"table-header-group":`header-group`,"table-row-group":`row-group`,"table-footer-group":`footer-group`,"table-row":`row`,"table-cell":`cell`,"table-caption":`caption`,"table-column":`column`,"table-column-group":`column-group`};function ma(e,t){let n=t.verticalAlign||e.getAttribute(`valign`)?.toLowerCase()||(e.tagName===`TD`||e.tagName===`TH`?`middle`:`baseline`);return n===`top`?`start`:n===`middle`?`center`:n===`bottom`?`end`:`start`}function ha(e,t,n){return{whiteSpace:t.whiteSpace===`pre`?`pre`:t.whiteSpace===`nowrap`?`nowrap`:`normal`,tabSize:Math.max(1,Math.floor(parseFloat(t.tabSize))||8),textOverflow:t.textOverflow===`ellipsis`?`ellipsis`:`clip`,textDecorationLine:t.textDecorationLine,textAlignBlocked:ya(e,t),textAlign:ba(e,t),textIndent:Pa(t,n)}}function ga(e,t,n){(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t)||/(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t)||n.fontSize!==``)&&m(e,`font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.`)}function _a(e,t,n,r){let i=e.getPropertyValue(t).trim();return n.includes(i)?i:r}function va(e,t){let n=Se(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`))||0);if(n<=0)return null;let r=e.getPropertyValue(`--mw-rule-${t}-color`).trim();return{width:n,style:Aa(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),color:r&&r!==`currentcolor`&&r!==`currentColor`?r:e.color}}function ya(e,t){return t.textAlign===`justify`||e.getAttribute(`align`)?.toLowerCase()===`justify`}function ba(e,t){let n=t.textAlign||e.getAttribute(`align`)?.toLowerCase()||``;return n===`right`||n===`end`?`end`:n===`center`||n.endsWith(`-center`)?`center`:`start`}function xa(e){return typeof e.computedStyleMap==`function`}function Sa(e){switch(e){case`center`:return`center`;case`flex-end`:case`end`:case`right`:return`end`;case`space-between`:return`space-between`;case`space-around`:return`space-around`;case`space-evenly`:return`space-evenly`;case`normal`:case`stretch`:case``:return`stretch`;default:return`start`}}function Ca(e){switch(e){case`center`:return`center`;case`flex-end`:case`end`:return`end`;case`stretch`:case`normal`:case``:return`stretch`;default:return`start`}}function wa(e){return e===`auto`||e===``||e===`normal`?`auto`:Ca(e)}function Ta(e,t,n,r,i){let a=(a,o,s)=>{if(t){let e=t.get(a)?.toString().trim();if(e===`auto`||t.get(o)?.toString().trim()===`auto`)return null;if(e?.endsWith(`%`)){let t=parseFloat(e);if(Number.isFinite(t)&&t!==0)return{percent:t}}}else if(s.test(n)||r.getPropertyValue(a)===`auto`)return null;let c=e.getPropertyValue(a);if(c===`auto`)return null;let l=Ma(c,i);if(l!==0)return l;let u=e.getPropertyValue(o);return u===`auto`?null:Ma(u,i)};return{top:a(`margin-top`,`margin-block-start`,/(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),right:a(`margin-right`,`margin-inline-end`,/(?:^|[\s:.[!])(?:m|mx|mr|me)-auto\b/),bottom:a(`margin-bottom`,`margin-block-end`,/(?:^|[\s:.[!])(?:m|my|mb)-auto\b/),left:a(`margin-left`,`margin-inline-start`,/(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)}}function Ea(e,t,n){let r=(e===`normal`?0:parseFloat(e)||0)-n;return r<=0?0:Math.floor(r/(.025*t)+1e-6)}function Da(e,t){if(!e||e===`normal`||t<=0)return 0;let n=parseFloat(e);return Number.isFinite(n)?Math.max(0,Math.floor(n/t+1e-6)-1):0}function Oa(e){switch(e){case`relative`:case`absolute`:case`fixed`:case`sticky`:return e;default:return`static`}}function ka(e,t,n,r,i){let a=(a,o)=>{if(t){let e=t.get(a)?.toString().trim();return!e||e===`auto`?null:Ma(e,i)}let s=r[a];if(s)return s===`auto`?null:Ma(s,i);if(!o.test(n))return null;let c=e.getPropertyValue(a);return!c||c===`auto`?null:Ma(c,i)};return{top:a(`top`,/(?:^|[\s:.[!])-?(?:top|inset|inset-y)-/),right:a(`right`,/(?:^|[\s:.[!])-?(?:right|end|inset|inset-x)-/),bottom:a(`bottom`,/(?:^|[\s:.[!])-?(?:bottom|inset|inset-y)-/),left:a(`left`,/(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)}}function Aa(e){switch(e){case`double`:return`double`;case`dashed`:return`dashed`;case`dotted`:return`dotted`;default:return`solid`}}function ja(e,t){if(!e||e===`none`||e===`auto`)return;if(e===`min-content`||e===`max-content`||e===`fit-content`)return e;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{percent:t}:void 0}let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):void 0}function Ma(e,t){if(!e||e===`auto`||e===`none`)return 0;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)&&t!==0?{percent:t}:0}let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):0}function Na(e){let t=parseFloat(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):1}function Pa(e,t){let n=e.textIndent;if(!n||n.endsWith(`%`))return 0;let r=parseFloat(n);return Number.isFinite(r)?Math.max(0,Ce(r,t)):0}function Fa(e,t,n,r,i,a,o){let s=Ia(n===`width`?a.width:a.height);if(s!==null)return{kind:`cells`,value:Ra(s,n,o,r)};let c=za(e,n,t,i,n===`width`?`w`:`h`,a,o,r);if(c!==void 0)return{kind:`cells`,value:c};let l=n===`width`?`w`:`h`,u=La(i,l)??La(i,`size`);if(u!==null){let i=parseFloat(e?String(e.get(n)??``):t),a=Number.isFinite(i)&&Math.abs(i-u)<=u*.3;if(a||!Number.isFinite(i))return{kind:`cells`,value:Ra(a?i:u,n,o,r)}}if(e){let t=e.get(n);if(t==null)return;let i=t.toString().trim();if(i===`auto`)return{kind:`auto`};let a=Ua(i);if(a)return a;if(i.endsWith(`%`))return{kind:`percent`,value:parseFloat(i)};if(i.endsWith(`px`))return{kind:`cells`,value:Ce(parseFloat(i),r)};if(i.endsWith(`rem`))return{kind:`cells`,value:Se(parseFloat(i)/.25)};let s=Ia(i);if(s!==null)return{kind:`cells`,value:Ra(s,n,o,r)}}let d=n===`width`?a.width:a.height;if(d){if(d===`auto`)return{kind:`auto`};let e=Ua(d);if(e)return e;if(d.endsWith(`%`))return{kind:`percent`,value:parseFloat(d)};let t=parseFloat(d);if(Number.isFinite(t))return{kind:`cells`,value:Ce(t,r)}}let f=`(?:^|[\\s:.[!])(?:${l}|size)-`;if(RegExp(`${f}min\\b`).test(i))return{kind:`min-content`};if(RegExp(`${f}max\\b`).test(i))return{kind:`max-content`};if(RegExp(`${f}fit\\b`).test(i))return{kind:`fit-content`};let p=RegExp(`${f}(\\d+)/(\\d+)(?![\\w./])`).exec(i);if(p)return{kind:`percent`,value:100*Number(p[1])/Number(p[2])};if(RegExp(`${f}full(?![\\w-])`).test(i))return{kind:`percent`,value:100};let m=RegExp(`${f}\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);if(m)return{kind:`percent`,value:Number(m[1])};let h=RegExp(`${f}(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);if(h)return{kind:`cells`,value:Se(Number(h[1]))};if(!new RegExp(f).test(i)||t===`auto`)return{kind:`auto`};if(t.endsWith(`%`))return{kind:`percent`,value:parseFloat(t)};let g=parseFloat(t);if(Number.isFinite(g))return{kind:`cells`,value:Ce(g,r)}}function Ia(e){let t=/^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());if(!t||typeof window>`u`)return null;let n=parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=t[2],i=window.innerHeight,a=window.innerWidth,o=r.endsWith(`h`)?i:r.endsWith(`min`)?Math.min(a,i):r.endsWith(`max`)?Math.max(a,i):r===`vb`?i:a;return n/100*o}function La(e,t){if(typeof window>`u`)return null;let n=RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);if(n){let e=n[1];return e===`screen`?t.includes(`h`)?window.innerHeight:window.innerWidth:e.endsWith(`h`)?window.innerHeight:window.innerWidth}let r=RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);return r?Ia(r[1]):null}function Ra(e,t,n,r){let i=t===`width`?n?.width:n?.height;return i&&i>0?Math.max(0,Math.floor(e/i)):Ce(e,r)}function za(e,t,n,r,i,a,o,s){let c=t.endsWith(`width`)?`width`:`height`,l=a.getPropertyValue(t).trim(),u=l.startsWith(`calc(`);if(!u&&!r.includes(`-[calc(`))return;let d=RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r),f=u?l:d?.[1]?.replaceAll(`_`,` `);if(!f)return;let p=Ba(f,c,o,s);if(!p||p.unitless)return;let m=Math.max(0,Se(p.cells));if(u)return m;let h=(e?String(e.get(t)??``):n).trim(),g=parseFloat(h);return(Number.isFinite(g)?Math.abs(g-p.px)<=Math.abs(p.px)*.3:h===``)?m:void 0}function Ba(e,t,n,r){let i=e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);if(!i||i.join(``).replace(/\s+/g,``)!==e.replace(/\s+/g,``))return null;let a=0,o=()=>i[a],s=()=>i[a++],c=(e,t)=>({cells:e,px:t,unitless:!1}),l=e=>{let i=/^--spacing\(\s*(-?[\d.]+)\s*\)$/.exec(e);if(i){let e=parseFloat(i[1]);return c(e,e*r/4)}let a=/^([\d.]+)([a-z%]*)$/.exec(e);if(!a)return null;let o=parseFloat(a[1]),s=a[2];if(!Number.isFinite(o))return null;if(s===``)return{cells:o,px:o,unitless:!0};if(s===`px`)return c(o/(r/4),o);if(s===`rem`)return c(o*4,o*r);let l=Ia(e);return l===null?null:c(Ra(l,t,n,r),l)},u=(e,t,n)=>{if(e===`+`||e===`-`){if(t.unitless!==n.unitless)return null;let r=e===`+`?1:-1;return{cells:t.cells+r*n.cells,px:t.px+r*n.px,unitless:t.unitless}}if(e===`*`){if(!t.unitless&&!n.unitless)return null;let[e,r]=t.unitless?[t,n]:[n,t];return{cells:r.cells*e.cells,px:r.px*e.px,unitless:r.unitless&&e.unitless}}return!n.unitless||n.px===0?null:{cells:t.cells/n.cells,px:t.px/n.px,unitless:t.unitless}},d=()=>{let e=s();if(e===void 0)return null;if(e===`-`){let e=d();return e&&{cells:-e.cells,px:-e.px,unitless:e.unitless}}return e===`calc`?s()===`(`?f():null:e===`(`?f():l(e)},f=()=>{let e=m();return s()===`)`?e:null},p=()=>{let e=d();for(;e&&(o()===`*`||o()===`/`);){let t=s(),n=d();e=n?u(t,e,n):null}return e},m=()=>{let e=p();for(;e&&(o()===`+`||o()===`-`);){let t=s(),n=p();e=n?u(t,e,n):null}return e},h=m();return a===i.length?h:null}function Va(e,t,n,r,i,a,o,s){let c=t.endsWith(`width`)?`width`:`height`,l=Ia(a.getPropertyValue(t))??Ia(e?.get(t)?.toString().trim()??``);if(l!==null)return Ra(l,c,o,s);let u=La(r,i);if(u===null)return;let d=(e?String(e.get(t)??``):n).trim(),f=parseFloat(d),p=Number.isFinite(f)&&Math.abs(f-u)<=u*.3;if(p||d===``)return Ra(p?f:u,c,o,s)}function Ha(e,t){if(!e||e===`auto`||e===`content`)return;let n=Ua(e);if(n)return n;if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{kind:`percent`,value:t}:void 0}let r=parseFloat(e);return Number.isFinite(r)?{kind:`cells`,value:Ce(r,t)}:void 0}function Ua(e){if(e===`min-content`)return{kind:`min-content`};if(e===`max-content`)return{kind:`max-content`};if(e===`fit-content`)return{kind:`fit-content`}}function Wa(e,t){let n=e.trim();if(!n||n===`none`)return{kind:`none`};if(n===`subgrid`||n.startsWith(`subgrid `))return{kind:`subgrid`};let r=[],i=[],a=[],o=e=>{i.push(a),a=[],r.push(e)},s;for(let e of Qa(n)){let n=Ka(e);if(n){a.push(...n);continue}let i=e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);if(i){let e=Ga(i[2].trim(),t);if(e.tracks.length===0)continue;let n=i[1];if(n===`auto-fill`||n===`auto-fit`){s||(s={index:r.length,tracks:e.tracks,mode:n},e.lineNames.some(e=>e.length>0)&&(s.lineNames=e.lineNames),a.length>0&&(s.leadingNames=a),a=[]);continue}let c=Math.max(0,Math.floor(Number(n)||0));for(let t=0;t<c;t++){a.push(...e.lineNames[0]);for(let t=0;t<e.tracks.length;t++)o(e.tracks[t]),a.push(...e.lineNames[t+1])}continue}o(Ya(e,t))}if(i.push(a),r.length===0&&!s)return{kind:`none`};let c={kind:`tracks`,tracks:r};return i.some(e=>e.length>0)&&(c.lineNames=i),s&&(c.autoRepeat=s),c}function Ga(e,t){let n=[],r=[],i=[];for(let a of Qa(e)){let e=Ka(a);if(e){i.push(...e);continue}r.push(i),i=[],n.push(Ya(a,t))}return r.push(i),{tracks:n,lineNames:r}}function Ka(e){let t=e.match(/^\[(.*)\]$/s);return t?t[1].split(/\s+/).filter(e=>e!==``):null}function qa(e){let t=[];for(let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)){let e=(n[1]??n[2]??``).trim().split(/\s+/).filter(e=>e!==``);if(e.length===0)return null;t.push(e)}if(t.length===0)return null;let n=t[0].length;if(t.some(e=>e.length!==n))return null;let r=new Map;t.forEach((e,t)=>{e.forEach((e,n)=>{if(/^\.+$/.test(e))return;let i=r.get(e);i?(i.colStart=Math.min(i.colStart,n),i.colEnd=Math.max(i.colEnd,n+1),i.rowStart=Math.min(i.rowStart,t),i.rowEnd=Math.max(i.rowEnd,t+1)):r.set(e,{colStart:n,colEnd:n+1,rowStart:t,rowEnd:t+1})})});for(let[e,n]of r)for(let r=n.rowStart;r<n.rowEnd;r++)for(let i=n.colStart;i<n.colEnd;i++)if(t[r][i]!==e)return null;return{columns:n,rows:t.length,areas:r}}function Ja(e,t){let n=Qa(e.trim()).filter(e=>e!==``&&!e.startsWith(`[`)).map(e=>Ya(e,t));return n.length>0?n:[xt()]}function Ya(e,t){let n=e.match(/^minmax\((.*)\)$/s);if(n){let e=Za(n[1]).map(e=>e.trim());return e.length===2?{min:Xa(e[0],t),max:Xa(e[1],t)}:{min:{kind:`auto`},max:{kind:`auto`}}}let r=Xa(e,t);return r.kind===`fr`?{min:{kind:`auto`},max:r}:{min:r,max:r}}function Xa(e,t){if(e===`auto`||e.startsWith(`fit-content`))return{kind:`auto`};if(e===`min-content`)return{kind:`min-content`};if(e===`max-content`)return{kind:`max-content`};let n=e.match(/^(min|max)\((.*)\)$/s);if(n){let e=Za(n[2]).map(e=>Xa(e.trim(),t)),r=e.every(e=>e.kind===`cells`||e.kind===`percent`||e.kind===`math`);return e.length>0&&r?{kind:`math`,fn:n[1],args:e}:{kind:`auto`}}if(e.endsWith(`fr`)){let t=parseFloat(e);return Number.isFinite(t)&&t>=0?{kind:`fr`,value:t}:{kind:`auto`}}if(e.endsWith(`%`)){let t=parseFloat(e);return Number.isFinite(t)?{kind:`percent`,value:t}:{kind:`auto`}}let r=parseFloat(e);return Number.isFinite(r)?{kind:`cells`,value:e.endsWith(`rem`)?Se(r/.25):Ce(r,t)}:{kind:`auto`}}function Za(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.filter(e=>e.trim()!==``)}function Qa(e){let t=[],n=0,r=-1;for(let i=0;i<e.length;i++){let a=e[i];a===`(`||a===`[`?n++:(a===`)`||a===`]`)&&n--,/\s/.test(a)&&n===0?(r!==-1&&t.push(e.slice(r,i)),r=-1):r===-1&&(r=i)}return r!==-1&&t.push(e.slice(r)),t}function $a(e){let t=e.trim();if(!t||t===`auto`)return{kind:`auto`};let n=!1,r,i;for(let e of t.split(/\s+/))e===`span`?n=!0:/^-?\d+$/.test(e)?r=Number(e):i=e;if(n){let e=r??1;return e<1?{kind:`auto`}:i===void 0?{kind:`span`,value:e}:{kind:`span`,value:e,name:i}}return i===void 0?r!==void 0&&r!==0?{kind:`line`,value:r}:{kind:`auto`}:r===0?{kind:`auto`}:r===void 0?{kind:`name`,name:i}:{kind:`name`,name:i,nth:r}}function eo(e){return{direction:e.includes(`column`)?`column`:`row`,dense:e.includes(`dense`)}}function to(e,t){return{top:Ma(e.getPropertyValue(`padding-top`),t),right:Ma(e.getPropertyValue(`padding-right`),t),bottom:Ma(e.getPropertyValue(`padding-bottom`),t),left:Ma(e.getPropertyValue(`padding-left`),t)}}function no(e){let t=(t,n)=>e.getPropertyValue(n)===`none`?0:Se(parseFloat(e.getPropertyValue(t))||0);return{top:t(`border-top-width`,`border-top-style`),right:t(`border-right-width`,`border-right-style`),bottom:t(`border-bottom-width`,`border-bottom-style`),left:t(`border-left-width`,`border-left-style`)}}function ro(e,t,n,r){let i=Qi(e,t,n);if(i.display===`none`)return null;let a=b(e.tagName);if(a)return uo(e,i,a);let o=Array.from(e.children),s=o.map(go),c={rootFontSizePx:t,cellMetrics:n,textareaWidths:r};return!s.includes(`block`)||Ao(e.tagName)?lo(e,i,o,s,c):{source:e,style:i,children:io(e,Array.from(e.childNodes),t,n,r),text:``,intrinsicWidth:0,intrinsicHeight:0,localRect:{x:0,y:0,width:0,height:0},unclampedHeight:0,resolvedPadding:bt()}}function io(e,t,n,r,i,a){let o={rootFontSizePx:n,cellMetrics:r,textareaWidths:i},s=[],c=e=>{let t=ro(e,n,r,i);t&&s.push(t)},l=a,u=[],d=[],f=!1,p=()=>{let t=u.filter(e=>e instanceof Element);if(f)l??=co(e,n,r),s.push(ao(e,u,t,d,o,l));else for(let e of t)c(e);u=[],d=[],f=!1};for(let e of t){if(e instanceof Element){let t=go(e);if(t===`none`)continue;if(t===`block`){p(),c(e);continue}d.push(t),f||=t===`inline`}else if(e.nodeType!==Node.TEXT_NODE)continue;else f||=/[^ \t\r\n\f]/.test(e.textContent??``);u.push(e)}return p(),s}function ao(e,t,n,r,i,a){let o=lo(e,a,n,r,i,t);return o.anonymous=!0,o}function oo(e,t,n,r){let i=Array.from(e.childNodes).filter(e=>!(e instanceof Element&&e.hasAttribute(`data-mw-probe`))),a=i.filter(e=>e instanceof Element),o=a.map(go);return o.includes(`block`)||!ko(e)&&!o.includes(`inline`)?null:lo(e,so(e,t,n),a,o,{rootFontSizePx:t,cellMetrics:n,textareaWidths:r},i)}function so(e,t,n){return{...co(e,t,n),tracking:0,lineGap:0}}function co(e,t,n){let r=getComputedStyle(e),i=parseFloat(r.fontSize)||t,a={...yt(),...ha(e,r,t),lineGap:Da(r.lineHeight,i),tracking:Ea(r.letterSpacing,i,n?.letterSpacing??0),color:r.color,fontWeight:r.fontWeight,fontStyle:r.fontStyle};return ua(r).x===`clip`&&(a.overflow={...a.overflow,x:`clip`}),a}function lo(e,t,n,r,i,a){let{rootFontSizePx:o,cellMetrics:s,textareaWidths:c}=i,l=e.tagName,u=Ao(l),d=_o(e,t.tracking,{rootFontSizePx:o,rootLetterSpacingPx:s?.letterSpacing??0,cellMetrics:s,textareaWidths:c,preserve:t.whiteSpace===`pre`,tabSize:t.tabSize},a),f=d.chars.join(``),{advances:p,charInline:m}=wo(d);if(d.boxes.length>0){let e=Kn();Je(f,(t,n)=>{p[t]=Math.max(1,pr(d.boxes[n],e))})}let h=Eo(f,p,t.tracking);if(u&&h===0){if(l===`INPUT`)h=Number(e.size)||20;else if(l===`TEXTAREA`)h=Number(e.cols)||20;else{let t=e,n=e=>e?.label||e?.textContent||``,r=getComputedStyle(e).getPropertyValue(`field-sizing`)===`content`?[n(t.selectedOptions[0])]:Array.from(t.options,n);h=Math.max(1,...r.map(e=>ze(e.trim())))}}let g=f.length>0?Do(f):0,_;if(l===`TEXTAREA`){let n=e,r=n.value??``,i=c?.get(n),a=+!!r.endsWith(`
963
+ `),o=i!==void 0&&i>0?Be(r,i,{advances:Re(r)})+a:r===``?0:r.split(/\r\n?|\n/).length,s=getComputedStyle(e).getPropertyValue(`field-sizing`)===`content`?1:Number(n.rows)||2,l=Math.max(s,o);_=l+Math.max(0,l-1)*t.lineGap}else _=u?Math.max(1,g):g;let v=new Map,y=[];for(let t of d.boxes)t.source.parentElement===e?v.set(t.source,t):y.push(t);let b=[];for(let e=0;e<n.length;e++){let t=n[e],i=v.get(t);if(i)b.push(i);else if(r[e]===`out-of-flow`){let e=ro(t,o,s,c);e&&b.push(e)}}y.length>0&&(b.push(...y),b.sort((e,t)=>e.source.compareDocumentPosition(t.source)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1));let x={source:e,style:t,children:b,text:f,intrinsicWidth:h,intrinsicHeight:_,localRect:{x:0,y:0,width:h,height:_},unclampedHeight:0,resolvedPadding:bt()};(p.some(e=>e!==1)||d.boxes.length>0)&&(x.advances=p),d.inlineElements.length>0&&(x.inlineElements=d.inlineElements,x.charInline=m);let S=To(d);return S.length>0&&(x.charSource=S),x}function uo(e,t,n){let r=C(n,e),i=r?.lines??[],a=i.join(`
964
+ `);t.whiteSpace=`pre`,(t.width===void 0||t.width.kind===`auto`)&&(t.width={kind:`max-content`});let o=Re(a,t.tracking),s=Eo(a,o,t.tracking),c=i.length,l={source:e,style:t,children:[],text:a,intrinsicWidth:s,intrinsicHeight:c,localRect:{x:0,y:0,width:s,height:c},unclampedHeight:0,resolvedPadding:bt()};o.some(e=>e!==1)&&(l.advances=o);let u=r?.runs??[];if(u.length>0&&a.length>0){let t=[0];for(let e of i)t.push(t[t.length-1]+e.length+1);let n=Array.from({length:a.length},()=>-1);l.inlineElements=u.map(t=>({element:e,tracking:0,padLeft:0,padRight:0,insets:null,color:t.paint.color,backgroundColor:t.paint.backgroundColor,fontWeight:t.paint.fontWeight??``,fontStyle:t.paint.fontStyle??``,textDecorationLine:t.paint.textDecorationLine??``})),u.forEach((e,r)=>{let a=i[e.line];if(a===void 0)return;let o=Math.max(0,e.start),s=Math.min(a.length,e.end);for(let i=o;i<s;i++)n[t[e.line]+i]=r}),l.charInline=n}return l}var fo=new Set(`A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR`.split(`.`));function po(e,t){return t||(fo.has(e.tagName)?`inline`:`block`)}function mo(e,t){let n=po(e,t);return n===`inline`||n===`contents`}function ho(e,t){let n=po(e,t);return n.startsWith(`inline`)&&n!==`inline`}function go(e){let t=getComputedStyle(e);return t.display===`none`?`none`:t.position===`absolute`||t.position===`fixed`?`out-of-flow`:b(e.tagName)?`block`:mo(e,t.display)||ho(e,t.display)?`inline`:`block`}function _o(e,t,n,r){let i={chars:[],advances:[],sourceNode:[],sourceOffset:[],inlineIndex:[],inlineElements:[],boxes:[]};return r?yo(r,t,n,i):vo(e,t,n,i),n.preserve?i:So(i)}function vo(e,t,n,r){Ao(e.tagName)||yo(Array.from(e.childNodes),t,n,r)}function yo(e,t,n,r){let i=()=>{let e=0;for(let t=r.chars.length-1;t>=0&&r.chars[t]!==`
965
965
  `;t--)e+=r.advances[t];return e};for(let a of e)if(a.nodeType===Node.TEXT_NODE){if(n.preserve){let e=a.textContent??``,o=0;for(let s of Ie(e)){let e=o;if(o+=s.length,s===`\r
966
966
  `||s===`\r`||s===`
967
- `)fo(r,`
968
- `,0,a,e+s.length-1);else if(s===` `){let t=(Math.floor(i()/n.tabSize)+1)*n.tabSize;for(let n=i();n<t;n++)fo(r,` `,1,a,e)}else fo(r,s,Le(s,t),a,e)}}else{let e=0,n=!1;for(let i of Ie(a.textContent??``)){let o=i===` `||i===` `||i===`\r`||i===`
967
+ `)Co(r,`
968
+ `,0,a,e+s.length-1);else if(s===` `){let t=(Math.floor(i()/n.tabSize)+1)*n.tabSize;for(let n=i();n<t;n++)Co(r,` `,1,a,e)}else Co(r,s,Le(s,t),a,e)}}else{let e=0,n=!1;for(let i of Ie(a.textContent??``)){let o=i===` `||i===` `||i===`\r`||i===`
969
969
  `||i===`\f`||i===`\r
970
- `;o?n||fo(r,` `,1+t,a,e):fo(r,i,Le(i,t),a,e),n=o,e+=i.length}}}else if(a.nodeType===Node.ELEMENT_NODE){let e=a;if(e.tagName===`BR`){fo(r,`
971
- `,0,null,-1);continue}let t=getComputedStyle(e);if(t.display===`none`||t.position===`absolute`||t.position===`fixed`)continue;if(ro(e,t.display)){let t=Ya(e,n.rootFontSizePx,n.cellMetrics,n.textareaWidths);t&&(t.inlineBox=!0,fo(r,``,1,null,-1),r.boxes.push(t));continue}if(!no(e,t.display)){_o(e);continue}let i=va(t.letterSpacing,parseFloat(t.fontSize)||n.rootFontSizePx,n.rootLetterSpacingPx),o=co(t.paddingLeft,n.rootFontSizePx),s=co(t.paddingRight,n.rootFontSizePx);r.inlineElements.push({element:e,tracking:i,padLeft:o,padRight:s,insets:t.position===`static`?null:lo(t,n.rootFontSizePx),color:t.color,backgroundColor:Ki(t.backgroundColor)?void 0:t.backgroundColor,fontWeight:t.fontWeight,fontStyle:t.fontStyle,textDecorationLine:t.textDecorationLine});let c=r.inlineElements.length-1;for(let e=0;e<o;e++)r.inlineIndex[r.chars.length]=c,fo(r,`⁠`,1,null,-1);let l=r.chars.length;oo(e,i,n,r);for(let e=l;e<r.chars.length;e++)r.inlineIndex[e]===void 0&&(r.inlineIndex[e]=c);for(let e=0;e<s;e++)r.inlineIndex[r.chars.length]=c,fo(r,`⁠`,1,null,-1)}}function co(e,t){if(!e||e.endsWith(`%`))return 0;let n=parseFloat(e);return Number.isFinite(n)?Math.max(0,Ce(n,t)):0}function lo(e,t){let n=e=>{if(!e||e===`auto`||e.endsWith(`%`))return null;let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):null};return{top:n(e.top),right:n(e.right),bottom:n(e.bottom),left:n(e.left)}}function uo(e){let t=[],n=[],r=[],i=[],a=[],o=()=>{let e=t.length;for(;e>0&&t[e-1]!==`
970
+ `;o?n||Co(r,` `,1+t,a,e):Co(r,i,Le(i,t),a,e),n=o,e+=i.length}}}else if(a.nodeType===Node.ELEMENT_NODE){let e=a;if(e.tagName===`BR`){Co(r,`
971
+ `,0,null,-1);continue}let t=getComputedStyle(e);if(t.display===`none`||t.position===`absolute`||t.position===`fixed`)continue;if(ho(e,t.display)){let t=ro(e,n.rootFontSizePx,n.cellMetrics,n.textareaWidths);t&&(t.inlineBox=!0,Co(r,``,1,null,-1),r.boxes.push(t));continue}if(!mo(e,t.display)){Oo(e);continue}let i=Ea(t.letterSpacing,parseFloat(t.fontSize)||n.rootFontSizePx,n.rootLetterSpacingPx),o=bo(t.paddingLeft,n.rootFontSizePx),s=bo(t.paddingRight,n.rootFontSizePx);r.inlineElements.push({element:e,tracking:i,padLeft:o,padRight:s,insets:t.position===`static`?null:xo(t,n.rootFontSizePx),color:t.color,backgroundColor:ea(t.backgroundColor)?void 0:t.backgroundColor,fontWeight:t.fontWeight,fontStyle:t.fontStyle,textDecorationLine:t.textDecorationLine});let c=r.inlineElements.length-1;for(let e=0;e<o;e++)r.inlineIndex[r.chars.length]=c,Co(r,`⁠`,1,null,-1);let l=r.chars.length;vo(e,i,n,r);for(let e=l;e<r.chars.length;e++)r.inlineIndex[e]===void 0&&(r.inlineIndex[e]=c);for(let e=0;e<s;e++)r.inlineIndex[r.chars.length]=c,Co(r,`⁠`,1,null,-1)}}function bo(e,t){if(!e||e.endsWith(`%`))return 0;let n=parseFloat(e);return Number.isFinite(n)?Math.max(0,Ce(n,t)):0}function xo(e,t){let n=e=>{if(!e||e===`auto`||e.endsWith(`%`))return null;let n=parseFloat(e);return Number.isFinite(n)?Ce(n,t):null};return{top:n(e.top),right:n(e.right),bottom:n(e.bottom),left:n(e.left)}}function So(e){let t=[],n=[],r=[],i=[],a=[],o=()=>{let e=t.length;for(;e>0&&t[e-1]!==`
972
972
  `;)e--;return e},s=()=>{for(;t.length>o()&&t[t.length-1]===` `;)t.pop(),n.pop(),r.pop(),i.pop(),a.pop()};for(let o=0;o<e.chars.length;o++){let c=e.chars[o];if(c===` `){let e=t.length-1;for(;e>=0&&t[e]===`⁠`;)e--;if(e<0||t[e]===`
973
973
  `||t[e]===` `)continue}else c===`
974
- `&&s();t.push(c),n.push(e.advances[o]),r.push(e.sourceNode[o]??null),i.push(e.sourceOffset[o]??-1),a.push(e.inlineIndex[o]??-1)}return s(),{chars:t,advances:n,sourceNode:r,sourceOffset:i,inlineIndex:a,inlineElements:e.inlineElements,boxes:e.boxes}}function fo(e,t,n,r,i){e.chars.push(t),e.advances.push(n),e.sourceNode.push(r),e.sourceOffset.push(i)}function po(e){let t=[],n=[];for(let r=0;r<e.chars.length;r++){let i=e.inlineIndex[r]??-1;t.push(e.advances[r]),n.push(i);for(let a=1;a<e.chars[r].length;a++)t.push(0),n.push(i)}return{advances:t,charInline:n}}function mo(e){let t=[],n=0;for(let r=0;r<e.chars.length;r++){let i=e.chars[r],a=e.sourceNode[r],o=e.sourceOffset[r],s=t[t.length-1];a&&(s&&s.node===a&&s.offset+s.length===o?s.length+=i.length:t.push({index:n,length:i.length,node:a,offset:o})),n+=i.length}return t}function ho(e,t,n){let r=0,i=0;for(let a=0;a<=e.length;a++)(a===e.length||e[a]===`
975
- `)&&(r=Math.max(r,Ge(e,i,a,t,n)),i=a+1);return r}function go(e){return He(e).length}function _o(e){m(e,`A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.`)}function vo(e){return Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&/[^ \t\r\n\f]/.test(e.textContent??``))}var yo=`Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).`;function bo(e){return e===`INPUT`||e===`SELECT`||e===`TEXTAREA`}function xo(e,t){vo(e)&&(t.droppedText=!0,m(e,yo))}var So=`
974
+ `&&s();t.push(c),n.push(e.advances[o]),r.push(e.sourceNode[o]??null),i.push(e.sourceOffset[o]??-1),a.push(e.inlineIndex[o]??-1)}return s(),{chars:t,advances:n,sourceNode:r,sourceOffset:i,inlineIndex:a,inlineElements:e.inlineElements,boxes:e.boxes}}function Co(e,t,n,r,i){e.chars.push(t),e.advances.push(n),e.sourceNode.push(r),e.sourceOffset.push(i)}function wo(e){let t=[],n=[];for(let r=0;r<e.chars.length;r++){let i=e.inlineIndex[r]??-1;t.push(e.advances[r]),n.push(i);for(let a=1;a<e.chars[r].length;a++)t.push(0),n.push(i)}return{advances:t,charInline:n}}function To(e){let t=[],n=0;for(let r=0;r<e.chars.length;r++){let i=e.chars[r],a=e.sourceNode[r],o=e.sourceOffset[r],s=t[t.length-1];a&&(s&&s.node===a&&s.offset+s.length===o?s.length+=i.length:t.push({index:n,length:i.length,node:a,offset:o})),n+=i.length}return t}function Eo(e,t,n){let r=0,i=0;for(let a=0;a<=e.length;a++)(a===e.length||e[a]===`
975
+ `)&&(r=Math.max(r,Ge(e,i,a,t,n)),i=a+1);return r}function Do(e){return He(e).length}function Oo(e){m(e,`A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.`)}function ko(e){return Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&/[^ \t\r\n\f]/.test(e.textContent??``))}function Ao(e){return e===`INPUT`||e===`SELECT`||e===`TEXTAREA`}var jo=`
976
976
  <style>
977
977
  :host { display: block; position: relative; contain: layout style; }
978
978
  #viewport { position: relative; width: 100%; height: 100%; background: inherit; }
979
979
  /* The slot as a positioned box: the light DOM paints ABOVE the grid
980
980
  * (the elements are absolute; the host's own in-flow text, specs/host-leaf.md,
981
981
  * would otherwise sit under the <pre> and lose its selection ink) and
982
- * laid-out elements position against it — the same origin as #viewport. */
983
- slot { display: block; position: relative; }
984
- /* The host's own dropped direct text (specs/cell-model.md deviation 7)
985
- * hides through the slot; laid-out children re-declare visible in
986
- * styles.css. */
987
- :host([data-mw-dropped-text]) slot { visibility: hidden; }
982
+ * laid-out elements position against it — the same origin as #viewport.
983
+ * A block formatting context, so a flow child's top margin
984
+ * (specs/cell-model.md "Inline content") stays inside it, where the
985
+ * engine put the child. */
986
+ slot { display: flow-root; position: relative; }
988
987
  /* The unified grid: one <pre> with same-paint-run spans, cell-precise
989
988
  * (one monospace character = one cell). In select="grid" (the
990
989
  * default, reflected onto the attribute — see DEFAULT_SELECT) the
@@ -1008,12 +1007,11 @@ input:where([type='button'], [type='reset'], [type='submit']),
1008
1007
  * span paints without moving the line (specs/cell-model.md). */
1009
1008
  #grid span { padding-block: var(--mw-bgpad, 0px); }
1010
1009
  /* A shade's lattice runs on from row to row (specs/wide-characters.md):
1011
- * the box holds its glyph down by the row's phase, with copies a
1012
- * period above and below. */
1013
- #grid span[data-shade] { position: relative; box-sizing: border-box; }
1010
+ * copies a period above and below the glyph, in its own line box. */
1011
+ #grid span[data-shade] { position: relative; }
1014
1012
  #grid span[data-shade]::before, #grid span[data-shade]::after { content: attr(data-shade); position: absolute; inset-inline: 0; }
1015
- #grid span[data-shade]::before { top: calc(var(--mw-phase) - var(--mw-period)); }
1016
- #grid span[data-shade]::after { top: calc(var(--mw-phase) + var(--mw-period)); }
1013
+ #grid span[data-shade]::before { top: calc(-1 * var(--mw-period)); }
1014
+ #grid span[data-shade]::after { top: var(--mw-period); }
1017
1015
  :host([select="grid"]) #grid { pointer-events: auto; user-select: text; -webkit-user-select: text; }
1018
1016
  :host([select="grid"]) slot { pointer-events: none; user-select: none; -webkit-user-select: none; }
1019
1017
  /* A live semantic selection (specs/semantic-selection.md) lifts the
@@ -1030,8 +1028,8 @@ input:where([type='button'], [type='reset'], [type='submit']),
1030
1028
  <pre id="grid" aria-hidden="true"></pre>
1031
1029
  <slot></slot>
1032
1030
  </div>
1033
- `,Co=`grid`,wo=`tab`,To=`data-mw-semantic-selection`,Eo=`a, button, input, select, textarea, label, [tabindex], [role='button']`,Do=[`pointerover`,`pointerleave`,`pointerdown`,`pointerup`,`pointercancel`,`keydown`,`keyup`,`focusin`,`focusout`,`input`,`change`],Oo=/^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/,ko=3e4,Ao=200,jo=3,Mo=4,No=8,Po=100,Fo=160,Io=500,Lo=typeof HTMLElement>`u`?class{}:HTMLElement,Ro=class e extends Lo{static observedAttributes=[`select`,`focus`];static#e=new Set;static#t=null;static#n=()=>{for(let t of e.#e)t.#Ue()};static#r(t){t instanceof HTMLLinkElement&&t.rel===`stylesheet`&&!t.sheet&&t.addEventListener(`load`,e.#n,{once:!0})}static#i(t){if(e.#e.add(t),e.#t)return;for(let t of document.querySelectorAll(`link[rel=stylesheet]`))e.#r(t);let n=new MutationObserver(t=>{for(let n of t)for(let t of n.addedNodes)e.#r(t);e.#n()});n.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),e.#t=n}static#a(t){e.#e.delete(t),e.#e.size===0&&(e.#t?.disconnect(),e.#t=null)}#o;#s;#c;#l=null;#u=null;#d=!1;#f=null;#p=null;#m=null;#h=null;#g=!1;#_=[];#v=new Map;#y=new WeakMap;#b=null;#x=null;#S=``;#C=null;#w=!1;#T=0;#E=new wi((e,t,n)=>this.#j(e,t,n));#D=null;#O=!1;#k=[];#A(){this.#u?.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`style`,`colspan`,`rowspan`,`span`,...x()]})}constructor(){super(),this.#o=this.attachShadow({mode:`open`}),this.#o.innerHTML=So,this.#s=this.#o.getElementById(`grid`),this.#c=document.createElement(`span`),this.#c.setAttribute(`aria-hidden`,`true`),this.#c.setAttribute(`data-mw-probe`,``),this.#c.style.cssText=`position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;`,this.#c.textContent=`M`.repeat(100)}#j(e,t,n){let r=document.createElement(`span`);r.style.cssText=`display:inline-block;vertical-align:top;overflow:hidden;padding:0;height:${this.#f?.height??0}px;line-height:${n}px;font-size:${t*100}%`,r.textContent=e;let i=document.createElement(`span`);i.style.cssText=`display:inline-block;width:0;height:0;padding:0`,r.appendChild(i),this.#s.appendChild(r);let a=i.getBoundingClientRect().top-r.getBoundingClientRect().top;return r.remove(),a}connectedCallback(){this.hasAttribute(`select`)||this.setAttribute(`select`,Co),this.hasAttribute(`focus`)||this.setAttribute(`focus`,wo),this.#c.parentNode!==this&&this.appendChild(this.#c),this.#l=new ResizeObserver(()=>this.#Ue()),this.#l.observe(this),this.#$(),this.#l.observe(this.#c),window.addEventListener(`resize`,this.#ze),this.#u=new MutationObserver(()=>this.#Ue()),this.#A(),this.#m=S(()=>{this.#A(),this.#Ue()}),this.#h=i(()=>this.#Ue()),document.fonts?.ready.then(this.#Be).catch(e=>{console.warn(`[monowind] document.fonts.ready failed:`,e)}),document.fonts?.addEventListener(`loadingdone`,this.#Be);for(let e of Do)this.addEventListener(e,this.#Re);this.addEventListener(`transitionrun`,this.#Fe),this.addEventListener(`transitionend`,this.#Ie),this.addEventListener(`transitioncancel`,this.#Ie),this.addEventListener(`pointermove`,this.#ne),this.addEventListener(`pointerleave`,this.#Ee),this.addEventListener(`pointerdown`,this.#De),this.addEventListener(`scroll`,this.#J,{capture:!0,passive:!0}),this.addEventListener(`scrollend`,this.#Y,{capture:!0}),this.addEventListener(`wheel`,this.#Z,{passive:!1}),this.addEventListener(`copy`,this.#re),this.addEventListener(`mousedown`,this.#ie),this.addEventListener(`keydown`,this.#ae),document.addEventListener(`selectionchange`,this.#we),window.addEventListener(`pointerup`,this.#Oe),window.addEventListener(`pointercancel`,this.#Oe),document.addEventListener(`scroll`,this.#ke,{capture:!0,passive:!0}),e.#i(this),this.#Ue()}disconnectedCallback(){window.removeEventListener(`resize`,this.#ze),this.#l?.disconnect(),this.#u?.disconnect(),this.#l=null,this.#u=null,this.#m?.(),this.#m=null,this.#h?.(),this.#h=null,document.fonts?.removeEventListener(`loadingdone`,this.#Be);for(let e of Do)this.removeEventListener(e,this.#Re);this.removeEventListener(`transitionrun`,this.#Fe),this.removeEventListener(`transitionend`,this.#Ie),this.removeEventListener(`transitioncancel`,this.#Ie),this.#Me=0,this.removeEventListener(`pointermove`,this.#ne),this.removeEventListener(`pointerleave`,this.#Ee),this.removeEventListener(`pointerdown`,this.#De),this.removeEventListener(`scroll`,this.#J,{capture:!0}),this.removeEventListener(`scrollend`,this.#Y,{capture:!0}),this.removeEventListener(`wheel`,this.#Z),this.removeEventListener(`copy`,this.#re),this.removeEventListener(`keydown`,this.#ae),this.removeEventListener(`mousedown`,this.#ie),document.removeEventListener(`selectionchange`,this.#we);for(let e of this.#v.values())clearTimeout(e);this.#v.clear(),this.#x=null,this.#b=null,window.removeEventListener(`pointerup`,this.#Oe),window.removeEventListener(`pointercancel`,this.#Oe),document.removeEventListener(`scroll`,this.#ke,{capture:!0}),this.#L=null,this.#P=null,this.#F=!1,this.#I=!1,this.#Ae(),e.#a(this)}#M=new Set;#N=new Set;#P=null;#F=!1;#I=!1;#L=null;#R=NaN;#z=NaN;#B=null;static#V=typeof matchMedia>`u`?null:matchMedia(`(hover: hover)`);#H(){if(this.#g||this.#d)return;this.#g=!0;let e=!1,t=()=>{if(e)return;e=!0,this.#g=!1;let t=this.#f;this.isConnected&&this.#p&&t&&(this.#U(t),this.#I=!this.#Te(this.#p),this.#Ae())};requestAnimationFrame(t),setTimeout(t,50)}#U(e,t){for(let n of this.#_){let r=n.source,{maxX:i,maxY:a}=n.scrollRange,o=t?.get(r);n.scroll=o?{x:o.pinX?i:Math.min(o.x,i),y:o.pinY?a:Math.min(o.y,a)}:this.#W(n,e)}}#W(e,t){let n=e.source,{maxX:r,maxY:i}=e.scrollRange,a=e.scroll??{x:0,y:0};return{x:Bo(n,`x`,t.width,r,a.x),y:Bo(n,`y`,t.height,i,a.y)}}#G(){let e=new Map,t=this.#f;if(!t)return e;for(let n of this.#_){let r=n.source,{maxX:i,maxY:a}=n.scrollRange,{x:o,y:s}=this.#W(n,t);e.set(r,{top:r.scrollTop,left:r.scrollLeft,maxTop:r.scrollHeight-r.clientHeight,maxLeft:r.scrollWidth-r.clientWidth,x:o,y:s,pinX:i>0&&o>=i,pinY:a>0&&s>=a})}return e}#K(e){for(let t of this.#_){let n=t.source,r=e.get(n);if(!r)continue;let i=n.scrollTop,a=n.scrollLeft;r.pinY&&n.scrollHeight-n.clientHeight!==r.maxTop?n.scrollTop=n.scrollHeight:i!==r.top&&(n.scrollTop=r.top),r.pinX&&n.scrollWidth-n.clientWidth!==r.maxLeft?n.scrollLeft=n.scrollWidth:a!==r.left&&(n.scrollLeft=r.left)}}#q(e,t){clearTimeout(this.#v.get(e)),this.#v.set(e,setTimeout(()=>this.#X(e),t))}#J=e=>{let t=e.target;t instanceof HTMLElement&&t!==this&&t.hasAttribute(`data-mw-scroll`)&&(this.#H(),!(Date.now()-(this.#y.get(t)??0)<Ao)&&(!(`onscrollend`in window)||Date.now()-this.#T<Io?this.#q(t,Fo):clearTimeout(this.#v.get(t))))};#Y=e=>{let t=e.target;t instanceof HTMLElement&&t!==this&&t.hasAttribute(`data-mw-scroll`)&&(Date.now()-(this.#y.get(t)??0)<Ao||this.#q(t,Po))};#X(e){if(this.#x?.el===e)return;this.#H();let t=this.#f,n=this.#_.find(t=>t.source===e);if(!t||!n)return;let r=n.scrollRange,i=n.scroll??this.#W(n,t),a=i.y===r.maxY?e.scrollHeight-e.clientHeight:i.y*t.height,o=i.x===r.maxX?e.scrollWidth-e.clientWidth:i.x*t.width;(Math.abs(e.scrollTop-a)>.5||Math.abs(e.scrollLeft-o)>.5)&&e.scrollTo({top:a,left:o,behavior:`instant`})}#Z=e=>{if(this.getAttribute(`select`)!==`grid`)return;let t=this.#p,n=this.#f;if(!t||!n||this.#_.length===0)return;let r=e,i=r.deltaMode===1?n.height:r.deltaMode===2?this.clientHeight:1,a=r.deltaX*i,o=r.deltaY*i;if(!r.cancelable&&this.#Q(a,o))return;let{col:s,row:c}=this.#ee(r.clientX,r.clientY,n),l=Date.now(),u=Math.abs(a)+Math.abs(o);if(u===0){this.#b=null,r.preventDefault();return}let d=e=>{let t=e.scrollRange,n=e.source;return o!==0&&t.maxY>0&&(o>0&&n.scrollTop<n.scrollHeight-n.clientHeight-.5||o<0&&n.scrollTop>.5)||a!==0&&t.maxX>0&&(a>0&&n.scrollLeft<n.scrollWidth-n.clientWidth-.5||a<0&&n.scrollLeft>.5)},f=this.#b,p=Math.abs(a)>=Math.abs(o)?`x`:`y`,m=f!==null&&u>f.mag*1.25+1,h=f!==null&&(Math.abs(r.clientX-f.x)>jo||Math.abs(r.clientY-f.y)>jo),g=f!==null&&f.decayed>=No,_=f!==null&&l-f.at<Ao&&p===f.axis&&(h?u<=f.mag:!(g&&m)),v=null;if(_){if(f.decayed=u<=f.mag&&u>=f.mag*.5?f.decayed+1:g?f.decayed:0,f.mag=u,f.at=l,!f.el)return;v=this.#_.find(e=>e.source===f.el)??null}if(!v){let e=Pr(t,s,c);for(let t=e.length-1;t>=0;t--){let n=e[t].node;if(!n.scrollRange||Fr(n.source))continue;if(d(n)){v=n;break}let r=n.style.overscroll;if(o!==0&&!r.y||a!==0&&!r.x){v=n;break}}if(!v&&u<Mo){r.preventDefault();return}this.#b={el:v?v.source:null,x:r.clientX,y:r.clientY,axis:p,at:l,mag:u,decayed:0}}if(!v||(r.preventDefault(),!d(v)))return;let y=v.source,b=v.scrollRange,x={behavior:`instant`};o!==0&&b.maxY>0&&(x.top=o),a!==0&&b.maxX>0&&(x.left=a),y.scrollBy(x),this.#y.set(y,l),this.#q(y,Ao)};#Q(e,t){return this.#k.some(n=>t>0&&n.scrollTop<n.scrollHeight-n.clientHeight-.5||t<0&&n.scrollTop>.5||e>0&&n.scrollLeft<n.scrollWidth-n.clientWidth-.5||e<0&&n.scrollLeft>.5)}#$(){let e=this.parentElement;if(e&&this.#l){this.#l.observe(e);for(let t of e.children)t!==this&&this.#l.observe(t)}}#ee(e,t,n){if(!this.#B){let e=this.#s.getBoundingClientRect();this.#B={left:e.left,top:e.top}}return{col:Math.floor((e-this.#B.left)/n.width),row:Math.floor((t-this.#B.top)/n.height)}}#te(e,t){let n=this.#p,r=this.#f;if(!n||!r||this.#_.length===0)return null;let{col:i,row:a}=this.#ee(e,t,r),o=Pr(n,i,a);for(let n=o.length-1;n>=0;n--){let{node:s,x:c,y:l}=o[n],u=s.scrollRange;if(!u||Fr(s.source))continue;let d=s.source,{y:f,x:p}=jr(s,c,l);if(f&&u.maxY>0&&i>=f.col&&i<f.col+f.thick&&a>=f.row&&a<f.row+f.len){let e=Mr(f.len,u.sizeY,u.maxY,0).len,n=Math.max(1,(f.len-e)*r.height);return{el:d,axis:`y`,startClient:t,startPx:d.scrollTop,factor:u.maxY*r.height/n}}if(p&&u.maxX>0&&a>=p.row&&a<p.row+p.thick&&i>=p.col&&i<p.col+p.len){let t=Mr(p.len,u.sizeX,u.maxX,0).len,n=Math.max(1,(p.len-t)*r.width);return{el:d,axis:`x`,startClient:e,startPx:d.scrollLeft,factor:u.maxX*r.width/n}}}return null}#ne=e=>{if(Ho(e))return;let{clientX:t,clientY:n}=e,r=this.#x;if(r){let e=(r.axis===`y`?n:t)-r.startClient,i=r.startPx+e*r.factor;r.axis===`y`?r.el.scrollTop=i:r.el.scrollLeft=i;return}let i=!!(e.buttons&1);i&&this.#C&&this.#pe(this.#C,t,n),i&&this.#D&&this.#fe(this.#D,t,n),i&&this.#O&&!this.hasAttribute(`data-mw-dragging`)&&this.setAttribute(`data-mw-dragging`,``),this.#L={x:t,y:n};let a=this.#f;if(a){let{col:e,row:r}=this.#ee(t,n,a);if(e===this.#R&&r===this.#z)return}this.#Ae()};#re=e=>{let{clipboardData:t}=e,n=this.#p,r=this.#Ce();t&&n&&r&&(t.setData(`text/plain`,ci(n,r)),e.preventDefault())};#ie=e=>{let t=e;if(t.button!==0)return;let n=this.getAttribute(`select`),r=t.composedPath().includes(this.#s);if(n===`grid`){if(!r&&!this.#le(t.target))return}else if(n!==`text`||!this.#ge(t.target))return;let i=this.#S===`mouse`||this.#S===`pen`;if(t.detail<=1){if(t.detail!==1||(this.removeAttribute(To),!i))return;if(n===`text`){this.#he(t);return}let e=this.#se();(!r||e)&&(e?.blur(),this.#de(t));return}if(!i)return;let a=t.detail===2?`word`:`paragraph`,o=document.getSelection(),s=this.#p,c=this.#f;if(!o||!s||!c)return;let{col:l,row:u}=this.#ee(t.clientX,t.clientY,c),d=this.#_e(l,u,a);if(!d){this.removeAttribute(To),this.#C=null;return}t.preventDefault(),this.#se()?.blur(),this.#Se(d);let f=t.shiftKey&&o.anchorNode&&this.#Ce()?Wo({node:o.anchorNode,offset:o.anchorOffset}):d;this.#me(o,f,d),this.#C={unit:a,anchor:f}};#ae=e=>{let t=e;if(this.#T=Date.now(),this.getAttribute(`focus`)!==`arrows`)return;let n=zr(t.key);if(!n||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let r=this.#p,i=t.target;if(!r||!(i instanceof Element)||i===this||Jr(i,t.key,this.#Ve()))return;let a=Ur(r),o=Wr(a,i);if(!o)return;let s=Br(n,o,a.filter(e=>e.element!==i));s&&(t.preventDefault(),s.focus({preventScroll:!0}),s.scrollIntoView({block:`nearest`,inline:`nearest`}))};#oe(e,t,n){let r=[];for(let i of Array.from(this.children)){if(i===this.#c)continue;let a=Ya(i,e,t,n);a&&r.push(a)}return vo(this)?(this.hasAttribute(`data-mw-dropped-text`)||console.warn(`[monowind] ${yo}`,h(this)),this.setAttribute(`data-mw-dropped-text`,``)):this.removeAttribute(`data-mw-dropped-text`),{source:this,style:yt(),children:r,text:``,intrinsicWidth:0,intrinsicHeight:0,localRect:{x:0,y:0,width:0,height:0},unclampedHeight:0,resolvedPadding:bt()}}#se(){let e=document.activeElement;return e instanceof HTMLElement&&e!==document.body&&this.contains(e)?e:null}#ce(){return this.#F&&!this.#D}#le(e){return e instanceof Element&&e!==this&&this.contains(e)&&!e.matches(Eo)}#ue(e,t){let n=this.#f;if(!n)return null;let{col:r,row:i}=this.#ee(e,t,n),a=Pi(this.#s,r,i),o=Zr(this.#s,a);return o&&{offset:a,at:o}}#de(e){let t=this.#ue(e.clientX,e.clientY);t&&(e.preventDefault(),document.getSelection()?.setBaseAndExtent(...t.at,...t.at),this.#D={anchor:t.offset})}#fe(e,t,n){let r=Zr(this.#s,e.anchor),i=this.#ue(t,n);r&&i&&document.getSelection()?.setBaseAndExtent(...r,...i.at)}#pe(e,t,n){let r=this.#f,i=document.getSelection();if(!r||!i)return;let{col:a,row:o}=this.#ee(t,n,r),s=this.#_e(a,o,e.unit);s&&this.#me(i,e.anchor,s)}#me(e,t,n){if(Ko(t,n)){Go(e,n.start,n.end);return}let r=t.start.node.getRootNode()===n.start.node.getRootNode(),i=r?t:this.#xe(t),a=r?n:this.#xe(n);Yr(i.start.node,i.start.offset,a.start.node,a.start.offset)<=0?Go(e,i.start,a.end):Go(e,i.end,a.start)}#he(e){let t=document.getSelection(),n=this.#f;if(!t||!n)return;let{col:r,row:i}=this.#ee(e.clientX,e.clientY,n),a=this.#_e(r,i,`character`);if(!a)return;e.preventDefault(),this.#se()?.blur();let o=e.shiftKey&&t.anchorNode&&this.#Ce()?Wo({node:t.anchorNode,offset:t.anchorOffset}):Wo(a.start);this.#me(t,o,e.shiftKey?a:o),this.#C={unit:`character`,anchor:o}}#ge(e){if(e===this)return!0;if(!(e instanceof Element)||!this.contains(e))return!1;let t=e.closest(Eo);return!t||t===this||!this.contains(t)}#_e(e,t,n){let r=this.#p;if(!r)return null;if(n!==`character`)return this.#ve(r,e,t,n);let{width:i,height:a}=r.localRect;for(let{x:n,y:o,edge:s}of Lr(i,a,e,t)){if(s===`self`){let e=Pr(r,n,o).at(-1);if(e&&Fr(e.node.source))return null}let e=Ai(this.#s,n,o);if(e===void 0||e===` `&&s!==`self`)continue;let t=this.#ve(r,n,o,`character`);if(t)return s===`self`?t:Wo(s===`start`?t.start:t.end)}return null}#ve(e,t,n,r){let i=Pr(e,t,n);for(let e=i.length-1;e>=0;e--){let{node:a,x:o,y:s}=i[e];if(hi(a))return Fr(a.source)?null:this.#ye(a,o,s,t,n,r)}return hi(e)?this.#ye(e,0,0,t,n,r):null}#ye(e,t,n,r,i,a){let o=kr(e,t,n,r,i);if(o===null||a===`character`&&e.text[o]===`⁠`)return null;if(a===`character`){let t=o+1;for(;t<e.text.length&&e.advances?.[t]===0&&e.text[t]!==`
1034
- `;)t++;let n=ti(e,o),r=ti(e,t);if(n&&r)return{start:n,end:r}}if(a===`word`){let t=b(e.source.tagName)?He(e.text).find(e=>o>=e.start&&o<e.end):yi(e,o),n=t&&ti(e,t.start),r=t&&ti(e,t.end);if(n&&r)return{start:n,end:r}}return this.#be(e)}#be(e){if(e===this.#p)return mi(e);let t=b(e.source.tagName)?.selectionTarget?.(e.source)??e.source;return{start:{node:t,offset:0},end:{node:t,offset:t.childNodes.length}}}#xe(e){let t=e.start.node.getRootNode();if(!(t instanceof ShadowRoot)||t===this.#s.getRootNode())return e;let n=t.host,r=n.parentNode;if(!r)return e;let i=Array.prototype.indexOf.call(r.childNodes,n),a=n.previousSibling,o=n.nextSibling;return{start:Uo(a)?{node:a,offset:a instanceof Text?a.length:a.childNodes.length}:{node:r,offset:i},end:Uo(o)?{node:o,offset:0}:{node:r,offset:i+1}}}#Se(e){this.setAttribute(To,``);let t=e.start.node,n=t instanceof Element?t:t.parentElement;n&&getComputedStyle(n).userSelect}#Ce(){let e=this.#p,t=ni(this.#s.getRootNode(),e?ai(e):[]);return!t||ri(this,this.#s,t)!==`light`||t.startContainer===t.endContainer&&t.startOffset===t.endOffset?null:t}#we=()=>{let e=this.#Ce()!==null;this.hasAttribute(To)&&!e&&this.removeAttribute(To),(e||this.#w)&&this.#p&&this.#H(),this.#w=e};#Te(e){let t=this.#Ce();return Oi(e,this.#s,{holdStructural:this.#ce(),glyphs:this.#E,selection:t?si(e,t):void 0})}#Ee=()=>{this.#L=null,this.#Ae()};#De=e=>{let t=e;if(!t.isPrimary||t.button!==0||(this.#S=t.pointerType,Ho(t)))return;let n=this.#te(t.clientX,t.clientY);if(n){this.#x=n,t.preventDefault(),t.isTrusted&&this.setPointerCapture(t.pointerId);return}this.#L={x:t.clientX,y:t.clientY},this.#F=!0,this.#O=t.composedPath().includes(this.#s),this.#Ae(!0)};#Oe=e=>{if(e.isPrimary){if(this.#C=null,this.#D=null,this.#O=!1,this.removeAttribute(`data-mw-dragging`),this.#x){this.#X(this.#x.el),this.#x=null;return}(this.#F||this.#P)&&(this.#F=!1,this.#P=null,this.#Ae(),this.#I&&this.#Ue())}};#ke=e=>{if(!this.#L)return;let t=e.target;t instanceof HTMLElement&&t.hasAttribute(`data-mw-scroll`)||(this.#B=null,this.#Ae())};#Ae(t=!1){let n=this.#p,r=this.#f,i=[];if(this.#L&&n&&r&&this.isConnected&&this.getAttribute(`select`)===`grid`&&(this.#F||e.#V?.matches)){let{col:e,row:t}=this.#ee(this.#L.x,this.#L.y,r);this.#R=e,this.#z=t,i=Ir(n,e,t)}else this.#R=NaN,this.#z=NaN;let a=i.at(-1)??null;t&&(this.#P=a);let o=e.#V?.matches?i:[],s=this.#P?i.indexOf(this.#P):-1,c=s>=0?i.slice(0,s+1):[],l=this.#je(`data-mw-hover`,this.#M,o);l=this.#je(`data-mw-active`,this.#N,c)||l;let u=a?getComputedStyle(a).cursor:``;this.#s.style.cursor=u===`auto`?``:u,l&&this.isConnected&&this.#Ue()}#je(e,t,n){let r=!1,i=new Set(n);for(let n of t)i.has(n)||(n.removeAttribute(e),r=!0);for(let n of i)t.has(n)||(n.setAttribute(e,``),r=!0);t.clear();for(let e of i)t.add(e);return r}#Me=0;#Ne=!1;#Pe=0;#Fe=e=>{Oo.test(e.propertyName)&&(this.#Me++,this.#Pe=performance.now(),this.#Le())};#Ie=e=>{Oo.test(e.propertyName)&&(this.#Me=Math.max(0,this.#Me-1))};#Le(){if(this.#Ne)return;this.#Ne=!0;let e=()=>{if(!this.isConnected||this.#Me===0&&!k()||performance.now()-this.#Pe>ko){this.#Ne=!1,this.#Me=0,this.#Ue();return}this.#He(),requestAnimationFrame(e)};requestAnimationFrame(e)}#Re=e=>{if(!Ho(e)){if(e.type===`keydown`||e.type===`keyup`){let{key:t,target:n}=e,r=n instanceof Element&&n.hasAttribute(`data-mw-scroll`);if(t!==`Enter`&&(t!==` `||r))return}if((e.type===`focusin`||e.type===`focusout`)&&e.target instanceof HTMLSelectElement){this.#He();return}this.#Ue()}};attributeChangedCallback(e,t,n){if(e===`focus`){n!==`tab`&&n!==`arrows`&&(n!==null&&console.warn(`[monowind] Ignoring unrecognized focus="${n}". Expected "tab" (default) or "arrows".`,h(this)),this.setAttribute(`focus`,wo));return}if(e===`select`&&n!==`text`&&n!==`grid`){n!==null&&console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`,h(this)),this.setAttribute(`select`,Co);return}e===`select`&&this.#Ae(),this.#Ue()}toPlainText(){return this.#d&&this.#We(),this.#p?vr(this.#p):``}#ze=()=>{this.#Ue()};#Be=()=>{requestAnimationFrame(()=>{this.#E.invalidate(),this.#Ue()})};#Ve(){let e=document.activeElement;if(!(e instanceof HTMLSelectElement)||!this.contains(e))return!1;try{return e.matches(`:open`)}catch{return!1}}#He(){try{this.#We()}catch(e){console.error(`[monowind] layout failed:`,e)}}#Ue(){this.#d||(this.#d=!0,requestAnimationFrame(()=>{if(this.#d=!1,this.#Ve()){this.#Ue();return}this.#He()}))}#We(){if(!this.isConnected)return;let e=this.#G(),t=new Map,n=getComputedStyle(this).getPropertyValue(`--mw-cw`).trim(),r=parseFloat(n);if(Number.isFinite(r)&&r>0)for(let e of this.querySelectorAll(`textarea`)){let n=getComputedStyle(e),i=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0);t.set(e,Math.max(0,Math.round(i/r)))}this.setAttribute(`measuring`,``);try{this.#c.parentNode!==this&&this.appendChild(this.#c);let n=F(this,this.#c),r=this.#f;(r===null||r.width!==n.width||r.height!==n.height||r.letterSpacing!==n.letterSpacing||r.gridLetterSpacing!==n.gridLetterSpacing||r.inkOverhang!==n.inkOverhang||r.backgroundGap!==n.backgroundGap)&&(this.style.setProperty(`--mw-cw`,`${n.width}px`),this.style.setProperty(`--mw-ch`,`${n.height}px`),this.style.setProperty(`--mw-rls`,`${n.letterSpacing}px`),this.style.setProperty(`--mw-ink`,`${n.inkOverhang??0}px`),this.style.setProperty(`--mw-bgpad`,`${Math.ceil((n.backgroundGap??0)/2)}px`),this.#s.style.lineHeight=`${n.height}px`,this.#s.style.letterSpacing=`${n.gridLetterSpacing??n.letterSpacing}px`),this.#f=n;let i=getComputedStyle(this.#s);this.#E.configure({style:i.fontStyle,weight:i.fontWeight,size:i.fontSize,family:i.fontFamily},{width:n.width,height:n.height,letterSpacing:n.gridLetterSpacing??n.letterSpacing});let a=getComputedStyle(this),o=(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0),s=Math.max(0,Math.floor((this.clientWidth-o)/n.width));if(s===0)return;let c=I(),l=Xa(this,c,n,t)??this.#oe(c,n,t),{height:u}=Wn(l,s);Ri(l),this.#_=qo(l),this.#U(n,e),this.#I=!this.#Te(l),this.#p=l;let d=`${l.localRect.width*n.width}px`,f=`${l.localRect.height*n.height}px`;this.#s.style.width!==d&&(this.#s.style.width=d),this.#s.style.height!==f&&(this.#s.style.height=f);let p=a.boxSizing===`border-box`?(parseFloat(a.paddingTop)||0)+(parseFloat(a.paddingBottom)||0)+(parseFloat(a.borderTopWidth)||0)+(parseFloat(a.borderBottomWidth)||0):0,m=`${u*n.height+p}px`;this.style.height!==m&&(this.style.height=m);let h=a.boxSizing===`border-box`?o+(parseFloat(a.borderLeftWidth)||0)+(parseFloat(a.borderRightWidth)||0):0,g=`${s*n.width+h}px`;this.style.getPropertyValue(`--mw-host-w`)!==g&&this.style.setProperty(`--mw-host-w`,g),this.hasAttribute(`data-mw-ready`)||this.setAttribute(`data-mw-ready`,``)}finally{this.setAttribute(`settling`,``),this.removeAttribute(`measuring`),getComputedStyle(this).transitionProperty,this.removeAttribute(`settling`),this.#K(e),this.#u?.takeRecords(),ee(this)&&(k()?(this.#Pe=performance.now(),this.#Le()):this.#Ue()),this.#$(),this.#k=[];let t=document.scrollingElement??document.documentElement;for(let e=this.parentElement;e;e=e.parentElement)(e===t||/auto|scroll/.test(getComputedStyle(e).overflow))&&this.#k.push(e);this.#B=null,this.#L&&this.#Ae()}}};function zo(){typeof customElements>`u`||customElements.get(`mono-wind`)||customElements.define(`mono-wind`,Ro)}function Bo(e,t,n,r,i){return Vo(t===`y`?e.scrollTop:e.scrollLeft,t===`y`?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth,n,r,i)}function Vo(e,t,n,r,i){if(r>0&&e>0&&e>=t-1)return r;let a=e/n-i,o=Math.abs(a)<=.5?i:i+Math.sign(a)*Math.round(Math.abs(a));return Math.min(Math.max(0,o),r)}function Ho(e){return e instanceof PointerEvent&&e.pointerType===`touch`&&e.type!==`pointerup`}function Uo(e){return e!==null&&!(e instanceof Element&&e.shadowRoot)}function Wo(e){return{start:e,end:e}}function Go(e,t,n){e.setBaseAndExtent(t.node,t.offset,n.node,n.offset)}function Ko(e,t){return e.start.node===t.start.node&&e.start.offset===t.start.offset&&e.end.node===t.end.node&&e.end.offset===t.end.offset}function qo(e){let t=[],n=e=>{e.scrollRange&&t.push(e);for(let t of e.children)n(t)};return n(e),t}var Jo=`/* Gap decorations (specs/gap-decorations.md): css-gaps-1 rules for flex
1031
+ `,Mo=`grid`,No=`tab`,Po=`data-mw-semantic-selection`,Fo=`a, button, input, select, textarea, label, [tabindex], [role='button']`,Io=[`pointerover`,`pointerleave`,`pointerdown`,`pointerup`,`pointercancel`,`keydown`,`keyup`,`focusin`,`focusout`,`input`,`change`],Lo=/^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/,Ro=3e4,zo=200,Bo=3,Vo=4,Ho=8,Uo=100,Wo=160,Go=500,Ko=50;function qo(e,t,n){return n>0&&e.scrollTop<e.scrollHeight-e.clientHeight-.5||n<0&&e.scrollTop>.5||t>0&&e.scrollLeft<e.scrollWidth-e.clientWidth-.5||t<0&&e.scrollLeft>.5}function Jo(e,t,n){let{maxX:r,maxY:i}=e.scrollRange,a=e.source;return n!==0&&i>0&&qo(a,0,n)||t!==0&&r>0&&qo(a,t,0)}function Yo(e){let t=e.getBoundingClientRect();return new DOMRectReadOnly(t.left+e.clientLeft,t.top+e.clientTop,e.clientWidth,e.clientHeight)}var Xo=typeof HTMLElement>`u`?class{}:HTMLElement,Zo=class e extends Xo{static observedAttributes=[`select`,`focus`];static#e=new Set;static#t=null;static#n=()=>{for(let t of e.#e)t.#et()};static#r(t){t instanceof HTMLLinkElement&&t.rel===`stylesheet`&&!t.sheet&&t.addEventListener(`load`,e.#n,{once:!0})}static#i(t){if(e.#e.add(t),e.#t)return;for(let t of document.querySelectorAll(`link[rel=stylesheet]`))e.#r(t);let n=new MutationObserver(t=>{for(let n of t)for(let t of n.addedNodes)e.#r(t);e.#n()});n.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),e.#t=n}static#a(t){e.#e.delete(t),e.#e.size===0&&(e.#t?.disconnect(),e.#t=null)}#o;#s;#c;#l=null;#u=null;#d=!1;#f=null;#p=null;#m=null;#h=null;#g=!1;#_=[];#v=new Map;#y=new WeakMap;#b=null;#x=null;#S=``;#C=-1;#w=null;#T=null;#E=!1;#D=!1;#O=!1;#k=0;#A=new Mi((e,t,n)=>this.#F(e,t,n));#j=null;#M=!1;#N=[];#P(){this.#u?.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`style`,`colspan`,`rowspan`,`span`,...x()]})}constructor(){super(),this.#o=this.attachShadow({mode:`open`}),this.#o.innerHTML=jo,this.#s=this.#o.getElementById(`grid`),this.#c=document.createElement(`span`),this.#c.setAttribute(`aria-hidden`,`true`),this.#c.setAttribute(`data-mw-probe`,``),this.#c.style.cssText=`position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;`,this.#c.textContent=`M`.repeat(100)}#F(e,t,n){let r=document.createElement(`span`);r.style.cssText=`display:inline-block;vertical-align:top;overflow:hidden;padding:0;height:${this.#f?.height??0}px;line-height:${n}px;font-size:${t*100}%`,r.textContent=e;let i=document.createElement(`span`);i.style.cssText=`display:inline-block;width:0;height:0;padding:0`,r.appendChild(i),this.#s.appendChild(r);let a=i.getBoundingClientRect().top-r.getBoundingClientRect().top;return r.remove(),a}connectedCallback(){this.hasAttribute(`select`)||this.setAttribute(`select`,Mo),this.hasAttribute(`focus`)||this.setAttribute(`focus`,No),this.#c.parentNode!==this&&this.appendChild(this.#c),this.#l=new ResizeObserver(()=>this.#et()),this.#l.observe(this),this.#ae(),this.#l.observe(this.#c),window.addEventListener(`resize`,this.#Xe),this.#u=new MutationObserver(()=>this.#et()),this.#P(),this.#m=S(()=>{this.#P(),this.#et()}),this.#h=i(()=>this.#et()),document.fonts?.ready.then(this.#Ze).catch(e=>{console.warn(`[monowind] document.fonts.ready failed:`,e)}),document.fonts?.addEventListener(`loadingdone`,this.#Ze);for(let e of Io)this.addEventListener(e,this.#Ye);this.addEventListener(`transitionrun`,this.#Ke),this.addEventListener(`transitionend`,this.#qe),this.addEventListener(`transitioncancel`,this.#qe),this.addEventListener(`pointermove`,this.#ce),this.addEventListener(`pointerleave`,this.#Ie),this.addEventListener(`pointerdown`,this.#Le),this.addEventListener(`scroll`,this.#$,{capture:!0,passive:!0}),this.addEventListener(`scrollend`,this.#ee,{capture:!0}),this.addEventListener(`wheel`,this.#ne,{passive:!1}),this.addEventListener(`copy`,this.#le),this.addEventListener(`mousedown`,this.#ue),this.addEventListener(`keydown`,this.#he),document.addEventListener(`selectionchange`,this.#Pe),window.addEventListener(`pointerup`,this.#Re),window.addEventListener(`pointercancel`,this.#Re),window.addEventListener(`mouseup`,this.#ze,{capture:!0}),document.addEventListener(`scroll`,this.#Be,{capture:!0,passive:!0}),e.#i(this),this.#et()}disconnectedCallback(){window.removeEventListener(`resize`,this.#Xe),this.#l?.disconnect(),this.#u?.disconnect(),this.#l=null,this.#u=null,this.#m?.(),this.#m=null,this.#h?.(),this.#h=null,document.fonts?.removeEventListener(`loadingdone`,this.#Ze);for(let e of Io)this.removeEventListener(e,this.#Ye);this.removeEventListener(`transitionrun`,this.#Ke),this.removeEventListener(`transitionend`,this.#qe),this.removeEventListener(`transitioncancel`,this.#qe),this.#Ue=0,this.removeEventListener(`pointermove`,this.#ce),this.removeEventListener(`pointerleave`,this.#Ie),this.removeEventListener(`pointerdown`,this.#Le),this.removeEventListener(`scroll`,this.#$,{capture:!0}),this.removeEventListener(`scrollend`,this.#ee,{capture:!0}),this.removeEventListener(`wheel`,this.#ne),this.removeEventListener(`copy`,this.#le),this.removeEventListener(`keydown`,this.#he),this.removeEventListener(`mousedown`,this.#ue),document.removeEventListener(`selectionchange`,this.#Pe);for(let e of this.#v.values())clearTimeout(e);this.#v.clear(),this.#x=null,this.#b=null,this.#pe(),window.removeEventListener(`pointerup`,this.#Re),window.removeEventListener(`pointercancel`,this.#Re),window.removeEventListener(`mouseup`,this.#ze,{capture:!0}),document.removeEventListener(`scroll`,this.#Be,{capture:!0}),this.#V=null,this.#R=null,this.#z=!1,this.#B=!1,this.#D=!1,this.#Ve(),e.#a(this)}#I=new Set;#L=new Set;#R=null;#z=!1;#B=!1;#V=null;#H=NaN;#U=NaN;#W=null;static#G=typeof matchMedia>`u`?null:matchMedia(`(hover: hover)`);#K(){if(this.#g||this.#d)return;this.#g=!0;let e=!1,t=()=>{if(e)return;e=!0,this.#g=!1;let t=this.#f;this.isConnected&&this.#p&&t&&(this.#q(t),this.#B=!this.#Fe(this.#p),this.#J(),this.#Ve())};requestAnimationFrame(t),setTimeout(t,50)}#q(e,t){for(let n of this.#_){let r=n.source,{maxX:i,maxY:a}=n.scrollRange,o=t?.get(r);n.scroll=o?{x:o.pinX?i:Math.min(o.x,i),y:o.pinY?a:Math.min(o.y,a)}:this.#Y(n,e)}}#J(){this.#E&&(this.#E=!1,this.#me())}#Y(e,t){let n=e.source,{maxX:r,maxY:i}=e.scrollRange,a=e.scroll??{x:0,y:0};return{x:$o(n,`x`,t.width,r,a.x),y:$o(n,`y`,t.height,i,a.y)}}#X(){let e=new Map,t=this.#f;if(!t)return e;for(let n of this.#_){let r=n.source,{maxX:i,maxY:a}=n.scrollRange,{x:o,y:s}=this.#Y(n,t);e.set(r,{top:r.scrollTop,left:r.scrollLeft,maxTop:r.scrollHeight-r.clientHeight,maxLeft:r.scrollWidth-r.clientWidth,x:o,y:s,pinX:i>0&&o>=i,pinY:a>0&&s>=a})}return e}#Z(e){for(let t of this.#_){let n=t.source,r=e.get(n);if(!r)continue;let i=n.scrollTop,a=n.scrollLeft;r.pinY&&n.scrollHeight-n.clientHeight!==r.maxTop?n.scrollTop=n.scrollHeight:i!==r.top&&(n.scrollTop=r.top),r.pinX&&n.scrollWidth-n.clientWidth!==r.maxLeft?n.scrollLeft=n.scrollWidth:a!==r.left&&(n.scrollLeft=r.left)}}#Q(e,t){clearTimeout(this.#v.get(e)),this.#v.set(e,setTimeout(()=>this.#te(e),t))}#$=e=>{let t=e.target;t instanceof HTMLElement&&t!==this&&t.hasAttribute(`data-mw-scroll`)&&(this.#E=!0,this.#K(),!(Date.now()-(this.#y.get(t)??0)<zo)&&(!(`onscrollend`in window)||Date.now()-this.#k<Go?this.#Q(t,Wo):clearTimeout(this.#v.get(t))))};#ee=e=>{let t=e.target;t instanceof HTMLElement&&t!==this&&t.hasAttribute(`data-mw-scroll`)&&(Date.now()-(this.#y.get(t)??0)<zo||this.#Q(t,Uo))};#te(e){if(this.#x?.el===e)return;this.#K();let t=this.#f,n=this.#_.find(t=>t.source===e);if(!t||!n)return;let r=n.scrollRange,i=n.scroll??this.#Y(n,t),a=i.y===r.maxY?e.scrollHeight-e.clientHeight:i.y*t.height,o=i.x===r.maxX?e.scrollWidth-e.clientWidth:i.x*t.width;(Math.abs(e.scrollTop-a)>.5||Math.abs(e.scrollLeft-o)>.5)&&e.scrollTo({top:a,left:o,behavior:`instant`})}#ne=e=>{if(this.getAttribute(`select`)!==`grid`)return;let t=this.#p,n=this.#f;if(!t||!n||this.#_.length===0)return;let r=e,i=r.deltaMode===1?n.height:r.deltaMode===2?this.clientHeight:1,a=r.deltaX*i,o=r.deltaY*i;if(!r.cancelable&&this.#ie(a,o))return;let{col:s,row:c}=this.#oe(r.clientX,r.clientY,n),l=Date.now(),u=Math.abs(a)+Math.abs(o);if(u===0){this.#b=null,r.preventDefault();return}let d=e=>Jo(e,a,o),f=this.#b,p=Math.abs(a)>=Math.abs(o)?`x`:`y`,m=f!==null&&u>f.mag*1.25+1,h=f!==null&&(Math.abs(r.clientX-f.x)>Bo||Math.abs(r.clientY-f.y)>Bo),g=f!==null&&f.decayed>=Ho,_=f!==null&&l-f.at<zo&&p===f.axis&&(h?u<=f.mag:!(g&&m)),v=null;if(_){if(f.decayed=u<=f.mag&&u>=f.mag*.5?f.decayed+1:g?f.decayed:0,f.mag=u,f.at=l,!f.el)return;v=this.#_.find(e=>e.source===f.el)??null}if(!v){let e=Lr(t,s,c);for(let t=e.length-1;t>=0;t--){let n=e[t].node;if(!n.scrollRange||zr(n.source))continue;if(d(n)){v=n;break}let r=n.style.overscroll;if(o!==0&&!r.y||a!==0&&!r.x){v=n;break}}if(!v&&u<Vo){r.preventDefault();return}this.#b={el:v?v.source:null,x:r.clientX,y:r.clientY,axis:p,at:l,mag:u,decayed:0}}if(!v||(r.preventDefault(),!d(v)))return;let y=v.scrollRange;this.#re(v.source,y.maxX>0?a:0,y.maxY>0?o:0)};#re(e,t,n){let r={behavior:`instant`};t!==0&&(r.left=t),n!==0&&(r.top=n),e.scrollBy(r),e.hasAttribute(`data-mw-scroll`)&&(this.#y.set(e,Date.now()),this.#Q(e,zo))}#ie(e,t){return this.#N.some(n=>qo(n,e,t))}#ae(){let e=this.parentElement;if(e&&this.#l){this.#l.observe(e);for(let t of e.children)t!==this&&this.#l.observe(t)}}#oe(e,t,n){if(!this.#W){let e=this.#s.getBoundingClientRect();this.#W={left:e.left,top:e.top}}return{col:Math.floor((e-this.#W.left)/n.width),row:Math.floor((t-this.#W.top)/n.height)}}#se(e,t){let n=this.#p,r=this.#f;if(!n||!r||this.#_.length===0)return null;let{col:i,row:a}=this.#oe(e,t,r),o=Lr(n,i,a);for(let n=o.length-1;n>=0;n--){let{node:s,x:c,y:l}=o[n],u=s.scrollRange;if(!u||zr(s.source))continue;let d=s.source,{y:f,x:p}=Nr(s,c,l);if(f&&u.maxY>0&&i>=f.col&&i<f.col+f.thick&&a>=f.row&&a<f.row+f.len){let e=Pr(f.len,u.sizeY,u.maxY,0).len,n=Math.max(1,(f.len-e)*r.height);return{el:d,axis:`y`,startClient:t,startPx:d.scrollTop,factor:u.maxY*r.height/n}}if(p&&u.maxX>0&&a>=p.row&&a<p.row+p.thick&&i>=p.col&&i<p.col+p.len){let t=Pr(p.len,u.sizeX,u.maxX,0).len,n=Math.max(1,(p.len-t)*r.width);return{el:d,axis:`x`,startClient:e,startPx:d.scrollLeft,factor:u.maxX*r.width/n}}}return null}#ce=e=>{if(ts(e))return;let{clientX:t,clientY:n}=e,r=this.#x;if(r){let e=(r.axis===`y`?n:t)-r.startClient,i=r.startPx+e*r.factor;r.axis===`y`?r.el.scrollTop=i:r.el.scrollLeft=i;return}let i=!!(e.buttons&1);i&&this.#w&&this.#Ce(this.#w,t,n),i&&this.#j&&this.#Se(this.#j,t,n),i&&this.#M&&!this.hasAttribute(`data-mw-dragging`)&&this.setAttribute(`data-mw-dragging`,``),this.#V={x:t,y:n};let a=this.#f;if(a){let{col:e,row:r}=this.#oe(t,n,a);if(e===this.#H&&r===this.#U)return}this.#Ve()};#le=e=>{let{clipboardData:t}=e,n=this.#p,r=this.#Ne();t&&n&&r&&(t.setData(`text/plain`,pi(n,r)),e.preventDefault())};#ue=e=>{let t=e;if(t.button!==0)return;let n=this.getAttribute(`select`),r=t.composedPath().includes(this.#s);if(n===`grid`){if(!r&&!this.#ye(t.target))return}else if(n!==`text`||!this.#Ee(t.target))return;let i=this.#S===`mouse`||this.#S===`pen`;if(t.detail<=1){if(t.detail!==1||(this.removeAttribute(Po),!i))return;if(n===`text`){this.#Te(t),this.#de(t);return}let e=this.#_e();(!r||e)&&(e?.blur(),this.#xe(t));return}if(!i)return;let a=t.detail===2?`word`:`paragraph`,o=document.getSelection(),s=this.#p,c=this.#f;if(!o||!s||!c)return;let{col:l,row:u}=this.#oe(t.clientX,t.clientY,c),d=this.#Oe(s,l,u,a);if(!d){this.removeAttribute(Po),this.#w=null;return}t.preventDefault(),this.#_e()?.blur(),this.#Me(d);let f=t.shiftKey&&o.anchorNode&&this.#Ne()?rs({node:o.anchorNode,offset:o.anchorOffset}):d;this.#we(o,f,d),this.#w={unit:a,anchor:f},this.#de(t)};#de(e){let t=this.#p,n=this.#f;if(!this.#w||!t||!n)return;this.#pe(),e.isTrusted&&this.setPointerCapture(this.#C);let{col:r,row:i}=this.#oe(e.clientX,e.clientY,n),a=Lr(t,r,i),o=null;for(let e=a.length-1;e>=0&&!o;e--){let{node:t}=a[e];t.scrollRange&&!zr(t.source)&&(o=t.source)}let s=this.#N[0],c=o??s??document.scrollingElement??document.documentElement,l=setInterval(()=>this.#fe(),Ko);this.#T={el:c,page:!o&&!s,timer:l}}#fe(){let e=this.#T,t=this.#f,n=this.#V;if(!e||!t||!n||!this.#z)return;let{el:r,page:i}=e,a=Vr(i?new DOMRectReadOnly(0,0,r.clientWidth,r.clientHeight):Yo(r),n,t),o=this.#_.find(e=>e.source===r),s=(e,t)=>o?Jo(o,e,t):qo(r,e,t),c=a.x*t.width,l=a.y*t.height,u=s(c,0)?c:0,d=s(0,l)?l:0;(u!==0||d!==0)&&this.#re(r,u,d)}#pe(){this.#T&&=(clearInterval(this.#T.timer),null)}#me(){let e=this.#w,t=this.#V;e&&t&&this.#z&&this.#Ce(e,t.x,t.y)}#he=e=>{let t=e;if(this.#k=Date.now(),this.getAttribute(`focus`)!==`arrows`)return;let n=Wr(t.key);if(!n||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;let r=this.#p,i=t.target;if(!r||!(i instanceof Element)||i===this||$r(i,t.key,this.#Qe()))return;let a=Jr(r),o=Yr(a,i);if(!o)return;let s=Gr(n,o,a.filter(e=>e.element!==i));s&&(t.preventDefault(),s.focus({preventScroll:!0}),s.scrollIntoView({block:`nearest`,inline:`nearest`}))};#ge(e,t,n){let r=Array.from(this.childNodes).filter(e=>e!==this.#c),i=so(this,e,t);return{source:this,style:i,children:io(this,r,e,t,n,i),text:``,intrinsicWidth:0,intrinsicHeight:0,localRect:{x:0,y:0,width:0,height:0},unclampedHeight:0,resolvedPadding:bt()}}#_e(){let e=document.activeElement;return e instanceof HTMLElement&&e!==document.body&&this.contains(e)?e:null}#ve(){return this.#z&&!this.#j}#ye(e){return e instanceof Element&&e!==this&&this.contains(e)&&!e.matches(Fo)}#be(e,t){let n=this.#f;if(!n)return null;let{col:r,row:i}=this.#oe(e,t,n),a=Hi(this.#s,r,i),o=ni(this.#s,a);return o&&{offset:a,at:o}}#xe(e){let t=this.#be(e.clientX,e.clientY);t&&(e.preventDefault(),document.getSelection()?.setBaseAndExtent(...t.at,...t.at),this.#j={anchor:t.offset})}#Se(e,t,n){let r=ni(this.#s,e.anchor),i=this.#be(t,n);r&&i&&document.getSelection()?.setBaseAndExtent(...r,...i.at)}#Ce(e,t,n){let r=this.#f,i=document.getSelection();if(!r||!i)return;let{col:a,row:o}=this.#oe(t,n,r),s=this.#De(a,o,e.unit);!s||e.extent&&as(e.extent,s)||(e.extent=s,this.#we(i,e.anchor,s))}#we(e,t,n){if(as(t,n)){is(e,n.start,n.end);return}let r=t.start.node.getRootNode()===n.start.node.getRootNode(),i=r?t:this.#je(t),a=r?n:this.#je(n);ei(i.start.node,i.start.offset,a.start.node,a.start.offset)<=0?is(e,i.start,a.end):is(e,i.end,a.start)}#Te(e){let t=document.getSelection(),n=this.#f;if(!t||!n)return;let{col:r,row:i}=this.#oe(e.clientX,e.clientY,n),a=this.#De(r,i,`character`);if(!a)return;e.preventDefault(),this.#_e()?.blur();let o=e.shiftKey&&t.anchorNode&&this.#Ne()?rs({node:t.anchorNode,offset:t.anchorOffset}):rs(a.start);this.#we(t,o,e.shiftKey?a:o),this.#w={unit:`character`,anchor:o}}#Ee(e){if(e===this)return!0;if(!(e instanceof Element)||!this.contains(e))return!1;let t=e.closest(Fo);return!t||t===this||!this.contains(t)}#De(e,t,n){let r=this.#p;if(!r)return null;let i={x:0,y:0,width:r.localRect.width,height:r.localRect.height},a=Math.max(0,Math.min(e,i.width-1)),o=Math.max(0,Math.min(t,i.height-1)),s=Lr(r,a,o).at(-1);if(s&&zr(s.node.source))return null;let c=s?[Ir(s.node,s.x,s.y),i]:[i];for(let e of c)for(let t of Hr(e.width,e.height,a-e.x,o-e.y)){let a=e.x+t.x,o=e.y+t.y,{edge:c}=t,l=Ri(this.#s,a,o);if(l===void 0||l===` `&&c!==`self`)continue;let u=this.#Oe(r,a,o,n,e===i?null:s.node);if(u)return c===`self`||n!==`character`?u:rs(c===`start`?u.start:u.end)}return null}#Oe(e,t,n,r,i=null){let a=Lr(e,t,n);if(i&&!a.some(e=>e.node===i))return null;for(let e=a.length-1;e>=0;e--){let{node:i,x:o,y:s}=a[e];if(Si(i))return zr(i.source)?null:this.#ke(i,o,s,t,n,r)}return Si(e)?this.#ke(e,0,0,t,n,r):null}#ke(e,t,n,r,i,a){let o=jr(e,t,n,r,i);if(o===null||a===`character`&&e.text[o]===`⁠`)return null;if(a===`character`){let t=o+1;for(;t<e.text.length&&e.advances?.[t]===0&&e.text[t]!==`
1032
+ `;)t++;let n=oi(e,o),r=oi(e,t);if(n&&r)return{start:n,end:r}}if(a===`word`){let t=b(e.source.tagName)?He(e.text).find(e=>o>=e.start&&o<e.end):Ei(e,o),n=t&&oi(e,t.start),r=t&&oi(e,t.end);if(n&&r)return{start:n,end:r}}return this.#Ae(e)}#Ae(e){if(e===this.#p||e.anonymous)return yi(e);let t=b(e.source.tagName)?.selectionTarget?.(e.source)??e.source;return{start:{node:t,offset:0},end:{node:t,offset:t.childNodes.length}}}#je(e){let t=e.start.node.getRootNode();if(!(t instanceof ShadowRoot)||t===this.#s.getRootNode())return e;let n=t.host,r=n.parentNode;if(!r)return e;let i=Array.prototype.indexOf.call(r.childNodes,n),a=n.previousSibling,o=n.nextSibling;return{start:ns(a)?{node:a,offset:a instanceof Text?a.length:a.childNodes.length}:{node:r,offset:i},end:ns(o)?{node:o,offset:0}:{node:r,offset:i+1}}}#Me(e){this.setAttribute(Po,``);let t=e.start.node,n=t instanceof Element?t:t.parentElement;n&&getComputedStyle(n).userSelect}#Ne(){let e=this.#p,t=si(this.#s.getRootNode(),e?ui(e):[]);return!t||ci(this,this.#s,t)!==`light`||t.startContainer===t.endContainer&&t.startOffset===t.endOffset?null:t}#Pe=()=>{let e=this.#Ne()!==null;this.hasAttribute(Po)&&!e&&this.removeAttribute(Po),(e||this.#O)&&this.#p&&this.#K(),this.#O=e};#Fe(e){let t=this.#Ne();return Ii(e,this.#s,{holdStructural:this.#ve(),glyphs:this.#A,selection:t?fi(e,t):void 0})}#Ie=()=>{this.#V=null,this.#Ve()};#Le=e=>{let t=e;if(!t.isPrimary||t.button!==0||(this.#S=t.pointerType,this.#C=t.pointerId,this.#D=!1,ts(t)))return;let n=this.#se(t.clientX,t.clientY);if(n){this.#x=n,t.preventDefault(),t.isTrusted&&this.setPointerCapture(t.pointerId);return}this.#V={x:t.clientX,y:t.clientY},this.#z=!0,this.#M=t.composedPath().includes(this.#s),this.#Ve(!0)};#Re=e=>{if(e.isPrimary){if(this.#D=e.type===`pointerup`&&this.#w!==null,this.#w=null,this.#pe(),this.#j=null,this.#M=!1,this.removeAttribute(`data-mw-dragging`),this.#x){this.#te(this.#x.el),this.#x=null;return}(this.#z||this.#R)&&(this.#z=!1,this.#R=null,this.#Ve(),this.#B&&this.#et())}};#ze=e=>{this.#D&&(this.#D=!1,e.preventDefault())};#Be=e=>{if(!this.#V)return;let t=e.target;t instanceof HTMLElement&&t.hasAttribute(`data-mw-scroll`)||(this.#W=null,this.#me(),this.#Ve())};#Ve(t=!1){let n=this.#p,r=this.#f,i=[];if(this.#V&&n&&r&&this.isConnected&&this.getAttribute(`select`)===`grid`&&(this.#z||e.#G?.matches)){let{col:e,row:t}=this.#oe(this.#V.x,this.#V.y,r);this.#H=e,this.#U=t,i=Br(n,e,t)}else this.#H=NaN,this.#U=NaN;let a=i.at(-1)??null;t&&(this.#R=a);let o=e.#G?.matches?i:[],s=this.#R?i.indexOf(this.#R):-1,c=s>=0?i.slice(0,s+1):[],l=this.#He(`data-mw-hover`,this.#I,o);l=this.#He(`data-mw-active`,this.#L,c)||l;let u=a?getComputedStyle(a).cursor:``;this.#s.style.cursor=u===`auto`?``:u,l&&this.isConnected&&this.#et()}#He(e,t,n){let r=!1,i=new Set(n);for(let n of t)i.has(n)||(n.removeAttribute(e),r=!0);for(let n of i)t.has(n)||(n.setAttribute(e,``),r=!0);t.clear();for(let e of i)t.add(e);return r}#Ue=0;#We=!1;#Ge=0;#Ke=e=>{Lo.test(e.propertyName)&&(this.#Ue++,this.#Ge=performance.now(),this.#Je())};#qe=e=>{Lo.test(e.propertyName)&&(this.#Ue=Math.max(0,this.#Ue-1))};#Je(){if(this.#We)return;this.#We=!0;let e=()=>{if(!this.isConnected||this.#Ue===0&&!k()||performance.now()-this.#Ge>Ro){this.#We=!1,this.#Ue=0,this.#et();return}this.#$e(),requestAnimationFrame(e)};requestAnimationFrame(e)}#Ye=e=>{if(!ts(e)){if(e.type===`keydown`||e.type===`keyup`){let{key:t,target:n}=e,r=n instanceof Element&&n.hasAttribute(`data-mw-scroll`);if(t!==`Enter`&&(t!==` `||r))return}if((e.type===`focusin`||e.type===`focusout`)&&e.target instanceof HTMLSelectElement){this.#$e();return}this.#et()}};attributeChangedCallback(e,t,n){if(e===`focus`){n!==`tab`&&n!==`arrows`&&(n!==null&&console.warn(`[monowind] Ignoring unrecognized focus="${n}". Expected "tab" (default) or "arrows".`,h(this)),this.setAttribute(`focus`,No));return}if(e===`select`&&n!==`text`&&n!==`grid`){n!==null&&console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`,h(this)),this.setAttribute(`select`,Mo);return}e===`select`&&this.#Ve(),this.#et()}toPlainText(){return this.#d&&this.#tt(),this.#p?yr(this.#p):``}#Xe=()=>{this.#et()};#Ze=()=>{requestAnimationFrame(()=>{this.#A.invalidate(),this.#et()})};#Qe(){let e=document.activeElement;if(!(e instanceof HTMLSelectElement)||!this.contains(e))return!1;try{return e.matches(`:open`)}catch{return!1}}#$e(){try{this.#tt()}catch(e){console.error(`[monowind] layout failed:`,e)}}#et(){this.#d||(this.#d=!0,requestAnimationFrame(()=>{if(this.#d=!1,this.#Qe()){this.#et();return}this.#$e()}))}#tt(){if(!this.isConnected)return;let e=this.#X(),t=new Map,n=getComputedStyle(this).getPropertyValue(`--mw-cw`).trim(),r=parseFloat(n);if(Number.isFinite(r)&&r>0)for(let e of this.querySelectorAll(`textarea`)){let n=getComputedStyle(e),i=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0);t.set(e,Math.max(0,Math.round(i/r)))}this.setAttribute(`measuring`,``);try{this.#c.parentNode!==this&&this.appendChild(this.#c);let n=F(this,this.#c),r=this.#f;(r===null||r.width!==n.width||r.height!==n.height||r.letterSpacing!==n.letterSpacing||r.gridLetterSpacing!==n.gridLetterSpacing||r.inkOverhang!==n.inkOverhang||r.backgroundGap!==n.backgroundGap)&&(this.style.setProperty(`--mw-cw`,`${n.width}px`),this.style.setProperty(`--mw-ch`,`${n.height}px`),this.style.setProperty(`--mw-rls`,`${n.letterSpacing}px`),this.style.setProperty(`--mw-ink`,`${n.inkOverhang??0}px`),this.style.setProperty(`--mw-bgpad`,`${Math.ceil((n.backgroundGap??0)/2)}px`),this.#s.style.lineHeight=`${n.height}px`,this.#s.style.letterSpacing=`${n.gridLetterSpacing??n.letterSpacing}px`),this.#f=n;let i=getComputedStyle(this.#s);this.#A.configure({style:i.fontStyle,weight:i.fontWeight,size:i.fontSize,family:i.fontFamily},{width:n.width,height:n.height,letterSpacing:n.gridLetterSpacing??n.letterSpacing});let a=getComputedStyle(this),o=(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0),s=Math.max(0,Math.floor((this.clientWidth-o)/n.width));if(s===0)return;let c=I(),l=oo(this,c,n,t)??this.#ge(c,n,t),{height:u}=Wn(l,s);Ki(l),this.#_=os(l),this.#q(n,e),this.#B=!this.#Fe(l),this.#p=l;let d=`${l.localRect.width*n.width}px`,f=`${l.localRect.height*n.height}px`;this.#s.style.width!==d&&(this.#s.style.width=d),this.#s.style.height!==f&&(this.#s.style.height=f);let p=a.boxSizing===`border-box`?(parseFloat(a.paddingTop)||0)+(parseFloat(a.paddingBottom)||0)+(parseFloat(a.borderTopWidth)||0)+(parseFloat(a.borderBottomWidth)||0):0,m=`${u*n.height+p}px`;this.style.height!==m&&(this.style.height=m);let h=a.boxSizing===`border-box`?o+(parseFloat(a.borderLeftWidth)||0)+(parseFloat(a.borderRightWidth)||0):0,g=`${s*n.width+h}px`;this.style.getPropertyValue(`--mw-host-w`)!==g&&this.style.setProperty(`--mw-host-w`,g),this.hasAttribute(`data-mw-ready`)||this.setAttribute(`data-mw-ready`,``)}finally{this.setAttribute(`settling`,``),this.removeAttribute(`measuring`),getComputedStyle(this).transitionProperty,this.removeAttribute(`settling`),this.#Z(e),this.#u?.takeRecords(),ee(this)&&(k()?(this.#Ge=performance.now(),this.#Je()):this.#et()),this.#ae(),this.#N=[];let t=document.scrollingElement??document.documentElement;for(let e=this.parentElement;e;e=e.parentElement)(e===t||/auto|scroll/.test(getComputedStyle(e).overflow))&&this.#N.push(e);this.#W=null,this.#J(),this.#V&&this.#Ve()}}};function Qo(){typeof customElements>`u`||customElements.get(`mono-wind`)||customElements.define(`mono-wind`,Zo)}function $o(e,t,n,r,i){return es(t===`y`?e.scrollTop:e.scrollLeft,t===`y`?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth,n,r,i)}function es(e,t,n,r,i){if(r>0&&e>0&&e>=t-1)return r;let a=e/n-i,o=Math.abs(a)<=.5?i:i+Math.sign(a)*Math.round(Math.abs(a));return Math.min(Math.max(0,o),r)}function ts(e){return e instanceof PointerEvent&&e.pointerType===`touch`&&e.type!==`pointerup`}function ns(e){return e!==null&&!(e instanceof Element&&e.shadowRoot)}function rs(e){return{start:e,end:e}}function is(e,t,n){e.setBaseAndExtent(t.node,t.offset,n.node,n.offset)}function as(e,t){return e.start.node===t.start.node&&e.start.offset===t.start.offset&&e.end.node===t.end.node&&e.end.offset===t.end.offset}function os(e){let t=[],n=e=>{e.scrollRange&&t.push(e);for(let t of e.children)n(t)};return n(e),t}var ss=`/* Gap decorations (specs/gap-decorations.md): css-gaps-1 rules for flex
1035
1033
  * and grid gaps, engine-painted as glyph runs. The utilities set the
1036
1034
  * real CSS properties (forward-compat; unknown ones drop harmlessly)
1037
1035
  * AND the --mw-* mirrors the engine reads — compiled by the consumer's
@@ -1259,7 +1257,7 @@ input:where([type='button'], [type='reset'], [type='submit']),
1259
1257
  inherits: false;
1260
1258
  initial-value: 0;
1261
1259
  }
1262
- `,Yo=`/* monowind companion stylesheet — loaded into the light DOM by the app.
1260
+ `,cs=`/* monowind companion stylesheet — loaded into the light DOM by the app.
1263
1261
  * The shadow root has its own baked-in styles; this file targets the light-DOM
1264
1262
  * subtree the host owns.
1265
1263
  *
@@ -1658,7 +1656,16 @@ input:where([type='button'], [type='reset'], [type='submit']),
1658
1656
  * despite \`pointer-events: none\`, and would show an arrow there.
1659
1657
  * Interactives keep their own (UA and authored cursors win). */
1660
1658
  mono-wind[select="grid"]
1661
- [data-mw-laid-out]:not(a, button, input, select, textarea, label, [tabindex], [role="button"]) {
1659
+ :is([data-mw-laid-out], [data-mw-flow]):not(
1660
+ a,
1661
+ button,
1662
+ input,
1663
+ select,
1664
+ textarea,
1665
+ label,
1666
+ [tabindex],
1667
+ [role="button"]
1668
+ ) {
1662
1669
  cursor: text;
1663
1670
  }
1664
1671
  }
@@ -1878,9 +1885,10 @@ mono-wind:not([measuring]) * {
1878
1885
  * on it for real and the engine samples true mid-fade values (the
1879
1886
  * animation loop, element.ts). Decoration ink follows \`color\`, so it
1880
1887
  * needs its own transparent lock (the grid paints decorations).
1881
- * \`[data-mw-leaf]\` is the host with its own text as the root leaf
1882
- * (specs/host-leaf.md): every rule that shapes a leaf's native text
1883
- * carries this host variant render.ts writes the host's flags. */
1888
+ * \`[data-mw-leaf]\` is the host with its own text on the grid — the root
1889
+ * leaf, or a mixed host's anonymous runs (specs/host-leaf.md): every
1890
+ * rule that shapes a leaf's native text carries this host variant
1891
+ * render.ts writes the host's flags. */
1884
1892
  mono-wind:not([measuring])[data-mw-leaf],
1885
1893
  mono-wind:not([measuring]) *:not(input):not(textarea):not(select) {
1886
1894
  -webkit-text-fill-color: transparent !important;
@@ -1979,7 +1987,8 @@ mono-wind:not([measuring]) [data-mw-laid-out] {
1979
1987
  * (below). */
1980
1988
  mono-wind:not([measuring]) [data-mw-laid-out],
1981
1989
  mono-wind:not([measuring]) [data-mw-inline-box],
1982
- mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
1990
+ mono-wind:not([measuring]) [data-mw-multicol-flow-span],
1991
+ mono-wind:not([measuring]) [data-mw-flow] {
1983
1992
  box-sizing: border-box !important;
1984
1993
  /* Trailing-gap allowance: a tracked box's lines end with a phantom
1985
1994
  * \`--mw-ls\`-cell gap the engine doesn't count. Give the content box that
@@ -2117,25 +2126,37 @@ mono-wind:not([measuring]) [data-mw-multicol-flow] {
2117
2126
  * the two agree — selection ranges land exactly where the glyphs are. */
2118
2127
  mono-wind:not([measuring])[data-mw-leaf],
2119
2128
  mono-wind:not([measuring]) [data-mw-laid-out],
2120
- mono-wind:not([measuring]) [data-mw-multicol-flow] {
2129
+ mono-wind:not([measuring]) [data-mw-multicol-flow],
2130
+ mono-wind:not([measuring]) [data-mw-flow] {
2121
2131
  text-indent: calc(var(--mw-ti, 0) * var(--mw-cw, 1px)) !important;
2122
2132
  }
2123
2133
 
2124
- /* In-flow multicol SPANNER (specs/multicol.md): a normally laid-out box
2125
- * that stays in the native flow so paragraphs fragment around it —
2126
- * engine-forced geometry (the shared rule above), quantized margins,
2127
- * \`column-span: all\`. The half-leading translate doubles as the
2128
- * containing block for its absolutized descendants (a transformed box
2129
- * contains them like a positioned one). */
2134
+ /* Boxes that stay in the browser's flow with engine-forced geometry
2135
+ * (the shared rule above) and quantized engine margins: a mixed block
2136
+ * container's child, placed so the container's anonymous runs of text
2137
+ * land on their rows (specs/cell-model.md "Inline content"), and an
2138
+ * in-flow multicol SPANNER (specs/multicol.md), which paragraphs
2139
+ * fragment around. The half-leading translate doubles as the containing
2140
+ * block for their absolutized descendants (a transformed box contains
2141
+ * them like a positioned one). */
2142
+ mono-wind:not([measuring]) [data-mw-flow],
2130
2143
  mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
2131
2144
  position: static !important;
2132
- column-span: all !important;
2133
2145
  margin-top: calc(var(--mw-mt, 0) * var(--mw-ch, 1px)) !important;
2134
2146
  margin-right: 0 !important;
2135
2147
  margin-bottom: calc(var(--mw-mb, 0) * var(--mw-ch, 1px)) !important;
2136
2148
  margin-left: calc(var(--mw-ml, 0) * var(--mw-cw, 1px)) !important;
2137
2149
  translate: 0 calc(var(--mw-lhs, 0) * var(--mw-ch, 1px)) !important;
2138
2150
  }
2151
+ mono-wind:not([measuring]) [data-mw-multicol-flow-span] {
2152
+ column-span: all !important;
2153
+ }
2154
+ /* A flow child's own formatting context: its first child's top margin
2155
+ * stays inside it, where the engine put that child (the shadow slot
2156
+ * does the same for the host's, element.ts). */
2157
+ mono-wind:not([measuring]) [data-mw-flow] {
2158
+ contain: layout !important;
2159
+ }
2139
2160
 
2140
2161
  /* Spanner-split paragraph flow trusts the NATIVE balancer per segment
2141
2162
  * (probed pixel-exact in all three engines under quantized inputs):
@@ -2189,27 +2210,23 @@ mono-wind:not([measuring]) [data-mw-inline-inset] {
2189
2210
 
2190
2211
  /* === Engine state attributes (warnings, hiding, alignment) =========== */
2191
2212
 
2192
- /* A container whose direct text was dropped (mixed text + block children,
2193
- * cell-model deviation): the browser would paint that text unpositioned
2194
- * over the laid-out children, so hide it — the host's own through its
2195
- * shadow slot (element.ts), a nested container's through itself.
2196
- * \`visibility\` is inherited AND resettable, so the laid-out children come
2197
- * back — only in this warned state, which is why the reset may also
2198
- * override an authored \`invisible\` utility there. */
2199
- mono-wind:not([measuring]) [data-mw-dropped-text] {
2200
- visibility: hidden !important;
2201
- }
2202
- mono-wind:not([measuring])[data-mw-dropped-text] > [data-mw-laid-out],
2203
- mono-wind:not([measuring]) [data-mw-dropped-text] > [data-mw-laid-out] {
2204
- visibility: visible !important;
2205
- }
2206
-
2207
2213
  /* Misparented table content (no anonymous boxes, specs/table.md) and
2208
2214
  * <col>/<colgroup> boxes: fully hidden, subtree included. */
2209
2215
  mono-wind:not([measuring]) [data-mw-table-hidden] {
2210
2216
  display: none !important;
2211
2217
  }
2212
2218
 
2219
+ /* A container whose anonymous runs are misparented table content
2220
+ * (stray text in a div-table, specs/table.md): the runs have no element
2221
+ * to hide, so the container hides its text, and its laid-out children
2222
+ * — the rows or cells — show through the inherited value. */
2223
+ mono-wind:not([measuring]) [data-mw-hidden-runs] {
2224
+ visibility: hidden !important;
2225
+ }
2226
+ mono-wind:not([measuring]) [data-mw-hidden-runs] > [data-mw-laid-out] {
2227
+ visibility: visible !important;
2228
+ }
2229
+
2213
2230
  /* Force off-grid text alignments back to \`start\`. \`text-left\`/\`right\`/\`start\`/
2214
2231
  * \`end\` all land on whole cells (offset = (W - N) × cell width); \`center\` and
2215
2232
  * \`justify\` produce fractional per-line offsets we can't snap to the grid. */
@@ -2217,7 +2234,7 @@ mono-wind:not([measuring])[data-mw-text-align-blocked],
2217
2234
  mono-wind:not([measuring]) [data-mw-text-align-blocked] {
2218
2235
  text-align: start !important;
2219
2236
  }
2220
- `,Xo=`/* Synthesized pointer states (specs/cell-model.md "Pointer states"):
2237
+ `,ls=`/* Synthesized pointer states (specs/cell-model.md "Pointer states"):
2221
2238
  * under select="grid" the light DOM is pointer-events: none, so
2222
2239
  * :hover/:active never match — the engine hit-tests the pointer's
2223
2240
  * cell and marks the chain with data-mw-hover / data-mw-active. These
@@ -2234,5 +2251,5 @@ mono-wind:not([measuring]) [data-mw-text-align-blocked] {
2234
2251
  }
2235
2252
  }
2236
2253
  @custom-variant active (&:is(:active, [data-mw-active]));
2237
- `,Zo=document.createElement(`style`);Zo.setAttribute(`data-monowind`,``),Zo.textContent=Yo,document.head.appendChild(Zo);var Qo=document.createElement(`style`);Qo.setAttribute(`type`,`text/tailwindcss`),Qo.setAttribute(`data-monowind-rules`,``),Qo.textContent=`${Jo}\n${Xo}`,document.head.appendChild(Qo),zo(),Object.assign(globalThis,{monowind:{...globalThis.monowind,version:`0.2.9`,registerLeafRenderer:v,invalidateLeaves:y,glyphSetFor:r}})})();
2254
+ `,us=document.createElement(`style`);us.setAttribute(`data-monowind`,``),us.textContent=cs,document.head.appendChild(us);var ds=document.createElement(`style`);ds.setAttribute(`type`,`text/tailwindcss`),ds.setAttribute(`data-monowind-rules`,``),ds.textContent=`${ss}\n${ls}`,document.head.appendChild(ds),Qo(),Object.assign(globalThis,{monowind:{...globalThis.monowind,version:`0.2.10`,registerLeafRenderer:v,invalidateLeaves:y,glyphSetFor:r}})})();
2238
2255
  //# sourceMappingURL=cdn.js.map