diffbook-app 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/bin/export.mjs +4 -0
  2. package/bin/serve-static.mjs +11 -0
  3. package/dist/client/assets/{CodeBlocks.impl-8fm4eP2E.js → CodeBlocks.impl-B2bHHbVr.js} +1 -1
  4. package/dist/client/assets/{Quiz.impl-Czw0AT5-.js → Quiz.impl-noCK8St2.js} +1 -1
  5. package/dist/client/assets/{_-BnmuYgCn.js → _-CzvvmzrL.js} +1 -1
  6. package/dist/client/assets/{_-CWRmCnat.js → _-DtlOTuaQ.js} +1 -1
  7. package/dist/client/assets/{_bookSlug-uvbJ2lZK.js → _bookSlug-CDIukwwd.js} +1 -1
  8. package/dist/client/assets/{book-links-oBD5_TD9.js → book-links-POwyHx-T.js} +11 -11
  9. package/dist/client/assets/{book-view-D8DLuZwr.js → book-view-B1VhlTqp.js} +3 -3
  10. package/dist/client/assets/{index-DcbQMucQ.js → index-fwL8CzeX.js} +2 -2
  11. package/dist/client/assets/{islands-BwU5t8ZK.js → islands-B6tNK80x.js} +2 -2
  12. package/dist/client/assets/{routes-CT1bBFQw.js → routes-DFt923uJ.js} +1 -1
  13. package/dist/client/assets/{search-BQRXPbYd.js → search-CiDFupIW.js} +1 -1
  14. package/dist/client/assets/{search-ByaQDQCI.js → search-RZsiFwn_.js} +1 -1
  15. package/dist/client/assets/{search-static-CANzr7Ay.js → search-static-BBk4OCV1.js} +1 -1
  16. package/dist/client/assets/{unavailable-YWEROYT2.js → unavailable-zzVFaXGP.js} +1 -1
  17. package/dist/server/assets/{Chart.impl-CoSFHAkZ.js → Chart.impl-BD778Sfz.js} +1 -1
  18. package/dist/server/assets/{CodeBlocks.impl-D0UyITJk.js → CodeBlocks.impl-BzZzzShT.js} +1 -1
  19. package/dist/server/assets/{Quiz.impl-D-jyKFzT.js → Quiz.impl--cKtTK4q.js} +1 -1
  20. package/dist/server/assets/{_-jK1csG3l.js → _-B80GDgiD.js} +1 -1
  21. package/dist/server/assets/{_-DdSkkwCj.js → _-B_NWL_qD.js} +1 -1
  22. package/dist/server/assets/{_-Dl8L0oTA.js → _-BtAixLy_.js} +3 -3
  23. package/dist/server/assets/{_-FUnPhrKP.js → _-CP8_agta.js} +3 -3
  24. package/dist/server/assets/{_bookSlug-D2UZWAHI.js → _bookSlug-CKPYyfgT.js} +1 -1
  25. package/dist/server/assets/{_bookSlug-Ra6D0Anb.js → _bookSlug-DrcXOgap.js} +4 -4
  26. package/dist/server/assets/{_tanstack-start-manifest_v-Ls_2zams.js → _tanstack-start-manifest_v-DzW688Vp.js} +22 -22
  27. package/dist/server/assets/{book-27zd8xMq.js → book-DwyvrUaa.js} +1 -1
  28. package/dist/server/assets/{book-links-DBPZZUO9.js → book-links-Bf2mPPK2.js} +15 -24
  29. package/dist/server/assets/{book-view-CZ19qQ01.js → book-view-BNB-pHS9.js} +6 -5
  30. package/dist/server/assets/{dist-CavVXdxV.js → dist-Dum_xO7d.js} +19 -10
  31. package/dist/server/assets/{islands-CC6fLMd4.js → islands-CrS5y5FI.js} +9 -9
  32. package/dist/server/assets/{router-D_hgIf_w.js → router-DpEmZ9-Y.js} +6 -6
  33. package/dist/server/assets/{routes-6WLGfEkb.js → routes-DcjNYCIo.js} +1 -1
  34. package/dist/server/assets/{routes-JZ-jv6kU.js → routes-FcpIT7AD.js} +5 -5
  35. package/dist/server/assets/{search-D0xbOYMw.js → search-B9QT-xba.js} +1 -1
  36. package/dist/server/assets/{search-Bin1_Wwn.js → search-CCISbhVN.js} +2 -2
  37. package/dist/server/assets/{search-C_oIfoAM.js → search-Kx_2e8nt.js} +2 -2
  38. package/dist/server/assets/{search-E-VnyBez.js → search-WKn1ukuf.js} +1 -1
  39. package/dist/server/assets/{unavailable-BiwA5vh7.js → unavailable-0XWFBxtd.js} +2 -2
  40. package/dist/server/server.js +8 -8
  41. package/package.json +3 -3
package/bin/export.mjs CHANGED
@@ -109,3 +109,7 @@ try {
109
109
  } finally {
110
110
  shutdown();
111
111
  }
