ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
118 lines • 290 kB
JavaScript
var ranui_math=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=typeof document>`u`,a=0,o=1,s=2,c=null,l=null,u=0,d=new Set,f=!1;function p(e,t){let n=t?.equals??Object.is,r={value:e,observers:new Set};return[()=>(y(r),r.value),e=>{let t=typeof e==`function`?e(r.value):e;if(!n(r.value,t)){r.value=t;for(let e of r.observers)b(e,s);u===0&&x()}}]}function m(e){let t=_(e,!0);return v(t),C(t),()=>te(t)}function h(e){let t={owned:[],cleanups:[],owner:l},n=l,r=c;l=t,c=null;try{return e(()=>ne(t))}finally{l=n,c=r}}function g(e){l&&l.cleanups.push(e)}function _(e,t,n){return{fn:e,sources:new Set,isEffect:t,running:!1,disposed:!1,state:s,observers:new Set,value:void 0,equals:n??Object.is,owned:[],cleanups:[],owner:l}}function v(e){l&&l.owned.push(e)}function y(e){c&&(c.sources.add(e),e.observers.add(c))}function b(e,t){if(e.disposed||e.state>=t)return;let n=e.state===a;if(e.state=t,e.isEffect)d.add(e);else if(n)for(let t of e.observers)b(t,o)}function x(){if(!(u>0||f)){f=!0;try{for(;d.size>0;){let e=[...d];d.clear();for(let t of e)t.disposed||S(t)}}finally{f=!1}}}function S(e){if(!(e.disposed||e.state===a)){if(e.state===o)for(let t of e.sources)`fn`in t&&S(t);e.state===s&&C(e),e.state=a}}function C(e){if(e.running)throw Error(`ranui reactivity: cyclic dependency detected (a computation triggered itself).`);ee(e);let t=c,n=l;c=e,l=e,e.running=!0,e.state=a;try{let t=e.fn();if(e.isEffect)typeof t==`function`&&e.cleanups.push(t);else{let n=e.value;if(e.value=t,e.observers.size>0&&!e.equals(n,t))for(let t of e.observers)b(t,s)}}finally{e.running=!1,c=t,l=n}}function ee(e){for(let t of e.owned)te(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0;for(let t of e.sources)t.observers.delete(e);e.sources.clear()}function te(e){e.disposed||(e.disposed=!0,ee(e),e.observers.clear())}function ne(e){for(let t of e.owned)te(t);e.owned.length=0;for(let t of e.cleanups)t();e.cleanups.length=0}function re(e){return typeof e==`string`?e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`):String(e)}function ie(e){return re(e)}var ae=e=>typeof e!=`string`&&`tagName`in e&&`childrenList`in e,oe=(e,t)=>{let n=t.trim();if(!n)return!1;if(n.startsWith(`.`))return e.classList.contains(n.slice(1));if(n.startsWith(`#`))return e.getAttribute(`id`)===n.slice(1);if(n.startsWith(`[`)&&n.endsWith(`]`)){let[t,r]=n.slice(1,-1).trim().split(`=`),i=(t||``).trim();if(!i)return!1;if(r==null)return e.hasAttribute(i);let a=r.trim().replace(/^['"]|['"]$/g,``);return e.getAttribute(i)===a}return e.tagName===n.toLowerCase()},se=(e,t,n)=>{for(let r of e)ae(r)&&(oe(r,t)&&n.push(r),se(r.childrenList,t,n))},ce=class{childrenList=[];appendChild(e){return this.childrenList.push(e),e}serialize(){return this.childrenList.map(e=>typeof e==`string`?re(e):e.serialize()).join(``)}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return se(this.childrenList,e,t),t}},le=class{tagName;attributes=new Map;inlineStyles=new Map;childrenList=[];shadowRoot=null;textContent=null;content;eventListeners=new Map;style={setProperty:(e,t)=>{let n=e.startsWith(`--`)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase();this.inlineStyles.set(n,t)},removeProperty:e=>this.inlineStyles.delete(e)};classList={add:(...e)=>{let t=this.attributes.get(`class`)||``,n=new Set([...t.split(` `).filter(Boolean),...e]);this.attributes.set(`class`,Array.from(n).join(` `))},remove:(...e)=>{let t=(this.attributes.get(`class`)||``).split(` `).filter(t=>!e.includes(t));this.attributes.set(`class`,t.join(` `))},toggle:e=>{this.classList.contains(e)?this.classList.remove(e):this.classList.add(e)},contains:e=>(this.attributes.get(`class`)||``).split(` `).includes(e)};_innerHTML=``;get innerHTML(){return this._innerHTML}set innerHTML(e){this._innerHTML=e,this.tagName===`template`&&this.content&&(this.content.childrenList=[e])}constructor(e=`div`){this.tagName=e.toLowerCase(),this.tagName===`template`&&(this.content=new ce)}get hidden(){return this.hasAttribute(`hidden`)}set hidden(e){e?this.setAttribute(`hidden`,``):this.removeAttribute(`hidden`)}setAttribute(e,t){this.attributes.set(e,t)}getAttribute(e){return this.attributes.get(e)||null}removeAttribute(e){this.attributes.delete(e)}hasAttribute(e){return this.attributes.has(e)}appendChild(e){return this.childrenList.push(e),e}attachShadow(e){return this.shadowRoot=new ue(this,e),this.shadowRoot}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return se(this.childrenList,e,t),t}addEventListener(e,t){let n=this.eventListeners.get(e)||new Set;n.add(t),this.eventListeners.set(e,n)}removeEventListener(e,t){let n=this.eventListeners.get(e);n&&(n.delete(t),n.size===0&&this.eventListeners.delete(e))}dispatchEvent(e){let t=this.eventListeners.get(e.type);if(!t||t.size===0)return!0;for(let n of t)typeof n==`function`?n.call(this,e):n.handleEvent(e);return!e.defaultPrevented}serialize(e){typeof this._preSerialize==`function`&&this._preSerialize();let t=e||this._ssrTag||this.tagName,n=Array.from(this.attributes.entries()).map(([e,t])=>` ${e}="${ie(t)}"`).join(``),r=Array.from(this.inlineStyles.entries()).map(([e,t])=>`${e}:${t}`).join(`;`),i=r?` style="${ie(r)}"`:``,a=``;return this.shadowRoot&&(a+=this.shadowRoot.serialize()),this.textContent===null?this._innerHTML?a+=this._innerHTML:a+=this.childrenList.map(e=>typeof e==`string`?re(e):(e instanceof ce,e.serialize())).join(``):a+=re(this.textContent),[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(t)&&!a?`<${t}${n}${i} />`:`<${t}${n}${i}>${a}</${t}>`}},ue=class{host;options;childrenList=[];adoptedStyleSheets=[];constructor(e,t){this.host=e,this.options=t}appendChild(e){return this.childrenList.push(e),e}querySelector(e){let t=this.querySelectorAll(e);return t.length>0?t[0]:null}querySelectorAll(e){let t=[];return se(this.childrenList,e,t),t}serialize(){return`<template shadowrootmode="${this.options.mode}"${this.options.delegatesFocus?` shadowrootdelegatesfocus`:``}>${this.adoptedStyleSheets.map(e=>`<style>${re(e)}</style>`).join(``)}${this.childrenList.map(e=>typeof e==`string`?re(e):(e instanceof ce,e.serialize())).join(``)}</template>`}},de=e=>e.reduce((e,t)=>Array.isArray(t)?e.concat(de(t)):e.concat(t),[]),fe=e=>e==null?null:e instanceof we?e.build():typeof e==`string`?i?e:document.createTextNode(e):e,pe=(e,t)=>{if(i){Ce(e,[t()]);return}let n=document.createComment(``),r=document.createComment(``);e.appendChild(n),e.appendChild(r);let a=null,o=()=>{a?.(),a=null;let e=n.nextSibling;for(;e&&e!==r;){let t=e.nextSibling;e.parentNode?.removeChild(e),e=t}};m(()=>{let e=t();o();let n=document.createDocumentFragment();a=h(t=>(Ce(n,[e]),t)),r.parentNode?.insertBefore(n,r)}),g(()=>a?.())},me=`__ranFor`,he=e=>typeof e==`object`&&!!e&&e[me]===!0,ge=(e,t,n)=>{let[r,i]=p(t),a=null,o=h(t=>{let i=fe(n(e,r));return a=typeof i==`string`?document.createTextNode(i):i,t});return{node:a,index:i,dispose:o}},_e=(e,t)=>{let n=e.parentNode;if(!n)return;let r=e;for(let e of t)r.nextSibling!==e&&n.insertBefore(e,r.nextSibling),r=e},ve=(e,t)=>{if(i){(t.each()??[]).forEach((n,r)=>{let i=fe(t.render(n,()=>r));i!=null&&e.appendChild(i)});return}let n=document.createComment(``);e.appendChild(n);let r=new Map;g(()=>{for(let e of r.values())e.dispose();r.clear()}),m(()=>{let e=t.each()??[],i=new Map,a=[];e.forEach((e,n)=>{let o=t.key(e,n);if(i.has(o))return;let s=r.get(o);s?(r.delete(o),s.index(n)):s=ge(e,n,t.render),i.set(o,s),s.node&&a.push(s.node)});for(let e of r.values())e.node?.parentNode?.removeChild(e.node),e.dispose();_e(n,a),r=i})},ye=`__ranIndex`,be=e=>typeof e==`object`&&!!e&&e[ye]===!0,xe=(e,t,n)=>{let[r,i]=p(e),a=null,o=h(e=>{let i=fe(n(r,t));return a=typeof i==`string`?document.createTextNode(i):i,e});return{node:a,setItem:i,dispose:o}},Se=(e,t)=>{if(i){(t.each()??[]).forEach((n,r)=>{let i=fe(t.render(()=>n,r));i!=null&&e.appendChild(i)});return}let n=document.createComment(``);e.appendChild(n);let r=[];g(()=>{for(let e of r)e.dispose();r=[]}),m(()=>{let e=t.each()??[];for(let n=0;n<e.length;n++)n<r.length?r[n].setItem(e[n]):r.push(xe(e[n],n,t.render));for(let t=r.length-1;t>=e.length;t--){let{node:e}=r[t];e?.parentNode?.removeChild(e),r[t].dispose(),r.pop()}_e(n,r.map(e=>e.node).filter(e=>e!=null))})},Ce=(e,t)=>{de(t).forEach(t=>{if(he(t)){ve(e,t);return}if(be(t)){Se(e,t);return}if(typeof t==`function`){pe(e,t);return}let n=fe(t);n!=null&&e.appendChild(n)})},we=class{el;constructor(e){this.el=i?new le(e):document.createElement(e)}id(e){return this.el.setAttribute(`id`,e),this}bind(e,t){typeof e==`function`?m(()=>t(e())):t(e)}class(e){return this.bind(e,e=>{i?this.el.attributes.set(`class`,e):this.el.className=e}),this}addClass(...e){return e.forEach(e=>this.el.classList.add(e)),this}removeClass(...e){return e.forEach(e=>this.el.classList.remove(e)),this}attr(e,t){return this.bind(t,t=>this.el.setAttribute(e,t)),this}attrs(e){return Object.entries(e).forEach(([e,t])=>{t!=null&&this.el.setAttribute(e,String(t))}),this}boolAttr(e,t,n=``){return this.bind(t,t=>{t?this.el.setAttribute(e,n):this.el.removeAttribute(e)}),this}part(e){return this.attr(`part`,e)}data(e,t){return this.attr(`data-${e}`,t)}style(e,t){return typeof e==`string`?this.bind(t??``,t=>this.el.style.setProperty(e,t)):Object.entries(e).forEach(([e,t])=>this.el.style.setProperty(e,t)),this}cssVar(e,t){let n=e.startsWith(`--`)?e:`--${e}`;return this.style(n,t)}aria(e,t){return this.attr(`aria-${e}`,t)}role(e){return this.attr(`role`,e)}tabIndex(e){return this.attr(`tabindex`,String(e))}label(e){return this.aria(`label`,e)}labelledBy(e){return this.aria(`labelledby`,e)}describedBy(e){return this.aria(`describedby`,e)}ariaHidden(e=!0){return this.aria(`hidden`,String(e))}on(e,t,n){return this.el.addEventListener(e,t,n),this}listen(e,t,n,r){return e.on(this.el,t,n,r),this}delegate(e,t,n,r,i){return e.delegate(this.el,t,n,r,i),this}children(...e){return Ce(this.el,e),this}replaceChildren(...e){if(i){let e=this.el;e.childrenList=[]}else this.el.replaceChildren();return this.children(...e)}text(e){return this.bind(e,e=>{this.el.textContent=e}),this}ref(e){return e.current=this.el,this}shadow(e={mode:`closed`}){let t=this.el.attachShadow(e);return new Te(this.el,t,e)}build(){return this.el}serialize(){if(i)return this.el.serialize();let e=document.createElement(`div`);return e.appendChild(this.el.cloneNode(!0)),e.innerHTML}},Te=class{root;hostEl;options;constructor(e,t,n){this.hostEl=e,this.root=t,this.options=n}children(...e){return Ce(this.root,e),this}adoptSheet(...e){return this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,...e],this}css(e){if(i)return this.root.adoptedStyleSheets.push(e),this;if(typeof CSSStyleSheet<`u`)try{let t=new CSSStyleSheet;return t.replaceSync(e),this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,t],this}catch{}let t=document.createElement(`style`);return t.textContent=e,this.root.appendChild(t),this}done(){return{host:this.hostEl,shadow:this.root}}serialize(){return i?this.root.serialize():this.root.innerHTML}},Ee=e=>new we(e),De=()=>Ee(`div`),Oe=()=>Ee(`span`),ke=class{_events=new Map;tap=(e,t)=>{this._events.get(e)&&e!==Symbol.for(`NEW_LISTENER`)&&this.call(Symbol.for(`NEW_LISTENER`),e);let n=this._events.get(e)||new Set;return typeof t==`function`?n.add({name:e,callback:t}):n.add(t),this._events.set(e,n),this};call=(e,...t)=>((this._events.get(e)||new Set).forEach(e=>{let{callback:n}=e;n(...t)}),this);callSync=async(e,...t)=>{let n=this._events.get(e)||new Set;for(let e of n){let{callback:n}=e;await n(...t)}return this};once=(e,t)=>{let n;if(typeof t==`function`)n={name:e,callback:(...r)=>{t(...r),this.off(e,n)},initialCallback:t};else{let{callback:r}=t;n={name:e,callback:(...t)=>{r(...t),this.off(e,n)},initialCallback:r}}return this.tap(e,n),this};off=(e,t)=>{let n=[...this._events.get(e)||new Set].filter(e=>{if(typeof t==`function`)return e.callback!==t&&e.initialCallback!==t;{let{callback:n}=t;return e.callback!==n&&e.initialCallback!==n}});return this._events.set(e,new Set(n)),this}},Ae=(e=8)=>Math.random().toString(36).substring(2,e+2),je=e=>typeof e==`function`,Me=12e4,Ne=`__ranuts_bridge__`,Pe=`default`,Fe=new class{bridges=new Set;attachedWindow=null;handleMessage=e=>{for(let t of Array.from(this.bridges))t.receive(e)};add(e){this.bridges.add(e),typeof window<`u`&&this.attachedWindow!==window&&(window.addEventListener(`message`,this.handleMessage),this.attachedWindow=window)}remove(e){this.bridges.delete(e),this.bridges.size===0&&this.attachedWindow&&(this.attachedWindow.removeEventListener(`message`,this.handleMessage),this.attachedWindow=null)}},Ie=class{targetWindow;targetOrigin;messageHandlers;pendingRequests;channel;senderId;available;constructor(e,t=`*`,n=Pe){this.targetOrigin=t,this.channel=n,this.senderId=Ae(12),this.messageHandlers=new Map,this.pendingRequests=new Map,this.available=typeof window<`u`,this.available?(this.targetWindow=e??window,Fe.add(this)):this.targetWindow=void 0}post(e,t){let n={...t,__bridge:Ne,channel:this.channel,senderId:this.senderId};e.postMessage(n,this.targetOrigin)}receive=e=>{if(!this.available||this.targetOrigin!==`*`&&e.origin!==this.targetOrigin||e.source&&e.source!==this.targetWindow)return;let t=e.data;if(!t||typeof t!=`object`||t.__bridge!==`__ranuts_bridge__`||(t.channel??`default`)!==this.channel)return;let{type:n,payload:r,id:i,isResponse:a,isError:o,senderId:s}=t;if(a&&i){let e=this.pendingRequests.get(i);e&&(o?e.reject(Error(typeof r==`string`?r:`Bridge request failed`)):e.resolve(r),this.pendingRequests.delete(i));return}if(s&&s===this.senderId||typeof n!=`string`||!this.messageHandlers.has(n))return;let c=this.messageHandlers.get(n);if(je(c)){let t=e.source??this.targetWindow;Promise.resolve(c(r)).then(e=>{i&&this.post(t,{type:n,payload:e,id:i,isResponse:!0})}).catch(e=>{i&&this.post(t,{type:n,payload:e instanceof Error?e.message:String(e),id:i,isResponse:!0,isError:!0})})}};on=(e,t)=>{this.messageHandlers.set(e,t)};off=e=>{this.messageHandlers.delete(e)};send=async(e,t)=>{if(!this.available)return Promise.reject(Error(`PostMessageBridge is unavailable outside a browser environment`));let n=Ae(10);return new Promise((r,i)=>{let a=setTimeout(()=>{this.pendingRequests.has(n)&&(this.pendingRequests.delete(n),i(Error(`Request timeout`)))},Me),o=e=>{clearTimeout(a),i(e)};this.pendingRequests.set(n,{resolve:e=>{clearTimeout(a),r(e)},reject:o});try{this.post(this.targetWindow,{type:e,payload:t,id:n})}catch(e){this.pendingRequests.delete(n),o(e instanceof Error?e:Error(`Failed to post message`))}})};broadcast=e=>{if(this.available)try{this.post(this.targetWindow,{type:e.type,payload:e.payload})}catch{}};destroy=()=>{Fe.remove(this),this.messageHandlers.clear(),this.pendingRequests.forEach(e=>{e.reject(Error(`Bridge destroyed`))}),this.pendingRequests.clear()}};(class e{static instance;bridges=new Map;constructor(){}static getInstance(){return e.instance||=new e,e.instance}connectClient=({id:e,targetOrigin:t,targetWindow:n,channel:r})=>{let i=new Ie(n,t,r);if(e||=Ae(10),this.bridges.has(e))throw Error(`Bridge ${e} already exists`);return this.bridges.set(e,i),{bridge:i,id:e}};getClient=e=>this.bridges.get(e);removeClient=e=>{let t=this.bridges.get(e);t&&(t.destroy(),this.bridges.delete(e))};removeAllClient=()=>{this.bridges.forEach(e=>{e.destroy()}),this.bridges.clear()};broadcast=e=>{this.bridges.forEach(t=>{t.broadcast(e)})};sendTo=(e,t,n)=>{let r=this.getClient(e);return r?r.send(t,n):Promise.reject(Error(`Bridge ${e} not found`))}}).getInstance(),new ke;var w=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],T=class{highOrder;lowOrder;constructor(e,t){this.highOrder=e,this.lowOrder=t}};new T(w[0],3609767458),new T(w[1],602891725),new T(w[2],3964484399),new T(w[3],2173295548),new T(w[4],4081628472),new T(w[5],3053834265),new T(w[6],2937671579),new T(w[7],3664609560),new T(w[8],2734883394),new T(w[9],1164996542),new T(w[10],1323610764),new T(w[11],3590304994),new T(w[12],4068182383),new T(w[13],991336113),new T(w[14],633803317),new T(w[15],3479774868),new T(w[16],2666613458),new T(w[17],944711139),new T(w[18],2341262773),new T(w[19],2007800933),new T(w[20],1495990901),new T(w[21],1856431235),new T(w[22],3175218132),new T(w[23],2198950837),new T(w[24],3999719339),new T(w[25],766784016),new T(w[26],2566594879),new T(w[27],3203337956),new T(w[28],1034457026),new T(w[29],2466948901),new T(w[30],3758326383),new T(w[31],168717936),new T(w[32],1188179964),new T(w[33],1546045734),new T(w[34],1522805485),new T(w[35],2643833823),new T(w[36],2343527390),new T(w[37],1014477480),new T(w[38],1206759142),new T(w[39],344077627),new T(w[40],1290863460),new T(w[41],3158454273),new T(w[42],3505952657),new T(w[43],106217008),new T(w[44],3606008344),new T(w[45],1432725776),new T(w[46],1467031594),new T(w[47],851169720),new T(w[48],3100823752),new T(w[49],1363258195),new T(w[50],3750685593),new T(w[51],3785050280),new T(w[52],3318307427),new T(w[53],3812723403),new T(w[54],2003034995),new T(w[55],3602036899),new T(w[56],1575990012),new T(w[57],1125592928),new T(w[58],2716904306),new T(w[59],442776044),new T(w[60],593698344),new T(w[61],3733110249),new T(w[62],2999351573),new T(w[63],3815920427),new T(3391569614,3928383900),new T(3515267271,566280711),new T(3940187606,3454069534),new T(4118630271,4000239992),new T(116418474,1914138554),new T(174292421,2731055270),new T(289380356,3203993006),new T(460393269,320620315),new T(685471733,587496836),new T(852142971,1086792851),new T(1017036298,365543100),new T(1126000580,2618297676),new T(1288033470,3409855158),new T(1501505948,4234509866),new T(1607167915,987167468),new T(1816402316,1246189591),new T(0,1),new T(0,32898),new T(2147483648,32906),new T(2147483648,2147516416),new T(0,32907),new T(0,2147483649),new T(2147483648,2147516545),new T(2147483648,32777),new T(0,138),new T(0,136),new T(0,2147516425),new T(0,2147483658),new T(0,2147516555),new T(2147483648,139),new T(2147483648,32905),new T(2147483648,32771),new T(2147483648,32770),new T(2147483648,128),new T(0,32778),new T(2147483648,2147483658),new T(2147483648,2147516545),new T(2147483648,32896),new T(0,2147483649),new T(2147483648,2147516424);var Le=new Map([[100,`Continue`],[101,`Switching Protocols`],[102,`Processing`],[103,`Early Hints`],[200,`OK`],[201,`Created`],[202,`Accepted`],[203,`Non-Authoritative Information`],[204,`No Content`],[205,`Reset Content`],[206,`Partial Content`],[207,`Multi-Status`],[208,`Already Reported`],[226,`IM Used`],[300,`Multiple Choices`],[301,`Moved Permanently`],[302,`Found`],[303,`See Other`],[304,`Not Modified`],[305,`Use Proxy`],[307,`Temporary Redirect`],[308,`Permanent Redirect`],[400,`Bad Request`],[401,`Unauthorized`],[402,`Payment Required`],[403,`Forbidden`],[404,`Not Found`],[405,`Method Not Allowed`],[406,`Not Acceptable`],[407,`Proxy Authentication Required`],[408,`Request Timeout`],[409,`Conflict`],[410,`Gone`],[411,`Length Required`],[412,`Precondition Failed`],[413,`Payload Too Large`],[414,`URI Too Long`],[415,`Unsupported Media Type`],[416,`Range Not Satisfiable`],[417,`Expectation Failed`],[418,`I'm a Teapot`],[421,`Misdirected Request`],[422,`Unprocessable Entity`],[423,`Locked`],[424,`Failed Dependency`],[425,`Too Early`],[426,`Upgrade Required`],[428,`Precondition Required`],[429,`Too Many Requests`],[431,`Request Header Fields Too Large`],[451,`Unavailable For Legal Reasons`],[500,`Internal Server Error`],[501,`Not Implemented`],[502,`Bad Gateway`],[503,`Service Unavailable`],[504,`Gateway Timeout`],[505,`HTTP Version Not Supported`],[506,`Variant Also Negotiates`],[507,`Insufficient Storage`],[508,`Loop Detected`],[509,`Bandwidth Limit Exceeded`],[510,`Not Extended`],[511,`Network Authentication Required`]]);(function(e){let t=new Map;for(let[n,r]of e)t.set(r.toLowerCase(),n);return t})(Le),function(e){let t=[];for(let[n,r]of e)t.push(n);return t}(Le);var Re=new Map;function ze(e,t){i?(Re.set(e,t),t.prototype._ssrTag=e):customElements.get(e)||customElements.define(e,t)}var Be=typeof document<`u`?HTMLElement:le,Ve=new Map,He=new Map,Ue=(e,t)=>{if(!(typeof document>`u`)&&t){if(typeof CSSStyleSheet<`u`)try{if(!Ve.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),Ve.set(t,e)}let n=Ve.get(t);e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return}catch{}if(!e.querySelector(`style[data-ranui]`)){let n=document.createElement(`style`);n.setAttribute(`data-ranui`,``),n.textContent=t,e.appendChild(n)}}},We=(e,t)=>{if(!(typeof document>`u`)&&t){if(typeof CSSStyleSheet<`u`)try{if(!He.has(t)){let e=new CSSStyleSheet;e.replaceSync(t),He.set(t,e)}let n=He.get(t);e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return}catch{}if(!Array.from(e.querySelectorAll(`style[data-ranui-sheet]`)).some(e=>e.textContent===t)){let n=document.createElement(`style`);n.setAttribute(`data-ranui-sheet`,``),n.textContent=t,e.appendChild(n)}}},Ge=new WeakMap,Ke=`@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}`,qe=(e,t=``,n={mode:`closed`})=>{let r=e.shadowRoot||Ge.get(e)||e.attachShadow(n);return Ge.set(e,r),Ue(r,t?`${t}\n${Ke}`:Ke),r},Je=(e,t,n)=>{let r=e.querySelector(t);if(r)return r;let i=n();return e.appendChild(i),i},Ye=(e,t,n=``)=>e.getAttribute(t)??n,Xe=(e,t,n,r={})=>{if(r.removeEmpty&&!n){e.removeAttribute(t);return}e.setAttribute(t,n??``)},Ze=(e,t,n,r,i)=>{if(n!==`sheet`||r===i)return;let a=e.getAttribute(`sheet`)||``;a&&We(t,a)},Qe=`.remove-wap-active-focus,.remove-wap-active-focus:active,.remove-wap-active-focus:focus{-webkit-tap-highlight-color:transparent;outline:0}:host{position:var(--ran-math-position,relative)}.ran-math{display:var(--ran-math-display,flex);justify-content:var(--ran-math-justify-content,space-around);align-items:var(--ran-math-align-items,center)}.katex-html{display:var(--ran-math-katex-display,none)}`;function $e(e){return String(e).replace(Pt,e=>Nt[e])}function et(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if(typeof n!=`string`)return n.enum[0];switch(n){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{}}}function tt(e){for(var t=0;t<nn.length;t++)for(var n=nn[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}function nt(e){for(var t=0;t<rn.length;t+=2)if(e>=rn[t]&&e<=rn[t+1])return!0;return!1}function rt(e,t){vn[e]=t}function it(e,t,n){if(!vn[t])throw Error(`Font metrics not found for font: `+t+`.`);var r=e.charCodeAt(0),i=vn[t][r];if(!i&&e[0]in bn&&(r=bn[e[0]].charCodeAt(0),i=vn[t][r]),!i&&n===`text`&&nt(r)&&(i=vn[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}function at(e){var t=e>=5?0:e>=3?1:2;if(!xn[t]){var n=xn[t]={cssEmPerMu:yn.quad[t]/18};for(var r in yn)yn.hasOwnProperty(r)&&(n[r]=yn[r][t])}return xn[t]}function ot(e){if(e instanceof Ln)return e;throw Error(`Expected symbolNode but got `+String(e)+`.`)}function st(e){if(e instanceof Nn)return e;throw Error(`Expected span<HtmlDomNode> but got `+String(e)+`.`)}function E(e,t,n,r,i,a){F[e][i]={font:t,group:n,replace:r},a&&r&&(F[e][r]=F[e][i])}function D(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:a,mathmlBuilder:o}=e,s={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},c=0;c<n.length;++c)Lr[n[c]]=s;t&&(a&&(Rr[t]=a),o&&(zr[t]=o))}function ct(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;D({type:t,names:[],props:{numArgs:0},handler(){throw Error(`Should never be called.`)},htmlBuilder:n,mathmlBuilder:r})}function lt(e,t){var n=Vr([`base`],e,t),r=Vr([`strut`]);return r.style.height=P(n.height+n.depth),n.depth&&(r.style.verticalAlign=P(-n.depth)),n.children.unshift(r),n}function ut(e,t){var n=null;e.length===1&&e[0].type===`tag`&&(n=e[0].tag,e=e[0].body);var r=Kr(e,t,`root`),i;r.length===2&&r[1].hasClass(`tag`)&&(i=r.pop());for(var a=[],o=[],s=0;s<r.length;s++)if(o.push(r[s]),r[s].hasClass(`mbin`)||r[s].hasClass(`mrel`)||r[s].hasClass(`allowbreak`)){for(var c=!1;s<r.length-1&&r[s+1].hasClass(`mspace`)&&!r[s+1].hasClass(`newline`);)s++,o.push(r[s]),r[s].hasClass(`nobreak`)&&(c=!0);c||(a.push(lt(o,t)),o=[])}else r[s].hasClass(`newline`)&&(o.pop(),o.length>0&&(a.push(lt(o,t)),o=[]),a.push(r[s]));o.length>0&&a.push(lt(o,t));var l;n?(l=lt(Kr(n,t,!0)),l.classes=[`tag`],a.push(l)):i&&a.push(i);var u=Vr([`katex-html`],a);if(u.setAttribute(`aria-hidden`,`true`),l){var d=l.children[0];d.style.height=P(u.height+u.depth),u.depth&&(d.style.verticalAlign=P(-u.depth))}return u}function dt(e){return new _n(e)}function ft(e,t,n,r,i){var a=ii(e,n),o=a.length===1&&a[0]instanceof Qr&&j.contains([`mrow`,`mtable`],a[0].type)?a[0]:new Q.MathNode(`mrow`,a),s=new Q.MathNode(`annotation`,[new Q.TextNode(t)]);s.setAttribute(`encoding`,`application/x-tex`);var c=new Q.MathNode(`semantics`,[o,s]),l=new Q.MathNode(`math`,[c]);l.setAttribute(`xmlns`,`http://www.w3.org/1998/Math/MathML`),r&&l.setAttribute(`display`,`block`);var u=i?`katex`:`katex-mathml`;return J.makeSpan([u],[l])}function O(e,t){if(!e||e.type!==t)throw Error(`Expected node of type `+t+`, but got `+(e?`node of type `+e.type:String(e)));return e}function pt(e){var t=mt(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function mt(e){return e&&(e.type===`atom`||Hn.hasOwnProperty(e.type))?e:null}function ht(e,t){var n=Kr(e.body,t,!0);return yi([e.mclass],n,t)}function gt(e,t){var n,r=ii(e.body,t);return e.mclass===`minner`?n=new Q.MathNode(`mpadded`,r):e.mclass===`mord`?e.isCharacterBox?(n=r[0],n.type=`mi`):n=new Q.MathNode(`mi`,r):(e.isCharacterBox?(n=r[0],n.type=`mo`):n=new Q.MathNode(`mo`,r),e.mclass===`mbin`?(n.attributes.lspace=`0.22em`,n.attributes.rspace=`0.22em`):e.mclass===`mpunct`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0.17em`):e.mclass===`mopen`||e.mclass===`mclose`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0em`):e.mclass===`minner`&&(n.attributes.lspace=`0.0556em`,n.attributes.width=`+0.1111em`)),n}function _t(e,t,n){var r=xi[e];switch(r){case`\\\\cdrightarrow`:case`\\\\cdleftarrow`:return n.callFunction(r,[t[0]],[t[1]]);case`\\uparrow`:case`\\downarrow`:var i=n.callFunction(`\\\\cdleft`,[t[0]],[]),a={type:`atom`,text:r,mode:`math`,family:`rel`},o={type:`ordgroup`,mode:`math`,body:[i,n.callFunction(`\\Big`,[a],[]),n.callFunction(`\\\\cdright`,[t[1]],[])]};return n.callFunction(`\\\\cdparent`,[o],[]);case`\\\\cdlongequal`:return n.callFunction(`\\\\cdlongequal`,[],[]);case`\\Vert`:return n.callFunction(`\\Big`,[{type:`textord`,text:`\\Vert`,mode:`math`}],[]);default:return{type:`textord`,text:` `,mode:`math`}}}function vt(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,`\\\\`)),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n===`&`||n===`\\\\`)e.consume();else if(n===`\\end`){t[t.length-1].length===0&&t.pop();break}else throw new A(`Expected \\\\ or \\cr or \\end`,e.nextToken)}for(var r=[],i=[r],a=0;a<t.length;a++){for(var o=t[a],s=Si(),c=0;c<o.length;c++)if(!Ci(o[c]))s.body.push(o[c]);else{r.push(s),c+=1;var l=pt(o[c]).text,u=[,,];if(u[0]={type:`ordgroup`,mode:`math`,body:[]},u[1]={type:`ordgroup`,mode:`math`,body:[]},!(`=|.`.indexOf(l)>-1))if(`<>AV`.indexOf(l)>-1)for(var d=0;d<2;d++){for(var f=!0,p=c+1;p<o.length;p++){if(wi(o[p],l)){f=!1,c=p;break}if(Ci(o[p]))throw new A(`Missing a `+l+` character to complete a CD arrow.`,o[p]);u[d].body.push(o[p])}if(f)throw new A(`Missing a `+l+` character to complete a CD arrow.`,o[c])}else throw new A(`Expected one of "<>AV=|." after @`,o[c]);var m={type:`styling`,body:[_t(l,u,e)],mode:`math`,style:`display`};r.push(m),s=Si()}a%2==0?r.push(s):r.shift(),r=[],i.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:`math`,body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:Array(i[0].length).fill({type:`align`,align:`c`,pregap:.25,postgap:.25}),colSeparationType:`CD`,hLinesBeforeRow:Array(i.length+1).fill([])}}function yt(e,t){var n=mt(e);if(n&&j.contains(sa,n.text))return n;throw n?new A(`Invalid delimiter '`+n.text+`' after '`+t.funcName+`'`,e):new A(`Invalid delimiter type '`+e.type+`'`,e)}function bt(e){if(!e.body)throw Error(`Bug: The leftright ParseNode wasn't fully parsed.`)}function xt(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:a,mathmlBuilder:o}=e,s={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},c=0;c<n.length;++c)ua[n[c]]=s;a&&(Rr[t]=a),o&&(zr[t]=o)}function k(e,t){da[e]=t}function St(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n===`\\relax`&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n===`\\hline`||n===`\\hdashline`;)e.consume(),t.push(n===`\\hdashline`),e.consumeSpaces(),n=e.fetch().text;return t}function Ct(e){if(e.indexOf(`ed`)===-1)return e.indexOf(`*`)===-1}function wt(e,t,n){var{hskipBeforeAndAfter:r,addJot:i,cols:a,arraystretch:o,colSeparationType:s,autoTag:c,singleRow:l,emptySingleRow:u,maxNumCols:d,leqno:f}=t;if(e.gullet.beginGroup(),l||e.gullet.macros.set(`\\cr`,`\\\\\\relax`),!o){var p=e.gullet.expandMacroAsText(`\\arraystretch`);if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new A(`Invalid \\arraystretch: `+p)}e.gullet.beginGroup();var m=[],h=[m],g=[],_=[],v=c==null?void 0:[];function y(){c&&e.gullet.macros.set(`\\@eqnsw`,`1`,!0)}function b(){v&&(e.gullet.macros.get(`\\df@tag`)?(v.push(e.subparse([new Ot(`\\df@tag`)])),e.gullet.macros.set(`\\df@tag`,void 0,!0)):v.push(!!c&&e.gullet.macros.get(`\\@eqnsw`)===`1`))}for(y(),_.push(St(e));;){var x=e.parseExpression(!1,l?`\\end`:`\\\\`);e.gullet.endGroup(),e.gullet.beginGroup(),x={type:`ordgroup`,mode:e.mode,body:x},n&&(x={type:`styling`,mode:e.mode,style:n,body:[x]}),m.push(x);var S=e.fetch().text;if(S===`&`){if(d&&m.length===d){if(l||s)throw new A(`Too many tab characters: &`,e.nextToken);e.settings.reportNonstrict(`textEnv`,`Too few columns specified in the {array} column argument.`)}e.consume()}else if(S===`\\end`){b(),m.length===1&&x.type===`styling`&&x.body[0].body.length===0&&(h.length>1||!u)&&h.pop(),_.length<h.length+1&&_.push([]);break}else if(S===`\\\\`){e.consume();var C=void 0;e.gullet.future().text!==` `&&(C=e.parseSizeGroup(!0)),g.push(C?C.value:null),b(),_.push(St(e)),m=[],h.push(m),y()}else throw new A(`Expected & or \\\\ or \\cr or \\end`,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:e.mode,addJot:i,arraystretch:o,body:h,cols:a,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:_,colSeparationType:s,tags:v,leqno:f}}function Tt(e){return e.slice(0,1)===`d`?`display`:`text`}function Et(e,t,n){for(var r=Kr(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,a=0;a<r.length;a++){var o=r[a].classes.indexOf(`sizing`);o<0?Array.prototype.push.apply(r[a].classes,t.sizingClasses(n)):r[a].classes[o+1]===`reset-size`+t.size&&(r[a].classes[o+1]=`reset-size`+n.size),r[a].height*=i,r[a].depth*=i}return J.makeFragment(r)}var Dt,Ot,A,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,j,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,M,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,N,P,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,F,I,L,R,z,B,V,Un,Wn,H,U,Gn,Kn,W,qn,G,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,K,ir,q,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,J,Y,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,X,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Z,Qr,$r,ei,Q,ti,ni,ri,ii,ai,$,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao=n((()=>{for(Dt=class e{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new e(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}},Ot=class e{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(t,n){return new e(n,Dt.range(this,t))}},A=class e{constructor(t,n){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}var d=Error(r);return d.name=`ParseError`,d.__proto__=e.prototype,d.position=i,i!=null&&a!=null&&(d.length=a-i),d.rawMessage=t,d}},A.prototype.__proto__=Error.prototype,kt=function(e,t){return e.indexOf(t)!==-1},At=function(e,t){return e===void 0?t:e},jt=/([A-Z])/g,Mt=function(e){return e.replace(jt,`-$1`).toLowerCase()},Nt={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},Pt=/[&><"']/g,Ft=function e(t){return t.type===`ordgroup`||t.type===`color`?t.body.length===1?e(t.body[0]):t:t.type===`font`?e(t.body):t},It=function(e){var t=Ft(e);return t.type===`mathord`||t.type===`textord`||t.type===`atom`},Lt=function(e){if(!e)throw Error(`Expected non-null, but got `+String(e));return e},j={contains:kt,deflt:At,escape:$e,hyphenate:Mt,getBaseElem:Ft,isCharacterBox:It,protocolFromUrl:function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`}},Rt={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}},zt=class{constructor(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={},Rt)if(Rt.hasOwnProperty(t)){var n=Rt[t];this[t]=e[t]===void 0?et(n):n.processor?n.processor(e[t]):e[t]}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new A(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=j.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},Bt=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Yt[Xt[this.id]]}sub(){return Yt[Zt[this.id]]}fracNum(){return Yt[Qt[this.id]]}fracDen(){return Yt[$t[this.id]]}cramp(){return Yt[en[this.id]]}text(){return Yt[tn[this.id]]}isTight(){return this.size>=2}},Vt=0,Ht=1,Ut=2,Wt=3,Gt=4,Kt=5,qt=6,Jt=7,Yt=[new Bt(Vt,0,!1),new Bt(Ht,0,!0),new Bt(Ut,1,!1),new Bt(Wt,1,!0),new Bt(Gt,2,!1),new Bt(Kt,2,!0),new Bt(qt,3,!1),new Bt(Jt,3,!0)],Xt=[Gt,Kt,Gt,Kt,qt,Jt,qt,Jt],Zt=[Kt,Kt,Kt,Kt,Jt,Jt,Jt,Jt],Qt=[Ut,Wt,Gt,Kt,qt,Jt,qt,Jt],$t=[Wt,Wt,Kt,Kt,Jt,Jt,Jt,Jt],en=[Ht,Ht,Wt,Wt,Kt,Kt,Jt,Jt],tn=[Vt,Ht,Ut,Wt,Ut,Wt,Ut,Wt],M={DISPLAY:Yt[Vt],TEXT:Yt[Ut],SCRIPT:Yt[Gt],SCRIPTSCRIPT:Yt[qt]},nn=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}],rn=[],nn.forEach(e=>e.blocks.forEach(e=>rn.push(...e))),an=80,on=function(e,t){return`M95,`+(622+e+t)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+e/2.075+` -`+e+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},sn=function(e,t){return`M263,`+(601+e+t)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+e/2.084+` -`+e+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},cn=function(e,t){return`M983 `+(10+e+t)+`
l`+e/3.13+` -`+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},ln=function(e,t){return`M424,`+(2398+e+t)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+e/4.223+` -`+e+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+e)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+` `+t+`
h400000v`+(40+e)+`h-400000z`},un=function(e,t){return`M473,`+(2713+e+t)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+` -`+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+e)+` `+t+`h400000v`+(40+e)+`H1017.7z`},dn=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},fn=function(e,t,n){var r=n-54-t-e;return`M702 `+(e+t)+`H400000`+(40+e)+`
H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},pn=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=on(t,an);break;case`sqrtSize1`:r=sn(t,an);break;case`sqrtSize2`:r=cn(t,an);break;case`sqrtSize3`:r=ln(t,an);break;case`sqrtSize4`:r=un(t,an);break;case`sqrtTall`:r=fn(t,an,n)}return r},mn=function(e,t){switch(e){case`⎜`:return`M291 0 H417 V`+t+` H291z M291 0 H417 V`+t+` H291z`;case`∣`:return`M145 0 H188 V`+t+` H145z M145 0 H188 V`+t+` H145z`;case`∥`:return`M145 0 H188 V`+t+` H145z M145 0 H188 V`+t+` H145z`+(`M367 0 H410 V`+t+` H367z M367 0 H410 V`+t+` H367z`);case`⎟`:return`M457 0 H583 V`+t+` H457z M457 0 H583 V`+t+` H457z`;case`⎢`:return`M319 0 H403 V`+t+` H319z M319 0 H403 V`+t+` H319z`;case`⎥`:return`M263 0 H347 V`+t+` H263z M263 0 H347 V`+t+` H263z`;case`⎪`:return`M384 0 H504 V`+t+` H384z M384 0 H504 V`+t+` H384z`;case`⏐`:return`M312 0 H355 V`+t+` H312z M312 0 H355 V`+t+` H312z`;case`‖`:return`M257 0 H300 V`+t+` H257z M257 0 H300 V`+t+` H257z`+(`M478 0 H521 V`+t+` H478z M478 0 H521 V`+t+` H478z`);default:return``}},hn={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 8