112
+
113
+ // GitHub Pages serves 404.html for unmatched paths; ship the app shell so deep links
114
+ // boot the SPA instead of GitHub's stock 404.
115
+ await cp(path.join(output, 'index.html'), path.join(output, '404.html'));
@@ -61,6 +61,17 @@ async function resolveFile(urlPath) {
61
61
  const server = http.createServer(async (req, res) => {
62
62
  const file = await resolveFile(req.url ?? '/');
63
63
  if (!file) {
64
+ // Mirror GitHub Pages: serve 404.html (app shell) for unmatched paths.
65
+ const fallback = path.join(root, '404.html');
66
+ try {
67
+ if ((await stat(fallback)).isFile()) {
68
+ res.writeHead(404, { 'content-type': MIME['.html'] });
69
+ createReadStream(fallback).pipe(res);
70
+ return;
71
+ }
72
+ } catch {
73
+ /* no 404.html — fall through to plain text */
74
+ }
64
75
  res.writeHead(404, { 'content-type': 'text/plain' });
65
76
  res.end('Not found');
66
77
  return;
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-Cm4-xod0.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/html-BLkwJ0Yd.js","assets/javascript-DcMHgNcu.js","assets/css-vJJohHMc.js","assets/angular-ts-Dopuir71.js","assets/scss-0nEf0IT-.js","assets/apl-sOqNBhKb.js","assets/xml-C01ajBW7.js","assets/java-D7h0NA_A.js","assets/json-DePJdKYk.js","assets/astro-DCKrGHxW.js","assets/typescript-BTGs5etX.js","assets/postcss-BXeXVLqQ.js","assets/tsx-DvWhG4dC.js","assets/blade-Eu0AhoJj.js","assets/html-derivative-B3p5VrMH.js","assets/sql-69VAgb2g.js","assets/bsl-BkkzgIyY.js","assets/sdbl-bTVj8UrX.js","assets/c-BNQJhXlP.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/cobol-DX4J-9wY.js","assets/coffee-BP03ytLP.js","assets/cpp-CasgGaGT.js","assets/regexp-I2jnduhj.js","assets/glsl-CyFpZtQv.js","assets/crystal-BfsqXVWK.js","assets/shellscript-B51zB43X.js","assets/edge-CA3vJMQc.js","assets/elixir-BEGKZ2an.js","assets/elm-Bmx6Fs0i.js","assets/erb-DMof5dQp.js","assets/ruby-D4hi37gB.js","assets/haml-4q8AaN7U.js","assets/graphql-BIyAKkG2.js","assets/jsx-BUUYi3qs.js","assets/lua-Z49wBRLR.js","assets/yaml-BWCS3NLV.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-DEKoE2YW.js","assets/fortran-free-form-CYNrtFtB.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-C0sCabJj.js","assets/gdshader-CBce3t8t.js","assets/gdscript-Cp2uCuqX.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-C-RR1FSc.js","assets/glimmer-js-CL5fchz4.js","assets/glimmer-ts-D8vQYVEv.js","assets/hack-DYZBqq1e.js","assets/handlebars-CLjHtSqf.js","assets/http-c4_vT9ST.js","assets/hurl-BqZA9I9Q.js","assets/csv-Dx-8-gkx.js","assets/hxml-B0Qn7Nwc.js","assets/haxe-OTjmBuCE.js","assets/jinja-BeFOxtqS.js","assets/jison-Ru_S5AEn.js","assets/julia-Cjp8PLl-.js","assets/r-6KKCcqAj.js","assets/just-BNn7QYQh.js","assets/perl-Bbat8LJP.js","assets/latex-CHfMKPpb.js","assets/tex-Dp-_o7gQ.js","assets/liquid-bMiatp3a.js","assets/marko-C3klgjEa.js","assets/less-DVTAwKKz.js","assets/mdc-DeN4Wli_.js","assets/nextflow-Bbiyy34d.js","assets/nextflow-groovy-Dc_ddanL.js","assets/nginx-BrbrEdla.js","assets/nim-BDqgSjeY.js","assets/php-C7Ta4TMI.js","assets/pug-BPcX_o8k.js","assets/qml-g4UDed-8.js","assets/razor-C8auZuEu.js","assets/csharp-Ct8U2NOr.js","assets/rst-Dw3vrK1D.js","assets/cmake-Bj61d0ZC.js","assets/sas-QXkbaQLP.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-B-KBpmJs.js","assets/soy-Bo6kOkke.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-LOZmcJVN.js","assets/surrealql-dFrJr534.js","assets/svelte-B4PVQJ-7.js","assets/templ-BQDsbizH.js","assets/go-BJwz_mda.js","assets/ts-tags-DFxfPaBI.js","assets/twig-CG94ZwIJ.js","assets/vue-CEqXEh2N.js","assets/vue-html-BXjKVtKk.js","assets/vue-vine-DdvC-EE2.js","assets/stylus-B6D30XZt.js","assets/xsl-CCLNyvR3.js"])))=>i.map(i=>d[i]);
2
- import{i as e,n as t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./react-FVqWAEVH.js";import{t as r}from"./jsx-runtime-DREnUpxT.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{D as a,E as o}from"./useRenderElement-BQ1V91fw.js";import{L as s}from"./book-links-oBD5_TD9.js";import{t as c}from"./createLucideIcon-CSrh2MqE.js";var l=c(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),u=c(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),d=r(),f=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function p(e){return m(e)}function m(e){return Array.isArray(e)?h(e):e instanceof RegExp?e:typeof e==`object`?g(e):e}function h(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=m(e[n]);return t}function g(e){let t={};for(let n in e)t[n]=m(e[n]);return t}function _(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ee(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ee(e.substring(0,e.length-1)):e.substr(~t+1)}var te=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ne=class{static hasCaptures(e){return e!==null&&(te.lastIndex=0,te.test(e))}static replaceCaptures(e,t,n){return e.replace(te,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function re(e,t){return e<t?-1:+(e>t)}function ie(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=re(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function ae(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function oe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var se=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},ce=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(pe(e),t)}static createFromParsedTheme(e,t){return he(e,t)}_cachedMatchRoot=new se(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ue(e.parent,t.parentScopes));return n?new fe(n.fontStyle,n.foreground,n.background):null}},le=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ue(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!de(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function de(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var fe=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function pe(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&ae(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&ae(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new me(l,u,e,o,s,c)}}return n}var me=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},v=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(v||{});function he(e,t){e.sort((e,t)=>{let n=re(e.scope,t.scope);return n!==0||(n=ie(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new ge(t),o=new fe(n,a.getId(r),a.getId(i)),s=new ye(new ve(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new ce(a,o,s)}var ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},_e=Object.freeze([]),ve=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||_e,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},ye=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),ve.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(ie(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new ve(e,t,n,r,i))}},y=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=xe(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function be(e){return e}function xe(e){return e}function Se(e,t){let n=[],r=we(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Ce(i)){let e=[];do e.push(i),i=r.next();while(Ce(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Ce(e){return!!e&&!!e.match(/[\w\.:]+/)}function we(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Te(e){typeof e.dispose==`function`&&e.dispose()}var b=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ee=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},De=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Oe=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new b(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new De;for(let n of e)ke(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof b){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ke(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof b?x({baseGrammar:a,selfGrammar:i},r):Ae(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new b(e))}function Ae(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];S([r],t,n)}}function x(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&S(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&S(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function S(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?_({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&S(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Ie(i);switch(a.kind){case 0:x({...t,selfGrammar:t.baseGrammar},n);break;case 1:x(t,n);break;case 2:Ae(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Ae(a.ruleName,i,n):x(i,n)}else a.kind===4?n.add(new Ee(a.scopeName,a.ruleName)):n.add(new b(a.scopeName))}}}var je=class{kind=0},Me=class{kind=1},Ne=class{constructor(e){this.ruleName=e}kind=2},Pe=class{constructor(e){this.scopeName=e}kind=3},Fe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ie(e){if(e===`$base`)return new je;if(e===`$self`)return new Me;let t=e.indexOf(`#`);return t===-1?new Pe(e):t===0?new Ne(e.substring(1)):new Fe(e.substring(0,t),e.substring(t+1))}var Le=/\\(\d+)/,Re=/\\(\d+)/g,ze=-1,Be=-2;function Ve(e){return e}function He(e){return e}var C=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ne.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ne.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ee(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ne.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ne.replaceCaptures(this._contentName,e,t)}},Ue=class extends C{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},We=class extends C{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new T(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new E,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ge=class extends C{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new E,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ke=class extends C{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new T(i,this.id),this.beginCaptures=a,this._end=new T(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new E;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},w=class extends C{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new T(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new T(o,Be),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new E;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new E,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},qe=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ue(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new We(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=_({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Ge(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new w(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ke(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Ie(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Ge||e instanceof Ke||e instanceof w)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},T=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Le.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Re.lastIndex=0,this.source.replace(Re,(e,t)=>oe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},E=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Je(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new Je(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Je=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
2
+ import{i as e,n as t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./react-FVqWAEVH.js";import{t as r}from"./jsx-runtime-DREnUpxT.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{D as a,E as o}from"./useRenderElement-BQ1V91fw.js";import{L as s}from"./book-links-POwyHx-T.js";import{t as c}from"./createLucideIcon-CSrh2MqE.js";var l=c(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),u=c(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),d=r(),f=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function p(e){return m(e)}function m(e){return Array.isArray(e)?h(e):e instanceof RegExp?e:typeof e==`object`?g(e):e}function h(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=m(e[n]);return t}function g(e){let t={};for(let n in e)t[n]=m(e[n]);return t}function _(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ee(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ee(e.substring(0,e.length-1)):e.substr(~t+1)}var te=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ne=class{static hasCaptures(e){return e!==null&&(te.lastIndex=0,te.test(e))}static replaceCaptures(e,t,n){return e.replace(te,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function re(e,t){return e<t?-1:+(e>t)}function ie(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=re(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function ae(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function oe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var se=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},ce=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(pe(e),t)}static createFromParsedTheme(e,t){return he(e,t)}_cachedMatchRoot=new se(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ue(e.parent,t.parentScopes));return n?new fe(n.fontStyle,n.foreground,n.background):null}},le=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ue(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!de(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function de(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var fe=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function pe(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&ae(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&ae(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new me(l,u,e,o,s,c)}}return n}var me=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},v=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(v||{});function he(e,t){e.sort((e,t)=>{let n=re(e.scope,t.scope);return n!==0||(n=ie(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new ge(t),o=new fe(n,a.getId(r),a.getId(i)),s=new ye(new ve(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new ce(a,o,s)}var ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},_e=Object.freeze([]),ve=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||_e,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},ye=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),ve.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(ie(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new ve(e,t,n,r,i))}},y=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=xe(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function be(e){return e}function xe(e){return e}function Se(e,t){let n=[],r=we(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Ce(i)){let e=[];do e.push(i),i=r.next();while(Ce(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Ce(e){return!!e&&!!e.match(/[\w\.:]+/)}function we(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Te(e){typeof e.dispose==`function`&&e.dispose()}var b=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ee=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},De=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Oe=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new b(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new De;for(let n of e)ke(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof b){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ke(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof b?x({baseGrammar:a,selfGrammar:i},r):Ae(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new b(e))}function Ae(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];S([r],t,n)}}function x(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&S(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&S(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function S(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?_({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&S(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Ie(i);switch(a.kind){case 0:x({...t,selfGrammar:t.baseGrammar},n);break;case 1:x(t,n);break;case 2:Ae(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Ae(a.ruleName,i,n):x(i,n)}else a.kind===4?n.add(new Ee(a.scopeName,a.ruleName)):n.add(new b(a.scopeName))}}}var je=class{kind=0},Me=class{kind=1},Ne=class{constructor(e){this.ruleName=e}kind=2},Pe=class{constructor(e){this.scopeName=e}kind=3},Fe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ie(e){if(e===`$base`)return new je;if(e===`$self`)return new Me;let t=e.indexOf(`#`);return t===-1?new Pe(e):t===0?new Ne(e.substring(1)):new Fe(e.substring(0,t),e.substring(t+1))}var Le=/\\(\d+)/,Re=/\\(\d+)/g,ze=-1,Be=-2;function Ve(e){return e}function He(e){return e}var C=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ne.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ne.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ee(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ne.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ne.replaceCaptures(this._contentName,e,t)}},Ue=class extends C{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},We=class extends C{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new T(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new E,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ge=class extends C{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new E,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ke=class extends C{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new T(i,this.id),this.beginCaptures=a,this._end=new T(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new E;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},w=class extends C{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new T(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new T(o,Be),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new E;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new E,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},qe=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ue(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new We(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=_({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Ge(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new w(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ke(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Ie(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Ge||e instanceof Ke||e instanceof w)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},T=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Le.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Re.lastIndex=0,this.source.replace(Re,(e,t)=>oe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},E=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Je(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new Je(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Je=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
3
  `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ye=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Xe=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Ye(e,8),this._embeddedLanguagesMatcher=new Ze(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Ye(0,0);_getBasicScopeAttributes=new se(e=>new Ye(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Ze=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>oe(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Qe=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function $e(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=et(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Qe(i,!0);f()}return new Qe(i,!1);function f(){let o=tt(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===ze){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),D(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Ke){let r=o;D(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof w){let r=o;D(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(D(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function et(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof w&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=at(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Be){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),D(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function tt(e,t,n,r,i,a){let o=nt(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=rt(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function nt(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=it(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function rt(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=it(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function it(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function at(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function D(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));$e(e,p,n&&d.start===0,d.start,f,i,!1,0),Te(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new ot(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ot=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function st(e,t,n,r,i,a,o,s){return new ut(e,t,n,r,i,a,o,s)}function ct(e,t,n,r,i){let a=Se(t,O),o=qe.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function O(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(lt(t[r],e))return n=r+1,!0;return!1})}function lt(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var ut=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Xe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=dt(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Se(e,O);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)ct(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&ct(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Ve(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[He(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=dt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=qe.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===ft.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=y.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?k.createRootAndLookUpScopeName(a,r,this):k.createRoot(`unknown`,r),t=new ft(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
4
  `;let a=this.createOnigString(e),o=a.content.length,s=new mt(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=$e(this,a,i,0,t,s,!0,r);return Te(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function dt(e,t){return e=p(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var k=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=le.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new le(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new le(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),y.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},ft=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?k.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:He(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=k.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Ve(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,k.fromExtension(r,n.contentNameScopesList))}},pt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Se(e,O).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Se(e,O).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},mt=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=y.set(n,0,be(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=y.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},ht=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,st(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},gt=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new ht(ce.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(ce.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new pt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Oe(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},_t=ft.NULL,vt=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],A=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};A.prototype.normal={},A.prototype.property={},A.prototype.space=void 0;function yt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new A(n,r,t)}function bt(e){return e.toLowerCase()}var j=class{constructor(e,t){this.attribute=t,this.property=e}};j.prototype.attribute=``,j.prototype.booleanish=!1,j.prototype.boolean=!1,j.prototype.commaOrSpaceSeparated=!1,j.prototype.commaSeparated=!1,j.prototype.defined=!1,j.prototype.mustUseProperty=!1,j.prototype.number=!1,j.prototype.overloadedBoolean=!1,j.prototype.property=``,j.prototype.spaceSeparated=!1,j.prototype.space=void 0;var xt=t({boolean:()=>M,booleanish:()=>N,commaOrSpaceSeparated:()=>L,commaSeparated:()=>I,number:()=>P,overloadedBoolean:()=>Ct,spaceSeparated:()=>F}),St=0,M=R(),N=R(),Ct=R(),P=R(),F=R(),I=R(),L=R();function R(){return 2**++St}var wt=Object.keys(xt),Tt=class extends j{constructor(e,t,n,r){let i=-1;if(super(e,t),Et(this,`space`,r),typeof n==`number`)for(;++i<wt.length;){let e=wt[i];Et(this,wt[i],(n&xt[e])===xt[e])}}};Tt.prototype.defined=!0;function Et(e,t,n){n&&(e[t]=n)}function z(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Tt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[bt(r)]=r,n[bt(a.attribute)]=r}return new A(t,n,e.space)}var Dt=z({properties:{ariaActiveDescendant:null,ariaAtomic:N,ariaAutoComplete:null,ariaBusy:N,ariaChecked:N,ariaColCount:P,ariaColIndex:P,ariaColSpan:P,ariaControls:F,ariaCurrent:null,ariaDescribedBy:F,ariaDetails:null,ariaDisabled:N,ariaDropEffect:F,ariaErrorMessage:null,ariaExpanded:N,ariaFlowTo:F,ariaGrabbed:N,ariaHasPopup:null,ariaHidden:N,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:F,ariaLevel:P,ariaLive:null,ariaModal:N,ariaMultiLine:N,ariaMultiSelectable:N,ariaOrientation:null,ariaOwns:F,ariaPlaceholder:null,ariaPosInSet:P,ariaPressed:N,ariaReadOnly:N,ariaRelevant:null,ariaRequired:N,ariaRoleDescription:F,ariaRowCount:P,ariaRowIndex:P,ariaRowSpan:P,ariaSelected:N,ariaSetSize:P,ariaSort:null,ariaValueMax:P,ariaValueMin:P,ariaValueNow:P,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ot(e,t){return t in e?e[t]:t}function kt(e,t){return Ot(e,t.toLowerCase())}var At=z({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:I,acceptCharset:F,accessKey:F,action:null,allow:null,allowFullScreen:M,allowPaymentRequest:M,allowUserMedia:M,alpha:M,alt:null,as:null,async:M,autoCapitalize:null,autoComplete:F,autoFocus:M,autoPlay:M,blocking:F,capture:null,charSet:null,checked:M,cite:null,className:F,closedBy:null,colorSpace:null,cols:P,colSpan:P,command:null,commandFor:null,content:null,contentEditable:N,controls:M,controlsList:F,coords:P|I,crossOrigin:null,data:null,dateTime:null,decoding:null,default:M,defer:M,dir:null,dirName:null,disabled:M,download:Ct,draggable:N,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:M,formTarget:null,headers:F,height:P,hidden:Ct,high:P,href:null,hrefLang:null,htmlFor:F,httpEquiv:F,id:null,imageSizes:null,imageSrcSet:null,inert:M,inputMode:null,integrity:null,is:null,isMap:M,itemId:null,itemProp:F,itemRef:F,itemScope:M,itemType:F,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:M,low:P,manifest:null,max:null,maxLength:P,media:null,method:null,min:null,minLength:P,multiple:M,muted:M,name:null,nonce:null,noModule:M,noValidate:M,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:M,optimum:P,pattern:null,ping:F,placeholder:null,playsInline:M,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:M,referrerPolicy:null,rel:F,required:M,reversed:M,rows:P,rowSpan:P,sandbox:F,scope:null,scoped:M,seamless:M,selected:M,shadowRootClonable:M,shadowRootCustomElementRegistry:M,shadowRootDelegatesFocus:M,shadowRootMode:null,shadowRootSerializable:M,shape:null,size:P,sizes:null,slot:null,span:P,spellCheck:N,src:null,srcDoc:null,srcLang:null,srcSet:null,start:P,step:null,style:null,tabIndex:P,target:null,title:null,translate:null,type:null,typeMustMatch:M,useMap:null,value:N,width:P,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:F,axis:null,background:null,bgColor:null,border:P,borderColor:null,bottomMargin:P,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:M,declare:M,event:null,face:null,frame:null,frameBorder:null,hSpace:P,leftMargin:P,link:null,longDesc:null,lowSrc:null,marginHeight:P,marginWidth:P,noResize:M,noHref:M,noShade:M,noWrap:M,object:null,profile:null,prompt:null,rev:null,rightMargin:P,rules:null,scheme:null,scrolling:N,standby:null,summary:null,text:null,topMargin:P,valueType:null,version:null,vAlign:null,vLink:null,vSpace:P,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:M,disablePictureInPicture:M,disableRemotePlayback:M,exportParts:I,part:F,prefix:null,property:null,results:P,security:null,unselectable:null},space:`html`,transform:kt}),jt=z({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:L,accentHeight:P,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:P,amplitude:P,arabicForm:null,ascent:P,attributeName:null,attributeType:null,azimuth:P,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:P,by:null,calcMode:null,capHeight:P,className:F,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:P,diffuseConstant:P,direction:null,display:null,dur:null,divisor:P,dominantBaseline:null,download:M,dx:null,dy:null,edgeMode:null,editable:null,elevation:P,enableBackground:null,end:null,event:null,exponent:P,externalResourcesRequired:null,fill:null,fillOpacity:P,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:I,g2:I,glyphName:I,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:P,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:P,horizOriginX:P,horizOriginY:P,id:null,ideographic:P,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:P,k:P,k1:P,k2:P,k3:P,k4:P,kernelMatrix:L,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:P,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:P,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:P,overlineThickness:P,paintOrder:null,panose1:null,path:null,pathLength:P,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:F,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:P,pointsAtY:P,pointsAtZ:P,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:L,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:L,rev:L,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:L,requiredFeatures:L,requiredFonts:L,requiredFormats:L,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:P,specularExponent:P,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:P,strikethroughThickness:P,string:null,stroke:null,strokeDashArray:L,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:P,strokeOpacity:P,strokeWidth:null,style:null,surfaceScale:P,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:L,tabIndex:P,tableValues:null,target:null,targetX:P,targetY:P,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:L,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:P,underlineThickness:P,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:P,values:null,vAlphabetic:P,vMathematical:P,vectorEffect:null,vHanging:P,vIdeographic:P,version:null,vertAdvY:P,vertOriginX:P,vertOriginY:P,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:P,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ot}),Mt=z({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Nt=z({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:kt}),Pt=z({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ft=/[A-Z]/g,It=/-[a-z]/g,Lt=/^data[-\w.:]+$/i;function Rt(e,t){let n=bt(t),r=t,i=j;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Lt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(It,Bt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!It.test(e)){let n=e.replace(Ft,zt);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Tt}return new i(r,t)}function zt(e){return`-`+e.toLowerCase()}function Bt(e){return e.charAt(1).toUpperCase()}var Vt=yt([Dt,At,Mt,Nt,Pt],`html`),Ht=yt([Dt,jt,Mt,Nt,Pt],`svg`),Ut={}.hasOwnProperty;function Wt(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Ut.call(t,e)){let n=String(t[e]);i=Ut.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Gt=/["&'<>`]/g,Kt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,qt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Jt=/[|\\{}()[\]^$+*?.]/g,Yt=new WeakMap;function Xt(e,t){if(e=e.replace(t.subset?Zt(t.subset):Gt,r),t.subset||t.escapeOnly)return e;return e.replace(Kt,n).replace(qt,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Zt(e){let t=Yt.get(e);return t||(t=Qt(e),Yt.set(e,t)),t}function Qt(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Jt,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var $t=/[\dA-Fa-f]/;function en(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!$t.test(String.fromCharCode(t))?r:r+`;`}var tn=/\d/;function nn(e,t,n){let r=`&#`+String(e);return n&&t&&!tn.test(String.fromCharCode(t))?r:r+`;`}var rn=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),an={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},on=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],sn={}.hasOwnProperty,cn={},B;for(B in an)sn.call(an,B)&&(cn[an[B]]=B);var ln=/[^\dA-Za-z]/;function un(e,t,n,r){let i=String.fromCharCode(e);if(sn.call(cn,i)){let e=cn[i],a=`&`+e;return n&&rn.includes(e)&&!on.includes(e)&&(!r||t&&t!==61&&ln.test(String.fromCharCode(t)))?a:a+`;`}return``}function dn(e,t,n){let r=en(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=un(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=nn(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function V(e,t){return Xt(e,Object.assign({format:dn},t))}var fn=/^>|^->|<!--|-->|--!>|<!-$/g,pn=[`>`],mn=[`<`,`>`];function hn(e,t,n,r){return r.settings.bogusComments?`<?`+V(e.value,Object.assign({},r.settings.characterReferences,{subset:pn}))+`>`:`<!--`+e.value.replace(fn,i)+`-->`;function i(e){return V(e,Object.assign({},r.settings.characterReferences,{subset:mn}))}}function gn(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function _n(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function vn(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function yn(e){return e.join(` `).trim()}var bn=/[ \t\n\f\r]/g;function xn(e){return typeof e==`object`?e.type===`text`&&Sn(e.value):Sn(e)}function Sn(e){return e.replace(bn,``)===``}var H=Tn(1),Cn=Tn(-1),wn=[];function Tn(e){return t;function t(t,n,r){let i=t?t.children:wn,a=(n||0)+e,o=i[a];if(!r)for(;o&&xn(o);)a+=e,o=i[a];return o}}var En={}.hasOwnProperty;function Dn(e){return t;function t(t,n,r){return En.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var On=Dn({body:jn,caption:kn,colgroup:kn,dd:Fn,dt:Pn,head:kn,html:An,li:Nn,optgroup:Ln,option:Rn,p:Mn,rp:In,rt:In,tbody:Bn,td:Un,tfoot:Vn,th:Un,thead:zn,tr:Hn});function kn(e,t,n){let r=H(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&xn(r.value.charAt(0)))}function An(e,t,n){let r=H(n,t);return!r||r.type!==`comment`}function jn(e,t,n){let r=H(n,t);return!r||r.type!==`comment`}function Mn(e,t,n){let r=H(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Nn(e,t,n){let r=H(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Pn(e,t,n){let r=H(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Fn(e,t,n){let r=H(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function In(e,t,n){let r=H(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Ln(e,t,n){let r=H(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Rn(e,t,n){let r=H(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function zn(e,t,n){let r=H(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Bn(e,t,n){let r=H(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Vn(e,t,n){return!H(n,t)}function Hn(e,t,n){let r=H(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Un(e,t,n){let r=H(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Wn=Dn({body:qn,colgroup:Jn,head:Kn,html:Gn,tbody:Yn});function Gn(e){let t=H(e,-1);return!t||t.type!==`comment`}function Kn(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function qn(e){let t=H(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&xn(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function Jn(e,t,n){let r=Cn(n,t),i=H(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&On(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Yn(e,t,n){let r=Cn(n,t),i=H(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&On(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var U={name:[[`
5
5
  \f\r &/=>`.split(``),`
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-FVqWAEVH.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{D as r,E as i,b as a,c as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,y}from"./useRenderElement-BQ1V91fw.js";import{A as b,C as ee,D as x,E as S,F as C,G as w,H as T,M as E,N as D,O as te,P as ne,S as O,T as k,U as re,_ as A,b as ie,c as j,d as M,g as N,h as P,j as F,k as ae,l as I,m as oe,o as se,p as ce,s as L,u as R,v as z,w as B,x as V,y as H}from"./book-links-oBD5_TD9.js";import{t as U}from"./createLucideIcon-CSrh2MqE.js";var le=5,W=6,G=10,K=(e,t,n,r)=>(e.events=e.events||{},e.events[n+G]||(e.events[n+G]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+G](),delete e.events[n+G])}),ue=1e3,de=(e,t)=>K(e,n=>{let r=t(n);r&&e.events[W].push(r)},le,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[W]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[W])t();e.events[W]=[]}},ue)},()=>{e.listen=n,e.off=r}}),q=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);function fe(e){return E(e,`base-ui`)}var J=e(t(),1);function pe(e,t){let n=J.useRef(e),r=m(t);c(()=>{n.current!==e&&r(n.current)},[e,r]),c(()=>{n.current=e},[e])}var me=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),he={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ge={disabled:!1,...Y},_e={valid(e){return e===null?null:e?{[me.valid]:``}:{[me.invalid]:``}}},X=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),ve={checked(e){return e?{[X.checked]:``}:{[X.unchecked]:``}},...C,..._e},ye=`data-composite-item-active`,be=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xe(){return J.useContext(be)}var Se=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Ce(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:l,elementsRef:u,labelsRef:d,nextIndexRef:f}=xe(),p=J.useRef(-1),[m,h]=J.useState(a??(i===Se.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=J.useRef(null),_=J.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(u.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,u,d,t,r]);return c(()=>{if(a!=null)return;let e=g.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),c(()=>{if(a==null)return l(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[a,l,h]),{ref:_,index:m}}function we(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=u(),{ref:i,index:a}=Ce(e),o=n===a,s=J.useRef(null),c=p(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Te(e){let{render:t,className:n,style:r,state:i=h,props:a=f,refs:o=f,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:p}=we({metadata:s});return _(l,e,{state:i,ref:[...o,p],props:[d,...a,u],stateAttributesMapping:c})}var Z={invalid:void 0,name:void 0,validityData:{state:he,errors:[],error:``,value:``,initialValue:null},setValidityData:l,disabled:void 0,touched:Y.touched,setTouched:l,dirty:Y.dirty,setDirty:l,filled:Y.filled,setFilled:l,focused:Y.focused,setFocused:l,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ge,markedDirtyRef:{current:!1},registerFieldControl:l,validation:{getValidationProps:(e,t=h)=>t,inputRef:{current:null},registerInput:l,commit:async()=>{},change:l}},Ee=J.createContext(Z);function De(e=!0){let t=J.useContext(Ee);if(t.setValidityData===l&&!e)throw Error(v(28));return t}var Oe=J.createContext({disabled:!1});function ke(){return J.useContext(Oe)}var Ae=J.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:e=>e});function je(){return J.useContext(Ae)}function Me(e,t,n,r=!0,i){let[a,o]=J.useState(),s=fe(i?`${i}-label`:void 0),l=e??t??a;return c(()=>{let i=e||t||!r?void 0:Q(n.current,s);a!==i&&o(i)}),l}function Q(e,t){let n=Ne(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Ne(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function Pe(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=je(),s=fe(t),u=n?i:void 0,f=d(()=>Symbol(`labelable-control`)),p=J.useRef(!1),h=J.useRef(t!=null),g=m(()=>{!p.current||o===l||(p.current=!1,o(f.current,void 0))});return c(()=>{if(o===l)return;let e;if(n){let n=r?.current;e=a(n)&&n.closest(`label`)!=null?t??null:u??s}else if(t!=null)h.current=!0,e=t;else if(h.current)e=s;else{g();return}if(e===void 0){g();return}p.current=!0,o(f.current,e)},[t,r,u,o,n,s,f,g]),J.useEffect(()=>g,[g]),i??s}var Fe=J.createContext(void 0);function Ie(){return J.useContext(Fe)}function Le(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Re=J.createContext(void 0);function ze(){let e=J.useContext(Re);if(e===void 0)throw Error(v(52));return e}var $=n(),Be=J.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:u,inputRef:d,nativeButton:f=!1,id:v,style:b,...ee}=e,x=Ie(),{disabled:S,readOnly:C,required:w,form:T,checkedValue:E,touched:O=!1,validation:k,name:re}=x??{},A=x?.setCheckedValue??l,ie=x?.setTouched??l,j=x?.registerControlRef??l,M=x?.registerInputRef??l,{setTouched:N,setFilled:P,state:F,disabled:I}=De(),oe=ke(),{labelId:se,getDescriptionProps:ce}=je(),L=I||oe.disabled||S||i,R=C||a,z=w||o,B=T,V=x?E===u:u===``,H=J.useRef(null),U=J.useRef(null),le=m(e=>{e&&j(e,L)}),W=p(d,U,M);c(()=>{U.current?.checked&&P(!0)},[P]),c(()=>{if(U.current){if(L&&V){M(null);return}H.current&&j(H.current,L),M(U.current)}},[V,L,j,M]);let G=fe(),K=Pe({id:v,implicit:!1,controlRef:H}),ue=f?void 0:K,de=Me(s,se,U,!f,ue),q={role:`radio`,"aria-checked":V,"aria-required":z||void 0,"aria-readonly":R||void 0,"aria-labelledby":de,[ye]:V?``:void 0,id:f?K:G,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||L||R)return;e.preventDefault();let t=U.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))},onFocus(e){e.defaultPrevented||L||R||!O||(U.current?.click(),ie(!1))}},{getButtonProps:pe,buttonRef:me}=g({disabled:L,native:f,composite:!1}),he={type:`radio`,ref:W,form:B,id:ue,name:re,tabIndex:-1,style:re?ae:te,"aria-hidden":!0,...u===void 0?h:{value:Le(u)},disabled:L,checked:V,required:z,readOnly:R,onChange(e){if(e.nativeEvent.defaultPrevented||L||R||u===void 0)return;let t=D(ne,e.nativeEvent);A(u,t),!t.isCanceled&&N(!0)},onFocus(){H.current?.focus()}},Y=J.useMemo(()=>({...F,required:z,disabled:L,readOnly:R,checked:V}),[F,L,R,V,z]),ge=Y,_e=x!==void 0,X=[t,H,me,le],be=[q,ee,pe,ce,k?e=>k.getValidationProps(L,e):h],xe=_(`span`,e,{enabled:!_e,state:Y,ref:X,props:be,stateAttributesMapping:ve});return(0,$.jsxs)(Re.Provider,{value:ge,children:[_e?(0,$.jsx)(Te,{tag:`span`,render:n,className:r,style:b,state:Y,refs:X,props:be,stateAttributesMapping:ve}):xe,(0,$.jsx)(`input`,{...he,suppressHydrationWarning:!0})]})}),Ve=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ze(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=O(c),f={...s,transitionStatus:u},p=J.useRef(null),m=a||l,h=_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:ve});return V({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null});function He({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(t);return[i?e:a,J.useCallback(e=>{i||o(e)},[])]}function Ue(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=m(i),o=J.useRef(0),s=d(Ge).current,l=d(We).current,[u,f]=J.useState(0),p=J.useRef(u),h=m((e,t)=>{l.set(e,t??null),p.current+=1,f(p.current)}),g=m(e=>{l.delete(e),p.current+=1,f(p.current)}),_=J.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(Ke).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);c(()=>{if(typeof MutationObserver!=`function`||_.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(p.current+=1,f(p.current))});return _.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[_]),c(()=>{p.current===u&&(n.current.length!==_.size&&(n.current.length=_.size),r&&r.current.length!==_.size&&(r.current.length=_.size),o.current=_.size),a(_)},[a,_,n,r,u]),c(()=>()=>{n.current=[]},[n]),c(()=>()=>{r&&(r.current=[])},[r]);let v=m(e=>(s.add(e),()=>{s.delete(e)}));c(()=>{s.forEach(e=>e(_))},[s,_]);let y=J.useMemo(()=>({register:h,unregister:g,subscribeMapChange:v,elementsRef:n,labelsRef:r,nextIndexRef:o}),[h,g,v,n,r,o]);return(0,$.jsx)(be.Provider,{value:y,children:t})}function We(){return new Map}function Ge(){return new Set}function Ke(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function qe(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var Je=[];function Ye(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:h=Je}=e,[g,_]=J.useState(0),v=r!=null,y=J.useRef(null),b=p(y,l),C=J.useRef([]),w=J.useRef(!1),T=o??g,E=m((e,t=!1)=>{if((s??_)(e),t){let t=C.current[e];ie(y.current,t,a,n)}}),D=m(e=>{if(e.size===0||w.current)return;w.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)E(i);else if(x(t,T,f)){let e=ee(t,{disabledIndices:f});S(t,e)||E(e)}ie(y.current,r,a,n)});c(()=>{if(f==null||o!=null||!w.current)return;let e=C.current;if(x(e,T,f)){let t=ee(e,{disabledIndices:f});S(e,t)||E(t)}},[f,o,T,C,E]);let te=m((e,t,n)=>i?i(e,t,n,C):n),ne=m(e=>{let o=u?M:L;if(!o.has(e.key)||Xe(e,h)||!y.current)return;let s=a===`rtl`,c=s?j:I,l={horizontal:c,vertical:se,both:c}[n],p=s?I:j,m={horizontal:p,vertical:R,both:p}[n],g=F(e.nativeEvent);if(g!=null&&H(g)&&!qe(g)){let t=g.selectionStart,n=g.selectionEnd,r=g.value??``;if(t==null||e.shiftKey||t!==n||e.key!==m&&t<r.length||e.key!==l&&t>0)return}let _=T,b=k(C,f),x=B(C,f);r!=null&&(_=r({disabledIndices:f,elementsRef:C,event:e,highlightedIndex:T,loopFocus:t,maxIndex:x,minIndex:b,onLoop:te,orientation:n,rtl:s}));let w={horizontal:[c],vertical:[se],both:[c,se]}[n],D={horizontal:[p],vertical:[R],both:[p,R]}[n],ne=v?o:{horizontal:u?oe:ce,vertical:u?z:A,both:o}[n];u&&(e.key===`Home`?_=b:e.key===`End`&&(_=x)),_===T&&(w.includes(e.key)||D.includes(e.key))&&(t&&_===x&&w.includes(e.key)?(_=b,i&&(_=i(e,T,_,C))):t&&_===b&&D.includes(e.key)?(_=x,i&&(_=i(e,T,_,C))):_=ee(C.current,{startingIndex:_,decrement:D.includes(e.key),disabledIndices:f})),_!==T&&!S(C.current,_)&&(d&&e.stopPropagation(),ne.has(e.key)&&e.preventDefault(),E(_,!0),queueMicrotask(()=>{C.current[_]?.focus()}))});return{props:{ref:b,onFocus(e){let t=y.current,n=F(e.nativeEvent);!t||n==null||!H(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:ne},highlightedIndex:T,onHighlightedIndexChange:E,elementsRef:C,disabledIndices:f,onMapChange:D,relayKeyboardEvent:ne}}function Xe(e,t){for(let n of P.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var Ze=J.createContext(void 0);function Qe(){return J.useContext(Ze)?.direction??`ltr`}function $e(e){let{render:t,className:n,style:r,refs:i=f,props:a=f,state:s=h,stateAttributesMapping:c,highlightedIndex:l,onHighlightedIndexChange:u,orientation:d,grid:p,loopFocus:m,onLoop:g,enableHomeAndEndKeys:v,onMapChange:y,stopEventPropagation:b=!0,rootRef:ee,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:te,elementsRef:ne,onMapChange:O,relayKeyboardEvent:k}=Ye({grid:p,loopFocus:m,onLoop:g,orientation:d,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:ee,stopEventPropagation:b,enableHomeAndEndKeys:v,direction:Qe(),disabledIndices:x,modifierKeys:S}),re=_(w,e,{state:s,ref:i,props:[E,...a,T],stateAttributesMapping:c}),A=J.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:te,highlightItemOnHover:C,relayKeyboardEvent:k}),[D,te,C,k]);return(0,$.jsx)(o.Provider,{value:A,children:(0,$.jsx)(Ue,{elementsRef:ne,onMapChange:e=>{y?.(e),O(e)},children:re})})}function et(e,t,n,r,i=!0,a){let{registerFieldControl:o}=De(),s=J.useRef(null);s.current||=Symbol(),c(()=>{let c=s.current;if(!(!c||!i))return o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}),()=>{o(c,void 0)}},[e,i,r,t,a,o,n])}var tt=J.createContext(void 0);function nt(e=!1){let t=J.useContext(tt);if(!t&&!e)throw Error(v(86));return t}var rt=J.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function it(){return J.useContext(rt)}var at=[N],ot=J.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:h,...g}=e,{setTouched:_,setFocused:v,validationMode:y,name:ee,disabled:x,state:S,validation:C,setDirty:w,setFilled:T,validityData:E}=De(),{labelId:D}=je(),{clearErrors:te}=it(),ne=nt(!0),O=x||i,k=ee??d,re=fe(p),[A,ie]=He({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[j,M]=J.useState(!1),N=m((e,t)=>{s?.(e,t),!t.isCanceled&&ie(e)}),P=J.useRef(null),F=J.useRef(null),ae=J.useRef(null);function I(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),F.current=e,C.inputRef.current=e,t}let oe=m((e,t=!1)=>{if(e){if(t){P.current===e&&(P.current=null);return}P.current??=e}}),se=m(e=>{if(!e||e.disabled)return;ae.current||=e;let t=F.current;if(e.checked||t==null||t.disabled)return I(e)}),ce=m(()=>{let e=F.current;return!e||e.disabled||!e.checked?null:A??null});et(P,re,A??null,ce,!O,d),pe(A,()=>{te(k),w(A!==E.initialValue),T(A!=null),C.change(A);let e=ae.current;A==null&&e&&!e.disabled&&I(e)});let L=g[`aria-labelledby`]??D??ne?.legendId,R={...S,disabled:O??!1,required:o??!1,readOnly:a??!1},z=J.useMemo(()=>({...S,checkedValue:A,disabled:O,form:u,validation:C,name:k,readOnly:a,registerControlRef:oe,registerInputRef:se,required:o,setCheckedValue:N,setTouched:M,touched:j}),[A,O,u,C,S,k,a,oe,se,o,N,M,j]),B={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":O||void 0,"aria-readonly":a||void 0,"aria-labelledby":L,onFocus(){v(!0)},onBlur(e){b(e.currentTarget,e.relatedTarget)||(_(!0),v(!1),y===`onBlur`&&C.commit(A))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(M(!0),v(!0))}};return(0,$.jsx)(Fe.Provider,{value:z,children:(0,$.jsx)($e,{render:n,className:r,style:h,state:R,props:[B,g,e=>C.getValidationProps(O??!1,e)],refs:[t],stateAttributesMapping:_e,enableHomeAndEndKeys:!1,modifierKeys:at})})});function st({className:e,...t}){return(0,$.jsx)(ot,{"data-slot":`radio-group`,className:r(`grid w-full gap-2`,e),...t})}function ct({className:e,...t}){return(0,$.jsx)(Be,{"data-slot":`radio-group-item`,className:r(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,$.jsx)(Ve,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,$.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function lt(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var ut=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function dt(e){return J.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[ut.checked]:``}:{[ut.unchecked]:``}},..._e}),[e.indeterminate])}var ft=J.createContext(void 0);function pt(e=!0){let t=J.useContext(ft);if(t===void 0&&!e)throw Error(v(3));return t}var mt=J.createContext(void 0);function ht(){let e=J.useContext(mt);if(e===void 0)throw Error(v(14));return e}var gt=`data-parent`,_t=J.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:u,id:f,indeterminate:m=!1,inputRef:v,name:b,onCheckedChange:ee,parent:x=!1,readOnly:S=!1,render:C,required:w=!1,uncheckedValue:T,value:E,nativeButton:O=!1,style:k,...re}=e,{clearErrors:A}=it(),{disabled:ie,name:j,setDirty:M,setFilled:N,setFocused:P,setTouched:F,state:I,validationMode:oe,validityData:se,validation:ce}=De(),L=ke(),{labelId:R,controlId:z,registerControlId:B,getDescriptionProps:V}=je(),H=pt(),U=H?.parent,le=U&&H.allValues,W=ie||L.disabled||H?.disabled||o,G=j??b,K=E??G,ue=fe(),de=fe(),q=z;le?q=x?de:`${U.id}-${K}`:f&&(q=f);let me={};le&&(x?me=H.parent.getParentProps():K&&(me=H.parent.getChildProps(K)));let{checked:he=n,indeterminate:Y=m,onCheckedChange:ge,..._e}=me,X=H?.value,ve=H?.setValue,ye=H?.defaultValue,be=J.useRef(null),xe=d(()=>Symbol(`checkbox-control`)),Se=J.useRef(!1),{getButtonProps:Ce,buttonRef:we}=g({disabled:W,native:O}),Te=H?.validation??ce,[Z,Ee]=He({controlled:K&&X&&!x?X.includes(K):he,default:K&&ye&&!x?ye.includes(K):i,name:`Checkbox`,state:`checked`}),Oe=le?!!he:Z,Ae=le&&Y||m;c(()=>{B!==l&&(Se.current=!0,B(xe.current,q))},[q,B,xe]),J.useEffect(()=>{let e=xe.current;return()=>{!Se.current||B===l||(Se.current=!1,B(e,void 0))}},[B,xe]),et(be,ue,Z,void 0,!H&&!W,b);let Q=J.useRef(null),Ne=p(v,Q,Te.inputRef,Te.registerInput),Pe=Me(a,R,Q,!O,q??void 0);c(()=>{Q.current&&(Q.current.indeterminate=Ae,Z&&N(!0))},[Z,Ae,N]),pe(Z,()=>{H||(A(G),N(Z),M(Z!==se.initialValue),Te.change(Z))});let Fe=s({checked:Z,disabled:W,form:u,name:x?void 0:G,id:O?void 0:q??void 0,required:w,ref:Ne,style:G?ae:te,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(S){e.preventDefault();return}let t=e.currentTarget.checked,n=D(ne,e.nativeEvent);if(ee?.(t,n),!n.isCanceled&&(ge?.(t,n),!n.isCanceled&&(Ee(t),K&&X&&ve&&!x&&!le))){let e=t?[...X,K]:X.filter(e=>e!==K);ve(e,n)}},onFocus(){be.current?.focus()}},E===void 0?h:{value:(H?Z&&E:E)||``},V,e=>Te.getValidationProps(W,e));J.useEffect(()=>{if(!U||!K)return;let e=U.disabledStatesRef.current;return e.set(K,W),()=>{e.delete(K)}},[U,W,K]);let Ie=J.useMemo(()=>({...I,checked:Oe,disabled:W,readOnly:S,required:w,indeterminate:Ae}),[I,Oe,W,S,w,Ae]),Le=dt(Ie),Re=_(`span`,e,{state:Ie,ref:[we,be,t,H?.registerControlRef],props:[{id:O?q??void 0:ue,role:`checkbox`,"aria-checked":Ae?`mixed`:Oe,"aria-readonly":S||void 0,"aria-required":w||void 0,"aria-labelledby":Pe,[gt]:x?``:void 0,onFocus(){W||P(!0)},onBlur(){let e=Q.current;e&&(F(!0),P(!1),oe===`onBlur`&&Te.commit(H?X:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),y(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||lt(t)?.click()})},onClick(e){if(S||W)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},re,_e,Ce,V,e=>Te.getValidationProps(W,e)],stateAttributesMapping:Le});return(0,$.jsxs)(mt.Provider,{value:Ie,children:[Re,!Z&&!H&&G&&!x&&T!==void 0&&(0,$.jsx)(`input`,{type:`hidden`,form:u,name:G,value:T,disabled:W}),(0,$.jsx)(`input`,{...Fe,suppressHydrationWarning:!0})]})}),vt=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ht(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=O(c),f=J.useRef(null),p={...s,transitionStatus:u};V({open:c,ref:f,onComplete(){c||d(!1)}});let m={...dt(s),...C,..._e},h=a||l,g=_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function yt({className:e,...t}){return(0,$.jsx)(_t,{"data-slot":`checkbox`,className:r(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,$.jsx)(vt,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,$.jsx)(i,{})})})}var bt=e=>e,xt={},St={addEventListener(){},removeEventListener(){}};function Ct(){try{return typeof localStorage<`u`}catch{return!1}}Ct()&&(xt=localStorage),typeof window<`u`&&(St={addEventListener(e,t,n){window.addEventListener(`storage`,t),window.addEventListener(`pageshow`,n)},removeEventListener(e,t,n){window.removeEventListener(`storage`,t),window.removeEventListener(`pageshow`,n)}});function wt(e,t=void 0,n={}){let r=n.encode||bt,i=n.decode||bt,a=w(t),o=a.set;a.set=t=>{t===void 0?delete xt[e]:xt[e]=r(t),o(t)};function s(t){t.key===e?t.newValue===null?o(void 0):o(i(t.newValue)):xt[e]||o(void 0)}function c(){a.set(xt[e]?i(xt[e]):t)}return de(a,()=>{if(c(),n.listen!==!1)return St.addEventListener(e,s,c),()=>{St.removeEventListener(e,s,c)}}),a}var Tt=wt(`diffbook:quiz`,{},{encode:JSON.stringify,decode:JSON.parse});function Et(e){return Tt.get()[e]??{}}function Dt(e,t,n){let r={...Tt.get()},i={...r[e]??{}};i[t]=n,r[e]=i,Tt.set(r)}function Ot(e){let t={...Tt.get()};delete t[e],Tt.set(t)}function kt({correct:e,explanation:t}){return e===null?null:(0,$.jsxs)(`div`,{"aria-live":`polite`,role:`status`,className:`mt-3`,children:[(0,$.jsx)(`div`,{className:r(`flex items-center gap-2 text-sm font-medium`,e?`text-success`:`text-destructive`),children:e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:`Correct`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:`Incorrect`})]})}),t&&(0,$.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:t})]})}function At({id:e,prompt:t,choices:n,correct:i,explanation:a,onGraded:o,persisted:s,quizId:c}){let l=`q-${e}-prompt`,[u,d]=J.useState(s?.value==null?null:s.value),[f,p]=J.useState(s?.correct==null?null:s.correct);return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`p`,{id:l,className:`mb-3 text-sm font-medium text-foreground`,children:t}),(0,$.jsx)(st,{"aria-labelledby":l,value:u===null?``:String(u),onValueChange:e=>{f===null&&d(Number(e))},disabled:f!==null,children:n.map((t,n)=>{let a=`q-${e}-opt-${String(n)}`;return(0,$.jsxs)(`label`,{htmlFor:a,className:r(`flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm`,`hover:bg-muted/60 transition-colors`,f!==null&&n===i&&`bg-success/10`,f!==null&&n===u&&n!==i&&`bg-destructive/10`),children:[(0,$.jsx)(ct,{value:String(n),id:a}),(0,$.jsx)(`span`,{children:t})]},a)})}),f===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{if(u===null)return;let t=u===i;p(t),o?.(t),Dt(c??e,e,{value:u,correct:t})},disabled:u===null,className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:f,explanation:a})]})}function jt({id:e,prompt:t,choices:n,correct:i,explanation:a,onGraded:o,persisted:s,quizId:c}){let l=`q-${e}-prompt`,[u,d]=J.useState(s?.value==null?new Set:new Set(s.value)),[f,p]=J.useState(s?.correct==null?null:s.correct),m=e=>{f===null&&d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`p`,{id:l,className:`mb-3 text-sm font-medium text-foreground`,children:t}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":l,className:`grid gap-2`,children:n.map((t,n)=>{let a=`q-${e}-chk-${String(n)}`,o=i.includes(n);return(0,$.jsxs)(`label`,{htmlFor:a,className:r(`flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm`,`hover:bg-muted/60 transition-colors`,f!==null&&o&&`bg-success/10`,f!==null&&u.has(n)&&!o&&`bg-destructive/10`),children:[(0,$.jsx)(yt,{id:a,checked:u.has(n),onCheckedChange:()=>m(n),disabled:f!==null}),(0,$.jsx)(`span`,{children:t})]},a)})}),f===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{if(u.size===0)return;let t=new Set(i),n=u.size===t.size&&[...u].every(e=>t.has(e));p(n),o?.(n),Dt(c??e,e,{value:[...u],correct:n})},disabled:u.size===0,className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:f,explanation:a})]})}function Mt({id:e,prompt:t,answer:n,tolerance:i=0,unit:a,explanation:o,onGraded:s,persisted:c,quizId:l}){let u=`q-${e}-input`,[d,f]=J.useState(c?.value==null?``:String(c.value)),[p,m]=J.useState(c?.correct==null?null:c.correct);return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`label`,{htmlFor:u,className:`mb-3 block text-sm font-medium text-foreground`,children:t}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{id:u,type:`text`,inputMode:`decimal`,value:d,onChange:e=>{p===null&&f(e.target.value)},disabled:p!==null,className:r(`h-9 w-32 rounded-md border border-input bg-background px-3 text-sm text-foreground`,`focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,`disabled:cursor-not-allowed disabled:opacity-50`)}),a&&(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:a})]}),p===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let t=parseFloat(d);if(isNaN(t))return;let r=Math.abs(t-n)<=i;m(r),s?.(r),Dt(l??e,e,{value:t,correct:r})},disabled:d.trim()===``||isNaN(parseFloat(d)),className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:p,explanation:o})]})}function Nt({id:e,title:t,questions:n}){let r=Et(e),[i,a]=J.useState(()=>{let e={};for(let[t,n]of Object.entries(r))e[t]={correct:n.correct};return e}),o=Object.values(i).filter(e=>e.correct).length,s=n.length,c=Object.keys(i).length===s,l=s>0?Math.round(o/s*100):0,u=e=>t=>{a(n=>({...n,[e]:{correct:t}}))},[d,f]=J.useState(0),p=()=>{Ot(e),a({}),f(e=>e+1)},m=t=>{let n=r[t.id];switch(t.type){case`single`:return(0,$.jsx)(At,{id:t.id,prompt:t.prompt,choices:t.choices,correct:t.correct,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);case`multiple`:return(0,$.jsx)(jt,{id:t.id,prompt:t.prompt,choices:t.choices,correct:t.correct,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);case`numeric`:return(0,$.jsx)(Mt,{id:t.id,prompt:t.prompt,answer:t.answer,tolerance:t.tolerance,unit:t.unit,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);default:return null}};return(0,$.jsxs)(`div`,{className:`not-prose my-6 rounded-lg border border-border bg-card/50 p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[t&&(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:t}),(0,$.jsxs)(`span`,{role:`status`,className:`ml-auto inline-flex items-center rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground`,children:[o,`/`,s]})]}),n.map(e=>(0,$.jsx)(J.Fragment,{children:m(e)},`${e.id}-${String(d)}`)),c&&(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg border border-border bg-muted/40 p-4`,children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,role:`status`,className:`text-center`,children:[(0,$.jsxs)(`p`,{className:`text-lg font-semibold text-foreground`,children:[o,`/`,s,` (`,l,`%)`]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:l>=70?`Well done!`:`Keep studying and try again.`})]}),(0,$.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:p,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":`true`}),`Reset`]})})]})]})}function Pt(e){let t=Et(e.id)[e.id];return(0,$.jsx)(At,{...e,persisted:t,quizId:e.id})}function Ft(e){let t=Et(e.id)[e.id];return(0,$.jsx)(jt,{...e,persisted:t,quizId:e.id})}function It(e){let t=Et(e.id)[e.id];return(0,$.jsx)(Mt,{...e,persisted:t,quizId:e.id})}export{Nt as QuizImpl,Nt as default,Ft as StandaloneMultipleChoice,It as StandaloneNumericQuestion,Pt as StandaloneSingleChoice};
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-FVqWAEVH.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{D as r,E as i,b as a,c as o,d as s,f as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,y}from"./useRenderElement-BQ1V91fw.js";import{A as b,C as ee,D as x,E as S,F as C,G as w,H as T,M as E,N as D,O as te,P as ne,S as O,T as k,U as re,_ as A,b as ie,c as j,d as M,g as N,h as P,j as F,k as ae,l as I,m as oe,o as se,p as ce,s as L,u as R,v as z,w as B,x as V,y as H}from"./book-links-POwyHx-T.js";import{t as U}from"./createLucideIcon-CSrh2MqE.js";var le=5,W=6,G=10,K=(e,t,n,r)=>(e.events=e.events||{},e.events[n+G]||(e.events[n+G]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+G](),delete e.events[n+G])}),ue=1e3,de=(e,t)=>K(e,n=>{let r=t(n);r&&e.events[W].push(r)},le,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[W]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[W])t();e.events[W]=[]}},ue)},()=>{e.listen=n,e.off=r}}),q=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);function fe(e){return E(e,`base-ui`)}var J=e(t(),1);function pe(e,t){let n=J.useRef(e),r=m(t);c(()=>{n.current!==e&&r(n.current)},[e,r]),c(()=>{n.current=e},[e])}var me=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),he={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ge={disabled:!1,...Y},_e={valid(e){return e===null?null:e?{[me.valid]:``}:{[me.invalid]:``}}},X=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),ve={checked(e){return e?{[X.checked]:``}:{[X.unchecked]:``}},...C,..._e},ye=`data-composite-item-active`,be=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xe(){return J.useContext(be)}var Se=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Ce(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:l,elementsRef:u,labelsRef:d,nextIndexRef:f}=xe(),p=J.useRef(-1),[m,h]=J.useState(a??(i===Se.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=J.useRef(null),_=J.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(u.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,u,d,t,r]);return c(()=>{if(a!=null)return;let e=g.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),c(()=>{if(a==null)return l(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[a,l,h]),{ref:_,index:m}}function we(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=u(),{ref:i,index:a}=Ce(e),o=n===a,s=J.useRef(null),c=p(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Te(e){let{render:t,className:n,style:r,state:i=h,props:a=f,refs:o=f,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:p}=we({metadata:s});return _(l,e,{state:i,ref:[...o,p],props:[d,...a,u],stateAttributesMapping:c})}var Z={invalid:void 0,name:void 0,validityData:{state:he,errors:[],error:``,value:``,initialValue:null},setValidityData:l,disabled:void 0,touched:Y.touched,setTouched:l,dirty:Y.dirty,setDirty:l,filled:Y.filled,setFilled:l,focused:Y.focused,setFocused:l,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ge,markedDirtyRef:{current:!1},registerFieldControl:l,validation:{getValidationProps:(e,t=h)=>t,inputRef:{current:null},registerInput:l,commit:async()=>{},change:l}},Ee=J.createContext(Z);function De(e=!0){let t=J.useContext(Ee);if(t.setValidityData===l&&!e)throw Error(v(28));return t}var Oe=J.createContext({disabled:!1});function ke(){return J.useContext(Oe)}var Ae=J.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:e=>e});function je(){return J.useContext(Ae)}function Me(e,t,n,r=!0,i){let[a,o]=J.useState(),s=fe(i?`${i}-label`:void 0),l=e??t??a;return c(()=>{let i=e||t||!r?void 0:Q(n.current,s);a!==i&&o(i)}),l}function Q(e,t){let n=Ne(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Ne(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function Pe(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=je(),s=fe(t),u=n?i:void 0,f=d(()=>Symbol(`labelable-control`)),p=J.useRef(!1),h=J.useRef(t!=null),g=m(()=>{!p.current||o===l||(p.current=!1,o(f.current,void 0))});return c(()=>{if(o===l)return;let e;if(n){let n=r?.current;e=a(n)&&n.closest(`label`)!=null?t??null:u??s}else if(t!=null)h.current=!0,e=t;else if(h.current)e=s;else{g();return}if(e===void 0){g();return}p.current=!0,o(f.current,e)},[t,r,u,o,n,s,f,g]),J.useEffect(()=>g,[g]),i??s}var Fe=J.createContext(void 0);function Ie(){return J.useContext(Fe)}function Le(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Re=J.createContext(void 0);function ze(){let e=J.useContext(Re);if(e===void 0)throw Error(v(52));return e}var $=n(),Be=J.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:u,inputRef:d,nativeButton:f=!1,id:v,style:b,...ee}=e,x=Ie(),{disabled:S,readOnly:C,required:w,form:T,checkedValue:E,touched:O=!1,validation:k,name:re}=x??{},A=x?.setCheckedValue??l,ie=x?.setTouched??l,j=x?.registerControlRef??l,M=x?.registerInputRef??l,{setTouched:N,setFilled:P,state:F,disabled:I}=De(),oe=ke(),{labelId:se,getDescriptionProps:ce}=je(),L=I||oe.disabled||S||i,R=C||a,z=w||o,B=T,V=x?E===u:u===``,H=J.useRef(null),U=J.useRef(null),le=m(e=>{e&&j(e,L)}),W=p(d,U,M);c(()=>{U.current?.checked&&P(!0)},[P]),c(()=>{if(U.current){if(L&&V){M(null);return}H.current&&j(H.current,L),M(U.current)}},[V,L,j,M]);let G=fe(),K=Pe({id:v,implicit:!1,controlRef:H}),ue=f?void 0:K,de=Me(s,se,U,!f,ue),q={role:`radio`,"aria-checked":V,"aria-required":z||void 0,"aria-readonly":R||void 0,"aria-labelledby":de,[ye]:V?``:void 0,id:f?K:G,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||L||R)return;e.preventDefault();let t=U.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))},onFocus(e){e.defaultPrevented||L||R||!O||(U.current?.click(),ie(!1))}},{getButtonProps:pe,buttonRef:me}=g({disabled:L,native:f,composite:!1}),he={type:`radio`,ref:W,form:B,id:ue,name:re,tabIndex:-1,style:re?ae:te,"aria-hidden":!0,...u===void 0?h:{value:Le(u)},disabled:L,checked:V,required:z,readOnly:R,onChange(e){if(e.nativeEvent.defaultPrevented||L||R||u===void 0)return;let t=D(ne,e.nativeEvent);A(u,t),!t.isCanceled&&N(!0)},onFocus(){H.current?.focus()}},Y=J.useMemo(()=>({...F,required:z,disabled:L,readOnly:R,checked:V}),[F,L,R,V,z]),ge=Y,_e=x!==void 0,X=[t,H,me,le],be=[q,ee,pe,ce,k?e=>k.getValidationProps(L,e):h],xe=_(`span`,e,{enabled:!_e,state:Y,ref:X,props:be,stateAttributesMapping:ve});return(0,$.jsxs)(Re.Provider,{value:ge,children:[_e?(0,$.jsx)(Te,{tag:`span`,render:n,className:r,style:b,state:Y,refs:X,props:be,stateAttributesMapping:ve}):xe,(0,$.jsx)(`input`,{...he,suppressHydrationWarning:!0})]})}),Ve=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ze(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=O(c),f={...s,transitionStatus:u},p=J.useRef(null),m=a||l,h=_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:ve});return V({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null});function He({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(t);return[i?e:a,J.useCallback(e=>{i||o(e)},[])]}function Ue(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=m(i),o=J.useRef(0),s=d(Ge).current,l=d(We).current,[u,f]=J.useState(0),p=J.useRef(u),h=m((e,t)=>{l.set(e,t??null),p.current+=1,f(p.current)}),g=m(e=>{l.delete(e),p.current+=1,f(p.current)}),_=J.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(Ke).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);c(()=>{if(typeof MutationObserver!=`function`||_.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(p.current+=1,f(p.current))});return _.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[_]),c(()=>{p.current===u&&(n.current.length!==_.size&&(n.current.length=_.size),r&&r.current.length!==_.size&&(r.current.length=_.size),o.current=_.size),a(_)},[a,_,n,r,u]),c(()=>()=>{n.current=[]},[n]),c(()=>()=>{r&&(r.current=[])},[r]);let v=m(e=>(s.add(e),()=>{s.delete(e)}));c(()=>{s.forEach(e=>e(_))},[s,_]);let y=J.useMemo(()=>({register:h,unregister:g,subscribeMapChange:v,elementsRef:n,labelsRef:r,nextIndexRef:o}),[h,g,v,n,r,o]);return(0,$.jsx)(be.Provider,{value:y,children:t})}function We(){return new Map}function Ge(){return new Set}function Ke(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function qe(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var Je=[];function Ye(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:h=Je}=e,[g,_]=J.useState(0),v=r!=null,y=J.useRef(null),b=p(y,l),C=J.useRef([]),w=J.useRef(!1),T=o??g,E=m((e,t=!1)=>{if((s??_)(e),t){let t=C.current[e];ie(y.current,t,a,n)}}),D=m(e=>{if(e.size===0||w.current)return;w.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)E(i);else if(x(t,T,f)){let e=ee(t,{disabledIndices:f});S(t,e)||E(e)}ie(y.current,r,a,n)});c(()=>{if(f==null||o!=null||!w.current)return;let e=C.current;if(x(e,T,f)){let t=ee(e,{disabledIndices:f});S(e,t)||E(t)}},[f,o,T,C,E]);let te=m((e,t,n)=>i?i(e,t,n,C):n),ne=m(e=>{let o=u?M:L;if(!o.has(e.key)||Xe(e,h)||!y.current)return;let s=a===`rtl`,c=s?j:I,l={horizontal:c,vertical:se,both:c}[n],p=s?I:j,m={horizontal:p,vertical:R,both:p}[n],g=F(e.nativeEvent);if(g!=null&&H(g)&&!qe(g)){let t=g.selectionStart,n=g.selectionEnd,r=g.value??``;if(t==null||e.shiftKey||t!==n||e.key!==m&&t<r.length||e.key!==l&&t>0)return}let _=T,b=k(C,f),x=B(C,f);r!=null&&(_=r({disabledIndices:f,elementsRef:C,event:e,highlightedIndex:T,loopFocus:t,maxIndex:x,minIndex:b,onLoop:te,orientation:n,rtl:s}));let w={horizontal:[c],vertical:[se],both:[c,se]}[n],D={horizontal:[p],vertical:[R],both:[p,R]}[n],ne=v?o:{horizontal:u?oe:ce,vertical:u?z:A,both:o}[n];u&&(e.key===`Home`?_=b:e.key===`End`&&(_=x)),_===T&&(w.includes(e.key)||D.includes(e.key))&&(t&&_===x&&w.includes(e.key)?(_=b,i&&(_=i(e,T,_,C))):t&&_===b&&D.includes(e.key)?(_=x,i&&(_=i(e,T,_,C))):_=ee(C.current,{startingIndex:_,decrement:D.includes(e.key),disabledIndices:f})),_!==T&&!S(C.current,_)&&(d&&e.stopPropagation(),ne.has(e.key)&&e.preventDefault(),E(_,!0),queueMicrotask(()=>{C.current[_]?.focus()}))});return{props:{ref:b,onFocus(e){let t=y.current,n=F(e.nativeEvent);!t||n==null||!H(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:ne},highlightedIndex:T,onHighlightedIndexChange:E,elementsRef:C,disabledIndices:f,onMapChange:D,relayKeyboardEvent:ne}}function Xe(e,t){for(let n of P.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var Ze=J.createContext(void 0);function Qe(){return J.useContext(Ze)?.direction??`ltr`}function $e(e){let{render:t,className:n,style:r,refs:i=f,props:a=f,state:s=h,stateAttributesMapping:c,highlightedIndex:l,onHighlightedIndexChange:u,orientation:d,grid:p,loopFocus:m,onLoop:g,enableHomeAndEndKeys:v,onMapChange:y,stopEventPropagation:b=!0,rootRef:ee,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:te,elementsRef:ne,onMapChange:O,relayKeyboardEvent:k}=Ye({grid:p,loopFocus:m,onLoop:g,orientation:d,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:ee,stopEventPropagation:b,enableHomeAndEndKeys:v,direction:Qe(),disabledIndices:x,modifierKeys:S}),re=_(w,e,{state:s,ref:i,props:[E,...a,T],stateAttributesMapping:c}),A=J.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:te,highlightItemOnHover:C,relayKeyboardEvent:k}),[D,te,C,k]);return(0,$.jsx)(o.Provider,{value:A,children:(0,$.jsx)(Ue,{elementsRef:ne,onMapChange:e=>{y?.(e),O(e)},children:re})})}function et(e,t,n,r,i=!0,a){let{registerFieldControl:o}=De(),s=J.useRef(null);s.current||=Symbol(),c(()=>{let c=s.current;if(!(!c||!i))return o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}),()=>{o(c,void 0)}},[e,i,r,t,a,o,n])}var tt=J.createContext(void 0);function nt(e=!1){let t=J.useContext(tt);if(!t&&!e)throw Error(v(86));return t}var rt=J.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function it(){return J.useContext(rt)}var at=[N],ot=J.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:h,...g}=e,{setTouched:_,setFocused:v,validationMode:y,name:ee,disabled:x,state:S,validation:C,setDirty:w,setFilled:T,validityData:E}=De(),{labelId:D}=je(),{clearErrors:te}=it(),ne=nt(!0),O=x||i,k=ee??d,re=fe(p),[A,ie]=He({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[j,M]=J.useState(!1),N=m((e,t)=>{s?.(e,t),!t.isCanceled&&ie(e)}),P=J.useRef(null),F=J.useRef(null),ae=J.useRef(null);function I(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),F.current=e,C.inputRef.current=e,t}let oe=m((e,t=!1)=>{if(e){if(t){P.current===e&&(P.current=null);return}P.current??=e}}),se=m(e=>{if(!e||e.disabled)return;ae.current||=e;let t=F.current;if(e.checked||t==null||t.disabled)return I(e)}),ce=m(()=>{let e=F.current;return!e||e.disabled||!e.checked?null:A??null});et(P,re,A??null,ce,!O,d),pe(A,()=>{te(k),w(A!==E.initialValue),T(A!=null),C.change(A);let e=ae.current;A==null&&e&&!e.disabled&&I(e)});let L=g[`aria-labelledby`]??D??ne?.legendId,R={...S,disabled:O??!1,required:o??!1,readOnly:a??!1},z=J.useMemo(()=>({...S,checkedValue:A,disabled:O,form:u,validation:C,name:k,readOnly:a,registerControlRef:oe,registerInputRef:se,required:o,setCheckedValue:N,setTouched:M,touched:j}),[A,O,u,C,S,k,a,oe,se,o,N,M,j]),B={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":O||void 0,"aria-readonly":a||void 0,"aria-labelledby":L,onFocus(){v(!0)},onBlur(e){b(e.currentTarget,e.relatedTarget)||(_(!0),v(!1),y===`onBlur`&&C.commit(A))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(M(!0),v(!0))}};return(0,$.jsx)(Fe.Provider,{value:z,children:(0,$.jsx)($e,{render:n,className:r,style:h,state:R,props:[B,g,e=>C.getValidationProps(O??!1,e)],refs:[t],stateAttributesMapping:_e,enableHomeAndEndKeys:!1,modifierKeys:at})})});function st({className:e,...t}){return(0,$.jsx)(ot,{"data-slot":`radio-group`,className:r(`grid w-full gap-2`,e),...t})}function ct({className:e,...t}){return(0,$.jsx)(Be,{"data-slot":`radio-group-item`,className:r(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,$.jsx)(Ve,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,$.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function lt(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var ut=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function dt(e){return J.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[ut.checked]:``}:{[ut.unchecked]:``}},..._e}),[e.indeterminate])}var ft=J.createContext(void 0);function pt(e=!0){let t=J.useContext(ft);if(t===void 0&&!e)throw Error(v(3));return t}var mt=J.createContext(void 0);function ht(){let e=J.useContext(mt);if(e===void 0)throw Error(v(14));return e}var gt=`data-parent`,_t=J.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:u,id:f,indeterminate:m=!1,inputRef:v,name:b,onCheckedChange:ee,parent:x=!1,readOnly:S=!1,render:C,required:w=!1,uncheckedValue:T,value:E,nativeButton:O=!1,style:k,...re}=e,{clearErrors:A}=it(),{disabled:ie,name:j,setDirty:M,setFilled:N,setFocused:P,setTouched:F,state:I,validationMode:oe,validityData:se,validation:ce}=De(),L=ke(),{labelId:R,controlId:z,registerControlId:B,getDescriptionProps:V}=je(),H=pt(),U=H?.parent,le=U&&H.allValues,W=ie||L.disabled||H?.disabled||o,G=j??b,K=E??G,ue=fe(),de=fe(),q=z;le?q=x?de:`${U.id}-${K}`:f&&(q=f);let me={};le&&(x?me=H.parent.getParentProps():K&&(me=H.parent.getChildProps(K)));let{checked:he=n,indeterminate:Y=m,onCheckedChange:ge,..._e}=me,X=H?.value,ve=H?.setValue,ye=H?.defaultValue,be=J.useRef(null),xe=d(()=>Symbol(`checkbox-control`)),Se=J.useRef(!1),{getButtonProps:Ce,buttonRef:we}=g({disabled:W,native:O}),Te=H?.validation??ce,[Z,Ee]=He({controlled:K&&X&&!x?X.includes(K):he,default:K&&ye&&!x?ye.includes(K):i,name:`Checkbox`,state:`checked`}),Oe=le?!!he:Z,Ae=le&&Y||m;c(()=>{B!==l&&(Se.current=!0,B(xe.current,q))},[q,B,xe]),J.useEffect(()=>{let e=xe.current;return()=>{!Se.current||B===l||(Se.current=!1,B(e,void 0))}},[B,xe]),et(be,ue,Z,void 0,!H&&!W,b);let Q=J.useRef(null),Ne=p(v,Q,Te.inputRef,Te.registerInput),Pe=Me(a,R,Q,!O,q??void 0);c(()=>{Q.current&&(Q.current.indeterminate=Ae,Z&&N(!0))},[Z,Ae,N]),pe(Z,()=>{H||(A(G),N(Z),M(Z!==se.initialValue),Te.change(Z))});let Fe=s({checked:Z,disabled:W,form:u,name:x?void 0:G,id:O?void 0:q??void 0,required:w,ref:Ne,style:G?ae:te,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(S){e.preventDefault();return}let t=e.currentTarget.checked,n=D(ne,e.nativeEvent);if(ee?.(t,n),!n.isCanceled&&(ge?.(t,n),!n.isCanceled&&(Ee(t),K&&X&&ve&&!x&&!le))){let e=t?[...X,K]:X.filter(e=>e!==K);ve(e,n)}},onFocus(){be.current?.focus()}},E===void 0?h:{value:(H?Z&&E:E)||``},V,e=>Te.getValidationProps(W,e));J.useEffect(()=>{if(!U||!K)return;let e=U.disabledStatesRef.current;return e.set(K,W),()=>{e.delete(K)}},[U,W,K]);let Ie=J.useMemo(()=>({...I,checked:Oe,disabled:W,readOnly:S,required:w,indeterminate:Ae}),[I,Oe,W,S,w,Ae]),Le=dt(Ie),Re=_(`span`,e,{state:Ie,ref:[we,be,t,H?.registerControlRef],props:[{id:O?q??void 0:ue,role:`checkbox`,"aria-checked":Ae?`mixed`:Oe,"aria-readonly":S||void 0,"aria-required":w||void 0,"aria-labelledby":Pe,[gt]:x?``:void 0,onFocus(){W||P(!0)},onBlur(){let e=Q.current;e&&(F(!0),P(!1),oe===`onBlur`&&Te.commit(H?X:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),y(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||lt(t)?.click()})},onClick(e){if(S||W)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(y(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},re,_e,Ce,V,e=>Te.getValidationProps(W,e)],stateAttributesMapping:Le});return(0,$.jsxs)(mt.Provider,{value:Ie,children:[Re,!Z&&!H&&G&&!x&&T!==void 0&&(0,$.jsx)(`input`,{type:`hidden`,form:u,name:G,value:T,disabled:W}),(0,$.jsx)(`input`,{...Fe,suppressHydrationWarning:!0})]})}),vt=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ht(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=O(c),f=J.useRef(null),p={...s,transitionStatus:u};V({open:c,ref:f,onComplete(){c||d(!1)}});let m={...dt(s),...C,..._e},h=a||l,g=_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function yt({className:e,...t}){return(0,$.jsx)(_t,{"data-slot":`checkbox`,className:r(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,$.jsx)(vt,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,$.jsx)(i,{})})})}var bt=e=>e,xt={},St={addEventListener(){},removeEventListener(){}};function Ct(){try{return typeof localStorage<`u`}catch{return!1}}Ct()&&(xt=localStorage),typeof window<`u`&&(St={addEventListener(e,t,n){window.addEventListener(`storage`,t),window.addEventListener(`pageshow`,n)},removeEventListener(e,t,n){window.removeEventListener(`storage`,t),window.removeEventListener(`pageshow`,n)}});function wt(e,t=void 0,n={}){let r=n.encode||bt,i=n.decode||bt,a=w(t),o=a.set;a.set=t=>{t===void 0?delete xt[e]:xt[e]=r(t),o(t)};function s(t){t.key===e?t.newValue===null?o(void 0):o(i(t.newValue)):xt[e]||o(void 0)}function c(){a.set(xt[e]?i(xt[e]):t)}return de(a,()=>{if(c(),n.listen!==!1)return St.addEventListener(e,s,c),()=>{St.removeEventListener(e,s,c)}}),a}var Tt=wt(`diffbook:quiz`,{},{encode:JSON.stringify,decode:JSON.parse});function Et(e){return Tt.get()[e]??{}}function Dt(e,t,n){let r={...Tt.get()},i={...r[e]??{}};i[t]=n,r[e]=i,Tt.set(r)}function Ot(e){let t={...Tt.get()};delete t[e],Tt.set(t)}function kt({correct:e,explanation:t}){return e===null?null:(0,$.jsxs)(`div`,{"aria-live":`polite`,role:`status`,className:`mt-3`,children:[(0,$.jsx)(`div`,{className:r(`flex items-center gap-2 text-sm font-medium`,e?`text-success`:`text-destructive`),children:e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:`Correct`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:`Incorrect`})]})}),t&&(0,$.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:t})]})}function At({id:e,prompt:t,choices:n,correct:i,explanation:a,onGraded:o,persisted:s,quizId:c}){let l=`q-${e}-prompt`,[u,d]=J.useState(s?.value==null?null:s.value),[f,p]=J.useState(s?.correct==null?null:s.correct);return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`p`,{id:l,className:`mb-3 text-sm font-medium text-foreground`,children:t}),(0,$.jsx)(st,{"aria-labelledby":l,value:u===null?``:String(u),onValueChange:e=>{f===null&&d(Number(e))},disabled:f!==null,children:n.map((t,n)=>{let a=`q-${e}-opt-${String(n)}`;return(0,$.jsxs)(`label`,{htmlFor:a,className:r(`flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm`,`hover:bg-muted/60 transition-colors`,f!==null&&n===i&&`bg-success/10`,f!==null&&n===u&&n!==i&&`bg-destructive/10`),children:[(0,$.jsx)(ct,{value:String(n),id:a}),(0,$.jsx)(`span`,{children:t})]},a)})}),f===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{if(u===null)return;let t=u===i;p(t),o?.(t),Dt(c??e,e,{value:u,correct:t})},disabled:u===null,className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:f,explanation:a})]})}function jt({id:e,prompt:t,choices:n,correct:i,explanation:a,onGraded:o,persisted:s,quizId:c}){let l=`q-${e}-prompt`,[u,d]=J.useState(s?.value==null?new Set:new Set(s.value)),[f,p]=J.useState(s?.correct==null?null:s.correct),m=e=>{f===null&&d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`p`,{id:l,className:`mb-3 text-sm font-medium text-foreground`,children:t}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":l,className:`grid gap-2`,children:n.map((t,n)=>{let a=`q-${e}-chk-${String(n)}`,o=i.includes(n);return(0,$.jsxs)(`label`,{htmlFor:a,className:r(`flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm`,`hover:bg-muted/60 transition-colors`,f!==null&&o&&`bg-success/10`,f!==null&&u.has(n)&&!o&&`bg-destructive/10`),children:[(0,$.jsx)(yt,{id:a,checked:u.has(n),onCheckedChange:()=>m(n),disabled:f!==null}),(0,$.jsx)(`span`,{children:t})]},a)})}),f===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{if(u.size===0)return;let t=new Set(i),n=u.size===t.size&&[...u].every(e=>t.has(e));p(n),o?.(n),Dt(c??e,e,{value:[...u],correct:n})},disabled:u.size===0,className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:f,explanation:a})]})}function Mt({id:e,prompt:t,answer:n,tolerance:i=0,unit:a,explanation:o,onGraded:s,persisted:c,quizId:l}){let u=`q-${e}-input`,[d,f]=J.useState(c?.value==null?``:String(c.value)),[p,m]=J.useState(c?.correct==null?null:c.correct);return(0,$.jsxs)(`div`,{className:`not-prose my-4 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsx)(`label`,{htmlFor:u,className:`mb-3 block text-sm font-medium text-foreground`,children:t}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{id:u,type:`text`,inputMode:`decimal`,value:d,onChange:e=>{p===null&&f(e.target.value)},disabled:p!==null,className:r(`h-9 w-32 rounded-md border border-input bg-background px-3 text-sm text-foreground`,`focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,`disabled:cursor-not-allowed disabled:opacity-50`)}),a&&(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:a})]}),p===null&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let t=parseFloat(d);if(isNaN(t))return;let r=Math.abs(t-n)<=i;m(r),s?.(r),Dt(l??e,e,{value:t,correct:r})},disabled:d.trim()===``||isNaN(parseFloat(d)),className:`mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:`Check`}),(0,$.jsx)(kt,{correct:p,explanation:o})]})}function Nt({id:e,title:t,questions:n}){let r=Et(e),[i,a]=J.useState(()=>{let e={};for(let[t,n]of Object.entries(r))e[t]={correct:n.correct};return e}),o=Object.values(i).filter(e=>e.correct).length,s=n.length,c=Object.keys(i).length===s,l=s>0?Math.round(o/s*100):0,u=e=>t=>{a(n=>({...n,[e]:{correct:t}}))},[d,f]=J.useState(0),p=()=>{Ot(e),a({}),f(e=>e+1)},m=t=>{let n=r[t.id];switch(t.type){case`single`:return(0,$.jsx)(At,{id:t.id,prompt:t.prompt,choices:t.choices,correct:t.correct,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);case`multiple`:return(0,$.jsx)(jt,{id:t.id,prompt:t.prompt,choices:t.choices,correct:t.correct,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);case`numeric`:return(0,$.jsx)(Mt,{id:t.id,prompt:t.prompt,answer:t.answer,tolerance:t.tolerance,unit:t.unit,explanation:t.explanation,onGraded:u(t.id),persisted:n,quizId:e},`${t.id}-${String(d)}`);default:return null}};return(0,$.jsxs)(`div`,{className:`not-prose my-6 rounded-lg border border-border bg-card/50 p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[t&&(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:t}),(0,$.jsxs)(`span`,{role:`status`,className:`ml-auto inline-flex items-center rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground`,children:[o,`/`,s]})]}),n.map(e=>(0,$.jsx)(J.Fragment,{children:m(e)},`${e.id}-${String(d)}`)),c&&(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg border border-border bg-muted/40 p-4`,children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,role:`status`,className:`text-center`,children:[(0,$.jsxs)(`p`,{className:`text-lg font-semibold text-foreground`,children:[o,`/`,s,` (`,l,`%)`]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:l>=70?`Well done!`:`Keep studying and try again.`})]}),(0,$.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:p,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":`true`}),`Reset`]})})]})]})}function Pt(e){let t=Et(e.id)[e.id];return(0,$.jsx)(At,{...e,persisted:t,quizId:e.id})}function Ft(e){let t=Et(e.id)[e.id];return(0,$.jsx)(jt,{...e,persisted:t,quizId:e.id})}function It(e){let t=Et(e.id)[e.id];return(0,$.jsx)(Mt,{...e,persisted:t,quizId:e.id})}export{Nt as QuizImpl,Nt as default,Ft as StandaloneMultipleChoice,It as StandaloneNumericQuestion,Pt as StandaloneSingleChoice};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DREnUpxT.js";import{n as t}from"./index-DcbQMucQ.js";import{t as n}from"./book-links-oBD5_TD9.js";import{n as r,t as i}from"./book-view-D8DLuZwr.js";var a=e();function o(){let{book:e,tree:o,rendered:s}=t.useLoaderData();if(!e.config)return null;let c=n(e.mode,e.book.slug),l=e.mode===`registry`?`/`:void 0;return(0,a.jsx)(r,{config:e.config,tree:o,pages:i(o),links:c,page:s.page,html:s.html,toc:s.toc,catalogHome:l})}export{o as component};
1
+ import{t as e}from"./jsx-runtime-DREnUpxT.js";import{n as t}from"./index-fwL8CzeX.js";import{t as n}from"./book-links-POwyHx-T.js";import{n as r,t as i}from"./book-view-B1VhlTqp.js";var a=e();function o(){let{book:e,tree:o,rendered:s}=t.useLoaderData();if(!e.config)return null;let c=n(e.mode,e.book.slug),l=e.mode===`registry`?`/`:void 0;return(0,a.jsx)(r,{config:e.config,tree:o,pages:i(o),links:c,page:s.page,html:s.html,toc:s.toc,catalogHome:l})}export{o as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DREnUpxT.js";import{a as t}from"./index-DcbQMucQ.js";import{t as n}from"./book-links-oBD5_TD9.js";import{n as r,t as i}from"./book-view-D8DLuZwr.js";var a=e();function o(){let{book:e,tree:o,rendered:s}=t.useLoaderData();if(!e.config)return null;let c=n(e.mode,e.book.slug);return(0,a.jsx)(r,{config:e.config,tree:o,pages:i(o),links:c,page:s.page,html:s.html,toc:s.toc})}export{o as component};
1
+ import{t as e}from"./jsx-runtime-DREnUpxT.js";import{a as t}from"./index-fwL8CzeX.js";import{t as n}from"./book-links-POwyHx-T.js";import{n as r,t as i}from"./book-view-B1VhlTqp.js";var a=e();function o(){let{book:e,tree:o,rendered:s}=t.useLoaderData();if(!e.config)return null;let c=n(e.mode,e.book.slug);return(0,a.jsx)(r,{config:e.config,tree:o,pages:i(o),links:c,page:s.page,html:s.html,toc:s.toc})}export{o as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DREnUpxT.js";import{r as t}from"./index-DcbQMucQ.js";import{n,t as r}from"./book-links-oBD5_TD9.js";import{n as i,t as a}from"./book-view-D8DLuZwr.js";import{n as o,t as s}from"./unavailable-YWEROYT2.js";var c=e();function l(){let e=t.useLoaderData();if(e.kind===`document`){let{book:t,tree:n,rendered:o}=e;if(!t.config)return null;let s=r(t.mode,t.book.slug),l=t.mode===`registry`?`/`:void 0;return(0,c.jsx)(i,{config:t.config,tree:n,pages:a(n),links:s,page:o.page,html:o.html,toc:o.toc,catalogHome:l})}let{book:l,tree:u}=e;if(l.unavailable)return(0,c.jsx)(s,{message:l.unavailable});if(!l.config)return null;let d=r(l.mode,l.book.slug),f=l.mode===`registry`?`/`:void 0;return l.config.mode===`book`?(0,c.jsx)(o,{config:l.config,tree:u,links:d,catalogHome:f}):(0,c.jsx)(n,{config:l.config,tree:u,links:d,currentPath:d.home,catalogHome:f})}export{l as component};
1
+ import{t as e}from"./jsx-runtime-DREnUpxT.js";import{r as t}from"./index-fwL8CzeX.js";import{n,t as r}from"./book-links-POwyHx-T.js";import{n as i,t as a}from"./book-view-B1VhlTqp.js";import{n as o,t as s}from"./unavailable-zzVFaXGP.js";var c=e();function l(){let e=t.useLoaderData();if(e.kind===`document`){let{book:t,tree:n,rendered:o}=e;if(!t.config)return null;let s=r(t.mode,t.book.slug),l=t.mode===`registry`?`/`:void 0;return(0,c.jsx)(i,{config:t.config,tree:n,pages:a(n),links:s,page:o.page,html:o.html,toc:o.toc,catalogHome:l})}let{book:l,tree:u}=e;if(l.unavailable)return(0,c.jsx)(s,{message:l.unavailable});if(!l.config)return null;let d=r(l.mode,l.book.slug),f=l.mode===`registry`?`/`:void 0;return l.config.mode===`book`?(0,c.jsx)(o,{config:l.config,tree:u,links:d,catalogHome:f}):(0,c.jsx)(n,{config:l.config,tree:u,links:d,currentPath:d.home,catalogHome:f})}export{l as component};